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