feat: Solana payment suite — nonce-transfer-build (T1), payment-watch (T0), x402-settle (T2)#130
Open
luongs3 wants to merge 1 commit into
Open
feat: Solana payment suite — nonce-transfer-build (T1), payment-watch (T0), x402-settle (T2)#130luongs3 wants to merge 1 commit into
luongs3 wants to merge 1 commit into
Conversation
Three tool plugins that let a ZeroClaw agent participate in Solana payments without ever holding a signing key it shouldn't: - nonce-transfer-build (T1): builds unsigned, durable-nonce-anchored SPL transfers that survive human approval delays. Operator allowlist + per-tx caps enforced in-plugin before any bytes are built. - payment-watch (T0): read-only chain verification that an expected payment landed (amount, mint, memo) — closes the loop for invoice flows. - x402-settle (T2): HTTP 402 x402 exact-svm scheme settlement with hard per-request caps; verbatim seller memo, partially-signed tx per spec. Pure-Rust wasip2 components (no solana-sdk): shared primitives (base58, compact-u16, instruction encoding, legacy message + durable-nonce construction, JSON-RPC shaping, fail-closed spend policy) are vendored per-plugin under vendor/solana-wasi-core to keep each crate standalone. Host-testable cores with plain cargo test (25 tests across the suite; ATA-derivation golden vector pinned against a real mainnet USDC ATA).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three new tool plugins that let a ZeroClaw agent participate in Solana payments safely, plus the shared pure-Rust primitives they build on (vendored per-plugin to keep each crate standalone):
nonce-transfer-buildbuild_nonce_transferpayment-watchcheck_paymentx402-settlefetch_paid_resourceexactSVM scheme (X-PAYMENT header, partially-signed tx,extra.feePayersponsor, verbatim seller memo ≤256B) with hard per-request caps enforced in-plugin.Why
Payments are the sharpest edge an agent can touch. The suite is designed around one principle: the blast radius of a prompt injection must be bounded by operator config, not model behavior. Allowlists and caps live in the plugin's jailed config section and are checked before any transaction bytes exist; each README documents the threat model, custody tier, and includes a real injection-attempt transcript (tool-level refusal, independent of the model also refusing).
How
wasm32-wasip2components againstwit/v0tool-plugin— nosolana-sdk(it doesn't target wasip2). Base58, compact-u16, instruction encoding, legacy message + durable-nonce construction, JSON-RPC shaping, and the spend-policy engine are implemented in a small shared core, vendored under each plugin'svendor/solana-wasi-core/so every crate stays a self-contained standalone workspace.cargo test— 25 tests across the suite plus 42 in the vendored core, including an ATA-derivation golden vector pinned against a real mainnet USDC ATA.http_client(JSON-RPC / 402 fetch) +config_readonly. Deny-by-default; no sockets, no filesystem.Validation
Local run of the CI gates on all three plugins (stable, aarch64-darwin):
cargo fmt --all -- --check✅cargo test✅ (8 / 7 / 10 per plugin + 42 core)cargo clippy --all-targets -- -D warnings✅ (host)cargo clippy --target wasm32-wasip2 -- -D warnings✅cargo build --target wasm32-wasip2 --release✅ (399 KB / 358 KB / 438 KB)wit/v0untouched (byte-identical to the vendored pin);registry.jsonuntouched (CI-generated).Also exercised end-to-end against a from-source
zeroclawhost (--features plugins-wasm,plugins-wasm-cranelift) on devnet: agent →build_nonce_transfer→ out-of-band human sign → landed transaction (43YH62EC…E3f8, slot 478052328,err: null), andcheck_paymentverifying a live transfer with memo matching.Happy to split the suite into three PRs if you prefer one plugin per PR — they're independent crates.