Prerequisites
Before you begin, ensure that you’ve:- Completed the deposit quickstart so you have USDC deposited in a vault.
- 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.
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
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
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. Withdraw USDC
2.1. Create the withdrawal script
Create awithdraw.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.
2.2. Run the withdrawal script
In your terminal, run:Shell
Shell
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.