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.

prepareDepositTxData builds calldata for vault deposits. Use it when the user has already granted allowance to the Boring Vault contract (or when a permit flow will supply approval).

Helper Signature

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

const tx = await prepareDepositTxData({
  yieldType, // e.g. YieldType.CORE
  recipientAddress, // Address of the user. Must be the same as the address used to sign the deposit transaction.
  depositToken, // Token contract address to deposit. Must be supported by the vault.
  depositAmount, // Amount of assets to deposit as a decimal string (e.g., "1.5")
  chainId, // ID of the chain where the deposit will occur
  slippage, // Optional (default 50 bps aka 0.5%): Maximum acceptable slippage in basis points (e.g., 100 for 1%)
  partnerCode, // Optional (default is empty string): Partner code to credit deposit fees to the partner used for the deposit
});
  • Returns { abi, address, functionName: 'deposit', args, chainId }.
  • args[0] is the recipient, args[1] is the deposit amount in base units.
  • Throws APIError if the vault, token, or chain is unsupported.

React with Privy

import { encodeFunctionData } from "viem";
import { mainnet } from "viem/chains";
import { prepareDepositTxData, YieldType } from "@paxoslabs/amplify-sdk";
import { usePrivy, useWallets } from "@privy-io/react-auth";

const { sendTransaction } = usePrivy();
const { wallets } = useWallets();
const wallet = wallets[0];
if (!wallet) {
  throw new Error("Connect a wallet before preparing transactions.");
}

const owner = wallet.address as `0x${string}`;

const deposit = await prepareDepositTxData({
  yieldType: YieldType.CORE,
  recipientAddress: owner,
  depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
  depositAmount: "1000",
  chainId: mainnet.id,
});

await sendTransaction({
  chainId: deposit.chainId,
  to: deposit.address,
  data: encodeFunctionData({
    abi: deposit.abi,
    functionName: deposit.functionName,
    args: deposit.args,
  }),
});

React with wagmi

import { prepareDepositTxData, YieldType } from "@paxoslabs/amplify-sdk";
import { useAccount, useWriteContract } from "wagmi";

const { address, chainId } = useAccount();
const { writeContractAsync } = useWriteContract();
if (!address || !chainId) {
  throw new Error("Connect a wallet before preparing transactions.");
}

const { chainId: _ignored, ...tx } = await prepareDepositTxData({
  yieldType: YieldType.CORE,
  recipientAddress: address,
  depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
  depositAmount: "1000",
  chainId,
});

await writeContractAsync({ ...tx, account: address });

React with viem

import { createWalletClient, custom } from "viem";
import { mainnet } from "viem/chains";
import { prepareDepositTxData, YieldType } from "@paxoslabs/amplify-sdk";

// ethereum is window.ethereum from an injected wallet.
const [account] = (await ethereum.request({
  method: "eth_requestAccounts",
})) as `0x${string}`[];

const client = createWalletClient({
  account,
  chain: mainnet,
  transport: custom(ethereum),
});

const { chainId: _ignored, ...tx } = await prepareDepositTxData({
  yieldType: YieldType.CORE,
  recipientAddress: account,
  depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
  depositAmount: "1000",
  chainId: mainnet.id,
});

await client.writeContract({ ...tx, account });
If the allowance is insufficient, switch to the Approve & Deposit flow. For permit-enabled tokens, jump to Deposit with Permit.***