Skip to content

celer-network/x402-polymarket-agentpay-buyer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

171 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Buyer AgentPay Public Bundle

This is the minimal user-side bundle for giving a Codex or Claude Code agent paid access to the x402 Polymarket data seller. Users do not need to clone the full service repository.

Install Into A User Project

Codex:

curl -fsSL https://raw.githubusercontent.com/celer-network/x402-polymarket-agentpay-buyer/refs/heads/main/install.sh | bash -s -- --codex

Claude Code:

curl -fsSL https://raw.githubusercontent.com/celer-network/x402-polymarket-agentpay-buyer/refs/heads/main/install.sh | bash -s -- --claude

Both:

curl -fsSL https://raw.githubusercontent.com/celer-network/x402-polymarket-agentpay-buyer/refs/heads/main/install.sh | bash -s -- --codex --claude

Configure Buyer Credentials

install.sh already created /tmp/buyer-agentpay.env from the template. Edit it and set:

export BUYER_KEY="<64_HEX_PRIVATE_KEY_NO_0x>"

Recommended: Use A Private Base RPC

By default RPC_URL points at the public https://mainnet.base.org endpoint, which is rate-limited and flaky under load — preflight balance checks, channel ops, and on-chain withdraw confirmations will intermittently fail (in the worst case, leaving the local buyer state with a stuck "pending withdraw" flag that no amount of clicking can clear). For reliable runs, swap it for your own Base mainnet RPC from a provider like Alchemy or NodeReal:

# In /tmp/buyer-agentpay.env
export RPC_URL="https://base-mainnet.g.alchemy.com/v2/<YOUR_API_KEY>"
# or
export RPC_URL="https://base-mainnet.nodereal.io/v1/<YOUR_API_KEY>"

Then re-run start-dashboard.sh. The buyer-node reads its on-chain RPC from Ethereum.Gateway in ~/.x402/buyer-profile.jsonnot directly from the env var — so the profile must contain your chosen RPC. start-dashboard.sh regenerates the profile on every launch (the previous file is preserved as ~/.x402/buyer-profile.json.prev), so changes to RPC_URL take effect the next time you start the dashboard. Editing ~/.x402/buyer-profile.json manually is pointless — it gets overwritten on the next launch; edit the env instead.

Run

bash start-dashboard.sh

Then open http://localhost:9100. The dashboard generates the buyer profile, runs preflight, and exposes a RUN AGENT button.

Where the dashboard page comes from

The public buyer bundle does not store a standalone dashboard.html file. The local page is compiled into the bundled skills/codex-buyer-agentpay/bin/status-bridge binary from the service repository:

// x402-polymarket-data/cmd/status-bridge/main.go
//go:embed dashboard.html

start-dashboard.sh launches that binary and opens http://localhost:9100; the binary serves the embedded page from /.

Syncing dashboard changes into this bundle

When x402-polymarket-data/cmd/status-bridge/dashboard.html, cmd/status-bridge/main.go, or cmd/x402-client changes, rebuild the runtime binaries from x402-polymarket-data and copy them into this public bundle before publishing:

DATA_REPO=/path/to/x402-polymarket-data
BUYER_REPO=/path/to/x402-polymarket-agentpay-buyer

cd "$DATA_REPO"
go test ./...
go build -o "$BUYER_REPO/skills/codex-buyer-agentpay/bin/status-bridge" ./cmd/status-bridge/
go build -o "$BUYER_REPO/skills/codex-buyer-agentpay/bin/x402-client" ./cmd/x402-client/
chmod +x "$BUYER_REPO/skills/codex-buyer-agentpay/bin/status-bridge" \
  "$BUYER_REPO/skills/codex-buyer-agentpay/bin/x402-client"

cd "$BUYER_REPO"
git status --short

Commit the updated binaries together with any bundle docs, scripts, or env template changes. This is what makes dashboard UI fixes available to users who install via install.sh.

How RUN AGENT works

Clicking RUN AGENT forks your local LLM CLI and prompts it to invoke skills/codex-buyer-agentpay/scripts/run-batch-export.sh. The wrapper runs x402-client in batch-export mode; paid x402 calls stream through your AgentPay channel and events feed the Payment Flow / Response panels live.

The dashboard picks codex by default; if you also have claude installed and signed in, the Agent Setup row shows a small switch to claude pill next to "codex signed in" — click it to flip the choice (the selection persists across reloads).

Requirements for RUN AGENT:

  • One of codex (brew install --cask codex or npm i -g @openai/codex) or claude (npm i -g @anthropic-ai/claude-code) on PATH.
  • That CLI must be signed in (codex login or claude auth login).

The dashboard's "Agent Setup → LLM CLI signed in" row reflects this. RUN AGENT requires an authenticated LLM CLI; if no CLI is available, install and sign in to Codex or Claude before starting the agent.

Paid calls spend USDC from the buyer channel.

Advanced: CLI Only

If you don't want the dashboard, run the same steps manually:

source /tmp/buyer-agentpay.env
bash deploy/gen-buyer-profile.sh
bash skills/codex-buyer-agentpay/scripts/preflight.sh

Then ask your Codex / Claude Code agent to run the Polymarket data buyer flow.

Security

  • Use a dedicated buyer key for this workflow.
  • Never commit /tmp/buyer-agentpay.env or BUYER_KEY.
  • Treat BUYER_DATA_DIR as sensitive local state.

About

Buyer-side AgentPay bundle for x402 Polymarket data access. Installs Codex/Claude agent skills, payment runtime scripts, and binaries so agents can discover paid APIs, pay through AgentPay state channels, and fetch market data.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages