Deposits and Withdrawals
import { Nord, NordUser } from "@n1xyz/nord-ts";
// Assuming nord and user are already initialized
// Withdraw tokens
try {
const tokenId = 0; // USDC
const amount = 100; // 100 USDC
await user.withdraw({ tokenId, amount });
console.log(`Successfully withdrew ${amount} of token ID ${tokenId}`);
} catch (error) {
console.error(`Withdrawal error: ${error}`);
}
// For Solana SPL tokens
try {
const tokenId = 1; // SOL
const amount = 1; // 1 SOL
const txId = await user.depositSpl(amount, tokenId);
console.log(`Deposit transaction ID: ${txId}`);
} catch (error) {
console.error(`Deposit error: ${error}`);
}Last updated on