Here, we provide the WALLET_TYPE.SAFE to fetch the Smart Account addresses associated with the EOA.
In the response, we will see the addresses associated with the EOA for Safe'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:11155111,// Sepolia Testnet apiKey:"YOUR_AARC_API_KEY"});asyncfunctionmain() {try {// get all the smart wallets associated with the eoaAddressconstsmartWalletAddresses=awaitaarcSDK.getSmartWalletAddresses(WALLET_TYPE.SAFE, eoaAddress );console.log(' smartWalletAddresses ', smartWalletAddresses); } catch (error) {console.error(' error ', error); }try {constresponse=awaitaarcSDK.transferNativeAndDeploy({ walletType:WALLET_TYPE.SAFE, owner: eoaAddress, receiver:"0x1a6e27BE6d0902eBd2D6FE533790c6A06A892F63",//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 Safe Smart Wallet.