caelum0x e99e8fe16a feat(near-spend-guard): real Testnet deploy + TS client + buyer/watchdog agents (Day 4-6, 11)
Deployed SpendGuard to NEAR Testnet for real via near-api-js, driven
programmatically (cargo-near's create-dev-account/sign-with-keychain are
interactive-only, confirmed in the plan's own rehearsal):
contract account spendguard-024e8dd6f7.testnet, deploy + init transactions
both SuccessValue, independently re-verified via a raw RPC call to
rpc.testnet.near.org.

- scripts/near_spend_guard_deploy.ts: generates a keypair, creates the
  account via the public testnet faucet, deploys the built wasm, calls
  new({admin}).
- lib/x402/near_spend_guard_client.ts: typed near-api-js client
  (SpendGuardClient) for request_spend_authorization / spend_to_seller /
  report_dispute_spike / view methods. Does not touch near_gateway.ts /
  near_rpc.ts / near_finality.ts.
- agents/near_spend_controlled_buyer_agent.ts: buyer_agent.ts-pattern agent
  — gets authorized, spends repeatedly through its scoped key.
- agents/near_watchdog_agent.ts: watchdog_agent.ts-pattern agent — triggers
  the dispute-spike circuit breaker.
- scripts/near_spend_guard_full_demo.ts (npm run demo:near-spend-guard):
  one command building the contract, running the full Rust test pass, and
  then a live Testnet bonus run — 25/25 real on-chain spend_to_seller calls
  settled against the real deployed contract, then a second real agent was
  frozen and its key revoked, confirmed by a genuine rejected transaction
  ("Access key ... does not exist").

Real protocol finding baked into the client/agent design: Function Call
Access Keys can never attach a deposit (InvalidAccessKeyError::
DepositWithFunctionCall, hit live against both the local sandbox and real
Testnet) — spend_to_seller takes `amount` as a plain argument instead, with
ExposureBook enforcing the yoctoNEAR cap and the FC key's allowance
enforcing a real, protocol-level prepaid-gas call budget.
2026-11-03 05:03:30 +03:00
..
2026-06-16 02:50:52 +03:00
2026-06-16 02:50:52 +03:00
2026-06-16 02:50:52 +03:00
2026-06-16 02:50:52 +03:00
2026-06-16 02:50:52 +03:00
2026-06-16 02:50:52 +03:00
2026-06-16 02:50:52 +03:00
2026-06-16 02:50:52 +03:00
2026-06-16 02:50:52 +03:00