Skip to content

Commit 09c0755

Browse files
Enhance README with detailed setup instructions and project layout fo… (#2)
…r stablecoin FX swaps using Circle Developer Controlled Wallets.
1 parent 14d1682 commit 09c0755

61 files changed

Lines changed: 19797 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Defaults for `supabase start` (local Supabase stack)
2+
# Run `npx supabase start` to boot the local instance, then copy the printed
3+
# values here as `.env.local` (the publishable key is deterministic across machines)
4+
NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
5+
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=
6+
SUPABASE_SECRET_KEY=
7+
8+
# Circle dev-controlled wallets (https://console.circle.com)
9+
CIRCLE_API_KEY=
10+
# 32-byte hex (64 chars). Register once with Circle before use
11+
CIRCLE_ENTITY_SECRET=
12+
# Circle blockchain identifier for Arc Testnet
13+
CIRCLE_BLOCKCHAIN=ARC-TESTNET
14+
15+
# Circle App Kit.
16+
KIT_KEY=
17+
NEXT_PUBLIC_ARC_CHAIN=Arc_Testnet
18+
19+
# Application-level percentage fee applied to every swap
20+
APP_FEE_BPS=25
21+
# Address that receives swap fees. Run `npm run wallet:generate` to provision a
22+
# Circle wallet for the platform operator and auto-fill this value
23+
APP_FEE_RECIPIENT=

.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env.local
35+
36+
# Circle entity secret recovery file (generated by `npm run wallet:generate`)
37+
circle-recovery.dat
38+
39+
# vercel
40+
.vercel
41+
42+
# typescript
43+
*.tsbuildinfo
44+
next-env.d.ts

README.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,78 @@
11
# arc-stablecoin-fx
2-
This sample app demonstrates stablecoin FX swaps between USDC and EURC using the App Kit Swap SDK on Arc.
2+
3+
This sample app demonstrates stablecoin FX swaps between USDC and EURC using the App Kits Swap SDK and Circle Developer Controlled Wallets on Arc.
4+
5+
<img alt="Arc Stablecoin Fx" src="public/screenshot.png" />
6+
7+
## Getting started
8+
9+
### Prerequisites
10+
11+
- Node.js 20+ and npm
12+
- Docker (for local Supabase)
13+
- A [Circle](https://console.circle.com) account with API key + entity secret
14+
- A Circle App Kit `KIT_KEY`
15+
16+
### 1. Install dependencies
17+
18+
```sh
19+
npm install
20+
```
21+
22+
### 2. Start the local Supabase stack
23+
24+
```sh
25+
npm run db:start
26+
```
27+
28+
This boots Postgres, Auth, etc. via the Supabase CLI and runs the migrations in
29+
`supabase/migrations/`. Use `npm run db:status` to print the local URLs and keys,
30+
`npm run db:reset` to wipe + re-migrate, and `npm run db:stop` to shut it down.
31+
32+
### 3. Configure environment
33+
34+
Copy the example file and fill in the blanks:
35+
36+
```sh
37+
cp .env.example .env.local
38+
```
39+
40+
- `NEXT_PUBLIC_SUPABASE_URL` / `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` /
41+
`SUPABASE_SECRET_KEY` - from `npm run db:status`.
42+
- `CIRCLE_API_KEY` - from the Circle console.
43+
- `CIRCLE_ENTITY_SECRET` - your 32-byte hex entity secret. Must be registered
44+
with Circle once before use.
45+
- `CIRCLE_BLOCKCHAIN` - Circle blockchain identifier (default `ARC-TESTNET`).
46+
- `KIT_KEY` - Circle App Kit key.
47+
- `NEXT_PUBLIC_ARC_CHAIN` - App Kit chain identifier (default `Arc_Testnet`).
48+
- `APP_FEE_BPS` - platform fee in basis points (default `25` = 0.25%).
49+
- `APP_FEE_RECIPIENT` - leave blank, then run the script below.
50+
51+
### 4. Provision the platform fee wallet
52+
53+
Creates a Circle wallet to receive swap fees and writes its address back to
54+
`.env.local` as `APP_FEE_RECIPIENT`:
55+
56+
```sh
57+
npm run wallet:generate
58+
```
59+
60+
### 5. Run the dev server
61+
62+
```sh
63+
npm run dev
64+
```
65+
66+
App is at http://localhost:3000.
67+
68+
## Project layout
69+
70+
- `src/app/(auth)/` - register / login flows
71+
- `src/app/(app)/dashboard/` - authenticated swap panel
72+
- `src/app/(app)/dashboard/history/` - trades history
73+
- `src/app/api/webhooks/circle/` - Circle webhook receiver
74+
- `src/components/swap/`, `src/components/trades/`, `src/components/wallet/` - feature UI
75+
- `src/lib/circle/`, `src/lib/appkit/` - Circle wallets + App Kit integration
76+
- `src/lib/supabase/` - Supabase client/server/admin helpers
77+
- `supabase/migrations/` - database schema
78+
- `scripts/` - one-off operator scripts

components.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "base-nova",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "",
8+
"css": "src/app/globals.css",
9+
"baseColor": "neutral",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"iconLibrary": "lucide",
14+
"rtl": false,
15+
"aliases": {
16+
"components": "@/components",
17+
"utils": "@/lib/utils",
18+
"ui": "@/components/ui",
19+
"lib": "@/lib",
20+
"hooks": "@/hooks"
21+
},
22+
"menuColor": "default",
23+
"menuAccent": "subtle",
24+
"registries": {}
25+
}

eslint.config.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { defineConfig, globalIgnores } from "eslint/config";
2+
import nextVitals from "eslint-config-next/core-web-vitals";
3+
import nextTs from "eslint-config-next/typescript";
4+
5+
const eslintConfig = defineConfig([
6+
...nextVitals,
7+
...nextTs,
8+
// Override default ignores of eslint-config-next.
9+
globalIgnores([
10+
// Default ignores of eslint-config-next:
11+
".next/**",
12+
"out/**",
13+
"build/**",
14+
"next-env.d.ts",
15+
]),
16+
]);
17+
18+
export default eslintConfig;

next.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
4+
/* config options here */
5+
};
6+
7+
export default nextConfig;

0 commit comments

Comments
 (0)