Here, we provide the WALLET_TYPE.ETHERSPOT to fetch the Smart Account addresses associated with the EOA.
In the response, we will see the addresses associated with the EOA for Etherspot's Smart Accounts. No Smart Account may be deployed, so it will only generate and return the Smart Account address, mentioning its deployment status and the walletIndex.
Example response when no Smart Account is deployed!
const { ethers,BigNumber } =require("ethers");const {Migrator,WALLET_TYPE}=require("@aarc-xyz/migrator");let provider =newethers.providers.JsonRpcProvider("YOUR_RPC_URL");let signer =newethers.Wallet("YOUR_PRIVATE_KEY", provider);let eoaAddress =signer.address;let aarcSDK =newMigrator({ rpcUrl:"YOUR_RPC_URL", chainId:80001,// Mumbai Testnet apiKey:"YOUR_AARC_API_KEY"});asyncfunctionmain() {try {constsmartWalletAddresses=awaitaarcSDK.getSmartWalletAddresses(WALLET_TYPE.ETHERSPOT, eoaAddress );console.log(' smartWalletAddresses ', smartWalletAddresses); } catch (error) {console.error(' error ', error); }try {constresponse=awaitaarcSDK.transferNativeAndDeploy({ walletType:WALLET_TYPE.ETHERSPOT, owner: eoaAddress, receiver:"0xa1A6dd310A45C4EDB53BF6512317093F820cbA65",//Change the receiver address to the SA address signer: signer, deploymentWalletIndex:0,// Change the index to the index of the SA amount:BigNumber.from("10000")._hex // Change the string to the amount you want to transfer });console.log("Transfer and Deploy Response: ", response); }catch(error){console.error(' error ', error); }}main();
nodesrc/index.js
You will see the following response after deploying the Etherspot Smart Wallet.