Skip to main content
Redeem your vault shares back to USDC on Arc Testnet, including any yield earned since deposit. This quickstart uses Circle Wallets, but you can use any compatible adapter setup.

Prerequisites

Before you begin, ensure that you’ve:
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.
TypeScript

Step 1. Set up the project

If you completed the deposit quickstart, add the withdraw run script in step 1.1 to your existing project and skip to Step 2.

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
Only need Earn and want a lighter install than the full App Kit? Install the standalone package instead: @circle-fin/earn-kit

1.2. Configure TypeScript (optional)

This step is optional. It helps prevent missing types in your IDE or editor.
Create a tsconfig.json file configured for ESM and Node:
Shell

1.3. Set environment variables

Create an .env file in the project directory:
Shell
Add your credentials. Replace YOUR_API_KEY with your Circle Developer API key, YOUR_ENTITY_SECRET with your entity secret:
.env
Edit .env files in your IDE or editor so credentials are not leaked to your shell history.

Step 2. Withdraw USDC

2.1. Create the withdrawal script

Create a withdraw.ts file. Replace YOUR_SELECTED_VAULT_ADDRESS with the vault address you deposited into and YOUR_CIRCLE_WALLET_ADDRESS with the address of your Circle Wallets wallet. This script withdraws 10.00 USDC from the vault:
withdraw.ts
The first withdrawal from a vault requires an approval transaction to allow the vault contract to redeem your shares. The App Kit SDK handles this automatically, so you may see two transactions in your wallet instead of one.
The amount you receive depends on the current vault share price at the time of redemption.
Preview the expected outcome of a withdrawal before submitting with kit.earn.getWithdrawalQuote.

2.2. Run the withdrawal script

In your terminal, run:
Shell
When the script completes, you’ll see output like:
Shell
The returned amount reflects the value of your shares at the time of withdrawal, which may be greater than your original deposit due to accrued yield. For details on any fees that apply, see How Earn fees work. Use the txHash to verify the transaction on the Arc Testnet block explorer. To confirm your updated vault balance, see Check your Earn position.