@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/umd/index.bundle.js
CHANGED
|
@@ -10827,13 +10827,13 @@
|
|
|
10827
10827
|
function isHexable$4(value) {
|
|
10828
10828
|
return !!(value.toHexString);
|
|
10829
10829
|
}
|
|
10830
|
-
function addSlice$
|
|
10830
|
+
function addSlice$4(array) {
|
|
10831
10831
|
if (array.slice) {
|
|
10832
10832
|
return array;
|
|
10833
10833
|
}
|
|
10834
10834
|
array.slice = function () {
|
|
10835
10835
|
const args = Array.prototype.slice.call(arguments);
|
|
10836
|
-
return addSlice$
|
|
10836
|
+
return addSlice$4(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
10837
10837
|
};
|
|
10838
10838
|
return array;
|
|
10839
10839
|
}
|
|
@@ -10864,7 +10864,7 @@
|
|
|
10864
10864
|
}
|
|
10865
10865
|
return true;
|
|
10866
10866
|
}
|
|
10867
|
-
function arrayify$
|
|
10867
|
+
function arrayify$4(value, options) {
|
|
10868
10868
|
if (!options) {
|
|
10869
10869
|
options = {};
|
|
10870
10870
|
}
|
|
@@ -10878,7 +10878,7 @@
|
|
|
10878
10878
|
if (result.length === 0) {
|
|
10879
10879
|
result.push(0);
|
|
10880
10880
|
}
|
|
10881
|
-
return addSlice$
|
|
10881
|
+
return addSlice$4(new Uint8Array(result));
|
|
10882
10882
|
}
|
|
10883
10883
|
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
10884
10884
|
value = "0x" + value;
|
|
@@ -10903,25 +10903,25 @@
|
|
|
10903
10903
|
for (let i = 0; i < hex.length; i += 2) {
|
|
10904
10904
|
result.push(parseInt(hex.substring(i, i + 2), 16));
|
|
10905
10905
|
}
|
|
10906
|
-
return addSlice$
|
|
10906
|
+
return addSlice$4(new Uint8Array(result));
|
|
10907
10907
|
}
|
|
10908
10908
|
if (isBytes$4(value)) {
|
|
10909
|
-
return addSlice$
|
|
10909
|
+
return addSlice$4(new Uint8Array(value));
|
|
10910
10910
|
}
|
|
10911
10911
|
return logger$J.throwArgumentError("invalid arrayify value", "value", value);
|
|
10912
10912
|
}
|
|
10913
10913
|
function concat$2(items) {
|
|
10914
|
-
const objects = items.map(item => arrayify$
|
|
10914
|
+
const objects = items.map(item => arrayify$4(item));
|
|
10915
10915
|
const length = objects.reduce((accum, item) => (accum + item.length), 0);
|
|
10916
10916
|
const result = new Uint8Array(length);
|
|
10917
10917
|
objects.reduce((offset, object) => {
|
|
10918
10918
|
result.set(object, offset);
|
|
10919
10919
|
return offset + object.length;
|
|
10920
10920
|
}, 0);
|
|
10921
|
-
return addSlice$
|
|
10921
|
+
return addSlice$4(result);
|
|
10922
10922
|
}
|
|
10923
10923
|
function stripZeros$2(value) {
|
|
10924
|
-
let result = arrayify$
|
|
10924
|
+
let result = arrayify$4(value);
|
|
10925
10925
|
if (result.length === 0) {
|
|
10926
10926
|
return result;
|
|
10927
10927
|
}
|
|
@@ -11039,7 +11039,7 @@
|
|
|
11039
11039
|
});
|
|
11040
11040
|
return result;
|
|
11041
11041
|
}
|
|
11042
|
-
function hexZeroPad$
|
|
11042
|
+
function hexZeroPad$4(value, length) {
|
|
11043
11043
|
if (typeof (value) !== "string") {
|
|
11044
11044
|
value = hexlify$4(value);
|
|
11045
11045
|
}
|
|
@@ -11061,7 +11061,7 @@
|
|
|
11061
11061
|
const logger$I = new Logger$4(version$w);
|
|
11062
11062
|
const _constructorGuard$9 = {};
|
|
11063
11063
|
const MAX_SAFE$4 = 0x1fffffffffffff;
|
|
11064
|
-
function isBigNumberish$
|
|
11064
|
+
function isBigNumberish$3(value) {
|
|
11065
11065
|
return (value != null) && (BigNumber$4.isBigNumber(value) ||
|
|
11066
11066
|
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
11067
11067
|
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
@@ -11359,12 +11359,12 @@
|
|
|
11359
11359
|
return logger$H.throwError(message, Logger$4.errors.NUMERIC_FAULT, params);
|
|
11360
11360
|
}
|
|
11361
11361
|
// Constant to pull zeros from for multipliers
|
|
11362
|
-
let zeros$
|
|
11363
|
-
while (zeros$
|
|
11364
|
-
zeros$
|
|
11362
|
+
let zeros$3 = "0";
|
|
11363
|
+
while (zeros$3.length < 256) {
|
|
11364
|
+
zeros$3 += zeros$3;
|
|
11365
11365
|
}
|
|
11366
11366
|
// Returns a string "1" followed by decimal "0"s
|
|
11367
|
-
function getMultiplier$
|
|
11367
|
+
function getMultiplier$3(decimals) {
|
|
11368
11368
|
if (typeof (decimals) !== "number") {
|
|
11369
11369
|
try {
|
|
11370
11370
|
decimals = BigNumber$4.from(decimals).toNumber();
|
|
@@ -11372,15 +11372,15 @@
|
|
|
11372
11372
|
catch (e) { }
|
|
11373
11373
|
}
|
|
11374
11374
|
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
11375
|
-
return ("1" + zeros$
|
|
11375
|
+
return ("1" + zeros$3.substring(0, decimals));
|
|
11376
11376
|
}
|
|
11377
11377
|
return logger$H.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
11378
11378
|
}
|
|
11379
|
-
function formatFixed$
|
|
11379
|
+
function formatFixed$3(value, decimals) {
|
|
11380
11380
|
if (decimals == null) {
|
|
11381
11381
|
decimals = 0;
|
|
11382
11382
|
}
|
|
11383
|
-
const multiplier = getMultiplier$
|
|
11383
|
+
const multiplier = getMultiplier$3(decimals);
|
|
11384
11384
|
// Make sure wei is a big number (convert as necessary)
|
|
11385
11385
|
value = BigNumber$4.from(value);
|
|
11386
11386
|
const negative = value.lt(Zero$6);
|
|
@@ -11405,11 +11405,11 @@
|
|
|
11405
11405
|
}
|
|
11406
11406
|
return value;
|
|
11407
11407
|
}
|
|
11408
|
-
function parseFixed$
|
|
11408
|
+
function parseFixed$3(value, decimals) {
|
|
11409
11409
|
if (decimals == null) {
|
|
11410
11410
|
decimals = 0;
|
|
11411
11411
|
}
|
|
11412
|
-
const multiplier = getMultiplier$
|
|
11412
|
+
const multiplier = getMultiplier$3(decimals);
|
|
11413
11413
|
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
|
|
11414
11414
|
logger$H.throwArgumentError("invalid decimal value", "value", value);
|
|
11415
11415
|
}
|
|
@@ -11457,7 +11457,7 @@
|
|
|
11457
11457
|
}
|
|
11458
11458
|
return wei;
|
|
11459
11459
|
}
|
|
11460
|
-
class FixedFormat$
|
|
11460
|
+
class FixedFormat$3 {
|
|
11461
11461
|
constructor(constructorGuard, signed, width, decimals) {
|
|
11462
11462
|
if (constructorGuard !== _constructorGuard$8) {
|
|
11463
11463
|
logger$H.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$4.errors.UNSUPPORTED_OPERATION, {
|
|
@@ -11468,11 +11468,11 @@
|
|
|
11468
11468
|
this.width = width;
|
|
11469
11469
|
this.decimals = decimals;
|
|
11470
11470
|
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
11471
|
-
this._multiplier = getMultiplier$
|
|
11471
|
+
this._multiplier = getMultiplier$3(decimals);
|
|
11472
11472
|
Object.freeze(this);
|
|
11473
11473
|
}
|
|
11474
11474
|
static from(value) {
|
|
11475
|
-
if (value instanceof FixedFormat$
|
|
11475
|
+
if (value instanceof FixedFormat$3) {
|
|
11476
11476
|
return value;
|
|
11477
11477
|
}
|
|
11478
11478
|
if (typeof (value) === "number") {
|
|
@@ -11516,12 +11516,12 @@
|
|
|
11516
11516
|
if (decimals > 80) {
|
|
11517
11517
|
logger$H.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
11518
11518
|
}
|
|
11519
|
-
return new FixedFormat$
|
|
11519
|
+
return new FixedFormat$3(_constructorGuard$8, signed, width, decimals);
|
|
11520
11520
|
}
|
|
11521
11521
|
}
|
|
11522
|
-
class FixedNumber$
|
|
11522
|
+
class FixedNumber$3 {
|
|
11523
11523
|
constructor(constructorGuard, hex, value, format) {
|
|
11524
|
-
logger$H.checkNew(new.target, FixedNumber$
|
|
11524
|
+
logger$H.checkNew(new.target, FixedNumber$3);
|
|
11525
11525
|
if (constructorGuard !== _constructorGuard$8) {
|
|
11526
11526
|
logger$H.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$4.errors.UNSUPPORTED_OPERATION, {
|
|
11527
11527
|
operation: "new FixedFormat"
|
|
@@ -11540,37 +11540,37 @@
|
|
|
11540
11540
|
}
|
|
11541
11541
|
addUnsafe(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.add(b), this.format.decimals, this.format);
|
|
11546
11546
|
}
|
|
11547
11547
|
subUnsafe(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.sub(b), this.format.decimals, this.format);
|
|
11552
11552
|
}
|
|
11553
11553
|
mulUnsafe(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(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
11558
11558
|
}
|
|
11559
11559
|
divUnsafe(other) {
|
|
11560
11560
|
this._checkFormat(other);
|
|
11561
|
-
const a = parseFixed$
|
|
11562
|
-
const b = parseFixed$
|
|
11563
|
-
return FixedNumber$
|
|
11561
|
+
const a = parseFixed$3(this._value, this.format.decimals);
|
|
11562
|
+
const b = parseFixed$3(other._value, other.format.decimals);
|
|
11563
|
+
return FixedNumber$3.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
11564
11564
|
}
|
|
11565
11565
|
floor() {
|
|
11566
11566
|
const comps = this.toString().split(".");
|
|
11567
11567
|
if (comps.length === 1) {
|
|
11568
11568
|
comps.push("0");
|
|
11569
11569
|
}
|
|
11570
|
-
let result = FixedNumber$
|
|
11570
|
+
let result = FixedNumber$3.from(comps[0], this.format);
|
|
11571
11571
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
11572
11572
|
if (this.isNegative() && hasFraction) {
|
|
11573
|
-
result = result.subUnsafe(ONE$
|
|
11573
|
+
result = result.subUnsafe(ONE$3.toFormat(result.format));
|
|
11574
11574
|
}
|
|
11575
11575
|
return result;
|
|
11576
11576
|
}
|
|
@@ -11579,10 +11579,10 @@
|
|
|
11579
11579
|
if (comps.length === 1) {
|
|
11580
11580
|
comps.push("0");
|
|
11581
11581
|
}
|
|
11582
|
-
let result = FixedNumber$
|
|
11582
|
+
let result = FixedNumber$3.from(comps[0], this.format);
|
|
11583
11583
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
11584
11584
|
if (!this.isNegative() && hasFraction) {
|
|
11585
|
-
result = result.addUnsafe(ONE$
|
|
11585
|
+
result = result.addUnsafe(ONE$3.toFormat(result.format));
|
|
11586
11586
|
}
|
|
11587
11587
|
return result;
|
|
11588
11588
|
}
|
|
@@ -11602,8 +11602,8 @@
|
|
|
11602
11602
|
if (comps[1].length <= decimals) {
|
|
11603
11603
|
return this;
|
|
11604
11604
|
}
|
|
11605
|
-
const factor = FixedNumber$
|
|
11606
|
-
const bump = BUMP$
|
|
11605
|
+
const factor = FixedNumber$3.from("1" + zeros$3.substring(0, decimals), this.format);
|
|
11606
|
+
const bump = BUMP$3.toFormat(this.format);
|
|
11607
11607
|
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
11608
11608
|
}
|
|
11609
11609
|
isZero() {
|
|
@@ -11621,15 +11621,15 @@
|
|
|
11621
11621
|
logger$H.throwArgumentError("invalid byte width", "width", width);
|
|
11622
11622
|
}
|
|
11623
11623
|
const hex = BigNumber$4.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
11624
|
-
return hexZeroPad$
|
|
11624
|
+
return hexZeroPad$4(hex, width / 8);
|
|
11625
11625
|
}
|
|
11626
11626
|
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
11627
11627
|
toFormat(format) {
|
|
11628
|
-
return FixedNumber$
|
|
11628
|
+
return FixedNumber$3.fromString(this._value, format);
|
|
11629
11629
|
}
|
|
11630
11630
|
static fromValue(value, decimals, format) {
|
|
11631
11631
|
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
11632
|
-
if (format == null && decimals != null && !isBigNumberish$
|
|
11632
|
+
if (format == null && decimals != null && !isBigNumberish$3(decimals)) {
|
|
11633
11633
|
format = decimals;
|
|
11634
11634
|
decimals = null;
|
|
11635
11635
|
}
|
|
@@ -11639,14 +11639,14 @@
|
|
|
11639
11639
|
if (format == null) {
|
|
11640
11640
|
format = "fixed";
|
|
11641
11641
|
}
|
|
11642
|
-
return FixedNumber$
|
|
11642
|
+
return FixedNumber$3.fromString(formatFixed$3(value, decimals), FixedFormat$3.from(format));
|
|
11643
11643
|
}
|
|
11644
11644
|
static fromString(value, format) {
|
|
11645
11645
|
if (format == null) {
|
|
11646
11646
|
format = "fixed";
|
|
11647
11647
|
}
|
|
11648
|
-
const fixedFormat = FixedFormat$
|
|
11649
|
-
const numeric = parseFixed$
|
|
11648
|
+
const fixedFormat = FixedFormat$3.from(format);
|
|
11649
|
+
const numeric = parseFixed$3(value, fixedFormat.decimals);
|
|
11650
11650
|
if (!fixedFormat.signed && numeric.lt(Zero$6)) {
|
|
11651
11651
|
throwFault$5("unsigned value cannot be negative", "overflow", "value", value);
|
|
11652
11652
|
}
|
|
@@ -11656,17 +11656,17 @@
|
|
|
11656
11656
|
}
|
|
11657
11657
|
else {
|
|
11658
11658
|
hex = numeric.toHexString();
|
|
11659
|
-
hex = hexZeroPad$
|
|
11659
|
+
hex = hexZeroPad$4(hex, fixedFormat.width / 8);
|
|
11660
11660
|
}
|
|
11661
|
-
const decimal = formatFixed$
|
|
11662
|
-
return new FixedNumber$
|
|
11661
|
+
const decimal = formatFixed$3(numeric, fixedFormat.decimals);
|
|
11662
|
+
return new FixedNumber$3(_constructorGuard$8, hex, decimal, fixedFormat);
|
|
11663
11663
|
}
|
|
11664
11664
|
static fromBytes(value, format) {
|
|
11665
11665
|
if (format == null) {
|
|
11666
11666
|
format = "fixed";
|
|
11667
11667
|
}
|
|
11668
|
-
const fixedFormat = FixedFormat$
|
|
11669
|
-
if (arrayify$
|
|
11668
|
+
const fixedFormat = FixedFormat$3.from(format);
|
|
11669
|
+
if (arrayify$4(value).length > fixedFormat.width / 8) {
|
|
11670
11670
|
throw new Error("overflow");
|
|
11671
11671
|
}
|
|
11672
11672
|
let numeric = BigNumber$4.from(value);
|
|
@@ -11674,18 +11674,18 @@
|
|
|
11674
11674
|
numeric = numeric.fromTwos(fixedFormat.width);
|
|
11675
11675
|
}
|
|
11676
11676
|
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
11677
|
-
const decimal = formatFixed$
|
|
11678
|
-
return new FixedNumber$
|
|
11677
|
+
const decimal = formatFixed$3(numeric, fixedFormat.decimals);
|
|
11678
|
+
return new FixedNumber$3(_constructorGuard$8, hex, decimal, fixedFormat);
|
|
11679
11679
|
}
|
|
11680
11680
|
static from(value, format) {
|
|
11681
11681
|
if (typeof (value) === "string") {
|
|
11682
|
-
return FixedNumber$
|
|
11682
|
+
return FixedNumber$3.fromString(value, format);
|
|
11683
11683
|
}
|
|
11684
11684
|
if (isBytes$4(value)) {
|
|
11685
|
-
return FixedNumber$
|
|
11685
|
+
return FixedNumber$3.fromBytes(value, format);
|
|
11686
11686
|
}
|
|
11687
11687
|
try {
|
|
11688
|
-
return FixedNumber$
|
|
11688
|
+
return FixedNumber$3.fromValue(value, 0, format);
|
|
11689
11689
|
}
|
|
11690
11690
|
catch (error) {
|
|
11691
11691
|
// Allow NUMERIC_FAULT to bubble up
|
|
@@ -11699,8 +11699,8 @@
|
|
|
11699
11699
|
return !!(value && value._isFixedNumber);
|
|
11700
11700
|
}
|
|
11701
11701
|
}
|
|
11702
|
-
const ONE$
|
|
11703
|
-
const BUMP$
|
|
11702
|
+
const ONE$3 = FixedNumber$3.from(1);
|
|
11703
|
+
const BUMP$3 = FixedNumber$3.from("0.5");
|
|
11704
11704
|
|
|
11705
11705
|
const version$v = "properties/5.5.0";
|
|
11706
11706
|
|
|
@@ -12722,7 +12722,7 @@
|
|
|
12722
12722
|
}
|
|
12723
12723
|
// Arrayish items; padded on the right to wordSize
|
|
12724
12724
|
writeBytes(value) {
|
|
12725
|
-
let bytes = arrayify$
|
|
12725
|
+
let bytes = arrayify$4(value);
|
|
12726
12726
|
const paddingOffset = bytes.length % this.wordSize;
|
|
12727
12727
|
if (paddingOffset) {
|
|
12728
12728
|
bytes = concat$2([bytes, this._padding.slice(paddingOffset)]);
|
|
@@ -12730,7 +12730,7 @@
|
|
|
12730
12730
|
return this._writeData(bytes);
|
|
12731
12731
|
}
|
|
12732
12732
|
_getValue(value) {
|
|
12733
|
-
let bytes = arrayify$
|
|
12733
|
+
let bytes = arrayify$4(BigNumber$4.from(value));
|
|
12734
12734
|
if (bytes.length > this.wordSize) {
|
|
12735
12735
|
logger$E.throwError("value out-of-bounds", Logger$4.errors.BUFFER_OVERRUN, {
|
|
12736
12736
|
length: this.wordSize,
|
|
@@ -12757,7 +12757,7 @@
|
|
|
12757
12757
|
}
|
|
12758
12758
|
class Reader$1 {
|
|
12759
12759
|
constructor(data, wordSize, coerceFunc, allowLoose) {
|
|
12760
|
-
defineReadOnly$2(this, "_data", arrayify$
|
|
12760
|
+
defineReadOnly$2(this, "_data", arrayify$4(data));
|
|
12761
12761
|
defineReadOnly$2(this, "wordSize", wordSize || 32);
|
|
12762
12762
|
defineReadOnly$2(this, "_coerceFunc", coerceFunc);
|
|
12763
12763
|
defineReadOnly$2(this, "allowLoose", allowLoose);
|
|
@@ -13455,7 +13455,7 @@
|
|
|
13455
13455
|
var sha3$5 = sha3$4;
|
|
13456
13456
|
|
|
13457
13457
|
function keccak256$3(data) {
|
|
13458
|
-
return '0x' + sha3$5.keccak_256(arrayify$
|
|
13458
|
+
return '0x' + sha3$5.keccak_256(arrayify$4(data));
|
|
13459
13459
|
}
|
|
13460
13460
|
|
|
13461
13461
|
const version$t = "rlp/5.5.0";
|
|
@@ -13486,7 +13486,7 @@
|
|
|
13486
13486
|
if (!isBytesLike$2(object)) {
|
|
13487
13487
|
logger$D.throwArgumentError("RLP object must be BytesLike", "object", object);
|
|
13488
13488
|
}
|
|
13489
|
-
const data = Array.prototype.slice.call(arrayify$
|
|
13489
|
+
const data = Array.prototype.slice.call(arrayify$4(object));
|
|
13490
13490
|
if (data.length === 1 && data[0] <= 0x7f) {
|
|
13491
13491
|
return data;
|
|
13492
13492
|
}
|
|
@@ -13515,7 +13515,7 @@
|
|
|
13515
13515
|
for (let i = 0; i < 40; i++) {
|
|
13516
13516
|
expanded[i] = chars[i].charCodeAt(0);
|
|
13517
13517
|
}
|
|
13518
|
-
const hashed = arrayify$
|
|
13518
|
+
const hashed = arrayify$4(keccak256$3(expanded));
|
|
13519
13519
|
for (let i = 0; i < 40; i += 2) {
|
|
13520
13520
|
if ((hashed[i >> 1] >> 4) >= 8) {
|
|
13521
13521
|
chars[i] = chars[i].toUpperCase();
|
|
@@ -13602,7 +13602,7 @@
|
|
|
13602
13602
|
catch (error) {
|
|
13603
13603
|
logger$C.throwArgumentError("missing from address", "transaction", transaction);
|
|
13604
13604
|
}
|
|
13605
|
-
const nonce = stripZeros$2(arrayify$
|
|
13605
|
+
const nonce = stripZeros$2(arrayify$4(BigNumber$4.from(transaction.nonce).toHexString()));
|
|
13606
13606
|
return getAddress$3(hexDataSlice$2(keccak256$3(encode$4([from, nonce])), 12));
|
|
13607
13607
|
}
|
|
13608
13608
|
|
|
@@ -13623,7 +13623,7 @@
|
|
|
13623
13623
|
return writer.writeValue(value);
|
|
13624
13624
|
}
|
|
13625
13625
|
decode(reader) {
|
|
13626
|
-
return getAddress$3(hexZeroPad$
|
|
13626
|
+
return getAddress$3(hexZeroPad$4(reader.readValue().toHexString(), 20));
|
|
13627
13627
|
}
|
|
13628
13628
|
}
|
|
13629
13629
|
|
|
@@ -13871,7 +13871,7 @@
|
|
|
13871
13871
|
return "0x";
|
|
13872
13872
|
}
|
|
13873
13873
|
encode(writer, value) {
|
|
13874
|
-
value = arrayify$
|
|
13874
|
+
value = arrayify$4(value);
|
|
13875
13875
|
let length = writer.writeValue(value.length);
|
|
13876
13876
|
length += writer.writeBytes(value);
|
|
13877
13877
|
return length;
|
|
@@ -13900,7 +13900,7 @@
|
|
|
13900
13900
|
return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2);
|
|
13901
13901
|
}
|
|
13902
13902
|
encode(writer, value) {
|
|
13903
|
-
let data = arrayify$
|
|
13903
|
+
let data = arrayify$4(value);
|
|
13904
13904
|
if (data.length !== this.size) {
|
|
13905
13905
|
this._throwError("incorrect data length", value);
|
|
13906
13906
|
}
|
|
@@ -14057,7 +14057,7 @@
|
|
|
14057
14057
|
if (onError == null) {
|
|
14058
14058
|
onError = Utf8ErrorFuncs$2.error;
|
|
14059
14059
|
}
|
|
14060
|
-
bytes = arrayify$
|
|
14060
|
+
bytes = arrayify$4(bytes);
|
|
14061
14061
|
const result = [];
|
|
14062
14062
|
let i = 0;
|
|
14063
14063
|
// Invalid bytes are ignored
|
|
@@ -14171,7 +14171,7 @@
|
|
|
14171
14171
|
result.push((c & 0x3f) | 0x80);
|
|
14172
14172
|
}
|
|
14173
14173
|
}
|
|
14174
|
-
return arrayify$
|
|
14174
|
+
return arrayify$4(result);
|
|
14175
14175
|
}
|
|
14176
14176
|
function _toUtf8String$2(codePoints) {
|
|
14177
14177
|
return codePoints.map((codePoint) => {
|
|
@@ -14330,7 +14330,7 @@
|
|
|
14330
14330
|
decode(types, data, loose) {
|
|
14331
14331
|
const coders = types.map((type) => this._getCoder(ParamType$1.from(type)));
|
|
14332
14332
|
const coder = new TupleCoder$1(coders, "_");
|
|
14333
|
-
return coder.decode(this._getReader(arrayify$
|
|
14333
|
+
return coder.decode(this._getReader(arrayify$4(data), loose));
|
|
14334
14334
|
}
|
|
14335
14335
|
}
|
|
14336
14336
|
const defaultAbiCoder$1 = new AbiCoder$1();
|
|
@@ -14588,7 +14588,7 @@
|
|
|
14588
14588
|
if (typeof (fragment) === "string") {
|
|
14589
14589
|
fragment = this.getError(fragment);
|
|
14590
14590
|
}
|
|
14591
|
-
const bytes = arrayify$
|
|
14591
|
+
const bytes = arrayify$4(data);
|
|
14592
14592
|
if (hexlify$4(bytes.slice(0, 4)) !== this.getSighash(fragment)) {
|
|
14593
14593
|
logger$y.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify$4(bytes));
|
|
14594
14594
|
}
|
|
@@ -14608,7 +14608,7 @@
|
|
|
14608
14608
|
if (typeof (functionFragment) === "string") {
|
|
14609
14609
|
functionFragment = this.getFunction(functionFragment);
|
|
14610
14610
|
}
|
|
14611
|
-
const bytes = arrayify$
|
|
14611
|
+
const bytes = arrayify$4(data);
|
|
14612
14612
|
if (hexlify$4(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {
|
|
14613
14613
|
logger$y.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify$4(bytes));
|
|
14614
14614
|
}
|
|
@@ -14629,7 +14629,7 @@
|
|
|
14629
14629
|
if (typeof (functionFragment) === "string") {
|
|
14630
14630
|
functionFragment = this.getFunction(functionFragment);
|
|
14631
14631
|
}
|
|
14632
|
-
let bytes = arrayify$
|
|
14632
|
+
let bytes = arrayify$4(data);
|
|
14633
14633
|
let reason = null;
|
|
14634
14634
|
let errorArgs = null;
|
|
14635
14635
|
let errorName = null;
|
|
@@ -14704,7 +14704,7 @@
|
|
|
14704
14704
|
if (param.type === "address") {
|
|
14705
14705
|
this._abiCoder.encode(["address"], [value]);
|
|
14706
14706
|
}
|
|
14707
|
-
return hexZeroPad$
|
|
14707
|
+
return hexZeroPad$4(hexlify$4(value), 32);
|
|
14708
14708
|
};
|
|
14709
14709
|
values.forEach((value, index) => {
|
|
14710
14710
|
let param = eventFragment.inputs[index];
|
|
@@ -15467,7 +15467,7 @@
|
|
|
15467
15467
|
// is always a non-nil to address, we can ignore G_create, but may wish to add
|
|
15468
15468
|
// similar logic to the ContractFactory.
|
|
15469
15469
|
let intrinsic = 21000;
|
|
15470
|
-
const bytes = arrayify$
|
|
15470
|
+
const bytes = arrayify$4(data);
|
|
15471
15471
|
for (let i = 0; i < bytes.length; i++) {
|
|
15472
15472
|
intrinsic += 4;
|
|
15473
15473
|
if (bytes[i]) {
|
|
@@ -16202,7 +16202,7 @@
|
|
|
16202
16202
|
const version$m = "units/5.5.0";
|
|
16203
16203
|
|
|
16204
16204
|
const logger$t = new Logger$4(version$m);
|
|
16205
|
-
const names$
|
|
16205
|
+
const names$3 = [
|
|
16206
16206
|
"wei",
|
|
16207
16207
|
"kwei",
|
|
16208
16208
|
"mwei",
|
|
@@ -16213,24 +16213,24 @@
|
|
|
16213
16213
|
];
|
|
16214
16214
|
function formatUnits(value, unitName) {
|
|
16215
16215
|
if (typeof (unitName) === "string") {
|
|
16216
|
-
const index = names$
|
|
16216
|
+
const index = names$3.indexOf(unitName);
|
|
16217
16217
|
if (index !== -1) {
|
|
16218
16218
|
unitName = 3 * index;
|
|
16219
16219
|
}
|
|
16220
16220
|
}
|
|
16221
|
-
return formatFixed$
|
|
16221
|
+
return formatFixed$3(value, (unitName != null) ? unitName : 18);
|
|
16222
16222
|
}
|
|
16223
|
-
function parseUnits$
|
|
16223
|
+
function parseUnits$3(value, unitName) {
|
|
16224
16224
|
if (typeof (value) !== "string") {
|
|
16225
16225
|
logger$t.throwArgumentError("value must be a string", "value", value);
|
|
16226
16226
|
}
|
|
16227
16227
|
if (typeof (unitName) === "string") {
|
|
16228
|
-
const index = names$
|
|
16228
|
+
const index = names$3.indexOf(unitName);
|
|
16229
16229
|
if (index !== -1) {
|
|
16230
16230
|
unitName = 3 * index;
|
|
16231
16231
|
}
|
|
16232
16232
|
}
|
|
16233
|
-
return parseFixed$
|
|
16233
|
+
return parseFixed$3(value, (unitName != null) ? unitName : 18);
|
|
16234
16234
|
}
|
|
16235
16235
|
|
|
16236
16236
|
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 = () => {
|
|
@@ -16784,13 +16784,13 @@
|
|
|
16784
16784
|
function isHexable$3(value) {
|
|
16785
16785
|
return !!(value.toHexString);
|
|
16786
16786
|
}
|
|
16787
|
-
function addSlice$
|
|
16787
|
+
function addSlice$3(array) {
|
|
16788
16788
|
if (array.slice) {
|
|
16789
16789
|
return array;
|
|
16790
16790
|
}
|
|
16791
16791
|
array.slice = function () {
|
|
16792
16792
|
const args = Array.prototype.slice.call(arguments);
|
|
16793
|
-
return addSlice$
|
|
16793
|
+
return addSlice$3(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
16794
16794
|
};
|
|
16795
16795
|
return array;
|
|
16796
16796
|
}
|
|
@@ -16818,7 +16818,7 @@
|
|
|
16818
16818
|
}
|
|
16819
16819
|
return true;
|
|
16820
16820
|
}
|
|
16821
|
-
function arrayify$
|
|
16821
|
+
function arrayify$3(value, options) {
|
|
16822
16822
|
if (!options) {
|
|
16823
16823
|
options = {};
|
|
16824
16824
|
}
|
|
@@ -16832,7 +16832,7 @@
|
|
|
16832
16832
|
if (result.length === 0) {
|
|
16833
16833
|
result.push(0);
|
|
16834
16834
|
}
|
|
16835
|
-
return addSlice$
|
|
16835
|
+
return addSlice$3(new Uint8Array(result));
|
|
16836
16836
|
}
|
|
16837
16837
|
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
16838
16838
|
value = "0x" + value;
|
|
@@ -16857,25 +16857,25 @@
|
|
|
16857
16857
|
for (let i = 0; i < hex.length; i += 2) {
|
|
16858
16858
|
result.push(parseInt(hex.substring(i, i + 2), 16));
|
|
16859
16859
|
}
|
|
16860
|
-
return addSlice$
|
|
16860
|
+
return addSlice$3(new Uint8Array(result));
|
|
16861
16861
|
}
|
|
16862
16862
|
if (isBytes$3(value)) {
|
|
16863
|
-
return addSlice$
|
|
16863
|
+
return addSlice$3(new Uint8Array(value));
|
|
16864
16864
|
}
|
|
16865
16865
|
return logger$f$1.throwArgumentError("invalid arrayify value", "value", value);
|
|
16866
16866
|
}
|
|
16867
16867
|
function concat$1(items) {
|
|
16868
|
-
const objects = items.map(item => arrayify$
|
|
16868
|
+
const objects = items.map(item => arrayify$3(item));
|
|
16869
16869
|
const length = objects.reduce((accum, item) => (accum + item.length), 0);
|
|
16870
16870
|
const result = new Uint8Array(length);
|
|
16871
16871
|
objects.reduce((offset, object) => {
|
|
16872
16872
|
result.set(object, offset);
|
|
16873
16873
|
return offset + object.length;
|
|
16874
16874
|
}, 0);
|
|
16875
|
-
return addSlice$
|
|
16875
|
+
return addSlice$3(result);
|
|
16876
16876
|
}
|
|
16877
16877
|
function stripZeros$1(value) {
|
|
16878
|
-
let result = arrayify$
|
|
16878
|
+
let result = arrayify$3(value);
|
|
16879
16879
|
if (result.length === 0) {
|
|
16880
16880
|
return result;
|
|
16881
16881
|
}
|
|
@@ -16891,13 +16891,13 @@
|
|
|
16891
16891
|
return result;
|
|
16892
16892
|
}
|
|
16893
16893
|
function zeroPad$1(value, length) {
|
|
16894
|
-
value = arrayify$
|
|
16894
|
+
value = arrayify$3(value);
|
|
16895
16895
|
if (value.length > length) {
|
|
16896
16896
|
logger$f$1.throwArgumentError("value out of range", "value", arguments[0]);
|
|
16897
16897
|
}
|
|
16898
16898
|
const result = new Uint8Array(length);
|
|
16899
16899
|
result.set(value, length - value.length);
|
|
16900
|
-
return addSlice$
|
|
16900
|
+
return addSlice$3(result);
|
|
16901
16901
|
}
|
|
16902
16902
|
function isHexString$3(value, length) {
|
|
16903
16903
|
if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
|
|
@@ -17023,7 +17023,7 @@
|
|
|
17023
17023
|
}
|
|
17024
17024
|
return "0x" + value.substring(offset);
|
|
17025
17025
|
}
|
|
17026
|
-
function hexZeroPad$
|
|
17026
|
+
function hexZeroPad$3(value, length) {
|
|
17027
17027
|
if (typeof (value) !== "string") {
|
|
17028
17028
|
value = hexlify$3(value);
|
|
17029
17029
|
}
|
|
@@ -17047,7 +17047,7 @@
|
|
|
17047
17047
|
v: 0
|
|
17048
17048
|
};
|
|
17049
17049
|
if (isBytesLike$1(signature)) {
|
|
17050
|
-
const bytes = arrayify$
|
|
17050
|
+
const bytes = arrayify$3(signature);
|
|
17051
17051
|
if (bytes.length !== 65) {
|
|
17052
17052
|
logger$f$1.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
|
|
17053
17053
|
}
|
|
@@ -17081,7 +17081,7 @@
|
|
|
17081
17081
|
// If the _vs is available, use it to populate missing s, v and recoveryParam
|
|
17082
17082
|
// and verify non-missing s, v and recoveryParam
|
|
17083
17083
|
if (result._vs != null) {
|
|
17084
|
-
const vs = zeroPad$1(arrayify$
|
|
17084
|
+
const vs = zeroPad$1(arrayify$3(result._vs), 32);
|
|
17085
17085
|
result._vs = hexlify$3(vs);
|
|
17086
17086
|
// Set or check the recid
|
|
17087
17087
|
const recoveryParam = ((vs[0] >= 128) ? 1 : 0);
|
|
@@ -17125,15 +17125,15 @@
|
|
|
17125
17125
|
logger$f$1.throwArgumentError("signature missing or invalid r", "signature", signature);
|
|
17126
17126
|
}
|
|
17127
17127
|
else {
|
|
17128
|
-
result.r = hexZeroPad$
|
|
17128
|
+
result.r = hexZeroPad$3(result.r, 32);
|
|
17129
17129
|
}
|
|
17130
17130
|
if (result.s == null || !isHexString$3(result.s)) {
|
|
17131
17131
|
logger$f$1.throwArgumentError("signature missing or invalid s", "signature", signature);
|
|
17132
17132
|
}
|
|
17133
17133
|
else {
|
|
17134
|
-
result.s = hexZeroPad$
|
|
17134
|
+
result.s = hexZeroPad$3(result.s, 32);
|
|
17135
17135
|
}
|
|
17136
|
-
const vs = arrayify$
|
|
17136
|
+
const vs = arrayify$3(result.s);
|
|
17137
17137
|
if (vs[0] >= 128) {
|
|
17138
17138
|
logger$f$1.throwArgumentError("signature s out of range", "signature", signature);
|
|
17139
17139
|
}
|
|
@@ -17145,7 +17145,7 @@
|
|
|
17145
17145
|
if (!isHexString$3(result._vs)) {
|
|
17146
17146
|
logger$f$1.throwArgumentError("signature invalid _vs", "signature", signature);
|
|
17147
17147
|
}
|
|
17148
|
-
result._vs = hexZeroPad$
|
|
17148
|
+
result._vs = hexZeroPad$3(result._vs, 32);
|
|
17149
17149
|
}
|
|
17150
17150
|
// Set or check the _vs
|
|
17151
17151
|
if (result._vs == null) {
|
|
@@ -17159,7 +17159,7 @@
|
|
|
17159
17159
|
}
|
|
17160
17160
|
|
|
17161
17161
|
function encode$2$1(data) {
|
|
17162
|
-
data = arrayify$
|
|
17162
|
+
data = arrayify$3(data);
|
|
17163
17163
|
let textData = "";
|
|
17164
17164
|
for (let i = 0; i < data.length; i++) {
|
|
17165
17165
|
textData += String.fromCharCode(data[i]);
|
|
@@ -20626,14 +20626,14 @@
|
|
|
20626
20626
|
|
|
20627
20627
|
var BN$3 = bn$3.BN;
|
|
20628
20628
|
const logger$e$1 = new Logger$3(version$c$1);
|
|
20629
|
-
const _constructorGuard$1$
|
|
20629
|
+
const _constructorGuard$1$3 = {};
|
|
20630
20630
|
const MAX_SAFE$3 = 0x1fffffffffffff;
|
|
20631
20631
|
// Only warn about passing 10 into radix once
|
|
20632
20632
|
let _warnedToStringRadix$3 = false;
|
|
20633
20633
|
class BigNumber$3 {
|
|
20634
20634
|
constructor(constructorGuard, hex) {
|
|
20635
20635
|
logger$e$1.checkNew(new.target, BigNumber$3);
|
|
20636
|
-
if (constructorGuard !== _constructorGuard$1$
|
|
20636
|
+
if (constructorGuard !== _constructorGuard$1$3) {
|
|
20637
20637
|
logger$e$1.throwError("cannot call constructor directly; use BigNumber.from", Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
20638
20638
|
operation: "new (BigNumber)"
|
|
20639
20639
|
});
|
|
@@ -20792,10 +20792,10 @@
|
|
|
20792
20792
|
}
|
|
20793
20793
|
if (typeof (value) === "string") {
|
|
20794
20794
|
if (value.match(/^-?0x[0-9a-f]+$/i)) {
|
|
20795
|
-
return new BigNumber$3(_constructorGuard$1$
|
|
20795
|
+
return new BigNumber$3(_constructorGuard$1$3, toHex$1$2(value));
|
|
20796
20796
|
}
|
|
20797
20797
|
if (value.match(/^-?[0-9]+$/)) {
|
|
20798
|
-
return new BigNumber$3(_constructorGuard$1$
|
|
20798
|
+
return new BigNumber$3(_constructorGuard$1$3, toHex$1$2(new BN$3(value)));
|
|
20799
20799
|
}
|
|
20800
20800
|
return logger$e$1.throwArgumentError("invalid BigNumber string", "value", value);
|
|
20801
20801
|
}
|
|
@@ -20906,7 +20906,7 @@
|
|
|
20906
20906
|
return (new BN$3(value, 36)).toString(16);
|
|
20907
20907
|
}
|
|
20908
20908
|
|
|
20909
|
-
const Zero$1$
|
|
20909
|
+
const Zero$1$2 = ( /*#__PURE__*/BigNumber$3.from(0));
|
|
20910
20910
|
|
|
20911
20911
|
const HashZero$1 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
20912
20912
|
|
|
@@ -20994,7 +20994,7 @@
|
|
|
20994
20994
|
if (onError == null) {
|
|
20995
20995
|
onError = Utf8ErrorFuncs$1.error;
|
|
20996
20996
|
}
|
|
20997
|
-
bytes = arrayify$
|
|
20997
|
+
bytes = arrayify$3(bytes);
|
|
20998
20998
|
const result = [];
|
|
20999
20999
|
let i = 0;
|
|
21000
21000
|
// Invalid bytes are ignored
|
|
@@ -21108,7 +21108,7 @@
|
|
|
21108
21108
|
result.push((c & 0x3f) | 0x80);
|
|
21109
21109
|
}
|
|
21110
21110
|
}
|
|
21111
|
-
return arrayify$
|
|
21111
|
+
return arrayify$3(result);
|
|
21112
21112
|
}
|
|
21113
21113
|
function _toUtf8String$1(codePoints) {
|
|
21114
21114
|
return codePoints.map((codePoint) => {
|
|
@@ -21355,7 +21355,7 @@
|
|
|
21355
21355
|
headers: headers,
|
|
21356
21356
|
statusCode: response.status,
|
|
21357
21357
|
statusMessage: response.statusText,
|
|
21358
|
-
body: arrayify$
|
|
21358
|
+
body: arrayify$3(new Uint8Array(body)),
|
|
21359
21359
|
};
|
|
21360
21360
|
});
|
|
21361
21361
|
}
|
|
@@ -22034,7 +22034,7 @@
|
|
|
22034
22034
|
}
|
|
22035
22035
|
}
|
|
22036
22036
|
encode(value) {
|
|
22037
|
-
let source = arrayify$
|
|
22037
|
+
let source = arrayify$3(value);
|
|
22038
22038
|
if (source.length === 0) {
|
|
22039
22039
|
return "";
|
|
22040
22040
|
}
|
|
@@ -22091,7 +22091,7 @@
|
|
|
22091
22091
|
for (let k = 0; value[k] === this._leader && k < value.length - 1; ++k) {
|
|
22092
22092
|
bytes.push(0);
|
|
22093
22093
|
}
|
|
22094
|
-
return arrayify$
|
|
22094
|
+
return arrayify$3(new Uint8Array(bytes.reverse()));
|
|
22095
22095
|
}
|
|
22096
22096
|
}
|
|
22097
22097
|
new BaseX$1("abcdefghijklmnopqrstuvwxyz234567");
|
|
@@ -22580,7 +22580,7 @@
|
|
|
22580
22580
|
var sha3$1$2 = sha3$3;
|
|
22581
22581
|
|
|
22582
22582
|
function keccak256$2(data) {
|
|
22583
|
-
return '0x' + sha3$1$2.keccak_256(arrayify$
|
|
22583
|
+
return '0x' + sha3$1$2.keccak_256(arrayify$3(data));
|
|
22584
22584
|
}
|
|
22585
22585
|
|
|
22586
22586
|
function id$1(text) {
|
|
@@ -22647,7 +22647,7 @@
|
|
|
22647
22647
|
if (!isBytesLike$1(object)) {
|
|
22648
22648
|
logger$8$1.throwArgumentError("RLP object must be BytesLike", "object", object);
|
|
22649
22649
|
}
|
|
22650
|
-
const data = Array.prototype.slice.call(arrayify$
|
|
22650
|
+
const data = Array.prototype.slice.call(arrayify$3(object));
|
|
22651
22651
|
if (data.length === 1 && data[0] <= 0x7f) {
|
|
22652
22652
|
return data;
|
|
22653
22653
|
}
|
|
@@ -22721,7 +22721,7 @@
|
|
|
22721
22721
|
return { consumed: 1, result: hexlify$3(data[offset]) };
|
|
22722
22722
|
}
|
|
22723
22723
|
function decode$1$1(data) {
|
|
22724
|
-
const bytes = arrayify$
|
|
22724
|
+
const bytes = arrayify$3(data);
|
|
22725
22725
|
const decoded = _decode$1(bytes, 0);
|
|
22726
22726
|
if (decoded.consumed !== bytes.length) {
|
|
22727
22727
|
logger$8$1.throwArgumentError("invalid rlp data", "data", data);
|
|
@@ -22742,7 +22742,7 @@
|
|
|
22742
22742
|
for (let i = 0; i < 40; i++) {
|
|
22743
22743
|
expanded[i] = chars[i].charCodeAt(0);
|
|
22744
22744
|
}
|
|
22745
|
-
const hashed = arrayify$
|
|
22745
|
+
const hashed = arrayify$3(keccak256$2(expanded));
|
|
22746
22746
|
for (let i = 0; i < 40; i += 2) {
|
|
22747
22747
|
if ((hashed[i >> 1] >> 4) >= 8) {
|
|
22748
22748
|
chars[i] = chars[i].toUpperCase();
|
|
@@ -22829,7 +22829,7 @@
|
|
|
22829
22829
|
catch (error) {
|
|
22830
22830
|
logger$7$1.throwArgumentError("missing from address", "transaction", transaction);
|
|
22831
22831
|
}
|
|
22832
|
-
const nonce = stripZeros$1(arrayify$
|
|
22832
|
+
const nonce = stripZeros$1(arrayify$3(BigNumber$3.from(transaction.nonce).toHexString()));
|
|
22833
22833
|
return getAddress$2(hexDataSlice$1(keccak256$2(encode$1$1([from, nonce])), 12));
|
|
22834
22834
|
}
|
|
22835
22835
|
|
|
@@ -22850,15 +22850,15 @@
|
|
|
22850
22850
|
const One$2 = BigNumber$3.from(1);
|
|
22851
22851
|
const MaxUint256$2 = BigNumber$3.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
|
22852
22852
|
function hexPadRight$1(value) {
|
|
22853
|
-
const bytes = arrayify$
|
|
22853
|
+
const bytes = arrayify$3(value);
|
|
22854
22854
|
const padOffset = bytes.length % 32;
|
|
22855
22855
|
if (padOffset) {
|
|
22856
22856
|
return hexConcat$1([bytes, padding$1.slice(padOffset)]);
|
|
22857
22857
|
}
|
|
22858
22858
|
return hexlify$3(bytes);
|
|
22859
22859
|
}
|
|
22860
|
-
const hexTrue$1 = hexZeroPad$
|
|
22861
|
-
const hexFalse$1 = hexZeroPad$
|
|
22860
|
+
const hexTrue$1 = hexZeroPad$3(One$2.toHexString(), 32);
|
|
22861
|
+
const hexFalse$1 = hexZeroPad$3(Zero$4.toHexString(), 32);
|
|
22862
22862
|
const domainFieldTypes$1 = {
|
|
22863
22863
|
name: "string",
|
|
22864
22864
|
version: "string",
|
|
@@ -22896,7 +22896,7 @@
|
|
|
22896
22896
|
},
|
|
22897
22897
|
salt: function (value) {
|
|
22898
22898
|
try {
|
|
22899
|
-
const bytes = arrayify$
|
|
22899
|
+
const bytes = arrayify$3(value);
|
|
22900
22900
|
if (bytes.length !== 32) {
|
|
22901
22901
|
throw new Error("bad length");
|
|
22902
22902
|
}
|
|
@@ -22923,7 +22923,7 @@
|
|
|
22923
22923
|
if (v.lt(boundsLower) || v.gt(boundsUpper)) {
|
|
22924
22924
|
logger$6$1.throwArgumentError(`value out-of-bounds for ${type}`, "value", value);
|
|
22925
22925
|
}
|
|
22926
|
-
return hexZeroPad$
|
|
22926
|
+
return hexZeroPad$3(v.toTwos(256).toHexString(), 32);
|
|
22927
22927
|
};
|
|
22928
22928
|
}
|
|
22929
22929
|
}
|
|
@@ -22936,7 +22936,7 @@
|
|
|
22936
22936
|
logger$6$1.throwArgumentError("invalid bytes width", "type", type);
|
|
22937
22937
|
}
|
|
22938
22938
|
return function (value) {
|
|
22939
|
-
const bytes = arrayify$
|
|
22939
|
+
const bytes = arrayify$3(value);
|
|
22940
22940
|
if (bytes.length !== width) {
|
|
22941
22941
|
logger$6$1.throwArgumentError(`invalid length for ${type}`, "value", value);
|
|
22942
22942
|
}
|
|
@@ -22946,7 +22946,7 @@
|
|
|
22946
22946
|
}
|
|
22947
22947
|
switch (type) {
|
|
22948
22948
|
case "address": return function (value) {
|
|
22949
|
-
return hexZeroPad$
|
|
22949
|
+
return hexZeroPad$3(getAddress$2(value), 32);
|
|
22950
22950
|
};
|
|
22951
22951
|
case "bool": return function (value) {
|
|
22952
22952
|
return ((!value) ? hexFalse$1 : hexTrue$1);
|
|
@@ -23243,7 +23243,7 @@
|
|
|
23243
23243
|
message: encoder.visit(value, (type, value) => {
|
|
23244
23244
|
// bytes
|
|
23245
23245
|
if (type.match(/^bytes(\d*)/)) {
|
|
23246
|
-
return hexlify$3(arrayify$
|
|
23246
|
+
return hexlify$3(arrayify$3(value));
|
|
23247
23247
|
}
|
|
23248
23248
|
// uint or int
|
|
23249
23249
|
if (type.match(/^u?int/)) {
|
|
@@ -24548,7 +24548,7 @@
|
|
|
24548
24548
|
|
|
24549
24549
|
new Logger$3(version$4$2);
|
|
24550
24550
|
function sha256$2(data) {
|
|
24551
|
-
return "0x" + (hash$1.sha256().update(arrayify$
|
|
24551
|
+
return "0x" + (hash$1.sha256().update(arrayify$3(data)).digest("hex"));
|
|
24552
24552
|
}
|
|
24553
24553
|
|
|
24554
24554
|
var ALPHABET$1 = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l';
|
|
@@ -24733,7 +24733,7 @@
|
|
|
24733
24733
|
fromWords: fromWords$1
|
|
24734
24734
|
};
|
|
24735
24735
|
|
|
24736
|
-
const version$3$
|
|
24736
|
+
const version$3$3 = "providers/5.4.5";
|
|
24737
24737
|
|
|
24738
24738
|
function createCommonjsModule$3(fn, basedir, module) {
|
|
24739
24739
|
return module = {
|
|
@@ -27175,33 +27175,33 @@
|
|
|
27175
27175
|
constructor(privateKey) {
|
|
27176
27176
|
defineReadOnly$1(this, "curve", "secp256k1");
|
|
27177
27177
|
defineReadOnly$1(this, "privateKey", hexlify$3(privateKey));
|
|
27178
|
-
const keyPair = getCurve$1().keyFromPrivate(arrayify$
|
|
27178
|
+
const keyPair = getCurve$1().keyFromPrivate(arrayify$3(this.privateKey));
|
|
27179
27179
|
defineReadOnly$1(this, "publicKey", "0x" + keyPair.getPublic(false, "hex"));
|
|
27180
27180
|
defineReadOnly$1(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex"));
|
|
27181
27181
|
defineReadOnly$1(this, "_isSigningKey", true);
|
|
27182
27182
|
}
|
|
27183
27183
|
_addPoint(other) {
|
|
27184
|
-
const p0 = getCurve$1().keyFromPublic(arrayify$
|
|
27185
|
-
const p1 = getCurve$1().keyFromPublic(arrayify$
|
|
27184
|
+
const p0 = getCurve$1().keyFromPublic(arrayify$3(this.publicKey));
|
|
27185
|
+
const p1 = getCurve$1().keyFromPublic(arrayify$3(other));
|
|
27186
27186
|
return "0x" + p0.pub.add(p1.pub).encodeCompressed("hex");
|
|
27187
27187
|
}
|
|
27188
27188
|
signDigest(digest) {
|
|
27189
|
-
const keyPair = getCurve$1().keyFromPrivate(arrayify$
|
|
27190
|
-
const digestBytes = arrayify$
|
|
27189
|
+
const keyPair = getCurve$1().keyFromPrivate(arrayify$3(this.privateKey));
|
|
27190
|
+
const digestBytes = arrayify$3(digest);
|
|
27191
27191
|
if (digestBytes.length !== 32) {
|
|
27192
27192
|
logger$5$2.throwArgumentError("bad digest length", "digest", digest);
|
|
27193
27193
|
}
|
|
27194
27194
|
const signature = keyPair.sign(digestBytes, { canonical: true });
|
|
27195
27195
|
return splitSignature$1({
|
|
27196
27196
|
recoveryParam: signature.recoveryParam,
|
|
27197
|
-
r: hexZeroPad$
|
|
27198
|
-
s: hexZeroPad$
|
|
27197
|
+
r: hexZeroPad$3("0x" + signature.r.toString(16), 32),
|
|
27198
|
+
s: hexZeroPad$3("0x" + signature.s.toString(16), 32),
|
|
27199
27199
|
});
|
|
27200
27200
|
}
|
|
27201
27201
|
computeSharedSecret(otherKey) {
|
|
27202
|
-
const keyPair = getCurve$1().keyFromPrivate(arrayify$
|
|
27203
|
-
const otherKeyPair = getCurve$1().keyFromPublic(arrayify$
|
|
27204
|
-
return hexZeroPad$
|
|
27202
|
+
const keyPair = getCurve$1().keyFromPrivate(arrayify$3(this.privateKey));
|
|
27203
|
+
const otherKeyPair = getCurve$1().keyFromPublic(arrayify$3(computePublicKey$1(otherKey)));
|
|
27204
|
+
return hexZeroPad$3("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);
|
|
27205
27205
|
}
|
|
27206
27206
|
static isSigningKey(value) {
|
|
27207
27207
|
return !!(value && value._isSigningKey);
|
|
@@ -27209,11 +27209,11 @@
|
|
|
27209
27209
|
}
|
|
27210
27210
|
function recoverPublicKey$1(digest, signature) {
|
|
27211
27211
|
const sig = splitSignature$1(signature);
|
|
27212
|
-
const rs = { r: arrayify$
|
|
27213
|
-
return "0x" + getCurve$1().recoverPubKey(arrayify$
|
|
27212
|
+
const rs = { r: arrayify$3(sig.r), s: arrayify$3(sig.s) };
|
|
27213
|
+
return "0x" + getCurve$1().recoverPubKey(arrayify$3(digest), rs, sig.recoveryParam).encode("hex", false);
|
|
27214
27214
|
}
|
|
27215
27215
|
function computePublicKey$1(key, compressed) {
|
|
27216
|
-
const bytes = arrayify$
|
|
27216
|
+
const bytes = arrayify$3(key);
|
|
27217
27217
|
if (bytes.length === 32) {
|
|
27218
27218
|
const signingKey = new SigningKey$1(bytes);
|
|
27219
27219
|
if (compressed) {
|
|
@@ -27254,7 +27254,7 @@
|
|
|
27254
27254
|
}
|
|
27255
27255
|
function handleNumber$1(value) {
|
|
27256
27256
|
if (value === "0x") {
|
|
27257
|
-
return Zero$1$
|
|
27257
|
+
return Zero$1$2;
|
|
27258
27258
|
}
|
|
27259
27259
|
return BigNumber$3.from(value);
|
|
27260
27260
|
}
|
|
@@ -27263,7 +27263,7 @@
|
|
|
27263
27263
|
return getAddress$2(hexDataSlice$1(keccak256$2(hexDataSlice$1(publicKey, 1)), 12));
|
|
27264
27264
|
}
|
|
27265
27265
|
function recoverAddress$1(digest, signature) {
|
|
27266
|
-
return computeAddress$1(recoverPublicKey$1(arrayify$
|
|
27266
|
+
return computeAddress$1(recoverPublicKey$1(arrayify$3(digest), signature));
|
|
27267
27267
|
}
|
|
27268
27268
|
function formatNumber$1(value, name) {
|
|
27269
27269
|
const result = stripZeros$1(BigNumber$3.from(value).toHexString());
|
|
@@ -27370,8 +27370,8 @@
|
|
|
27370
27370
|
catch (error) {
|
|
27371
27371
|
logger$4$2.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]);
|
|
27372
27372
|
}
|
|
27373
|
-
tx.r = hexZeroPad$
|
|
27374
|
-
tx.s = hexZeroPad$
|
|
27373
|
+
tx.r = hexZeroPad$3(fields[1], 32);
|
|
27374
|
+
tx.s = hexZeroPad$3(fields[2], 32);
|
|
27375
27375
|
try {
|
|
27376
27376
|
const digest = keccak256$2(serialize(tx));
|
|
27377
27377
|
tx.from = recoverAddress$1(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v });
|
|
@@ -27458,8 +27458,8 @@
|
|
|
27458
27458
|
console.log(error);
|
|
27459
27459
|
return tx;
|
|
27460
27460
|
}
|
|
27461
|
-
tx.r = hexZeroPad$
|
|
27462
|
-
tx.s = hexZeroPad$
|
|
27461
|
+
tx.r = hexZeroPad$3(transaction[7], 32);
|
|
27462
|
+
tx.s = hexZeroPad$3(transaction[8], 32);
|
|
27463
27463
|
if (BigNumber$3.from(tx.r).isZero() && BigNumber$3.from(tx.s).isZero()) {
|
|
27464
27464
|
// EIP-155 unsigned transaction
|
|
27465
27465
|
tx.chainId = tx.v;
|
|
@@ -27492,7 +27492,7 @@
|
|
|
27492
27492
|
return tx;
|
|
27493
27493
|
}
|
|
27494
27494
|
function parse$1(rawTransaction) {
|
|
27495
|
-
const payload = arrayify$
|
|
27495
|
+
const payload = arrayify$3(rawTransaction);
|
|
27496
27496
|
// Legacy and EIP-155 Transactions
|
|
27497
27497
|
if (payload[0] > 0x7f) {
|
|
27498
27498
|
return _parse$1(payload);
|
|
@@ -27510,10 +27510,10 @@
|
|
|
27510
27510
|
});
|
|
27511
27511
|
}
|
|
27512
27512
|
|
|
27513
|
-
const logger$3$
|
|
27513
|
+
const logger$3$3 = new Logger$3(version$3$3);
|
|
27514
27514
|
class Formatter$1 {
|
|
27515
27515
|
constructor() {
|
|
27516
|
-
logger$3$
|
|
27516
|
+
logger$3$3.checkNew(new.target, Formatter$1);
|
|
27517
27517
|
this.formats = this.getDefaultFormats();
|
|
27518
27518
|
}
|
|
27519
27519
|
getDefaultFormats() {
|
|
@@ -27676,7 +27676,7 @@
|
|
|
27676
27676
|
return value.toLowerCase();
|
|
27677
27677
|
}
|
|
27678
27678
|
}
|
|
27679
|
-
return logger$3$
|
|
27679
|
+
return logger$3$3.throwArgumentError("invalid hash", "value", value);
|
|
27680
27680
|
}
|
|
27681
27681
|
data(value, strict) {
|
|
27682
27682
|
const result = this.hex(value, strict);
|
|
@@ -27720,7 +27720,7 @@
|
|
|
27720
27720
|
hash(value, strict) {
|
|
27721
27721
|
const result = this.hex(value, strict);
|
|
27722
27722
|
if (hexDataLength$1(result) !== 32) {
|
|
27723
|
-
return logger$3$
|
|
27723
|
+
return logger$3$3.throwArgumentError("invalid hash", "value", value);
|
|
27724
27724
|
}
|
|
27725
27725
|
return result;
|
|
27726
27726
|
}
|
|
@@ -27740,7 +27740,7 @@
|
|
|
27740
27740
|
if (!isHexString$3(value)) {
|
|
27741
27741
|
throw new Error("invalid uint256");
|
|
27742
27742
|
}
|
|
27743
|
-
return hexZeroPad$
|
|
27743
|
+
return hexZeroPad$3(value, 32);
|
|
27744
27744
|
}
|
|
27745
27745
|
_block(value, format) {
|
|
27746
27746
|
if (value.author != null && value.miner == null) {
|
|
@@ -27830,18 +27830,18 @@
|
|
|
27830
27830
|
if (value === 0 || value === 1) {
|
|
27831
27831
|
// Make sure if both are specified, they match
|
|
27832
27832
|
if (result.status != null && (result.status !== value)) {
|
|
27833
|
-
logger$3$
|
|
27833
|
+
logger$3$3.throwArgumentError("alt-root-status/status mismatch", "value", { root: result.root, status: result.status });
|
|
27834
27834
|
}
|
|
27835
27835
|
result.status = value;
|
|
27836
27836
|
delete result.root;
|
|
27837
27837
|
}
|
|
27838
27838
|
else {
|
|
27839
|
-
logger$3$
|
|
27839
|
+
logger$3$3.throwArgumentError("invalid alt-root-status", "value.root", result.root);
|
|
27840
27840
|
}
|
|
27841
27841
|
}
|
|
27842
27842
|
else if (result.root.length !== 66) {
|
|
27843
27843
|
// Must be a valid bytes32
|
|
27844
|
-
logger$3$
|
|
27844
|
+
logger$3$3.throwArgumentError("invalid root hash", "value.root", result.root);
|
|
27845
27845
|
}
|
|
27846
27846
|
}
|
|
27847
27847
|
if (result.status != null) {
|
|
@@ -27923,7 +27923,7 @@
|
|
|
27923
27923
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27924
27924
|
});
|
|
27925
27925
|
};
|
|
27926
|
-
const logger$2$
|
|
27926
|
+
const logger$2$3 = new Logger$3(version$3$3);
|
|
27927
27927
|
//////////////////////////////
|
|
27928
27928
|
// Event Serializeing
|
|
27929
27929
|
function checkTopic$1(topic) {
|
|
@@ -27931,7 +27931,7 @@
|
|
|
27931
27931
|
return "null";
|
|
27932
27932
|
}
|
|
27933
27933
|
if (hexDataLength$1(topic) !== 32) {
|
|
27934
|
-
logger$2$
|
|
27934
|
+
logger$2$3.throwArgumentError("invalid topic", "topic", topic);
|
|
27935
27935
|
}
|
|
27936
27936
|
return topic.toLowerCase();
|
|
27937
27937
|
}
|
|
@@ -27986,7 +27986,7 @@
|
|
|
27986
27986
|
return "filter:*:" + serializeTopics$1(eventName);
|
|
27987
27987
|
}
|
|
27988
27988
|
else if (ForkEvent$1.isForkEvent(eventName)) {
|
|
27989
|
-
logger$2$
|
|
27989
|
+
logger$2$3.warn("not implemented");
|
|
27990
27990
|
throw new Error("not implemented");
|
|
27991
27991
|
}
|
|
27992
27992
|
else if (eventName && typeof (eventName) === "object") {
|
|
@@ -28074,7 +28074,7 @@
|
|
|
28074
28074
|
"700": { symbol: "xdai", ilk: "eth" },
|
|
28075
28075
|
};
|
|
28076
28076
|
function bytes32ify$1(value) {
|
|
28077
|
-
return hexZeroPad$
|
|
28077
|
+
return hexZeroPad$3(BigNumber$3.from(value).toHexString(), 32);
|
|
28078
28078
|
}
|
|
28079
28079
|
// Compute the Base58Check encoded data (checksum is first 4 bytes of sha256d)
|
|
28080
28080
|
function base58Encode$1(data) {
|
|
@@ -28113,14 +28113,14 @@
|
|
|
28113
28113
|
_getAddress(coinType, hexBytes) {
|
|
28114
28114
|
const coinInfo = coinInfos$1[String(coinType)];
|
|
28115
28115
|
if (coinInfo == null) {
|
|
28116
|
-
logger$2$
|
|
28116
|
+
logger$2$3.throwError(`unsupported coin type: ${coinType}`, Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
28117
28117
|
operation: `getAddress(${coinType})`
|
|
28118
28118
|
});
|
|
28119
28119
|
}
|
|
28120
28120
|
if (coinInfo.ilk === "eth") {
|
|
28121
28121
|
return this.provider.formatter.address(hexBytes);
|
|
28122
28122
|
}
|
|
28123
|
-
const bytes = arrayify$
|
|
28123
|
+
const bytes = arrayify$3(hexBytes);
|
|
28124
28124
|
// P2PKH: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
|
|
28125
28125
|
if (coinInfo.p2pkh != null) {
|
|
28126
28126
|
const p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);
|
|
@@ -28198,7 +28198,7 @@
|
|
|
28198
28198
|
// Compute the address
|
|
28199
28199
|
const address = this._getAddress(coinType, hexBytes);
|
|
28200
28200
|
if (address == null) {
|
|
28201
|
-
logger$2$
|
|
28201
|
+
logger$2$3.throwError(`invalid or unsupported coin data`, Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
28202
28202
|
operation: `getAddress(${coinType})`,
|
|
28203
28203
|
coinType: coinType,
|
|
28204
28204
|
data: hexBytes
|
|
@@ -28230,7 +28230,7 @@
|
|
|
28230
28230
|
return "bzz:/\/" + swarm[1];
|
|
28231
28231
|
}
|
|
28232
28232
|
}
|
|
28233
|
-
return logger$2$
|
|
28233
|
+
return logger$2$3.throwError(`invalid or unsupported content hash data`, Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
28234
28234
|
operation: "getContentHash()",
|
|
28235
28235
|
data: hexBytes
|
|
28236
28236
|
});
|
|
@@ -28245,7 +28245,7 @@
|
|
|
28245
28245
|
keyBytes = concat$1([bytes32ify$1(64), bytes32ify$1(keyBytes.length), keyBytes]);
|
|
28246
28246
|
// Pad to word-size (32 bytes)
|
|
28247
28247
|
if ((keyBytes.length % 32) !== 0) {
|
|
28248
|
-
keyBytes = concat$1([keyBytes, hexZeroPad$
|
|
28248
|
+
keyBytes = concat$1([keyBytes, hexZeroPad$3("0x", 32 - (key.length % 32))]);
|
|
28249
28249
|
}
|
|
28250
28250
|
const hexBytes = yield this._fetchBytes("0x59d1d43c", hexlify$3(keyBytes));
|
|
28251
28251
|
if (hexBytes == null || hexBytes === "0x") {
|
|
@@ -28268,7 +28268,7 @@
|
|
|
28268
28268
|
*
|
|
28269
28269
|
*/
|
|
28270
28270
|
constructor(network) {
|
|
28271
|
-
logger$2$
|
|
28271
|
+
logger$2$3.checkNew(new.target, Provider$1);
|
|
28272
28272
|
super();
|
|
28273
28273
|
// Events being listened to
|
|
28274
28274
|
this._events = [];
|
|
@@ -28295,7 +28295,7 @@
|
|
|
28295
28295
|
this.emit("network", knownNetwork, null);
|
|
28296
28296
|
}
|
|
28297
28297
|
else {
|
|
28298
|
-
logger$2$
|
|
28298
|
+
logger$2$3.throwArgumentError("invalid network", "network", network);
|
|
28299
28299
|
}
|
|
28300
28300
|
}
|
|
28301
28301
|
this._maxInternalBlockNumber = -1024;
|
|
@@ -28320,7 +28320,7 @@
|
|
|
28320
28320
|
// This should never happen; every Provider sub-class should have
|
|
28321
28321
|
// suggested a network by here (or have thrown).
|
|
28322
28322
|
if (!network) {
|
|
28323
|
-
logger$2$
|
|
28323
|
+
logger$2$3.throwError("no network detected", Logger$3.errors.UNKNOWN_ERROR, {});
|
|
28324
28324
|
}
|
|
28325
28325
|
// Possible this call stacked so do not call defineReadOnly again
|
|
28326
28326
|
if (this._network == null) {
|
|
@@ -28452,8 +28452,8 @@
|
|
|
28452
28452
|
this._emitted.block = blockNumber - 1;
|
|
28453
28453
|
}
|
|
28454
28454
|
if (Math.abs((this._emitted.block) - blockNumber) > 1000) {
|
|
28455
|
-
logger$2$
|
|
28456
|
-
this.emit("error", logger$2$
|
|
28455
|
+
logger$2$3.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${blockNumber})`);
|
|
28456
|
+
this.emit("error", logger$2$3.makeError("network block skew detected", Logger$3.errors.NETWORK_ERROR, {
|
|
28457
28457
|
blockNumber: blockNumber,
|
|
28458
28458
|
event: "blockSkew",
|
|
28459
28459
|
previousBlockNumber: this._emitted.block
|
|
@@ -28550,7 +28550,7 @@
|
|
|
28550
28550
|
// can change, such as when connected to a JSON-RPC backend
|
|
28551
28551
|
detectNetwork() {
|
|
28552
28552
|
return __awaiter$2$1(this, void 0, void 0, function* () {
|
|
28553
|
-
return logger$2$
|
|
28553
|
+
return logger$2$3.throwError("provider does not support network detection", Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
28554
28554
|
operation: "provider.detectNetwork"
|
|
28555
28555
|
});
|
|
28556
28556
|
});
|
|
@@ -28582,7 +28582,7 @@
|
|
|
28582
28582
|
yield stall$1(0);
|
|
28583
28583
|
return this._network;
|
|
28584
28584
|
}
|
|
28585
|
-
const error = logger$2$
|
|
28585
|
+
const error = logger$2$3.makeError("underlying network changed", Logger$3.errors.NETWORK_ERROR, {
|
|
28586
28586
|
event: "changed",
|
|
28587
28587
|
network: network,
|
|
28588
28588
|
detectedNetwork: currentNetwork
|
|
@@ -28769,7 +28769,7 @@
|
|
|
28769
28769
|
reason = "cancelled";
|
|
28770
28770
|
}
|
|
28771
28771
|
// Explain why we were replaced
|
|
28772
|
-
reject(logger$2$
|
|
28772
|
+
reject(logger$2$3.makeError("transaction was replaced", Logger$3.errors.TRANSACTION_REPLACED, {
|
|
28773
28773
|
cancelled: (reason === "replaced" || reason === "cancelled"),
|
|
28774
28774
|
reason,
|
|
28775
28775
|
replacement: this._wrapTransaction(tx),
|
|
@@ -28806,7 +28806,7 @@
|
|
|
28806
28806
|
if (alreadyDone()) {
|
|
28807
28807
|
return;
|
|
28808
28808
|
}
|
|
28809
|
-
reject(logger$2$
|
|
28809
|
+
reject(logger$2$3.makeError("timeout exceeded", Logger$3.errors.TIMEOUT, { timeout: timeout }));
|
|
28810
28810
|
}, timeout);
|
|
28811
28811
|
if (timer.unref) {
|
|
28812
28812
|
timer.unref();
|
|
@@ -28829,7 +28829,7 @@
|
|
|
28829
28829
|
return BigNumber$3.from(result);
|
|
28830
28830
|
}
|
|
28831
28831
|
catch (error) {
|
|
28832
|
-
return logger$2$
|
|
28832
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
28833
28833
|
method: "getGasPrice",
|
|
28834
28834
|
result, error
|
|
28835
28835
|
});
|
|
@@ -28848,7 +28848,7 @@
|
|
|
28848
28848
|
return BigNumber$3.from(result);
|
|
28849
28849
|
}
|
|
28850
28850
|
catch (error) {
|
|
28851
|
-
return logger$2$
|
|
28851
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
28852
28852
|
method: "getBalance",
|
|
28853
28853
|
params, result, error
|
|
28854
28854
|
});
|
|
@@ -28867,7 +28867,7 @@
|
|
|
28867
28867
|
return BigNumber$3.from(result).toNumber();
|
|
28868
28868
|
}
|
|
28869
28869
|
catch (error) {
|
|
28870
|
-
return logger$2$
|
|
28870
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
28871
28871
|
method: "getTransactionCount",
|
|
28872
28872
|
params, result, error
|
|
28873
28873
|
});
|
|
@@ -28886,7 +28886,7 @@
|
|
|
28886
28886
|
return hexlify$3(result);
|
|
28887
28887
|
}
|
|
28888
28888
|
catch (error) {
|
|
28889
|
-
return logger$2$
|
|
28889
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
28890
28890
|
method: "getCode",
|
|
28891
28891
|
params, result, error
|
|
28892
28892
|
});
|
|
@@ -28906,7 +28906,7 @@
|
|
|
28906
28906
|
return hexlify$3(result);
|
|
28907
28907
|
}
|
|
28908
28908
|
catch (error) {
|
|
28909
|
-
return logger$2$
|
|
28909
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
28910
28910
|
method: "getStorageAt",
|
|
28911
28911
|
params, result, error
|
|
28912
28912
|
});
|
|
@@ -28921,7 +28921,7 @@
|
|
|
28921
28921
|
const result = tx;
|
|
28922
28922
|
// Check the hash we expect is the same as the hash the server reported
|
|
28923
28923
|
if (hash != null && tx.hash !== hash) {
|
|
28924
|
-
logger$2$
|
|
28924
|
+
logger$2$3.throwError("Transaction hash mismatch from Provider.sendTransaction.", Logger$3.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });
|
|
28925
28925
|
}
|
|
28926
28926
|
result.wait = (confirms, timeout) => __awaiter$2$1(this, void 0, void 0, function* () {
|
|
28927
28927
|
if (confirms == null) {
|
|
@@ -28949,7 +28949,7 @@
|
|
|
28949
28949
|
// No longer pending, allow the polling loop to garbage collect this
|
|
28950
28950
|
this._emitted["t:" + tx.hash] = receipt.blockNumber;
|
|
28951
28951
|
if (receipt.status === 0) {
|
|
28952
|
-
logger$2$
|
|
28952
|
+
logger$2$3.throwError("transaction failed", Logger$3.errors.CALL_EXCEPTION, {
|
|
28953
28953
|
transactionHash: tx.hash,
|
|
28954
28954
|
transaction: tx,
|
|
28955
28955
|
receipt: receipt
|
|
@@ -29047,7 +29047,7 @@
|
|
|
29047
29047
|
return hexlify$3(result);
|
|
29048
29048
|
}
|
|
29049
29049
|
catch (error) {
|
|
29050
|
-
return logger$2$
|
|
29050
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
29051
29051
|
method: "call",
|
|
29052
29052
|
params, result, error
|
|
29053
29053
|
});
|
|
@@ -29065,7 +29065,7 @@
|
|
|
29065
29065
|
return BigNumber$3.from(result);
|
|
29066
29066
|
}
|
|
29067
29067
|
catch (error) {
|
|
29068
|
-
return logger$2$
|
|
29068
|
+
return logger$2$3.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, {
|
|
29069
29069
|
method: "estimateGas",
|
|
29070
29070
|
params, result, error
|
|
29071
29071
|
});
|
|
@@ -29076,7 +29076,7 @@
|
|
|
29076
29076
|
return __awaiter$2$1(this, void 0, void 0, function* () {
|
|
29077
29077
|
const address = yield this.resolveName(addressOrName);
|
|
29078
29078
|
if (address == null) {
|
|
29079
|
-
logger$2$
|
|
29079
|
+
logger$2$3.throwError("ENS name not configured", Logger$3.errors.UNSUPPORTED_OPERATION, {
|
|
29080
29080
|
operation: `resolveName(${JSON.stringify(addressOrName)})`
|
|
29081
29081
|
});
|
|
29082
29082
|
}
|
|
@@ -29103,7 +29103,7 @@
|
|
|
29103
29103
|
}
|
|
29104
29104
|
}
|
|
29105
29105
|
catch (error) {
|
|
29106
|
-
logger$2$
|
|
29106
|
+
logger$2$3.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag);
|
|
29107
29107
|
}
|
|
29108
29108
|
}
|
|
29109
29109
|
return poll$1(() => __awaiter$2$1(this, void 0, void 0, function* () {
|
|
@@ -29249,7 +29249,7 @@
|
|
|
29249
29249
|
blockTag = yield blockTag;
|
|
29250
29250
|
if (typeof (blockTag) === "number" && blockTag < 0) {
|
|
29251
29251
|
if (blockTag % 1) {
|
|
29252
|
-
logger$2$
|
|
29252
|
+
logger$2$3.throwArgumentError("invalid BlockTag", "blockTag", blockTag);
|
|
29253
29253
|
}
|
|
29254
29254
|
let blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval);
|
|
29255
29255
|
blockNumber += blockTag;
|
|
@@ -29284,7 +29284,7 @@
|
|
|
29284
29284
|
const network = yield this.getNetwork();
|
|
29285
29285
|
// No ENS...
|
|
29286
29286
|
if (!network.ensAddress) {
|
|
29287
|
-
logger$2$
|
|
29287
|
+
logger$2$3.throwError("network does not support ENS", Logger$3.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name });
|
|
29288
29288
|
}
|
|
29289
29289
|
// keccak256("resolver(bytes32)")
|
|
29290
29290
|
const transaction = {
|
|
@@ -29316,7 +29316,7 @@
|
|
|
29316
29316
|
}
|
|
29317
29317
|
}
|
|
29318
29318
|
if (typeof (name) !== "string") {
|
|
29319
|
-
logger$2$
|
|
29319
|
+
logger$2$3.throwArgumentError("invalid ENS name", "name", name);
|
|
29320
29320
|
}
|
|
29321
29321
|
// Get the addr from the resovler
|
|
29322
29322
|
const resolver = yield this.getResolver(name);
|
|
@@ -29336,7 +29336,7 @@
|
|
|
29336
29336
|
return null;
|
|
29337
29337
|
}
|
|
29338
29338
|
// keccak("name(bytes32)")
|
|
29339
|
-
let bytes = arrayify$
|
|
29339
|
+
let bytes = arrayify$3(yield this.call({
|
|
29340
29340
|
to: resolverAddress,
|
|
29341
29341
|
data: ("0x691f3431" + namehash$1(reverseName).substring(2))
|
|
29342
29342
|
}));
|
|
@@ -29366,7 +29366,7 @@
|
|
|
29366
29366
|
});
|
|
29367
29367
|
}
|
|
29368
29368
|
perform(method, params) {
|
|
29369
|
-
return logger$2$
|
|
29369
|
+
return logger$2$3.throwError(method + " not implemented", Logger$3.errors.NOT_IMPLEMENTED, { operation: method });
|
|
29370
29370
|
}
|
|
29371
29371
|
_startEvent(event) {
|
|
29372
29372
|
this.polling = (this._events.filter((e) => e.pollable()).length > 0);
|
|
@@ -29748,7 +29748,7 @@
|
|
|
29748
29748
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
29749
29749
|
});
|
|
29750
29750
|
};
|
|
29751
|
-
const logger$s = new Logger$3(version$3$
|
|
29751
|
+
const logger$s = new Logger$3(version$3$3);
|
|
29752
29752
|
const errorGas$1 = ["call", "estimateGas"];
|
|
29753
29753
|
function checkError$1(method, error, params) {
|
|
29754
29754
|
// Undo the "convenience" some nodes are attempting to prevent backwards
|
|
@@ -30379,7 +30379,7 @@
|
|
|
30379
30379
|
}
|
|
30380
30380
|
}
|
|
30381
30381
|
|
|
30382
|
-
new Logger$3(version$3$
|
|
30382
|
+
new Logger$3(version$3$3);
|
|
30383
30383
|
|
|
30384
30384
|
const BATCH_INTERVAL = 10;
|
|
30385
30385
|
|
|
@@ -34430,13 +34430,13 @@
|
|
|
34430
34430
|
function isHexable$2(value) {
|
|
34431
34431
|
return !!(value.toHexString);
|
|
34432
34432
|
}
|
|
34433
|
-
function addSlice$
|
|
34433
|
+
function addSlice$2(array) {
|
|
34434
34434
|
if (array.slice) {
|
|
34435
34435
|
return array;
|
|
34436
34436
|
}
|
|
34437
34437
|
array.slice = function () {
|
|
34438
34438
|
const args = Array.prototype.slice.call(arguments);
|
|
34439
|
-
return addSlice$
|
|
34439
|
+
return addSlice$2(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
34440
34440
|
};
|
|
34441
34441
|
return array;
|
|
34442
34442
|
}
|
|
@@ -34464,7 +34464,7 @@
|
|
|
34464
34464
|
}
|
|
34465
34465
|
return true;
|
|
34466
34466
|
}
|
|
34467
|
-
function arrayify$
|
|
34467
|
+
function arrayify$2(value, options) {
|
|
34468
34468
|
if (!options) {
|
|
34469
34469
|
options = {};
|
|
34470
34470
|
}
|
|
@@ -34478,7 +34478,7 @@
|
|
|
34478
34478
|
if (result.length === 0) {
|
|
34479
34479
|
result.push(0);
|
|
34480
34480
|
}
|
|
34481
|
-
return addSlice$
|
|
34481
|
+
return addSlice$2(new Uint8Array(result));
|
|
34482
34482
|
}
|
|
34483
34483
|
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
34484
34484
|
value = "0x" + value;
|
|
@@ -34503,25 +34503,25 @@
|
|
|
34503
34503
|
for (let i = 0; i < hex.length; i += 2) {
|
|
34504
34504
|
result.push(parseInt(hex.substring(i, i + 2), 16));
|
|
34505
34505
|
}
|
|
34506
|
-
return addSlice$
|
|
34506
|
+
return addSlice$2(new Uint8Array(result));
|
|
34507
34507
|
}
|
|
34508
34508
|
if (isBytes$2(value)) {
|
|
34509
|
-
return addSlice$
|
|
34509
|
+
return addSlice$2(new Uint8Array(value));
|
|
34510
34510
|
}
|
|
34511
34511
|
return logger$q.throwArgumentError("invalid arrayify value", "value", value);
|
|
34512
34512
|
}
|
|
34513
34513
|
function concat(items) {
|
|
34514
|
-
const objects = items.map(item => arrayify$
|
|
34514
|
+
const objects = items.map(item => arrayify$2(item));
|
|
34515
34515
|
const length = objects.reduce((accum, item) => (accum + item.length), 0);
|
|
34516
34516
|
const result = new Uint8Array(length);
|
|
34517
34517
|
objects.reduce((offset, object) => {
|
|
34518
34518
|
result.set(object, offset);
|
|
34519
34519
|
return offset + object.length;
|
|
34520
34520
|
}, 0);
|
|
34521
|
-
return addSlice$
|
|
34521
|
+
return addSlice$2(result);
|
|
34522
34522
|
}
|
|
34523
34523
|
function stripZeros(value) {
|
|
34524
|
-
let result = arrayify$
|
|
34524
|
+
let result = arrayify$2(value);
|
|
34525
34525
|
if (result.length === 0) {
|
|
34526
34526
|
return result;
|
|
34527
34527
|
}
|
|
@@ -34537,13 +34537,13 @@
|
|
|
34537
34537
|
return result;
|
|
34538
34538
|
}
|
|
34539
34539
|
function zeroPad(value, length) {
|
|
34540
|
-
value = arrayify$
|
|
34540
|
+
value = arrayify$2(value);
|
|
34541
34541
|
if (value.length > length) {
|
|
34542
34542
|
logger$q.throwArgumentError("value out of range", "value", arguments[0]);
|
|
34543
34543
|
}
|
|
34544
34544
|
const result = new Uint8Array(length);
|
|
34545
34545
|
result.set(value, length - value.length);
|
|
34546
|
-
return addSlice$
|
|
34546
|
+
return addSlice$2(result);
|
|
34547
34547
|
}
|
|
34548
34548
|
function isHexString$2(value, length) {
|
|
34549
34549
|
if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
|
|
@@ -34669,7 +34669,7 @@
|
|
|
34669
34669
|
}
|
|
34670
34670
|
return "0x" + value.substring(offset);
|
|
34671
34671
|
}
|
|
34672
|
-
function hexZeroPad$
|
|
34672
|
+
function hexZeroPad$2(value, length) {
|
|
34673
34673
|
if (typeof (value) !== "string") {
|
|
34674
34674
|
value = hexlify$2(value);
|
|
34675
34675
|
}
|
|
@@ -34693,7 +34693,7 @@
|
|
|
34693
34693
|
v: 0
|
|
34694
34694
|
};
|
|
34695
34695
|
if (isBytesLike(signature)) {
|
|
34696
|
-
const bytes = arrayify$
|
|
34696
|
+
const bytes = arrayify$2(signature);
|
|
34697
34697
|
if (bytes.length !== 65) {
|
|
34698
34698
|
logger$q.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
|
|
34699
34699
|
}
|
|
@@ -34727,7 +34727,7 @@
|
|
|
34727
34727
|
// If the _vs is available, use it to populate missing s, v and recoveryParam
|
|
34728
34728
|
// and verify non-missing s, v and recoveryParam
|
|
34729
34729
|
if (result._vs != null) {
|
|
34730
|
-
const vs = zeroPad(arrayify$
|
|
34730
|
+
const vs = zeroPad(arrayify$2(result._vs), 32);
|
|
34731
34731
|
result._vs = hexlify$2(vs);
|
|
34732
34732
|
// Set or check the recid
|
|
34733
34733
|
const recoveryParam = ((vs[0] >= 128) ? 1 : 0);
|
|
@@ -34771,15 +34771,15 @@
|
|
|
34771
34771
|
logger$q.throwArgumentError("signature missing or invalid r", "signature", signature);
|
|
34772
34772
|
}
|
|
34773
34773
|
else {
|
|
34774
|
-
result.r = hexZeroPad$
|
|
34774
|
+
result.r = hexZeroPad$2(result.r, 32);
|
|
34775
34775
|
}
|
|
34776
34776
|
if (result.s == null || !isHexString$2(result.s)) {
|
|
34777
34777
|
logger$q.throwArgumentError("signature missing or invalid s", "signature", signature);
|
|
34778
34778
|
}
|
|
34779
34779
|
else {
|
|
34780
|
-
result.s = hexZeroPad$
|
|
34780
|
+
result.s = hexZeroPad$2(result.s, 32);
|
|
34781
34781
|
}
|
|
34782
|
-
const vs = arrayify$
|
|
34782
|
+
const vs = arrayify$2(result.s);
|
|
34783
34783
|
if (vs[0] >= 128) {
|
|
34784
34784
|
logger$q.throwArgumentError("signature s out of range", "signature", signature);
|
|
34785
34785
|
}
|
|
@@ -34791,7 +34791,7 @@
|
|
|
34791
34791
|
if (!isHexString$2(result._vs)) {
|
|
34792
34792
|
logger$q.throwArgumentError("signature invalid _vs", "signature", signature);
|
|
34793
34793
|
}
|
|
34794
|
-
result._vs = hexZeroPad$
|
|
34794
|
+
result._vs = hexZeroPad$2(result._vs, 32);
|
|
34795
34795
|
}
|
|
34796
34796
|
// Set or check the _vs
|
|
34797
34797
|
if (result._vs == null) {
|
|
@@ -34810,7 +34810,7 @@
|
|
|
34810
34810
|
const logger$p = new Logger$2(version$h);
|
|
34811
34811
|
const _constructorGuard$4 = {};
|
|
34812
34812
|
const MAX_SAFE$1$1 = 0x1fffffffffffff;
|
|
34813
|
-
function isBigNumberish$
|
|
34813
|
+
function isBigNumberish$2(value) {
|
|
34814
34814
|
return (value != null) && (BigNumber$1$1.isBigNumber(value) ||
|
|
34815
34815
|
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
34816
34816
|
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
@@ -35100,7 +35100,7 @@
|
|
|
35100
35100
|
const _constructorGuard$3 = {};
|
|
35101
35101
|
const Zero$2 = BigNumber$1$1.from(0);
|
|
35102
35102
|
const NegativeOne$2 = BigNumber$1$1.from(-1);
|
|
35103
|
-
function throwFault$1$
|
|
35103
|
+
function throwFault$1$2(message, fault, operation, value) {
|
|
35104
35104
|
const params = { fault: fault, operation: operation };
|
|
35105
35105
|
if (value !== undefined) {
|
|
35106
35106
|
params.value = value;
|
|
@@ -35108,12 +35108,12 @@
|
|
|
35108
35108
|
return logger$o.throwError(message, Logger$2.errors.NUMERIC_FAULT, params);
|
|
35109
35109
|
}
|
|
35110
35110
|
// Constant to pull zeros from for multipliers
|
|
35111
|
-
let zeros$
|
|
35112
|
-
while (zeros$
|
|
35113
|
-
zeros$
|
|
35111
|
+
let zeros$2 = "0";
|
|
35112
|
+
while (zeros$2.length < 256) {
|
|
35113
|
+
zeros$2 += zeros$2;
|
|
35114
35114
|
}
|
|
35115
35115
|
// Returns a string "1" followed by decimal "0"s
|
|
35116
|
-
function getMultiplier$
|
|
35116
|
+
function getMultiplier$2(decimals) {
|
|
35117
35117
|
if (typeof (decimals) !== "number") {
|
|
35118
35118
|
try {
|
|
35119
35119
|
decimals = BigNumber$1$1.from(decimals).toNumber();
|
|
@@ -35121,15 +35121,15 @@
|
|
|
35121
35121
|
catch (e) { }
|
|
35122
35122
|
}
|
|
35123
35123
|
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
35124
|
-
return ("1" + zeros$
|
|
35124
|
+
return ("1" + zeros$2.substring(0, decimals));
|
|
35125
35125
|
}
|
|
35126
35126
|
return logger$o.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
35127
35127
|
}
|
|
35128
|
-
function formatFixed$
|
|
35128
|
+
function formatFixed$2(value, decimals) {
|
|
35129
35129
|
if (decimals == null) {
|
|
35130
35130
|
decimals = 0;
|
|
35131
35131
|
}
|
|
35132
|
-
const multiplier = getMultiplier$
|
|
35132
|
+
const multiplier = getMultiplier$2(decimals);
|
|
35133
35133
|
// Make sure wei is a big number (convert as necessary)
|
|
35134
35134
|
value = BigNumber$1$1.from(value);
|
|
35135
35135
|
const negative = value.lt(Zero$2);
|
|
@@ -35154,11 +35154,11 @@
|
|
|
35154
35154
|
}
|
|
35155
35155
|
return value;
|
|
35156
35156
|
}
|
|
35157
|
-
function parseFixed$
|
|
35157
|
+
function parseFixed$2(value, decimals) {
|
|
35158
35158
|
if (decimals == null) {
|
|
35159
35159
|
decimals = 0;
|
|
35160
35160
|
}
|
|
35161
|
-
const multiplier = getMultiplier$
|
|
35161
|
+
const multiplier = getMultiplier$2(decimals);
|
|
35162
35162
|
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
|
|
35163
35163
|
logger$o.throwArgumentError("invalid decimal value", "value", value);
|
|
35164
35164
|
}
|
|
@@ -35186,7 +35186,7 @@
|
|
|
35186
35186
|
{
|
|
35187
35187
|
const sigFraction = fraction.replace(/^([0-9]*?)(0*)$/, (all, sig, zeros) => (sig));
|
|
35188
35188
|
if (sigFraction.length > multiplier.length - 1) {
|
|
35189
|
-
throwFault$1$
|
|
35189
|
+
throwFault$1$2("fractional component exceeds decimals", "underflow", "parseFixed");
|
|
35190
35190
|
}
|
|
35191
35191
|
}
|
|
35192
35192
|
// Fully pad the string with zeros to get to wei
|
|
@@ -35201,7 +35201,7 @@
|
|
|
35201
35201
|
}
|
|
35202
35202
|
return wei;
|
|
35203
35203
|
}
|
|
35204
|
-
class FixedFormat$
|
|
35204
|
+
class FixedFormat$2 {
|
|
35205
35205
|
constructor(constructorGuard, signed, width, decimals) {
|
|
35206
35206
|
if (constructorGuard !== _constructorGuard$3) {
|
|
35207
35207
|
logger$o.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
@@ -35212,11 +35212,11 @@
|
|
|
35212
35212
|
this.width = width;
|
|
35213
35213
|
this.decimals = decimals;
|
|
35214
35214
|
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
35215
|
-
this._multiplier = getMultiplier$
|
|
35215
|
+
this._multiplier = getMultiplier$2(decimals);
|
|
35216
35216
|
Object.freeze(this);
|
|
35217
35217
|
}
|
|
35218
35218
|
static from(value) {
|
|
35219
|
-
if (value instanceof FixedFormat$
|
|
35219
|
+
if (value instanceof FixedFormat$2) {
|
|
35220
35220
|
return value;
|
|
35221
35221
|
}
|
|
35222
35222
|
if (typeof (value) === "number") {
|
|
@@ -35260,12 +35260,12 @@
|
|
|
35260
35260
|
if (decimals > 80) {
|
|
35261
35261
|
logger$o.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
35262
35262
|
}
|
|
35263
|
-
return new FixedFormat$
|
|
35263
|
+
return new FixedFormat$2(_constructorGuard$3, signed, width, decimals);
|
|
35264
35264
|
}
|
|
35265
35265
|
}
|
|
35266
|
-
class FixedNumber$
|
|
35266
|
+
class FixedNumber$2 {
|
|
35267
35267
|
constructor(constructorGuard, hex, value, format) {
|
|
35268
|
-
logger$o.checkNew(new.target, FixedNumber$
|
|
35268
|
+
logger$o.checkNew(new.target, FixedNumber$2);
|
|
35269
35269
|
if (constructorGuard !== _constructorGuard$3) {
|
|
35270
35270
|
logger$o.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
35271
35271
|
operation: "new FixedFormat"
|
|
@@ -35284,37 +35284,37 @@
|
|
|
35284
35284
|
}
|
|
35285
35285
|
addUnsafe(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.add(b), this.format.decimals, this.format);
|
|
35290
35290
|
}
|
|
35291
35291
|
subUnsafe(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.sub(b), this.format.decimals, this.format);
|
|
35296
35296
|
}
|
|
35297
35297
|
mulUnsafe(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(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
35302
35302
|
}
|
|
35303
35303
|
divUnsafe(other) {
|
|
35304
35304
|
this._checkFormat(other);
|
|
35305
|
-
const a = parseFixed$
|
|
35306
|
-
const b = parseFixed$
|
|
35307
|
-
return FixedNumber$
|
|
35305
|
+
const a = parseFixed$2(this._value, this.format.decimals);
|
|
35306
|
+
const b = parseFixed$2(other._value, other.format.decimals);
|
|
35307
|
+
return FixedNumber$2.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
35308
35308
|
}
|
|
35309
35309
|
floor() {
|
|
35310
35310
|
const comps = this.toString().split(".");
|
|
35311
35311
|
if (comps.length === 1) {
|
|
35312
35312
|
comps.push("0");
|
|
35313
35313
|
}
|
|
35314
|
-
let result = FixedNumber$
|
|
35314
|
+
let result = FixedNumber$2.from(comps[0], this.format);
|
|
35315
35315
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
35316
35316
|
if (this.isNegative() && hasFraction) {
|
|
35317
|
-
result = result.subUnsafe(ONE$
|
|
35317
|
+
result = result.subUnsafe(ONE$2.toFormat(result.format));
|
|
35318
35318
|
}
|
|
35319
35319
|
return result;
|
|
35320
35320
|
}
|
|
@@ -35323,10 +35323,10 @@
|
|
|
35323
35323
|
if (comps.length === 1) {
|
|
35324
35324
|
comps.push("0");
|
|
35325
35325
|
}
|
|
35326
|
-
let result = FixedNumber$
|
|
35326
|
+
let result = FixedNumber$2.from(comps[0], this.format);
|
|
35327
35327
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
35328
35328
|
if (!this.isNegative() && hasFraction) {
|
|
35329
|
-
result = result.addUnsafe(ONE$
|
|
35329
|
+
result = result.addUnsafe(ONE$2.toFormat(result.format));
|
|
35330
35330
|
}
|
|
35331
35331
|
return result;
|
|
35332
35332
|
}
|
|
@@ -35346,8 +35346,8 @@
|
|
|
35346
35346
|
if (comps[1].length <= decimals) {
|
|
35347
35347
|
return this;
|
|
35348
35348
|
}
|
|
35349
|
-
const factor = FixedNumber$
|
|
35350
|
-
const bump = BUMP$
|
|
35349
|
+
const factor = FixedNumber$2.from("1" + zeros$2.substring(0, decimals), this.format);
|
|
35350
|
+
const bump = BUMP$2.toFormat(this.format);
|
|
35351
35351
|
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
35352
35352
|
}
|
|
35353
35353
|
isZero() {
|
|
@@ -35365,15 +35365,15 @@
|
|
|
35365
35365
|
logger$o.throwArgumentError("invalid byte width", "width", width);
|
|
35366
35366
|
}
|
|
35367
35367
|
const hex = BigNumber$1$1.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
35368
|
-
return hexZeroPad$
|
|
35368
|
+
return hexZeroPad$2(hex, width / 8);
|
|
35369
35369
|
}
|
|
35370
35370
|
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
35371
35371
|
toFormat(format) {
|
|
35372
|
-
return FixedNumber$
|
|
35372
|
+
return FixedNumber$2.fromString(this._value, format);
|
|
35373
35373
|
}
|
|
35374
35374
|
static fromValue(value, decimals, format) {
|
|
35375
35375
|
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
35376
|
-
if (format == null && decimals != null && !isBigNumberish$
|
|
35376
|
+
if (format == null && decimals != null && !isBigNumberish$2(decimals)) {
|
|
35377
35377
|
format = decimals;
|
|
35378
35378
|
decimals = null;
|
|
35379
35379
|
}
|
|
@@ -35383,16 +35383,16 @@
|
|
|
35383
35383
|
if (format == null) {
|
|
35384
35384
|
format = "fixed";
|
|
35385
35385
|
}
|
|
35386
|
-
return FixedNumber$
|
|
35386
|
+
return FixedNumber$2.fromString(formatFixed$2(value, decimals), FixedFormat$2.from(format));
|
|
35387
35387
|
}
|
|
35388
35388
|
static fromString(value, format) {
|
|
35389
35389
|
if (format == null) {
|
|
35390
35390
|
format = "fixed";
|
|
35391
35391
|
}
|
|
35392
|
-
const fixedFormat = FixedFormat$
|
|
35393
|
-
const numeric = parseFixed$
|
|
35392
|
+
const fixedFormat = FixedFormat$2.from(format);
|
|
35393
|
+
const numeric = parseFixed$2(value, fixedFormat.decimals);
|
|
35394
35394
|
if (!fixedFormat.signed && numeric.lt(Zero$2)) {
|
|
35395
|
-
throwFault$1$
|
|
35395
|
+
throwFault$1$2("unsigned value cannot be negative", "overflow", "value", value);
|
|
35396
35396
|
}
|
|
35397
35397
|
let hex = null;
|
|
35398
35398
|
if (fixedFormat.signed) {
|
|
@@ -35400,17 +35400,17 @@
|
|
|
35400
35400
|
}
|
|
35401
35401
|
else {
|
|
35402
35402
|
hex = numeric.toHexString();
|
|
35403
|
-
hex = hexZeroPad$
|
|
35403
|
+
hex = hexZeroPad$2(hex, fixedFormat.width / 8);
|
|
35404
35404
|
}
|
|
35405
|
-
const decimal = formatFixed$
|
|
35406
|
-
return new FixedNumber$
|
|
35405
|
+
const decimal = formatFixed$2(numeric, fixedFormat.decimals);
|
|
35406
|
+
return new FixedNumber$2(_constructorGuard$3, hex, decimal, fixedFormat);
|
|
35407
35407
|
}
|
|
35408
35408
|
static fromBytes(value, format) {
|
|
35409
35409
|
if (format == null) {
|
|
35410
35410
|
format = "fixed";
|
|
35411
35411
|
}
|
|
35412
|
-
const fixedFormat = FixedFormat$
|
|
35413
|
-
if (arrayify$
|
|
35412
|
+
const fixedFormat = FixedFormat$2.from(format);
|
|
35413
|
+
if (arrayify$2(value).length > fixedFormat.width / 8) {
|
|
35414
35414
|
throw new Error("overflow");
|
|
35415
35415
|
}
|
|
35416
35416
|
let numeric = BigNumber$1$1.from(value);
|
|
@@ -35418,18 +35418,18 @@
|
|
|
35418
35418
|
numeric = numeric.fromTwos(fixedFormat.width);
|
|
35419
35419
|
}
|
|
35420
35420
|
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
35421
|
-
const decimal = formatFixed$
|
|
35422
|
-
return new FixedNumber$
|
|
35421
|
+
const decimal = formatFixed$2(numeric, fixedFormat.decimals);
|
|
35422
|
+
return new FixedNumber$2(_constructorGuard$3, hex, decimal, fixedFormat);
|
|
35423
35423
|
}
|
|
35424
35424
|
static from(value, format) {
|
|
35425
35425
|
if (typeof (value) === "string") {
|
|
35426
|
-
return FixedNumber$
|
|
35426
|
+
return FixedNumber$2.fromString(value, format);
|
|
35427
35427
|
}
|
|
35428
35428
|
if (isBytes$2(value)) {
|
|
35429
|
-
return FixedNumber$
|
|
35429
|
+
return FixedNumber$2.fromBytes(value, format);
|
|
35430
35430
|
}
|
|
35431
35431
|
try {
|
|
35432
|
-
return FixedNumber$
|
|
35432
|
+
return FixedNumber$2.fromValue(value, 0, format);
|
|
35433
35433
|
}
|
|
35434
35434
|
catch (error) {
|
|
35435
35435
|
// Allow NUMERIC_FAULT to bubble up
|
|
@@ -35443,8 +35443,8 @@
|
|
|
35443
35443
|
return !!(value && value._isFixedNumber);
|
|
35444
35444
|
}
|
|
35445
35445
|
}
|
|
35446
|
-
const ONE$
|
|
35447
|
-
const BUMP$
|
|
35446
|
+
const ONE$2 = FixedNumber$2.from(1);
|
|
35447
|
+
const BUMP$2 = FixedNumber$2.from("0.5");
|
|
35448
35448
|
|
|
35449
35449
|
const version$g = "properties/5.4.1";
|
|
35450
35450
|
|
|
@@ -36476,7 +36476,7 @@
|
|
|
36476
36476
|
}
|
|
36477
36477
|
// Arrayish items; padded on the right to wordSize
|
|
36478
36478
|
writeBytes(value) {
|
|
36479
|
-
let bytes = arrayify$
|
|
36479
|
+
let bytes = arrayify$2(value);
|
|
36480
36480
|
const paddingOffset = bytes.length % this.wordSize;
|
|
36481
36481
|
if (paddingOffset) {
|
|
36482
36482
|
bytes = concat([bytes, this._padding.slice(paddingOffset)]);
|
|
@@ -36484,7 +36484,7 @@
|
|
|
36484
36484
|
return this._writeData(bytes);
|
|
36485
36485
|
}
|
|
36486
36486
|
_getValue(value) {
|
|
36487
|
-
let bytes = arrayify$
|
|
36487
|
+
let bytes = arrayify$2(BigNumber$1$1.from(value));
|
|
36488
36488
|
if (bytes.length > this.wordSize) {
|
|
36489
36489
|
logger$l.throwError("value out-of-bounds", Logger$2.errors.BUFFER_OVERRUN, {
|
|
36490
36490
|
length: this.wordSize,
|
|
@@ -36511,7 +36511,7 @@
|
|
|
36511
36511
|
}
|
|
36512
36512
|
class Reader {
|
|
36513
36513
|
constructor(data, wordSize, coerceFunc, allowLoose) {
|
|
36514
|
-
defineReadOnly(this, "_data", arrayify$
|
|
36514
|
+
defineReadOnly(this, "_data", arrayify$2(data));
|
|
36515
36515
|
defineReadOnly(this, "wordSize", wordSize || 32);
|
|
36516
36516
|
defineReadOnly(this, "_coerceFunc", coerceFunc);
|
|
36517
36517
|
defineReadOnly(this, "allowLoose", allowLoose);
|
|
@@ -37043,7 +37043,7 @@
|
|
|
37043
37043
|
var sha3$1$1 = sha3$2;
|
|
37044
37044
|
|
|
37045
37045
|
function keccak256$1(data) {
|
|
37046
|
-
return '0x' + sha3$1$1.keccak_256(arrayify$
|
|
37046
|
+
return '0x' + sha3$1$1.keccak_256(arrayify$2(data));
|
|
37047
37047
|
}
|
|
37048
37048
|
|
|
37049
37049
|
const version$e = "rlp/5.4.0";
|
|
@@ -37081,7 +37081,7 @@
|
|
|
37081
37081
|
if (!isBytesLike(object)) {
|
|
37082
37082
|
logger$k.throwArgumentError("RLP object must be BytesLike", "object", object);
|
|
37083
37083
|
}
|
|
37084
|
-
const data = Array.prototype.slice.call(arrayify$
|
|
37084
|
+
const data = Array.prototype.slice.call(arrayify$2(object));
|
|
37085
37085
|
if (data.length === 1 && data[0] <= 0x7f) {
|
|
37086
37086
|
return data;
|
|
37087
37087
|
}
|
|
@@ -37155,7 +37155,7 @@
|
|
|
37155
37155
|
return { consumed: 1, result: hexlify$2(data[offset]) };
|
|
37156
37156
|
}
|
|
37157
37157
|
function decode$1(data) {
|
|
37158
|
-
const bytes = arrayify$
|
|
37158
|
+
const bytes = arrayify$2(data);
|
|
37159
37159
|
const decoded = _decode(bytes, 0);
|
|
37160
37160
|
if (decoded.consumed !== bytes.length) {
|
|
37161
37161
|
logger$k.throwArgumentError("invalid rlp data", "data", data);
|
|
@@ -37176,7 +37176,7 @@
|
|
|
37176
37176
|
for (let i = 0; i < 40; i++) {
|
|
37177
37177
|
expanded[i] = chars[i].charCodeAt(0);
|
|
37178
37178
|
}
|
|
37179
|
-
const hashed = arrayify$
|
|
37179
|
+
const hashed = arrayify$2(keccak256$1(expanded));
|
|
37180
37180
|
for (let i = 0; i < 40; i += 2) {
|
|
37181
37181
|
if ((hashed[i >> 1] >> 4) >= 8) {
|
|
37182
37182
|
chars[i] = chars[i].toUpperCase();
|
|
@@ -37263,7 +37263,7 @@
|
|
|
37263
37263
|
catch (error) {
|
|
37264
37264
|
logger$j.throwArgumentError("missing from address", "transaction", transaction);
|
|
37265
37265
|
}
|
|
37266
|
-
const nonce = stripZeros(arrayify$
|
|
37266
|
+
const nonce = stripZeros(arrayify$2(BigNumber$1$1.from(transaction.nonce).toHexString()));
|
|
37267
37267
|
return getAddress$1(hexDataSlice(keccak256$1(encode$2([from, nonce])), 12));
|
|
37268
37268
|
}
|
|
37269
37269
|
|
|
@@ -37284,7 +37284,7 @@
|
|
|
37284
37284
|
return writer.writeValue(value);
|
|
37285
37285
|
}
|
|
37286
37286
|
decode(reader) {
|
|
37287
|
-
return getAddress$1(hexZeroPad$
|
|
37287
|
+
return getAddress$1(hexZeroPad$2(reader.readValue().toHexString(), 20));
|
|
37288
37288
|
}
|
|
37289
37289
|
}
|
|
37290
37290
|
|
|
@@ -37532,7 +37532,7 @@
|
|
|
37532
37532
|
return "0x";
|
|
37533
37533
|
}
|
|
37534
37534
|
encode(writer, value) {
|
|
37535
|
-
value = arrayify$
|
|
37535
|
+
value = arrayify$2(value);
|
|
37536
37536
|
let length = writer.writeValue(value.length);
|
|
37537
37537
|
length += writer.writeBytes(value);
|
|
37538
37538
|
return length;
|
|
@@ -37561,7 +37561,7 @@
|
|
|
37561
37561
|
return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2);
|
|
37562
37562
|
}
|
|
37563
37563
|
encode(writer, value) {
|
|
37564
|
-
let data = arrayify$
|
|
37564
|
+
let data = arrayify$2(value);
|
|
37565
37565
|
if (data.length !== this.size) {
|
|
37566
37566
|
this._throwError("incorrect data length", value);
|
|
37567
37567
|
}
|
|
@@ -37593,8 +37593,8 @@
|
|
|
37593
37593
|
|
|
37594
37594
|
const AddressZero = "0x0000000000000000000000000000000000000000";
|
|
37595
37595
|
|
|
37596
|
-
const NegativeOne$1 = ( /*#__PURE__*/BigNumber$1$1.from(-1));
|
|
37597
|
-
const Zero$1 = ( /*#__PURE__*/BigNumber$1$1.from(0));
|
|
37596
|
+
const NegativeOne$1$1 = ( /*#__PURE__*/BigNumber$1$1.from(-1));
|
|
37597
|
+
const Zero$1$1 = ( /*#__PURE__*/BigNumber$1$1.from(0));
|
|
37598
37598
|
const One$1 = ( /*#__PURE__*/BigNumber$1$1.from(1));
|
|
37599
37599
|
const MaxUint256$1 = ( /*#__PURE__*/BigNumber$1$1.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
|
37600
37600
|
|
|
@@ -37616,11 +37616,11 @@
|
|
|
37616
37616
|
let maxUintValue = MaxUint256$1.mask(writer.wordSize * 8);
|
|
37617
37617
|
if (this.signed) {
|
|
37618
37618
|
let bounds = maxUintValue.mask(this.size * 8 - 1);
|
|
37619
|
-
if (v.gt(bounds) || v.lt(bounds.add(One$1).mul(NegativeOne$1))) {
|
|
37619
|
+
if (v.gt(bounds) || v.lt(bounds.add(One$1).mul(NegativeOne$1$1))) {
|
|
37620
37620
|
this._throwError("value out-of-bounds", value);
|
|
37621
37621
|
}
|
|
37622
37622
|
}
|
|
37623
|
-
else if (v.lt(Zero$1) || v.gt(maxUintValue.mask(this.size * 8))) {
|
|
37623
|
+
else if (v.lt(Zero$1$1) || v.gt(maxUintValue.mask(this.size * 8))) {
|
|
37624
37624
|
this._throwError("value out-of-bounds", value);
|
|
37625
37625
|
}
|
|
37626
37626
|
v = v.toTwos(this.size * 8).mask(this.size * 8);
|
|
@@ -37722,7 +37722,7 @@
|
|
|
37722
37722
|
if (onError == null) {
|
|
37723
37723
|
onError = Utf8ErrorFuncs.error;
|
|
37724
37724
|
}
|
|
37725
|
-
bytes = arrayify$
|
|
37725
|
+
bytes = arrayify$2(bytes);
|
|
37726
37726
|
const result = [];
|
|
37727
37727
|
let i = 0;
|
|
37728
37728
|
// Invalid bytes are ignored
|
|
@@ -37836,7 +37836,7 @@
|
|
|
37836
37836
|
result.push((c & 0x3f) | 0x80);
|
|
37837
37837
|
}
|
|
37838
37838
|
}
|
|
37839
|
-
return arrayify$
|
|
37839
|
+
return arrayify$2(result);
|
|
37840
37840
|
}
|
|
37841
37841
|
function _toUtf8String(codePoints) {
|
|
37842
37842
|
return codePoints.map((codePoint) => {
|
|
@@ -38184,7 +38184,7 @@
|
|
|
38184
38184
|
decode(types, data, loose) {
|
|
38185
38185
|
const coders = types.map((type) => this._getCoder(ParamType.from(type)));
|
|
38186
38186
|
const coder = new TupleCoder(coders, "_");
|
|
38187
|
-
return coder.decode(this._getReader(arrayify$
|
|
38187
|
+
return coder.decode(this._getReader(arrayify$2(data), loose));
|
|
38188
38188
|
}
|
|
38189
38189
|
}
|
|
38190
38190
|
const defaultAbiCoder = new AbiCoder();
|
|
@@ -38235,15 +38235,15 @@
|
|
|
38235
38235
|
const One = BigNumber$1$1.from(1);
|
|
38236
38236
|
const MaxUint256 = BigNumber$1$1.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
|
38237
38237
|
function hexPadRight(value) {
|
|
38238
|
-
const bytes = arrayify$
|
|
38238
|
+
const bytes = arrayify$2(value);
|
|
38239
38239
|
const padOffset = bytes.length % 32;
|
|
38240
38240
|
if (padOffset) {
|
|
38241
38241
|
return hexConcat([bytes, padding.slice(padOffset)]);
|
|
38242
38242
|
}
|
|
38243
38243
|
return hexlify$2(bytes);
|
|
38244
38244
|
}
|
|
38245
|
-
const hexTrue = hexZeroPad$
|
|
38246
|
-
const hexFalse = hexZeroPad$
|
|
38245
|
+
const hexTrue = hexZeroPad$2(One.toHexString(), 32);
|
|
38246
|
+
const hexFalse = hexZeroPad$2(Zero$3.toHexString(), 32);
|
|
38247
38247
|
const domainFieldTypes = {
|
|
38248
38248
|
name: "string",
|
|
38249
38249
|
version: "string",
|
|
@@ -38281,7 +38281,7 @@
|
|
|
38281
38281
|
},
|
|
38282
38282
|
salt: function (value) {
|
|
38283
38283
|
try {
|
|
38284
|
-
const bytes = arrayify$
|
|
38284
|
+
const bytes = arrayify$2(value);
|
|
38285
38285
|
if (bytes.length !== 32) {
|
|
38286
38286
|
throw new Error("bad length");
|
|
38287
38287
|
}
|
|
@@ -38308,7 +38308,7 @@
|
|
|
38308
38308
|
if (v.lt(boundsLower) || v.gt(boundsUpper)) {
|
|
38309
38309
|
logger$e.throwArgumentError(`value out-of-bounds for ${type}`, "value", value);
|
|
38310
38310
|
}
|
|
38311
|
-
return hexZeroPad$
|
|
38311
|
+
return hexZeroPad$2(v.toTwos(256).toHexString(), 32);
|
|
38312
38312
|
};
|
|
38313
38313
|
}
|
|
38314
38314
|
}
|
|
@@ -38321,7 +38321,7 @@
|
|
|
38321
38321
|
logger$e.throwArgumentError("invalid bytes width", "type", type);
|
|
38322
38322
|
}
|
|
38323
38323
|
return function (value) {
|
|
38324
|
-
const bytes = arrayify$
|
|
38324
|
+
const bytes = arrayify$2(value);
|
|
38325
38325
|
if (bytes.length !== width) {
|
|
38326
38326
|
logger$e.throwArgumentError(`invalid length for ${type}`, "value", value);
|
|
38327
38327
|
}
|
|
@@ -38331,7 +38331,7 @@
|
|
|
38331
38331
|
}
|
|
38332
38332
|
switch (type) {
|
|
38333
38333
|
case "address": return function (value) {
|
|
38334
|
-
return hexZeroPad$
|
|
38334
|
+
return hexZeroPad$2(getAddress$1(value), 32);
|
|
38335
38335
|
};
|
|
38336
38336
|
case "bool": return function (value) {
|
|
38337
38337
|
return ((!value) ? hexFalse : hexTrue);
|
|
@@ -38628,7 +38628,7 @@
|
|
|
38628
38628
|
message: encoder.visit(value, (type, value) => {
|
|
38629
38629
|
// bytes
|
|
38630
38630
|
if (type.match(/^bytes(\d*)/)) {
|
|
38631
|
-
return hexlify$2(arrayify$
|
|
38631
|
+
return hexlify$2(arrayify$2(value));
|
|
38632
38632
|
}
|
|
38633
38633
|
// uint or int
|
|
38634
38634
|
if (type.match(/^u?int/)) {
|
|
@@ -38900,7 +38900,7 @@
|
|
|
38900
38900
|
if (typeof (fragment) === "string") {
|
|
38901
38901
|
fragment = this.getError(fragment);
|
|
38902
38902
|
}
|
|
38903
|
-
const bytes = arrayify$
|
|
38903
|
+
const bytes = arrayify$2(data);
|
|
38904
38904
|
if (hexlify$2(bytes.slice(0, 4)) !== this.getSighash(fragment)) {
|
|
38905
38905
|
logger$d.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify$2(bytes));
|
|
38906
38906
|
}
|
|
@@ -38920,7 +38920,7 @@
|
|
|
38920
38920
|
if (typeof (functionFragment) === "string") {
|
|
38921
38921
|
functionFragment = this.getFunction(functionFragment);
|
|
38922
38922
|
}
|
|
38923
|
-
const bytes = arrayify$
|
|
38923
|
+
const bytes = arrayify$2(data);
|
|
38924
38924
|
if (hexlify$2(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {
|
|
38925
38925
|
logger$d.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify$2(bytes));
|
|
38926
38926
|
}
|
|
@@ -38941,7 +38941,7 @@
|
|
|
38941
38941
|
if (typeof (functionFragment) === "string") {
|
|
38942
38942
|
functionFragment = this.getFunction(functionFragment);
|
|
38943
38943
|
}
|
|
38944
|
-
let bytes = arrayify$
|
|
38944
|
+
let bytes = arrayify$2(data);
|
|
38945
38945
|
let reason = null;
|
|
38946
38946
|
let errorArgs = null;
|
|
38947
38947
|
let errorName = null;
|
|
@@ -39016,7 +39016,7 @@
|
|
|
39016
39016
|
if (param.type === "address") {
|
|
39017
39017
|
this._abiCoder.encode(["address"], [value]);
|
|
39018
39018
|
}
|
|
39019
|
-
return hexZeroPad$
|
|
39019
|
+
return hexZeroPad$2(hexlify$2(value), 32);
|
|
39020
39020
|
};
|
|
39021
39021
|
values.forEach((value, index) => {
|
|
39022
39022
|
let param = eventFragment.inputs[index];
|
|
@@ -43317,33 +43317,33 @@
|
|
|
43317
43317
|
constructor(privateKey) {
|
|
43318
43318
|
defineReadOnly(this, "curve", "secp256k1");
|
|
43319
43319
|
defineReadOnly(this, "privateKey", hexlify$2(privateKey));
|
|
43320
|
-
const keyPair = getCurve().keyFromPrivate(arrayify$
|
|
43320
|
+
const keyPair = getCurve().keyFromPrivate(arrayify$2(this.privateKey));
|
|
43321
43321
|
defineReadOnly(this, "publicKey", "0x" + keyPair.getPublic(false, "hex"));
|
|
43322
43322
|
defineReadOnly(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex"));
|
|
43323
43323
|
defineReadOnly(this, "_isSigningKey", true);
|
|
43324
43324
|
}
|
|
43325
43325
|
_addPoint(other) {
|
|
43326
|
-
const p0 = getCurve().keyFromPublic(arrayify$
|
|
43327
|
-
const p1 = getCurve().keyFromPublic(arrayify$
|
|
43326
|
+
const p0 = getCurve().keyFromPublic(arrayify$2(this.publicKey));
|
|
43327
|
+
const p1 = getCurve().keyFromPublic(arrayify$2(other));
|
|
43328
43328
|
return "0x" + p0.pub.add(p1.pub).encodeCompressed("hex");
|
|
43329
43329
|
}
|
|
43330
43330
|
signDigest(digest) {
|
|
43331
|
-
const keyPair = getCurve().keyFromPrivate(arrayify$
|
|
43332
|
-
const digestBytes = arrayify$
|
|
43331
|
+
const keyPair = getCurve().keyFromPrivate(arrayify$2(this.privateKey));
|
|
43332
|
+
const digestBytes = arrayify$2(digest);
|
|
43333
43333
|
if (digestBytes.length !== 32) {
|
|
43334
43334
|
logger$a.throwArgumentError("bad digest length", "digest", digest);
|
|
43335
43335
|
}
|
|
43336
43336
|
const signature = keyPair.sign(digestBytes, { canonical: true });
|
|
43337
43337
|
return splitSignature({
|
|
43338
43338
|
recoveryParam: signature.recoveryParam,
|
|
43339
|
-
r: hexZeroPad$
|
|
43340
|
-
s: hexZeroPad$
|
|
43339
|
+
r: hexZeroPad$2("0x" + signature.r.toString(16), 32),
|
|
43340
|
+
s: hexZeroPad$2("0x" + signature.s.toString(16), 32),
|
|
43341
43341
|
});
|
|
43342
43342
|
}
|
|
43343
43343
|
computeSharedSecret(otherKey) {
|
|
43344
|
-
const keyPair = getCurve().keyFromPrivate(arrayify$
|
|
43345
|
-
const otherKeyPair = getCurve().keyFromPublic(arrayify$
|
|
43346
|
-
return hexZeroPad$
|
|
43344
|
+
const keyPair = getCurve().keyFromPrivate(arrayify$2(this.privateKey));
|
|
43345
|
+
const otherKeyPair = getCurve().keyFromPublic(arrayify$2(computePublicKey(otherKey)));
|
|
43346
|
+
return hexZeroPad$2("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);
|
|
43347
43347
|
}
|
|
43348
43348
|
static isSigningKey(value) {
|
|
43349
43349
|
return !!(value && value._isSigningKey);
|
|
@@ -43351,11 +43351,11 @@
|
|
|
43351
43351
|
}
|
|
43352
43352
|
function recoverPublicKey(digest, signature) {
|
|
43353
43353
|
const sig = splitSignature(signature);
|
|
43354
|
-
const rs = { r: arrayify$
|
|
43355
|
-
return "0x" + getCurve().recoverPubKey(arrayify$
|
|
43354
|
+
const rs = { r: arrayify$2(sig.r), s: arrayify$2(sig.s) };
|
|
43355
|
+
return "0x" + getCurve().recoverPubKey(arrayify$2(digest), rs, sig.recoveryParam).encode("hex", false);
|
|
43356
43356
|
}
|
|
43357
43357
|
function computePublicKey(key, compressed) {
|
|
43358
|
-
const bytes = arrayify$
|
|
43358
|
+
const bytes = arrayify$2(key);
|
|
43359
43359
|
if (bytes.length === 32) {
|
|
43360
43360
|
const signingKey = new SigningKey(bytes);
|
|
43361
43361
|
if (compressed) {
|
|
@@ -43396,7 +43396,7 @@
|
|
|
43396
43396
|
}
|
|
43397
43397
|
function handleNumber(value) {
|
|
43398
43398
|
if (value === "0x") {
|
|
43399
|
-
return Zero$1;
|
|
43399
|
+
return Zero$1$1;
|
|
43400
43400
|
}
|
|
43401
43401
|
return BigNumber$1$1.from(value);
|
|
43402
43402
|
}
|
|
@@ -43405,7 +43405,7 @@
|
|
|
43405
43405
|
return getAddress$1(hexDataSlice(keccak256$1(hexDataSlice(publicKey, 1)), 12));
|
|
43406
43406
|
}
|
|
43407
43407
|
function recoverAddress(digest, signature) {
|
|
43408
|
-
return computeAddress(recoverPublicKey(arrayify$
|
|
43408
|
+
return computeAddress(recoverPublicKey(arrayify$2(digest), signature));
|
|
43409
43409
|
}
|
|
43410
43410
|
function formatNumber(value, name) {
|
|
43411
43411
|
const result = stripZeros(BigNumber$1$1.from(value).toHexString());
|
|
@@ -43512,8 +43512,8 @@
|
|
|
43512
43512
|
catch (error) {
|
|
43513
43513
|
logger$9.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]);
|
|
43514
43514
|
}
|
|
43515
|
-
tx.r = hexZeroPad$
|
|
43516
|
-
tx.s = hexZeroPad$
|
|
43515
|
+
tx.r = hexZeroPad$2(fields[1], 32);
|
|
43516
|
+
tx.s = hexZeroPad$2(fields[2], 32);
|
|
43517
43517
|
try {
|
|
43518
43518
|
const digest = keccak256$1(serialize(tx));
|
|
43519
43519
|
tx.from = recoverAddress(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v });
|
|
@@ -43600,8 +43600,8 @@
|
|
|
43600
43600
|
console.log(error);
|
|
43601
43601
|
return tx;
|
|
43602
43602
|
}
|
|
43603
|
-
tx.r = hexZeroPad$
|
|
43604
|
-
tx.s = hexZeroPad$
|
|
43603
|
+
tx.r = hexZeroPad$2(transaction[7], 32);
|
|
43604
|
+
tx.s = hexZeroPad$2(transaction[8], 32);
|
|
43605
43605
|
if (BigNumber$1$1.from(tx.r).isZero() && BigNumber$1$1.from(tx.s).isZero()) {
|
|
43606
43606
|
// EIP-155 unsigned transaction
|
|
43607
43607
|
tx.chainId = tx.v;
|
|
@@ -43634,7 +43634,7 @@
|
|
|
43634
43634
|
return tx;
|
|
43635
43635
|
}
|
|
43636
43636
|
function parse(rawTransaction) {
|
|
43637
|
-
const payload = arrayify$
|
|
43637
|
+
const payload = arrayify$2(rawTransaction);
|
|
43638
43638
|
// Legacy and EIP-155 Transactions
|
|
43639
43639
|
if (payload[0] > 0x7f) {
|
|
43640
43640
|
return _parse(payload);
|
|
@@ -43791,7 +43791,7 @@
|
|
|
43791
43791
|
// is always a non-nil to address, we can ignore G_create, but may wish to add
|
|
43792
43792
|
// similar logic to the ContractFactory.
|
|
43793
43793
|
let intrinsic = 21000;
|
|
43794
|
-
const bytes = arrayify$
|
|
43794
|
+
const bytes = arrayify$2(data);
|
|
43795
43795
|
for (let i = 0; i < bytes.length; i++) {
|
|
43796
43796
|
intrinsic += 4;
|
|
43797
43797
|
if (bytes[i]) {
|
|
@@ -44518,14 +44518,14 @@
|
|
|
44518
44518
|
|
|
44519
44519
|
var BN$2 = bn$2.BN;
|
|
44520
44520
|
const logger$7 = new Logger$2(version$5$1);
|
|
44521
|
-
const _constructorGuard$1$
|
|
44521
|
+
const _constructorGuard$1$2 = {};
|
|
44522
44522
|
const MAX_SAFE$2 = 0x1fffffffffffff;
|
|
44523
44523
|
// Only warn about passing 10 into radix once
|
|
44524
44524
|
let _warnedToStringRadix$2 = false;
|
|
44525
44525
|
class BigNumber$2 {
|
|
44526
44526
|
constructor(constructorGuard, hex) {
|
|
44527
44527
|
logger$7.checkNew(new.target, BigNumber$2);
|
|
44528
|
-
if (constructorGuard !== _constructorGuard$1$
|
|
44528
|
+
if (constructorGuard !== _constructorGuard$1$2) {
|
|
44529
44529
|
logger$7.throwError("cannot call constructor directly; use BigNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
44530
44530
|
operation: "new (BigNumber)"
|
|
44531
44531
|
});
|
|
@@ -44684,10 +44684,10 @@
|
|
|
44684
44684
|
}
|
|
44685
44685
|
if (typeof (value) === "string") {
|
|
44686
44686
|
if (value.match(/^-?0x[0-9a-f]+$/i)) {
|
|
44687
|
-
return new BigNumber$2(_constructorGuard$1$
|
|
44687
|
+
return new BigNumber$2(_constructorGuard$1$2, toHex$3(value));
|
|
44688
44688
|
}
|
|
44689
44689
|
if (value.match(/^-?[0-9]+$/)) {
|
|
44690
|
-
return new BigNumber$2(_constructorGuard$1$
|
|
44690
|
+
return new BigNumber$2(_constructorGuard$1$2, toHex$3(new BN$2(value)));
|
|
44691
44691
|
}
|
|
44692
44692
|
return logger$7.throwArgumentError("invalid BigNumber string", "value", value);
|
|
44693
44693
|
}
|
|
@@ -44845,7 +44845,7 @@
|
|
|
44845
44845
|
}
|
|
44846
44846
|
}
|
|
44847
44847
|
encode(value) {
|
|
44848
|
-
let source = arrayify$
|
|
44848
|
+
let source = arrayify$2(value);
|
|
44849
44849
|
if (source.length === 0) {
|
|
44850
44850
|
return "";
|
|
44851
44851
|
}
|
|
@@ -44902,7 +44902,7 @@
|
|
|
44902
44902
|
for (let k = 0; value[k] === this._leader && k < value.length - 1; ++k) {
|
|
44903
44903
|
bytes.push(0);
|
|
44904
44904
|
}
|
|
44905
|
-
return arrayify$
|
|
44905
|
+
return arrayify$2(new Uint8Array(bytes.reverse()));
|
|
44906
44906
|
}
|
|
44907
44907
|
}
|
|
44908
44908
|
new BaseX("abcdefghijklmnopqrstuvwxyz234567");
|
|
@@ -44914,12 +44914,12 @@
|
|
|
44914
44914
|
|
|
44915
44915
|
new Logger$2(version$4$1);
|
|
44916
44916
|
function sha256(data) {
|
|
44917
|
-
return "0x" + (hash.sha256().update(arrayify$
|
|
44917
|
+
return "0x" + (hash.sha256().update(arrayify$2(data)).digest("hex"));
|
|
44918
44918
|
}
|
|
44919
44919
|
|
|
44920
|
-
const version$3$
|
|
44920
|
+
const version$3$2 = "networks/5.4.2";
|
|
44921
44921
|
|
|
44922
|
-
const logger$6 = new Logger$2(version$3$
|
|
44922
|
+
const logger$6 = new Logger$2(version$3$2);
|
|
44923
44923
|
function isRenetworkable(value) {
|
|
44924
44924
|
return (value && typeof (value.renetwork) === "function");
|
|
44925
44925
|
}
|
|
@@ -45133,7 +45133,7 @@
|
|
|
45133
45133
|
}
|
|
45134
45134
|
|
|
45135
45135
|
function encode$1(data) {
|
|
45136
|
-
data = arrayify$
|
|
45136
|
+
data = arrayify$2(data);
|
|
45137
45137
|
let textData = "";
|
|
45138
45138
|
for (let i = 0; i < data.length; i++) {
|
|
45139
45139
|
textData += String.fromCharCode(data[i]);
|
|
@@ -45184,7 +45184,7 @@
|
|
|
45184
45184
|
headers: headers,
|
|
45185
45185
|
statusCode: response.status,
|
|
45186
45186
|
statusMessage: response.statusText,
|
|
45187
|
-
body: arrayify$
|
|
45187
|
+
body: arrayify$2(new Uint8Array(body)),
|
|
45188
45188
|
};
|
|
45189
45189
|
});
|
|
45190
45190
|
}
|
|
@@ -45950,7 +45950,7 @@
|
|
|
45950
45950
|
if (!isHexString$2(value)) {
|
|
45951
45951
|
throw new Error("invalid uint256");
|
|
45952
45952
|
}
|
|
45953
|
-
return hexZeroPad$
|
|
45953
|
+
return hexZeroPad$2(value, 32);
|
|
45954
45954
|
}
|
|
45955
45955
|
_block(value, format) {
|
|
45956
45956
|
if (value.author != null && value.miner == null) {
|
|
@@ -46133,7 +46133,7 @@
|
|
|
46133
46133
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
46134
46134
|
});
|
|
46135
46135
|
};
|
|
46136
|
-
const logger$3$
|
|
46136
|
+
const logger$3$2 = new Logger$2(version$1$2);
|
|
46137
46137
|
//////////////////////////////
|
|
46138
46138
|
// Event Serializeing
|
|
46139
46139
|
function checkTopic(topic) {
|
|
@@ -46141,7 +46141,7 @@
|
|
|
46141
46141
|
return "null";
|
|
46142
46142
|
}
|
|
46143
46143
|
if (hexDataLength(topic) !== 32) {
|
|
46144
|
-
logger$3$
|
|
46144
|
+
logger$3$2.throwArgumentError("invalid topic", "topic", topic);
|
|
46145
46145
|
}
|
|
46146
46146
|
return topic.toLowerCase();
|
|
46147
46147
|
}
|
|
@@ -46196,7 +46196,7 @@
|
|
|
46196
46196
|
return "filter:*:" + serializeTopics(eventName);
|
|
46197
46197
|
}
|
|
46198
46198
|
else if (ForkEvent.isForkEvent(eventName)) {
|
|
46199
|
-
logger$3$
|
|
46199
|
+
logger$3$2.warn("not implemented");
|
|
46200
46200
|
throw new Error("not implemented");
|
|
46201
46201
|
}
|
|
46202
46202
|
else if (eventName && typeof (eventName) === "object") {
|
|
@@ -46284,7 +46284,7 @@
|
|
|
46284
46284
|
"700": { symbol: "xdai", ilk: "eth" },
|
|
46285
46285
|
};
|
|
46286
46286
|
function bytes32ify(value) {
|
|
46287
|
-
return hexZeroPad$
|
|
46287
|
+
return hexZeroPad$2(BigNumber$1$1.from(value).toHexString(), 32);
|
|
46288
46288
|
}
|
|
46289
46289
|
// Compute the Base58Check encoded data (checksum is first 4 bytes of sha256d)
|
|
46290
46290
|
function base58Encode(data) {
|
|
@@ -46323,14 +46323,14 @@
|
|
|
46323
46323
|
_getAddress(coinType, hexBytes) {
|
|
46324
46324
|
const coinInfo = coinInfos[String(coinType)];
|
|
46325
46325
|
if (coinInfo == null) {
|
|
46326
|
-
logger$3$
|
|
46326
|
+
logger$3$2.throwError(`unsupported coin type: ${coinType}`, Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
46327
46327
|
operation: `getAddress(${coinType})`
|
|
46328
46328
|
});
|
|
46329
46329
|
}
|
|
46330
46330
|
if (coinInfo.ilk === "eth") {
|
|
46331
46331
|
return this.provider.formatter.address(hexBytes);
|
|
46332
46332
|
}
|
|
46333
|
-
const bytes = arrayify$
|
|
46333
|
+
const bytes = arrayify$2(hexBytes);
|
|
46334
46334
|
// P2PKH: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
|
|
46335
46335
|
if (coinInfo.p2pkh != null) {
|
|
46336
46336
|
const p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);
|
|
@@ -46408,7 +46408,7 @@
|
|
|
46408
46408
|
// Compute the address
|
|
46409
46409
|
const address = this._getAddress(coinType, hexBytes);
|
|
46410
46410
|
if (address == null) {
|
|
46411
|
-
logger$3$
|
|
46411
|
+
logger$3$2.throwError(`invalid or unsupported coin data`, Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
46412
46412
|
operation: `getAddress(${coinType})`,
|
|
46413
46413
|
coinType: coinType,
|
|
46414
46414
|
data: hexBytes
|
|
@@ -46440,7 +46440,7 @@
|
|
|
46440
46440
|
return "bzz:/\/" + swarm[1];
|
|
46441
46441
|
}
|
|
46442
46442
|
}
|
|
46443
|
-
return logger$3$
|
|
46443
|
+
return logger$3$2.throwError(`invalid or unsupported content hash data`, Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
46444
46444
|
operation: "getContentHash()",
|
|
46445
46445
|
data: hexBytes
|
|
46446
46446
|
});
|
|
@@ -46455,7 +46455,7 @@
|
|
|
46455
46455
|
keyBytes = concat([bytes32ify(64), bytes32ify(keyBytes.length), keyBytes]);
|
|
46456
46456
|
// Pad to word-size (32 bytes)
|
|
46457
46457
|
if ((keyBytes.length % 32) !== 0) {
|
|
46458
|
-
keyBytes = concat([keyBytes, hexZeroPad$
|
|
46458
|
+
keyBytes = concat([keyBytes, hexZeroPad$2("0x", 32 - (key.length % 32))]);
|
|
46459
46459
|
}
|
|
46460
46460
|
const hexBytes = yield this._fetchBytes("0x59d1d43c", hexlify$2(keyBytes));
|
|
46461
46461
|
if (hexBytes == null || hexBytes === "0x") {
|
|
@@ -46478,7 +46478,7 @@
|
|
|
46478
46478
|
*
|
|
46479
46479
|
*/
|
|
46480
46480
|
constructor(network) {
|
|
46481
|
-
logger$3$
|
|
46481
|
+
logger$3$2.checkNew(new.target, Provider);
|
|
46482
46482
|
super();
|
|
46483
46483
|
// Events being listened to
|
|
46484
46484
|
this._events = [];
|
|
@@ -46505,7 +46505,7 @@
|
|
|
46505
46505
|
this.emit("network", knownNetwork, null);
|
|
46506
46506
|
}
|
|
46507
46507
|
else {
|
|
46508
|
-
logger$3$
|
|
46508
|
+
logger$3$2.throwArgumentError("invalid network", "network", network);
|
|
46509
46509
|
}
|
|
46510
46510
|
}
|
|
46511
46511
|
this._maxInternalBlockNumber = -1024;
|
|
@@ -46530,7 +46530,7 @@
|
|
|
46530
46530
|
// This should never happen; every Provider sub-class should have
|
|
46531
46531
|
// suggested a network by here (or have thrown).
|
|
46532
46532
|
if (!network) {
|
|
46533
|
-
logger$3$
|
|
46533
|
+
logger$3$2.throwError("no network detected", Logger$2.errors.UNKNOWN_ERROR, {});
|
|
46534
46534
|
}
|
|
46535
46535
|
// Possible this call stacked so do not call defineReadOnly again
|
|
46536
46536
|
if (this._network == null) {
|
|
@@ -46662,8 +46662,8 @@
|
|
|
46662
46662
|
this._emitted.block = blockNumber - 1;
|
|
46663
46663
|
}
|
|
46664
46664
|
if (Math.abs((this._emitted.block) - blockNumber) > 1000) {
|
|
46665
|
-
logger$3$
|
|
46666
|
-
this.emit("error", logger$3$
|
|
46665
|
+
logger$3$2.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${blockNumber})`);
|
|
46666
|
+
this.emit("error", logger$3$2.makeError("network block skew detected", Logger$2.errors.NETWORK_ERROR, {
|
|
46667
46667
|
blockNumber: blockNumber,
|
|
46668
46668
|
event: "blockSkew",
|
|
46669
46669
|
previousBlockNumber: this._emitted.block
|
|
@@ -46760,7 +46760,7 @@
|
|
|
46760
46760
|
// can change, such as when connected to a JSON-RPC backend
|
|
46761
46761
|
detectNetwork() {
|
|
46762
46762
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
46763
|
-
return logger$3$
|
|
46763
|
+
return logger$3$2.throwError("provider does not support network detection", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
46764
46764
|
operation: "provider.detectNetwork"
|
|
46765
46765
|
});
|
|
46766
46766
|
});
|
|
@@ -46792,7 +46792,7 @@
|
|
|
46792
46792
|
yield stall(0);
|
|
46793
46793
|
return this._network;
|
|
46794
46794
|
}
|
|
46795
|
-
const error = logger$3$
|
|
46795
|
+
const error = logger$3$2.makeError("underlying network changed", Logger$2.errors.NETWORK_ERROR, {
|
|
46796
46796
|
event: "changed",
|
|
46797
46797
|
network: network,
|
|
46798
46798
|
detectedNetwork: currentNetwork
|
|
@@ -46979,7 +46979,7 @@
|
|
|
46979
46979
|
reason = "cancelled";
|
|
46980
46980
|
}
|
|
46981
46981
|
// Explain why we were replaced
|
|
46982
|
-
reject(logger$3$
|
|
46982
|
+
reject(logger$3$2.makeError("transaction was replaced", Logger$2.errors.TRANSACTION_REPLACED, {
|
|
46983
46983
|
cancelled: (reason === "replaced" || reason === "cancelled"),
|
|
46984
46984
|
reason,
|
|
46985
46985
|
replacement: this._wrapTransaction(tx),
|
|
@@ -47016,7 +47016,7 @@
|
|
|
47016
47016
|
if (alreadyDone()) {
|
|
47017
47017
|
return;
|
|
47018
47018
|
}
|
|
47019
|
-
reject(logger$3$
|
|
47019
|
+
reject(logger$3$2.makeError("timeout exceeded", Logger$2.errors.TIMEOUT, { timeout: timeout }));
|
|
47020
47020
|
}, timeout);
|
|
47021
47021
|
if (timer.unref) {
|
|
47022
47022
|
timer.unref();
|
|
@@ -47039,7 +47039,7 @@
|
|
|
47039
47039
|
return BigNumber$1$1.from(result);
|
|
47040
47040
|
}
|
|
47041
47041
|
catch (error) {
|
|
47042
|
-
return logger$3$
|
|
47042
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47043
47043
|
method: "getGasPrice",
|
|
47044
47044
|
result, error
|
|
47045
47045
|
});
|
|
@@ -47058,7 +47058,7 @@
|
|
|
47058
47058
|
return BigNumber$1$1.from(result);
|
|
47059
47059
|
}
|
|
47060
47060
|
catch (error) {
|
|
47061
|
-
return logger$3$
|
|
47061
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47062
47062
|
method: "getBalance",
|
|
47063
47063
|
params, result, error
|
|
47064
47064
|
});
|
|
@@ -47077,7 +47077,7 @@
|
|
|
47077
47077
|
return BigNumber$1$1.from(result).toNumber();
|
|
47078
47078
|
}
|
|
47079
47079
|
catch (error) {
|
|
47080
|
-
return logger$3$
|
|
47080
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47081
47081
|
method: "getTransactionCount",
|
|
47082
47082
|
params, result, error
|
|
47083
47083
|
});
|
|
@@ -47096,7 +47096,7 @@
|
|
|
47096
47096
|
return hexlify$2(result);
|
|
47097
47097
|
}
|
|
47098
47098
|
catch (error) {
|
|
47099
|
-
return logger$3$
|
|
47099
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47100
47100
|
method: "getCode",
|
|
47101
47101
|
params, result, error
|
|
47102
47102
|
});
|
|
@@ -47116,7 +47116,7 @@
|
|
|
47116
47116
|
return hexlify$2(result);
|
|
47117
47117
|
}
|
|
47118
47118
|
catch (error) {
|
|
47119
|
-
return logger$3$
|
|
47119
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47120
47120
|
method: "getStorageAt",
|
|
47121
47121
|
params, result, error
|
|
47122
47122
|
});
|
|
@@ -47131,7 +47131,7 @@
|
|
|
47131
47131
|
const result = tx;
|
|
47132
47132
|
// Check the hash we expect is the same as the hash the server reported
|
|
47133
47133
|
if (hash != null && tx.hash !== hash) {
|
|
47134
|
-
logger$3$
|
|
47134
|
+
logger$3$2.throwError("Transaction hash mismatch from Provider.sendTransaction.", Logger$2.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });
|
|
47135
47135
|
}
|
|
47136
47136
|
result.wait = (confirms, timeout) => __awaiter$1(this, void 0, void 0, function* () {
|
|
47137
47137
|
if (confirms == null) {
|
|
@@ -47159,7 +47159,7 @@
|
|
|
47159
47159
|
// No longer pending, allow the polling loop to garbage collect this
|
|
47160
47160
|
this._emitted["t:" + tx.hash] = receipt.blockNumber;
|
|
47161
47161
|
if (receipt.status === 0) {
|
|
47162
|
-
logger$3$
|
|
47162
|
+
logger$3$2.throwError("transaction failed", Logger$2.errors.CALL_EXCEPTION, {
|
|
47163
47163
|
transactionHash: tx.hash,
|
|
47164
47164
|
transaction: tx,
|
|
47165
47165
|
receipt: receipt
|
|
@@ -47257,7 +47257,7 @@
|
|
|
47257
47257
|
return hexlify$2(result);
|
|
47258
47258
|
}
|
|
47259
47259
|
catch (error) {
|
|
47260
|
-
return logger$3$
|
|
47260
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47261
47261
|
method: "call",
|
|
47262
47262
|
params, result, error
|
|
47263
47263
|
});
|
|
@@ -47275,7 +47275,7 @@
|
|
|
47275
47275
|
return BigNumber$1$1.from(result);
|
|
47276
47276
|
}
|
|
47277
47277
|
catch (error) {
|
|
47278
|
-
return logger$3$
|
|
47278
|
+
return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, {
|
|
47279
47279
|
method: "estimateGas",
|
|
47280
47280
|
params, result, error
|
|
47281
47281
|
});
|
|
@@ -47286,7 +47286,7 @@
|
|
|
47286
47286
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
47287
47287
|
const address = yield this.resolveName(addressOrName);
|
|
47288
47288
|
if (address == null) {
|
|
47289
|
-
logger$3$
|
|
47289
|
+
logger$3$2.throwError("ENS name not configured", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
47290
47290
|
operation: `resolveName(${JSON.stringify(addressOrName)})`
|
|
47291
47291
|
});
|
|
47292
47292
|
}
|
|
@@ -47313,7 +47313,7 @@
|
|
|
47313
47313
|
}
|
|
47314
47314
|
}
|
|
47315
47315
|
catch (error) {
|
|
47316
|
-
logger$3$
|
|
47316
|
+
logger$3$2.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag);
|
|
47317
47317
|
}
|
|
47318
47318
|
}
|
|
47319
47319
|
return poll(() => __awaiter$1(this, void 0, void 0, function* () {
|
|
@@ -47459,7 +47459,7 @@
|
|
|
47459
47459
|
blockTag = yield blockTag;
|
|
47460
47460
|
if (typeof (blockTag) === "number" && blockTag < 0) {
|
|
47461
47461
|
if (blockTag % 1) {
|
|
47462
|
-
logger$3$
|
|
47462
|
+
logger$3$2.throwArgumentError("invalid BlockTag", "blockTag", blockTag);
|
|
47463
47463
|
}
|
|
47464
47464
|
let blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval);
|
|
47465
47465
|
blockNumber += blockTag;
|
|
@@ -47494,7 +47494,7 @@
|
|
|
47494
47494
|
const network = yield this.getNetwork();
|
|
47495
47495
|
// No ENS...
|
|
47496
47496
|
if (!network.ensAddress) {
|
|
47497
|
-
logger$3$
|
|
47497
|
+
logger$3$2.throwError("network does not support ENS", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name });
|
|
47498
47498
|
}
|
|
47499
47499
|
// keccak256("resolver(bytes32)")
|
|
47500
47500
|
const transaction = {
|
|
@@ -47526,7 +47526,7 @@
|
|
|
47526
47526
|
}
|
|
47527
47527
|
}
|
|
47528
47528
|
if (typeof (name) !== "string") {
|
|
47529
|
-
logger$3$
|
|
47529
|
+
logger$3$2.throwArgumentError("invalid ENS name", "name", name);
|
|
47530
47530
|
}
|
|
47531
47531
|
// Get the addr from the resovler
|
|
47532
47532
|
const resolver = yield this.getResolver(name);
|
|
@@ -47546,7 +47546,7 @@
|
|
|
47546
47546
|
return null;
|
|
47547
47547
|
}
|
|
47548
47548
|
// keccak("name(bytes32)")
|
|
47549
|
-
let bytes = arrayify$
|
|
47549
|
+
let bytes = arrayify$2(yield this.call({
|
|
47550
47550
|
to: resolverAddress,
|
|
47551
47551
|
data: ("0x691f3431" + namehash(reverseName).substring(2))
|
|
47552
47552
|
}));
|
|
@@ -47576,7 +47576,7 @@
|
|
|
47576
47576
|
});
|
|
47577
47577
|
}
|
|
47578
47578
|
perform(method, params) {
|
|
47579
|
-
return logger$3$
|
|
47579
|
+
return logger$3$2.throwError(method + " not implemented", Logger$2.errors.NOT_IMPLEMENTED, { operation: method });
|
|
47580
47580
|
}
|
|
47581
47581
|
_startEvent(event) {
|
|
47582
47582
|
this.polling = (this._events.filter((e) => e.pollable()).length > 0);
|
|
@@ -47686,7 +47686,7 @@
|
|
|
47686
47686
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47687
47687
|
});
|
|
47688
47688
|
};
|
|
47689
|
-
const logger$2$
|
|
47689
|
+
const logger$2$2 = new Logger$2(version$1$2);
|
|
47690
47690
|
const errorGas = ["call", "estimateGas"];
|
|
47691
47691
|
function checkError(method, error, params) {
|
|
47692
47692
|
// Undo the "convenience" some nodes are attempting to prevent backwards
|
|
@@ -47696,7 +47696,7 @@
|
|
|
47696
47696
|
if (e && e.message.match("reverted") && isHexString$2(e.data)) {
|
|
47697
47697
|
return e.data;
|
|
47698
47698
|
}
|
|
47699
|
-
logger$2$
|
|
47699
|
+
logger$2$2.throwError("missing revert data in call exception", Logger$2.errors.CALL_EXCEPTION, {
|
|
47700
47700
|
error, data: "0x"
|
|
47701
47701
|
});
|
|
47702
47702
|
}
|
|
@@ -47714,30 +47714,30 @@
|
|
|
47714
47714
|
const transaction = params.transaction || params.signedTransaction;
|
|
47715
47715
|
// "insufficient funds for gas * price + value + cost(data)"
|
|
47716
47716
|
if (message.match(/insufficient funds|base fee exceeds gas limit/)) {
|
|
47717
|
-
logger$2$
|
|
47717
|
+
logger$2$2.throwError("insufficient funds for intrinsic transaction cost", Logger$2.errors.INSUFFICIENT_FUNDS, {
|
|
47718
47718
|
error, method, transaction
|
|
47719
47719
|
});
|
|
47720
47720
|
}
|
|
47721
47721
|
// "nonce too low"
|
|
47722
47722
|
if (message.match(/nonce too low/)) {
|
|
47723
|
-
logger$2$
|
|
47723
|
+
logger$2$2.throwError("nonce has already been used", Logger$2.errors.NONCE_EXPIRED, {
|
|
47724
47724
|
error, method, transaction
|
|
47725
47725
|
});
|
|
47726
47726
|
}
|
|
47727
47727
|
// "replacement transaction underpriced"
|
|
47728
47728
|
if (message.match(/replacement transaction underpriced/)) {
|
|
47729
|
-
logger$2$
|
|
47729
|
+
logger$2$2.throwError("replacement fee too low", Logger$2.errors.REPLACEMENT_UNDERPRICED, {
|
|
47730
47730
|
error, method, transaction
|
|
47731
47731
|
});
|
|
47732
47732
|
}
|
|
47733
47733
|
// "replacement transaction underpriced"
|
|
47734
47734
|
if (message.match(/only replay-protected/)) {
|
|
47735
|
-
logger$2$
|
|
47735
|
+
logger$2$2.throwError("legacy pre-eip-155 transactions not supported", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
47736
47736
|
error, method, transaction
|
|
47737
47737
|
});
|
|
47738
47738
|
}
|
|
47739
47739
|
if (errorGas.indexOf(method) >= 0 && message.match(/gas required exceeds allowance|always failing transaction|execution reverted/)) {
|
|
47740
|
-
logger$2$
|
|
47740
|
+
logger$2$2.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$2.errors.UNPREDICTABLE_GAS_LIMIT, {
|
|
47741
47741
|
error, method, transaction
|
|
47742
47742
|
});
|
|
47743
47743
|
}
|
|
@@ -47767,7 +47767,7 @@
|
|
|
47767
47767
|
const _constructorGuard$5 = {};
|
|
47768
47768
|
class JsonRpcSigner extends Signer {
|
|
47769
47769
|
constructor(constructorGuard, provider, addressOrIndex) {
|
|
47770
|
-
logger$2$
|
|
47770
|
+
logger$2$2.checkNew(new.target, JsonRpcSigner);
|
|
47771
47771
|
super();
|
|
47772
47772
|
if (constructorGuard !== _constructorGuard$5) {
|
|
47773
47773
|
throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");
|
|
@@ -47785,11 +47785,11 @@
|
|
|
47785
47785
|
defineReadOnly(this, "_address", null);
|
|
47786
47786
|
}
|
|
47787
47787
|
else {
|
|
47788
|
-
logger$2$
|
|
47788
|
+
logger$2$2.throwArgumentError("invalid address or index", "addressOrIndex", addressOrIndex);
|
|
47789
47789
|
}
|
|
47790
47790
|
}
|
|
47791
47791
|
connect(provider) {
|
|
47792
|
-
return logger$2$
|
|
47792
|
+
return logger$2$2.throwError("cannot alter JSON-RPC Signer connection", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
47793
47793
|
operation: "connect"
|
|
47794
47794
|
});
|
|
47795
47795
|
}
|
|
@@ -47802,7 +47802,7 @@
|
|
|
47802
47802
|
}
|
|
47803
47803
|
return this.provider.send("eth_accounts", []).then((accounts) => {
|
|
47804
47804
|
if (accounts.length <= this._index) {
|
|
47805
|
-
logger$2$
|
|
47805
|
+
logger$2$2.throwError("unknown account #" + this._index, Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
47806
47806
|
operation: "getAddress"
|
|
47807
47807
|
});
|
|
47808
47808
|
}
|
|
@@ -47832,7 +47832,7 @@
|
|
|
47832
47832
|
}
|
|
47833
47833
|
const address = yield this.provider.resolveName(to);
|
|
47834
47834
|
if (address == null) {
|
|
47835
|
-
logger$2$
|
|
47835
|
+
logger$2$2.throwArgumentError("provided ENS name resolves to null", "tx.to", to);
|
|
47836
47836
|
}
|
|
47837
47837
|
return address;
|
|
47838
47838
|
}));
|
|
@@ -47843,7 +47843,7 @@
|
|
|
47843
47843
|
}).then(({ tx, sender }) => {
|
|
47844
47844
|
if (tx.from != null) {
|
|
47845
47845
|
if (tx.from.toLowerCase() !== sender) {
|
|
47846
|
-
logger$2$
|
|
47846
|
+
logger$2$2.throwArgumentError("from address mismatch", "transaction", transaction);
|
|
47847
47847
|
}
|
|
47848
47848
|
}
|
|
47849
47849
|
else {
|
|
@@ -47858,7 +47858,7 @@
|
|
|
47858
47858
|
});
|
|
47859
47859
|
}
|
|
47860
47860
|
signTransaction(transaction) {
|
|
47861
|
-
return logger$2$
|
|
47861
|
+
return logger$2$2.throwError("signing transactions is unsupported", Logger$2.errors.UNSUPPORTED_OPERATION, {
|
|
47862
47862
|
operation: "signTransaction"
|
|
47863
47863
|
});
|
|
47864
47864
|
}
|
|
@@ -47940,7 +47940,7 @@
|
|
|
47940
47940
|
};
|
|
47941
47941
|
class JsonRpcProvider extends BaseProvider {
|
|
47942
47942
|
constructor(url, network) {
|
|
47943
|
-
logger$2$
|
|
47943
|
+
logger$2$2.checkNew(new.target, JsonRpcProvider);
|
|
47944
47944
|
let networkOrReady = network;
|
|
47945
47945
|
// The network is unknown, query the JSON-RPC for it
|
|
47946
47946
|
if (networkOrReady == null) {
|
|
@@ -48007,14 +48007,14 @@
|
|
|
48007
48007
|
return getNetwork(BigNumber$1$1.from(chainId).toNumber());
|
|
48008
48008
|
}
|
|
48009
48009
|
catch (error) {
|
|
48010
|
-
return logger$2$
|
|
48010
|
+
return logger$2$2.throwError("could not detect network", Logger$2.errors.NETWORK_ERROR, {
|
|
48011
48011
|
chainId: chainId,
|
|
48012
48012
|
event: "invalidNetwork",
|
|
48013
48013
|
serverError: error
|
|
48014
48014
|
});
|
|
48015
48015
|
}
|
|
48016
48016
|
}
|
|
48017
|
-
return logger$2$
|
|
48017
|
+
return logger$2$2.throwError("could not detect network", Logger$2.errors.NETWORK_ERROR, {
|
|
48018
48018
|
event: "noNetwork"
|
|
48019
48019
|
});
|
|
48020
48020
|
});
|
|
@@ -48139,7 +48139,7 @@
|
|
|
48139
48139
|
}
|
|
48140
48140
|
const args = this.prepareRequest(method, params);
|
|
48141
48141
|
if (args == null) {
|
|
48142
|
-
logger$2$
|
|
48142
|
+
logger$2$2.throwError(method + " not implemented", Logger$2.errors.NOT_IMPLEMENTED, { operation: method });
|
|
48143
48143
|
}
|
|
48144
48144
|
try {
|
|
48145
48145
|
return yield this.send(args[0], args[1]);
|
|
@@ -48388,7 +48388,7 @@
|
|
|
48388
48388
|
const version$k = "units/5.4.0";
|
|
48389
48389
|
|
|
48390
48390
|
const logger$r = new Logger$2(version$k);
|
|
48391
|
-
const names$
|
|
48391
|
+
const names$2 = [
|
|
48392
48392
|
"wei",
|
|
48393
48393
|
"kwei",
|
|
48394
48394
|
"mwei",
|
|
@@ -48397,17 +48397,17 @@
|
|
|
48397
48397
|
"finney",
|
|
48398
48398
|
"ether",
|
|
48399
48399
|
];
|
|
48400
|
-
function parseUnits$
|
|
48400
|
+
function parseUnits$2(value, unitName) {
|
|
48401
48401
|
if (typeof (value) !== "string") {
|
|
48402
48402
|
logger$r.throwArgumentError("value must be a string", "value", value);
|
|
48403
48403
|
}
|
|
48404
48404
|
if (typeof (unitName) === "string") {
|
|
48405
|
-
const index = names$
|
|
48405
|
+
const index = names$2.indexOf(unitName);
|
|
48406
48406
|
if (index !== -1) {
|
|
48407
48407
|
unitName = 3 * index;
|
|
48408
48408
|
}
|
|
48409
48409
|
}
|
|
48410
|
-
return parseFixed$
|
|
48410
|
+
return parseFixed$2(value, (unitName != null) ? unitName : 18);
|
|
48411
48411
|
}
|
|
48412
48412
|
|
|
48413
48413
|
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; }
|
|
@@ -48438,7 +48438,7 @@
|
|
|
48438
48438
|
|
|
48439
48439
|
static bigNumberify(value, blockchain) {
|
|
48440
48440
|
if (typeof value === 'number') {
|
|
48441
|
-
return parseUnits$
|
|
48441
|
+
return parseUnits$2(value.toString(), CONSTANTS$2[blockchain].DECIMALS)
|
|
48442
48442
|
} else if (value && value.toString) {
|
|
48443
48443
|
return BigNumber$2.from(value.toString())
|
|
48444
48444
|
} else {
|
|
@@ -55414,7 +55414,7 @@
|
|
|
55414
55414
|
|
|
55415
55415
|
async BigNumber(amount) {
|
|
55416
55416
|
let decimals = await this.decimals();
|
|
55417
|
-
return parseUnits$
|
|
55417
|
+
return parseUnits$3(
|
|
55418
55418
|
Token.safeAmount({ amount: parseFloat(amount), decimals }).toString(),
|
|
55419
55419
|
decimals
|
|
55420
55420
|
)
|
|
@@ -59421,20 +59421,20 @@
|
|
|
59421
59421
|
Logger$1.errors = ErrorCode$1;
|
|
59422
59422
|
Logger$1.levels = LogLevel$1;
|
|
59423
59423
|
|
|
59424
|
-
const version$3 = "bytes/5.4.0";
|
|
59424
|
+
const version$3$1 = "bytes/5.4.0";
|
|
59425
59425
|
|
|
59426
|
-
const logger$4 = new Logger$1(version$3);
|
|
59426
|
+
const logger$4 = new Logger$1(version$3$1);
|
|
59427
59427
|
///////////////////////////////
|
|
59428
59428
|
function isHexable$1(value) {
|
|
59429
59429
|
return !!(value.toHexString);
|
|
59430
59430
|
}
|
|
59431
|
-
function addSlice(array) {
|
|
59431
|
+
function addSlice$1(array) {
|
|
59432
59432
|
if (array.slice) {
|
|
59433
59433
|
return array;
|
|
59434
59434
|
}
|
|
59435
59435
|
array.slice = function () {
|
|
59436
59436
|
const args = Array.prototype.slice.call(arguments);
|
|
59437
|
-
return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
59437
|
+
return addSlice$1(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
59438
59438
|
};
|
|
59439
59439
|
return array;
|
|
59440
59440
|
}
|
|
@@ -59459,7 +59459,7 @@
|
|
|
59459
59459
|
}
|
|
59460
59460
|
return true;
|
|
59461
59461
|
}
|
|
59462
|
-
function arrayify(value, options) {
|
|
59462
|
+
function arrayify$1(value, options) {
|
|
59463
59463
|
if (!options) {
|
|
59464
59464
|
options = {};
|
|
59465
59465
|
}
|
|
@@ -59473,7 +59473,7 @@
|
|
|
59473
59473
|
if (result.length === 0) {
|
|
59474
59474
|
result.push(0);
|
|
59475
59475
|
}
|
|
59476
|
-
return addSlice(new Uint8Array(result));
|
|
59476
|
+
return addSlice$1(new Uint8Array(result));
|
|
59477
59477
|
}
|
|
59478
59478
|
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
59479
59479
|
value = "0x" + value;
|
|
@@ -59498,10 +59498,10 @@
|
|
|
59498
59498
|
for (let i = 0; i < hex.length; i += 2) {
|
|
59499
59499
|
result.push(parseInt(hex.substring(i, i + 2), 16));
|
|
59500
59500
|
}
|
|
59501
|
-
return addSlice(new Uint8Array(result));
|
|
59501
|
+
return addSlice$1(new Uint8Array(result));
|
|
59502
59502
|
}
|
|
59503
59503
|
if (isBytes$1(value)) {
|
|
59504
|
-
return addSlice(new Uint8Array(value));
|
|
59504
|
+
return addSlice$1(new Uint8Array(value));
|
|
59505
59505
|
}
|
|
59506
59506
|
return logger$4.throwArgumentError("invalid arrayify value", "value", value);
|
|
59507
59507
|
}
|
|
@@ -59571,7 +59571,7 @@
|
|
|
59571
59571
|
}
|
|
59572
59572
|
return logger$4.throwArgumentError("invalid hexlify value", "value", value);
|
|
59573
59573
|
}
|
|
59574
|
-
function hexZeroPad(value, length) {
|
|
59574
|
+
function hexZeroPad$1(value, length) {
|
|
59575
59575
|
if (typeof (value) !== "string") {
|
|
59576
59576
|
value = hexlify$1(value);
|
|
59577
59577
|
}
|
|
@@ -59590,10 +59590,10 @@
|
|
|
59590
59590
|
const version$2$1 = "bignumber/5.4.1";
|
|
59591
59591
|
|
|
59592
59592
|
var BN$1 = bn$1.BN;
|
|
59593
|
-
const logger$3 = new Logger$1(version$2$1);
|
|
59594
|
-
const _constructorGuard$1 = {};
|
|
59593
|
+
const logger$3$1 = new Logger$1(version$2$1);
|
|
59594
|
+
const _constructorGuard$1$1 = {};
|
|
59595
59595
|
const MAX_SAFE$1 = 0x1fffffffffffff;
|
|
59596
|
-
function isBigNumberish(value) {
|
|
59596
|
+
function isBigNumberish$1(value) {
|
|
59597
59597
|
return (value != null) && (BigNumber$1.isBigNumber(value) ||
|
|
59598
59598
|
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
59599
59599
|
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
@@ -59605,9 +59605,9 @@
|
|
|
59605
59605
|
let _warnedToStringRadix$1 = false;
|
|
59606
59606
|
class BigNumber$1 {
|
|
59607
59607
|
constructor(constructorGuard, hex) {
|
|
59608
|
-
logger$3.checkNew(new.target, BigNumber$1);
|
|
59609
|
-
if (constructorGuard !== _constructorGuard$1) {
|
|
59610
|
-
logger$3.throwError("cannot call constructor directly; use BigNumber.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59608
|
+
logger$3$1.checkNew(new.target, BigNumber$1);
|
|
59609
|
+
if (constructorGuard !== _constructorGuard$1$1) {
|
|
59610
|
+
logger$3$1.throwError("cannot call constructor directly; use BigNumber.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59611
59611
|
operation: "new (BigNumber)"
|
|
59612
59612
|
});
|
|
59613
59613
|
}
|
|
@@ -59636,7 +59636,7 @@
|
|
|
59636
59636
|
div(other) {
|
|
59637
59637
|
const o = BigNumber$1.from(other);
|
|
59638
59638
|
if (o.isZero()) {
|
|
59639
|
-
throwFault$1("division by zero", "div");
|
|
59639
|
+
throwFault$1$1("division by zero", "div");
|
|
59640
59640
|
}
|
|
59641
59641
|
return toBigNumber$1(toBN$1(this).div(toBN$1(other)));
|
|
59642
59642
|
}
|
|
@@ -59646,53 +59646,53 @@
|
|
|
59646
59646
|
mod(other) {
|
|
59647
59647
|
const value = toBN$1(other);
|
|
59648
59648
|
if (value.isNeg()) {
|
|
59649
|
-
throwFault$1("cannot modulo negative values", "mod");
|
|
59649
|
+
throwFault$1$1("cannot modulo negative values", "mod");
|
|
59650
59650
|
}
|
|
59651
59651
|
return toBigNumber$1(toBN$1(this).umod(value));
|
|
59652
59652
|
}
|
|
59653
59653
|
pow(other) {
|
|
59654
59654
|
const value = toBN$1(other);
|
|
59655
59655
|
if (value.isNeg()) {
|
|
59656
|
-
throwFault$1("cannot raise to negative values", "pow");
|
|
59656
|
+
throwFault$1$1("cannot raise to negative values", "pow");
|
|
59657
59657
|
}
|
|
59658
59658
|
return toBigNumber$1(toBN$1(this).pow(value));
|
|
59659
59659
|
}
|
|
59660
59660
|
and(other) {
|
|
59661
59661
|
const value = toBN$1(other);
|
|
59662
59662
|
if (this.isNegative() || value.isNeg()) {
|
|
59663
|
-
throwFault$1("cannot 'and' negative values", "and");
|
|
59663
|
+
throwFault$1$1("cannot 'and' negative values", "and");
|
|
59664
59664
|
}
|
|
59665
59665
|
return toBigNumber$1(toBN$1(this).and(value));
|
|
59666
59666
|
}
|
|
59667
59667
|
or(other) {
|
|
59668
59668
|
const value = toBN$1(other);
|
|
59669
59669
|
if (this.isNegative() || value.isNeg()) {
|
|
59670
|
-
throwFault$1("cannot 'or' negative values", "or");
|
|
59670
|
+
throwFault$1$1("cannot 'or' negative values", "or");
|
|
59671
59671
|
}
|
|
59672
59672
|
return toBigNumber$1(toBN$1(this).or(value));
|
|
59673
59673
|
}
|
|
59674
59674
|
xor(other) {
|
|
59675
59675
|
const value = toBN$1(other);
|
|
59676
59676
|
if (this.isNegative() || value.isNeg()) {
|
|
59677
|
-
throwFault$1("cannot 'xor' negative values", "xor");
|
|
59677
|
+
throwFault$1$1("cannot 'xor' negative values", "xor");
|
|
59678
59678
|
}
|
|
59679
59679
|
return toBigNumber$1(toBN$1(this).xor(value));
|
|
59680
59680
|
}
|
|
59681
59681
|
mask(value) {
|
|
59682
59682
|
if (this.isNegative() || value < 0) {
|
|
59683
|
-
throwFault$1("cannot mask negative values", "mask");
|
|
59683
|
+
throwFault$1$1("cannot mask negative values", "mask");
|
|
59684
59684
|
}
|
|
59685
59685
|
return toBigNumber$1(toBN$1(this).maskn(value));
|
|
59686
59686
|
}
|
|
59687
59687
|
shl(value) {
|
|
59688
59688
|
if (this.isNegative() || value < 0) {
|
|
59689
|
-
throwFault$1("cannot shift negative values", "shl");
|
|
59689
|
+
throwFault$1$1("cannot shift negative values", "shl");
|
|
59690
59690
|
}
|
|
59691
59691
|
return toBigNumber$1(toBN$1(this).shln(value));
|
|
59692
59692
|
}
|
|
59693
59693
|
shr(value) {
|
|
59694
59694
|
if (this.isNegative() || value < 0) {
|
|
59695
|
-
throwFault$1("cannot shift negative values", "shr");
|
|
59695
|
+
throwFault$1$1("cannot shift negative values", "shr");
|
|
59696
59696
|
}
|
|
59697
59697
|
return toBigNumber$1(toBN$1(this).shrn(value));
|
|
59698
59698
|
}
|
|
@@ -59722,7 +59722,7 @@
|
|
|
59722
59722
|
return toBN$1(this).toNumber();
|
|
59723
59723
|
}
|
|
59724
59724
|
catch (error) {
|
|
59725
|
-
throwFault$1("overflow", "toNumber", this.toString());
|
|
59725
|
+
throwFault$1$1("overflow", "toNumber", this.toString());
|
|
59726
59726
|
}
|
|
59727
59727
|
return null;
|
|
59728
59728
|
}
|
|
@@ -59731,7 +59731,7 @@
|
|
|
59731
59731
|
return BigInt(this.toString());
|
|
59732
59732
|
}
|
|
59733
59733
|
catch (e) { }
|
|
59734
|
-
return logger$3.throwError("this platform does not support BigInt", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59734
|
+
return logger$3$1.throwError("this platform does not support BigInt", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59735
59735
|
value: this.toString()
|
|
59736
59736
|
});
|
|
59737
59737
|
}
|
|
@@ -59741,14 +59741,14 @@
|
|
|
59741
59741
|
if (arguments[0] === 10) {
|
|
59742
59742
|
if (!_warnedToStringRadix$1) {
|
|
59743
59743
|
_warnedToStringRadix$1 = true;
|
|
59744
|
-
logger$3.warn("BigNumber.toString does not accept any parameters; base-10 is assumed");
|
|
59744
|
+
logger$3$1.warn("BigNumber.toString does not accept any parameters; base-10 is assumed");
|
|
59745
59745
|
}
|
|
59746
59746
|
}
|
|
59747
59747
|
else if (arguments[0] === 16) {
|
|
59748
|
-
logger$3.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$1.errors.UNEXPECTED_ARGUMENT, {});
|
|
59748
|
+
logger$3$1.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$1.errors.UNEXPECTED_ARGUMENT, {});
|
|
59749
59749
|
}
|
|
59750
59750
|
else {
|
|
59751
|
-
logger$3.throwError("BigNumber.toString does not accept parameters", Logger$1.errors.UNEXPECTED_ARGUMENT, {});
|
|
59751
|
+
logger$3$1.throwError("BigNumber.toString does not accept parameters", Logger$1.errors.UNEXPECTED_ARGUMENT, {});
|
|
59752
59752
|
}
|
|
59753
59753
|
}
|
|
59754
59754
|
return toBN$1(this).toString(10);
|
|
@@ -59765,19 +59765,19 @@
|
|
|
59765
59765
|
}
|
|
59766
59766
|
if (typeof (value) === "string") {
|
|
59767
59767
|
if (value.match(/^-?0x[0-9a-f]+$/i)) {
|
|
59768
|
-
return new BigNumber$1(_constructorGuard$1, toHex$1(value));
|
|
59768
|
+
return new BigNumber$1(_constructorGuard$1$1, toHex$1(value));
|
|
59769
59769
|
}
|
|
59770
59770
|
if (value.match(/^-?[0-9]+$/)) {
|
|
59771
|
-
return new BigNumber$1(_constructorGuard$1, toHex$1(new BN$1(value)));
|
|
59771
|
+
return new BigNumber$1(_constructorGuard$1$1, toHex$1(new BN$1(value)));
|
|
59772
59772
|
}
|
|
59773
|
-
return logger$3.throwArgumentError("invalid BigNumber string", "value", value);
|
|
59773
|
+
return logger$3$1.throwArgumentError("invalid BigNumber string", "value", value);
|
|
59774
59774
|
}
|
|
59775
59775
|
if (typeof (value) === "number") {
|
|
59776
59776
|
if (value % 1) {
|
|
59777
|
-
throwFault$1("underflow", "BigNumber.from", value);
|
|
59777
|
+
throwFault$1$1("underflow", "BigNumber.from", value);
|
|
59778
59778
|
}
|
|
59779
59779
|
if (value >= MAX_SAFE$1 || value <= -MAX_SAFE$1) {
|
|
59780
|
-
throwFault$1("overflow", "BigNumber.from", value);
|
|
59780
|
+
throwFault$1$1("overflow", "BigNumber.from", value);
|
|
59781
59781
|
}
|
|
59782
59782
|
return BigNumber$1.from(String(value));
|
|
59783
59783
|
}
|
|
@@ -59810,7 +59810,7 @@
|
|
|
59810
59810
|
}
|
|
59811
59811
|
}
|
|
59812
59812
|
}
|
|
59813
|
-
return logger$3.throwArgumentError("invalid BigNumber value", "value", value);
|
|
59813
|
+
return logger$3$1.throwArgumentError("invalid BigNumber value", "value", value);
|
|
59814
59814
|
}
|
|
59815
59815
|
static isBigNumber(value) {
|
|
59816
59816
|
return !!(value && value._isBigNumber);
|
|
@@ -59828,7 +59828,7 @@
|
|
|
59828
59828
|
value = value.substring(1);
|
|
59829
59829
|
// Cannot have mulitple negative signs (e.g. "--0x04")
|
|
59830
59830
|
if (value[0] === "-") {
|
|
59831
|
-
logger$3.throwArgumentError("invalid hex", "value", value);
|
|
59831
|
+
logger$3$1.throwArgumentError("invalid hex", "value", value);
|
|
59832
59832
|
}
|
|
59833
59833
|
// Call toHex on the positive component
|
|
59834
59834
|
value = toHex$1(value);
|
|
@@ -59867,36 +59867,36 @@
|
|
|
59867
59867
|
}
|
|
59868
59868
|
return new BN$1(hex.substring(2), 16);
|
|
59869
59869
|
}
|
|
59870
|
-
function throwFault$1(fault, operation, value) {
|
|
59870
|
+
function throwFault$1$1(fault, operation, value) {
|
|
59871
59871
|
const params = { fault: fault, operation: operation };
|
|
59872
59872
|
if (value != null) {
|
|
59873
59873
|
params.value = value;
|
|
59874
59874
|
}
|
|
59875
|
-
return logger$3.throwError(fault, Logger$1.errors.NUMERIC_FAULT, params);
|
|
59875
|
+
return logger$3$1.throwError(fault, Logger$1.errors.NUMERIC_FAULT, params);
|
|
59876
59876
|
}
|
|
59877
59877
|
// value should have no prefix
|
|
59878
59878
|
function _base36To16(value) {
|
|
59879
59879
|
return (new BN$1(value, 36)).toString(16);
|
|
59880
59880
|
}
|
|
59881
59881
|
|
|
59882
|
-
const logger$2 = new Logger$1(version$2$1);
|
|
59882
|
+
const logger$2$1 = new Logger$1(version$2$1);
|
|
59883
59883
|
const _constructorGuard$2 = {};
|
|
59884
|
-
const Zero = BigNumber$1.from(0);
|
|
59885
|
-
const NegativeOne = BigNumber$1.from(-1);
|
|
59884
|
+
const Zero$1 = BigNumber$1.from(0);
|
|
59885
|
+
const NegativeOne$1 = BigNumber$1.from(-1);
|
|
59886
59886
|
function throwFault$2(message, fault, operation, value) {
|
|
59887
59887
|
const params = { fault: fault, operation: operation };
|
|
59888
59888
|
if (value !== undefined) {
|
|
59889
59889
|
params.value = value;
|
|
59890
59890
|
}
|
|
59891
|
-
return logger$2.throwError(message, Logger$1.errors.NUMERIC_FAULT, params);
|
|
59891
|
+
return logger$2$1.throwError(message, Logger$1.errors.NUMERIC_FAULT, params);
|
|
59892
59892
|
}
|
|
59893
59893
|
// Constant to pull zeros from for multipliers
|
|
59894
|
-
let zeros = "0";
|
|
59895
|
-
while (zeros.length < 256) {
|
|
59896
|
-
zeros += zeros;
|
|
59894
|
+
let zeros$1 = "0";
|
|
59895
|
+
while (zeros$1.length < 256) {
|
|
59896
|
+
zeros$1 += zeros$1;
|
|
59897
59897
|
}
|
|
59898
59898
|
// Returns a string "1" followed by decimal "0"s
|
|
59899
|
-
function getMultiplier(decimals) {
|
|
59899
|
+
function getMultiplier$1(decimals) {
|
|
59900
59900
|
if (typeof (decimals) !== "number") {
|
|
59901
59901
|
try {
|
|
59902
59902
|
decimals = BigNumber$1.from(decimals).toNumber();
|
|
@@ -59904,20 +59904,20 @@
|
|
|
59904
59904
|
catch (e) { }
|
|
59905
59905
|
}
|
|
59906
59906
|
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
59907
|
-
return ("1" + zeros.substring(0, decimals));
|
|
59907
|
+
return ("1" + zeros$1.substring(0, decimals));
|
|
59908
59908
|
}
|
|
59909
|
-
return logger$2.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
59909
|
+
return logger$2$1.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
59910
59910
|
}
|
|
59911
|
-
function formatFixed(value, decimals) {
|
|
59911
|
+
function formatFixed$1(value, decimals) {
|
|
59912
59912
|
if (decimals == null) {
|
|
59913
59913
|
decimals = 0;
|
|
59914
59914
|
}
|
|
59915
|
-
const multiplier = getMultiplier(decimals);
|
|
59915
|
+
const multiplier = getMultiplier$1(decimals);
|
|
59916
59916
|
// Make sure wei is a big number (convert as necessary)
|
|
59917
59917
|
value = BigNumber$1.from(value);
|
|
59918
|
-
const negative = value.lt(Zero);
|
|
59918
|
+
const negative = value.lt(Zero$1);
|
|
59919
59919
|
if (negative) {
|
|
59920
|
-
value = value.mul(NegativeOne);
|
|
59920
|
+
value = value.mul(NegativeOne$1);
|
|
59921
59921
|
}
|
|
59922
59922
|
let fraction = value.mod(multiplier).toString();
|
|
59923
59923
|
while (fraction.length < multiplier.length - 1) {
|
|
@@ -59937,13 +59937,13 @@
|
|
|
59937
59937
|
}
|
|
59938
59938
|
return value;
|
|
59939
59939
|
}
|
|
59940
|
-
function parseFixed(value, decimals) {
|
|
59940
|
+
function parseFixed$1(value, decimals) {
|
|
59941
59941
|
if (decimals == null) {
|
|
59942
59942
|
decimals = 0;
|
|
59943
59943
|
}
|
|
59944
|
-
const multiplier = getMultiplier(decimals);
|
|
59944
|
+
const multiplier = getMultiplier$1(decimals);
|
|
59945
59945
|
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
|
|
59946
|
-
logger$2.throwArgumentError("invalid decimal value", "value", value);
|
|
59946
|
+
logger$2$1.throwArgumentError("invalid decimal value", "value", value);
|
|
59947
59947
|
}
|
|
59948
59948
|
// Is it negative?
|
|
59949
59949
|
const negative = (value.substring(0, 1) === "-");
|
|
@@ -59951,12 +59951,12 @@
|
|
|
59951
59951
|
value = value.substring(1);
|
|
59952
59952
|
}
|
|
59953
59953
|
if (value === ".") {
|
|
59954
|
-
logger$2.throwArgumentError("missing value", "value", value);
|
|
59954
|
+
logger$2$1.throwArgumentError("missing value", "value", value);
|
|
59955
59955
|
}
|
|
59956
59956
|
// Split it into a whole and fractional part
|
|
59957
59957
|
const comps = value.split(".");
|
|
59958
59958
|
if (comps.length > 2) {
|
|
59959
|
-
logger$2.throwArgumentError("too many decimal points", "value", value);
|
|
59959
|
+
logger$2$1.throwArgumentError("too many decimal points", "value", value);
|
|
59960
59960
|
}
|
|
59961
59961
|
let whole = comps[0], fraction = comps[1];
|
|
59962
59962
|
if (!whole) {
|
|
@@ -59980,14 +59980,14 @@
|
|
|
59980
59980
|
const fractionValue = BigNumber$1.from(fraction);
|
|
59981
59981
|
let wei = (wholeValue.mul(multiplier)).add(fractionValue);
|
|
59982
59982
|
if (negative) {
|
|
59983
|
-
wei = wei.mul(NegativeOne);
|
|
59983
|
+
wei = wei.mul(NegativeOne$1);
|
|
59984
59984
|
}
|
|
59985
59985
|
return wei;
|
|
59986
59986
|
}
|
|
59987
|
-
class FixedFormat {
|
|
59987
|
+
class FixedFormat$1 {
|
|
59988
59988
|
constructor(constructorGuard, signed, width, decimals) {
|
|
59989
59989
|
if (constructorGuard !== _constructorGuard$2) {
|
|
59990
|
-
logger$2.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59990
|
+
logger$2$1.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
59991
59991
|
operation: "new FixedFormat"
|
|
59992
59992
|
});
|
|
59993
59993
|
}
|
|
@@ -59995,11 +59995,11 @@
|
|
|
59995
59995
|
this.width = width;
|
|
59996
59996
|
this.decimals = decimals;
|
|
59997
59997
|
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
59998
|
-
this._multiplier = getMultiplier(decimals);
|
|
59998
|
+
this._multiplier = getMultiplier$1(decimals);
|
|
59999
59999
|
Object.freeze(this);
|
|
60000
60000
|
}
|
|
60001
60001
|
static from(value) {
|
|
60002
|
-
if (value instanceof FixedFormat) {
|
|
60002
|
+
if (value instanceof FixedFormat$1) {
|
|
60003
60003
|
return value;
|
|
60004
60004
|
}
|
|
60005
60005
|
if (typeof (value) === "number") {
|
|
@@ -60016,7 +60016,7 @@
|
|
|
60016
60016
|
else {
|
|
60017
60017
|
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
|
60018
60018
|
if (!match) {
|
|
60019
|
-
logger$2.throwArgumentError("invalid fixed format", "format", value);
|
|
60019
|
+
logger$2$1.throwArgumentError("invalid fixed format", "format", value);
|
|
60020
60020
|
}
|
|
60021
60021
|
signed = (match[1] !== "u");
|
|
60022
60022
|
width = parseInt(match[2]);
|
|
@@ -60029,7 +60029,7 @@
|
|
|
60029
60029
|
return defaultValue;
|
|
60030
60030
|
}
|
|
60031
60031
|
if (typeof (value[key]) !== type) {
|
|
60032
|
-
logger$2.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
|
60032
|
+
logger$2$1.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
|
60033
60033
|
}
|
|
60034
60034
|
return value[key];
|
|
60035
60035
|
};
|
|
@@ -60038,19 +60038,19 @@
|
|
|
60038
60038
|
decimals = check("decimals", "number", decimals);
|
|
60039
60039
|
}
|
|
60040
60040
|
if (width % 8) {
|
|
60041
|
-
logger$2.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
|
60041
|
+
logger$2$1.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
|
60042
60042
|
}
|
|
60043
60043
|
if (decimals > 80) {
|
|
60044
|
-
logger$2.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
60044
|
+
logger$2$1.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
60045
60045
|
}
|
|
60046
|
-
return new FixedFormat(_constructorGuard$2, signed, width, decimals);
|
|
60046
|
+
return new FixedFormat$1(_constructorGuard$2, signed, width, decimals);
|
|
60047
60047
|
}
|
|
60048
60048
|
}
|
|
60049
|
-
class FixedNumber {
|
|
60049
|
+
class FixedNumber$1 {
|
|
60050
60050
|
constructor(constructorGuard, hex, value, format) {
|
|
60051
|
-
logger$2.checkNew(new.target, FixedNumber);
|
|
60051
|
+
logger$2$1.checkNew(new.target, FixedNumber$1);
|
|
60052
60052
|
if (constructorGuard !== _constructorGuard$2) {
|
|
60053
|
-
logger$2.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
60053
|
+
logger$2$1.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$1.errors.UNSUPPORTED_OPERATION, {
|
|
60054
60054
|
operation: "new FixedFormat"
|
|
60055
60055
|
});
|
|
60056
60056
|
}
|
|
@@ -60062,42 +60062,42 @@
|
|
|
60062
60062
|
}
|
|
60063
60063
|
_checkFormat(other) {
|
|
60064
60064
|
if (this.format.name !== other.format.name) {
|
|
60065
|
-
logger$2.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
|
60065
|
+
logger$2$1.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
|
60066
60066
|
}
|
|
60067
60067
|
}
|
|
60068
60068
|
addUnsafe(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.add(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.add(b), this.format.decimals, this.format);
|
|
60073
60073
|
}
|
|
60074
60074
|
subUnsafe(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.sub(b), 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.sub(b), this.format.decimals, this.format);
|
|
60079
60079
|
}
|
|
60080
60080
|
mulUnsafe(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(b).div(this.format._multiplier), 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(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
60085
60085
|
}
|
|
60086
60086
|
divUnsafe(other) {
|
|
60087
60087
|
this._checkFormat(other);
|
|
60088
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
60089
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
60090
|
-
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
60088
|
+
const a = parseFixed$1(this._value, this.format.decimals);
|
|
60089
|
+
const b = parseFixed$1(other._value, other.format.decimals);
|
|
60090
|
+
return FixedNumber$1.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
60091
60091
|
}
|
|
60092
60092
|
floor() {
|
|
60093
60093
|
const comps = this.toString().split(".");
|
|
60094
60094
|
if (comps.length === 1) {
|
|
60095
60095
|
comps.push("0");
|
|
60096
60096
|
}
|
|
60097
|
-
let result = FixedNumber.from(comps[0], this.format);
|
|
60097
|
+
let result = FixedNumber$1.from(comps[0], this.format);
|
|
60098
60098
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
60099
60099
|
if (this.isNegative() && hasFraction) {
|
|
60100
|
-
result = result.subUnsafe(ONE.toFormat(result.format));
|
|
60100
|
+
result = result.subUnsafe(ONE$1.toFormat(result.format));
|
|
60101
60101
|
}
|
|
60102
60102
|
return result;
|
|
60103
60103
|
}
|
|
@@ -60106,10 +60106,10 @@
|
|
|
60106
60106
|
if (comps.length === 1) {
|
|
60107
60107
|
comps.push("0");
|
|
60108
60108
|
}
|
|
60109
|
-
let result = FixedNumber.from(comps[0], this.format);
|
|
60109
|
+
let result = FixedNumber$1.from(comps[0], this.format);
|
|
60110
60110
|
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
60111
60111
|
if (!this.isNegative() && hasFraction) {
|
|
60112
|
-
result = result.addUnsafe(ONE.toFormat(result.format));
|
|
60112
|
+
result = result.addUnsafe(ONE$1.toFormat(result.format));
|
|
60113
60113
|
}
|
|
60114
60114
|
return result;
|
|
60115
60115
|
}
|
|
@@ -60124,13 +60124,13 @@
|
|
|
60124
60124
|
comps.push("0");
|
|
60125
60125
|
}
|
|
60126
60126
|
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
|
60127
|
-
logger$2.throwArgumentError("invalid decimal count", "decimals", decimals);
|
|
60127
|
+
logger$2$1.throwArgumentError("invalid decimal count", "decimals", decimals);
|
|
60128
60128
|
}
|
|
60129
60129
|
if (comps[1].length <= decimals) {
|
|
60130
60130
|
return this;
|
|
60131
60131
|
}
|
|
60132
|
-
const factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format);
|
|
60133
|
-
const bump = BUMP.toFormat(this.format);
|
|
60132
|
+
const factor = FixedNumber$1.from("1" + zeros$1.substring(0, decimals), this.format);
|
|
60133
|
+
const bump = BUMP$1.toFormat(this.format);
|
|
60134
60134
|
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
60135
60135
|
}
|
|
60136
60136
|
isZero() {
|
|
@@ -60145,18 +60145,18 @@
|
|
|
60145
60145
|
return this._hex;
|
|
60146
60146
|
}
|
|
60147
60147
|
if (width % 8) {
|
|
60148
|
-
logger$2.throwArgumentError("invalid byte width", "width", width);
|
|
60148
|
+
logger$2$1.throwArgumentError("invalid byte width", "width", width);
|
|
60149
60149
|
}
|
|
60150
60150
|
const hex = BigNumber$1.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
60151
|
-
return hexZeroPad(hex, width / 8);
|
|
60151
|
+
return hexZeroPad$1(hex, width / 8);
|
|
60152
60152
|
}
|
|
60153
60153
|
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
60154
60154
|
toFormat(format) {
|
|
60155
|
-
return FixedNumber.fromString(this._value, format);
|
|
60155
|
+
return FixedNumber$1.fromString(this._value, format);
|
|
60156
60156
|
}
|
|
60157
60157
|
static fromValue(value, decimals, format) {
|
|
60158
60158
|
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
60159
|
-
if (format == null && decimals != null && !isBigNumberish(decimals)) {
|
|
60159
|
+
if (format == null && decimals != null && !isBigNumberish$1(decimals)) {
|
|
60160
60160
|
format = decimals;
|
|
60161
60161
|
decimals = null;
|
|
60162
60162
|
}
|
|
@@ -60166,15 +60166,15 @@
|
|
|
60166
60166
|
if (format == null) {
|
|
60167
60167
|
format = "fixed";
|
|
60168
60168
|
}
|
|
60169
|
-
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
|
|
60169
|
+
return FixedNumber$1.fromString(formatFixed$1(value, decimals), FixedFormat$1.from(format));
|
|
60170
60170
|
}
|
|
60171
60171
|
static fromString(value, format) {
|
|
60172
60172
|
if (format == null) {
|
|
60173
60173
|
format = "fixed";
|
|
60174
60174
|
}
|
|
60175
|
-
const fixedFormat = FixedFormat.from(format);
|
|
60176
|
-
const numeric = parseFixed(value, fixedFormat.decimals);
|
|
60177
|
-
if (!fixedFormat.signed && numeric.lt(Zero)) {
|
|
60175
|
+
const fixedFormat = FixedFormat$1.from(format);
|
|
60176
|
+
const numeric = parseFixed$1(value, fixedFormat.decimals);
|
|
60177
|
+
if (!fixedFormat.signed && numeric.lt(Zero$1)) {
|
|
60178
60178
|
throwFault$2("unsigned value cannot be negative", "overflow", "value", value);
|
|
60179
60179
|
}
|
|
60180
60180
|
let hex = null;
|
|
@@ -60183,17 +60183,17 @@
|
|
|
60183
60183
|
}
|
|
60184
60184
|
else {
|
|
60185
60185
|
hex = numeric.toHexString();
|
|
60186
|
-
hex = hexZeroPad(hex, fixedFormat.width / 8);
|
|
60186
|
+
hex = hexZeroPad$1(hex, fixedFormat.width / 8);
|
|
60187
60187
|
}
|
|
60188
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
60189
|
-
return new FixedNumber(_constructorGuard$2, hex, decimal, fixedFormat);
|
|
60188
|
+
const decimal = formatFixed$1(numeric, fixedFormat.decimals);
|
|
60189
|
+
return new FixedNumber$1(_constructorGuard$2, hex, decimal, fixedFormat);
|
|
60190
60190
|
}
|
|
60191
60191
|
static fromBytes(value, format) {
|
|
60192
60192
|
if (format == null) {
|
|
60193
60193
|
format = "fixed";
|
|
60194
60194
|
}
|
|
60195
|
-
const fixedFormat = FixedFormat.from(format);
|
|
60196
|
-
if (arrayify(value).length > fixedFormat.width / 8) {
|
|
60195
|
+
const fixedFormat = FixedFormat$1.from(format);
|
|
60196
|
+
if (arrayify$1(value).length > fixedFormat.width / 8) {
|
|
60197
60197
|
throw new Error("overflow");
|
|
60198
60198
|
}
|
|
60199
60199
|
let numeric = BigNumber$1.from(value);
|
|
@@ -60201,18 +60201,18 @@
|
|
|
60201
60201
|
numeric = numeric.fromTwos(fixedFormat.width);
|
|
60202
60202
|
}
|
|
60203
60203
|
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
60204
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
60205
|
-
return new FixedNumber(_constructorGuard$2, hex, decimal, fixedFormat);
|
|
60204
|
+
const decimal = formatFixed$1(numeric, fixedFormat.decimals);
|
|
60205
|
+
return new FixedNumber$1(_constructorGuard$2, hex, decimal, fixedFormat);
|
|
60206
60206
|
}
|
|
60207
60207
|
static from(value, format) {
|
|
60208
60208
|
if (typeof (value) === "string") {
|
|
60209
|
-
return FixedNumber.fromString(value, format);
|
|
60209
|
+
return FixedNumber$1.fromString(value, format);
|
|
60210
60210
|
}
|
|
60211
60211
|
if (isBytes$1(value)) {
|
|
60212
|
-
return FixedNumber.fromBytes(value, format);
|
|
60212
|
+
return FixedNumber$1.fromBytes(value, format);
|
|
60213
60213
|
}
|
|
60214
60214
|
try {
|
|
60215
|
-
return FixedNumber.fromValue(value, 0, format);
|
|
60215
|
+
return FixedNumber$1.fromValue(value, 0, format);
|
|
60216
60216
|
}
|
|
60217
60217
|
catch (error) {
|
|
60218
60218
|
// Allow NUMERIC_FAULT to bubble up
|
|
@@ -60220,14 +60220,14 @@
|
|
|
60220
60220
|
throw error;
|
|
60221
60221
|
}
|
|
60222
60222
|
}
|
|
60223
|
-
return logger$2.throwArgumentError("invalid FixedNumber value", "value", value);
|
|
60223
|
+
return logger$2$1.throwArgumentError("invalid FixedNumber value", "value", value);
|
|
60224
60224
|
}
|
|
60225
60225
|
static isFixedNumber(value) {
|
|
60226
60226
|
return !!(value && value._isFixedNumber);
|
|
60227
60227
|
}
|
|
60228
60228
|
}
|
|
60229
|
-
const ONE = FixedNumber.from(1);
|
|
60230
|
-
const BUMP = FixedNumber.from("0.5");
|
|
60229
|
+
const ONE$1 = FixedNumber$1.from(1);
|
|
60230
|
+
const BUMP$1 = FixedNumber$1.from("0.5");
|
|
60231
60231
|
|
|
60232
60232
|
/**
|
|
60233
60233
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
@@ -60710,7 +60710,7 @@
|
|
|
60710
60710
|
var sha3$1 = sha3;
|
|
60711
60711
|
|
|
60712
60712
|
function keccak256(data) {
|
|
60713
|
-
return '0x' + sha3$1.keccak_256(arrayify(data));
|
|
60713
|
+
return '0x' + sha3$1.keccak_256(arrayify$1(data));
|
|
60714
60714
|
}
|
|
60715
60715
|
|
|
60716
60716
|
const version$1$1 = "address/5.4.0";
|
|
@@ -60726,7 +60726,7 @@
|
|
|
60726
60726
|
for (let i = 0; i < 40; i++) {
|
|
60727
60727
|
expanded[i] = chars[i].charCodeAt(0);
|
|
60728
60728
|
}
|
|
60729
|
-
const hashed = arrayify(keccak256(expanded));
|
|
60729
|
+
const hashed = arrayify$1(keccak256(expanded));
|
|
60730
60730
|
for (let i = 0; i < 40; i += 2) {
|
|
60731
60731
|
if ((hashed[i >> 1] >> 4) >= 8) {
|
|
60732
60732
|
chars[i] = chars[i].toUpperCase();
|
|
@@ -60808,7 +60808,7 @@
|
|
|
60808
60808
|
const version$5 = "units/5.4.0";
|
|
60809
60809
|
|
|
60810
60810
|
const logger$5 = new Logger$1(version$5);
|
|
60811
|
-
const names = [
|
|
60811
|
+
const names$1 = [
|
|
60812
60812
|
"wei",
|
|
60813
60813
|
"kwei",
|
|
60814
60814
|
"mwei",
|
|
@@ -60817,17 +60817,17 @@
|
|
|
60817
60817
|
"finney",
|
|
60818
60818
|
"ether",
|
|
60819
60819
|
];
|
|
60820
|
-
function parseUnits(value, unitName) {
|
|
60820
|
+
function parseUnits$1(value, unitName) {
|
|
60821
60821
|
if (typeof (value) !== "string") {
|
|
60822
60822
|
logger$5.throwArgumentError("value must be a string", "value", value);
|
|
60823
60823
|
}
|
|
60824
60824
|
if (typeof (unitName) === "string") {
|
|
60825
|
-
const index = names.indexOf(unitName);
|
|
60825
|
+
const index = names$1.indexOf(unitName);
|
|
60826
60826
|
if (index !== -1) {
|
|
60827
60827
|
unitName = 3 * index;
|
|
60828
60828
|
}
|
|
60829
60829
|
}
|
|
60830
|
-
return parseFixed(value, (unitName != null) ? unitName : 18);
|
|
60830
|
+
return parseFixed$1(value, (unitName != null) ? unitName : 18);
|
|
60831
60831
|
}
|
|
60832
60832
|
|
|
60833
60833
|
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; }
|
|
@@ -60861,9 +60861,9 @@
|
|
|
60861
60861
|
|
|
60862
60862
|
let minReserveRequirements$1 = ({ reserves, min, token, token0, token1, decimals }) => {
|
|
60863
60863
|
if(token0.toLowerCase() == token.toLowerCase()) {
|
|
60864
|
-
return reserves[0].gte(parseUnits(min.toString(), decimals))
|
|
60864
|
+
return reserves[0].gte(parseUnits$1(min.toString(), decimals))
|
|
60865
60865
|
} else if (token1.toLowerCase() == token.toLowerCase()) {
|
|
60866
|
-
return reserves[1].gte(parseUnits(min.toString(), decimals))
|
|
60866
|
+
return reserves[1].gte(parseUnits$1(min.toString(), decimals))
|
|
60867
60867
|
} else {
|
|
60868
60868
|
return false
|
|
60869
60869
|
}
|
|
@@ -61211,9 +61211,9 @@
|
|
|
61211
61211
|
|
|
61212
61212
|
let minReserveRequirements = ({ reserves, min, token, token0, token1, decimals }) => {
|
|
61213
61213
|
if(token0.toLowerCase() == token.toLowerCase()) {
|
|
61214
|
-
return reserves[0].gte(parseUnits(min.toString(), decimals))
|
|
61214
|
+
return reserves[0].gte(parseUnits$1(min.toString(), decimals))
|
|
61215
61215
|
} else if (token1.toLowerCase() == token.toLowerCase()) {
|
|
61216
|
-
return reserves[1].gte(parseUnits(min.toString(), decimals))
|
|
61216
|
+
return reserves[1].gte(parseUnits$1(min.toString(), decimals))
|
|
61217
61217
|
} else {
|
|
61218
61218
|
return false
|
|
61219
61219
|
}
|
|
@@ -62716,6 +62716,10 @@
|
|
|
62716
62716
|
return transaction
|
|
62717
62717
|
};
|
|
62718
62718
|
|
|
62719
|
+
const preparePaymentFeeTransaction = (transaction)=> {
|
|
62720
|
+
|
|
62721
|
+
};
|
|
62722
|
+
|
|
62719
62723
|
var plugins = {
|
|
62720
62724
|
ethereum: {
|
|
62721
62725
|
payment: {
|
|
@@ -62737,6 +62741,10 @@
|
|
|
62737
62741
|
address: '0x2D18c5A46cc1780d2460DD51B5d0996e55Fd2446',
|
|
62738
62742
|
prepareTransaction: prepareContractCallAddressPassedAmountBooleanTransaction
|
|
62739
62743
|
}
|
|
62744
|
+
},
|
|
62745
|
+
paymentFee: {
|
|
62746
|
+
address: '0x874Cb669D7BFff79d4A6A30F4ea52c5e413BD6A7',
|
|
62747
|
+
prepareTransaction: preparePaymentFeeTransaction
|
|
62740
62748
|
}
|
|
62741
62749
|
},
|
|
62742
62750
|
bsc: {
|
|
@@ -62759,6 +62767,10 @@
|
|
|
62759
62767
|
address: '0x7E655088214d0657251A51aDccE9109CFd23B5B5',
|
|
62760
62768
|
prepareTransaction: prepareContractCallAddressPassedAmountBooleanTransaction
|
|
62761
62769
|
}
|
|
62770
|
+
},
|
|
62771
|
+
paymentFee: {
|
|
62772
|
+
address: '0xae33f10AD57A38113f74FCdc1ffA6B1eC47B94E3',
|
|
62773
|
+
prepareTransaction: preparePaymentFeeTransaction
|
|
62762
62774
|
}
|
|
62763
62775
|
}
|
|
62764
62776
|
};
|
|
@@ -66227,7 +66239,7 @@
|
|
|
66227
66239
|
})(module, commonjsGlobal);
|
|
66228
66240
|
});
|
|
66229
66241
|
|
|
66230
|
-
const version$
|
|
66242
|
+
const version$3 = "logger/5.4.1";
|
|
66231
66243
|
|
|
66232
66244
|
let _permanentCensorErrors = false;
|
|
66233
66245
|
let _censorErrors = false;
|
|
@@ -66503,7 +66515,7 @@
|
|
|
66503
66515
|
}
|
|
66504
66516
|
static globalLogger() {
|
|
66505
66517
|
if (!_globalLogger) {
|
|
66506
|
-
_globalLogger = new Logger(version$
|
|
66518
|
+
_globalLogger = new Logger(version$3);
|
|
66507
66519
|
}
|
|
66508
66520
|
return _globalLogger;
|
|
66509
66521
|
}
|
|
@@ -66539,13 +66551,23 @@
|
|
|
66539
66551
|
Logger.errors = ErrorCode;
|
|
66540
66552
|
Logger.levels = LogLevel;
|
|
66541
66553
|
|
|
66542
|
-
const version$
|
|
66554
|
+
const version$2 = "bytes/5.4.0";
|
|
66543
66555
|
|
|
66544
|
-
const logger$
|
|
66556
|
+
const logger$3 = new Logger(version$2);
|
|
66545
66557
|
///////////////////////////////
|
|
66546
66558
|
function isHexable(value) {
|
|
66547
66559
|
return !!(value.toHexString);
|
|
66548
66560
|
}
|
|
66561
|
+
function addSlice(array) {
|
|
66562
|
+
if (array.slice) {
|
|
66563
|
+
return array;
|
|
66564
|
+
}
|
|
66565
|
+
array.slice = function () {
|
|
66566
|
+
const args = Array.prototype.slice.call(arguments);
|
|
66567
|
+
return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
66568
|
+
};
|
|
66569
|
+
return array;
|
|
66570
|
+
}
|
|
66549
66571
|
function isBytes(value) {
|
|
66550
66572
|
if (value == null) {
|
|
66551
66573
|
return false;
|
|
@@ -66567,6 +66589,52 @@
|
|
|
66567
66589
|
}
|
|
66568
66590
|
return true;
|
|
66569
66591
|
}
|
|
66592
|
+
function arrayify(value, options) {
|
|
66593
|
+
if (!options) {
|
|
66594
|
+
options = {};
|
|
66595
|
+
}
|
|
66596
|
+
if (typeof (value) === "number") {
|
|
66597
|
+
logger$3.checkSafeUint53(value, "invalid arrayify value");
|
|
66598
|
+
const result = [];
|
|
66599
|
+
while (value) {
|
|
66600
|
+
result.unshift(value & 0xff);
|
|
66601
|
+
value = parseInt(String(value / 256));
|
|
66602
|
+
}
|
|
66603
|
+
if (result.length === 0) {
|
|
66604
|
+
result.push(0);
|
|
66605
|
+
}
|
|
66606
|
+
return addSlice(new Uint8Array(result));
|
|
66607
|
+
}
|
|
66608
|
+
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
66609
|
+
value = "0x" + value;
|
|
66610
|
+
}
|
|
66611
|
+
if (isHexable(value)) {
|
|
66612
|
+
value = value.toHexString();
|
|
66613
|
+
}
|
|
66614
|
+
if (isHexString(value)) {
|
|
66615
|
+
let hex = value.substring(2);
|
|
66616
|
+
if (hex.length % 2) {
|
|
66617
|
+
if (options.hexPad === "left") {
|
|
66618
|
+
hex = "0x0" + hex.substring(2);
|
|
66619
|
+
}
|
|
66620
|
+
else if (options.hexPad === "right") {
|
|
66621
|
+
hex += "0";
|
|
66622
|
+
}
|
|
66623
|
+
else {
|
|
66624
|
+
logger$3.throwArgumentError("hex data is odd-length", "value", value);
|
|
66625
|
+
}
|
|
66626
|
+
}
|
|
66627
|
+
const result = [];
|
|
66628
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
66629
|
+
result.push(parseInt(hex.substring(i, i + 2), 16));
|
|
66630
|
+
}
|
|
66631
|
+
return addSlice(new Uint8Array(result));
|
|
66632
|
+
}
|
|
66633
|
+
if (isBytes(value)) {
|
|
66634
|
+
return addSlice(new Uint8Array(value));
|
|
66635
|
+
}
|
|
66636
|
+
return logger$3.throwArgumentError("invalid arrayify value", "value", value);
|
|
66637
|
+
}
|
|
66570
66638
|
function isHexString(value, length) {
|
|
66571
66639
|
if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
|
|
66572
66640
|
return false;
|
|
@@ -66582,7 +66650,7 @@
|
|
|
66582
66650
|
options = {};
|
|
66583
66651
|
}
|
|
66584
66652
|
if (typeof (value) === "number") {
|
|
66585
|
-
logger$
|
|
66653
|
+
logger$3.checkSafeUint53(value, "invalid hexlify value");
|
|
66586
66654
|
let hex = "";
|
|
66587
66655
|
while (value) {
|
|
66588
66656
|
hex = HexCharacters[value & 0xf] + hex;
|
|
@@ -66618,7 +66686,7 @@
|
|
|
66618
66686
|
value += "0";
|
|
66619
66687
|
}
|
|
66620
66688
|
else {
|
|
66621
|
-
logger$
|
|
66689
|
+
logger$3.throwArgumentError("hex data is odd-length", "value", value);
|
|
66622
66690
|
}
|
|
66623
66691
|
}
|
|
66624
66692
|
return value.toLowerCase();
|
|
@@ -66631,22 +66699,45 @@
|
|
|
66631
66699
|
}
|
|
66632
66700
|
return result;
|
|
66633
66701
|
}
|
|
66634
|
-
return logger$
|
|
66702
|
+
return logger$3.throwArgumentError("invalid hexlify value", "value", value);
|
|
66703
|
+
}
|
|
66704
|
+
function hexZeroPad(value, length) {
|
|
66705
|
+
if (typeof (value) !== "string") {
|
|
66706
|
+
value = hexlify(value);
|
|
66707
|
+
}
|
|
66708
|
+
else if (!isHexString(value)) {
|
|
66709
|
+
logger$3.throwArgumentError("invalid hex string", "value", value);
|
|
66710
|
+
}
|
|
66711
|
+
if (value.length > 2 * length + 2) {
|
|
66712
|
+
logger$3.throwArgumentError("value out of range", "value", arguments[1]);
|
|
66713
|
+
}
|
|
66714
|
+
while (value.length < 2 * length + 2) {
|
|
66715
|
+
value = "0x0" + value.substring(2);
|
|
66716
|
+
}
|
|
66717
|
+
return value;
|
|
66635
66718
|
}
|
|
66636
66719
|
|
|
66637
|
-
const version = "bignumber/5.4.1";
|
|
66720
|
+
const version$1 = "bignumber/5.4.1";
|
|
66638
66721
|
|
|
66639
66722
|
var BN = bn.BN;
|
|
66640
|
-
const logger = new Logger(version);
|
|
66641
|
-
const _constructorGuard = {};
|
|
66723
|
+
const logger$2 = new Logger(version$1);
|
|
66724
|
+
const _constructorGuard$1 = {};
|
|
66642
66725
|
const MAX_SAFE = 0x1fffffffffffff;
|
|
66726
|
+
function isBigNumberish(value) {
|
|
66727
|
+
return (value != null) && (BigNumber.isBigNumber(value) ||
|
|
66728
|
+
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
66729
|
+
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
66730
|
+
isHexString(value) ||
|
|
66731
|
+
(typeof (value) === "bigint") ||
|
|
66732
|
+
isBytes(value));
|
|
66733
|
+
}
|
|
66643
66734
|
// Only warn about passing 10 into radix once
|
|
66644
66735
|
let _warnedToStringRadix = false;
|
|
66645
66736
|
class BigNumber {
|
|
66646
66737
|
constructor(constructorGuard, hex) {
|
|
66647
|
-
logger.checkNew(new.target, BigNumber);
|
|
66648
|
-
if (constructorGuard !== _constructorGuard) {
|
|
66649
|
-
logger.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
66738
|
+
logger$2.checkNew(new.target, BigNumber);
|
|
66739
|
+
if (constructorGuard !== _constructorGuard$1) {
|
|
66740
|
+
logger$2.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
66650
66741
|
operation: "new (BigNumber)"
|
|
66651
66742
|
});
|
|
66652
66743
|
}
|
|
@@ -66675,7 +66766,7 @@
|
|
|
66675
66766
|
div(other) {
|
|
66676
66767
|
const o = BigNumber.from(other);
|
|
66677
66768
|
if (o.isZero()) {
|
|
66678
|
-
throwFault("division by zero", "div");
|
|
66769
|
+
throwFault$1("division by zero", "div");
|
|
66679
66770
|
}
|
|
66680
66771
|
return toBigNumber(toBN(this).div(toBN(other)));
|
|
66681
66772
|
}
|
|
@@ -66685,53 +66776,53 @@
|
|
|
66685
66776
|
mod(other) {
|
|
66686
66777
|
const value = toBN(other);
|
|
66687
66778
|
if (value.isNeg()) {
|
|
66688
|
-
throwFault("cannot modulo negative values", "mod");
|
|
66779
|
+
throwFault$1("cannot modulo negative values", "mod");
|
|
66689
66780
|
}
|
|
66690
66781
|
return toBigNumber(toBN(this).umod(value));
|
|
66691
66782
|
}
|
|
66692
66783
|
pow(other) {
|
|
66693
66784
|
const value = toBN(other);
|
|
66694
66785
|
if (value.isNeg()) {
|
|
66695
|
-
throwFault("cannot raise to negative values", "pow");
|
|
66786
|
+
throwFault$1("cannot raise to negative values", "pow");
|
|
66696
66787
|
}
|
|
66697
66788
|
return toBigNumber(toBN(this).pow(value));
|
|
66698
66789
|
}
|
|
66699
66790
|
and(other) {
|
|
66700
66791
|
const value = toBN(other);
|
|
66701
66792
|
if (this.isNegative() || value.isNeg()) {
|
|
66702
|
-
throwFault("cannot 'and' negative values", "and");
|
|
66793
|
+
throwFault$1("cannot 'and' negative values", "and");
|
|
66703
66794
|
}
|
|
66704
66795
|
return toBigNumber(toBN(this).and(value));
|
|
66705
66796
|
}
|
|
66706
66797
|
or(other) {
|
|
66707
66798
|
const value = toBN(other);
|
|
66708
66799
|
if (this.isNegative() || value.isNeg()) {
|
|
66709
|
-
throwFault("cannot 'or' negative values", "or");
|
|
66800
|
+
throwFault$1("cannot 'or' negative values", "or");
|
|
66710
66801
|
}
|
|
66711
66802
|
return toBigNumber(toBN(this).or(value));
|
|
66712
66803
|
}
|
|
66713
66804
|
xor(other) {
|
|
66714
66805
|
const value = toBN(other);
|
|
66715
66806
|
if (this.isNegative() || value.isNeg()) {
|
|
66716
|
-
throwFault("cannot 'xor' negative values", "xor");
|
|
66807
|
+
throwFault$1("cannot 'xor' negative values", "xor");
|
|
66717
66808
|
}
|
|
66718
66809
|
return toBigNumber(toBN(this).xor(value));
|
|
66719
66810
|
}
|
|
66720
66811
|
mask(value) {
|
|
66721
66812
|
if (this.isNegative() || value < 0) {
|
|
66722
|
-
throwFault("cannot mask negative values", "mask");
|
|
66813
|
+
throwFault$1("cannot mask negative values", "mask");
|
|
66723
66814
|
}
|
|
66724
66815
|
return toBigNumber(toBN(this).maskn(value));
|
|
66725
66816
|
}
|
|
66726
66817
|
shl(value) {
|
|
66727
66818
|
if (this.isNegative() || value < 0) {
|
|
66728
|
-
throwFault("cannot shift negative values", "shl");
|
|
66819
|
+
throwFault$1("cannot shift negative values", "shl");
|
|
66729
66820
|
}
|
|
66730
66821
|
return toBigNumber(toBN(this).shln(value));
|
|
66731
66822
|
}
|
|
66732
66823
|
shr(value) {
|
|
66733
66824
|
if (this.isNegative() || value < 0) {
|
|
66734
|
-
throwFault("cannot shift negative values", "shr");
|
|
66825
|
+
throwFault$1("cannot shift negative values", "shr");
|
|
66735
66826
|
}
|
|
66736
66827
|
return toBigNumber(toBN(this).shrn(value));
|
|
66737
66828
|
}
|
|
@@ -66761,7 +66852,7 @@
|
|
|
66761
66852
|
return toBN(this).toNumber();
|
|
66762
66853
|
}
|
|
66763
66854
|
catch (error) {
|
|
66764
|
-
throwFault("overflow", "toNumber", this.toString());
|
|
66855
|
+
throwFault$1("overflow", "toNumber", this.toString());
|
|
66765
66856
|
}
|
|
66766
66857
|
return null;
|
|
66767
66858
|
}
|
|
@@ -66770,7 +66861,7 @@
|
|
|
66770
66861
|
return BigInt(this.toString());
|
|
66771
66862
|
}
|
|
66772
66863
|
catch (e) { }
|
|
66773
|
-
return logger.throwError("this platform does not support BigInt", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
66864
|
+
return logger$2.throwError("this platform does not support BigInt", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
66774
66865
|
value: this.toString()
|
|
66775
66866
|
});
|
|
66776
66867
|
}
|
|
@@ -66780,14 +66871,14 @@
|
|
|
66780
66871
|
if (arguments[0] === 10) {
|
|
66781
66872
|
if (!_warnedToStringRadix) {
|
|
66782
66873
|
_warnedToStringRadix = true;
|
|
66783
|
-
logger.warn("BigNumber.toString does not accept any parameters; base-10 is assumed");
|
|
66874
|
+
logger$2.warn("BigNumber.toString does not accept any parameters; base-10 is assumed");
|
|
66784
66875
|
}
|
|
66785
66876
|
}
|
|
66786
66877
|
else if (arguments[0] === 16) {
|
|
66787
|
-
logger.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
66878
|
+
logger$2.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
66788
66879
|
}
|
|
66789
66880
|
else {
|
|
66790
|
-
logger.throwError("BigNumber.toString does not accept parameters", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
66881
|
+
logger$2.throwError("BigNumber.toString does not accept parameters", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
66791
66882
|
}
|
|
66792
66883
|
}
|
|
66793
66884
|
return toBN(this).toString(10);
|
|
@@ -66804,19 +66895,19 @@
|
|
|
66804
66895
|
}
|
|
66805
66896
|
if (typeof (value) === "string") {
|
|
66806
66897
|
if (value.match(/^-?0x[0-9a-f]+$/i)) {
|
|
66807
|
-
return new BigNumber(_constructorGuard, toHex(value));
|
|
66898
|
+
return new BigNumber(_constructorGuard$1, toHex(value));
|
|
66808
66899
|
}
|
|
66809
66900
|
if (value.match(/^-?[0-9]+$/)) {
|
|
66810
|
-
return new BigNumber(_constructorGuard, toHex(new BN(value)));
|
|
66901
|
+
return new BigNumber(_constructorGuard$1, toHex(new BN(value)));
|
|
66811
66902
|
}
|
|
66812
|
-
return logger.throwArgumentError("invalid BigNumber string", "value", value);
|
|
66903
|
+
return logger$2.throwArgumentError("invalid BigNumber string", "value", value);
|
|
66813
66904
|
}
|
|
66814
66905
|
if (typeof (value) === "number") {
|
|
66815
66906
|
if (value % 1) {
|
|
66816
|
-
throwFault("underflow", "BigNumber.from", value);
|
|
66907
|
+
throwFault$1("underflow", "BigNumber.from", value);
|
|
66817
66908
|
}
|
|
66818
66909
|
if (value >= MAX_SAFE || value <= -MAX_SAFE) {
|
|
66819
|
-
throwFault("overflow", "BigNumber.from", value);
|
|
66910
|
+
throwFault$1("overflow", "BigNumber.from", value);
|
|
66820
66911
|
}
|
|
66821
66912
|
return BigNumber.from(String(value));
|
|
66822
66913
|
}
|
|
@@ -66849,7 +66940,7 @@
|
|
|
66849
66940
|
}
|
|
66850
66941
|
}
|
|
66851
66942
|
}
|
|
66852
|
-
return logger.throwArgumentError("invalid BigNumber value", "value", value);
|
|
66943
|
+
return logger$2.throwArgumentError("invalid BigNumber value", "value", value);
|
|
66853
66944
|
}
|
|
66854
66945
|
static isBigNumber(value) {
|
|
66855
66946
|
return !!(value && value._isBigNumber);
|
|
@@ -66867,7 +66958,7 @@
|
|
|
66867
66958
|
value = value.substring(1);
|
|
66868
66959
|
// Cannot have mulitple negative signs (e.g. "--0x04")
|
|
66869
66960
|
if (value[0] === "-") {
|
|
66870
|
-
logger.throwArgumentError("invalid hex", "value", value);
|
|
66961
|
+
logger$2.throwArgumentError("invalid hex", "value", value);
|
|
66871
66962
|
}
|
|
66872
66963
|
// Call toHex on the positive component
|
|
66873
66964
|
value = toHex(value);
|
|
@@ -66906,24 +66997,399 @@
|
|
|
66906
66997
|
}
|
|
66907
66998
|
return new BN(hex.substring(2), 16);
|
|
66908
66999
|
}
|
|
66909
|
-
function throwFault(fault, operation, value) {
|
|
67000
|
+
function throwFault$1(fault, operation, value) {
|
|
66910
67001
|
const params = { fault: fault, operation: operation };
|
|
66911
67002
|
if (value != null) {
|
|
66912
67003
|
params.value = value;
|
|
66913
67004
|
}
|
|
66914
|
-
return logger.throwError(fault, Logger.errors.NUMERIC_FAULT, params);
|
|
67005
|
+
return logger$2.throwError(fault, Logger.errors.NUMERIC_FAULT, params);
|
|
67006
|
+
}
|
|
67007
|
+
|
|
67008
|
+
const logger$1 = new Logger(version$1);
|
|
67009
|
+
const _constructorGuard = {};
|
|
67010
|
+
const Zero = BigNumber.from(0);
|
|
67011
|
+
const NegativeOne = BigNumber.from(-1);
|
|
67012
|
+
function throwFault(message, fault, operation, value) {
|
|
67013
|
+
const params = { fault: fault, operation: operation };
|
|
67014
|
+
if (value !== undefined) {
|
|
67015
|
+
params.value = value;
|
|
67016
|
+
}
|
|
67017
|
+
return logger$1.throwError(message, Logger.errors.NUMERIC_FAULT, params);
|
|
67018
|
+
}
|
|
67019
|
+
// Constant to pull zeros from for multipliers
|
|
67020
|
+
let zeros = "0";
|
|
67021
|
+
while (zeros.length < 256) {
|
|
67022
|
+
zeros += zeros;
|
|
67023
|
+
}
|
|
67024
|
+
// Returns a string "1" followed by decimal "0"s
|
|
67025
|
+
function getMultiplier(decimals) {
|
|
67026
|
+
if (typeof (decimals) !== "number") {
|
|
67027
|
+
try {
|
|
67028
|
+
decimals = BigNumber.from(decimals).toNumber();
|
|
67029
|
+
}
|
|
67030
|
+
catch (e) { }
|
|
67031
|
+
}
|
|
67032
|
+
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
67033
|
+
return ("1" + zeros.substring(0, decimals));
|
|
67034
|
+
}
|
|
67035
|
+
return logger$1.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
67036
|
+
}
|
|
67037
|
+
function formatFixed(value, decimals) {
|
|
67038
|
+
if (decimals == null) {
|
|
67039
|
+
decimals = 0;
|
|
67040
|
+
}
|
|
67041
|
+
const multiplier = getMultiplier(decimals);
|
|
67042
|
+
// Make sure wei is a big number (convert as necessary)
|
|
67043
|
+
value = BigNumber.from(value);
|
|
67044
|
+
const negative = value.lt(Zero);
|
|
67045
|
+
if (negative) {
|
|
67046
|
+
value = value.mul(NegativeOne);
|
|
67047
|
+
}
|
|
67048
|
+
let fraction = value.mod(multiplier).toString();
|
|
67049
|
+
while (fraction.length < multiplier.length - 1) {
|
|
67050
|
+
fraction = "0" + fraction;
|
|
67051
|
+
}
|
|
67052
|
+
// Strip training 0
|
|
67053
|
+
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
|
|
67054
|
+
const whole = value.div(multiplier).toString();
|
|
67055
|
+
if (multiplier.length === 1) {
|
|
67056
|
+
value = whole;
|
|
67057
|
+
}
|
|
67058
|
+
else {
|
|
67059
|
+
value = whole + "." + fraction;
|
|
67060
|
+
}
|
|
67061
|
+
if (negative) {
|
|
67062
|
+
value = "-" + value;
|
|
67063
|
+
}
|
|
67064
|
+
return value;
|
|
67065
|
+
}
|
|
67066
|
+
function parseFixed(value, decimals) {
|
|
67067
|
+
if (decimals == null) {
|
|
67068
|
+
decimals = 0;
|
|
67069
|
+
}
|
|
67070
|
+
const multiplier = getMultiplier(decimals);
|
|
67071
|
+
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
|
|
67072
|
+
logger$1.throwArgumentError("invalid decimal value", "value", value);
|
|
67073
|
+
}
|
|
67074
|
+
// Is it negative?
|
|
67075
|
+
const negative = (value.substring(0, 1) === "-");
|
|
67076
|
+
if (negative) {
|
|
67077
|
+
value = value.substring(1);
|
|
67078
|
+
}
|
|
67079
|
+
if (value === ".") {
|
|
67080
|
+
logger$1.throwArgumentError("missing value", "value", value);
|
|
67081
|
+
}
|
|
67082
|
+
// Split it into a whole and fractional part
|
|
67083
|
+
const comps = value.split(".");
|
|
67084
|
+
if (comps.length > 2) {
|
|
67085
|
+
logger$1.throwArgumentError("too many decimal points", "value", value);
|
|
67086
|
+
}
|
|
67087
|
+
let whole = comps[0], fraction = comps[1];
|
|
67088
|
+
if (!whole) {
|
|
67089
|
+
whole = "0";
|
|
67090
|
+
}
|
|
67091
|
+
if (!fraction) {
|
|
67092
|
+
fraction = "0";
|
|
67093
|
+
}
|
|
67094
|
+
// Get significant digits to check truncation for underflow
|
|
67095
|
+
{
|
|
67096
|
+
const sigFraction = fraction.replace(/^([0-9]*?)(0*)$/, (all, sig, zeros) => (sig));
|
|
67097
|
+
if (sigFraction.length > multiplier.length - 1) {
|
|
67098
|
+
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
|
|
67099
|
+
}
|
|
67100
|
+
}
|
|
67101
|
+
// Fully pad the string with zeros to get to wei
|
|
67102
|
+
while (fraction.length < multiplier.length - 1) {
|
|
67103
|
+
fraction += "0";
|
|
67104
|
+
}
|
|
67105
|
+
const wholeValue = BigNumber.from(whole);
|
|
67106
|
+
const fractionValue = BigNumber.from(fraction);
|
|
67107
|
+
let wei = (wholeValue.mul(multiplier)).add(fractionValue);
|
|
67108
|
+
if (negative) {
|
|
67109
|
+
wei = wei.mul(NegativeOne);
|
|
67110
|
+
}
|
|
67111
|
+
return wei;
|
|
67112
|
+
}
|
|
67113
|
+
class FixedFormat {
|
|
67114
|
+
constructor(constructorGuard, signed, width, decimals) {
|
|
67115
|
+
if (constructorGuard !== _constructorGuard) {
|
|
67116
|
+
logger$1.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
67117
|
+
operation: "new FixedFormat"
|
|
67118
|
+
});
|
|
67119
|
+
}
|
|
67120
|
+
this.signed = signed;
|
|
67121
|
+
this.width = width;
|
|
67122
|
+
this.decimals = decimals;
|
|
67123
|
+
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
67124
|
+
this._multiplier = getMultiplier(decimals);
|
|
67125
|
+
Object.freeze(this);
|
|
67126
|
+
}
|
|
67127
|
+
static from(value) {
|
|
67128
|
+
if (value instanceof FixedFormat) {
|
|
67129
|
+
return value;
|
|
67130
|
+
}
|
|
67131
|
+
if (typeof (value) === "number") {
|
|
67132
|
+
value = `fixed128x${value}`;
|
|
67133
|
+
}
|
|
67134
|
+
let signed = true;
|
|
67135
|
+
let width = 128;
|
|
67136
|
+
let decimals = 18;
|
|
67137
|
+
if (typeof (value) === "string") {
|
|
67138
|
+
if (value === "fixed") ;
|
|
67139
|
+
else if (value === "ufixed") {
|
|
67140
|
+
signed = false;
|
|
67141
|
+
}
|
|
67142
|
+
else {
|
|
67143
|
+
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
|
67144
|
+
if (!match) {
|
|
67145
|
+
logger$1.throwArgumentError("invalid fixed format", "format", value);
|
|
67146
|
+
}
|
|
67147
|
+
signed = (match[1] !== "u");
|
|
67148
|
+
width = parseInt(match[2]);
|
|
67149
|
+
decimals = parseInt(match[3]);
|
|
67150
|
+
}
|
|
67151
|
+
}
|
|
67152
|
+
else if (value) {
|
|
67153
|
+
const check = (key, type, defaultValue) => {
|
|
67154
|
+
if (value[key] == null) {
|
|
67155
|
+
return defaultValue;
|
|
67156
|
+
}
|
|
67157
|
+
if (typeof (value[key]) !== type) {
|
|
67158
|
+
logger$1.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
|
67159
|
+
}
|
|
67160
|
+
return value[key];
|
|
67161
|
+
};
|
|
67162
|
+
signed = check("signed", "boolean", signed);
|
|
67163
|
+
width = check("width", "number", width);
|
|
67164
|
+
decimals = check("decimals", "number", decimals);
|
|
67165
|
+
}
|
|
67166
|
+
if (width % 8) {
|
|
67167
|
+
logger$1.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
|
67168
|
+
}
|
|
67169
|
+
if (decimals > 80) {
|
|
67170
|
+
logger$1.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
67171
|
+
}
|
|
67172
|
+
return new FixedFormat(_constructorGuard, signed, width, decimals);
|
|
67173
|
+
}
|
|
67174
|
+
}
|
|
67175
|
+
class FixedNumber {
|
|
67176
|
+
constructor(constructorGuard, hex, value, format) {
|
|
67177
|
+
logger$1.checkNew(new.target, FixedNumber);
|
|
67178
|
+
if (constructorGuard !== _constructorGuard) {
|
|
67179
|
+
logger$1.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
67180
|
+
operation: "new FixedFormat"
|
|
67181
|
+
});
|
|
67182
|
+
}
|
|
67183
|
+
this.format = format;
|
|
67184
|
+
this._hex = hex;
|
|
67185
|
+
this._value = value;
|
|
67186
|
+
this._isFixedNumber = true;
|
|
67187
|
+
Object.freeze(this);
|
|
67188
|
+
}
|
|
67189
|
+
_checkFormat(other) {
|
|
67190
|
+
if (this.format.name !== other.format.name) {
|
|
67191
|
+
logger$1.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
|
67192
|
+
}
|
|
67193
|
+
}
|
|
67194
|
+
addUnsafe(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.add(b), this.format.decimals, this.format);
|
|
67199
|
+
}
|
|
67200
|
+
subUnsafe(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.sub(b), this.format.decimals, this.format);
|
|
67205
|
+
}
|
|
67206
|
+
mulUnsafe(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(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
67211
|
+
}
|
|
67212
|
+
divUnsafe(other) {
|
|
67213
|
+
this._checkFormat(other);
|
|
67214
|
+
const a = parseFixed(this._value, this.format.decimals);
|
|
67215
|
+
const b = parseFixed(other._value, other.format.decimals);
|
|
67216
|
+
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
67217
|
+
}
|
|
67218
|
+
floor() {
|
|
67219
|
+
const comps = this.toString().split(".");
|
|
67220
|
+
if (comps.length === 1) {
|
|
67221
|
+
comps.push("0");
|
|
67222
|
+
}
|
|
67223
|
+
let result = FixedNumber.from(comps[0], this.format);
|
|
67224
|
+
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
67225
|
+
if (this.isNegative() && hasFraction) {
|
|
67226
|
+
result = result.subUnsafe(ONE.toFormat(result.format));
|
|
67227
|
+
}
|
|
67228
|
+
return result;
|
|
67229
|
+
}
|
|
67230
|
+
ceiling() {
|
|
67231
|
+
const comps = this.toString().split(".");
|
|
67232
|
+
if (comps.length === 1) {
|
|
67233
|
+
comps.push("0");
|
|
67234
|
+
}
|
|
67235
|
+
let result = FixedNumber.from(comps[0], this.format);
|
|
67236
|
+
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
67237
|
+
if (!this.isNegative() && hasFraction) {
|
|
67238
|
+
result = result.addUnsafe(ONE.toFormat(result.format));
|
|
67239
|
+
}
|
|
67240
|
+
return result;
|
|
67241
|
+
}
|
|
67242
|
+
// @TODO: Support other rounding algorithms
|
|
67243
|
+
round(decimals) {
|
|
67244
|
+
if (decimals == null) {
|
|
67245
|
+
decimals = 0;
|
|
67246
|
+
}
|
|
67247
|
+
// If we are already in range, we're done
|
|
67248
|
+
const comps = this.toString().split(".");
|
|
67249
|
+
if (comps.length === 1) {
|
|
67250
|
+
comps.push("0");
|
|
67251
|
+
}
|
|
67252
|
+
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
|
67253
|
+
logger$1.throwArgumentError("invalid decimal count", "decimals", decimals);
|
|
67254
|
+
}
|
|
67255
|
+
if (comps[1].length <= decimals) {
|
|
67256
|
+
return this;
|
|
67257
|
+
}
|
|
67258
|
+
const factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format);
|
|
67259
|
+
const bump = BUMP.toFormat(this.format);
|
|
67260
|
+
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
67261
|
+
}
|
|
67262
|
+
isZero() {
|
|
67263
|
+
return (this._value === "0.0" || this._value === "0");
|
|
67264
|
+
}
|
|
67265
|
+
isNegative() {
|
|
67266
|
+
return (this._value[0] === "-");
|
|
67267
|
+
}
|
|
67268
|
+
toString() { return this._value; }
|
|
67269
|
+
toHexString(width) {
|
|
67270
|
+
if (width == null) {
|
|
67271
|
+
return this._hex;
|
|
67272
|
+
}
|
|
67273
|
+
if (width % 8) {
|
|
67274
|
+
logger$1.throwArgumentError("invalid byte width", "width", width);
|
|
67275
|
+
}
|
|
67276
|
+
const hex = BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
67277
|
+
return hexZeroPad(hex, width / 8);
|
|
67278
|
+
}
|
|
67279
|
+
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
67280
|
+
toFormat(format) {
|
|
67281
|
+
return FixedNumber.fromString(this._value, format);
|
|
67282
|
+
}
|
|
67283
|
+
static fromValue(value, decimals, format) {
|
|
67284
|
+
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
67285
|
+
if (format == null && decimals != null && !isBigNumberish(decimals)) {
|
|
67286
|
+
format = decimals;
|
|
67287
|
+
decimals = null;
|
|
67288
|
+
}
|
|
67289
|
+
if (decimals == null) {
|
|
67290
|
+
decimals = 0;
|
|
67291
|
+
}
|
|
67292
|
+
if (format == null) {
|
|
67293
|
+
format = "fixed";
|
|
67294
|
+
}
|
|
67295
|
+
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
|
|
67296
|
+
}
|
|
67297
|
+
static fromString(value, format) {
|
|
67298
|
+
if (format == null) {
|
|
67299
|
+
format = "fixed";
|
|
67300
|
+
}
|
|
67301
|
+
const fixedFormat = FixedFormat.from(format);
|
|
67302
|
+
const numeric = parseFixed(value, fixedFormat.decimals);
|
|
67303
|
+
if (!fixedFormat.signed && numeric.lt(Zero)) {
|
|
67304
|
+
throwFault("unsigned value cannot be negative", "overflow", "value", value);
|
|
67305
|
+
}
|
|
67306
|
+
let hex = null;
|
|
67307
|
+
if (fixedFormat.signed) {
|
|
67308
|
+
hex = numeric.toTwos(fixedFormat.width).toHexString();
|
|
67309
|
+
}
|
|
67310
|
+
else {
|
|
67311
|
+
hex = numeric.toHexString();
|
|
67312
|
+
hex = hexZeroPad(hex, fixedFormat.width / 8);
|
|
67313
|
+
}
|
|
67314
|
+
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
67315
|
+
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
|
67316
|
+
}
|
|
67317
|
+
static fromBytes(value, format) {
|
|
67318
|
+
if (format == null) {
|
|
67319
|
+
format = "fixed";
|
|
67320
|
+
}
|
|
67321
|
+
const fixedFormat = FixedFormat.from(format);
|
|
67322
|
+
if (arrayify(value).length > fixedFormat.width / 8) {
|
|
67323
|
+
throw new Error("overflow");
|
|
67324
|
+
}
|
|
67325
|
+
let numeric = BigNumber.from(value);
|
|
67326
|
+
if (fixedFormat.signed) {
|
|
67327
|
+
numeric = numeric.fromTwos(fixedFormat.width);
|
|
67328
|
+
}
|
|
67329
|
+
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
67330
|
+
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
67331
|
+
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
|
67332
|
+
}
|
|
67333
|
+
static from(value, format) {
|
|
67334
|
+
if (typeof (value) === "string") {
|
|
67335
|
+
return FixedNumber.fromString(value, format);
|
|
67336
|
+
}
|
|
67337
|
+
if (isBytes(value)) {
|
|
67338
|
+
return FixedNumber.fromBytes(value, format);
|
|
67339
|
+
}
|
|
67340
|
+
try {
|
|
67341
|
+
return FixedNumber.fromValue(value, 0, format);
|
|
67342
|
+
}
|
|
67343
|
+
catch (error) {
|
|
67344
|
+
// Allow NUMERIC_FAULT to bubble up
|
|
67345
|
+
if (error.code !== Logger.errors.INVALID_ARGUMENT) {
|
|
67346
|
+
throw error;
|
|
67347
|
+
}
|
|
67348
|
+
}
|
|
67349
|
+
return logger$1.throwArgumentError("invalid FixedNumber value", "value", value);
|
|
67350
|
+
}
|
|
67351
|
+
static isFixedNumber(value) {
|
|
67352
|
+
return !!(value && value._isFixedNumber);
|
|
67353
|
+
}
|
|
67354
|
+
}
|
|
67355
|
+
const ONE = FixedNumber.from(1);
|
|
67356
|
+
const BUMP = FixedNumber.from("0.5");
|
|
67357
|
+
|
|
67358
|
+
const version = "units/5.4.0";
|
|
67359
|
+
|
|
67360
|
+
const logger = new Logger(version);
|
|
67361
|
+
const names = [
|
|
67362
|
+
"wei",
|
|
67363
|
+
"kwei",
|
|
67364
|
+
"mwei",
|
|
67365
|
+
"gwei",
|
|
67366
|
+
"szabo",
|
|
67367
|
+
"finney",
|
|
67368
|
+
"ether",
|
|
67369
|
+
];
|
|
67370
|
+
function parseUnits(value, unitName) {
|
|
67371
|
+
if (typeof (value) !== "string") {
|
|
67372
|
+
logger.throwArgumentError("value must be a string", "value", value);
|
|
67373
|
+
}
|
|
67374
|
+
if (typeof (unitName) === "string") {
|
|
67375
|
+
const index = names.indexOf(unitName);
|
|
67376
|
+
if (index !== -1) {
|
|
67377
|
+
unitName = 3 * index;
|
|
67378
|
+
}
|
|
67379
|
+
}
|
|
67380
|
+
return parseFixed(value, (unitName != null) ? unitName : 18);
|
|
66915
67381
|
}
|
|
66916
67382
|
|
|
66917
67383
|
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; }
|
|
66918
|
-
let getTransaction = ({ paymentRoute, event })=> {
|
|
67384
|
+
let getTransaction = ({ paymentRoute, event, fee })=> {
|
|
66919
67385
|
let exchangeRoute = paymentRoute.exchangeRoutes[0];
|
|
66920
67386
|
|
|
66921
67387
|
let transaction = {
|
|
66922
67388
|
blockchain: paymentRoute.blockchain,
|
|
66923
|
-
to: transactionAddress({ paymentRoute }),
|
|
66924
|
-
api: transactionApi({ paymentRoute }),
|
|
66925
|
-
method: transactionMethod({ paymentRoute }),
|
|
66926
|
-
params: transactionParams({ paymentRoute, exchangeRoute, event }),
|
|
67389
|
+
to: transactionAddress({ paymentRoute, fee }),
|
|
67390
|
+
api: transactionApi({ paymentRoute, fee }),
|
|
67391
|
+
method: transactionMethod({ paymentRoute, fee }),
|
|
67392
|
+
params: transactionParams({ paymentRoute, exchangeRoute, event, fee }),
|
|
66927
67393
|
value: transactionValue({ paymentRoute, exchangeRoute })
|
|
66928
67394
|
};
|
|
66929
67395
|
|
|
@@ -66940,8 +67406,8 @@
|
|
|
66940
67406
|
return transaction
|
|
66941
67407
|
};
|
|
66942
67408
|
|
|
66943
|
-
let transactionAddress = ({ paymentRoute })=> {
|
|
66944
|
-
if(paymentRoute.directTransfer) {
|
|
67409
|
+
let transactionAddress = ({ paymentRoute, fee })=> {
|
|
67410
|
+
if(paymentRoute.directTransfer && !fee) {
|
|
66945
67411
|
if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) {
|
|
66946
67412
|
return paymentRoute.toAddress
|
|
66947
67413
|
} else {
|
|
@@ -66952,8 +67418,8 @@
|
|
|
66952
67418
|
}
|
|
66953
67419
|
};
|
|
66954
67420
|
|
|
66955
|
-
let transactionApi = ({ paymentRoute })=> {
|
|
66956
|
-
if(paymentRoute.directTransfer) {
|
|
67421
|
+
let transactionApi = ({ paymentRoute, fee })=> {
|
|
67422
|
+
if(paymentRoute.directTransfer && !fee) {
|
|
66957
67423
|
if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) {
|
|
66958
67424
|
return undefined
|
|
66959
67425
|
} else {
|
|
@@ -66964,8 +67430,8 @@
|
|
|
66964
67430
|
}
|
|
66965
67431
|
};
|
|
66966
67432
|
|
|
66967
|
-
let transactionMethod = ({ paymentRoute })=> {
|
|
66968
|
-
if(paymentRoute.directTransfer) {
|
|
67433
|
+
let transactionMethod = ({ paymentRoute, fee })=> {
|
|
67434
|
+
if(paymentRoute.directTransfer && !fee) {
|
|
66969
67435
|
if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) {
|
|
66970
67436
|
return undefined
|
|
66971
67437
|
} else {
|
|
@@ -66976,8 +67442,8 @@
|
|
|
66976
67442
|
}
|
|
66977
67443
|
};
|
|
66978
67444
|
|
|
66979
|
-
let transactionParams = ({ paymentRoute, exchangeRoute, event })=> {
|
|
66980
|
-
if(paymentRoute.directTransfer) {
|
|
67445
|
+
let transactionParams = ({ paymentRoute, exchangeRoute, event, fee })=> {
|
|
67446
|
+
if(paymentRoute.directTransfer && !fee) {
|
|
66981
67447
|
if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) {
|
|
66982
67448
|
return undefined
|
|
66983
67449
|
} else {
|
|
@@ -66986,9 +67452,9 @@
|
|
|
66986
67452
|
} else {
|
|
66987
67453
|
return {
|
|
66988
67454
|
path: transactionPath({ paymentRoute, exchangeRoute }),
|
|
66989
|
-
amounts: transactionAmounts({ paymentRoute, exchangeRoute }),
|
|
66990
|
-
addresses: transactionAddresses({ paymentRoute }),
|
|
66991
|
-
plugins: transactionPlugins({ paymentRoute, exchangeRoute, event }),
|
|
67455
|
+
amounts: transactionAmounts({ paymentRoute, exchangeRoute, fee }),
|
|
67456
|
+
addresses: transactionAddresses({ paymentRoute, fee }),
|
|
67457
|
+
plugins: transactionPlugins({ paymentRoute, exchangeRoute, event, fee }),
|
|
66992
67458
|
data: []
|
|
66993
67459
|
}
|
|
66994
67460
|
}
|
|
@@ -67002,23 +67468,59 @@
|
|
|
67002
67468
|
}
|
|
67003
67469
|
};
|
|
67004
67470
|
|
|
67005
|
-
let transactionAmounts = ({ paymentRoute, exchangeRoute })=> {
|
|
67471
|
+
let transactionAmounts = ({ paymentRoute, exchangeRoute, fee })=> {
|
|
67472
|
+
let amounts;
|
|
67006
67473
|
if(exchangeRoute) {
|
|
67007
|
-
|
|
67474
|
+
amounts = [
|
|
67008
67475
|
exchangeRoute.amountIn.toString(),
|
|
67009
|
-
exchangeRoute.amountOutMin.toString(),
|
|
67476
|
+
subtractFee({ amount: exchangeRoute.amountOutMin.toString(), paymentRoute, fee }),
|
|
67010
67477
|
exchangeRoute.transaction.params.deadline
|
|
67011
|
-
]
|
|
67478
|
+
];
|
|
67479
|
+
} else {
|
|
67480
|
+
amounts = [
|
|
67481
|
+
paymentRoute.toAmount, // from
|
|
67482
|
+
subtractFee({ amount: paymentRoute.toAmount, paymentRoute, fee }) // to
|
|
67483
|
+
];
|
|
67484
|
+
}
|
|
67485
|
+
if(fee){
|
|
67486
|
+
amounts[4] = transactionFeeAmount({ paymentRoute, fee });
|
|
67487
|
+
}
|
|
67488
|
+
for(var i = 0; i < amounts.length; i++) {
|
|
67489
|
+
if(amounts[i] == undefined){ amounts[i] = '0'; }
|
|
67490
|
+
}
|
|
67491
|
+
return amounts
|
|
67492
|
+
};
|
|
67493
|
+
|
|
67494
|
+
let subtractFee = ({ amount, paymentRoute, fee })=> {
|
|
67495
|
+
if(fee) {
|
|
67496
|
+
let feeAmount = transactionFeeAmount({ paymentRoute, fee });
|
|
67497
|
+
return BigNumber.from(amount).sub(feeAmount).toString()
|
|
67012
67498
|
} else {
|
|
67013
|
-
return
|
|
67499
|
+
return amount
|
|
67014
67500
|
}
|
|
67015
67501
|
};
|
|
67016
67502
|
|
|
67017
|
-
let
|
|
67018
|
-
|
|
67503
|
+
let transactionFeeAmount = ({ paymentRoute, fee })=> {
|
|
67504
|
+
if(typeof fee.amount == 'string' && fee.amount.match('%')) {
|
|
67505
|
+
return BigNumber.from(paymentRoute.toAmount).div(100).mul(parseFloat(fee.amount)).toString()
|
|
67506
|
+
} else if(typeof fee.amount == 'string') {
|
|
67507
|
+
return fee.amount
|
|
67508
|
+
} else if(typeof fee.amount == 'number') {
|
|
67509
|
+
return parseUnits(fee.amount.toString(), paymentRoute.toDecimals).toString()
|
|
67510
|
+
} else {
|
|
67511
|
+
throw('Unknown fee amount type!')
|
|
67512
|
+
}
|
|
67019
67513
|
};
|
|
67020
67514
|
|
|
67021
|
-
let
|
|
67515
|
+
let transactionAddresses = ({ paymentRoute, fee })=> {
|
|
67516
|
+
if(fee) {
|
|
67517
|
+
return [paymentRoute.fromAddress, fee.receiver, paymentRoute.toAddress]
|
|
67518
|
+
} else {
|
|
67519
|
+
return [paymentRoute.fromAddress, paymentRoute.toAddress]
|
|
67520
|
+
}
|
|
67521
|
+
};
|
|
67522
|
+
|
|
67523
|
+
let transactionPlugins = ({ paymentRoute, exchangeRoute, event, fee })=> {
|
|
67022
67524
|
let paymentPlugins = [];
|
|
67023
67525
|
|
|
67024
67526
|
if(exchangeRoute) {
|
|
@@ -67046,6 +67548,10 @@
|
|
|
67046
67548
|
paymentPlugins.push(plugins[paymentRoute.blockchain].payment.address);
|
|
67047
67549
|
}
|
|
67048
67550
|
|
|
67551
|
+
if(fee) {
|
|
67552
|
+
paymentPlugins.push(plugins[paymentRoute.blockchain].paymentFee.address);
|
|
67553
|
+
}
|
|
67554
|
+
|
|
67049
67555
|
return paymentPlugins
|
|
67050
67556
|
};
|
|
67051
67557
|
|
|
@@ -67063,11 +67569,12 @@
|
|
|
67063
67569
|
|
|
67064
67570
|
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; }
|
|
67065
67571
|
class PaymentRoute {
|
|
67066
|
-
constructor({ blockchain, fromToken, toToken, toAmount, fromAddress, toAddress, toContract }) {
|
|
67572
|
+
constructor({ blockchain, fromToken, toToken, toDecimals, toAmount, fromAddress, toAddress, toContract }) {
|
|
67067
67573
|
this.blockchain = blockchain;
|
|
67068
67574
|
this.fromToken = fromToken;
|
|
67069
67575
|
this.fromBalance = 0;
|
|
67070
67576
|
this.toToken = toToken;
|
|
67577
|
+
this.toDecimals = toDecimals;
|
|
67071
67578
|
this.toAmount = _optionalChain([toAmount, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]);
|
|
67072
67579
|
this.fromAddress = fromAddress;
|
|
67073
67580
|
this.toAddress = toAddress;
|
|
@@ -67126,38 +67633,32 @@
|
|
|
67126
67633
|
}
|
|
67127
67634
|
|
|
67128
67635
|
function convertToRoutes({ tokens, accept }) {
|
|
67129
|
-
|
|
67130
|
-
return tokens.map((fromToken)=>{
|
|
67636
|
+
return Promise.all(tokens.map(async (fromToken)=>{
|
|
67131
67637
|
let relevantConfigurations = accept.filter((configuration)=>(configuration.blockchain == fromToken.blockchain));
|
|
67132
|
-
return relevantConfigurations.map((configuration)=>{
|
|
67638
|
+
return Promise.all(relevantConfigurations.map(async (configuration)=>{
|
|
67133
67639
|
let blockchain = configuration.blockchain;
|
|
67134
67640
|
let toToken = new Token({ blockchain, address: configuration.token });
|
|
67641
|
+
let toDecimals = await toToken.decimals();
|
|
67642
|
+
let toAmount = (await toToken.BigNumber(configuration.amount)).toString();
|
|
67135
67643
|
return new PaymentRoute({
|
|
67136
67644
|
blockchain,
|
|
67137
67645
|
fromToken: fromToken,
|
|
67138
67646
|
toToken: toToken,
|
|
67139
|
-
toAmount:
|
|
67647
|
+
toAmount: toAmount,
|
|
67648
|
+
toDecimals: toDecimals,
|
|
67140
67649
|
fromAddress: configuration.fromAddress,
|
|
67141
67650
|
toAddress: configuration.toAddress,
|
|
67142
67651
|
toContract: configuration.toContract
|
|
67143
67652
|
})
|
|
67144
|
-
})
|
|
67145
|
-
}).flat()
|
|
67653
|
+
}))
|
|
67654
|
+
})).then((routes)=> routes.flat())
|
|
67146
67655
|
}
|
|
67147
67656
|
|
|
67148
|
-
async function
|
|
67149
|
-
return await Promise.all(routes.map(async (route)=>{
|
|
67150
|
-
route.toAmount = (await route.toToken.BigNumber(route.toAmount)).toString();
|
|
67151
|
-
return route
|
|
67152
|
-
}))
|
|
67153
|
-
}
|
|
67154
|
-
|
|
67155
|
-
async function route({ accept, whitelist, blacklist, apiKey, event }) {
|
|
67657
|
+
async function route({ accept, whitelist, blacklist, apiKey, event, fee }) {
|
|
67156
67658
|
let paymentRoutes = getAllAssets({ accept, whitelist, apiKey })
|
|
67157
67659
|
.then((assets)=>filterBlacklistedAssets({ assets, blacklist }))
|
|
67158
67660
|
.then(assetsToTokens)
|
|
67159
67661
|
.then((tokens) => convertToRoutes({ tokens, accept }))
|
|
67160
|
-
.then(convertToAmounts)
|
|
67161
67662
|
.then(addDirectTransferStatus)
|
|
67162
67663
|
.then(addExchangeRoutes)
|
|
67163
67664
|
.then(filterExchangeRoutesWithoutPlugin)
|
|
@@ -67166,7 +67667,7 @@
|
|
|
67166
67667
|
.then(filterInsufficientBalance)
|
|
67167
67668
|
.then(addApproval)
|
|
67168
67669
|
.then(sortPaymentRoutes)
|
|
67169
|
-
.then((routes)=>addTransactions({ routes, event }))
|
|
67670
|
+
.then((routes)=>addTransactions({ routes, event, fee }))
|
|
67170
67671
|
.then(addFromAmount)
|
|
67171
67672
|
.then(filterDuplicateFromTokens);
|
|
67172
67673
|
|
|
@@ -67289,7 +67790,7 @@
|
|
|
67289
67790
|
|
|
67290
67791
|
let addFromAmount = (routes)=> {
|
|
67291
67792
|
return routes.map((route)=>{
|
|
67292
|
-
if(route.directTransfer) {
|
|
67793
|
+
if(route.directTransfer && !route.fee) {
|
|
67293
67794
|
if(route.fromToken.address.toLowerCase() == CONSTANTS$2[route.blockchain].NATIVE.toLowerCase()) {
|
|
67294
67795
|
route.fromAmount = route.transaction.value;
|
|
67295
67796
|
} else {
|
|
@@ -67363,10 +67864,11 @@
|
|
|
67363
67864
|
})
|
|
67364
67865
|
};
|
|
67365
67866
|
|
|
67366
|
-
let addTransactions = ({ routes, event }) => {
|
|
67867
|
+
let addTransactions = ({ routes, event, fee }) => {
|
|
67367
67868
|
return routes.map((route)=>{
|
|
67368
|
-
route.transaction = getTransaction({ paymentRoute: route, event });
|
|
67869
|
+
route.transaction = getTransaction({ paymentRoute: route, event, fee });
|
|
67369
67870
|
route.event = !route.directTransfer;
|
|
67871
|
+
route.fee = !!fee;
|
|
67370
67872
|
return route
|
|
67371
67873
|
})
|
|
67372
67874
|
};
|
|
@@ -67420,6 +67922,7 @@
|
|
|
67420
67922
|
whitelist: props.whitelist,
|
|
67421
67923
|
blacklist: props.blacklist,
|
|
67422
67924
|
event: props.event,
|
|
67925
|
+
fee: props.fee,
|
|
67423
67926
|
apiKey: apiKey
|
|
67424
67927
|
}).then(function (routes) {
|
|
67425
67928
|
if (routes.length == 0) {
|
|
@@ -70758,7 +71261,8 @@
|
|
|
70758
71261
|
whitelist: props.whitelist,
|
|
70759
71262
|
blacklist: props.blacklist,
|
|
70760
71263
|
event: props.event,
|
|
70761
|
-
setMaxRoute: setMaxRoute
|
|
71264
|
+
setMaxRoute: setMaxRoute,
|
|
71265
|
+
fee: props.fee
|
|
70762
71266
|
}, props.children));
|
|
70763
71267
|
});
|
|
70764
71268
|
|
|
@@ -70951,12 +71455,12 @@
|
|
|
70951
71455
|
|
|
70952
71456
|
var Payment = /*#__PURE__*/function () {
|
|
70953
71457
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
70954
|
-
var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, document, unmount;
|
|
71458
|
+
var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, document, unmount;
|
|
70955
71459
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
70956
71460
|
while (1) {
|
|
70957
71461
|
switch (_context2.prev = _context2.next) {
|
|
70958
71462
|
case 0:
|
|
70959
|
-
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;
|
|
71463
|
+
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;
|
|
70960
71464
|
_context2.prev = 1;
|
|
70961
71465
|
_context2.next = 4;
|
|
70962
71466
|
return preflight$1({
|
|
@@ -70986,7 +71490,8 @@
|
|
|
70986
71490
|
whitelist: whitelist,
|
|
70987
71491
|
blacklist: blacklist,
|
|
70988
71492
|
providers: providers,
|
|
70989
|
-
track: track
|
|
71493
|
+
track: track,
|
|
71494
|
+
fee: fee
|
|
70990
71495
|
}
|
|
70991
71496
|
}, /*#__PURE__*/react.createElement(UpdatableProvider, null, /*#__PURE__*/react.createElement(ClosableProvider, {
|
|
70992
71497
|
unmount: unmount
|
|
@@ -71001,7 +71506,8 @@
|
|
|
71001
71506
|
accept: accept,
|
|
71002
71507
|
whitelist: whitelist,
|
|
71003
71508
|
blacklist: blacklist,
|
|
71004
|
-
event: event
|
|
71509
|
+
event: event,
|
|
71510
|
+
fee: fee
|
|
71005
71511
|
}, /*#__PURE__*/react.createElement(TrackingProvider, {
|
|
71006
71512
|
document: ensureDocument(document)
|
|
71007
71513
|
}, /*#__PURE__*/react.createElement(PaymentProvider, {
|