@agirails/sdk 2.5.3 → 2.5.5
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.
- package/dist/ACTPClient.d.ts +18 -0
- package/dist/ACTPClient.d.ts.map +1 -1
- package/dist/ACTPClient.js +72 -23
- package/dist/ACTPClient.js.map +1 -1
- package/dist/adapters/BasicAdapter.d.ts +15 -0
- package/dist/adapters/BasicAdapter.d.ts.map +1 -1
- package/dist/adapters/BasicAdapter.js +33 -4
- package/dist/adapters/BasicAdapter.js.map +1 -1
- package/dist/adapters/StandardAdapter.d.ts +20 -3
- package/dist/adapters/StandardAdapter.d.ts.map +1 -1
- package/dist/adapters/StandardAdapter.js +90 -12
- package/dist/adapters/StandardAdapter.js.map +1 -1
- package/dist/cli/commands/publish.js +16 -4
- package/dist/cli/commands/publish.js.map +1 -1
- package/dist/cli/commands/register.js +16 -4
- package/dist/cli/commands/register.js.map +1 -1
- package/dist/cli/commands/tx.js +31 -3
- package/dist/cli/commands/tx.js.map +1 -1
- package/dist/config/networks.d.ts +10 -2
- package/dist/config/networks.d.ts.map +1 -1
- package/dist/config/networks.js +31 -22
- package/dist/config/networks.js.map +1 -1
- package/dist/level0/request.d.ts.map +1 -1
- package/dist/level0/request.js +2 -1
- package/dist/level0/request.js.map +1 -1
- package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
- package/dist/runtime/BlockchainRuntime.js +11 -5
- package/dist/runtime/BlockchainRuntime.js.map +1 -1
- package/dist/utils/IPFSClient.d.ts +3 -1
- package/dist/utils/IPFSClient.d.ts.map +1 -1
- package/dist/utils/IPFSClient.js +27 -7
- package/dist/utils/IPFSClient.js.map +1 -1
- package/dist/wallet/AutoWalletProvider.d.ts +11 -1
- package/dist/wallet/AutoWalletProvider.d.ts.map +1 -1
- package/dist/wallet/AutoWalletProvider.js +84 -19
- package/dist/wallet/AutoWalletProvider.js.map +1 -1
- package/dist/wallet/IWalletProvider.d.ts +34 -0
- package/dist/wallet/IWalletProvider.d.ts.map +1 -1
- package/dist/wallet/SmartWalletRouter.d.ts +128 -0
- package/dist/wallet/SmartWalletRouter.d.ts.map +1 -0
- package/dist/wallet/SmartWalletRouter.js +248 -0
- package/dist/wallet/SmartWalletRouter.js.map +1 -0
- package/dist/wallet/aa/DualNonceManager.d.ts +26 -1
- package/dist/wallet/aa/DualNonceManager.d.ts.map +1 -1
- package/dist/wallet/aa/DualNonceManager.js +140 -6
- package/dist/wallet/aa/DualNonceManager.js.map +1 -1
- package/package.json +3 -6
- package/src/ACTPClient.ts +0 -1579
- package/src/abi/ACTPKernel.json +0 -1356
- package/src/abi/AgentRegistry.json +0 -915
- package/src/abi/ERC20.json +0 -40
- package/src/abi/EscrowVault.json +0 -134
- package/src/abi/IdentityRegistry.json +0 -316
- package/src/adapters/AdapterRegistry.ts +0 -173
- package/src/adapters/AdapterRouter.ts +0 -416
- package/src/adapters/BaseAdapter.ts +0 -498
- package/src/adapters/BasicAdapter.ts +0 -514
- package/src/adapters/IAdapter.ts +0 -292
- package/src/adapters/StandardAdapter.ts +0 -555
- package/src/adapters/X402Adapter.ts +0 -731
- package/src/adapters/index.ts +0 -60
- package/src/builders/DeliveryProofBuilder.ts +0 -327
- package/src/builders/QuoteBuilder.ts +0 -483
- package/src/builders/index.ts +0 -17
- package/src/cli/commands/balance.ts +0 -110
- package/src/cli/commands/batch.ts +0 -487
- package/src/cli/commands/config.ts +0 -231
- package/src/cli/commands/deploy-check.ts +0 -364
- package/src/cli/commands/deploy-env.ts +0 -120
- package/src/cli/commands/diff.ts +0 -141
- package/src/cli/commands/init.ts +0 -469
- package/src/cli/commands/mint.ts +0 -116
- package/src/cli/commands/pay.ts +0 -113
- package/src/cli/commands/publish.ts +0 -475
- package/src/cli/commands/pull.ts +0 -124
- package/src/cli/commands/register.ts +0 -247
- package/src/cli/commands/simulate.ts +0 -345
- package/src/cli/commands/time.ts +0 -302
- package/src/cli/commands/tx.ts +0 -448
- package/src/cli/commands/watch.ts +0 -211
- package/src/cli/index.ts +0 -134
- package/src/cli/utils/client.ts +0 -252
- package/src/cli/utils/config.ts +0 -389
- package/src/cli/utils/output.ts +0 -465
- package/src/cli/utils/wallet.ts +0 -109
- package/src/config/agirailsmd.ts +0 -262
- package/src/config/networks.ts +0 -275
- package/src/config/pendingPublish.ts +0 -237
- package/src/config/publishPipeline.ts +0 -359
- package/src/config/syncOperations.ts +0 -279
- package/src/erc8004/ERC8004Bridge.ts +0 -462
- package/src/erc8004/ReputationReporter.ts +0 -468
- package/src/erc8004/index.ts +0 -61
- package/src/errors/index.ts +0 -427
- package/src/index.ts +0 -364
- package/src/level0/Provider.ts +0 -117
- package/src/level0/ServiceDirectory.ts +0 -131
- package/src/level0/index.ts +0 -10
- package/src/level0/provide.ts +0 -132
- package/src/level0/request.ts +0 -432
- package/src/level1/Agent.ts +0 -1426
- package/src/level1/index.ts +0 -10
- package/src/level1/pricing/PriceCalculator.ts +0 -255
- package/src/level1/pricing/PricingStrategy.ts +0 -198
- package/src/level1/types/Job.ts +0 -179
- package/src/level1/types/Options.ts +0 -291
- package/src/level1/types/index.ts +0 -8
- package/src/protocol/ACTPKernel.ts +0 -808
- package/src/protocol/AgentRegistry.ts +0 -559
- package/src/protocol/DIDManager.ts +0 -629
- package/src/protocol/DIDResolver.ts +0 -554
- package/src/protocol/EASHelper.ts +0 -378
- package/src/protocol/EscrowVault.ts +0 -255
- package/src/protocol/EventMonitor.ts +0 -204
- package/src/protocol/MessageSigner.ts +0 -510
- package/src/protocol/ProofGenerator.ts +0 -339
- package/src/protocol/QuoteBuilder.ts +0 -15
- package/src/registry/AgentRegistryClient.ts +0 -202
- package/src/runtime/BlockchainRuntime.ts +0 -1015
- package/src/runtime/IACTPRuntime.ts +0 -306
- package/src/runtime/MockRuntime.ts +0 -1298
- package/src/runtime/MockStateManager.ts +0 -577
- package/src/runtime/index.ts +0 -25
- package/src/runtime/types/MockState.ts +0 -237
- package/src/storage/ArchiveBundleBuilder.ts +0 -561
- package/src/storage/ArweaveClient.ts +0 -946
- package/src/storage/FilebaseClient.ts +0 -790
- package/src/storage/index.ts +0 -96
- package/src/storage/types.ts +0 -348
- package/src/types/adapter.ts +0 -310
- package/src/types/agent.ts +0 -79
- package/src/types/did.ts +0 -223
- package/src/types/eip712.ts +0 -175
- package/src/types/erc8004.ts +0 -293
- package/src/types/escrow.ts +0 -27
- package/src/types/index.ts +0 -17
- package/src/types/message.ts +0 -145
- package/src/types/state.ts +0 -87
- package/src/types/transaction.ts +0 -69
- package/src/types/x402.ts +0 -251
- package/src/utils/ErrorRecoveryGuide.ts +0 -676
- package/src/utils/Helpers.ts +0 -688
- package/src/utils/IPFSClient.ts +0 -368
- package/src/utils/Logger.ts +0 -484
- package/src/utils/NonceManager.ts +0 -591
- package/src/utils/RateLimiter.ts +0 -534
- package/src/utils/ReceivedNonceTracker.ts +0 -567
- package/src/utils/SDKLifecycle.ts +0 -416
- package/src/utils/SecureNonce.ts +0 -78
- package/src/utils/Semaphore.ts +0 -276
- package/src/utils/UsedAttestationTracker.ts +0 -385
- package/src/utils/canonicalJson.ts +0 -38
- package/src/utils/circuitBreaker.ts +0 -324
- package/src/utils/computeTypeHash.ts +0 -48
- package/src/utils/fsSafe.ts +0 -80
- package/src/utils/index.ts +0 -80
- package/src/utils/retry.ts +0 -364
- package/src/utils/security.ts +0 -418
- package/src/utils/validation.ts +0 -540
- package/src/wallet/AutoWalletProvider.ts +0 -299
- package/src/wallet/EOAWalletProvider.ts +0 -69
- package/src/wallet/IWalletProvider.ts +0 -135
- package/src/wallet/aa/BundlerClient.ts +0 -274
- package/src/wallet/aa/DualNonceManager.ts +0 -173
- package/src/wallet/aa/PaymasterClient.ts +0 -174
- package/src/wallet/aa/TransactionBatcher.ts +0 -353
- package/src/wallet/aa/UserOpBuilder.ts +0 -246
- package/src/wallet/aa/constants.ts +0 -60
- package/src/wallet/keystore.ts +0 -240
package/src/types/eip712.ts
DELETED
|
@@ -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
|
-
|
package/src/types/erc8004.ts
DELETED
|
@@ -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];
|
package/src/types/escrow.ts
DELETED
|
@@ -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
|
-
|
package/src/types/index.ts
DELETED
|
@@ -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';
|
package/src/types/message.ts
DELETED
|
@@ -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
|
-
|