For the complete documentation index, see llms.txt. This page is also available as Markdown.

Withdrawal Methods

Withdrawal methods of Papaya SDK for withdrawing tokens from the protocol

withdraw()

Withdraws tokens from the Papaya protocol.

async withdraw(amount: bigint | number): Promise<ethers.TransactionResponse>

Parameters:

  • amount: The amount of tokens to withdraw, should be formatted using formatInput()

Returns: An ethers.js TransactionResponse object.

Example:

// Format the amount correctly (50 USDT with 18 decimals)
const amount = formatInput('50', 18);

// Withdraw
const tx = await papaya.withdraw(amount);
await tx.wait();
console.log('Withdrawal successful');

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 using formatInput()

  • deadline: Timestamp after which the transaction can't be executed

Returns: An ethers.js TransactionResponse object.

Example:

withdrawTo()

Withdraws tokens directly to another address.

Parameters:

  • to: The recipient address

  • amount: The amount of tokens to withdraw, should be formatted using formatInput()

Returns: An ethers.js TransactionResponse object.

Example:

Last updated