@gearbox-protocol/deploy-tools 1.1.4 → 1.1.5
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 +2 -0
- package/dist/index.js +367 -353
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7112,14 +7112,14 @@ var require_errors = __commonJS({
|
|
|
7112
7112
|
return error;
|
|
7113
7113
|
}
|
|
7114
7114
|
exports2.makeError = makeError;
|
|
7115
|
-
function
|
|
7115
|
+
function assert(check, message, code, info) {
|
|
7116
7116
|
if (!check) {
|
|
7117
7117
|
throw makeError(message, code, info);
|
|
7118
7118
|
}
|
|
7119
7119
|
}
|
|
7120
|
-
exports2.assert =
|
|
7120
|
+
exports2.assert = assert;
|
|
7121
7121
|
function assertArgument(check, message, name, value) {
|
|
7122
|
-
|
|
7122
|
+
assert(check, message, "INVALID_ARGUMENT", { argument: name, value });
|
|
7123
7123
|
}
|
|
7124
7124
|
exports2.assertArgument = assertArgument;
|
|
7125
7125
|
function assertArgumentCount(count, expectedCount, message) {
|
|
@@ -7129,11 +7129,11 @@ var require_errors = __commonJS({
|
|
|
7129
7129
|
if (message) {
|
|
7130
7130
|
message = ": " + message;
|
|
7131
7131
|
}
|
|
7132
|
-
|
|
7132
|
+
assert(count >= expectedCount, "missing arguemnt" + message, "MISSING_ARGUMENT", {
|
|
7133
7133
|
count,
|
|
7134
7134
|
expectedCount
|
|
7135
7135
|
});
|
|
7136
|
-
|
|
7136
|
+
assert(count <= expectedCount, "too many arguemnts" + message, "UNEXPECTED_ARGUMENT", {
|
|
7137
7137
|
count,
|
|
7138
7138
|
expectedCount
|
|
7139
7139
|
});
|
|
@@ -7158,7 +7158,7 @@ var require_errors = __commonJS({
|
|
|
7158
7158
|
return accum;
|
|
7159
7159
|
}, []);
|
|
7160
7160
|
function assertNormalize(form) {
|
|
7161
|
-
|
|
7161
|
+
assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
|
|
7162
7162
|
operation: "String.prototype.normalize",
|
|
7163
7163
|
info: { form }
|
|
7164
7164
|
});
|
|
@@ -7174,7 +7174,7 @@ var require_errors = __commonJS({
|
|
|
7174
7174
|
method += ".";
|
|
7175
7175
|
operation += " " + className;
|
|
7176
7176
|
}
|
|
7177
|
-
|
|
7177
|
+
assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", {
|
|
7178
7178
|
operation
|
|
7179
7179
|
});
|
|
7180
7180
|
}
|
|
@@ -10004,7 +10004,7 @@ var require_assert = __commonJS({
|
|
|
10004
10004
|
}
|
|
10005
10005
|
}
|
|
10006
10006
|
exports2.output = output;
|
|
10007
|
-
var
|
|
10007
|
+
var assert = {
|
|
10008
10008
|
number,
|
|
10009
10009
|
bool,
|
|
10010
10010
|
bytes,
|
|
@@ -10012,7 +10012,7 @@ var require_assert = __commonJS({
|
|
|
10012
10012
|
exists,
|
|
10013
10013
|
output
|
|
10014
10014
|
};
|
|
10015
|
-
exports2.default =
|
|
10015
|
+
exports2.default = assert;
|
|
10016
10016
|
}
|
|
10017
10017
|
});
|
|
10018
10018
|
|
|
@@ -42624,7 +42624,7 @@ var require_follow_redirects = __commonJS({
|
|
|
42624
42624
|
var http = require("http");
|
|
42625
42625
|
var https = require("https");
|
|
42626
42626
|
var Writable = require("stream").Writable;
|
|
42627
|
-
var
|
|
42627
|
+
var assert = require("assert");
|
|
42628
42628
|
var debug = require_debug2();
|
|
42629
42629
|
var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
|
|
42630
42630
|
var eventHandlers = /* @__PURE__ */ Object.create(null);
|
|
@@ -42990,7 +42990,7 @@ var require_follow_redirects = __commonJS({
|
|
|
42990
42990
|
if (!isString(options.host) && !isString(options.hostname)) {
|
|
42991
42991
|
options.hostname = "::1";
|
|
42992
42992
|
}
|
|
42993
|
-
|
|
42993
|
+
assert.equal(options.protocol, protocol, "protocol mismatch");
|
|
42994
42994
|
debug("options", options);
|
|
42995
42995
|
return new RedirectableRequest(options, callback);
|
|
42996
42996
|
}
|
|
@@ -43056,7 +43056,7 @@ var require_follow_redirects = __commonJS({
|
|
|
43056
43056
|
request.destroy(error);
|
|
43057
43057
|
}
|
|
43058
43058
|
function isSubdomain(subdomain, domain) {
|
|
43059
|
-
|
|
43059
|
+
assert(isString(subdomain) && isString(domain));
|
|
43060
43060
|
var dot = subdomain.length - domain.length - 1;
|
|
43061
43061
|
return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
|
|
43062
43062
|
}
|
|
@@ -59918,7 +59918,7 @@ var require_bn = __commonJS({
|
|
|
59918
59918
|
"node_modules/bn.js/lib/bn.js"(exports2, module2) {
|
|
59919
59919
|
(function(module3, exports3) {
|
|
59920
59920
|
"use strict";
|
|
59921
|
-
function
|
|
59921
|
+
function assert(val, msg) {
|
|
59922
59922
|
if (!val)
|
|
59923
59923
|
throw new Error(msg || "Assertion failed");
|
|
59924
59924
|
}
|
|
@@ -59988,7 +59988,7 @@ var require_bn = __commonJS({
|
|
|
59988
59988
|
if (base === "hex") {
|
|
59989
59989
|
base = 16;
|
|
59990
59990
|
}
|
|
59991
|
-
|
|
59991
|
+
assert(base === (base | 0) && base >= 2 && base <= 36);
|
|
59992
59992
|
number = number.toString().replace(/\s+/g, "");
|
|
59993
59993
|
var start = 0;
|
|
59994
59994
|
if (number[0] === "-") {
|
|
@@ -60021,7 +60021,7 @@ var require_bn = __commonJS({
|
|
|
60021
60021
|
];
|
|
60022
60022
|
this.length = 2;
|
|
60023
60023
|
} else {
|
|
60024
|
-
|
|
60024
|
+
assert(number < 9007199254740992);
|
|
60025
60025
|
this.words = [
|
|
60026
60026
|
number & 67108863,
|
|
60027
60027
|
number / 67108864 & 67108863,
|
|
@@ -60034,7 +60034,7 @@ var require_bn = __commonJS({
|
|
|
60034
60034
|
this._initArray(this.toArray(), base, endian);
|
|
60035
60035
|
};
|
|
60036
60036
|
BN.prototype._initArray = function _initArray(number, base, endian) {
|
|
60037
|
-
|
|
60037
|
+
assert(typeof number.length === "number");
|
|
60038
60038
|
if (number.length <= 0) {
|
|
60039
60039
|
this.words = [0];
|
|
60040
60040
|
this.length = 1;
|
|
@@ -60081,7 +60081,7 @@ var require_bn = __commonJS({
|
|
|
60081
60081
|
} else if (c >= 97 && c <= 102) {
|
|
60082
60082
|
return c - 87;
|
|
60083
60083
|
} else {
|
|
60084
|
-
|
|
60084
|
+
assert(false, "Invalid character in " + string);
|
|
60085
60085
|
}
|
|
60086
60086
|
}
|
|
60087
60087
|
function parseHexByte(string, lowerBound, index) {
|
|
@@ -60142,7 +60142,7 @@ var require_bn = __commonJS({
|
|
|
60142
60142
|
} else {
|
|
60143
60143
|
b = c;
|
|
60144
60144
|
}
|
|
60145
|
-
|
|
60145
|
+
assert(c >= 0 && b < mul, "Invalid character");
|
|
60146
60146
|
r += b;
|
|
60147
60147
|
}
|
|
60148
60148
|
return r;
|
|
@@ -60402,7 +60402,7 @@ var require_bn = __commonJS({
|
|
|
60402
60402
|
}
|
|
60403
60403
|
return out;
|
|
60404
60404
|
}
|
|
60405
|
-
|
|
60405
|
+
assert(false, "Base should be between 2 and 36");
|
|
60406
60406
|
};
|
|
60407
60407
|
BN.prototype.toNumber = function toNumber() {
|
|
60408
60408
|
var ret = this.words[0];
|
|
@@ -60411,7 +60411,7 @@ var require_bn = __commonJS({
|
|
|
60411
60411
|
} else if (this.length === 3 && this.words[2] === 1) {
|
|
60412
60412
|
ret += 4503599627370496 + this.words[1] * 67108864;
|
|
60413
60413
|
} else if (this.length > 2) {
|
|
60414
|
-
|
|
60414
|
+
assert(false, "Number can only safely store up to 53 bits");
|
|
60415
60415
|
}
|
|
60416
60416
|
return this.negative !== 0 ? -ret : ret;
|
|
60417
60417
|
};
|
|
@@ -60436,8 +60436,8 @@ var require_bn = __commonJS({
|
|
|
60436
60436
|
this._strip();
|
|
60437
60437
|
var byteLength = this.byteLength();
|
|
60438
60438
|
var reqLength = length || Math.max(1, byteLength);
|
|
60439
|
-
|
|
60440
|
-
|
|
60439
|
+
assert(byteLength <= reqLength, "byte array longer than desired length");
|
|
60440
|
+
assert(reqLength > 0, "Requested array length <= 0");
|
|
60441
60441
|
var res = allocate(ArrayType, reqLength);
|
|
60442
60442
|
var postfix = endian === "le" ? "LE" : "BE";
|
|
60443
60443
|
this["_toArrayLike" + postfix](res, byteLength);
|
|
@@ -60619,7 +60619,7 @@ var require_bn = __commonJS({
|
|
|
60619
60619
|
return this._strip();
|
|
60620
60620
|
};
|
|
60621
60621
|
BN.prototype.ior = function ior(num) {
|
|
60622
|
-
|
|
60622
|
+
assert((this.negative | num.negative) === 0);
|
|
60623
60623
|
return this.iuor(num);
|
|
60624
60624
|
};
|
|
60625
60625
|
BN.prototype.or = function or(num) {
|
|
@@ -60646,7 +60646,7 @@ var require_bn = __commonJS({
|
|
|
60646
60646
|
return this._strip();
|
|
60647
60647
|
};
|
|
60648
60648
|
BN.prototype.iand = function iand(num) {
|
|
60649
|
-
|
|
60649
|
+
assert((this.negative | num.negative) === 0);
|
|
60650
60650
|
return this.iuand(num);
|
|
60651
60651
|
};
|
|
60652
60652
|
BN.prototype.and = function and(num) {
|
|
@@ -60681,7 +60681,7 @@ var require_bn = __commonJS({
|
|
|
60681
60681
|
return this._strip();
|
|
60682
60682
|
};
|
|
60683
60683
|
BN.prototype.ixor = function ixor(num) {
|
|
60684
|
-
|
|
60684
|
+
assert((this.negative | num.negative) === 0);
|
|
60685
60685
|
return this.iuxor(num);
|
|
60686
60686
|
};
|
|
60687
60687
|
BN.prototype.xor = function xor(num) {
|
|
@@ -60695,7 +60695,7 @@ var require_bn = __commonJS({
|
|
|
60695
60695
|
return num.clone().iuxor(this);
|
|
60696
60696
|
};
|
|
60697
60697
|
BN.prototype.inotn = function inotn(width) {
|
|
60698
|
-
|
|
60698
|
+
assert(typeof width === "number" && width >= 0);
|
|
60699
60699
|
var bytesNeeded = Math.ceil(width / 26) | 0;
|
|
60700
60700
|
var bitsLeft = width % 26;
|
|
60701
60701
|
this._expand(bytesNeeded);
|
|
@@ -60714,7 +60714,7 @@ var require_bn = __commonJS({
|
|
|
60714
60714
|
return this.clone().inotn(width);
|
|
60715
60715
|
};
|
|
60716
60716
|
BN.prototype.setn = function setn(bit, val) {
|
|
60717
|
-
|
|
60717
|
+
assert(typeof bit === "number" && bit >= 0);
|
|
60718
60718
|
var off = bit / 26 | 0;
|
|
60719
60719
|
var wbit = bit % 26;
|
|
60720
60720
|
this._expand(off + 1);
|
|
@@ -61580,8 +61580,8 @@ var require_bn = __commonJS({
|
|
|
61580
61580
|
for (i = 2 * len; i < N; ++i) {
|
|
61581
61581
|
rws[i] = 0;
|
|
61582
61582
|
}
|
|
61583
|
-
|
|
61584
|
-
|
|
61583
|
+
assert(carry === 0);
|
|
61584
|
+
assert((carry & ~8191) === 0);
|
|
61585
61585
|
};
|
|
61586
61586
|
FFTM.prototype.stub = function stub(N) {
|
|
61587
61587
|
var ph = new Array(N);
|
|
@@ -61636,8 +61636,8 @@ var require_bn = __commonJS({
|
|
|
61636
61636
|
var isNegNum = num < 0;
|
|
61637
61637
|
if (isNegNum)
|
|
61638
61638
|
num = -num;
|
|
61639
|
-
|
|
61640
|
-
|
|
61639
|
+
assert(typeof num === "number");
|
|
61640
|
+
assert(num < 67108864);
|
|
61641
61641
|
var carry = 0;
|
|
61642
61642
|
for (var i = 0; i < this.length; i++) {
|
|
61643
61643
|
var w = (this.words[i] | 0) * num;
|
|
@@ -61681,7 +61681,7 @@ var require_bn = __commonJS({
|
|
|
61681
61681
|
return res;
|
|
61682
61682
|
};
|
|
61683
61683
|
BN.prototype.iushln = function iushln(bits) {
|
|
61684
|
-
|
|
61684
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
61685
61685
|
var r = bits % 26;
|
|
61686
61686
|
var s = (bits - r) / 26;
|
|
61687
61687
|
var carryMask = 67108863 >>> 26 - r << 26 - r;
|
|
@@ -61711,11 +61711,11 @@ var require_bn = __commonJS({
|
|
|
61711
61711
|
return this._strip();
|
|
61712
61712
|
};
|
|
61713
61713
|
BN.prototype.ishln = function ishln(bits) {
|
|
61714
|
-
|
|
61714
|
+
assert(this.negative === 0);
|
|
61715
61715
|
return this.iushln(bits);
|
|
61716
61716
|
};
|
|
61717
61717
|
BN.prototype.iushrn = function iushrn(bits, hint, extended) {
|
|
61718
|
-
|
|
61718
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
61719
61719
|
var h;
|
|
61720
61720
|
if (hint) {
|
|
61721
61721
|
h = (hint - hint % 26) / 26;
|
|
@@ -61760,7 +61760,7 @@ var require_bn = __commonJS({
|
|
|
61760
61760
|
return this._strip();
|
|
61761
61761
|
};
|
|
61762
61762
|
BN.prototype.ishrn = function ishrn(bits, hint, extended) {
|
|
61763
|
-
|
|
61763
|
+
assert(this.negative === 0);
|
|
61764
61764
|
return this.iushrn(bits, hint, extended);
|
|
61765
61765
|
};
|
|
61766
61766
|
BN.prototype.shln = function shln(bits) {
|
|
@@ -61776,7 +61776,7 @@ var require_bn = __commonJS({
|
|
|
61776
61776
|
return this.clone().iushrn(bits);
|
|
61777
61777
|
};
|
|
61778
61778
|
BN.prototype.testn = function testn(bit) {
|
|
61779
|
-
|
|
61779
|
+
assert(typeof bit === "number" && bit >= 0);
|
|
61780
61780
|
var r = bit % 26;
|
|
61781
61781
|
var s = (bit - r) / 26;
|
|
61782
61782
|
var q = 1 << r;
|
|
@@ -61786,10 +61786,10 @@ var require_bn = __commonJS({
|
|
|
61786
61786
|
return !!(w & q);
|
|
61787
61787
|
};
|
|
61788
61788
|
BN.prototype.imaskn = function imaskn(bits) {
|
|
61789
|
-
|
|
61789
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
61790
61790
|
var r = bits % 26;
|
|
61791
61791
|
var s = (bits - r) / 26;
|
|
61792
|
-
|
|
61792
|
+
assert(this.negative === 0, "imaskn works only with positive numbers");
|
|
61793
61793
|
if (this.length <= s) {
|
|
61794
61794
|
return this;
|
|
61795
61795
|
}
|
|
@@ -61807,8 +61807,8 @@ var require_bn = __commonJS({
|
|
|
61807
61807
|
return this.clone().imaskn(bits);
|
|
61808
61808
|
};
|
|
61809
61809
|
BN.prototype.iaddn = function iaddn(num) {
|
|
61810
|
-
|
|
61811
|
-
|
|
61810
|
+
assert(typeof num === "number");
|
|
61811
|
+
assert(num < 67108864);
|
|
61812
61812
|
if (num < 0)
|
|
61813
61813
|
return this.isubn(-num);
|
|
61814
61814
|
if (this.negative !== 0) {
|
|
@@ -61838,8 +61838,8 @@ var require_bn = __commonJS({
|
|
|
61838
61838
|
return this;
|
|
61839
61839
|
};
|
|
61840
61840
|
BN.prototype.isubn = function isubn(num) {
|
|
61841
|
-
|
|
61842
|
-
|
|
61841
|
+
assert(typeof num === "number");
|
|
61842
|
+
assert(num < 67108864);
|
|
61843
61843
|
if (num < 0)
|
|
61844
61844
|
return this.iaddn(-num);
|
|
61845
61845
|
if (this.negative !== 0) {
|
|
@@ -61893,7 +61893,7 @@ var require_bn = __commonJS({
|
|
|
61893
61893
|
}
|
|
61894
61894
|
if (carry === 0)
|
|
61895
61895
|
return this._strip();
|
|
61896
|
-
|
|
61896
|
+
assert(carry === -1);
|
|
61897
61897
|
carry = 0;
|
|
61898
61898
|
for (i = 0; i < this.length; i++) {
|
|
61899
61899
|
w = -(this.words[i] | 0) + carry;
|
|
@@ -61961,7 +61961,7 @@ var require_bn = __commonJS({
|
|
|
61961
61961
|
};
|
|
61962
61962
|
};
|
|
61963
61963
|
BN.prototype.divmod = function divmod(num, mode, positive) {
|
|
61964
|
-
|
|
61964
|
+
assert(!num.isZero());
|
|
61965
61965
|
if (this.isZero()) {
|
|
61966
61966
|
return {
|
|
61967
61967
|
div: new BN(0),
|
|
@@ -62059,7 +62059,7 @@ var require_bn = __commonJS({
|
|
|
62059
62059
|
var isNegNum = num < 0;
|
|
62060
62060
|
if (isNegNum)
|
|
62061
62061
|
num = -num;
|
|
62062
|
-
|
|
62062
|
+
assert(num <= 67108863);
|
|
62063
62063
|
var p = (1 << 26) % num;
|
|
62064
62064
|
var acc = 0;
|
|
62065
62065
|
for (var i = this.length - 1; i >= 0; i--) {
|
|
@@ -62074,7 +62074,7 @@ var require_bn = __commonJS({
|
|
|
62074
62074
|
var isNegNum = num < 0;
|
|
62075
62075
|
if (isNegNum)
|
|
62076
62076
|
num = -num;
|
|
62077
|
-
|
|
62077
|
+
assert(num <= 67108863);
|
|
62078
62078
|
var carry = 0;
|
|
62079
62079
|
for (var i = this.length - 1; i >= 0; i--) {
|
|
62080
62080
|
var w = (this.words[i] | 0) + carry * 67108864;
|
|
@@ -62088,8 +62088,8 @@ var require_bn = __commonJS({
|
|
|
62088
62088
|
return this.clone().idivn(num);
|
|
62089
62089
|
};
|
|
62090
62090
|
BN.prototype.egcd = function egcd(p) {
|
|
62091
|
-
|
|
62092
|
-
|
|
62091
|
+
assert(p.negative === 0);
|
|
62092
|
+
assert(!p.isZero());
|
|
62093
62093
|
var x = this;
|
|
62094
62094
|
var y = p.clone();
|
|
62095
62095
|
if (x.negative !== 0) {
|
|
@@ -62153,8 +62153,8 @@ var require_bn = __commonJS({
|
|
|
62153
62153
|
};
|
|
62154
62154
|
};
|
|
62155
62155
|
BN.prototype._invmp = function _invmp(p) {
|
|
62156
|
-
|
|
62157
|
-
|
|
62156
|
+
assert(p.negative === 0);
|
|
62157
|
+
assert(!p.isZero());
|
|
62158
62158
|
var a = this;
|
|
62159
62159
|
var b = p.clone();
|
|
62160
62160
|
if (a.negative !== 0) {
|
|
@@ -62252,7 +62252,7 @@ var require_bn = __commonJS({
|
|
|
62252
62252
|
return this.words[0] & num;
|
|
62253
62253
|
};
|
|
62254
62254
|
BN.prototype.bincn = function bincn(bit) {
|
|
62255
|
-
|
|
62255
|
+
assert(typeof bit === "number");
|
|
62256
62256
|
var r = bit % 26;
|
|
62257
62257
|
var s = (bit - r) / 26;
|
|
62258
62258
|
var q = 1 << r;
|
|
@@ -62292,7 +62292,7 @@ var require_bn = __commonJS({
|
|
|
62292
62292
|
if (negative) {
|
|
62293
62293
|
num = -num;
|
|
62294
62294
|
}
|
|
62295
|
-
|
|
62295
|
+
assert(num <= 67108863, "Number is too big");
|
|
62296
62296
|
var w = this.words[0] | 0;
|
|
62297
62297
|
res = w === num ? 0 : w < num ? -1 : 1;
|
|
62298
62298
|
}
|
|
@@ -62364,12 +62364,12 @@ var require_bn = __commonJS({
|
|
|
62364
62364
|
return new Red(num);
|
|
62365
62365
|
};
|
|
62366
62366
|
BN.prototype.toRed = function toRed(ctx) {
|
|
62367
|
-
|
|
62368
|
-
|
|
62367
|
+
assert(!this.red, "Already a number in reduction context");
|
|
62368
|
+
assert(this.negative === 0, "red works only with positives");
|
|
62369
62369
|
return ctx.convertTo(this)._forceRed(ctx);
|
|
62370
62370
|
};
|
|
62371
62371
|
BN.prototype.fromRed = function fromRed() {
|
|
62372
|
-
|
|
62372
|
+
assert(this.red, "fromRed works only with numbers in reduction context");
|
|
62373
62373
|
return this.red.convertFrom(this);
|
|
62374
62374
|
};
|
|
62375
62375
|
BN.prototype._forceRed = function _forceRed(ctx) {
|
|
@@ -62377,66 +62377,66 @@ var require_bn = __commonJS({
|
|
|
62377
62377
|
return this;
|
|
62378
62378
|
};
|
|
62379
62379
|
BN.prototype.forceRed = function forceRed(ctx) {
|
|
62380
|
-
|
|
62380
|
+
assert(!this.red, "Already a number in reduction context");
|
|
62381
62381
|
return this._forceRed(ctx);
|
|
62382
62382
|
};
|
|
62383
62383
|
BN.prototype.redAdd = function redAdd(num) {
|
|
62384
|
-
|
|
62384
|
+
assert(this.red, "redAdd works only with red numbers");
|
|
62385
62385
|
return this.red.add(this, num);
|
|
62386
62386
|
};
|
|
62387
62387
|
BN.prototype.redIAdd = function redIAdd(num) {
|
|
62388
|
-
|
|
62388
|
+
assert(this.red, "redIAdd works only with red numbers");
|
|
62389
62389
|
return this.red.iadd(this, num);
|
|
62390
62390
|
};
|
|
62391
62391
|
BN.prototype.redSub = function redSub(num) {
|
|
62392
|
-
|
|
62392
|
+
assert(this.red, "redSub works only with red numbers");
|
|
62393
62393
|
return this.red.sub(this, num);
|
|
62394
62394
|
};
|
|
62395
62395
|
BN.prototype.redISub = function redISub(num) {
|
|
62396
|
-
|
|
62396
|
+
assert(this.red, "redISub works only with red numbers");
|
|
62397
62397
|
return this.red.isub(this, num);
|
|
62398
62398
|
};
|
|
62399
62399
|
BN.prototype.redShl = function redShl(num) {
|
|
62400
|
-
|
|
62400
|
+
assert(this.red, "redShl works only with red numbers");
|
|
62401
62401
|
return this.red.shl(this, num);
|
|
62402
62402
|
};
|
|
62403
62403
|
BN.prototype.redMul = function redMul(num) {
|
|
62404
|
-
|
|
62404
|
+
assert(this.red, "redMul works only with red numbers");
|
|
62405
62405
|
this.red._verify2(this, num);
|
|
62406
62406
|
return this.red.mul(this, num);
|
|
62407
62407
|
};
|
|
62408
62408
|
BN.prototype.redIMul = function redIMul(num) {
|
|
62409
|
-
|
|
62409
|
+
assert(this.red, "redMul works only with red numbers");
|
|
62410
62410
|
this.red._verify2(this, num);
|
|
62411
62411
|
return this.red.imul(this, num);
|
|
62412
62412
|
};
|
|
62413
62413
|
BN.prototype.redSqr = function redSqr() {
|
|
62414
|
-
|
|
62414
|
+
assert(this.red, "redSqr works only with red numbers");
|
|
62415
62415
|
this.red._verify1(this);
|
|
62416
62416
|
return this.red.sqr(this);
|
|
62417
62417
|
};
|
|
62418
62418
|
BN.prototype.redISqr = function redISqr() {
|
|
62419
|
-
|
|
62419
|
+
assert(this.red, "redISqr works only with red numbers");
|
|
62420
62420
|
this.red._verify1(this);
|
|
62421
62421
|
return this.red.isqr(this);
|
|
62422
62422
|
};
|
|
62423
62423
|
BN.prototype.redSqrt = function redSqrt() {
|
|
62424
|
-
|
|
62424
|
+
assert(this.red, "redSqrt works only with red numbers");
|
|
62425
62425
|
this.red._verify1(this);
|
|
62426
62426
|
return this.red.sqrt(this);
|
|
62427
62427
|
};
|
|
62428
62428
|
BN.prototype.redInvm = function redInvm() {
|
|
62429
|
-
|
|
62429
|
+
assert(this.red, "redInvm works only with red numbers");
|
|
62430
62430
|
this.red._verify1(this);
|
|
62431
62431
|
return this.red.invm(this);
|
|
62432
62432
|
};
|
|
62433
62433
|
BN.prototype.redNeg = function redNeg() {
|
|
62434
|
-
|
|
62434
|
+
assert(this.red, "redNeg works only with red numbers");
|
|
62435
62435
|
this.red._verify1(this);
|
|
62436
62436
|
return this.red.neg(this);
|
|
62437
62437
|
};
|
|
62438
62438
|
BN.prototype.redPow = function redPow(num) {
|
|
62439
|
-
|
|
62439
|
+
assert(this.red && !num.red, "redPow(normalNum)");
|
|
62440
62440
|
this.red._verify1(this);
|
|
62441
62441
|
return this.red.pow(this, num);
|
|
62442
62442
|
};
|
|
@@ -62604,18 +62604,18 @@ var require_bn = __commonJS({
|
|
|
62604
62604
|
this.m = prime.p;
|
|
62605
62605
|
this.prime = prime;
|
|
62606
62606
|
} else {
|
|
62607
|
-
|
|
62607
|
+
assert(m.gtn(1), "modulus must be greater than 1");
|
|
62608
62608
|
this.m = m;
|
|
62609
62609
|
this.prime = null;
|
|
62610
62610
|
}
|
|
62611
62611
|
}
|
|
62612
62612
|
Red.prototype._verify1 = function _verify1(a) {
|
|
62613
|
-
|
|
62614
|
-
|
|
62613
|
+
assert(a.negative === 0, "red works only with positives");
|
|
62614
|
+
assert(a.red, "red works only with red numbers");
|
|
62615
62615
|
};
|
|
62616
62616
|
Red.prototype._verify2 = function _verify2(a, b) {
|
|
62617
|
-
|
|
62618
|
-
|
|
62617
|
+
assert((a.negative | b.negative) === 0, "red works only with positives");
|
|
62618
|
+
assert(
|
|
62619
62619
|
a.red && a.red === b.red,
|
|
62620
62620
|
"red works only with red numbers"
|
|
62621
62621
|
);
|
|
@@ -62686,7 +62686,7 @@ var require_bn = __commonJS({
|
|
|
62686
62686
|
if (a.isZero())
|
|
62687
62687
|
return a.clone();
|
|
62688
62688
|
var mod3 = this.m.andln(3);
|
|
62689
|
-
|
|
62689
|
+
assert(mod3 % 2 === 1);
|
|
62690
62690
|
if (mod3 === 3) {
|
|
62691
62691
|
var pow = this.m.add(new BN(1)).iushrn(2);
|
|
62692
62692
|
return this.pow(a, pow);
|
|
@@ -62697,7 +62697,7 @@ var require_bn = __commonJS({
|
|
|
62697
62697
|
s++;
|
|
62698
62698
|
q.iushrn(1);
|
|
62699
62699
|
}
|
|
62700
|
-
|
|
62700
|
+
assert(!q.isZero());
|
|
62701
62701
|
var one = new BN(1).toRed(this);
|
|
62702
62702
|
var nOne = one.redNeg();
|
|
62703
62703
|
var lpow = this.m.subn(1).iushrn(1);
|
|
@@ -62715,7 +62715,7 @@ var require_bn = __commonJS({
|
|
|
62715
62715
|
for (var i = 0; tmp.cmp(one) !== 0; i++) {
|
|
62716
62716
|
tmp = tmp.redSqr();
|
|
62717
62717
|
}
|
|
62718
|
-
|
|
62718
|
+
assert(i < m);
|
|
62719
62719
|
var b = this.pow(c, new BN(1).iushln(m - i - 1));
|
|
62720
62720
|
r = r.redMul(b);
|
|
62721
62721
|
c = b.redSqr();
|
|
@@ -71309,7 +71309,7 @@ var require_bn2 = __commonJS({
|
|
|
71309
71309
|
"node_modules/elliptic/node_modules/bn.js/lib/bn.js"(exports2, module2) {
|
|
71310
71310
|
(function(module3, exports3) {
|
|
71311
71311
|
"use strict";
|
|
71312
|
-
function
|
|
71312
|
+
function assert(val, msg) {
|
|
71313
71313
|
if (!val)
|
|
71314
71314
|
throw new Error(msg || "Assertion failed");
|
|
71315
71315
|
}
|
|
@@ -71379,7 +71379,7 @@ var require_bn2 = __commonJS({
|
|
|
71379
71379
|
if (base === "hex") {
|
|
71380
71380
|
base = 16;
|
|
71381
71381
|
}
|
|
71382
|
-
|
|
71382
|
+
assert(base === (base | 0) && base >= 2 && base <= 36);
|
|
71383
71383
|
number = number.toString().replace(/\s+/g, "");
|
|
71384
71384
|
var start = 0;
|
|
71385
71385
|
if (number[0] === "-") {
|
|
@@ -71412,7 +71412,7 @@ var require_bn2 = __commonJS({
|
|
|
71412
71412
|
];
|
|
71413
71413
|
this.length = 2;
|
|
71414
71414
|
} else {
|
|
71415
|
-
|
|
71415
|
+
assert(number < 9007199254740992);
|
|
71416
71416
|
this.words = [
|
|
71417
71417
|
number & 67108863,
|
|
71418
71418
|
number / 67108864 & 67108863,
|
|
@@ -71425,7 +71425,7 @@ var require_bn2 = __commonJS({
|
|
|
71425
71425
|
this._initArray(this.toArray(), base, endian);
|
|
71426
71426
|
};
|
|
71427
71427
|
BN.prototype._initArray = function _initArray(number, base, endian) {
|
|
71428
|
-
|
|
71428
|
+
assert(typeof number.length === "number");
|
|
71429
71429
|
if (number.length <= 0) {
|
|
71430
71430
|
this.words = [0];
|
|
71431
71431
|
this.length = 1;
|
|
@@ -71770,7 +71770,7 @@ var require_bn2 = __commonJS({
|
|
|
71770
71770
|
}
|
|
71771
71771
|
return out;
|
|
71772
71772
|
}
|
|
71773
|
-
|
|
71773
|
+
assert(false, "Base should be between 2 and 36");
|
|
71774
71774
|
};
|
|
71775
71775
|
BN.prototype.toNumber = function toNumber() {
|
|
71776
71776
|
var ret = this.words[0];
|
|
@@ -71779,7 +71779,7 @@ var require_bn2 = __commonJS({
|
|
|
71779
71779
|
} else if (this.length === 3 && this.words[2] === 1) {
|
|
71780
71780
|
ret += 4503599627370496 + this.words[1] * 67108864;
|
|
71781
71781
|
} else if (this.length > 2) {
|
|
71782
|
-
|
|
71782
|
+
assert(false, "Number can only safely store up to 53 bits");
|
|
71783
71783
|
}
|
|
71784
71784
|
return this.negative !== 0 ? -ret : ret;
|
|
71785
71785
|
};
|
|
@@ -71787,7 +71787,7 @@ var require_bn2 = __commonJS({
|
|
|
71787
71787
|
return this.toString(16);
|
|
71788
71788
|
};
|
|
71789
71789
|
BN.prototype.toBuffer = function toBuffer(endian, length) {
|
|
71790
|
-
|
|
71790
|
+
assert(typeof Buffer2 !== "undefined");
|
|
71791
71791
|
return this.toArrayLike(Buffer2, endian, length);
|
|
71792
71792
|
};
|
|
71793
71793
|
BN.prototype.toArray = function toArray(endian, length) {
|
|
@@ -71796,8 +71796,8 @@ var require_bn2 = __commonJS({
|
|
|
71796
71796
|
BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
|
|
71797
71797
|
var byteLength = this.byteLength();
|
|
71798
71798
|
var reqLength = length || Math.max(1, byteLength);
|
|
71799
|
-
|
|
71800
|
-
|
|
71799
|
+
assert(byteLength <= reqLength, "byte array longer than desired length");
|
|
71800
|
+
assert(reqLength > 0, "Requested array length <= 0");
|
|
71801
71801
|
this.strip();
|
|
71802
71802
|
var littleEndian = endian === "le";
|
|
71803
71803
|
var res = new ArrayType(reqLength);
|
|
@@ -71940,7 +71940,7 @@ var require_bn2 = __commonJS({
|
|
|
71940
71940
|
return this.strip();
|
|
71941
71941
|
};
|
|
71942
71942
|
BN.prototype.ior = function ior(num) {
|
|
71943
|
-
|
|
71943
|
+
assert((this.negative | num.negative) === 0);
|
|
71944
71944
|
return this.iuor(num);
|
|
71945
71945
|
};
|
|
71946
71946
|
BN.prototype.or = function or(num) {
|
|
@@ -71967,7 +71967,7 @@ var require_bn2 = __commonJS({
|
|
|
71967
71967
|
return this.strip();
|
|
71968
71968
|
};
|
|
71969
71969
|
BN.prototype.iand = function iand(num) {
|
|
71970
|
-
|
|
71970
|
+
assert((this.negative | num.negative) === 0);
|
|
71971
71971
|
return this.iuand(num);
|
|
71972
71972
|
};
|
|
71973
71973
|
BN.prototype.and = function and(num) {
|
|
@@ -72002,7 +72002,7 @@ var require_bn2 = __commonJS({
|
|
|
72002
72002
|
return this.strip();
|
|
72003
72003
|
};
|
|
72004
72004
|
BN.prototype.ixor = function ixor(num) {
|
|
72005
|
-
|
|
72005
|
+
assert((this.negative | num.negative) === 0);
|
|
72006
72006
|
return this.iuxor(num);
|
|
72007
72007
|
};
|
|
72008
72008
|
BN.prototype.xor = function xor(num) {
|
|
@@ -72016,7 +72016,7 @@ var require_bn2 = __commonJS({
|
|
|
72016
72016
|
return num.clone().iuxor(this);
|
|
72017
72017
|
};
|
|
72018
72018
|
BN.prototype.inotn = function inotn(width) {
|
|
72019
|
-
|
|
72019
|
+
assert(typeof width === "number" && width >= 0);
|
|
72020
72020
|
var bytesNeeded = Math.ceil(width / 26) | 0;
|
|
72021
72021
|
var bitsLeft = width % 26;
|
|
72022
72022
|
this._expand(bytesNeeded);
|
|
@@ -72035,7 +72035,7 @@ var require_bn2 = __commonJS({
|
|
|
72035
72035
|
return this.clone().inotn(width);
|
|
72036
72036
|
};
|
|
72037
72037
|
BN.prototype.setn = function setn(bit, val) {
|
|
72038
|
-
|
|
72038
|
+
assert(typeof bit === "number" && bit >= 0);
|
|
72039
72039
|
var off = bit / 26 | 0;
|
|
72040
72040
|
var wbit = bit % 26;
|
|
72041
72041
|
this._expand(off + 1);
|
|
@@ -72902,8 +72902,8 @@ var require_bn2 = __commonJS({
|
|
|
72902
72902
|
for (i = 2 * len; i < N; ++i) {
|
|
72903
72903
|
rws[i] = 0;
|
|
72904
72904
|
}
|
|
72905
|
-
|
|
72906
|
-
|
|
72905
|
+
assert(carry === 0);
|
|
72906
|
+
assert((carry & ~8191) === 0);
|
|
72907
72907
|
};
|
|
72908
72908
|
FFTM.prototype.stub = function stub(N) {
|
|
72909
72909
|
var ph = new Array(N);
|
|
@@ -72955,8 +72955,8 @@ var require_bn2 = __commonJS({
|
|
|
72955
72955
|
return this.clone().mulTo(num, this);
|
|
72956
72956
|
};
|
|
72957
72957
|
BN.prototype.imuln = function imuln(num) {
|
|
72958
|
-
|
|
72959
|
-
|
|
72958
|
+
assert(typeof num === "number");
|
|
72959
|
+
assert(num < 67108864);
|
|
72960
72960
|
var carry = 0;
|
|
72961
72961
|
for (var i = 0; i < this.length; i++) {
|
|
72962
72962
|
var w = (this.words[i] | 0) * num;
|
|
@@ -73000,7 +73000,7 @@ var require_bn2 = __commonJS({
|
|
|
73000
73000
|
return res;
|
|
73001
73001
|
};
|
|
73002
73002
|
BN.prototype.iushln = function iushln(bits) {
|
|
73003
|
-
|
|
73003
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
73004
73004
|
var r = bits % 26;
|
|
73005
73005
|
var s = (bits - r) / 26;
|
|
73006
73006
|
var carryMask = 67108863 >>> 26 - r << 26 - r;
|
|
@@ -73030,11 +73030,11 @@ var require_bn2 = __commonJS({
|
|
|
73030
73030
|
return this.strip();
|
|
73031
73031
|
};
|
|
73032
73032
|
BN.prototype.ishln = function ishln(bits) {
|
|
73033
|
-
|
|
73033
|
+
assert(this.negative === 0);
|
|
73034
73034
|
return this.iushln(bits);
|
|
73035
73035
|
};
|
|
73036
73036
|
BN.prototype.iushrn = function iushrn(bits, hint, extended) {
|
|
73037
|
-
|
|
73037
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
73038
73038
|
var h;
|
|
73039
73039
|
if (hint) {
|
|
73040
73040
|
h = (hint - hint % 26) / 26;
|
|
@@ -73079,7 +73079,7 @@ var require_bn2 = __commonJS({
|
|
|
73079
73079
|
return this.strip();
|
|
73080
73080
|
};
|
|
73081
73081
|
BN.prototype.ishrn = function ishrn(bits, hint, extended) {
|
|
73082
|
-
|
|
73082
|
+
assert(this.negative === 0);
|
|
73083
73083
|
return this.iushrn(bits, hint, extended);
|
|
73084
73084
|
};
|
|
73085
73085
|
BN.prototype.shln = function shln(bits) {
|
|
@@ -73095,7 +73095,7 @@ var require_bn2 = __commonJS({
|
|
|
73095
73095
|
return this.clone().iushrn(bits);
|
|
73096
73096
|
};
|
|
73097
73097
|
BN.prototype.testn = function testn(bit) {
|
|
73098
|
-
|
|
73098
|
+
assert(typeof bit === "number" && bit >= 0);
|
|
73099
73099
|
var r = bit % 26;
|
|
73100
73100
|
var s = (bit - r) / 26;
|
|
73101
73101
|
var q = 1 << r;
|
|
@@ -73105,10 +73105,10 @@ var require_bn2 = __commonJS({
|
|
|
73105
73105
|
return !!(w & q);
|
|
73106
73106
|
};
|
|
73107
73107
|
BN.prototype.imaskn = function imaskn(bits) {
|
|
73108
|
-
|
|
73108
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
73109
73109
|
var r = bits % 26;
|
|
73110
73110
|
var s = (bits - r) / 26;
|
|
73111
|
-
|
|
73111
|
+
assert(this.negative === 0, "imaskn works only with positive numbers");
|
|
73112
73112
|
if (this.length <= s) {
|
|
73113
73113
|
return this;
|
|
73114
73114
|
}
|
|
@@ -73126,8 +73126,8 @@ var require_bn2 = __commonJS({
|
|
|
73126
73126
|
return this.clone().imaskn(bits);
|
|
73127
73127
|
};
|
|
73128
73128
|
BN.prototype.iaddn = function iaddn(num) {
|
|
73129
|
-
|
|
73130
|
-
|
|
73129
|
+
assert(typeof num === "number");
|
|
73130
|
+
assert(num < 67108864);
|
|
73131
73131
|
if (num < 0)
|
|
73132
73132
|
return this.isubn(-num);
|
|
73133
73133
|
if (this.negative !== 0) {
|
|
@@ -73157,8 +73157,8 @@ var require_bn2 = __commonJS({
|
|
|
73157
73157
|
return this;
|
|
73158
73158
|
};
|
|
73159
73159
|
BN.prototype.isubn = function isubn(num) {
|
|
73160
|
-
|
|
73161
|
-
|
|
73160
|
+
assert(typeof num === "number");
|
|
73161
|
+
assert(num < 67108864);
|
|
73162
73162
|
if (num < 0)
|
|
73163
73163
|
return this.iaddn(-num);
|
|
73164
73164
|
if (this.negative !== 0) {
|
|
@@ -73212,7 +73212,7 @@ var require_bn2 = __commonJS({
|
|
|
73212
73212
|
}
|
|
73213
73213
|
if (carry === 0)
|
|
73214
73214
|
return this.strip();
|
|
73215
|
-
|
|
73215
|
+
assert(carry === -1);
|
|
73216
73216
|
carry = 0;
|
|
73217
73217
|
for (i = 0; i < this.length; i++) {
|
|
73218
73218
|
w = -(this.words[i] | 0) + carry;
|
|
@@ -73280,7 +73280,7 @@ var require_bn2 = __commonJS({
|
|
|
73280
73280
|
};
|
|
73281
73281
|
};
|
|
73282
73282
|
BN.prototype.divmod = function divmod(num, mode, positive) {
|
|
73283
|
-
|
|
73283
|
+
assert(!num.isZero());
|
|
73284
73284
|
if (this.isZero()) {
|
|
73285
73285
|
return {
|
|
73286
73286
|
div: new BN(0),
|
|
@@ -73375,7 +73375,7 @@ var require_bn2 = __commonJS({
|
|
|
73375
73375
|
return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
|
|
73376
73376
|
};
|
|
73377
73377
|
BN.prototype.modn = function modn(num) {
|
|
73378
|
-
|
|
73378
|
+
assert(num <= 67108863);
|
|
73379
73379
|
var p = (1 << 26) % num;
|
|
73380
73380
|
var acc = 0;
|
|
73381
73381
|
for (var i = this.length - 1; i >= 0; i--) {
|
|
@@ -73384,7 +73384,7 @@ var require_bn2 = __commonJS({
|
|
|
73384
73384
|
return acc;
|
|
73385
73385
|
};
|
|
73386
73386
|
BN.prototype.idivn = function idivn(num) {
|
|
73387
|
-
|
|
73387
|
+
assert(num <= 67108863);
|
|
73388
73388
|
var carry = 0;
|
|
73389
73389
|
for (var i = this.length - 1; i >= 0; i--) {
|
|
73390
73390
|
var w = (this.words[i] | 0) + carry * 67108864;
|
|
@@ -73397,8 +73397,8 @@ var require_bn2 = __commonJS({
|
|
|
73397
73397
|
return this.clone().idivn(num);
|
|
73398
73398
|
};
|
|
73399
73399
|
BN.prototype.egcd = function egcd(p) {
|
|
73400
|
-
|
|
73401
|
-
|
|
73400
|
+
assert(p.negative === 0);
|
|
73401
|
+
assert(!p.isZero());
|
|
73402
73402
|
var x = this;
|
|
73403
73403
|
var y = p.clone();
|
|
73404
73404
|
if (x.negative !== 0) {
|
|
@@ -73462,8 +73462,8 @@ var require_bn2 = __commonJS({
|
|
|
73462
73462
|
};
|
|
73463
73463
|
};
|
|
73464
73464
|
BN.prototype._invmp = function _invmp(p) {
|
|
73465
|
-
|
|
73466
|
-
|
|
73465
|
+
assert(p.negative === 0);
|
|
73466
|
+
assert(!p.isZero());
|
|
73467
73467
|
var a = this;
|
|
73468
73468
|
var b = p.clone();
|
|
73469
73469
|
if (a.negative !== 0) {
|
|
@@ -73561,7 +73561,7 @@ var require_bn2 = __commonJS({
|
|
|
73561
73561
|
return this.words[0] & num;
|
|
73562
73562
|
};
|
|
73563
73563
|
BN.prototype.bincn = function bincn(bit) {
|
|
73564
|
-
|
|
73564
|
+
assert(typeof bit === "number");
|
|
73565
73565
|
var r = bit % 26;
|
|
73566
73566
|
var s = (bit - r) / 26;
|
|
73567
73567
|
var q = 1 << r;
|
|
@@ -73601,7 +73601,7 @@ var require_bn2 = __commonJS({
|
|
|
73601
73601
|
if (negative) {
|
|
73602
73602
|
num = -num;
|
|
73603
73603
|
}
|
|
73604
|
-
|
|
73604
|
+
assert(num <= 67108863, "Number is too big");
|
|
73605
73605
|
var w = this.words[0] | 0;
|
|
73606
73606
|
res = w === num ? 0 : w < num ? -1 : 1;
|
|
73607
73607
|
}
|
|
@@ -73673,12 +73673,12 @@ var require_bn2 = __commonJS({
|
|
|
73673
73673
|
return new Red(num);
|
|
73674
73674
|
};
|
|
73675
73675
|
BN.prototype.toRed = function toRed(ctx) {
|
|
73676
|
-
|
|
73677
|
-
|
|
73676
|
+
assert(!this.red, "Already a number in reduction context");
|
|
73677
|
+
assert(this.negative === 0, "red works only with positives");
|
|
73678
73678
|
return ctx.convertTo(this)._forceRed(ctx);
|
|
73679
73679
|
};
|
|
73680
73680
|
BN.prototype.fromRed = function fromRed() {
|
|
73681
|
-
|
|
73681
|
+
assert(this.red, "fromRed works only with numbers in reduction context");
|
|
73682
73682
|
return this.red.convertFrom(this);
|
|
73683
73683
|
};
|
|
73684
73684
|
BN.prototype._forceRed = function _forceRed(ctx) {
|
|
@@ -73686,66 +73686,66 @@ var require_bn2 = __commonJS({
|
|
|
73686
73686
|
return this;
|
|
73687
73687
|
};
|
|
73688
73688
|
BN.prototype.forceRed = function forceRed(ctx) {
|
|
73689
|
-
|
|
73689
|
+
assert(!this.red, "Already a number in reduction context");
|
|
73690
73690
|
return this._forceRed(ctx);
|
|
73691
73691
|
};
|
|
73692
73692
|
BN.prototype.redAdd = function redAdd(num) {
|
|
73693
|
-
|
|
73693
|
+
assert(this.red, "redAdd works only with red numbers");
|
|
73694
73694
|
return this.red.add(this, num);
|
|
73695
73695
|
};
|
|
73696
73696
|
BN.prototype.redIAdd = function redIAdd(num) {
|
|
73697
|
-
|
|
73697
|
+
assert(this.red, "redIAdd works only with red numbers");
|
|
73698
73698
|
return this.red.iadd(this, num);
|
|
73699
73699
|
};
|
|
73700
73700
|
BN.prototype.redSub = function redSub(num) {
|
|
73701
|
-
|
|
73701
|
+
assert(this.red, "redSub works only with red numbers");
|
|
73702
73702
|
return this.red.sub(this, num);
|
|
73703
73703
|
};
|
|
73704
73704
|
BN.prototype.redISub = function redISub(num) {
|
|
73705
|
-
|
|
73705
|
+
assert(this.red, "redISub works only with red numbers");
|
|
73706
73706
|
return this.red.isub(this, num);
|
|
73707
73707
|
};
|
|
73708
73708
|
BN.prototype.redShl = function redShl(num) {
|
|
73709
|
-
|
|
73709
|
+
assert(this.red, "redShl works only with red numbers");
|
|
73710
73710
|
return this.red.shl(this, num);
|
|
73711
73711
|
};
|
|
73712
73712
|
BN.prototype.redMul = function redMul(num) {
|
|
73713
|
-
|
|
73713
|
+
assert(this.red, "redMul works only with red numbers");
|
|
73714
73714
|
this.red._verify2(this, num);
|
|
73715
73715
|
return this.red.mul(this, num);
|
|
73716
73716
|
};
|
|
73717
73717
|
BN.prototype.redIMul = function redIMul(num) {
|
|
73718
|
-
|
|
73718
|
+
assert(this.red, "redMul works only with red numbers");
|
|
73719
73719
|
this.red._verify2(this, num);
|
|
73720
73720
|
return this.red.imul(this, num);
|
|
73721
73721
|
};
|
|
73722
73722
|
BN.prototype.redSqr = function redSqr() {
|
|
73723
|
-
|
|
73723
|
+
assert(this.red, "redSqr works only with red numbers");
|
|
73724
73724
|
this.red._verify1(this);
|
|
73725
73725
|
return this.red.sqr(this);
|
|
73726
73726
|
};
|
|
73727
73727
|
BN.prototype.redISqr = function redISqr() {
|
|
73728
|
-
|
|
73728
|
+
assert(this.red, "redISqr works only with red numbers");
|
|
73729
73729
|
this.red._verify1(this);
|
|
73730
73730
|
return this.red.isqr(this);
|
|
73731
73731
|
};
|
|
73732
73732
|
BN.prototype.redSqrt = function redSqrt() {
|
|
73733
|
-
|
|
73733
|
+
assert(this.red, "redSqrt works only with red numbers");
|
|
73734
73734
|
this.red._verify1(this);
|
|
73735
73735
|
return this.red.sqrt(this);
|
|
73736
73736
|
};
|
|
73737
73737
|
BN.prototype.redInvm = function redInvm() {
|
|
73738
|
-
|
|
73738
|
+
assert(this.red, "redInvm works only with red numbers");
|
|
73739
73739
|
this.red._verify1(this);
|
|
73740
73740
|
return this.red.invm(this);
|
|
73741
73741
|
};
|
|
73742
73742
|
BN.prototype.redNeg = function redNeg() {
|
|
73743
|
-
|
|
73743
|
+
assert(this.red, "redNeg works only with red numbers");
|
|
73744
73744
|
this.red._verify1(this);
|
|
73745
73745
|
return this.red.neg(this);
|
|
73746
73746
|
};
|
|
73747
73747
|
BN.prototype.redPow = function redPow(num) {
|
|
73748
|
-
|
|
73748
|
+
assert(this.red && !num.red, "redPow(normalNum)");
|
|
73749
73749
|
this.red._verify1(this);
|
|
73750
73750
|
return this.red.pow(this, num);
|
|
73751
73751
|
};
|
|
@@ -73913,18 +73913,18 @@ var require_bn2 = __commonJS({
|
|
|
73913
73913
|
this.m = prime.p;
|
|
73914
73914
|
this.prime = prime;
|
|
73915
73915
|
} else {
|
|
73916
|
-
|
|
73916
|
+
assert(m.gtn(1), "modulus must be greater than 1");
|
|
73917
73917
|
this.m = m;
|
|
73918
73918
|
this.prime = null;
|
|
73919
73919
|
}
|
|
73920
73920
|
}
|
|
73921
73921
|
Red.prototype._verify1 = function _verify1(a) {
|
|
73922
|
-
|
|
73923
|
-
|
|
73922
|
+
assert(a.negative === 0, "red works only with positives");
|
|
73923
|
+
assert(a.red, "red works only with red numbers");
|
|
73924
73924
|
};
|
|
73925
73925
|
Red.prototype._verify2 = function _verify2(a, b) {
|
|
73926
|
-
|
|
73927
|
-
|
|
73926
|
+
assert((a.negative | b.negative) === 0, "red works only with positives");
|
|
73927
|
+
assert(
|
|
73928
73928
|
a.red && a.red === b.red,
|
|
73929
73929
|
"red works only with red numbers"
|
|
73930
73930
|
);
|
|
@@ -73994,7 +73994,7 @@ var require_bn2 = __commonJS({
|
|
|
73994
73994
|
if (a.isZero())
|
|
73995
73995
|
return a.clone();
|
|
73996
73996
|
var mod3 = this.m.andln(3);
|
|
73997
|
-
|
|
73997
|
+
assert(mod3 % 2 === 1);
|
|
73998
73998
|
if (mod3 === 3) {
|
|
73999
73999
|
var pow = this.m.add(new BN(1)).iushrn(2);
|
|
74000
74000
|
return this.pow(a, pow);
|
|
@@ -74005,7 +74005,7 @@ var require_bn2 = __commonJS({
|
|
|
74005
74005
|
s++;
|
|
74006
74006
|
q.iushrn(1);
|
|
74007
74007
|
}
|
|
74008
|
-
|
|
74008
|
+
assert(!q.isZero());
|
|
74009
74009
|
var one = new BN(1).toRed(this);
|
|
74010
74010
|
var nOne = one.redNeg();
|
|
74011
74011
|
var lpow = this.m.subn(1).iushrn(1);
|
|
@@ -74023,7 +74023,7 @@ var require_bn2 = __commonJS({
|
|
|
74023
74023
|
for (var i = 0; tmp.cmp(one) !== 0; i++) {
|
|
74024
74024
|
tmp = tmp.redSqr();
|
|
74025
74025
|
}
|
|
74026
|
-
|
|
74026
|
+
assert(i < m);
|
|
74027
74027
|
var b = this.pow(c, new BN(1).iushln(m - i - 1));
|
|
74028
74028
|
r = r.redMul(b);
|
|
74029
74029
|
c = b.redSqr();
|
|
@@ -74160,12 +74160,12 @@ var require_bn2 = __commonJS({
|
|
|
74160
74160
|
// node_modules/minimalistic-assert/index.js
|
|
74161
74161
|
var require_minimalistic_assert = __commonJS({
|
|
74162
74162
|
"node_modules/minimalistic-assert/index.js"(exports2, module2) {
|
|
74163
|
-
module2.exports =
|
|
74164
|
-
function
|
|
74163
|
+
module2.exports = assert;
|
|
74164
|
+
function assert(val, msg) {
|
|
74165
74165
|
if (!val)
|
|
74166
74166
|
throw new Error(msg || "Assertion failed");
|
|
74167
74167
|
}
|
|
74168
|
-
|
|
74168
|
+
assert.equal = function assertEqual(l, r, msg) {
|
|
74169
74169
|
if (l != r)
|
|
74170
74170
|
throw new Error(msg || "Assertion failed: " + l + " != " + r);
|
|
74171
74171
|
};
|
|
@@ -74399,7 +74399,7 @@ var require_base = __commonJS({
|
|
|
74399
74399
|
var utils = require_utils9();
|
|
74400
74400
|
var getNAF = utils.getNAF;
|
|
74401
74401
|
var getJSF = utils.getJSF;
|
|
74402
|
-
var
|
|
74402
|
+
var assert = utils.assert;
|
|
74403
74403
|
function BaseCurve(type, conf) {
|
|
74404
74404
|
this.type = type;
|
|
74405
74405
|
this.p = new BN(conf.p, 16);
|
|
@@ -74430,7 +74430,7 @@ var require_base = __commonJS({
|
|
|
74430
74430
|
throw new Error("Not implemented");
|
|
74431
74431
|
};
|
|
74432
74432
|
BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
|
|
74433
|
-
|
|
74433
|
+
assert(p.precomputed);
|
|
74434
74434
|
var doubles = p._getDoubles();
|
|
74435
74435
|
var naf = getNAF(k, 1, this._bitLength);
|
|
74436
74436
|
var I = (1 << doubles.step + 1) - (doubles.step % 2 === 0 ? 2 : 1);
|
|
@@ -74474,7 +74474,7 @@ var require_base = __commonJS({
|
|
|
74474
74474
|
if (i < 0)
|
|
74475
74475
|
break;
|
|
74476
74476
|
var z = naf[i];
|
|
74477
|
-
|
|
74477
|
+
assert(z !== 0);
|
|
74478
74478
|
if (p.type === "affine") {
|
|
74479
74479
|
if (z > 0)
|
|
74480
74480
|
acc = acc.mixedAdd(wnd[z - 1 >> 1]);
|
|
@@ -74625,9 +74625,9 @@ var require_base = __commonJS({
|
|
|
74625
74625
|
var len = this.p.byteLength();
|
|
74626
74626
|
if ((bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) && bytes.length - 1 === 2 * len) {
|
|
74627
74627
|
if (bytes[0] === 6)
|
|
74628
|
-
|
|
74628
|
+
assert(bytes[bytes.length - 1] % 2 === 0);
|
|
74629
74629
|
else if (bytes[0] === 7)
|
|
74630
|
-
|
|
74630
|
+
assert(bytes[bytes.length - 1] % 2 === 1);
|
|
74631
74631
|
var res = this.point(
|
|
74632
74632
|
bytes.slice(1, 1 + len),
|
|
74633
74633
|
bytes.slice(1 + len, 1 + 2 * len)
|
|
@@ -74721,7 +74721,7 @@ var require_short = __commonJS({
|
|
|
74721
74721
|
var BN = require_bn2();
|
|
74722
74722
|
var inherits = require_inherits();
|
|
74723
74723
|
var Base = require_base();
|
|
74724
|
-
var
|
|
74724
|
+
var assert = utils.assert;
|
|
74725
74725
|
function ShortCurve(conf) {
|
|
74726
74726
|
Base.call(this, "short", conf);
|
|
74727
74727
|
this.a = new BN(conf.a, 16).toRed(this.red);
|
|
@@ -74755,7 +74755,7 @@ var require_short = __commonJS({
|
|
|
74755
74755
|
lambda = lambdas[0];
|
|
74756
74756
|
} else {
|
|
74757
74757
|
lambda = lambdas[1];
|
|
74758
|
-
|
|
74758
|
+
assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
|
|
74759
74759
|
}
|
|
74760
74760
|
}
|
|
74761
74761
|
var basis;
|
|
@@ -75547,7 +75547,7 @@ var require_edwards = __commonJS({
|
|
|
75547
75547
|
var BN = require_bn2();
|
|
75548
75548
|
var inherits = require_inherits();
|
|
75549
75549
|
var Base = require_base();
|
|
75550
|
-
var
|
|
75550
|
+
var assert = utils.assert;
|
|
75551
75551
|
function EdwardsCurve(conf) {
|
|
75552
75552
|
this.twisted = (conf.a | 0) !== 1;
|
|
75553
75553
|
this.mOneA = this.twisted && (conf.a | 0) === -1;
|
|
@@ -75559,7 +75559,7 @@ var require_edwards = __commonJS({
|
|
|
75559
75559
|
this.c2 = this.c.redSqr();
|
|
75560
75560
|
this.d = new BN(conf.d, 16).toRed(this.red);
|
|
75561
75561
|
this.dd = this.d.redAdd(this.d);
|
|
75562
|
-
|
|
75562
|
+
assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
|
|
75563
75563
|
this.oneC = (conf.c | 0) === 1;
|
|
75564
75564
|
}
|
|
75565
75565
|
inherits(EdwardsCurve, Base);
|
|
@@ -75856,7 +75856,7 @@ var require_curve = __commonJS({
|
|
|
75856
75856
|
var require_utils10 = __commonJS({
|
|
75857
75857
|
"node_modules/hash.js/lib/hash/utils.js"(exports2) {
|
|
75858
75858
|
"use strict";
|
|
75859
|
-
var
|
|
75859
|
+
var assert = require_minimalistic_assert();
|
|
75860
75860
|
var inherits = require_inherits();
|
|
75861
75861
|
exports2.inherits = inherits;
|
|
75862
75862
|
function isSurrogatePair(msg, i) {
|
|
@@ -75961,7 +75961,7 @@ var require_utils10 = __commonJS({
|
|
|
75961
75961
|
exports2.zero8 = zero8;
|
|
75962
75962
|
function join32(msg, start, end, endian) {
|
|
75963
75963
|
var len = end - start;
|
|
75964
|
-
|
|
75964
|
+
assert(len % 4 === 0);
|
|
75965
75965
|
var res = new Array(len / 4);
|
|
75966
75966
|
for (var i = 0, k = start; i < res.length; i++, k += 4) {
|
|
75967
75967
|
var w;
|
|
@@ -76102,7 +76102,7 @@ var require_common3 = __commonJS({
|
|
|
76102
76102
|
"node_modules/hash.js/lib/hash/common.js"(exports2) {
|
|
76103
76103
|
"use strict";
|
|
76104
76104
|
var utils = require_utils10();
|
|
76105
|
-
var
|
|
76105
|
+
var assert = require_minimalistic_assert();
|
|
76106
76106
|
function BlockHash() {
|
|
76107
76107
|
this.pending = null;
|
|
76108
76108
|
this.pendingTotal = 0;
|
|
@@ -76136,7 +76136,7 @@ var require_common3 = __commonJS({
|
|
|
76136
76136
|
};
|
|
76137
76137
|
BlockHash.prototype.digest = function digest(enc) {
|
|
76138
76138
|
this.update(this._pad());
|
|
76139
|
-
|
|
76139
|
+
assert(this.pending === null);
|
|
76140
76140
|
return this._digest(enc);
|
|
76141
76141
|
};
|
|
76142
76142
|
BlockHash.prototype._pad = function pad() {
|
|
@@ -76301,7 +76301,7 @@ var require__2 = __commonJS({
|
|
|
76301
76301
|
var utils = require_utils10();
|
|
76302
76302
|
var common = require_common3();
|
|
76303
76303
|
var shaCommon = require_common4();
|
|
76304
|
-
var
|
|
76304
|
+
var assert = require_minimalistic_assert();
|
|
76305
76305
|
var sum32 = utils.sum32;
|
|
76306
76306
|
var sum32_4 = utils.sum32_4;
|
|
76307
76307
|
var sum32_5 = utils.sum32_5;
|
|
@@ -76415,7 +76415,7 @@ var require__2 = __commonJS({
|
|
|
76415
76415
|
var f = this.h[5];
|
|
76416
76416
|
var g = this.h[6];
|
|
76417
76417
|
var h = this.h[7];
|
|
76418
|
-
|
|
76418
|
+
assert(this.k.length === W.length);
|
|
76419
76419
|
for (i = 0; i < W.length; i++) {
|
|
76420
76420
|
var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
|
|
76421
76421
|
var T2 = sum32(s0_256(a), maj32(a, b, c));
|
|
@@ -76488,7 +76488,7 @@ var require__4 = __commonJS({
|
|
|
76488
76488
|
"use strict";
|
|
76489
76489
|
var utils = require_utils10();
|
|
76490
76490
|
var common = require_common3();
|
|
76491
|
-
var
|
|
76491
|
+
var assert = require_minimalistic_assert();
|
|
76492
76492
|
var rotr64_hi = utils.rotr64_hi;
|
|
76493
76493
|
var rotr64_lo = utils.rotr64_lo;
|
|
76494
76494
|
var shr64_hi = utils.shr64_hi;
|
|
@@ -76748,7 +76748,7 @@ var require__4 = __commonJS({
|
|
|
76748
76748
|
var gl = this.h[13];
|
|
76749
76749
|
var hh = this.h[14];
|
|
76750
76750
|
var hl = this.h[15];
|
|
76751
|
-
|
|
76751
|
+
assert(this.k.length === W.length);
|
|
76752
76752
|
for (var i = 0; i < W.length; i += 2) {
|
|
76753
76753
|
var c0_hi = hh;
|
|
76754
76754
|
var c0_lo = hl;
|
|
@@ -77423,7 +77423,7 @@ var require_hmac3 = __commonJS({
|
|
|
77423
77423
|
"node_modules/hash.js/lib/hash/hmac.js"(exports2, module2) {
|
|
77424
77424
|
"use strict";
|
|
77425
77425
|
var utils = require_utils10();
|
|
77426
|
-
var
|
|
77426
|
+
var assert = require_minimalistic_assert();
|
|
77427
77427
|
function Hmac(hash, key, enc) {
|
|
77428
77428
|
if (!(this instanceof Hmac))
|
|
77429
77429
|
return new Hmac(hash, key, enc);
|
|
@@ -77438,7 +77438,7 @@ var require_hmac3 = __commonJS({
|
|
|
77438
77438
|
Hmac.prototype._init = function init(key) {
|
|
77439
77439
|
if (key.length > this.blockSize)
|
|
77440
77440
|
key = new this.Hash().update(key).digest();
|
|
77441
|
-
|
|
77441
|
+
assert(key.length <= this.blockSize);
|
|
77442
77442
|
for (var i = key.length; i < this.blockSize; i++)
|
|
77443
77443
|
key.push(0);
|
|
77444
77444
|
for (i = 0; i < key.length; i++)
|
|
@@ -78271,7 +78271,7 @@ var require_curves = __commonJS({
|
|
|
78271
78271
|
var hash = require_hash2();
|
|
78272
78272
|
var curve = require_curve();
|
|
78273
78273
|
var utils = require_utils9();
|
|
78274
|
-
var
|
|
78274
|
+
var assert = utils.assert;
|
|
78275
78275
|
function PresetCurve(options) {
|
|
78276
78276
|
if (options.type === "short")
|
|
78277
78277
|
this.curve = new curve.short(options);
|
|
@@ -78282,8 +78282,8 @@ var require_curves = __commonJS({
|
|
|
78282
78282
|
this.g = this.curve.g;
|
|
78283
78283
|
this.n = this.curve.n;
|
|
78284
78284
|
this.hash = options.hash;
|
|
78285
|
-
|
|
78286
|
-
|
|
78285
|
+
assert(this.g.validate(), "Invalid curve");
|
|
78286
|
+
assert(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O");
|
|
78287
78287
|
}
|
|
78288
78288
|
curves.PresetCurve = PresetCurve;
|
|
78289
78289
|
function defineCurve(name, options) {
|
|
@@ -78445,7 +78445,7 @@ var require_hmac_drbg = __commonJS({
|
|
|
78445
78445
|
"use strict";
|
|
78446
78446
|
var hash = require_hash2();
|
|
78447
78447
|
var utils = require_utils8();
|
|
78448
|
-
var
|
|
78448
|
+
var assert = require_minimalistic_assert();
|
|
78449
78449
|
function HmacDRBG(options) {
|
|
78450
78450
|
if (!(this instanceof HmacDRBG))
|
|
78451
78451
|
return new HmacDRBG(options);
|
|
@@ -78460,7 +78460,7 @@ var require_hmac_drbg = __commonJS({
|
|
|
78460
78460
|
var entropy = utils.toArray(options.entropy, options.entropyEnc || "hex");
|
|
78461
78461
|
var nonce = utils.toArray(options.nonce, options.nonceEnc || "hex");
|
|
78462
78462
|
var pers = utils.toArray(options.pers, options.persEnc || "hex");
|
|
78463
|
-
|
|
78463
|
+
assert(
|
|
78464
78464
|
entropy.length >= this.minEntropy / 8,
|
|
78465
78465
|
"Not enough entropy. Minimum is: " + this.minEntropy + " bits"
|
|
78466
78466
|
);
|
|
@@ -78501,7 +78501,7 @@ var require_hmac_drbg = __commonJS({
|
|
|
78501
78501
|
}
|
|
78502
78502
|
entropy = utils.toArray(entropy, entropyEnc);
|
|
78503
78503
|
add = utils.toArray(add, addEnc);
|
|
78504
|
-
|
|
78504
|
+
assert(
|
|
78505
78505
|
entropy.length >= this.minEntropy / 8,
|
|
78506
78506
|
"Not enough entropy. Minimum is: " + this.minEntropy + " bits"
|
|
78507
78507
|
);
|
|
@@ -78539,7 +78539,7 @@ var require_key = __commonJS({
|
|
|
78539
78539
|
"use strict";
|
|
78540
78540
|
var BN = require_bn2();
|
|
78541
78541
|
var utils = require_utils9();
|
|
78542
|
-
var
|
|
78542
|
+
var assert = utils.assert;
|
|
78543
78543
|
function KeyPair(ec, options) {
|
|
78544
78544
|
this.ec = ec;
|
|
78545
78545
|
this.priv = null;
|
|
@@ -78600,9 +78600,9 @@ var require_key = __commonJS({
|
|
|
78600
78600
|
KeyPair.prototype._importPublic = function _importPublic(key, enc) {
|
|
78601
78601
|
if (key.x || key.y) {
|
|
78602
78602
|
if (this.ec.curve.type === "mont") {
|
|
78603
|
-
|
|
78603
|
+
assert(key.x, "Need x coordinate");
|
|
78604
78604
|
} else if (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") {
|
|
78605
|
-
|
|
78605
|
+
assert(key.x && key.y, "Need both x and y coordinate");
|
|
78606
78606
|
}
|
|
78607
78607
|
this.pub = this.ec.curve.point(key.x, key.y);
|
|
78608
78608
|
return;
|
|
@@ -78611,7 +78611,7 @@ var require_key = __commonJS({
|
|
|
78611
78611
|
};
|
|
78612
78612
|
KeyPair.prototype.derive = function derive(pub) {
|
|
78613
78613
|
if (!pub.validate()) {
|
|
78614
|
-
|
|
78614
|
+
assert(pub.validate(), "public point not validated");
|
|
78615
78615
|
}
|
|
78616
78616
|
return pub.mul(this.priv).getX();
|
|
78617
78617
|
};
|
|
@@ -78633,13 +78633,13 @@ var require_signature3 = __commonJS({
|
|
|
78633
78633
|
"use strict";
|
|
78634
78634
|
var BN = require_bn2();
|
|
78635
78635
|
var utils = require_utils9();
|
|
78636
|
-
var
|
|
78636
|
+
var assert = utils.assert;
|
|
78637
78637
|
function Signature(options, enc) {
|
|
78638
78638
|
if (options instanceof Signature)
|
|
78639
78639
|
return options;
|
|
78640
78640
|
if (this._importDER(options, enc))
|
|
78641
78641
|
return;
|
|
78642
|
-
|
|
78642
|
+
assert(options.r && options.s, "Signature without r or s");
|
|
78643
78643
|
this.r = new BN(options.r, 16);
|
|
78644
78644
|
this.s = new BN(options.s, 16);
|
|
78645
78645
|
if (options.recoveryParam === void 0)
|
|
@@ -78782,14 +78782,14 @@ var require_ec = __commonJS({
|
|
|
78782
78782
|
var utils = require_utils9();
|
|
78783
78783
|
var curves = require_curves();
|
|
78784
78784
|
var rand = require_brorand();
|
|
78785
|
-
var
|
|
78785
|
+
var assert = utils.assert;
|
|
78786
78786
|
var KeyPair = require_key();
|
|
78787
78787
|
var Signature = require_signature3();
|
|
78788
78788
|
function EC(options) {
|
|
78789
78789
|
if (!(this instanceof EC))
|
|
78790
78790
|
return new EC(options);
|
|
78791
78791
|
if (typeof options === "string") {
|
|
78792
|
-
|
|
78792
|
+
assert(
|
|
78793
78793
|
Object.prototype.hasOwnProperty.call(curves, options),
|
|
78794
78794
|
"Unknown curve " + options
|
|
78795
78795
|
);
|
|
@@ -78915,7 +78915,7 @@ var require_ec = __commonJS({
|
|
|
78915
78915
|
return p.eqXToP(r);
|
|
78916
78916
|
};
|
|
78917
78917
|
EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
|
|
78918
|
-
|
|
78918
|
+
assert((3 & j) === j, "The recovery param is more than two bits");
|
|
78919
78919
|
signature = new Signature(signature, enc);
|
|
78920
78920
|
var n = this.n;
|
|
78921
78921
|
var e = new BN(msg);
|
|
@@ -78958,7 +78958,7 @@ var require_key2 = __commonJS({
|
|
|
78958
78958
|
"node_modules/elliptic/lib/elliptic/eddsa/key.js"(exports2, module2) {
|
|
78959
78959
|
"use strict";
|
|
78960
78960
|
var utils = require_utils9();
|
|
78961
|
-
var
|
|
78961
|
+
var assert = utils.assert;
|
|
78962
78962
|
var parseBytes = utils.parseBytes;
|
|
78963
78963
|
var cachedProperty = utils.cachedProperty;
|
|
78964
78964
|
function KeyPair(eddsa, params) {
|
|
@@ -79010,14 +79010,14 @@ var require_key2 = __commonJS({
|
|
|
79010
79010
|
return this.hash().slice(this.eddsa.encodingLength);
|
|
79011
79011
|
});
|
|
79012
79012
|
KeyPair.prototype.sign = function sign(message) {
|
|
79013
|
-
|
|
79013
|
+
assert(this._secret, "KeyPair can only verify");
|
|
79014
79014
|
return this.eddsa.sign(message, this);
|
|
79015
79015
|
};
|
|
79016
79016
|
KeyPair.prototype.verify = function verify(message, sig) {
|
|
79017
79017
|
return this.eddsa.verify(message, sig, this);
|
|
79018
79018
|
};
|
|
79019
79019
|
KeyPair.prototype.getSecret = function getSecret(enc) {
|
|
79020
|
-
|
|
79020
|
+
assert(this._secret, "KeyPair is public only");
|
|
79021
79021
|
return utils.encode(this.secret(), enc);
|
|
79022
79022
|
};
|
|
79023
79023
|
KeyPair.prototype.getPublic = function getPublic(enc) {
|
|
@@ -79033,7 +79033,7 @@ var require_signature4 = __commonJS({
|
|
|
79033
79033
|
"use strict";
|
|
79034
79034
|
var BN = require_bn2();
|
|
79035
79035
|
var utils = require_utils9();
|
|
79036
|
-
var
|
|
79036
|
+
var assert = utils.assert;
|
|
79037
79037
|
var cachedProperty = utils.cachedProperty;
|
|
79038
79038
|
var parseBytes = utils.parseBytes;
|
|
79039
79039
|
function Signature(eddsa, sig) {
|
|
@@ -79046,7 +79046,7 @@ var require_signature4 = __commonJS({
|
|
|
79046
79046
|
S: sig.slice(eddsa.encodingLength)
|
|
79047
79047
|
};
|
|
79048
79048
|
}
|
|
79049
|
-
|
|
79049
|
+
assert(sig.R && sig.S, "Signature without R or S");
|
|
79050
79050
|
if (eddsa.isPoint(sig.R))
|
|
79051
79051
|
this._R = sig.R;
|
|
79052
79052
|
if (sig.S instanceof BN)
|
|
@@ -79083,12 +79083,12 @@ var require_eddsa = __commonJS({
|
|
|
79083
79083
|
var hash = require_hash2();
|
|
79084
79084
|
var curves = require_curves();
|
|
79085
79085
|
var utils = require_utils9();
|
|
79086
|
-
var
|
|
79086
|
+
var assert = utils.assert;
|
|
79087
79087
|
var parseBytes = utils.parseBytes;
|
|
79088
79088
|
var KeyPair = require_key2();
|
|
79089
79089
|
var Signature = require_signature4();
|
|
79090
79090
|
function EDDSA(curve) {
|
|
79091
|
-
|
|
79091
|
+
assert(curve === "ed25519", "only tested with ed25519 so far");
|
|
79092
79092
|
if (!(this instanceof EDDSA))
|
|
79093
79093
|
return new EDDSA(curve);
|
|
79094
79094
|
curve = curves[curve].curve;
|
|
@@ -100168,25 +100168,25 @@ var require_lib41 = __commonJS({
|
|
|
100168
100168
|
RECOVER: "Public key could not be recover",
|
|
100169
100169
|
ECDH: "Scalar was invalid (zero or overflow)"
|
|
100170
100170
|
};
|
|
100171
|
-
function
|
|
100171
|
+
function assert(cond, msg) {
|
|
100172
100172
|
if (!cond)
|
|
100173
100173
|
throw new Error(msg);
|
|
100174
100174
|
}
|
|
100175
100175
|
function isUint8Array(name, value, length) {
|
|
100176
|
-
|
|
100176
|
+
assert(value instanceof Uint8Array, `Expected ${name} to be an Uint8Array`);
|
|
100177
100177
|
if (length !== void 0) {
|
|
100178
100178
|
if (Array.isArray(length)) {
|
|
100179
100179
|
const numbers = length.join(", ");
|
|
100180
100180
|
const msg = `Expected ${name} to be an Uint8Array with length [${numbers}]`;
|
|
100181
|
-
|
|
100181
|
+
assert(length.includes(value.length), msg);
|
|
100182
100182
|
} else {
|
|
100183
100183
|
const msg = `Expected ${name} to be an Uint8Array with length ${length}`;
|
|
100184
|
-
|
|
100184
|
+
assert(value.length === length, msg);
|
|
100185
100185
|
}
|
|
100186
100186
|
}
|
|
100187
100187
|
}
|
|
100188
100188
|
function isCompressed(value) {
|
|
100189
|
-
|
|
100189
|
+
assert(toTypeString(value) === "Boolean", "Expected compressed to be a Boolean");
|
|
100190
100190
|
}
|
|
100191
100191
|
function getAssertedOutput(output = (len) => new Uint8Array(len), length) {
|
|
100192
100192
|
if (typeof output === "function")
|
|
@@ -100200,7 +100200,7 @@ var require_lib41 = __commonJS({
|
|
|
100200
100200
|
module2.exports = (secp256k1) => {
|
|
100201
100201
|
return {
|
|
100202
100202
|
contextRandomize(seed) {
|
|
100203
|
-
|
|
100203
|
+
assert(
|
|
100204
100204
|
seed === null || seed instanceof Uint8Array,
|
|
100205
100205
|
"Expected seed to be an Uint8Array or null"
|
|
100206
100206
|
);
|
|
@@ -100290,8 +100290,8 @@ var require_lib41 = __commonJS({
|
|
|
100290
100290
|
}
|
|
100291
100291
|
},
|
|
100292
100292
|
publicKeyCombine(pubkeys, compressed = true, output) {
|
|
100293
|
-
|
|
100294
|
-
|
|
100293
|
+
assert(Array.isArray(pubkeys), "Expected public keys to be an Array");
|
|
100294
|
+
assert(pubkeys.length > 0, "Expected public keys array will have more than zero items");
|
|
100295
100295
|
for (const pubkey of pubkeys) {
|
|
100296
100296
|
isUint8Array("public key", pubkey, [33, 65]);
|
|
100297
100297
|
}
|
|
@@ -100373,11 +100373,11 @@ var require_lib41 = __commonJS({
|
|
|
100373
100373
|
ecdsaSign(msg32, seckey, options = {}, output) {
|
|
100374
100374
|
isUint8Array("message", msg32, 32);
|
|
100375
100375
|
isUint8Array("private key", seckey, 32);
|
|
100376
|
-
|
|
100376
|
+
assert(toTypeString(options) === "Object", "Expected options to be an Object");
|
|
100377
100377
|
if (options.data !== void 0)
|
|
100378
100378
|
isUint8Array("options.data", options.data);
|
|
100379
100379
|
if (options.noncefn !== void 0)
|
|
100380
|
-
|
|
100380
|
+
assert(toTypeString(options.noncefn) === "Function", "Expected options.noncefn to be a Function");
|
|
100381
100381
|
output = getAssertedOutput(output, 64);
|
|
100382
100382
|
const obj = { signature: output, recid: null };
|
|
100383
100383
|
switch (secp256k1.ecdsaSign(obj, msg32, seckey, options.data, options.noncefn)) {
|
|
@@ -100406,7 +100406,7 @@ var require_lib41 = __commonJS({
|
|
|
100406
100406
|
},
|
|
100407
100407
|
ecdsaRecover(sig, recid, msg32, compressed = true, output) {
|
|
100408
100408
|
isUint8Array("signature", sig, 64);
|
|
100409
|
-
|
|
100409
|
+
assert(
|
|
100410
100410
|
toTypeString(recid) === "Number" && recid >= 0 && recid <= 3,
|
|
100411
100411
|
"Expected recovery id to be a Number within interval [0, 3]"
|
|
100412
100412
|
);
|
|
@@ -100427,11 +100427,11 @@ var require_lib41 = __commonJS({
|
|
|
100427
100427
|
ecdh(pubkey, seckey, options = {}, output) {
|
|
100428
100428
|
isUint8Array("public key", pubkey, [33, 65]);
|
|
100429
100429
|
isUint8Array("private key", seckey, 32);
|
|
100430
|
-
|
|
100430
|
+
assert(toTypeString(options) === "Object", "Expected options to be an Object");
|
|
100431
100431
|
if (options.data !== void 0)
|
|
100432
100432
|
isUint8Array("options.data", options.data);
|
|
100433
100433
|
if (options.hashfn !== void 0) {
|
|
100434
|
-
|
|
100434
|
+
assert(toTypeString(options.hashfn) === "Function", "Expected options.hashfn to be a Function");
|
|
100435
100435
|
if (options.xbuf !== void 0)
|
|
100436
100436
|
isUint8Array("options.xbuf", options.xbuf, 32);
|
|
100437
100437
|
if (options.ybuf !== void 0)
|
|
@@ -124568,7 +124568,7 @@ var require_bn3 = __commonJS({
|
|
|
124568
124568
|
"node_modules/ethjs-unit/node_modules/bn.js/lib/bn.js"(exports2, module2) {
|
|
124569
124569
|
(function(module3, exports3) {
|
|
124570
124570
|
"use strict";
|
|
124571
|
-
function
|
|
124571
|
+
function assert(val, msg) {
|
|
124572
124572
|
if (!val)
|
|
124573
124573
|
throw new Error(msg || "Assertion failed");
|
|
124574
124574
|
}
|
|
@@ -124634,7 +124634,7 @@ var require_bn3 = __commonJS({
|
|
|
124634
124634
|
if (base === "hex") {
|
|
124635
124635
|
base = 16;
|
|
124636
124636
|
}
|
|
124637
|
-
|
|
124637
|
+
assert(base === (base | 0) && base >= 2 && base <= 36);
|
|
124638
124638
|
number = number.toString().replace(/\s+/g, "");
|
|
124639
124639
|
var start = 0;
|
|
124640
124640
|
if (number[0] === "-") {
|
|
@@ -124668,7 +124668,7 @@ var require_bn3 = __commonJS({
|
|
|
124668
124668
|
];
|
|
124669
124669
|
this.length = 2;
|
|
124670
124670
|
} else {
|
|
124671
|
-
|
|
124671
|
+
assert(number < 9007199254740992);
|
|
124672
124672
|
this.words = [
|
|
124673
124673
|
number & 67108863,
|
|
124674
124674
|
number / 67108864 & 67108863,
|
|
@@ -124681,7 +124681,7 @@ var require_bn3 = __commonJS({
|
|
|
124681
124681
|
this._initArray(this.toArray(), base, endian);
|
|
124682
124682
|
};
|
|
124683
124683
|
BN.prototype._initArray = function _initArray(number, base, endian) {
|
|
124684
|
-
|
|
124684
|
+
assert(typeof number.length === "number");
|
|
124685
124685
|
if (number.length <= 0) {
|
|
124686
124686
|
this.words = [0];
|
|
124687
124687
|
this.length = 1;
|
|
@@ -125012,7 +125012,7 @@ var require_bn3 = __commonJS({
|
|
|
125012
125012
|
}
|
|
125013
125013
|
return out;
|
|
125014
125014
|
}
|
|
125015
|
-
|
|
125015
|
+
assert(false, "Base should be between 2 and 36");
|
|
125016
125016
|
};
|
|
125017
125017
|
BN.prototype.toNumber = function toNumber() {
|
|
125018
125018
|
var ret = this.words[0];
|
|
@@ -125021,7 +125021,7 @@ var require_bn3 = __commonJS({
|
|
|
125021
125021
|
} else if (this.length === 3 && this.words[2] === 1) {
|
|
125022
125022
|
ret += 4503599627370496 + this.words[1] * 67108864;
|
|
125023
125023
|
} else if (this.length > 2) {
|
|
125024
|
-
|
|
125024
|
+
assert(false, "Number can only safely store up to 53 bits");
|
|
125025
125025
|
}
|
|
125026
125026
|
return this.negative !== 0 ? -ret : ret;
|
|
125027
125027
|
};
|
|
@@ -125029,7 +125029,7 @@ var require_bn3 = __commonJS({
|
|
|
125029
125029
|
return this.toString(16);
|
|
125030
125030
|
};
|
|
125031
125031
|
BN.prototype.toBuffer = function toBuffer(endian, length) {
|
|
125032
|
-
|
|
125032
|
+
assert(typeof Buffer2 !== "undefined");
|
|
125033
125033
|
return this.toArrayLike(Buffer2, endian, length);
|
|
125034
125034
|
};
|
|
125035
125035
|
BN.prototype.toArray = function toArray(endian, length) {
|
|
@@ -125038,8 +125038,8 @@ var require_bn3 = __commonJS({
|
|
|
125038
125038
|
BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
|
|
125039
125039
|
var byteLength = this.byteLength();
|
|
125040
125040
|
var reqLength = length || Math.max(1, byteLength);
|
|
125041
|
-
|
|
125042
|
-
|
|
125041
|
+
assert(byteLength <= reqLength, "byte array longer than desired length");
|
|
125042
|
+
assert(reqLength > 0, "Requested array length <= 0");
|
|
125043
125043
|
this.strip();
|
|
125044
125044
|
var littleEndian = endian === "le";
|
|
125045
125045
|
var res = new ArrayType(reqLength);
|
|
@@ -125182,7 +125182,7 @@ var require_bn3 = __commonJS({
|
|
|
125182
125182
|
return this.strip();
|
|
125183
125183
|
};
|
|
125184
125184
|
BN.prototype.ior = function ior(num) {
|
|
125185
|
-
|
|
125185
|
+
assert((this.negative | num.negative) === 0);
|
|
125186
125186
|
return this.iuor(num);
|
|
125187
125187
|
};
|
|
125188
125188
|
BN.prototype.or = function or(num) {
|
|
@@ -125209,7 +125209,7 @@ var require_bn3 = __commonJS({
|
|
|
125209
125209
|
return this.strip();
|
|
125210
125210
|
};
|
|
125211
125211
|
BN.prototype.iand = function iand(num) {
|
|
125212
|
-
|
|
125212
|
+
assert((this.negative | num.negative) === 0);
|
|
125213
125213
|
return this.iuand(num);
|
|
125214
125214
|
};
|
|
125215
125215
|
BN.prototype.and = function and(num) {
|
|
@@ -125244,7 +125244,7 @@ var require_bn3 = __commonJS({
|
|
|
125244
125244
|
return this.strip();
|
|
125245
125245
|
};
|
|
125246
125246
|
BN.prototype.ixor = function ixor(num) {
|
|
125247
|
-
|
|
125247
|
+
assert((this.negative | num.negative) === 0);
|
|
125248
125248
|
return this.iuxor(num);
|
|
125249
125249
|
};
|
|
125250
125250
|
BN.prototype.xor = function xor(num) {
|
|
@@ -125258,7 +125258,7 @@ var require_bn3 = __commonJS({
|
|
|
125258
125258
|
return num.clone().iuxor(this);
|
|
125259
125259
|
};
|
|
125260
125260
|
BN.prototype.inotn = function inotn(width) {
|
|
125261
|
-
|
|
125261
|
+
assert(typeof width === "number" && width >= 0);
|
|
125262
125262
|
var bytesNeeded = Math.ceil(width / 26) | 0;
|
|
125263
125263
|
var bitsLeft = width % 26;
|
|
125264
125264
|
this._expand(bytesNeeded);
|
|
@@ -125277,7 +125277,7 @@ var require_bn3 = __commonJS({
|
|
|
125277
125277
|
return this.clone().inotn(width);
|
|
125278
125278
|
};
|
|
125279
125279
|
BN.prototype.setn = function setn(bit, val) {
|
|
125280
|
-
|
|
125280
|
+
assert(typeof bit === "number" && bit >= 0);
|
|
125281
125281
|
var off = bit / 26 | 0;
|
|
125282
125282
|
var wbit = bit % 26;
|
|
125283
125283
|
this._expand(off + 1);
|
|
@@ -126144,8 +126144,8 @@ var require_bn3 = __commonJS({
|
|
|
126144
126144
|
for (i = 2 * len; i < N; ++i) {
|
|
126145
126145
|
rws[i] = 0;
|
|
126146
126146
|
}
|
|
126147
|
-
|
|
126148
|
-
|
|
126147
|
+
assert(carry === 0);
|
|
126148
|
+
assert((carry & ~8191) === 0);
|
|
126149
126149
|
};
|
|
126150
126150
|
FFTM.prototype.stub = function stub(N) {
|
|
126151
126151
|
var ph = new Array(N);
|
|
@@ -126197,8 +126197,8 @@ var require_bn3 = __commonJS({
|
|
|
126197
126197
|
return this.clone().mulTo(num, this);
|
|
126198
126198
|
};
|
|
126199
126199
|
BN.prototype.imuln = function imuln(num) {
|
|
126200
|
-
|
|
126201
|
-
|
|
126200
|
+
assert(typeof num === "number");
|
|
126201
|
+
assert(num < 67108864);
|
|
126202
126202
|
var carry = 0;
|
|
126203
126203
|
for (var i = 0; i < this.length; i++) {
|
|
126204
126204
|
var w = (this.words[i] | 0) * num;
|
|
@@ -126242,7 +126242,7 @@ var require_bn3 = __commonJS({
|
|
|
126242
126242
|
return res;
|
|
126243
126243
|
};
|
|
126244
126244
|
BN.prototype.iushln = function iushln(bits) {
|
|
126245
|
-
|
|
126245
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
126246
126246
|
var r = bits % 26;
|
|
126247
126247
|
var s = (bits - r) / 26;
|
|
126248
126248
|
var carryMask = 67108863 >>> 26 - r << 26 - r;
|
|
@@ -126272,11 +126272,11 @@ var require_bn3 = __commonJS({
|
|
|
126272
126272
|
return this.strip();
|
|
126273
126273
|
};
|
|
126274
126274
|
BN.prototype.ishln = function ishln(bits) {
|
|
126275
|
-
|
|
126275
|
+
assert(this.negative === 0);
|
|
126276
126276
|
return this.iushln(bits);
|
|
126277
126277
|
};
|
|
126278
126278
|
BN.prototype.iushrn = function iushrn(bits, hint, extended) {
|
|
126279
|
-
|
|
126279
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
126280
126280
|
var h;
|
|
126281
126281
|
if (hint) {
|
|
126282
126282
|
h = (hint - hint % 26) / 26;
|
|
@@ -126321,7 +126321,7 @@ var require_bn3 = __commonJS({
|
|
|
126321
126321
|
return this.strip();
|
|
126322
126322
|
};
|
|
126323
126323
|
BN.prototype.ishrn = function ishrn(bits, hint, extended) {
|
|
126324
|
-
|
|
126324
|
+
assert(this.negative === 0);
|
|
126325
126325
|
return this.iushrn(bits, hint, extended);
|
|
126326
126326
|
};
|
|
126327
126327
|
BN.prototype.shln = function shln(bits) {
|
|
@@ -126337,7 +126337,7 @@ var require_bn3 = __commonJS({
|
|
|
126337
126337
|
return this.clone().iushrn(bits);
|
|
126338
126338
|
};
|
|
126339
126339
|
BN.prototype.testn = function testn(bit) {
|
|
126340
|
-
|
|
126340
|
+
assert(typeof bit === "number" && bit >= 0);
|
|
126341
126341
|
var r = bit % 26;
|
|
126342
126342
|
var s = (bit - r) / 26;
|
|
126343
126343
|
var q = 1 << r;
|
|
@@ -126347,10 +126347,10 @@ var require_bn3 = __commonJS({
|
|
|
126347
126347
|
return !!(w & q);
|
|
126348
126348
|
};
|
|
126349
126349
|
BN.prototype.imaskn = function imaskn(bits) {
|
|
126350
|
-
|
|
126350
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
126351
126351
|
var r = bits % 26;
|
|
126352
126352
|
var s = (bits - r) / 26;
|
|
126353
|
-
|
|
126353
|
+
assert(this.negative === 0, "imaskn works only with positive numbers");
|
|
126354
126354
|
if (this.length <= s) {
|
|
126355
126355
|
return this;
|
|
126356
126356
|
}
|
|
@@ -126368,8 +126368,8 @@ var require_bn3 = __commonJS({
|
|
|
126368
126368
|
return this.clone().imaskn(bits);
|
|
126369
126369
|
};
|
|
126370
126370
|
BN.prototype.iaddn = function iaddn(num) {
|
|
126371
|
-
|
|
126372
|
-
|
|
126371
|
+
assert(typeof num === "number");
|
|
126372
|
+
assert(num < 67108864);
|
|
126373
126373
|
if (num < 0)
|
|
126374
126374
|
return this.isubn(-num);
|
|
126375
126375
|
if (this.negative !== 0) {
|
|
@@ -126399,8 +126399,8 @@ var require_bn3 = __commonJS({
|
|
|
126399
126399
|
return this;
|
|
126400
126400
|
};
|
|
126401
126401
|
BN.prototype.isubn = function isubn(num) {
|
|
126402
|
-
|
|
126403
|
-
|
|
126402
|
+
assert(typeof num === "number");
|
|
126403
|
+
assert(num < 67108864);
|
|
126404
126404
|
if (num < 0)
|
|
126405
126405
|
return this.iaddn(-num);
|
|
126406
126406
|
if (this.negative !== 0) {
|
|
@@ -126454,7 +126454,7 @@ var require_bn3 = __commonJS({
|
|
|
126454
126454
|
}
|
|
126455
126455
|
if (carry === 0)
|
|
126456
126456
|
return this.strip();
|
|
126457
|
-
|
|
126457
|
+
assert(carry === -1);
|
|
126458
126458
|
carry = 0;
|
|
126459
126459
|
for (i = 0; i < this.length; i++) {
|
|
126460
126460
|
w = -(this.words[i] | 0) + carry;
|
|
@@ -126522,7 +126522,7 @@ var require_bn3 = __commonJS({
|
|
|
126522
126522
|
};
|
|
126523
126523
|
};
|
|
126524
126524
|
BN.prototype.divmod = function divmod(num, mode, positive) {
|
|
126525
|
-
|
|
126525
|
+
assert(!num.isZero());
|
|
126526
126526
|
if (this.isZero()) {
|
|
126527
126527
|
return {
|
|
126528
126528
|
div: new BN(0),
|
|
@@ -126617,7 +126617,7 @@ var require_bn3 = __commonJS({
|
|
|
126617
126617
|
return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
|
|
126618
126618
|
};
|
|
126619
126619
|
BN.prototype.modn = function modn(num) {
|
|
126620
|
-
|
|
126620
|
+
assert(num <= 67108863);
|
|
126621
126621
|
var p = (1 << 26) % num;
|
|
126622
126622
|
var acc = 0;
|
|
126623
126623
|
for (var i = this.length - 1; i >= 0; i--) {
|
|
@@ -126626,7 +126626,7 @@ var require_bn3 = __commonJS({
|
|
|
126626
126626
|
return acc;
|
|
126627
126627
|
};
|
|
126628
126628
|
BN.prototype.idivn = function idivn(num) {
|
|
126629
|
-
|
|
126629
|
+
assert(num <= 67108863);
|
|
126630
126630
|
var carry = 0;
|
|
126631
126631
|
for (var i = this.length - 1; i >= 0; i--) {
|
|
126632
126632
|
var w = (this.words[i] | 0) + carry * 67108864;
|
|
@@ -126639,8 +126639,8 @@ var require_bn3 = __commonJS({
|
|
|
126639
126639
|
return this.clone().idivn(num);
|
|
126640
126640
|
};
|
|
126641
126641
|
BN.prototype.egcd = function egcd(p) {
|
|
126642
|
-
|
|
126643
|
-
|
|
126642
|
+
assert(p.negative === 0);
|
|
126643
|
+
assert(!p.isZero());
|
|
126644
126644
|
var x = this;
|
|
126645
126645
|
var y = p.clone();
|
|
126646
126646
|
if (x.negative !== 0) {
|
|
@@ -126704,8 +126704,8 @@ var require_bn3 = __commonJS({
|
|
|
126704
126704
|
};
|
|
126705
126705
|
};
|
|
126706
126706
|
BN.prototype._invmp = function _invmp(p) {
|
|
126707
|
-
|
|
126708
|
-
|
|
126707
|
+
assert(p.negative === 0);
|
|
126708
|
+
assert(!p.isZero());
|
|
126709
126709
|
var a = this;
|
|
126710
126710
|
var b = p.clone();
|
|
126711
126711
|
if (a.negative !== 0) {
|
|
@@ -126803,7 +126803,7 @@ var require_bn3 = __commonJS({
|
|
|
126803
126803
|
return this.words[0] & num;
|
|
126804
126804
|
};
|
|
126805
126805
|
BN.prototype.bincn = function bincn(bit) {
|
|
126806
|
-
|
|
126806
|
+
assert(typeof bit === "number");
|
|
126807
126807
|
var r = bit % 26;
|
|
126808
126808
|
var s = (bit - r) / 26;
|
|
126809
126809
|
var q = 1 << r;
|
|
@@ -126843,7 +126843,7 @@ var require_bn3 = __commonJS({
|
|
|
126843
126843
|
if (negative) {
|
|
126844
126844
|
num = -num;
|
|
126845
126845
|
}
|
|
126846
|
-
|
|
126846
|
+
assert(num <= 67108863, "Number is too big");
|
|
126847
126847
|
var w = this.words[0] | 0;
|
|
126848
126848
|
res = w === num ? 0 : w < num ? -1 : 1;
|
|
126849
126849
|
}
|
|
@@ -126915,12 +126915,12 @@ var require_bn3 = __commonJS({
|
|
|
126915
126915
|
return new Red(num);
|
|
126916
126916
|
};
|
|
126917
126917
|
BN.prototype.toRed = function toRed(ctx) {
|
|
126918
|
-
|
|
126919
|
-
|
|
126918
|
+
assert(!this.red, "Already a number in reduction context");
|
|
126919
|
+
assert(this.negative === 0, "red works only with positives");
|
|
126920
126920
|
return ctx.convertTo(this)._forceRed(ctx);
|
|
126921
126921
|
};
|
|
126922
126922
|
BN.prototype.fromRed = function fromRed() {
|
|
126923
|
-
|
|
126923
|
+
assert(this.red, "fromRed works only with numbers in reduction context");
|
|
126924
126924
|
return this.red.convertFrom(this);
|
|
126925
126925
|
};
|
|
126926
126926
|
BN.prototype._forceRed = function _forceRed(ctx) {
|
|
@@ -126928,66 +126928,66 @@ var require_bn3 = __commonJS({
|
|
|
126928
126928
|
return this;
|
|
126929
126929
|
};
|
|
126930
126930
|
BN.prototype.forceRed = function forceRed(ctx) {
|
|
126931
|
-
|
|
126931
|
+
assert(!this.red, "Already a number in reduction context");
|
|
126932
126932
|
return this._forceRed(ctx);
|
|
126933
126933
|
};
|
|
126934
126934
|
BN.prototype.redAdd = function redAdd(num) {
|
|
126935
|
-
|
|
126935
|
+
assert(this.red, "redAdd works only with red numbers");
|
|
126936
126936
|
return this.red.add(this, num);
|
|
126937
126937
|
};
|
|
126938
126938
|
BN.prototype.redIAdd = function redIAdd(num) {
|
|
126939
|
-
|
|
126939
|
+
assert(this.red, "redIAdd works only with red numbers");
|
|
126940
126940
|
return this.red.iadd(this, num);
|
|
126941
126941
|
};
|
|
126942
126942
|
BN.prototype.redSub = function redSub(num) {
|
|
126943
|
-
|
|
126943
|
+
assert(this.red, "redSub works only with red numbers");
|
|
126944
126944
|
return this.red.sub(this, num);
|
|
126945
126945
|
};
|
|
126946
126946
|
BN.prototype.redISub = function redISub(num) {
|
|
126947
|
-
|
|
126947
|
+
assert(this.red, "redISub works only with red numbers");
|
|
126948
126948
|
return this.red.isub(this, num);
|
|
126949
126949
|
};
|
|
126950
126950
|
BN.prototype.redShl = function redShl(num) {
|
|
126951
|
-
|
|
126951
|
+
assert(this.red, "redShl works only with red numbers");
|
|
126952
126952
|
return this.red.shl(this, num);
|
|
126953
126953
|
};
|
|
126954
126954
|
BN.prototype.redMul = function redMul(num) {
|
|
126955
|
-
|
|
126955
|
+
assert(this.red, "redMul works only with red numbers");
|
|
126956
126956
|
this.red._verify2(this, num);
|
|
126957
126957
|
return this.red.mul(this, num);
|
|
126958
126958
|
};
|
|
126959
126959
|
BN.prototype.redIMul = function redIMul(num) {
|
|
126960
|
-
|
|
126960
|
+
assert(this.red, "redMul works only with red numbers");
|
|
126961
126961
|
this.red._verify2(this, num);
|
|
126962
126962
|
return this.red.imul(this, num);
|
|
126963
126963
|
};
|
|
126964
126964
|
BN.prototype.redSqr = function redSqr() {
|
|
126965
|
-
|
|
126965
|
+
assert(this.red, "redSqr works only with red numbers");
|
|
126966
126966
|
this.red._verify1(this);
|
|
126967
126967
|
return this.red.sqr(this);
|
|
126968
126968
|
};
|
|
126969
126969
|
BN.prototype.redISqr = function redISqr() {
|
|
126970
|
-
|
|
126970
|
+
assert(this.red, "redISqr works only with red numbers");
|
|
126971
126971
|
this.red._verify1(this);
|
|
126972
126972
|
return this.red.isqr(this);
|
|
126973
126973
|
};
|
|
126974
126974
|
BN.prototype.redSqrt = function redSqrt() {
|
|
126975
|
-
|
|
126975
|
+
assert(this.red, "redSqrt works only with red numbers");
|
|
126976
126976
|
this.red._verify1(this);
|
|
126977
126977
|
return this.red.sqrt(this);
|
|
126978
126978
|
};
|
|
126979
126979
|
BN.prototype.redInvm = function redInvm() {
|
|
126980
|
-
|
|
126980
|
+
assert(this.red, "redInvm works only with red numbers");
|
|
126981
126981
|
this.red._verify1(this);
|
|
126982
126982
|
return this.red.invm(this);
|
|
126983
126983
|
};
|
|
126984
126984
|
BN.prototype.redNeg = function redNeg() {
|
|
126985
|
-
|
|
126985
|
+
assert(this.red, "redNeg works only with red numbers");
|
|
126986
126986
|
this.red._verify1(this);
|
|
126987
126987
|
return this.red.neg(this);
|
|
126988
126988
|
};
|
|
126989
126989
|
BN.prototype.redPow = function redPow(num) {
|
|
126990
|
-
|
|
126990
|
+
assert(this.red && !num.red, "redPow(normalNum)");
|
|
126991
126991
|
this.red._verify1(this);
|
|
126992
126992
|
return this.red.pow(this, num);
|
|
126993
126993
|
};
|
|
@@ -127151,18 +127151,18 @@ var require_bn3 = __commonJS({
|
|
|
127151
127151
|
this.m = prime.p;
|
|
127152
127152
|
this.prime = prime;
|
|
127153
127153
|
} else {
|
|
127154
|
-
|
|
127154
|
+
assert(m.gtn(1), "modulus must be greater than 1");
|
|
127155
127155
|
this.m = m;
|
|
127156
127156
|
this.prime = null;
|
|
127157
127157
|
}
|
|
127158
127158
|
}
|
|
127159
127159
|
Red.prototype._verify1 = function _verify1(a) {
|
|
127160
|
-
|
|
127161
|
-
|
|
127160
|
+
assert(a.negative === 0, "red works only with positives");
|
|
127161
|
+
assert(a.red, "red works only with red numbers");
|
|
127162
127162
|
};
|
|
127163
127163
|
Red.prototype._verify2 = function _verify2(a, b) {
|
|
127164
|
-
|
|
127165
|
-
|
|
127164
|
+
assert((a.negative | b.negative) === 0, "red works only with positives");
|
|
127165
|
+
assert(
|
|
127166
127166
|
a.red && a.red === b.red,
|
|
127167
127167
|
"red works only with red numbers"
|
|
127168
127168
|
);
|
|
@@ -127232,7 +127232,7 @@ var require_bn3 = __commonJS({
|
|
|
127232
127232
|
if (a.isZero())
|
|
127233
127233
|
return a.clone();
|
|
127234
127234
|
var mod3 = this.m.andln(3);
|
|
127235
|
-
|
|
127235
|
+
assert(mod3 % 2 === 1);
|
|
127236
127236
|
if (mod3 === 3) {
|
|
127237
127237
|
var pow = this.m.add(new BN(1)).iushrn(2);
|
|
127238
127238
|
return this.pow(a, pow);
|
|
@@ -127243,7 +127243,7 @@ var require_bn3 = __commonJS({
|
|
|
127243
127243
|
s++;
|
|
127244
127244
|
q.iushrn(1);
|
|
127245
127245
|
}
|
|
127246
|
-
|
|
127246
|
+
assert(!q.isZero());
|
|
127247
127247
|
var one = new BN(1).toRed(this);
|
|
127248
127248
|
var nOne = one.redNeg();
|
|
127249
127249
|
var lpow = this.m.subn(1).iushrn(1);
|
|
@@ -127261,7 +127261,7 @@ var require_bn3 = __commonJS({
|
|
|
127261
127261
|
for (var i = 0; tmp.cmp(one) !== 0; i++) {
|
|
127262
127262
|
tmp = tmp.redSqr();
|
|
127263
127263
|
}
|
|
127264
|
-
|
|
127264
|
+
assert(i < m);
|
|
127265
127265
|
var b = this.pow(c, new BN(1).iushln(m - i - 1));
|
|
127266
127266
|
r = r.redMul(b);
|
|
127267
127267
|
c = b.redSqr();
|
|
@@ -127400,7 +127400,7 @@ var require_bn4 = __commonJS({
|
|
|
127400
127400
|
"node_modules/number-to-bn/node_modules/bn.js/lib/bn.js"(exports2, module2) {
|
|
127401
127401
|
(function(module3, exports3) {
|
|
127402
127402
|
"use strict";
|
|
127403
|
-
function
|
|
127403
|
+
function assert(val, msg) {
|
|
127404
127404
|
if (!val)
|
|
127405
127405
|
throw new Error(msg || "Assertion failed");
|
|
127406
127406
|
}
|
|
@@ -127466,7 +127466,7 @@ var require_bn4 = __commonJS({
|
|
|
127466
127466
|
if (base === "hex") {
|
|
127467
127467
|
base = 16;
|
|
127468
127468
|
}
|
|
127469
|
-
|
|
127469
|
+
assert(base === (base | 0) && base >= 2 && base <= 36);
|
|
127470
127470
|
number = number.toString().replace(/\s+/g, "");
|
|
127471
127471
|
var start = 0;
|
|
127472
127472
|
if (number[0] === "-") {
|
|
@@ -127500,7 +127500,7 @@ var require_bn4 = __commonJS({
|
|
|
127500
127500
|
];
|
|
127501
127501
|
this.length = 2;
|
|
127502
127502
|
} else {
|
|
127503
|
-
|
|
127503
|
+
assert(number < 9007199254740992);
|
|
127504
127504
|
this.words = [
|
|
127505
127505
|
number & 67108863,
|
|
127506
127506
|
number / 67108864 & 67108863,
|
|
@@ -127513,7 +127513,7 @@ var require_bn4 = __commonJS({
|
|
|
127513
127513
|
this._initArray(this.toArray(), base, endian);
|
|
127514
127514
|
};
|
|
127515
127515
|
BN.prototype._initArray = function _initArray(number, base, endian) {
|
|
127516
|
-
|
|
127516
|
+
assert(typeof number.length === "number");
|
|
127517
127517
|
if (number.length <= 0) {
|
|
127518
127518
|
this.words = [0];
|
|
127519
127519
|
this.length = 1;
|
|
@@ -127844,7 +127844,7 @@ var require_bn4 = __commonJS({
|
|
|
127844
127844
|
}
|
|
127845
127845
|
return out;
|
|
127846
127846
|
}
|
|
127847
|
-
|
|
127847
|
+
assert(false, "Base should be between 2 and 36");
|
|
127848
127848
|
};
|
|
127849
127849
|
BN.prototype.toNumber = function toNumber() {
|
|
127850
127850
|
var ret = this.words[0];
|
|
@@ -127853,7 +127853,7 @@ var require_bn4 = __commonJS({
|
|
|
127853
127853
|
} else if (this.length === 3 && this.words[2] === 1) {
|
|
127854
127854
|
ret += 4503599627370496 + this.words[1] * 67108864;
|
|
127855
127855
|
} else if (this.length > 2) {
|
|
127856
|
-
|
|
127856
|
+
assert(false, "Number can only safely store up to 53 bits");
|
|
127857
127857
|
}
|
|
127858
127858
|
return this.negative !== 0 ? -ret : ret;
|
|
127859
127859
|
};
|
|
@@ -127861,7 +127861,7 @@ var require_bn4 = __commonJS({
|
|
|
127861
127861
|
return this.toString(16);
|
|
127862
127862
|
};
|
|
127863
127863
|
BN.prototype.toBuffer = function toBuffer(endian, length) {
|
|
127864
|
-
|
|
127864
|
+
assert(typeof Buffer2 !== "undefined");
|
|
127865
127865
|
return this.toArrayLike(Buffer2, endian, length);
|
|
127866
127866
|
};
|
|
127867
127867
|
BN.prototype.toArray = function toArray(endian, length) {
|
|
@@ -127870,8 +127870,8 @@ var require_bn4 = __commonJS({
|
|
|
127870
127870
|
BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
|
|
127871
127871
|
var byteLength = this.byteLength();
|
|
127872
127872
|
var reqLength = length || Math.max(1, byteLength);
|
|
127873
|
-
|
|
127874
|
-
|
|
127873
|
+
assert(byteLength <= reqLength, "byte array longer than desired length");
|
|
127874
|
+
assert(reqLength > 0, "Requested array length <= 0");
|
|
127875
127875
|
this.strip();
|
|
127876
127876
|
var littleEndian = endian === "le";
|
|
127877
127877
|
var res = new ArrayType(reqLength);
|
|
@@ -128014,7 +128014,7 @@ var require_bn4 = __commonJS({
|
|
|
128014
128014
|
return this.strip();
|
|
128015
128015
|
};
|
|
128016
128016
|
BN.prototype.ior = function ior(num) {
|
|
128017
|
-
|
|
128017
|
+
assert((this.negative | num.negative) === 0);
|
|
128018
128018
|
return this.iuor(num);
|
|
128019
128019
|
};
|
|
128020
128020
|
BN.prototype.or = function or(num) {
|
|
@@ -128041,7 +128041,7 @@ var require_bn4 = __commonJS({
|
|
|
128041
128041
|
return this.strip();
|
|
128042
128042
|
};
|
|
128043
128043
|
BN.prototype.iand = function iand(num) {
|
|
128044
|
-
|
|
128044
|
+
assert((this.negative | num.negative) === 0);
|
|
128045
128045
|
return this.iuand(num);
|
|
128046
128046
|
};
|
|
128047
128047
|
BN.prototype.and = function and(num) {
|
|
@@ -128076,7 +128076,7 @@ var require_bn4 = __commonJS({
|
|
|
128076
128076
|
return this.strip();
|
|
128077
128077
|
};
|
|
128078
128078
|
BN.prototype.ixor = function ixor(num) {
|
|
128079
|
-
|
|
128079
|
+
assert((this.negative | num.negative) === 0);
|
|
128080
128080
|
return this.iuxor(num);
|
|
128081
128081
|
};
|
|
128082
128082
|
BN.prototype.xor = function xor(num) {
|
|
@@ -128090,7 +128090,7 @@ var require_bn4 = __commonJS({
|
|
|
128090
128090
|
return num.clone().iuxor(this);
|
|
128091
128091
|
};
|
|
128092
128092
|
BN.prototype.inotn = function inotn(width) {
|
|
128093
|
-
|
|
128093
|
+
assert(typeof width === "number" && width >= 0);
|
|
128094
128094
|
var bytesNeeded = Math.ceil(width / 26) | 0;
|
|
128095
128095
|
var bitsLeft = width % 26;
|
|
128096
128096
|
this._expand(bytesNeeded);
|
|
@@ -128109,7 +128109,7 @@ var require_bn4 = __commonJS({
|
|
|
128109
128109
|
return this.clone().inotn(width);
|
|
128110
128110
|
};
|
|
128111
128111
|
BN.prototype.setn = function setn(bit, val) {
|
|
128112
|
-
|
|
128112
|
+
assert(typeof bit === "number" && bit >= 0);
|
|
128113
128113
|
var off = bit / 26 | 0;
|
|
128114
128114
|
var wbit = bit % 26;
|
|
128115
128115
|
this._expand(off + 1);
|
|
@@ -128976,8 +128976,8 @@ var require_bn4 = __commonJS({
|
|
|
128976
128976
|
for (i = 2 * len; i < N; ++i) {
|
|
128977
128977
|
rws[i] = 0;
|
|
128978
128978
|
}
|
|
128979
|
-
|
|
128980
|
-
|
|
128979
|
+
assert(carry === 0);
|
|
128980
|
+
assert((carry & ~8191) === 0);
|
|
128981
128981
|
};
|
|
128982
128982
|
FFTM.prototype.stub = function stub(N) {
|
|
128983
128983
|
var ph = new Array(N);
|
|
@@ -129029,8 +129029,8 @@ var require_bn4 = __commonJS({
|
|
|
129029
129029
|
return this.clone().mulTo(num, this);
|
|
129030
129030
|
};
|
|
129031
129031
|
BN.prototype.imuln = function imuln(num) {
|
|
129032
|
-
|
|
129033
|
-
|
|
129032
|
+
assert(typeof num === "number");
|
|
129033
|
+
assert(num < 67108864);
|
|
129034
129034
|
var carry = 0;
|
|
129035
129035
|
for (var i = 0; i < this.length; i++) {
|
|
129036
129036
|
var w = (this.words[i] | 0) * num;
|
|
@@ -129074,7 +129074,7 @@ var require_bn4 = __commonJS({
|
|
|
129074
129074
|
return res;
|
|
129075
129075
|
};
|
|
129076
129076
|
BN.prototype.iushln = function iushln(bits) {
|
|
129077
|
-
|
|
129077
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
129078
129078
|
var r = bits % 26;
|
|
129079
129079
|
var s = (bits - r) / 26;
|
|
129080
129080
|
var carryMask = 67108863 >>> 26 - r << 26 - r;
|
|
@@ -129104,11 +129104,11 @@ var require_bn4 = __commonJS({
|
|
|
129104
129104
|
return this.strip();
|
|
129105
129105
|
};
|
|
129106
129106
|
BN.prototype.ishln = function ishln(bits) {
|
|
129107
|
-
|
|
129107
|
+
assert(this.negative === 0);
|
|
129108
129108
|
return this.iushln(bits);
|
|
129109
129109
|
};
|
|
129110
129110
|
BN.prototype.iushrn = function iushrn(bits, hint, extended) {
|
|
129111
|
-
|
|
129111
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
129112
129112
|
var h;
|
|
129113
129113
|
if (hint) {
|
|
129114
129114
|
h = (hint - hint % 26) / 26;
|
|
@@ -129153,7 +129153,7 @@ var require_bn4 = __commonJS({
|
|
|
129153
129153
|
return this.strip();
|
|
129154
129154
|
};
|
|
129155
129155
|
BN.prototype.ishrn = function ishrn(bits, hint, extended) {
|
|
129156
|
-
|
|
129156
|
+
assert(this.negative === 0);
|
|
129157
129157
|
return this.iushrn(bits, hint, extended);
|
|
129158
129158
|
};
|
|
129159
129159
|
BN.prototype.shln = function shln(bits) {
|
|
@@ -129169,7 +129169,7 @@ var require_bn4 = __commonJS({
|
|
|
129169
129169
|
return this.clone().iushrn(bits);
|
|
129170
129170
|
};
|
|
129171
129171
|
BN.prototype.testn = function testn(bit) {
|
|
129172
|
-
|
|
129172
|
+
assert(typeof bit === "number" && bit >= 0);
|
|
129173
129173
|
var r = bit % 26;
|
|
129174
129174
|
var s = (bit - r) / 26;
|
|
129175
129175
|
var q = 1 << r;
|
|
@@ -129179,10 +129179,10 @@ var require_bn4 = __commonJS({
|
|
|
129179
129179
|
return !!(w & q);
|
|
129180
129180
|
};
|
|
129181
129181
|
BN.prototype.imaskn = function imaskn(bits) {
|
|
129182
|
-
|
|
129182
|
+
assert(typeof bits === "number" && bits >= 0);
|
|
129183
129183
|
var r = bits % 26;
|
|
129184
129184
|
var s = (bits - r) / 26;
|
|
129185
|
-
|
|
129185
|
+
assert(this.negative === 0, "imaskn works only with positive numbers");
|
|
129186
129186
|
if (this.length <= s) {
|
|
129187
129187
|
return this;
|
|
129188
129188
|
}
|
|
@@ -129200,8 +129200,8 @@ var require_bn4 = __commonJS({
|
|
|
129200
129200
|
return this.clone().imaskn(bits);
|
|
129201
129201
|
};
|
|
129202
129202
|
BN.prototype.iaddn = function iaddn(num) {
|
|
129203
|
-
|
|
129204
|
-
|
|
129203
|
+
assert(typeof num === "number");
|
|
129204
|
+
assert(num < 67108864);
|
|
129205
129205
|
if (num < 0)
|
|
129206
129206
|
return this.isubn(-num);
|
|
129207
129207
|
if (this.negative !== 0) {
|
|
@@ -129231,8 +129231,8 @@ var require_bn4 = __commonJS({
|
|
|
129231
129231
|
return this;
|
|
129232
129232
|
};
|
|
129233
129233
|
BN.prototype.isubn = function isubn(num) {
|
|
129234
|
-
|
|
129235
|
-
|
|
129234
|
+
assert(typeof num === "number");
|
|
129235
|
+
assert(num < 67108864);
|
|
129236
129236
|
if (num < 0)
|
|
129237
129237
|
return this.iaddn(-num);
|
|
129238
129238
|
if (this.negative !== 0) {
|
|
@@ -129286,7 +129286,7 @@ var require_bn4 = __commonJS({
|
|
|
129286
129286
|
}
|
|
129287
129287
|
if (carry === 0)
|
|
129288
129288
|
return this.strip();
|
|
129289
|
-
|
|
129289
|
+
assert(carry === -1);
|
|
129290
129290
|
carry = 0;
|
|
129291
129291
|
for (i = 0; i < this.length; i++) {
|
|
129292
129292
|
w = -(this.words[i] | 0) + carry;
|
|
@@ -129354,7 +129354,7 @@ var require_bn4 = __commonJS({
|
|
|
129354
129354
|
};
|
|
129355
129355
|
};
|
|
129356
129356
|
BN.prototype.divmod = function divmod(num, mode, positive) {
|
|
129357
|
-
|
|
129357
|
+
assert(!num.isZero());
|
|
129358
129358
|
if (this.isZero()) {
|
|
129359
129359
|
return {
|
|
129360
129360
|
div: new BN(0),
|
|
@@ -129449,7 +129449,7 @@ var require_bn4 = __commonJS({
|
|
|
129449
129449
|
return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
|
|
129450
129450
|
};
|
|
129451
129451
|
BN.prototype.modn = function modn(num) {
|
|
129452
|
-
|
|
129452
|
+
assert(num <= 67108863);
|
|
129453
129453
|
var p = (1 << 26) % num;
|
|
129454
129454
|
var acc = 0;
|
|
129455
129455
|
for (var i = this.length - 1; i >= 0; i--) {
|
|
@@ -129458,7 +129458,7 @@ var require_bn4 = __commonJS({
|
|
|
129458
129458
|
return acc;
|
|
129459
129459
|
};
|
|
129460
129460
|
BN.prototype.idivn = function idivn(num) {
|
|
129461
|
-
|
|
129461
|
+
assert(num <= 67108863);
|
|
129462
129462
|
var carry = 0;
|
|
129463
129463
|
for (var i = this.length - 1; i >= 0; i--) {
|
|
129464
129464
|
var w = (this.words[i] | 0) + carry * 67108864;
|
|
@@ -129471,8 +129471,8 @@ var require_bn4 = __commonJS({
|
|
|
129471
129471
|
return this.clone().idivn(num);
|
|
129472
129472
|
};
|
|
129473
129473
|
BN.prototype.egcd = function egcd(p) {
|
|
129474
|
-
|
|
129475
|
-
|
|
129474
|
+
assert(p.negative === 0);
|
|
129475
|
+
assert(!p.isZero());
|
|
129476
129476
|
var x = this;
|
|
129477
129477
|
var y = p.clone();
|
|
129478
129478
|
if (x.negative !== 0) {
|
|
@@ -129536,8 +129536,8 @@ var require_bn4 = __commonJS({
|
|
|
129536
129536
|
};
|
|
129537
129537
|
};
|
|
129538
129538
|
BN.prototype._invmp = function _invmp(p) {
|
|
129539
|
-
|
|
129540
|
-
|
|
129539
|
+
assert(p.negative === 0);
|
|
129540
|
+
assert(!p.isZero());
|
|
129541
129541
|
var a = this;
|
|
129542
129542
|
var b = p.clone();
|
|
129543
129543
|
if (a.negative !== 0) {
|
|
@@ -129635,7 +129635,7 @@ var require_bn4 = __commonJS({
|
|
|
129635
129635
|
return this.words[0] & num;
|
|
129636
129636
|
};
|
|
129637
129637
|
BN.prototype.bincn = function bincn(bit) {
|
|
129638
|
-
|
|
129638
|
+
assert(typeof bit === "number");
|
|
129639
129639
|
var r = bit % 26;
|
|
129640
129640
|
var s = (bit - r) / 26;
|
|
129641
129641
|
var q = 1 << r;
|
|
@@ -129675,7 +129675,7 @@ var require_bn4 = __commonJS({
|
|
|
129675
129675
|
if (negative) {
|
|
129676
129676
|
num = -num;
|
|
129677
129677
|
}
|
|
129678
|
-
|
|
129678
|
+
assert(num <= 67108863, "Number is too big");
|
|
129679
129679
|
var w = this.words[0] | 0;
|
|
129680
129680
|
res = w === num ? 0 : w < num ? -1 : 1;
|
|
129681
129681
|
}
|
|
@@ -129747,12 +129747,12 @@ var require_bn4 = __commonJS({
|
|
|
129747
129747
|
return new Red(num);
|
|
129748
129748
|
};
|
|
129749
129749
|
BN.prototype.toRed = function toRed(ctx) {
|
|
129750
|
-
|
|
129751
|
-
|
|
129750
|
+
assert(!this.red, "Already a number in reduction context");
|
|
129751
|
+
assert(this.negative === 0, "red works only with positives");
|
|
129752
129752
|
return ctx.convertTo(this)._forceRed(ctx);
|
|
129753
129753
|
};
|
|
129754
129754
|
BN.prototype.fromRed = function fromRed() {
|
|
129755
|
-
|
|
129755
|
+
assert(this.red, "fromRed works only with numbers in reduction context");
|
|
129756
129756
|
return this.red.convertFrom(this);
|
|
129757
129757
|
};
|
|
129758
129758
|
BN.prototype._forceRed = function _forceRed(ctx) {
|
|
@@ -129760,66 +129760,66 @@ var require_bn4 = __commonJS({
|
|
|
129760
129760
|
return this;
|
|
129761
129761
|
};
|
|
129762
129762
|
BN.prototype.forceRed = function forceRed(ctx) {
|
|
129763
|
-
|
|
129763
|
+
assert(!this.red, "Already a number in reduction context");
|
|
129764
129764
|
return this._forceRed(ctx);
|
|
129765
129765
|
};
|
|
129766
129766
|
BN.prototype.redAdd = function redAdd(num) {
|
|
129767
|
-
|
|
129767
|
+
assert(this.red, "redAdd works only with red numbers");
|
|
129768
129768
|
return this.red.add(this, num);
|
|
129769
129769
|
};
|
|
129770
129770
|
BN.prototype.redIAdd = function redIAdd(num) {
|
|
129771
|
-
|
|
129771
|
+
assert(this.red, "redIAdd works only with red numbers");
|
|
129772
129772
|
return this.red.iadd(this, num);
|
|
129773
129773
|
};
|
|
129774
129774
|
BN.prototype.redSub = function redSub(num) {
|
|
129775
|
-
|
|
129775
|
+
assert(this.red, "redSub works only with red numbers");
|
|
129776
129776
|
return this.red.sub(this, num);
|
|
129777
129777
|
};
|
|
129778
129778
|
BN.prototype.redISub = function redISub(num) {
|
|
129779
|
-
|
|
129779
|
+
assert(this.red, "redISub works only with red numbers");
|
|
129780
129780
|
return this.red.isub(this, num);
|
|
129781
129781
|
};
|
|
129782
129782
|
BN.prototype.redShl = function redShl(num) {
|
|
129783
|
-
|
|
129783
|
+
assert(this.red, "redShl works only with red numbers");
|
|
129784
129784
|
return this.red.shl(this, num);
|
|
129785
129785
|
};
|
|
129786
129786
|
BN.prototype.redMul = function redMul(num) {
|
|
129787
|
-
|
|
129787
|
+
assert(this.red, "redMul works only with red numbers");
|
|
129788
129788
|
this.red._verify2(this, num);
|
|
129789
129789
|
return this.red.mul(this, num);
|
|
129790
129790
|
};
|
|
129791
129791
|
BN.prototype.redIMul = function redIMul(num) {
|
|
129792
|
-
|
|
129792
|
+
assert(this.red, "redMul works only with red numbers");
|
|
129793
129793
|
this.red._verify2(this, num);
|
|
129794
129794
|
return this.red.imul(this, num);
|
|
129795
129795
|
};
|
|
129796
129796
|
BN.prototype.redSqr = function redSqr() {
|
|
129797
|
-
|
|
129797
|
+
assert(this.red, "redSqr works only with red numbers");
|
|
129798
129798
|
this.red._verify1(this);
|
|
129799
129799
|
return this.red.sqr(this);
|
|
129800
129800
|
};
|
|
129801
129801
|
BN.prototype.redISqr = function redISqr() {
|
|
129802
|
-
|
|
129802
|
+
assert(this.red, "redISqr works only with red numbers");
|
|
129803
129803
|
this.red._verify1(this);
|
|
129804
129804
|
return this.red.isqr(this);
|
|
129805
129805
|
};
|
|
129806
129806
|
BN.prototype.redSqrt = function redSqrt() {
|
|
129807
|
-
|
|
129807
|
+
assert(this.red, "redSqrt works only with red numbers");
|
|
129808
129808
|
this.red._verify1(this);
|
|
129809
129809
|
return this.red.sqrt(this);
|
|
129810
129810
|
};
|
|
129811
129811
|
BN.prototype.redInvm = function redInvm() {
|
|
129812
|
-
|
|
129812
|
+
assert(this.red, "redInvm works only with red numbers");
|
|
129813
129813
|
this.red._verify1(this);
|
|
129814
129814
|
return this.red.invm(this);
|
|
129815
129815
|
};
|
|
129816
129816
|
BN.prototype.redNeg = function redNeg() {
|
|
129817
|
-
|
|
129817
|
+
assert(this.red, "redNeg works only with red numbers");
|
|
129818
129818
|
this.red._verify1(this);
|
|
129819
129819
|
return this.red.neg(this);
|
|
129820
129820
|
};
|
|
129821
129821
|
BN.prototype.redPow = function redPow(num) {
|
|
129822
|
-
|
|
129822
|
+
assert(this.red && !num.red, "redPow(normalNum)");
|
|
129823
129823
|
this.red._verify1(this);
|
|
129824
129824
|
return this.red.pow(this, num);
|
|
129825
129825
|
};
|
|
@@ -129983,18 +129983,18 @@ var require_bn4 = __commonJS({
|
|
|
129983
129983
|
this.m = prime.p;
|
|
129984
129984
|
this.prime = prime;
|
|
129985
129985
|
} else {
|
|
129986
|
-
|
|
129986
|
+
assert(m.gtn(1), "modulus must be greater than 1");
|
|
129987
129987
|
this.m = m;
|
|
129988
129988
|
this.prime = null;
|
|
129989
129989
|
}
|
|
129990
129990
|
}
|
|
129991
129991
|
Red.prototype._verify1 = function _verify1(a) {
|
|
129992
|
-
|
|
129993
|
-
|
|
129992
|
+
assert(a.negative === 0, "red works only with positives");
|
|
129993
|
+
assert(a.red, "red works only with red numbers");
|
|
129994
129994
|
};
|
|
129995
129995
|
Red.prototype._verify2 = function _verify2(a, b) {
|
|
129996
|
-
|
|
129997
|
-
|
|
129996
|
+
assert((a.negative | b.negative) === 0, "red works only with positives");
|
|
129997
|
+
assert(
|
|
129998
129998
|
a.red && a.red === b.red,
|
|
129999
129999
|
"red works only with red numbers"
|
|
130000
130000
|
);
|
|
@@ -130064,7 +130064,7 @@ var require_bn4 = __commonJS({
|
|
|
130064
130064
|
if (a.isZero())
|
|
130065
130065
|
return a.clone();
|
|
130066
130066
|
var mod3 = this.m.andln(3);
|
|
130067
|
-
|
|
130067
|
+
assert(mod3 % 2 === 1);
|
|
130068
130068
|
if (mod3 === 3) {
|
|
130069
130069
|
var pow = this.m.add(new BN(1)).iushrn(2);
|
|
130070
130070
|
return this.pow(a, pow);
|
|
@@ -130075,7 +130075,7 @@ var require_bn4 = __commonJS({
|
|
|
130075
130075
|
s++;
|
|
130076
130076
|
q.iushrn(1);
|
|
130077
130077
|
}
|
|
130078
|
-
|
|
130078
|
+
assert(!q.isZero());
|
|
130079
130079
|
var one = new BN(1).toRed(this);
|
|
130080
130080
|
var nOne = one.redNeg();
|
|
130081
130081
|
var lpow = this.m.subn(1).iushrn(1);
|
|
@@ -130093,7 +130093,7 @@ var require_bn4 = __commonJS({
|
|
|
130093
130093
|
for (var i = 0; tmp.cmp(one) !== 0; i++) {
|
|
130094
130094
|
tmp = tmp.redSqr();
|
|
130095
130095
|
}
|
|
130096
|
-
|
|
130096
|
+
assert(i < m);
|
|
130097
130097
|
var b = this.pow(c, new BN(1).iushln(m - i - 1));
|
|
130098
130098
|
r = r.redMul(b);
|
|
130099
130099
|
c = b.redSqr();
|
|
@@ -130653,7 +130653,7 @@ var require_assert2 = __commonJS({
|
|
|
130653
130653
|
}
|
|
130654
130654
|
}
|
|
130655
130655
|
exports2.output = output;
|
|
130656
|
-
var
|
|
130656
|
+
var assert = {
|
|
130657
130657
|
number,
|
|
130658
130658
|
bool,
|
|
130659
130659
|
bytes,
|
|
@@ -130661,7 +130661,7 @@ var require_assert2 = __commonJS({
|
|
|
130661
130661
|
exists,
|
|
130662
130662
|
output
|
|
130663
130663
|
};
|
|
130664
|
-
exports2.default =
|
|
130664
|
+
exports2.default = assert;
|
|
130665
130665
|
}
|
|
130666
130666
|
});
|
|
130667
130667
|
|
|
@@ -148868,7 +148868,7 @@ var require_tunnel = __commonJS({
|
|
|
148868
148868
|
var http = require("http");
|
|
148869
148869
|
var https = require("https");
|
|
148870
148870
|
var events = require("events");
|
|
148871
|
-
var
|
|
148871
|
+
var assert = require("assert");
|
|
148872
148872
|
var util = require("util");
|
|
148873
148873
|
exports2.httpOverHttp = httpOverHttp;
|
|
148874
148874
|
exports2.httpsOverHttp = httpsOverHttp;
|
|
@@ -151849,7 +151849,6 @@ verifyCreate2Tx_fn = async function(tx, meta2) {
|
|
|
151849
151849
|
var Create2Verifier = _Create2Verifier;
|
|
151850
151850
|
|
|
151851
151851
|
// src/SafeHelper.ts
|
|
151852
|
-
var import_strict = __toESM(require("assert/strict"));
|
|
151853
151852
|
var import_core = __toESM(require_core2());
|
|
151854
151853
|
var import_chalk2 = __toESM(require_source());
|
|
151855
151854
|
var import_ethers4 = __toESM(require_lib40());
|
|
@@ -151985,9 +151984,13 @@ impersonateSafe_fn = async function() {
|
|
|
151985
151984
|
data: addOwnerTx.data.data
|
|
151986
151985
|
});
|
|
151987
151986
|
const receipt = await this.provider.getTransactionReceipt(hash);
|
|
151988
|
-
|
|
151987
|
+
if (!receipt.status) {
|
|
151988
|
+
throw new Error("failed to add owner to safe");
|
|
151989
|
+
}
|
|
151989
151990
|
const owners = await this.safe.getOwners();
|
|
151990
|
-
|
|
151991
|
+
if (!owners.includes(ownerAddress)) {
|
|
151992
|
+
throw new Error("owner was not added");
|
|
151993
|
+
}
|
|
151991
151994
|
console.log("added fake owner to safe and set threshold to 1");
|
|
151992
151995
|
if (!__privateGet(this, _tenderly)) {
|
|
151993
151996
|
await stopImpersonate(this.provider, this.safeAddress);
|
|
@@ -151996,10 +151999,11 @@ impersonateSafe_fn = async function() {
|
|
|
151996
151999
|
_validateTransaction = new WeakSet();
|
|
151997
152000
|
validateTransaction_fn = function(timestamp, data) {
|
|
151998
152001
|
var _a2;
|
|
151999
|
-
|
|
152000
|
-
|
|
152001
|
-
|
|
152002
|
-
|
|
152002
|
+
if (data.isExecuted) {
|
|
152003
|
+
throw new Error(
|
|
152004
|
+
`safe tx already executed in tx ${data.safeTxHash} with nonce ${data.nonce}`
|
|
152005
|
+
);
|
|
152006
|
+
}
|
|
152003
152007
|
if (!data.dataDecoded) {
|
|
152004
152008
|
console.warn("data decoded is missing");
|
|
152005
152009
|
}
|
|
@@ -152015,32 +152019,34 @@ validateTransaction_fn = function(timestamp, data) {
|
|
|
152015
152019
|
_validateMultisend = new WeakSet();
|
|
152016
152020
|
validateMultisend_fn = function(timestamp, data) {
|
|
152017
152021
|
var _a2;
|
|
152018
|
-
|
|
152019
|
-
|
|
152020
|
-
|
|
152021
|
-
|
|
152022
|
-
|
|
152023
|
-
|
|
152024
|
-
data.dataDecoded.parameters[0].name,
|
|
152025
|
-
"transactions",
|
|
152026
|
-
"expected multiSend transactions"
|
|
152027
|
-
);
|
|
152022
|
+
if (data.dataDecoded.parameters.length !== 1) {
|
|
152023
|
+
throw new Error("expected multiSend transaction with 1 parameter");
|
|
152024
|
+
}
|
|
152025
|
+
if (data.dataDecoded.parameters[0].name !== "transactions") {
|
|
152026
|
+
throw new Error("expected multiSend transactions");
|
|
152027
|
+
}
|
|
152028
152028
|
const txs = data.dataDecoded.parameters[0].valueDecoded;
|
|
152029
|
-
|
|
152029
|
+
if (txs.length === 0) {
|
|
152030
|
+
throw new Error("expected some transactions");
|
|
152031
|
+
}
|
|
152030
152032
|
let eta = 0;
|
|
152031
152033
|
let isQueue = false;
|
|
152032
152034
|
let isExecute = false;
|
|
152033
152035
|
for (const tx of txs) {
|
|
152034
152036
|
const method = (_a2 = tx.dataDecoded) == null ? void 0 : _a2.method;
|
|
152035
152037
|
if (method === "queueTransaction" || method === "executeTransaction") {
|
|
152036
|
-
|
|
152038
|
+
if (tx.dataDecoded.parameters.length !== 5) {
|
|
152039
|
+
throw new Error(`${method} expects 5 arguments`);
|
|
152040
|
+
}
|
|
152037
152041
|
eta = Math.max(parseInt(tx.dataDecoded.parameters[4].value, 10), eta);
|
|
152038
152042
|
isQueue || (isQueue = method === "queueTransaction");
|
|
152039
152043
|
isExecute || (isExecute = method === "executeTransaction");
|
|
152040
152044
|
}
|
|
152041
152045
|
}
|
|
152042
152046
|
if (eta && isQueue) {
|
|
152043
|
-
|
|
152047
|
+
if (eta <= timestamp) {
|
|
152048
|
+
throw new Error(`ETA is outdated: ${eta} <= ${timestamp}`);
|
|
152049
|
+
}
|
|
152044
152050
|
}
|
|
152045
152051
|
return {
|
|
152046
152052
|
multisend: true,
|
|
@@ -152055,11 +152061,17 @@ validateSingle_fn = function(timestamp, data) {
|
|
|
152055
152061
|
const method = (_a2 = data.dataDecoded) == null ? void 0 : _a2.method;
|
|
152056
152062
|
if (method === "queueTransaction" || method === "executeTransaction") {
|
|
152057
152063
|
const isQueue = method === "queueTransaction";
|
|
152058
|
-
|
|
152064
|
+
if (data.dataDecoded.parameters.length !== 5) {
|
|
152065
|
+
throw new Error(`${method} expects 5 args`);
|
|
152066
|
+
}
|
|
152059
152067
|
const etaP = data.dataDecoded.parameters.find((p) => p.name === "eta");
|
|
152060
|
-
|
|
152068
|
+
if (!etaP) {
|
|
152069
|
+
throw new Error("eta parameter not found");
|
|
152070
|
+
}
|
|
152061
152071
|
const eta = parseInt(data.dataDecoded.parameters[4].value, 10);
|
|
152062
|
-
|
|
152072
|
+
if (eta <= timestamp) {
|
|
152073
|
+
throw new Error("ETA is outdated");
|
|
152074
|
+
}
|
|
152063
152075
|
return {
|
|
152064
152076
|
isQueue,
|
|
152065
152077
|
isExecute: !isQueue,
|
|
@@ -152083,7 +152095,9 @@ execute_fn = async function(tx) {
|
|
|
152083
152095
|
const receipt = await Promise.resolve(
|
|
152084
152096
|
(_a2 = executeTxResponse.transactionResponse) == null ? void 0 : _a2.wait()
|
|
152085
152097
|
);
|
|
152086
|
-
|
|
152098
|
+
if (!(receipt == null ? void 0 : receipt.status)) {
|
|
152099
|
+
throw new Error("failed to execute transaction");
|
|
152100
|
+
}
|
|
152087
152101
|
if ("safeTxHash" in tx) {
|
|
152088
152102
|
console.log(`executed safe tx ${tx.safeTxHash} with nonce ${tx.nonce}`);
|
|
152089
152103
|
} else {
|