Coinbase Onramp + Offramp (feature-flagged, mock mode) with server-side screening; USDC as dollars #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/coinbase-ramps"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This reopens the work from web #2 under Taskuler-bot so George can review it. Head:
feat/coinbase-ramps@f596353(merge of #3 @786e1f7into the screening update @7c5ddd5).Stacked on #3 (
feat/nov9-tax-notice-cr2-plan@786e1f7, keepsTaxNoticeand the CR2 plan/sketch aligned with contracts #5 @1f2e460 / #6 @c988b9c). George's request, relayed by Taskuler on Nov 10, 2026, 10:29 AM CT: "start the coinbase work". PR only: don't merge, deploy, sign up for Coinbase/CDP, submit an app for approval, or spend.What this adds (Coinbase UI off by default; live escrow screening on unless disabled)
Funding (Post job, USDC): "Need USDC? Buy it with Coinbase" shows wallet USDC vs. the total to approve (bounty + fee + deposit) and pre-fills the shortfall. Coinbase Onramp delivers USDC to the customer's own connected wallet on Arbitrum, then they click Approve & post as usual. Taskuler never holds funds, and
TaskulerMarketis unchanged. While the wallet is short, Approve & post stays disabled (ramps flag only)./withdraw (builders): "Cash out USDC to your bank with Coinbase". This follows Coinbase's Offramp flow: hosted sell page, redirect back, read the transaction (
to_address,sell_amount) from the status API, then the user sends the USDC from their wallet (within Coinbase's 30-minute window), and Coinbase pays the bank. Before sending, the app checks the asset is USDC, the network matches, and the amount isn't more than the wallet holds.Screening gate on posting, funding, bidding and Market withdraw (DECIDED 2026-11-10). VPN/proxy/Tor is blocked (VH2; browsing stays open). Chainalysis runs on top of OFAC (BS2). Syria stays on the default geo-block (counsel list):
CU,IR,KP,SYplusUA: Crimea/Sevastopol/Donetsk/Luhansk. Once screening is live (COINBASE_RAMPS_MODE=liveandVITE_SCREENING_ENABLEDunset /auto), the escrow gate runs by default on every Approve & post, on Approve deposit & bid, and on Market Withdraw, unless it is explicitly disabled withVITE_SCREENING_ENABLED=false. Mock mode stays previewable (npm run dev:mocksets the flag totrue). The overall Coinbase feature flag (VITE_COINBASE_RAMPS_ENABLED) stays off by default, so nothing Coinbase-related goes live without keys and explicit enablement. Coinbase buy/cash-out are always screened when the ramps UI is on, regardless of the escrow flag.USDC shown as dollars everywhere
amt()is used (Market, job detail, post, withdraw, history): "$100 (USDC)", "$12.50 (USDC)". Other tokens are unchanged.Server (
server/): Fetch-style handlers. The same code runs as a standalone Node server (npm run api) or insidenpm run devthrough a Vite plugin (mounted in live mode, when ramps or a screening preview is on, or when screening isauto, so the client can read the server mode).GET /api/ramps/config,POST /api/ramps/screen(action:fund|buy|cashout|bid|withdraw)POST /api/ramps/onramp/sessionuses CDP v2 Create Onramp Session (POST https://api.cdp.coinbase.com/platform/v2/onramp/sessions,purchaseCurrency=USDC,destinationNetwork=arbitrum,purchaseAmount,redirectUrl,clientIp,partnerUserRef) and returnssession.onrampUrl.POST /api/ramps/offramp/sessionuses the Session Token API (POST https://api.developer.coinbase.com/onramp/v1/token,addresses:[{address, blockchains:["arbitrum"]}],assets:["USDC"],clientIp), then buildshttps://pay.coinbase.com/v3/sell/input?sessionToken=…&partnerUserRef=…&redirectUrl=….GET /api/ramps/offramp/statususesGET /onramp/v1/sell/user/{partnerUserRef}/transactions. Each ref is bound to the wallet that opened it.@coinbase/cdp-sdk/authgenerateJwt. The SDK is server-only and is not in the browser bundle.*); live mode needs a fresh wallet signature (≤5 min) before a session is minted; screening runs again server-side before every session;clientIpcomes from the socket or one explicitly trusted proxy header, neverX-Forwarded-For.Checks (server-side, fail closed: a check that's on but can't run refuses the action and leaves browsing open):
SDN.CSV(Digital Currency Address - … 0x…). Refreshed hourly; refuses if the last good refresh is over 2 hours old (0005, Nov 8, provisional). Live smoke test: 94 EVM addresses parsed, and a listed address is blocked.GET https://public.chainalysis.com/api/v1/address/{address},X-API-Key) — DECIDED (BS2, Nov 10).CU,IR,KP,SYplusUA: Crimea/Sevastopol/Donetsk/Luhansk(DECIDED Nov 10; Syria stays on the counsel list). Country comes from a trusted CDN header (e.g.cf-ipcountry) or ipapi.is.is_vpn/is_proxy/is_tor; the free key allows 1,000 lookups a day) plus the Tor bulk exit list (free). Each check can still be turned off withSCREEN_*=false.UI copy makes no compliance claims. No W-9/W-8 collection. The tax notice is unchanged on Withdraw and Work history.
How to run mock mode
Connect any injected wallet. On Post job pick USDC, then Buy … with Coinbase. That opens
/ramps/mock-coinbase, a clearly labelled stand-in, not Coinbase. Buy now (mock) credits a mock wallet balance and returns you to the form. On Withdraw, Withdraw (mock) the USDC row first (it lands in the mock wallet; this button is also screening-gated), then Cash out, then Cash out now (mock), then Send … to Coinbase (mock). The yellow Mock mode bar has a "Screening result" select for previewing the blocked states: sanctioned wallet, blocked region, VPN/proxy, Tor, and screening outage. Mock mode makes no network calls and needs no keys.Real vs. stubbed
pay.coinbase.comin a popup (Coinbase says the widget can't be iframed).balanceOf/transferon native USDC (Arbitrum One0xaf88…5831).COINBASE_RAMPS_MODE=mock.POST /v2/onramp/orders)Coinbase facts, checked against current docs on Nov 10, 2026
(a) Hosted guest checkout ending June 30, 2026: matches the date, but the docs still use future tense. Every Onramp page carries: "Will be deprecated on June 30, 2026: Guest Checkout (debit card, Apple Pay) via the Coinbase-hosted Onramp widget is being discontinued. Use the Headless Onramp API instead" (Onramp overview, Coinbase-hosted Onramp, FAQ). I found no page confirming that it actually ended. Assume it's gone: the hosted flow in this PR is for Coinbase account holders (card/bank linked to Coinbase, or balance). Offramp never had guest checkout: "A Coinbase account with linked bank details is required for Offramp" (FAQ).
(b) Guest card buyers need the Headless API, US-only, with app approval: confirmed, with details. "For Apple Pay or debit card flows, start with the Headless Onramp API — you get access immediately after your app is approved." Headless is "Card payment methods only · Up to $2.5K weekly for cards · US-only" (overview). "Available for US users with valid US phone numbers … not a VoIP phone number"; users' email and phone must be OTP-verified (phone re-verified every 60 days); "apply for access" via support.cdp.coinbase.com/onramp-onboarding (Headless Onramp). On the web it is Apple Pay in an iframe (Google Pay is Android only). It also needs domain allowlisting, domain-ownership verification, no other Apple Merchant ID on the domain, and acceptance of Coinbase's Guest Checkout Terms. A "debit card" here means a card inside Apple Pay or Google Pay, not a typed card form. Embedded orders, where Coinbase collects the phone, email and OTP, need separate account enablement. Sandbox works by prefixing
partnerUserRefwithsandbox-.(c) Fees (claimed: ~2.5% card, 0.5% bank, 0% USDC if approved): partly matches.
coinbase_fee.Also checked: USDC on Arbitrum isn't confirmed. The Layer 2 networks table lists USDC on "Ethereum / Base / Polygon / Solana / Optimism / Avalanche C-Chain", without Arbitrum (ETH, DAI and wBTC do list Arbitrum). The FAQ says Onramp supports whatever Coinbase.com supports and points to the Buy/Sell Options API. Once keys exist, call
GET /onramp/v1/buy/options?country=US&subdivision=ILand the sell options before relying onRAMPS_NETWORK=arbitrum. If Arbitrum USDC isn't offered, the options are Base delivery plus a bridge, or deferring ramps.Other docs facts used: session tokens are single-use and expire after 5 minutes; Offramp requires
partnerUserRefandredirectUrl; redirect URLs must be on the Onramp & Offramp domain allowlist (otherwise "silently ignored"); new integrations start in trial mode until the onboarding form is approved (welcome).What George would need to do (each needs his OK)
CDP_API_KEY_IDandCDP_API_KEY_SECRETon the server only.https://app.taskuler.com. SetRAMPS_REDIRECT_BASE_URLandRAMPS_ALLOWED_ORIGINSto match. Optionally set a display name.CHAINALYSIS_API_KEY; ipapi.is (free, 1,000/day) asIPAPI_IS_API_KEY. Alternatively, behind Cloudflare, setRAMPS_TRUSTED_IP_HEADER=cf-connecting-ipandRAMPS_TRUSTED_COUNTRY_HEADER=cf-ipcountry; ipapi.is is still needed for VPN/proxy, and the Tor list is free.COINBASE_RAMPS_MODE=liveandVITE_COINBASE_RAMPS_ENABLED=true, and runnpm run apibehind the same origin or setVITE_RAMPS_API_URL. LeaveVITE_SCREENING_ENABLEDunset so the escrow gate defaults ON in live; set it tofalseonly to disable the gate.Decided Nov 10 (removed from open questions)
SCREEN_*kill switch).Open questions
/workspace/tw/previews/coinbase-*.pngandweb-cr2-sketch.png(on the agent box; regenerate coinbase shots withscripts/previews.py).