Module 9 - Understanding Asset Transfer SDK - Part 2
Proceed with the Following Steps to -
This Module focuses on importing all the Necessary Modules, Getting the Quote and actually Executing the Transaction.
1. Importing Modules
Description:
Import the Necessary Modules from the SDK into your CodeBase.
Example:
2. Initializing Pathfinder
Description:
Next you need to initialize a Pathfinder
Instance. You need to Provide your Unique Widget ID obtained from Router Protocol Telegram Channel. For now let it be 24.
Example:
3. Main Function
Description:
Define a main
Function where Asset Swapping Operations will be Organized and Executed.
Example:
4. Building EVM Signer
Description:
Construct an EVM Signer Object using your Private Key and the RPC Endpoint. This Signer will be used for Signing Transactions during Asset Transfers. In this Tutorial, we will be Transferring 10 AFTT from Fuji to Holesky Chain.
Example:
Make sure to Replace evmPrivateKey
with your Private Key.
Note: This is just a Tutorial, so Abstain from using Private Key which you use for Normal Usage.
5. Getting Quote
Description:
Router Nitro enables you to interact with the Nitro Contract and initiate cross-chain Token Transfers. The First step in this Process is to Request a Quote, which provides you with essential Details about the Proposed Token Transfer. Request a Quote from Pathfinder for the Desired Asset Transfer, specifying Source and Destination Chain IDs, Token Addresses, and the Amount of Assets to be Transferred. In this case, we are Transferring 10 AFTT Tokens.
Example:
6. Executing Quote
Description:
Execute the Obtained Quote, handling Approval and Executing the Transaction to ensure a Successful Asset Transfer.
Example:
Congratulations!
You just Transferred 10 AFTT from Fuji to using Router Protocol’s Asset Transfer SDK.