Skip to main content
High-yield savings is one of the most requested features in consumer fintech, and one of the most expensive to build. Traditional options require a banking charter, balance sheet exposure, or a complex treasury operation. Onchain lending markets like Aave and Morpho offer institutional-grade yields on stablecoins, but integrating them typically means building DeFi infrastructure from scratch. The cross-chain layer handles that. Your customer funds from a card or bank account, and the money lands in a yield-bearing position in one action. You define the destination protocol; the SDK handles the routing, bridging, and deposit.

What your customers experience

A customer opens your app, taps “Add funds,” enters an amount, pays with their debit card, picks a market, and sees their balance earning yield. All of it happens in under two minutes, with no crypto knowledge required. The stablecoin acquisition, cross-chain routing, and vault deposit happen in the background. When they want to withdraw, the same infrastructure runs in reverse.

What you build

Drop in the Earn component to open a market selector. Customers fund from any source and pick where to deposit; the SDK handles the routing, bridging, and deposit.
import { Earn } from "0xtrails";

<Earn
  apiKey="YOUR_API_KEY"
  onEarnSuccess={(result) => {
    // Update customer balance in your system
  }}
/>

Product-defined destinations

To target a specific vault or chain a deposit with another action (e.g., swap then deposit), use composable actions. These let you predefine the protocol, the route, and any intermediate steps.
import { useTrailsSendTransaction, swap, deposit, dynamic } from "0xtrails";

const { sendTransaction } = useTrailsSendTransaction({
  to: {
    chain: "polygon",
    actions: [
      swap({
        tokenIn: "USDC",
        tokenOut: "wstETH",
        amountIn: dynamic(),
      }),
      deposit({
        marketId: "yearn-wsteth-vault",
        token: "wstETH",
        amount: dynamic(),
      }),
    ],
  },
});
The customer funds from their card or bank. The SDK converts to wstETH and deposits into the vault in a single atomic batch.

Supported protocols

ProtocolTypeNetworks
Aave V3LendingEthereum, Polygon, Base, Arbitrum, and more
MorphoVault / LendingEthereum, Base, Polygon
YearnVaultEthereum, Polygon, Arbitrum
Use useEarnMarkets to query available markets by chain, token, and protocol at runtime.

How a yield product fits together

A yield product has three parts:
  1. Funding: The SDK accepts card, bank, or crypto and routes to your vault
  2. Position tracking: Your backend reads the customer’s vault balance to display their yield
  3. Withdrawal: The SDK routes funds from the vault back to the customer’s preferred destination
The SDK handles the first part entirely. The second integrates with standard ERC-4626 or protocol-specific balance reads. The third uses the withdraw flow for outbound transfers.
For a complete walkthrough of funding a Morpho vault, see the Morpho vault deposit guide.