Send transaction

Send the transaction to the DEX Aggregator contract.

Example

library.getSigner().sendTransaction({
  from: account,
  to: contractAddress,
  data: data,
  gasPrice: userGasPrice?.value, // optional
  gasLimit: estimateGas, // optional
  value: nativeValue
});

Parameters

With data from /quote/cross API (contractAddress, data, nativeValue, estimateGas)

  • account: the address of the wallet sending the transaction

  • data: the transaction data to be sent

  • contractAddress: the address of the contract to which the transaction is being sent

  • userGasPrice (optional): the gas price set by the user

  • estimateGas (optional): the estimated amount of gas needed for the transaction

  • currencyInIsNative: a boolean value that indicates whether the currency being used is native to the blockchain or not

  • nativeValue: the value of the native currency being sent with the transaction

Return Value

This function returns a promise that resolves to a transaction hash. The format data can be found here: Signers

ContractAddress

When you are preparing to send a transaction, it is essential to reference the correct version of the smart contract. This version is specified within the transactionData of the swap endpoint. Alternatively, if you have the disableEstimate parameter set to false, you would refer to the quote endpoint instead. Once you have identified the correct version, you can obtain the associated address by referring to our npm package that contains all our smart contract addresses.

The transactionData will also provide a field known as contractAddress. This field reflects the same address where the transaction must be directed. However, for enhanced security and to minimize potential risks, we strongly advise retrieving the contract address through our npm package instead of solely relying on the address provided in the transactionData. This recommendation is made to safeguard against any inadvertent security vulnerabilities that could arise from using incorrect or outdated address information.

Last updated

Was this helpful?