@arcenpay/react 0.0.1 → 0.0.2

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/zerodev.js CHANGED
@@ -3,6 +3,9 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __esm = (fn, res) => function __init() {
7
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
+ };
6
9
  var __export = (target, all) => {
7
10
  for (var name in all)
8
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -17,6 +20,50 @@ var __copyProps = (to, from, except, desc) => {
17
20
  };
18
21
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
22
 
23
+ // src/internal/sdk-core/chains.ts
24
+ var import_viem, sepolia, baseSepolia, baseMainnet;
25
+ var init_chains = __esm({
26
+ "src/internal/sdk-core/chains.ts"() {
27
+ "use strict";
28
+ import_viem = require("viem");
29
+ sepolia = (0, import_viem.defineChain)({
30
+ id: 11155111,
31
+ name: "Sepolia",
32
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
33
+ rpcUrls: {
34
+ default: { http: ["https://ethereum-sepolia-rpc.publicnode.com"] }
35
+ },
36
+ blockExplorers: {
37
+ default: { name: "Etherscan", url: "https://sepolia.etherscan.io" }
38
+ },
39
+ testnet: true
40
+ });
41
+ baseSepolia = (0, import_viem.defineChain)({
42
+ id: 84532,
43
+ name: "Base Sepolia",
44
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
45
+ rpcUrls: {
46
+ default: { http: ["https://sepolia.base.org"] }
47
+ },
48
+ blockExplorers: {
49
+ default: { name: "BaseScan", url: "https://sepolia.basescan.org" }
50
+ },
51
+ testnet: true
52
+ });
53
+ baseMainnet = (0, import_viem.defineChain)({
54
+ id: 8453,
55
+ name: "Base",
56
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
57
+ rpcUrls: {
58
+ default: { http: ["https://mainnet.base.org"] }
59
+ },
60
+ blockExplorers: {
61
+ default: { name: "BaseScan", url: "https://basescan.org" }
62
+ }
63
+ });
64
+ }
65
+ });
66
+
20
67
  // src/zerodev.ts
21
68
  var zerodev_exports = {};
22
69
  __export(zerodev_exports, {
@@ -32,13 +79,532 @@ module.exports = __toCommonJS(zerodev_exports);
32
79
  // src/lib/zerodev.ts
33
80
  var import_sdk = require("@zerodev/sdk");
34
81
  var import_ecdsa_validator = require("@zerodev/ecdsa-validator");
35
- var import_viem = require("viem");
36
- var import_chains = require("viem/chains");
37
- var import_sdk2 = require("@arcenpay/sdk");
82
+ var import_viem3 = require("viem");
83
+ var import_chains5 = require("viem/chains");
84
+
85
+ // src/internal/sdk-core/index.ts
86
+ init_chains();
87
+
88
+ // src/internal/sdk-core/addresses.ts
89
+ var ADDRESSES = {
90
+ // Ethereum Sepolia (Testnet) — Deployed 2026-03-19
91
+ 11155111: {
92
+ subscriptionRegistry: "0xE206C519076535A9d24c852093860CFD780908C1",
93
+ autopayModule: "0xc82417e378b23AD9Ae73229EF08a4BA7896a4351",
94
+ planFactory: "0x4F97E0c2Ac053b735640fEb164a08Cb45ba83db1",
95
+ feeCollector: "0xa8A0D3007e5680D387A50C1a1E2Eb0AD092ca396",
96
+ sessionVault: "0xd68b9C0a34d61CC3b3F982A5EC6Cc5a5739e46D9",
97
+ zkUsageVerifier: "0x1f75d66692416cE880d51Baf6CdcBeE98E5837c0",
98
+ mirrorRegistry: "0xC187CD32d569ec0E84B9b378f8E63f3a74afac74"
99
+ },
100
+ // Base Sepolia (Testnet) — Deployed 2026-04-23
101
+ 84532: {
102
+ subscriptionRegistry: "0xF9610c064FFD64255A1d509d17b2Af8733084e50",
103
+ autopayModule: "0x69Ac04bFdC045A99A2D31bb141A74da354a94c19",
104
+ planFactory: "0x66775Af13C63781AAd28203CC5d3E9eE5d5eB83d",
105
+ feeCollector: "0x5F32fBfF19385A78c3F721007758E9924FAD4133",
106
+ sessionVault: "0x96BcE2d49e3e4EddBBF3aa07354E66615BC2623c",
107
+ zkUsageVerifier: "0x03290b6988F87925A4939d974895bC30981aA90D",
108
+ mirrorRegistry: "0xe7E0dFfa82596ee6Ba1755bc25c29376a07236dE"
109
+ },
110
+ // Base Mainnet — set ARCENPAY_CONTRACT_8453_* env vars after audit + deployment
111
+ 8453: {
112
+ subscriptionRegistry: "0x0000000000000000000000000000000000000000",
113
+ autopayModule: "0x0000000000000000000000000000000000000000",
114
+ planFactory: "0x0000000000000000000000000000000000000000",
115
+ feeCollector: "0x0000000000000000000000000000000000000000",
116
+ sessionVault: "0x0000000000000000000000000000000000000000",
117
+ zkUsageVerifier: "0x0000000000000000000000000000000000000000",
118
+ mirrorRegistry: "0x0000000000000000000000000000000000000000"
119
+ }
120
+ };
121
+ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
122
+ var CONTRACT_KEYS = [
123
+ "subscriptionRegistry",
124
+ "autopayModule",
125
+ "planFactory",
126
+ "feeCollector",
127
+ "sessionVault",
128
+ "zkUsageVerifier"
129
+ ];
130
+ function applyEnvOverrides(chainId, base2) {
131
+ if (typeof process === "undefined") return base2;
132
+ const result = { ...base2 };
133
+ for (const key of CONTRACT_KEYS) {
134
+ const envKey = `ARCENPAY_CONTRACT_${chainId}_${key}`;
135
+ const legacyKey = `MEAP_CONTRACT_${chainId}_${key}`;
136
+ const override = process.env[envKey] ?? process.env[legacyKey];
137
+ if (override && override.startsWith("0x")) {
138
+ result[key] = override;
139
+ }
140
+ }
141
+ const mirrorOverride = process.env[`ARCENPAY_CONTRACT_${chainId}_mirrorRegistry`] ?? process.env[`MEAP_CONTRACT_${chainId}_mirrorRegistry`];
142
+ if (mirrorOverride && mirrorOverride.startsWith("0x")) {
143
+ result.mirrorRegistry = mirrorOverride;
144
+ }
145
+ const yieldOverride = process.env[`ARCENPAY_CONTRACT_${chainId}_yieldSessionVault`] ?? process.env[`MEAP_CONTRACT_${chainId}_yieldSessionVault`];
146
+ if (yieldOverride && yieldOverride.startsWith("0x")) {
147
+ result.yieldSessionVault = yieldOverride;
148
+ }
149
+ return result;
150
+ }
151
+ function getContractAddresses(chainId) {
152
+ const base2 = ADDRESSES[chainId];
153
+ if (!base2) {
154
+ throw new Error(`No contract addresses configured for chain ${chainId}`);
155
+ }
156
+ const addresses = applyEnvOverrides(chainId, base2);
157
+ if (typeof process !== "undefined" && process.env.NODE_ENV === "production") {
158
+ const allZero = CONTRACT_KEYS.every(
159
+ (k) => addresses[k] === ZERO_ADDRESS
160
+ );
161
+ if (allZero) {
162
+ throw new Error(
163
+ `[getContractAddresses] Chain ${chainId} has no deployed contracts. Set ARCENPAY_CONTRACT_${chainId}_<key> env vars or deploy contracts before using this chain in production.`
164
+ );
165
+ }
166
+ }
167
+ return addresses;
168
+ }
169
+
170
+ // src/internal/sdk-core/environment.ts
171
+ init_chains();
172
+
173
+ // src/internal/sdk-core/runtime-profile.ts
174
+ init_chains();
175
+
176
+ // src/internal/sdk-core/abis.ts
177
+ var SubscriptionRegistryABI = [
178
+ // Core functions
179
+ {
180
+ type: "function",
181
+ name: "mint",
182
+ inputs: [
183
+ { name: "to", type: "address" },
184
+ { name: "planId", type: "uint256" },
185
+ { name: "duration", type: "uint64" }
186
+ ],
187
+ outputs: [{ name: "tokenId", type: "uint256" }],
188
+ stateMutability: "nonpayable"
189
+ },
190
+ {
191
+ type: "function",
192
+ name: "renew",
193
+ inputs: [
194
+ { name: "tokenId", type: "uint256" },
195
+ { name: "extension", type: "uint64" }
196
+ ],
197
+ outputs: [],
198
+ stateMutability: "nonpayable"
199
+ },
200
+ {
201
+ type: "function",
202
+ name: "cancel",
203
+ inputs: [{ name: "tokenId", type: "uint256" }],
204
+ outputs: [],
205
+ stateMutability: "nonpayable"
206
+ },
207
+ {
208
+ type: "function",
209
+ name: "changePlan",
210
+ inputs: [
211
+ { name: "tokenId", type: "uint256" },
212
+ { name: "newPlanId", type: "uint256" }
213
+ ],
214
+ outputs: [],
215
+ stateMutability: "nonpayable"
216
+ },
217
+ {
218
+ type: "function",
219
+ name: "isValid",
220
+ inputs: [{ name: "tokenId", type: "uint256" }],
221
+ outputs: [{ name: "", type: "bool" }],
222
+ stateMutability: "view"
223
+ },
224
+ {
225
+ type: "function",
226
+ name: "expiresAt",
227
+ inputs: [{ name: "tokenId", type: "uint256" }],
228
+ outputs: [{ name: "", type: "uint64" }],
229
+ stateMutability: "view"
230
+ },
231
+ {
232
+ type: "function",
233
+ name: "getPlanFeatures",
234
+ inputs: [{ name: "tokenId", type: "uint256" }],
235
+ outputs: [
236
+ { name: "planId", type: "uint256" },
237
+ { name: "planTier", type: "string" }
238
+ ],
239
+ stateMutability: "view"
240
+ },
241
+ {
242
+ type: "function",
243
+ name: "getWalletSubscription",
244
+ inputs: [{ name: "wallet", type: "address" }],
245
+ outputs: [{ name: "", type: "uint256" }],
246
+ stateMutability: "view"
247
+ },
248
+ {
249
+ type: "function",
250
+ name: "importSubscription",
251
+ inputs: [
252
+ { name: "to", type: "address" },
253
+ { name: "tokenId", type: "uint256" },
254
+ { name: "planId", type: "uint256" },
255
+ { name: "expiration", type: "uint64" }
256
+ ],
257
+ outputs: [],
258
+ stateMutability: "nonpayable"
259
+ },
260
+ {
261
+ type: "function",
262
+ name: "finalizeMigration",
263
+ inputs: [],
264
+ outputs: [],
265
+ stateMutability: "nonpayable"
266
+ },
267
+ {
268
+ type: "function",
269
+ name: "hasActiveSubscription",
270
+ inputs: [{ name: "wallet", type: "address" }],
271
+ outputs: [{ name: "", type: "bool" }],
272
+ stateMutability: "view"
273
+ },
274
+ {
275
+ type: "function",
276
+ name: "authorizedBillers",
277
+ inputs: [{ name: "biller", type: "address" }],
278
+ outputs: [{ name: "isAuthorized", type: "bool" }],
279
+ stateMutability: "view"
280
+ },
281
+ {
282
+ type: "function",
283
+ name: "setCrossChainTransports",
284
+ inputs: [
285
+ { name: "axelarTransport", type: "address" },
286
+ { name: "ccipTransport", type: "address" }
287
+ ],
288
+ outputs: [],
289
+ stateMutability: "nonpayable"
290
+ },
291
+ {
292
+ type: "function",
293
+ name: "dispatchCrossChainUpdate",
294
+ inputs: [
295
+ { name: "tokenId", type: "uint256" },
296
+ { name: "destinationChainId", type: "uint256" },
297
+ { name: "refundAddress", type: "address" }
298
+ ],
299
+ outputs: [
300
+ { name: "messageId", type: "bytes32" },
301
+ { name: "routeUsed", type: "uint8" }
302
+ ],
303
+ stateMutability: "payable"
304
+ },
305
+ // Events
306
+ {
307
+ type: "event",
308
+ name: "SubscriptionMinted",
309
+ inputs: [
310
+ { name: "subscriber", type: "address", indexed: true },
311
+ { name: "tokenId", type: "uint256", indexed: true },
312
+ { name: "planId", type: "uint256", indexed: true },
313
+ { name: "expiration", type: "uint64", indexed: false }
314
+ ]
315
+ },
316
+ {
317
+ type: "event",
318
+ name: "SubscriptionRenewed",
319
+ inputs: [
320
+ { name: "tokenId", type: "uint256", indexed: true },
321
+ { name: "newExpiration", type: "uint64", indexed: false },
322
+ { name: "amountPaid", type: "uint256", indexed: false }
323
+ ]
324
+ },
325
+ {
326
+ type: "event",
327
+ name: "SubscriptionCancelled",
328
+ inputs: [{ name: "tokenId", type: "uint256", indexed: true }]
329
+ },
330
+ {
331
+ type: "event",
332
+ name: "SubscriptionPlanChanged",
333
+ inputs: [
334
+ { name: "tokenId", type: "uint256", indexed: true },
335
+ { name: "previousPlanId", type: "uint256", indexed: true },
336
+ { name: "newPlanId", type: "uint256", indexed: true },
337
+ { name: "expiration", type: "uint64", indexed: false }
338
+ ]
339
+ },
340
+ {
341
+ type: "event",
342
+ name: "BillingSuccess",
343
+ inputs: [
344
+ { name: "tokenId", type: "uint256", indexed: true },
345
+ { name: "planId", type: "uint256", indexed: true },
346
+ { name: "amount", type: "uint256", indexed: false },
347
+ { name: "timestamp", type: "uint256", indexed: false }
348
+ ]
349
+ },
350
+ {
351
+ type: "event",
352
+ name: "CrossChainDispatchRequested",
353
+ inputs: [
354
+ { name: "tokenId", type: "uint256", indexed: true },
355
+ { name: "destinationChainId", type: "uint256", indexed: true },
356
+ { name: "route", type: "uint8", indexed: true },
357
+ { name: "messageId", type: "bytes32", indexed: false }
358
+ ]
359
+ },
360
+ {
361
+ type: "event",
362
+ name: "CrossChainFallbackTriggered",
363
+ inputs: [
364
+ { name: "tokenId", type: "uint256", indexed: true },
365
+ { name: "destinationChainId", type: "uint256", indexed: true },
366
+ { name: "primaryError", type: "bytes", indexed: false }
367
+ ]
368
+ },
369
+ {
370
+ type: "event",
371
+ name: "SubscriptionImported",
372
+ inputs: [
373
+ { name: "subscriber", type: "address", indexed: true },
374
+ { name: "tokenId", type: "uint256", indexed: true },
375
+ { name: "planId", type: "uint256", indexed: true },
376
+ { name: "expiration", type: "uint64", indexed: false }
377
+ ]
378
+ },
379
+ {
380
+ type: "event",
381
+ name: "RegistryMigrationFinalized",
382
+ inputs: []
383
+ },
384
+ {
385
+ type: "event",
386
+ name: "Transfer",
387
+ inputs: [
388
+ { name: "from", type: "address", indexed: true },
389
+ { name: "to", type: "address", indexed: true },
390
+ { name: "tokenId", type: "uint256", indexed: true }
391
+ ]
392
+ }
393
+ ];
394
+ var ERC7579AutopayModuleABI = [
395
+ {
396
+ type: "function",
397
+ name: "onInstall",
398
+ inputs: [{ name: "data", type: "bytes" }],
399
+ outputs: [],
400
+ stateMutability: "nonpayable"
401
+ },
402
+ {
403
+ type: "function",
404
+ name: "onUninstall",
405
+ inputs: [{ name: "data", type: "bytes" }],
406
+ outputs: [],
407
+ stateMutability: "nonpayable"
408
+ },
409
+ {
410
+ type: "function",
411
+ name: "execute",
412
+ inputs: [
413
+ { name: "account", type: "address" },
414
+ { name: "amount", type: "uint256" }
415
+ ],
416
+ outputs: [],
417
+ stateMutability: "nonpayable"
418
+ },
419
+ {
420
+ type: "function",
421
+ name: "isInitialized",
422
+ inputs: [{ name: "smartAccount", type: "address" }],
423
+ outputs: [{ name: "", type: "bool" }],
424
+ stateMutability: "view"
425
+ },
426
+ {
427
+ type: "function",
428
+ name: "getConfig",
429
+ inputs: [{ name: "account", type: "address" }],
430
+ outputs: [
431
+ {
432
+ name: "config",
433
+ type: "tuple",
434
+ components: [
435
+ { name: "merchant", type: "address" },
436
+ { name: "maxAmount", type: "uint256" },
437
+ { name: "token", type: "address" },
438
+ { name: "interval", type: "uint32" },
439
+ { name: "startTime", type: "uint64" },
440
+ { name: "planId", type: "uint256" },
441
+ { name: "maxTotalAmount", type: "uint256" }
442
+ ]
443
+ }
444
+ ],
445
+ stateMutability: "view"
446
+ },
447
+ {
448
+ type: "function",
449
+ name: "updateConfig",
450
+ inputs: [
451
+ {
452
+ name: "config",
453
+ type: "tuple",
454
+ components: [
455
+ { name: "merchant", type: "address" },
456
+ { name: "maxAmount", type: "uint256" },
457
+ { name: "token", type: "address" },
458
+ { name: "interval", type: "uint32" },
459
+ { name: "startTime", type: "uint64" },
460
+ { name: "planId", type: "uint256" },
461
+ { name: "maxTotalAmount", type: "uint256" }
462
+ ]
463
+ }
464
+ ],
465
+ outputs: [],
466
+ stateMutability: "nonpayable"
467
+ },
468
+ {
469
+ type: "function",
470
+ name: "canExecute",
471
+ inputs: [{ name: "account", type: "address" }],
472
+ outputs: [{ name: "", type: "bool" }],
473
+ stateMutability: "view"
474
+ },
475
+ {
476
+ type: "function",
477
+ name: "lastPullTime",
478
+ inputs: [{ name: "account", type: "address" }],
479
+ outputs: [{ name: "", type: "uint64" }],
480
+ stateMutability: "view"
481
+ },
482
+ {
483
+ type: "function",
484
+ name: "mirrorDestinationChainId",
485
+ inputs: [{ name: "account", type: "address" }],
486
+ outputs: [{ name: "", type: "uint256" }],
487
+ stateMutability: "view"
488
+ },
489
+ {
490
+ type: "function",
491
+ name: "isAccountPaused",
492
+ inputs: [{ name: "account", type: "address" }],
493
+ outputs: [{ name: "", type: "bool" }],
494
+ stateMutability: "view"
495
+ },
496
+ {
497
+ type: "function",
498
+ name: "importAccountState",
499
+ inputs: [
500
+ { name: "account", type: "address" },
501
+ {
502
+ name: "config",
503
+ type: "tuple",
504
+ components: [
505
+ { name: "merchant", type: "address" },
506
+ { name: "maxAmount", type: "uint256" },
507
+ { name: "token", type: "address" },
508
+ { name: "interval", type: "uint32" },
509
+ { name: "startTime", type: "uint64" },
510
+ { name: "planId", type: "uint256" },
511
+ { name: "maxTotalAmount", type: "uint256" }
512
+ ]
513
+ },
514
+ { name: "lastPullTime_", type: "uint64" },
515
+ { name: "totalPulled_", type: "uint256" },
516
+ { name: "mirrorDestinationChainId_", type: "uint256" },
517
+ { name: "accountPaused_", type: "bool" }
518
+ ],
519
+ outputs: [],
520
+ stateMutability: "nonpayable"
521
+ },
522
+ {
523
+ type: "function",
524
+ name: "finalizeMigration",
525
+ inputs: [],
526
+ outputs: [],
527
+ stateMutability: "nonpayable"
528
+ },
529
+ {
530
+ type: "event",
531
+ name: "AutopayConfigured",
532
+ inputs: [
533
+ { name: "account", type: "address", indexed: true },
534
+ { name: "merchant", type: "address", indexed: true },
535
+ { name: "maxAmount", type: "uint256", indexed: false },
536
+ { name: "token", type: "address", indexed: false },
537
+ { name: "interval", type: "uint32", indexed: false }
538
+ ]
539
+ },
540
+ {
541
+ type: "event",
542
+ name: "AutopayConfigUpdated",
543
+ inputs: [
544
+ { name: "account", type: "address", indexed: true },
545
+ { name: "previousPlanId", type: "uint256", indexed: true },
546
+ { name: "newPlanId", type: "uint256", indexed: true },
547
+ { name: "maxAmount", type: "uint256", indexed: false },
548
+ { name: "interval", type: "uint32", indexed: false }
549
+ ]
550
+ },
551
+ {
552
+ type: "event",
553
+ name: "PaymentExecuted",
554
+ inputs: [
555
+ { name: "account", type: "address", indexed: true },
556
+ { name: "merchant", type: "address", indexed: true },
557
+ { name: "amount", type: "uint256", indexed: false },
558
+ { name: "timestamp", type: "uint256", indexed: false }
559
+ ]
560
+ },
561
+ {
562
+ type: "event",
563
+ name: "BillingExecuted",
564
+ inputs: [
565
+ { name: "account", type: "address", indexed: true },
566
+ { name: "merchant", type: "address", indexed: true },
567
+ { name: "tokenId", type: "uint256", indexed: true },
568
+ { name: "planId", type: "uint256", indexed: false },
569
+ { name: "reason", type: "uint8", indexed: false },
570
+ { name: "grossAmount", type: "uint256", indexed: false },
571
+ { name: "merchantAmount", type: "uint256", indexed: false },
572
+ { name: "protocolFee", type: "uint256", indexed: false },
573
+ { name: "timestamp", type: "uint256", indexed: false }
574
+ ]
575
+ },
576
+ {
577
+ type: "event",
578
+ name: "AutopayRevoked",
579
+ inputs: [{ name: "account", type: "address", indexed: true }]
580
+ },
581
+ {
582
+ type: "event",
583
+ name: "AccountStateImported",
584
+ inputs: [
585
+ { name: "account", type: "address", indexed: true },
586
+ { name: "planId", type: "uint256", indexed: true },
587
+ { name: "lastPullTime", type: "uint64", indexed: false }
588
+ ]
589
+ },
590
+ {
591
+ type: "event",
592
+ name: "MigrationFinalized",
593
+ inputs: []
594
+ }
595
+ ];
596
+
597
+ // src/internal/sdk-core/accounts.ts
598
+ var import_viem2 = require("viem");
599
+
600
+ // src/internal/sdk-core/index.ts
601
+ init_chains();
602
+
603
+ // src/lib/zerodev.ts
38
604
  var CHAIN_MAP = {
39
- 11155111: import_chains.sepolia,
40
- 84532: import_chains.baseSepolia,
41
- 8453: import_chains.base
605
+ 11155111: import_chains5.sepolia,
606
+ 84532: import_chains5.baseSepolia,
607
+ 8453: import_chains5.base
42
608
  };
43
609
  var ENTRY_POINT = import_sdk.constants.getEntryPoint("0.7");
44
610
  var ENTRY_POINT_ADDRESS = ENTRY_POINT.address;
@@ -82,16 +648,16 @@ function isRecoverableSmartAccountFundingError(error) {
82
648
  return lower.includes("smart account does not have sufficient funds") || lower.includes("sufficient funds to execute the user operation") || lower.includes("insufficient funds") || lower.includes("user operation") && lower.includes("paymaster");
83
649
  }
84
650
  async function createKernelExecutionContext(config) {
85
- const chain = CHAIN_MAP[config.chainId] || import_chains.baseSepolia;
651
+ const chain = CHAIN_MAP[config.chainId] || import_chains5.baseSepolia;
86
652
  const { bundlerUrl, paymasterUrl, hasConfiguredUrls } = resolveZeroDevUrls({
87
653
  projectId: config.projectId,
88
654
  chainId: config.chainId,
89
655
  bundlerUrl: config.bundlerUrl,
90
656
  paymasterUrl: config.paymasterUrl
91
657
  });
92
- const publicClient = (0, import_viem.createPublicClient)({
658
+ const publicClient = (0, import_viem3.createPublicClient)({
93
659
  chain,
94
- transport: (0, import_viem.http)()
660
+ transport: (0, import_viem3.http)()
95
661
  });
96
662
  const ecdsaValidator = await (0, import_ecdsa_validator.signerToEcdsaValidator)(publicClient, {
97
663
  signer: config.walletClient,
@@ -105,14 +671,16 @@ async function createKernelExecutionContext(config) {
105
671
  });
106
672
  const paymasterClient = (0, import_sdk.createZeroDevPaymasterClient)({
107
673
  chain,
108
- transport: (0, import_viem.http)(paymasterUrl)
674
+ transport: (0, import_viem3.http)(paymasterUrl)
109
675
  });
110
676
  const kernelClient = (0, import_sdk.createKernelAccountClient)({
111
677
  account: kernelAccount,
112
678
  chain,
113
- bundlerTransport: (0, import_viem.http)(bundlerUrl),
679
+ bundlerTransport: (0, import_viem3.http)(bundlerUrl),
114
680
  middleware: {
115
- sponsorUserOperation: async ({ userOperation }) => {
681
+ sponsorUserOperation: async ({
682
+ userOperation
683
+ }) => {
116
684
  return paymasterClient.sponsorUserOperation({
117
685
  userOperation,
118
686
  entryPoint: ENTRY_POINT_ADDRESS
@@ -130,17 +698,17 @@ async function createKernelExecutionContext(config) {
130
698
  };
131
699
  }
132
700
  async function deploySmartAccount(config) {
133
- const chain = CHAIN_MAP[config.chainId] || import_chains.baseSepolia;
134
- const contracts = (0, import_sdk2.getContractAddresses)(config.chainId);
701
+ const chain = CHAIN_MAP[config.chainId] || import_chains5.baseSepolia;
702
+ const contracts = getContractAddresses(config.chainId);
135
703
  const { bundlerUrl, paymasterUrl, hasConfiguredUrls } = resolveZeroDevUrls({
136
704
  projectId: config.projectId,
137
705
  chainId: config.chainId,
138
706
  bundlerUrl: config.bundlerUrl,
139
707
  paymasterUrl: config.paymasterUrl
140
708
  });
141
- const publicClient = (0, import_viem.createPublicClient)({
709
+ const publicClient = (0, import_viem3.createPublicClient)({
142
710
  chain,
143
- transport: (0, import_viem.http)()
711
+ transport: (0, import_viem3.http)()
144
712
  });
145
713
  const ecdsaValidator = await (0, import_ecdsa_validator.signerToEcdsaValidator)(publicClient, {
146
714
  signer: config.walletClient,
@@ -159,14 +727,16 @@ async function deploySmartAccount(config) {
159
727
  const alreadyDeployed = !!code && code !== "0x";
160
728
  const paymasterClient = (0, import_sdk.createZeroDevPaymasterClient)({
161
729
  chain,
162
- transport: (0, import_viem.http)(paymasterUrl)
730
+ transport: (0, import_viem3.http)(paymasterUrl)
163
731
  });
164
732
  const kernelClient = (0, import_sdk.createKernelAccountClient)({
165
733
  account: kernelAccount,
166
734
  chain,
167
- bundlerTransport: (0, import_viem.http)(bundlerUrl),
735
+ bundlerTransport: (0, import_viem3.http)(bundlerUrl),
168
736
  middleware: {
169
- sponsorUserOperation: async ({ userOperation }) => {
737
+ sponsorUserOperation: async ({
738
+ userOperation
739
+ }) => {
170
740
  return paymasterClient.sponsorUserOperation({
171
741
  userOperation,
172
742
  entryPoint: ENTRY_POINT_ADDRESS
@@ -179,7 +749,7 @@ async function deploySmartAccount(config) {
179
749
  try {
180
750
  const initialized = await publicClient.readContract({
181
751
  address: contracts.autopayModule,
182
- abi: import_sdk2.ERC7579AutopayModuleABI,
752
+ abi: ERC7579AutopayModuleABI,
183
753
  functionName: "isInitialized",
184
754
  args: [smartAccountAddress]
185
755
  });
@@ -193,7 +763,7 @@ async function deploySmartAccount(config) {
193
763
  alreadyDeployed
194
764
  };
195
765
  }
196
- const installData = (0, import_viem.encodeFunctionData)({
766
+ const installData = (0, import_viem3.encodeFunctionData)({
197
767
  abi: [
198
768
  {
199
769
  type: "function",
@@ -243,7 +813,10 @@ async function deploySmartAccount(config) {
243
813
  normalizedError.message
244
814
  );
245
815
  } else {
246
- console.error("[ZeroDev] Module installation failed:", normalizedError.message);
816
+ console.error(
817
+ "[ZeroDev] Module installation failed:",
818
+ normalizedError.message
819
+ );
247
820
  }
248
821
  throw normalizedError;
249
822
  }
@@ -256,8 +829,8 @@ async function deploySmartAccount(config) {
256
829
  };
257
830
  }
258
831
  async function revokeAutopayModule(config) {
259
- const chain = CHAIN_MAP[config.chainId] || import_chains.baseSepolia;
260
- const contracts = (0, import_sdk2.getContractAddresses)(config.chainId);
832
+ const chain = CHAIN_MAP[config.chainId] || import_chains5.baseSepolia;
833
+ const contracts = getContractAddresses(config.chainId);
261
834
  if (!contracts.autopayModule) {
262
835
  throw new Error("Autopay module address not configured for this chain.");
263
836
  }
@@ -267,13 +840,13 @@ async function revokeAutopayModule(config) {
267
840
  bundlerUrl: config.bundlerUrl,
268
841
  paymasterUrl: config.paymasterUrl
269
842
  });
270
- const publicClient = (0, import_viem.createPublicClient)({
843
+ const publicClient = (0, import_viem3.createPublicClient)({
271
844
  chain,
272
- transport: (0, import_viem.http)()
845
+ transport: (0, import_viem3.http)()
273
846
  });
274
847
  const initialized = await publicClient.readContract({
275
848
  address: contracts.autopayModule,
276
- abi: import_sdk2.ERC7579AutopayModuleABI,
849
+ abi: ERC7579AutopayModuleABI,
277
850
  functionName: "isInitialized",
278
851
  args: [config.smartAccountAddress]
279
852
  });
@@ -292,8 +865,8 @@ async function revokeAutopayModule(config) {
292
865
  `Kernel account mismatch. Expected ${config.smartAccountAddress}, got ${kernelAccount.address}.`
293
866
  );
294
867
  }
295
- const revokeData = (0, import_viem.encodeFunctionData)({
296
- abi: import_sdk2.ERC7579AutopayModuleABI,
868
+ const revokeData = (0, import_viem3.encodeFunctionData)({
869
+ abi: ERC7579AutopayModuleABI,
297
870
  functionName: "onUninstall",
298
871
  args: ["0x"]
299
872
  });
@@ -356,12 +929,12 @@ async function sendSmartAccountTransaction(config) {
356
929
  }
357
930
  }
358
931
  async function updateAutopayConfig(config) {
359
- const contracts = (0, import_sdk2.getContractAddresses)(config.chainId);
932
+ const contracts = getContractAddresses(config.chainId);
360
933
  if (!contracts.autopayModule) {
361
934
  throw new Error("Autopay module address is not configured for this chain.");
362
935
  }
363
- const data = (0, import_viem.encodeFunctionData)({
364
- abi: import_sdk2.ERC7579AutopayModuleABI,
936
+ const data = (0, import_viem3.encodeFunctionData)({
937
+ abi: ERC7579AutopayModuleABI,
365
938
  functionName: "updateConfig",
366
939
  args: [
367
940
  {
@@ -387,14 +960,14 @@ async function updateAutopayConfig(config) {
387
960
  });
388
961
  }
389
962
  async function cancelSubscription(config) {
390
- const contracts = (0, import_sdk2.getContractAddresses)(config.chainId);
963
+ const contracts = getContractAddresses(config.chainId);
391
964
  if (!contracts.subscriptionRegistry) {
392
965
  throw new Error(
393
966
  "Subscription registry address is not configured for this chain."
394
967
  );
395
968
  }
396
- const data = (0, import_viem.encodeFunctionData)({
397
- abi: import_sdk2.SubscriptionRegistryABI,
969
+ const data = (0, import_viem3.encodeFunctionData)({
970
+ abi: SubscriptionRegistryABI,
398
971
  functionName: "cancelSubscription",
399
972
  args: [config.tokenId]
400
973
  });