Transfer ERC20 Token

For ERC20 tokens, users need to approve the specified amount to be transferred to the dex manager smart contract before the dex manager smart contract initiates the transfer. This process involves two transactions, which may result in slightly longer transfer times than transferring native token.

If an ERC20 token does not have an approve function, Nectar cannot support it.

Using ethers-io

For more detailed information about ethers, please refer to the link: ethers-io.

Using Nectar SDK

import { Nectar } from "@wasd3rplay/nectar-sdk";
import { ethers } from "ethers";

const nectar = new Nectar();
const transferResult = await nectar.transferTokenToTradingWallet({
  ticker: "USDT_ETH",
  requestAmount: "1000", // 1000 USDT
});

Properties

  • ticker

    • The ticker of the token to transfer

  • requestAmount

    • The amount to transfer in the base (human-readable) unit

  • symbol (optional)

    • Market symbol can be specified. If not specified, it will use the market information for the market that is first found with the ticker.

  • signer (optional)

    • It's possible to specify a wallet other than the default user wallet provided by the Nectar SDK.

  • market (optional)

    • Directly specifying the market can reduce the load caused by market queries.