@dynamic-labs/ethereum-aa 4.10.3 → 4.10.4-preview.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 (40) hide show
  1. package/CHANGELOG.md +15 -4
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +11 -9
  5. package/src/AccountAbstractionConnector.cjs +75 -0
  6. package/src/AccountAbstractionConnector.d.ts +56 -0
  7. package/src/AccountAbstractionConnector.js +71 -0
  8. package/src/ZKsync/client.cjs +31 -0
  9. package/src/ZKsync/client.d.ts +25 -0
  10. package/src/ZKsync/client.js +27 -0
  11. package/src/ZKsync/ecdsaAccount.cjs +32 -0
  12. package/src/ZKsync/ecdsaAccount.d.ts +13 -0
  13. package/src/ZKsync/ecdsaAccount.js +28 -0
  14. package/src/ZKsync/getEip712Domain.cjs +62 -0
  15. package/src/ZKsync/getEip712Domain.d.ts +2 -0
  16. package/src/ZKsync/getEip712Domain.js +58 -0
  17. package/src/ZKsync/session.cjs +1218 -0
  18. package/src/ZKsync/session.d.ts +904 -0
  19. package/src/ZKsync/session.js +1211 -0
  20. package/src/ZKsync/types.cjs +52 -0
  21. package/src/ZKsync/types.d.ts +9 -0
  22. package/src/ZKsync/types.js +48 -0
  23. package/src/ZKsync/walletActions.cjs +93 -0
  24. package/src/ZKsync/walletActions.d.ts +15 -0
  25. package/src/ZKsync/walletActions.js +87 -0
  26. package/src/ZKsyncConnector.cjs +536 -0
  27. package/src/ZKsyncConnector.d.ts +24923 -0
  28. package/src/ZKsyncConnector.js +532 -0
  29. package/src/ZeroDevConnector.cjs +17 -13
  30. package/src/ZeroDevConnector.d.ts +17 -16
  31. package/src/ZeroDevConnector.js +18 -14
  32. package/src/index.cjs +11 -0
  33. package/src/index.d.ts +2 -0
  34. package/src/index.js +10 -1
  35. package/src/utils/abi.cjs +88 -0
  36. package/src/utils/abi.d.ts +102 -0
  37. package/src/utils/abi.js +84 -0
  38. package/src/utils/isZKsyncConnector.cjs +8 -0
  39. package/src/utils/isZKsyncConnector.d.ts +3 -0
  40. package/src/utils/isZKsyncConnector.js +4 -0
