@deserialize/multi-vm-wallet 1.4.12 → 1.5.0

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 +340 -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 +263 -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 +33 -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,19 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Kernel Module Management
4
- *
5
- * Handles installation and management of ERC-7579 modules for Kernel v3 accounts:
6
- * - Validators: Session keys, multi-sig, passkeys
7
- * - Executors: Additional execution logic
8
- * - Hooks: Pre/post execution hooks
9
- * - Fallbacks: Handle unknown function calls
10
- *
11
- * ERC-7579 Module Types:
12
- * 1 = Validator
13
- * 2 = Executor
14
- * 3 = Fallback
15
- * 4 = Hook
16
- */
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.MODULE_TYPE_IDS = void 0;
19
4
  exports.prepareInstallModule = prepareInstallModule;
@@ -34,28 +19,11 @@ exports.MODULE_TYPE_IDS = {
34
19
  fallback: 3,
35
20
  hook: 4
36
21
  };
37
- /**
38
- * Prepare installModule call (for batching)
39
- *
40
- * Returns a Call object that can be batched with other operations.
41
- * Use this when you want to install multiple modules in one transaction.
42
- *
43
- * @example
44
- * // Batch install multiple modules
45
- * const calls = [
46
- * prepareInstallModule({ account, moduleType: 'validator', moduleAddress: '0x...' }),
47
- * prepareInstallModule({ account, moduleType: 'hook', moduleAddress: '0x...' })
48
- * ];
49
- * await aaService.sendBatchTransaction({ account, calls });
50
- */
51
22
  function prepareInstallModule(config) {
52
23
  const { account, moduleType, moduleAddress, initData = '0x' } = config;
53
- // Get the module type ID according to ERC-7579
54
24
  const moduleTypeId = exports.MODULE_TYPE_IDS[moduleType];
55
- // Encode the installModule call
56
- // function installModule(uint256 moduleTypeId, address module, bytes calldata initData)
57
25
  const calldata = (0, viem_1.encodePacked)(['bytes4', 'uint256', 'address', 'bytes'], [
58
- '0x8f6e1e8e', // installModule selector
26
+ '0x8f6e1e8e',
59
27
  BigInt(moduleTypeId),
60
28
  moduleAddress,
61
29
  initData
@@ -65,34 +33,16 @@ function prepareInstallModule(config) {
65
33
  data: calldata
66
34
  };
67
35
  }
68
- /**
69
- * Install a module on a Kernel account (execute immediately)
70
- *
71
- * This uses the ERC-7579 standard installModule function.
72
- * For batching multiple modules, use prepareInstallModule instead.
73
- *
74
- * @example
75
- * // Install a single module
76
- * const userOpHash = await installModule({
77
- * account,
78
- * bundlerManager,
79
- * moduleType: 'validator',
80
- * moduleAddress: SESSION_KEY_VALIDATOR_ADDRESS,
81
- * initData: encodedPermissions
82
- * });
83
- */
84
36
  async function installModule(config) {
85
37
  const { account, bundlerManager, moduleType, moduleAddress, initData = '0x' } = config;
86
38
  const bundlerClient = bundlerManager.getClient(account.chain);
87
39
  console.log(`Installing ${moduleType} module at ${moduleAddress}...`);
88
- // Use prepareInstallModule to get the call
89
40
  const call = prepareInstallModule({
90
41
  account,
91
42
  moduleType,
92
43
  moduleAddress,
93
44
  initData
94
45
  });
95
- // Execute immediately
96
46
  const userOpHash = await bundlerClient.sendUserOperation({
97
47
  account: account.account,
98
48
  calls: [call]
@@ -100,26 +50,11 @@ async function installModule(config) {
100
50
  console.log(`✅ Module installation submitted: ${userOpHash}`);
101
51
  return userOpHash;
102
52
  }
103
- /**
104
- * Prepare uninstallModule call (for batching)
105
- *
106
- * Returns a Call object that can be batched with other operations.
107
- *
108
- * @example
109
- * // Batch uninstall multiple modules
110
- * const calls = [
111
- * prepareUninstallModule({ account, moduleType: 'validator', moduleAddress: '0x...' }),
112
- * prepareUninstallModule({ account, moduleType: 'hook', moduleAddress: '0x...' })
113
- * ];
114
- * await aaService.sendBatchTransaction({ account, calls });
115
- */
116
53
  function prepareUninstallModule(config) {
117
54
  const { account, moduleType, moduleAddress, deInitData = '0x' } = config;
118
55
  const moduleTypeId = exports.MODULE_TYPE_IDS[moduleType];
119
- // Encode the uninstallModule call
120
- // function uninstallModule(uint256 moduleTypeId, address module, bytes calldata deInitData)
121
56
  const calldata = (0, viem_1.encodePacked)(['bytes4', 'uint256', 'address', 'bytes'], [
122
- '0xbf8a8dc4', // uninstallModule selector
57
+ '0xbf8a8dc4',
123
58
  BigInt(moduleTypeId),
124
59
  moduleAddress,
125
60
  deInitData
@@ -129,32 +64,16 @@ function prepareUninstallModule(config) {
129
64
  data: calldata
130
65
  };
131
66
  }
132
- /**
133
- * Uninstall a module from a Kernel account (execute immediately)
134
- *
135
- * For batching multiple uninstalls, use prepareUninstallModule instead.
136
- *
137
- * @example
138
- * // Uninstall a single module
139
- * const userOpHash = await uninstallModule({
140
- * account,
141
- * bundlerManager,
142
- * moduleType: 'validator',
143
- * moduleAddress: SESSION_KEY_VALIDATOR_ADDRESS
144
- * });
145
- */
146
67
  async function uninstallModule(config) {
147
68
  const { account, bundlerManager, moduleType, moduleAddress, deInitData = '0x' } = config;
148
69
  const bundlerClient = bundlerManager.getClient(account.chain);
149
70
  console.log(`Uninstalling ${moduleType} module at ${moduleAddress}...`);
150
- // Use prepareUninstallModule to get the call
151
71
  const call = prepareUninstallModule({
152
72
  account,
153
73
  moduleType,
154
74
  moduleAddress,
155
75
  deInitData
156
76
  });
157
- // Execute immediately
158
77
  const userOpHash = await bundlerClient.sendUserOperation({
159
78
  account: account.account,
160
79
  calls: [call]
@@ -162,23 +81,11 @@ async function uninstallModule(config) {
162
81
  console.log(`✅ Module uninstallation submitted: ${userOpHash}`);
163
82
  return userOpHash;
164
83
  }
165
- /**
166
- * Check if a module is installed on an account
167
- *
168
- * @example
169
- * const isInstalled = await isModuleInstalled({
170
- * account,
171
- * bundlerManager,
172
- * moduleType: 'validator',
173
- * moduleAddress: SESSION_KEY_VALIDATOR_ADDRESS
174
- * });
175
- */
176
84
  async function isModuleInstalled(config) {
177
85
  const { account, bundlerManager, moduleType, moduleAddress } = config;
178
86
  const publicClient = bundlerManager.getClient(account.chain);
179
87
  const moduleTypeId = exports.MODULE_TYPE_IDS[moduleType];
180
88
  try {
181
- // Call isModuleInstalled(uint256 moduleTypeId, address module)
182
89
  const result = await publicClient.readContract({
183
90
  address: account.address,
184
91
  abi: (0, viem_1.parseAbi)([
@@ -194,29 +101,10 @@ async function isModuleInstalled(config) {
194
101
  return false;
195
102
  }
196
103
  }
197
- // ============================================
198
- // Session Key Helpers
199
- // ============================================
200
- /**
201
- * Prepare session key installation call (for batching)
202
- *
203
- * Returns a Call object that can be batched with other operations.
204
- *
205
- * @example
206
- * // Batch install session key with other modules
207
- * const calls = [
208
- * prepareInstallSessionKey({ account, sessionKeyAddress, permissions }),
209
- * prepareInstallModule({ account, moduleType: 'hook', moduleAddress: '0x...' })
210
- * ];
211
- * await aaService.sendBatchTransaction({ account, calls });
212
- */
213
104
  function prepareInstallSessionKey(config) {
214
105
  const { account, sessionKeyAddress, permissions } = config;
215
- // Encode session key permissions
216
106
  const initData = encodeSessionKeyPermissions(sessionKeyAddress, permissions);
217
- // Get session key validator address for your chain
218
107
  const SESSION_KEY_VALIDATOR = getSessionKeyValidatorAddress(account.chain.id);
219
- // Return the install module call
220
108
  return prepareInstallModule({
221
109
  account,
222
110
  moduleType: 'validator',
@@ -224,38 +112,10 @@ function prepareInstallSessionKey(config) {
224
112
  initData
225
113
  });
226
114
  }
227
- /**
228
- * Create and install a session key validator (execute immediately)
229
- *
230
- * Session keys allow delegated access with specific permissions.
231
- * Perfect for automated operations like recurring payments.
232
- *
233
- * For batching with other operations, use prepareInstallSessionKey instead.
234
- *
235
- * @example
236
- * // Install session key for monthly savings automation
237
- * const sessionKey = privateKeyToAccount('0x...');
238
- *
239
- * await createSessionKey({
240
- * account,
241
- * bundlerManager,
242
- * sessionKeyAddress: sessionKey.address,
243
- * permissions: [{
244
- * target: USDC_ADDRESS,
245
- * functionSelector: '0xa9059cbb', // transfer(address,uint256)
246
- * maxValuePerUse: parseUnits('100', 6), // Max 100 USDC per tx
247
- * validUntil: Date.now() + 30 * 24 * 60 * 60 * 1000, // 30 days
248
- * maxUses: 1 // Once per month
249
- * }]
250
- * });
251
- */
252
115
  async function createSessionKey(config) {
253
116
  const { account, bundlerManager, sessionKeyAddress, permissions } = config;
254
- // Encode session key permissions
255
117
  const initData = encodeSessionKeyPermissions(sessionKeyAddress, permissions);
256
- // Get session key validator address for your chain
257
118
  const SESSION_KEY_VALIDATOR = getSessionKeyValidatorAddress(account.chain.id);
258
- // Install the session key validator with permissions
259
119
  return installModule({
260
120
  account,
261
121
  bundlerManager,
@@ -264,19 +124,6 @@ async function createSessionKey(config) {
264
124
  initData
265
125
  });
266
126
  }
267
- /**
268
- * Prepare session key revocation call (for batching)
269
- *
270
- * Returns a Call object that can be batched with other operations.
271
- *
272
- * @example
273
- * // Batch revoke multiple session keys
274
- * const calls = [
275
- * prepareRevokeSessionKey({ account, sessionKeyAddress: key1 }),
276
- * prepareRevokeSessionKey({ account, sessionKeyAddress: key2 })
277
- * ];
278
- * await aaService.sendBatchTransaction({ account, calls });
279
- */
280
127
  function prepareRevokeSessionKey(config) {
281
128
  const { account, sessionKeyAddress } = config;
282
129
  const SESSION_KEY_VALIDATOR = getSessionKeyValidatorAddress(account.chain.id);
@@ -288,11 +135,6 @@ function prepareRevokeSessionKey(config) {
288
135
  deInitData
289
136
  });
290
137
  }
291
- /**
292
- * Revoke a session key (execute immediately)
293
- *
294
- * For batching with other operations, use prepareRevokeSessionKey instead.
295
- */
296
138
  async function revokeSessionKey(account, bundlerManager, sessionKeyAddress) {
297
139
  const SESSION_KEY_VALIDATOR = getSessionKeyValidatorAddress(account.chain.id);
298
140
  const deInitData = (0, viem_1.encodePacked)(['address'], [sessionKeyAddress]);
@@ -304,12 +146,7 @@ async function revokeSessionKey(account, bundlerManager, sessionKeyAddress) {
304
146
  deInitData
305
147
  });
306
148
  }
307
- // ============================================
308
- // Helper Functions
309
- // ============================================
310
149
  function encodeSessionKeyPermissions(sessionKeyAddress, permissions) {
311
- // This encoding depends on your session key validator implementation
312
- // Example encoding for a simple permission structure:
313
150
  const encodedPermissions = permissions.map(p => {
314
151
  return (0, viem_1.encodePacked)(['address', 'uint256', 'bytes4', 'uint256', 'uint48', 'uint48', 'uint48'], [
315
152
  p.target,
@@ -321,7 +158,6 @@ function encodeSessionKeyPermissions(sessionKeyAddress, permissions) {
321
158
  BigInt(p.maxUses ?? 0)
322
159
  ]);
323
160
  });
324
- // Combine session key address with permissions
325
161
  return (0, viem_1.encodePacked)(['address', 'uint256', 'bytes[]'], [
326
162
  sessionKeyAddress,
327
163
  BigInt(permissions.length),
@@ -329,12 +165,9 @@ function encodeSessionKeyPermissions(sessionKeyAddress, permissions) {
329
165
  ]);
330
166
  }
331
167
  function getSessionKeyValidatorAddress(chainId) {
332
- // Known session key validator addresses per chain
333
- // These would be pre-deployed or use a universal address
334
168
  const addresses = {
335
- 1: '0x0000000000000000000000000000000000000000', // Mainnet
336
- 11155111: '0x0000000000000000000000000000000000000000', // Sepolia
337
- // Add more chains as needed
169
+ 1: '0x0000000000000000000000000000000000000000',
170
+ 11155111: '0x0000000000000000000000000000000000000000',
338
171
  };
339
172
  const address = addresses[chainId];
340
173
  if (!address) {
@@ -342,22 +175,6 @@ function getSessionKeyValidatorAddress(chainId) {
342
175
  }
343
176
  return address;
344
177
  }
345
- // ============================================
346
- // Multi-Signature Module Helpers
347
- // ============================================
348
- /**
349
- * Prepare multi-sig validator installation call (for batching)
350
- *
351
- * Returns a Call object that can be batched with other operations.
352
- *
353
- * @example
354
- * // Batch install multi-sig with session key
355
- * const calls = [
356
- * prepareInstallMultiSigValidator({ account, owners, threshold: 2 }),
357
- * prepareInstallSessionKey({ account, sessionKeyAddress, permissions })
358
- * ];
359
- * await aaService.sendBatchTransaction({ account, calls });
360
- */
361
178
  function prepareInstallMultiSigValidator(config) {
362
179
  const { account, owners, threshold } = config;
363
180
  const initData = (0, viem_1.encodePacked)(['address[]', 'uint256'], [owners, BigInt(threshold)]);
@@ -369,19 +186,6 @@ function prepareInstallMultiSigValidator(config) {
369
186
  initData
370
187
  });
371
188
  }
372
- /**
373
- * Install a multi-signature validator (execute immediately)
374
- *
375
- * For batching with other operations, use prepareInstallMultiSigValidator instead.
376
- *
377
- * @example
378
- * await installMultiSigValidator({
379
- * account,
380
- * bundlerManager,
381
- * owners: [owner1, owner2, owner3],
382
- * threshold: 2 // 2 of 3 signatures required
383
- * });
384
- */
385
189
  async function installMultiSigValidator(config) {
386
190
  const { account, bundlerManager, owners, threshold } = config;
387
191
  const initData = (0, viem_1.encodePacked)(['address[]', 'uint256'], [owners, BigInt(threshold)]);
@@ -395,7 +199,6 @@ async function installMultiSigValidator(config) {
395
199
  });
396
200
  }
397
201
  function getMultiSigValidatorAddress(chainId) {
398
- // Known multi-sig validator addresses per chain
399
202
  const addresses = {
400
203
  1: '0x0000000000000000000000000000000000000000',
401
204
  11155111: '0x0000000000000000000000000000000000000000',
@@ -406,4 +209,3 @@ function getMultiSigValidatorAddress(chainId) {
406
209
  }
407
210
  return address;
408
211
  }
409
- //# sourceMappingURL=kernel-modules.js.map
@@ -1,15 +1,3 @@
1
- /**
2
- * EIP-7702 Session Keys Utilities
3
- *
4
- * Utilities for creating and managing session keys with ZeroDev's permission system.
5
- * This uses the NEW EIP-7702 pattern, not the legacy smart account pattern.
6
- *
7
- * Key differences from legacy pattern:
8
- * - Uses `eip7702Account` instead of `address`
9
- * - Uses `addressToEmptyAccount` for permission validator creation
10
- * - Passes `sessionKeySigner` to `deserializePermissionAccount`
11
- * - No sudo validator needed, only permission plugin
12
- */
13
1
  import { Hex, Address } from 'viem';
14
2
  import { Chain } from 'viem/chains';
15
3
  import { PrivateKeyAccount } from 'viem/accounts';
@@ -39,94 +27,14 @@ export interface DeserializedSessionKey {
39
27
  account: any;
40
28
  client: any;
41
29
  }
42
- /**
43
- * Generate a new session key
44
- *
45
- * Creates a new keypair for use as a session key or use the one that was passed if available.
46
- * The private key should be stored securely and shared with the agent.
47
- * The address should be shared with the owner for approval.
48
- *
49
- * @returns Session key info including private key, address, and signer
50
- *
51
- * @example
52
- * const sessionKey = await generateSessionKey(); or
53
- * const privateKey = '0x...'; // Existing private key
54
- * const sessionKey = await generateSessionKey(privateKey);
55
- *
56
- * console.log("Share this address with owner:", sessionKey.address);
57
- * console.log("Keep this private key secure:", sessionKey.privateKey);
58
- */
59
30
  export declare function generateSessionKey(privateKey?: Hex): Promise<SessionKeyInfo>;
60
- /**
61
- * Create session key approval (Owner side)
62
- *
63
- * The owner calls this to create an approval for a session key address.
64
- * This uses the NEW EIP-7702 pattern with addressToEmptyAccount.
65
- *
66
- * @param options - Configuration options
67
- * @returns Serialized approval string to share with the agent
68
- *
69
- * @example
70
- * // Owner approves session key
71
- * const approval = await createSessionKeyApproval({
72
- * sessionKeyAddress: '0x...', // Agent's session key address
73
- * owner: ownerAccount,
74
- * chain: sepolia,
75
- * permissions: [{
76
- * target: USDC_ADDRESS,
77
- * abi: parseAbi(['function transfer(address to, uint256 amount)']),
78
- * functionName: 'transfer',
79
- * args: [null, { condition: 3, value: parseUnits('10', 6) }]
80
- * }]
81
- * });
82
- * // Share approval with agent
83
- */
84
31
  export declare function createSessionKeyApproval(options: CreateSessionKeyApprovalOptions): Promise<string>;
85
- /**
86
- * Deserialize session key account (Agent side)
87
- *
88
- * The agent calls this to reconstruct the session key account from the approval.
89
- * This requires BOTH the approval AND the session key signer.
90
- *
91
- * @param approval - Approval string from owner
92
- * @param sessionKeySigner - Session key signer (created from private key)
93
- * @param chain - Chain to use
94
- * @param entryPointVersion - EntryPoint version
95
- * @returns Deserialized session key account
96
- *
97
- * @example
98
- * // Agent deserializes with private key
99
- * const sessionKey = await recreateSessionKey(storedPrivateKey);
100
- * const account = await deserializeSessionKey({
101
- * approval,
102
- * sessionKeySigner: sessionKey.signer,
103
- * chain: sepolia
104
- * });
105
- */
106
32
  export declare function deserializeSessionKey(options: {
107
33
  approval: string;
108
34
  sessionKeySigner: ModularSigner;
109
35
  chain: Chain;
110
36
  entryPointVersion?: '0.6' | '0.7';
111
37
  }): Promise<CreateKernelAccountReturnType<"0.6" | "0.7">>;
112
- /**
113
- * Create kernel client for session key
114
- *
115
- * Creates a client for sending transactions with the session key.
116
- *
117
- * @param account - Deserialized session key account
118
- * @param chain - Chain to use
119
- * @param bundlerUrl - Bundler RPC URL
120
- * @param paymasterUrl - Optional paymaster URL for gas sponsorship
121
- * @returns Kernel account client
122
- *
123
- * @example
124
- * const client = createSessionKeyClient({
125
- * account: sessionKeyAccount,
126
- * chain: sepolia,
127
- * bundlerUrl: 'https://api.pimlico.io/...'
128
- * });
129
- */
130
38
  export declare function createSessionKeyClient(options: {
131
39
  account: any;
132
40
  chain: Chain;
@@ -137,31 +45,5 @@ export declare function createSessionKeyClient(options: {
137
45
  version: '0.6' | '0.7';
138
46
  };
139
47
  }): any;
140
- /**
141
- * Create USDC transfer permission rule
142
- *
143
- * Helper to create a permission rule for USDC transfers with a maximum amount.
144
- *
145
- * @param usdcAddress - USDC contract address
146
- * @param maxAmount - Maximum USDC amount (in USDC units, e.g., "10" for 10 USDC)
147
- * @returns Permission rule
148
- *
149
- * @example
150
- * const rule = createUSDCTransferPermission(
151
- * '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',
152
- * '10' // Max 10 USDC
153
- * );
154
- */
155
48
  export declare function createUSDCTransferPermission(usdcAddress: Hex, maxAmount: string, destinationAddress: Hex): SessionKeyPermissionRule;
156
- /**
157
- * Create ETH transfer permission rule
158
- *
159
- * Helper to create a permission rule for ETH transfers with a maximum value.
160
- *
161
- * @param maxValue - Maximum ETH value (in ether units, e.g., "0.1" for 0.1 ETH)
162
- * @returns Permission rule
163
- *
164
- * @example
165
- * const rule = createETHTransferPermission('0.1'); // Max 0.1 ETH
166
- */
167
49
  export declare function createETHTransferPermission(maxValue: string): SessionKeyPermissionRule;