How it works
Users never interact with a blockchain directly. Wallet creation, gas, and transaction signing all happen in the background via a non-custodial wallet tied to their account.
Prerequisites
- A Trails API key
- A wagmi-compatible non-custodial wallet provider (Polygon Wallet, Privy, Dynamic, or similar), which powers the invisible signing layer your users never see
Install
Addresses
Step 1: Set up the non-custodial wallet
Each user gets a non-custodial wallet created automatically at sign-up, with no crypto onboarding and no seed phrases. This wallet is the signing key for their yield account; users never see or interact with it directly.Step 2: Discover the vault market
Composable actions use market IDs instead of hand-encoded vault calldata. Fetch the available vaults, then pass the selected market’sid to the deposit action:
Step 3: Quote and execute the deposit
UseuseQuote with the deposit action. Trails quotes the route, handles any bridge or swap, and executes the vault deposit from the destination intent wallet:
onStatusUpdate gives you progress events for the route and destination action so you can update the savings balance after settlement.
Withdraw
Users can withdraw their full balance (principal + accrued yield) at any time. UseuseEarnBalances to read the user’s position, then build a plain ERC-4626 redeem transaction with viem:
useEarnBalances returns the normalized earn position for the wallet, including the market yieldId, the display balance, and protocol-specific share/output token balances. Until the SDK exposes a higher-level withdraw helper, you can encode the vault’s ERC-4626 redeem call directly and submit it with the user’s wallet.
Next steps
Trails API Reference
Full reference for QuoteIntent, CommitIntent, ExecuteIntent, and monitoring.
Wallet Compatibility
Full list of supported non-custodial wallet providers including Privy, Dynamic, and WalletConnect.
Smart Sessions
Automate recurring deposits: schedule weekly transfers to savings without per-transaction prompts.
Treasury Wallet
Sweep funds from user accounts into a central treasury wallet on a schedule.