@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
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock State Type Definitions
|
|
3
|
-
*
|
|
4
|
-
* These interfaces define the structure of the persistent mock blockchain state
|
|
5
|
-
* stored in `.actp/mock-state.json`. This state is shared across CLI commands,
|
|
6
|
-
* SDK library usage, and Dashboard.
|
|
7
|
-
*
|
|
8
|
-
* @module runtime/types/MockState
|
|
9
|
-
* @see ADR-001 (Mock State Persistence Strategy)
|
|
10
|
-
* @see MOCK_STATE_MANAGER_SPEC.md
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* ACTP Transaction State enum matching the smart contract states.
|
|
15
|
-
*
|
|
16
|
-
* State machine:
|
|
17
|
-
* - INITIATED (0) -> QUOTED (1, optional) -> COMMITTED (2) -> IN_PROGRESS (3, mandatory)
|
|
18
|
-
* -> DELIVERED (4) -> SETTLED (5)
|
|
19
|
-
* - Dispute path: DELIVERED -> DISPUTED (6) -> SETTLED or CANCELLED (admin)
|
|
20
|
-
* - Cancel path: Any pre-DELIVERED state -> CANCELLED (7)
|
|
21
|
-
*
|
|
22
|
-
* AUDIT FIX (2026-02): IN_PROGRESS is now mandatory per contract. Direct
|
|
23
|
-
* COMMITTED -> DELIVERED transitions are rejected on-chain.
|
|
24
|
-
*/
|
|
25
|
-
export type TransactionState =
|
|
26
|
-
| 'INITIATED'
|
|
27
|
-
| 'QUOTED'
|
|
28
|
-
| 'COMMITTED'
|
|
29
|
-
| 'IN_PROGRESS'
|
|
30
|
-
| 'DELIVERED'
|
|
31
|
-
| 'SETTLED'
|
|
32
|
-
| 'DISPUTED'
|
|
33
|
-
| 'CANCELLED';
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Numeric state values matching the smart contract enum.
|
|
37
|
-
*/
|
|
38
|
-
export const TransactionStateValue: Record<TransactionState, number> = {
|
|
39
|
-
INITIATED: 0,
|
|
40
|
-
QUOTED: 1,
|
|
41
|
-
COMMITTED: 2,
|
|
42
|
-
IN_PROGRESS: 3,
|
|
43
|
-
DELIVERED: 4,
|
|
44
|
-
SETTLED: 5,
|
|
45
|
-
DISPUTED: 6,
|
|
46
|
-
CANCELLED: 7,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Mock blockchain event recorded during transaction lifecycle.
|
|
51
|
-
*
|
|
52
|
-
* Events are stored for debugging and can be queried to simulate
|
|
53
|
-
* blockchain event subscriptions.
|
|
54
|
-
*/
|
|
55
|
-
export interface MockEvent {
|
|
56
|
-
/** Event type (e.g., 'TransactionCreated', 'EscrowLinked', 'StateTransitioned') */
|
|
57
|
-
type: string;
|
|
58
|
-
|
|
59
|
-
/** Unix timestamp (seconds) when event was emitted */
|
|
60
|
-
timestamp: number;
|
|
61
|
-
|
|
62
|
-
/** Block number when event was included */
|
|
63
|
-
blockNumber: number;
|
|
64
|
-
|
|
65
|
-
/** Event-specific data payload */
|
|
66
|
-
data: Record<string, unknown>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Mock transaction representing an ACTP transaction in the mock blockchain.
|
|
71
|
-
*
|
|
72
|
-
* Mirrors the on-chain Transaction struct but stored as JSON for human-readability.
|
|
73
|
-
* BigNumber values are stored as strings to preserve precision.
|
|
74
|
-
*/
|
|
75
|
-
export interface MockTransaction {
|
|
76
|
-
/** Unique transaction identifier (bytes32 hex string) */
|
|
77
|
-
id: string;
|
|
78
|
-
|
|
79
|
-
/** Requester's Ethereum address (checksummed) */
|
|
80
|
-
requester: string;
|
|
81
|
-
|
|
82
|
-
/** Provider's Ethereum address (checksummed) */
|
|
83
|
-
provider: string;
|
|
84
|
-
|
|
85
|
-
/** Transaction amount in USDC wei (string for BigNumber precision, 6 decimals) */
|
|
86
|
-
amount: string;
|
|
87
|
-
|
|
88
|
-
/** Current transaction state */
|
|
89
|
-
state: TransactionState;
|
|
90
|
-
|
|
91
|
-
/** Unix timestamp (seconds) when transaction was created */
|
|
92
|
-
createdAt: number;
|
|
93
|
-
|
|
94
|
-
/** Unix timestamp (seconds) when transaction was last updated */
|
|
95
|
-
updatedAt: number;
|
|
96
|
-
|
|
97
|
-
/** Unix timestamp (seconds) deadline for transaction acceptance */
|
|
98
|
-
deadline: number;
|
|
99
|
-
|
|
100
|
-
/** Dispute window duration in seconds */
|
|
101
|
-
disputeWindow: number;
|
|
102
|
-
|
|
103
|
-
/** Unix timestamp (seconds) when transaction was completed (null if not completed) */
|
|
104
|
-
completedAt: number | null;
|
|
105
|
-
|
|
106
|
-
/** Linked escrow ID (null if not linked yet) */
|
|
107
|
-
escrowId: string | null;
|
|
108
|
-
|
|
109
|
-
/** Service description or metadata hash */
|
|
110
|
-
serviceDescription: string;
|
|
111
|
-
|
|
112
|
-
/** Delivery proof hash (null if not delivered) */
|
|
113
|
-
deliveryProof: string | null;
|
|
114
|
-
|
|
115
|
-
/** List of events emitted during transaction lifecycle */
|
|
116
|
-
events: MockEvent[];
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* ERC-8004 agent ID (optional).
|
|
120
|
-
* If set, can be used for reputation reporting after settlement.
|
|
121
|
-
* Stored as string representation of uint256.
|
|
122
|
-
*/
|
|
123
|
-
agentId?: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Mock escrow representing funds locked for a transaction.
|
|
128
|
-
*
|
|
129
|
-
* In mock mode, escrow is simulated without actual token transfers.
|
|
130
|
-
*/
|
|
131
|
-
export interface MockEscrow {
|
|
132
|
-
/** Unique escrow identifier */
|
|
133
|
-
id: string;
|
|
134
|
-
|
|
135
|
-
/** Current escrow balance in USDC wei (string for BigNumber precision) */
|
|
136
|
-
balance: string;
|
|
137
|
-
|
|
138
|
-
/** Whether funds are currently locked (cannot be withdrawn) */
|
|
139
|
-
locked: boolean;
|
|
140
|
-
|
|
141
|
-
/** List of transaction IDs using this escrow */
|
|
142
|
-
transactions: string[];
|
|
143
|
-
|
|
144
|
-
/** Unix timestamp (seconds) when escrow was created */
|
|
145
|
-
createdAt: number;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Mock account representing a user's wallet state.
|
|
150
|
-
*
|
|
151
|
-
* Tracks USDC balance for testing without real tokens.
|
|
152
|
-
*/
|
|
153
|
-
export interface MockAccount {
|
|
154
|
-
/** Ethereum address (checksummed) */
|
|
155
|
-
address: string;
|
|
156
|
-
|
|
157
|
-
/** USDC balance in wei (string for BigNumber precision, 6 decimals) */
|
|
158
|
-
usdcBalance: string;
|
|
159
|
-
|
|
160
|
-
/** Optional label for easier identification in tests */
|
|
161
|
-
label?: string;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Mock blockchain state simulating chain parameters.
|
|
166
|
-
*
|
|
167
|
-
* Allows time manipulation and block progression for testing
|
|
168
|
-
* deadline-based logic and dispute windows.
|
|
169
|
-
*/
|
|
170
|
-
export interface MockBlockchain {
|
|
171
|
-
/** Current simulated Unix timestamp (seconds) */
|
|
172
|
-
currentTime: number;
|
|
173
|
-
|
|
174
|
-
/** Current block number */
|
|
175
|
-
blockNumber: number;
|
|
176
|
-
|
|
177
|
-
/** Chain ID (84532 for Base Sepolia, 8453 for Base Mainnet) */
|
|
178
|
-
chainId: number;
|
|
179
|
-
|
|
180
|
-
/** Average block time in seconds (for time progression calculations) */
|
|
181
|
-
blockTime: number;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Complete mock state persisted to `.actp/mock-state.json`.
|
|
186
|
-
*
|
|
187
|
-
* This is the root interface for all mock blockchain state.
|
|
188
|
-
* Loaded/saved by MockStateManager.
|
|
189
|
-
*/
|
|
190
|
-
export interface MockState {
|
|
191
|
-
/** State schema version (e.g., "1.0") for migrations */
|
|
192
|
-
version: string;
|
|
193
|
-
|
|
194
|
-
/** Always "mock" for mock mode */
|
|
195
|
-
mode: 'mock';
|
|
196
|
-
|
|
197
|
-
/** Simulated blockchain parameters */
|
|
198
|
-
blockchain: MockBlockchain;
|
|
199
|
-
|
|
200
|
-
/** All mock transactions indexed by transaction ID */
|
|
201
|
-
transactions: Record<string, MockTransaction>;
|
|
202
|
-
|
|
203
|
-
/** All mock escrows indexed by escrow ID */
|
|
204
|
-
escrows: Record<string, MockEscrow>;
|
|
205
|
-
|
|
206
|
-
/** All mock accounts indexed by address */
|
|
207
|
-
accounts: Record<string, MockAccount>;
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Global event log for all events (optional for backwards compatibility).
|
|
211
|
-
*
|
|
212
|
-
* SECURITY FIX (L-4): Events are now persisted to state file for
|
|
213
|
-
* debugging and audit purposes. This allows event history to survive
|
|
214
|
-
* across CLI invocations.
|
|
215
|
-
*/
|
|
216
|
-
events?: MockEvent[];
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Default values for creating new mock state.
|
|
221
|
-
*/
|
|
222
|
-
export const MOCK_STATE_DEFAULTS = {
|
|
223
|
-
/** Current state schema version */
|
|
224
|
-
VERSION: '1.0',
|
|
225
|
-
|
|
226
|
-
/** Default chain ID (Base Sepolia testnet) */
|
|
227
|
-
CHAIN_ID: 84532,
|
|
228
|
-
|
|
229
|
-
/** Default starting block number */
|
|
230
|
-
INITIAL_BLOCK_NUMBER: 1000,
|
|
231
|
-
|
|
232
|
-
/** Default block time in seconds (Base L2 ~2 seconds) */
|
|
233
|
-
BLOCK_TIME: 2,
|
|
234
|
-
|
|
235
|
-
/** Default initial USDC balance for new accounts (10,000 USDC = 10_000_000_000 wei) */
|
|
236
|
-
DEFAULT_USDC_BALANCE: '10000000000',
|
|
237
|
-
} as const;
|