@agirails/sdk 2.5.2 → 2.5.4

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 (172) hide show
  1. package/dist/ACTPClient.d.ts +18 -0
  2. package/dist/ACTPClient.d.ts.map +1 -1
  3. package/dist/ACTPClient.js +67 -22
  4. package/dist/ACTPClient.js.map +1 -1
  5. package/dist/adapters/BasicAdapter.d.ts +12 -0
  6. package/dist/adapters/BasicAdapter.d.ts.map +1 -1
  7. package/dist/adapters/BasicAdapter.js +30 -4
  8. package/dist/adapters/BasicAdapter.js.map +1 -1
  9. package/dist/adapters/StandardAdapter.d.ts +20 -3
  10. package/dist/adapters/StandardAdapter.d.ts.map +1 -1
  11. package/dist/adapters/StandardAdapter.js +45 -11
  12. package/dist/adapters/StandardAdapter.js.map +1 -1
  13. package/dist/cli/commands/publish.js +16 -4
  14. package/dist/cli/commands/publish.js.map +1 -1
  15. package/dist/cli/commands/register.js +16 -4
  16. package/dist/cli/commands/register.js.map +1 -1
  17. package/dist/cli/commands/tx.js +31 -3
  18. package/dist/cli/commands/tx.js.map +1 -1
  19. package/dist/cli/utils/client.d.ts.map +1 -1
  20. package/dist/cli/utils/client.js +1 -0
  21. package/dist/cli/utils/client.js.map +1 -1
  22. package/dist/config/networks.d.ts +2 -2
  23. package/dist/config/networks.d.ts.map +1 -1
  24. package/dist/config/networks.js +27 -22
  25. package/dist/config/networks.js.map +1 -1
  26. package/dist/level0/request.d.ts.map +1 -1
  27. package/dist/level0/request.js +2 -1
  28. package/dist/level0/request.js.map +1 -1
  29. package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
  30. package/dist/runtime/BlockchainRuntime.js +11 -5
  31. package/dist/runtime/BlockchainRuntime.js.map +1 -1
  32. package/dist/runtime/MockStateManager.d.ts.map +1 -1
  33. package/dist/runtime/MockStateManager.js +2 -1
  34. package/dist/runtime/MockStateManager.js.map +1 -1
  35. package/dist/utils/IPFSClient.d.ts +3 -1
  36. package/dist/utils/IPFSClient.d.ts.map +1 -1
  37. package/dist/utils/IPFSClient.js +27 -7
  38. package/dist/utils/IPFSClient.js.map +1 -1
  39. package/dist/wallet/AutoWalletProvider.d.ts.map +1 -1
  40. package/dist/wallet/AutoWalletProvider.js +52 -18
  41. package/dist/wallet/AutoWalletProvider.js.map +1 -1
  42. package/dist/wallet/SmartWalletRouter.d.ts +116 -0
  43. package/dist/wallet/SmartWalletRouter.d.ts.map +1 -0
  44. package/dist/wallet/SmartWalletRouter.js +212 -0
  45. package/dist/wallet/SmartWalletRouter.js.map +1 -0
  46. package/dist/wallet/aa/DualNonceManager.d.ts +19 -0
  47. package/dist/wallet/aa/DualNonceManager.d.ts.map +1 -1
  48. package/dist/wallet/aa/DualNonceManager.js +100 -5
  49. package/dist/wallet/aa/DualNonceManager.js.map +1 -1
  50. package/package.json +3 -6
  51. package/src/ACTPClient.ts +0 -1579
  52. package/src/abi/ACTPKernel.json +0 -1356
  53. package/src/abi/AgentRegistry.json +0 -915
  54. package/src/abi/ERC20.json +0 -40
  55. package/src/abi/EscrowVault.json +0 -134
  56. package/src/abi/IdentityRegistry.json +0 -316
  57. package/src/adapters/AdapterRegistry.ts +0 -173
  58. package/src/adapters/AdapterRouter.ts +0 -416
  59. package/src/adapters/BaseAdapter.ts +0 -498
  60. package/src/adapters/BasicAdapter.ts +0 -514
  61. package/src/adapters/IAdapter.ts +0 -292
  62. package/src/adapters/StandardAdapter.ts +0 -555
  63. package/src/adapters/X402Adapter.ts +0 -731
  64. package/src/adapters/index.ts +0 -60
  65. package/src/builders/DeliveryProofBuilder.ts +0 -327
  66. package/src/builders/QuoteBuilder.ts +0 -483
  67. package/src/builders/index.ts +0 -17
  68. package/src/cli/commands/balance.ts +0 -110
  69. package/src/cli/commands/batch.ts +0 -487
  70. package/src/cli/commands/config.ts +0 -231
  71. package/src/cli/commands/deploy-check.ts +0 -364
  72. package/src/cli/commands/deploy-env.ts +0 -120
  73. package/src/cli/commands/diff.ts +0 -141
  74. package/src/cli/commands/init.ts +0 -469
  75. package/src/cli/commands/mint.ts +0 -116
  76. package/src/cli/commands/pay.ts +0 -113
  77. package/src/cli/commands/publish.ts +0 -475
  78. package/src/cli/commands/pull.ts +0 -124
  79. package/src/cli/commands/register.ts +0 -247
  80. package/src/cli/commands/simulate.ts +0 -345
  81. package/src/cli/commands/time.ts +0 -302
  82. package/src/cli/commands/tx.ts +0 -448
  83. package/src/cli/commands/watch.ts +0 -211
  84. package/src/cli/index.ts +0 -134
  85. package/src/cli/utils/client.ts +0 -251
  86. package/src/cli/utils/config.ts +0 -389
  87. package/src/cli/utils/output.ts +0 -465
  88. package/src/cli/utils/wallet.ts +0 -109
  89. package/src/config/agirailsmd.ts +0 -262
  90. package/src/config/networks.ts +0 -275
  91. package/src/config/pendingPublish.ts +0 -237
  92. package/src/config/publishPipeline.ts +0 -359
  93. package/src/config/syncOperations.ts +0 -279
  94. package/src/erc8004/ERC8004Bridge.ts +0 -462
  95. package/src/erc8004/ReputationReporter.ts +0 -468
  96. package/src/erc8004/index.ts +0 -61
  97. package/src/errors/index.ts +0 -427
  98. package/src/index.ts +0 -364
  99. package/src/level0/Provider.ts +0 -117
  100. package/src/level0/ServiceDirectory.ts +0 -131
  101. package/src/level0/index.ts +0 -10
  102. package/src/level0/provide.ts +0 -132
  103. package/src/level0/request.ts +0 -432
  104. package/src/level1/Agent.ts +0 -1426
  105. package/src/level1/index.ts +0 -10
  106. package/src/level1/pricing/PriceCalculator.ts +0 -255
  107. package/src/level1/pricing/PricingStrategy.ts +0 -198
  108. package/src/level1/types/Job.ts +0 -179
  109. package/src/level1/types/Options.ts +0 -291
  110. package/src/level1/types/index.ts +0 -8
  111. package/src/protocol/ACTPKernel.ts +0 -808
  112. package/src/protocol/AgentRegistry.ts +0 -559
  113. package/src/protocol/DIDManager.ts +0 -629
  114. package/src/protocol/DIDResolver.ts +0 -554
  115. package/src/protocol/EASHelper.ts +0 -378
  116. package/src/protocol/EscrowVault.ts +0 -255
  117. package/src/protocol/EventMonitor.ts +0 -204
  118. package/src/protocol/MessageSigner.ts +0 -510
  119. package/src/protocol/ProofGenerator.ts +0 -339
  120. package/src/protocol/QuoteBuilder.ts +0 -15
  121. package/src/registry/AgentRegistryClient.ts +0 -202
  122. package/src/runtime/BlockchainRuntime.ts +0 -1015
  123. package/src/runtime/IACTPRuntime.ts +0 -306
  124. package/src/runtime/MockRuntime.ts +0 -1298
  125. package/src/runtime/MockStateManager.ts +0 -576
  126. package/src/runtime/index.ts +0 -25
  127. package/src/runtime/types/MockState.ts +0 -237
  128. package/src/storage/ArchiveBundleBuilder.ts +0 -561
  129. package/src/storage/ArweaveClient.ts +0 -946
  130. package/src/storage/FilebaseClient.ts +0 -790
  131. package/src/storage/index.ts +0 -96
  132. package/src/storage/types.ts +0 -348
  133. package/src/types/adapter.ts +0 -310
  134. package/src/types/agent.ts +0 -79
  135. package/src/types/did.ts +0 -223
  136. package/src/types/eip712.ts +0 -175
  137. package/src/types/erc8004.ts +0 -293
  138. package/src/types/escrow.ts +0 -27
  139. package/src/types/index.ts +0 -17
  140. package/src/types/message.ts +0 -145
  141. package/src/types/state.ts +0 -87
  142. package/src/types/transaction.ts +0 -69
  143. package/src/types/x402.ts +0 -251
  144. package/src/utils/ErrorRecoveryGuide.ts +0 -676
  145. package/src/utils/Helpers.ts +0 -688
  146. package/src/utils/IPFSClient.ts +0 -368
  147. package/src/utils/Logger.ts +0 -484
  148. package/src/utils/NonceManager.ts +0 -591
  149. package/src/utils/RateLimiter.ts +0 -534
  150. package/src/utils/ReceivedNonceTracker.ts +0 -567
  151. package/src/utils/SDKLifecycle.ts +0 -416
  152. package/src/utils/SecureNonce.ts +0 -78
  153. package/src/utils/Semaphore.ts +0 -276
  154. package/src/utils/UsedAttestationTracker.ts +0 -385
  155. package/src/utils/canonicalJson.ts +0 -38
  156. package/src/utils/circuitBreaker.ts +0 -324
  157. package/src/utils/computeTypeHash.ts +0 -48
  158. package/src/utils/fsSafe.ts +0 -80
  159. package/src/utils/index.ts +0 -80
  160. package/src/utils/retry.ts +0 -364
  161. package/src/utils/security.ts +0 -418
  162. package/src/utils/validation.ts +0 -540
  163. package/src/wallet/AutoWalletProvider.ts +0 -299
  164. package/src/wallet/EOAWalletProvider.ts +0 -69
  165. package/src/wallet/IWalletProvider.ts +0 -135
  166. package/src/wallet/aa/BundlerClient.ts +0 -274
  167. package/src/wallet/aa/DualNonceManager.ts +0 -173
  168. package/src/wallet/aa/PaymasterClient.ts +0 -174
  169. package/src/wallet/aa/TransactionBatcher.ts +0 -353
  170. package/src/wallet/aa/UserOpBuilder.ts +0 -246
  171. package/src/wallet/aa/constants.ts +0 -60
  172. package/src/wallet/keystore.ts +0 -240
