@veridex/agentic-payments 0.1.1-beta.3 → 2.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +44 -44
  2. package/STACKS_IMPLEMENTATION_PLAN.md +700 -0
  3. package/dist/index.d.mts +1041 -5
  4. package/dist/index.d.ts +1041 -5
  5. package/dist/index.js +10586 -3402
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +10539 -3367
  8. package/dist/index.mjs.map +1 -1
  9. package/docs/PROTOCOL_INTEGRATION.md +945 -0
  10. package/package.json +3 -3
  11. package/src/AgentWallet.ts +211 -2
  12. package/src/chains/ChainClientFactory.ts +9 -0
  13. package/src/chains/StacksChainClient.ts +139 -0
  14. package/src/index.ts +16 -0
  15. package/src/middleware/veridexPaywall.ts +827 -0
  16. package/src/oracle/PythFeeds.ts +4 -0
  17. package/src/oracle/PythOracle.ts +32 -3
  18. package/src/protocols/acp/ACPHandler.ts +220 -0
  19. package/src/protocols/acp/index.ts +1 -0
  20. package/src/protocols/ap2/AP2Handler.ts +279 -0
  21. package/src/protocols/ap2/index.ts +1 -0
  22. package/src/protocols/base/ProtocolDetector.ts +167 -0
  23. package/src/protocols/base/ProtocolHandler.ts +79 -0
  24. package/src/protocols/base/index.ts +3 -0
  25. package/src/protocols/base/types.ts +110 -0
  26. package/src/protocols/index.ts +5 -0
  27. package/src/protocols/ucp/UCPHandler.ts +272 -0
  28. package/src/protocols/ucp/index.ts +1 -0
  29. package/src/protocols/x402/X402Handler.ts +169 -0
  30. package/src/protocols/x402/index.ts +1 -0
  31. package/src/react/hooks.ts +204 -1
  32. package/src/session/StacksSpendingTracker.ts +136 -0
  33. package/src/types/errors.ts +5 -0
  34. package/src/x402/NonEvmPaymentSigner.ts +565 -0
  35. package/src/x402/PaymentParser.ts +1 -0
  36. package/src/x402/PaymentSigner.ts +5 -4
  37. package/src/x402/adapters/StacksFacilitatorAdapter.ts +309 -0
  38. package/tests/chains.test.ts +50 -0
  39. package/tests/middleware.test.ts +673 -0
  40. package/tests/protocols.test.ts +428 -0
  41. package/tests/stacks.test.ts +382 -0
