Deposit Funds using Aarc SDK

megabyte,AarcCross-Chain

gm gm gm!!!

Web3 is growing at an exponential rate because of the high level of technical infrastructure it has built to support the decentralized world. However, the applications built on top of this infrastructure are still struggling to onboard users who are not familiar with web3. This struggle is stalling the growth of web3 applications and the adoption of blockchain technology.

The question arises: How can we solve this struggle and onboard users seamlessly?

The answer is simple: *Aarc Fund Deposit Kit

Aarc FDK abstracts all the technical complexity for users and developers, making the onboarding process as simple as possible.

Aarc FDK provides great DevX by providing a simple SDK that can be integrated into any web3 application in a few lines of code.

Aarc FDK can be utilized in the following ways:

Today, we will build a simple script for a cross-chain swap using Aarc FDK SDK.

We will use Aarc Fund Deposit Kit SDK's performDeposit function. This function takes the required parameters and performs the deposit on the user's behalf. The SDK abstracts the complete transaction flow; the user only needs to sign the transactions without leaving the application.

Let's start building (🧱,🚀)

Prerequisites

Getting Started

Initializing the Aarc FDK SDK

Creating objects and variables

Creating the function

Executing the script

To execute the above script, run the following command:

node index.js

Upon executing this function, Aarc SDK will check the user funds on the Source Chain, fetch the best possible routes from different providers, select a route, and perform the deposit on the user's behalf. All the user needs to do is sign the transactions.

Voila! You have successfully performed a cross-chain swap using Aarc FDK SDK.

Understanding the response

The response of executing the performDeposit function will look like this:

[
  {
    tokenInfo: [ [Object] ],
    type: 'ERC20_APPROVAL',
    taskId: '',
    status: 'Tx Sent',
    txHash: '0xda9cafe77b32e59517310694954ebaafdcf68640defcd9fd47f490618d4528bf'
  },
  {
    tokenInfo: [ [Object] ],
    type: 'DEPOSIT',
    taskId: '',
    status: 'Tx Sent',
    txHash: '0x63ca8d9a02f4730e6d6c127d0ae1086bad3a0e853478643f4eeec4583ccc5306'
  }
]

There are two types of transactions in the response above:


Thanks for building with us!

You can check the complete code here: https://github.com/aarc-xyz/aarc-fdk-performDeposit (opens in a new tab)

Aarc provides several other solutions to improve web3 UX and developer experience. Check out the Aarc Developer Docs (opens in a new tab) for more information.

If you have any doubts or wanna discuss something:

© megabyte.RSS