Send

The most common and important action in SDK is sending a transfer. To make it first of all you have to build a transaction. For that, you need to call the send method. It has the following fields:

amount: (string) - total amount to send in float format. If you pay a fee with stables also includes fee and extra gas amount.

destinationToken: token you want to send has got from token info

sourceToken: token you want to receive have got from token info

extraGas: (string, optional) If you want to receive extra gas tokens on a destination chain, you have to add this field. Limits for extra gas you can get here

extraGasFormat: (AmountFormat enum INT or FLOAT. Default: INT) Define the format of the extraGas field

fee: (string, optional) to set manually amount of the fee to pay for the transfer. If it is not specified, the fee is set according to getGasFeeOptions method. Value currency depends on gasFeePaymentMethod field - NATIVE_CURRENCY or STABLECOIN respectively

feeFormat: (AmountFormat enum INT or FLOAT. Default: INT) Define the format of the fee field

fromAccountAddress: (string) sender address

toAccountAddress: (string) recipient address

gasFeePaymentMethod: (enum, optional, default: WITH_NATIVE_CURRENCY) WITH_NATIVE_CURRENCY - gas fee and extra gas will be added to the transaction as native token value WITH_STABLECOIN - gas fee and extra gas will be deducted from the amount field

messenger: (enum) Could be ALLBRIDGE, WORMHOLE, CCTP. Not all chains and tokens support all messengers. To check it you can call getAverageTransferTime method, and if the messenger is not supported it returns null

txFeeParams: (object, optional) additional fee for sending transaction blockchain. Now used only for Solana to add extra fee instructions in the transaction. For more details see docs

const rawTx = await sdk.bridge.rawTxBuilder.send(sendParams);

The method will return a raw transaction accounting to the source chain. You need only to sign and send it.

If you want to build a swap transaction you have to use this method also, but with the tokens on the same chain and more simpler args

Last updated