@fuel-ts/account 0.0.0-rc-2143-20240514195947 → 0.0.0-rc-2143-20240514211533
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.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/index.global.js +231 -456
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +3 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -33
- package/dist/index.mjs.map +1 -1
- package/dist/mnemonic/mnemonic.d.ts.map +1 -1
- package/dist/mnemonic/utils.d.ts +0 -1
- package/dist/mnemonic/utils.d.ts.map +1 -1
- package/dist/test-utils.global.js +229 -454
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +3 -35
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +1 -33
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.global.js
CHANGED
@@ -73,7 +73,7 @@
|
|
73
73
|
"../../node_modules/.pnpm/bn.js@5.2.1/node_modules/bn.js/lib/bn.js"(exports, module) {
|
74
74
|
(function(module2, exports2) {
|
75
75
|
"use strict";
|
76
|
-
function
|
76
|
+
function assert2(val, msg) {
|
77
77
|
if (!val)
|
78
78
|
throw new Error(msg || "Assertion failed");
|
79
79
|
}
|
@@ -143,7 +143,7 @@
|
|
143
143
|
if (base === "hex") {
|
144
144
|
base = 16;
|
145
145
|
}
|
146
|
-
|
146
|
+
assert2(base === (base | 0) && base >= 2 && base <= 36);
|
147
147
|
number2 = number2.toString().replace(/\s+/g, "");
|
148
148
|
var start = 0;
|
149
149
|
if (number2[0] === "-") {
|
@@ -176,7 +176,7 @@
|
|
176
176
|
];
|
177
177
|
this.length = 2;
|
178
178
|
} else {
|
179
|
-
|
179
|
+
assert2(number2 < 9007199254740992);
|
180
180
|
this.words = [
|
181
181
|
number2 & 67108863,
|
182
182
|
number2 / 67108864 & 67108863,
|
@@ -189,7 +189,7 @@
|
|
189
189
|
this._initArray(this.toArray(), base, endian);
|
190
190
|
};
|
191
191
|
BN2.prototype._initArray = function _initArray(number2, base, endian) {
|
192
|
-
|
192
|
+
assert2(typeof number2.length === "number");
|
193
193
|
if (number2.length <= 0) {
|
194
194
|
this.words = [0];
|
195
195
|
this.length = 1;
|
@@ -236,7 +236,7 @@
|
|
236
236
|
} else if (c >= 97 && c <= 102) {
|
237
237
|
return c - 87;
|
238
238
|
} else {
|
239
|
-
|
239
|
+
assert2(false, "Invalid character in " + string);
|
240
240
|
}
|
241
241
|
}
|
242
242
|
function parseHexByte(string, lowerBound, index) {
|
@@ -297,7 +297,7 @@
|
|
297
297
|
} else {
|
298
298
|
b = c;
|
299
299
|
}
|
300
|
-
|
300
|
+
assert2(c >= 0 && b < mul, "Invalid character");
|
301
301
|
r += b;
|
302
302
|
}
|
303
303
|
return r;
|
@@ -557,16 +557,16 @@
|
|
557
557
|
}
|
558
558
|
return out;
|
559
559
|
}
|
560
|
-
|
560
|
+
assert2(false, "Base should be between 2 and 36");
|
561
561
|
};
|
562
|
-
BN2.prototype.toNumber = function
|
562
|
+
BN2.prototype.toNumber = function toNumber2() {
|
563
563
|
var ret2 = this.words[0];
|
564
564
|
if (this.length === 2) {
|
565
565
|
ret2 += this.words[1] * 67108864;
|
566
566
|
} else if (this.length === 3 && this.words[2] === 1) {
|
567
567
|
ret2 += 4503599627370496 + this.words[1] * 67108864;
|
568
568
|
} else if (this.length > 2) {
|
569
|
-
|
569
|
+
assert2(false, "Number can only safely store up to 53 bits");
|
570
570
|
}
|
571
571
|
return this.negative !== 0 ? -ret2 : ret2;
|
572
572
|
};
|
@@ -591,8 +591,8 @@
|
|
591
591
|
this._strip();
|
592
592
|
var byteLength = this.byteLength();
|
593
593
|
var reqLength = length || Math.max(1, byteLength);
|
594
|
-
|
595
|
-
|
594
|
+
assert2(byteLength <= reqLength, "byte array longer than desired length");
|
595
|
+
assert2(reqLength > 0, "Requested array length <= 0");
|
596
596
|
var res = allocate(ArrayType, reqLength);
|
597
597
|
var postfix = endian === "le" ? "LE" : "BE";
|
598
598
|
this["_toArrayLike" + postfix](res, byteLength);
|
@@ -740,13 +740,13 @@
|
|
740
740
|
BN2.prototype.byteLength = function byteLength() {
|
741
741
|
return Math.ceil(this.bitLength() / 8);
|
742
742
|
};
|
743
|
-
BN2.prototype.toTwos = function
|
743
|
+
BN2.prototype.toTwos = function toTwos(width) {
|
744
744
|
if (this.negative !== 0) {
|
745
745
|
return this.abs().inotn(width).iaddn(1);
|
746
746
|
}
|
747
747
|
return this.clone();
|
748
748
|
};
|
749
|
-
BN2.prototype.fromTwos = function
|
749
|
+
BN2.prototype.fromTwos = function fromTwos(width) {
|
750
750
|
if (this.testn(width - 1)) {
|
751
751
|
return this.notn(width).iaddn(1).ineg();
|
752
752
|
}
|
@@ -774,7 +774,7 @@
|
|
774
774
|
return this._strip();
|
775
775
|
};
|
776
776
|
BN2.prototype.ior = function ior(num) {
|
777
|
-
|
777
|
+
assert2((this.negative | num.negative) === 0);
|
778
778
|
return this.iuor(num);
|
779
779
|
};
|
780
780
|
BN2.prototype.or = function or(num) {
|
@@ -801,7 +801,7 @@
|
|
801
801
|
return this._strip();
|
802
802
|
};
|
803
803
|
BN2.prototype.iand = function iand(num) {
|
804
|
-
|
804
|
+
assert2((this.negative | num.negative) === 0);
|
805
805
|
return this.iuand(num);
|
806
806
|
};
|
807
807
|
BN2.prototype.and = function and(num) {
|
@@ -836,7 +836,7 @@
|
|
836
836
|
return this._strip();
|
837
837
|
};
|
838
838
|
BN2.prototype.ixor = function ixor(num) {
|
839
|
-
|
839
|
+
assert2((this.negative | num.negative) === 0);
|
840
840
|
return this.iuxor(num);
|
841
841
|
};
|
842
842
|
BN2.prototype.xor = function xor(num) {
|
@@ -850,7 +850,7 @@
|
|
850
850
|
return num.clone().iuxor(this);
|
851
851
|
};
|
852
852
|
BN2.prototype.inotn = function inotn(width) {
|
853
|
-
|
853
|
+
assert2(typeof width === "number" && width >= 0);
|
854
854
|
var bytesNeeded = Math.ceil(width / 26) | 0;
|
855
855
|
var bitsLeft = width % 26;
|
856
856
|
this._expand(bytesNeeded);
|
@@ -869,7 +869,7 @@
|
|
869
869
|
return this.clone().inotn(width);
|
870
870
|
};
|
871
871
|
BN2.prototype.setn = function setn(bit, val) {
|
872
|
-
|
872
|
+
assert2(typeof bit === "number" && bit >= 0);
|
873
873
|
var off = bit / 26 | 0;
|
874
874
|
var wbit = bit % 26;
|
875
875
|
this._expand(off + 1);
|
@@ -1735,8 +1735,8 @@
|
|
1735
1735
|
for (i = 2 * len; i < N; ++i) {
|
1736
1736
|
rws[i] = 0;
|
1737
1737
|
}
|
1738
|
-
|
1739
|
-
|
1738
|
+
assert2(carry === 0);
|
1739
|
+
assert2((carry & ~8191) === 0);
|
1740
1740
|
};
|
1741
1741
|
FFTM.prototype.stub = function stub(N) {
|
1742
1742
|
var ph = new Array(N);
|
@@ -1791,8 +1791,8 @@
|
|
1791
1791
|
var isNegNum = num < 0;
|
1792
1792
|
if (isNegNum)
|
1793
1793
|
num = -num;
|
1794
|
-
|
1795
|
-
|
1794
|
+
assert2(typeof num === "number");
|
1795
|
+
assert2(num < 67108864);
|
1796
1796
|
var carry = 0;
|
1797
1797
|
for (var i = 0; i < this.length; i++) {
|
1798
1798
|
var w = (this.words[i] | 0) * num;
|
@@ -1836,7 +1836,7 @@
|
|
1836
1836
|
return res;
|
1837
1837
|
};
|
1838
1838
|
BN2.prototype.iushln = function iushln(bits) {
|
1839
|
-
|
1839
|
+
assert2(typeof bits === "number" && bits >= 0);
|
1840
1840
|
var r = bits % 26;
|
1841
1841
|
var s = (bits - r) / 26;
|
1842
1842
|
var carryMask = 67108863 >>> 26 - r << 26 - r;
|
@@ -1866,11 +1866,11 @@
|
|
1866
1866
|
return this._strip();
|
1867
1867
|
};
|
1868
1868
|
BN2.prototype.ishln = function ishln(bits) {
|
1869
|
-
|
1869
|
+
assert2(this.negative === 0);
|
1870
1870
|
return this.iushln(bits);
|
1871
1871
|
};
|
1872
1872
|
BN2.prototype.iushrn = function iushrn(bits, hint, extended) {
|
1873
|
-
|
1873
|
+
assert2(typeof bits === "number" && bits >= 0);
|
1874
1874
|
var h;
|
1875
1875
|
if (hint) {
|
1876
1876
|
h = (hint - hint % 26) / 26;
|
@@ -1879,7 +1879,7 @@
|
|
1879
1879
|
}
|
1880
1880
|
var r = bits % 26;
|
1881
1881
|
var s = Math.min((bits - r) / 26, this.length);
|
1882
|
-
var
|
1882
|
+
var mask = 67108863 ^ 67108863 >>> r << r;
|
1883
1883
|
var maskedWords = extended;
|
1884
1884
|
h -= s;
|
1885
1885
|
h = Math.max(0, h);
|
@@ -1903,7 +1903,7 @@
|
|
1903
1903
|
for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
|
1904
1904
|
var word = this.words[i] | 0;
|
1905
1905
|
this.words[i] = carry << 26 - r | word >>> r;
|
1906
|
-
carry = word &
|
1906
|
+
carry = word & mask;
|
1907
1907
|
}
|
1908
1908
|
if (maskedWords && carry !== 0) {
|
1909
1909
|
maskedWords.words[maskedWords.length++] = carry;
|
@@ -1915,7 +1915,7 @@
|
|
1915
1915
|
return this._strip();
|
1916
1916
|
};
|
1917
1917
|
BN2.prototype.ishrn = function ishrn(bits, hint, extended) {
|
1918
|
-
|
1918
|
+
assert2(this.negative === 0);
|
1919
1919
|
return this.iushrn(bits, hint, extended);
|
1920
1920
|
};
|
1921
1921
|
BN2.prototype.shln = function shln(bits) {
|
@@ -1931,7 +1931,7 @@
|
|
1931
1931
|
return this.clone().iushrn(bits);
|
1932
1932
|
};
|
1933
1933
|
BN2.prototype.testn = function testn(bit) {
|
1934
|
-
|
1934
|
+
assert2(typeof bit === "number" && bit >= 0);
|
1935
1935
|
var r = bit % 26;
|
1936
1936
|
var s = (bit - r) / 26;
|
1937
1937
|
var q = 1 << r;
|
@@ -1941,10 +1941,10 @@
|
|
1941
1941
|
return !!(w & q);
|
1942
1942
|
};
|
1943
1943
|
BN2.prototype.imaskn = function imaskn(bits) {
|
1944
|
-
|
1944
|
+
assert2(typeof bits === "number" && bits >= 0);
|
1945
1945
|
var r = bits % 26;
|
1946
1946
|
var s = (bits - r) / 26;
|
1947
|
-
|
1947
|
+
assert2(this.negative === 0, "imaskn works only with positive numbers");
|
1948
1948
|
if (this.length <= s) {
|
1949
1949
|
return this;
|
1950
1950
|
}
|
@@ -1953,8 +1953,8 @@
|
|
1953
1953
|
}
|
1954
1954
|
this.length = Math.min(s, this.length);
|
1955
1955
|
if (r !== 0) {
|
1956
|
-
var
|
1957
|
-
this.words[this.length - 1] &=
|
1956
|
+
var mask = 67108863 ^ 67108863 >>> r << r;
|
1957
|
+
this.words[this.length - 1] &= mask;
|
1958
1958
|
}
|
1959
1959
|
return this._strip();
|
1960
1960
|
};
|
@@ -1962,8 +1962,8 @@
|
|
1962
1962
|
return this.clone().imaskn(bits);
|
1963
1963
|
};
|
1964
1964
|
BN2.prototype.iaddn = function iaddn(num) {
|
1965
|
-
|
1966
|
-
|
1965
|
+
assert2(typeof num === "number");
|
1966
|
+
assert2(num < 67108864);
|
1967
1967
|
if (num < 0)
|
1968
1968
|
return this.isubn(-num);
|
1969
1969
|
if (this.negative !== 0) {
|
@@ -1993,8 +1993,8 @@
|
|
1993
1993
|
return this;
|
1994
1994
|
};
|
1995
1995
|
BN2.prototype.isubn = function isubn(num) {
|
1996
|
-
|
1997
|
-
|
1996
|
+
assert2(typeof num === "number");
|
1997
|
+
assert2(num < 67108864);
|
1998
1998
|
if (num < 0)
|
1999
1999
|
return this.iaddn(-num);
|
2000
2000
|
if (this.negative !== 0) {
|
@@ -2048,7 +2048,7 @@
|
|
2048
2048
|
}
|
2049
2049
|
if (carry === 0)
|
2050
2050
|
return this._strip();
|
2051
|
-
|
2051
|
+
assert2(carry === -1);
|
2052
2052
|
carry = 0;
|
2053
2053
|
for (i = 0; i < this.length; i++) {
|
2054
2054
|
w = -(this.words[i] | 0) + carry;
|
@@ -2116,7 +2116,7 @@
|
|
2116
2116
|
};
|
2117
2117
|
};
|
2118
2118
|
BN2.prototype.divmod = function divmod(num, mode, positive) {
|
2119
|
-
|
2119
|
+
assert2(!num.isZero());
|
2120
2120
|
if (this.isZero()) {
|
2121
2121
|
return {
|
2122
2122
|
div: new BN2(0),
|
@@ -2214,7 +2214,7 @@
|
|
2214
2214
|
var isNegNum = num < 0;
|
2215
2215
|
if (isNegNum)
|
2216
2216
|
num = -num;
|
2217
|
-
|
2217
|
+
assert2(num <= 67108863);
|
2218
2218
|
var p = (1 << 26) % num;
|
2219
2219
|
var acc = 0;
|
2220
2220
|
for (var i = this.length - 1; i >= 0; i--) {
|
@@ -2229,7 +2229,7 @@
|
|
2229
2229
|
var isNegNum = num < 0;
|
2230
2230
|
if (isNegNum)
|
2231
2231
|
num = -num;
|
2232
|
-
|
2232
|
+
assert2(num <= 67108863);
|
2233
2233
|
var carry = 0;
|
2234
2234
|
for (var i = this.length - 1; i >= 0; i--) {
|
2235
2235
|
var w = (this.words[i] | 0) + carry * 67108864;
|
@@ -2243,8 +2243,8 @@
|
|
2243
2243
|
return this.clone().idivn(num);
|
2244
2244
|
};
|
2245
2245
|
BN2.prototype.egcd = function egcd(p) {
|
2246
|
-
|
2247
|
-
|
2246
|
+
assert2(p.negative === 0);
|
2247
|
+
assert2(!p.isZero());
|
2248
2248
|
var x = this;
|
2249
2249
|
var y = p.clone();
|
2250
2250
|
if (x.negative !== 0) {
|
@@ -2308,8 +2308,8 @@
|
|
2308
2308
|
};
|
2309
2309
|
};
|
2310
2310
|
BN2.prototype._invmp = function _invmp(p) {
|
2311
|
-
|
2312
|
-
|
2311
|
+
assert2(p.negative === 0);
|
2312
|
+
assert2(!p.isZero());
|
2313
2313
|
var a = this;
|
2314
2314
|
var b = p.clone();
|
2315
2315
|
if (a.negative !== 0) {
|
@@ -2407,7 +2407,7 @@
|
|
2407
2407
|
return this.words[0] & num;
|
2408
2408
|
};
|
2409
2409
|
BN2.prototype.bincn = function bincn(bit) {
|
2410
|
-
|
2410
|
+
assert2(typeof bit === "number");
|
2411
2411
|
var r = bit % 26;
|
2412
2412
|
var s = (bit - r) / 26;
|
2413
2413
|
var q = 1 << r;
|
@@ -2447,7 +2447,7 @@
|
|
2447
2447
|
if (negative) {
|
2448
2448
|
num = -num;
|
2449
2449
|
}
|
2450
|
-
|
2450
|
+
assert2(num <= 67108863, "Number is too big");
|
2451
2451
|
var w = this.words[0] | 0;
|
2452
2452
|
res = w === num ? 0 : w < num ? -1 : 1;
|
2453
2453
|
}
|
@@ -2519,12 +2519,12 @@
|
|
2519
2519
|
return new Red(num);
|
2520
2520
|
};
|
2521
2521
|
BN2.prototype.toRed = function toRed(ctx) {
|
2522
|
-
|
2523
|
-
|
2522
|
+
assert2(!this.red, "Already a number in reduction context");
|
2523
|
+
assert2(this.negative === 0, "red works only with positives");
|
2524
2524
|
return ctx.convertTo(this)._forceRed(ctx);
|
2525
2525
|
};
|
2526
2526
|
BN2.prototype.fromRed = function fromRed() {
|
2527
|
-
|
2527
|
+
assert2(this.red, "fromRed works only with numbers in reduction context");
|
2528
2528
|
return this.red.convertFrom(this);
|
2529
2529
|
};
|
2530
2530
|
BN2.prototype._forceRed = function _forceRed(ctx) {
|
@@ -2532,66 +2532,66 @@
|
|
2532
2532
|
return this;
|
2533
2533
|
};
|
2534
2534
|
BN2.prototype.forceRed = function forceRed(ctx) {
|
2535
|
-
|
2535
|
+
assert2(!this.red, "Already a number in reduction context");
|
2536
2536
|
return this._forceRed(ctx);
|
2537
2537
|
};
|
2538
2538
|
BN2.prototype.redAdd = function redAdd(num) {
|
2539
|
-
|
2539
|
+
assert2(this.red, "redAdd works only with red numbers");
|
2540
2540
|
return this.red.add(this, num);
|
2541
2541
|
};
|
2542
2542
|
BN2.prototype.redIAdd = function redIAdd(num) {
|
2543
|
-
|
2543
|
+
assert2(this.red, "redIAdd works only with red numbers");
|
2544
2544
|
return this.red.iadd(this, num);
|
2545
2545
|
};
|
2546
2546
|
BN2.prototype.redSub = function redSub(num) {
|
2547
|
-
|
2547
|
+
assert2(this.red, "redSub works only with red numbers");
|
2548
2548
|
return this.red.sub(this, num);
|
2549
2549
|
};
|
2550
2550
|
BN2.prototype.redISub = function redISub(num) {
|
2551
|
-
|
2551
|
+
assert2(this.red, "redISub works only with red numbers");
|
2552
2552
|
return this.red.isub(this, num);
|
2553
2553
|
};
|
2554
2554
|
BN2.prototype.redShl = function redShl(num) {
|
2555
|
-
|
2555
|
+
assert2(this.red, "redShl works only with red numbers");
|
2556
2556
|
return this.red.shl(this, num);
|
2557
2557
|
};
|
2558
2558
|
BN2.prototype.redMul = function redMul(num) {
|
2559
|
-
|
2559
|
+
assert2(this.red, "redMul works only with red numbers");
|
2560
2560
|
this.red._verify2(this, num);
|
2561
2561
|
return this.red.mul(this, num);
|
2562
2562
|
};
|
2563
2563
|
BN2.prototype.redIMul = function redIMul(num) {
|
2564
|
-
|
2564
|
+
assert2(this.red, "redMul works only with red numbers");
|
2565
2565
|
this.red._verify2(this, num);
|
2566
2566
|
return this.red.imul(this, num);
|
2567
2567
|
};
|
2568
2568
|
BN2.prototype.redSqr = function redSqr() {
|
2569
|
-
|
2569
|
+
assert2(this.red, "redSqr works only with red numbers");
|
2570
2570
|
this.red._verify1(this);
|
2571
2571
|
return this.red.sqr(this);
|
2572
2572
|
};
|
2573
2573
|
BN2.prototype.redISqr = function redISqr() {
|
2574
|
-
|
2574
|
+
assert2(this.red, "redISqr works only with red numbers");
|
2575
2575
|
this.red._verify1(this);
|
2576
2576
|
return this.red.isqr(this);
|
2577
2577
|
};
|
2578
2578
|
BN2.prototype.redSqrt = function redSqrt() {
|
2579
|
-
|
2579
|
+
assert2(this.red, "redSqrt works only with red numbers");
|
2580
2580
|
this.red._verify1(this);
|
2581
2581
|
return this.red.sqrt(this);
|
2582
2582
|
};
|
2583
2583
|
BN2.prototype.redInvm = function redInvm() {
|
2584
|
-
|
2584
|
+
assert2(this.red, "redInvm works only with red numbers");
|
2585
2585
|
this.red._verify1(this);
|
2586
2586
|
return this.red.invm(this);
|
2587
2587
|
};
|
2588
2588
|
BN2.prototype.redNeg = function redNeg() {
|
2589
|
-
|
2589
|
+
assert2(this.red, "redNeg works only with red numbers");
|
2590
2590
|
this.red._verify1(this);
|
2591
2591
|
return this.red.neg(this);
|
2592
2592
|
};
|
2593
2593
|
BN2.prototype.redPow = function redPow(num) {
|
2594
|
-
|
2594
|
+
assert2(this.red && !num.red, "redPow(normalNum)");
|
2595
2595
|
this.red._verify1(this);
|
2596
2596
|
return this.red.pow(this, num);
|
2597
2597
|
};
|
@@ -2652,7 +2652,7 @@
|
|
2652
2652
|
}
|
2653
2653
|
inherits(K256, MPrime);
|
2654
2654
|
K256.prototype.split = function split2(input, output2) {
|
2655
|
-
var
|
2655
|
+
var mask = 4194303;
|
2656
2656
|
var outLen = Math.min(input.length, 9);
|
2657
2657
|
for (var i = 0; i < outLen; i++) {
|
2658
2658
|
output2.words[i] = input.words[i];
|
@@ -2664,10 +2664,10 @@
|
|
2664
2664
|
return;
|
2665
2665
|
}
|
2666
2666
|
var prev = input.words[9];
|
2667
|
-
output2.words[output2.length++] = prev &
|
2667
|
+
output2.words[output2.length++] = prev & mask;
|
2668
2668
|
for (i = 10; i < input.length; i++) {
|
2669
2669
|
var next = input.words[i] | 0;
|
2670
|
-
input.words[i - 10] = (next &
|
2670
|
+
input.words[i - 10] = (next & mask) << 4 | prev >>> 22;
|
2671
2671
|
prev = next;
|
2672
2672
|
}
|
2673
2673
|
prev >>>= 22;
|
@@ -2759,18 +2759,18 @@
|
|
2759
2759
|
this.m = prime.p;
|
2760
2760
|
this.prime = prime;
|
2761
2761
|
} else {
|
2762
|
-
|
2762
|
+
assert2(m.gtn(1), "modulus must be greater than 1");
|
2763
2763
|
this.m = m;
|
2764
2764
|
this.prime = null;
|
2765
2765
|
}
|
2766
2766
|
}
|
2767
2767
|
Red.prototype._verify1 = function _verify1(a) {
|
2768
|
-
|
2769
|
-
|
2768
|
+
assert2(a.negative === 0, "red works only with positives");
|
2769
|
+
assert2(a.red, "red works only with red numbers");
|
2770
2770
|
};
|
2771
2771
|
Red.prototype._verify2 = function _verify2(a, b) {
|
2772
|
-
|
2773
|
-
|
2772
|
+
assert2((a.negative | b.negative) === 0, "red works only with positives");
|
2773
|
+
assert2(
|
2774
2774
|
a.red && a.red === b.red,
|
2775
2775
|
"red works only with red numbers"
|
2776
2776
|
);
|
@@ -2841,7 +2841,7 @@
|
|
2841
2841
|
if (a.isZero())
|
2842
2842
|
return a.clone();
|
2843
2843
|
var mod3 = this.m.andln(3);
|
2844
|
-
|
2844
|
+
assert2(mod3 % 2 === 1);
|
2845
2845
|
if (mod3 === 3) {
|
2846
2846
|
var pow3 = this.m.add(new BN2(1)).iushrn(2);
|
2847
2847
|
return this.pow(a, pow3);
|
@@ -2852,7 +2852,7 @@
|
|
2852
2852
|
s++;
|
2853
2853
|
q.iushrn(1);
|
2854
2854
|
}
|
2855
|
-
|
2855
|
+
assert2(!q.isZero());
|
2856
2856
|
var one = new BN2(1).toRed(this);
|
2857
2857
|
var nOne = one.redNeg();
|
2858
2858
|
var lpow = this.m.subn(1).iushrn(1);
|
@@ -2870,7 +2870,7 @@
|
|
2870
2870
|
for (var i = 0; tmp.cmp(one) !== 0; i++) {
|
2871
2871
|
tmp = tmp.redSqr();
|
2872
2872
|
}
|
2873
|
-
|
2873
|
+
assert2(i < m);
|
2874
2874
|
var b = this.pow(c, new BN2(1).iushln(m - i - 1));
|
2875
2875
|
r = r.redMul(b);
|
2876
2876
|
c = b.redSqr();
|
@@ -29475,8 +29475,8 @@ spurious results.`);
|
|
29475
29475
|
FUELS: "0.85.0"
|
29476
29476
|
};
|
29477
29477
|
}
|
29478
|
-
function parseVersion(
|
29479
|
-
const [major, minor, patch] =
|
29478
|
+
function parseVersion(version) {
|
29479
|
+
const [major, minor, patch] = version.split(".").map((v) => parseInt(v, 10));
|
29480
29480
|
return { major, minor, patch };
|
29481
29481
|
}
|
29482
29482
|
function versionDiffs(version1, version2) {
|
@@ -30036,6 +30036,123 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30036
30036
|
}
|
30037
30037
|
return hexlify(bytes2.slice(start == null ? 0 : start, end == null ? bytes2.length : end));
|
30038
30038
|
}
|
30039
|
+
function toUtf8Bytes(stri, form = true) {
|
30040
|
+
let str = stri;
|
30041
|
+
if (form) {
|
30042
|
+
str = stri.normalize("NFC");
|
30043
|
+
}
|
30044
|
+
const result = [];
|
30045
|
+
for (let i = 0; i < str.length; i += 1) {
|
30046
|
+
const c = str.charCodeAt(i);
|
30047
|
+
if (c < 128) {
|
30048
|
+
result.push(c);
|
30049
|
+
} else if (c < 2048) {
|
30050
|
+
result.push(c >> 6 | 192);
|
30051
|
+
result.push(c & 63 | 128);
|
30052
|
+
} else if ((c & 64512) === 55296) {
|
30053
|
+
i += 1;
|
30054
|
+
const c2 = str.charCodeAt(i);
|
30055
|
+
if (i >= str.length || (c2 & 64512) !== 56320) {
|
30056
|
+
throw new FuelError(
|
30057
|
+
ErrorCode.INVALID_INPUT_PARAMETERS,
|
30058
|
+
"Invalid UTF-8 in the input string."
|
30059
|
+
);
|
30060
|
+
}
|
30061
|
+
const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
|
30062
|
+
result.push(pair >> 18 | 240);
|
30063
|
+
result.push(pair >> 12 & 63 | 128);
|
30064
|
+
result.push(pair >> 6 & 63 | 128);
|
30065
|
+
result.push(pair & 63 | 128);
|
30066
|
+
} else {
|
30067
|
+
result.push(c >> 12 | 224);
|
30068
|
+
result.push(c >> 6 & 63 | 128);
|
30069
|
+
result.push(c & 63 | 128);
|
30070
|
+
}
|
30071
|
+
}
|
30072
|
+
return new Uint8Array(result);
|
30073
|
+
}
|
30074
|
+
function onError(reason, offset, bytes2, output2, badCodepoint) {
|
30075
|
+
console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${bytes2}`);
|
30076
|
+
return offset;
|
30077
|
+
}
|
30078
|
+
function helper(codePoints) {
|
30079
|
+
return codePoints.map((codePoint) => {
|
30080
|
+
if (codePoint <= 65535) {
|
30081
|
+
return String.fromCharCode(codePoint);
|
30082
|
+
}
|
30083
|
+
codePoint -= 65536;
|
30084
|
+
return String.fromCharCode(
|
30085
|
+
(codePoint >> 10 & 1023) + 55296,
|
30086
|
+
(codePoint & 1023) + 56320
|
30087
|
+
);
|
30088
|
+
}).join("");
|
30089
|
+
}
|
30090
|
+
function getUtf8CodePoints(_bytes) {
|
30091
|
+
const bytes2 = arrayify(_bytes, "bytes");
|
30092
|
+
const result = [];
|
30093
|
+
let i = 0;
|
30094
|
+
while (i < bytes2.length) {
|
30095
|
+
const c = bytes2[i++];
|
30096
|
+
if (c >> 7 === 0) {
|
30097
|
+
result.push(c);
|
30098
|
+
continue;
|
30099
|
+
}
|
30100
|
+
let extraLength = null;
|
30101
|
+
let overlongMask = null;
|
30102
|
+
if ((c & 224) === 192) {
|
30103
|
+
extraLength = 1;
|
30104
|
+
overlongMask = 127;
|
30105
|
+
} else if ((c & 240) === 224) {
|
30106
|
+
extraLength = 2;
|
30107
|
+
overlongMask = 2047;
|
30108
|
+
} else if ((c & 248) === 240) {
|
30109
|
+
extraLength = 3;
|
30110
|
+
overlongMask = 65535;
|
30111
|
+
} else {
|
30112
|
+
if ((c & 192) === 128) {
|
30113
|
+
i += onError("UNEXPECTED_CONTINUE", i - 1, bytes2, result);
|
30114
|
+
} else {
|
30115
|
+
i += onError("BAD_PREFIX", i - 1, bytes2, result);
|
30116
|
+
}
|
30117
|
+
continue;
|
30118
|
+
}
|
30119
|
+
if (i - 1 + extraLength >= bytes2.length) {
|
30120
|
+
i += onError("OVERRUN", i - 1, bytes2, result);
|
30121
|
+
continue;
|
30122
|
+
}
|
30123
|
+
let res = c & (1 << 8 - extraLength - 1) - 1;
|
30124
|
+
for (let j = 0; j < extraLength; j++) {
|
30125
|
+
const nextChar = bytes2[i];
|
30126
|
+
if ((nextChar & 192) !== 128) {
|
30127
|
+
i += onError("MISSING_CONTINUE", i, bytes2, result);
|
30128
|
+
res = null;
|
30129
|
+
break;
|
30130
|
+
}
|
30131
|
+
res = res << 6 | nextChar & 63;
|
30132
|
+
i++;
|
30133
|
+
}
|
30134
|
+
if (res === null) {
|
30135
|
+
continue;
|
30136
|
+
}
|
30137
|
+
if (res > 1114111) {
|
30138
|
+
i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes2, result, res);
|
30139
|
+
continue;
|
30140
|
+
}
|
30141
|
+
if (res >= 55296 && res <= 57343) {
|
30142
|
+
i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes2, result, res);
|
30143
|
+
continue;
|
30144
|
+
}
|
30145
|
+
if (res <= overlongMask) {
|
30146
|
+
i += onError("OVERLONG", i - 1 - extraLength, bytes2, result, res);
|
30147
|
+
continue;
|
30148
|
+
}
|
30149
|
+
result.push(res);
|
30150
|
+
}
|
30151
|
+
return result;
|
30152
|
+
}
|
30153
|
+
function toUtf8String(bytes2) {
|
30154
|
+
return helper(getUtf8CodePoints(bytes2));
|
30155
|
+
}
|
30039
30156
|
|
30040
30157
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/ripemd160.js
|
30041
30158
|
var Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
|
@@ -30147,13 +30264,13 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30147
30264
|
};
|
30148
30265
|
var keccak256 = (data) => keccak_256(data);
|
30149
30266
|
var locked = false;
|
30150
|
-
var
|
30151
|
-
var ripemd =
|
30267
|
+
var helper2 = (data) => ripemd160(data);
|
30268
|
+
var ripemd = helper2;
|
30152
30269
|
function ripemd1602(_data) {
|
30153
30270
|
const data = arrayify(_data, "data");
|
30154
30271
|
return ripemd(data);
|
30155
30272
|
}
|
30156
|
-
ripemd1602._ =
|
30273
|
+
ripemd1602._ = helper2;
|
30157
30274
|
ripemd1602.lock = () => {
|
30158
30275
|
locked = true;
|
30159
30276
|
};
|
@@ -30757,316 +30874,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30757
30874
|
return coinQuantities;
|
30758
30875
|
};
|
30759
30876
|
|
30760
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
|
30761
|
-
var version = "6.7.1";
|
30762
|
-
|
30763
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/properties.js
|
30764
|
-
function checkType(value, type3, name) {
|
30765
|
-
const types = type3.split("|").map((t) => t.trim());
|
30766
|
-
for (let i = 0; i < types.length; i++) {
|
30767
|
-
switch (type3) {
|
30768
|
-
case "any":
|
30769
|
-
return;
|
30770
|
-
case "bigint":
|
30771
|
-
case "boolean":
|
30772
|
-
case "number":
|
30773
|
-
case "string":
|
30774
|
-
if (typeof value === type3) {
|
30775
|
-
return;
|
30776
|
-
}
|
30777
|
-
}
|
30778
|
-
}
|
30779
|
-
const error = new Error(`invalid value for type ${type3}`);
|
30780
|
-
error.code = "INVALID_ARGUMENT";
|
30781
|
-
error.argument = `value.${name}`;
|
30782
|
-
error.value = value;
|
30783
|
-
throw error;
|
30784
|
-
}
|
30785
|
-
function defineProperties(target, values, types) {
|
30786
|
-
for (let key in values) {
|
30787
|
-
let value = values[key];
|
30788
|
-
const type3 = types ? types[key] : null;
|
30789
|
-
if (type3) {
|
30790
|
-
checkType(value, type3, key);
|
30791
|
-
}
|
30792
|
-
Object.defineProperty(target, key, { enumerable: true, value, writable: false });
|
30793
|
-
}
|
30794
|
-
}
|
30795
|
-
|
30796
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/errors.js
|
30797
|
-
function stringify(value) {
|
30798
|
-
if (value == null) {
|
30799
|
-
return "null";
|
30800
|
-
}
|
30801
|
-
if (Array.isArray(value)) {
|
30802
|
-
return "[ " + value.map(stringify).join(", ") + " ]";
|
30803
|
-
}
|
30804
|
-
if (value instanceof Uint8Array) {
|
30805
|
-
const HEX = "0123456789abcdef";
|
30806
|
-
let result = "0x";
|
30807
|
-
for (let i = 0; i < value.length; i++) {
|
30808
|
-
result += HEX[value[i] >> 4];
|
30809
|
-
result += HEX[value[i] & 15];
|
30810
|
-
}
|
30811
|
-
return result;
|
30812
|
-
}
|
30813
|
-
if (typeof value === "object" && typeof value.toJSON === "function") {
|
30814
|
-
return stringify(value.toJSON());
|
30815
|
-
}
|
30816
|
-
switch (typeof value) {
|
30817
|
-
case "boolean":
|
30818
|
-
case "symbol":
|
30819
|
-
return value.toString();
|
30820
|
-
case "bigint":
|
30821
|
-
return BigInt(value).toString();
|
30822
|
-
case "number":
|
30823
|
-
return value.toString();
|
30824
|
-
case "string":
|
30825
|
-
return JSON.stringify(value);
|
30826
|
-
case "object": {
|
30827
|
-
const keys = Object.keys(value);
|
30828
|
-
keys.sort();
|
30829
|
-
return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }";
|
30830
|
-
}
|
30831
|
-
}
|
30832
|
-
return `[ COULD NOT SERIALIZE ]`;
|
30833
|
-
}
|
30834
|
-
function makeError(message, code, info) {
|
30835
|
-
{
|
30836
|
-
const details = [];
|
30837
|
-
if (info) {
|
30838
|
-
if ("message" in info || "code" in info || "name" in info) {
|
30839
|
-
throw new Error(`value will overwrite populated values: ${stringify(info)}`);
|
30840
|
-
}
|
30841
|
-
for (const key in info) {
|
30842
|
-
const value = info[key];
|
30843
|
-
details.push(key + "=" + stringify(value));
|
30844
|
-
}
|
30845
|
-
}
|
30846
|
-
details.push(`code=${code}`);
|
30847
|
-
details.push(`version=${version}`);
|
30848
|
-
if (details.length) {
|
30849
|
-
message += " (" + details.join(", ") + ")";
|
30850
|
-
}
|
30851
|
-
}
|
30852
|
-
let error;
|
30853
|
-
switch (code) {
|
30854
|
-
case "INVALID_ARGUMENT":
|
30855
|
-
error = new TypeError(message);
|
30856
|
-
break;
|
30857
|
-
case "NUMERIC_FAULT":
|
30858
|
-
case "BUFFER_OVERRUN":
|
30859
|
-
error = new RangeError(message);
|
30860
|
-
break;
|
30861
|
-
default:
|
30862
|
-
error = new Error(message);
|
30863
|
-
}
|
30864
|
-
defineProperties(error, { code });
|
30865
|
-
if (info) {
|
30866
|
-
Object.assign(error, info);
|
30867
|
-
}
|
30868
|
-
return error;
|
30869
|
-
}
|
30870
|
-
function assert(check, message, code, info) {
|
30871
|
-
if (!check) {
|
30872
|
-
throw makeError(message, code, info);
|
30873
|
-
}
|
30874
|
-
}
|
30875
|
-
function assertArgument(check, message, name, value) {
|
30876
|
-
assert(check, message, "INVALID_ARGUMENT", { argument: name, value });
|
30877
|
-
}
|
30878
|
-
var _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
|
30879
|
-
try {
|
30880
|
-
if ("test".normalize(form) !== "test") {
|
30881
|
-
throw new Error("bad");
|
30882
|
-
}
|
30883
|
-
;
|
30884
|
-
if (form === "NFD") {
|
30885
|
-
const check = String.fromCharCode(233).normalize("NFD");
|
30886
|
-
const expected = String.fromCharCode(101, 769);
|
30887
|
-
if (check !== expected) {
|
30888
|
-
throw new Error("broken");
|
30889
|
-
}
|
30890
|
-
}
|
30891
|
-
accum.push(form);
|
30892
|
-
} catch (error) {
|
30893
|
-
}
|
30894
|
-
return accum;
|
30895
|
-
}, []);
|
30896
|
-
function assertNormalize(form) {
|
30897
|
-
assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
|
30898
|
-
operation: "String.prototype.normalize",
|
30899
|
-
info: { form }
|
30900
|
-
});
|
30901
|
-
}
|
30902
|
-
|
30903
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/data.js
|
30904
|
-
function _getBytes(value, name, copy) {
|
30905
|
-
if (value instanceof Uint8Array) {
|
30906
|
-
if (copy) {
|
30907
|
-
return new Uint8Array(value);
|
30908
|
-
}
|
30909
|
-
return value;
|
30910
|
-
}
|
30911
|
-
if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
|
30912
|
-
const result = new Uint8Array((value.length - 2) / 2);
|
30913
|
-
let offset = 2;
|
30914
|
-
for (let i = 0; i < result.length; i++) {
|
30915
|
-
result[i] = parseInt(value.substring(offset, offset + 2), 16);
|
30916
|
-
offset += 2;
|
30917
|
-
}
|
30918
|
-
return result;
|
30919
|
-
}
|
30920
|
-
assertArgument(false, "invalid BytesLike value", name || "value", value);
|
30921
|
-
}
|
30922
|
-
function getBytes(value, name) {
|
30923
|
-
return _getBytes(value, name, false);
|
30924
|
-
}
|
30925
|
-
|
30926
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/utf8.js
|
30927
|
-
function errorFunc(reason, offset, bytes2, output2, badCodepoint) {
|
30928
|
-
assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes2);
|
30929
|
-
}
|
30930
|
-
function ignoreFunc(reason, offset, bytes2, output2, badCodepoint) {
|
30931
|
-
if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") {
|
30932
|
-
let i = 0;
|
30933
|
-
for (let o = offset + 1; o < bytes2.length; o++) {
|
30934
|
-
if (bytes2[o] >> 6 !== 2) {
|
30935
|
-
break;
|
30936
|
-
}
|
30937
|
-
i++;
|
30938
|
-
}
|
30939
|
-
return i;
|
30940
|
-
}
|
30941
|
-
if (reason === "OVERRUN") {
|
30942
|
-
return bytes2.length - offset - 1;
|
30943
|
-
}
|
30944
|
-
return 0;
|
30945
|
-
}
|
30946
|
-
function replaceFunc(reason, offset, bytes2, output2, badCodepoint) {
|
30947
|
-
if (reason === "OVERLONG") {
|
30948
|
-
assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint);
|
30949
|
-
output2.push(badCodepoint);
|
30950
|
-
return 0;
|
30951
|
-
}
|
30952
|
-
output2.push(65533);
|
30953
|
-
return ignoreFunc(reason, offset, bytes2, output2, badCodepoint);
|
30954
|
-
}
|
30955
|
-
var Utf8ErrorFuncs = Object.freeze({
|
30956
|
-
error: errorFunc,
|
30957
|
-
ignore: ignoreFunc,
|
30958
|
-
replace: replaceFunc
|
30959
|
-
});
|
30960
|
-
function getUtf8CodePoints(_bytes, onError) {
|
30961
|
-
if (onError == null) {
|
30962
|
-
onError = Utf8ErrorFuncs.error;
|
30963
|
-
}
|
30964
|
-
const bytes2 = getBytes(_bytes, "bytes");
|
30965
|
-
const result = [];
|
30966
|
-
let i = 0;
|
30967
|
-
while (i < bytes2.length) {
|
30968
|
-
const c = bytes2[i++];
|
30969
|
-
if (c >> 7 === 0) {
|
30970
|
-
result.push(c);
|
30971
|
-
continue;
|
30972
|
-
}
|
30973
|
-
let extraLength = null;
|
30974
|
-
let overlongMask = null;
|
30975
|
-
if ((c & 224) === 192) {
|
30976
|
-
extraLength = 1;
|
30977
|
-
overlongMask = 127;
|
30978
|
-
} else if ((c & 240) === 224) {
|
30979
|
-
extraLength = 2;
|
30980
|
-
overlongMask = 2047;
|
30981
|
-
} else if ((c & 248) === 240) {
|
30982
|
-
extraLength = 3;
|
30983
|
-
overlongMask = 65535;
|
30984
|
-
} else {
|
30985
|
-
if ((c & 192) === 128) {
|
30986
|
-
i += onError("UNEXPECTED_CONTINUE", i - 1, bytes2, result);
|
30987
|
-
} else {
|
30988
|
-
i += onError("BAD_PREFIX", i - 1, bytes2, result);
|
30989
|
-
}
|
30990
|
-
continue;
|
30991
|
-
}
|
30992
|
-
if (i - 1 + extraLength >= bytes2.length) {
|
30993
|
-
i += onError("OVERRUN", i - 1, bytes2, result);
|
30994
|
-
continue;
|
30995
|
-
}
|
30996
|
-
let res = c & (1 << 8 - extraLength - 1) - 1;
|
30997
|
-
for (let j = 0; j < extraLength; j++) {
|
30998
|
-
let nextChar = bytes2[i];
|
30999
|
-
if ((nextChar & 192) != 128) {
|
31000
|
-
i += onError("MISSING_CONTINUE", i, bytes2, result);
|
31001
|
-
res = null;
|
31002
|
-
break;
|
31003
|
-
}
|
31004
|
-
;
|
31005
|
-
res = res << 6 | nextChar & 63;
|
31006
|
-
i++;
|
31007
|
-
}
|
31008
|
-
if (res === null) {
|
31009
|
-
continue;
|
31010
|
-
}
|
31011
|
-
if (res > 1114111) {
|
31012
|
-
i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes2, result, res);
|
31013
|
-
continue;
|
31014
|
-
}
|
31015
|
-
if (res >= 55296 && res <= 57343) {
|
31016
|
-
i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes2, result, res);
|
31017
|
-
continue;
|
31018
|
-
}
|
31019
|
-
if (res <= overlongMask) {
|
31020
|
-
i += onError("OVERLONG", i - 1 - extraLength, bytes2, result, res);
|
31021
|
-
continue;
|
31022
|
-
}
|
31023
|
-
result.push(res);
|
31024
|
-
}
|
31025
|
-
return result;
|
31026
|
-
}
|
31027
|
-
function toUtf8Bytes(str, form) {
|
31028
|
-
if (form != null) {
|
31029
|
-
assertNormalize(form);
|
31030
|
-
str = str.normalize(form);
|
31031
|
-
}
|
31032
|
-
let result = [];
|
31033
|
-
for (let i = 0; i < str.length; i++) {
|
31034
|
-
const c = str.charCodeAt(i);
|
31035
|
-
if (c < 128) {
|
31036
|
-
result.push(c);
|
31037
|
-
} else if (c < 2048) {
|
31038
|
-
result.push(c >> 6 | 192);
|
31039
|
-
result.push(c & 63 | 128);
|
31040
|
-
} else if ((c & 64512) == 55296) {
|
31041
|
-
i++;
|
31042
|
-
const c2 = str.charCodeAt(i);
|
31043
|
-
assertArgument(i < str.length && (c2 & 64512) === 56320, "invalid surrogate pair", "str", str);
|
31044
|
-
const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
|
31045
|
-
result.push(pair >> 18 | 240);
|
31046
|
-
result.push(pair >> 12 & 63 | 128);
|
31047
|
-
result.push(pair >> 6 & 63 | 128);
|
31048
|
-
result.push(pair & 63 | 128);
|
31049
|
-
} else {
|
31050
|
-
result.push(c >> 12 | 224);
|
31051
|
-
result.push(c >> 6 & 63 | 128);
|
31052
|
-
result.push(c & 63 | 128);
|
31053
|
-
}
|
31054
|
-
}
|
31055
|
-
return new Uint8Array(result);
|
31056
|
-
}
|
31057
|
-
function _toUtf8String(codePoints) {
|
31058
|
-
return codePoints.map((codePoint) => {
|
31059
|
-
if (codePoint <= 65535) {
|
31060
|
-
return String.fromCharCode(codePoint);
|
31061
|
-
}
|
31062
|
-
codePoint -= 65536;
|
31063
|
-
return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320);
|
31064
|
-
}).join("");
|
31065
|
-
}
|
31066
|
-
function toUtf8String(bytes2, onError) {
|
31067
|
-
return _toUtf8String(getUtf8CodePoints(bytes2, onError));
|
31068
|
-
}
|
31069
|
-
|
31070
30877
|
// ../hasher/dist/index.mjs
|
31071
30878
|
function sha2562(data) {
|
31072
30879
|
return hexlify(sha256(arrayify(data)));
|
@@ -32526,9 +32333,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32526
32333
|
const offsetAndLength = offset + WORD_SIZE;
|
32527
32334
|
const lengthBytes = data.slice(offset, offsetAndLength);
|
32528
32335
|
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
32529
|
-
const
|
32530
|
-
const dataBytes = data.slice(offsetAndLength, offsetAndLength +
|
32531
|
-
if (!this.#isOptionVec && dataBytes.length !==
|
32336
|
+
const dataLength = length * this.coder.encodedLength;
|
32337
|
+
const dataBytes = data.slice(offsetAndLength, offsetAndLength + dataLength);
|
32338
|
+
if (!this.#isOptionVec && dataBytes.length !== dataLength) {
|
32532
32339
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid vec byte data size.`);
|
32533
32340
|
}
|
32534
32341
|
let newOffset = offsetAndLength;
|
@@ -33052,8 +32859,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33052
32859
|
}
|
33053
32860
|
static encodeData(messageData) {
|
33054
32861
|
const bytes2 = arrayify(messageData || "0x");
|
33055
|
-
const
|
33056
|
-
return new ByteArrayCoder(
|
32862
|
+
const dataLength = bytes2.length;
|
32863
|
+
return new ByteArrayCoder(dataLength).encode(bytes2);
|
33057
32864
|
}
|
33058
32865
|
encode(value) {
|
33059
32866
|
const parts = [];
|
@@ -33076,8 +32883,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33076
32883
|
}
|
33077
32884
|
static decodeData(messageData) {
|
33078
32885
|
const bytes2 = arrayify(messageData);
|
33079
|
-
const
|
33080
|
-
const [data] = new ByteArrayCoder(
|
32886
|
+
const dataLength = bytes2.length;
|
32887
|
+
const [data] = new ByteArrayCoder(dataLength).decode(bytes2, 0);
|
33081
32888
|
return arrayify(data);
|
33082
32889
|
}
|
33083
32890
|
decode(data, offset) {
|
@@ -33096,12 +32903,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33096
32903
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33097
32904
|
const predicateGasUsed = decoded;
|
33098
32905
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33099
|
-
const
|
32906
|
+
const dataLength = decoded;
|
33100
32907
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33101
32908
|
const predicateLength = decoded;
|
33102
32909
|
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
33103
32910
|
const predicateDataLength = decoded;
|
33104
|
-
[decoded, o] = new ByteArrayCoder(
|
32911
|
+
[decoded, o] = new ByteArrayCoder(dataLength).decode(data, o);
|
33105
32912
|
const messageData = decoded;
|
33106
32913
|
[decoded, o] = new ByteArrayCoder(predicateLength.toNumber()).decode(data, o);
|
33107
32914
|
const predicate = decoded;
|
@@ -33116,7 +32923,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33116
32923
|
witnessIndex,
|
33117
32924
|
nonce,
|
33118
32925
|
predicateGasUsed,
|
33119
|
-
dataLength
|
32926
|
+
dataLength,
|
33120
32927
|
predicateLength,
|
33121
32928
|
predicateDataLength,
|
33122
32929
|
data: messageData,
|
@@ -33730,12 +33537,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33730
33537
|
let decoded;
|
33731
33538
|
let o = offset;
|
33732
33539
|
[decoded, o] = new NumberCoder("u32").decode(data, o);
|
33733
|
-
const
|
33734
|
-
[decoded, o] = new ByteArrayCoder(
|
33540
|
+
const dataLength = decoded;
|
33541
|
+
[decoded, o] = new ByteArrayCoder(dataLength).decode(data, o);
|
33735
33542
|
const witnessData = decoded;
|
33736
33543
|
return [
|
33737
33544
|
{
|
33738
|
-
dataLength
|
33545
|
+
dataLength,
|
33739
33546
|
data: witnessData
|
33740
33547
|
},
|
33741
33548
|
o
|
@@ -39220,7 +39027,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39220
39027
|
}
|
39221
39028
|
return { errorMessage, reason };
|
39222
39029
|
};
|
39223
|
-
var
|
39030
|
+
var stringify = (obj) => JSON.stringify(obj, null, 2);
|
39224
39031
|
var assembleRevertError = (receipts, logs) => {
|
39225
39032
|
let errorMessage = "The transaction reverted with an unknown reason.";
|
39226
39033
|
const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
|
@@ -39230,17 +39037,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39230
39037
|
switch (reasonHex) {
|
39231
39038
|
case FAILED_REQUIRE_SIGNAL: {
|
39232
39039
|
reason = "require";
|
39233
|
-
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ?
|
39040
|
+
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
|
39234
39041
|
break;
|
39235
39042
|
}
|
39236
39043
|
case FAILED_ASSERT_EQ_SIGNAL: {
|
39237
|
-
const sufix = logs.length >= 2 ? ` comparing ${
|
39044
|
+
const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
|
39238
39045
|
reason = "assert_eq";
|
39239
39046
|
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
|
39240
39047
|
break;
|
39241
39048
|
}
|
39242
39049
|
case FAILED_ASSERT_NE_SIGNAL: {
|
39243
|
-
const sufix = logs.length >= 2 ? ` comparing ${
|
39050
|
+
const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
|
39244
39051
|
reason = "assert_ne";
|
39245
39052
|
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
|
39246
39053
|
break;
|
@@ -41248,13 +41055,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41248
41055
|
gasCosts,
|
41249
41056
|
baseAssetId,
|
41250
41057
|
chainId,
|
41251
|
-
version
|
41058
|
+
version
|
41252
41059
|
} = consensusParameters;
|
41253
41060
|
return {
|
41254
41061
|
name,
|
41255
41062
|
baseChainHeight: bn(daHeight),
|
41256
41063
|
consensusParameters: {
|
41257
|
-
version
|
41064
|
+
version,
|
41258
41065
|
chainId: bn(chainId),
|
41259
41066
|
baseAssetId,
|
41260
41067
|
feeParameters: {
|
@@ -43430,12 +43237,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43430
43237
|
const { windows, windowSize } = opts(W);
|
43431
43238
|
let p = c.ZERO;
|
43432
43239
|
let f2 = c.BASE;
|
43433
|
-
const
|
43240
|
+
const mask = BigInt(2 ** W - 1);
|
43434
43241
|
const maxNumber = 2 ** W;
|
43435
43242
|
const shiftBy = BigInt(W);
|
43436
43243
|
for (let window2 = 0; window2 < windows; window2++) {
|
43437
43244
|
const offset = window2 * windowSize;
|
43438
|
-
let wbits = Number(n &
|
43245
|
+
let wbits = Number(n & mask);
|
43439
43246
|
n >>= shiftBy;
|
43440
43247
|
if (wbits > windowSize) {
|
43441
43248
|
wbits -= maxNumber;
|
@@ -46776,38 +46583,6 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46776
46583
|
})(Language || {});
|
46777
46584
|
|
46778
46585
|
// src/mnemonic/utils.ts
|
46779
|
-
function toUtf8Bytes2(stri) {
|
46780
|
-
const str = stri.normalize("NFKD");
|
46781
|
-
const result = [];
|
46782
|
-
for (let i = 0; i < str.length; i += 1) {
|
46783
|
-
const c = str.charCodeAt(i);
|
46784
|
-
if (c < 128) {
|
46785
|
-
result.push(c);
|
46786
|
-
} else if (c < 2048) {
|
46787
|
-
result.push(c >> 6 | 192);
|
46788
|
-
result.push(c & 63 | 128);
|
46789
|
-
} else if ((c & 64512) === 55296) {
|
46790
|
-
i += 1;
|
46791
|
-
const c2 = str.charCodeAt(i);
|
46792
|
-
if (i >= str.length || (c2 & 64512) !== 56320) {
|
46793
|
-
throw new FuelError(
|
46794
|
-
ErrorCode.INVALID_INPUT_PARAMETERS,
|
46795
|
-
"Invalid UTF-8 in the input string."
|
46796
|
-
);
|
46797
|
-
}
|
46798
|
-
const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
|
46799
|
-
result.push(pair >> 18 | 240);
|
46800
|
-
result.push(pair >> 12 & 63 | 128);
|
46801
|
-
result.push(pair >> 6 & 63 | 128);
|
46802
|
-
result.push(pair & 63 | 128);
|
46803
|
-
} else {
|
46804
|
-
result.push(c >> 12 | 224);
|
46805
|
-
result.push(c >> 6 & 63 | 128);
|
46806
|
-
result.push(c & 63 | 128);
|
46807
|
-
}
|
46808
|
-
}
|
46809
|
-
return Uint8Array.from(result);
|
46810
|
-
}
|
46811
46586
|
function getLowerMask(bits) {
|
46812
46587
|
return (1 << bits) - 1;
|
46813
46588
|
}
|
@@ -46880,7 +46655,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46880
46655
|
}
|
46881
46656
|
|
46882
46657
|
// src/mnemonic/mnemonic.ts
|
46883
|
-
var MasterSecret =
|
46658
|
+
var MasterSecret = toUtf8Bytes("Bitcoin seed");
|
46884
46659
|
var MainnetPRV = "0x0488ade4";
|
46885
46660
|
var TestnetPRV = "0x04358394";
|
46886
46661
|
var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
|
@@ -46964,8 +46739,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46964
46739
|
*/
|
46965
46740
|
static mnemonicToSeed(phrase, passphrase = "") {
|
46966
46741
|
assertMnemonic(getWords(phrase));
|
46967
|
-
const phraseBytes =
|
46968
|
-
const salt =
|
46742
|
+
const phraseBytes = toUtf8Bytes(getPhrase(phrase));
|
46743
|
+
const salt = toUtf8Bytes(`mnemonic${passphrase}`);
|
46969
46744
|
return pbkdf222(phraseBytes, salt, 2048, 64, "sha512");
|
46970
46745
|
}
|
46971
46746
|
/**
|
@@ -47593,7 +47368,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47593
47368
|
wallet_not_unlocked: "The wallet is currently locked.",
|
47594
47369
|
passphrase_not_match: "The provided passphrase did not match the expected value."
|
47595
47370
|
};
|
47596
|
-
function
|
47371
|
+
function assert(condition, message) {
|
47597
47372
|
if (!condition) {
|
47598
47373
|
throw new FuelError(ErrorCode.WALLET_MANAGER_ERROR, message);
|
47599
47374
|
}
|
@@ -47636,9 +47411,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47636
47411
|
* the format of the return depends on the Vault type.
|
47637
47412
|
*/
|
47638
47413
|
exportVault(vaultId) {
|
47639
|
-
|
47414
|
+
assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
|
47640
47415
|
const vaultState = __privateGet(this, _vaults).find((_, idx) => idx === vaultId);
|
47641
|
-
|
47416
|
+
assert(vaultState, ERROR_MESSAGES.vault_not_found);
|
47642
47417
|
return vaultState.vault.serialize();
|
47643
47418
|
}
|
47644
47419
|
/**
|
@@ -47667,7 +47442,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47667
47442
|
const vaultState = __privateGet(this, _vaults).find(
|
47668
47443
|
(vs) => vs.vault.getAccounts().find((a) => a.address.equals(ownerAddress))
|
47669
47444
|
);
|
47670
|
-
|
47445
|
+
assert(vaultState, ERROR_MESSAGES.address_not_found);
|
47671
47446
|
return vaultState.vault.getWallet(ownerAddress);
|
47672
47447
|
}
|
47673
47448
|
/**
|
@@ -47675,11 +47450,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47675
47450
|
*/
|
47676
47451
|
exportPrivateKey(address) {
|
47677
47452
|
const ownerAddress = Address.fromAddressOrString(address);
|
47678
|
-
|
47453
|
+
assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
|
47679
47454
|
const vaultState = __privateGet(this, _vaults).find(
|
47680
47455
|
(vs) => vs.vault.getAccounts().find((a) => a.address.equals(ownerAddress))
|
47681
47456
|
);
|
47682
|
-
|
47457
|
+
assert(vaultState, ERROR_MESSAGES.address_not_found);
|
47683
47458
|
return vaultState.vault.exportAccount(ownerAddress);
|
47684
47459
|
}
|
47685
47460
|
/**
|
@@ -47689,7 +47464,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47689
47464
|
async addAccount(options) {
|
47690
47465
|
await this.loadState();
|
47691
47466
|
const vaultState = __privateGet(this, _vaults)[options?.vaultId || 0];
|
47692
|
-
await
|
47467
|
+
await assert(vaultState, ERROR_MESSAGES.vault_not_found);
|
47693
47468
|
const account = vaultState.vault.addAccount();
|
47694
47469
|
await this.saveState();
|
47695
47470
|
return account;
|
@@ -47759,7 +47534,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47759
47534
|
* Retrieve and decrypt WalletManager state from storage
|
47760
47535
|
*/
|
47761
47536
|
async loadState() {
|
47762
|
-
await
|
47537
|
+
await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
|
47763
47538
|
const data = await this.storage.getItem(this.STORAGE_KEY);
|
47764
47539
|
if (data) {
|
47765
47540
|
const state = await decrypt2(__privateGet(this, _passphrase), JSON.parse(data));
|
@@ -47770,7 +47545,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47770
47545
|
* Store encrypted WalletManager state on storage
|
47771
47546
|
*/
|
47772
47547
|
async saveState() {
|
47773
|
-
await
|
47548
|
+
await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
|
47774
47549
|
const encryptedData = await encrypt2(__privateGet(this, _passphrase), {
|
47775
47550
|
vaults: __privateMethod(this, _serializeVaults, serializeVaults_fn).call(this, __privateGet(this, _vaults))
|
47776
47551
|
});
|
@@ -47782,7 +47557,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47782
47557
|
*/
|
47783
47558
|
getVaultClass(type3) {
|
47784
47559
|
const VaultClass = _WalletManager.Vaults.find((v) => v.type === type3);
|
47785
|
-
|
47560
|
+
assert(VaultClass, ERROR_MESSAGES.invalid_vault_type);
|
47786
47561
|
return VaultClass;
|
47787
47562
|
}
|
47788
47563
|
};
|