Cross Chain Swap
1. CrossChainQuote
crossChainQuote = async (params: CrossChainSwapParams)CrossChainSwapParams
Description
sourceToken
The source token to be swapped.
targetToken
The target token to receive after the swap.
sourceChain
The source network ID or chain for the swap.
targetChain
The target network ID or chain for the swap.
amountIn
The amount of source tokens to be swapped.
sourceSlippage
The allowed slippage percentage on the source chain.
targetSlippage
The allowed slippage percentage on the target chain.
options
(Optional) An object containing additional options.
2. Execute Cross Chain Transfer
executeTransfer = async (params: ExecuteCrossChainTransferParams)CrossChainTransferParams
Description
sourceProvider
RPC Provider for source chain
sourceSigner
Source chain signer
quote
selected cross chain swap quote
sourceAddress
source chain user address
targetAddress
Target chain user address
targetSigner
target chain signer.
targetProvider
Rpc provider for target chain.
3. Execute Cross Chain Claim
CrossChainSwapParams
Description
txHash
Transaction hash of the tranfer transaction in source chain
sourceProvider
RPC Provider for source chain
targetProvider
Rpc provider for target chain.
targetSigner
target chain signer.
quote
selected cross chain swap quote
sourceAddress
source chain user address
targetAddress
Target chain user address
A CrossChain swap consists of three steps
Getting Swap Quotes: This step involves obtaining quotes for the selected chains and tokens.
Executing Transfer Instruction: In this phase, tokens are transferred across chains using a bridge to reach the selected destination chain.
Executing Claim Instruction: After the tokens have been successfully bridged to the destination chain, this step allows users to claim their tokens. It's worth noting that bridges utilizing a relayer may not require this specific claim step.
What if the claim fails ?
In the event of a failure, users can redeem their tokens that were transferred via the bridge. Kanalabs exclusively transfers native stable coins / wrapped stable coins via the bridge. Therefore, users have the option to redeem their tokens and manually initiate the swap on the destination chain."
1 . POLYGON TO BSC
1.1 . Initialising SDK
1.2 . Getting Cross Chain Swap Quote
1.3 . Executing Transfer Instruction
For Bridges using relayers there is no need to execute claim Instruction
1.4 . Execute Claim Instruction
1.5 . Redeeming tokens in case of failure
2 . APTOS TO SUI
2.1 . Initialising SDK
2.2 . Getting Cross Chain Swap Quote
2.3 . Executing Transfer Instruction
For Bridges using relayers there is no need to execute claim Instruction
2.4 . Execute Claim Instruction
2.5 . Redeeming tokens in case of failure
3 . SOLANA TO APTOS
3.1 . Initialising SDK
3.2 . Getting Cross Chain Swap Quote
3.3 . Executing Transfer Instruction
For Bridges using relayers there is no need to execute claim Instruction
3.4 . Execute Claim Instruction
3.5 . Redeeming tokens in case of failure
Last updated