@huuduynvc/permit2-sdk 1.3.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.
@@ -0,0 +1,1566 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
+
7
+ var invariant = _interopDefault(require('tiny-invariant'));
8
+ var hash = require('@ethersproject/hash');
9
+ var bignumber = require('@ethersproject/bignumber');
10
+ var contracts = require('@ethersproject/contracts');
11
+
12
+ // @deprecated please use permit2Address(chainId: number)
13
+ var PERMIT2_ADDRESS = '0x000000000022D473030F116dDEE9F6B43aC78BA3';
14
+ function permit2Address(chainId) {
15
+ switch (chainId) {
16
+ case 324:
17
+ return '0x0000000000225e31D15943971F47aD3022F714Fa';
18
+ default:
19
+ return PERMIT2_ADDRESS;
20
+ }
21
+ }
22
+ var MaxUint48 = /*#__PURE__*/bignumber.BigNumber.from('0xffffffffffff');
23
+ var MaxUint160 = /*#__PURE__*/bignumber.BigNumber.from('0xffffffffffffffffffffffffffffffffffffffff');
24
+ var MaxUint256 = /*#__PURE__*/bignumber.BigNumber.from('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
25
+ // alias max types for their usages
26
+ // allowance transfer types
27
+ var MaxAllowanceTransferAmount = MaxUint160;
28
+ var MaxAllowanceExpiration = MaxUint48;
29
+ var MaxOrderedNonce = MaxUint48;
30
+ // signature transfer types
31
+ var MaxSignatureTransferAmount = MaxUint256;
32
+ var MaxUnorderedNonce = MaxUint256;
33
+ var MaxSigDeadline = MaxUint256;
34
+ var InstantExpiration = /*#__PURE__*/bignumber.BigNumber.from(0);
35
+
36
+ var PERMIT2_DOMAIN_NAME = 'Permit2';
37
+ function permit2Domain(permit2Address, chainId) {
38
+ return {
39
+ name: PERMIT2_DOMAIN_NAME,
40
+ chainId: chainId,
41
+ verifyingContract: permit2Address
42
+ };
43
+ }
44
+
45
+ var PERMIT_DETAILS = [{
46
+ name: 'token',
47
+ type: 'address'
48
+ }, {
49
+ name: 'amount',
50
+ type: 'uint160'
51
+ }, {
52
+ name: 'expiration',
53
+ type: 'uint48'
54
+ }, {
55
+ name: 'nonce',
56
+ type: 'uint48'
57
+ }];
58
+ var PERMIT_TYPES = {
59
+ PermitSingle: [{
60
+ name: 'details',
61
+ type: 'PermitDetails'
62
+ }, {
63
+ name: 'spender',
64
+ type: 'address'
65
+ }, {
66
+ name: 'sigDeadline',
67
+ type: 'uint256'
68
+ }],
69
+ PermitDetails: PERMIT_DETAILS
70
+ };
71
+ var PERMIT_BATCH_TYPES = {
72
+ PermitBatch: [{
73
+ name: 'details',
74
+ type: 'PermitDetails[]'
75
+ }, {
76
+ name: 'spender',
77
+ type: 'address'
78
+ }, {
79
+ name: 'sigDeadline',
80
+ type: 'uint256'
81
+ }],
82
+ PermitDetails: PERMIT_DETAILS
83
+ };
84
+ function isPermit(permit) {
85
+ return !Array.isArray(permit.details);
86
+ }
87
+ var AllowanceTransfer = /*#__PURE__*/function () {
88
+ /**
89
+ * Cannot be constructed.
90
+ */
91
+ function AllowanceTransfer() {}
92
+ // return the data to be sent in a eth_signTypedData RPC call
93
+ // for signing the given permit data
94
+ AllowanceTransfer.getPermitData = function getPermitData(permit, permit2Address, chainId) {
95
+ !MaxSigDeadline.gte(permit.sigDeadline) ? invariant(false, 'SIG_DEADLINE_OUT_OF_RANGE') : void 0;
96
+ var domain = permit2Domain(permit2Address, chainId);
97
+ if (isPermit(permit)) {
98
+ validatePermitDetails(permit.details);
99
+ return {
100
+ domain: domain,
101
+ types: PERMIT_TYPES,
102
+ values: permit
103
+ };
104
+ } else {
105
+ permit.details.forEach(validatePermitDetails);
106
+ return {
107
+ domain: domain,
108
+ types: PERMIT_BATCH_TYPES,
109
+ values: permit
110
+ };
111
+ }
112
+ };
113
+ AllowanceTransfer.hash = function hash$1(permit, permit2Address, chainId) {
114
+ var _AllowanceTransfer$ge = AllowanceTransfer.getPermitData(permit, permit2Address, chainId),
115
+ domain = _AllowanceTransfer$ge.domain,
116
+ types = _AllowanceTransfer$ge.types,
117
+ values = _AllowanceTransfer$ge.values;
118
+ return hash._TypedDataEncoder.hash(domain, types, values);
119
+ };
120
+ return AllowanceTransfer;
121
+ }();
122
+ function validatePermitDetails(details) {
123
+ !MaxOrderedNonce.gte(details.nonce) ? invariant(false, 'NONCE_OUT_OF_RANGE') : void 0;
124
+ !MaxAllowanceTransferAmount.gte(details.amount) ? invariant(false, 'AMOUNT_OUT_OF_RANGE') : void 0;
125
+ !MaxAllowanceExpiration.gte(details.expiration) ? invariant(false, 'EXPIRATION_OUT_OF_RANGE') : void 0;
126
+ }
127
+
128
+ function _regeneratorRuntime() {
129
+ _regeneratorRuntime = function () {
130
+ return e;
131
+ };
132
+ var t,
133
+ e = {},
134
+ r = Object.prototype,
135
+ n = r.hasOwnProperty,
136
+ o = Object.defineProperty || function (t, e, r) {
137
+ t[e] = r.value;
138
+ },
139
+ i = "function" == typeof Symbol ? Symbol : {},
140
+ a = i.iterator || "@@iterator",
141
+ c = i.asyncIterator || "@@asyncIterator",
142
+ u = i.toStringTag || "@@toStringTag";
143
+ function define(t, e, r) {
144
+ return Object.defineProperty(t, e, {
145
+ value: r,
146
+ enumerable: !0,
147
+ configurable: !0,
148
+ writable: !0
149
+ }), t[e];
150
+ }
151
+ try {
152
+ define({}, "");
153
+ } catch (t) {
154
+ define = function (t, e, r) {
155
+ return t[e] = r;
156
+ };
157
+ }
158
+ function wrap(t, e, r, n) {
159
+ var i = e && e.prototype instanceof Generator ? e : Generator,
160
+ a = Object.create(i.prototype),
161
+ c = new Context(n || []);
162
+ return o(a, "_invoke", {
163
+ value: makeInvokeMethod(t, r, c)
164
+ }), a;
165
+ }
166
+ function tryCatch(t, e, r) {
167
+ try {
168
+ return {
169
+ type: "normal",
170
+ arg: t.call(e, r)
171
+ };
172
+ } catch (t) {
173
+ return {
174
+ type: "throw",
175
+ arg: t
176
+ };
177
+ }
178
+ }
179
+ e.wrap = wrap;
180
+ var h = "suspendedStart",
181
+ l = "suspendedYield",
182
+ f = "executing",
183
+ s = "completed",
184
+ y = {};
185
+ function Generator() {}
186
+ function GeneratorFunction() {}
187
+ function GeneratorFunctionPrototype() {}
188
+ var p = {};
189
+ define(p, a, function () {
190
+ return this;
191
+ });
192
+ var d = Object.getPrototypeOf,
193
+ v = d && d(d(values([])));
194
+ v && v !== r && n.call(v, a) && (p = v);
195
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
196
+ function defineIteratorMethods(t) {
197
+ ["next", "throw", "return"].forEach(function (e) {
198
+ define(t, e, function (t) {
199
+ return this._invoke(e, t);
200
+ });
201
+ });
202
+ }
203
+ function AsyncIterator(t, e) {
204
+ function invoke(r, o, i, a) {
205
+ var c = tryCatch(t[r], t, o);
206
+ if ("throw" !== c.type) {
207
+ var u = c.arg,
208
+ h = u.value;
209
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
210
+ invoke("next", t, i, a);
211
+ }, function (t) {
212
+ invoke("throw", t, i, a);
213
+ }) : e.resolve(h).then(function (t) {
214
+ u.value = t, i(u);
215
+ }, function (t) {
216
+ return invoke("throw", t, i, a);
217
+ });
218
+ }
219
+ a(c.arg);
220
+ }
221
+ var r;
222
+ o(this, "_invoke", {
223
+ value: function (t, n) {
224
+ function callInvokeWithMethodAndArg() {
225
+ return new e(function (e, r) {
226
+ invoke(t, n, e, r);
227
+ });
228
+ }
229
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
230
+ }
231
+ });
232
+ }
233
+ function makeInvokeMethod(e, r, n) {
234
+ var o = h;
235
+ return function (i, a) {
236
+ if (o === f) throw new Error("Generator is already running");
237
+ if (o === s) {
238
+ if ("throw" === i) throw a;
239
+ return {
240
+ value: t,
241
+ done: !0
242
+ };
243
+ }
244
+ for (n.method = i, n.arg = a;;) {
245
+ var c = n.delegate;
246
+ if (c) {
247
+ var u = maybeInvokeDelegate(c, n);
248
+ if (u) {
249
+ if (u === y) continue;
250
+ return u;
251
+ }
252
+ }
253
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
254
+ if (o === h) throw o = s, n.arg;
255
+ n.dispatchException(n.arg);
256
+ } else "return" === n.method && n.abrupt("return", n.arg);
257
+ o = f;
258
+ var p = tryCatch(e, r, n);
259
+ if ("normal" === p.type) {
260
+ if (o = n.done ? s : l, p.arg === y) continue;
261
+ return {
262
+ value: p.arg,
263
+ done: n.done
264
+ };
265
+ }
266
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
267
+ }
268
+ };
269
+ }
270
+ function maybeInvokeDelegate(e, r) {
271
+ var n = r.method,
272
+ o = e.iterator[n];
273
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
274
+ var i = tryCatch(o, e.iterator, r.arg);
275
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
276
+ var a = i.arg;
277
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
278
+ }
279
+ function pushTryEntry(t) {
280
+ var e = {
281
+ tryLoc: t[0]
282
+ };
283
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
284
+ }
285
+ function resetTryEntry(t) {
286
+ var e = t.completion || {};
287
+ e.type = "normal", delete e.arg, t.completion = e;
288
+ }
289
+ function Context(t) {
290
+ this.tryEntries = [{
291
+ tryLoc: "root"
292
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
293
+ }
294
+ function values(e) {
295
+ if (e || "" === e) {
296
+ var r = e[a];
297
+ if (r) return r.call(e);
298
+ if ("function" == typeof e.next) return e;
299
+ if (!isNaN(e.length)) {
300
+ var o = -1,
301
+ i = function next() {
302
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
303
+ return next.value = t, next.done = !0, next;
304
+ };
305
+ return i.next = i;
306
+ }
307
+ }
308
+ throw new TypeError(typeof e + " is not iterable");
309
+ }
310
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
311
+ value: GeneratorFunctionPrototype,
312
+ configurable: !0
313
+ }), o(GeneratorFunctionPrototype, "constructor", {
314
+ value: GeneratorFunction,
315
+ configurable: !0
316
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
317
+ var e = "function" == typeof t && t.constructor;
318
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
319
+ }, e.mark = function (t) {
320
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
321
+ }, e.awrap = function (t) {
322
+ return {
323
+ __await: t
324
+ };
325
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
326
+ return this;
327
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
328
+ void 0 === i && (i = Promise);
329
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
330
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
331
+ return t.done ? t.value : a.next();
332
+ });
333
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
334
+ return this;
335
+ }), define(g, "toString", function () {
336
+ return "[object Generator]";
337
+ }), e.keys = function (t) {
338
+ var e = Object(t),
339
+ r = [];
340
+ for (var n in e) r.push(n);
341
+ return r.reverse(), function next() {
342
+ for (; r.length;) {
343
+ var t = r.pop();
344
+ if (t in e) return next.value = t, next.done = !1, next;
345
+ }
346
+ return next.done = !0, next;
347
+ };
348
+ }, e.values = values, Context.prototype = {
349
+ constructor: Context,
350
+ reset: function (e) {
351
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
352
+ },
353
+ stop: function () {
354
+ this.done = !0;
355
+ var t = this.tryEntries[0].completion;
356
+ if ("throw" === t.type) throw t.arg;
357
+ return this.rval;
358
+ },
359
+ dispatchException: function (e) {
360
+ if (this.done) throw e;
361
+ var r = this;
362
+ function handle(n, o) {
363
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
364
+ }
365
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
366
+ var i = this.tryEntries[o],
367
+ a = i.completion;
368
+ if ("root" === i.tryLoc) return handle("end");
369
+ if (i.tryLoc <= this.prev) {
370
+ var c = n.call(i, "catchLoc"),
371
+ u = n.call(i, "finallyLoc");
372
+ if (c && u) {
373
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
374
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
375
+ } else if (c) {
376
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
377
+ } else {
378
+ if (!u) throw new Error("try statement without catch or finally");
379
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
380
+ }
381
+ }
382
+ }
383
+ },
384
+ abrupt: function (t, e) {
385
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
386
+ var o = this.tryEntries[r];
387
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
388
+ var i = o;
389
+ break;
390
+ }
391
+ }
392
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
393
+ var a = i ? i.completion : {};
394
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
395
+ },
396
+ complete: function (t, e) {
397
+ if ("throw" === t.type) throw t.arg;
398
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
399
+ },
400
+ finish: function (t) {
401
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
402
+ var r = this.tryEntries[e];
403
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
404
+ }
405
+ },
406
+ catch: function (t) {
407
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
408
+ var r = this.tryEntries[e];
409
+ if (r.tryLoc === t) {
410
+ var n = r.completion;
411
+ if ("throw" === n.type) {
412
+ var o = n.arg;
413
+ resetTryEntry(r);
414
+ }
415
+ return o;
416
+ }
417
+ }
418
+ throw new Error("illegal catch attempt");
419
+ },
420
+ delegateYield: function (e, r, n) {
421
+ return this.delegate = {
422
+ iterator: values(e),
423
+ resultName: r,
424
+ nextLoc: n
425
+ }, "next" === this.method && (this.arg = t), y;
426
+ }
427
+ }, e;
428
+ }
429
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
430
+ try {
431
+ var info = gen[key](arg);
432
+ var value = info.value;
433
+ } catch (error) {
434
+ reject(error);
435
+ return;
436
+ }
437
+ if (info.done) {
438
+ resolve(value);
439
+ } else {
440
+ Promise.resolve(value).then(_next, _throw);
441
+ }
442
+ }
443
+ function _asyncToGenerator(fn) {
444
+ return function () {
445
+ var self = this,
446
+ args = arguments;
447
+ return new Promise(function (resolve, reject) {
448
+ var gen = fn.apply(self, args);
449
+ function _next(value) {
450
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
451
+ }
452
+ function _throw(err) {
453
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
454
+ }
455
+ _next(undefined);
456
+ });
457
+ };
458
+ }
459
+ function _extends() {
460
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
461
+ for (var i = 1; i < arguments.length; i++) {
462
+ var source = arguments[i];
463
+ for (var key in source) {
464
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
465
+ target[key] = source[key];
466
+ }
467
+ }
468
+ }
469
+ return target;
470
+ };
471
+ return _extends.apply(this, arguments);
472
+ }
473
+
474
+ var TOKEN_PERMISSIONS = [{
475
+ name: 'token',
476
+ type: 'address'
477
+ }, {
478
+ name: 'amount',
479
+ type: 'uint256'
480
+ }];
481
+ var PERMIT_TRANSFER_FROM_TYPES = {
482
+ PermitTransferFrom: [{
483
+ name: 'permitted',
484
+ type: 'TokenPermissions'
485
+ }, {
486
+ name: 'spender',
487
+ type: 'address'
488
+ }, {
489
+ name: 'nonce',
490
+ type: 'uint256'
491
+ }, {
492
+ name: 'deadline',
493
+ type: 'uint256'
494
+ }],
495
+ TokenPermissions: TOKEN_PERMISSIONS
496
+ };
497
+ var PERMIT_BATCH_TRANSFER_FROM_TYPES = {
498
+ PermitBatchTransferFrom: [{
499
+ name: 'permitted',
500
+ type: 'TokenPermissions[]'
501
+ }, {
502
+ name: 'spender',
503
+ type: 'address'
504
+ }, {
505
+ name: 'nonce',
506
+ type: 'uint256'
507
+ }, {
508
+ name: 'deadline',
509
+ type: 'uint256'
510
+ }],
511
+ TokenPermissions: TOKEN_PERMISSIONS
512
+ };
513
+ function permitTransferFromWithWitnessType(witness) {
514
+ return _extends({
515
+ PermitWitnessTransferFrom: [{
516
+ name: 'permitted',
517
+ type: 'TokenPermissions'
518
+ }, {
519
+ name: 'spender',
520
+ type: 'address'
521
+ }, {
522
+ name: 'nonce',
523
+ type: 'uint256'
524
+ }, {
525
+ name: 'deadline',
526
+ type: 'uint256'
527
+ }, {
528
+ name: 'witness',
529
+ type: witness.witnessTypeName
530
+ }],
531
+ TokenPermissions: TOKEN_PERMISSIONS
532
+ }, witness.witnessType);
533
+ }
534
+ function permitBatchTransferFromWithWitnessType(witness) {
535
+ return _extends({
536
+ PermitBatchWitnessTransferFrom: [{
537
+ name: 'permitted',
538
+ type: 'TokenPermissions[]'
539
+ }, {
540
+ name: 'spender',
541
+ type: 'address'
542
+ }, {
543
+ name: 'nonce',
544
+ type: 'uint256'
545
+ }, {
546
+ name: 'deadline',
547
+ type: 'uint256'
548
+ }, {
549
+ name: 'witness',
550
+ type: witness.witnessTypeName
551
+ }],
552
+ TokenPermissions: TOKEN_PERMISSIONS
553
+ }, witness.witnessType);
554
+ }
555
+ function isPermitTransferFrom(permit) {
556
+ return !Array.isArray(permit.permitted);
557
+ }
558
+ var SignatureTransfer = /*#__PURE__*/function () {
559
+ /**
560
+ * Cannot be constructed.
561
+ */
562
+ function SignatureTransfer() {}
563
+ // return the data to be sent in a eth_signTypedData RPC call
564
+ // for signing the given permit data
565
+ SignatureTransfer.getPermitData = function getPermitData(permit, permit2Address, chainId, witness) {
566
+ !MaxSigDeadline.gte(permit.deadline) ? invariant(false, 'SIG_DEADLINE_OUT_OF_RANGE') : void 0;
567
+ !MaxUnorderedNonce.gte(permit.nonce) ? invariant(false, 'NONCE_OUT_OF_RANGE') : void 0;
568
+ var domain = permit2Domain(permit2Address, chainId);
569
+ if (isPermitTransferFrom(permit)) {
570
+ validateTokenPermissions(permit.permitted);
571
+ var types = witness ? permitTransferFromWithWitnessType(witness) : PERMIT_TRANSFER_FROM_TYPES;
572
+ var values = witness ? Object.assign(permit, {
573
+ witness: witness.witness
574
+ }) : permit;
575
+ return {
576
+ domain: domain,
577
+ types: types,
578
+ values: values
579
+ };
580
+ } else {
581
+ permit.permitted.forEach(validateTokenPermissions);
582
+ var _types = witness ? permitBatchTransferFromWithWitnessType(witness) : PERMIT_BATCH_TRANSFER_FROM_TYPES;
583
+ var _values = witness ? Object.assign(permit, {
584
+ witness: witness.witness
585
+ }) : permit;
586
+ return {
587
+ domain: domain,
588
+ types: _types,
589
+ values: _values
590
+ };
591
+ }
592
+ };
593
+ SignatureTransfer.hash = function hash$1(permit, permit2Address, chainId, witness) {
594
+ var _SignatureTransfer$ge = SignatureTransfer.getPermitData(permit, permit2Address, chainId, witness),
595
+ domain = _SignatureTransfer$ge.domain,
596
+ types = _SignatureTransfer$ge.types,
597
+ values = _SignatureTransfer$ge.values;
598
+ return hash._TypedDataEncoder.hash(domain, types, values);
599
+ };
600
+ return SignatureTransfer;
601
+ }();
602
+ function validateTokenPermissions(permissions) {
603
+ !MaxSignatureTransferAmount.gte(permissions.amount) ? invariant(false, 'AMOUNT_OUT_OF_RANGE') : void 0;
604
+ }
605
+
606
+ var Permit2Abi = [
607
+ {
608
+ inputs: [
609
+ ],
610
+ name: "AllowanceExpired",
611
+ type: "error"
612
+ },
613
+ {
614
+ inputs: [
615
+ ],
616
+ name: "ExcessiveInvalidation",
617
+ type: "error"
618
+ },
619
+ {
620
+ inputs: [
621
+ ],
622
+ name: "InsufficientAllowance",
623
+ type: "error"
624
+ },
625
+ {
626
+ inputs: [
627
+ ],
628
+ name: "InvalidAmount",
629
+ type: "error"
630
+ },
631
+ {
632
+ inputs: [
633
+ ],
634
+ name: "InvalidContractSignature",
635
+ type: "error"
636
+ },
637
+ {
638
+ inputs: [
639
+ ],
640
+ name: "InvalidNonce",
641
+ type: "error"
642
+ },
643
+ {
644
+ inputs: [
645
+ ],
646
+ name: "InvalidSignature",
647
+ type: "error"
648
+ },
649
+ {
650
+ inputs: [
651
+ ],
652
+ name: "InvalidSigner",
653
+ type: "error"
654
+ },
655
+ {
656
+ inputs: [
657
+ ],
658
+ name: "LengthMismatch",
659
+ type: "error"
660
+ },
661
+ {
662
+ inputs: [
663
+ ],
664
+ name: "NotSpender",
665
+ type: "error"
666
+ },
667
+ {
668
+ inputs: [
669
+ ],
670
+ name: "SignatureExpired",
671
+ type: "error"
672
+ },
673
+ {
674
+ anonymous: false,
675
+ inputs: [
676
+ {
677
+ indexed: true,
678
+ internalType: "address",
679
+ name: "owner",
680
+ type: "address"
681
+ },
682
+ {
683
+ indexed: true,
684
+ internalType: "address",
685
+ name: "token",
686
+ type: "address"
687
+ },
688
+ {
689
+ indexed: true,
690
+ internalType: "address",
691
+ name: "spender",
692
+ type: "address"
693
+ },
694
+ {
695
+ indexed: false,
696
+ internalType: "uint160",
697
+ name: "amount",
698
+ type: "uint160"
699
+ },
700
+ {
701
+ indexed: false,
702
+ internalType: "uint48",
703
+ name: "expiration",
704
+ type: "uint48"
705
+ }
706
+ ],
707
+ name: "Approval",
708
+ type: "event"
709
+ },
710
+ {
711
+ anonymous: false,
712
+ inputs: [
713
+ {
714
+ indexed: true,
715
+ internalType: "address",
716
+ name: "owner",
717
+ type: "address"
718
+ },
719
+ {
720
+ indexed: false,
721
+ internalType: "address",
722
+ name: "token",
723
+ type: "address"
724
+ },
725
+ {
726
+ indexed: false,
727
+ internalType: "address",
728
+ name: "spender",
729
+ type: "address"
730
+ }
731
+ ],
732
+ name: "Lockdown",
733
+ type: "event"
734
+ },
735
+ {
736
+ anonymous: false,
737
+ inputs: [
738
+ {
739
+ indexed: true,
740
+ internalType: "address",
741
+ name: "owner",
742
+ type: "address"
743
+ },
744
+ {
745
+ indexed: true,
746
+ internalType: "address",
747
+ name: "token",
748
+ type: "address"
749
+ },
750
+ {
751
+ indexed: true,
752
+ internalType: "address",
753
+ name: "spender",
754
+ type: "address"
755
+ },
756
+ {
757
+ indexed: false,
758
+ internalType: "uint48",
759
+ name: "newNonce",
760
+ type: "uint48"
761
+ },
762
+ {
763
+ indexed: false,
764
+ internalType: "uint48",
765
+ name: "oldNonce",
766
+ type: "uint48"
767
+ }
768
+ ],
769
+ name: "NonceInvalidation",
770
+ type: "event"
771
+ },
772
+ {
773
+ anonymous: false,
774
+ inputs: [
775
+ {
776
+ indexed: true,
777
+ internalType: "address",
778
+ name: "owner",
779
+ type: "address"
780
+ },
781
+ {
782
+ indexed: false,
783
+ internalType: "uint256",
784
+ name: "word",
785
+ type: "uint256"
786
+ },
787
+ {
788
+ indexed: false,
789
+ internalType: "uint256",
790
+ name: "mask",
791
+ type: "uint256"
792
+ }
793
+ ],
794
+ name: "UnorderedNonceInvalidation",
795
+ type: "event"
796
+ },
797
+ {
798
+ inputs: [
799
+ ],
800
+ name: "DOMAIN_SEPARATOR",
801
+ outputs: [
802
+ {
803
+ internalType: "bytes32",
804
+ name: "",
805
+ type: "bytes32"
806
+ }
807
+ ],
808
+ stateMutability: "view",
809
+ type: "function"
810
+ },
811
+ {
812
+ inputs: [
813
+ {
814
+ internalType: "address",
815
+ name: "",
816
+ type: "address"
817
+ },
818
+ {
819
+ internalType: "address",
820
+ name: "",
821
+ type: "address"
822
+ },
823
+ {
824
+ internalType: "address",
825
+ name: "",
826
+ type: "address"
827
+ }
828
+ ],
829
+ name: "allowance",
830
+ outputs: [
831
+ {
832
+ internalType: "uint160",
833
+ name: "amount",
834
+ type: "uint160"
835
+ },
836
+ {
837
+ internalType: "uint48",
838
+ name: "expiration",
839
+ type: "uint48"
840
+ },
841
+ {
842
+ internalType: "uint48",
843
+ name: "nonce",
844
+ type: "uint48"
845
+ }
846
+ ],
847
+ stateMutability: "view",
848
+ type: "function"
849
+ },
850
+ {
851
+ inputs: [
852
+ {
853
+ internalType: "address",
854
+ name: "token",
855
+ type: "address"
856
+ },
857
+ {
858
+ internalType: "address",
859
+ name: "spender",
860
+ type: "address"
861
+ },
862
+ {
863
+ internalType: "uint160",
864
+ name: "amount",
865
+ type: "uint160"
866
+ },
867
+ {
868
+ internalType: "uint48",
869
+ name: "expiration",
870
+ type: "uint48"
871
+ }
872
+ ],
873
+ name: "approve",
874
+ outputs: [
875
+ ],
876
+ stateMutability: "nonpayable",
877
+ type: "function"
878
+ },
879
+ {
880
+ inputs: [
881
+ {
882
+ internalType: "address",
883
+ name: "token",
884
+ type: "address"
885
+ },
886
+ {
887
+ internalType: "address",
888
+ name: "spender",
889
+ type: "address"
890
+ },
891
+ {
892
+ internalType: "uint48",
893
+ name: "newNonce",
894
+ type: "uint48"
895
+ }
896
+ ],
897
+ name: "invalidateNonces",
898
+ outputs: [
899
+ ],
900
+ stateMutability: "nonpayable",
901
+ type: "function"
902
+ },
903
+ {
904
+ inputs: [
905
+ {
906
+ internalType: "uint256",
907
+ name: "wordPos",
908
+ type: "uint256"
909
+ },
910
+ {
911
+ internalType: "uint256",
912
+ name: "mask",
913
+ type: "uint256"
914
+ }
915
+ ],
916
+ name: "invalidateUnorderedNonces",
917
+ outputs: [
918
+ ],
919
+ stateMutability: "nonpayable",
920
+ type: "function"
921
+ },
922
+ {
923
+ inputs: [
924
+ {
925
+ components: [
926
+ {
927
+ internalType: "address",
928
+ name: "token",
929
+ type: "address"
930
+ },
931
+ {
932
+ internalType: "address",
933
+ name: "spender",
934
+ type: "address"
935
+ }
936
+ ],
937
+ internalType: "struct IAllowanceTransfer.TokenSpenderPair[]",
938
+ name: "approvals",
939
+ type: "tuple[]"
940
+ }
941
+ ],
942
+ name: "lockdown",
943
+ outputs: [
944
+ ],
945
+ stateMutability: "nonpayable",
946
+ type: "function"
947
+ },
948
+ {
949
+ inputs: [
950
+ {
951
+ internalType: "address",
952
+ name: "",
953
+ type: "address"
954
+ },
955
+ {
956
+ internalType: "uint256",
957
+ name: "",
958
+ type: "uint256"
959
+ }
960
+ ],
961
+ name: "nonceBitmap",
962
+ outputs: [
963
+ {
964
+ internalType: "uint256",
965
+ name: "",
966
+ type: "uint256"
967
+ }
968
+ ],
969
+ stateMutability: "view",
970
+ type: "function"
971
+ },
972
+ {
973
+ inputs: [
974
+ {
975
+ internalType: "address",
976
+ name: "owner",
977
+ type: "address"
978
+ },
979
+ {
980
+ components: [
981
+ {
982
+ components: [
983
+ {
984
+ internalType: "address",
985
+ name: "token",
986
+ type: "address"
987
+ },
988
+ {
989
+ internalType: "uint160",
990
+ name: "amount",
991
+ type: "uint160"
992
+ },
993
+ {
994
+ internalType: "uint48",
995
+ name: "expiration",
996
+ type: "uint48"
997
+ },
998
+ {
999
+ internalType: "uint48",
1000
+ name: "nonce",
1001
+ type: "uint48"
1002
+ }
1003
+ ],
1004
+ internalType: "struct IAllowanceTransfer.PermitDetails[]",
1005
+ name: "details",
1006
+ type: "tuple[]"
1007
+ },
1008
+ {
1009
+ internalType: "address",
1010
+ name: "spender",
1011
+ type: "address"
1012
+ },
1013
+ {
1014
+ internalType: "uint256",
1015
+ name: "sigDeadline",
1016
+ type: "uint256"
1017
+ }
1018
+ ],
1019
+ internalType: "struct IAllowanceTransfer.PermitBatch",
1020
+ name: "permitBatch",
1021
+ type: "tuple"
1022
+ },
1023
+ {
1024
+ internalType: "bytes",
1025
+ name: "signature",
1026
+ type: "bytes"
1027
+ }
1028
+ ],
1029
+ name: "permit",
1030
+ outputs: [
1031
+ ],
1032
+ stateMutability: "nonpayable",
1033
+ type: "function"
1034
+ },
1035
+ {
1036
+ inputs: [
1037
+ {
1038
+ internalType: "address",
1039
+ name: "owner",
1040
+ type: "address"
1041
+ },
1042
+ {
1043
+ components: [
1044
+ {
1045
+ components: [
1046
+ {
1047
+ internalType: "address",
1048
+ name: "token",
1049
+ type: "address"
1050
+ },
1051
+ {
1052
+ internalType: "uint160",
1053
+ name: "amount",
1054
+ type: "uint160"
1055
+ },
1056
+ {
1057
+ internalType: "uint48",
1058
+ name: "expiration",
1059
+ type: "uint48"
1060
+ },
1061
+ {
1062
+ internalType: "uint48",
1063
+ name: "nonce",
1064
+ type: "uint48"
1065
+ }
1066
+ ],
1067
+ internalType: "struct IAllowanceTransfer.PermitDetails",
1068
+ name: "details",
1069
+ type: "tuple"
1070
+ },
1071
+ {
1072
+ internalType: "address",
1073
+ name: "spender",
1074
+ type: "address"
1075
+ },
1076
+ {
1077
+ internalType: "uint256",
1078
+ name: "sigDeadline",
1079
+ type: "uint256"
1080
+ }
1081
+ ],
1082
+ internalType: "struct IAllowanceTransfer.PermitSingle",
1083
+ name: "permitSingle",
1084
+ type: "tuple"
1085
+ },
1086
+ {
1087
+ internalType: "bytes",
1088
+ name: "signature",
1089
+ type: "bytes"
1090
+ }
1091
+ ],
1092
+ name: "permit",
1093
+ outputs: [
1094
+ ],
1095
+ stateMutability: "nonpayable",
1096
+ type: "function"
1097
+ },
1098
+ {
1099
+ inputs: [
1100
+ {
1101
+ components: [
1102
+ {
1103
+ components: [
1104
+ {
1105
+ internalType: "address",
1106
+ name: "token",
1107
+ type: "address"
1108
+ },
1109
+ {
1110
+ internalType: "uint256",
1111
+ name: "amount",
1112
+ type: "uint256"
1113
+ }
1114
+ ],
1115
+ internalType: "struct ISignatureTransfer.TokenPermissions[]",
1116
+ name: "permitted",
1117
+ type: "tuple[]"
1118
+ },
1119
+ {
1120
+ internalType: "uint256",
1121
+ name: "nonce",
1122
+ type: "uint256"
1123
+ },
1124
+ {
1125
+ internalType: "uint256",
1126
+ name: "deadline",
1127
+ type: "uint256"
1128
+ }
1129
+ ],
1130
+ internalType: "struct ISignatureTransfer.PermitBatchTransferFrom",
1131
+ name: "permit",
1132
+ type: "tuple"
1133
+ },
1134
+ {
1135
+ internalType: "address",
1136
+ name: "owner",
1137
+ type: "address"
1138
+ },
1139
+ {
1140
+ components: [
1141
+ {
1142
+ internalType: "address",
1143
+ name: "to",
1144
+ type: "address"
1145
+ },
1146
+ {
1147
+ internalType: "uint256",
1148
+ name: "requestedAmount",
1149
+ type: "uint256"
1150
+ }
1151
+ ],
1152
+ internalType: "struct ISignatureTransfer.SignatureTransferDetails[]",
1153
+ name: "transferDetails",
1154
+ type: "tuple[]"
1155
+ },
1156
+ {
1157
+ internalType: "bytes",
1158
+ name: "signature",
1159
+ type: "bytes"
1160
+ }
1161
+ ],
1162
+ name: "permitTransferFrom",
1163
+ outputs: [
1164
+ ],
1165
+ stateMutability: "nonpayable",
1166
+ type: "function"
1167
+ },
1168
+ {
1169
+ inputs: [
1170
+ {
1171
+ components: [
1172
+ {
1173
+ components: [
1174
+ {
1175
+ internalType: "address",
1176
+ name: "token",
1177
+ type: "address"
1178
+ },
1179
+ {
1180
+ internalType: "uint256",
1181
+ name: "amount",
1182
+ type: "uint256"
1183
+ }
1184
+ ],
1185
+ internalType: "struct ISignatureTransfer.TokenPermissions",
1186
+ name: "permitted",
1187
+ type: "tuple"
1188
+ },
1189
+ {
1190
+ internalType: "uint256",
1191
+ name: "nonce",
1192
+ type: "uint256"
1193
+ },
1194
+ {
1195
+ internalType: "uint256",
1196
+ name: "deadline",
1197
+ type: "uint256"
1198
+ }
1199
+ ],
1200
+ internalType: "struct ISignatureTransfer.PermitTransferFrom",
1201
+ name: "permit",
1202
+ type: "tuple"
1203
+ },
1204
+ {
1205
+ internalType: "address",
1206
+ name: "owner",
1207
+ type: "address"
1208
+ },
1209
+ {
1210
+ internalType: "address",
1211
+ name: "to",
1212
+ type: "address"
1213
+ },
1214
+ {
1215
+ internalType: "uint256",
1216
+ name: "requestedAmount",
1217
+ type: "uint256"
1218
+ },
1219
+ {
1220
+ internalType: "bytes",
1221
+ name: "signature",
1222
+ type: "bytes"
1223
+ }
1224
+ ],
1225
+ name: "permitTransferFrom",
1226
+ outputs: [
1227
+ ],
1228
+ stateMutability: "nonpayable",
1229
+ type: "function"
1230
+ },
1231
+ {
1232
+ inputs: [
1233
+ {
1234
+ components: [
1235
+ {
1236
+ components: [
1237
+ {
1238
+ internalType: "address",
1239
+ name: "token",
1240
+ type: "address"
1241
+ },
1242
+ {
1243
+ internalType: "uint256",
1244
+ name: "amount",
1245
+ type: "uint256"
1246
+ }
1247
+ ],
1248
+ internalType: "struct ISignatureTransfer.TokenPermissions",
1249
+ name: "permitted",
1250
+ type: "tuple"
1251
+ },
1252
+ {
1253
+ internalType: "uint256",
1254
+ name: "nonce",
1255
+ type: "uint256"
1256
+ },
1257
+ {
1258
+ internalType: "uint256",
1259
+ name: "deadline",
1260
+ type: "uint256"
1261
+ }
1262
+ ],
1263
+ internalType: "struct ISignatureTransfer.PermitTransferFrom",
1264
+ name: "permit",
1265
+ type: "tuple"
1266
+ },
1267
+ {
1268
+ internalType: "address",
1269
+ name: "owner",
1270
+ type: "address"
1271
+ },
1272
+ {
1273
+ internalType: "address",
1274
+ name: "to",
1275
+ type: "address"
1276
+ },
1277
+ {
1278
+ internalType: "uint256",
1279
+ name: "requestedAmount",
1280
+ type: "uint256"
1281
+ },
1282
+ {
1283
+ internalType: "bytes32",
1284
+ name: "witness",
1285
+ type: "bytes32"
1286
+ },
1287
+ {
1288
+ internalType: "string",
1289
+ name: "witnessTypeName",
1290
+ type: "string"
1291
+ },
1292
+ {
1293
+ internalType: "string",
1294
+ name: "witnessType",
1295
+ type: "string"
1296
+ },
1297
+ {
1298
+ internalType: "bytes",
1299
+ name: "signature",
1300
+ type: "bytes"
1301
+ }
1302
+ ],
1303
+ name: "permitWitnessTransferFrom",
1304
+ outputs: [
1305
+ ],
1306
+ stateMutability: "nonpayable",
1307
+ type: "function"
1308
+ },
1309
+ {
1310
+ inputs: [
1311
+ {
1312
+ components: [
1313
+ {
1314
+ components: [
1315
+ {
1316
+ internalType: "address",
1317
+ name: "token",
1318
+ type: "address"
1319
+ },
1320
+ {
1321
+ internalType: "uint256",
1322
+ name: "amount",
1323
+ type: "uint256"
1324
+ }
1325
+ ],
1326
+ internalType: "struct ISignatureTransfer.TokenPermissions[]",
1327
+ name: "permitted",
1328
+ type: "tuple[]"
1329
+ },
1330
+ {
1331
+ internalType: "uint256",
1332
+ name: "nonce",
1333
+ type: "uint256"
1334
+ },
1335
+ {
1336
+ internalType: "uint256",
1337
+ name: "deadline",
1338
+ type: "uint256"
1339
+ }
1340
+ ],
1341
+ internalType: "struct ISignatureTransfer.PermitBatchTransferFrom",
1342
+ name: "permit",
1343
+ type: "tuple"
1344
+ },
1345
+ {
1346
+ internalType: "address",
1347
+ name: "owner",
1348
+ type: "address"
1349
+ },
1350
+ {
1351
+ components: [
1352
+ {
1353
+ internalType: "address",
1354
+ name: "to",
1355
+ type: "address"
1356
+ },
1357
+ {
1358
+ internalType: "uint256",
1359
+ name: "requestedAmount",
1360
+ type: "uint256"
1361
+ }
1362
+ ],
1363
+ internalType: "struct ISignatureTransfer.SignatureTransferDetails[]",
1364
+ name: "transferDetails",
1365
+ type: "tuple[]"
1366
+ },
1367
+ {
1368
+ internalType: "bytes32",
1369
+ name: "witness",
1370
+ type: "bytes32"
1371
+ },
1372
+ {
1373
+ internalType: "string",
1374
+ name: "witnessTypeName",
1375
+ type: "string"
1376
+ },
1377
+ {
1378
+ internalType: "string",
1379
+ name: "witnessType",
1380
+ type: "string"
1381
+ },
1382
+ {
1383
+ internalType: "bytes",
1384
+ name: "signature",
1385
+ type: "bytes"
1386
+ }
1387
+ ],
1388
+ name: "permitWitnessTransferFrom",
1389
+ outputs: [
1390
+ ],
1391
+ stateMutability: "nonpayable",
1392
+ type: "function"
1393
+ },
1394
+ {
1395
+ inputs: [
1396
+ {
1397
+ internalType: "address",
1398
+ name: "token",
1399
+ type: "address"
1400
+ },
1401
+ {
1402
+ internalType: "address",
1403
+ name: "from",
1404
+ type: "address"
1405
+ },
1406
+ {
1407
+ internalType: "address",
1408
+ name: "to",
1409
+ type: "address"
1410
+ },
1411
+ {
1412
+ internalType: "uint160",
1413
+ name: "amount",
1414
+ type: "uint160"
1415
+ }
1416
+ ],
1417
+ name: "transferFrom",
1418
+ outputs: [
1419
+ ],
1420
+ stateMutability: "nonpayable",
1421
+ type: "function"
1422
+ },
1423
+ {
1424
+ inputs: [
1425
+ {
1426
+ internalType: "address",
1427
+ name: "from",
1428
+ type: "address"
1429
+ },
1430
+ {
1431
+ components: [
1432
+ {
1433
+ internalType: "address",
1434
+ name: "token",
1435
+ type: "address"
1436
+ },
1437
+ {
1438
+ internalType: "uint160",
1439
+ name: "amount",
1440
+ type: "uint160"
1441
+ },
1442
+ {
1443
+ internalType: "address",
1444
+ name: "to",
1445
+ type: "address"
1446
+ }
1447
+ ],
1448
+ internalType: "struct IAllowanceTransfer.AllowanceTransferDetails[]",
1449
+ name: "transferDetails",
1450
+ type: "tuple[]"
1451
+ }
1452
+ ],
1453
+ name: "transferFrom",
1454
+ outputs: [
1455
+ ],
1456
+ stateMutability: "nonpayable",
1457
+ type: "function"
1458
+ }
1459
+ ];
1460
+
1461
+ var AllowanceProvider = /*#__PURE__*/function () {
1462
+ function AllowanceProvider(provider, permit2Address) {
1463
+ this.provider = provider;
1464
+ this.permit2Address = permit2Address;
1465
+ this.permit2 = new contracts.Contract(this.permit2Address, Permit2Abi, this.provider);
1466
+ }
1467
+ var _proto = AllowanceProvider.prototype;
1468
+ _proto.getAllowanceData = /*#__PURE__*/function () {
1469
+ var _getAllowanceData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(token, owner, spender) {
1470
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1471
+ while (1) switch (_context.prev = _context.next) {
1472
+ case 0:
1473
+ _context.next = 2;
1474
+ return this.permit2.allowance(owner, token, spender);
1475
+ case 2:
1476
+ return _context.abrupt("return", _context.sent);
1477
+ case 3:
1478
+ case "end":
1479
+ return _context.stop();
1480
+ }
1481
+ }, _callee, this);
1482
+ }));
1483
+ function getAllowanceData(_x, _x2, _x3) {
1484
+ return _getAllowanceData.apply(this, arguments);
1485
+ }
1486
+ return getAllowanceData;
1487
+ }();
1488
+ _proto.getAllowance = /*#__PURE__*/function () {
1489
+ var _getAllowance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(token, owner, spender) {
1490
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1491
+ while (1) switch (_context2.prev = _context2.next) {
1492
+ case 0:
1493
+ _context2.next = 2;
1494
+ return this.getAllowanceData(token, owner, spender);
1495
+ case 2:
1496
+ return _context2.abrupt("return", _context2.sent.amount);
1497
+ case 3:
1498
+ case "end":
1499
+ return _context2.stop();
1500
+ }
1501
+ }, _callee2, this);
1502
+ }));
1503
+ function getAllowance(_x4, _x5, _x6) {
1504
+ return _getAllowance.apply(this, arguments);
1505
+ }
1506
+ return getAllowance;
1507
+ }();
1508
+ _proto.getNonce = /*#__PURE__*/function () {
1509
+ var _getNonce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(token, owner, spender) {
1510
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1511
+ while (1) switch (_context3.prev = _context3.next) {
1512
+ case 0:
1513
+ _context3.next = 2;
1514
+ return this.getAllowanceData(token, owner, spender);
1515
+ case 2:
1516
+ return _context3.abrupt("return", _context3.sent.nonce);
1517
+ case 3:
1518
+ case "end":
1519
+ return _context3.stop();
1520
+ }
1521
+ }, _callee3, this);
1522
+ }));
1523
+ function getNonce(_x7, _x8, _x9) {
1524
+ return _getNonce.apply(this, arguments);
1525
+ }
1526
+ return getNonce;
1527
+ }();
1528
+ _proto.getExpiration = /*#__PURE__*/function () {
1529
+ var _getExpiration = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(token, owner, spender) {
1530
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1531
+ while (1) switch (_context4.prev = _context4.next) {
1532
+ case 0:
1533
+ _context4.next = 2;
1534
+ return this.getAllowanceData(token, owner, spender);
1535
+ case 2:
1536
+ return _context4.abrupt("return", _context4.sent.expiration);
1537
+ case 3:
1538
+ case "end":
1539
+ return _context4.stop();
1540
+ }
1541
+ }, _callee4, this);
1542
+ }));
1543
+ function getExpiration(_x10, _x11, _x12) {
1544
+ return _getExpiration.apply(this, arguments);
1545
+ }
1546
+ return getExpiration;
1547
+ }();
1548
+ return AllowanceProvider;
1549
+ }();
1550
+
1551
+ exports.AllowanceProvider = AllowanceProvider;
1552
+ exports.AllowanceTransfer = AllowanceTransfer;
1553
+ exports.InstantExpiration = InstantExpiration;
1554
+ exports.MaxAllowanceExpiration = MaxAllowanceExpiration;
1555
+ exports.MaxAllowanceTransferAmount = MaxAllowanceTransferAmount;
1556
+ exports.MaxOrderedNonce = MaxOrderedNonce;
1557
+ exports.MaxSigDeadline = MaxSigDeadline;
1558
+ exports.MaxSignatureTransferAmount = MaxSignatureTransferAmount;
1559
+ exports.MaxUint160 = MaxUint160;
1560
+ exports.MaxUint256 = MaxUint256;
1561
+ exports.MaxUint48 = MaxUint48;
1562
+ exports.MaxUnorderedNonce = MaxUnorderedNonce;
1563
+ exports.PERMIT2_ADDRESS = PERMIT2_ADDRESS;
1564
+ exports.SignatureTransfer = SignatureTransfer;
1565
+ exports.permit2Address = permit2Address;
1566
+ //# sourceMappingURL=permit2-sdk.cjs.development.js.map