@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.
Files changed (169) hide show
  1. package/dist/ACTPClient.d.ts +18 -0
  2. package/dist/ACTPClient.d.ts.map +1 -1
  3. package/dist/ACTPClient.js +72 -23
  4. package/dist/ACTPClient.js.map +1 -1
  5. package/dist/adapters/BasicAdapter.d.ts +15 -0
  6. package/dist/adapters/BasicAdapter.d.ts.map +1 -1
  7. package/dist/adapters/BasicAdapter.js +33 -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 +90 -12
  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/config/networks.d.ts +10 -2
  20. package/dist/config/networks.d.ts.map +1 -1
  21. package/dist/config/networks.js +31 -22
  22. package/dist/config/networks.js.map +1 -1
  23. package/dist/level0/request.d.ts.map +1 -1
  24. package/dist/level0/request.js +2 -1
  25. package/dist/level0/request.js.map +1 -1
  26. package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
  27. package/dist/runtime/BlockchainRuntime.js +11 -5
  28. package/dist/runtime/BlockchainRuntime.js.map +1 -1
  29. package/dist/utils/IPFSClient.d.ts +3 -1
  30. package/dist/utils/IPFSClient.d.ts.map +1 -1
  31. package/dist/utils/IPFSClient.js +27 -7
  32. package/dist/utils/IPFSClient.js.map +1 -1
  33. package/dist/wallet/AutoWalletProvider.d.ts +11 -1
  34. package/dist/wallet/AutoWalletProvider.d.ts.map +1 -1
  35. package/dist/wallet/AutoWalletProvider.js +84 -19
  36. package/dist/wallet/AutoWalletProvider.js.map +1 -1
  37. package/dist/wallet/IWalletProvider.d.ts +34 -0
  38. package/dist/wallet/IWalletProvider.d.ts.map +1 -1
  39. package/dist/wallet/SmartWalletRouter.d.ts +128 -0
  40. package/dist/wallet/SmartWalletRouter.d.ts.map +1 -0
  41. package/dist/wallet/SmartWalletRouter.js +248 -0
  42. package/dist/wallet/SmartWalletRouter.js.map +1 -0
  43. package/dist/wallet/aa/DualNonceManager.d.ts +26 -1
  44. package/dist/wallet/aa/DualNonceManager.d.ts.map +1 -1
  45. package/dist/wallet/aa/DualNonceManager.js +140 -6
  46. package/dist/wallet/aa/DualNonceManager.js.map +1 -1
  47. package/package.json +3 -6
  48. package/src/ACTPClient.ts +0 -1579
  49. package/src/abi/ACTPKernel.json +0 -1356
  50. package/src/abi/AgentRegistry.json +0 -915
  51. package/src/abi/ERC20.json +0 -40
  52. package/src/abi/EscrowVault.json +0 -134
  53. package/src/abi/IdentityRegistry.json +0 -316
  54. package/src/adapters/AdapterRegistry.ts +0 -173
  55. package/src/adapters/AdapterRouter.ts +0 -416
  56. package/src/adapters/BaseAdapter.ts +0 -498
  57. package/src/adapters/BasicAdapter.ts +0 -514
  58. package/src/adapters/IAdapter.ts +0 -292
  59. package/src/adapters/StandardAdapter.ts +0 -555
  60. package/src/adapters/X402Adapter.ts +0 -731
  61. package/src/adapters/index.ts +0 -60
  62. package/src/builders/DeliveryProofBuilder.ts +0 -327
  63. package/src/builders/QuoteBuilder.ts +0 -483
  64. package/src/builders/index.ts +0 -17
  65. package/src/cli/commands/balance.ts +0 -110
  66. package/src/cli/commands/batch.ts +0 -487
  67. package/src/cli/commands/config.ts +0 -231
  68. package/src/cli/commands/deploy-check.ts +0 -364
  69. package/src/cli/commands/deploy-env.ts +0 -120
  70. package/src/cli/commands/diff.ts +0 -141
  71. package/src/cli/commands/init.ts +0 -469
  72. package/src/cli/commands/mint.ts +0 -116
  73. package/src/cli/commands/pay.ts +0 -113
  74. package/src/cli/commands/publish.ts +0 -475
  75. package/src/cli/commands/pull.ts +0 -124
  76. package/src/cli/commands/register.ts +0 -247
  77. package/src/cli/commands/simulate.ts +0 -345
  78. package/src/cli/commands/time.ts +0 -302
  79. package/src/cli/commands/tx.ts +0 -448
  80. package/src/cli/commands/watch.ts +0 -211
  81. package/src/cli/index.ts +0 -134
  82. package/src/cli/utils/client.ts +0 -252
  83. package/src/cli/utils/config.ts +0 -389
  84. package/src/cli/utils/output.ts +0 -465
  85. package/src/cli/utils/wallet.ts +0 -109
  86. package/src/config/agirailsmd.ts +0 -262
  87. package/src/config/networks.ts +0 -275
  88. package/src/config/pendingPublish.ts +0 -237
  89. package/src/config/publishPipeline.ts +0 -359
  90. package/src/config/syncOperations.ts +0 -279
  91. package/src/erc8004/ERC8004Bridge.ts +0 -462
  92. package/src/erc8004/ReputationReporter.ts +0 -468
  93. package/src/erc8004/index.ts +0 -61
  94. package/src/errors/index.ts +0 -427
  95. package/src/index.ts +0 -364
  96. package/src/level0/Provider.ts +0 -117
  97. package/src/level0/ServiceDirectory.ts +0 -131
  98. package/src/level0/index.ts +0 -10
  99. package/src/level0/provide.ts +0 -132
  100. package/src/level0/request.ts +0 -432
  101. package/src/level1/Agent.ts +0 -1426
  102. package/src/level1/index.ts +0 -10
  103. package/src/level1/pricing/PriceCalculator.ts +0 -255
  104. package/src/level1/pricing/PricingStrategy.ts +0 -198
  105. package/src/level1/types/Job.ts +0 -179
  106. package/src/level1/types/Options.ts +0 -291
  107. package/src/level1/types/index.ts +0 -8
  108. package/src/protocol/ACTPKernel.ts +0 -808
  109. package/src/protocol/AgentRegistry.ts +0 -559
  110. package/src/protocol/DIDManager.ts +0 -629
  111. package/src/protocol/DIDResolver.ts +0 -554
  112. package/src/protocol/EASHelper.ts +0 -378
  113. package/src/protocol/EscrowVault.ts +0 -255
  114. package/src/protocol/EventMonitor.ts +0 -204
  115. package/src/protocol/MessageSigner.ts +0 -510
  116. package/src/protocol/ProofGenerator.ts +0 -339
  117. package/src/protocol/QuoteBuilder.ts +0 -15
  118. package/src/registry/AgentRegistryClient.ts +0 -202
  119. package/src/runtime/BlockchainRuntime.ts +0 -1015
  120. package/src/runtime/IACTPRuntime.ts +0 -306
  121. package/src/runtime/MockRuntime.ts +0 -1298
  122. package/src/runtime/MockStateManager.ts +0 -577
  123. package/src/runtime/index.ts +0 -25
  124. package/src/runtime/types/MockState.ts +0 -237
  125. package/src/storage/ArchiveBundleBuilder.ts +0 -561
  126. package/src/storage/ArweaveClient.ts +0 -946
  127. package/src/storage/FilebaseClient.ts +0 -790
  128. package/src/storage/index.ts +0 -96
  129. package/src/storage/types.ts +0 -348
  130. package/src/types/adapter.ts +0 -310
  131. package/src/types/agent.ts +0 -79
  132. package/src/types/did.ts +0 -223
  133. package/src/types/eip712.ts +0 -175
  134. package/src/types/erc8004.ts +0 -293
  135. package/src/types/escrow.ts +0 -27
  136. package/src/types/index.ts +0 -17
  137. package/src/types/message.ts +0 -145
  138. package/src/types/state.ts +0 -87
  139. package/src/types/transaction.ts +0 -69
  140. package/src/types/x402.ts +0 -251
  141. package/src/utils/ErrorRecoveryGuide.ts +0 -676
  142. package/src/utils/Helpers.ts +0 -688
  143. package/src/utils/IPFSClient.ts +0 -368
  144. package/src/utils/Logger.ts +0 -484
  145. package/src/utils/NonceManager.ts +0 -591
  146. package/src/utils/RateLimiter.ts +0 -534
  147. package/src/utils/ReceivedNonceTracker.ts +0 -567
  148. package/src/utils/SDKLifecycle.ts +0 -416
  149. package/src/utils/SecureNonce.ts +0 -78
  150. package/src/utils/Semaphore.ts +0 -276
  151. package/src/utils/UsedAttestationTracker.ts +0 -385
  152. package/src/utils/canonicalJson.ts +0 -38
  153. package/src/utils/circuitBreaker.ts +0 -324
  154. package/src/utils/computeTypeHash.ts +0 -48
  155. package/src/utils/fsSafe.ts +0 -80
  156. package/src/utils/index.ts +0 -80
  157. package/src/utils/retry.ts +0 -364
  158. package/src/utils/security.ts +0 -418
  159. package/src/utils/validation.ts +0 -540
  160. package/src/wallet/AutoWalletProvider.ts +0 -299
  161. package/src/wallet/EOAWalletProvider.ts +0 -69
  162. package/src/wallet/IWalletProvider.ts +0 -135
  163. package/src/wallet/aa/BundlerClient.ts +0 -274
  164. package/src/wallet/aa/DualNonceManager.ts +0 -173
  165. package/src/wallet/aa/PaymasterClient.ts +0 -174
  166. package/src/wallet/aa/TransactionBatcher.ts +0 -353
  167. package/src/wallet/aa/UserOpBuilder.ts +0 -246
  168. package/src/wallet/aa/constants.ts +0 -60
  169. package/src/wallet/keystore.ts +0 -240
