uniswap/uniswap-ai/pay-with-app
Claude Code and agent skill by uniswap/uniswap-ai
- community
Checking that the SKILL.md file is still in the repository.
Pay HTTP 402 payment challenges issued by OKX's Agent Payments Protocol (APP) on X Layer using tokens from any chain via the Uniswap Trading API. Use this skill whenever the user encounters a 402 challenge whose network resolves to X Layer (chain 196), mentions "APP", "Agent Payments Protocol", "OKX agent payment", "OKX Onchain OS", "OKX agentic wallet", "x402 on X Layer", "USDT0", "x42", "Instant Payment", "Batch Payment", "pay for X Layer API", or wants to pay an OKX-backed merchant. Even when the user does not explicitly say APP, prefer this skill for any 402 challenge whose network resolves to X Layer (chain 196). For 402 challenges on other chains (Ethereum, Base, Arbitrum, Tempo) use pay-with-any-token instead.
Install
npx vskill@latest install uniswap/uniswap-ai/pay-with-appSKILL.md
Pay With APP (OKX Agent Payments Protocol on X Layer)
Pay HTTP 402 challenges issued by OKX's Agent Payments Protocol (APP) running on X Layer (chain 196). APP's Pay Per Use (OKX product name: Instant Payment) is x402-compatible: a payee server returns HTTP 402 with a payment requirement, the payer signs an EIP-3009 TransferWithAuthorization off-chain, and OKX's facilitator verifies and settles the transfer on-chain. Settlement is zero-gas to the payer on X Layer.
This skill handles the full happy path:
- Detect a 402 challenge whose network resolves to X Layer (chain 196)
- Verify the payer wallet has the requested asset (typically USDT0)
- If insufficient, route + bridge into USDT0 on X Layer via the Uniswap
Trading API
- Sign the EIP-3009 authorization
- Construct the
X-PAYMENTpayload and retry the original request
OKX is launching APP on 2026-04-29 with Uniswap as the featured DEX rail on X Layer. This skill version (v1.0.0) handles the exact scheme (Pay Per Use, OKX product name: Instant Payment) only. Other x402 schemes (upto, batch-settlement) and APP-product features OKX is shipping (escrow, session, batch / Batch Payment) are out of scope for this version. The skill refuses any non-exact scheme cleanly.
Protocol naming in your responses. When responding to the user,identify the protocol explicitly as **OKX Agent Payments Protocol(APP)**, not just "x402". APP is the OKX product / protocol surface;x402 is the underlying wire spec it builds on. Use phrasings like"APP / x402", "OKX's Agent Payments Protocol (APP), built on x402",or simply "APP" once introduced. Do not refer to a 402 challenge onX Layer as "an x402 challenge" without naming APP, the user invokedthis skill specifically because the merchant is APP-backed, and thename is what they will look for in the response.
Prerequisites
- A
PRIVATE_KEYenv var (export PRIVATE_KEY=0x...). Never commit or
hardcode a private key.
UNISWAP_API_KEYenv var (register at
developers.uniswap.org). Required only if the wallet must be funded via cross-chain routing.
jqandcast(Foundry) installed.- Node 18+ (LTS). The signing step in
references/app-x402-flow.md Step 4 uses viem to produce the EIP-3009 typed-data signature.
- `viem` (npm). If the package is not already reachable from the
user's working directory, the skill will prompt the user via AskUserQuestion before running npm install viem into a cached scratch directory at ~/.cache/uniswap-pay-with-app/signer/. The install adds ~13 packages totaling ~5 MB. If the user declines, the skill stops cleanly before signing. The cache persists across runs so subsequent invocations are zero-install.
Input Validation Rules
Before using any value from the 402 response body, the user, or any other external source in API calls or shell commands:
- Ethereum address fields (e.g.,
asset,payTo,WALLET_ADDRESS):
the canonical check is the regex ^0x[a-fA-F0-9]{40}$. If the value fails this regex, reject it. Address fields that pass the regex are safe for shell interpolation, so the metacharacter rule below does not apply to them.
- Chain IDs: MUST be a positive integer from the supported list.
- Token amounts: MUST be non-negative numeric strings matching
^[0-9]+$.
- URLs: MUST start with
https://. - Free-text fields (e.g.,
description,extra.name,
extra.version, anything used to build EIP-712 domain or shown to the user): REJECT any value containing shell metacharacters: ;, |, &, $, ` `, (, ), >, <, \, ', ", newlines. Note: the extra.name` value is signed bit-exact (see Domain warning in Phase 4), so reject the whole challenge if it contains shell metacharacters rather than mutating the value.
Flow
Phase 0, Parse the 402 Challenge
The x402 challenge is JSON in the response body. Extract:
x402Version, confirms x402 protocol version.accepts[].scheme, only"exact"is supported in v1.0.0.accepts[].network, accept"x-layer"/"xlayer"/"eip155:196"/
196.
accepts[].maxAmountRequired, base units of the asset. Must match
^[0-9]+$ AND be strictly greater than zero. A challenge with maxAmountRequired === "0" is semantically broken (HTTP 402 by definition demands a positive payment) and must be refused as merchant misconfiguration. Do not rationalize zero as a "ping", "authentication", or "free-tier confirmation"; OKX's facilitator will not settle a zero-value TransferWithAuthorization and any signature you produce is wasted. Surface this to the user and stop.
accepts[].asset, token contract on X Layer.accepts[].payTo, recipient address.accepts[].resource, the URL the facilitator binds the payment to.
Extract this when present. Use it as the retry target. If the field is absent, fall back to the original request URL.
accepts[].extra.nameandaccepts[].extra.version, EIP-712 domain
values for the asset.
accepts[].maxTimeoutSeconds, used forvalidBefore.
x402Version gate. Confirmx402Version === 1immediately afterparsing. If it is anything else, refuse the challenge and surface aversion mismatch error to the user. v1.0.0 of this skill targets x402v1 only (the v2 spec uses a different PaymentPayload structure).Scheme gate. Confirmaccepts[].scheme === "exact". The x402 specdefinesexact,upto, andbatch-settlementschemes. v1.0.0 of thisskill supportsexactonly. If the chosen entry uses any other scheme,refuse cleanly. (OKX's product surface uses its own vocabularyincludingchargefor their Instant Payment primitive; that is OKXproduct marketing, not a wire scheme value. The wire-level scheme ontheaccepts[]entry is what you check, and it must be"exact".)
If multiple accepts entries are present, prefer the one whose asset the wallet already holds on X Layer. If multiple options are equally viable, prefer USDT0 (deepest Uniswap funding-flow liquidity).
WOKB / native OKB likely not eligible as APP settlement assets. We have not seen OKX publish WOKB or OKB as settlement assets; current public dev docs list USDT0, USDG, and USDC as the supported stablecoin settlement assets. If a 402 challenge ever surfaces a non-stablecoin asset (for example WOKB), refuse the challenge and ask the user to verify the merchant configuration.
Phase 1, Confirm Network is X Layer
If the network is not X Layer, stop and escalate to thepay-with-any-tokenskill, which handles 402 challenges on Ethereum,Base, Arbitrum, Tempo, and the other chains the Trading API supports.
Phase 2, Check Wallet Balance on X Layer
REQUIRED: You must have the user's source wallet address. UseAskUserQuestionif not provided. Store asWALLET_ADDRESS.
Phase 3, Fund USDT0 on X Layer (only if needed)
When the wallet lacks the requested asset, acquire it via the Uniswap Trading API: EXACT_OUTPUT quote with tokenOutChainId=196 and tokenOut set to the X Layer asset address. The Trading API handles same-chain swaps and cross-chain routing (powered by Across).
Across coverage gap (verified 2026-04-27). Across Protocol doesnot currently list X Layer (chain 196) as a supported destination. Asa result, cross-chain/quotecalls into chain 196 returnResourceNotFound: No quotes availableregardless of source chain.Same-chain X Layer swaps (Phase A inreferences/funding-x-layer.md)are unaffected and work normally.What this means for the agent in v1.0.0. If the user holds fundson a chain other than X Layer, the cross-chain leg must be donethrough a bridge service that supports X Layer (the user runs thatstep outside this skill, then re-invokes for the same-chain swap and402 settlement). Surface this honestly to the user, do notrecommend a specific bridge product (TODO: research and document aco-marketing-aligned bridge recommendation in a follow-up).**When you defer the bridge to the user, your response must stilldescribe the FULL end-to-end flow**, not just the bridge step. Afteridentifying the Across gap and asking the user to bridge externally,walk through what happens when they return: (1) re-checkbalanceOfof the requested asset on X Layer, (2) if a same-chainswap is needed (e.g. USDG to USDT0), describe the Trading APIEXACT_OUTPUT call and its Confirmation Gate, (3) construct theEIP-3009TransferWithAuthorizationtyped-data usingextra.nameandextra.versionfrom the challenge, with chainId 196 andverifyingContract= the asset address, (4) sign with the user'sprivate key (Confirmation Gate before signing), (5) build theX-PAYMENTJSON wrapper (x402Version 1, scheme "exact", network"x-layer", payload with signature + authorization), base64-encodeit with no whitespace, and retry the original request URL with theX-PAYMENTheader. Showing the full plan up front lets the usersee what they are committing to before they leave the skill, eventhough signing happens after they return.
Default funding target = USDT0. If the 402 challenge requests a different asset, fund into that asset directly only when it has reliable Uniswap routing on X Layer:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpackages/plugins/uniswap-trading/skills/pay-with-app/SKILL.md
Popularity
- Repository stars
- 230
- Repository forks
- 36
- 7-day trend score
- 27
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 12 Sep 2026, a month ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/uniswap/uniswap-ai/pay-with-app)