Paying fees with stables

By default you the transaction charges fee in network's gas tokens, but you may opt into paying fees with stables instead:

For this you have to use getGasFeeOptions metod

const gasFeeOptions = await sdk.getGasFeeOptions(sourceTokenInfo, destinationTokenInfo, Messenger.ALLBRIDGE);
const gasFeeAmount = gasFeeOptions[FeePaymentMethod.WITH_STABLECOIN];

// initiate transfer
const rawTransactionTransfer = await sdk.bridge.rawTxBuilder.send(
  {
    amount: totalAmountFloat,
    fromAccountAddress: fromAddress,
    toAccountAddress: toAddress,
    sourceToken: sourceTokenInfo,
    destinationToken: destinationTokenInfo,
    messenger: Messenger.ALLBRIDGE,
    gasFeePaymentMethod: FeePaymentMethod.WITH_STABLECOIN,
    fee: gasFeeAmount.int,
  }
);

Full example

Last updated