Skip to main content

Usage

const result = await withdraw({
  amount: '50',
  tokenName: 'USDC',
});

Parameters

type WithdrawInput {
  amount: string;
  tokenName: string;
}
amount
string
required
The amount to withdraw.
tokenName
string
required
The tokenName name (e.g., ‘USDC’, ‘USDT’, ‘ETH’).

Returns

type WithdrawResponse = {
  result: TransactionResult.SUCCESS;
  data: {
    txHash: string;
  };
} | {
  result: TransactionResult.FAILED;
  error: MiniAppError;
} | {
  result: TransactionResult.CANCELLED;
}
result
TransactionResult
The result of the withdrawal attempt.
  • SUCCESS: The withdrawal was successful.
  • FAILED: The withdrawal failed.
  • CANCELLED: The withdrawal was cancelled by the user.
data
object
Contains the transaction hash of the withdrawal transaction. Only present when the result is SUCCESS.
  • txHash: The transaction hash.
error
MiniAppError
Contains the error information when the withdrawal fails. Only present when the result is FAILED.
  • message: The error message.
  • code: The error code.

Demo