Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
The Aarc SDK is a TypeScript library that makes it easy for developers to transfer assets from Externally Owned Accounts (EOA) to any destination address. It simplifies the asset transfer process by supporting various token standards, such as ERC20 and ER
The Aarc SDK is a TypeScript library that makes it easy for developers to transfer assets from Externally Owned Accounts (EOA) to any destination address. It simplifies the asset transfer process by supporting various token standards, such as ERC20 and ERC721, and offering custom flows like batched transactions, gasless transactions, and paying gas fees with the same asset being moved. Additionally, it enables custom contract interaction within the same transaction using permit2(), allowing for direct swaps and bridge functionality.
Install ethers.js and Aarc SDK using npm:
npm install ethers@5.7.2 aarc-sdk
To use Aarc SDK, an API key is required. Fill out this form to get the API Key on your email instantly!
Import and initialise the Aarc SDK in your project.
import { AarcSDK } from "aarc-sdk";
let aarcSDK = new AarcSDK({
rpcUrl: rpcUrl,
chainId: chainId,
apiKey: "YOUR_API_KEY",
});
Retrieve balances of all tokens in an EOA wallet:
let balances = await aarcSDK.fetchBalances(
eoaAddress: string,
fetchBalancesOnly: true,
tokenAddress: string[] // Optional: Array of specific token addresses
);
Transfer tokens from EOA to any receiver wallet address:
await aarcSDK.executeMigration({
senderSigner: signer, // ethers.signer object
receiverAddress:'RECEIVER_WALLET_ADDRESS',
transferTokenDetails: // Optional. If not passed, the SDK will migrate all the tokens of the wallet
[
{
tokenAddress:TOKEN1_ADDRESS,
amount?:TOKEN1_AMOUNT, // ethers.BigNumber in case of erc20 and native token
tokenIds?: string[] // tokenIds for nfts
},
...
]
})
// Returns the response given below
Output:
[
{
tokenAddress,
amount,
message,
txHash,
tokenId
},
...
]
Transfer tokens from EOA to any receiver wallet address without gas fees. Please note that we use Gelato Relayer to provide the gasless functionality. Please get the Gelato API Key to use the gasless functionality.
await aarcSDK.executeMigrationGasless({
senderSigner: signer, // ethers.signer object
receiverAddress:RECEIVER_WALLET_ADDRESS,
transferTokenDetails: // Optional. If not passed, the SDK will migrate all the tokens of the wallet
[
{
tokenAddress:TOKEN1_ADDRESS,
amount?:TOKEN1_AMOUNT, // ethers.BigNumber in case of erc20 and native token
tokenIds?: string[] // tokenIds for nfts
},
...
],
gelatoApiKey: GELATO_RELAYER_API_KEY // Use the link above to get the gelato relayer key
})
// Returns the response given below
Output:
[
{
tokenAddress,
amount,
message,
txHash,
tokenId
},
...
]
The following code snippet demonstrates a method to transfer native tokens while simultaneously deploying a wallet using the aarcSDK.
This code snippet illustrates a process to transfer native tokens and deploy a wallet concurrently using the aarcSDK. Essential parameters such as the owner's address (EOA_ADDRESS), the type of wallet to deploy (WALLET_TYPE), the signer (ethers.signer object), the receiver's wallet address (RECEIVER_WALLET_ADDRESS), an optional amount of tokens to transfer (amount), and an index for deploying multiple wallets under the same EOA (deploymentWalletIndex) are included.
If the wallet corresponding to the provided owner address (EOA_ADDRESS) and index (deploymentWalletIndex) is already deployed, the deployment process will not occur, and only the token transfer will be executed.
import { WALLET_TYPE } from "aarc-sdk/dist/utils/AarcTypes";
await aarcSDK.transferNativeAndDeploy({
owner: EOA_ADDRESS,
walletType: WALLET_TYPE, // WALLET_TYPE.SAFE or WALLET_TYPE.BICONOMY
signer: signer, // ethers.signer object
receiverAddress: RECEIVER_WALLET_ADDRESS,
amount: BigNumber, // Optional. if not paseed 80% of native tokens will get transferred.
deploymentWalletIndex: 0 // Optional -- Number: Since an EOA, can be used to deploy multiple wallets. you can supply any index and it will deploy wallet for you
})
// Returns the response given below
The Aarc SDK seamlessly integrates with different smart wallets. It currently supports Safe and Biconomy smart wallets and will add more options in the future.
Fetching Existing Safes:
Retrieve a list of all Safe smart wallets associated with the user's EOA:
const safes = await aarcSDK.getAllSafes(owner: string); // owner's eoaAddress
// This returns an array of Safe wallet addresses
Creating a New Safe Wallet:
Generate a new Safe smart wallet. The address returned is a counterfactual address, and the wallet needs to be deployed later. Asset migration can be directed to this address even before deployment.
const newSafeAddress = await aarcSDK.generateSafeSCW(
config: {owners: string[], threshold: number},
saltNonce?: number // default value is 0
);
// Returns a counterfactual address for the new Safe wallet
Fetching Biconomy Smart Wallets:
Retrieve a list of all Biconomy smart wallets associated with the user's EOA:
const biconomySWs = await aarcSDK.getAllBiconomySCWs(owner: string); // owner's eoaAddress
// This returns an array of Biconomy wallet addresses
Creating a New Biconomy Wallet:
Similar to the Safe wallet, you can create a Biconomy smart wallet. The address provided is also a counterfactual address, requiring later deployment. The migration process can target this address immediately.
const newBiconomySCWAddress = await aarcSDK.generateBiconomySCW(
signer // wallet owner's ethers.signer object
);
// Returns a counterfactual address for the new Biconomy wallet
You have the capability to deploy Biconomy or Safe wallets by utilizing the provided code snippets.
The code snippet below showcases how to deploy a wallet using the AarcSDK. It involves specifying essential parameters such as the owner's address (EOA_ADDRESS), the type of wallet to deploy (WALLET_TYPE.BICONOMY or WALLET_TYPE.SAFE), the signer (ethers.signer object), and an optional index for deploying multiple wallets under the same EOA.
If the wallet corresponding to the provided owner address (EOA_ADDRESS) and index (deploymentWalletIndex) is already deployed, the deployment process will not occur.
import { WALLET_TYPE } from "aarc-sdk/dist/utils/AarcTypes";
await aarcSDK.deployWallet({
owner: EOA_ADDRESS,
walletType: WALLET_TYPE, // WALLET_TYPE.SAFE or WALLET_TYPE.BICONOMY
signer: signer, // ethers.signer object
deploymentWalletIndex: 0 // Optional -- Number: Since an EOA, can be used to deploy multiple wallets. you can supply any index and it will deploy wallet for you
})
This project is licensed under the MIT License - see the LICENSE for details.
For support or to share feedback, please schedule a call with us here. You can also share your ideas and feedback on our community forum.
FAQs
The Aarc SDK is a TypeScript library that makes it easy for developers to transfer assets from Externally Owned Accounts (EOA) to any destination address. It simplifies the asset transfer process by supporting various token standards, such as ERC20 and ER
The npm package aarc-sdk receives a total of 29 weekly downloads. As such, aarc-sdk popularity was classified as not popular.
We found that aarc-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.