LogoLogo
  • Introduction to Unizen
    • Unizen Overview
      • Unizen Liquidity Distribution Mechanism (ULDM)
        • ULDM Performance
      • Unizen Interoperability Protocol (UIP)
        • LayerZero
        • DeBridge
        • Stargate
        • Celer
        • Axelar
        • Thorchain
    • Unizen Dashboard
      • General
      • Portfolio
      • History
    • Unizen Trade
      • Fees
    • Unizen Explore
      • Unizen Omni-Chain Data Pool
    • Unizen Earn
  • ZCX
    • Token Utility
    • Tokenomics
  • API - Introduction
    • Introduction
    • Before you get started
      • Understanding Price Impact and Price Slippage in Token Swaps
      • Token Allowance Management for Non-updatable Allowance Tokens
      • Tokens with taxes
      • Wrapping and Unwrapping Native Tokens
      • Quote expiration deadline
    • Security Best Practices for Integrating Unizen
      • Why disable CORS
      • How to integrate with a reverse proxy
    • Version 2 of our smart contracts
      • Migration to smart contract v2
  • API - GET STARTED
    • QuickStart guide
    • Swagger
    • Information endpoints
      • GET /trade/v1/info/chains
      • GET /trade/v1/info/sources
      • GET/v1/info/cross-providers
      • GET /trade/v1/info/token/search
      • GET /v1/info/token/popular
      • GET /trade/v1/info/token/{chainId}/{tokenAddress}
      • GET /trade/v1/info/tokenLogo/{chainId}/{tokenAddress}
      • GET /info/thorchain-inbound-address
      • GET /trade/v1/info/tx/{txHash}
      • GET /trade/v1/info/trade/{chainId}/{txHash}
      • GET /trade/v1/info/trades
    • Approval
      • GET /trade/v1/{chainId}/approval/spender
      • GET /trade/v1/{chainId}/approval/transaction
      • GET /trade/v1/{chainId}/approval/allowance
    • Single-Chain Swap
      • GET /trade/v1/{chainId}/quote/single
      • GET /trade/v1/{chainId}/swap/single
      • Send transaction in evm chains
      • Send transaction in Solana
    • Cross-Chain Swap
      • GET /trade/v1/{chainId}/quote/cross
      • GET /trade/v1/{chainId}/swap/cross
      • Send transaction
    • Gasless orders
      • POST /trade/v1/gasless/typed-data
      • POST /v1/gasless/estimate
      • POST /v1/gasless/create
      • POST /v1/gasless/cancel
      • GET /trade/v1/gasless/status/{orderId}
      • GET /v1/gasless/orderByAddress/{address}
    • UTXO Assets and Cosmos Swap
      • GET /trade/v1/{chainId}/quote/cross 1
      • GET /trade/v1/{chainId}/swap/cross
      • Sending transactions
    • Efficient Quote Retrieval with Batch Processing
      • GET /trade/v1/{chainId}/batch_quote/single
    • Error Messages
  • GASLESS TRADES
    • Obtaining gasless quotes
    • Gas estimation
    • Executing the trade
    • Following the orders
  • On-Chain Contracts - Get Started
    • Integration with Unizen Contracts for Token Swapping
    • Registering Errors on Smart Contract Calls
  • PERMIT2
    • What is Permit2?
    • Usage in our api
  • WIDGET - Get Started
    • Embed the Unizen Widget
    • Playground
  • Other
    • Smart Contracts
    • Security Audits
    • Roadmap
  • links
    • Unizen
    • Marketing Website
    • Medium
    • Twitter
    • Discord
    • Telegram
Powered by GitBook
On this page

Was this helpful?

  1. API - GET STARTED
  2. Single-Chain Swap

Send transaction in evm chains

Send the transaction to the DEX Aggregator contract.

PreviousGET /trade/v1/{chainId}/swap/singleNextSend transaction in Solana

Last updated 1 month ago

Was this helpful?

Example

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

Parameters

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

  • library:

  • 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:

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.

ethers.providers.Web3Provider
Signers