• User Guide
    • Security Notes
      Security Notes
    • Online/Desktop Apps
      • Account Management
        • Create Account
          Create Account
        • Log in to Account
          Log in to Account
        • Backup Seed Phrase
          Backup Seed Phrase
        • Recover Account
          Recover Account
        • Find Out Your Address
          Find Out Your Address
        • Create Personal Alias
          Create Personal Alias
        • Import From Keeper Wallet
          Import From Keeper Wallet
        • Use Ledger Nano Devices With WX Network
          Use Ledger Nano Devices With WX Network
        Account Management
      • Token Management
        • Deposit & Withdraw Tokens
          • Transactions Tab
            Transactions Tab
          Deposit & Withdraw Tokens
        • Create Token
          Create Token
        • Mass Transfer
          Mass Transfer
        • Reissue Token
          Reissue Token
        • Change Reissuable to Not Reissuable
          Change Reissuable to Not Reissuable
        • Burn Token
          Burn Token
        • Sponsored Transaction
          Sponsored Transaction
        • Sponsored Fee
          Sponsored Fee
        • Swap Tokens
          Swap Tokens
        Token Management
      • Investment Tools
        • Stake Tokens
          • How to Get XTN (Quick Guide)
            How to Get XTN (Quick Guide)
          • How to Get USDT/USDC/BTC/ETH (Quick Guide)
            How to Get USDT/USDC/BTC/ETH (Quick Guide)
          Stake Tokens
        • Lambo Investments
          Lambo Investments
        • Algorithmic Trading
          Algorithmic Trading
        Investment Tools
      • Liquidity Pools
        • How to Maximize Passive Income from Liquidity Pools?
          How to Maximize Passive Income from Liquidity Pools?
        • How to Deposit/Withdraw Tokens to/from a Liquidity Pool?
          How to Deposit/Withdraw Tokens to/from a Liquidity Pool?
        • How to Stake/Unstake LP Tokens?
          How to Stake/Unstake LP Tokens?
        • How to Claim LP Staking Reward in WX?
          How to Claim LP Staking Reward in WX?
        • How to Stake WX Token to Boost LP Staking Reward?
          How to Stake WX Token to Boost LP Staking Reward?
        • How to Claim WX Staking Reward?
          How to Claim WX Staking Reward?
        • WX Token Protocol
          WX Token Protocol
        Liquidity Pools
      • Voting
        Voting
      • Advanced Features
        • Script Transaction
          Script Transaction
        • JSON Confirmation
          JSON Confirmation
        Advanced Features
      • Start Trading on WX Network
        Start Trading on WX Network
      Online/Desktop Apps
    • Mobile Apps
      • WX Network App
        WX Network App
      • Waves.Exchange App
        • Account Management
          • Create Account
            Create Account
          • Log in to Account
            Log in to Account
          • Recover Account
            Recover Account
          • Find Out Your Address
            Find Out Your Address
          • Create Personal Alias
            Create Personal Alias
          Account Management
        • Token Management
          • Deposit & Withdraw Tokens
            Deposit & Withdraw Tokens
          • Burn Token
            Burn Token
          Token Management
        • Start Trading on WX Network
          Start Trading on WX Network
        Waves.Exchange App
      • WX Invest App
        WX Invest App
      Mobile Apps
    • Working With MetaMask in Waves Network
      Working With MetaMask in Waves Network
    • WX Referral Program
      WX Referral Program
    User Guide
  • API and Library
    • CCXT
      CCXT
    • Fees
      Fees
    • Payment API
      Payment API
    • Web Auth API
      Web Auth API
    • Gateway API
      • Deposit
        • [Deprecated] GET /v1/deposit/addresses/{currency}
          [Deprecated] GET /v1/deposit/addresses/{currency}
        • GET /v1/deposit/addresses/{currency}/{platform}
          GET /v1/deposit/addresses/{currency}/{platform}
        • GET /v1/deposit/currencies
          GET /v1/deposit/currencies
        • [Deprecated] GET /v1/deposit/currencies/{currency}
          [Deprecated] GET /v1/deposit/currencies/{currency}
        • GET /v1/deposit/currencies/{currency}/{platform}
          GET /v1/deposit/currencies/{currency}/{platform}
        • Terms of Deposit
          Terms of Deposit
        Deposit
      • Withdraw
        • [Deprecated] GET /v1/withdraw/addresses/{currency}/{address}
          [Deprecated] GET /v1/withdraw/addresses/{currency}/{address}
        • GET /v1/withdraw/addresses/{currency}/{address}/{platform}
          GET /v1/withdraw/addresses/{currency}/{address}/{platform}
        • GET /v1/withdraw/currencies
          GET /v1/withdraw/currencies
        • [Deprecated] GET /v1/withdraw/currencies/{currency}
          [Deprecated] GET /v1/withdraw/currencies/{currency}
        • GET /v1/withdraw/currencies/{currency}/{platform}
          GET /v1/withdraw/currencies/{currency}/{platform}
        • Terms of Withdrawal
          Terms of Withdrawal
        Withdraw
      • Movements History
        Movements History
      • Platforms List
        Platforms List
      • Error Codes
        Error Codes
      Gateway API
    • Access Token
      • Get Access Token in WX Network App
        Get Access Token in WX Network App
      • POST /v1/oauth2/token
        POST /v1/oauth2/token
      Access Token
    • Get Trades
      Get Trades
    • Staking Annual Percentage Yield API
      Staking Annual Percentage Yield API
    • Matcher
      • WX Network Protocol
        WX Network Protocol
      • Matcher Fee
        Matcher Fee
      • Install Matcher on Ubuntu From Deb-package
        Install Matcher on Ubuntu From Deb-package
      • Matcher Settings
        Matcher Settings
      • Matcher API
        • Order Validation
          Order Validation
        • Exchange Transation Validation
          Exchange Transation Validation
        Matcher API
      • Matcher WebSocket API
        • Errors and Debugging
          Errors and Debugging
        • Common Streams
          Common Streams
        Matcher WebSocket API
      Matcher
    API and Library
  • Glossary
    Glossary
      • English
      • Русский
      On this page
        • How to Swap Tokens
        • How to Swap Tokens via dApp

          # Swap Tokens

          WX Network provides the Swap tool based on the public smart contract (opens new window) that allows users to instantly exchange tokens in various directions without any amount limitations. The swaps liquidity is provided by the Liquidity pools.

          Read more about Swap tool (opens new window).

          # How to Swap Tokens

          Open WX Network (opens new window) app, login to your account and in the Trading tab select one of the available swap directions, for example USDT/WX (opens new window).

          figure 1

          In the I Send field specify the amount to swap. In the I receive field the estimated amount of the token that you will receive will be displayed. The current spot and swap rates will be displayed in the fields below.

          figure 2

          Select the appropriate Slippage value and the Transaction Fee token, then click Swap USDT to WX.

          # How to Swap Tokens via dApp

          It is possible to swap tokens not only via WX Network interface, but also via Waves dApp. This functionality might be useful for bot developers and any advanced users in general.

          In the following example lets review a swap of 1 USDT to XTN with 5% slippage.

          The Swap dApp works with exact numbers, so, first of all, you will need to figure out the amount that you want to swap based on the current swap rate.

          To do so, navigate to Waves node POST /utils/script/evaluate/{address} (opens new window) swagger interface:

          figure 3

          Long story short, you need to ask the contract to evaluate how much XTN will be received for a swap of 1 USDT.

          Request example:

          {
           "expr": "swapCalculateREADONLY(1000000,\"34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ\",\"DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p\")"
          }
          

          Where:

          3P68zNiufsu1viZpu1aY3cdahRRKcvV5N93 is the Swap dApp address.

          1000000 is the amount of the sent token (1 USDT).

          34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ is the ID of the sent token (USDT).

          DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p is the ID of the received token (XTN).

          Response example:

          {
            "result": {
              "type": "Tuple",
              "value": {
                "_1": {
                  "type": "Array",
                  "value": []
                },
                "_2": {
                  "type": "Int",
                  "value": 4192129
                }
              }
            },
            "complexity": 3569,
            "expr": "swapCalculateREADONLY(1000000,\"34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ\",\"DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p\")",
            "address": "3P68zNiufsu1viZpu1aY3cdahRRKcvV5N93"
          }
          

          Where:

          4192129 is the value you are looking for. It indicates that at the current swap rate 1 USDT can be swapped to 4,192129 XTN. The Service Fee is already deducted from this value.

          Before executing the swap, calculate and deduct the slippage amount.

          For example, multiply the value by 0.95 to quickly deduct 5% slippage:

          4192129x0.95=3982522

          Now that you know the exact amount based on the current swap rate and 5% slippage, navigate to the dApp page (opens new window), login to your account and input the Swap contract address (3P68zNiufsu1viZpu1aY3cdahRRKcvV5N93).

          figure 4

          1. In the amountOutMin field enter the 3982522 amount.

          2. In the assetOut field enter the ID of XTN (DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p).

          3. In the addressTo field enter the address that will receive XTN.

          4. Click Attach payment.

          5. Select USDT from the list and specify the 1.000000 amount.

          6. Click Invoke.

          7. In the window that opens, confirm the transaction.


          See more articles in the Token Management chapter.

          If you have difficulties with WX Network, please create a support (opens new window) ticket or write a question on our forum (opens new window).

          Sponsored Fee
          Investment Tools
          Sponsored Fee
          Investment Tools