Direct Deposit

The performDeposit function in our SDK returns the transaction data only by selecting the best way to deposit the funds. This functionality ensures optimal transaction efficiency and enhances user convenience.

Expected parameters

performDeposit accepts the following parameters:

ParameterTypeDescription

senderSigner

ethers.Signer

The signer object from ethers

fromChainId

number

Source chain id

fromTokenAddress

string

address of initial token on source chain

toChainId

number

Chain id of the destination chain

toTokenAddress

string

Address of the final token on the destination chain.

fromAmount

string

Amount of the initial token on the source chain.

userAddress

string

Address of the sender on the source chain.

recipient

string

Address of the receiver on the destination chain.

routeType[Optional]

string

Default route is Value. The type of route to be preferred. It can be Value,Fee and Time.

estimateGas[Optional]

boolean

Default is set to true. If you don't want to estimate gas on the backend.

Function call

performDeposit function will initiate all required transactions on source chain such as getting an approval and sending tokens for bridging & swapping.

const provider = new ethers.BrowserProvider(window.ethereum);
const signer = await provider.getSigner();

const address = signer.getAddress();

await aarcSDK.performDeposit({
  toChainId: base.id,
  fromChainId: arbitrum.id,
  routeType: "Value",
  userAddress: address,
  toTokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  fromTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
  senderSigner: signer,
  fromAmount: "1000000",
  recipient: address,
});

Response

The response from the performDeposit will be:

[
  {
    tokenInfo: [
      {
        tokenAddress: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
        amount: bigint
      }   
    ],
    type: 'ERC20_APPROVAL',
    taskId: '',
    status: 'Tx Sent',
    txHash: '0xda9cafe77b32e59517310694954ebaafdcf68640defcd9fd47f490618d4528bf'
  },
  {
    tokenInfo: [
      {
        tokenAddress: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
        amount: bigint
      }   
    ],
    type: 'DEPOSIT',
    taskId: '',
    status: 'Tx Sent',
    txHash: '0x63ca8d9a02f4730e6d6c127d0ae1086bad3a0e853478643f4eeec4583ccc5306'
  }
]

Support

If you face any trouble, feel free to reach out to our engineers in the Telegram support group.

Last updated