Prerequisites
Before you begin, ensure that you’ve:- Installed Node.js v22+.
- Obtained an API key and entity secret from the Circle Console.
- Created a developer-controlled wallet on Arc Testnet using the Circle Console.
- Funded your Arc Testnet wallet with testnet USDC from the Circle Faucet.
Earn operations work without an API key. For higher rate limits, pass an
optional API key as
apiKey in the operation config.
Keep the API key server-side. The App Kit SDK rejects an API key passed from a
browser context.Example: passing an API key
Example: passing an API key
TypeScript
Step 1. Set up the project
1.1. Create the project and install dependencies
Create a new directory and install the App Kit SDK with the Circle Wallets adapter and supporting tools:Shell
1.2. Configure TypeScript (optional)
This step is optional. It helps prevent missing types in your IDE or editor.
tsconfig.json file configured for ESM and Node:
Shell
1.3. Set environment variables
Create an.env file in the project directory:
Shell
YOUR_API_KEY with your Circle Developer API key,
YOUR_ENTITY_SECRET with your entity secret:
.env
Step 2. Discover available vaults
kit.earn.exploreVaults returns the vaults available on a chain along with each
vault’s address, current APY, fees, and status. Use it to pick a vault to
deposit into.
2.1. Create the discovery script
Create anexplore-vaults.ts file:
explore-vaults.ts
2.2. Run the discovery script
In your terminal, run:Shell
Shell
Only deposit into a vault with
status: 'active'. A 'low_liquidity' vault may
not have enough liquidity for withdrawals.kit.earn.exploreVaults returns all Morpho vaults on the blockchain. No
allowlist is applied, so integrators choose any active vault to deposit into.
Crosschain deposits are an exception: gas-sponsored crosschain routes use a
manually allowlisted set of destination vaults.
2.3. Pick a vault
Choose a vault from the output and copy itsvaultAddress. You’ll use it in the
next step.
Step 3. Deposit USDC
If your wallet is on a different blockchain than the vault, see
Deposit crosschain into an Earn vault
instead.
3.1. Create the deposit script
Create adeposit.ts file. Replace YOUR_SELECTED_VAULT_ADDRESS with the vault
address you copied in the previous step and YOUR_CIRCLE_WALLET_ADDRESS with
the address of your Circle Wallets wallet. This script deposits 10.00 USDC into
the vault:
Pass
amount as a positive decimal string (for example "10.00"). Zero and
negative values are rejected. For USDC and EURC, use at most 6 decimal places.
Leading zeros and leading-dot forms (for example "00.5" or ".5") are
rejected.deposit.ts
3.2. Run the deposit script
In your terminal, run:Shell
Shell
txHash to verify the transaction on the Arc Testnet block explorer. To
confirm the vault shares credited to your wallet, see
Check your Earn position. When you’re
ready to redeem, see
Withdraw from an Earn vault.