@deserialize/multi-vm-wallet 1.4.12 → 1.5.1

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 (191) hide show
  1. package/.claude/settings.local.json +7 -1
  2. package/BUILD_OPTIMIZATION_PLAN.md +640 -0
  3. package/BUILD_RESULTS.md +282 -0
  4. package/BUN_MIGRATION.md +415 -0
  5. package/CHANGELOG_SECURITY.md +573 -0
  6. package/IMPLEMENTATION_SUMMARY.md +494 -0
  7. package/SECURITY_AUDIT.md +1124 -0
  8. package/bun.lock +553 -0
  9. package/dist/IChainWallet.js +0 -5
  10. package/dist/bip32Old.js +0 -885
  11. package/dist/bip32Small.js +0 -79
  12. package/dist/bipTest.js +0 -362
  13. package/dist/constant.js +0 -17
  14. package/dist/english.js +0 -1
  15. package/dist/evm/aa-service/index.d.ts +0 -5
  16. package/dist/evm/aa-service/index.js +0 -14
  17. package/dist/evm/aa-service/lib/account-adapter.d.ts +0 -22
  18. package/dist/evm/aa-service/lib/account-adapter.js +0 -24
  19. package/dist/evm/aa-service/lib/kernel-account.d.ts +0 -30
  20. package/dist/evm/aa-service/lib/kernel-account.js +2 -67
  21. package/dist/evm/aa-service/lib/kernel-modules.d.ts +0 -177
  22. package/dist/evm/aa-service/lib/kernel-modules.js +4 -202
  23. package/dist/evm/aa-service/lib/session-keys.d.ts +0 -118
  24. package/dist/evm/aa-service/lib/session-keys.js +7 -151
  25. package/dist/evm/aa-service/lib/type.d.ts +0 -55
  26. package/dist/evm/aa-service/lib/type.js +0 -10
  27. package/dist/evm/aa-service/services/account-abstraction.d.ts +0 -426
  28. package/dist/evm/aa-service/services/account-abstraction.js +0 -461
  29. package/dist/evm/aa-service/services/bundler.d.ts +0 -6
  30. package/dist/evm/aa-service/services/bundler.js +0 -54
  31. package/dist/evm/evm.d.ts +10 -67
  32. package/dist/evm/evm.js +339 -102
  33. package/dist/evm/index.js +0 -3
  34. package/dist/evm/script.js +3 -17
  35. package/dist/evm/smartWallet.d.ts +0 -173
  36. package/dist/evm/smartWallet.js +0 -206
  37. package/dist/evm/smartWallet.types.d.ts +0 -6
  38. package/dist/evm/smartWallet.types.js +0 -8
  39. package/dist/evm/transaction.utils.d.ts +0 -242
  40. package/dist/evm/transaction.utils.js +4 -320
  41. package/dist/evm/transactionParsing.d.ts +0 -11
  42. package/dist/evm/transactionParsing.js +28 -147
  43. package/dist/evm/utils.d.ts +0 -46
  44. package/dist/evm/utils.js +1 -57
  45. package/dist/helpers/index.d.ts +0 -4
  46. package/dist/helpers/index.js +8 -44
  47. package/dist/helpers/routeScan.js +0 -1
  48. package/dist/index.js +0 -1
  49. package/dist/old.js +0 -884
  50. package/dist/price.js +0 -1
  51. package/dist/price.types.js +0 -2
  52. package/dist/rate-limiter.d.ts +28 -0
  53. package/dist/rate-limiter.js +95 -0
  54. package/dist/retry-logic.d.ts +14 -0
  55. package/dist/retry-logic.js +120 -0
  56. package/dist/savings/index.d.ts +1 -0
  57. package/dist/savings/index.js +16 -2
  58. package/dist/savings/saving-manager.d.ts +46 -0
  59. package/dist/savings/saving-manager.js +176 -0
  60. package/dist/savings/savings-operations.d.ts +39 -0
  61. package/dist/savings/savings-operations.js +141 -0
  62. package/dist/savings/smart-savings.d.ts +0 -63
  63. package/dist/savings/smart-savings.js +0 -78
  64. package/dist/savings/types.d.ts +0 -69
  65. package/dist/savings/types.js +0 -7
  66. package/dist/savings/validation.d.ts +9 -0
  67. package/dist/savings/validation.js +85 -0
  68. package/dist/svm/constant.js +0 -1
  69. package/dist/svm/index.js +0 -1
  70. package/dist/svm/svm.d.ts +7 -13
  71. package/dist/svm/svm.js +262 -46
  72. package/dist/svm/transactionParsing.d.ts +0 -7
  73. package/dist/svm/transactionParsing.js +3 -41
  74. package/dist/svm/transactionSender.js +0 -9
  75. package/dist/svm/utils.d.ts +0 -12
  76. package/dist/svm/utils.js +9 -60
  77. package/dist/test.d.ts +0 -4
  78. package/dist/test.js +15 -95
  79. package/dist/transaction-utils.d.ts +38 -0
  80. package/dist/transaction-utils.js +168 -0
  81. package/dist/types.d.ts +36 -0
  82. package/dist/types.js +0 -1
  83. package/dist/utils.js +0 -1
  84. package/dist/vm-validation.d.ts +11 -0
  85. package/dist/vm-validation.js +151 -0
  86. package/dist/vm.d.ts +14 -16
  87. package/dist/vm.js +64 -53
  88. package/dist/walletBip32.d.ts +2 -0
  89. package/dist/walletBip32.js +31 -66
  90. package/package.json +9 -4
  91. package/test-discovery.ts +235 -0
  92. package/test-pocket-discovery.ts +84 -0
  93. package/tsconfig.json +18 -11
  94. package/tsconfig.prod.json +10 -0
  95. package/utils/IChainWallet.ts +2 -0
  96. package/utils/evm/evm.ts +560 -39
  97. package/utils/rate-limiter.ts +179 -0
  98. package/utils/retry-logic.ts +271 -0
  99. package/utils/savings/EXAMPLES.md +883 -0
  100. package/utils/savings/SECURITY.md +731 -0
  101. package/utils/savings/index.ts +1 -1
  102. package/utils/savings/saving-manager.ts +656 -0
  103. package/utils/savings/savings-operations.ts +509 -0
  104. package/utils/savings/validation.ts +187 -0
  105. package/utils/svm/svm.ts +467 -20
  106. package/utils/test.ts +26 -3
  107. package/utils/transaction-utils.ts +394 -0
  108. package/utils/types.ts +100 -0
  109. package/utils/vm-validation.ts +280 -0
  110. package/utils/vm.ts +202 -24
  111. package/utils/walletBip32.ts +63 -3
  112. package/dist/IChainWallet.js.map +0 -1
  113. package/dist/bip32.d.ts +0 -9
  114. package/dist/bip32.js +0 -172
  115. package/dist/bip32.js.map +0 -1
  116. package/dist/bip32Old.js.map +0 -1
  117. package/dist/bip32Small.js.map +0 -1
  118. package/dist/bipTest.js.map +0 -1
  119. package/dist/constant.js.map +0 -1
  120. package/dist/english.js.map +0 -1
  121. package/dist/evm/SMART_WALLET_EXAMPLES.d.ts +0 -20
  122. package/dist/evm/SMART_WALLET_EXAMPLES.js +0 -451
  123. package/dist/evm/SMART_WALLET_EXAMPLES.js.map +0 -1
  124. package/dist/evm/aa-service/index.js.map +0 -1
  125. package/dist/evm/aa-service/lib/account-adapter.js.map +0 -1
  126. package/dist/evm/aa-service/lib/kernel-account.js.map +0 -1
  127. package/dist/evm/aa-service/lib/kernel-modules.js.map +0 -1
  128. package/dist/evm/aa-service/lib/session-keys.js.map +0 -1
  129. package/dist/evm/aa-service/lib/type.js.map +0 -1
  130. package/dist/evm/aa-service/services/account-abstraction.js.map +0 -1
  131. package/dist/evm/aa-service/services/bundler.js.map +0 -1
  132. package/dist/evm/evm.js.map +0 -1
  133. package/dist/evm/index.js.map +0 -1
  134. package/dist/evm/script.js.map +0 -1
  135. package/dist/evm/smartWallet.js.map +0 -1
  136. package/dist/evm/smartWallet.types.js.map +0 -1
  137. package/dist/evm/transaction.utils.js.map +0 -1
  138. package/dist/evm/transactionParsing.js.map +0 -1
  139. package/dist/evm/utils.js.map +0 -1
  140. package/dist/helpers/index.js.map +0 -1
  141. package/dist/helpers/routeScan.js.map +0 -1
  142. package/dist/index.js.map +0 -1
  143. package/dist/old.js.map +0 -1
  144. package/dist/price.js.map +0 -1
  145. package/dist/price.types.js.map +0 -1
  146. package/dist/privacy/artifact-manager.d.ts +0 -117
  147. package/dist/privacy/artifact-manager.js +0 -251
  148. package/dist/privacy/artifact-manager.js.map +0 -1
  149. package/dist/privacy/broadcaster-client.d.ts +0 -166
  150. package/dist/privacy/broadcaster-client.js +0 -261
  151. package/dist/privacy/broadcaster-client.js.map +0 -1
  152. package/dist/privacy/index.d.ts +0 -34
  153. package/dist/privacy/index.js +0 -56
  154. package/dist/privacy/index.js.map +0 -1
  155. package/dist/privacy/network-config.d.ts +0 -57
  156. package/dist/privacy/network-config.js +0 -118
  157. package/dist/privacy/network-config.js.map +0 -1
  158. package/dist/privacy/poi-helper.d.ts +0 -161
  159. package/dist/privacy/poi-helper.js +0 -249
  160. package/dist/privacy/poi-helper.js.map +0 -1
  161. package/dist/privacy/railgun-engine.d.ts +0 -135
  162. package/dist/privacy/railgun-engine.js +0 -205
  163. package/dist/privacy/railgun-engine.js.map +0 -1
  164. package/dist/privacy/railgun-privacy-wallet.d.ts +0 -288
  165. package/dist/privacy/railgun-privacy-wallet.js +0 -539
  166. package/dist/privacy/railgun-privacy-wallet.js.map +0 -1
  167. package/dist/privacy/types.d.ts +0 -229
  168. package/dist/privacy/types.js +0 -26
  169. package/dist/privacy/types.js.map +0 -1
  170. package/dist/savings/index.js.map +0 -1
  171. package/dist/savings/saving-actions.d.ts +0 -0
  172. package/dist/savings/saving-actions.js +0 -78
  173. package/dist/savings/saving-actions.js.map +0 -1
  174. package/dist/savings/savings-manager.d.ts +0 -126
  175. package/dist/savings/savings-manager.js +0 -234
  176. package/dist/savings/savings-manager.js.map +0 -1
  177. package/dist/savings/smart-savings.js.map +0 -1
  178. package/dist/savings/types.js.map +0 -1
  179. package/dist/svm/constant.js.map +0 -1
  180. package/dist/svm/index.js.map +0 -1
  181. package/dist/svm/svm.js.map +0 -1
  182. package/dist/svm/transactionParsing.js.map +0 -1
  183. package/dist/svm/transactionSender.js.map +0 -1
  184. package/dist/svm/utils.js.map +0 -1
  185. package/dist/test.js.map +0 -1
  186. package/dist/types.js.map +0 -1
  187. package/dist/utils.js.map +0 -1
  188. package/dist/vm.js.map +0 -1
  189. package/dist/walletBip32.js.map +0 -1
  190. package/utils/savings/saving-actions.ts +0 -92
  191. package/utils/savings/savings-manager.ts +0 -271
