Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developers.paxoslabs.com/llms.txt

Use this file to discover all available pages before exploring further.

Prepare transaction data for submitting a withdrawal order through the unified withdrawal wrapper. prepareWithdrawal() is the recommended execution helper for most integrations.
prepareWithdrawal() does not check or enforce allowance. Run prepareWithdrawalAuthorization first if you need approval routing.

Import

import { prepareWithdrawal } from "@paxoslabs/amplify-sdk";

Usage

const txData = await prepareWithdrawal({
  yieldType: "CORE",
  wantAsset: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
  withdrawAmount: "1.0", // Vault shares to offer
  userAddress: "0x1234...",
  chainId: 1,
});

const hash = await walletClient.writeContract(txData);

Parameters

ParameterTypeRequiredDescription
yieldTypeYieldTypeYesYield strategy (CORE, TREASURY, FRONTIER)
wantAssetAddressYesToken address user wants to receive
withdrawAmountstringYesVault shares to withdraw (decimal string)
userAddressAddressYesUser wallet address
chainIdChainIdYesChain ID

Return Type

Returns PrepareWithdrawalResult (alias of WithdrawOrderTxData), ready for writeContract.
1

Check Authorization

const auth = await prepareWithdrawalAuthorization({
  yieldType: "CORE",
  wantAsset: USDC_ADDRESS,
  withdrawAmount: "1.0",
  userAddress,
  chainId: 1,
});

if (isWithdrawApprovalAuth(auth)) {
  await walletClient.writeContract(auth.txData);
}
2

Prepare Withdrawal Tx

const withdrawTx = await prepareWithdrawal({
  yieldType: "CORE",
  wantAsset: USDC_ADDRESS,
  withdrawAmount: "1.0",
  userAddress,
  chainId: 1,
});
3

Submit Transaction

await walletClient.writeContract(withdrawTx);