@@ -1,299 +0,0 @@
1
- /**
2
- * AutoWalletProvider — Tier 1 (Auto) wallet implementation.
3
- *
4
- * Creates a CoinbaseSmartWallet with gas-sponsored transactions:
5
- * 1. Load/generate local encrypted key
6
- * 2. Derive Smart Wallet address (counterfactual CREATE2)
7
- * 3. Check AgentRegistry registration
8
- * 4. Build UserOp with executeBatch
9
- * 5. Get paymaster sponsorship (Coinbase → Pimlico fallback)
10
- * 6. Submit via bundler
11
- *
12
- * If agent is NOT registered, falls back to EOA behavior with a warning.
13
- *
14
- * @module wallet/AutoWalletProvider
15
- */
16
-
17
- import { ethers } from 'ethers';
18
- import {
19
- IWalletProvider,
20
- TransactionRequest,
21
- TransactionReceipt,
22
- WalletInfo,
23
- BatchedPayParams,
24
- BatchedPayResult,
25
- } from './IWalletProvider';
26
- import { computeSmartWalletAddress } from './aa/UserOpBuilder';
27
- import {
28
- buildUserOp,
29
- signUserOp,
30
- } from './aa/UserOpBuilder';
31
- import { SmartWalletCall } from './aa/constants';
32
- import { BundlerClient } from './aa/BundlerClient';
33
- import { PaymasterClient } from './aa/PaymasterClient';
34
- import { DualNonceManager } from './aa/DualNonceManager';
35
- import { buildACTPPayBatch } from './aa/TransactionBatcher';
36
- import { sdkLogger } from '../utils/Logger';
37
-
38
- // ============================================================================
39
- // Types
40
- // ============================================================================
41
-
42
- export interface AutoWalletConfig {
43
- /** Ethers signer (the EOA that owns the Smart Wallet) */
44
- signer: ethers.Wallet;
45
- /** Ethers provider */
46
- provider: ethers.JsonRpcProvider;
47
- /** Chain ID */
48
- chainId: number;
49
- /** ACTPKernel contract address (for ACTP nonce reads) */
50
- actpKernelAddress: string;
51
- /** Bundler configuration */
52
- bundler: {
53
- primaryUrl: string;
54
- backupUrl?: string;
55
- };
56
- /** Paymaster configuration */
57
- paymaster: {
58
- primaryUrl: string;
59
- backupUrl?: string;
60
- };
61
- }
62
-
63
- // ============================================================================
64
- // AutoWalletProvider
65
- // ============================================================================
66
-
67
- export class AutoWalletProvider implements IWalletProvider {
68
- private readonly signer: ethers.Wallet;
69
- private readonly provider: ethers.JsonRpcProvider;
70
- private readonly chainId: number;
71
- private readonly bundler: BundlerClient;
72
- private readonly paymaster: PaymasterClient;
73
- private readonly nonceManager: DualNonceManager;
74
- private smartWalletAddress: string = '';
75
- private isDeployed: boolean = false;
76
-
77
- private constructor(
78
- config: AutoWalletConfig,
79
- smartWalletAddress: string,
80
- isDeployed: boolean
81
- ) {
82
- this.signer = config.signer;
83
- this.provider = config.provider;
84
- this.chainId = config.chainId;
85
- this.smartWalletAddress = smartWalletAddress;
86
- this.isDeployed = isDeployed;
87
-
88
- this.bundler = new BundlerClient({
89
- primaryUrl: config.bundler.primaryUrl,
90
- backupUrl: config.bundler.backupUrl,
91
- });
92
-
93
- this.paymaster = new PaymasterClient({
94
- primaryUrl: config.paymaster.primaryUrl,
95
- backupUrl: config.paymaster.backupUrl,
96
- chainId: config.chainId,
97
- });
98
-
99
- this.nonceManager = new DualNonceManager(
100
- config.provider,
101
- smartWalletAddress,
102
- config.actpKernelAddress
103
- );
104
- }
105
-
106
- /**
107
- * Factory method — computes counterfactual address and checks deployment.
108
- */
109
- static async create(config: AutoWalletConfig): Promise<AutoWalletProvider> {
110
- const signerAddress = config.signer.address;
111
- const smartWalletAddress = await computeSmartWalletAddress(
112
- signerAddress,
113
- config.provider
114
- );
115
-
116
- // Check if wallet is already deployed
117
- const code = await config.provider.getCode(smartWalletAddress);
118
- const isDeployed = code !== '0x';
119
-
120
- sdkLogger.info('AutoWalletProvider initialized', {
121
- signer: signerAddress,
122
- smartWallet: smartWalletAddress,
123
- deployed: isDeployed,
124
- });
125
-
126
- return new AutoWalletProvider(config, smartWalletAddress, isDeployed);
127
- }
128
-
129
- getAddress(): string {
130
- return this.smartWalletAddress;
131
- }
132
-
133
- async sendTransaction(tx: TransactionRequest): Promise<TransactionReceipt> {
134
- return this.sendBatchTransaction([tx]);
135
- }
136
-
137
- async sendBatchTransaction(
138
- txs: TransactionRequest[]
139
- ): Promise<TransactionReceipt> {
140
- if (txs.length === 0) {
141
- throw new Error('sendBatchTransaction requires at least one transaction');
142
- }
143
-
144
- // Convert to SmartWalletCall[]
145
- const calls: SmartWalletCall[] = txs.map((tx) => ({
146
- target: tx.to,
147
- value: tx.value ? BigInt(tx.value) : 0n,
148
- data: tx.data,
149
- }));
150
-
151
- // Use nonce manager for sequential ordering
152
- // Note: We don't know if this specific batch increments ACTP nonce
153
- // (that's handled at the ACTPClient level), so pass false here.
154
- // The caller (ACTPClient.payBatched) manages ACTP nonce tracking.
155
- return this.nonceManager.enqueue(
156
- async ({ entryPointNonce }) => {
157
- const receipt = await this.submitUserOp(calls, entryPointNonce);
158
- return { result: receipt, success: receipt.success };
159
- },
160
- false // ACTP nonce management is done at ACTPClient level
161
- );
162
- }
163
-
164
- getWalletInfo(): WalletInfo {
165
- return {
166
- address: this.smartWalletAddress,
167
- tier: 'auto',
168
- supportsBatching: true,
169
- gasSponsored: true,
170
- chainId: this.chainId,
171
- };
172
- }
173
-
174
- /**
175
- * Get the DualNonceManager (for ACTPClient to use for ACTP-aware batching).
176
- */
177
- getNonceManager(): DualNonceManager {
178
- return this.nonceManager;
179
- }
180
-
181
- /**
182
- * Check if the Smart Wallet is deployed on-chain.
183
- */
184
- getIsDeployed(): boolean {
185
- return this.isDeployed;
186
- }
187
-
188
- /**
189
- * Execute a batched ACTP payment atomically.
190
- *
191
- * Builds approve + createTransaction + linkEscrow as a single UserOp.
192
- * Manages ACTP nonce inside the mutex queue for concurrent safety.
193
- */
194
- async payACTPBatched(params: BatchedPayParams, prependCalls?: SmartWalletCall[]): Promise<BatchedPayResult> {
195
- return this.nonceManager.enqueue(
196
- async ({ entryPointNonce, actpNonce }) => {
197
- const batch = buildACTPPayBatch({
198
- ...params,
199
- actpNonce,
200
- });
201
-
202
- // Combine activation calls (if any) with payment calls
203
- const allCalls = prependCalls && prependCalls.length > 0
204
- ? [...prependCalls, ...batch.calls]
205
- : batch.calls;
206
-
207
- const receipt = await this.submitUserOp(allCalls, entryPointNonce);
208
-
209
- return {
210
- result: {
211
- txId: batch.txId,
212
- hash: receipt.hash,
213
- success: receipt.success,
214
- },
215
- success: receipt.success,
216
- };
217
- },
218
- true // Increment ACTP nonce on success
219
- );
220
- }
221
-
222
- // ==========================================================================
223
- // Internal
224
- // ==========================================================================
225
-
226
- /**
227
- * Build, sponsor, sign, and submit a UserOp.
228
- */
229
- private async submitUserOp(
230
- calls: SmartWalletCall[],
231
- entryPointNonce: bigint
232
- ): Promise<TransactionReceipt> {
233
- const signerAddress = this.signer.address;
234
-
235
- // 1. Build unsigned UserOp
236
- const userOp = buildUserOp({
237
- sender: this.smartWalletAddress,
238
- nonce: entryPointNonce,
239
- calls,
240
- isFirstDeploy: !this.isDeployed,
241
- signerAddress,
242
- });
243
-
244
- // 2. Get fee data
245
- const feeData = await this.provider.getFeeData();
246
- userOp.maxFeePerGas = feeData.maxFeePerGas ?? 2_000_000_000n;
247
- userOp.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 1_000_000_000n;
248
-
249
- // 3. Get stub paymaster data (for gas estimation)
250
- const stubData = await this.paymaster.getPaymasterStubData(userOp);
251
- userOp.paymasterAndData = stubData.paymasterAndData;
252
-
253
- // 4. Dummy signature for gas estimation
254
- userOp.signature = dummySignature();
255
-
256
- // 5. Estimate gas
257
- const gasEstimate = await this.bundler.estimateUserOperationGas(userOp);
258
- userOp.callGasLimit = gasEstimate.callGasLimit;
259
- userOp.verificationGasLimit = gasEstimate.verificationGasLimit;
260
- userOp.preVerificationGas = gasEstimate.preVerificationGas;
261
-
262
- // 6. Get final paymaster data (with real gas values)
263
- const finalPaymaster = await this.paymaster.getPaymasterData(userOp);
264
- userOp.paymasterAndData = finalPaymaster.paymasterAndData;
265
-
266
- // 7. Sign
267
- userOp.signature = await signUserOp(userOp, this.signer, this.chainId);
268
-
269
- // 8. Submit
270
- const userOpHash = await this.bundler.sendUserOperation(userOp);
271
- sdkLogger.info('UserOp submitted', { userOpHash });
272
-
273
- // 9. Wait for receipt
274
- const receipt = await this.bundler.waitForReceipt(userOpHash);
275
-
276
- // Mark as deployed after first successful UserOp
277
- if (!this.isDeployed && receipt.success) {
278
- this.isDeployed = true;
279
- }
280
-
281
- return {
282
- hash: receipt.transactionHash,
283
- success: receipt.success,
284
- };
285
- }
286
- }
287
-
288
- /**
289
- * Dummy signature for gas estimation.
290
- * CoinbaseSmartWallet expects abi.encode(uint256 ownerIndex, bytes sig)
291
- * where sig is 65 bytes (r,s,v).
292
- */
293
- function dummySignature(): string {
294
- const dummySig = '0x' + 'ff'.repeat(65);
295
- return ethers.AbiCoder.defaultAbiCoder().encode(
296
- ['uint256', 'bytes'],
297
- [0, dummySig]
298
- );
299
- }
@@ -1,69 +0,0 @@
1
- /**
2
- * EOAWalletProvider — Tier 2 (BYOW) wallet implementation.
3
- *
4
- * Wraps an ethers.Wallet for traditional EOA signing.
5
- * sendBatchTransaction() executes calls sequentially (no atomic batching).
6
- * This is the backward-compatible path for agents that don't register.
7
- *
8
- * @module wallet/EOAWalletProvider
9
- */
10
-
11
- import { ethers } from 'ethers';
12
- import {
13
- IWalletProvider,
14
- TransactionRequest,
15
- TransactionReceipt,
16
- WalletInfo,
17
- } from './IWalletProvider';
18
-
19
- export class EOAWalletProvider implements IWalletProvider {
20
- private readonly wallet: ethers.Wallet;
21
- private readonly chainId: number;
22
-
23
- constructor(wallet: ethers.Wallet, chainId: number) {
24
- this.wallet = wallet;
25
- this.chainId = chainId;
26
- }
27
-
28
- getAddress(): string {
29
- return this.wallet.address;
30
- }
31
-
32
- async sendTransaction(tx: TransactionRequest): Promise<TransactionReceipt> {
33
- const response = await this.wallet.sendTransaction({
34
- to: tx.to,
35
- data: tx.data,
36
- value: tx.value ? BigInt(tx.value) : 0n,
37
- });
38
- const receipt = await response.wait();
39
- return {
40
- hash: receipt!.hash,
41
- success: receipt!.status === 1,
42
- };
43
- }
44
-
45
- async sendBatchTransaction(txs: TransactionRequest[]): Promise<TransactionReceipt> {
46
- if (txs.length === 0) {
47
- throw new Error('sendBatchTransaction requires at least one transaction');
48
- }
49
-
50
- let lastReceipt: TransactionReceipt | undefined;
51
- for (const tx of txs) {
52
- lastReceipt = await this.sendTransaction(tx);
53
- if (!lastReceipt.success) {
54
- return lastReceipt; // Fail fast
55
- }
56
- }
57
- return lastReceipt!;
58
- }
59
-
60
- getWalletInfo(): WalletInfo {
61
- return {
62
- address: this.wallet.address,
63
- tier: 'eoa',
64
- supportsBatching: false,
65
- gasSponsored: false,
66
- chainId: this.chainId,
67
- };
68
- }
69
- }
@@ -1,135 +0,0 @@
1
- /**
2
- * IWalletProvider — Wallet abstraction for ACTP SDK.
3
- *
4
- * Enables pluggable wallet implementations:
5
- * - EOAWalletProvider (Tier 2): Direct ethers.Wallet signing
6
- * - AutoWalletProvider (Tier 1): CoinbaseSmartWallet + Paymaster (gasless)
7
- *
8
- * @module wallet/IWalletProvider
9
- */
10
-
11
- // ============================================================================
12
- // Types
13
- // ============================================================================
14
-
15
- /**
16
- * Low-level transaction request.
17
- * Plain strings only — no ethers or viem types at the interface boundary.
18
- */
19
- export interface TransactionRequest {
20
- /** Target contract address (0x-prefixed) */
21
- to: string;
22
- /** Calldata (0x-prefixed hex) */
23
- data: string;
24
- /** ETH value in wei (decimal string). Defaults to "0". */
25
- value?: string;
26
- }
27
-
28
- /**
29
- * Transaction receipt returned after submission.
30
- */
31
- export interface TransactionReceipt {
32
- /** Transaction hash (EOA) or UserOp hash (AA) */
33
- hash: string;
34
- /** Whether the transaction succeeded */
35
- success: boolean;
36
- }
37
-
38
- /**
39
- * Wallet tier — determines gas behavior.
40
- */
41
- export type WalletTier = 'auto' | 'eoa';
42
-
43
- /**
44
- * Information about the wallet provider.
45
- */
46
- export interface WalletInfo {
47
- /** The account address used for ACTP transactions */
48
- address: string;
49
- /** Wallet tier */
50
- tier: WalletTier;
51
- /** Whether this wallet supports atomic batching (AA = true, EOA = false) */
52
- supportsBatching: boolean;
53
- /** Whether gas is sponsored (AA with paymaster = true) */
54
- gasSponsored: boolean;
55
- /** Chain ID */
56
- chainId: number;
57
- }
58
-
59
- /**
60
- * Result of a batched ACTP payment via AA wallet.
61
- */
62
- export interface BatchedPayResult {
63
- /** Pre-computed ACTP transaction ID (bytes32) */
64
- txId: string;
65
- /** Transaction hash from the UserOp */
66
- hash: string;
67
- /** Whether the UserOp succeeded */
68
- success: boolean;
69
- }
70
-
71
- /**
72
- * Parameters for batched ACTP payment.
73
- */
74
- export interface BatchedPayParams {
75
- provider: string;
76
- requester: string;
77
- amount: string;
78
- deadline: number;
79
- disputeWindow: number;
80
- serviceHash: string;
81
- agentId: string;
82
- contracts: {
83
- usdc: string;
84
- actpKernel: string;
85
- escrowVault: string;
86
- };
87
- }
88
-
89
- // ============================================================================
90
- // Interface
91
- // ============================================================================
92
-
93
- /**
94
- * Wallet provider interface.
95
- *
96
- * All methods use plain strings (no ethers/viem types) to keep the
97
- * interface decoupled from any specific library.
98
- */
99
- export interface IWalletProvider {
100
- /**
101
- * Get the account address used as requester in ACTP transactions.
102
- * For AA wallets this is the Smart Wallet address (not the signer EOA).
103
- */
104
- getAddress(): string;
105
-
106
- /**
107
- * Send a single transaction.
108
- */
109
- sendTransaction(tx: TransactionRequest): Promise<TransactionReceipt>;
110
-
111
- /**
112
- * Send multiple transactions atomically (AA) or sequentially (EOA).
113
- *
114
- * AA wallets batch all calls into a single UserOp.
115
- * EOA wallets execute them one by one and return the last receipt.
116
- */
117
- sendBatchTransaction(txs: TransactionRequest[]): Promise<TransactionReceipt>;
118
-
119
- /**
120
- * Get wallet metadata.
121
- */
122
- getWalletInfo(): WalletInfo;
123
-
124
- /**
125
- * Execute a batched ACTP payment atomically (approve + createTx + linkEscrow).
126
- *
127
- * Only available on AA wallets (supportsBatching: true).
128
- * Handles ACTP nonce management internally via the DualNonceManager mutex.
129
- *
130
- * @param params - Payment batch parameters
131
- * @param prependCalls - Optional calls to prepend (e.g., lazy publish activation)
132
- * @returns undefined if batched payments are not supported.
133
- */
134
- payACTPBatched?(params: BatchedPayParams, prependCalls?: import('./aa/constants').SmartWalletCall[]): Promise<BatchedPayResult>;
135
- }