Withdrawal Methods
Withdrawal methods of Azoth SDK for withdrawing tokens from the system.
withdraw()
withdraw()
Withdraws tokens from AzothPay.
async withdraw(amount: bigint | number): Promise<ethers.TransactionResponse>
Parameters:
amount
: The amount of tokens to withdraw, should be formatted usingformatInput()
Returns:
An ethers.js
TransactionResponse
object
Example:
// Format the amount correctly (50 USDT with 6 decimals)
const amount = formatInput('50', 6);
// Withdraw
const tx = await azoth.withdraw(amount);
await tx.wait();
console.log('Withdrawal successful');
withdrawBySig()
withdrawBySig()
Creates a withdrawal transaction that can be signed off-chain and executed by anyone.
async withdrawBySig(amount: bigint | number, deadline: number): Promise<ethers.TransactionResponse>
Parameters:
amount
: The amount of tokens to withdraw, should be formatted usingformatInput()
deadline
: Timestamp after which the transaction cannot be executed
Returns:
An ethers.js
TransactionResponse
object
Example:
// Format the amount correctly (50 USDT with 6 decimals)
const amount = formatInput('50', 6);
// Set deadline to 1 hour from now
const deadline = Math.floor(Date.now() / 1000) + 3600;
// Create the withdrawBySig transaction
const tx = await azoth.withdrawBySig(amount, deadline);
await tx.wait();
withdrawTo()
withdrawTo()
Last updated