package/README.md CHANGED
@@ -3,67 +3,67 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@veridex/agentic-payments.svg)](https://www.npmjs.com/package/@veridex/agentic-payments)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- A comprehensive SDK for autonomous agent payments, built on top of `@veridex/sdk`. This package provides session key management, x402 protocol support, UCP credential provider, MCP server integration, and multi-chain payment routing.
6
+ A comprehensive SDK for autonomous agent payments, built on top of `@veridex/sdk`. This package provides session key management, **universal protocol support (x402, UCP, ACP, AP2)**, MCP server integration, and multi-chain payment routing.
7
7
 
8
- ## Features
8
+ ## The Universal Payment SDK for AI Agents
9
9
 
10
- - **Session Key Management**: Secure, time-limited signing keys with spending limits
11
- - **x402 Protocol**: Automatic HTTP 402 payment handling
12
- - **UCP Integration**: Universal Credential Protocol support for payment tokenization
13
- - **MCP Server**: Model Context Protocol server for LLM integration
14
- - **Multi-Chain Support**: EVM, Solana, Aptos, Sui, and Starknet
15
- - **Real-Time Pricing**: Pyth Network oracle integration
16
- - **Performance Optimizations**: Client-side nonce tracking, transaction batching, confirmation polling
10
+ **One Wallet. Any Protocol. Global Access.**
17
11
 
18
- ## Installation
12
+ The Veridex SDK (`@veridex/agentic-payments`) is the standard financial layer for autonomous agents. It bridges the gap between competing protocols (ACP, UCP, x402, AP2), allowing your agent to pay for anything, anywhere, with a single line of code.
13
+
14
+ ## 🌐 Protocol Support
15
+
16
+ | Protocol | Creator | Status | Use Case |
17
+ |----------|---------|--------|----------|
18
+ | **x402** | Coinbase/Cloudflare | ✅ Full | Web-native micropayments |
19
+ | **UCP** | Google/Shopify | ✅ Full | Commerce/Search integration |
20
+ | **ACP** | OpenAI/Stripe | 🔜 Q2 2026 | ChatGPT ecosystem |
21
+ | **AP2** | Google | 🔜 Q2 2026 | A2A mandate delegation |
22
+ | **AXTP** | Circuit/Chisel | 🔜 Q3 2026 | MCP monetization |
23
+
24
+ ## 🚀 Features
25
+
26
+ - **Universal Protocol Support**: Automatically handles **ACP** (OpenAI), **UCP** (Google), **x402** (Web-Native), and **AP2**.
27
+ - **Smart Protocol Detection**: The SDK detects the merchant's required payment method and adapts instantly.
28
+ - **Session Keys (USKS)**: Bank-grade security with strict, human-defined spending limits (e.g., "$10/day").
29
+ - **Chain Abstraction**: Pay with USDC on Base, even if the merchant wants SOL on Solana. We handle the bridging.
30
+ - **MCP Server Included**: Give Claude or ChatGPT a wallet in 5 minutes with our pre-built Model Context Protocol server.
31
+ - **Identity & Trust**: Built-in support for ERC-8004 and Visa TAP verification.
32
+
33
+ ## 📦 Installation
19
34
 
20
35
  ```bash
21
36
  npm install @veridex/agentic-payments
22
37
  # or
23
- yarn add @veridex/agentic-payments
24
- # or
25
38
  pnpm add @veridex/agentic-payments
26
39
  ```
27
40
 
28
- ## Quick Start
29
-
30
- ### Basic Agent Setup
41
+ ## Quick Start
31
42
 
43
+ ### 1. Initialize the Universal Wallet
32
44
  ```typescript
33
- import { createAgentWallet, AgentWalletConfig } from '@veridex/agentic-payments';
34
-
35
- const config: AgentWalletConfig = {
36
- masterCredential: {
37
- credentialId: 'your-passkey-credential-id',
38
- publicKeyX: BigInt('...'),
39
- publicKeyY: BigInt('...'),
40
- keyHash: '0x...',
41
- },
42
- session: {
43
- dailyLimitUSD: 100,
44
- perTransactionLimitUSD: 25,
45
- expiryHours: 8,
46
- allowedChains: [30], // Base
47
- },
48
- relayerUrl: 'https://relay.veridex.network',
49
- };
45
+ import { createAgentWallet } from '@veridex/agentic-payments';
50
46
 
51
- const agent = await createAgentWallet(config);
47
+ const agent = await createAgentWallet({
48
+ sessionKey: process.env.SESSION_KEY,
49
+ // Define limits once, enforce everywhere
50
+ limits: { daily: 100, currency: 'USD' }
51
+ });
52
52
  ```
53
53
 
54
- ### Making Payments
54
+ ### 2. Pay for Anything (The "Magic" Method)
55
+ Forget dealing with complex headers or handshake protocols. Just use `fetch`:
55
56
 
56
57
  ```typescript
57
- // Direct payment
58
- const receipt = await agent.pay({
59
- amount: '10.00',
60
- token: 'USDC',
61
- recipient: '0x...',
62
- chain: 30,
63
- });
64
-
65
- // Automatic 402 payment handling
66
- const response = await agent.fetch('https://api.paid-service.com/resource');
58
+ // The SDK automatically:
59
+ // 1. Detects if this is x402, ACP, or UCP
60
+ // 2. Negotiates the price
61
+ // 3. Signs the transaction
62
+ // 4. Settles the payment
63
+ const response = await agent.fetch('https://api.merchant.com/premium-data');
64
+
65
+ const data = await response.json();
66
+ console.log('Bought data:', data);
67
67
  ```
68
68
 
69
69
  ### Session Management