Deposits and redemptions
These examples use an already-connected T3trisWalletClient. Every exported write function submits one live action when invoked. Call it only after your UI has obtained confirmation for that action.
Prepare a deposit
Read the vault's asset, share decimals, kind, status and flags through the API. Recheck contract limits on the target chain before submitting. Asset amounts and share quantities can have different decimals. Use parseUnits with the corresponding token's decimals, never floating-point multiplication.
Establish a native allowance or Permit2 authorization first. An approval must execute on-chain before the deposit request. Contract-wallet proposals may require additional signers before that happens.
A preview describes the current state. It reserves no liquidity and is not a minimum-output guarantee. These deposit and redeem methods do not accept a slippage argument, so your UI must disclose that limitation and refresh stale quotes.
Confirm execution
Use this helper after each submitted action. For a proposal, return control to the contract-wallet workflow instead of polling the proposal ID as if it were a mined hash.
import type { TransactionResult } from "@t3tris-labs/sdk";
import type { PublicClient } from "viem";
export async function execution(publicClient: PublicClient, result: TransactionResult) {
if (result.status === "proposed") {
return { status: "awaiting-signers" as const, proposalId: result.hash };
}
const receipt = await publicClient.waitForTransactionReceipt({ hash: result.hash });
if (receipt.status !== "success") throw new Error("Transaction reverted.");
return { status: "executed" as const, hash: receipt.transactionHash };
}
Refresh indexed data after successful execution, allowing for indexer delay. Never start the next funding step just because a proposal was created.
Asynchronous deposit
An async deposit has three separate transactions: request, authorized settlement, then claim. The depositor normally performs the request and claim; an authorized operator performs settlement.
Submit the request
import type { T3trisWalletClient } from "@t3tris-labs/sdk";
import type { Address, Hex } from "viem";
export function requestDeposit(
client: T3trisWalletClient, chainId: number, vault: Address,
controller: Address, amount: bigint, permit2Data?: Hex,
) {
if (amount <= 0n) throw new Error("Amount must be positive.");
return client.vaults.requestDeposit({
chainId, address: vault, controller, amount, permit2Data,
});
}
Confirm the request receipt. Display assets as pending, not as owned shares. controller defaults to the connected account, and designating a controller does not grant arbitrary authority to claim another account's request.
Inspect and claim settled shares
import type { T3trisWalletClient } from "@t3tris-labs/sdk";
import type { Address } from "viem";
export function claimableDeposit(
client: T3trisWalletClient, chainId: number, vault: Address, owner: Address,
) {
return client.vaults.read.previewClaimDeposit({ chainId, address: vault, owner });
}
export function claimDeposit(
client: T3trisWalletClient, chainId: number, vault: Address, receiver: Address,
) {
return client.vaults.claimDeposit({ chainId, address: vault, receiver });
}
Call the preview after settlement has executed. Show the claim action when shares are available, obtain a new confirmation and submit the claim from the authorized wallet. Receiving a settlement event alone does not mean the claim has executed.
Reduce a pending deposit
import type { T3trisWalletClient } from "@t3tris-labs/sdk";
import type { Address } from "viem";
export function reduceDeposit(
client: T3trisWalletClient, chainId: number, vault: Address,
receiver: Address, amount: bigint, minAmountOut: bigint,
) {
return client.vaults.decreaseDepositRequest({
chainId, address: vault, receiver, amount, minAmountOut,
});
}
minAmountOut is required and uses asset units. Calculate it from the current quote and the user's slippage policy. Silo losses or liquidity restrictions can affect the returned assets. Zero disables that minimum-output protection.
Asynchronous redemption
Request withdrawal
import type { T3trisWalletClient } from "@t3tris-labs/sdk";
import type { Address } from "viem";
export function requestRedemption(
client: T3trisWalletClient, chainId: number, vault: Address,
owner: Address, shares: bigint,
) {
if (shares <= 0n) throw new Error("Shares must be positive.");
return client.vaults.requestRedeem({
chainId, address: vault, owner, controller: owner, shares,
});
}
Confirm request execution, then show the shares as pending redemption. Wait for the authorized operator's settlement. See settlement examples.
Claim the assets
import type { T3trisWalletClient } from "@t3tris-labs/sdk";
import type { Address } from "viem";
export function claimRedemption(
client: T3trisWalletClient, chainId: number, vault: Address,
owner: Address, receiver: Address,
) {
return client.vaults.claimRedeem({ chainId, address: vault, owner, receiver });
}
Use indexed claimableRedeemAssets to display availability and let simulation check current contract eligibility. The SDK does not currently expose an on-chain previewClaimRedeem method. Confirm the claim receipt before displaying the withdrawal as paid.
Reduce a pending redemption
import type { T3trisWalletClient } from "@t3tris-labs/sdk";
import type { Address } from "viem";
export function reduceRedemption(
client: T3trisWalletClient, chainId: number, vault: Address,
owner: Address, receiver: Address, shares: bigint,
) {
return client.vaults.decreaseRedeemRequest({ chainId, address: vault, owner, receiver, shares });
}
A reduction is subject to the pending request's current state. Re-read lifecycle flags before offering an action: a closed or end-of-fund vault can follow different withdrawal rules from an open vault.
Track the position
accounts.listPositions is paginated. accounts.portfolio is a bounded snapshot of up to 200 indexed positions, so use the paginated endpoint for a complete large portfolio. Position fields distinguish each stage:
| Field | Meaning |
|---|---|
pendingDepositAssets | Requested assets awaiting settlement |
claimableDepositShares | Settled shares awaiting claim |
pendingRedeemShares | Shares awaiting redemption settlement |
claimableRedeemAssets | Settled assets awaiting claim |
shares | Indexed owned share balance |
Keep transaction state and indexed position state separate. Contract receipts establish execution; events tell your backend when to refresh its view.