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:

  • senderSigner: The signer object from ethers.

  • fromChainId: Chain id of the source chain

  • fromTokenAddress: Address of the initial token on the source chain.

  • toChainId: Chain id of the destination chain

  • toTokenAddress: Address of the final token on the destination chain.

  • fromAmount: Amount of the initial token on the source chain.

  • userAddress: Address of the sender on the source chain.

  • recipient: Address of the receiver on the destination chain.

  • destinationPayload[OPTIONAL]: If you want to interact with the contract directly. NOTE: If using destinationPayload, then the recipient should be the contract addresss.

  • destinationGasLimit[OPTIONAL]: The gas limit on the destination chain.

  • routeType[OPTIONAL]: The type of route to be preferred. It can be Value,Fee and Time.

  • estimateGas[OPTIONAL]: Default is set to true. If you don't want to estimate gas on the backend.

Function call

await aarcSDK.performDeposit({
  senderSigner: signer,
  fromChainId: 137,
  fromTokenAddress: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
  toChainId: 42161,
  toTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
  fromAmount: 2000000,
  userAddress: "0x1Cb30cb181D7854F91c2410BD037E6F42130e860",
  recipient: "0x1Cb30cb181D7854F91c2410BD037E6F42130e860"
});

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