@depay/widgets 6.9.2 → 6.10.0
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/README.md +21 -0
- package/dist/esm/index.bundle.js +1100 -594
- package/dist/esm/index.js +9 -5
- package/dist/umd/index.bundle.js +1100 -594
- package/dist/umd/index.js +9 -5
- package/package.json +2 -2
package/dist/esm/index.bundle.js
CHANGED
|
@@ -10821,13 +10821,13 @@ const logger$J = new Logger$4(version$x);
|
|
|
10821
10821
|
function isHexable$4(value) {
|
|
10822
10822
|
return !!(value.toHexString);
|
|
10823
10823
|
}
|
|
10824
|
-
function addSlice$
|
|
10824
|
+
function addSlice$4(array) {
|
|
10825
10825
|
if (array.slice) {
|
|
10826
10826
|
return array;
|
|
10827
10827
|
}
|
|
10828
10828
|
array.slice = function () {
|
|
10829
10829
|
const args = Array.prototype.slice.call(arguments);
|
|
10830
|
-
return addSlice$
|
|
10830
|
+
return addSlice$4(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
10831
10831
|
};
|
|
10832
10832
|
return array;
|
|
10833
10833
|
}
|
|
@@ -10858,7 +10858,7 @@ function isBytes$4(value) {
|
|
|
10858
10858
|
}
|
|
10859
10859
|
return true;
|
|
10860
10860
|
}
|
|
10861
|
-
function arrayify$
|
|
10861
|
+
function arrayify$4(value, options) {
|
|
10862
10862
|
if (!options) {
|
|
10863
10863
|
options = {};
|
|
10864
10864
|
}
|
|
@@ -10872,7 +10872,7 @@ function arrayify$3(value, options) {
|
|
|
10872
10872
|
if (result.length === 0) {
|
|
10873
10873
|
result.push(0);
|
|
10874
10874
|
}
|
|
10875
|
-
return addSlice$
|
|
10875
|
+
return addSlice$4(new Uint8Array(result));
|
|
10876
10876
|
}
|
|
10877
10877
|
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
10878
10878
|
value = "0x" + value;
|
|
@@ -10897,25 +10897,25 @@ function arrayify$3(value, options) {
|
|
|
10897
10897
|
for (let i = 0; i < hex.length; i += 2) {
|
|
10898
10898
|
result.push(parseInt(hex.substring(i, i + 2), 16));
|
|
10899
10899
|
}
|
|
10900
|
-
return addSlice$
|
|
10900
|
+
return addSlice$4(new Uint8Array(result));
|
|
10901
10901
|
}
|
|
10902
10902
|
if (isBytes$4(value)) {
|
|
10903
|
-
return addSlice$
|
|
10903
|
+
return addSlice$4(new Uint8Array(value));
|
|
10904
10904
|
}
|
|
10905
10905
|
return logger$J.throwArgumentError("invalid arrayify value", "value", value);
|
|
10906
10906
|
}
|
|
10907
10907
|
function concat$2(items) {
|
|
10908
|
-
const objects = items.map(item => arrayify$
|
|
10908
|
+
const objects = items.map(item => arrayify$4(item));
|
|
10909
10909
|
const length = objects.reduce((accum, item) => (accum + item.length), 0);
|
|
10910
10910
|
const result = new Uint8Array(length);
|
|
10911
10911
|
objects.reduce((offset, object) => {
|
|
10912
10912
|
result.set(object, offset);
|
|
10913
10913
|
return offset + object.length;
|
|
10914
10914
|
}, 0);
|
|
10915
|
-
return addSlice$
|
|
10915
|
+
return addSlice$4(result);
|
|
10916
10916
|
}
|
|
10917
10917
|
function stripZeros$2(value) {
|
|
10918
|
-
let result = arrayify$
|
|
10918
|
+
let result = arrayify$4(value);
|
|
10919
10919
|
if (result.length === 0) {
|
|
10920
10920
|
return result;
|
|
10921
10921
|
}
|
|
@@ -11033,7 +11033,7 @@ function hexConcat$2(items) {
|
|
|
11033
11033
|
});
|
|
11034
11034
|
return result;
|
|
11035
11035
|
}
|
|
11036
|
-
function hexZeroPad$
|
|
11036
|
+
function hexZeroPad$4(value, length) {
|
|
11037
11037
|
if (typeof (value) !== "string") {
|
|
11038
11038
|
value = hexlify$4(value);
|
|
11039
11039
|
}
|
|
@@ -11055,7 +11055,7 @@ var BN$4 = bn$4.BN;
|
|
|
11055
11055
|
const logger$I = new Logger$4(version$w);
|
|
11056
11056
|
const _constructorGuard$9 = {};
|
|
11057
11057
|
const MAX_SAFE$4 = 0x1fffffffffffff;
|
|
11058
|
-
function isBigNumberish$
|
|
11058
|
+
function isBigNumberish$3(value) {
|
|
11059
11059
|
return (value != null) && (BigNumber$4.isBigNumber(value) ||
|
|
11060
11060
|
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
11061
11061
|
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
@@ -11353,12 +11353,12 @@ function throwFault$5(message, fault, operation, value) {
|
|
|
11353
11353
|
return logger$H.throwError(message, Logger$4.errors.NUMERIC_FAULT, params);
|
|
11354
11354
|
}
|
|
11355
11355
|
// Constant to pull zeros from for multipliers
|
|
11356
|
-
let zeros$
|
|
11357
|
-
while (zeros$
|
|
11358
|
-
zeros$
|
|
11356
|
+
let zeros$3 = "0";
|
|
11357
|
+
while (zeros$3.length < 256) {
|
|
11358
|
+
zeros$3 += zeros$3;
|
|
11359
11359
|
}
|
|
11360
11360
|
// Returns a string "1" followed by decimal "0"s
|
|
11361
|
-
function getMultiplier$
|
|
11361
|
+
function getMultiplier$3(decimals) {
|
|
11362
11362
|
if (typeof (decimals) !== "number") {
|
|
11363
11363
|
try {
|
|
11364
11364
|
decimals = BigNumber$4.from(decimals).toNumber();
|
|
@@ -11366,15 +11366,15 @@ function getMultiplier$2(decimals) {
|
|
|
11366
11366
|
catch (e) { }
|
|
11367
11367
|
}
|
|
11368
11368
|
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
11369
|
-
return ("1" + zeros$
|
|
11369
|
+
return ("1" + zeros$3.substring(0, decimals));
|
|
11370
11370
|
}
|
|
11371
11371
|
return logger$H.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
11372
11372
|
}
|
|
11373
|
-
function formatFixed$
|
|
11373
|
+
function formatFixed$3(value, decimals) {
|
|
11374
11374
|
if (decimals == null) {
|
|
11375
11375
|
decimals = 0;
|
|
11376
11376
|
}
|
|
11377
|
-
const multiplier = getMultiplier$
|
|
11377
|
+
const multiplier = getMultiplier$3(decimals);
|
|
11378
11378
|
// Make sure wei is a big number (convert as necessary)
|
|
11379
11379
|
value = BigNumber$4.from(value);
|
|
11380
11380
|
const negative = value.lt(Zero$6);
|
|
@@ -11399,11 +11399,11 @@ function formatFixed$2(value, decimals) {
|
|
|
11399
11399
|
}
|
|
11400
11400
|
return value;
|
|
11401
11401
|
}
|
|
11402
|
-
function parseFixed$
|
|
11402
|
+
function parseFixed$3(value, decimals) {
|
|
11403
11403
|
if (decimals == null) {
|
|
11404
11404
|
decimals = 0;
|
|
11405
11405
|
}
|
|
11406
|
-
const multiplier = getMultiplier$
|
|
11406
|
+
const multiplier = getMultiplier$3(decimals);
|
|
11407
11407
|
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
|
|
11408
11408
|
logger$H.throwArgumentError("invalid decimal value", "value", value);
|
|
11409
11409
|
}
|
|
@@ -11451,7 +11451,7 @@ function parseFixed$2(value, decimals) {
|
|
|
11451
11451
|
}
|
|
11452
11452
|
return wei;
|
|
11453
11453
|
}
|
|
11454
|
-
class FixedFormat$
|
|
11454
|
+
class FixedFormat$3 {
|
|
11455
11455
|
constructor(constructorGuard, signed, width, decimals) {
|
|
11456
11456
|
if (constructorGuard !== _constructorGuard$8) {
|
|
11457
11457
|
logger$H.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$4.errors.UNSUPPORTED_OPERATION, {
|
|
@@ -11462,11 +11462,11 @@ class FixedFormat$2 {
|
|
|
11462
11462
|
this.width = width;
|
|
11463
11463
|
this.decimals = decimals;
|
|
11464
11464
|
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
11465
|
-
this._multiplier = getMultiplier$
|
|
11465
|
+
this._multiplier = getMultiplier$3(decimals);
|
|
11466
11466
|
Object.freeze(this);
|
|
11467
11467
|
}
|
|
11468
11468
|
static from(value) {
|
|
11469
|
-
if (value instanceof FixedFormat$
|
|
11469
|
+
if (value instanceof FixedFormat$3) {
|
|
11470
11470
|
return value;
|
|
11471
11471
|
}
|
|
11472
11472
|
if (typeof (value) === "number") {
|
|
@@ -11510,12 +11510,12 @@ class FixedFormat$2 {
|
|
|
11510
11510
|
if (decimals > 80) {
|
|
11511
11511
|
logger$H.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
11512
11512
|
}
|
|
11513
|
-
return new FixedFormat$
|
|
11513
|
+
return new FixedFormat$3(_constructorGuard$8, signed, width, decimals);
|
|
11514
11514
|
}
|
|
11515
11515
|
}
|
|
11516
|
-
class FixedNumber$
|
|
11516
|
+
class FixedNumber$3 {
|
|
11517
11517
|
constructor(constructorGuard, hex, value, format) {
|
|
11518
|
-
logger$H.checkNew(new.target, FixedNumber$
|
|
11518
|
+
logger$H.checkNew(new.target, FixedNumber$3);
|
|
11519
11519
|
if (constructorGuard !== _constructorGuard$8) {
|
|
11520
11520
|
logger$H.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$4.errors.UNSUPPORTED_OPERATION, {
|
|
11521
11521
|
operation: "new FixedFormat"
|
|
@@ -11534,37 +11534,37 @@ class FixedNumber$2 {
|
|
|
11534
11534
|
}
|
|
11535
11535
|
addUnsafe(other) {
|
|
11536
11536
|
this._checkFormat(other);
|
|
11537
|
-
const a = parseFixed$
|
|
11538
|
-
const b = parseFixed$
|
|
11539
|
-
return FixedNumber$
|
|
11537
|
+
const a = parseFixed$3(this._value, this.format.decimals);
|
|
11538
|
+
const b = parseFixed$3(other._value, other.format.decimals);
|
|
11539
|
+
return FixedNumber$3.fromValue(a.add(b), this.format.decimals, this.format);
|
|
11540
11540
|
}
|
|
11541
11541
|
subUnsafe(other) {
|
|
11542
11542
|
this._checkFormat(other);
|
|
11543
|
-
const a = parseFixed$
|
|
11544
|
-
const b = parseFixed$
|
|
11545
|
-
return FixedNumber$
|
|
11543
|
+
const a = parseFixed$3(this._value, this.format.decimals);
|
|
11544
|
+
const b = parseFixed$3(other._value, other.format.decimals);
|
|
11545
|
+
return FixedNumber$3.fromValue(a.sub(b), this.format.decimals, this.format);
|
|
11546
11546
|
}
|
|
11547
11547
|
mulUnsafe(other) {
|
|
11548
11548
|
this._checkFormat(other);
|
|
11549
|
-
const a = parseFixed$
|
|
11550
|
-
const b = parseFixed$
|
|
11551
|
-
return FixedNumber$
|
|
11549
|
+
const a = parseFixed$3(this._value, this.format.decimals);
|
|
11550
|
+
const b = parseFixed$3(other._value, other.format.decimals);
|
|
11551
|
+
return FixedNumber$3.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
11552
11552
|
}
|
|
11553
11553
|
divUnsafe(other) {
|
|
11554
11554
|
this._checkFormat(other);
|
|
11555
|
-
const a = parseFixed$
|
|
11556
|
-
const b = parseFixed$
|
|
11557
|
-
return FixedNumber$
|
|
11555
|
+
const a = parseFixed$3(this._value, this.format.decimals);
|
|
11556
|
+
const b = parseFixed$3(other._value, other.format.decimals);
|
|
11557
|
+
return FixedNumber$3.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
11558
11558
|
}
|
|
11559
11559
|
floor() {
|
|
11560
11560
|
const comps = this.toString().split(".");
|
|
11561
11561
|
if (comps.length === 1) {
|
|
11562
11562
|
comps.push("0");
|
|
11563
11563
|
}
|
|
11564
|
-
let result = FixedNumber$
|
|
11564
|
+
let result = FixedNumber$3.from(comps[0], this.format);
|
|
11565
11565
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
11566
11566
|
if (this.isNegative() && hasFraction) {
|
|
11567
|
-
result = result.subUnsafe(ONE$
|
|
11567
|
+
result = result.subUnsafe(ONE$3.toFormat(result.format));
|
|
11568
11568
|
}
|
|
11569
11569
|
return result;
|
|
11570
11570
|
}
|
|
@@ -11573,10 +11573,10 @@ class FixedNumber$2 {
|
|
|
11573
11573
|
if (comps.length === 1) {
|
|
11574
11574
|
comps.push("0");
|
|
11575
11575
|
}
|
|
11576
|
-
let result = FixedNumber$
|
|
11576
|
+
let result = FixedNumber$3.from(comps[0], this.format);
|
|
11577
11577
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
11578
11578
|
if (!this.isNegative() && hasFraction) {
|
|
11579
|
-
result = result.addUnsafe(ONE$
|
|
11579
|
+
result = result.addUnsafe(ONE$3.toFormat(result.format));
|
|
11580
11580
|
}
|
|
11581
11581
|
return result;
|
|
11582
11582
|
}
|
|
@@ -11596,8 +11596,8 @@ class FixedNumber$2 {
|
|
|
11596
11596
|
if (comps[1].length <= decimals) {
|
|
11597
11597
|
return this;
|
|
11598
11598
|
}
|
|
11599
|
-
const factor = FixedNumber$
|
|
11600
|
-
const bump = BUMP$
|
|
11599
|
+
const factor = FixedNumber$3.from("1" + zeros$3.substring(0, decimals), this.format);
|
|
11600
|
+
const bump = BUMP$3.toFormat(this.format);
|
|
11601
11601
|
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
11602
11602
|
}
|
|
11603
11603
|
isZero() {
|
|
@@ -11615,15 +11615,15 @@ class FixedNumber$2 {
|
|
|
11615
11615
|
logger$H.throwArgumentError("invalid byte width", "width", width);
|
|
11616
11616
|
}
|
|
11617
11617
|
const hex = BigNumber$4.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
11618
|
-
return hexZeroPad$
|
|
11618
|
+
return hexZeroPad$4(hex, width / 8);
|
|
11619
11619
|
}
|
|
11620
11620
|
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
11621
11621
|
toFormat(format) {
|
|
11622
|
-
return FixedNumber$
|
|
11622
|
+
return FixedNumber$3.fromString(this._value, format);
|
|
11623
11623
|
}
|
|
11624
11624
|
static fromValue(value, decimals, format) {
|
|
11625
11625
|
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
11626
|
-
if (format == null && decimals != null && !isBigNumberish$
|
|
11626
|
+
if (format == null && decimals != null && !isBigNumberish$3(decimals)) {
|
|
11627
11627
|
format = decimals;
|
|
11628
11628
|
decimals = null;
|
|
11629
11629
|
}
|
|
@@ -11633,14 +11633,14 @@ class FixedNumber$2 {
|
|
|
11633
11633
|
if (format == null) {
|
|
11634
11634
|
format = "fixed";
|
|
11635
11635
|
}
|
|
11636
|
-
return FixedNumber$
|
|
11636
|
+
return FixedNumber$3.fromString(formatFixed$3(value, decimals), FixedFormat$3.from(format));
|
|
11637
11637
|
}
|
|
11638
11638
|
static fromString(value, format) {
|
|
11639
11639
|
if (format == null) {
|
|
11640
11640
|
format = "fixed";
|
|
11641
11641
|
}
|
|
11642
|
-
const fixedFormat = FixedFormat$
|
|
11643
|
-
const numeric = parseFixed$
|
|
11642
|
+
const fixedFormat = FixedFormat$3.from(format);
|
|
11643
|
+
const numeric = parseFixed$3(value, fixedFormat.decimals);
|
|
11644
11644
|
if (!fixedFormat.signed && numeric.lt(Zero$6)) {
|
|
11645
11645
|
throwFault$5("unsigned value cannot be negative", "overflow", "value", value);
|
|
11646
11646
|
}
|
|
@@ -11650,17 +11650,17 @@ class FixedNumber$2 {
|
|
|
11650
11650
|
}
|
|
11651
11651
|
else {
|
|
11652
11652
|
hex = numeric.toHexString();
|
|
11653
|
-
hex = hexZeroPad$
|
|
11653
|
+
hex = hexZeroPad$4(hex, fixedFormat.width / 8);
|
|
11654
11654
|
}
|
|
11655
|
-
const decimal = formatFixed$
|
|
11656
|
-
return new FixedNumber$
|
|
11655
|
+
const decimal = formatFixed$3(numeric, fixedFormat.decimals);
|
|
11656
|
+
return new FixedNumber$3(_constructorGuard$8, hex, decimal, fixedFormat);
|
|
11657
11657
|
}
|
|
11658
11658
|
static fromBytes(value, format) {
|
|
11659
11659
|
if (format == null) {
|
|
11660
11660
|
format = "fixed";
|
|
11661
11661
|
}
|
|
11662
|
-
const fixedFormat = FixedFormat$
|
|
11663
|
-
if (arrayify$
|
|
11662
|
+
const fixedFormat = FixedFormat$3.from(format);
|
|
11663
|
+
if (arrayify$4(value).length > fixedFormat.width / 8) {
|
|
11664
11664
|
throw new Error("overflow");
|
|
11665
11665
|
}
|
|
11666
11666
|
let numeric = BigNumber$4.from(value);
|
|
@@ -11668,18 +11668,18 @@ class FixedNumber$2 {
|
|
|
11668
11668
|
numeric = numeric.fromTwos(fixedFormat.width);
|
|
11669
11669
|
}
|
|
11670
11670
|
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
11671
|
-
const decimal = formatFixed$
|
|
11672
|
-
return new FixedNumber$
|
|
11671
|
+
const decimal = formatFixed$3(numeric, fixedFormat.decimals);
|
|
11672
|
+
return new FixedNumber$3(_constructorGuard$8, hex, decimal, fixedFormat);
|
|
11673
11673
|
}
|
|
11674
11674
|
static from(value, format) {
|
|
11675
11675
|
if (typeof (value) === "string") {
|
|
11676
|
-
return FixedNumber$
|
|
11676
|
+
return FixedNumber$3.fromString(value, format);
|
|
11677
11677
|
}
|
|
11678
11678
|
if (isBytes$4(value)) {
|
|
11679
|
-
return FixedNumber$
|
|
11679
|
+
return FixedNumber$3.fromBytes(value, format);
|
|
11680
11680
|
}
|
|
11681
11681
|
try {
|
|
11682
|
-
return FixedNumber$
|
|
11682
|
+
return FixedNumber$3.fromValue(value, 0, format);
|
|
11683
11683
|
}
|
|
11684
11684
|
catch (error) {
|
|
11685
11685
|
// Allow NUMERIC_FAULT to bubble up
|
|
@@ -11693,8 +11693,8 @@ class FixedNumber$2 {
|
|
|
11693
11693
|
return !!(value && value._isFixedNumber);
|
|
11694
11694
|
}
|
|
11695
11695
|
}
|
|
11696
|
-
const ONE$
|
|
11697
|
-
const BUMP$
|
|
11696
|
+
const ONE$3 = FixedNumber$3.from(1);
|
|
11697
|
+
const BUMP$3 = FixedNumber$3.from("0.5");
|
|
11698
11698
|
|
|
11699
11699
|
const version$v = "properties/5.5.0";
|
|
11700
11700
|
|
|
@@ -12716,7 +12716,7 @@ class Writer$1 {
|
|
|
12716
12716
|
}
|
|
12717
12717
|
// Arrayish items; padded on the right to wordSize
|
|
12718
12718
|
writeBytes(value) {
|
|
12719
|
-
let bytes = arrayify$
|
|
12719
|
+
let bytes = arrayify$4(value);
|
|
12720
12720
|
const paddingOffset = bytes.length % this.wordSize;
|
|
12721
12721
|
if (paddingOffset) {
|
|
12722
12722
|
bytes = concat$2([bytes, this._padding.slice(paddingOffset)]);
|
|
@@ -12724,7 +12724,7 @@ class Writer$1 {
|
|
|
12724
12724
|
return this._writeData(bytes);
|
|
12725
12725
|
}
|
|
12726
12726
|
_getValue(value) {
|
|
12727
|
-
let bytes = arrayify$
|
|
12727
|
+
let bytes = arrayify$4(BigNumber$4.from(value));
|
|
12728
12728
|
if (bytes.length > this.wordSize) {
|
|
12729
12729
|
logger$E.throwError("value out-of-bounds", Logger$4.errors.BUFFER_OVERRUN, {
|
|
12730
12730
|
length: this.wordSize,
|
|
@@ -12751,7 +12751,7 @@ class Writer$1 {
|
|
|
12751
12751
|
}
|
|
12752
12752
|
class Reader$1 {
|
|
12753
12753
|
constructor(data, wordSize, coerceFunc, allowLoose) {
|
|
12754
|
-
defineReadOnly$2(this, "_data", arrayify$
|
|
12754
|
+
defineReadOnly$2(this, "_data", arrayify$4(data));
|
|
12755
12755
|
defineReadOnly$2(this, "wordSize", wordSize || 32);
|
|
12756
12756
|
defineReadOnly$2(this, "_coerceFunc", coerceFunc);
|
|
12757
12757
|
defineReadOnly$2(this, "allowLoose", allowLoose);
|
|
@@ -13449,7 +13449,7 @@ var sha3$4 = createCommonjsModule$4(function (module) {
|
|
|
13449
13449
|
var sha3$5 = sha3$4;
|
|
13450
13450
|
|
|
13451
13451
|
function keccak256$3(data) {
|
|
13452
|
-
return '0x' + sha3$5.keccak_256(arrayify$
|
|
13452
|
+
return '0x' + sha3$5.keccak_256(arrayify$4(data));
|
|
13453
13453
|
}
|
|
13454
13454
|
|
|
13455
13455
|
const version$t = "rlp/5.5.0";
|
|
@@ -13480,7 +13480,7 @@ function _encode$2(object) {
|
|
|
13480
13480
|
if (!isBytesLike$2(object)) {
|
|
13481
13481
|
logger$D.throwArgumentError("RLP object must be BytesLike", "object", object);
|
|
13482
13482
|
}
|
|
13483
|
-
const data = Array.prototype.slice.call(arrayify$
|
|
13483
|
+
const data = Array.prototype.slice.call(arrayify$4(object));
|
|
13484
13484
|
if (data.length === 1 && data[0] <= 0x7f) {
|
|
13485
13485
|
return data;
|
|
13486
13486
|
}
|
|
@@ -13509,7 +13509,7 @@ function getChecksumAddress$3(address) {
|
|
|
13509
13509
|
for (let i = 0; i < 40; i++) {
|
|
13510
13510
|
expanded[i] = chars[i].charCodeAt(0);
|
|
13511
13511
|
}
|
|
13512
|
-
const hashed = arrayify$
|
|
13512
|
+
const hashed = arrayify$4(keccak256$3(expanded));
|
|
13513
13513
|
for (let i = 0; i < 40; i += 2) {
|
|
13514
13514
|
if ((hashed[i >> 1] >> 4) >= 8) {
|
|
13515
13515
|
chars[i] = chars[i].toUpperCase();
|
|
@@ -13596,7 +13596,7 @@ function getContractAddress$2(transaction) {
|
|
|
13596
13596
|
catch (error) {
|
|
13597
13597
|
logger$C.throwArgumentError("missing from address", "transaction", transaction);
|
|
13598
13598
|
}
|
|
13599
|
-
const nonce = stripZeros$2(arrayify$
|
|
13599
|
+
const nonce = stripZeros$2(arrayify$4(BigNumber$4.from(transaction.nonce).toHexString()));
|
|
13600
13600
|
return getAddress$3(hexDataSlice$2(keccak256$3(encode$4([from, nonce])), 12));
|
|
13601
13601
|
}
|
|
13602
13602
|
|
|
@@ -13617,7 +13617,7 @@ class AddressCoder$1 extends Coder$1 {
|
|
|
13617
13617
|
return writer.writeValue(value);
|
|
13618
13618
|
}
|
|
13619
13619
|
decode(reader) {
|
|
13620
|
-
return getAddress$3(hexZeroPad$
|
|
13620
|
+
return getAddress$3(hexZeroPad$4(reader.readValue().toHexString(), 20));
|
|
13621
13621
|
}
|
|
13622
13622
|
}
|
|
13623
13623
|
|
|
@@ -13865,7 +13865,7 @@ class DynamicBytesCoder$1 extends Coder$1 {
|
|
|
13865
13865
|
return "0x";
|
|
13866
13866
|
}
|
|
13867
13867
|
encode(writer, value) {
|
|
13868
|
-
value = arrayify$
|
|
13868
|
+
value = arrayify$4(value);
|
|
13869
13869
|
let length = writer.writeValue(value.length);
|
|
13870
13870
|
length += writer.writeBytes(value);
|
|
13871
13871
|
return length;
|
|
@@ -13894,7 +13894,7 @@ class FixedBytesCoder$1 extends Coder$1 {
|
|
|
13894
13894
|
return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2);
|
|
13895
13895
|
}
|
|
13896
13896
|
encode(writer, value) {
|
|
13897
|
-
let data = arrayify$
|
|
13897
|
+
let data = arrayify$4(value);
|
|
13898
13898
|
if (data.length !== this.size) {
|
|
13899
13899
|
this._throwError("incorrect data length", value);
|
|
13900
13900
|
}
|
|
@@ -14051,7 +14051,7 @@ function getUtf8CodePoints$2(bytes, onError) {
|
|
|
14051
14051
|
if (onError == null) {
|
|
14052
14052
|
onError = Utf8ErrorFuncs$2.error;
|
|
14053
14053
|
}
|
|
14054
|
-
bytes = arrayify$
|
|
14054
|
+
bytes = arrayify$4(bytes);
|
|
14055
14055
|
const result = [];
|
|
14056
14056
|
let i = 0;
|
|
14057
14057
|
// Invalid bytes are ignored
|
|
@@ -14165,7 +14165,7 @@ function toUtf8Bytes$2(str, form = UnicodeNormalizationForm$2.current) {
|
|
|
14165
14165
|
result.push((c & 0x3f) | 0x80);
|
|
14166
14166
|
}
|
|
14167
14167
|
}
|
|
14168
|
-
return arrayify$
|
|
14168
|
+
return arrayify$4(result);
|
|
14169
14169
|
}
|
|
14170
14170
|
function _toUtf8String$2(codePoints) {
|
|
14171
14171
|
return codePoints.map((codePoint) => {
|
|
@@ -14324,7 +14324,7 @@ class AbiCoder$1 {
|
|
|
14324
14324
|
decode(types, data, loose) {
|
|
14325
14325
|
const coders = types.map((type) => this._getCoder(ParamType$1.from(type)));
|
|
14326
14326
|
const coder = new TupleCoder$1(coders, "_");
|
|
14327
|
-
return coder.decode(this._getReader(arrayify$
|
|
14327
|
+
return coder.decode(this._getReader(arrayify$4(data), loose));
|
|
14328
14328
|
}
|
|
14329
14329
|
}
|
|
14330
14330
|
const defaultAbiCoder$1 = new AbiCoder$1();
|
|
@@ -14582,7 +14582,7 @@ class Interface$1 {
|
|
|
14582
14582
|
if (typeof (fragment) === "string") {
|
|
14583
14583
|
fragment = this.getError(fragment);
|
|
14584
14584
|
}
|
|
14585
|
-
const bytes = arrayify$
|
|
14585
|
+
const bytes = arrayify$4(data);
|
|
14586
14586
|
if (hexlify$4(bytes.slice(0, 4)) !== this.getSighash(fragment)) {
|
|
14587
14587
|
logger$y.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify$4(bytes));
|
|
14588
14588
|
}
|
|
@@ -14602,7 +14602,7 @@ class Interface$1 {
|
|
|
14602
14602
|
if (typeof (functionFragment) === "string") {
|
|
14603
14603
|
functionFragment = this.getFunction(functionFragment);
|
|
14604
14604
|
}
|
|
14605
|
-
const bytes = arrayify$
|
|
14605
|
+
const bytes = arrayify$4(data);
|
|
14606
14606
|
if (hexlify$4(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {
|
|
14607
14607
|
logger$y.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify$4(bytes));
|
|
14608
14608
|
}
|
|
@@ -14623,7 +14623,7 @@ class Interface$1 {
|
|
|
14623
14623
|
if (typeof (functionFragment) === "string") {
|
|
14624
14624
|
functionFragment = this.getFunction(functionFragment);
|
|
14625
14625
|
}
|
|
14626
|
-
let bytes = arrayify$
|
|
14626
|
+
let bytes = arrayify$4(data);
|
|
14627
14627
|
let reason = null;
|
|
14628
14628
|
let errorArgs = null;
|
|
14629
14629
|
let errorName = null;
|
|
@@ -14698,7 +14698,7 @@ class Interface$1 {
|
|
|
14698
14698
|
if (param.type === "address") {
|
|
14699
14699
|
this._abiCoder.encode(["address"], [value]);
|
|
14700
14700
|
}
|
|
14701
|
-
return hexZeroPad$
|
|
14701
|
+
return hexZeroPad$4(hexlify$4(value), 32);
|
|
14702
14702
|
};
|
|
14703
14703
|
values.forEach((value, index) => {
|
|
14704
14704
|
let param = eventFragment.inputs[index];
|
|
@@ -15461,7 +15461,7 @@ function populateTransaction$1(contract, fragment, args) {
|
|
|
15461
15461
|
// is always a non-nil to address, we can ignore G_create, but may wish to add
|
|
15462
15462
|
// similar logic to the ContractFactory.
|
|
15463
15463
|
let intrinsic = 21000;
|
|
15464
|
-
const bytes = arrayify$
|
|
15464
|
+
const bytes = arrayify$4(data);
|
|
15465
15465
|
for (let i = 0; i < bytes.length; i++) {
|
|
15466
15466
|
intrinsic += 4;
|
|
15467
15467
|
if (bytes[i]) {
|
|
@@ -16196,7 +16196,7 @@ class Contract$1 extends BaseContract$1 {
|
|
|
16196
16196
|
const version$m = "units/5.5.0";
|
|
16197
16197
|
|
|
16198
16198
|
const logger$t = new Logger$4(version$m);
|
|
16199
|
-
const names$
|
|
16199
|
+
const names$3 = [
|
|
16200
16200
|
"wei",
|
|
16201
16201
|
"kwei",
|
|
16202
16202
|
"mwei",
|
|
@@ -16207,24 +16207,24 @@ const names$2 = [
|
|
|
16207
16207
|
];
|
|
16208
16208
|
function formatUnits(value, unitName) {
|
|
16209
16209
|
if (typeof (unitName) === "string") {
|
|
16210
|
-
const index = names$
|
|
16210
|
+
const index = names$3.indexOf(unitName);
|
|
16211
16211
|
if (index !== -1) {
|
|
16212
16212
|
unitName = 3 * index;
|
|
16213
16213
|
}
|
|
16214
16214
|
}
|
|
16215
|
-
return formatFixed$
|
|
16215
|
+
return formatFixed$3(value, (unitName != null) ? unitName : 18);
|
|
16216
16216
|
}
|
|
16217
|
-
function parseUnits$
|
|
16217
|
+
function parseUnits$3(value, unitName) {
|
|
16218
16218
|
if (typeof (value) !== "string") {
|
|
16219
16219
|
logger$t.throwArgumentError("value must be a string", "value", value);
|
|
16220
16220
|
}
|
|
16221
16221
|
if (typeof (unitName) === "string") {
|
|
16222
|
-
const index = names$
|
|
16222
|
+
const index = names$3.indexOf(unitName);
|
|
16223
16223
|
if (index !== -1) {
|
|
16224
16224
|
unitName = 3 * index;
|
|
16225
16225
|
}
|
|
16226
16226
|
}
|
|
16227
|
-
return parseFixed$
|
|
16227
|
+
return parseFixed$3(value, (unitName != null) ? unitName : 18);
|
|
16228
16228
|
}
|
|
16229
16229
|
|
|
16230
16230
|
function _optionalChain$7(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }let getWindow = () => {
|
|
@@ -16778,13 +16778,13 @@ const logger$f$1 = new Logger$3(version$d$1);
|
|
|
16778
16778
|
function isHexable$3(value) {
|
|
16779
16779
|
return !!(value.toHexString);
|
|
16780
16780
|
}
|
|
16781
|
-
function addSlice$
|
|
16781
|
+
function addSlice$3(array) {
|
|
16782
16782
|
if (array.slice) {
|
|
16783
16783
|
return array;
|
|
16784
16784
|
}
|
|
16785
16785
|
array.slice = function () {
|
|
16786
16786
|
const args = Array.prototype.slice.call(arguments);
|
|
16787
|
-
return addSlice$
|
|
16787
|
+
return addSlice$3(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
16788
16788
|
};
|
|
16789
16789
|
return array;
|
|
16790
16790
|
}
|
|
@@ -16812,7 +16812,7 @@ function isBytes$3(value) {
|
|
|
16812
16812
|
}
|
|
16813
16813
|
return true;
|
|
16814
16814
|
}
|
|
16815
|
-
function arrayify$
|
|
16815
|
+
function arrayify$3(value, options) {
|
|
16816
16816
|
if (!options) {
|
|
16817
16817
|
options = {};
|
|
16818
16818
|
}
|
|
@@ -16826,7 +16826,7 @@ function arrayify$2(value, options) {
|
|
|
16826
16826
|
if (result.length === 0) {
|
|
16827
16827
|
result.push(0);
|
|
16828
16828
|
}
|
|
16829
|
-
return addSlice$
|
|
16829
|
+
return addSlice$3(new Uint8Array(result));
|
|
16830
16830
|
}
|
|
16831
16831
|
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
16832
16832
|
value = "0x" + value;
|
|
@@ -16851,25 +16851,25 @@ function arrayify$2(value, options) {
|
|
|
16851
16851
|
for (let i = 0; i < hex.length; i += 2) {
|
|
16852
16852
|
result.push(parseInt(hex.substring(i, i + 2), 16));
|
|
16853
16853
|
}
|
|
16854
|
-
return addSlice$
|
|
16854
|
+
return addSlice$3(new Uint8Array(result));
|
|
16855
16855
|
}
|
|
16856
16856
|
if (isBytes$3(value)) {
|
|
16857
|
-
return addSlice$
|
|
16857
|
+
return addSlice$3(new Uint8Array(value));
|
|
16858
16858
|
}
|
|
16859
16859
|
return logger$f$1.throwArgumentError("invalid arrayify value", "value", value);
|
|
16860
16860
|
}
|
|
16861
16861
|
function concat$1(items) {
|
|
16862
|
-
const objects = items.map(item => arrayify$
|
|
16862
|
+
const objects = items.map(item => arrayify$3(item));
|
|
16863
16863
|
const length = objects.reduce((accum, item) => (accum + item.length), 0);
|
|
16864
16864
|
const result = new Uint8Array(length);
|
|
16865
16865
|
objects.reduce((offset, object) => {
|
|
16866
16866
|
result.set(object, offset);
|
|
16867
16867
|
return offset + object.length;
|
|
16868
16868
|
}, 0);
|
|
16869
|
-
return addSlice$
|
|
16869
|
+
return addSlice$3(result);
|
|
16870
16870
|
}
|
|
16871
16871
|
function stripZeros$1(value) {
|
|
16872
|
-
let result = arrayify$
|
|
16872
|
+
let result = arrayify$3(value);
|
|
16873
16873
|
if (result.length === 0) {
|
|
16874
16874
|
return result;
|
|
16875
16875
|
}
|
|
@@ -16885,13 +16885,13 @@ function stripZeros$1(value) {
|
|
|
16885
16885
|
return result;
|
|
16886
16886
|
}
|
|
16887
16887
|
function zeroPad$1(value, length) {
|
|
16888
|
-
value = arrayify$
|
|
16888
|
+
value = arrayify$3(value);
|
|
16889
16889
|
if (value.length > length) {
|
|
16890
16890
|
logger$f$1.throwArgumentError("value out of range", "value", arguments[0]);
|
|
16891
16891
|
}
|
|
16892
16892
|
const result = new Uint8Array(length);
|
|
16893
16893
|
result.set(value, length - value.length);
|
|
16894
|
-
return addSlice$
|
|
16894
|
+
return addSlice$3(result);
|
|
16895
16895
|
}
|
|
16896
16896
|
function isHexString$3(value, length) {
|
|
16897
16897
|
if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
|
|
@@ -17017,7 +17017,7 @@ function hexStripZeros$1(value) {
|
|
|
17017
17017
|
}
|
|
17018
17018
|
return "0x" + value.substring(offset);
|
|
17019
17019
|
}
|
|
17020
|
-
function hexZeroPad$
|
|
17020
|
+
function hexZeroPad$3(value, length) {
|
|
17021
17021
|
if (typeof (value) !== "string") {
|
|
17022
17022
|
value = hexlify$3(value);
|
|
17023
17023
|
}
|
|
@@ -17041,7 +17041,7 @@ function splitSignature$1(signature) {
|
|
|
17041
17041
|
v: 0
|
|
17042
17042
|
};
|
|
17043
17043
|
if (isBytesLike$1(signature)) {
|
|
17044
|
-
const bytes = arrayify$
|
|
17044
|
+
const bytes = arrayify$3(signature);
|
|
17045
17045
|
if (bytes.length !== 65) {
|
|
17046
17046
|
logger$f$1.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
|
|
17047
17047
|
}
|
|
@@ -17075,7 +17075,7 @@ function splitSignature$1(signature) {
|
|
|
17075
17075
|
// If the _vs is available, use it to populate missing s, v and recoveryParam
|
|
17076
17076
|
// and verify non-missing s, v and recoveryParam
|
|
17077
17077
|
if (result._vs != null) {
|
|
17078
|
-
const vs = zeroPad$1(arrayify$
|
|
17078
|
+
const vs = zeroPad$1(arrayify$3(result._vs), 32);
|
|
17079
17079
|
result._vs = hexlify$3(vs);
|
|
17080
17080
|
// Set or check the recid
|
|
17081
17081
|
const recoveryParam = ((vs[0] >= 128) ? 1 : 0);
|
|
@@ -17119,15 +17119,15 @@ function splitSignature$1(signature) {
|
|
|
17119
17119
|
logger$f$1.throwArgumentError("signature missing or invalid r", "signature", signature);
|
|
17120
17120
|
}
|
|
17121
17121
|
else {
|
|
17122
|
-
result.r = hexZeroPad$
|
|
17122
|
+
result.r = hexZeroPad$3(result.r, 32);
|
|
17123
17123
|
}
|
|
17124
17124
|
if (result.s == null || !isHexString$3(result.s)) {
|
|
17125
17125
|
logger$f$1.throwArgumentError("signature missing or invalid s", "signature", signature);
|
|
17126
17126
|
}
|
|
17127
17127
|
else {
|
|
17128
|
-
result.s = hexZeroPad$
|
|
17128
|
+
result.s = hexZeroPad$3(result.s, 32);
|
|
17129
17129
|
}
|
|
17130
|
-
const vs = arrayify$
|
|
17130
|
+
const vs = arrayify$3(result.s);
|
|
17131
17131
|
if (vs[0] >= 128) {
|
|
17132
17132
|
logger$f$1.throwArgumentError("signature s out of range", "signature", signature);
|
|
17133
17133
|
}
|
|
@@ -17139,7 +17139,7 @@ function splitSignature$1(signature) {
|
|
|
17139
17139
|
if (!isHexString$3(result._vs)) {
|
|
17140
17140
|
logger$f$1.throwArgumentError("signature invalid _vs", "signature", signature);
|
|
17141
17141
|
}
|
|
17142
|
-
result._vs = hexZeroPad$
|
|
17142
|
+
result._vs = hexZeroPad$3(result._vs, 32);
|
|
17143
17143
|
}
|
|
17144
17144
|
// Set or check the _vs
|
|
17145
17145
|
if (result._vs == null) {
|
|
@@ -17153,7 +17153,7 @@ function splitSignature$1(signature) {
|
|
|
17153
17153
|
}
|
|
17154
17154
|
|
|
17155
17155
|
function encode$2$1(data) {
|
|
17156
|
-
data = arrayify$
|
|
17156
|
+
data = arrayify$3(data);
|
|
17157
17157
|
let textData = "";
|
|
17158
17158
|
for (let i = 0; i < data.length; i++) {
|
|
17159
17159
|
textData += String.fromCharCode(data[i]);
|
|
@@ -20620,14 +20620,14 @@ const version$c$1 = "bignumber/5.4.1";
|
|
|
20620
20620
|
|
|
20621
20621
|
var BN$3 = bn$3.BN;
|
|
20622
20622
|
const logger$e$1 = new Logger$3(version$c$1);
|
|
20623
|
-
const _constructorGuard$1$
|
|
20623
|
+
const _constructorGuard$1$3 = {};
|
|
20624
20624
|
const MAX_SAFE$3 = 0x1fffffffffffff;
|
|
20625
20625
|
// Only warn about passing 10 into radix once
|
|
20626
20626
|
let _warnedToStringRadix$3 = false;
|
|
20627
20627
|
class BigNumber$3 {
|
|
20628
20628
|
constructor(constructorGuard, hex) {
|
|
20629
20629
|
logger$e$1.checkNew(new.target, BigNumber$3);
|
|
20630
|
-
if (constructorGuard !== _constructorGuard$1$
|
|
20630
|
+
if (constructorGuard !== _constructorGuard$1$3) {
|
|
20631
20631
|
logger$e$1.throwError("cannot call constructor directly; use BigNumber.from", Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
20632
20632
|
operation: "new (BigNumber)"
|
|
20633
20633
|
});
|
|
@@ -20786,10 +20786,10 @@ class BigNumber$3 {
|
|
|
20786
20786
|
}
|
|
20787
20787
|
if (typeof (value) === "string") {
|
|
20788
20788
|
if (value.match(/^-?0x[0-9a-f]+$/i)) {
|
|
20789
|
-
return new BigNumber$3(_constructorGuard$1$
|
|
20789
|
+
return new BigNumber$3(_constructorGuard$1$3, toHex$1$2(value));
|
|
20790
20790
|
}
|
|
20791
20791
|
if (value.match(/^-?[0-9]+$/)) {
|
|
20792
|
-
return new BigNumber$3(_constructorGuard$1$
|
|
20792
|
+
return new BigNumber$3(_constructorGuard$1$3, toHex$1$2(new BN$3(value)));
|
|
20793
20793
|
}
|
|
20794
20794
|
return logger$e$1.throwArgumentError("invalid BigNumber string", "value", value);
|
|
20795
20795
|
}
|
|
@@ -20900,7 +20900,7 @@ function _base36To16$2(value) {
|
|
|
20900
20900
|
return (new BN$3(value, 36)).toString(16);
|
|
20901
20901
|
}
|
|
20902
20902
|
|
|
20903
|
-
const Zero$1$
|
|
20903
|
+
const Zero$1$2 = ( /*#__PURE__*/BigNumber$3.from(0));
|
|
20904
20904
|
|
|
20905
20905
|
const HashZero$1 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
20906
20906
|
|
|
@@ -20988,7 +20988,7 @@ function getUtf8CodePoints$1(bytes, onError) {
|
|
|
20988
20988
|
if (onError == null) {
|
|
20989
20989
|
onError = Utf8ErrorFuncs$1.error;
|
|
20990
20990
|
}
|
|
20991
|
-
bytes = arrayify$
|
|
20991
|
+
bytes = arrayify$3(bytes);
|
|
20992
20992
|
const result = [];
|
|
20993
20993
|
let i = 0;
|
|
20994
20994
|
// Invalid bytes are ignored
|
|
@@ -21102,7 +21102,7 @@ function toUtf8Bytes$1(str, form = UnicodeNormalizationForm$1.current) {
|
|
|
21102
21102
|
result.push((c & 0x3f) | 0x80);
|
|
21103
21103
|
}
|
|
21104
21104
|
}
|
|
21105
|
-
return arrayify$
|
|
21105
|
+
return arrayify$3(result);
|
|
21106
21106
|
}
|
|
21107
21107
|
function _toUtf8String$1(codePoints) {
|
|
21108
21108
|
return codePoints.map((codePoint) => {
|
|
@@ -21349,7 +21349,7 @@ function getUrl$1(href, options) {
|
|
|
21349
21349
|
headers: headers,
|
|
21350
21350
|
statusCode: response.status,
|
|
21351
21351
|
statusMessage: response.statusText,
|
|
21352
|
-
body: arrayify$
|
|
21352
|
+
body: arrayify$3(new Uint8Array(body)),
|
|
21353
21353
|
};
|
|
21354
21354
|
});
|
|
21355
21355
|
}
|
|
@@ -22028,7 +22028,7 @@ class BaseX$1 {
|
|
|
22028
22028
|
}
|
|
22029
22029
|
}
|
|
22030
22030
|
encode(value) {
|
|
22031
|
-
let source = arrayify$
|
|
22031
|
+
let source = arrayify$3(value);
|
|
22032
22032
|
if (source.length === 0) {
|
|
22033
22033
|
return "";
|
|
22034
22034
|
}
|
|
@@ -22085,7 +22085,7 @@ class BaseX$1 {
|
|
|
22085
22085
|
for (let k = 0; value[k] === this._leader && k < value.length - 1; ++k) {
|
|
22086
22086
|
bytes.push(0);
|
|
22087
22087
|
}
|
|
22088
|
-
return arrayify$
|
|
22088
|
+
return arrayify$3(new Uint8Array(bytes.reverse()));
|
|
22089
22089
|
}
|
|
22090
22090
|
}
|
|
22091
22091
|
new BaseX$1("abcdefghijklmnopqrstuvwxyz234567");
|
|
@@ -22574,7 +22574,7 @@ var sha3$3 = createCommonjsModule$1$2(function (module) {
|
|
|
22574
22574
|
var sha3$1$2 = sha3$3;
|
|
22575
22575
|
|
|
22576
22576
|
function keccak256$2(data) {
|
|
22577
|
-
return '0x' + sha3$1$2.keccak_256(arrayify$
|
|
22577
|
+
return '0x' + sha3$1$2.keccak_256(arrayify$3(data));
|
|
22578
22578
|
}
|
|
22579
22579
|
|
|
22580
22580
|
function id$1(text) {
|
|
@@ -22641,7 +22641,7 @@ function _encode$1(object) {
|
|
|
22641
22641
|
if (!isBytesLike$1(object)) {
|
|
22642
22642
|
logger$8$1.throwArgumentError("RLP object must be BytesLike", "object", object);
|
|
22643
22643
|
}
|
|
22644
|
-
const data = Array.prototype.slice.call(arrayify$
|
|
22644
|
+
const data = Array.prototype.slice.call(arrayify$3(object));
|
|
22645
22645
|
if (data.length === 1 && data[0] <= 0x7f) {
|
|
22646
22646
|
return data;
|
|
22647
22647
|
}
|
|
@@ -22715,7 +22715,7 @@ function _decode$1(data, offset) {
|
|
|
22715
22715
|
return { consumed: 1, result: hexlify$3(data[offset]) };
|
|
22716
22716
|
}
|
|
22717
22717
|
function decode$1$1(data) {
|
|
22718
|
-
const bytes = arrayify$
|
|
22718
|
+
const bytes = arrayify$3(data);
|
|
22719
22719
|
const decoded = _decode$1(bytes, 0);
|
|
22720
22720
|
if (decoded.consumed !== bytes.length) {
|
|
22721
22721
|
logger$8$1.throwArgumentError("invalid rlp data", "data", data);
|
|
@@ -22736,7 +22736,7 @@ function getChecksumAddress$2(address) {
|
|
|
22736
22736
|
for (let i = 0; i < 40; i++) {
|
|
22737
22737
|
expanded[i] = chars[i].charCodeAt(0);
|
|
22738
22738
|
}
|
|
22739
|
-
const hashed = arrayify$
|
|
22739
|
+
const hashed = arrayify$3(keccak256$2(expanded));
|
|
22740
22740
|
for (let i = 0; i < 40; i += 2) {
|
|
22741
22741
|
if ((hashed[i >> 1] >> 4) >= 8) {
|
|
22742
22742
|
chars[i] = chars[i].toUpperCase();
|
|
@@ -22823,7 +22823,7 @@ function getContractAddress$1(transaction) {
|
|
|
22823
22823
|
catch (error) {
|
|
22824
22824
|
logger$7$1.throwArgumentError("missing from address", "transaction", transaction);
|
|
22825
22825
|
}
|
|
22826
|
-
const nonce = stripZeros$1(arrayify$
|
|
22826
|
+
const nonce = stripZeros$1(arrayify$3(BigNumber$3.from(transaction.nonce).toHexString()));
|
|
22827
22827
|
return getAddress$2(hexDataSlice$1(keccak256$2(encode$1$1([from, nonce])), 12));
|
|
22828
22828
|
}
|
|
22829
22829
|
|
|
@@ -22844,15 +22844,15 @@ const Zero$4 = BigNumber$3.from(0);
|
|
|
22844
22844
|
const One$2 = BigNumber$3.from(1);
|
|
22845
22845
|
const MaxUint256$2 = BigNumber$3.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
|
22846
22846
|
function hexPadRight$1(value) {
|
|
22847
|
-
const bytes = arrayify$
|
|
22847
|
+
const bytes = arrayify$3(value);
|
|
22848
22848
|
const padOffset = bytes.length % 32;
|
|
22849
22849
|
if (padOffset) {
|
|
22850
22850
|
return hexConcat$1([bytes, padding$1.slice(padOffset)]);
|
|
22851
22851
|
}
|
|
22852
22852
|
return hexlify$3(bytes);
|
|
22853
22853
|
}
|
|
22854
|
-
const hexTrue$1 = hexZeroPad$
|
|
22855
|
-
const hexFalse$1 = hexZeroPad$
|
|
22854
|
+
const hexTrue$1 = hexZeroPad$3(One$2.toHexString(), 32);
|
|
22855
|
+
const hexFalse$1 = hexZeroPad$3(Zero$4.toHexString(), 32);
|
|
22856
22856
|
const domainFieldTypes$1 = {
|
|
22857
22857
|
name: "string",
|
|
22858
22858
|
version: "string",
|
|
@@ -22890,7 +22890,7 @@ const domainChecks$1 = {
|
|
|
22890
22890
|
},
|
|
22891
22891
|
salt: function (value) {
|
|
22892
22892
|
try {
|
|
22893
|
-
const bytes = arrayify$
|
|
22893
|
+
const bytes = arrayify$3(value);
|
|
22894
22894
|
if (bytes.length !== 32) {
|
|
22895
22895
|
throw new Error("bad length");
|
|
22896
22896
|
}
|
|
@@ -22917,7 +22917,7 @@ function getBaseEncoder$1(type) {
|
|
|
22917
22917
|
if (v.lt(boundsLower) || v.gt(boundsUpper)) {
|
|
22918
22918
|
logger$6$1.throwArgumentError(`value out-of-bounds for ${type}`, "value", value);
|
|
22919
22919
|
}
|
|
22920
|
-
return hexZeroPad$
|
|
22920
|
+
return hexZeroPad$3(v.toTwos(256).toHexString(), 32);
|
|
22921
22921
|
};
|
|
22922
22922
|
}
|
|
22923
22923
|
}
|
|
@@ -22930,7 +22930,7 @@ function getBaseEncoder$1(type) {
|
|
|
22930
22930
|
logger$6$1.throwArgumentError("invalid bytes width", "type", type);
|
|
22931
22931
|
}
|
|
22932
22932
|
return function (value) {
|
|
22933
|
-
const bytes = arrayify$
|
|
22933
|
+
const bytes = arrayify$3(value);
|
|
22934
22934
|
if (bytes.length !== width) {
|
|
22935
22935
|
logger$6$1.throwArgumentError(`invalid length for ${type}`, "value", value);
|
|
22936
22936
|
}
|
|
@@ -22940,7 +22940,7 @@ function getBaseEncoder$1(type) {
|
|
|
22940
22940
|
}
|
|
22941
22941
|
switch (type) {
|
|
22942
22942
|
case "address": return function (value) {
|
|
22943
|
-
return hexZeroPad$
|
|
22943
|
+
return hexZeroPad$3(getAddress$2(value), 32);
|
|
22944
22944
|
};
|
|
22945
22945
|
case "bool": return function (value) {
|
|
22946
22946
|
return ((!value) ? hexFalse$1 : hexTrue$1);
|
|
@@ -23237,7 +23237,7 @@ class TypedDataEncoder$1 {
|
|
|
23237
23237
|
message: encoder.visit(value, (type, value) => {
|
|
23238
23238
|
// bytes
|
|
23239
23239
|
if (type.match(/^bytes(\d*)/)) {
|
|
23240
|
-
return hexlify$3(arrayify$
|
|
23240
|
+
return hexlify$3(arrayify$3(value));
|
|
23241
23241
|
}
|
|
23242
23242
|
// uint or int
|
|
23243
23243
|
if (type.match(/^u?int/)) {
|
|
@@ -24542,7 +24542,7 @@ const version$4$2 = "sha2/5.4.0";
|
|
|
24542
24542
|
|
|
24543
24543
|
new Logger$3(version$4$2);
|
|
24544
24544
|
function sha256$2(data) {
|
|
24545
|
-
return "0x" + (hash$1.sha256().update(arrayify$
|
|
24545
|
+
return "0x" + (hash$1.sha256().update(arrayify$3(data)).digest("hex"));
|
|
24546
24546
|
}
|
|
24547
24547
|
|
|
24548
24548
|
var ALPHABET$1 = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l';
|
|
@@ -24727,7 +24727,7 @@ var bech32$1 = {
|
|
|
24727
24727
|
fromWords: fromWords$1
|
|
24728
24728
|
};
|
|
24729
24729
|
|
|
24730
|
-
const version$3$
|
|
24730
|
+
const version$3$3 = "providers/5.4.5";
|
|
24731
24731
|
|
|
24732
24732
|
function createCommonjsModule$3(fn, basedir, module) {
|
|
24733
24733
|
return module = {
|
|
@@ -27169,33 +27169,33 @@ class SigningKey$1 {
|
|
|
27169
27169
|
constructor(privateKey) {
|
|
27170
27170
|
defineReadOnly$1(this, "curve", "secp256k1");
|
|
27171
27171
|
defineReadOnly$1(this, "privateKey", hexlify$3(privateKey));
|
|
27172
|
-
const keyPair = getCurve$1().keyFromPrivate(arrayify$
|
|
27172
|
+
const keyPair = getCurve$1().keyFromPrivate(arrayify$3(this.privateKey));
|
|
27173
27173
|
defineReadOnly$1(this, "publicKey", "0x" + keyPair.getPublic(false, "hex"));
|
|
27174
27174
|
defineReadOnly$1(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex"));
|
|
27175
27175
|
defineReadOnly$1(this, "_isSigningKey", true);
|
|
27176
27176
|
}
|
|
27177
27177
|
_addPoint(other) {
|
|
27178
|
-
const p0 = getCurve$1().keyFromPublic(arrayify$
|
|
27179
|
-
const p1 = getCurve$1().keyFromPublic(arrayify$
|
|
27178
|
+
const p0 = getCurve$1().keyFromPublic(arrayify$3(this.publicKey));
|
|
27179
|
+
const p1 = getCurve$1().keyFromPublic(arrayify$3(other));
|
|
27180
27180
|
return "0x" + p0.pub.add(p1.pub).encodeCompressed("hex");
|
|
27181
27181
|
}
|
|
27182
27182
|
signDigest(digest) {
|
|
27183
|
-
const keyPair = getCurve$1().keyFromPrivate(arrayify$
|
|
27184
|
-
const digestBytes = arrayify$
|
|
27183
|
+
const keyPair = getCurve$1().keyFromPrivate(arrayify$3(this.privateKey));
|
|
27184
|
+
const digestBytes = arrayify$3(digest);
|
|
27185
27185
|
if (digestBytes.length !== 32) {
|
|
27186
27186
|
logger$5$2.throwArgumentError("bad digest length", "digest", digest);
|
|
27187
27187
|
}
|
|
27188
27188
|
const signature = keyPair.sign(digestBytes, { canonical: true });
|
|
27189
27189
|
return splitSignature$1({
|
|
27190
27190
|
recoveryParam: signature.recoveryParam,
|
|
27191
|
-
r: hexZeroPad$
|
|
27192
|
-
s: hexZeroPad$
|
|
27191
|
+
r: hexZeroPad$3("0x" + signature.r.toString(16), 32),
|
|
27192
|
+
s: hexZeroPad$3("0x" + signature.s.toString(16), 32),
|
|
27193
27193
|
});
|
|
27194
27194
|
}
|
|
27195
27195
|
computeSharedSecret(otherKey) {
|
|
27196
|
-
const keyPair = getCurve$1().keyFromPrivate(arrayify$
|
|
27197
|
-
const otherKeyPair = getCurve$1().keyFromPublic(arrayify$
|
|
27198
|
-
return hexZeroPad$
|
|
27196
|
+
const keyPair = getCurve$1().keyFromPrivate(arrayify$3(this.privateKey));
|
|
27197
|
+
const otherKeyPair = getCurve$1().keyFromPublic(arrayify$3(computePublicKey$1(otherKey)));
|
|
27198
|
+
return hexZeroPad$3("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);
|
|
27199
27199
|
}
|
|
27200
27200
|
static isSigningKey(value) {
|
|
27201
27201
|
return !!(value && value._isSigningKey);
|
|
@@ -27203,11 +27203,11 @@ class SigningKey$1 {
|
|
|
27203
27203
|
}
|
|
27204
27204
|
function recoverPublicKey$1(digest, signature) {
|
|
27205
27205
|
const sig = splitSignature$1(signature);
|
|
27206
|
-
const rs = { r: arrayify$
|
|
27207
|
-
return "0x" + getCurve$1().recoverPubKey(arrayify$
|
|
27206
|
+
const rs = { r: arrayify$3(sig.r), s: arrayify$3(sig.s) };
|
|
27207
|
+
return "0x" + getCurve$1().recoverPubKey(arrayify$3(digest), rs, sig.recoveryParam).encode("hex", false);
|
|
27208
27208
|
}
|
|
27209
27209
|
function computePublicKey$1(key, compressed) {
|
|
27210
|
-
const bytes = arrayify$
|
|
27210
|
+
const bytes = arrayify$3(key);
|
|
27211
27211
|
if (bytes.length === 32) {
|
|
27212
27212
|
const signingKey = new SigningKey$1(bytes);
|
|
27213
27213
|
if (compressed) {
|
|
@@ -27248,7 +27248,7 @@ function handleAddress$1(value) {
|
|
|
27248
27248
|
}
|
|
27249
27249
|
function handleNumber$1(value) {
|
|
27250
27250
|
if (value === "0x") {
|
|
27251
|
-
return Zero$1$
|
|
27251
|
+
return Zero$1$2;
|
|
27252
27252
|
}
|
|
27253
27253
|
return BigNumber$3.from(value);
|
|
27254
27254
|
}
|
|
@@ -27257,7 +27257,7 @@ function computeAddress$1(key) {
|
|
|
27257
27257
|
return getAddress$2(hexDataSlice$1(keccak256$2(hexDataSlice$1(publicKey, 1)), 12));
|
|
27258
27258
|
}
|
|
27259
27259
|
function recoverAddress$1(digest, signature) {
|
|
27260
|
-
return computeAddress$1(recoverPublicKey$1(arrayify$
|
|
27260
|
+
return computeAddress$1(recoverPublicKey$1(arrayify$3(digest), signature));
|
|
27261
27261
|
}
|
|
27262
27262
|
function formatNumber$1(value, name) {
|
|
27263
27263
|
const result = stripZeros$1(BigNumber$3.from(value).toHexString());
|
|
@@ -27364,8 +27364,8 @@ function _parseEipSignature$1(tx, fields, serialize) {
|
|
|
27364
27364
|
catch (error) {
|
|
27365
27365
|
logger$4$2.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]);
|
|
27366
27366
|
}
|
|
27367
|
-
tx.r = hexZeroPad$
|
|
27368
|
-
tx.s = hexZeroPad$
|
|
27367
|
+
tx.r = hexZeroPad$3(fields[1], 32);
|
|
27368
|
+
tx.s = hexZeroPad$3(fields[2], 32);
|
|
27369
27369
|
try {
|
|
27370
27370
|
const digest = keccak256$2(serialize(tx));
|
|
27371
27371
|
tx.from = recoverAddress$1(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v });
|
|
@@ -27452,8 +27452,8 @@ function _parse$1(rawTransaction) {
|
|
|
27452
27452
|
console.log(error);
|
|
27453
27453
|
return tx;
|
|
27454
27454
|
}
|
|
27455
|
-
tx.r = hexZeroPad$
|
|
27456
|
-
tx.s = hexZeroPad$
|
|
27455
|
+
tx.r = hexZeroPad$3(transaction[7], 32);
|
|
27456
|
+
tx.s = hexZeroPad$3(transaction[8], 32);
|
|
27457
27457
|
if (BigNumber$3.from(tx.r).isZero() && BigNumber$3.from(tx.s).isZero()) {
|
|
27458
27458
|
// EIP-155 unsigned transaction
|
|
27459
27459
|
tx.chainId = tx.v;
|
|
@@ -27486,7 +27486,7 @@ function _parse$1(rawTransaction) {
|
|
|
27486
27486
|
return tx;
|
|
27487
27487
|
}
|
|
27488
27488
|
function parse$1(rawTransaction) {
|
|
27489
|
-
const payload = arrayify$
|
|
27489
|
+
const payload = arrayify$3(rawTransaction);
|
|
27490
27490
|
// Legacy and EIP-155 Transactions
|
|
27491
27491
|
if (payload[0] > 0x7f) {
|
|
27492
27492
|
return _parse$1(payload);
|
|
@@ -27504,10 +27504,10 @@ function parse$1(rawTransaction) {
|
|
|
27504
27504
|
});
|
|
27505
27505
|
}
|
|
27506
27506
|
|
|
27507
|
-
const logger$3$
|
|
27507
|
+
const logger$3$3 = new Logger$3(version$3$3);
|
|
27508
27508
|
class Formatter$1 {
|
|
27509
27509
|
constructor() {
|
|
27510
|
-
logger$3$
|
|
27510
|
+
logger$3$3.checkNew(new.target, Formatter$1);
|
|
27511
27511
|
this.formats = this.getDefaultFormats();
|
|
27512
27512
|
}
|
|
27513
27513
|
getDefaultFormats() {
|
|
@@ -27670,7 +27670,7 @@ class Formatter$1 {
|
|
|
27670
27670
|
return value.toLowerCase();
|
|
27671
27671
|
}
|
|
27672
27672
|
}
|
|
27673
|
-
return logger$3$
|
|
27673
|
+
return logger$3$3.throwArgumentError("invalid hash", "value", value);
|
|
27674
27674
|
}
|
|
27675
27675
|
data(value, strict) {
|
|
27676
27676
|
const result = this.hex(value, strict);
|
|
@@ -27714,7 +27714,7 @@ class Formatter$1 {
|
|
|
27714
27714
|
hash(value, strict) {
|
|
27715
27715
|
const result = this.hex(value, strict);
|
|
27716
27716
|
if (hexDataLength$1(result) !== 32) {
|
|
27717
|
-
return logger$3$
|
|
27717
|
+
return logger$3$3.throwArgumentError("invalid hash", "value", value);
|
|
27718
27718
|
}
|
|
27719
27719
|
return result;
|
|
27720
27720
|
}
|
|
@@ -27734,7 +27734,7 @@ class Formatter$1 {
|
|
|
27734
27734
|
if (!isHexString$3(value)) {
|
|
27735
27735
|
throw new Error("invalid uint256");
|
|
27736
27736
|
}
|
|
27737
|
-
return hexZeroPad$
|
|
27737
|
+
return hexZeroPad$3(value, 32);
|
|
27738
27738
|
}
|
|
27739
27739
|
_block(value, format) {
|
|
27740
27740
|
if (value.author != null && value.miner == null) {
|
|
@@ -27824,18 +27824,18 @@ class Formatter$1 {
|
|
|
27824
27824
|
if (value === 0 || value === 1) {
|
|
27825
27825
|
// Make sure if both are specified, they match
|
|
27826
27826
|
if (result.status != null && (result.status !== value)) {
|
|
27827
|
-
logger$3$
|
|
27827
|
+
logger$3$3.throwArgumentError("alt-root-status/status mismatch", "value", { root: result.root, status: result.status });
|
|
27828
27828
|
}
|
|
27829
27829
|
result.status = value;
|
|
27830
27830
|
delete result.root;
|
|
27831
27831
|
}
|
|
27832
27832
|
else {
|
|
27833
|
-
logger$3$
|
|
27833
|
+
logger$3$3.throwArgumentError("invalid alt-root-status", "value.root", result.root);
|
|
27834
27834
|
}
|
|
27835
27835
|
}
|
|
27836
27836
|
else if (result.root.length !== 66) {
|
|
27837
27837
|
// Must be a valid bytes32
|
|
27838
|
-
logger$3$
|
|
27838
|
+
logger$3$3.throwArgumentError("invalid root hash", "value.root", result.root);
|
|
27839
27839
|
}
|
|
27840
27840
|
}
|
|
27841
27841
|
if (result.status != null) {
|
|
@@ -27917,7 +27917,7 @@ var __awaiter$2$1 = function (thisArg, _arguments, P, generator) {
|
|
|
27917
27917
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27918
27918
|
});
|
|
27919
27919
|
};
|
|
27920
|
-
const logger$2$
|
|
27920
|
+
const logger$2$3 = new Logger$3(version$3$3);
|
|
27921
27921
|
//////////////////////////////
|
|
27922
27922
|
// Event Serializeing
|
|
27923
27923
|
function checkTopic$1(topic) {
|
|
@@ -27925,7 +27925,7 @@ function checkTopic$1(topic) {
|
|
|
27925
27925
|
return "null";
|
|
27926
27926
|
}
|
|
27927
27927
|
if (hexDataLength$1(topic) !== 32) {
|
|
27928
|
-
logger$2$
|
|
27928
|
+
logger$2$3.throwArgumentError("invalid topic", "topic", topic);
|
|
27929
27929
|
}
|
|
27930
27930
|
return topic.toLowerCase();
|
|
27931
27931
|
}
|
|
@@ -27980,7 +27980,7 @@ function getEventTag$2(eventName) {
|
|
|
27980
27980
|
return "filter:*:" + serializeTopics$1(eventName);
|
|
27981
27981
|
}
|
|
27982
27982
|
else if (ForkEvent$1.isForkEvent(eventName)) {
|
|
27983
|
-
logger$2$
|
|
27983
|
+
logger$2$3.warn("not implemented");
|
|
27984
27984
|
throw new Error("not implemented");
|
|
27985
27985
|
}
|
|
27986
27986
|
else if (eventName && typeof (eventName) === "object") {
|
|
@@ -28068,7 +28068,7 @@ const coinInfos$1 = {
|
|
|
28068
28068
|
"700": { symbol: "xdai", ilk: "eth" },
|
|
28069
28069
|
};
|
|
28070
28070
|
function bytes32ify$1(value) {
|
|
28071
|
-
return hexZeroPad$
|
|
28071
|
+
return hexZeroPad$3(BigNumber$3.from(value).toHexString(), 32);
|
|
28072
28072
|
}
|
|
28073
28073
|
// Compute the Base58Check encoded data (checksum is first 4 bytes of sha256d)
|
|
28074
28074
|
function base58Encode$1(data) {
|
|
@@ -28107,14 +28107,14 @@ class Resolver$1 {
|
|
|
28107
28107
|
_getAddress(coinType, hexBytes) {
|
|
28108
28108
|
const coinInfo = coinInfos$1[String(coinType)];
|
|
28109
28109
|
if (coinInfo == null) {
|
|
28110
|
-
logger$2$
|
|
28110
|
+
logger$2$3.throwError(`unsupported coin type: ${coinType}`, Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
28111
28111
|
operation: `getAddress(${coinType})`
|
|
28112
28112
|
});
|
|
28113
28113
|
}
|
|
28114
28114
|
if (coinInfo.ilk === "eth") {
|
|
28115
28115
|
return this.provider.formatter.address(hexBytes);
|
|
28116
28116
|
}
|
|
28117
|
-
const bytes = arrayify$
|
|
28117
|
+
const bytes = arrayify$3(hexBytes);
|
|
28118
28118
|
// P2PKH: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
|
|
28119
28119
|
if (coinInfo.p2pkh != null) {
|
|
28120
28120
|
const p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);
|
|
@@ -28192,7 +28192,7 @@ class Resolver$1 {
|
|
|
28192
28192
|
// Compute the address
|
|
28193
28193
|
const address = this._getAddress(coinType, hexBytes);
|
|
28194
28194
|
if (address == null) {
|
|
28195
|
-
logger$2$
|
|
28195
|
+
logger$2$3.throwError(`invalid or unsupported coin data`, Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
28196
28196
|
operation: `getAddress(${coinType})`,
|
|
28197
28197
|
coinType: coinType,
|
|
28198
28198
|
data: hexBytes
|
|
@@ -28224,7 +28224,7 @@ class Resolver$1 {
|
|
|
28224
28224
|
return "bzz:/\/" + swarm[1];
|
|
28225
28225
|
}
|
|
28226
28226
|
}
|
|
28227
|
-
return logger$2$
|
|
28227
|
+
return logger$2$3.throwError(`invalid or unsupported content hash data`, Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
28228
28228
|
operation: "getContentHash()",
|
|
28229
28229
|
data: hexBytes
|
|
28230
28230
|
});
|
|
@@ -28239,7 +28239,7 @@ class Resolver$1 {
|
|
|
28239
28239
|
keyBytes = concat$1([bytes32ify$1(64), bytes32ify$1(keyBytes.length), keyBytes]);
|
|
28240
28240
|
// Pad to word-size (32 bytes)
|
|
28241
28241
|
if ((keyBytes.length % 32) !== 0) {
|
|
28242
|
-
keyBytes = concat$1([keyBytes, hexZeroPad$
|
|
28242
|
+
keyBytes = concat$1([keyBytes, hexZeroPad$3("0x", 32 - (key.length % 32))]);
|
|
28243
28243
|
}
|
|
28244
28244
|
const hexBytes = yield this._fetchBytes("0x59d1d43c", hexlify$3(keyBytes));
|
|
28245
28245
|
if (hexBytes == null || hexBytes === "0x") {
|
|
@@ -28262,7 +28262,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28262
28262
|
*
|
|
28263
28263
|
*/
|
|
28264
28264
|
constructor(network) {
|
|
28265
|
-
logger$2$
|
|
28265
|
+
logger$2$3.checkNew(new.target, Provider$1);
|
|
28266
28266
|
super();
|
|
28267
28267
|
// Events being listened to
|
|
28268
28268
|
this._events = [];
|
|
@@ -28289,7 +28289,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28289
28289
|
this.emit("network", knownNetwork, null);
|
|
28290
28290
|
}
|
|
28291
28291
|
else {
|
|
28292
|
-
logger$2$
|
|
28292
|
+
logger$2$3.throwArgumentError("invalid network", "network", network);
|
|
28293
28293
|
}
|
|
28294
28294
|
}
|
|
28295
28295
|
this._maxInternalBlockNumber = -1024;
|
|
@@ -28314,7 +28314,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28314
28314
|
// This should never happen; every Provider sub-class should have
|
|
28315
28315
|
// suggested a network by here (or have thrown).
|
|
28316
28316
|
if (!network) {
|
|
28317
|
-
logger$2$
|
|
28317
|
+
logger$2$3.throwError("no network detected", Logger$3.errors.UNKNOWN_ERROR, {});
|
|
28318
28318
|
}
|
|
28319
28319
|
// Possible this call stacked so do not call defineReadOnly again
|
|
28320
28320
|
if (this._network == null) {
|
|
@@ -28446,8 +28446,8 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28446
28446
|
this._emitted.block = blockNumber - 1;
|
|
28447
28447
|
}
|
|
28448
28448
|
if (Math.abs((this._emitted.block) - blockNumber) > 1000) {
|
|
28449
|
-
logger$2$
|
|
28450
|
-
this.emit("error", logger$2$
|
|
28449
|
+
logger$2$3.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${blockNumber})`);
|
|
28450
|
+
this.emit("error", logger$2$3.makeError("network block skew detected", Logger$3.errors.NETWORK_ERROR, {
|
|
28451
28451
|
blockNumber: blockNumber,
|
|
28452
28452
|
event: "blockSkew",
|
|
28453
28453
|
previousBlockNumber: this._emitted.block
|
|
@@ -28544,7 +28544,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28544
28544
|
// can change, such as when connected to a JSON-RPC backend
|
|
28545
28545
|
detectNetwork() {
|
|
28546
28546
|
return __awaiter$2$1(this, void 0, void 0, function* () {
|
|
28547
|
-
return logger$2$
|
|
28547
|
+
return logger$2$3.throwError("provider does not support network detection", Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
28548
28548
|
operation: "provider.detectNetwork"
|
|
28549
28549
|
});
|
|
28550
28550
|
});
|
|
@@ -28576,7 +28576,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28576
28576
|
yield stall$1(0);
|
|
28577
28577
|
return this._network;
|
|
28578
28578
|
}
|
|
28579
|
-
const error = logger$2$
|
|
28579
|
+
const error = logger$2$3.makeError("underlying network changed", Logger$3.errors.NETWORK_ERROR, {
|
|
28580
28580
|
event: "changed",
|
|
28581
28581
|
network: network,
|
|
28582
28582
|
detectedNetwork: currentNetwork
|
|
@@ -28763,7 +28763,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28763
28763
|
reason = "cancelled";
|
|
28764
28764
|
}
|
|
28765
28765
|
// Explain why we were replaced
|
|
28766
|
-
reject(logger$2$
|
|
28766
|
+
reject(logger$2$3.makeError("transaction was replaced", Logger$3.errors.TRANSACTION_REPLACED, {
|
|
28767
28767
|
cancelled: (reason === "replaced" || reason === "cancelled"),
|
|
28768
28768
|
reason,
|
|
28769
28769
|
replacement: this._wrapTransaction(tx),
|
|
@@ -28800,7 +28800,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28800
28800
|
if (alreadyDone()) {
|
|
28801
28801
|
return;
|
|
28802
28802
|
}
|
|
28803
|
-
reject(logger$2$
|
|
28803
|
+
reject(logger$2$3.makeError("timeout exceeded", Logger$3.errors.TIMEOUT, { timeout: timeout }));
|
|
28804
28804
|
}, timeout);
|
|
28805
28805
|
if (timer.unref) {
|
|
28806
28806
|
timer.unref();
|
|
@@ -28823,7 +28823,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28823
28823
|
return BigNumber$3.from(result);
|
|
28824
28824
|
}
|
|
28825
28825
|
catch (error) {
|
|
28826
|
-
return logger$2$
|
|
28826
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
28827
28827
|
method: "getGasPrice",
|
|
28828
28828
|
result, error
|
|
28829
28829
|
});
|
|
@@ -28842,7 +28842,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28842
28842
|
return BigNumber$3.from(result);
|
|
28843
28843
|
}
|
|
28844
28844
|
catch (error) {
|
|
28845
|
-
return logger$2$
|
|
28845
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
28846
28846
|
method: "getBalance",
|
|
28847
28847
|
params, result, error
|
|
28848
28848
|
});
|
|
@@ -28861,7 +28861,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28861
28861
|
return BigNumber$3.from(result).toNumber();
|
|
28862
28862
|
}
|
|
28863
28863
|
catch (error) {
|
|
28864
|
-
return logger$2$
|
|
28864
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
28865
28865
|
method: "getTransactionCount",
|
|
28866
28866
|
params, result, error
|
|
28867
28867
|
});
|
|
@@ -28880,7 +28880,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28880
28880
|
return hexlify$3(result);
|
|
28881
28881
|
}
|
|
28882
28882
|
catch (error) {
|
|
28883
|
-
return logger$2$
|
|
28883
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
28884
28884
|
method: "getCode",
|
|
28885
28885
|
params, result, error
|
|
28886
28886
|
});
|
|
@@ -28900,7 +28900,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28900
28900
|
return hexlify$3(result);
|
|
28901
28901
|
}
|
|
28902
28902
|
catch (error) {
|
|
28903
|
-
return logger$2$
|
|
28903
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
28904
28904
|
method: "getStorageAt",
|
|
28905
28905
|
params, result, error
|
|
28906
28906
|
});
|
|
@@ -28915,7 +28915,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28915
28915
|
const result = tx;
|
|
28916
28916
|
// Check the hash we expect is the same as the hash the server reported
|
|
28917
28917
|
if (hash != null && tx.hash !== hash) {
|
|
28918
|
-
logger$2$
|
|
28918
|
+
logger$2$3.throwError("Transaction hash mismatch from Provider.sendTransaction.", Logger$3.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });
|
|
28919
28919
|
}
|
|
28920
28920
|
result.wait = (confirms, timeout) => __awaiter$2$1(this, void 0, void 0, function* () {
|
|
28921
28921
|
if (confirms == null) {
|
|
@@ -28943,7 +28943,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
28943
28943
|
// No longer pending, allow the polling loop to garbage collect this
|
|
28944
28944
|
this._emitted["t:" + tx.hash] = receipt.blockNumber;
|
|
28945
28945
|
if (receipt.status === 0) {
|
|
28946
|
-
logger$2$
|
|
28946
|
+
logger$2$3.throwError("transaction failed", Logger$3.errors.CALL_EXCEPTION, {
|
|
28947
28947
|
transactionHash: tx.hash,
|
|
28948
28948
|
transaction: tx,
|
|
28949
28949
|
receipt: receipt
|
|
@@ -29041,7 +29041,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
29041
29041
|
return hexlify$3(result);
|
|
29042
29042
|
}
|
|
29043
29043
|
catch (error) {
|
|
29044
|
-
return logger$2$
|
|
29044
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
29045
29045
|
method: "call",
|
|
29046
29046
|
params, result, error
|
|
29047
29047
|
});
|
|
@@ -29059,7 +29059,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
29059
29059
|
return BigNumber$3.from(result);
|
|
29060
29060
|
}
|
|
29061
29061
|
catch (error) {
|
|
29062
|
-
return logger$2$
|
|
29062
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
29063
29063
|
method: "estimateGas",
|
|
29064
29064
|
params, result, error
|
|
29065
29065
|
});
|
|
@@ -29070,7 +29070,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
29070
29070
|
return __awaiter$2$1(this, void 0, void 0, function* () {
|
|
29071
29071
|
const address = yield this.resolveName(addressOrName);
|
|
29072
29072
|
if (address == null) {
|
|
29073
|
-
logger$2$
|
|
29073
|
+
logger$2$3.throwError("ENS name not configured", Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
29074
29074
|
operation: `resolveName(${JSON.stringify(addressOrName)})`
|
|
29075
29075
|
});
|
|
29076
29076
|
}
|
|
@@ -29097,7 +29097,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
29097
29097
|
}
|
|
29098
29098
|
}
|
|
29099
29099
|
catch (error) {
|
|
29100
|
-
logger$2$
|
|
29100
|
+
logger$2$3.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag);
|
|
29101
29101
|
}
|
|
29102
29102
|
}
|
|
29103
29103
|
return poll$1(() => __awaiter$2$1(this, void 0, void 0, function* () {
|
|
@@ -29243,7 +29243,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
29243
29243
|
blockTag = yield blockTag;
|
|
29244
29244
|
if (typeof (blockTag) === "number" && blockTag < 0) {
|
|
29245
29245
|
if (blockTag % 1) {
|
|
29246
|
-
logger$2$
|
|
29246
|
+
logger$2$3.throwArgumentError("invalid BlockTag", "blockTag", blockTag);
|
|
29247
29247
|
}
|
|
29248
29248
|
let blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval);
|
|
29249
29249
|
blockNumber += blockTag;
|
|
@@ -29278,7 +29278,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
29278
29278
|
const network = yield this.getNetwork();
|
|
29279
29279
|
// No ENS...
|
|
29280
29280
|
if (!network.ensAddress) {
|
|
29281
|
-
logger$2$
|
|
29281
|
+
logger$2$3.throwError("network does not support ENS", Logger$3.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name });
|
|
29282
29282
|
}
|
|
29283
29283
|
// keccak256("resolver(bytes32)")
|
|
29284
29284
|
const transaction = {
|
|
@@ -29310,7 +29310,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
29310
29310
|
}
|
|
29311
29311
|
}
|
|
29312
29312
|
if (typeof (name) !== "string") {
|
|
29313
|
-
logger$2$
|
|
29313
|
+
logger$2$3.throwArgumentError("invalid ENS name", "name", name);
|
|
29314
29314
|
}
|
|
29315
29315
|
// Get the addr from the resovler
|
|
29316
29316
|
const resolver = yield this.getResolver(name);
|
|
@@ -29330,7 +29330,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
29330
29330
|
return null;
|
|
29331
29331
|
}
|
|
29332
29332
|
// keccak("name(bytes32)")
|
|
29333
|
-
let bytes = arrayify$
|
|
29333
|
+
let bytes = arrayify$3(yield this.call({
|
|
29334
29334
|
to: resolverAddress,
|
|
29335
29335
|
data: ("0x691f3431" + namehash$1(reverseName).substring(2))
|
|
29336
29336
|
}));
|
|
@@ -29360,7 +29360,7 @@ class BaseProvider$1 extends Provider$1 {
|
|
|
29360
29360
|
});
|
|
29361
29361
|
}
|
|
29362
29362
|
perform(method, params) {
|
|
29363
|
-
return logger$2$
|
|
29363
|
+
return logger$2$3.throwError(method + " not implemented", Logger$3.errors.NOT_IMPLEMENTED, { operation: method });
|
|
29364
29364
|
}
|
|
29365
29365
|
_startEvent(event) {
|
|
29366
29366
|
this.polling = (this._events.filter((e) => e.pollable()).length > 0);
|
|
@@ -29742,7 +29742,7 @@ var __awaiter$9 = function (thisArg, _arguments, P, generator) {
|
|
|
29742
29742
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
29743
29743
|
});
|
|
29744
29744
|
};
|
|
29745
|
-
const logger$s = new Logger$3(version$3$
|
|
29745
|
+
const logger$s = new Logger$3(version$3$3);
|
|
29746
29746
|
const errorGas$1 = ["call", "estimateGas"];
|
|
29747
29747
|
function checkError$1(method, error, params) {
|
|
29748
29748
|
// Undo the "convenience" some nodes are attempting to prevent backwards
|
|
@@ -30373,7 +30373,7 @@ class JsonRpcBatchProvider extends JsonRpcProvider$1 {
|
|
|
30373
30373
|
}
|
|
30374
30374
|
}
|
|
30375
30375
|
|
|
30376
|
-
new Logger$3(version$3$
|
|
30376
|
+
new Logger$3(version$3$3);
|
|
30377
30377
|
|
|
30378
30378
|
const BATCH_INTERVAL = 10;
|
|
30379
30379
|
|
|
@@ -34424,13 +34424,13 @@ const logger$q = new Logger$2(version$i);
|
|
|
34424
34424
|
function isHexable$2(value) {
|
|
34425
34425
|
return !!(value.toHexString);
|
|
34426
34426
|
}
|
|
34427
|
-
function addSlice$
|
|
34427
|
+
function addSlice$2(array) {
|
|
34428
34428
|
if (array.slice) {
|
|
34429
34429
|
return array;
|
|
34430
34430
|
}
|
|
34431
34431
|
array.slice = function () {
|
|
34432
34432
|
const args = Array.prototype.slice.call(arguments);
|
|
34433
|
-
return addSlice$
|
|
34433
|
+
return addSlice$2(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
34434
34434
|
};
|
|
34435
34435
|
return array;
|
|
34436
34436
|
}
|
|
@@ -34458,7 +34458,7 @@ function isBytes$2(value) {
|
|
|
34458
34458
|
}
|
|
34459
34459
|
return true;
|
|
34460
34460
|
}
|
|
34461
|
-
function arrayify$
|
|
34461
|
+
function arrayify$2(value, options) {
|
|
34462
34462
|
if (!options) {
|
|
34463
34463
|
options = {};
|
|
34464
34464
|
}
|
|
@@ -34472,7 +34472,7 @@ function arrayify$1(value, options) {
|
|
|
34472
34472
|
if (result.length === 0) {
|
|
34473
34473
|
result.push(0);
|
|
34474
34474
|
}
|
|
34475
|
-
return addSlice$
|
|
34475
|
+
return addSlice$2(new Uint8Array(result));
|
|
34476
34476
|
}
|
|
34477
34477
|
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
34478
34478
|
value = "0x" + value;
|
|
@@ -34497,25 +34497,25 @@ function arrayify$1(value, options) {
|
|
|
34497
34497
|
for (let i = 0; i < hex.length; i += 2) {
|
|
34498
34498
|
result.push(parseInt(hex.substring(i, i + 2), 16));
|
|
34499
34499
|
}
|
|
34500
|
-
return addSlice$
|
|
34500
|
+
return addSlice$2(new Uint8Array(result));
|
|
34501
34501
|
}
|
|
34502
34502
|
if (isBytes$2(value)) {
|
|
34503
|
-
return addSlice$
|
|
34503
|
+
return addSlice$2(new Uint8Array(value));
|
|
34504
34504
|
}
|
|
34505
34505
|
return logger$q.throwArgumentError("invalid arrayify value", "value", value);
|
|
34506
34506
|
}
|
|
34507
34507
|
function concat(items) {
|
|
34508
|
-
const objects = items.map(item => arrayify$
|
|
34508
|
+
const objects = items.map(item => arrayify$2(item));
|
|
34509
34509
|
const length = objects.reduce((accum, item) => (accum + item.length), 0);
|
|
34510
34510
|
const result = new Uint8Array(length);
|
|
34511
34511
|
objects.reduce((offset, object) => {
|
|
34512
34512
|
result.set(object, offset);
|
|
34513
34513
|
return offset + object.length;
|
|
34514
34514
|
}, 0);
|
|
34515
|
-
return addSlice$
|
|
34515
|
+
return addSlice$2(result);
|
|
34516
34516
|
}
|
|
34517
34517
|
function stripZeros(value) {
|
|
34518
|
-
let result = arrayify$
|
|
34518
|
+
let result = arrayify$2(value);
|
|
34519
34519
|
if (result.length === 0) {
|
|
34520
34520
|
return result;
|
|
34521
34521
|
}
|
|
@@ -34531,13 +34531,13 @@ function stripZeros(value) {
|
|
|
34531
34531
|
return result;
|
|
34532
34532
|
}
|
|
34533
34533
|
function zeroPad(value, length) {
|
|
34534
|
-
value = arrayify$
|
|
34534
|
+
value = arrayify$2(value);
|
|
34535
34535
|
if (value.length > length) {
|
|
34536
34536
|
logger$q.throwArgumentError("value out of range", "value", arguments[0]);
|
|
34537
34537
|
}
|
|
34538
34538
|
const result = new Uint8Array(length);
|
|
34539
34539
|
result.set(value, length - value.length);
|
|
34540
|
-
return addSlice$
|
|
34540
|
+
return addSlice$2(result);
|
|
34541
34541
|
}
|
|
34542
34542
|
function isHexString$2(value, length) {
|
|
34543
34543
|
if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
|
|
@@ -34663,7 +34663,7 @@ function hexStripZeros(value) {
|
|
|
34663
34663
|
}
|
|
34664
34664
|
return "0x" + value.substring(offset);
|
|
34665
34665
|
}
|
|
34666
|
-
function hexZeroPad$
|
|
34666
|
+
function hexZeroPad$2(value, length) {
|
|
34667
34667
|
if (typeof (value) !== "string") {
|
|
34668
34668
|
value = hexlify$2(value);
|
|
34669
34669
|
}
|
|
@@ -34687,7 +34687,7 @@ function splitSignature(signature) {
|
|
|
34687
34687
|
v: 0
|
|
34688
34688
|
};
|
|
34689
34689
|
if (isBytesLike(signature)) {
|
|
34690
|
-
const bytes = arrayify$
|
|
34690
|
+
const bytes = arrayify$2(signature);
|
|
34691
34691
|
if (bytes.length !== 65) {
|
|
34692
34692
|
logger$q.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
|
|
34693
34693
|
}
|
|
@@ -34721,7 +34721,7 @@ function splitSignature(signature) {
|
|
|
34721
34721
|
// If the _vs is available, use it to populate missing s, v and recoveryParam
|
|
34722
34722
|
// and verify non-missing s, v and recoveryParam
|
|
34723
34723
|
if (result._vs != null) {
|
|
34724
|
-
const vs = zeroPad(arrayify$
|
|
34724
|
+
const vs = zeroPad(arrayify$2(result._vs), 32);
|
|
34725
34725
|
result._vs = hexlify$2(vs);
|
|
34726
34726
|
// Set or check the recid
|
|
34727
34727
|
const recoveryParam = ((vs[0] >= 128) ? 1 : 0);
|
|
@@ -34765,15 +34765,15 @@ function splitSignature(signature) {
|
|
|
34765
34765
|
logger$q.throwArgumentError("signature missing or invalid r", "signature", signature);
|
|
34766
34766
|
}
|
|
34767
34767
|
else {
|
|
34768
|
-
result.r = hexZeroPad$
|
|
34768
|
+
result.r = hexZeroPad$2(result.r, 32);
|
|
34769
34769
|
}
|
|
34770
34770
|
if (result.s == null || !isHexString$2(result.s)) {
|
|
34771
34771
|
logger$q.throwArgumentError("signature missing or invalid s", "signature", signature);
|
|
34772
34772
|
}
|
|
34773
34773
|
else {
|
|
34774
|
-
result.s = hexZeroPad$
|
|
34774
|
+
result.s = hexZeroPad$2(result.s, 32);
|
|
34775
34775
|
}
|
|
34776
|
-
const vs = arrayify$
|
|
34776
|
+
const vs = arrayify$2(result.s);
|
|
34777
34777
|
if (vs[0] >= 128) {
|
|
34778
34778
|
logger$q.throwArgumentError("signature s out of range", "signature", signature);
|
|
34779
34779
|
}
|
|
@@ -34785,7 +34785,7 @@ function splitSignature(signature) {
|
|
|
34785
34785
|
if (!isHexString$2(result._vs)) {
|
|
34786
34786
|
logger$q.throwArgumentError("signature invalid _vs", "signature", signature);
|
|
34787
34787
|
}
|
|
34788
|
-
result._vs = hexZeroPad$
|
|
34788
|
+
result._vs = hexZeroPad$2(result._vs, 32);
|
|
34789
34789
|
}
|
|
34790
34790
|
// Set or check the _vs
|
|
34791
34791
|
if (result._vs == null) {
|
|
@@ -34804,7 +34804,7 @@ var BN$1$1 = bn$2.BN;
|
|
|
34804
34804
|
const logger$p = new Logger$2(version$h);
|
|
34805
34805
|
const _constructorGuard$4 = {};
|
|
34806
34806
|
const MAX_SAFE$1$1 = 0x1fffffffffffff;
|
|
34807
|
-
function isBigNumberish$
|
|
34807
|
+
function isBigNumberish$2(value) {
|
|
34808
34808
|
return (value != null) && (BigNumber$1$1.isBigNumber(value) ||
|
|
34809
34809
|
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
34810
34810
|
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
@@ -35094,7 +35094,7 @@ const logger$o = new Logger$2(version$h);
|
|
|
35094
35094
|
const _constructorGuard$3 = {};
|
|
35095
35095
|
const Zero$2 = BigNumber$1$1.from(0);
|
|
35096
35096
|
const NegativeOne$2 = BigNumber$1$1.from(-1);
|
|
35097
|
-
function throwFault$1$
|
|
35097
|
+
function throwFault$1$2(message, fault, operation, value) {
|
|
35098
35098
|
const params = { fault: fault, operation: operation };
|
|
35099
35099
|
if (value !== undefined) {
|
|
35100
35100
|
params.value = value;
|
|
@@ -35102,12 +35102,12 @@ function throwFault$1$1(message, fault, operation, value) {
|
|
|
35102
35102
|
return logger$o.throwError(message, Logger$2.errors.NUMERIC_FAULT, params);
|
|
35103
35103
|
}
|
|
35104
35104
|
// Constant to pull zeros from for multipliers
|
|
35105
|
-
let zeros$
|
|
35106
|
-
while (zeros$
|
|
35107
|
-
zeros$
|
|
35105
|
+
let zeros$2 = "0";
|
|
35106
|
+
while (zeros$2.length < 256) {
|
|
35107
|
+
zeros$2 += zeros$2;
|
|
35108
35108
|
}
|
|
35109
35109
|
// Returns a string "1" followed by decimal "0"s
|
|
35110
|
-
function getMultiplier$
|
|
35110
|
+
function getMultiplier$2(decimals) {
|
|
35111
35111
|
if (typeof (decimals) !== "number") {
|
|
35112
35112
|
try {
|
|
35113
35113
|
decimals = BigNumber$1$1.from(decimals).toNumber();
|
|
@@ -35115,15 +35115,15 @@ function getMultiplier$1(decimals) {
|
|
|
35115
35115
|
catch (e) { }
|
|
35116
35116
|
}
|
|
35117
35117
|
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
35118
|
-
return ("1" + zeros$
|
|
35118
|
+
return ("1" + zeros$2.substring(0, decimals));
|
|
35119
35119
|
}
|
|
35120
35120
|
return logger$o.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
35121
35121
|
}
|
|
35122
|
-
function formatFixed$
|
|
35122
|
+
function formatFixed$2(value, decimals) {
|
|
35123
35123
|
if (decimals == null) {
|
|
35124
35124
|
decimals = 0;
|
|
35125
35125
|
}
|
|
35126
|
-
const multiplier = getMultiplier$
|
|
35126
|
+
const multiplier = getMultiplier$2(decimals);
|
|
35127
35127
|
// Make sure wei is a big number (convert as necessary)
|
|
35128
35128
|
value = BigNumber$1$1.from(value);
|
|
35129
35129
|
const negative = value.lt(Zero$2);
|
|
@@ -35148,11 +35148,11 @@ function formatFixed$1(value, decimals) {
|
|
|
35148
35148
|
}
|
|
35149
35149
|
return value;
|
|
35150
35150
|
}
|
|
35151
|
-
function parseFixed$
|
|
35151
|
+
function parseFixed$2(value, decimals) {
|
|
35152
35152
|
if (decimals == null) {
|
|
35153
35153
|
decimals = 0;
|
|
35154
35154
|
}
|
|
35155
|
-
const multiplier = getMultiplier$
|
|
35155
|
+
const multiplier = getMultiplier$2(decimals);
|
|
35156
35156
|
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
|
|
35157
35157
|
logger$o.throwArgumentError("invalid decimal value", "value", value);
|
|
35158
35158
|
}
|
|
@@ -35180,7 +35180,7 @@ function parseFixed$1(value, decimals) {
|
|
|
35180
35180
|
{
|
|
35181
35181
|
const sigFraction = fraction.replace(/^([0-9]*?)(0*)$/, (all, sig, zeros) => (sig));
|
|
35182
35182
|
if (sigFraction.length > multiplier.length - 1) {
|
|
35183
|
-
throwFault$1$
|
|
35183
|
+
throwFault$1$2("fractional component exceeds decimals", "underflow", "parseFixed");
|
|
35184
35184
|
}
|
|
35185
35185
|
}
|
|
35186
35186
|
// Fully pad the string with zeros to get to wei
|
|
@@ -35195,7 +35195,7 @@ function parseFixed$1(value, decimals) {
|
|
|
35195
35195
|
}
|
|
35196
35196
|
return wei;
|
|
35197
35197
|
}
|
|
35198
|
-
class FixedFormat$
|
|
35198
|
+
class FixedFormat$2 {
|
|
35199
35199
|
constructor(constructorGuard, signed, width, decimals) {
|
|
35200
35200
|
if (constructorGuard !== _constructorGuard$3) {
|
|
35201
35201
|
logger$o.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
@@ -35206,11 +35206,11 @@ class FixedFormat$1 {
|
|
|
35206
35206
|
this.width = width;
|
|
35207
35207
|
this.decimals = decimals;
|
|
35208
35208
|
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
35209
|
-
this._multiplier = getMultiplier$
|
|
35209
|
+
this._multiplier = getMultiplier$2(decimals);
|
|
35210
35210
|
Object.freeze(this);
|
|
35211
35211
|
}
|
|
35212
35212
|
static from(value) {
|
|
35213
|
-
if (value instanceof FixedFormat$
|
|
35213
|
+
if (value instanceof FixedFormat$2) {
|
|
35214
35214
|
return value;
|
|
35215
35215
|
}
|
|
35216
35216
|
if (typeof (value) === "number") {
|
|
@@ -35254,12 +35254,12 @@ class FixedFormat$1 {
|
|
|
35254
35254
|
if (decimals > 80) {
|
|
35255
35255
|
logger$o.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
35256
35256
|
}
|
|
35257
|
-
return new FixedFormat$
|
|
35257
|
+
return new FixedFormat$2(_constructorGuard$3, signed, width, decimals);
|
|
35258
35258
|
}
|
|
35259
35259
|
}
|
|
35260
|
-
class FixedNumber$
|
|
35260
|
+
class FixedNumber$2 {
|
|
35261
35261
|
constructor(constructorGuard, hex, value, format) {
|
|
35262
|
-
logger$o.checkNew(new.target, FixedNumber$
|
|
35262
|
+
logger$o.checkNew(new.target, FixedNumber$2);
|
|
35263
35263
|
if (constructorGuard !== _constructorGuard$3) {
|
|
35264
35264
|
logger$o.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
35265
35265
|
operation: "new FixedFormat"
|
|
@@ -35278,37 +35278,37 @@ class FixedNumber$1 {
|
|
|
35278
35278
|
}
|
|
35279
35279
|
addUnsafe(other) {
|
|
35280
35280
|
this._checkFormat(other);
|
|
35281
|
-
const a = parseFixed$
|
|
35282
|
-
const b = parseFixed$
|
|
35283
|
-
return FixedNumber$
|
|
35281
|
+
const a = parseFixed$2(this._value, this.format.decimals);
|
|
35282
|
+
const b = parseFixed$2(other._value, other.format.decimals);
|
|
35283
|
+
return FixedNumber$2.fromValue(a.add(b), this.format.decimals, this.format);
|
|
35284
35284
|
}
|
|
35285
35285
|
subUnsafe(other) {
|
|
35286
35286
|
this._checkFormat(other);
|
|
35287
|
-
const a = parseFixed$
|
|
35288
|
-
const b = parseFixed$
|
|
35289
|
-
return FixedNumber$
|
|
35287
|
+
const a = parseFixed$2(this._value, this.format.decimals);
|
|
35288
|
+
const b = parseFixed$2(other._value, other.format.decimals);
|
|
35289
|
+
return FixedNumber$2.fromValue(a.sub(b), this.format.decimals, this.format);
|
|
35290
35290
|
}
|
|
35291
35291
|
mulUnsafe(other) {
|
|
35292
35292
|
this._checkFormat(other);
|
|
35293
|
-
const a = parseFixed$
|
|
35294
|
-
const b = parseFixed$
|
|
35295
|
-
return FixedNumber$
|
|
35293
|
+
const a = parseFixed$2(this._value, this.format.decimals);
|
|
35294
|
+
const b = parseFixed$2(other._value, other.format.decimals);
|
|
35295
|
+
return FixedNumber$2.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
35296
35296
|
}
|
|
35297
35297
|
divUnsafe(other) {
|
|
35298
35298
|
this._checkFormat(other);
|
|
35299
|
-
const a = parseFixed$
|
|
35300
|
-
const b = parseFixed$
|
|
35301
|
-
return FixedNumber$
|
|
35299
|
+
const a = parseFixed$2(this._value, this.format.decimals);
|
|
35300
|
+
const b = parseFixed$2(other._value, other.format.decimals);
|
|
35301
|
+
return FixedNumber$2.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
35302
35302
|
}
|
|
35303
35303
|
floor() {
|
|
35304
35304
|
const comps = this.toString().split(".");
|
|
35305
35305
|
if (comps.length === 1) {
|
|
35306
35306
|
comps.push("0");
|
|
35307
35307
|
}
|
|
35308
|
-
let result = FixedNumber$
|
|
35308
|
+
let result = FixedNumber$2.from(comps[0], this.format);
|
|
35309
35309
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
35310
35310
|
if (this.isNegative() && hasFraction) {
|
|
35311
|
-
result = result.subUnsafe(ONE$
|
|
35311
|
+
result = result.subUnsafe(ONE$2.toFormat(result.format));
|
|
35312
35312
|
}
|
|
35313
35313
|
return result;
|
|
35314
35314
|
}
|
|
@@ -35317,10 +35317,10 @@ class FixedNumber$1 {
|
|
|
35317
35317
|
if (comps.length === 1) {
|
|
35318
35318
|
comps.push("0");
|
|
35319
35319
|
}
|
|
35320
|
-
let result = FixedNumber$
|
|
35320
|
+
let result = FixedNumber$2.from(comps[0], this.format);
|
|
35321
35321
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
35322
35322
|
if (!this.isNegative() && hasFraction) {
|
|
35323
|
-
result = result.addUnsafe(ONE$
|
|
35323
|
+
result = result.addUnsafe(ONE$2.toFormat(result.format));
|
|
35324
35324
|
}
|
|
35325
35325
|
return result;
|
|
35326
35326
|
}
|
|
@@ -35340,8 +35340,8 @@ class FixedNumber$1 {
|
|
|
35340
35340
|
if (comps[1].length <= decimals) {
|
|
35341
35341
|
return this;
|
|
35342
35342
|
}
|
|
35343
|
-
const factor = FixedNumber$
|
|
35344
|
-
const bump = BUMP$
|
|
35343
|
+
const factor = FixedNumber$2.from("1" + zeros$2.substring(0, decimals), this.format);
|
|
35344
|
+
const bump = BUMP$2.toFormat(this.format);
|
|
35345
35345
|
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
35346
35346
|
}
|
|
35347
35347
|
isZero() {
|
|
@@ -35359,15 +35359,15 @@ class FixedNumber$1 {
|
|
|
35359
35359
|
logger$o.throwArgumentError("invalid byte width", "width", width);
|
|
35360
35360
|
}
|
|
35361
35361
|
const hex = BigNumber$1$1.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
35362
|
-
return hexZeroPad$
|
|
35362
|
+
return hexZeroPad$2(hex, width / 8);
|
|
35363
35363
|
}
|
|
35364
35364
|
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
35365
35365
|
toFormat(format) {
|
|
35366
|
-
return FixedNumber$
|
|
35366
|
+
return FixedNumber$2.fromString(this._value, format);
|
|
35367
35367
|
}
|
|
35368
35368
|
static fromValue(value, decimals, format) {
|
|
35369
35369
|
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
35370
|
-
if (format == null && decimals != null && !isBigNumberish$
|
|
35370
|
+
if (format == null && decimals != null && !isBigNumberish$2(decimals)) {
|
|
35371
35371
|
format = decimals;
|
|
35372
35372
|
decimals = null;
|
|
35373
35373
|
}
|
|
@@ -35377,16 +35377,16 @@ class FixedNumber$1 {
|
|
|
35377
35377
|
if (format == null) {
|
|
35378
35378
|
format = "fixed";
|
|
35379
35379
|
}
|
|
35380
|
-
return FixedNumber$
|
|
35380
|
+
return FixedNumber$2.fromString(formatFixed$2(value, decimals), FixedFormat$2.from(format));
|
|
35381
35381
|
}
|
|
35382
35382
|
static fromString(value, format) {
|
|
35383
35383
|
if (format == null) {
|
|
35384
35384
|
format = "fixed";
|
|
35385
35385
|
}
|
|
35386
|
-
const fixedFormat = FixedFormat$
|
|
35387
|
-
const numeric = parseFixed$
|
|
35386
|
+
const fixedFormat = FixedFormat$2.from(format);
|
|
35387
|
+
const numeric = parseFixed$2(value, fixedFormat.decimals);
|
|
35388
35388
|
if (!fixedFormat.signed && numeric.lt(Zero$2)) {
|
|
35389
|
-
throwFault$1$
|
|
35389
|
+
throwFault$1$2("unsigned value cannot be negative", "overflow", "value", value);
|
|
35390
35390
|
}
|
|
35391
35391
|
let hex = null;
|
|
35392
35392
|
if (fixedFormat.signed) {
|
|
@@ -35394,17 +35394,17 @@ class FixedNumber$1 {
|
|
|
35394
35394
|
}
|
|
35395
35395
|
else {
|
|
35396
35396
|
hex = numeric.toHexString();
|
|
35397
|
-
hex = hexZeroPad$
|
|
35397
|
+
hex = hexZeroPad$2(hex, fixedFormat.width / 8);
|
|
35398
35398
|
}
|
|
35399
|
-
const decimal = formatFixed$
|
|
35400
|
-
return new FixedNumber$
|
|
35399
|
+
const decimal = formatFixed$2(numeric, fixedFormat.decimals);
|
|
35400
|
+
return new FixedNumber$2(_constructorGuard$3, hex, decimal, fixedFormat);
|
|
35401
35401
|
}
|
|
35402
35402
|
static fromBytes(value, format) {
|
|
35403
35403
|
if (format == null) {
|
|
35404
35404
|
format = "fixed";
|
|
35405
35405
|
}
|
|
35406
|
-
const fixedFormat = FixedFormat$
|
|
35407
|
-
if (arrayify$
|
|
35406
|
+
const fixedFormat = FixedFormat$2.from(format);
|
|
35407
|
+
if (arrayify$2(value).length > fixedFormat.width / 8) {
|
|
35408
35408
|
throw new Error("overflow");
|
|
35409
35409
|
}
|
|
35410
35410
|
let numeric = BigNumber$1$1.from(value);
|
|
@@ -35412,18 +35412,18 @@ class FixedNumber$1 {
|
|
|
35412
35412
|
numeric = numeric.fromTwos(fixedFormat.width);
|
|
35413
35413
|
}
|
|
35414
35414
|
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
35415
|
-
const decimal = formatFixed$
|
|
35416
|
-
return new FixedNumber$
|
|
35415
|
+
const decimal = formatFixed$2(numeric, fixedFormat.decimals);
|
|
35416
|
+
return new FixedNumber$2(_constructorGuard$3, hex, decimal, fixedFormat);
|
|
35417
35417
|
}
|
|
35418
35418
|
static from(value, format) {
|
|
35419
35419
|
if (typeof (value) === "string") {
|
|
35420
|
-
return FixedNumber$
|
|
35420
|
+
return FixedNumber$2.fromString(value, format);
|
|
35421
35421
|
}
|
|
35422
35422
|
if (isBytes$2(value)) {
|
|
35423
|
-
return FixedNumber$
|
|
35423
|
+
return FixedNumber$2.fromBytes(value, format);
|
|
35424
35424
|
}
|
|
35425
35425
|
try {
|
|
35426
|
-
return FixedNumber$
|
|
35426
|
+
return FixedNumber$2.fromValue(value, 0, format);
|
|
35427
35427
|
}
|
|
35428
35428
|
catch (error) {
|
|
35429
35429
|
// Allow NUMERIC_FAULT to bubble up
|
|
@@ -35437,8 +35437,8 @@ class FixedNumber$1 {
|
|
|
35437
35437
|
return !!(value && value._isFixedNumber);
|
|
35438
35438
|
}
|
|
35439
35439
|
}
|
|
35440
|
-
const ONE$
|
|
35441
|
-
const BUMP$
|
|
35440
|
+
const ONE$2 = FixedNumber$2.from(1);
|
|
35441
|
+
const BUMP$2 = FixedNumber$2.from("0.5");
|
|
35442
35442
|
|
|
35443
35443
|
const version$g = "properties/5.4.1";
|
|
35444
35444
|
|
|
@@ -36470,7 +36470,7 @@ class Writer {
|
|
|
36470
36470
|
}
|
|
36471
36471
|
// Arrayish items; padded on the right to wordSize
|
|
36472
36472
|
writeBytes(value) {
|
|
36473
|
-
let bytes = arrayify$
|
|
36473
|
+
let bytes = arrayify$2(value);
|
|
36474
36474
|
const paddingOffset = bytes.length % this.wordSize;
|
|
36475
36475
|
if (paddingOffset) {
|
|
36476
36476
|
bytes = concat([bytes, this._padding.slice(paddingOffset)]);
|
|
@@ -36478,7 +36478,7 @@ class Writer {
|
|
|
36478
36478
|
return this._writeData(bytes);
|
|
36479
36479
|
}
|
|
36480
36480
|
_getValue(value) {
|
|
36481
|
-
let bytes = arrayify$
|
|
36481
|
+
let bytes = arrayify$2(BigNumber$1$1.from(value));
|
|
36482
36482
|
if (bytes.length > this.wordSize) {
|
|
36483
36483
|
logger$l.throwError("value out-of-bounds", Logger$2.errors.BUFFER_OVERRUN, {
|
|
36484
36484
|
length: this.wordSize,
|
|
@@ -36505,7 +36505,7 @@ class Writer {
|
|
|
36505
36505
|
}
|
|
36506
36506
|
class Reader {
|
|
36507
36507
|
constructor(data, wordSize, coerceFunc, allowLoose) {
|
|
36508
|
-
defineReadOnly(this, "_data", arrayify$
|
|
36508
|
+
defineReadOnly(this, "_data", arrayify$2(data));
|
|
36509
36509
|
defineReadOnly(this, "wordSize", wordSize || 32);
|
|
36510
36510
|
defineReadOnly(this, "_coerceFunc", coerceFunc);
|
|
36511
36511
|
defineReadOnly(this, "allowLoose", allowLoose);
|
|
@@ -37037,7 +37037,7 @@ var sha3$2 = createCommonjsModule$1$1(function (module) {
|
|
|
37037
37037
|
var sha3$1$1 = sha3$2;
|
|
37038
37038
|
|
|
37039
37039
|
function keccak256$1(data) {
|
|
37040
|
-
return '0x' + sha3$1$1.keccak_256(arrayify$
|
|
37040
|
+
return '0x' + sha3$1$1.keccak_256(arrayify$2(data));
|
|
37041
37041
|
}
|
|
37042
37042
|
|
|
37043
37043
|
const version$e = "rlp/5.4.0";
|
|
@@ -37075,7 +37075,7 @@ function _encode(object) {
|
|
|
37075
37075
|
if (!isBytesLike(object)) {
|
|
37076
37076
|
logger$k.throwArgumentError("RLP object must be BytesLike", "object", object);
|
|
37077
37077
|
}
|
|
37078
|
-
const data = Array.prototype.slice.call(arrayify$
|
|
37078
|
+
const data = Array.prototype.slice.call(arrayify$2(object));
|
|
37079
37079
|
if (data.length === 1 && data[0] <= 0x7f) {
|
|
37080
37080
|
return data;
|
|
37081
37081
|
}
|
|
@@ -37149,7 +37149,7 @@ function _decode(data, offset) {
|
|
|
37149
37149
|
return { consumed: 1, result: hexlify$2(data[offset]) };
|
|
37150
37150
|
}
|
|
37151
37151
|
function decode$1(data) {
|
|
37152
|
-
const bytes = arrayify$
|
|
37152
|
+
const bytes = arrayify$2(data);
|
|
37153
37153
|
const decoded = _decode(bytes, 0);
|
|
37154
37154
|
if (decoded.consumed !== bytes.length) {
|
|
37155
37155
|
logger$k.throwArgumentError("invalid rlp data", "data", data);
|
|
@@ -37170,7 +37170,7 @@ function getChecksumAddress$1(address) {
|
|
|
37170
37170
|
for (let i = 0; i < 40; i++) {
|
|
37171
37171
|
expanded[i] = chars[i].charCodeAt(0);
|
|
37172
37172
|
}
|
|
37173
|
-
const hashed = arrayify$
|
|
37173
|
+
const hashed = arrayify$2(keccak256$1(expanded));
|
|
37174
37174
|
for (let i = 0; i < 40; i += 2) {
|
|
37175
37175
|
if ((hashed[i >> 1] >> 4) >= 8) {
|
|
37176
37176
|
chars[i] = chars[i].toUpperCase();
|
|
@@ -37257,7 +37257,7 @@ function getContractAddress(transaction) {
|
|
|
37257
37257
|
catch (error) {
|
|
37258
37258
|
logger$j.throwArgumentError("missing from address", "transaction", transaction);
|
|
37259
37259
|
}
|
|
37260
|
-
const nonce = stripZeros(arrayify$
|
|
37260
|
+
const nonce = stripZeros(arrayify$2(BigNumber$1$1.from(transaction.nonce).toHexString()));
|
|
37261
37261
|
return getAddress$1(hexDataSlice(keccak256$1(encode$2([from, nonce])), 12));
|
|
37262
37262
|
}
|
|
37263
37263
|
|
|
@@ -37278,7 +37278,7 @@ class AddressCoder extends Coder {
|
|
|
37278
37278
|
return writer.writeValue(value);
|
|
37279
37279
|
}
|
|
37280
37280
|
decode(reader) {
|
|
37281
|
-
return getAddress$1(hexZeroPad$
|
|
37281
|
+
return getAddress$1(hexZeroPad$2(reader.readValue().toHexString(), 20));
|
|
37282
37282
|
}
|
|
37283
37283
|
}
|
|
37284
37284
|
|
|
@@ -37526,7 +37526,7 @@ class DynamicBytesCoder extends Coder {
|
|
|
37526
37526
|
return "0x";
|
|
37527
37527
|
}
|
|
37528
37528
|
encode(writer, value) {
|
|
37529
|
-
value = arrayify$
|
|
37529
|
+
value = arrayify$2(value);
|
|
37530
37530
|
let length = writer.writeValue(value.length);
|
|
37531
37531
|
length += writer.writeBytes(value);
|
|
37532
37532
|
return length;
|
|
@@ -37555,7 +37555,7 @@ class FixedBytesCoder extends Coder {
|
|
|
37555
37555
|
return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2);
|
|
37556
37556
|
}
|
|
37557
37557
|
encode(writer, value) {
|
|
37558
|
-
let data = arrayify$
|
|
37558
|
+
let data = arrayify$2(value);
|
|
37559
37559
|
if (data.length !== this.size) {
|
|
37560
37560
|
this._throwError("incorrect data length", value);
|
|
37561
37561
|
}
|
|
@@ -37587,8 +37587,8 @@ class NullCoder extends Coder {
|
|
|
37587
37587
|
|
|
37588
37588
|
const AddressZero = "0x0000000000000000000000000000000000000000";
|
|
37589
37589
|
|
|
37590
|
-
const NegativeOne$1 = ( /*#__PURE__*/BigNumber$1$1.from(-1));
|
|
37591
|
-
const Zero$1 = ( /*#__PURE__*/BigNumber$1$1.from(0));
|
|
37590
|
+
const NegativeOne$1$1 = ( /*#__PURE__*/BigNumber$1$1.from(-1));
|
|
37591
|
+
const Zero$1$1 = ( /*#__PURE__*/BigNumber$1$1.from(0));
|
|
37592
37592
|
const One$1 = ( /*#__PURE__*/BigNumber$1$1.from(1));
|
|
37593
37593
|
const MaxUint256$1 = ( /*#__PURE__*/BigNumber$1$1.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
|
37594
37594
|
|
|
@@ -37610,11 +37610,11 @@ class NumberCoder extends Coder {
|
|
|
37610
37610
|
let maxUintValue = MaxUint256$1.mask(writer.wordSize * 8);
|
|
37611
37611
|
if (this.signed) {
|
|
37612
37612
|
let bounds = maxUintValue.mask(this.size * 8 - 1);
|
|
37613
|
-
if (v.gt(bounds) || v.lt(bounds.add(One$1).mul(NegativeOne$1))) {
|
|
37613
|
+
if (v.gt(bounds) || v.lt(bounds.add(One$1).mul(NegativeOne$1$1))) {
|
|
37614
37614
|
this._throwError("value out-of-bounds", value);
|
|
37615
37615
|
}
|
|
37616
37616
|
}
|
|
37617
|
-
else if (v.lt(Zero$1) || v.gt(maxUintValue.mask(this.size * 8))) {
|
|
37617
|
+
else if (v.lt(Zero$1$1) || v.gt(maxUintValue.mask(this.size * 8))) {
|
|
37618
37618
|
this._throwError("value out-of-bounds", value);
|
|
37619
37619
|
}
|
|
37620
37620
|
v = v.toTwos(this.size * 8).mask(this.size * 8);
|
|
@@ -37716,7 +37716,7 @@ function getUtf8CodePoints(bytes, onError) {
|
|
|
37716
37716
|
if (onError == null) {
|
|
37717
37717
|
onError = Utf8ErrorFuncs.error;
|
|
37718
37718
|
}
|
|
37719
|
-
bytes = arrayify$
|
|
37719
|
+
bytes = arrayify$2(bytes);
|
|
37720
37720
|
const result = [];
|
|
37721
37721
|
let i = 0;
|
|
37722
37722
|
// Invalid bytes are ignored
|
|
@@ -37830,7 +37830,7 @@ function toUtf8Bytes(str, form = UnicodeNormalizationForm.current) {
|
|
|
37830
37830
|
result.push((c & 0x3f) | 0x80);
|
|
37831
37831
|
}
|
|
37832
37832
|
}
|
|
37833
|
-
return arrayify$
|
|
37833
|
+
return arrayify$2(result);
|
|
37834
37834
|
}
|
|
37835
37835
|
function _toUtf8String(codePoints) {
|
|
37836
37836
|
return codePoints.map((codePoint) => {
|
|
@@ -38178,7 +38178,7 @@ class AbiCoder {
|
|
|
38178
38178
|
decode(types, data, loose) {
|
|
38179
38179
|
const coders = types.map((type) => this._getCoder(ParamType.from(type)));
|
|
38180
38180
|
const coder = new TupleCoder(coders, "_");
|
|
38181
|
-
return coder.decode(this._getReader(arrayify$
|
|
38181
|
+
return coder.decode(this._getReader(arrayify$2(data), loose));
|
|
38182
38182
|
}
|
|
38183
38183
|
}
|
|
38184
38184
|
const defaultAbiCoder = new AbiCoder();
|
|
@@ -38229,15 +38229,15 @@ const Zero$3 = BigNumber$1$1.from(0);
|
|
|
38229
38229
|
const One = BigNumber$1$1.from(1);
|
|
38230
38230
|
const MaxUint256 = BigNumber$1$1.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
|
38231
38231
|
function hexPadRight(value) {
|
|
38232
|
-
const bytes = arrayify$
|
|
38232
|
+
const bytes = arrayify$2(value);
|
|
38233
38233
|
const padOffset = bytes.length % 32;
|
|
38234
38234
|
if (padOffset) {
|
|
38235
38235
|
return hexConcat([bytes, padding.slice(padOffset)]);
|
|
38236
38236
|
}
|
|
38237
38237
|
return hexlify$2(bytes);
|
|
38238
38238
|
}
|
|
38239
|
-
const hexTrue = hexZeroPad$
|
|
38240
|
-
const hexFalse = hexZeroPad$
|
|
38239
|
+
const hexTrue = hexZeroPad$2(One.toHexString(), 32);
|
|
38240
|
+
const hexFalse = hexZeroPad$2(Zero$3.toHexString(), 32);
|
|
38241
38241
|
const domainFieldTypes = {
|
|
38242
38242
|
name: "string",
|
|
38243
38243
|
version: "string",
|
|
@@ -38275,7 +38275,7 @@ const domainChecks = {
|
|
|
38275
38275
|
},
|
|
38276
38276
|
salt: function (value) {
|
|
38277
38277
|
try {
|
|
38278
|
-
const bytes = arrayify$
|
|
38278
|
+
const bytes = arrayify$2(value);
|
|
38279
38279
|
if (bytes.length !== 32) {
|
|
38280
38280
|
throw new Error("bad length");
|
|
38281
38281
|
}
|
|
@@ -38302,7 +38302,7 @@ function getBaseEncoder(type) {
|
|
|
38302
38302
|
if (v.lt(boundsLower) || v.gt(boundsUpper)) {
|
|
38303
38303
|
logger$e.throwArgumentError(`value out-of-bounds for ${type}`, "value", value);
|
|
38304
38304
|
}
|
|
38305
|
-
return hexZeroPad$
|
|
38305
|
+
return hexZeroPad$2(v.toTwos(256).toHexString(), 32);
|
|
38306
38306
|
};
|
|
38307
38307
|
}
|
|
38308
38308
|
}
|
|
@@ -38315,7 +38315,7 @@ function getBaseEncoder(type) {
|
|
|
38315
38315
|
logger$e.throwArgumentError("invalid bytes width", "type", type);
|
|
38316
38316
|
}
|
|
38317
38317
|
return function (value) {
|
|
38318
|
-
const bytes = arrayify$
|
|
38318
|
+
const bytes = arrayify$2(value);
|
|
38319
38319
|
if (bytes.length !== width) {
|
|
38320
38320
|
logger$e.throwArgumentError(`invalid length for ${type}`, "value", value);
|
|
38321
38321
|
}
|
|
@@ -38325,7 +38325,7 @@ function getBaseEncoder(type) {
|
|
|
38325
38325
|
}
|
|
38326
38326
|
switch (type) {
|
|
38327
38327
|
case "address": return function (value) {
|
|
38328
|
-
return hexZeroPad$
|
|
38328
|
+
return hexZeroPad$2(getAddress$1(value), 32);
|
|
38329
38329
|
};
|
|
38330
38330
|
case "bool": return function (value) {
|
|
38331
38331
|
return ((!value) ? hexFalse : hexTrue);
|
|
@@ -38622,7 +38622,7 @@ class TypedDataEncoder {
|
|
|
38622
38622
|
message: encoder.visit(value, (type, value) => {
|
|
38623
38623
|
// bytes
|
|
38624
38624
|
if (type.match(/^bytes(\d*)/)) {
|
|
38625
|
-
return hexlify$2(arrayify$
|
|
38625
|
+
return hexlify$2(arrayify$2(value));
|
|
38626
38626
|
}
|
|
38627
38627
|
// uint or int
|
|
38628
38628
|
if (type.match(/^u?int/)) {
|
|
@@ -38894,7 +38894,7 @@ class Interface {
|
|
|
38894
38894
|
if (typeof (fragment) === "string") {
|
|
38895
38895
|
fragment = this.getError(fragment);
|
|
38896
38896
|
}
|
|
38897
|
-
const bytes = arrayify$
|
|
38897
|
+
const bytes = arrayify$2(data);
|
|
38898
38898
|
if (hexlify$2(bytes.slice(0, 4)) !== this.getSighash(fragment)) {
|
|
38899
38899
|
logger$d.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify$2(bytes));
|
|
38900
38900
|
}
|
|
@@ -38914,7 +38914,7 @@ class Interface {
|
|
|
38914
38914
|
if (typeof (functionFragment) === "string") {
|
|
38915
38915
|
functionFragment = this.getFunction(functionFragment);
|
|
38916
38916
|
}
|
|
38917
|
-
const bytes = arrayify$
|
|
38917
|
+
const bytes = arrayify$2(data);
|
|
38918
38918
|
if (hexlify$2(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {
|
|
38919
38919
|
logger$d.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify$2(bytes));
|
|
38920
38920
|
}
|
|
@@ -38935,7 +38935,7 @@ class Interface {
|
|
|
38935
38935
|
if (typeof (functionFragment) === "string") {
|
|
38936
38936
|
functionFragment = this.getFunction(functionFragment);
|
|
38937
38937
|
}
|
|
38938
|
-
let bytes = arrayify$
|
|
38938
|
+
let bytes = arrayify$2(data);
|
|
38939
38939
|
let reason = null;
|
|
38940
38940
|
let errorArgs = null;
|
|
38941
38941
|
let errorName = null;
|
|
@@ -39010,7 +39010,7 @@ class Interface {
|
|
|
39010
39010
|
if (param.type === "address") {
|
|
39011
39011
|
this._abiCoder.encode(["address"], [value]);
|
|
39012
39012
|
}
|
|
39013
|
-
return hexZeroPad$
|
|
39013
|
+
return hexZeroPad$2(hexlify$2(value), 32);
|
|
39014
39014
|
};
|
|
39015
39015
|
values.forEach((value, index) => {
|
|
39016
39016
|
let param = eventFragment.inputs[index];
|
|
@@ -43311,33 +43311,33 @@ class SigningKey {
|
|
|
43311
43311
|
constructor(privateKey) {
|
|
43312
43312
|
defineReadOnly(this, "curve", "secp256k1");
|
|
43313
43313
|
defineReadOnly(this, "privateKey", hexlify$2(privateKey));
|
|
43314
|
-
const keyPair = getCurve().keyFromPrivate(arrayify$
|
|
43314
|
+
const keyPair = getCurve().keyFromPrivate(arrayify$2(this.privateKey));
|
|
43315
43315
|
defineReadOnly(this, "publicKey", "0x" + keyPair.getPublic(false, "hex"));
|
|
43316
43316
|
defineReadOnly(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex"));
|
|
43317
43317
|
defineReadOnly(this, "_isSigningKey", true);
|
|
43318
43318
|
}
|
|
43319
43319
|
_addPoint(other) {
|
|
43320
|
-
const p0 = getCurve().keyFromPublic(arrayify$
|
|
43321
|
-
const p1 = getCurve().keyFromPublic(arrayify$
|
|
43320
|
+
const p0 = getCurve().keyFromPublic(arrayify$2(this.publicKey));
|
|
43321
|
+
const p1 = getCurve().keyFromPublic(arrayify$2(other));
|
|
43322
43322
|
return "0x" + p0.pub.add(p1.pub).encodeCompressed("hex");
|
|
43323
43323
|
}
|
|
43324
43324
|
signDigest(digest) {
|
|
43325
|
-
const keyPair = getCurve().keyFromPrivate(arrayify$
|
|
43326
|
-
const digestBytes = arrayify$
|
|
43325
|
+
const keyPair = getCurve().keyFromPrivate(arrayify$2(this.privateKey));
|
|
43326
|
+
const digestBytes = arrayify$2(digest);
|
|
43327
43327
|
if (digestBytes.length !== 32) {
|
|
43328
43328
|
logger$a.throwArgumentError("bad digest length", "digest", digest);
|
|
43329
43329
|
}
|
|
43330
43330
|
const signature = keyPair.sign(digestBytes, { canonical: true });
|
|
43331
43331
|
return splitSignature({
|
|
43332
43332
|
recoveryParam: signature.recoveryParam,
|
|
43333
|
-
r: hexZeroPad$
|
|
43334
|
-
s: hexZeroPad$
|
|
43333
|
+
r: hexZeroPad$2("0x" + signature.r.toString(16), 32),
|
|
43334
|
+
s: hexZeroPad$2("0x" + signature.s.toString(16), 32),
|
|
43335
43335
|
});
|
|
43336
43336
|
}
|
|
43337
43337
|
computeSharedSecret(otherKey) {
|
|
43338
|
-
const keyPair = getCurve().keyFromPrivate(arrayify$
|
|
43339
|
-
const otherKeyPair = getCurve().keyFromPublic(arrayify$
|
|
43340
|
-
return hexZeroPad$
|
|
43338
|
+
const keyPair = getCurve().keyFromPrivate(arrayify$2(this.privateKey));
|
|
43339
|
+
const otherKeyPair = getCurve().keyFromPublic(arrayify$2(computePublicKey(otherKey)));
|
|
43340
|
+
return hexZeroPad$2("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);
|
|
43341
43341
|
}
|
|
43342
43342
|
static isSigningKey(value) {
|
|
43343
43343
|
return !!(value && value._isSigningKey);
|
|
@@ -43345,11 +43345,11 @@ class SigningKey {
|
|
|
43345
43345
|
}
|
|
43346
43346
|
function recoverPublicKey(digest, signature) {
|
|
43347
43347
|
const sig = splitSignature(signature);
|
|
43348
|
-
const rs = { r: arrayify$
|
|
43349
|
-
return "0x" + getCurve().recoverPubKey(arrayify$
|
|
43348
|
+
const rs = { r: arrayify$2(sig.r), s: arrayify$2(sig.s) };
|
|
43349
|
+
return "0x" + getCurve().recoverPubKey(arrayify$2(digest), rs, sig.recoveryParam).encode("hex", false);
|
|
43350
43350
|
}
|
|
43351
43351
|
function computePublicKey(key, compressed) {
|
|
43352
|
-
const bytes = arrayify$
|
|
43352
|
+
const bytes = arrayify$2(key);
|
|
43353
43353
|
if (bytes.length === 32) {
|
|
43354
43354
|
const signingKey = new SigningKey(bytes);
|
|
43355
43355
|
if (compressed) {
|
|
@@ -43390,7 +43390,7 @@ function handleAddress(value) {
|
|
|
43390
43390
|
}
|
|
43391
43391
|
function handleNumber(value) {
|
|
43392
43392
|
if (value === "0x") {
|
|
43393
|
-
return Zero$1;
|
|
43393
|
+
return Zero$1$1;
|
|
43394
43394
|
}
|
|
43395
43395
|
return BigNumber$1$1.from(value);
|
|
43396
43396
|
}
|
|
@@ -43399,7 +43399,7 @@ function computeAddress(key) {
|
|
|
43399
43399
|
return getAddress$1(hexDataSlice(keccak256$1(hexDataSlice(publicKey, 1)), 12));
|
|
43400
43400
|
}
|
|
43401
43401
|
function recoverAddress(digest, signature) {
|
|
43402
|
-
return computeAddress(recoverPublicKey(arrayify$
|
|
43402
|
+
return computeAddress(recoverPublicKey(arrayify$2(digest), signature));
|
|
43403
43403
|
}
|
|
43404
43404
|
function formatNumber(value, name) {
|
|
43405
43405
|
const result = stripZeros(BigNumber$1$1.from(value).toHexString());
|
|
@@ -43506,8 +43506,8 @@ function _parseEipSignature(tx, fields, serialize) {
|
|
|
43506
43506
|
catch (error) {
|
|
43507
43507
|
logger$9.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]);
|
|
43508
43508
|
}
|
|
43509
|
-
tx.r = hexZeroPad$
|
|
43510
|
-
tx.s = hexZeroPad$
|
|
43509
|
+
tx.r = hexZeroPad$2(fields[1], 32);
|
|
43510
|
+
tx.s = hexZeroPad$2(fields[2], 32);
|
|
43511
43511
|
try {
|
|
43512
43512
|
const digest = keccak256$1(serialize(tx));
|
|
43513
43513
|
tx.from = recoverAddress(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v });
|
|
@@ -43594,8 +43594,8 @@ function _parse(rawTransaction) {
|
|
|
43594
43594
|
console.log(error);
|
|
43595
43595
|
return tx;
|
|
43596
43596
|
}
|
|
43597
|
-
tx.r = hexZeroPad$
|
|
43598
|
-
tx.s = hexZeroPad$
|
|
43597
|
+
tx.r = hexZeroPad$2(transaction[7], 32);
|
|
43598
|
+
tx.s = hexZeroPad$2(transaction[8], 32);
|
|
43599
43599
|
if (BigNumber$1$1.from(tx.r).isZero() && BigNumber$1$1.from(tx.s).isZero()) {
|
|
43600
43600
|
// EIP-155 unsigned transaction
|
|
43601
43601
|
tx.chainId = tx.v;
|
|
@@ -43628,7 +43628,7 @@ function _parse(rawTransaction) {
|
|
|
43628
43628
|
return tx;
|
|
43629
43629
|
}
|
|
43630
43630
|
function parse(rawTransaction) {
|
|
43631
|
-
const payload = arrayify$
|
|
43631
|
+
const payload = arrayify$2(rawTransaction);
|
|
43632
43632
|
// Legacy and EIP-155 Transactions
|
|
43633
43633
|
if (payload[0] > 0x7f) {
|
|
43634
43634
|
return _parse(payload);
|
|
@@ -43785,7 +43785,7 @@ function populateTransaction(contract, fragment, args) {
|
|
|
43785
43785
|
// is always a non-nil to address, we can ignore G_create, but may wish to add
|
|
43786
43786
|
// similar logic to the ContractFactory.
|
|
43787
43787
|
let intrinsic = 21000;
|
|
43788
|
-
const bytes = arrayify$
|
|
43788
|
+
const bytes = arrayify$2(data);
|
|
43789
43789
|
for (let i = 0; i < bytes.length; i++) {
|
|
43790
43790
|
intrinsic += 4;
|
|
43791
43791
|
if (bytes[i]) {
|
|
@@ -44512,14 +44512,14 @@ const version$5$1 = "bignumber/5.4.2";
|
|
|
44512
44512
|
|
|
44513
44513
|
var BN$2 = bn$2.BN;
|
|
44514
44514
|
const logger$7 = new Logger$2(version$5$1);
|
|
44515
|
-
const _constructorGuard$1$
|
|
44515
|
+
const _constructorGuard$1$2 = {};
|
|
44516
44516
|
const MAX_SAFE$2 = 0x1fffffffffffff;
|
|
44517
44517
|
// Only warn about passing 10 into radix once
|
|
44518
44518
|
let _warnedToStringRadix$2 = false;
|
|
44519
44519
|
class BigNumber$2 {
|
|
44520
44520
|
constructor(constructorGuard, hex) {
|
|
44521
44521
|
logger$7.checkNew(new.target, BigNumber$2);
|
|
44522
|
-
if (constructorGuard !== _constructorGuard$1$
|
|
44522
|
+
if (constructorGuard !== _constructorGuard$1$2) {
|
|
44523
44523
|
logger$7.throwError("cannot call constructor directly; use BigNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
44524
44524
|
operation: "new (BigNumber)"
|
|
44525
44525
|
});
|
|
@@ -44678,10 +44678,10 @@ class BigNumber$2 {
|
|
|
44678
44678
|
}
|
|
44679
44679
|
if (typeof (value) === "string") {
|
|
44680
44680
|
if (value.match(/^-?0x[0-9a-f]+$/i)) {
|
|
44681
|
-
return new BigNumber$2(_constructorGuard$1$
|
|
44681
|
+
return new BigNumber$2(_constructorGuard$1$2, toHex$3(value));
|
|
44682
44682
|
}
|
|
44683
44683
|
if (value.match(/^-?[0-9]+$/)) {
|
|
44684
|
-
return new BigNumber$2(_constructorGuard$1$
|
|
44684
|
+
return new BigNumber$2(_constructorGuard$1$2, toHex$3(new BN$2(value)));
|
|
44685
44685
|
}
|
|
44686
44686
|
return logger$7.throwArgumentError("invalid BigNumber string", "value", value);
|
|
44687
44687
|
}
|
|
@@ -44839,7 +44839,7 @@ class BaseX {
|
|
|
44839
44839
|
}
|
|
44840
44840
|
}
|
|
44841
44841
|
encode(value) {
|
|
44842
|
-
let source = arrayify$
|
|
44842
|
+
let source = arrayify$2(value);
|
|
44843
44843
|
if (source.length === 0) {
|
|
44844
44844
|
return "";
|
|
44845
44845
|
}
|
|
@@ -44896,7 +44896,7 @@ class BaseX {
|
|
|
44896
44896
|
for (let k = 0; value[k] === this._leader && k < value.length - 1; ++k) {
|
|
44897
44897
|
bytes.push(0);
|
|
44898
44898
|
}
|
|
44899
|
-
return arrayify$
|
|
44899
|
+
return arrayify$2(new Uint8Array(bytes.reverse()));
|
|
44900
44900
|
}
|
|
44901
44901
|
}
|
|
44902
44902
|
new BaseX("abcdefghijklmnopqrstuvwxyz234567");
|
|
@@ -44908,12 +44908,12 @@ const version$4$1 = "sha2/5.4.0";
|
|
|
44908
44908
|
|
|
44909
44909
|
new Logger$2(version$4$1);
|
|
44910
44910
|
function sha256(data) {
|
|
44911
|
-
return "0x" + (hash.sha256().update(arrayify$
|
|
44911
|
+
return "0x" + (hash.sha256().update(arrayify$2(data)).digest("hex"));
|
|
44912
44912
|
}
|
|
44913
44913
|
|
|
44914
|
-
const version$3$
|
|
44914
|
+
const version$3$2 = "networks/5.4.2";
|
|
44915
44915
|
|
|
44916
|
-
const logger$6 = new Logger$2(version$3$
|
|
44916
|
+
const logger$6 = new Logger$2(version$3$2);
|
|
44917
44917
|
function isRenetworkable(value) {
|
|
44918
44918
|
return (value && typeof (value.renetwork) === "function");
|
|
44919
44919
|
}
|
|
@@ -45127,7 +45127,7 @@ function getNetwork(network) {
|
|
|
45127
45127
|
}
|
|
45128
45128
|
|
|
45129
45129
|
function encode$1(data) {
|
|
45130
|
-
data = arrayify$
|
|
45130
|
+
data = arrayify$2(data);
|
|
45131
45131
|
let textData = "";
|
|
45132
45132
|
for (let i = 0; i < data.length; i++) {
|
|
45133
45133
|
textData += String.fromCharCode(data[i]);
|
|
@@ -45178,7 +45178,7 @@ function getUrl(href, options) {
|
|
|
45178
45178
|
headers: headers,
|
|
45179
45179
|
statusCode: response.status,
|
|
45180
45180
|
statusMessage: response.statusText,
|
|
45181
|
-
body: arrayify$
|
|
45181
|
+
body: arrayify$2(new Uint8Array(body)),
|
|
45182
45182
|
};
|
|
45183
45183
|
});
|
|
45184
45184
|
}
|
|
@@ -45944,7 +45944,7 @@ class Formatter {
|
|
|
45944
45944
|
if (!isHexString$2(value)) {
|
|
45945
45945
|
throw new Error("invalid uint256");
|
|
45946
45946
|
}
|
|
45947
|
-
return hexZeroPad$
|
|
45947
|
+
return hexZeroPad$2(value, 32);
|
|
45948
45948
|
}
|
|
45949
45949
|
_block(value, format) {
|
|
45950
45950
|
if (value.author != null && value.miner == null) {
|
|
@@ -46127,7 +46127,7 @@ var __awaiter$1 = function (thisArg, _arguments, P, generator) {
|
|
|
46127
46127
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
46128
46128
|
});
|
|
46129
46129
|
};
|
|
46130
|
-
const logger$3$
|
|
46130
|
+
const logger$3$2 = new Logger$2(version$1$2);
|
|
46131
46131
|
//////////////////////////////
|
|
46132
46132
|
// Event Serializeing
|
|
46133
46133
|
function checkTopic(topic) {
|
|
@@ -46135,7 +46135,7 @@ function checkTopic(topic) {
|
|
|
46135
46135
|
return "null";
|
|
46136
46136
|
}
|
|
46137
46137
|
if (hexDataLength(topic) !== 32) {
|
|
46138
|
-
logger$3$
|
|
46138
|
+
logger$3$2.throwArgumentError("invalid topic", "topic", topic);
|
|
46139
46139
|
}
|
|
46140
46140
|
return topic.toLowerCase();
|
|
46141
46141
|
}
|
|
@@ -46190,7 +46190,7 @@ function getEventTag(eventName) {
|
|
|
46190
46190
|
return "filter:*:" + serializeTopics(eventName);
|
|
46191
46191
|
}
|
|
46192
46192
|
else if (ForkEvent.isForkEvent(eventName)) {
|
|
46193
|
-
logger$3$
|
|
46193
|
+
logger$3$2.warn("not implemented");
|
|
46194
46194
|
throw new Error("not implemented");
|
|
46195
46195
|
}
|
|
46196
46196
|
else if (eventName && typeof (eventName) === "object") {
|
|
@@ -46278,7 +46278,7 @@ const coinInfos = {
|
|
|
46278
46278
|
"700": { symbol: "xdai", ilk: "eth" },
|
|
46279
46279
|
};
|
|
46280
46280
|
function bytes32ify(value) {
|
|
46281
|
-
return hexZeroPad$
|
|
46281
|
+
return hexZeroPad$2(BigNumber$1$1.from(value).toHexString(), 32);
|
|
46282
46282
|
}
|
|
46283
46283
|
// Compute the Base58Check encoded data (checksum is first 4 bytes of sha256d)
|
|
46284
46284
|
function base58Encode(data) {
|
|
@@ -46317,14 +46317,14 @@ class Resolver {
|
|
|
46317
46317
|
_getAddress(coinType, hexBytes) {
|
|
46318
46318
|
const coinInfo = coinInfos[String(coinType)];
|
|
46319
46319
|
if (coinInfo == null) {
|
|
46320
|
-
logger$3$
|
|
46320
|
+
logger$3$2.throwError(`unsupported coin type: ${coinType}`, Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
46321
46321
|
operation: `getAddress(${coinType})`
|
|
46322
46322
|
});
|
|
46323
46323
|
}
|
|
46324
46324
|
if (coinInfo.ilk === "eth") {
|
|
46325
46325
|
return this.provider.formatter.address(hexBytes);
|
|
46326
46326
|
}
|
|
46327
|
-
const bytes = arrayify$
|
|
46327
|
+
const bytes = arrayify$2(hexBytes);
|
|
46328
46328
|
// P2PKH: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
|
|
46329
46329
|
if (coinInfo.p2pkh != null) {
|
|
46330
46330
|
const p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);
|
|
@@ -46402,7 +46402,7 @@ class Resolver {
|
|
|
46402
46402
|
// Compute the address
|
|
46403
46403
|
const address = this._getAddress(coinType, hexBytes);
|
|
46404
46404
|
if (address == null) {
|
|
46405
|
-
logger$3$
|
|
46405
|
+
logger$3$2.throwError(`invalid or unsupported coin data`, Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
46406
46406
|
operation: `getAddress(${coinType})`,
|
|
46407
46407
|
coinType: coinType,
|
|
46408
46408
|
data: hexBytes
|
|
@@ -46434,7 +46434,7 @@ class Resolver {
|
|
|
46434
46434
|
return "bzz:/\/" + swarm[1];
|
|
46435
46435
|
}
|
|
46436
46436
|
}
|
|
46437
|
-
return logger$3$
|
|
46437
|
+
return logger$3$2.throwError(`invalid or unsupported content hash data`, Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
46438
46438
|
operation: "getContentHash()",
|
|
46439
46439
|
data: hexBytes
|
|
46440
46440
|
});
|
|
@@ -46449,7 +46449,7 @@ class Resolver {
|
|
|
46449
46449
|
keyBytes = concat([bytes32ify(64), bytes32ify(keyBytes.length), keyBytes]);
|
|
46450
46450
|
// Pad to word-size (32 bytes)
|
|
46451
46451
|
if ((keyBytes.length % 32) !== 0) {
|
|
46452
|
-
keyBytes = concat([keyBytes, hexZeroPad$
|
|
46452
|
+
keyBytes = concat([keyBytes, hexZeroPad$2("0x", 32 - (key.length % 32))]);
|
|
46453
46453
|
}
|
|
46454
46454
|
const hexBytes = yield this._fetchBytes("0x59d1d43c", hexlify$2(keyBytes));
|
|
46455
46455
|
if (hexBytes == null || hexBytes === "0x") {
|
|
@@ -46472,7 +46472,7 @@ class BaseProvider extends Provider {
|
|
|
46472
46472
|
*
|
|
46473
46473
|
*/
|
|
46474
46474
|
constructor(network) {
|
|
46475
|
-
logger$3$
|
|
46475
|
+
logger$3$2.checkNew(new.target, Provider);
|
|
46476
46476
|
super();
|
|
46477
46477
|
// Events being listened to
|
|
46478
46478
|
this._events = [];
|
|
@@ -46499,7 +46499,7 @@ class BaseProvider extends Provider {
|
|
|
46499
46499
|
this.emit("network", knownNetwork, null);
|
|
46500
46500
|
}
|
|
46501
46501
|
else {
|
|
46502
|
-
logger$3$
|
|
46502
|
+
logger$3$2.throwArgumentError("invalid network", "network", network);
|
|
46503
46503
|
}
|
|
46504
46504
|
}
|
|
46505
46505
|
this._maxInternalBlockNumber = -1024;
|
|
@@ -46524,7 +46524,7 @@ class BaseProvider extends Provider {
|
|
|
46524
46524
|
// This should never happen; every Provider sub-class should have
|
|
46525
46525
|
// suggested a network by here (or have thrown).
|
|
46526
46526
|
if (!network) {
|
|
46527
|
-
logger$3$
|
|
46527
|
+
logger$3$2.throwError("no network detected", Logger$2.errors.UNKNOWN_ERROR, {});
|
|
46528
46528
|
}
|
|
46529
46529
|
// Possible this call stacked so do not call defineReadOnly again
|
|
46530
46530
|
if (this._network == null) {
|
|
@@ -46656,8 +46656,8 @@ class BaseProvider extends Provider {
|
|
|
46656
46656
|
this._emitted.block = blockNumber - 1;
|
|
46657
46657
|
}
|
|
46658
46658
|
if (Math.abs((this._emitted.block) - blockNumber) > 1000) {
|
|
46659
|
-
logger$3$
|
|
46660
|
-
this.emit("error", logger$3$
|
|
46659
|
+
logger$3$2.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${blockNumber})`);
|
|
46660
|
+
this.emit("error", logger$3$2.makeError("network block skew detected", Logger$2.errors.NETWORK_ERROR, {
|
|
46661
46661
|
blockNumber: blockNumber,
|
|
46662
46662
|
event: "blockSkew",
|
|
46663
46663
|
previousBlockNumber: this._emitted.block
|
|
@@ -46754,7 +46754,7 @@ class BaseProvider extends Provider {
|
|
|
46754
46754
|
// can change, such as when connected to a JSON-RPC backend
|
|
46755
46755
|
detectNetwork() {
|
|
46756
46756
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
46757
|
-
return logger$3$
|
|
46757
|
+
return logger$3$2.throwError("provider does not support network detection", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
46758
46758
|
operation: "provider.detectNetwork"
|
|
46759
46759
|
});
|
|
46760
46760
|
});
|
|
@@ -46786,7 +46786,7 @@ class BaseProvider extends Provider {
|
|
|
46786
46786
|
yield stall(0);
|
|
46787
46787
|
return this._network;
|
|
46788
46788
|
}
|
|
46789
|
-
const error = logger$3$
|
|
46789
|
+
const error = logger$3$2.makeError("underlying network changed", Logger$2.errors.NETWORK_ERROR, {
|
|
46790
46790
|
event: "changed",
|
|
46791
46791
|
network: network,
|
|
46792
46792
|
detectedNetwork: currentNetwork
|
|
@@ -46973,7 +46973,7 @@ class BaseProvider extends Provider {
|
|
|
46973
46973
|
reason = "cancelled";
|
|
46974
46974
|
}
|
|
46975
46975
|
// Explain why we were replaced
|
|
46976
|
-
reject(logger$3$
|
|
46976
|
+
reject(logger$3$2.makeError("transaction was replaced", Logger$2.errors.TRANSACTION_REPLACED, {
|
|
46977
46977
|
cancelled: (reason === "replaced" || reason === "cancelled"),
|
|
46978
46978
|
reason,
|
|
46979
46979
|
replacement: this._wrapTransaction(tx),
|
|
@@ -47010,7 +47010,7 @@ class BaseProvider extends Provider {
|
|
|
47010
47010
|
if (alreadyDone()) {
|
|
47011
47011
|
return;
|
|
47012
47012
|
}
|
|
47013
|
-
reject(logger$3$
|
|
47013
|
+
reject(logger$3$2.makeError("timeout exceeded", Logger$2.errors.TIMEOUT, { timeout: timeout }));
|
|
47014
47014
|
}, timeout);
|
|
47015
47015
|
if (timer.unref) {
|
|
47016
47016
|
timer.unref();
|
|
@@ -47033,7 +47033,7 @@ class BaseProvider extends Provider {
|
|
|
47033
47033
|
return BigNumber$1$1.from(result);
|
|
47034
47034
|
}
|
|
47035
47035
|
catch (error) {
|
|
47036
|
-
return logger$3$
|
|
47036
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47037
47037
|
method: "getGasPrice",
|
|
47038
47038
|
result, error
|
|
47039
47039
|
});
|
|
@@ -47052,7 +47052,7 @@ class BaseProvider extends Provider {
|
|
|
47052
47052
|
return BigNumber$1$1.from(result);
|
|
47053
47053
|
}
|
|
47054
47054
|
catch (error) {
|
|
47055
|
-
return logger$3$
|
|
47055
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47056
47056
|
method: "getBalance",
|
|
47057
47057
|
params, result, error
|
|
47058
47058
|
});
|
|
@@ -47071,7 +47071,7 @@ class BaseProvider extends Provider {
|
|
|
47071
47071
|
return BigNumber$1$1.from(result).toNumber();
|
|
47072
47072
|
}
|
|
47073
47073
|
catch (error) {
|
|
47074
|
-
return logger$3$
|
|
47074
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47075
47075
|
method: "getTransactionCount",
|
|
47076
47076
|
params, result, error
|
|
47077
47077
|
});
|
|
@@ -47090,7 +47090,7 @@ class BaseProvider extends Provider {
|
|
|
47090
47090
|
return hexlify$2(result);
|
|
47091
47091
|
}
|
|
47092
47092
|
catch (error) {
|
|
47093
|
-
return logger$3$
|
|
47093
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47094
47094
|
method: "getCode",
|
|
47095
47095
|
params, result, error
|
|
47096
47096
|
});
|
|
@@ -47110,7 +47110,7 @@ class BaseProvider extends Provider {
|
|
|
47110
47110
|
return hexlify$2(result);
|
|
47111
47111
|
}
|
|
47112
47112
|
catch (error) {
|
|
47113
|
-
return logger$3$
|
|
47113
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47114
47114
|
method: "getStorageAt",
|
|
47115
47115
|
params, result, error
|
|
47116
47116
|
});
|
|
@@ -47125,7 +47125,7 @@ class BaseProvider extends Provider {
|
|
|
47125
47125
|
const result = tx;
|
|
47126
47126
|
// Check the hash we expect is the same as the hash the server reported
|
|
47127
47127
|
if (hash != null && tx.hash !== hash) {
|
|
47128
|
-
logger$3$
|
|
47128
|
+
logger$3$2.throwError("Transaction hash mismatch from Provider.sendTransaction.", Logger$2.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });
|
|
47129
47129
|
}
|
|
47130
47130
|
result.wait = (confirms, timeout) => __awaiter$1(this, void 0, void 0, function* () {
|
|
47131
47131
|
if (confirms == null) {
|
|
@@ -47153,7 +47153,7 @@ class BaseProvider extends Provider {
|
|
|
47153
47153
|
// No longer pending, allow the polling loop to garbage collect this
|
|
47154
47154
|
this._emitted["t:" + tx.hash] = receipt.blockNumber;
|
|
47155
47155
|
if (receipt.status === 0) {
|
|
47156
|
-
logger$3$
|
|
47156
|
+
logger$3$2.throwError("transaction failed", Logger$2.errors.CALL_EXCEPTION, {
|
|
47157
47157
|
transactionHash: tx.hash,
|
|
47158
47158
|
transaction: tx,
|
|
47159
47159
|
receipt: receipt
|
|
@@ -47251,7 +47251,7 @@ class BaseProvider extends Provider {
|
|
|
47251
47251
|
return hexlify$2(result);
|
|
47252
47252
|
}
|
|
47253
47253
|
catch (error) {
|
|
47254
|
-
return logger$3$
|
|
47254
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47255
47255
|
method: "call",
|
|
47256
47256
|
params, result, error
|
|
47257
47257
|
});
|
|
@@ -47269,7 +47269,7 @@ class BaseProvider extends Provider {
|
|
|
47269
47269
|
return BigNumber$1$1.from(result);
|
|
47270
47270
|
}
|
|
47271
47271
|
catch (error) {
|
|
47272
|
-
return logger$3$
|
|
47272
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47273
47273
|
method: "estimateGas",
|
|
47274
47274
|
params, result, error
|
|
47275
47275
|
});
|
|
@@ -47280,7 +47280,7 @@ class BaseProvider extends Provider {
|
|
|
47280
47280
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
47281
47281
|
const address = yield this.resolveName(addressOrName);
|
|
47282
47282
|
if (address == null) {
|
|
47283
|
-
logger$3$
|
|
47283
|
+
logger$3$2.throwError("ENS name not configured", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
47284
47284
|
operation: `resolveName(${JSON.stringify(addressOrName)})`
|
|
47285
47285
|
});
|
|
47286
47286
|
}
|
|
@@ -47307,7 +47307,7 @@ class BaseProvider extends Provider {
|
|
|
47307
47307
|
}
|
|
47308
47308
|
}
|
|
47309
47309
|
catch (error) {
|
|
47310
|
-
logger$3$
|
|
47310
|
+
logger$3$2.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag);
|
|
47311
47311
|
}
|
|
47312
47312
|
}
|
|
47313
47313
|
return poll(() => __awaiter$1(this, void 0, void 0, function* () {
|
|
@@ -47453,7 +47453,7 @@ class BaseProvider extends Provider {
|
|
|
47453
47453
|
blockTag = yield blockTag;
|
|
47454
47454
|
if (typeof (blockTag) === "number" && blockTag < 0) {
|
|
47455
47455
|
if (blockTag % 1) {
|
|
47456
|
-
logger$3$
|
|
47456
|
+
logger$3$2.throwArgumentError("invalid BlockTag", "blockTag", blockTag);
|
|
47457
47457
|
}
|
|
47458
47458
|
let blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval);
|
|
47459
47459
|
blockNumber += blockTag;
|
|
@@ -47488,7 +47488,7 @@ class BaseProvider extends Provider {
|
|
|
47488
47488
|
const network = yield this.getNetwork();
|
|
47489
47489
|
// No ENS...
|
|
47490
47490
|
if (!network.ensAddress) {
|
|
47491
|
-
logger$3$
|
|
47491
|
+
logger$3$2.throwError("network does not support ENS", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name });
|
|
47492
47492
|
}
|
|
47493
47493
|
// keccak256("resolver(bytes32)")
|
|
47494
47494
|
const transaction = {
|
|
@@ -47520,7 +47520,7 @@ class BaseProvider extends Provider {
|
|
|
47520
47520
|
}
|
|
47521
47521
|
}
|
|
47522
47522
|
if (typeof (name) !== "string") {
|
|
47523
|
-
logger$3$
|
|
47523
|
+
logger$3$2.throwArgumentError("invalid ENS name", "name", name);
|
|
47524
47524
|
}
|
|
47525
47525
|
// Get the addr from the resovler
|
|
47526
47526
|
const resolver = yield this.getResolver(name);
|
|
@@ -47540,7 +47540,7 @@ class BaseProvider extends Provider {
|
|
|
47540
47540
|
return null;
|
|
47541
47541
|
}
|
|
47542
47542
|
// keccak("name(bytes32)")
|
|
47543
|
-
let bytes = arrayify$
|
|
47543
|
+
let bytes = arrayify$2(yield this.call({
|
|
47544
47544
|
to: resolverAddress,
|
|
47545
47545
|
data: ("0x691f3431" + namehash(reverseName).substring(2))
|
|
47546
47546
|
}));
|
|
@@ -47570,7 +47570,7 @@ class BaseProvider extends Provider {
|
|
|
47570
47570
|
});
|
|
47571
47571
|
}
|
|
47572
47572
|
perform(method, params) {
|
|
47573
|
-
return logger$3$
|
|
47573
|
+
return logger$3$2.throwError(method + " not implemented", Logger$2.errors.NOT_IMPLEMENTED, { operation: method });
|
|
47574
47574
|
}
|
|
47575
47575
|
_startEvent(event) {
|
|
47576
47576
|
this.polling = (this._events.filter((e) => e.pollable()).length > 0);
|
|
@@ -47680,7 +47680,7 @@ var __awaiter = function (thisArg, _arguments, P, generator) {
|
|
|
47680
47680
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47681
47681
|
});
|
|
47682
47682
|
};
|
|
47683
|
-
const logger$2$
|
|
47683
|
+
const logger$2$2 = new Logger$2(version$1$2);
|
|
47684
47684
|
const errorGas = ["call", "estimateGas"];
|
|
47685
47685
|
function checkError(method, error, params) {
|
|
47686
47686
|
// Undo the "convenience" some nodes are attempting to prevent backwards
|
|
@@ -47690,7 +47690,7 @@ function checkError(method, error, params) {
|
|
|
47690
47690
|
if (e && e.message.match("reverted") && isHexString$2(e.data)) {
|
|
47691
47691
|
return e.data;
|
|
47692
47692
|
}
|
|
47693
|
-
logger$2$
|
|
47693
|
+
logger$2$2.throwError("missing revert data in call exception", Logger$2.errors.CALL_EXCEPTION, {
|
|
47694
47694
|
error, data: "0x"
|
|
47695
47695
|
});
|
|
47696
47696
|
}
|
|
@@ -47708,30 +47708,30 @@ function checkError(method, error, params) {
|
|
|
47708
47708
|
const transaction = params.transaction || params.signedTransaction;
|
|
47709
47709
|
// "insufficient funds for gas * price + value + cost(data)"
|
|
47710
47710
|
if (message.match(/insufficient funds|base fee exceeds gas limit/)) {
|
|
47711
|
-
logger$2$
|
|
47711
|
+
logger$2$2.throwError("insufficient funds for intrinsic transaction cost", Logger$2.errors.INSUFFICIENT_FUNDS, {
|
|
47712
47712
|
error, method, transaction
|
|
47713
47713
|
});
|
|
47714
47714
|
}
|
|
47715
47715
|
// "nonce too low"
|
|
47716
47716
|
if (message.match(/nonce too low/)) {
|
|
47717
|
-
logger$2$
|
|
47717
|
+
logger$2$2.throwError("nonce has already been used", Logger$2.errors.NONCE_EXPIRED, {
|
|
47718
47718
|
error, method, transaction
|
|
47719
47719
|
});
|
|
47720
47720
|
}
|
|
47721
47721
|
// "replacement transaction underpriced"
|
|
47722
47722
|
if (message.match(/replacement transaction underpriced/)) {
|
|
47723
|
-
logger$2$
|
|
47723
|
+
logger$2$2.throwError("replacement fee too low", Logger$2.errors.REPLACEMENT_UNDERPRICED, {
|
|
47724
47724
|
error, method, transaction
|
|
47725
47725
|
});
|
|
47726
47726
|
}
|
|
47727
47727
|
// "replacement transaction underpriced"
|
|
47728
47728
|
if (message.match(/only replay-protected/)) {
|
|
47729
|
-
logger$2$
|
|
47729
|
+
logger$2$2.throwError("legacy pre-eip-155 transactions not supported", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
47730
47730
|
error, method, transaction
|
|
47731
47731
|
});
|
|
47732
47732
|
}
|
|
47733
47733
|
if (errorGas.indexOf(method) >= 0 && message.match(/gas required exceeds allowance|always failing transaction|execution reverted/)) {
|
|
47734
|
-
logger$2$
|
|
47734
|
+
logger$2$2.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$2.errors.UNPREDICTABLE_GAS_LIMIT, {
|
|
47735
47735
|
error, method, transaction
|
|
47736
47736
|
});
|
|
47737
47737
|
}
|
|
@@ -47761,7 +47761,7 @@ function getLowerCase(value) {
|
|
|
47761
47761
|
const _constructorGuard$5 = {};
|
|
47762
47762
|
class JsonRpcSigner extends Signer {
|
|
47763
47763
|
constructor(constructorGuard, provider, addressOrIndex) {
|
|
47764
|
-
logger$2$
|
|
47764
|
+
logger$2$2.checkNew(new.target, JsonRpcSigner);
|
|
47765
47765
|
super();
|
|
47766
47766
|
if (constructorGuard !== _constructorGuard$5) {
|
|
47767
47767
|
throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");
|
|
@@ -47779,11 +47779,11 @@ class JsonRpcSigner extends Signer {
|
|
|
47779
47779
|
defineReadOnly(this, "_address", null);
|
|
47780
47780
|
}
|
|
47781
47781
|
else {
|
|
47782
|
-
logger$2$
|
|
47782
|
+
logger$2$2.throwArgumentError("invalid address or index", "addressOrIndex", addressOrIndex);
|
|
47783
47783
|
}
|
|
47784
47784
|
}
|
|
47785
47785
|
connect(provider) {
|
|
47786
|
-
return logger$2$
|
|
47786
|
+
return logger$2$2.throwError("cannot alter JSON-RPC Signer connection", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
47787
47787
|
operation: "connect"
|
|
47788
47788
|
});
|
|
47789
47789
|
}
|
|
@@ -47796,7 +47796,7 @@ class JsonRpcSigner extends Signer {
|
|
|
47796
47796
|
}
|
|
47797
47797
|
return this.provider.send("eth_accounts", []).then((accounts) => {
|
|
47798
47798
|
if (accounts.length <= this._index) {
|
|
47799
|
-
logger$2$
|
|
47799
|
+
logger$2$2.throwError("unknown account #" + this._index, Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
47800
47800
|
operation: "getAddress"
|
|
47801
47801
|
});
|
|
47802
47802
|
}
|
|
@@ -47826,7 +47826,7 @@ class JsonRpcSigner extends Signer {
|
|
|
47826
47826
|
}
|
|
47827
47827
|
const address = yield this.provider.resolveName(to);
|
|
47828
47828
|
if (address == null) {
|
|
47829
|
-
logger$2$
|
|
47829
|
+
logger$2$2.throwArgumentError("provided ENS name resolves to null", "tx.to", to);
|
|
47830
47830
|
}
|
|
47831
47831
|
return address;
|
|
47832
47832
|
}));
|
|
@@ -47837,7 +47837,7 @@ class JsonRpcSigner extends Signer {
|
|
|
47837
47837
|
}).then(({ tx, sender }) => {
|
|
47838
47838
|
if (tx.from != null) {
|
|
47839
47839
|
if (tx.from.toLowerCase() !== sender) {
|
|
47840
|
-
logger$2$
|
|
47840
|
+
logger$2$2.throwArgumentError("from address mismatch", "transaction", transaction);
|
|
47841
47841
|
}
|
|
47842
47842
|
}
|
|
47843
47843
|
else {
|
|
@@ -47852,7 +47852,7 @@ class JsonRpcSigner extends Signer {
|
|
|
47852
47852
|
});
|
|
47853
47853
|
}
|
|
47854
47854
|
signTransaction(transaction) {
|
|
47855
|
-
return logger$2$
|
|
47855
|
+
return logger$2$2.throwError("signing transactions is unsupported", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
47856
47856
|
operation: "signTransaction"
|
|
47857
47857
|
});
|
|
47858
47858
|
}
|
|
@@ -47934,7 +47934,7 @@ const allowedTransactionKeys = {
|
|
|
47934
47934
|
};
|
|
47935
47935
|
class JsonRpcProvider extends BaseProvider {
|
|
47936
47936
|
constructor(url, network) {
|
|
47937
|
-
logger$2$
|
|
47937
|
+
logger$2$2.checkNew(new.target, JsonRpcProvider);
|
|
47938
47938
|
let networkOrReady = network;
|
|
47939
47939
|
// The network is unknown, query the JSON-RPC for it
|
|
47940
47940
|
if (networkOrReady == null) {
|
|
@@ -48001,14 +48001,14 @@ class JsonRpcProvider extends BaseProvider {
|
|
|
48001
48001
|
return getNetwork(BigNumber$1$1.from(chainId).toNumber());
|
|
48002
48002
|
}
|
|
48003
48003
|
catch (error) {
|
|
48004
|
-
return logger$2$
|
|
48004
|
+
return logger$2$2.throwError("could not detect network", Logger$2.errors.NETWORK_ERROR, {
|
|
48005
48005
|
chainId: chainId,
|
|
48006
48006
|
event: "invalidNetwork",
|
|
48007
48007
|
serverError: error
|
|
48008
48008
|
});
|
|
48009
48009
|
}
|
|
48010
48010
|
}
|
|
48011
|
-
return logger$2$
|
|
48011
|
+
return logger$2$2.throwError("could not detect network", Logger$2.errors.NETWORK_ERROR, {
|
|
48012
48012
|
event: "noNetwork"
|
|
48013
48013
|
});
|
|
48014
48014
|
});
|
|
@@ -48133,7 +48133,7 @@ class JsonRpcProvider extends BaseProvider {
|
|
|
48133
48133
|
}
|
|
48134
48134
|
const args = this.prepareRequest(method, params);
|
|
48135
48135
|
if (args == null) {
|
|
48136
|
-
logger$2$
|
|
48136
|
+
logger$2$2.throwError(method + " not implemented", Logger$2.errors.NOT_IMPLEMENTED, { operation: method });
|
|
48137
48137
|
}
|
|
48138
48138
|
try {
|
|
48139
48139
|
return yield this.send(args[0], args[1]);
|
|
@@ -48382,7 +48382,7 @@ class Web3Provider extends JsonRpcProvider {
|
|
|
48382
48382
|
const version$k = "units/5.4.0";
|
|
48383
48383
|
|
|
48384
48384
|
const logger$r = new Logger$2(version$k);
|
|
48385
|
-
const names$
|
|
48385
|
+
const names$2 = [
|
|
48386
48386
|
"wei",
|
|
48387
48387
|
"kwei",
|
|
48388
48388
|
"mwei",
|
|
@@ -48391,17 +48391,17 @@ const names$1 = [
|
|
|
48391
48391
|
"finney",
|
|
48392
48392
|
"ether",
|
|
48393
48393
|
];
|
|
48394
|
-
function parseUnits$
|
|
48394
|
+
function parseUnits$2(value, unitName) {
|
|
48395
48395
|
if (typeof (value) !== "string") {
|
|
48396
48396
|
logger$r.throwArgumentError("value must be a string", "value", value);
|
|
48397
48397
|
}
|
|
48398
48398
|
if (typeof (unitName) === "string") {
|
|
48399
|
-
const index = names$
|
|
48399
|
+
const index = names$2.indexOf(unitName);
|
|
48400
48400
|
if (index !== -1) {
|
|
48401
48401
|
unitName = 3 * index;
|
|
48402
48402
|
}
|
|
48403
48403
|
}
|
|
48404
|
-
return parseFixed$
|
|
48404
|
+
return parseFixed$2(value, (unitName != null) ? unitName : 18);
|
|
48405
48405
|
}
|
|
48406
48406
|
|
|
48407
48407
|
function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
@@ -48432,7 +48432,7 @@ class Transaction {
|
|
|
48432
48432
|
|
|
48433
48433
|
static bigNumberify(value, blockchain) {
|
|
48434
48434
|
if (typeof value === 'number') {
|
|
48435
|
-
return parseUnits$
|
|
48435
|
+
return parseUnits$2(value.toString(), CONSTANTS$2[blockchain].DECIMALS)
|
|
48436
48436
|
} else if (value && value.toString) {
|
|
48437
48437
|
return BigNumber$2.from(value.toString())
|
|
48438
48438
|
} else {
|
|
@@ -55408,7 +55408,7 @@ class Token {
|
|
|
55408
55408
|
|
|
55409
55409
|
async BigNumber(amount) {
|
|
55410
55410
|
let decimals = await this.decimals();
|
|
55411
|
-
return parseUnits$
|
|
55411
|
+
return parseUnits$3(
|
|
55412
55412
|
Token.safeAmount({ amount: parseFloat(amount), decimals }).toString(),
|
|
55413
55413
|
decimals
|
|
55414
55414
|
)
|
|
@@ -59415,20 +59415,20 @@ class Logger$1 {
|
|
|
59415
59415
|
Logger$1.errors = ErrorCode$1;
|
|
59416
59416
|
Logger$1.levels = LogLevel$1;
|
|
59417
59417
|
|
|
59418
|
-
const version$3 = "bytes/5.4.0";
|
|
59418
|
+
const version$3$1 = "bytes/5.4.0";
|
|
59419
59419
|
|
|
59420
|
-
const logger$4 = new Logger$1(version$3);
|
|
59420
|
+
const logger$4 = new Logger$1(version$3$1);
|
|
59421
59421
|
///////////////////////////////
|
|
59422
59422
|
function isHexable$1(value) {
|
|
59423
59423
|
return !!(value.toHexString);
|
|
59424
59424
|
}
|
|
59425
|
-
function addSlice(array) {
|
|
59425
|
+
function addSlice$1(array) {
|
|
59426
59426
|
if (array.slice) {
|
|
59427
59427
|
return array;
|
|
59428
59428
|
}
|
|
59429
59429
|
array.slice = function () {
|
|
59430
59430
|
const args = Array.prototype.slice.call(arguments);
|
|
59431
|
-
return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
59431
|
+
return addSlice$1(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
59432
59432
|
};
|
|
59433
59433
|
return array;
|
|
59434
59434
|
}
|
|
@@ -59453,7 +59453,7 @@ function isBytes$1(value) {
|
|
|
59453
59453
|
}
|
|
59454
59454
|
return true;
|
|
59455
59455
|
}
|
|
59456
|
-
function arrayify(value, options) {
|
|
59456
|
+
function arrayify$1(value, options) {
|
|
59457
59457
|
if (!options) {
|
|
59458
59458
|
options = {};
|
|
59459
59459
|
}
|
|
@@ -59467,7 +59467,7 @@ function arrayify(value, options) {
|
|
|
59467
59467
|
if (result.length === 0) {
|
|
59468
59468
|
result.push(0);
|
|
59469
59469
|
}
|
|
59470
|
-
return addSlice(new Uint8Array(result));
|
|
59470
|
+
return addSlice$1(new Uint8Array(result));
|
|
59471
59471
|
}
|
|
59472
59472
|
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
59473
59473
|
value = "0x" + value;
|
|
@@ -59492,10 +59492,10 @@ function arrayify(value, options) {
|
|
|
59492
59492
|
for (let i = 0; i < hex.length; i += 2) {
|
|
59493
59493
|
result.push(parseInt(hex.substring(i, i + 2), 16));
|
|
59494
59494
|
}
|
|
59495
|
-
return addSlice(new Uint8Array(result));
|
|
59495
|
+
return addSlice$1(new Uint8Array(result));
|
|
59496
59496
|
}
|
|
59497
59497
|
if (isBytes$1(value)) {
|
|
59498
|
-
return addSlice(new Uint8Array(value));
|
|
59498
|
+
return addSlice$1(new Uint8Array(value));
|
|
59499
59499
|
}
|
|
59500
59500
|
return logger$4.throwArgumentError("invalid arrayify value", "value", value);
|
|
59501
59501
|
}
|
|
@@ -59565,7 +59565,7 @@ function hexlify$1(value, options) {
|
|
|
59565
59565
|
}
|
|
59566
59566
|
return logger$4.throwArgumentError("invalid hexlify value", "value", value);
|
|
59567
59567
|
}
|
|
59568
|
-
function hexZeroPad(value, length) {
|
|
59568
|
+
function hexZeroPad$1(value, length) {
|
|
59569
59569
|
if (typeof (value) !== "string") {
|
|
59570
59570
|
value = hexlify$1(value);
|
|
59571
59571
|
}
|
|
@@ -59584,10 +59584,10 @@ function hexZeroPad(value, length) {
|
|
|
59584
59584
|
const version$2$1 = "bignumber/5.4.1";
|
|
59585
59585
|
|
|
59586
59586
|
var BN$1 = bn$1.BN;
|
|
59587
|
-
const logger$3 = new Logger$1(version$2$1);
|
|
59588
|
-
const _constructorGuard$1 = {};
|
|
59587
|
+
const logger$3$1 = new Logger$1(version$2$1);
|
|
59588
|
+
const _constructorGuard$1$1 = {};
|
|
59589
59589
|
const MAX_SAFE$1 = 0x1fffffffffffff;
|
|
59590
|
-
function isBigNumberish(value) {
|
|
59590
|
+
function isBigNumberish$1(value) {
|
|
59591
59591
|
return (value != null) && (BigNumber$1.isBigNumber(value) ||
|
|
59592
59592
|
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
59593
59593
|
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
@@ -59599,9 +59599,9 @@ function isBigNumberish(value) {
|
|
|
59599
59599
|
let _warnedToStringRadix$1 = false;
|
|
59600
59600
|
class BigNumber$1 {
|
|
59601
59601
|
constructor(constructorGuard, hex) {
|
|
59602
|
-
logger$3.checkNew(new.target, BigNumber$1);
|
|
59603
|
-
if (constructorGuard !== _constructorGuard$1) {
|
|
59604
|
-
logger$3.throwError("cannot call constructor directly; use BigNumber.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59602
|
+
logger$3$1.checkNew(new.target, BigNumber$1);
|
|
59603
|
+
if (constructorGuard !== _constructorGuard$1$1) {
|
|
59604
|
+
logger$3$1.throwError("cannot call constructor directly; use BigNumber.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59605
59605
|
operation: "new (BigNumber)"
|
|
59606
59606
|
});
|
|
59607
59607
|
}
|
|
@@ -59630,7 +59630,7 @@ class BigNumber$1 {
|
|
|
59630
59630
|
div(other) {
|
|
59631
59631
|
const o = BigNumber$1.from(other);
|
|
59632
59632
|
if (o.isZero()) {
|
|
59633
|
-
throwFault$1("division by zero", "div");
|
|
59633
|
+
throwFault$1$1("division by zero", "div");
|
|
59634
59634
|
}
|
|
59635
59635
|
return toBigNumber$1(toBN$1(this).div(toBN$1(other)));
|
|
59636
59636
|
}
|
|
@@ -59640,53 +59640,53 @@ class BigNumber$1 {
|
|
|
59640
59640
|
mod(other) {
|
|
59641
59641
|
const value = toBN$1(other);
|
|
59642
59642
|
if (value.isNeg()) {
|
|
59643
|
-
throwFault$1("cannot modulo negative values", "mod");
|
|
59643
|
+
throwFault$1$1("cannot modulo negative values", "mod");
|
|
59644
59644
|
}
|
|
59645
59645
|
return toBigNumber$1(toBN$1(this).umod(value));
|
|
59646
59646
|
}
|
|
59647
59647
|
pow(other) {
|
|
59648
59648
|
const value = toBN$1(other);
|
|
59649
59649
|
if (value.isNeg()) {
|
|
59650
|
-
throwFault$1("cannot raise to negative values", "pow");
|
|
59650
|
+
throwFault$1$1("cannot raise to negative values", "pow");
|
|
59651
59651
|
}
|
|
59652
59652
|
return toBigNumber$1(toBN$1(this).pow(value));
|
|
59653
59653
|
}
|
|
59654
59654
|
and(other) {
|
|
59655
59655
|
const value = toBN$1(other);
|
|
59656
59656
|
if (this.isNegative() || value.isNeg()) {
|
|
59657
|
-
throwFault$1("cannot 'and' negative values", "and");
|
|
59657
|
+
throwFault$1$1("cannot 'and' negative values", "and");
|
|
59658
59658
|
}
|
|
59659
59659
|
return toBigNumber$1(toBN$1(this).and(value));
|
|
59660
59660
|
}
|
|
59661
59661
|
or(other) {
|
|
59662
59662
|
const value = toBN$1(other);
|
|
59663
59663
|
if (this.isNegative() || value.isNeg()) {
|
|
59664
|
-
throwFault$1("cannot 'or' negative values", "or");
|
|
59664
|
+
throwFault$1$1("cannot 'or' negative values", "or");
|
|
59665
59665
|
}
|
|
59666
59666
|
return toBigNumber$1(toBN$1(this).or(value));
|
|
59667
59667
|
}
|
|
59668
59668
|
xor(other) {
|
|
59669
59669
|
const value = toBN$1(other);
|
|
59670
59670
|
if (this.isNegative() || value.isNeg()) {
|
|
59671
|
-
throwFault$1("cannot 'xor' negative values", "xor");
|
|
59671
|
+
throwFault$1$1("cannot 'xor' negative values", "xor");
|
|
59672
59672
|
}
|
|
59673
59673
|
return toBigNumber$1(toBN$1(this).xor(value));
|
|
59674
59674
|
}
|
|
59675
59675
|
mask(value) {
|
|
59676
59676
|
if (this.isNegative() || value < 0) {
|
|
59677
|
-
throwFault$1("cannot mask negative values", "mask");
|
|
59677
|
+
throwFault$1$1("cannot mask negative values", "mask");
|
|
59678
59678
|
}
|
|
59679
59679
|
return toBigNumber$1(toBN$1(this).maskn(value));
|
|
59680
59680
|
}
|
|
59681
59681
|
shl(value) {
|
|
59682
59682
|
if (this.isNegative() || value < 0) {
|
|
59683
|
-
throwFault$1("cannot shift negative values", "shl");
|
|
59683
|
+
throwFault$1$1("cannot shift negative values", "shl");
|
|
59684
59684
|
}
|
|
59685
59685
|
return toBigNumber$1(toBN$1(this).shln(value));
|
|
59686
59686
|
}
|
|
59687
59687
|
shr(value) {
|
|
59688
59688
|
if (this.isNegative() || value < 0) {
|
|
59689
|
-
throwFault$1("cannot shift negative values", "shr");
|
|
59689
|
+
throwFault$1$1("cannot shift negative values", "shr");
|
|
59690
59690
|
}
|
|
59691
59691
|
return toBigNumber$1(toBN$1(this).shrn(value));
|
|
59692
59692
|
}
|
|
@@ -59716,7 +59716,7 @@ class BigNumber$1 {
|
|
|
59716
59716
|
return toBN$1(this).toNumber();
|
|
59717
59717
|
}
|
|
59718
59718
|
catch (error) {
|
|
59719
|
-
throwFault$1("overflow", "toNumber", this.toString());
|
|
59719
|
+
throwFault$1$1("overflow", "toNumber", this.toString());
|
|
59720
59720
|
}
|
|
59721
59721
|
return null;
|
|
59722
59722
|
}
|
|
@@ -59725,7 +59725,7 @@ class BigNumber$1 {
|
|
|
59725
59725
|
return BigInt(this.toString());
|
|
59726
59726
|
}
|
|
59727
59727
|
catch (e) { }
|
|
59728
|
-
return logger$3.throwError("this platform does not support BigInt", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59728
|
+
return logger$3$1.throwError("this platform does not support BigInt", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59729
59729
|
value: this.toString()
|
|
59730
59730
|
});
|
|
59731
59731
|
}
|
|
@@ -59735,14 +59735,14 @@ class BigNumber$1 {
|
|
|
59735
59735
|
if (arguments[0] === 10) {
|
|
59736
59736
|
if (!_warnedToStringRadix$1) {
|
|
59737
59737
|
_warnedToStringRadix$1 = true;
|
|
59738
|
-
logger$3.warn("BigNumber.toString does not accept any parameters; base-10 is assumed");
|
|
59738
|
+
logger$3$1.warn("BigNumber.toString does not accept any parameters; base-10 is assumed");
|
|
59739
59739
|
}
|
|
59740
59740
|
}
|
|
59741
59741
|
else if (arguments[0] === 16) {
|
|
59742
|
-
logger$3.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$1.errors.UNEXPECTED_ARGUMENT, {});
|
|
59742
|
+
logger$3$1.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$1.errors.UNEXPECTED_ARGUMENT, {});
|
|
59743
59743
|
}
|
|
59744
59744
|
else {
|
|
59745
|
-
logger$3.throwError("BigNumber.toString does not accept parameters", Logger$1.errors.UNEXPECTED_ARGUMENT, {});
|
|
59745
|
+
logger$3$1.throwError("BigNumber.toString does not accept parameters", Logger$1.errors.UNEXPECTED_ARGUMENT, {});
|
|
59746
59746
|
}
|
|
59747
59747
|
}
|
|
59748
59748
|
return toBN$1(this).toString(10);
|
|
@@ -59759,19 +59759,19 @@ class BigNumber$1 {
|
|
|
59759
59759
|
}
|
|
59760
59760
|
if (typeof (value) === "string") {
|
|
59761
59761
|
if (value.match(/^-?0x[0-9a-f]+$/i)) {
|
|
59762
|
-
return new BigNumber$1(_constructorGuard$1, toHex$1(value));
|
|
59762
|
+
return new BigNumber$1(_constructorGuard$1$1, toHex$1(value));
|
|
59763
59763
|
}
|
|
59764
59764
|
if (value.match(/^-?[0-9]+$/)) {
|
|
59765
|
-
return new BigNumber$1(_constructorGuard$1, toHex$1(new BN$1(value)));
|
|
59765
|
+
return new BigNumber$1(_constructorGuard$1$1, toHex$1(new BN$1(value)));
|
|
59766
59766
|
}
|
|
59767
|
-
return logger$3.throwArgumentError("invalid BigNumber string", "value", value);
|
|
59767
|
+
return logger$3$1.throwArgumentError("invalid BigNumber string", "value", value);
|
|
59768
59768
|
}
|
|
59769
59769
|
if (typeof (value) === "number") {
|
|
59770
59770
|
if (value % 1) {
|
|
59771
|
-
throwFault$1("underflow", "BigNumber.from", value);
|
|
59771
|
+
throwFault$1$1("underflow", "BigNumber.from", value);
|
|
59772
59772
|
}
|
|
59773
59773
|
if (value >= MAX_SAFE$1 || value <= -MAX_SAFE$1) {
|
|
59774
|
-
throwFault$1("overflow", "BigNumber.from", value);
|
|
59774
|
+
throwFault$1$1("overflow", "BigNumber.from", value);
|
|
59775
59775
|
}
|
|
59776
59776
|
return BigNumber$1.from(String(value));
|
|
59777
59777
|
}
|
|
@@ -59804,7 +59804,7 @@ class BigNumber$1 {
|
|
|
59804
59804
|
}
|
|
59805
59805
|
}
|
|
59806
59806
|
}
|
|
59807
|
-
return logger$3.throwArgumentError("invalid BigNumber value", "value", value);
|
|
59807
|
+
return logger$3$1.throwArgumentError("invalid BigNumber value", "value", value);
|
|
59808
59808
|
}
|
|
59809
59809
|
static isBigNumber(value) {
|
|
59810
59810
|
return !!(value && value._isBigNumber);
|
|
@@ -59822,7 +59822,7 @@ function toHex$1(value) {
|
|
|
59822
59822
|
value = value.substring(1);
|
|
59823
59823
|
// Cannot have mulitple negative signs (e.g. "--0x04")
|
|
59824
59824
|
if (value[0] === "-") {
|
|
59825
|
-
logger$3.throwArgumentError("invalid hex", "value", value);
|
|
59825
|
+
logger$3$1.throwArgumentError("invalid hex", "value", value);
|
|
59826
59826
|
}
|
|
59827
59827
|
// Call toHex on the positive component
|
|
59828
59828
|
value = toHex$1(value);
|
|
@@ -59861,36 +59861,36 @@ function toBN$1(value) {
|
|
|
59861
59861
|
}
|
|
59862
59862
|
return new BN$1(hex.substring(2), 16);
|
|
59863
59863
|
}
|
|
59864
|
-
function throwFault$1(fault, operation, value) {
|
|
59864
|
+
function throwFault$1$1(fault, operation, value) {
|
|
59865
59865
|
const params = { fault: fault, operation: operation };
|
|
59866
59866
|
if (value != null) {
|
|
59867
59867
|
params.value = value;
|
|
59868
59868
|
}
|
|
59869
|
-
return logger$3.throwError(fault, Logger$1.errors.NUMERIC_FAULT, params);
|
|
59869
|
+
return logger$3$1.throwError(fault, Logger$1.errors.NUMERIC_FAULT, params);
|
|
59870
59870
|
}
|
|
59871
59871
|
// value should have no prefix
|
|
59872
59872
|
function _base36To16(value) {
|
|
59873
59873
|
return (new BN$1(value, 36)).toString(16);
|
|
59874
59874
|
}
|
|
59875
59875
|
|
|
59876
|
-
const logger$2 = new Logger$1(version$2$1);
|
|
59876
|
+
const logger$2$1 = new Logger$1(version$2$1);
|
|
59877
59877
|
const _constructorGuard$2 = {};
|
|
59878
|
-
const Zero = BigNumber$1.from(0);
|
|
59879
|
-
const NegativeOne = BigNumber$1.from(-1);
|
|
59878
|
+
const Zero$1 = BigNumber$1.from(0);
|
|
59879
|
+
const NegativeOne$1 = BigNumber$1.from(-1);
|
|
59880
59880
|
function throwFault$2(message, fault, operation, value) {
|
|
59881
59881
|
const params = { fault: fault, operation: operation };
|
|
59882
59882
|
if (value !== undefined) {
|
|
59883
59883
|
params.value = value;
|
|
59884
59884
|
}
|
|
59885
|
-
return logger$2.throwError(message, Logger$1.errors.NUMERIC_FAULT, params);
|
|
59885
|
+
return logger$2$1.throwError(message, Logger$1.errors.NUMERIC_FAULT, params);
|
|
59886
59886
|
}
|
|
59887
59887
|
// Constant to pull zeros from for multipliers
|
|
59888
|
-
let zeros = "0";
|
|
59889
|
-
while (zeros.length < 256) {
|
|
59890
|
-
zeros += zeros;
|
|
59888
|
+
let zeros$1 = "0";
|
|
59889
|
+
while (zeros$1.length < 256) {
|
|
59890
|
+
zeros$1 += zeros$1;
|
|
59891
59891
|
}
|
|
59892
59892
|
// Returns a string "1" followed by decimal "0"s
|
|
59893
|
-
function getMultiplier(decimals) {
|
|
59893
|
+
function getMultiplier$1(decimals) {
|
|
59894
59894
|
if (typeof (decimals) !== "number") {
|
|
59895
59895
|
try {
|
|
59896
59896
|
decimals = BigNumber$1.from(decimals).toNumber();
|
|
@@ -59898,20 +59898,20 @@ function getMultiplier(decimals) {
|
|
|
59898
59898
|
catch (e) { }
|
|
59899
59899
|
}
|
|
59900
59900
|
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
59901
|
-
return ("1" + zeros.substring(0, decimals));
|
|
59901
|
+
return ("1" + zeros$1.substring(0, decimals));
|
|
59902
59902
|
}
|
|
59903
|
-
return logger$2.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
59903
|
+
return logger$2$1.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
59904
59904
|
}
|
|
59905
|
-
function formatFixed(value, decimals) {
|
|
59905
|
+
function formatFixed$1(value, decimals) {
|
|
59906
59906
|
if (decimals == null) {
|
|
59907
59907
|
decimals = 0;
|
|
59908
59908
|
}
|
|
59909
|
-
const multiplier = getMultiplier(decimals);
|
|
59909
|
+
const multiplier = getMultiplier$1(decimals);
|
|
59910
59910
|
// Make sure wei is a big number (convert as necessary)
|
|
59911
59911
|
value = BigNumber$1.from(value);
|
|
59912
|
-
const negative = value.lt(Zero);
|
|
59912
|
+
const negative = value.lt(Zero$1);
|
|
59913
59913
|
if (negative) {
|
|
59914
|
-
value = value.mul(NegativeOne);
|
|
59914
|
+
value = value.mul(NegativeOne$1);
|
|
59915
59915
|
}
|
|
59916
59916
|
let fraction = value.mod(multiplier).toString();
|
|
59917
59917
|
while (fraction.length < multiplier.length - 1) {
|
|
@@ -59931,13 +59931,13 @@ function formatFixed(value, decimals) {
|
|
|
59931
59931
|
}
|
|
59932
59932
|
return value;
|
|
59933
59933
|
}
|
|
59934
|
-
function parseFixed(value, decimals) {
|
|
59934
|
+
function parseFixed$1(value, decimals) {
|
|
59935
59935
|
if (decimals == null) {
|
|
59936
59936
|
decimals = 0;
|
|
59937
59937
|
}
|
|
59938
|
-
const multiplier = getMultiplier(decimals);
|
|
59938
|
+
const multiplier = getMultiplier$1(decimals);
|
|
59939
59939
|
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
|
|
59940
|
-
logger$2.throwArgumentError("invalid decimal value", "value", value);
|
|
59940
|
+
logger$2$1.throwArgumentError("invalid decimal value", "value", value);
|
|
59941
59941
|
}
|
|
59942
59942
|
// Is it negative?
|
|
59943
59943
|
const negative = (value.substring(0, 1) === "-");
|
|
@@ -59945,12 +59945,12 @@ function parseFixed(value, decimals) {
|
|
|
59945
59945
|
value = value.substring(1);
|
|
59946
59946
|
}
|
|
59947
59947
|
if (value === ".") {
|
|
59948
|
-
logger$2.throwArgumentError("missing value", "value", value);
|
|
59948
|
+
logger$2$1.throwArgumentError("missing value", "value", value);
|
|
59949
59949
|
}
|
|
59950
59950
|
// Split it into a whole and fractional part
|
|
59951
59951
|
const comps = value.split(".");
|
|
59952
59952
|
if (comps.length > 2) {
|
|
59953
|
-
logger$2.throwArgumentError("too many decimal points", "value", value);
|
|
59953
|
+
logger$2$1.throwArgumentError("too many decimal points", "value", value);
|
|
59954
59954
|
}
|
|
59955
59955
|
let whole = comps[0], fraction = comps[1];
|
|
59956
59956
|
if (!whole) {
|
|
@@ -59974,14 +59974,14 @@ function parseFixed(value, decimals) {
|
|
|
59974
59974
|
const fractionValue = BigNumber$1.from(fraction);
|
|
59975
59975
|
let wei = (wholeValue.mul(multiplier)).add(fractionValue);
|
|
59976
59976
|
if (negative) {
|
|
59977
|
-
wei = wei.mul(NegativeOne);
|
|
59977
|
+
wei = wei.mul(NegativeOne$1);
|
|
59978
59978
|
}
|
|
59979
59979
|
return wei;
|
|
59980
59980
|
}
|
|
59981
|
-
class FixedFormat {
|
|
59981
|
+
class FixedFormat$1 {
|
|
59982
59982
|
constructor(constructorGuard, signed, width, decimals) {
|
|
59983
59983
|
if (constructorGuard !== _constructorGuard$2) {
|
|
59984
|
-
logger$2.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59984
|
+
logger$2$1.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59985
59985
|
operation: "new FixedFormat"
|
|
59986
59986
|
});
|
|
59987
59987
|
}
|
|
@@ -59989,11 +59989,11 @@ class FixedFormat {
|
|
|
59989
59989
|
this.width = width;
|
|
59990
59990
|
this.decimals = decimals;
|
|
59991
59991
|
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
59992
|
-
this._multiplier = getMultiplier(decimals);
|
|
59992
|
+
this._multiplier = getMultiplier$1(decimals);
|
|
59993
59993
|
Object.freeze(this);
|
|
59994
59994
|
}
|
|
59995
59995
|
static from(value) {
|
|
59996
|
-
if (value instanceof FixedFormat) {
|
|
59996
|
+
if (value instanceof FixedFormat$1) {
|
|
59997
59997
|
return value;
|
|
59998
59998
|
}
|
|
59999
59999
|
if (typeof (value) === "number") {
|
|
@@ -60010,7 +60010,7 @@ class FixedFormat {
|
|
|
60010
60010
|
else {
|
|
60011
60011
|
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
|
60012
60012
|
if (!match) {
|
|
60013
|
-
logger$2.throwArgumentError("invalid fixed format", "format", value);
|
|
60013
|
+
logger$2$1.throwArgumentError("invalid fixed format", "format", value);
|
|
60014
60014
|
}
|
|
60015
60015
|
signed = (match[1] !== "u");
|
|
60016
60016
|
width = parseInt(match[2]);
|
|
@@ -60023,7 +60023,7 @@ class FixedFormat {
|
|
|
60023
60023
|
return defaultValue;
|
|
60024
60024
|
}
|
|
60025
60025
|
if (typeof (value[key]) !== type) {
|
|
60026
|
-
logger$2.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
|
60026
|
+
logger$2$1.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
|
60027
60027
|
}
|
|
60028
60028
|
return value[key];
|
|
60029
60029
|
};
|
|
@@ -60032,19 +60032,19 @@ class FixedFormat {
|
|
|
60032
60032
|
decimals = check("decimals", "number", decimals);
|
|
60033
60033
|
}
|
|
60034
60034
|
if (width % 8) {
|
|
60035
|
-
logger$2.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
|
60035
|
+
logger$2$1.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
|
60036
60036
|
}
|
|
60037
60037
|
if (decimals > 80) {
|
|
60038
|
-
logger$2.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
60038
|
+
logger$2$1.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
60039
60039
|
}
|
|
60040
|
-
return new FixedFormat(_constructorGuard$2, signed, width, decimals);
|
|
60040
|
+
return new FixedFormat$1(_constructorGuard$2, signed, width, decimals);
|
|
60041
60041
|
}
|
|
60042
60042
|
}
|
|
60043
|
-
class FixedNumber {
|
|
60043
|
+
class FixedNumber$1 {
|
|
60044
60044
|
constructor(constructorGuard, hex, value, format) {
|
|
60045
|
-
logger$2.checkNew(new.target, FixedNumber);
|
|
60045
|
+
logger$2$1.checkNew(new.target, FixedNumber$1);
|
|
60046
60046
|
if (constructorGuard !== _constructorGuard$2) {
|
|
60047
|
-
logger$2.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
60047
|
+
logger$2$1.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
60048
60048
|
operation: "new FixedFormat"
|
|
60049
60049
|
});
|
|
60050
60050
|
}
|
|
@@ -60056,42 +60056,42 @@ class FixedNumber {
|
|
|
60056
60056
|
}
|
|
60057
60057
|
_checkFormat(other) {
|
|
60058
60058
|
if (this.format.name !== other.format.name) {
|
|
60059
|
-
logger$2.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
|
60059
|
+
logger$2$1.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
|
60060
60060
|
}
|
|
60061
60061
|
}
|
|
60062
60062
|
addUnsafe(other) {
|
|
60063
60063
|
this._checkFormat(other);
|
|
60064
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
60065
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
60066
|
-
return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format);
|
|
60064
|
+
const a = parseFixed$1(this._value, this.format.decimals);
|
|
60065
|
+
const b = parseFixed$1(other._value, other.format.decimals);
|
|
60066
|
+
return FixedNumber$1.fromValue(a.add(b), this.format.decimals, this.format);
|
|
60067
60067
|
}
|
|
60068
60068
|
subUnsafe(other) {
|
|
60069
60069
|
this._checkFormat(other);
|
|
60070
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
60071
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
60072
|
-
return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format);
|
|
60070
|
+
const a = parseFixed$1(this._value, this.format.decimals);
|
|
60071
|
+
const b = parseFixed$1(other._value, other.format.decimals);
|
|
60072
|
+
return FixedNumber$1.fromValue(a.sub(b), this.format.decimals, this.format);
|
|
60073
60073
|
}
|
|
60074
60074
|
mulUnsafe(other) {
|
|
60075
60075
|
this._checkFormat(other);
|
|
60076
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
60077
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
60078
|
-
return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
60076
|
+
const a = parseFixed$1(this._value, this.format.decimals);
|
|
60077
|
+
const b = parseFixed$1(other._value, other.format.decimals);
|
|
60078
|
+
return FixedNumber$1.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
60079
60079
|
}
|
|
60080
60080
|
divUnsafe(other) {
|
|
60081
60081
|
this._checkFormat(other);
|
|
60082
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
60083
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
60084
|
-
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
60082
|
+
const a = parseFixed$1(this._value, this.format.decimals);
|
|
60083
|
+
const b = parseFixed$1(other._value, other.format.decimals);
|
|
60084
|
+
return FixedNumber$1.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
60085
60085
|
}
|
|
60086
60086
|
floor() {
|
|
60087
60087
|
const comps = this.toString().split(".");
|
|
60088
60088
|
if (comps.length === 1) {
|
|
60089
60089
|
comps.push("0");
|
|
60090
60090
|
}
|
|
60091
|
-
let result = FixedNumber.from(comps[0], this.format);
|
|
60091
|
+
let result = FixedNumber$1.from(comps[0], this.format);
|
|
60092
60092
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
60093
60093
|
if (this.isNegative() && hasFraction) {
|
|
60094
|
-
result = result.subUnsafe(ONE.toFormat(result.format));
|
|
60094
|
+
result = result.subUnsafe(ONE$1.toFormat(result.format));
|
|
60095
60095
|
}
|
|
60096
60096
|
return result;
|
|
60097
60097
|
}
|
|
@@ -60100,10 +60100,10 @@ class FixedNumber {
|
|
|
60100
60100
|
if (comps.length === 1) {
|
|
60101
60101
|
comps.push("0");
|
|
60102
60102
|
}
|
|
60103
|
-
let result = FixedNumber.from(comps[0], this.format);
|
|
60103
|
+
let result = FixedNumber$1.from(comps[0], this.format);
|
|
60104
60104
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
60105
60105
|
if (!this.isNegative() && hasFraction) {
|
|
60106
|
-
result = result.addUnsafe(ONE.toFormat(result.format));
|
|
60106
|
+
result = result.addUnsafe(ONE$1.toFormat(result.format));
|
|
60107
60107
|
}
|
|
60108
60108
|
return result;
|
|
60109
60109
|
}
|
|
@@ -60118,13 +60118,13 @@ class FixedNumber {
|
|
|
60118
60118
|
comps.push("0");
|
|
60119
60119
|
}
|
|
60120
60120
|
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
|
60121
|
-
logger$2.throwArgumentError("invalid decimal count", "decimals", decimals);
|
|
60121
|
+
logger$2$1.throwArgumentError("invalid decimal count", "decimals", decimals);
|
|
60122
60122
|
}
|
|
60123
60123
|
if (comps[1].length <= decimals) {
|
|
60124
60124
|
return this;
|
|
60125
60125
|
}
|
|
60126
|
-
const factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format);
|
|
60127
|
-
const bump = BUMP.toFormat(this.format);
|
|
60126
|
+
const factor = FixedNumber$1.from("1" + zeros$1.substring(0, decimals), this.format);
|
|
60127
|
+
const bump = BUMP$1.toFormat(this.format);
|
|
60128
60128
|
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
60129
60129
|
}
|
|
60130
60130
|
isZero() {
|
|
@@ -60139,18 +60139,18 @@ class FixedNumber {
|
|
|
60139
60139
|
return this._hex;
|
|
60140
60140
|
}
|
|
60141
60141
|
if (width % 8) {
|
|
60142
|
-
logger$2.throwArgumentError("invalid byte width", "width", width);
|
|
60142
|
+
logger$2$1.throwArgumentError("invalid byte width", "width", width);
|
|
60143
60143
|
}
|
|
60144
60144
|
const hex = BigNumber$1.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
60145
|
-
return hexZeroPad(hex, width / 8);
|
|
60145
|
+
return hexZeroPad$1(hex, width / 8);
|
|
60146
60146
|
}
|
|
60147
60147
|
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
60148
60148
|
toFormat(format) {
|
|
60149
|
-
return FixedNumber.fromString(this._value, format);
|
|
60149
|
+
return FixedNumber$1.fromString(this._value, format);
|
|
60150
60150
|
}
|
|
60151
60151
|
static fromValue(value, decimals, format) {
|
|
60152
60152
|
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
60153
|
-
if (format == null && decimals != null && !isBigNumberish(decimals)) {
|
|
60153
|
+
if (format == null && decimals != null && !isBigNumberish$1(decimals)) {
|
|
60154
60154
|
format = decimals;
|
|
60155
60155
|
decimals = null;
|
|
60156
60156
|
}
|
|
@@ -60160,15 +60160,15 @@ class FixedNumber {
|
|
|
60160
60160
|
if (format == null) {
|
|
60161
60161
|
format = "fixed";
|
|
60162
60162
|
}
|
|
60163
|
-
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
|
|
60163
|
+
return FixedNumber$1.fromString(formatFixed$1(value, decimals), FixedFormat$1.from(format));
|
|
60164
60164
|
}
|
|
60165
60165
|
static fromString(value, format) {
|
|
60166
60166
|
if (format == null) {
|
|
60167
60167
|
format = "fixed";
|
|
60168
60168
|
}
|
|
60169
|
-
const fixedFormat = FixedFormat.from(format);
|
|
60170
|
-
const numeric = parseFixed(value, fixedFormat.decimals);
|
|
60171
|
-
if (!fixedFormat.signed && numeric.lt(Zero)) {
|
|
60169
|
+
const fixedFormat = FixedFormat$1.from(format);
|
|
60170
|
+
const numeric = parseFixed$1(value, fixedFormat.decimals);
|
|
60171
|
+
if (!fixedFormat.signed && numeric.lt(Zero$1)) {
|
|
60172
60172
|
throwFault$2("unsigned value cannot be negative", "overflow", "value", value);
|
|
60173
60173
|
}
|
|
60174
60174
|
let hex = null;
|
|
@@ -60177,17 +60177,17 @@ class FixedNumber {
|
|
|
60177
60177
|
}
|
|
60178
60178
|
else {
|
|
60179
60179
|
hex = numeric.toHexString();
|
|
60180
|
-
hex = hexZeroPad(hex, fixedFormat.width / 8);
|
|
60180
|
+
hex = hexZeroPad$1(hex, fixedFormat.width / 8);
|
|
60181
60181
|
}
|
|
60182
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
60183
|
-
return new FixedNumber(_constructorGuard$2, hex, decimal, fixedFormat);
|
|
60182
|
+
const decimal = formatFixed$1(numeric, fixedFormat.decimals);
|
|
60183
|
+
return new FixedNumber$1(_constructorGuard$2, hex, decimal, fixedFormat);
|
|
60184
60184
|
}
|
|
60185
60185
|
static fromBytes(value, format) {
|
|
60186
60186
|
if (format == null) {
|
|
60187
60187
|
format = "fixed";
|
|
60188
60188
|
}
|
|
60189
|
-
const fixedFormat = FixedFormat.from(format);
|
|
60190
|
-
if (arrayify(value).length > fixedFormat.width / 8) {
|
|
60189
|
+
const fixedFormat = FixedFormat$1.from(format);
|
|
60190
|
+
if (arrayify$1(value).length > fixedFormat.width / 8) {
|
|
60191
60191
|
throw new Error("overflow");
|
|
60192
60192
|
}
|
|
60193
60193
|
let numeric = BigNumber$1.from(value);
|
|
@@ -60195,18 +60195,18 @@ class FixedNumber {
|
|
|
60195
60195
|
numeric = numeric.fromTwos(fixedFormat.width);
|
|
60196
60196
|
}
|
|
60197
60197
|
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
60198
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
60199
|
-
return new FixedNumber(_constructorGuard$2, hex, decimal, fixedFormat);
|
|
60198
|
+
const decimal = formatFixed$1(numeric, fixedFormat.decimals);
|
|
60199
|
+
return new FixedNumber$1(_constructorGuard$2, hex, decimal, fixedFormat);
|
|
60200
60200
|
}
|
|
60201
60201
|
static from(value, format) {
|
|
60202
60202
|
if (typeof (value) === "string") {
|
|
60203
|
-
return FixedNumber.fromString(value, format);
|
|
60203
|
+
return FixedNumber$1.fromString(value, format);
|
|
60204
60204
|
}
|
|
60205
60205
|
if (isBytes$1(value)) {
|
|
60206
|
-
return FixedNumber.fromBytes(value, format);
|
|
60206
|
+
return FixedNumber$1.fromBytes(value, format);
|
|
60207
60207
|
}
|
|
60208
60208
|
try {
|
|
60209
|
-
return FixedNumber.fromValue(value, 0, format);
|
|
60209
|
+
return FixedNumber$1.fromValue(value, 0, format);
|
|
60210
60210
|
}
|
|
60211
60211
|
catch (error) {
|
|
60212
60212
|
// Allow NUMERIC_FAULT to bubble up
|
|
@@ -60214,14 +60214,14 @@ class FixedNumber {
|
|
|
60214
60214
|
throw error;
|
|
60215
60215
|
}
|
|
60216
60216
|
}
|
|
60217
|
-
return logger$2.throwArgumentError("invalid FixedNumber value", "value", value);
|
|
60217
|
+
return logger$2$1.throwArgumentError("invalid FixedNumber value", "value", value);
|
|
60218
60218
|
}
|
|
60219
60219
|
static isFixedNumber(value) {
|
|
60220
60220
|
return !!(value && value._isFixedNumber);
|
|
60221
60221
|
}
|
|
60222
60222
|
}
|
|
60223
|
-
const ONE = FixedNumber.from(1);
|
|
60224
|
-
const BUMP = FixedNumber.from("0.5");
|
|
60223
|
+
const ONE$1 = FixedNumber$1.from(1);
|
|
60224
|
+
const BUMP$1 = FixedNumber$1.from("0.5");
|
|
60225
60225
|
|
|
60226
60226
|
/**
|
|
60227
60227
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
@@ -60704,7 +60704,7 @@ var sha3 = createCommonjsModule$1(function (module) {
|
|
|
60704
60704
|
var sha3$1 = sha3;
|
|
60705
60705
|
|
|
60706
60706
|
function keccak256(data) {
|
|
60707
|
-
return '0x' + sha3$1.keccak_256(arrayify(data));
|
|
60707
|
+
return '0x' + sha3$1.keccak_256(arrayify$1(data));
|
|
60708
60708
|
}
|
|
60709
60709
|
|
|
60710
60710
|
const version$1$1 = "address/5.4.0";
|
|
@@ -60720,7 +60720,7 @@ function getChecksumAddress(address) {
|
|
|
60720
60720
|
for (let i = 0; i < 40; i++) {
|
|
60721
60721
|
expanded[i] = chars[i].charCodeAt(0);
|
|
60722
60722
|
}
|
|
60723
|
-
const hashed = arrayify(keccak256(expanded));
|
|
60723
|
+
const hashed = arrayify$1(keccak256(expanded));
|
|
60724
60724
|
for (let i = 0; i < 40; i += 2) {
|
|
60725
60725
|
if ((hashed[i >> 1] >> 4) >= 8) {
|
|
60726
60726
|
chars[i] = chars[i].toUpperCase();
|
|
@@ -60802,7 +60802,7 @@ function getAddress(address) {
|
|
|
60802
60802
|
const version$5 = "units/5.4.0";
|
|
60803
60803
|
|
|
60804
60804
|
const logger$5 = new Logger$1(version$5);
|
|
60805
|
-
const names = [
|
|
60805
|
+
const names$1 = [
|
|
60806
60806
|
"wei",
|
|
60807
60807
|
"kwei",
|
|
60808
60808
|
"mwei",
|
|
@@ -60811,17 +60811,17 @@ const names = [
|
|
|
60811
60811
|
"finney",
|
|
60812
60812
|
"ether",
|
|
60813
60813
|
];
|
|
60814
|
-
function parseUnits(value, unitName) {
|
|
60814
|
+
function parseUnits$1(value, unitName) {
|
|
60815
60815
|
if (typeof (value) !== "string") {
|
|
60816
60816
|
logger$5.throwArgumentError("value must be a string", "value", value);
|
|
60817
60817
|
}
|
|
60818
60818
|
if (typeof (unitName) === "string") {
|
|
60819
|
-
const index = names.indexOf(unitName);
|
|
60819
|
+
const index = names$1.indexOf(unitName);
|
|
60820
60820
|
if (index !== -1) {
|
|
60821
60821
|
unitName = 3 * index;
|
|
60822
60822
|
}
|
|
60823
60823
|
}
|
|
60824
|
-
return parseFixed(value, (unitName != null) ? unitName : 18);
|
|
60824
|
+
return parseFixed$1(value, (unitName != null) ? unitName : 18);
|
|
60825
60825
|
}
|
|
60826
60826
|
|
|
60827
60827
|
function _optionalChain$1$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
@@ -60855,9 +60855,9 @@ let fixUniswapPath$1 = (path) => {
|
|
|
60855
60855
|
|
|
60856
60856
|
let minReserveRequirements$1 = ({ reserves, min, token, token0, token1, decimals }) => {
|
|
60857
60857
|
if(token0.toLowerCase() == token.toLowerCase()) {
|
|
60858
|
-
return reserves[0].gte(parseUnits(min.toString(), decimals))
|
|
60858
|
+
return reserves[0].gte(parseUnits$1(min.toString(), decimals))
|
|
60859
60859
|
} else if (token1.toLowerCase() == token.toLowerCase()) {
|
|
60860
|
-
return reserves[1].gte(parseUnits(min.toString(), decimals))
|
|
60860
|
+
return reserves[1].gte(parseUnits$1(min.toString(), decimals))
|
|
60861
60861
|
} else {
|
|
60862
60862
|
return false
|
|
60863
60863
|
}
|
|
@@ -61205,9 +61205,9 @@ let fixUniswapPath = (path) => {
|
|
|
61205
61205
|
|
|
61206
61206
|
let minReserveRequirements = ({ reserves, min, token, token0, token1, decimals }) => {
|
|
61207
61207
|
if(token0.toLowerCase() == token.toLowerCase()) {
|
|
61208
|
-
return reserves[0].gte(parseUnits(min.toString(), decimals))
|
|
61208
|
+
return reserves[0].gte(parseUnits$1(min.toString(), decimals))
|
|
61209
61209
|
} else if (token1.toLowerCase() == token.toLowerCase()) {
|
|
61210
|
-
return reserves[1].gte(parseUnits(min.toString(), decimals))
|
|
61210
|
+
return reserves[1].gte(parseUnits$1(min.toString(), decimals))
|
|
61211
61211
|
} else {
|
|
61212
61212
|
return false
|
|
61213
61213
|
}
|
|
@@ -62710,6 +62710,10 @@ const prepareContractCallAddressPassedAmountBooleanTransaction = (transaction, t
|
|
|
62710
62710
|
return transaction
|
|
62711
62711
|
};
|
|
62712
62712
|
|
|
62713
|
+
const preparePaymentFeeTransaction = (transaction)=> {
|
|
62714
|
+
|
|
62715
|
+
};
|
|
62716
|
+
|
|
62713
62717
|
var plugins = {
|
|
62714
62718
|
ethereum: {
|
|
62715
62719
|
payment: {
|
|
@@ -62731,6 +62735,10 @@ var plugins = {
|
|
|
62731
62735
|
address: '0x2D18c5A46cc1780d2460DD51B5d0996e55Fd2446',
|
|
62732
62736
|
prepareTransaction: prepareContractCallAddressPassedAmountBooleanTransaction
|
|
62733
62737
|
}
|
|
62738
|
+
},
|
|
62739
|
+
paymentFee: {
|
|
62740
|
+
address: '0x874Cb669D7BFff79d4A6A30F4ea52c5e413BD6A7',
|
|
62741
|
+
prepareTransaction: preparePaymentFeeTransaction
|
|
62734
62742
|
}
|
|
62735
62743
|
},
|
|
62736
62744
|
bsc: {
|
|
@@ -62753,6 +62761,10 @@ var plugins = {
|
|
|
62753
62761
|
address: '0x7E655088214d0657251A51aDccE9109CFd23B5B5',
|
|
62754
62762
|
prepareTransaction: prepareContractCallAddressPassedAmountBooleanTransaction
|
|
62755
62763
|
}
|
|
62764
|
+
},
|
|
62765
|
+
paymentFee: {
|
|
62766
|
+
address: '0xae33f10AD57A38113f74FCdc1ffA6B1eC47B94E3',
|
|
62767
|
+
prepareTransaction: preparePaymentFeeTransaction
|
|
62756
62768
|
}
|
|
62757
62769
|
}
|
|
62758
62770
|
};
|
|
@@ -66221,7 +66233,7 @@ var bn = createCommonjsModule(function (module) {
|
|
|
66221
66233
|
})(module, commonjsGlobal);
|
|
66222
66234
|
});
|
|
66223
66235
|
|
|
66224
|
-
const version$
|
|
66236
|
+
const version$3 = "logger/5.4.1";
|
|
66225
66237
|
|
|
66226
66238
|
let _permanentCensorErrors = false;
|
|
66227
66239
|
let _censorErrors = false;
|
|
@@ -66497,7 +66509,7 @@ class Logger {
|
|
|
66497
66509
|
}
|
|
66498
66510
|
static globalLogger() {
|
|
66499
66511
|
if (!_globalLogger) {
|
|
66500
|
-
_globalLogger = new Logger(version$
|
|
66512
|
+
_globalLogger = new Logger(version$3);
|
|
66501
66513
|
}
|
|
66502
66514
|
return _globalLogger;
|
|
66503
66515
|
}
|
|
@@ -66533,13 +66545,23 @@ class Logger {
|
|
|
66533
66545
|
Logger.errors = ErrorCode;
|
|
66534
66546
|
Logger.levels = LogLevel;
|
|
66535
66547
|
|
|
66536
|
-
const version$
|
|
66548
|
+
const version$2 = "bytes/5.4.0";
|
|
66537
66549
|
|
|
66538
|
-
const logger$
|
|
66550
|
+
const logger$3 = new Logger(version$2);
|
|
66539
66551
|
///////////////////////////////
|
|
66540
66552
|
function isHexable(value) {
|
|
66541
66553
|
return !!(value.toHexString);
|
|
66542
66554
|
}
|
|
66555
|
+
function addSlice(array) {
|
|
66556
|
+
if (array.slice) {
|
|
66557
|
+
return array;
|
|
66558
|
+
}
|
|
66559
|
+
array.slice = function () {
|
|
66560
|
+
const args = Array.prototype.slice.call(arguments);
|
|
66561
|
+
return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
66562
|
+
};
|
|
66563
|
+
return array;
|
|
66564
|
+
}
|
|
66543
66565
|
function isBytes(value) {
|
|
66544
66566
|
if (value == null) {
|
|
66545
66567
|
return false;
|
|
@@ -66561,6 +66583,52 @@ function isBytes(value) {
|
|
|
66561
66583
|
}
|
|
66562
66584
|
return true;
|
|
66563
66585
|
}
|
|
66586
|
+
function arrayify(value, options) {
|
|
66587
|
+
if (!options) {
|
|
66588
|
+
options = {};
|
|
66589
|
+
}
|
|
66590
|
+
if (typeof (value) === "number") {
|
|
66591
|
+
logger$3.checkSafeUint53(value, "invalid arrayify value");
|
|
66592
|
+
const result = [];
|
|
66593
|
+
while (value) {
|
|
66594
|
+
result.unshift(value & 0xff);
|
|
66595
|
+
value = parseInt(String(value / 256));
|
|
66596
|
+
}
|
|
66597
|
+
if (result.length === 0) {
|
|
66598
|
+
result.push(0);
|
|
66599
|
+
}
|
|
66600
|
+
return addSlice(new Uint8Array(result));
|
|
66601
|
+
}
|
|
66602
|
+
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
66603
|
+
value = "0x" + value;
|
|
66604
|
+
}
|
|
66605
|
+
if (isHexable(value)) {
|
|
66606
|
+
value = value.toHexString();
|
|
66607
|
+
}
|
|
66608
|
+
if (isHexString(value)) {
|
|
66609
|
+
let hex = value.substring(2);
|
|
66610
|
+
if (hex.length % 2) {
|
|
66611
|
+
if (options.hexPad === "left") {
|
|
66612
|
+
hex = "0x0" + hex.substring(2);
|
|
66613
|
+
}
|
|
66614
|
+
else if (options.hexPad === "right") {
|
|
66615
|
+
hex += "0";
|
|
66616
|
+
}
|
|
66617
|
+
else {
|
|
66618
|
+
logger$3.throwArgumentError("hex data is odd-length", "value", value);
|
|
66619
|
+
}
|
|
66620
|
+
}
|
|
66621
|
+
const result = [];
|
|
66622
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
66623
|
+
result.push(parseInt(hex.substring(i, i + 2), 16));
|
|
66624
|
+
}
|
|
66625
|
+
return addSlice(new Uint8Array(result));
|
|
66626
|
+
}
|
|
66627
|
+
if (isBytes(value)) {
|
|
66628
|
+
return addSlice(new Uint8Array(value));
|
|
66629
|
+
}
|
|
66630
|
+
return logger$3.throwArgumentError("invalid arrayify value", "value", value);
|
|
66631
|
+
}
|
|
66564
66632
|
function isHexString(value, length) {
|
|
66565
66633
|
if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
|
|
66566
66634
|
return false;
|
|
@@ -66576,7 +66644,7 @@ function hexlify(value, options) {
|
|
|
66576
66644
|
options = {};
|
|
66577
66645
|
}
|
|
66578
66646
|
if (typeof (value) === "number") {
|
|
66579
|
-
logger$
|
|
66647
|
+
logger$3.checkSafeUint53(value, "invalid hexlify value");
|
|
66580
66648
|
let hex = "";
|
|
66581
66649
|
while (value) {
|
|
66582
66650
|
hex = HexCharacters[value & 0xf] + hex;
|
|
@@ -66612,7 +66680,7 @@ function hexlify(value, options) {
|
|
|
66612
66680
|
value += "0";
|
|
66613
66681
|
}
|
|
66614
66682
|
else {
|
|
66615
|
-
logger$
|
|
66683
|
+
logger$3.throwArgumentError("hex data is odd-length", "value", value);
|
|
66616
66684
|
}
|
|
66617
66685
|
}
|
|
66618
66686
|
return value.toLowerCase();
|
|
@@ -66625,22 +66693,45 @@ function hexlify(value, options) {
|
|
|
66625
66693
|
}
|
|
66626
66694
|
return result;
|
|
66627
66695
|
}
|
|
66628
|
-
return logger$
|
|
66696
|
+
return logger$3.throwArgumentError("invalid hexlify value", "value", value);
|
|
66697
|
+
}
|
|
66698
|
+
function hexZeroPad(value, length) {
|
|
66699
|
+
if (typeof (value) !== "string") {
|
|
66700
|
+
value = hexlify(value);
|
|
66701
|
+
}
|
|
66702
|
+
else if (!isHexString(value)) {
|
|
66703
|
+
logger$3.throwArgumentError("invalid hex string", "value", value);
|
|
66704
|
+
}
|
|
66705
|
+
if (value.length > 2 * length + 2) {
|
|
66706
|
+
logger$3.throwArgumentError("value out of range", "value", arguments[1]);
|
|
66707
|
+
}
|
|
66708
|
+
while (value.length < 2 * length + 2) {
|
|
66709
|
+
value = "0x0" + value.substring(2);
|
|
66710
|
+
}
|
|
66711
|
+
return value;
|
|
66629
66712
|
}
|
|
66630
66713
|
|
|
66631
|
-
const version = "bignumber/5.4.1";
|
|
66714
|
+
const version$1 = "bignumber/5.4.1";
|
|
66632
66715
|
|
|
66633
66716
|
var BN = bn.BN;
|
|
66634
|
-
const logger = new Logger(version);
|
|
66635
|
-
const _constructorGuard = {};
|
|
66717
|
+
const logger$2 = new Logger(version$1);
|
|
66718
|
+
const _constructorGuard$1 = {};
|
|
66636
66719
|
const MAX_SAFE = 0x1fffffffffffff;
|
|
66720
|
+
function isBigNumberish(value) {
|
|
66721
|
+
return (value != null) && (BigNumber.isBigNumber(value) ||
|
|
66722
|
+
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
66723
|
+
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
66724
|
+
isHexString(value) ||
|
|
66725
|
+
(typeof (value) === "bigint") ||
|
|
66726
|
+
isBytes(value));
|
|
66727
|
+
}
|
|
66637
66728
|
// Only warn about passing 10 into radix once
|
|
66638
66729
|
let _warnedToStringRadix = false;
|
|
66639
66730
|
class BigNumber {
|
|
66640
66731
|
constructor(constructorGuard, hex) {
|
|
66641
|
-
logger.checkNew(new.target, BigNumber);
|
|
66642
|
-
if (constructorGuard !== _constructorGuard) {
|
|
66643
|
-
logger.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
66732
|
+
logger$2.checkNew(new.target, BigNumber);
|
|
66733
|
+
if (constructorGuard !== _constructorGuard$1) {
|
|
66734
|
+
logger$2.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
66644
66735
|
operation: "new (BigNumber)"
|
|
66645
66736
|
});
|
|
66646
66737
|
}
|
|
@@ -66669,7 +66760,7 @@ class BigNumber {
|
|
|
66669
66760
|
div(other) {
|
|
66670
66761
|
const o = BigNumber.from(other);
|
|
66671
66762
|
if (o.isZero()) {
|
|
66672
|
-
throwFault("division by zero", "div");
|
|
66763
|
+
throwFault$1("division by zero", "div");
|
|
66673
66764
|
}
|
|
66674
66765
|
return toBigNumber(toBN(this).div(toBN(other)));
|
|
66675
66766
|
}
|
|
@@ -66679,53 +66770,53 @@ class BigNumber {
|
|
|
66679
66770
|
mod(other) {
|
|
66680
66771
|
const value = toBN(other);
|
|
66681
66772
|
if (value.isNeg()) {
|
|
66682
|
-
throwFault("cannot modulo negative values", "mod");
|
|
66773
|
+
throwFault$1("cannot modulo negative values", "mod");
|
|
66683
66774
|
}
|
|
66684
66775
|
return toBigNumber(toBN(this).umod(value));
|
|
66685
66776
|
}
|
|
66686
66777
|
pow(other) {
|
|
66687
66778
|
const value = toBN(other);
|
|
66688
66779
|
if (value.isNeg()) {
|
|
66689
|
-
throwFault("cannot raise to negative values", "pow");
|
|
66780
|
+
throwFault$1("cannot raise to negative values", "pow");
|
|
66690
66781
|
}
|
|
66691
66782
|
return toBigNumber(toBN(this).pow(value));
|
|
66692
66783
|
}
|
|
66693
66784
|
and(other) {
|
|
66694
66785
|
const value = toBN(other);
|
|
66695
66786
|
if (this.isNegative() || value.isNeg()) {
|
|
66696
|
-
throwFault("cannot 'and' negative values", "and");
|
|
66787
|
+
throwFault$1("cannot 'and' negative values", "and");
|
|
66697
66788
|
}
|
|
66698
66789
|
return toBigNumber(toBN(this).and(value));
|
|
66699
66790
|
}
|
|
66700
66791
|
or(other) {
|
|
66701
66792
|
const value = toBN(other);
|
|
66702
66793
|
if (this.isNegative() || value.isNeg()) {
|
|
66703
|
-
throwFault("cannot 'or' negative values", "or");
|
|
66794
|
+
throwFault$1("cannot 'or' negative values", "or");
|
|
66704
66795
|
}
|
|
66705
66796
|
return toBigNumber(toBN(this).or(value));
|
|
66706
66797
|
}
|
|
66707
66798
|
xor(other) {
|
|
66708
66799
|
const value = toBN(other);
|
|
66709
66800
|
if (this.isNegative() || value.isNeg()) {
|
|
66710
|
-
throwFault("cannot 'xor' negative values", "xor");
|
|
66801
|
+
throwFault$1("cannot 'xor' negative values", "xor");
|
|
66711
66802
|
}
|
|
66712
66803
|
return toBigNumber(toBN(this).xor(value));
|
|
66713
66804
|
}
|
|
66714
66805
|
mask(value) {
|
|
66715
66806
|
if (this.isNegative() || value < 0) {
|
|
66716
|
-
throwFault("cannot mask negative values", "mask");
|
|
66807
|
+
throwFault$1("cannot mask negative values", "mask");
|
|
66717
66808
|
}
|
|
66718
66809
|
return toBigNumber(toBN(this).maskn(value));
|
|
66719
66810
|
}
|
|
66720
66811
|
shl(value) {
|
|
66721
66812
|
if (this.isNegative() || value < 0) {
|
|
66722
|
-
throwFault("cannot shift negative values", "shl");
|
|
66813
|
+
throwFault$1("cannot shift negative values", "shl");
|
|
66723
66814
|
}
|
|
66724
66815
|
return toBigNumber(toBN(this).shln(value));
|
|
66725
66816
|
}
|
|
66726
66817
|
shr(value) {
|
|
66727
66818
|
if (this.isNegative() || value < 0) {
|
|
66728
|
-
throwFault("cannot shift negative values", "shr");
|
|
66819
|
+
throwFault$1("cannot shift negative values", "shr");
|
|
66729
66820
|
}
|
|
66730
66821
|
return toBigNumber(toBN(this).shrn(value));
|
|
66731
66822
|
}
|
|
@@ -66755,7 +66846,7 @@ class BigNumber {
|
|
|
66755
66846
|
return toBN(this).toNumber();
|
|
66756
66847
|
}
|
|
66757
66848
|
catch (error) {
|
|
66758
|
-
throwFault("overflow", "toNumber", this.toString());
|
|
66849
|
+
throwFault$1("overflow", "toNumber", this.toString());
|
|
66759
66850
|
}
|
|
66760
66851
|
return null;
|
|
66761
66852
|
}
|
|
@@ -66764,7 +66855,7 @@ class BigNumber {
|
|
|
66764
66855
|
return BigInt(this.toString());
|
|
66765
66856
|
}
|
|
66766
66857
|
catch (e) { }
|
|
66767
|
-
return logger.throwError("this platform does not support BigInt", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
66858
|
+
return logger$2.throwError("this platform does not support BigInt", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
66768
66859
|
value: this.toString()
|
|
66769
66860
|
});
|
|
66770
66861
|
}
|
|
@@ -66774,14 +66865,14 @@ class BigNumber {
|
|
|
66774
66865
|
if (arguments[0] === 10) {
|
|
66775
66866
|
if (!_warnedToStringRadix) {
|
|
66776
66867
|
_warnedToStringRadix = true;
|
|
66777
|
-
logger.warn("BigNumber.toString does not accept any parameters; base-10 is assumed");
|
|
66868
|
+
logger$2.warn("BigNumber.toString does not accept any parameters; base-10 is assumed");
|
|
66778
66869
|
}
|
|
66779
66870
|
}
|
|
66780
66871
|
else if (arguments[0] === 16) {
|
|
66781
|
-
logger.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
66872
|
+
logger$2.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
66782
66873
|
}
|
|
66783
66874
|
else {
|
|
66784
|
-
logger.throwError("BigNumber.toString does not accept parameters", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
66875
|
+
logger$2.throwError("BigNumber.toString does not accept parameters", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
66785
66876
|
}
|
|
66786
66877
|
}
|
|
66787
66878
|
return toBN(this).toString(10);
|
|
@@ -66798,19 +66889,19 @@ class BigNumber {
|
|
|
66798
66889
|
}
|
|
66799
66890
|
if (typeof (value) === "string") {
|
|
66800
66891
|
if (value.match(/^-?0x[0-9a-f]+$/i)) {
|
|
66801
|
-
return new BigNumber(_constructorGuard, toHex(value));
|
|
66892
|
+
return new BigNumber(_constructorGuard$1, toHex(value));
|
|
66802
66893
|
}
|
|
66803
66894
|
if (value.match(/^-?[0-9]+$/)) {
|
|
66804
|
-
return new BigNumber(_constructorGuard, toHex(new BN(value)));
|
|
66895
|
+
return new BigNumber(_constructorGuard$1, toHex(new BN(value)));
|
|
66805
66896
|
}
|
|
66806
|
-
return logger.throwArgumentError("invalid BigNumber string", "value", value);
|
|
66897
|
+
return logger$2.throwArgumentError("invalid BigNumber string", "value", value);
|
|
66807
66898
|
}
|
|
66808
66899
|
if (typeof (value) === "number") {
|
|
66809
66900
|
if (value % 1) {
|
|
66810
|
-
throwFault("underflow", "BigNumber.from", value);
|
|
66901
|
+
throwFault$1("underflow", "BigNumber.from", value);
|
|
66811
66902
|
}
|
|
66812
66903
|
if (value >= MAX_SAFE || value <= -MAX_SAFE) {
|
|
66813
|
-
throwFault("overflow", "BigNumber.from", value);
|
|
66904
|
+
throwFault$1("overflow", "BigNumber.from", value);
|
|
66814
66905
|
}
|
|
66815
66906
|
return BigNumber.from(String(value));
|
|
66816
66907
|
}
|
|
@@ -66843,7 +66934,7 @@ class BigNumber {
|
|
|
66843
66934
|
}
|
|
66844
66935
|
}
|
|
66845
66936
|
}
|
|
66846
|
-
return logger.throwArgumentError("invalid BigNumber value", "value", value);
|
|
66937
|
+
return logger$2.throwArgumentError("invalid BigNumber value", "value", value);
|
|
66847
66938
|
}
|
|
66848
66939
|
static isBigNumber(value) {
|
|
66849
66940
|
return !!(value && value._isBigNumber);
|
|
@@ -66861,7 +66952,7 @@ function toHex(value) {
|
|
|
66861
66952
|
value = value.substring(1);
|
|
66862
66953
|
// Cannot have mulitple negative signs (e.g. "--0x04")
|
|
66863
66954
|
if (value[0] === "-") {
|
|
66864
|
-
logger.throwArgumentError("invalid hex", "value", value);
|
|
66955
|
+
logger$2.throwArgumentError("invalid hex", "value", value);
|
|
66865
66956
|
}
|
|
66866
66957
|
// Call toHex on the positive component
|
|
66867
66958
|
value = toHex(value);
|
|
@@ -66900,24 +66991,399 @@ function toBN(value) {
|
|
|
66900
66991
|
}
|
|
66901
66992
|
return new BN(hex.substring(2), 16);
|
|
66902
66993
|
}
|
|
66903
|
-
function throwFault(fault, operation, value) {
|
|
66994
|
+
function throwFault$1(fault, operation, value) {
|
|
66904
66995
|
const params = { fault: fault, operation: operation };
|
|
66905
66996
|
if (value != null) {
|
|
66906
66997
|
params.value = value;
|
|
66907
66998
|
}
|
|
66908
|
-
return logger.throwError(fault, Logger.errors.NUMERIC_FAULT, params);
|
|
66999
|
+
return logger$2.throwError(fault, Logger.errors.NUMERIC_FAULT, params);
|
|
67000
|
+
}
|
|
67001
|
+
|
|
67002
|
+
const logger$1 = new Logger(version$1);
|
|
67003
|
+
const _constructorGuard = {};
|
|
67004
|
+
const Zero = BigNumber.from(0);
|
|
67005
|
+
const NegativeOne = BigNumber.from(-1);
|
|
67006
|
+
function throwFault(message, fault, operation, value) {
|
|
67007
|
+
const params = { fault: fault, operation: operation };
|
|
67008
|
+
if (value !== undefined) {
|
|
67009
|
+
params.value = value;
|
|
67010
|
+
}
|
|
67011
|
+
return logger$1.throwError(message, Logger.errors.NUMERIC_FAULT, params);
|
|
67012
|
+
}
|
|
67013
|
+
// Constant to pull zeros from for multipliers
|
|
67014
|
+
let zeros = "0";
|
|
67015
|
+
while (zeros.length < 256) {
|
|
67016
|
+
zeros += zeros;
|
|
67017
|
+
}
|
|
67018
|
+
// Returns a string "1" followed by decimal "0"s
|
|
67019
|
+
function getMultiplier(decimals) {
|
|
67020
|
+
if (typeof (decimals) !== "number") {
|
|
67021
|
+
try {
|
|
67022
|
+
decimals = BigNumber.from(decimals).toNumber();
|
|
67023
|
+
}
|
|
67024
|
+
catch (e) { }
|
|
67025
|
+
}
|
|
67026
|
+
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
67027
|
+
return ("1" + zeros.substring(0, decimals));
|
|
67028
|
+
}
|
|
67029
|
+
return logger$1.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
67030
|
+
}
|
|
67031
|
+
function formatFixed(value, decimals) {
|
|
67032
|
+
if (decimals == null) {
|
|
67033
|
+
decimals = 0;
|
|
67034
|
+
}
|
|
67035
|
+
const multiplier = getMultiplier(decimals);
|
|
67036
|
+
// Make sure wei is a big number (convert as necessary)
|
|
67037
|
+
value = BigNumber.from(value);
|
|
67038
|
+
const negative = value.lt(Zero);
|
|
67039
|
+
if (negative) {
|
|
67040
|
+
value = value.mul(NegativeOne);
|
|
67041
|
+
}
|
|
67042
|
+
let fraction = value.mod(multiplier).toString();
|
|
67043
|
+
while (fraction.length < multiplier.length - 1) {
|
|
67044
|
+
fraction = "0" + fraction;
|
|
67045
|
+
}
|
|
67046
|
+
// Strip training 0
|
|
67047
|
+
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
|
|
67048
|
+
const whole = value.div(multiplier).toString();
|
|
67049
|
+
if (multiplier.length === 1) {
|
|
67050
|
+
value = whole;
|
|
67051
|
+
}
|
|
67052
|
+
else {
|
|
67053
|
+
value = whole + "." + fraction;
|
|
67054
|
+
}
|
|
67055
|
+
if (negative) {
|
|
67056
|
+
value = "-" + value;
|
|
67057
|
+
}
|
|
67058
|
+
return value;
|
|
67059
|
+
}
|
|
67060
|
+
function parseFixed(value, decimals) {
|
|
67061
|
+
if (decimals == null) {
|
|
67062
|
+
decimals = 0;
|
|
67063
|
+
}
|
|
67064
|
+
const multiplier = getMultiplier(decimals);
|
|
67065
|
+
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
|
|
67066
|
+
logger$1.throwArgumentError("invalid decimal value", "value", value);
|
|
67067
|
+
}
|
|
67068
|
+
// Is it negative?
|
|
67069
|
+
const negative = (value.substring(0, 1) === "-");
|
|
67070
|
+
if (negative) {
|
|
67071
|
+
value = value.substring(1);
|
|
67072
|
+
}
|
|
67073
|
+
if (value === ".") {
|
|
67074
|
+
logger$1.throwArgumentError("missing value", "value", value);
|
|
67075
|
+
}
|
|
67076
|
+
// Split it into a whole and fractional part
|
|
67077
|
+
const comps = value.split(".");
|
|
67078
|
+
if (comps.length > 2) {
|
|
67079
|
+
logger$1.throwArgumentError("too many decimal points", "value", value);
|
|
67080
|
+
}
|
|
67081
|
+
let whole = comps[0], fraction = comps[1];
|
|
67082
|
+
if (!whole) {
|
|
67083
|
+
whole = "0";
|
|
67084
|
+
}
|
|
67085
|
+
if (!fraction) {
|
|
67086
|
+
fraction = "0";
|
|
67087
|
+
}
|
|
67088
|
+
// Get significant digits to check truncation for underflow
|
|
67089
|
+
{
|
|
67090
|
+
const sigFraction = fraction.replace(/^([0-9]*?)(0*)$/, (all, sig, zeros) => (sig));
|
|
67091
|
+
if (sigFraction.length > multiplier.length - 1) {
|
|
67092
|
+
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
|
|
67093
|
+
}
|
|
67094
|
+
}
|
|
67095
|
+
// Fully pad the string with zeros to get to wei
|
|
67096
|
+
while (fraction.length < multiplier.length - 1) {
|
|
67097
|
+
fraction += "0";
|
|
67098
|
+
}
|
|
67099
|
+
const wholeValue = BigNumber.from(whole);
|
|
67100
|
+
const fractionValue = BigNumber.from(fraction);
|
|
67101
|
+
let wei = (wholeValue.mul(multiplier)).add(fractionValue);
|
|
67102
|
+
if (negative) {
|
|
67103
|
+
wei = wei.mul(NegativeOne);
|
|
67104
|
+
}
|
|
67105
|
+
return wei;
|
|
67106
|
+
}
|
|
67107
|
+
class FixedFormat {
|
|
67108
|
+
constructor(constructorGuard, signed, width, decimals) {
|
|
67109
|
+
if (constructorGuard !== _constructorGuard) {
|
|
67110
|
+
logger$1.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
67111
|
+
operation: "new FixedFormat"
|
|
67112
|
+
});
|
|
67113
|
+
}
|
|
67114
|
+
this.signed = signed;
|
|
67115
|
+
this.width = width;
|
|
67116
|
+
this.decimals = decimals;
|
|
67117
|
+
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
67118
|
+
this._multiplier = getMultiplier(decimals);
|
|
67119
|
+
Object.freeze(this);
|
|
67120
|
+
}
|
|
67121
|
+
static from(value) {
|
|
67122
|
+
if (value instanceof FixedFormat) {
|
|
67123
|
+
return value;
|
|
67124
|
+
}
|
|
67125
|
+
if (typeof (value) === "number") {
|
|
67126
|
+
value = `fixed128x${value}`;
|
|
67127
|
+
}
|
|
67128
|
+
let signed = true;
|
|
67129
|
+
let width = 128;
|
|
67130
|
+
let decimals = 18;
|
|
67131
|
+
if (typeof (value) === "string") {
|
|
67132
|
+
if (value === "fixed") ;
|
|
67133
|
+
else if (value === "ufixed") {
|
|
67134
|
+
signed = false;
|
|
67135
|
+
}
|
|
67136
|
+
else {
|
|
67137
|
+
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
|
67138
|
+
if (!match) {
|
|
67139
|
+
logger$1.throwArgumentError("invalid fixed format", "format", value);
|
|
67140
|
+
}
|
|
67141
|
+
signed = (match[1] !== "u");
|
|
67142
|
+
width = parseInt(match[2]);
|
|
67143
|
+
decimals = parseInt(match[3]);
|
|
67144
|
+
}
|
|
67145
|
+
}
|
|
67146
|
+
else if (value) {
|
|
67147
|
+
const check = (key, type, defaultValue) => {
|
|
67148
|
+
if (value[key] == null) {
|
|
67149
|
+
return defaultValue;
|
|
67150
|
+
}
|
|
67151
|
+
if (typeof (value[key]) !== type) {
|
|
67152
|
+
logger$1.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
|
67153
|
+
}
|
|
67154
|
+
return value[key];
|
|
67155
|
+
};
|
|
67156
|
+
signed = check("signed", "boolean", signed);
|
|
67157
|
+
width = check("width", "number", width);
|
|
67158
|
+
decimals = check("decimals", "number", decimals);
|
|
67159
|
+
}
|
|
67160
|
+
if (width % 8) {
|
|
67161
|
+
logger$1.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
|
67162
|
+
}
|
|
67163
|
+
if (decimals > 80) {
|
|
67164
|
+
logger$1.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
67165
|
+
}
|
|
67166
|
+
return new FixedFormat(_constructorGuard, signed, width, decimals);
|
|
67167
|
+
}
|
|
67168
|
+
}
|
|
67169
|
+
class FixedNumber {
|
|
67170
|
+
constructor(constructorGuard, hex, value, format) {
|
|
67171
|
+
logger$1.checkNew(new.target, FixedNumber);
|
|
67172
|
+
if (constructorGuard !== _constructorGuard) {
|
|
67173
|
+
logger$1.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
67174
|
+
operation: "new FixedFormat"
|
|
67175
|
+
});
|
|
67176
|
+
}
|
|
67177
|
+
this.format = format;
|
|
67178
|
+
this._hex = hex;
|
|
67179
|
+
this._value = value;
|
|
67180
|
+
this._isFixedNumber = true;
|
|
67181
|
+
Object.freeze(this);
|
|
67182
|
+
}
|
|
67183
|
+
_checkFormat(other) {
|
|
67184
|
+
if (this.format.name !== other.format.name) {
|
|
67185
|
+
logger$1.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
|
67186
|
+
}
|
|
67187
|
+
}
|
|
67188
|
+
addUnsafe(other) {
|
|
67189
|
+
this._checkFormat(other);
|
|
67190
|
+
const a = parseFixed(this._value, this.format.decimals);
|
|
67191
|
+
const b = parseFixed(other._value, other.format.decimals);
|
|
67192
|
+
return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format);
|
|
67193
|
+
}
|
|
67194
|
+
subUnsafe(other) {
|
|
67195
|
+
this._checkFormat(other);
|
|
67196
|
+
const a = parseFixed(this._value, this.format.decimals);
|
|
67197
|
+
const b = parseFixed(other._value, other.format.decimals);
|
|
67198
|
+
return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format);
|
|
67199
|
+
}
|
|
67200
|
+
mulUnsafe(other) {
|
|
67201
|
+
this._checkFormat(other);
|
|
67202
|
+
const a = parseFixed(this._value, this.format.decimals);
|
|
67203
|
+
const b = parseFixed(other._value, other.format.decimals);
|
|
67204
|
+
return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
67205
|
+
}
|
|
67206
|
+
divUnsafe(other) {
|
|
67207
|
+
this._checkFormat(other);
|
|
67208
|
+
const a = parseFixed(this._value, this.format.decimals);
|
|
67209
|
+
const b = parseFixed(other._value, other.format.decimals);
|
|
67210
|
+
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
67211
|
+
}
|
|
67212
|
+
floor() {
|
|
67213
|
+
const comps = this.toString().split(".");
|
|
67214
|
+
if (comps.length === 1) {
|
|
67215
|
+
comps.push("0");
|
|
67216
|
+
}
|
|
67217
|
+
let result = FixedNumber.from(comps[0], this.format);
|
|
67218
|
+
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
67219
|
+
if (this.isNegative() && hasFraction) {
|
|
67220
|
+
result = result.subUnsafe(ONE.toFormat(result.format));
|
|
67221
|
+
}
|
|
67222
|
+
return result;
|
|
67223
|
+
}
|
|
67224
|
+
ceiling() {
|
|
67225
|
+
const comps = this.toString().split(".");
|
|
67226
|
+
if (comps.length === 1) {
|
|
67227
|
+
comps.push("0");
|
|
67228
|
+
}
|
|
67229
|
+
let result = FixedNumber.from(comps[0], this.format);
|
|
67230
|
+
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
67231
|
+
if (!this.isNegative() && hasFraction) {
|
|
67232
|
+
result = result.addUnsafe(ONE.toFormat(result.format));
|
|
67233
|
+
}
|
|
67234
|
+
return result;
|
|
67235
|
+
}
|
|
67236
|
+
// @TODO: Support other rounding algorithms
|
|
67237
|
+
round(decimals) {
|
|
67238
|
+
if (decimals == null) {
|
|
67239
|
+
decimals = 0;
|
|
67240
|
+
}
|
|
67241
|
+
// If we are already in range, we're done
|
|
67242
|
+
const comps = this.toString().split(".");
|
|
67243
|
+
if (comps.length === 1) {
|
|
67244
|
+
comps.push("0");
|
|
67245
|
+
}
|
|
67246
|
+
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
|
67247
|
+
logger$1.throwArgumentError("invalid decimal count", "decimals", decimals);
|
|
67248
|
+
}
|
|
67249
|
+
if (comps[1].length <= decimals) {
|
|
67250
|
+
return this;
|
|
67251
|
+
}
|
|
67252
|
+
const factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format);
|
|
67253
|
+
const bump = BUMP.toFormat(this.format);
|
|
67254
|
+
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
67255
|
+
}
|
|
67256
|
+
isZero() {
|
|
67257
|
+
return (this._value === "0.0" || this._value === "0");
|
|
67258
|
+
}
|
|
67259
|
+
isNegative() {
|
|
67260
|
+
return (this._value[0] === "-");
|
|
67261
|
+
}
|
|
67262
|
+
toString() { return this._value; }
|
|
67263
|
+
toHexString(width) {
|
|
67264
|
+
if (width == null) {
|
|
67265
|
+
return this._hex;
|
|
67266
|
+
}
|
|
67267
|
+
if (width % 8) {
|
|
67268
|
+
logger$1.throwArgumentError("invalid byte width", "width", width);
|
|
67269
|
+
}
|
|
67270
|
+
const hex = BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
67271
|
+
return hexZeroPad(hex, width / 8);
|
|
67272
|
+
}
|
|
67273
|
+
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
67274
|
+
toFormat(format) {
|
|
67275
|
+
return FixedNumber.fromString(this._value, format);
|
|
67276
|
+
}
|
|
67277
|
+
static fromValue(value, decimals, format) {
|
|
67278
|
+
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
67279
|
+
if (format == null && decimals != null && !isBigNumberish(decimals)) {
|
|
67280
|
+
format = decimals;
|
|
67281
|
+
decimals = null;
|
|
67282
|
+
}
|
|
67283
|
+
if (decimals == null) {
|
|
67284
|
+
decimals = 0;
|
|
67285
|
+
}
|
|
67286
|
+
if (format == null) {
|
|
67287
|
+
format = "fixed";
|
|
67288
|
+
}
|
|
67289
|
+
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
|
|
67290
|
+
}
|
|
67291
|
+
static fromString(value, format) {
|
|
67292
|
+
if (format == null) {
|
|
67293
|
+
format = "fixed";
|
|
67294
|
+
}
|
|
67295
|
+
const fixedFormat = FixedFormat.from(format);
|
|
67296
|
+
const numeric = parseFixed(value, fixedFormat.decimals);
|
|
67297
|
+
if (!fixedFormat.signed && numeric.lt(Zero)) {
|
|
67298
|
+
throwFault("unsigned value cannot be negative", "overflow", "value", value);
|
|
67299
|
+
}
|
|
67300
|
+
let hex = null;
|
|
67301
|
+
if (fixedFormat.signed) {
|
|
67302
|
+
hex = numeric.toTwos(fixedFormat.width).toHexString();
|
|
67303
|
+
}
|
|
67304
|
+
else {
|
|
67305
|
+
hex = numeric.toHexString();
|
|
67306
|
+
hex = hexZeroPad(hex, fixedFormat.width / 8);
|
|
67307
|
+
}
|
|
67308
|
+
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
67309
|
+
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
|
67310
|
+
}
|
|
67311
|
+
static fromBytes(value, format) {
|
|
67312
|
+
if (format == null) {
|
|
67313
|
+
format = "fixed";
|
|
67314
|
+
}
|
|
67315
|
+
const fixedFormat = FixedFormat.from(format);
|
|
67316
|
+
if (arrayify(value).length > fixedFormat.width / 8) {
|
|
67317
|
+
throw new Error("overflow");
|
|
67318
|
+
}
|
|
67319
|
+
let numeric = BigNumber.from(value);
|
|
67320
|
+
if (fixedFormat.signed) {
|
|
67321
|
+
numeric = numeric.fromTwos(fixedFormat.width);
|
|
67322
|
+
}
|
|
67323
|
+
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
67324
|
+
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
67325
|
+
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
|
67326
|
+
}
|
|
67327
|
+
static from(value, format) {
|
|
67328
|
+
if (typeof (value) === "string") {
|
|
67329
|
+
return FixedNumber.fromString(value, format);
|
|
67330
|
+
}
|
|
67331
|
+
if (isBytes(value)) {
|
|
67332
|
+
return FixedNumber.fromBytes(value, format);
|
|
67333
|
+
}
|
|
67334
|
+
try {
|
|
67335
|
+
return FixedNumber.fromValue(value, 0, format);
|
|
67336
|
+
}
|
|
67337
|
+
catch (error) {
|
|
67338
|
+
// Allow NUMERIC_FAULT to bubble up
|
|
67339
|
+
if (error.code !== Logger.errors.INVALID_ARGUMENT) {
|
|
67340
|
+
throw error;
|
|
67341
|
+
}
|
|
67342
|
+
}
|
|
67343
|
+
return logger$1.throwArgumentError("invalid FixedNumber value", "value", value);
|
|
67344
|
+
}
|
|
67345
|
+
static isFixedNumber(value) {
|
|
67346
|
+
return !!(value && value._isFixedNumber);
|
|
67347
|
+
}
|
|
67348
|
+
}
|
|
67349
|
+
const ONE = FixedNumber.from(1);
|
|
67350
|
+
const BUMP = FixedNumber.from("0.5");
|
|
67351
|
+
|
|
67352
|
+
const version = "units/5.4.0";
|
|
67353
|
+
|
|
67354
|
+
const logger = new Logger(version);
|
|
67355
|
+
const names = [
|
|
67356
|
+
"wei",
|
|
67357
|
+
"kwei",
|
|
67358
|
+
"mwei",
|
|
67359
|
+
"gwei",
|
|
67360
|
+
"szabo",
|
|
67361
|
+
"finney",
|
|
67362
|
+
"ether",
|
|
67363
|
+
];
|
|
67364
|
+
function parseUnits(value, unitName) {
|
|
67365
|
+
if (typeof (value) !== "string") {
|
|
67366
|
+
logger.throwArgumentError("value must be a string", "value", value);
|
|
67367
|
+
}
|
|
67368
|
+
if (typeof (unitName) === "string") {
|
|
67369
|
+
const index = names.indexOf(unitName);
|
|
67370
|
+
if (index !== -1) {
|
|
67371
|
+
unitName = 3 * index;
|
|
67372
|
+
}
|
|
67373
|
+
}
|
|
67374
|
+
return parseFixed(value, (unitName != null) ? unitName : 18);
|
|
66909
67375
|
}
|
|
66910
67376
|
|
|
66911
67377
|
function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
66912
|
-
let getTransaction = ({ paymentRoute, event })=> {
|
|
67378
|
+
let getTransaction = ({ paymentRoute, event, fee })=> {
|
|
66913
67379
|
let exchangeRoute = paymentRoute.exchangeRoutes[0];
|
|
66914
67380
|
|
|
66915
67381
|
let transaction = {
|
|
66916
67382
|
blockchain: paymentRoute.blockchain,
|
|
66917
|
-
to: transactionAddress({ paymentRoute }),
|
|
66918
|
-
api: transactionApi({ paymentRoute }),
|
|
66919
|
-
method: transactionMethod({ paymentRoute }),
|
|
66920
|
-
params: transactionParams({ paymentRoute, exchangeRoute, event }),
|
|
67383
|
+
to: transactionAddress({ paymentRoute, fee }),
|
|
67384
|
+
api: transactionApi({ paymentRoute, fee }),
|
|
67385
|
+
method: transactionMethod({ paymentRoute, fee }),
|
|
67386
|
+
params: transactionParams({ paymentRoute, exchangeRoute, event, fee }),
|
|
66921
67387
|
value: transactionValue({ paymentRoute, exchangeRoute })
|
|
66922
67388
|
};
|
|
66923
67389
|
|
|
@@ -66934,8 +67400,8 @@ let getTransaction = ({ paymentRoute, event })=> {
|
|
|
66934
67400
|
return transaction
|
|
66935
67401
|
};
|
|
66936
67402
|
|
|
66937
|
-
let transactionAddress = ({ paymentRoute })=> {
|
|
66938
|
-
if(paymentRoute.directTransfer) {
|
|
67403
|
+
let transactionAddress = ({ paymentRoute, fee })=> {
|
|
67404
|
+
if(paymentRoute.directTransfer && !fee) {
|
|
66939
67405
|
if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) {
|
|
66940
67406
|
return paymentRoute.toAddress
|
|
66941
67407
|
} else {
|
|
@@ -66946,8 +67412,8 @@ let transactionAddress = ({ paymentRoute })=> {
|
|
|
66946
67412
|
}
|
|
66947
67413
|
};
|
|
66948
67414
|
|
|
66949
|
-
let transactionApi = ({ paymentRoute })=> {
|
|
66950
|
-
if(paymentRoute.directTransfer) {
|
|
67415
|
+
let transactionApi = ({ paymentRoute, fee })=> {
|
|
67416
|
+
if(paymentRoute.directTransfer && !fee) {
|
|
66951
67417
|
if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) {
|
|
66952
67418
|
return undefined
|
|
66953
67419
|
} else {
|
|
@@ -66958,8 +67424,8 @@ let transactionApi = ({ paymentRoute })=> {
|
|
|
66958
67424
|
}
|
|
66959
67425
|
};
|
|
66960
67426
|
|
|
66961
|
-
let transactionMethod = ({ paymentRoute })=> {
|
|
66962
|
-
if(paymentRoute.directTransfer) {
|
|
67427
|
+
let transactionMethod = ({ paymentRoute, fee })=> {
|
|
67428
|
+
if(paymentRoute.directTransfer && !fee) {
|
|
66963
67429
|
if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) {
|
|
66964
67430
|
return undefined
|
|
66965
67431
|
} else {
|
|
@@ -66970,8 +67436,8 @@ let transactionMethod = ({ paymentRoute })=> {
|
|
|
66970
67436
|
}
|
|
66971
67437
|
};
|
|
66972
67438
|
|
|
66973
|
-
let transactionParams = ({ paymentRoute, exchangeRoute, event })=> {
|
|
66974
|
-
if(paymentRoute.directTransfer) {
|
|
67439
|
+
let transactionParams = ({ paymentRoute, exchangeRoute, event, fee })=> {
|
|
67440
|
+
if(paymentRoute.directTransfer && !fee) {
|
|
66975
67441
|
if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) {
|
|
66976
67442
|
return undefined
|
|
66977
67443
|
} else {
|
|
@@ -66980,9 +67446,9 @@ let transactionParams = ({ paymentRoute, exchangeRoute, event })=> {
|
|
|
66980
67446
|
} else {
|
|
66981
67447
|
return {
|
|
66982
67448
|
path: transactionPath({ paymentRoute, exchangeRoute }),
|
|
66983
|
-
amounts: transactionAmounts({ paymentRoute, exchangeRoute }),
|
|
66984
|
-
addresses: transactionAddresses({ paymentRoute }),
|
|
66985
|
-
plugins: transactionPlugins({ paymentRoute, exchangeRoute, event }),
|
|
67449
|
+
amounts: transactionAmounts({ paymentRoute, exchangeRoute, fee }),
|
|
67450
|
+
addresses: transactionAddresses({ paymentRoute, fee }),
|
|
67451
|
+
plugins: transactionPlugins({ paymentRoute, exchangeRoute, event, fee }),
|
|
66986
67452
|
data: []
|
|
66987
67453
|
}
|
|
66988
67454
|
}
|
|
@@ -66996,23 +67462,59 @@ let transactionPath = ({ paymentRoute, exchangeRoute })=> {
|
|
|
66996
67462
|
}
|
|
66997
67463
|
};
|
|
66998
67464
|
|
|
66999
|
-
let transactionAmounts = ({ paymentRoute, exchangeRoute })=> {
|
|
67465
|
+
let transactionAmounts = ({ paymentRoute, exchangeRoute, fee })=> {
|
|
67466
|
+
let amounts;
|
|
67000
67467
|
if(exchangeRoute) {
|
|
67001
|
-
|
|
67468
|
+
amounts = [
|
|
67002
67469
|
exchangeRoute.amountIn.toString(),
|
|
67003
|
-
exchangeRoute.amountOutMin.toString(),
|
|
67470
|
+
subtractFee({ amount: exchangeRoute.amountOutMin.toString(), paymentRoute, fee }),
|
|
67004
67471
|
exchangeRoute.transaction.params.deadline
|
|
67005
|
-
]
|
|
67472
|
+
];
|
|
67473
|
+
} else {
|
|
67474
|
+
amounts = [
|
|
67475
|
+
paymentRoute.toAmount, // from
|
|
67476
|
+
subtractFee({ amount: paymentRoute.toAmount, paymentRoute, fee }) // to
|
|
67477
|
+
];
|
|
67478
|
+
}
|
|
67479
|
+
if(fee){
|
|
67480
|
+
amounts[4] = transactionFeeAmount({ paymentRoute, fee });
|
|
67481
|
+
}
|
|
67482
|
+
for(var i = 0; i < amounts.length; i++) {
|
|
67483
|
+
if(amounts[i] == undefined){ amounts[i] = '0'; }
|
|
67484
|
+
}
|
|
67485
|
+
return amounts
|
|
67486
|
+
};
|
|
67487
|
+
|
|
67488
|
+
let subtractFee = ({ amount, paymentRoute, fee })=> {
|
|
67489
|
+
if(fee) {
|
|
67490
|
+
let feeAmount = transactionFeeAmount({ paymentRoute, fee });
|
|
67491
|
+
return BigNumber.from(amount).sub(feeAmount).toString()
|
|
67006
67492
|
} else {
|
|
67007
|
-
return
|
|
67493
|
+
return amount
|
|
67008
67494
|
}
|
|
67009
67495
|
};
|
|
67010
67496
|
|
|
67011
|
-
let
|
|
67012
|
-
|
|
67497
|
+
let transactionFeeAmount = ({ paymentRoute, fee })=> {
|
|
67498
|
+
if(typeof fee.amount == 'string' && fee.amount.match('%')) {
|
|
67499
|
+
return BigNumber.from(paymentRoute.toAmount).div(100).mul(parseFloat(fee.amount)).toString()
|
|
67500
|
+
} else if(typeof fee.amount == 'string') {
|
|
67501
|
+
return fee.amount
|
|
67502
|
+
} else if(typeof fee.amount == 'number') {
|
|
67503
|
+
return parseUnits(fee.amount.toString(), paymentRoute.toDecimals).toString()
|
|
67504
|
+
} else {
|
|
67505
|
+
throw('Unknown fee amount type!')
|
|
67506
|
+
}
|
|
67013
67507
|
};
|
|
67014
67508
|
|
|
67015
|
-
let
|
|
67509
|
+
let transactionAddresses = ({ paymentRoute, fee })=> {
|
|
67510
|
+
if(fee) {
|
|
67511
|
+
return [paymentRoute.fromAddress, fee.receiver, paymentRoute.toAddress]
|
|
67512
|
+
} else {
|
|
67513
|
+
return [paymentRoute.fromAddress, paymentRoute.toAddress]
|
|
67514
|
+
}
|
|
67515
|
+
};
|
|
67516
|
+
|
|
67517
|
+
let transactionPlugins = ({ paymentRoute, exchangeRoute, event, fee })=> {
|
|
67016
67518
|
let paymentPlugins = [];
|
|
67017
67519
|
|
|
67018
67520
|
if(exchangeRoute) {
|
|
@@ -67040,6 +67542,10 @@ let transactionPlugins = ({ paymentRoute, exchangeRoute, event })=> {
|
|
|
67040
67542
|
paymentPlugins.push(plugins[paymentRoute.blockchain].payment.address);
|
|
67041
67543
|
}
|
|
67042
67544
|
|
|
67545
|
+
if(fee) {
|
|
67546
|
+
paymentPlugins.push(plugins[paymentRoute.blockchain].paymentFee.address);
|
|
67547
|
+
}
|
|
67548
|
+
|
|
67043
67549
|
return paymentPlugins
|
|
67044
67550
|
};
|
|
67045
67551
|
|
|
@@ -67057,11 +67563,12 @@ let transactionValue = ({ paymentRoute, exchangeRoute })=> {
|
|
|
67057
67563
|
|
|
67058
67564
|
function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
67059
67565
|
class PaymentRoute {
|
|
67060
|
-
constructor({ blockchain, fromToken, toToken, toAmount, fromAddress, toAddress, toContract }) {
|
|
67566
|
+
constructor({ blockchain, fromToken, toToken, toDecimals, toAmount, fromAddress, toAddress, toContract }) {
|
|
67061
67567
|
this.blockchain = blockchain;
|
|
67062
67568
|
this.fromToken = fromToken;
|
|
67063
67569
|
this.fromBalance = 0;
|
|
67064
67570
|
this.toToken = toToken;
|
|
67571
|
+
this.toDecimals = toDecimals;
|
|
67065
67572
|
this.toAmount = _optionalChain([toAmount, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]);
|
|
67066
67573
|
this.fromAddress = fromAddress;
|
|
67067
67574
|
this.toAddress = toAddress;
|
|
@@ -67120,38 +67627,32 @@ async function getAllAssets({ accept, apiKey, whitelist }) {
|
|
|
67120
67627
|
}
|
|
67121
67628
|
|
|
67122
67629
|
function convertToRoutes({ tokens, accept }) {
|
|
67123
|
-
|
|
67124
|
-
return tokens.map((fromToken)=>{
|
|
67630
|
+
return Promise.all(tokens.map(async (fromToken)=>{
|
|
67125
67631
|
let relevantConfigurations = accept.filter((configuration)=>(configuration.blockchain == fromToken.blockchain));
|
|
67126
|
-
return relevantConfigurations.map((configuration)=>{
|
|
67632
|
+
return Promise.all(relevantConfigurations.map(async (configuration)=>{
|
|
67127
67633
|
let blockchain = configuration.blockchain;
|
|
67128
67634
|
let toToken = new Token({ blockchain, address: configuration.token });
|
|
67635
|
+
let toDecimals = await toToken.decimals();
|
|
67636
|
+
let toAmount = (await toToken.BigNumber(configuration.amount)).toString();
|
|
67129
67637
|
return new PaymentRoute({
|
|
67130
67638
|
blockchain,
|
|
67131
67639
|
fromToken: fromToken,
|
|
67132
67640
|
toToken: toToken,
|
|
67133
|
-
toAmount:
|
|
67641
|
+
toAmount: toAmount,
|
|
67642
|
+
toDecimals: toDecimals,
|
|
67134
67643
|
fromAddress: configuration.fromAddress,
|
|
67135
67644
|
toAddress: configuration.toAddress,
|
|
67136
67645
|
toContract: configuration.toContract
|
|
67137
67646
|
})
|
|
67138
|
-
})
|
|
67139
|
-
}).flat()
|
|
67647
|
+
}))
|
|
67648
|
+
})).then((routes)=> routes.flat())
|
|
67140
67649
|
}
|
|
67141
67650
|
|
|
67142
|
-
async function
|
|
67143
|
-
return await Promise.all(routes.map(async (route)=>{
|
|
67144
|
-
route.toAmount = (await route.toToken.BigNumber(route.toAmount)).toString();
|
|
67145
|
-
return route
|
|
67146
|
-
}))
|
|
67147
|
-
}
|
|
67148
|
-
|
|
67149
|
-
async function route({ accept, whitelist, blacklist, apiKey, event }) {
|
|
67651
|
+
async function route({ accept, whitelist, blacklist, apiKey, event, fee }) {
|
|
67150
67652
|
let paymentRoutes = getAllAssets({ accept, whitelist, apiKey })
|
|
67151
67653
|
.then((assets)=>filterBlacklistedAssets({ assets, blacklist }))
|
|
67152
67654
|
.then(assetsToTokens)
|
|
67153
67655
|
.then((tokens) => convertToRoutes({ tokens, accept }))
|
|
67154
|
-
.then(convertToAmounts)
|
|
67155
67656
|
.then(addDirectTransferStatus)
|
|
67156
67657
|
.then(addExchangeRoutes)
|
|
67157
67658
|
.then(filterExchangeRoutesWithoutPlugin)
|
|
@@ -67160,7 +67661,7 @@ async function route({ accept, whitelist, blacklist, apiKey, event }) {
|
|
|
67160
67661
|
.then(filterInsufficientBalance)
|
|
67161
67662
|
.then(addApproval)
|
|
67162
67663
|
.then(sortPaymentRoutes)
|
|
67163
|
-
.then((routes)=>addTransactions({ routes, event }))
|
|
67664
|
+
.then((routes)=>addTransactions({ routes, event, fee }))
|
|
67164
67665
|
.then(addFromAmount)
|
|
67165
67666
|
.then(filterDuplicateFromTokens);
|
|
67166
67667
|
|
|
@@ -67283,7 +67784,7 @@ let addDirectTransferStatus = (routes) => {
|
|
|
67283
67784
|
|
|
67284
67785
|
let addFromAmount = (routes)=> {
|
|
67285
67786
|
return routes.map((route)=>{
|
|
67286
|
-
if(route.directTransfer) {
|
|
67787
|
+
if(route.directTransfer && !route.fee) {
|
|
67287
67788
|
if(route.fromToken.address.toLowerCase() == CONSTANTS$2[route.blockchain].NATIVE.toLowerCase()) {
|
|
67288
67789
|
route.fromAmount = route.transaction.value;
|
|
67289
67790
|
} else {
|
|
@@ -67357,10 +67858,11 @@ let sortPaymentRoutes = (routes) => {
|
|
|
67357
67858
|
})
|
|
67358
67859
|
};
|
|
67359
67860
|
|
|
67360
|
-
let addTransactions = ({ routes, event }) => {
|
|
67861
|
+
let addTransactions = ({ routes, event, fee }) => {
|
|
67361
67862
|
return routes.map((route)=>{
|
|
67362
|
-
route.transaction = getTransaction({ paymentRoute: route, event });
|
|
67863
|
+
route.transaction = getTransaction({ paymentRoute: route, event, fee });
|
|
67363
67864
|
route.event = !route.directTransfer;
|
|
67865
|
+
route.fee = !!fee;
|
|
67364
67866
|
return route
|
|
67365
67867
|
})
|
|
67366
67868
|
};
|
|
@@ -67414,6 +67916,7 @@ var PaymentRoutingProvider = (function (props) {
|
|
|
67414
67916
|
whitelist: props.whitelist,
|
|
67415
67917
|
blacklist: props.blacklist,
|
|
67416
67918
|
event: props.event,
|
|
67919
|
+
fee: props.fee,
|
|
67417
67920
|
apiKey: apiKey
|
|
67418
67921
|
}).then(function (routes) {
|
|
67419
67922
|
if (routes.length == 0) {
|
|
@@ -70752,7 +71255,8 @@ var PaymentAmountRoutingProvider = (function (props) {
|
|
|
70752
71255
|
whitelist: props.whitelist,
|
|
70753
71256
|
blacklist: props.blacklist,
|
|
70754
71257
|
event: props.event,
|
|
70755
|
-
setMaxRoute: setMaxRoute
|
|
71258
|
+
setMaxRoute: setMaxRoute,
|
|
71259
|
+
fee: props.fee
|
|
70756
71260
|
}, props.children));
|
|
70757
71261
|
});
|
|
70758
71262
|
|
|
@@ -70945,12 +71449,12 @@ var preflight$1 = /*#__PURE__*/function () {
|
|
|
70945
71449
|
|
|
70946
71450
|
var Payment = /*#__PURE__*/function () {
|
|
70947
71451
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
70948
|
-
var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, document, unmount;
|
|
71452
|
+
var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, document, unmount;
|
|
70949
71453
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
70950
71454
|
while (1) {
|
|
70951
71455
|
switch (_context2.prev = _context2.next) {
|
|
70952
71456
|
case 0:
|
|
70953
|
-
accept = _ref3.accept, amount = _ref3.amount, event = _ref3.event, sent = _ref3.sent, confirmed = _ref3.confirmed, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, whitelist = _ref3.whitelist, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, track = _ref3.track, document = _ref3.document;
|
|
71457
|
+
accept = _ref3.accept, amount = _ref3.amount, event = _ref3.event, sent = _ref3.sent, confirmed = _ref3.confirmed, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, whitelist = _ref3.whitelist, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, track = _ref3.track, fee = _ref3.fee, document = _ref3.document;
|
|
70954
71458
|
_context2.prev = 1;
|
|
70955
71459
|
_context2.next = 4;
|
|
70956
71460
|
return preflight$1({
|
|
@@ -70980,7 +71484,8 @@ var Payment = /*#__PURE__*/function () {
|
|
|
70980
71484
|
whitelist: whitelist,
|
|
70981
71485
|
blacklist: blacklist,
|
|
70982
71486
|
providers: providers,
|
|
70983
|
-
track: track
|
|
71487
|
+
track: track,
|
|
71488
|
+
fee: fee
|
|
70984
71489
|
}
|
|
70985
71490
|
}, /*#__PURE__*/react.createElement(UpdatableProvider, null, /*#__PURE__*/react.createElement(ClosableProvider, {
|
|
70986
71491
|
unmount: unmount
|
|
@@ -70995,7 +71500,8 @@ var Payment = /*#__PURE__*/function () {
|
|
|
70995
71500
|
accept: accept,
|
|
70996
71501
|
whitelist: whitelist,
|
|
70997
71502
|
blacklist: blacklist,
|
|
70998
|
-
event: event
|
|
71503
|
+
event: event,
|
|
71504
|
+
fee: fee
|
|
70999
71505
|
}, /*#__PURE__*/react.createElement(TrackingProvider, {
|
|
71000
71506
|
document: ensureDocument(document)
|
|
71001
71507
|
}, /*#__PURE__*/react.createElement(PaymentProvider, {
|