@@ -1,18 +1,3 @@
1
- /**
2
- * Account Abstraction Service (Singleton)
3
- *
4
- * Centralized service for managing Kernel accounts, bundlers, and transactions.
5
- * Use this singleton across your application for consistent AA operations.
6
- *
7
- * Usage:
8
- * const aaService = AccountAbstractionService.getInstance({
9
- * bundlerProvider: 'pimlico',
10
- * apiKey: env.pimlicoApiKey
11
- * });
12
- *
13
- * const account = await aaService.createAccount(sepolia, owner);
14
- * const txHash = await aaService.sendTransaction({ account, to, value });
15
- */
16
1
  import { Chain, Hex } from 'viem';
17
2
  import { PrivateKeyAccount } from 'viem/accounts';
18
3
  import { SignAuthorizationReturnType } from 'viem';
@@ -55,447 +40,102 @@ export declare class AccountAbstractionService {
55
40
  private bundlerManager;
56
41
  private aaConfig;
57
42
  private publicClientCache;
58
- /**
59
- * Private constructor (singleton pattern)
60
- */
61
43
  private constructor();
62
- /**
63
- * Get singleton instance
64
- */
65
44
  static getInstance(config?: AAServiceConfig): AccountAbstractionService;
66
- /**
67
- * Reset singleton instance (useful for testing or reconfiguration)
68
- */
69
45
  static reset(): void;
70
- /**
71
- * Create a Kernel 7702 account
72
- */
73
46
  createAccount(options: CreateAccountOptions): Promise<KernelAccountInstance>;
74
- /**
75
- * Check if account is already delegated to Kernel
76
- */
77
47
  isAccountDelegated(owner: PrivateKeyAccount, chain: Chain): Promise<boolean>;
78
- /**
79
- * Create EIP-7702 authorization (if needed)
80
- */
81
48
  createAuthorization(options: {
82
49
  owner: PrivateKeyAccount;
83
50
  chain: Chain;
84
51
  }): Promise<SignAuthorizationReturnType | undefined>;
85
- /**
86
- * Prepare a call (for batching)
87
- *
88
- * Returns a Call object that can be included in a batch transaction.
89
- * Use this to prepare any transfer or contract interaction for batching.
90
- *
91
- * @example
92
- * // Prepare multiple calls
93
- * const calls = [
94
- * aaService.prepareCall({ to: recipient1, value: parseEther('0.1') }),
95
- * aaService.prepareCall({ to: recipient2, value: parseEther('0.2') }),
96
- * aaService.prepareCall({ to: contractAddress, data: encodedData })
97
- * ];
98
- * await aaService.sendBatchTransaction({ account, calls });
99
- */
100
52
  prepareCall(options: {
101
53
  to: Hex;
102
54
  value?: bigint;
103
55
  data?: Hex;
104
56
  }): Call;
105
- /**
106
- * Prepare a contract call (for batching)
107
- *
108
- * Helper for preparing contract interactions with type-safe encoding.
109
- *
110
- * @example
111
- * import { parseAbi, encodeFunctionData } from 'viem';
112
- *
113
- * const call = aaService.prepareContractCall({
114
- * to: USDC_ADDRESS,
115
- * data: encodeFunctionData({
116
- * abi: parseAbi(['function transfer(address to, uint256 amount)']),
117
- * functionName: 'transfer',
118
- * args: [recipient, parseUnits('100', 6)]
119
- * })
120
- * });
121
- */
122
57
  prepareContractCall(options: {
123
58
  to: Hex;
124
59
  data: Hex;
125
60
  value?: bigint;
126
61
  }): Call;
127
- /**
128
- * Send a transaction using Kernel account (execute immediately)
129
- *
130
- * For batching multiple operations, use prepareCall() + sendBatchTransaction() instead.
131
- *
132
- * @example
133
- * // Single transaction
134
- * await aaService.sendTransaction({
135
- * account,
136
- * to: recipient,
137
- * value: parseEther('0.1')
138
- * });
139
- *
140
- * // For batching, use prepareCall instead:
141
- * const calls = [
142
- * aaService.prepareCall({ to: recipient1, value: parseEther('0.1') }),
143
- * aaService.prepareCall({ to: recipient2, value: parseEther('0.2') })
144
- * ];
145
- * await aaService.sendBatchTransaction({ account, calls });
146
- */
147
62
  sendTransaction(options: SendTransactionOptions): Promise<Hex>;
148
- /**
149
- * Wait for transaction receipt
150
- */
151
63
  waitForReceipt(options: WaitForReceiptOptions): Promise<any>;
152
- /**
153
- * Send transaction and wait for receipt (convenience method)
154
- */
155
64
  sendTransactionAndWait(options: SendTransactionOptions): Promise<{
156
65
  userOpHash: Hex;
157
66
  receipt: any;
158
67
  }>;
159
- /**
160
- * Send batch transaction (RECOMMENDED for smart accounts)
161
- *
162
- * Sends multiple calls in a single UserOperation, paying gas ONLY ONCE.
163
- * This is one of the main advantages of smart accounts over EOAs.
164
- *
165
- * Use prepare*() methods to create Call objects for batching:
166
- * - prepareCall() - for transfers and contract interactions
167
- * - prepareInstallModule() - for module installations
168
- * - prepareInstallSessionKey() - for session keys
169
- * - prepareInstallMultiSigValidator() - for multi-sig
170
- * - etc.
171
- *
172
- * @example
173
- * // Send ETH to 3 recipients in one transaction
174
- * const calls = [
175
- * aaService.prepareCall({ to: '0xRecipient1', value: parseEther('0.01') }),
176
- * aaService.prepareCall({ to: '0xRecipient2', value: parseEther('0.02') }),
177
- * aaService.prepareCall({ to: '0xRecipient3', value: parseEther('0.03') })
178
- * ];
179
- * await aaService.sendBatchTransaction({ account, calls });
180
- *
181
- * @example
182
- * // Mix transfers, contract calls, and module installations
183
- * const calls = [
184
- * aaService.prepareCall({ to: recipient, value: parseEther('0.1') }),
185
- * aaService.prepareContractCall({ to: USDC, data: transferData }),
186
- * aaService.prepareInstallSessionKey({ account, sessionKeyAddress, permissions })
187
- * ];
188
- * await aaService.sendBatchTransaction({ account, calls });
189
- *
190
- * @example
191
- * // Install multiple modules at once
192
- * const calls = [
193
- * aaService.prepareInstallSessionKey({ account, ... }),
194
- * aaService.prepareInstallMultiSigValidator({ account, ... }),
195
- * aaService.prepareInstallModule({ account, moduleType: 'hook', ... })
196
- * ];
197
- * await aaService.sendBatchTransaction({ account, calls });
198
- */
199
68
  sendBatchTransaction(options: SendBatchTransactionOptions): Promise<Hex>;
200
- /**
201
- * Send batch transaction and wait for receipt (convenience method)
202
- *
203
- * Same as sendBatchTransaction but waits for confirmation.
204
- */
205
69
  sendBatchTransactionAndWait(options: SendBatchTransactionOptions): Promise<{
206
70
  userOpHash: Hex;
207
71
  receipt: any;
208
72
  }>;
209
- /**
210
- * Get account balance
211
- */
212
73
  getBalance(account: KernelAccountInstance): Promise<bigint>;
213
- /**
214
- * Get or create public client for standard RPC calls
215
- * (bundler clients don't support standard eth_* methods)
216
- */
217
74
  private getPublicClient;
218
- /**
219
- * Get bundler information
220
- */
221
75
  getBundlerInfo(chain: Chain): {
222
76
  provider: string;
223
77
  url: string;
224
78
  };
225
- /**
226
- * Get bundler client directly (advanced usage)
227
- */
228
79
  getBundlerClient(chain: Chain): any;
229
- /**
230
- * Get bundler manager (advanced usage)
231
- */
232
80
  getBundlerManager(chain: Chain): BundlerManager;
233
- /**
234
- * Prepare module installation call (for batching)
235
- *
236
- * Returns a Call object that can be included in a batch transaction.
237
- * This allows you to install multiple modules in a single UserOperation.
238
- *
239
- * @example
240
- * // Batch install multiple modules
241
- * const calls = [
242
- * aaService.prepareInstallModule({
243
- * account,
244
- * moduleType: 'validator',
245
- * moduleAddress: SESSION_KEY_VALIDATOR
246
- * }),
247
- * aaService.prepareInstallModule({
248
- * account,
249
- * moduleType: 'hook',
250
- * moduleAddress: SPENDING_LIMIT_HOOK
251
- * })
252
- * ];
253
- * await aaService.sendBatchTransaction({ account, calls });
254
- */
255
81
  prepareInstallModule(options: {
256
82
  account: KernelAccountInstance;
257
83
  moduleType: ModuleType;
258
84
  moduleAddress: Hex;
259
85
  initData?: Hex;
260
86
  }): Call;
261
- /**
262
- * Install a module on an account (execute immediately)
263
- *
264
- * For batching multiple modules, use prepareInstallModule instead.
265
- *
266
- * @example
267
- * // Install a single module
268
- * await aaService.installModule({
269
- * account,
270
- * moduleType: 'validator',
271
- * moduleAddress: SESSION_KEY_VALIDATOR_ADDRESS,
272
- * initData: encodedPermissions
273
- * });
274
- */
275
87
  installModule(options: {
276
88
  account: KernelAccountInstance;
277
89
  moduleType: ModuleType;
278
90
  moduleAddress: Hex;
279
91
  initData?: Hex;
280
92
  }): Promise<Hex>;
281
- /**
282
- * Prepare module uninstallation call (for batching)
283
- *
284
- * Returns a Call object that can be included in a batch transaction.
285
- *
286
- * @example
287
- * // Batch uninstall multiple modules
288
- * const calls = [
289
- * aaService.prepareUninstallModule({ account, moduleType: 'validator', moduleAddress: '0x...' }),
290
- * aaService.prepareUninstallModule({ account, moduleType: 'hook', moduleAddress: '0x...' })
291
- * ];
292
- * await aaService.sendBatchTransaction({ account, calls });
293
- */
294
93
  prepareUninstallModule(options: {
295
94
  account: KernelAccountInstance;
296
95
  moduleType: ModuleType;
297
96
  moduleAddress: Hex;
298
97
  deInitData?: Hex;
299
98
  }): Call;
300
- /**
301
- * Uninstall a module from an account (execute immediately)
302
- *
303
- * For batching, use prepareUninstallModule instead.
304
- *
305
- * @example
306
- * await aaService.uninstallModule({
307
- * account,
308
- * moduleType: 'validator',
309
- * moduleAddress: SESSION_KEY_VALIDATOR_ADDRESS
310
- * });
311
- */
312
99
  uninstallModule(options: {
313
100
  account: KernelAccountInstance;
314
101
  moduleType: ModuleType;
315
102
  moduleAddress: Hex;
316
103
  deInitData?: Hex;
317
104
  }): Promise<Hex>;
318
- /**
319
- * Check if a module is installed
320
- *
321
- * @example
322
- * const isInstalled = await aaService.isModuleInstalled({
323
- * account,
324
- * moduleType: 'validator',
325
- * moduleAddress: SESSION_KEY_VALIDATOR_ADDRESS
326
- * });
327
- */
328
105
  isModuleInstalled(options: {
329
106
  account: KernelAccountInstance;
330
107
  moduleType: ModuleType;
331
108
  moduleAddress: Hex;
332
109
  }): Promise<boolean>;
333
- /**
334
- * Prepare session key installation call (for batching)
335
- *
336
- * Returns a Call object that can be batched with other operations.
337
- *
338
- * @example
339
- * // Batch install session key with multi-sig
340
- * const calls = [
341
- * aaService.prepareInstallSessionKey({ account, sessionKeyAddress, permissions }),
342
- * aaService.prepareInstallMultiSigValidator({ account, owners, threshold: 2 })
343
- * ];
344
- * await aaService.sendBatchTransaction({ account, calls });
345
- */
346
110
  prepareInstallSessionKey(options: {
347
111
  account: KernelAccountInstance;
348
112
  sessionKeyAddress: Hex;
349
113
  permissions: SessionKeyPermission[];
350
114
  }): Call;
351
- /**
352
- * Create and install a session key for automated operations (execute immediately)
353
- *
354
- * Perfect for use cases like:
355
- * - Recurring payments
356
- * - Automated savings
357
- * - Subscription management
358
- * - DCA (Dollar Cost Averaging)
359
- *
360
- * For batching with other operations, use prepareInstallSessionKey instead.
361
- *
362
- * @example
363
- * // Create session key for monthly savings
364
- * const sessionKey = privateKeyToAccount('0x...');
365
- *
366
- * await aaService.createSessionKey({
367
- * account,
368
- * sessionKeyAddress: sessionKey.address,
369
- * permissions: [{
370
- * target: USDC_ADDRESS,
371
- * functionSelector: '0xa9059cbb', // transfer(address,uint256)
372
- * maxValuePerUse: parseUnits('100', 6), // Max 100 USDC
373
- * validUntil: Date.now() + 30 * 24 * 60 * 60 * 1000, // 30 days
374
- * maxUses: 1 // Once per month
375
- * }]
376
- * });
377
- */
378
115
  createSessionKey(options: {
379
116
  account: KernelAccountInstance;
380
117
  sessionKeyAddress: Hex;
381
118
  permissions: SessionKeyPermission[];
382
119
  }): Promise<Hex>;
383
- /**
384
- * Prepare session key revocation call (for batching)
385
- *
386
- * Returns a Call object that can be batched with other operations.
387
- *
388
- * @example
389
- * // Batch revoke multiple session keys
390
- * const calls = [
391
- * aaService.prepareRevokeSessionKey({ account, sessionKeyAddress: key1 }),
392
- * aaService.prepareRevokeSessionKey({ account, sessionKeyAddress: key2 })
393
- * ];
394
- * await aaService.sendBatchTransaction({ account, calls });
395
- */
396
120
  prepareRevokeSessionKey(options: {
397
121
  account: KernelAccountInstance;
398
122
  sessionKeyAddress: Hex;
399
123
  }): Call;
400
- /**
401
- * Revoke a session key (execute immediately)
402
- *
403
- * For batching, use prepareRevokeSessionKey instead.
404
- *
405
- * @example
406
- * await aaService.revokeSessionKey({
407
- * account,
408
- * sessionKeyAddress: sessionKey.address
409
- * });
410
- */
411
124
  revokeSessionKey(options: {
412
125
  account: KernelAccountInstance;
413
126
  sessionKeyAddress: Hex;
414
127
  }): Promise<Hex>;
415
- /**
416
- * Prepare multi-sig validator installation call (for batching)
417
- *
418
- * Returns a Call object that can be batched with other operations.
419
- *
420
- * @example
421
- * // Batch install multi-sig with session key
422
- * const calls = [
423
- * aaService.prepareInstallMultiSigValidator({ account, owners, threshold: 2 }),
424
- * aaService.prepareInstallSessionKey({ account, sessionKeyAddress, permissions })
425
- * ];
426
- * await aaService.sendBatchTransaction({ account, calls });
427
- */
428
128
  prepareInstallMultiSigValidator(options: {
429
129
  account: KernelAccountInstance;
430
130
  owners: Hex[];
431
131
  threshold: number;
432
132
  }): Call;
433
- /**
434
- * Install a multi-signature validator (execute immediately)
435
- *
436
- * For batching, use prepareInstallMultiSigValidator instead.
437
- *
438
- * @example
439
- * await aaService.installMultiSigValidator({
440
- * account,
441
- * owners: [owner1, owner2, owner3],
442
- * threshold: 2 // 2 of 3 required
443
- * });
444
- */
445
133
  installMultiSigValidator(options: {
446
134
  account: KernelAccountInstance;
447
135
  owners: Hex[];
448
136
  threshold: number;
449
137
  }): Promise<Hex>;
450
- /**
451
- * Generate a new session key
452
- *
453
- * Creates a new keypair for use as a session key with EIP-7702 accounts.
454
- * The private key should be stored securely and shared with the agent.
455
- * The address should be shared with the owner for approval.
456
- *
457
- * This uses the NEW EIP-7702 pattern, not the legacy module-based pattern.
458
- *
459
- * @returns Session key info including private key, address, and signer
460
- *
461
- * @example
462
- * // Agent generates session key
463
- * const sessionKey = await aaService.generateSessionKey();
464
- * console.log("Share this address with owner:", sessionKey.address);
465
- * console.log("Keep this private key secure:", sessionKey.privateKey);
466
- * // Store sessionKey.privateKey securely for later use
467
- */
468
138
  generateSessionKey(): Promise<SessionKeyInfo>;
469
- /**
470
- * Create session key approval (Owner side)
471
- *
472
- * The owner calls this to create an approval for a session key address.
473
- * This uses the NEW EIP-7702 pattern with addressToEmptyAccount.
474
- *
475
- * @param options - Configuration options
476
- * @returns Serialized approval string to share with the agent
477
- *
478
- * @example
479
- * // Owner approves session key with USDC transfer restrictions
480
- * const approval = await aaService.createSessionKeyApproval({
481
- * sessionKeyAddress: '0x...', // Agent's session key address
482
- * owner: ownerAccount,
483
- * chain: sepolia,
484
- * permissions: [
485
- * aaService.createUSDCTransferPermission(USDC_ADDRESS, '10') // Max 10 USDC
486
- * ]
487
- * });
488
- * // Share approval with agent
489
- *
490
- * @example
491
- * // Owner approves session key with sudo (unrestricted) access
492
- * const approval = await aaService.createSessionKeyApproval({
493
- * sessionKeyAddress: agentSessionKey.address,
494
- * owner: ownerAccount,
495
- * chain: sepolia,
496
- * useSudoPolicy: true
497
- * });
498
- */
499
139
  createSessionKeyApproval(options: {
500
140
  sessionKeyAddress: Hex;
501
141
  sessionKeyPrivateKey: Hex;
@@ -505,85 +145,19 @@ export declare class AccountAbstractionService {
505
145
  useSudoPolicy?: boolean;
506
146
  permissions?: SessionKeyPermissionRule[];
507
147
  }): Promise<string>;
508
- /**
509
- * Deserialize session key account (Agent side)
510
- *
511
- * The agent calls this to reconstruct the session key account from the approval.
512
- * This requires BOTH the approval AND the session key signer.
513
- *
514
- * @param options - Deserialization options
515
- * @returns Deserialized session key account
516
- *
517
- * @example
518
- * // Agent deserializes with private key
519
- * const sessionKey = await aaService.recreateSessionKey(storedPrivateKey);
520
- * const account = await aaService.deserializeSessionKey({
521
- * approval,
522
- * sessionKeySigner: sessionKey.signer,
523
- * chain: sepolia
524
- * });
525
- */
526
148
  deserializeSessionKey(options: {
527
149
  approval: string;
528
150
  sessionKeySigner: ModularSigner;
529
151
  chain: Chain;
530
152
  entryPointVersion?: '0.6' | '0.7';
531
153
  }): Promise<import("@zerodev/sdk").CreateKernelAccountReturnType<"0.6" | "0.7">>;
532
- /**
533
- * Create kernel client for session key
534
- *
535
- * Creates a client for sending transactions with the session key.
536
- *
537
- * @param options - Client options
538
- * @returns Kernel account client
539
- *
540
- * @example
541
- * // Agent creates client for session key
542
- * const sessionKey = await aaService.recreateSessionKey(storedPrivateKey);
543
- * const account = await aaService.deserializeSessionKey({
544
- * approval,
545
- * sessionKeySigner: sessionKey.signer,
546
- * chain: sepolia
547
- * });
548
- * const client = aaService.createSessionKeyClient({
549
- * account,
550
- * chain: sepolia,
551
- * bundlerUrl: 'https://api.pimlico.io/...'
552
- * });
553
- */
554
154
  createSessionKeyClient(options: {
555
155
  account: any;
556
156
  chain: Chain;
557
157
  bundlerUrl: string;
558
158
  paymasterUrl?: string;
559
159
  }): any;
560
- /**
561
- * Create USDC transfer permission rule
562
- *
563
- * Helper to create a permission rule for USDC transfers with a maximum amount.
564
- *
565
- * @param usdcAddress - USDC contract address
566
- * @param maxAmount - Maximum USDC amount (in USDC units, e.g., "10" for 10 USDC)
567
- * @returns Permission rule
568
- *
569
- * @example
570
- * const rule = aaService.createUSDCTransferPermission(
571
- * '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238', // Sepolia USDC
572
- * '10' // Max 10 USDC
573
- * );
574
- */
575
160
  createUSDCTransferPermission(usdcAddress: Hex, maxAmount: string, destinationAddress: Hex): SessionKeyPermissionRule;
576
- /**
577
- * Create ETH transfer permission rule
578
- *
579
- * Helper to create a permission rule for ETH transfers with a maximum value.
580
- *
581
- * @param maxValue - Maximum ETH value (in ether units, e.g., "0.1" for 0.1 ETH)
582
- * @returns Permission rule
583
- *
584
- * @example
585
- * const rule = aaService.createETHTransferPermission('0.1'); // Max 0.1 ETH
586
- */
587
161
  createETHTransferPermission(maxValue: string): SessionKeyPermissionRule;
588
162
  private getAccountCacheKey;
589
163
  private getAuthorizationCacheKey;