Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@ destination and a Solana wallet for the source.

Run with `npm install && npm run dev`.

### [`app-kit-earn`](./app-kit-earn)

Browser app that discovers earn vaults on Arc Testnet, deposits and withdraws
USDC, and checks a position using
[App Kit](https://www.npmjs.com/package/@circle-fin/app-kit) with the viem
adapter. Connects to any EIP-6963 browser wallet (e.g., MetaMask).

Run with `npm install && npm run dev`.

### [`app-kit-onramp`](./app-kit-onramp)

Browser app that embeds the Arc Onramp widget with
[App Kit](https://www.npmjs.com/package/@circle-fin/app-kit): mint a session on
a small Node server, then `fetchSession()`, `mountIframe()`, or `openWindow()`.
Requires a Circle API key; run the session server and Vite client together.

Run with `npm install`, then `npm run server` and `npm run dev` in separate
terminals.

### [`app-kit-send`](./app-kit-send)

Browser app that estimates and sends USDC on Arc Testnet using
Expand Down
17 changes: 15 additions & 2 deletions app-kit-bridge-evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,18 @@ npm run build
## Key file

- `src/main.ts` — wallet connect, adapter creation, bridge, and retry.
Change `from` / `to` `chain` and `amount` in the bridge call for different
chains or amounts.
Change `from` / `to` `chain`, `amount`, and optional `token` in the bridge
call for different chains, amounts, or tokens.

## Bridge a non-USDC token

This sample defaults to USDC. To bridge a
[non-USDC token](https://developers.circle.com/cctp/expanded-assets), pass
`token` on the same `kit.bridge()` call in `src/main.ts` — for example
`token: "EURC"` (also `"wETH"`, `"cirBTC"`, or a configured asset's
`tokenId`). Fund the source wallet with that token. `amount` stays a
human-readable decimal string (EURC uses 6 decimals, cirBTC 8, wETH 18).

Both chains must support CCTP for non-USDC, and the token must be configured on
both. Check
[supported blockchains and tokens](https://developers.circle.com/cctp/expanded-assets/concepts/supported-chains-and-domains).
8 changes: 4 additions & 4 deletions app-kit-bridge-evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
},
"devDependencies": {
"typescript": "~7.0.2",
"vite": "^8.2.2"
"vite": "^8.3.0"
},
"dependencies": {
"@circle-fin/app-kit": "^1.14.0",
"@circle-fin/adapter-viem-v2": "^1.17.1",
"viem": "^2.56.3"
"@circle-fin/app-kit": "^1.15.1",
"@circle-fin/adapter-viem-v2": "^1.18.0",
"viem": "^2.56.5"
}
}
3 changes: 2 additions & 1 deletion app-kit-bridge-solana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ calls `bridge()` and `retryBridge()` when needed.

- [Node.js 22 or later](https://nodejs.org/)
- An EIP-6963 EVM browser wallet such as MetaMask
- A Solana browser wallet on `window.solana` such as Phantom
- A Solana browser wallet such as Phantom (`window.solana`) or Solflare
(`window.solflare`)
- Testnet USDC on Solana Devnet
- Native gas tokens for both wallets

Expand Down
10 changes: 5 additions & 5 deletions app-kit-bridge-solana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
},
"devDependencies": {
"typescript": "~7.0.2",
"vite": "^8.2.2"
"vite": "^8.3.0"
},
"dependencies": {
"@circle-fin/adapter-solana": "^1.7.2",
"@circle-fin/adapter-viem-v2": "^1.17.1",
"@circle-fin/app-kit": "^1.14.0",
"viem": "^2.56.3"
"@circle-fin/adapter-solana": "^1.7.3",
"@circle-fin/adapter-viem-v2": "^1.18.0",
"@circle-fin/app-kit": "^1.15.1",
"viem": "^2.56.5"
}
}
6 changes: 4 additions & 2 deletions app-kit-bridge-solana/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ declare global {
}
interface Window {
solana?: SolanaWalletProvider;
solflare?: SolanaWalletProvider;
}
}

