coinbase / coinbase/agentkit

Proposal: SafeRoute preflight and buffered USDC funding on Base

Open
#1,434 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.3k
Forks
815
Avg merge
13h 31m
Merged PRs (30d)
2

Description

## Problem

AgentKit clients that pay x402 resources on Base can hold ETH/WETH but have insufficient USDC. Failing the request, adding custodial funding logic, or giving the agent broad signing authority are poor defaults. A separate preflight is also useful before an agent signs a token trade or approval.

## Proposed integration

Add an optional TypeScript action provider/example that:

1. sends the proposed Base transaction to SafeRoute Proof and verifies the signed `ALLOW | BLOCK | REVIEW` receipt;
2. on an x402 USDC shortfall, requests an exact buffered AutoFund route;
3. verifies chain 8453, canonical Base USDC, payer, target balance, maximum sell, expiry, calldata, simulation result, and SafeRoute's Ed25519 receipt;
4. asks the existing AgentKit wallet provider to authorize the exact transaction locally;
5. waits for confirmation, rechecks USDC, and retries the merchant once.

SafeRoute never receives a private key or controls the wallet. The live public beta is Base-only, caps AutoFund at $10, and limits slippage to 100 bps.

Integration surfaces:
- MCP: `https://saferoute-x402-production.up.railway.app/mcp`
- OpenAPI: `https://saferoute-x402-production.up.railway.app/openapi.json`
- TypeScript wrapper source: https://github.com/crystalsignal/saferoute/tree/main/packages/x402
- Portable skill: https://github.com/crystalsignal/saferoute/tree/main/skills/saferoute-pay
- Implementation/release: https://github.com/crystalsignal/saferoute/pull/66

The smallest AgentKit-facing API could be a `safeRouteProof` action plus a fetch/payment example; no protocol or wallet-custody change is required. I can prepare a focused PR matching the repository's TypeScript action-provider patterns if maintainers agree on placement.

For embedded distribution, SafeRoute accrues 25% of successfully settled external service fees to a verified referral code; owner, QA, self-paid, failed, and duplicate jobs are excluded.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.