cred402/sdk/rust/README.md
caelum0x 2d43618725 feat: real integrations (Casper Testnet, x402/EIP-712, MCP, RealFi, cross-chain), wallet sign-in, branding
Replace the design-note docs (p1–p7) with the implemented "make it real" phase
docs (p8–p10) and wire production-grade, env-gated real integrations:

- p8 Casper Testnet: byte-exact deploys + WASM install via casper-js-sdk; live
  node reads (node.testnet.casper.network); CRED402_CHAIN=sim|testnet transport.
- p9 x402 + data + MCP: real EIP-712 typed-data digests (@casper-ecosystem/
  casper-eip-712); casper-x402 facilitator client (x402 V2); live Open-Meteo GHI;
  official @modelcontextprotocol/sdk server; casper-sidecar SSE event feed.
- p10 RealFi + cross-chain: real Stripe test-mode webhooks (HMAC-verified) and
  Plaid sandbox → privacy-preserving on-chain envelopes; Base Sepolia EVM deploy
  (Foundry); reachable via /api/realfi/* and /api/x402/facilitator routes.
- Sign-in with Casper Wallet: real extension provider + challenge/ed25519/session
  flow (/v1/auth/wallet/*), console connect + sign-in button.
- Branding: Cred402 logo mark, favicon, OG image; Vercel config for the console.

All env-gated with sim/free-API fallbacks; full suite green, all toolchains
(TS/Rust/Go/Solidity) build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 00:37:36 +03:00

1.1 KiB

Cred402 Rust SDK + CLI

A real blocking HTTP client (ureq + serde) for the Cred402 protocol, plus a cred402 CLI. Talks to the production /v1 surface (envelope, bearer auth, idempotency) and the raw /api routes.

Library

use cred402::{Client, types::motes_to_cspr};

let c = Client::new("http://localhost:4021").with_api_key("c402_...");
let explain = c.explain_credit("EvidenceSellerAgent")?;
let line = explain["decision"]["credit_line"].as_str().unwrap_or("0");
println!("credit line: {:.2} CSPR", motes_to_cspr(line));

Methods: health, list_agents, get_agent, credit_pool, explain_credit, marketplace, economics, analytics, search, screen_compliance, register_agent, open_credit_line, draw_credit, repay_credit, verify_operator, run_demo.

CLI

cargo build
./target/debug/cred402 demo          # seed live data
./target/debug/cred402 analytics     # protocol dashboard
./target/debug/cred402 agents
./target/debug/cred402 explain EvidenceSellerAgent
./target/debug/cred402 --api http://host:4021 --key c402_... market

cargo build is clean.