@@ -1,175 +0,0 @@
1
- import { DeliveryProof } from './message';
2
-
3
- /**
4
- * EIP-712 Type Definitions for ACTP Messages
5
- * Reference: Yellow Paper §11.4.2
6
- *
7
- * Each AIP message has explicit typed data for cross-language compatibility
8
- */
9
-
10
- /**
11
- * EIP-712 Domain for ACTP
12
- */
13
- export interface EIP712Domain {
14
- name: string;
15
- version: string;
16
- chainId: number;
17
- verifyingContract: string;
18
- }
19
-
20
- /**
21
- * QuoteRequest (AIP-2)
22
- * Reference: Yellow Paper §4.2
23
- */
24
- export const QuoteRequestTypes = {
25
- QuoteRequest: [
26
- { name: 'from', type: 'string' }, // DID
27
- { name: 'to', type: 'string' }, // DID
28
- { name: 'timestamp', type: 'uint256' },
29
- { name: 'nonce', type: 'bytes32' },
30
- { name: 'serviceType', type: 'string' },
31
- { name: 'requirements', type: 'string' },
32
- { name: 'deadline', type: 'uint256' },
33
- { name: 'disputeWindow', type: 'uint256' }
34
- ]
35
- };
36
-
37
- export interface QuoteRequestData {
38
- from: string;
39
- to: string;
40
- timestamp: number;
41
- nonce: string;
42
- serviceType: string;
43
- requirements: string;
44
- deadline: number;
45
- disputeWindow: number;
46
- }
47
-
48
- /**
49
- * QuoteResponse (AIP-2)
50
- * Reference: Yellow Paper §4.2
51
- */
52
- export const QuoteResponseTypes = {
53
- QuoteResponse: [
54
- { name: 'from', type: 'string' },
55
- { name: 'to', type: 'string' },
56
- { name: 'timestamp', type: 'uint256' },
57
- { name: 'nonce', type: 'bytes32' },
58
- { name: 'requestId', type: 'bytes32' },
59
- { name: 'price', type: 'uint256' },
60
- { name: 'currency', type: 'address' },
61
- { name: 'deliveryTime', type: 'uint256' },
62
- { name: 'terms', type: 'string' }
63
- ]
64
- };
65
-
66
- export interface QuoteResponseData {
67
- from: string;
68
- to: string;
69
- timestamp: number;
70
- nonce: string;
71
- requestId: string;
72
- price: string; // BigNumber as string
73
- currency: string;
74
- deliveryTime: number;
75
- terms: string;
76
- }
77
-
78
- /**
79
- * DeliveryProof (AIP-4) - DEPRECATED
80
- * @deprecated Use AIP4DeliveryProofTypes instead (AIP-4 v1.1)
81
- */
82
- export const DeliveryProofTypes = {
83
- DeliveryProof: [
84
- { name: 'txId', type: 'bytes32' },
85
- { name: 'contentHash', type: 'bytes32' },
86
- { name: 'timestamp', type: 'uint256' },
87
- { name: 'deliveryUrl', type: 'string' },
88
- { name: 'size', type: 'uint256' },
89
- { name: 'mimeType', type: 'string' }
90
- ]
91
- };
92
-
93
- export interface DeliveryProofData {
94
- txId: string;
95
- contentHash: string;
96
- timestamp: number;
97
- deliveryUrl: string;
98
- size: number;
99
- mimeType: string;
100
- }
101
-
102
- export function deliveryProofDataFromProof(proof: DeliveryProof): DeliveryProofData {
103
- return {
104
- txId: proof.txId,
105
- contentHash: proof.contentHash,
106
- timestamp: proof.timestamp,
107
- deliveryUrl: proof.deliveryUrl || '',
108
- size: proof.metadata.size,
109
- mimeType: proof.metadata.mimeType
110
- };
111
- }
112
-
113
- /**
114
- * AIP-4 Delivery Proof (v1.1)
115
- * Reference: AIP-4 §3.3
116
- */
117
- export const AIP4DeliveryProofTypes = {
118
- DeliveryProof: [
119
- { name: 'txId', type: 'bytes32' },
120
- { name: 'provider', type: 'string' },
121
- { name: 'consumer', type: 'string' },
122
- { name: 'resultCID', type: 'string' },
123
- { name: 'resultHash', type: 'bytes32' },
124
- { name: 'easAttestationUID', type: 'bytes32' },
125
- { name: 'deliveredAt', type: 'uint256' },
126
- { name: 'chainId', type: 'uint256' },
127
- { name: 'nonce', type: 'uint256' }
128
- ]
129
- };
130
-
131
- export interface AIP4DeliveryProofData {
132
- txId: string;
133
- provider: string;
134
- consumer: string;
135
- resultCID: string;
136
- resultHash: string;
137
- easAttestationUID: string;
138
- deliveredAt: number;
139
- chainId: number;
140
- nonce: number;
141
- }
142
-
143
- /**
144
- * Generic ACTPMessage (fallback for custom AIPs)
145
- */
146
- export const ACTPMessageTypes = {
147
- ACTPMessage: [
148
- { name: 'type', type: 'string' },
149
- { name: 'version', type: 'string' },
150
- { name: 'from', type: 'string' },
151
- { name: 'to', type: 'string' },
152
- { name: 'timestamp', type: 'uint256' },
153
- { name: 'nonce', type: 'bytes32' },
154
- { name: 'payload', type: 'bytes' }
155
- ]
156
- };
157
-
158
- /**
159
- * Message type registry
160
- */
161
- export const MESSAGE_TYPES = {
162
- 'quote.request': QuoteRequestTypes,
163
- 'quote.response': QuoteResponseTypes,
164
- 'delivery.proof': DeliveryProofTypes,
165
- // Fallback for custom/future AIPs
166
- default: ACTPMessageTypes
167
- };
168
-
169
- /**
170
- * Get EIP-712 types for message type
171
- */
172
- export function getMessageTypes(messageType: string): Record<string, any> {
173
- return MESSAGE_TYPES[messageType as keyof typeof MESSAGE_TYPES] || MESSAGE_TYPES.default;
174
- }
175
-
@@ -1,293 +0,0 @@
1
- /**
2
- * ERC-8004 Trustless Agents - SDK Types
3
- *
4
- * Types and constants for ERC-8004 integration.
5
- *
6
- * SECURITY NOTES:
7
- * - Identity Registry is read-only (safe, no gas)
8
- * - Reputation Registry writes require gas (requester pays)
9
- * - Replay protection via feedbackHash = keccak256(txId)
10
- * - ERC-8004 restriction: feedback submitter ≠ agent owner
11
- *
12
- * @see https://eips.ethereum.org/EIPS/eip-8004
13
- * @module types/erc8004
14
- */
15
-
16
- // ============================================================================
17
- // Networks
18
- // ============================================================================
19
-
20
- /**
21
- * Networks with ERC-8004 registry deployments.
22
- */
23
- export type ERC8004Network = 'ethereum' | 'base' | 'base-sepolia';
24
-
25
- // ============================================================================
26
- // Identity Types (from Identity Registry)
27
- // ============================================================================
28
-
29
- /**
30
- * Agent identity resolved from ERC-8004 Identity Registry.
31
- */
32
- export interface ERC8004Agent {
33
- /** ERC-8004 agent ID (uint256 as string) */
34
- agentId: string;
35
-
36
- /** Owner address (EOA that controls the NFT) */
37
- owner: string;
38
-
39
- /** Payment wallet address (checksummed) */
40
- wallet: string;
41
-
42
- /** Agent URI (IPFS or HTTPS, points to metadata JSON) */
43
- agentURI: string;
44
-
45
- /** Parsed metadata from agentURI (may be undefined if fetch fails) */
46
- metadata?: ERC8004AgentMetadata;
47
-
48
- /** Network where agent is registered */
49
- network: ERC8004Network;
50
- }
51
-
52
- /**
53
- * Agent metadata schema from ERC-8004 agentURI.
54
- *
55
- * Standard fields defined by ERC-8004, plus arbitrary extensions.
56
- */
57
- export interface ERC8004AgentMetadata {
58
- /** Human-readable agent name */
59
- name?: string;
60
-
61
- /** Agent description */
62
- description?: string;
63
-
64
- /** Agent avatar/logo URL */
65
- image?: string;
66
-
67
- /** Wallet address for receiving payments (overrides owner) */
68
- paymentAddress?: string;
69
-
70
- /** Alternative field name for payment address */
71
- wallet?: string;
72
-
73
- /** List of agent capabilities */
74
- capabilities?: string[];
75
-
76
- /** Service endpoints */
77
- endpoints?: {
78
- api?: string;
79
- webhook?: string;
80
- };
81
-
82
- /** Allow arbitrary extensions */
83
- [key: string]: unknown;
84
- }
85
-
86
- // ============================================================================
87
- // Reputation Types (from Reputation Registry)
88
- // ============================================================================
89
-
90
- /**
91
- * Feedback entry for ERC-8004 Reputation Registry.
92
- *
93
- * For ACTP settlements, we use binary values:
94
- * - value: 1 (success) or -1 (dispute lost)
95
- * - valueDecimals: 0 (no fractional part)
96
- */
97
- export interface ReputationFeedback {
98
- /** ERC-8004 agent ID */
99
- agentId: string;
100
-
101
- /**
102
- * Feedback value.
103
- * For ACTP: 1 = successful settlement, -1 = dispute lost
104
- */
105
- value: number;
106
-
107
- /**
108
- * Decimal precision for value.
109
- * For ACTP: always 0 (binary)
110
- */
111
- valueDecimals: number;
112
-
113
- /**
114
- * Primary tag for categorization.
115
- * ACTP uses: 'actp_settled', 'actp_dispute_won', 'actp_dispute_lost'
116
- */
117
- tag1: string;
118
-
119
- /**
120
- * Secondary tag for filtering.
121
- * ACTP uses: capability (e.g., 'code_generation', 'data_analysis')
122
- */
123
- tag2: string;
124
-
125
- /** Service endpoint (optional) */
126
- endpoint?: string;
127
-
128
- /** Link to detailed feedback (optional, IPFS or HTTPS) */
129
- feedbackURI?: string;
130
-
131
- /**
132
- * Hash for replay protection.
133
- * ACTP uses: keccak256(txId)
134
- */
135
- feedbackHash: string;
136
- }
137
-
138
- /**
139
- * Aggregated reputation summary for an agent.
140
- */
141
- export interface ReputationSummary {
142
- /** ERC-8004 agent ID */
143
- agentId: string;
144
-
145
- /** Total feedback count */
146
- feedbackCount: number;
147
-
148
- /** Count of positive feedback (value > 0) */
149
- positiveCount: number;
150
-
151
- /** Count of negative feedback (value < 0) */
152
- negativeCount: number;
153
-
154
- /** Aggregated score (sum of values) */
155
- score: number;
156
- }
157
-
158
- // ============================================================================
159
- // Errors
160
- // ============================================================================
161
-
162
- /**
163
- * ERC-8004 error codes.
164
- */
165
- export enum ERC8004ErrorCode {
166
- // Identity errors
167
- AGENT_NOT_FOUND = 'AGENT_NOT_FOUND',
168
- INVALID_AGENT_ID = 'INVALID_AGENT_ID',
169
- WALLET_NOT_FOUND = 'WALLET_NOT_FOUND',
170
- METADATA_FETCH_FAILED = 'METADATA_FETCH_FAILED',
171
-
172
- // Reputation errors
173
- REPORT_FAILED = 'REPORT_FAILED',
174
- ALREADY_REPORTED = 'ALREADY_REPORTED',
175
- NOT_AUTHORIZED = 'NOT_AUTHORIZED',
176
-
177
- // Network errors
178
- NETWORK_ERROR = 'NETWORK_ERROR',
179
- INVALID_NETWORK = 'INVALID_NETWORK',
180
- }
181
-
182
- /**
183
- * Custom error for ERC-8004 operations.
184
- */
185
- export class ERC8004Error extends Error {
186
- constructor(
187
- message: string,
188
- public readonly code: ERC8004ErrorCode,
189
- public readonly agentId?: string,
190
- public readonly cause?: Error
191
- ) {
192
- super(message);
193
- this.name = 'ERC8004Error';
194
-
195
- // Maintain proper stack trace in V8
196
- if (Error.captureStackTrace) {
197
- Error.captureStackTrace(this, ERC8004Error);
198
- }
199
- }
200
- }
201
-
202
- // ============================================================================
203
- // Registry Addresses
204
- // ============================================================================
205
-
206
- /**
207
- * ERC-8004 Identity Registry addresses per network.
208
- *
209
- * Canonical CREATE2 addresses from: https://github.com/erc-8004/erc-8004-contracts
210
- * Vanity prefix 0x8004 ensures same address across all EVM chains.
211
- */
212
- export const ERC8004_IDENTITY_REGISTRY: Record<ERC8004Network, string> = {
213
- ethereum: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432', // Ethereum Mainnet
214
- base: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432', // Base Mainnet
215
- 'base-sepolia': '0x8004A818BFB912233c491871b3d84c89A494BD9e', // Base Sepolia
216
- };
217
-
218
- /**
219
- * ERC-8004 Reputation Registry addresses per network.
220
- *
221
- * Canonical CREATE2 addresses from: https://github.com/erc-8004/erc-8004-contracts
222
- * Vanity prefix 0x8004 ensures same address across all EVM chains.
223
- */
224
- export const ERC8004_REPUTATION_REGISTRY: Record<ERC8004Network, string> = {
225
- ethereum: '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63', // Ethereum Mainnet
226
- base: '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63', // Base Mainnet
227
- 'base-sepolia': '0x8004B663056A597Dffe9eCcC1965A193B7388713', // Base Sepolia
228
- };
229
-
230
- // ============================================================================
231
- // ABI Fragments (minimal, view-only for Bridge)
232
- // ============================================================================
233
-
234
- /**
235
- * Minimal ABI for ERC-8004 Identity Registry.
236
- * Only includes view functions needed by ERC8004Bridge.
237
- */
238
- export const ERC8004_IDENTITY_ABI = [
239
- 'function ownerOf(uint256 agentId) view returns (address)',
240
- 'function getAgentURI(uint256 agentId) view returns (string)',
241
- 'function balanceOf(address owner) view returns (uint256)',
242
- 'function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)',
243
- ] as const;
244
-
245
- /**
246
- * Minimal ABI for ERC-8004 Reputation Registry.
247
- * Includes both read and write functions.
248
- */
249
- export const ERC8004_REPUTATION_ABI = [
250
- // Write
251
- 'function giveFeedback(uint256 agentId, int128 value, uint8 valueDecimals, string tag1, string tag2, string endpoint, string feedbackURI, bytes32 feedbackHash) external',
252
- 'function revokeLatest(uint256 agentId, uint64 feedbackIndex) external',
253
- // Read
254
- 'function getSummary(uint256 agentId, address[] clientAddresses, string tag1, string tag2) view returns (uint256 count, int256 summaryValue, uint8 summaryValueDecimals)',
255
- 'function readFeedback(uint256 agentId, uint64 feedbackIndex) view returns (tuple(int128 value, uint8 valueDecimals, string tag1, string tag2, bool isRevoked, uint64 feedbackIndex))',
256
- ] as const;
257
-
258
- // ============================================================================
259
- // Default RPC URLs
260
- // ============================================================================
261
-
262
- /**
263
- * Default RPC URLs for each network.
264
- * Used when no custom RPC is provided.
265
- */
266
- export const ERC8004_DEFAULT_RPC: Record<ERC8004Network, string> = {
267
- ethereum: 'https://eth.llamarpc.com',
268
- base: 'https://mainnet.base.org',
269
- 'base-sepolia': 'https://sepolia.base.org',
270
- };
271
-
272
- // ============================================================================
273
- // ACTP-specific constants
274
- // ============================================================================
275
-
276
- /**
277
- * ACTP feedback tags for ERC-8004 Reputation.
278
- */
279
- export const ACTP_FEEDBACK_TAGS = {
280
- /** Successful settlement */
281
- SETTLED: 'actp_settled',
282
-
283
- /** Agent won dispute */
284
- DISPUTE_WON: 'actp_dispute_won',
285
-
286
- /** Agent lost dispute (requester won) */
287
- DISPUTE_LOST: 'actp_dispute_lost',
288
- } as const;
289
-
290
- /**
291
- * Type for ACTP feedback tags.
292
- */
293
- export type ACTPFeedbackTag = (typeof ACTP_FEEDBACK_TAGS)[keyof typeof ACTP_FEEDBACK_TAGS];
@@ -1,27 +0,0 @@
1
- /**
2
- * Escrow creation parameters
3
- */
4
- export interface CreateEscrowParams {
5
- /** Escrow identifier (bytes32). In ACTP standard this is typically the txId. */
6
- escrowId: string;
7
- /** Consumer/requester who funds the escrow */
8
- requester: string;
9
- /** Provider who receives payout on settlement */
10
- provider: string;
11
- /** Amount locked in escrow (USDC wei, 6 decimals) */
12
- amount: bigint;
13
- }
14
-
15
- /**
16
- * Escrow state (matches on-chain EscrowVault.EscrowData struct)
17
- */
18
- export interface Escrow {
19
- escrowId: string;
20
- requester: string;
21
- provider: string;
22
- amount: bigint;
23
- releasedAmount: bigint;
24
- active: boolean;
25
- }
26
-
27
-
@@ -1,17 +0,0 @@
1
- /**
2
- * Type exports
3
- */
4
-
5
- export * from './state';
6
- export * from './transaction';
7
- export * from './escrow';
8
- export * from './message';
9
- export * from './eip712';
10
- export * from './agent';
11
- export * from './did';
12
- export * from './adapter';
13
- export * from './x402';
14
- export * from './erc8004';
15
- // Note: storage and archive types are not yet implemented in this version
16
- // export * from './storage';
17
- // export * from './archive';
@@ -1,145 +0,0 @@
1
- /**
2
- * ACTP Message Types
3
- * Reference: Yellow Paper §4-10 (AIPs)
4
- */
5
-
6
- /**
7
- * Base ACTP message structure
8
- */
9
- export interface ACTPMessage {
10
- type: string;
11
- version: string;
12
- from: string; // DID
13
- to: string; // DID
14
- timestamp: number;
15
- nonce: string;
16
- signature?: string;
17
- [key: string]: any;
18
- }
19
-
20
- /**
21
- * Quote Request (AIP-2)
22
- * Reference: Yellow Paper §6.2.1
23
- */
24
- export interface QuoteRequest extends ACTPMessage {
25
- type: 'quote.request';
26
- serviceRequest: {
27
- capabilityType: string;
28
- parameters: Record<string, any>;
29
- deliveryRequirements: {
30
- deadline: string;
31
- maxDeliveryTime: string;
32
- };
33
- };
34
- budgetConstraints: {
35
- maxPrice: string;
36
- currency: 'USDC';
37
- };
38
- expiresAt: string;
39
- }
40
-
41
- /**
42
- * Quote Response (AIP-2)
43
- * Reference: Yellow Paper §6.2.2
44
- */
45
- export interface QuoteResponse extends ACTPMessage {
46
- type: 'quote.response';
47
- inResponseTo: string;
48
- quoteId: string;
49
- pricing: {
50
- totalPrice: string;
51
- currency: 'USDC';
52
- breakdown: Array<{ item: string; amount: string }>;
53
- platformFee: string;
54
- };
55
- sla: {
56
- successRateGuarantee: number;
57
- refundPolicy: string;
58
- };
59
- expiresAt: string;
60
- }
61
-
62
- /**
63
- * Delivery Proof (AIP-4) - DEPRECATED
64
- * @deprecated Use DeliveryProofMessage instead (AIP-4 v1.1)
65
- */
66
- export interface DeliveryProof {
67
- type: 'delivery.proof';
68
- txId: string;
69
- contentHash: string;
70
- timestamp: number;
71
- deliveryUrl?: string;
72
- metadata: {
73
- size: number;
74
- mimeType: string;
75
- [key: string]: any;
76
- };
77
- }
78
-
79
- /**
80
- * Delivery Proof Message (AIP-4 v1.1)
81
- * Reference: AIP-4 §3.2, §8.1
82
- * Complete schema for delivery proofs with EAS attestations
83
- */
84
- export interface DeliveryProofMessage {
85
- type: 'agirails.delivery.v1';
86
- version: string; // Semantic version (e.g., "1.0.0")
87
- txId: string; // bytes32 (0x-prefixed)
88
- provider: string; // DID (e.g., "did:ethr:84532:0x...")
89
- consumer: string; // DID
90
- resultCID: string; // IPFS CID (CIDv1, base32, e.g., "bafybeig...")
91
- resultHash: string; // Keccak256 hash of canonical result JSON
92
- metadata?: {
93
- executionTime?: number; // Seconds
94
- outputFormat?: string; // MIME type
95
- outputSize?: number; // Bytes
96
- notes?: string; // Max 500 chars
97
- };
98
- easAttestationUID: string; // bytes32 (0x-prefixed)
99
- deliveredAt: number; // Unix timestamp (seconds)
100
- chainId: number; // 84532 (Base Sepolia) or 8453 (Base Mainnet)
101
- nonce: number; // Monotonically increasing
102
- signature: string; // EIP-712 signature (0x-prefixed, 130 chars)
103
- }
104
-
105
- /**
106
- * EAS Attestation Data for delivery proofs
107
- */
108
- export interface EASAttestationData {
109
- schema: string; // EAS schema UID
110
- recipient: string; // Provider address
111
- expirationTime: number; // Unix timestamp (0 for no expiration)
112
- revocable: boolean;
113
- refUID: string; // Reference to transaction
114
- data: string; // ABI-encoded attestation data
115
- }
116
-
117
- /**
118
- * Quote Message (AIP-2 v1.0)
119
- * Reference: AIP-2 §2.1, §2.2
120
- * Price quote submitted by provider for negotiated transactions
121
- */
122
- export interface QuoteMessageV2 {
123
- type: 'agirails.quote.v1';
124
- version: '1.0.0';
125
- txId: string; // bytes32 (0x-prefixed)
126
- provider: string; // DID (e.g., "did:ethr:84532:0x...")
127
- consumer: string; // DID
128
- quotedAmount: string; // Provider's quoted price (base units, string to avoid JS overflow)
129
- originalAmount: string; // Consumer's original offer from AIP-1
130
- maxPrice: string; // Consumer's maximum acceptable price from AIP-1
131
- currency: string; // Currently "USDC" only
132
- decimals: number; // Token decimals (6 for USDC)
133
- quotedAt: number; // Unix timestamp (seconds)
134
- expiresAt: number; // Unix timestamp (seconds)
135
- justification?: {
136
- reason?: string;
137
- estimatedTime?: number;
138
- computeCost?: number;
139
- breakdown?: Record<string, any>;
140
- };
141
- chainId: number; // 84532 (Base Sepolia) or 8453 (Base Mainnet)
142
- nonce: number; // Monotonically increasing per provider + message type
143
- signature: string; // EIP-712 signature (0x-prefixed, 130 chars)
144
- }
145
-