@pancakeswap/permit2-sdk 1.0.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.
package/dist/index.js ADDED
@@ -0,0 +1,1148 @@
1
+ 'use strict';
2
+
3
+ var invariant = require('tiny-invariant');
4
+ var chains = require('@pancakeswap/chains');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var invariant__default = /*#__PURE__*/_interopDefault(invariant);
9
+
10
+ // src/allowanceTransfer.ts
11
+ var PERMIT2_ADDRESSES = {
12
+ [chains.ChainId.ETHEREUM]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
13
+ [chains.ChainId.GOERLI]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
14
+ [chains.ChainId.SEPOLIA]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
15
+ [chains.ChainId.BSC]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
16
+ [chains.ChainId.BSC_TESTNET]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
17
+ // [ChainId.SCROLL]: '0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768',
18
+ [chains.ChainId.SCROLL_SEPOLIA]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
19
+ [chains.ChainId.ARBITRUM_ONE]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
20
+ [chains.ChainId.ARBITRUM_GOERLI]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
21
+ [chains.ChainId.ARBITRUM_SEPOLIA]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
22
+ [chains.ChainId.BASE]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
23
+ [chains.ChainId.BASE_TESTNET]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
24
+ [chains.ChainId.BASE_SEPOLIA]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
25
+ [chains.ChainId.POLYGON_ZKEVM]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
26
+ [chains.ChainId.POLYGON_ZKEVM_TESTNET]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
27
+ [chains.ChainId.LINEA]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
28
+ [chains.ChainId.LINEA_TESTNET]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
29
+ [chains.ChainId.ZKSYNC]: "0x686FD50007EaA636F01154d660b96110B6bFe351",
30
+ [chains.ChainId.ZKSYNC_TESTNET]: "0xaf321b731E65715DdbFDa73A066E00BB28345709",
31
+ [chains.ChainId.OPBNB]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",
32
+ [chains.ChainId.OPBNB_TESTNET]: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768"
33
+ };
34
+ var getPermit2Address = (chainId) => {
35
+ if (chainId === void 0)
36
+ return PERMIT2_ADDRESSES[chains.ChainId.BSC];
37
+ if (!(chainId in PERMIT2_ADDRESSES))
38
+ throw new Error(`Permit2 Contract not deployed on chain ${chainId}`);
39
+ return PERMIT2_ADDRESSES[chainId];
40
+ };
41
+ var MaxUint48 = BigInt("0xffffffffffff");
42
+ var MaxUint160 = BigInt("0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF");
43
+ var MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
44
+ var MaxAllowanceTransferAmount = MaxUint160;
45
+ var MaxAllowanceExpiration = MaxUint48;
46
+ var MaxOrderedNonce = MaxUint48;
47
+ var MaxSignatureTransferAmount = MaxUint256;
48
+ var MaxUnorderedNonce = MaxUint256;
49
+ var MaxSigDeadline = MaxUint256;
50
+ var PERMIT_EXPIRATION = 2592e6;
51
+ var PERMIT_SIG_EXPIRATION = 18e5;
52
+ var InstantExpiration = BigInt("0");
53
+
54
+ // src/domain.ts
55
+ var PERMIT2_DOMAIN_NAME = "Permit2";
56
+ function permit2Domain(permit2Address, chainId) {
57
+ return {
58
+ name: PERMIT2_DOMAIN_NAME,
59
+ chainId,
60
+ verifyingContract: permit2Address
61
+ };
62
+ }
63
+
64
+ // src/allowanceTransfer.ts
65
+ var PERMIT_DETAILS = [
66
+ { name: "token", type: "address" },
67
+ { name: "amount", type: "uint160" },
68
+ { name: "expiration", type: "uint48" },
69
+ { name: "nonce", type: "uint48" }
70
+ ];
71
+ var PERMIT_TYPES = {
72
+ PermitSingle: [
73
+ { name: "details", type: "PermitDetails" },
74
+ { name: "spender", type: "address" },
75
+ { name: "sigDeadline", type: "uint256" }
76
+ ],
77
+ PermitDetails: PERMIT_DETAILS
78
+ };
79
+ var PERMIT_BATCH_TYPES = {
80
+ PermitBatch: [
81
+ { name: "details", type: "PermitDetails[]" },
82
+ { name: "spender", type: "address" },
83
+ { name: "sigDeadline", type: "uint256" }
84
+ ],
85
+ PermitDetails: PERMIT_DETAILS
86
+ };
87
+ function isPermit(permit) {
88
+ return !Array.isArray(permit.details);
89
+ }
90
+ var AllowanceTransfer = class {
91
+ /**
92
+ * Cannot be constructed.
93
+ */
94
+ // eslint-disable-next-line no-useless-constructor
95
+ constructor() {
96
+ }
97
+ // return the data to be sent in a eth_signTypedData RPC call
98
+ // for signing the given permit data
99
+ static getPermitData(permit, permit2Address, chainId) {
100
+ invariant__default.default(MaxSigDeadline >= BigInt(permit.sigDeadline), "SIG_DEADLINE_OUT_OF_RANGE");
101
+ const domain = permit2Domain(permit2Address, chainId);
102
+ if (isPermit(permit)) {
103
+ validatePermitDetails(permit.details);
104
+ return {
105
+ domain,
106
+ types: PERMIT_TYPES,
107
+ values: permit
108
+ };
109
+ }
110
+ permit.details.forEach(validatePermitDetails);
111
+ return {
112
+ domain,
113
+ types: PERMIT_BATCH_TYPES,
114
+ values: permit
115
+ };
116
+ }
117
+ };
118
+ function validatePermitDetails(details) {
119
+ invariant__default.default(MaxOrderedNonce >= BigInt(details.nonce), "NONCE_OUT_OF_RANGE");
120
+ invariant__default.default(MaxAllowanceTransferAmount >= BigInt(details.amount), "AMOUNT_OUT_OF_RANGE");
121
+ invariant__default.default(MaxAllowanceExpiration >= BigInt(details.expiration), "EXPIRATION_OUT_OF_RANGE");
122
+ }
123
+ var TOKEN_PERMISSIONS = [
124
+ { name: "token", type: "address" },
125
+ { name: "amount", type: "uint256" }
126
+ ];
127
+ var PERMIT_TRANSFER_FROM_TYPES = {
128
+ PermitTransferFrom: [
129
+ { name: "permitted", type: "TokenPermissions" },
130
+ { name: "spender", type: "address" },
131
+ { name: "nonce", type: "uint256" },
132
+ { name: "deadline", type: "uint256" }
133
+ ],
134
+ TokenPermissions: TOKEN_PERMISSIONS
135
+ };
136
+ var PERMIT_BATCH_TRANSFER_FROM_TYPES = {
137
+ PermitBatchTransferFrom: [
138
+ { name: "permitted", type: "TokenPermissions[]" },
139
+ { name: "spender", type: "address" },
140
+ { name: "nonce", type: "uint256" },
141
+ { name: "deadline", type: "uint256" }
142
+ ],
143
+ TokenPermissions: TOKEN_PERMISSIONS
144
+ };
145
+ function permitTransferFromWithWitnessType(witness) {
146
+ return {
147
+ PermitWitnessTransferFrom: [
148
+ { name: "permitted", type: "TokenPermissions" },
149
+ { name: "spender", type: "address" },
150
+ { name: "nonce", type: "uint256" },
151
+ { name: "deadline", type: "uint256" },
152
+ { name: "witness", type: witness.witnessTypeName }
153
+ ],
154
+ TokenPermissions: TOKEN_PERMISSIONS,
155
+ ...witness.witnessType
156
+ };
157
+ }
158
+ function permitBatchTransferFromWithWitnessType(witness) {
159
+ return {
160
+ PermitBatchWitnessTransferFrom: [
161
+ { name: "permitted", type: "TokenPermissions[]" },
162
+ { name: "spender", type: "address" },
163
+ { name: "nonce", type: "uint256" },
164
+ { name: "deadline", type: "uint256" },
165
+ { name: "witness", type: witness.witnessTypeName }
166
+ ],
167
+ TokenPermissions: TOKEN_PERMISSIONS,
168
+ ...witness.witnessType
169
+ };
170
+ }
171
+ function isPermitTransferFrom(permit) {
172
+ return !Array.isArray(permit.permitted);
173
+ }
174
+ var SignatureTransfer = class {
175
+ /**
176
+ * Cannot be constructed.
177
+ */
178
+ // eslint-disable-next-line no-useless-constructor
179
+ constructor() {
180
+ }
181
+ // return the data to be sent in a eth_signTypedData RPC call
182
+ // for signing the given permit data
183
+ static getPermitData(permit, permit2Address, chainId, witness) {
184
+ invariant__default.default(MaxSigDeadline >= BigInt(permit.deadline), "SIG_DEADLINE_OUT_OF_RANGE");
185
+ invariant__default.default(MaxUnorderedNonce >= BigInt(permit.nonce), "NONCE_OUT_OF_RANGE");
186
+ const domain = permit2Domain(permit2Address, chainId);
187
+ if (isPermitTransferFrom(permit)) {
188
+ validateTokenPermissions(permit.permitted);
189
+ const types2 = witness ? permitTransferFromWithWitnessType(witness) : PERMIT_TRANSFER_FROM_TYPES;
190
+ const values2 = witness ? Object.assign(permit, { witness: witness.witness }) : permit;
191
+ return {
192
+ domain,
193
+ types: types2,
194
+ values: values2
195
+ };
196
+ }
197
+ permit.permitted.forEach(validateTokenPermissions);
198
+ const types = witness ? permitBatchTransferFromWithWitnessType(witness) : PERMIT_BATCH_TRANSFER_FROM_TYPES;
199
+ const values = witness ? Object.assign(permit, { witness: witness.witness }) : permit;
200
+ return {
201
+ domain,
202
+ types,
203
+ values
204
+ };
205
+ }
206
+ };
207
+ function validateTokenPermissions(permissions) {
208
+ invariant__default.default(MaxSignatureTransferAmount >= BigInt(permissions.amount), "AMOUNT_OUT_OF_RANGE");
209
+ }
210
+
211
+ // src/utils/utils.ts
212
+ var toDeadline = (expiration) => {
213
+ return Math.floor((Date.now() + expiration) / 1e3);
214
+ };
215
+ var generatePermitTypedData = (token, nonce, spender) => {
216
+ return {
217
+ details: {
218
+ token: token.address,
219
+ amount: MaxAllowanceTransferAmount.toString(),
220
+ expiration: toDeadline(PERMIT_EXPIRATION).toString(),
221
+ nonce: nonce.toString()
222
+ },
223
+ spender,
224
+ sigDeadline: toDeadline(PERMIT_SIG_EXPIRATION).toString()
225
+ };
226
+ };
227
+
228
+ // src/abis/Permit2.ts
229
+ var Permit2ABI = [
230
+ {
231
+ inputs: [
232
+ {
233
+ internalType: "uint256",
234
+ name: "deadline",
235
+ type: "uint256"
236
+ }
237
+ ],
238
+ name: "AllowanceExpired",
239
+ type: "error"
240
+ },
241
+ {
242
+ inputs: [],
243
+ name: "ExcessiveInvalidation",
244
+ type: "error"
245
+ },
246
+ {
247
+ inputs: [
248
+ {
249
+ internalType: "uint256",
250
+ name: "amount",
251
+ type: "uint256"
252
+ }
253
+ ],
254
+ name: "InsufficientAllowance",
255
+ type: "error"
256
+ },
257
+ {
258
+ inputs: [
259
+ {
260
+ internalType: "uint256",
261
+ name: "maxAmount",
262
+ type: "uint256"
263
+ }
264
+ ],
265
+ name: "InvalidAmount",
266
+ type: "error"
267
+ },
268
+ {
269
+ inputs: [],
270
+ name: "InvalidContractSignature",
271
+ type: "error"
272
+ },
273
+ {
274
+ inputs: [],
275
+ name: "InvalidNonce",
276
+ type: "error"
277
+ },
278
+ {
279
+ inputs: [],
280
+ name: "InvalidSignature",
281
+ type: "error"
282
+ },
283
+ {
284
+ inputs: [],
285
+ name: "InvalidSignatureLength",
286
+ type: "error"
287
+ },
288
+ {
289
+ inputs: [],
290
+ name: "InvalidSigner",
291
+ type: "error"
292
+ },
293
+ {
294
+ inputs: [],
295
+ name: "LengthMismatch",
296
+ type: "error"
297
+ },
298
+ {
299
+ inputs: [
300
+ {
301
+ internalType: "uint256",
302
+ name: "signatureDeadline",
303
+ type: "uint256"
304
+ }
305
+ ],
306
+ name: "SignatureExpired",
307
+ type: "error"
308
+ },
309
+ {
310
+ anonymous: false,
311
+ inputs: [
312
+ {
313
+ indexed: true,
314
+ internalType: "address",
315
+ name: "owner",
316
+ type: "address"
317
+ },
318
+ {
319
+ indexed: true,
320
+ internalType: "address",
321
+ name: "token",
322
+ type: "address"
323
+ },
324
+ {
325
+ indexed: true,
326
+ internalType: "address",
327
+ name: "spender",
328
+ type: "address"
329
+ },
330
+ {
331
+ indexed: false,
332
+ internalType: "uint160",
333
+ name: "amount",
334
+ type: "uint160"
335
+ },
336
+ {
337
+ indexed: false,
338
+ internalType: "uint48",
339
+ name: "expiration",
340
+ type: "uint48"
341
+ }
342
+ ],
343
+ name: "Approval",
344
+ type: "event"
345
+ },
346
+ {
347
+ anonymous: false,
348
+ inputs: [
349
+ {
350
+ indexed: true,
351
+ internalType: "address",
352
+ name: "owner",
353
+ type: "address"
354
+ },
355
+ {
356
+ indexed: false,
357
+ internalType: "address",
358
+ name: "token",
359
+ type: "address"
360
+ },
361
+ {
362
+ indexed: false,
363
+ internalType: "address",
364
+ name: "spender",
365
+ type: "address"
366
+ }
367
+ ],
368
+ name: "Lockdown",
369
+ type: "event"
370
+ },
371
+ {
372
+ anonymous: false,
373
+ inputs: [
374
+ {
375
+ indexed: true,
376
+ internalType: "address",
377
+ name: "owner",
378
+ type: "address"
379
+ },
380
+ {
381
+ indexed: true,
382
+ internalType: "address",
383
+ name: "token",
384
+ type: "address"
385
+ },
386
+ {
387
+ indexed: true,
388
+ internalType: "address",
389
+ name: "spender",
390
+ type: "address"
391
+ },
392
+ {
393
+ indexed: false,
394
+ internalType: "uint48",
395
+ name: "newNonce",
396
+ type: "uint48"
397
+ },
398
+ {
399
+ indexed: false,
400
+ internalType: "uint48",
401
+ name: "oldNonce",
402
+ type: "uint48"
403
+ }
404
+ ],
405
+ name: "NonceInvalidation",
406
+ type: "event"
407
+ },
408
+ {
409
+ anonymous: false,
410
+ inputs: [
411
+ {
412
+ indexed: true,
413
+ internalType: "address",
414
+ name: "owner",
415
+ type: "address"
416
+ },
417
+ {
418
+ indexed: true,
419
+ internalType: "address",
420
+ name: "token",
421
+ type: "address"
422
+ },
423
+ {
424
+ indexed: true,
425
+ internalType: "address",
426
+ name: "spender",
427
+ type: "address"
428
+ },
429
+ {
430
+ indexed: false,
431
+ internalType: "uint160",
432
+ name: "amount",
433
+ type: "uint160"
434
+ },
435
+ {
436
+ indexed: false,
437
+ internalType: "uint48",
438
+ name: "expiration",
439
+ type: "uint48"
440
+ },
441
+ {
442
+ indexed: false,
443
+ internalType: "uint48",
444
+ name: "nonce",
445
+ type: "uint48"
446
+ }
447
+ ],
448
+ name: "Permit",
449
+ type: "event"
450
+ },
451
+ {
452
+ anonymous: false,
453
+ inputs: [
454
+ {
455
+ indexed: true,
456
+ internalType: "address",
457
+ name: "owner",
458
+ type: "address"
459
+ },
460
+ {
461
+ indexed: false,
462
+ internalType: "uint256",
463
+ name: "word",
464
+ type: "uint256"
465
+ },
466
+ {
467
+ indexed: false,
468
+ internalType: "uint256",
469
+ name: "mask",
470
+ type: "uint256"
471
+ }
472
+ ],
473
+ name: "UnorderedNonceInvalidation",
474
+ type: "event"
475
+ },
476
+ {
477
+ inputs: [],
478
+ name: "DOMAIN_SEPARATOR",
479
+ outputs: [
480
+ {
481
+ internalType: "bytes32",
482
+ name: "",
483
+ type: "bytes32"
484
+ }
485
+ ],
486
+ stateMutability: "view",
487
+ type: "function"
488
+ },
489
+ {
490
+ inputs: [
491
+ {
492
+ internalType: "address",
493
+ name: "",
494
+ type: "address"
495
+ },
496
+ {
497
+ internalType: "address",
498
+ name: "",
499
+ type: "address"
500
+ },
501
+ {
502
+ internalType: "address",
503
+ name: "",
504
+ type: "address"
505
+ }
506
+ ],
507
+ name: "allowance",
508
+ outputs: [
509
+ {
510
+ internalType: "uint160",
511
+ name: "amount",
512
+ type: "uint160"
513
+ },
514
+ {
515
+ internalType: "uint48",
516
+ name: "expiration",
517
+ type: "uint48"
518
+ },
519
+ {
520
+ internalType: "uint48",
521
+ name: "nonce",
522
+ type: "uint48"
523
+ }
524
+ ],
525
+ stateMutability: "view",
526
+ type: "function"
527
+ },
528
+ {
529
+ inputs: [
530
+ {
531
+ internalType: "address",
532
+ name: "token",
533
+ type: "address"
534
+ },
535
+ {
536
+ internalType: "address",
537
+ name: "spender",
538
+ type: "address"
539
+ },
540
+ {
541
+ internalType: "uint160",
542
+ name: "amount",
543
+ type: "uint160"
544
+ },
545
+ {
546
+ internalType: "uint48",
547
+ name: "expiration",
548
+ type: "uint48"
549
+ }
550
+ ],
551
+ name: "approve",
552
+ outputs: [],
553
+ stateMutability: "nonpayable",
554
+ type: "function"
555
+ },
556
+ {
557
+ inputs: [
558
+ {
559
+ internalType: "address",
560
+ name: "token",
561
+ type: "address"
562
+ },
563
+ {
564
+ internalType: "address",
565
+ name: "spender",
566
+ type: "address"
567
+ },
568
+ {
569
+ internalType: "uint48",
570
+ name: "newNonce",
571
+ type: "uint48"
572
+ }
573
+ ],
574
+ name: "invalidateNonces",
575
+ outputs: [],
576
+ stateMutability: "nonpayable",
577
+ type: "function"
578
+ },
579
+ {
580
+ inputs: [
581
+ {
582
+ internalType: "uint256",
583
+ name: "wordPos",
584
+ type: "uint256"
585
+ },
586
+ {
587
+ internalType: "uint256",
588
+ name: "mask",
589
+ type: "uint256"
590
+ }
591
+ ],
592
+ name: "invalidateUnorderedNonces",
593
+ outputs: [],
594
+ stateMutability: "nonpayable",
595
+ type: "function"
596
+ },
597
+ {
598
+ inputs: [
599
+ {
600
+ components: [
601
+ {
602
+ internalType: "address",
603
+ name: "token",
604
+ type: "address"
605
+ },
606
+ {
607
+ internalType: "address",
608
+ name: "spender",
609
+ type: "address"
610
+ }
611
+ ],
612
+ internalType: "struct IAllowanceTransfer.TokenSpenderPair[]",
613
+ name: "approvals",
614
+ type: "tuple[]"
615
+ }
616
+ ],
617
+ name: "lockdown",
618
+ outputs: [],
619
+ stateMutability: "nonpayable",
620
+ type: "function"
621
+ },
622
+ {
623
+ inputs: [
624
+ {
625
+ internalType: "address",
626
+ name: "",
627
+ type: "address"
628
+ },
629
+ {
630
+ internalType: "uint256",
631
+ name: "",
632
+ type: "uint256"
633
+ }
634
+ ],
635
+ name: "nonceBitmap",
636
+ outputs: [
637
+ {
638
+ internalType: "uint256",
639
+ name: "",
640
+ type: "uint256"
641
+ }
642
+ ],
643
+ stateMutability: "view",
644
+ type: "function"
645
+ },
646
+ {
647
+ inputs: [
648
+ {
649
+ internalType: "address",
650
+ name: "owner",
651
+ type: "address"
652
+ },
653
+ {
654
+ components: [
655
+ {
656
+ components: [
657
+ {
658
+ internalType: "address",
659
+ name: "token",
660
+ type: "address"
661
+ },
662
+ {
663
+ internalType: "uint160",
664
+ name: "amount",
665
+ type: "uint160"
666
+ },
667
+ {
668
+ internalType: "uint48",
669
+ name: "expiration",
670
+ type: "uint48"
671
+ },
672
+ {
673
+ internalType: "uint48",
674
+ name: "nonce",
675
+ type: "uint48"
676
+ }
677
+ ],
678
+ internalType: "struct IAllowanceTransfer.PermitDetails[]",
679
+ name: "details",
680
+ type: "tuple[]"
681
+ },
682
+ {
683
+ internalType: "address",
684
+ name: "spender",
685
+ type: "address"
686
+ },
687
+ {
688
+ internalType: "uint256",
689
+ name: "sigDeadline",
690
+ type: "uint256"
691
+ }
692
+ ],
693
+ internalType: "struct IAllowanceTransfer.PermitBatch",
694
+ name: "permitBatch",
695
+ type: "tuple"
696
+ },
697
+ {
698
+ internalType: "bytes",
699
+ name: "signature",
700
+ type: "bytes"
701
+ }
702
+ ],
703
+ name: "permit",
704
+ outputs: [],
705
+ stateMutability: "nonpayable",
706
+ type: "function"
707
+ },
708
+ {
709
+ inputs: [
710
+ {
711
+ internalType: "address",
712
+ name: "owner",
713
+ type: "address"
714
+ },
715
+ {
716
+ components: [
717
+ {
718
+ components: [
719
+ {
720
+ internalType: "address",
721
+ name: "token",
722
+ type: "address"
723
+ },
724
+ {
725
+ internalType: "uint160",
726
+ name: "amount",
727
+ type: "uint160"
728
+ },
729
+ {
730
+ internalType: "uint48",
731
+ name: "expiration",
732
+ type: "uint48"
733
+ },
734
+ {
735
+ internalType: "uint48",
736
+ name: "nonce",
737
+ type: "uint48"
738
+ }
739
+ ],
740
+ internalType: "struct IAllowanceTransfer.PermitDetails",
741
+ name: "details",
742
+ type: "tuple"
743
+ },
744
+ {
745
+ internalType: "address",
746
+ name: "spender",
747
+ type: "address"
748
+ },
749
+ {
750
+ internalType: "uint256",
751
+ name: "sigDeadline",
752
+ type: "uint256"
753
+ }
754
+ ],
755
+ internalType: "struct IAllowanceTransfer.PermitSingle",
756
+ name: "permitSingle",
757
+ type: "tuple"
758
+ },
759
+ {
760
+ internalType: "bytes",
761
+ name: "signature",
762
+ type: "bytes"
763
+ }
764
+ ],
765
+ name: "permit",
766
+ outputs: [],
767
+ stateMutability: "nonpayable",
768
+ type: "function"
769
+ },
770
+ {
771
+ inputs: [
772
+ {
773
+ components: [
774
+ {
775
+ components: [
776
+ {
777
+ internalType: "address",
778
+ name: "token",
779
+ type: "address"
780
+ },
781
+ {
782
+ internalType: "uint256",
783
+ name: "amount",
784
+ type: "uint256"
785
+ }
786
+ ],
787
+ internalType: "struct ISignatureTransfer.TokenPermissions",
788
+ name: "permitted",
789
+ type: "tuple"
790
+ },
791
+ {
792
+ internalType: "uint256",
793
+ name: "nonce",
794
+ type: "uint256"
795
+ },
796
+ {
797
+ internalType: "uint256",
798
+ name: "deadline",
799
+ type: "uint256"
800
+ }
801
+ ],
802
+ internalType: "struct ISignatureTransfer.PermitTransferFrom",
803
+ name: "permit",
804
+ type: "tuple"
805
+ },
806
+ {
807
+ components: [
808
+ {
809
+ internalType: "address",
810
+ name: "to",
811
+ type: "address"
812
+ },
813
+ {
814
+ internalType: "uint256",
815
+ name: "requestedAmount",
816
+ type: "uint256"
817
+ }
818
+ ],
819
+ internalType: "struct ISignatureTransfer.SignatureTransferDetails",
820
+ name: "transferDetails",
821
+ type: "tuple"
822
+ },
823
+ {
824
+ internalType: "address",
825
+ name: "owner",
826
+ type: "address"
827
+ },
828
+ {
829
+ internalType: "bytes",
830
+ name: "signature",
831
+ type: "bytes"
832
+ }
833
+ ],
834
+ name: "permitTransferFrom",
835
+ outputs: [],
836
+ stateMutability: "nonpayable",
837
+ type: "function"
838
+ },
839
+ {
840
+ inputs: [
841
+ {
842
+ components: [
843
+ {
844
+ components: [
845
+ {
846
+ internalType: "address",
847
+ name: "token",
848
+ type: "address"
849
+ },
850
+ {
851
+ internalType: "uint256",
852
+ name: "amount",
853
+ type: "uint256"
854
+ }
855
+ ],
856
+ internalType: "struct ISignatureTransfer.TokenPermissions[]",
857
+ name: "permitted",
858
+ type: "tuple[]"
859
+ },
860
+ {
861
+ internalType: "uint256",
862
+ name: "nonce",
863
+ type: "uint256"
864
+ },
865
+ {
866
+ internalType: "uint256",
867
+ name: "deadline",
868
+ type: "uint256"
869
+ }
870
+ ],
871
+ internalType: "struct ISignatureTransfer.PermitBatchTransferFrom",
872
+ name: "permit",
873
+ type: "tuple"
874
+ },
875
+ {
876
+ components: [
877
+ {
878
+ internalType: "address",
879
+ name: "to",
880
+ type: "address"
881
+ },
882
+ {
883
+ internalType: "uint256",
884
+ name: "requestedAmount",
885
+ type: "uint256"
886
+ }
887
+ ],
888
+ internalType: "struct ISignatureTransfer.SignatureTransferDetails[]",
889
+ name: "transferDetails",
890
+ type: "tuple[]"
891
+ },
892
+ {
893
+ internalType: "address",
894
+ name: "owner",
895
+ type: "address"
896
+ },
897
+ {
898
+ internalType: "bytes",
899
+ name: "signature",
900
+ type: "bytes"
901
+ }
902
+ ],
903
+ name: "permitTransferFrom",
904
+ outputs: [],
905
+ stateMutability: "nonpayable",
906
+ type: "function"
907
+ },
908
+ {
909
+ inputs: [
910
+ {
911
+ components: [
912
+ {
913
+ components: [
914
+ {
915
+ internalType: "address",
916
+ name: "token",
917
+ type: "address"
918
+ },
919
+ {
920
+ internalType: "uint256",
921
+ name: "amount",
922
+ type: "uint256"
923
+ }
924
+ ],
925
+ internalType: "struct ISignatureTransfer.TokenPermissions",
926
+ name: "permitted",
927
+ type: "tuple"
928
+ },
929
+ {
930
+ internalType: "uint256",
931
+ name: "nonce",
932
+ type: "uint256"
933
+ },
934
+ {
935
+ internalType: "uint256",
936
+ name: "deadline",
937
+ type: "uint256"
938
+ }
939
+ ],
940
+ internalType: "struct ISignatureTransfer.PermitTransferFrom",
941
+ name: "permit",
942
+ type: "tuple"
943
+ },
944
+ {
945
+ components: [
946
+ {
947
+ internalType: "address",
948
+ name: "to",
949
+ type: "address"
950
+ },
951
+ {
952
+ internalType: "uint256",
953
+ name: "requestedAmount",
954
+ type: "uint256"
955
+ }
956
+ ],
957
+ internalType: "struct ISignatureTransfer.SignatureTransferDetails",
958
+ name: "transferDetails",
959
+ type: "tuple"
960
+ },
961
+ {
962
+ internalType: "address",
963
+ name: "owner",
964
+ type: "address"
965
+ },
966
+ {
967
+ internalType: "bytes32",
968
+ name: "witness",
969
+ type: "bytes32"
970
+ },
971
+ {
972
+ internalType: "string",
973
+ name: "witnessTypeString",
974
+ type: "string"
975
+ },
976
+ {
977
+ internalType: "bytes",
978
+ name: "signature",
979
+ type: "bytes"
980
+ }
981
+ ],
982
+ name: "permitWitnessTransferFrom",
983
+ outputs: [],
984
+ stateMutability: "nonpayable",
985
+ type: "function"
986
+ },
987
+ {
988
+ inputs: [
989
+ {
990
+ components: [
991
+ {
992
+ components: [
993
+ {
994
+ internalType: "address",
995
+ name: "token",
996
+ type: "address"
997
+ },
998
+ {
999
+ internalType: "uint256",
1000
+ name: "amount",
1001
+ type: "uint256"
1002
+ }
1003
+ ],
1004
+ internalType: "struct ISignatureTransfer.TokenPermissions[]",
1005
+ name: "permitted",
1006
+ type: "tuple[]"
1007
+ },
1008
+ {
1009
+ internalType: "uint256",
1010
+ name: "nonce",
1011
+ type: "uint256"
1012
+ },
1013
+ {
1014
+ internalType: "uint256",
1015
+ name: "deadline",
1016
+ type: "uint256"
1017
+ }
1018
+ ],
1019
+ internalType: "struct ISignatureTransfer.PermitBatchTransferFrom",
1020
+ name: "permit",
1021
+ type: "tuple"
1022
+ },
1023
+ {
1024
+ components: [
1025
+ {
1026
+ internalType: "address",
1027
+ name: "to",
1028
+ type: "address"
1029
+ },
1030
+ {
1031
+ internalType: "uint256",
1032
+ name: "requestedAmount",
1033
+ type: "uint256"
1034
+ }
1035
+ ],
1036
+ internalType: "struct ISignatureTransfer.SignatureTransferDetails[]",
1037
+ name: "transferDetails",
1038
+ type: "tuple[]"
1039
+ },
1040
+ {
1041
+ internalType: "address",
1042
+ name: "owner",
1043
+ type: "address"
1044
+ },
1045
+ {
1046
+ internalType: "bytes32",
1047
+ name: "witness",
1048
+ type: "bytes32"
1049
+ },
1050
+ {
1051
+ internalType: "string",
1052
+ name: "witnessTypeString",
1053
+ type: "string"
1054
+ },
1055
+ {
1056
+ internalType: "bytes",
1057
+ name: "signature",
1058
+ type: "bytes"
1059
+ }
1060
+ ],
1061
+ name: "permitWitnessTransferFrom",
1062
+ outputs: [],
1063
+ stateMutability: "nonpayable",
1064
+ type: "function"
1065
+ },
1066
+ {
1067
+ inputs: [
1068
+ {
1069
+ components: [
1070
+ {
1071
+ internalType: "address",
1072
+ name: "from",
1073
+ type: "address"
1074
+ },
1075
+ {
1076
+ internalType: "address",
1077
+ name: "to",
1078
+ type: "address"
1079
+ },
1080
+ {
1081
+ internalType: "uint160",
1082
+ name: "amount",
1083
+ type: "uint160"
1084
+ },
1085
+ {
1086
+ internalType: "address",
1087
+ name: "token",
1088
+ type: "address"
1089
+ }
1090
+ ],
1091
+ internalType: "struct IAllowanceTransfer.AllowanceTransferDetails[]",
1092
+ name: "transferDetails",
1093
+ type: "tuple[]"
1094
+ }
1095
+ ],
1096
+ name: "transferFrom",
1097
+ outputs: [],
1098
+ stateMutability: "nonpayable",
1099
+ type: "function"
1100
+ },
1101
+ {
1102
+ inputs: [
1103
+ {
1104
+ internalType: "address",
1105
+ name: "from",
1106
+ type: "address"
1107
+ },
1108
+ {
1109
+ internalType: "address",
1110
+ name: "to",
1111
+ type: "address"
1112
+ },
1113
+ {
1114
+ internalType: "uint160",
1115
+ name: "amount",
1116
+ type: "uint160"
1117
+ },
1118
+ {
1119
+ internalType: "address",
1120
+ name: "token",
1121
+ type: "address"
1122
+ }
1123
+ ],
1124
+ name: "transferFrom",
1125
+ outputs: [],
1126
+ stateMutability: "nonpayable",
1127
+ type: "function"
1128
+ }
1129
+ ];
1130
+
1131
+ exports.AllowanceTransfer = AllowanceTransfer;
1132
+ exports.InstantExpiration = InstantExpiration;
1133
+ exports.MaxAllowanceExpiration = MaxAllowanceExpiration;
1134
+ exports.MaxAllowanceTransferAmount = MaxAllowanceTransferAmount;
1135
+ exports.MaxOrderedNonce = MaxOrderedNonce;
1136
+ exports.MaxSigDeadline = MaxSigDeadline;
1137
+ exports.MaxSignatureTransferAmount = MaxSignatureTransferAmount;
1138
+ exports.MaxUint160 = MaxUint160;
1139
+ exports.MaxUint256 = MaxUint256;
1140
+ exports.MaxUint48 = MaxUint48;
1141
+ exports.MaxUnorderedNonce = MaxUnorderedNonce;
1142
+ exports.PERMIT_EXPIRATION = PERMIT_EXPIRATION;
1143
+ exports.PERMIT_SIG_EXPIRATION = PERMIT_SIG_EXPIRATION;
1144
+ exports.Permit2ABI = Permit2ABI;
1145
+ exports.SignatureTransfer = SignatureTransfer;
1146
+ exports.generatePermitTypedData = generatePermitTypedData;
1147
+ exports.getPermit2Address = getPermit2Address;
1148
+ exports.toDeadline = toDeadline;