transferToTradingWallet
The transferToTradingWallet()
method of Nectar
instances transfers a token from the user's Web3 (funding) wallet (e.g., MetaMask Wallet) to the trading wallet.
Nectar utilizes a non-custodial trading wallet, governed by the DEX manager smart contract, to improve transaction efficiency and reduce costs. Therefore, users must transfer the tokens they wish to trade from their Web3 funding wallet to Nectar's trading wallet, ensuring a streamlined trading experience.
Usage
Transfering Native Tokens Using ethers
One can also use ethers library to transfer native tokens.
Transfering ERC20 Tokens
For the transfer of ERC20 tokens, the protocol requires users to first authorize the transfer amount to the DEX manager smart contract. This preparatory step enables the DEX manager smart contract to initiate the actual token transfer. This process involves two separate transactions, which can lead to a longer transfer duration compared to that of native tokens.
It is important to note that ERC20 tokens must possess an approve
function to be supported by the platform.
Parameters
ticker: string
A ticker of the token to transfer.
It is a combination of a symbol, an underscore, and a chain symbol.
E.g.,
USDT_ETHSEPOLIA
amount: string
The amount of token to transfer.
market: Market
A market whose base ticker or quote ticker matches the given ticker.
Options
signer?: Wallet
Optional
Default to
userWallet
property ofNectar
instances.A wallet placing the order.
retry?: boolean | number
Optional
Defaults to
true
This option is applicable only for transactions involving ERC20 tokens.
If
false
, the method does not monitor the transaction outcome (success or failure).If
true
, the method continuously checks the transaction status until it is either executed successfully or fails.If set to a
number
, it represents the count of attempts to check the transaction status before stopping.
retryDelay?: number
Optional
Defaults to
3000
A delay to apply before the next attempt in milliseconds.
Returns
NectarTransferResult
A result of the transaction.
Last updated