Skip to main content
This walkthrough runs the complete Earn lifecycle against Base mainnet: find a Morpho USDC vault (we’ll use Steakhouse USDC), enable it, deposit 100 USDC from a Turnkey wallet, check the position, and withdraw everything.
Earn is currently an Early Access Product. Contact us to enable it for your organization.
Prerequisites
  • Earn Early access enabled for your organization (and a Pro plan or higher if you want gas sponsorship)
  • A Turnkey API key pair
  • A wallet account holding USDC on Base, plus ETH on Base for gas if you don’t sponsor
  • An org-owned wallet address to receive your fee payouts
1

Initialize the client

All requests go through the generic request method of TurnkeyClient, stamped by your API key. Deposits, withdrawals, and deployments all confirm asynchronously, so define a small polling helper here as well.
2

Find a vault

Query the catalog for USDC vaults on Base. The chain comes from the CAIP-19 asset identifier; results are sorted by TVL.
3

Deploy the wrapper

Enable the vault for your organization with a 1% fee on yield ("100" bps) paid to your fee wallet. Turnkey pays the deployment gas. This step is safe to re-run: identical parameters return the same addresses without redeploying.
4

Wait for the deployment

Poll until the wrapper is live onchain.
5

Deposit 100 USDC

USDC has 6 decimals, so 100 USDC is "100000000" raw units. The approval and deposit run as one atomic transaction. With sponsor: true, Gas Station pays the gas (Pro plan or higher); set it to false to have the wallet pay with its own ETH.
6

Wait for the deposit

The activity completing only means the transaction was enqueued. Poll until it’s included onchain.
7

Check the position

Query the wallet’s positions and compute the yield earned so far from the raw fields, using BigInt rather than floats or the display values.
8

Withdraw everything

Exit the full position with "MAX", which redeems the exact live share balance, then poll the withdrawal to confirmation.

Dive deeper

Earn overview

— Fee model, chains, and the full API surface.

Browse the vault catalog

— Catalog and enabled-vault queries in detail.

Deploy a vault wrapper

— Fee configuration, idempotency, and status polling.

Deposit into a vault

— Gas options and deposit semantics.

Withdraw from a vault

— Partial or full exit.

Track positions

— Position fields, units, and precision.