Installing packages
Prerequisite You should have installed Node.js (version 18.10.0 or
higher).
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
An introduction to Account Abstraction on Flare using the Etherspot Prime SDK
npm i @etherspot/prime-sdk --save
yarn add @etherspot/prime-sdk
import { PrimeSdk } from '@etherspot/prime-sdk';
const randomWallet = ethers.Wallet.createRandom();
setEoaPrivateKey(randomWallet.privateKey);
const primeSdk = new PrimeSdk({ privateKey: privateKey}, { chainId: 114, bundlerProvider: new EtherspotBundler(114, bundlerApiKey) });
const address: string = await primeSdk.getCounterFactualAddress();
console.log(address);
const sendFunds = async () => {
const primeSdk = new PrimeSdk({ privateKey: eoaPrivateKey}, { chainId: 114, bundlerProvider: new EtherspotBundler(114, bundlerApiKey) });
// clear the transaction batch
await primeSdk.clearUserOpsFromBatch();
// add transactions to the batch
const transactionBatch = await primeSdk.addUserOpsToBatch({to: destinationAddress, value: ethers.utils.parseEther(destinationAddress)});
// estimate transactions added to the batch and get the fee data for the UserOp
const op = await primeSdk.estimate();
// sign the UserOp and send to bundler
const uoHash = await primeSdk.send(op);
console.log(`UserOpHash: ${uoHash}`);
}