@@ -0,0 +1,1218 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../_virtual/_tslib.cjs');
7
+ var viem = require('viem');
8
+ var actions = require('viem/actions');
9
+ var zksync = require('viem/zksync');
10
+ var paymaster = require('zksync-sso/paymaster');
11
+
12
+ const createSession = (client, args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
13
+ var _a, _b, _c;
14
+ const callData = viem.encodeFunctionData({
15
+ abi: SessionKeyValidatorAbi,
16
+ args: [args.sessionConfig],
17
+ functionName: 'createSession',
18
+ });
19
+ const sendTransactionArgs = {
20
+ account: client.account,
21
+ data: callData,
22
+ gas: BigInt(10000000),
23
+ paymaster: (_a = args.paymaster) === null || _a === void 0 ? void 0 : _a.address,
24
+ paymasterInput: ((_b = args.paymaster) === null || _b === void 0 ? void 0 : _b.address)
25
+ ? ((_c = args.paymaster) === null || _c === void 0 ? void 0 : _c.paymasterInput) ||
26
+ zksync.getGeneralPaymasterInput({ innerInput: '0x' })
27
+ : undefined,
28
+ to: args.contracts.session, // TODO: Remove when gas estimation is fixed
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ };
31
+ const transactionWithPaymasterData = yield paymaster.getTransactionWithPaymasterData(client.chain.id, client.account.address, sendTransactionArgs, args.paymasterHandler);
32
+ const transactionHash = yield actions.sendTransaction(client, transactionWithPaymasterData);
33
+ if (args.onTransactionSent) {
34
+ args.onTransactionSent(transactionHash);
35
+ }
36
+ const transactionReceipt = yield actions.waitForTransactionReceipt(client, {
37
+ hash: transactionHash,
38
+ });
39
+ if (transactionReceipt.status !== 'success')
40
+ throw new Error('createSession transaction reverted');
41
+ return {
42
+ transactionReceipt,
43
+ };
44
+ });
45
+ const revokeSession = (client, args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
46
+ var _d, _e, _f;
47
+ const callData = viem.encodeFunctionData({
48
+ abi: SessionKeyValidatorAbi,
49
+ args: [args.sessionId],
50
+ functionName: 'revokeKey',
51
+ });
52
+ const sendTransactionArgs = {
53
+ account: client.account,
54
+ data: callData,
55
+ gas: BigInt(10000000),
56
+ paymaster: (_d = args.paymaster) === null || _d === void 0 ? void 0 : _d.address,
57
+ paymasterInput: ((_e = args.paymaster) === null || _e === void 0 ? void 0 : _e.address)
58
+ ? ((_f = args.paymaster) === null || _f === void 0 ? void 0 : _f.paymasterInput) ||
59
+ zksync.getGeneralPaymasterInput({ innerInput: '0x' })
60
+ : undefined,
61
+ to: args.contracts.session, // TODO: Remove when gas estimation is fixed
62
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
+ };
64
+ const transactionWithPaymasterData = yield paymaster.getTransactionWithPaymasterData(client.chain.id, client.account.address, sendTransactionArgs, args.paymasterHandler);
65
+ const transactionHash = yield actions.sendTransaction(client, transactionWithPaymasterData);
66
+ if (args.onTransactionSent) {
67
+ args.onTransactionSent(transactionHash);
68
+ }
69
+ const transactionReceipt = yield actions.waitForTransactionReceipt(client, {
70
+ hash: transactionHash,
71
+ });
72
+ if (transactionReceipt.status !== 'success')
73
+ throw new Error('createSession transaction reverted');
74
+ return {
75
+ transactionReceipt,
76
+ };
77
+ });
78
+ const zksyncSsoEcdsaActions = (client) => ({
79
+ createSession: (args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
80
+ return yield createSession(client, Object.assign(Object.assign({}, args), { contracts: client.contracts }));
81
+ }),
82
+ revokeSession: (args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
83
+ return yield revokeSession(client, Object.assign(Object.assign({}, args), { contracts: client.contracts }));
84
+ }),
85
+ });
86
+ const SessionKeyValidatorAbi = [
87
+ {
88
+ inputs: [
89
+ {
90
+ internalType: 'uint256',
91
+ name: 'value',
92
+ type: 'uint256',
93
+ },
94
+ ],
95
+ name: 'ADDRESS_CAST_OVERFLOW',
96
+ type: 'error',
97
+ },
98
+ {
99
+ inputs: [
100
+ {
101
+ internalType: 'bytes',
102
+ name: 'input',
103
+ type: 'bytes',
104
+ },
105
+ ],
106
+ name: 'INVALID_PAYMASTER_INPUT',
107
+ type: 'error',
108
+ },
109
+ {
110
+ inputs: [
111
+ {
112
+ internalType: 'address',
113
+ name: 'notInitialized',
114
+ type: 'address',
115
+ },
116
+ ],
117
+ name: 'NOT_FROM_INITIALIZED_ACCOUNT',
118
+ type: 'error',
119
+ },
120
+ {
121
+ inputs: [
122
+ {
123
+ internalType: 'uint256',
124
+ name: 'chainId',
125
+ type: 'uint256',
126
+ },
127
+ ],
128
+ name: 'NO_TIMESTAMP_ASSERTER',
129
+ type: 'error',
130
+ },
131
+ {
132
+ inputs: [
133
+ {
134
+ internalType: 'uint256',
135
+ name: 'allowance',
136
+ type: 'uint256',
137
+ },
138
+ {
139
+ internalType: 'uint256',
140
+ name: 'maxAllowance',
141
+ type: 'uint256',
142
+ },
143
+ {
144
+ internalType: 'uint64',
145
+ name: 'period',
146
+ type: 'uint64',
147
+ },
148
+ ],
149
+ name: 'SESSION_ALLOWANCE_EXCEEDED',
150
+ type: 'error',
151
+ },
152
+ {
153
+ inputs: [
154
+ {
155
+ internalType: 'bytes32',
156
+ name: 'sessionHash',
157
+ type: 'bytes32',
158
+ },
159
+ ],
160
+ name: 'SESSION_ALREADY_EXISTS',
161
+ type: 'error',
162
+ },
163
+ {
164
+ inputs: [
165
+ {
166
+ internalType: 'address',
167
+ name: 'target',
168
+ type: 'address',
169
+ },
170
+ {
171
+ internalType: 'bytes4',
172
+ name: 'selector',
173
+ type: 'bytes4',
174
+ },
175
+ ],
176
+ name: 'SESSION_CALL_POLICY_VIOLATED',
177
+ type: 'error',
178
+ },
179
+ {
180
+ inputs: [
181
+ {
182
+ internalType: 'bytes32',
183
+ name: 'param',
184
+ type: 'bytes32',
185
+ },
186
+ {
187
+ internalType: 'bytes32',
188
+ name: 'refValue',
189
+ type: 'bytes32',
190
+ },
191
+ {
192
+ internalType: 'uint8',
193
+ name: 'condition',
194
+ type: 'uint8',
195
+ },
196
+ ],
197
+ name: 'SESSION_CONDITION_FAILED',
198
+ type: 'error',
199
+ },
200
+ {
201
+ inputs: [
202
+ {
203
+ internalType: 'uint256',
204
+ name: 'expiresAt',
205
+ type: 'uint256',
206
+ },
207
+ ],
208
+ name: 'SESSION_EXPIRES_TOO_SOON',
209
+ type: 'error',
210
+ },
211
+ {
212
+ inputs: [
213
+ {
214
+ internalType: 'uint256',
215
+ name: 'actualLength',
216
+ type: 'uint256',
217
+ },
218
+ {
219
+ internalType: 'uint256',
220
+ name: 'expectedMinimumLength',
221
+ type: 'uint256',
222
+ },
223
+ ],
224
+ name: 'SESSION_INVALID_DATA_LENGTH',
225
+ type: 'error',
226
+ },
227
+ {
228
+ inputs: [
229
+ {
230
+ internalType: 'address',
231
+ name: 'recovered',
232
+ type: 'address',
233
+ },
234
+ {
235
+ internalType: 'address',
236
+ name: 'expected',
237
+ type: 'address',
238
+ },
239
+ ],
240
+ name: 'SESSION_INVALID_SIGNER',
241
+ type: 'error',
242
+ },
243
+ {
244
+ inputs: [
245
+ {
246
+ internalType: 'uint256',
247
+ name: 'lifetimeUsage',
248
+ type: 'uint256',
249
+ },
250
+ {
251
+ internalType: 'uint256',
252
+ name: 'maxUsage',
253
+ type: 'uint256',
254
+ },
255
+ ],
256
+ name: 'SESSION_LIFETIME_USAGE_EXCEEDED',
257
+ type: 'error',
258
+ },
259
+ {
260
+ inputs: [
261
+ {
262
+ internalType: 'uint256',
263
+ name: 'usedValue',
264
+ type: 'uint256',
265
+ },
266
+ {
267
+ internalType: 'uint256',
268
+ name: 'maxValuePerUse',
269
+ type: 'uint256',
270
+ },
271
+ ],
272
+ name: 'SESSION_MAX_VALUE_EXCEEDED',
273
+ type: 'error',
274
+ },
275
+ {
276
+ inputs: [],
277
+ name: 'SESSION_NOT_ACTIVE',
278
+ type: 'error',
279
+ },
280
+ {
281
+ inputs: [
282
+ {
283
+ internalType: 'address',
284
+ name: 'target',
285
+ type: 'address',
286
+ },
287
+ ],
288
+ name: 'SESSION_TRANSFER_POLICY_VIOLATED',
289
+ type: 'error',
290
+ },
291
+ {
292
+ inputs: [],
293
+ name: 'SESSION_UNLIMITED_FEES',
294
+ type: 'error',
295
+ },
296
+ {
297
+ inputs: [],
298
+ name: 'SESSION_ZERO_SIGNER',
299
+ type: 'error',
300
+ },
301
+ {
302
+ inputs: [
303
+ {
304
+ internalType: 'uint256',
305
+ name: 'openSessions',
306
+ type: 'uint256',
307
+ },
308
+ ],
309
+ name: 'UNINSTALL_WITH_OPEN_SESSIONS',
310
+ type: 'error',
311
+ },
312
+ {
313
+ anonymous: false,
314
+ inputs: [
315
+ {
316
+ indexed: true,
317
+ internalType: 'address',
318
+ name: 'account',
319
+ type: 'address',
320
+ },
321
+ {
322
+ indexed: true,
323
+ internalType: 'bytes32',
324
+ name: 'sessionHash',
325
+ type: 'bytes32',
326
+ },
327
+ {
328
+ components: [
329
+ {
330
+ internalType: 'address',
331
+ name: 'signer',
332
+ type: 'address',
333
+ },
334
+ {
335
+ internalType: 'uint256',
336
+ name: 'expiresAt',
337
+ type: 'uint256',
338
+ },
339
+ {
340
+ components: [
341
+ {
342
+ internalType: 'enum SessionLib.LimitType',
343
+ name: 'limitType',
344
+ type: 'uint8',
345
+ },
346
+ {
347
+ internalType: 'uint256',
348
+ name: 'limit',
349
+ type: 'uint256',
350
+ },
351
+ {
352
+ internalType: 'uint256',
353
+ name: 'period',
354
+ type: 'uint256',
355
+ },
356
+ ],
357
+ internalType: 'struct SessionLib.UsageLimit',
358
+ name: 'feeLimit',
359
+ type: 'tuple',
360
+ },
361
+ {
362
+ components: [
363
+ {
364
+ internalType: 'address',
365
+ name: 'target',
366
+ type: 'address',
367
+ },
368
+ {
369
+ internalType: 'bytes4',
370
+ name: 'selector',
371
+ type: 'bytes4',
372
+ },
373
+ {
374
+ internalType: 'uint256',
375
+ name: 'maxValuePerUse',
376
+ type: 'uint256',
377
+ },
378
+ {
379
+ components: [
380
+ {
381
+ internalType: 'enum SessionLib.LimitType',
382
+ name: 'limitType',
383
+ type: 'uint8',
384
+ },
385
+ {
386
+ internalType: 'uint256',
387
+ name: 'limit',
388
+ type: 'uint256',
389
+ },
390
+ {
391
+ internalType: 'uint256',
392
+ name: 'period',
393
+ type: 'uint256',
394
+ },
395
+ ],
396
+ internalType: 'struct SessionLib.UsageLimit',
397
+ name: 'valueLimit',
398
+ type: 'tuple',
399
+ },
400
+ {
401
+ components: [
402
+ {
403
+ internalType: 'enum SessionLib.Condition',
404
+ name: 'condition',
405
+ type: 'uint8',
406
+ },
407
+ {
408
+ internalType: 'uint64',
409
+ name: 'index',
410
+ type: 'uint64',
411
+ },
412
+ {
413
+ internalType: 'bytes32',
414
+ name: 'refValue',
415
+ type: 'bytes32',
416
+ },
417
+ {
418
+ components: [
419
+ {
420
+ internalType: 'enum SessionLib.LimitType',
421
+ name: 'limitType',
422
+ type: 'uint8',
423
+ },
424
+ {
425
+ internalType: 'uint256',
426
+ name: 'limit',
427
+ type: 'uint256',
428
+ },
429
+ {
430
+ internalType: 'uint256',
431
+ name: 'period',
432
+ type: 'uint256',
433
+ },
434
+ ],
435
+ internalType: 'struct SessionLib.UsageLimit',
436
+ name: 'limit',
437
+ type: 'tuple',
438
+ },
439
+ ],
440
+ internalType: 'struct SessionLib.Constraint[]',
441
+ name: 'constraints',
442
+ type: 'tuple[]',
443
+ },
444
+ ],
445
+ internalType: 'struct SessionLib.CallSpec[]',
446
+ name: 'callPolicies',
447
+ type: 'tuple[]',
448
+ },
449
+ {
450
+ components: [
451
+ {
452
+ internalType: 'address',
453
+ name: 'target',
454
+ type: 'address',
455
+ },
456
+ {
457
+ internalType: 'uint256',
458
+ name: 'maxValuePerUse',
459
+ type: 'uint256',
460
+ },
461
+ {
462
+ components: [
463
+ {
464
+ internalType: 'enum SessionLib.LimitType',
465
+ name: 'limitType',
466
+ type: 'uint8',
467
+ },
468
+ {
469
+ internalType: 'uint256',
470
+ name: 'limit',
471
+ type: 'uint256',
472
+ },
473
+ {
474
+ internalType: 'uint256',
475
+ name: 'period',
476
+ type: 'uint256',
477
+ },
478
+ ],
479
+ internalType: 'struct SessionLib.UsageLimit',
480
+ name: 'valueLimit',
481
+ type: 'tuple',
482
+ },
483
+ ],
484
+ internalType: 'struct SessionLib.TransferSpec[]',
485
+ name: 'transferPolicies',
486
+ type: 'tuple[]',
487
+ },
488
+ ],
489
+ indexed: false,
490
+ internalType: 'struct SessionLib.SessionSpec',
491
+ name: 'sessionSpec',
492
+ type: 'tuple',
493
+ },
494
+ ],
495
+ name: 'SessionCreated',
496
+ type: 'event',
497
+ },
498
+ {
499
+ anonymous: false,
500
+ inputs: [
501
+ {
502
+ indexed: true,
503
+ internalType: 'address',
504
+ name: 'account',
505
+ type: 'address',
506
+ },
507
+ {
508
+ indexed: true,
509
+ internalType: 'bytes32',
510
+ name: 'sessionHash',
511
+ type: 'bytes32',
512
+ },
513
+ ],
514
+ name: 'SessionRevoked',
515
+ type: 'event',
516
+ },
517
+ {
518
+ inputs: [
519
+ {
520
+ components: [
521
+ {
522
+ internalType: 'address',
523
+ name: 'signer',
524
+ type: 'address',
525
+ },
526
+ {
527
+ internalType: 'uint256',
528
+ name: 'expiresAt',
529
+ type: 'uint256',
530
+ },
531
+ {
532
+ components: [
533
+ {
534
+ internalType: 'enum SessionLib.LimitType',
535
+ name: 'limitType',
536
+ type: 'uint8',
537
+ },
538
+ {
539
+ internalType: 'uint256',
540
+ name: 'limit',
541
+ type: 'uint256',
542
+ },
543
+ {
544
+ internalType: 'uint256',
545
+ name: 'period',
546
+ type: 'uint256',
547
+ },
548
+ ],
549
+ internalType: 'struct SessionLib.UsageLimit',
550
+ name: 'feeLimit',
551
+ type: 'tuple',
552
+ },
553
+ {
554
+ components: [
555
+ {
556
+ internalType: 'address',
557
+ name: 'target',
558
+ type: 'address',
559
+ },
560
+ {
561
+ internalType: 'bytes4',
562
+ name: 'selector',
563
+ type: 'bytes4',
564
+ },
565
+ {
566
+ internalType: 'uint256',
567
+ name: 'maxValuePerUse',
568
+ type: 'uint256',
569
+ },
570
+ {
571
+ components: [
572
+ {
573
+ internalType: 'enum SessionLib.LimitType',
574
+ name: 'limitType',
575
+ type: 'uint8',
576
+ },
577
+ {
578
+ internalType: 'uint256',
579
+ name: 'limit',
580
+ type: 'uint256',
581
+ },
582
+ {
583
+ internalType: 'uint256',
584
+ name: 'period',
585
+ type: 'uint256',
586
+ },
587
+ ],
588
+ internalType: 'struct SessionLib.UsageLimit',
589
+ name: 'valueLimit',
590
+ type: 'tuple',
591
+ },
592
+ {
593
+ components: [
594
+ {
595
+ internalType: 'enum SessionLib.Condition',
596
+ name: 'condition',
597
+ type: 'uint8',
598
+ },
599
+ {
600
+ internalType: 'uint64',
601
+ name: 'index',
602
+ type: 'uint64',
603
+ },
604
+ {
605
+ internalType: 'bytes32',
606
+ name: 'refValue',
607
+ type: 'bytes32',
608
+ },
609
+ {
610
+ components: [
611
+ {
612
+ internalType: 'enum SessionLib.LimitType',
613
+ name: 'limitType',
614
+ type: 'uint8',
615
+ },
616
+ {
617
+ internalType: 'uint256',
618
+ name: 'limit',
619
+ type: 'uint256',
620
+ },
621
+ {
622
+ internalType: 'uint256',
623
+ name: 'period',
624
+ type: 'uint256',
625
+ },
626
+ ],
627
+ internalType: 'struct SessionLib.UsageLimit',
628
+ name: 'limit',
629
+ type: 'tuple',
630
+ },
631
+ ],
632
+ internalType: 'struct SessionLib.Constraint[]',
633
+ name: 'constraints',
634
+ type: 'tuple[]',
635
+ },
636
+ ],
637
+ internalType: 'struct SessionLib.CallSpec[]',
638
+ name: 'callPolicies',
639
+ type: 'tuple[]',
640
+ },
641
+ {
642
+ components: [
643
+ {
644
+ internalType: 'address',
645
+ name: 'target',
646
+ type: 'address',
647
+ },
648
+ {
649
+ internalType: 'uint256',
650
+ name: 'maxValuePerUse',
651
+ type: 'uint256',
652
+ },
653
+ {
654
+ components: [
655
+ {
656
+ internalType: 'enum SessionLib.LimitType',
657
+ name: 'limitType',
658
+ type: 'uint8',
659
+ },
660
+ {
661
+ internalType: 'uint256',
662
+ name: 'limit',
663
+ type: 'uint256',
664
+ },
665
+ {
666
+ internalType: 'uint256',
667
+ name: 'period',
668
+ type: 'uint256',
669
+ },
670
+ ],
671
+ internalType: 'struct SessionLib.UsageLimit',
672
+ name: 'valueLimit',
673
+ type: 'tuple',
674
+ },
675
+ ],
676
+ internalType: 'struct SessionLib.TransferSpec[]',
677
+ name: 'transferPolicies',
678
+ type: 'tuple[]',
679
+ },
680
+ ],
681
+ internalType: 'struct SessionLib.SessionSpec',
682
+ name: 'sessionSpec',
683
+ type: 'tuple',
684
+ },
685
+ ],
686
+ name: 'createSession',
687
+ outputs: [],
688
+ stateMutability: 'nonpayable',
689
+ type: 'function',
690
+ },
691
+ {
692
+ inputs: [
693
+ {
694
+ internalType: 'address',
695
+ name: 'smartAccount',
696
+ type: 'address',
697
+ },
698
+ ],
699
+ name: 'isInitialized',
700
+ outputs: [
701
+ {
702
+ internalType: 'bool',
703
+ name: '',
704
+ type: 'bool',
705
+ },
706
+ ],
707
+ stateMutability: 'view',
708
+ type: 'function',
709
+ },
710
+ {
711
+ inputs: [
712
+ {
713
+ internalType: 'bytes',
714
+ name: 'data',
715
+ type: 'bytes',
716
+ },
717
+ ],
718
+ name: 'onInstall',
719
+ outputs: [],
720
+ stateMutability: 'nonpayable',
721
+ type: 'function',
722
+ },
723
+ {
724
+ inputs: [
725
+ {
726
+ internalType: 'bytes',
727
+ name: 'data',
728
+ type: 'bytes',
729
+ },
730
+ ],
731
+ name: 'onUninstall',
732
+ outputs: [],
733
+ stateMutability: 'nonpayable',
734
+ type: 'function',
735
+ },
736
+ {
737
+ inputs: [
738
+ {
739
+ internalType: 'bytes32',
740
+ name: 'sessionHash',
741
+ type: 'bytes32',
742
+ },
743
+ ],
744
+ name: 'revokeKey',
745
+ outputs: [],
746
+ stateMutability: 'nonpayable',
747
+ type: 'function',
748
+ },
749
+ {
750
+ inputs: [
751
+ {
752
+ internalType: 'bytes32[]',
753
+ name: 'sessionHashes',
754
+ type: 'bytes32[]',
755
+ },
756
+ ],
757
+ name: 'revokeKeys',
758
+ outputs: [],
759
+ stateMutability: 'nonpayable',
760
+ type: 'function',
761
+ },
762
+ {
763
+ inputs: [
764
+ {
765
+ internalType: 'address',
766
+ name: 'account',
767
+ type: 'address',
768
+ },
769
+ {
770
+ components: [
771
+ {
772
+ internalType: 'address',
773
+ name: 'signer',
774
+ type: 'address',
775
+ },
776
+ {
777
+ internalType: 'uint256',
778
+ name: 'expiresAt',
779
+ type: 'uint256',
780
+ },
781
+ {
782
+ components: [
783
+ {
784
+ internalType: 'enum SessionLib.LimitType',
785
+ name: 'limitType',
786
+ type: 'uint8',
787
+ },
788
+ {
789
+ internalType: 'uint256',
790
+ name: 'limit',
791
+ type: 'uint256',
792
+ },
793
+ {
794
+ internalType: 'uint256',
795
+ name: 'period',
796
+ type: 'uint256',
797
+ },
798
+ ],
799
+ internalType: 'struct SessionLib.UsageLimit',
800
+ name: 'feeLimit',
801
+ type: 'tuple',
802
+ },
803
+ {
804
+ components: [
805
+ {
806
+ internalType: 'address',
807
+ name: 'target',
808
+ type: 'address',
809
+ },
810
+ {
811
+ internalType: 'bytes4',
812
+ name: 'selector',
813
+ type: 'bytes4',
814
+ },
815
+ {
816
+ internalType: 'uint256',
817
+ name: 'maxValuePerUse',
818
+ type: 'uint256',
819
+ },
820
+ {
821
+ components: [
822
+ {
823
+ internalType: 'enum SessionLib.LimitType',
824
+ name: 'limitType',
825
+ type: 'uint8',
826
+ },
827
+ {
828
+ internalType: 'uint256',
829
+ name: 'limit',
830
+ type: 'uint256',
831
+ },
832
+ {
833
+ internalType: 'uint256',
834
+ name: 'period',
835
+ type: 'uint256',
836
+ },
837
+ ],
838
+ internalType: 'struct SessionLib.UsageLimit',
839
+ name: 'valueLimit',
840
+ type: 'tuple',
841
+ },
842
+ {
843
+ components: [
844
+ {
845
+ internalType: 'enum SessionLib.Condition',
846
+ name: 'condition',
847
+ type: 'uint8',
848
+ },
849
+ {
850
+ internalType: 'uint64',
851
+ name: 'index',
852
+ type: 'uint64',
853
+ },
854
+ {
855
+ internalType: 'bytes32',
856
+ name: 'refValue',
857
+ type: 'bytes32',
858
+ },
859
+ {
860
+ components: [
861
+ {
862
+ internalType: 'enum SessionLib.LimitType',
863
+ name: 'limitType',
864
+ type: 'uint8',
865
+ },
866
+ {
867
+ internalType: 'uint256',
868
+ name: 'limit',
869
+ type: 'uint256',
870
+ },
871
+ {
872
+ internalType: 'uint256',
873
+ name: 'period',
874
+ type: 'uint256',
875
+ },
876
+ ],
877
+ internalType: 'struct SessionLib.UsageLimit',
878
+ name: 'limit',
879
+ type: 'tuple',
880
+ },
881
+ ],
882
+ internalType: 'struct SessionLib.Constraint[]',
883
+ name: 'constraints',
884
+ type: 'tuple[]',
885
+ },
886
+ ],
887
+ internalType: 'struct SessionLib.CallSpec[]',
888
+ name: 'callPolicies',
889
+ type: 'tuple[]',
890
+ },
891
+ {
892
+ components: [
893
+ {
894
+ internalType: 'address',
895
+ name: 'target',
896
+ type: 'address',
897
+ },
898
+ {
899
+ internalType: 'uint256',
900
+ name: 'maxValuePerUse',
901
+ type: 'uint256',
902
+ },
903
+ {
904
+ components: [
905
+ {
906
+ internalType: 'enum SessionLib.LimitType',
907
+ name: 'limitType',
908
+ type: 'uint8',
909
+ },
910
+ {
911
+ internalType: 'uint256',
912
+ name: 'limit',
913
+ type: 'uint256',
914
+ },
915
+ {
916
+ internalType: 'uint256',
917
+ name: 'period',
918
+ type: 'uint256',
919
+ },
920
+ ],
921
+ internalType: 'struct SessionLib.UsageLimit',
922
+ name: 'valueLimit',
923
+ type: 'tuple',
924
+ },
925
+ ],
926
+ internalType: 'struct SessionLib.TransferSpec[]',
927
+ name: 'transferPolicies',
928
+ type: 'tuple[]',
929
+ },
930
+ ],
931
+ internalType: 'struct SessionLib.SessionSpec',
932
+ name: 'spec',
933
+ type: 'tuple',
934
+ },
935
+ ],
936
+ name: 'sessionState',
937
+ outputs: [
938
+ {
939
+ components: [
940
+ {
941
+ internalType: 'enum SessionLib.Status',
942
+ name: 'status',
943
+ type: 'uint8',
944
+ },
945
+ {
946
+ internalType: 'uint256',
947
+ name: 'feesRemaining',
948
+ type: 'uint256',
949
+ },
950
+ {
951
+ components: [
952
+ {
953
+ internalType: 'uint256',
954
+ name: 'remaining',
955
+ type: 'uint256',
956
+ },
957
+ {
958
+ internalType: 'address',
959
+ name: 'target',
960
+ type: 'address',
961
+ },
962
+ {
963
+ internalType: 'bytes4',
964
+ name: 'selector',
965
+ type: 'bytes4',
966
+ },
967
+ {
968
+ internalType: 'uint256',
969
+ name: 'index',
970
+ type: 'uint256',
971
+ },
972
+ ],
973
+ internalType: 'struct SessionLib.LimitState[]',
974
+ name: 'transferValue',
975
+ type: 'tuple[]',
976
+ },
977
+ {
978
+ components: [
979
+ {
980
+ internalType: 'uint256',
981
+ name: 'remaining',
982
+ type: 'uint256',
983
+ },
984
+ {
985
+ internalType: 'address',
986
+ name: 'target',
987
+ type: 'address',
988
+ },
989
+ {
990
+ internalType: 'bytes4',
991
+ name: 'selector',
992
+ type: 'bytes4',
993
+ },
994
+ {
995
+ internalType: 'uint256',
996
+ name: 'index',
997
+ type: 'uint256',
998
+ },
999
+ ],
1000
+ internalType: 'struct SessionLib.LimitState[]',
1001
+ name: 'callValue',
1002
+ type: 'tuple[]',
1003
+ },
1004
+ {
1005
+ components: [
1006
+ {
1007
+ internalType: 'uint256',
1008
+ name: 'remaining',
1009
+ type: 'uint256',
1010
+ },
1011
+ {
1012
+ internalType: 'address',
1013
+ name: 'target',
1014
+ type: 'address',
1015
+ },
1016
+ {
1017
+ internalType: 'bytes4',
1018
+ name: 'selector',
1019
+ type: 'bytes4',
1020
+ },
1021
+ {
1022
+ internalType: 'uint256',
1023
+ name: 'index',
1024
+ type: 'uint256',
1025
+ },
1026
+ ],
1027
+ internalType: 'struct SessionLib.LimitState[]',
1028
+ name: 'callParams',
1029
+ type: 'tuple[]',
1030
+ },
1031
+ ],
1032
+ internalType: 'struct SessionLib.SessionState',
1033
+ name: '',
1034
+ type: 'tuple',
1035
+ },
1036
+ ],
1037
+ stateMutability: 'view',
1038
+ type: 'function',
1039
+ },
1040
+ {
1041
+ inputs: [
1042
+ {
1043
+ internalType: 'address',
1044
+ name: 'account',
1045
+ type: 'address',
1046
+ },
1047
+ {
1048
+ internalType: 'bytes32',
1049
+ name: 'sessionHash',
1050
+ type: 'bytes32',
1051
+ },
1052
+ ],
1053
+ name: 'sessionStatus',
1054
+ outputs: [
1055
+ {
1056
+ internalType: 'enum SessionLib.Status',
1057
+ name: '',
1058
+ type: 'uint8',
1059
+ },
1060
+ ],
1061
+ stateMutability: 'view',
1062
+ type: 'function',
1063
+ },
1064
+ {
1065
+ inputs: [
1066
+ {
1067
+ internalType: 'bytes4',
1068
+ name: 'interfaceId',
1069
+ type: 'bytes4',
1070
+ },
1071
+ ],
1072
+ name: 'supportsInterface',
1073
+ outputs: [
1074
+ {
1075
+ internalType: 'bool',
1076
+ name: '',
1077
+ type: 'bool',
1078
+ },
1079
+ ],
1080
+ stateMutability: 'pure',
1081
+ type: 'function',
1082
+ },
1083
+ {
1084
+ inputs: [
1085
+ {
1086
+ internalType: 'bytes32',
1087
+ name: '',
1088
+ type: 'bytes32',
1089
+ },
1090
+ {
1091
+ internalType: 'bytes',
1092
+ name: '',
1093
+ type: 'bytes',
1094
+ },
1095
+ ],
1096
+ name: 'validateSignature',
1097
+ outputs: [
1098
+ {
1099
+ internalType: 'bool',
1100
+ name: '',
1101
+ type: 'bool',
1102
+ },
1103
+ ],
1104
+ stateMutability: 'pure',
1105
+ type: 'function',
1106
+ },
1107
+ {
1108
+ inputs: [
1109
+ {
1110
+ internalType: 'bytes32',
1111
+ name: 'signedHash',
1112
+ type: 'bytes32',
1113
+ },
1114
+ {
1115
+ components: [
1116
+ {
1117
+ internalType: 'uint256',
1118
+ name: 'txType',
1119
+ type: 'uint256',
1120
+ },
1121
+ {
1122
+ internalType: 'uint256',
1123
+ name: 'from',
1124
+ type: 'uint256',
1125
+ },
1126
+ {
1127
+ internalType: 'uint256',
1128
+ name: 'to',
1129
+ type: 'uint256',
1130
+ },
1131
+ {
1132
+ internalType: 'uint256',
1133
+ name: 'gasLimit',
1134
+ type: 'uint256',
1135
+ },
1136
+ {
1137
+ internalType: 'uint256',
1138
+ name: 'gasPerPubdataByteLimit',
1139
+ type: 'uint256',
1140
+ },
1141
+ {
1142
+ internalType: 'uint256',
1143
+ name: 'maxFeePerGas',
1144
+ type: 'uint256',
1145
+ },
1146
+ {
1147
+ internalType: 'uint256',
1148
+ name: 'maxPriorityFeePerGas',
1149
+ type: 'uint256',
1150
+ },
1151
+ {
1152
+ internalType: 'uint256',
1153
+ name: 'paymaster',
1154
+ type: 'uint256',
1155
+ },
1156
+ {
1157
+ internalType: 'uint256',
1158
+ name: 'nonce',
1159
+ type: 'uint256',
1160
+ },
1161
+ {
1162
+ internalType: 'uint256',
1163
+ name: 'value',
1164
+ type: 'uint256',
1165
+ },
1166
+ {
1167
+ internalType: 'uint256[4]',
1168
+ name: 'reserved',
1169
+ type: 'uint256[4]',
1170
+ },
1171
+ {
1172
+ internalType: 'bytes',
1173
+ name: 'data',
1174
+ type: 'bytes',
1175
+ },
1176
+ {
1177
+ internalType: 'bytes',
1178
+ name: 'signature',
1179
+ type: 'bytes',
1180
+ },
1181
+ {
1182
+ internalType: 'bytes32[]',
1183
+ name: 'factoryDeps',
1184
+ type: 'bytes32[]',
1185
+ },
1186
+ {
1187
+ internalType: 'bytes',
1188
+ name: 'paymasterInput',
1189
+ type: 'bytes',
1190
+ },
1191
+ {
1192
+ internalType: 'bytes',
1193
+ name: 'reservedDynamic',
1194
+ type: 'bytes',
1195
+ },
1196
+ ],
1197
+ internalType: 'struct Transaction',
1198
+ name: 'transaction',
1199
+ type: 'tuple',
1200
+ },
1201
+ ],
1202
+ name: 'validateTransaction',
1203
+ outputs: [
1204
+ {
1205
+ internalType: 'bool',
1206
+ name: '',
1207
+ type: 'bool',
1208
+ },
1209
+ ],
1210
+ stateMutability: 'nonpayable',
1211
+ type: 'function',
1212
+ },
1213
+ ];
1214
+
1215
+ exports.SessionKeyValidatorAbi = SessionKeyValidatorAbi;
1216
+ exports.createSession = createSession;
1217
+ exports.revokeSession = revokeSession;
1218
+ exports.zksyncSsoEcdsaActions = zksyncSsoEcdsaActions;