Developer docs

Build with Arc Drift.

Arc Drift helps freelancers, creators, companies, and agencies run milestone and time-based escrow payments with Circle wallets and Arc Testnet USDC. This page maps the app flow, V2 routes, env setup, and recovery behavior.

Quick start

npm install
npm run dev

# deploy contract
npx hardhat run scripts/deploy.js --network arcTestnet
1

Email login

Circle creates or restores the user, then returns a PIN challenge and wallet session.

2

Wallet funding

The app copies the Arc wallet and opens Circle Faucet for Arc Testnet USDC.

3

Rule setup

The user chooses amount, recipient, timing, and transfer type.

4

Approval

Circle signs an approval transaction for the USDC amount.

5

Drift creation

Circle signs the contract call that stores the stream rule on Arc Testnet.

6

History recovery

Reconnect loads contract events so progress and tx links survive refresh or device changes.

Environment

Required config.

CIRCLE_API_KEY

Server-side Circle API key used by the app routes.

NEXT_PUBLIC_CIRCLE_APP_ID

Circle app id used by the PIN challenge SDK.

NEXT_PUBLIC_ARC_DRIFT_CONTRACT_ADDRESS

Arc Drift Core contract on Arc Testnet.

NEXT_PUBLIC_USDC_ADDRESS

Arc Testnet USDC address.

ARC_RPC_URL

Arc Testnet RPC endpoint for reads, balances, and event history.

ADMIN_DASHBOARD_PASSWORD

Password gate for the private /admin dashboard.

ADMIN_ALLOWED_WALLETS

Comma-separated Arc wallet allowlist for /admin access.

NEXT_PUBLIC_APP_URL

Base URL used when generating public payment links.

RESEND_API_KEY

Optional email provider key for outbound V2 notifications.

NOTIFICATION_FROM_EMAIL

Optional verified sender address for notification emails.

PRIVATE_KEY

Optional deployer key for Hardhat contract deployment.

API routes

Server endpoints.

POST /api/circle-auth

Creates or restores a Circle user, then ensures an Arc Testnet SCA wallet exists.

POST /api/get-wallet

Polls Circle for the connected wallet address and available blockchains.

POST /api/usdc-balance

Reads USDC balance from Arc Testnet for the connected wallet.

POST /api/approve-usdc-challenge

Creates the Circle challenge for USDC allowance approval.

POST /api/create-drift-challenge

Creates the Circle challenge that calls createDrift on Arc Drift Core.

POST /api/transaction-proof

Polls Circle transaction history for tx hash proof after a challenge completes.

POST /api/stream-history

Reads Arc Drift contract events and restores stream progress plus tx links.

POST /api/execute-drift-challenge

Creates a Circle challenge to claim unlocked stream funds.

POST /api/cancel-drift-challenge

Creates a Circle challenge to cancel cancellable escrows.

POST /api/admin/summary

Password and wallet-protected admin snapshot rebuilt from on-chain events.

POST /api/payment-link

Creates a database-free encoded public payment request link.

POST /api/notifications

Queues stream lifecycle emails when an email provider is configured.

V2 surfaces

Added without changing the main app.

/dashboard

User stream dashboard

Wallet owners can view active, completed, cancelled, and recurring streams, then claim or cancel eligible escrows.

/admin

Private admin dashboard

Circle wallet and password-gated operator view for wallets, USDC volume, stream counts, and transaction hashes without a database.

/pay/[request]

Public payment links

Encoded links let clients and creators share a requested recipient, amount, timeframe, and memo.

/docs

Docs V2

Documents routes, contract events, payment links, notification hooks, and the Arc Drift escrow workflow.

Contract

Arc Drift Core.

createDrift(
  address recipient,
  uint256 amount,
  uint256 startTime,
  uint256 endTime,
  uint256 interval,
  RuleType ruleType
)
DriftCreated

Primary event used to restore stream metadata and creation tx hash.

DriftExecuted

Shows withdrawal/execution transactions in the history panel.

DriftCanceled

Shows cancelled streams and refund transactions.

Stream rules

Supported transfers.

Streaming payment

Linear unlock between start and end time.

Delayed transfer

Full amount unlocks only after the deadline.

Cancellable transfer

Sender can cancel before the deadline and recover unclaimed funds.

Recurring payment

Unlocks in fixed installments based on the interval.