Actions

Transaction-building functions that require a walletClient on the YoClient.

Deposit

Deposits assets into a vault via the Yo Gateway contract. Uses quotePreviewDeposit to calculate slippage protection.

const result = await client.deposit({
  vault: '0x3a43aec...',
  amount: parseEther('1'),
  slippageBps: 50,       // 0.5% slippage (optional, default: 50)
  recipient: account,    // optional, defaults to signer
})

console.log(result.hash)   // transaction hash
console.log(result.shares) // expected shares

Redeem

Redeems vault shares for underlying assets via the Yo Gateway. Uses quotePreviewRedeem to calculate slippage protection.

const result = await client.redeem({
  vault: vaultAddress,
  shares: parseEther('10'),
  slippageBps: 50,         // optional, default: 50
  recipient: account,      // optional, defaults to signer
  minAssetsOut: 0n,        // optional, overrides slippageBps
})

console.log(result.hash)
console.log(result.assets) // expected assets

Approve

Approves token spending. Defaults to the Yo Gateway as spender.

Deposit with Approval

Checks allowance and approves if needed before depositing — all in one call.

Prepared Transactions

Build { to, data, value } call data without executing. Useful for AA wallet bundling or custom transaction flows.

Transaction Confirmation

Wait for transaction confirmation and decode events.