//Blockquote
const accountAbstractionProvider = new AccountAbstractionProvider({
config: {
chainConfig,
bundlerConfig: {
// Get the pimlico API Key from dashboard.pimlico.io
url: https://api.pimlico.io/v2/${chainId}/rpc?apikey=${pimlicoAPIKey}
,
paymasterContext: {
// USDC address on Ethereum Sepolia
token: “0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238”,
},
},
smartAccountInit: new SafeSmartAccount(),
paymasterConfig: {
// Get the pimlico API Key from dashboard.pimlico.io
url: https://api.pimlico.io/v2/${chainId}/rpc?apikey=${pimlicoAPIKey}
,
},
},
});
//Blockquote
// IMP START - SDK Initialization
const privateKeyProvider = new EthereumPrivateKeyProvider({
config: { chainConfig },
});
//Blockquote
const web3AuthOptions: Web3AuthOptions = {
clientId,
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
privateKeyProvider,
// Use the account abstraction provider we configured earlier
accountAbstractionProvider,
// This will allow you to use EthereumPrivateKeyProvider for
// external wallets, while use the AccountAbstractionProvider
// for Web3Auth embedded wallets.
useAAWithExternalWallet: false,
};
const web3auth = new Web3Auth(web3AuthOptions);
then I send the transaction
// Use the same accountAbstractionProvider we created earlier.
const bundlerClient = accountAbstractionProvider.bundlerClient!;
const smartAccount = accountAbstractionProvider.smartAccount!;
// Pimlico’s ERC-20 Paymaster address
const pimlicoPaymasterAddress = “0x0000000000000039cd5e8aE05257CE51C473ddd1”;
// USDC address on Ethereum Sepolia
const usdcAddress = “0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238”;
// 0.00001 ETH in WEI format
const amount = 10000000000000n;
// 10 USDC in WEI format. Since USDC has 6 decimals, 10 * 10^6
const approvalAmount = 1000000n;
const userOpHash = await bundlerClient.sendUserOperation({
account: smartAccount,
calls: [
// Approve USDC on Sepolia chain for Pimlico’s ERC 20 Paymaster
{
to: usdcAddress,
abi: parseAbi([“function approve(address,uint)”]),
functionName: “approve”,
args: [pimlicoPaymasterAddress, approvalAmount],
},
{
to: “0xf63d71b8E48AAdbdcf49bfF0CB849eC98efc4849”,
value: amount,
data: “0x”,
},
{
to: “0xf63d71b8E48AAdbdcf49bfF0CB849eC98efc4849”,
value: amount,
data: “0x”,
},
],
});
// Retrieve user operation receipt
const receipt = await bundlerClient.waitForUserOperationReceipt({
hash: userOpHash,
});