Expand Down Expand Up @@ -107,11 +108,12 @@ async function handleSolanaConnect() {
try {
connectSolButton.disabled = true;

if (!window.solana) {
const provider = window.solana ?? window.solflare;
if (!provider) {
throw new Error("No Solana browser wallet found");
}

solanaProvider = window.solana;
solanaProvider = provider;
const connection = await solanaProvider.connect();
solanaWalletInfo.textContent =
connection.publicKey?.toString() ??
Expand Down
24 changes: 24 additions & 0 deletions app-kit-earn/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
83 changes: 83 additions & 0 deletions app-kit-earn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Deposit and withdraw USDC in an earn vault

Use [`@circle-fin/app-kit`](https://www.npmjs.com/package/@circle-fin/app-kit)
to discover earn vaults on Arc Testnet, deposit USDC, check a position, and
withdraw with a browser wallet and the viem adapter.

This Vite + TypeScript page connects an EIP-6963 wallet (for example MetaMask),
creates a Circle adapter from the provider, then calls `earn.exploreVaults()`,
`earn.getDepositQuote()`, `earn.deposit()`, `earn.getPosition()`,
`earn.getWithdrawalQuote()`, and `earn.withdraw()`.

## Prerequisites

- [Node.js 22 or later](https://nodejs.org/)
- An EIP-6963 browser wallet such as MetaMask
- Testnet USDC on Arc Testnet
- Native gas token on Arc Testnet for the wallet transaction

This project does not require environment variables or API keys.

## Install and run

```bash
npm install
npm run dev
```

Open the local Vite URL in a browser with your wallet installed.

```bash
npm run build
```

## What this example does

1. Discovers an EIP-6963 browser wallet and requests account access.
2. Lists active vaults on `Arc_Testnet` with `kit.earn.exploreVaults()`.
3. Creates a viem adapter with `createViemAdapterFromProvider()`.
4. Previews and deposits 1 USDC with `kit.earn.getDepositQuote()` and
`kit.earn.deposit()`.
5. Reads the position with `kit.earn.getPosition()`.
6. Previews and withdraws 1 USDC with `kit.earn.getWithdrawalQuote()` and
`kit.earn.withdraw()`.

## Key file

- `src/main.ts` — wallet connect, vault discovery, quotes, deposit, position,
and withdraw. Change `chain`, `amount`, and the selected vault for a
different chain, amount, or opportunity.

## Deposit from another chain

This sample deposits on the same chain as the vault (`Arc_Testnet`). To deposit
USDC from a wallet on another blockchain into that vault, pass a different
`from.chain` and a `to` destination on the same `kit.earn.deposit()` call in
`src/main.ts` — for example Ethereum Sepolia → Arc Testnet:

```typescript
const result = await kit.earn.deposit({
from: { adapter, chain: "Ethereum_Sepolia" },
to: {
chain: "Arc_Testnet",
recipientAddress, // position owner on the vault chain
},
vaultAddress,
amount: "1",
transferSpeed: "FAST", // optional: "FAST" | "SLOW"
});
```

Fund the source wallet with USDC and gas on the source chain (not Arc). Testnet
sources are Ethereum Sepolia, Arbitrum Sepolia, and Base Sepolia; the vault
destination is Arc Testnet.

A crosschain deposit returns when the bridge submit succeeds
(`result.kind === "cross-chain"`), not when the vault position is funded. Use
`kit.earn.getCrossChainDepositStatus()` or
`kit.earn.waitForCrossChainDeposit()` with `result.execId` to track settlement.
Preview fees with the same `from` / `to` shape on `kit.earn.getDepositQuote()`.

See
[Deposit crosschain into an Earn vault](https://docs.arc.io/app-kit/tutorials/earn/crosschain-deposit)
for routes, fees, and status tracking.
69 changes: 69 additions & 0 deletions app-kit-earn/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<!doctype html>
<!--
Copyright 2026 Circle Internet Group, Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache-2.0
-->

<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Earn USDC on Arc Testnet</title>
<style>
header > div {
display: flex;
align-items: center;
gap: 0.5em;
margin-block-end: 1em;
}
p {
margin: 0;
}
pre:not(:empty) {
background-color: ghostwhite;
padding: 1em;
max-width: 100%;
overflow: auto;
border-radius: 0.5em;
max-height: calc(100vh - 16em);
word-break: break-all;
white-space: pre-wrap;
}
</style>
</head>
<body>
<header>
<div>
<button id="connectWallet">Connect wallet</button>
<p id="walletInfo"></p>
</div>
</header>
<main>
<select id="vaults">
<option value="" disabled selected>--Select vault--</option>
</select>
<button id="checkPosition" disabled>Check Position</button>
<hr />
<button id="depositQuote" disabled>Load deposit quote</button>
<button id="deposit" disabled>Deposit 1 USDC</button>
<hr />
<button id="withdrawQuote" disabled>Load withdrawal quote</button>
<button id="withdraw" disabled>Withdraw 1 USDC</button>
<pre id="output"></pre>
</main>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions app-kit-earn/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "app-kit-earn",
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"devDependencies": {
"typescript": "~7.0.2",
"vite": "^8.3.0"
},
"dependencies": {
"@circle-fin/adapter-viem-v2": "^1.18.0",
"@circle-fin/app-kit": "^1.15.1",
"viem": "^2.56.5"
}
}
Loading
Loading