@fuel-ts/account 0.0.0-rc-2408-20240620125747 → 0.0.0-rc-2408-20240620151941
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 +807 -403
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -2
- package/dist/index.mjs.map +1 -1
- package/dist/providers/provider.d.ts +4 -0
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/test-utils.global.js +808 -404
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +16 -2
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +16 -2
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
@@ -76,20 +76,20 @@
|
|
76
76
|
ctor.prototype = new TempCtor();
|
77
77
|
ctor.prototype.constructor = ctor;
|
78
78
|
}
|
79
|
-
function BN2(
|
80
|
-
if (BN2.isBN(
|
81
|
-
return
|
79
|
+
function BN2(number3, base, endian) {
|
80
|
+
if (BN2.isBN(number3)) {
|
81
|
+
return number3;
|
82
82
|
}
|
83
83
|
this.negative = 0;
|
84
84
|
this.words = null;
|
85
85
|
this.length = 0;
|
86
86
|
this.red = null;
|
87
|
-
if (
|
87
|
+
if (number3 !== null) {
|
88
88
|
if (base === "le" || base === "be") {
|
89
89
|
endian = base;
|
90
90
|
base = 10;
|
91
91
|
}
|
92
|
-
this._init(
|
92
|
+
this._init(number3 || 0, base || 10, endian || "be");
|
93
93
|
}
|
94
94
|
}
|
95
95
|
if (typeof module2 === "object") {
|
@@ -124,53 +124,53 @@
|
|
124
124
|
return left;
|
125
125
|
return right;
|
126
126
|
};
|
127
|
-
BN2.prototype._init = function init(
|
128
|
-
if (typeof
|
129
|
-
return this._initNumber(
|
127
|
+
BN2.prototype._init = function init(number3, base, endian) {
|
128
|
+
if (typeof number3 === "number") {
|
129
|
+
return this._initNumber(number3, base, endian);
|
130
130
|
}
|
131
|
-
if (typeof
|
132
|
-
return this._initArray(
|
131
|
+
if (typeof number3 === "object") {
|
132
|
+
return this._initArray(number3, base, endian);
|
133
133
|
}
|
134
134
|
if (base === "hex") {
|
135
135
|
base = 16;
|
136
136
|
}
|
137
137
|
assert(base === (base | 0) && base >= 2 && base <= 36);
|
138
|
-
|
138
|
+
number3 = number3.toString().replace(/\s+/g, "");
|
139
139
|
var start = 0;
|
140
|
-
if (
|
140
|
+
if (number3[0] === "-") {
|
141
141
|
start++;
|
142
142
|
this.negative = 1;
|
143
143
|
}
|
144
|
-
if (start <
|
144
|
+
if (start < number3.length) {
|
145
145
|
if (base === 16) {
|
146
|
-
this._parseHex(
|
146
|
+
this._parseHex(number3, start, endian);
|
147
147
|
} else {
|
148
|
-
this._parseBase(
|
148
|
+
this._parseBase(number3, base, start);
|
149
149
|
if (endian === "le") {
|
150
150
|
this._initArray(this.toArray(), base, endian);
|
151
151
|
}
|
152
152
|
}
|
153
153
|
}
|
154
154
|
};
|
155
|
-
BN2.prototype._initNumber = function _initNumber(
|
156
|
-
if (
|
155
|
+
BN2.prototype._initNumber = function _initNumber(number3, base, endian) {
|
156
|
+
if (number3 < 0) {
|
157
157
|
this.negative = 1;
|
158
|
-
|
158
|
+
number3 = -number3;
|
159
159
|
}
|
160
|
-
if (
|
161
|
-
this.words = [
|
160
|
+
if (number3 < 67108864) {
|
161
|
+
this.words = [number3 & 67108863];
|
162
162
|
this.length = 1;
|
163
|
-
} else if (
|
163
|
+
} else if (number3 < 4503599627370496) {
|
164
164
|
this.words = [
|
165
|
-
|
166
|
-
|
165
|
+
number3 & 67108863,
|
166
|
+
number3 / 67108864 & 67108863
|
167
167
|
];
|
168
168
|
this.length = 2;
|
169
169
|
} else {
|
170
|
-
assert(
|
170
|
+
assert(number3 < 9007199254740992);
|
171
171
|
this.words = [
|
172
|
-
|
173
|
-
|
172
|
+
number3 & 67108863,
|
173
|
+
number3 / 67108864 & 67108863,
|
174
174
|
1
|
175
175
|
];
|
176
176
|
this.length = 3;
|
@@ -179,14 +179,14 @@
|
|
179
179
|
return;
|
180
180
|
this._initArray(this.toArray(), base, endian);
|
181
181
|
};
|
182
|
-
BN2.prototype._initArray = function _initArray(
|
183
|
-
assert(typeof
|
184
|
-
if (
|
182
|
+
BN2.prototype._initArray = function _initArray(number3, base, endian) {
|
183
|
+
assert(typeof number3.length === "number");
|
184
|
+
if (number3.length <= 0) {
|
185
185
|
this.words = [0];
|
186
186
|
this.length = 1;
|
187
187
|
return this;
|
188
188
|
}
|
189
|
-
this.length = Math.ceil(
|
189
|
+
this.length = Math.ceil(number3.length / 3);
|
190
190
|
this.words = new Array(this.length);
|
191
191
|
for (var i = 0; i < this.length; i++) {
|
192
192
|
this.words[i] = 0;
|
@@ -194,8 +194,8 @@
|
|
194
194
|
var j, w;
|
195
195
|
var off = 0;
|
196
196
|
if (endian === "be") {
|
197
|
-
for (i =
|
198
|
-
w =
|
197
|
+
for (i = number3.length - 1, j = 0; i >= 0; i -= 3) {
|
198
|
+
w = number3[i] | number3[i - 1] << 8 | number3[i - 2] << 16;
|
199
199
|
this.words[j] |= w << off & 67108863;
|
200
200
|
this.words[j + 1] = w >>> 26 - off & 67108863;
|
201
201
|
off += 24;
|
@@ -205,8 +205,8 @@
|
|
205
205
|
}
|
206
206
|
}
|
207
207
|
} else if (endian === "le") {
|
208
|
-
for (i = 0, j = 0; i <
|
209
|
-
w =
|
208
|
+
for (i = 0, j = 0; i < number3.length; i += 3) {
|
209
|
+
w = number3[i] | number3[i + 1] << 8 | number3[i + 2] << 16;
|
210
210
|
this.words[j] |= w << off & 67108863;
|
211
211
|
this.words[j + 1] = w >>> 26 - off & 67108863;
|
212
212
|
off += 24;
|
@@ -237,8 +237,8 @@
|
|
237
237
|
}
|
238
238
|
return r;
|
239
239
|
}
|
240
|
-
BN2.prototype._parseHex = function _parseHex(
|
241
|
-
this.length = Math.ceil((
|
240
|
+
BN2.prototype._parseHex = function _parseHex(number3, start, endian) {
|
241
|
+
this.length = Math.ceil((number3.length - start) / 6);
|
242
242
|
this.words = new Array(this.length);
|
243
243
|
for (var i = 0; i < this.length; i++) {
|
244
244
|
this.words[i] = 0;
|
@@ -247,8 +247,8 @@
|
|
247
247
|
var j = 0;
|
248
248
|
var w;
|
249
249
|
if (endian === "be") {
|
250
|
-
for (i =
|
251
|
-
w = parseHexByte(
|
250
|
+
for (i = number3.length - 1; i >= start; i -= 2) {
|
251
|
+
w = parseHexByte(number3, start, i) << off;
|
252
252
|
this.words[j] |= w & 67108863;
|
253
253
|
if (off >= 18) {
|
254
254
|
off -= 18;
|
@@ -259,9 +259,9 @@
|
|
259
259
|
}
|
260
260
|
}
|
261
261
|
} else {
|
262
|
-
var parseLength =
|
263
|
-
for (i = parseLength % 2 === 0 ? start + 1 : start; i <
|
264
|
-
w = parseHexByte(
|
262
|
+
var parseLength = number3.length - start;
|
263
|
+
for (i = parseLength % 2 === 0 ? start + 1 : start; i < number3.length; i += 2) {
|
264
|
+
w = parseHexByte(number3, start, i) << off;
|
265
265
|
this.words[j] |= w & 67108863;
|
266
266
|
if (off >= 18) {
|
267
267
|
off -= 18;
|
@@ -293,7 +293,7 @@
|
|
293
293
|
}
|
294
294
|
return r;
|
295
295
|
}
|
296
|
-
BN2.prototype._parseBase = function _parseBase(
|
296
|
+
BN2.prototype._parseBase = function _parseBase(number3, base, start) {
|
297
297
|
this.words = [0];
|
298
298
|
this.length = 1;
|
299
299
|
for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) {
|
@@ -301,12 +301,12 @@
|
|
301
301
|
}
|
302
302
|
limbLen--;
|
303
303
|
limbPow = limbPow / base | 0;
|
304
|
-
var total =
|
304
|
+
var total = number3.length - start;
|
305
305
|
var mod2 = total % limbLen;
|
306
306
|
var end = Math.min(total, total - mod2) + start;
|
307
307
|
var word = 0;
|
308
308
|
for (var i = start; i < end; i += limbLen) {
|
309
|
-
word = parseBase(
|
309
|
+
word = parseBase(number3, i, i + limbLen, base);
|
310
310
|
this.imuln(limbPow);
|
311
311
|
if (this.words[0] + word < 67108864) {
|
312
312
|
this.words[0] += word;
|
@@ -316,7 +316,7 @@
|
|
316
316
|
}
|
317
317
|
if (mod2 !== 0) {
|
318
318
|
var pow3 = 1;
|
319
|
-
word = parseBase(
|
319
|
+
word = parseBase(number3, i, number3.length, base);
|
320
320
|
for (i = 0; i < mod2; i++) {
|
321
321
|
pow3 *= base;
|
322
322
|
}
|
@@ -2642,20 +2642,20 @@
|
|
2642
2642
|
);
|
2643
2643
|
}
|
2644
2644
|
inherits(K256, MPrime);
|
2645
|
-
K256.prototype.split = function split2(input,
|
2645
|
+
K256.prototype.split = function split2(input, output3) {
|
2646
2646
|
var mask = 4194303;
|
2647
2647
|
var outLen = Math.min(input.length, 9);
|
2648
2648
|
for (var i = 0; i < outLen; i++) {
|
2649
|
-
|
2649
|
+
output3.words[i] = input.words[i];
|
2650
2650
|
}
|
2651
|
-
|
2651
|
+
output3.length = outLen;
|
2652
2652
|
if (input.length <= 9) {
|
2653
2653
|
input.words[0] = 0;
|
2654
2654
|
input.length = 1;
|
2655
2655
|
return;
|
2656
2656
|
}
|
2657
2657
|
var prev = input.words[9];
|
2658
|
-
|
2658
|
+
output3.words[output3.length++] = prev & mask;
|
2659
2659
|
for (i = 10; i < input.length; i++) {
|
2660
2660
|
var next = input.words[i] | 0;
|
2661
2661
|
input.words[i - 10] = (next & mask) << 4 | prev >>> 22;
|
@@ -3051,8 +3051,8 @@
|
|
3051
3051
|
}
|
3052
3052
|
return result;
|
3053
3053
|
}
|
3054
|
-
function toWords(
|
3055
|
-
return convert2(
|
3054
|
+
function toWords(bytes3) {
|
3055
|
+
return convert2(bytes3, 8, 5, true);
|
3056
3056
|
}
|
3057
3057
|
function fromWordsUnsafe(words) {
|
3058
3058
|
const res = convert2(words, 5, 8, false);
|
@@ -3591,18 +3591,18 @@
|
|
3591
3591
|
}
|
3592
3592
|
function utf8PercentDecode(str) {
|
3593
3593
|
const input = new Buffer(str);
|
3594
|
-
const
|
3594
|
+
const output3 = [];
|
3595
3595
|
for (let i = 0; i < input.length; ++i) {
|
3596
3596
|
if (input[i] !== 37) {
|
3597
|
-
|
3597
|
+
output3.push(input[i]);
|
3598
3598
|
} else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) {
|
3599
|
-
|
3599
|
+
output3.push(parseInt(input.slice(i + 1, i + 3).toString(), 16));
|
3600
3600
|
i += 2;
|
3601
3601
|
} else {
|
3602
|
-
|
3602
|
+
output3.push(input[i]);
|
3603
3603
|
}
|
3604
3604
|
}
|
3605
|
-
return new Buffer(
|
3605
|
+
return new Buffer(output3).toString();
|
3606
3606
|
}
|
3607
3607
|
function isC0ControlPercentEncode(c) {
|
3608
3608
|
return c <= 31 || c > 126;
|
@@ -3678,16 +3678,16 @@
|
|
3678
3678
|
return ipv4;
|
3679
3679
|
}
|
3680
3680
|
function serializeIPv4(address) {
|
3681
|
-
let
|
3681
|
+
let output3 = "";
|
3682
3682
|
let n = address;
|
3683
3683
|
for (let i = 1; i <= 4; ++i) {
|
3684
|
-
|
3684
|
+
output3 = String(n % 256) + output3;
|
3685
3685
|
if (i !== 4) {
|
3686
|
-
|
3686
|
+
output3 = "." + output3;
|
3687
3687
|
}
|
3688
3688
|
n = Math.floor(n / 256);
|
3689
3689
|
}
|
3690
|
-
return
|
3690
|
+
return output3;
|
3691
3691
|
}
|
3692
3692
|
function parseIPv6(input) {
|
3693
3693
|
const address = [0, 0, 0, 0, 0, 0, 0, 0];
|
@@ -3745,13 +3745,13 @@
|
|
3745
3745
|
return failure;
|
3746
3746
|
}
|
3747
3747
|
while (isASCIIDigit(input[pointer])) {
|
3748
|
-
const
|
3748
|
+
const number3 = parseInt(at(input, pointer));
|
3749
3749
|
if (ipv4Piece === null) {
|
3750
|
-
ipv4Piece =
|
3750
|
+
ipv4Piece = number3;
|
3751
3751
|
} else if (ipv4Piece === 0) {
|
3752
3752
|
return failure;
|
3753
3753
|
} else {
|
3754
|
-
ipv4Piece = ipv4Piece * 10 +
|
3754
|
+
ipv4Piece = ipv4Piece * 10 + number3;
|
3755
3755
|
}
|
3756
3756
|
if (ipv4Piece > 255) {
|
3757
3757
|
return failure;
|
@@ -3795,7 +3795,7 @@
|
|
3795
3795
|
return address;
|
3796
3796
|
}
|
3797
3797
|
function serializeIPv6(address) {
|
3798
|
-
let
|
3798
|
+
let output3 = "";
|
3799
3799
|
const seqResult = findLongestZeroSequence(address);
|
3800
3800
|
const compress = seqResult.idx;
|
3801
3801
|
let ignore0 = false;
|
@@ -3807,16 +3807,16 @@
|
|
3807
3807
|
}
|
3808
3808
|
if (compress === pieceIndex) {
|
3809
3809
|
const separator = pieceIndex === 0 ? "::" : ":";
|
3810
|
-
|
3810
|
+
output3 += separator;
|
3811
3811
|
ignore0 = true;
|
3812
3812
|
continue;
|
3813
3813
|
}
|
3814
|
-
|
3814
|
+
output3 += address[pieceIndex].toString(16);
|
3815
3815
|
if (pieceIndex !== 7) {
|
3816
|
-
|
3816
|
+
output3 += ":";
|
3817
3817
|
}
|
3818
3818
|
}
|
3819
|
-
return
|
3819
|
+
return output3;
|
3820
3820
|
}
|
3821
3821
|
function parseHost(input, isSpecialArg) {
|
3822
3822
|
if (input[0] === "[") {
|
@@ -3846,12 +3846,12 @@
|
|
3846
3846
|
if (containsForbiddenHostCodePointExcludingPercent(input)) {
|
3847
3847
|
return failure;
|
3848
3848
|
}
|
3849
|
-
let
|
3849
|
+
let output3 = "";
|
3850
3850
|
const decoded = punycode.ucs2.decode(input);
|
3851
3851
|
for (let i = 0; i < decoded.length; ++i) {
|
3852
|
-
|
3852
|
+
output3 += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
|
3853
3853
|
}
|
3854
|
-
return
|
3854
|
+
return output3;
|
3855
3855
|
}
|
3856
3856
|
function findLongestZeroSequence(arr) {
|
3857
3857
|
let maxIdx = null;
|
@@ -4476,37 +4476,37 @@
|
|
4476
4476
|
return true;
|
4477
4477
|
};
|
4478
4478
|
function serializeURL(url, excludeFragment) {
|
4479
|
-
let
|
4479
|
+
let output3 = url.scheme + ":";
|
4480
4480
|
if (url.host !== null) {
|
4481
|
-
|
4481
|
+
output3 += "//";
|
4482
4482
|
if (url.username !== "" || url.password !== "") {
|
4483
|
-
|
4483
|
+
output3 += url.username;
|
4484
4484
|
if (url.password !== "") {
|
4485
|
-
|
4485
|
+
output3 += ":" + url.password;
|
4486
4486
|
}
|
4487
|
-
|
4487
|
+
output3 += "@";
|
4488
4488
|
}
|
4489
|
-
|
4489
|
+
output3 += serializeHost(url.host);
|
4490
4490
|
if (url.port !== null) {
|
4491
|
-
|
4491
|
+
output3 += ":" + url.port;
|
4492
4492
|
}
|
4493
4493
|
} else if (url.host === null && url.scheme === "file") {
|
4494
|
-
|
4494
|
+
output3 += "//";
|
4495
4495
|
}
|
4496
4496
|
if (url.cannotBeABaseURL) {
|
4497
|
-
|
4497
|
+
output3 += url.path[0];
|
4498
4498
|
} else {
|
4499
4499
|
for (const string of url.path) {
|
4500
|
-
|
4500
|
+
output3 += "/" + string;
|
4501
4501
|
}
|
4502
4502
|
}
|
4503
4503
|
if (url.query !== null) {
|
4504
|
-
|
4504
|
+
output3 += "?" + url.query;
|
4505
4505
|
}
|
4506
4506
|
if (!excludeFragment && url.fragment !== null) {
|
4507
|
-
|
4507
|
+
output3 += "#" + url.fragment;
|
4508
4508
|
}
|
4509
|
-
return
|
4509
|
+
return output3;
|
4510
4510
|
}
|
4511
4511
|
function serializeOrigin(tuple) {
|
4512
4512
|
let result = tuple.scheme + "://";
|
@@ -6450,19 +6450,19 @@
|
|
6450
6450
|
return "GraphQLError";
|
6451
6451
|
}
|
6452
6452
|
toString() {
|
6453
|
-
let
|
6453
|
+
let output3 = this.message;
|
6454
6454
|
if (this.nodes) {
|
6455
6455
|
for (const node of this.nodes) {
|
6456
6456
|
if (node.loc) {
|
6457
|
-
|
6457
|
+
output3 += "\n\n" + (0, _printLocation.printLocation)(node.loc);
|
6458
6458
|
}
|
6459
6459
|
}
|
6460
6460
|
} else if (this.source && this.locations) {
|
6461
6461
|
for (const location of this.locations) {
|
6462
|
-
|
6462
|
+
output3 += "\n\n" + (0, _printLocation.printSourceLocation)(this.source, location);
|
6463
6463
|
}
|
6464
6464
|
}
|
6465
|
-
return
|
6465
|
+
return output3;
|
6466
6466
|
}
|
6467
6467
|
toJSON() {
|
6468
6468
|
const formattedError = {
|
@@ -18777,7 +18777,7 @@ spurious results.`);
|
|
18777
18777
|
module.exports = iterate;
|
18778
18778
|
function iterate(list, iterator, state, callback) {
|
18779
18779
|
var key = state["keyedList"] ? state["keyedList"][state.index] : state.index;
|
18780
|
-
state.jobs[key] = runJob(iterator, key, list[key], function(error,
|
18780
|
+
state.jobs[key] = runJob(iterator, key, list[key], function(error, output3) {
|
18781
18781
|
if (!(key in state.jobs)) {
|
18782
18782
|
return;
|
18783
18783
|
}
|
@@ -18785,7 +18785,7 @@ spurious results.`);
|
|
18785
18785
|
if (error) {
|
18786
18786
|
abort(state);
|
18787
18787
|
} else {
|
18788
|
-
state.results[key] =
|
18788
|
+
state.results[key] = output3;
|
18789
18789
|
}
|
18790
18790
|
callback(error, state.results);
|
18791
18791
|
});
|
@@ -20547,8 +20547,8 @@ spurious results.`);
|
|
20547
20547
|
const ret3 = wasm$1.retd(addr, len);
|
20548
20548
|
return Instruction.__wrap(ret3);
|
20549
20549
|
}
|
20550
|
-
function aloc(
|
20551
|
-
const ret3 = wasm$1.aloc(
|
20550
|
+
function aloc(bytes3) {
|
20551
|
+
const ret3 = wasm$1.aloc(bytes3);
|
20552
20552
|
return Instruction.__wrap(ret3);
|
20553
20553
|
}
|
20554
20554
|
function mcl(dst_addr, len) {
|
@@ -21757,9 +21757,9 @@ spurious results.`);
|
|
21757
21757
|
* Construct the instruction from its parts.
|
21758
21758
|
* @param {RegId} bytes
|
21759
21759
|
*/
|
21760
|
-
constructor(
|
21761
|
-
_assertClass(
|
21762
|
-
var ptr0 =
|
21760
|
+
constructor(bytes3) {
|
21761
|
+
_assertClass(bytes3, RegId);
|
21762
|
+
var ptr0 = bytes3.__destroy_into_raw();
|
21763
21763
|
const ret3 = wasm$1.aloc_new_typescript(ptr0);
|
21764
21764
|
this.__wbg_ptr = ret3 >>> 0;
|
21765
21765
|
return this;
|
@@ -28296,8 +28296,8 @@ spurious results.`);
|
|
28296
28296
|
}
|
28297
28297
|
}
|
28298
28298
|
}
|
28299
|
-
const
|
28300
|
-
return await WebAssembly.instantiate(
|
28299
|
+
const bytes3 = await module2.arrayBuffer();
|
28300
|
+
return await WebAssembly.instantiate(bytes3, imports);
|
28301
28301
|
} else {
|
28302
28302
|
const instance = await WebAssembly.instantiate(module2, imports);
|
28303
28303
|
if (instance instanceof WebAssembly.Instance) {
|
@@ -30702,12 +30702,12 @@ spurious results.`);
|
|
30702
30702
|
createDebug.skips = [];
|
30703
30703
|
createDebug.formatters = {};
|
30704
30704
|
function selectColor(namespace) {
|
30705
|
-
var
|
30705
|
+
var hash4 = 0;
|
30706
30706
|
for (var i = 0; i < namespace.length; i++) {
|
30707
|
-
|
30708
|
-
|
30707
|
+
hash4 = (hash4 << 5) - hash4 + namespace.charCodeAt(i);
|
30708
|
+
hash4 |= 0;
|
30709
30709
|
}
|
30710
|
-
return createDebug.colors[Math.abs(
|
30710
|
+
return createDebug.colors[Math.abs(hash4) % createDebug.colors.length];
|
30711
30711
|
}
|
30712
30712
|
createDebug.selectColor = selectColor;
|
30713
30713
|
function createDebug(namespace) {
|
@@ -31609,11 +31609,11 @@ spurious results.`);
|
|
31609
31609
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
31610
31610
|
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
31611
31611
|
}
|
31612
|
-
function hash(
|
31613
|
-
if (typeof
|
31612
|
+
function hash(hash4) {
|
31613
|
+
if (typeof hash4 !== "function" || typeof hash4.create !== "function")
|
31614
31614
|
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
31615
|
-
number(
|
31616
|
-
number(
|
31615
|
+
number(hash4.outputLen);
|
31616
|
+
number(hash4.blockLen);
|
31617
31617
|
}
|
31618
31618
|
function exists(instance, checkFinished = true) {
|
31619
31619
|
if (instance.destroyed)
|
@@ -31629,10 +31629,6 @@ spurious results.`);
|
|
31629
31629
|
}
|
31630
31630
|
}
|
31631
31631
|
|
31632
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
|
31633
|
-
var nc = __toESM(__require("crypto"), 1);
|
31634
|
-
var crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : void 0;
|
31635
|
-
|
31636
31632
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js
|
31637
31633
|
var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
31638
31634
|
function isBytes2(a) {
|
@@ -31655,22 +31651,6 @@ spurious results.`);
|
|
31655
31651
|
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
31656
31652
|
return data;
|
31657
31653
|
}
|
31658
|
-
function concatBytes(...arrays) {
|
31659
|
-
let sum = 0;
|
31660
|
-
for (let i = 0; i < arrays.length; i++) {
|
31661
|
-
const a = arrays[i];
|
31662
|
-
if (!isBytes2(a))
|
31663
|
-
throw new Error("Uint8Array expected");
|
31664
|
-
sum += a.length;
|
31665
|
-
}
|
31666
|
-
const res = new Uint8Array(sum);
|
31667
|
-
for (let i = 0, pad3 = 0; i < arrays.length; i++) {
|
31668
|
-
const a = arrays[i];
|
31669
|
-
res.set(a, pad3);
|
31670
|
-
pad3 += a.length;
|
31671
|
-
}
|
31672
|
-
return res;
|
31673
|
-
}
|
31674
31654
|
var Hash = class {
|
31675
31655
|
// Safe version that clones internal state
|
31676
31656
|
clone() {
|
@@ -31700,33 +31680,27 @@ spurious results.`);
|
|
31700
31680
|
hashC.create = (opts) => hashCons(opts);
|
31701
31681
|
return hashC;
|
31702
31682
|
}
|
31703
|
-
function randomBytes(bytesLength = 32) {
|
31704
|
-
if (crypto && typeof crypto.getRandomValues === "function") {
|
31705
|
-
return crypto.getRandomValues(new Uint8Array(bytesLength));
|
31706
|
-
}
|
31707
|
-
throw new Error("crypto.getRandomValues must be defined");
|
31708
|
-
}
|
31709
31683
|
|
31710
31684
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.js
|
31711
|
-
function setBigUint64(view, byteOffset, value,
|
31685
|
+
function setBigUint64(view, byteOffset, value, isLE3) {
|
31712
31686
|
if (typeof view.setBigUint64 === "function")
|
31713
|
-
return view.setBigUint64(byteOffset, value,
|
31687
|
+
return view.setBigUint64(byteOffset, value, isLE3);
|
31714
31688
|
const _32n2 = BigInt(32);
|
31715
31689
|
const _u32_max = BigInt(4294967295);
|
31716
31690
|
const wh = Number(value >> _32n2 & _u32_max);
|
31717
31691
|
const wl = Number(value & _u32_max);
|
31718
|
-
const h =
|
31719
|
-
const l =
|
31720
|
-
view.setUint32(byteOffset + h, wh,
|
31721
|
-
view.setUint32(byteOffset + l, wl,
|
31692
|
+
const h = isLE3 ? 4 : 0;
|
31693
|
+
const l = isLE3 ? 0 : 4;
|
31694
|
+
view.setUint32(byteOffset + h, wh, isLE3);
|
31695
|
+
view.setUint32(byteOffset + l, wl, isLE3);
|
31722
31696
|
}
|
31723
31697
|
var SHA2 = class extends Hash {
|
31724
|
-
constructor(blockLen, outputLen, padOffset,
|
31698
|
+
constructor(blockLen, outputLen, padOffset, isLE3) {
|
31725
31699
|
super();
|
31726
31700
|
this.blockLen = blockLen;
|
31727
31701
|
this.outputLen = outputLen;
|
31728
31702
|
this.padOffset = padOffset;
|
31729
|
-
this.isLE =
|
31703
|
+
this.isLE = isLE3;
|
31730
31704
|
this.finished = false;
|
31731
31705
|
this.length = 0;
|
31732
31706
|
this.pos = 0;
|
@@ -31763,7 +31737,7 @@ spurious results.`);
|
|
31763
31737
|
exists(this);
|
31764
31738
|
output(out, this);
|
31765
31739
|
this.finished = true;
|
31766
|
-
const { buffer, view, blockLen, isLE:
|
31740
|
+
const { buffer, view, blockLen, isLE: isLE3 } = this;
|
31767
31741
|
let { pos } = this;
|
31768
31742
|
buffer[pos++] = 128;
|
31769
31743
|
this.buffer.subarray(pos).fill(0);
|
@@ -31773,7 +31747,7 @@ spurious results.`);
|
|
31773
31747
|
}
|
31774
31748
|
for (let i = pos; i < blockLen; i++)
|
31775
31749
|
buffer[i] = 0;
|
31776
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8),
|
31750
|
+
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE3);
|
31777
31751
|
this.process(view, 0);
|
31778
31752
|
const oview = createView(out);
|
31779
31753
|
const len = this.outputLen;
|
@@ -31784,7 +31758,7 @@ spurious results.`);
|
|
31784
31758
|
if (outLen > state.length)
|
31785
31759
|
throw new Error("_sha2: outputLen bigger than state");
|
31786
31760
|
for (let i = 0; i < outLen; i++)
|
31787
|
-
oview.setUint32(4 * i, state[i],
|
31761
|
+
oview.setUint32(4 * i, state[i], isLE3);
|
31788
31762
|
}
|
31789
31763
|
digest() {
|
31790
31764
|
const { buffer, outputLen } = this;
|
@@ -31961,24 +31935,24 @@ spurious results.`);
|
|
31961
31935
|
|
31962
31936
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/hmac.js
|
31963
31937
|
var HMAC = class extends Hash {
|
31964
|
-
constructor(
|
31938
|
+
constructor(hash4, _key) {
|
31965
31939
|
super();
|
31966
31940
|
this.finished = false;
|
31967
31941
|
this.destroyed = false;
|
31968
|
-
hash(
|
31942
|
+
hash(hash4);
|
31969
31943
|
const key = toBytes(_key);
|
31970
|
-
this.iHash =
|
31944
|
+
this.iHash = hash4.create();
|
31971
31945
|
if (typeof this.iHash.update !== "function")
|
31972
31946
|
throw new Error("Expected instance of class which extends utils.Hash");
|
31973
31947
|
this.blockLen = this.iHash.blockLen;
|
31974
31948
|
this.outputLen = this.iHash.outputLen;
|
31975
31949
|
const blockLen = this.blockLen;
|
31976
31950
|
const pad3 = new Uint8Array(blockLen);
|
31977
|
-
pad3.set(key.length > blockLen ?
|
31951
|
+
pad3.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
|
31978
31952
|
for (let i = 0; i < pad3.length; i++)
|
31979
31953
|
pad3[i] ^= 54;
|
31980
31954
|
this.iHash.update(pad3);
|
31981
|
-
this.oHash =
|
31955
|
+
this.oHash = hash4.create();
|
31982
31956
|
for (let i = 0; i < pad3.length; i++)
|
31983
31957
|
pad3[i] ^= 54 ^ 92;
|
31984
31958
|
this.oHash.update(pad3);
|
@@ -32021,12 +31995,12 @@ spurious results.`);
|
|
32021
31995
|
this.iHash.destroy();
|
32022
31996
|
}
|
32023
31997
|
};
|
32024
|
-
var hmac = (
|
32025
|
-
hmac.create = (
|
31998
|
+
var hmac = (hash4, key, message) => new HMAC(hash4, key).update(message).digest();
|
31999
|
+
hmac.create = (hash4, key) => new HMAC(hash4, key);
|
32026
32000
|
|
32027
32001
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/pbkdf2.js
|
32028
|
-
function pbkdf2Init(
|
32029
|
-
hash(
|
32002
|
+
function pbkdf2Init(hash4, _password, _salt, _opts) {
|
32003
|
+
hash(hash4);
|
32030
32004
|
const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
|
32031
32005
|
const { c, dkLen, asyncTick } = opts;
|
32032
32006
|
number(c);
|
@@ -32037,7 +32011,7 @@ spurious results.`);
|
|
32037
32011
|
const password = toBytes(_password);
|
32038
32012
|
const salt = toBytes(_salt);
|
32039
32013
|
const DK = new Uint8Array(dkLen);
|
32040
|
-
const PRF = hmac.create(
|
32014
|
+
const PRF = hmac.create(hash4, password);
|
32041
32015
|
const PRFSalt = PRF._cloneInto().update(salt);
|
32042
32016
|
return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
|
32043
32017
|
}
|
@@ -32049,8 +32023,8 @@ spurious results.`);
|
|
32049
32023
|
u.fill(0);
|
32050
32024
|
return DK;
|
32051
32025
|
}
|
32052
|
-
function pbkdf2(
|
32053
|
-
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(
|
32026
|
+
function pbkdf2(hash4, password, salt, opts) {
|
32027
|
+
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash4, password, salt, opts);
|
32054
32028
|
let prfW;
|
32055
32029
|
const arr = new Uint8Array(4);
|
32056
32030
|
const view = createView(arr);
|
@@ -32377,9 +32351,9 @@ spurious results.`);
|
|
32377
32351
|
throw new Error("XOF is not possible for this instance");
|
32378
32352
|
return this.writeInto(out);
|
32379
32353
|
}
|
32380
|
-
xof(
|
32381
|
-
number(
|
32382
|
-
return this.xofInto(new Uint8Array(
|
32354
|
+
xof(bytes3) {
|
32355
|
+
number(bytes3);
|
32356
|
+
return this.xofInto(new Uint8Array(bytes3));
|
32383
32357
|
}
|
32384
32358
|
digestInto(out) {
|
32385
32359
|
output(out, this);
|
@@ -32630,15 +32604,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32630
32604
|
// ANCHOR: HELPERS
|
32631
32605
|
// make sure we always include `0x` in hex strings
|
32632
32606
|
toString(base, length) {
|
32633
|
-
const
|
32607
|
+
const output3 = super.toString(base, length);
|
32634
32608
|
if (base === 16 || base === "hex") {
|
32635
|
-
return `0x${
|
32609
|
+
return `0x${output3}`;
|
32636
32610
|
}
|
32637
|
-
return
|
32611
|
+
return output3;
|
32638
32612
|
}
|
32639
32613
|
toHex(bytesPadding) {
|
32640
|
-
const
|
32641
|
-
const bytesLength =
|
32614
|
+
const bytes3 = bytesPadding || 0;
|
32615
|
+
const bytesLength = bytes3 * 2;
|
32642
32616
|
if (this.isNeg()) {
|
32643
32617
|
throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to hex.");
|
32644
32618
|
}
|
@@ -32749,21 +32723,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32749
32723
|
// END ANCHOR: OVERRIDES to output our BN type
|
32750
32724
|
// ANCHOR: OVERRIDES to avoid losing references
|
32751
32725
|
caller(v, methodName) {
|
32752
|
-
const
|
32753
|
-
if (BN.isBN(
|
32754
|
-
return new BN(
|
32726
|
+
const output3 = super[methodName](new BN(v));
|
32727
|
+
if (BN.isBN(output3)) {
|
32728
|
+
return new BN(output3.toArray());
|
32755
32729
|
}
|
32756
|
-
if (typeof
|
32757
|
-
return
|
32730
|
+
if (typeof output3 === "boolean") {
|
32731
|
+
return output3;
|
32758
32732
|
}
|
32759
|
-
return
|
32733
|
+
return output3;
|
32760
32734
|
}
|
32761
32735
|
clone() {
|
32762
32736
|
return new BN(this.toArray());
|
32763
32737
|
}
|
32764
32738
|
mulTo(num, out) {
|
32765
|
-
const
|
32766
|
-
return new BN(
|
32739
|
+
const output3 = new import_bn.default(this.toArray()).mulTo(num, out);
|
32740
|
+
return new BN(output3.toArray());
|
32767
32741
|
}
|
32768
32742
|
egcd(p) {
|
32769
32743
|
const { a, b, gcd } = new import_bn.default(this.toArray()).egcd(p);
|
@@ -32842,7 +32816,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32842
32816
|
If you are attempting to transform a hex value, please make sure it is being passed as a string and wrapped in quotes.`;
|
32843
32817
|
throw new FuelError(ErrorCode.INVALID_DATA, message);
|
32844
32818
|
};
|
32845
|
-
var
|
32819
|
+
var concatBytes = (arrays) => {
|
32846
32820
|
const byteArrays = arrays.map((array) => {
|
32847
32821
|
if (array instanceof Uint8Array) {
|
32848
32822
|
return array;
|
@@ -32858,15 +32832,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32858
32832
|
return concatenated;
|
32859
32833
|
};
|
32860
32834
|
var concat = (arrays) => {
|
32861
|
-
const
|
32862
|
-
return
|
32835
|
+
const bytes3 = arrays.map((v) => arrayify(v));
|
32836
|
+
return concatBytes(bytes3);
|
32863
32837
|
};
|
32864
32838
|
var HexCharacters = "0123456789abcdef";
|
32865
32839
|
function hexlify(data) {
|
32866
|
-
const
|
32840
|
+
const bytes3 = arrayify(data);
|
32867
32841
|
let result = "0x";
|
32868
|
-
for (let i = 0; i <
|
32869
|
-
const v =
|
32842
|
+
for (let i = 0; i < bytes3.length; i++) {
|
32843
|
+
const v = bytes3[i];
|
32870
32844
|
result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15];
|
32871
32845
|
}
|
32872
32846
|
return result;
|
@@ -33748,15 +33722,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33748
33722
|
return bn(result);
|
33749
33723
|
}
|
33750
33724
|
function encodeBase58(_value) {
|
33751
|
-
const
|
33752
|
-
let value = bn(
|
33725
|
+
const bytes3 = arrayify(_value);
|
33726
|
+
let value = bn(bytes3);
|
33753
33727
|
let result = "";
|
33754
33728
|
while (value.gt(BN_0)) {
|
33755
33729
|
result = Alphabet[Number(value.mod(BN_58))] + result;
|
33756
33730
|
value = value.div(BN_58);
|
33757
33731
|
}
|
33758
|
-
for (let i = 0; i <
|
33759
|
-
if (
|
33732
|
+
for (let i = 0; i < bytes3.length; i++) {
|
33733
|
+
if (bytes3[i]) {
|
33760
33734
|
break;
|
33761
33735
|
}
|
33762
33736
|
result = Alphabet[0] + result;
|
@@ -33772,11 +33746,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33772
33746
|
return result;
|
33773
33747
|
}
|
33774
33748
|
function dataSlice(data, start, end) {
|
33775
|
-
const
|
33776
|
-
if (end != null && end >
|
33749
|
+
const bytes3 = arrayify(data);
|
33750
|
+
if (end != null && end > bytes3.length) {
|
33777
33751
|
throw new FuelError(ErrorCode.INVALID_DATA, "cannot slice beyond data bounds");
|
33778
33752
|
}
|
33779
|
-
return hexlify(
|
33753
|
+
return hexlify(bytes3.slice(start == null ? 0 : start, end == null ? bytes3.length : end));
|
33780
33754
|
}
|
33781
33755
|
function toUtf8Bytes(stri, form = true) {
|
33782
33756
|
let str = stri;
|
@@ -33813,8 +33787,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33813
33787
|
}
|
33814
33788
|
return new Uint8Array(result);
|
33815
33789
|
}
|
33816
|
-
function onError(reason, offset,
|
33817
|
-
console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${
|
33790
|
+
function onError(reason, offset, bytes3, output3, badCodepoint) {
|
33791
|
+
console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${bytes3}`);
|
33818
33792
|
return offset;
|
33819
33793
|
}
|
33820
33794
|
function helper(codePoints) {
|
@@ -33830,11 +33804,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33830
33804
|
}).join("");
|
33831
33805
|
}
|
33832
33806
|
function getUtf8CodePoints(_bytes) {
|
33833
|
-
const
|
33807
|
+
const bytes3 = arrayify(_bytes, "bytes");
|
33834
33808
|
const result = [];
|
33835
33809
|
let i = 0;
|
33836
|
-
while (i <
|
33837
|
-
const c =
|
33810
|
+
while (i < bytes3.length) {
|
33811
|
+
const c = bytes3[i++];
|
33838
33812
|
if (c >> 7 === 0) {
|
33839
33813
|
result.push(c);
|
33840
33814
|
continue;
|
@@ -33852,21 +33826,21 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33852
33826
|
overlongMask = 65535;
|
33853
33827
|
} else {
|
33854
33828
|
if ((c & 192) === 128) {
|
33855
|
-
i += onError("UNEXPECTED_CONTINUE", i - 1,
|
33829
|
+
i += onError("UNEXPECTED_CONTINUE", i - 1, bytes3, result);
|
33856
33830
|
} else {
|
33857
|
-
i += onError("BAD_PREFIX", i - 1,
|
33831
|
+
i += onError("BAD_PREFIX", i - 1, bytes3, result);
|
33858
33832
|
}
|
33859
33833
|
continue;
|
33860
33834
|
}
|
33861
|
-
if (i - 1 + extraLength >=
|
33862
|
-
i += onError("OVERRUN", i - 1,
|
33835
|
+
if (i - 1 + extraLength >= bytes3.length) {
|
33836
|
+
i += onError("OVERRUN", i - 1, bytes3, result);
|
33863
33837
|
continue;
|
33864
33838
|
}
|
33865
33839
|
let res = c & (1 << 8 - extraLength - 1) - 1;
|
33866
33840
|
for (let j = 0; j < extraLength; j++) {
|
33867
|
-
const nextChar =
|
33841
|
+
const nextChar = bytes3[i];
|
33868
33842
|
if ((nextChar & 192) !== 128) {
|
33869
|
-
i += onError("MISSING_CONTINUE", i,
|
33843
|
+
i += onError("MISSING_CONTINUE", i, bytes3, result);
|
33870
33844
|
res = null;
|
33871
33845
|
break;
|
33872
33846
|
}
|
@@ -33877,23 +33851,23 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33877
33851
|
continue;
|
33878
33852
|
}
|
33879
33853
|
if (res > 1114111) {
|
33880
|
-
i += onError("OUT_OF_RANGE", i - 1 - extraLength,
|
33854
|
+
i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes3, result, res);
|
33881
33855
|
continue;
|
33882
33856
|
}
|
33883
33857
|
if (res >= 55296 && res <= 57343) {
|
33884
|
-
i += onError("UTF16_SURROGATE", i - 1 - extraLength,
|
33858
|
+
i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes3, result, res);
|
33885
33859
|
continue;
|
33886
33860
|
}
|
33887
33861
|
if (res <= overlongMask) {
|
33888
|
-
i += onError("OVERLONG", i - 1 - extraLength,
|
33862
|
+
i += onError("OVERLONG", i - 1 - extraLength, bytes3, result, res);
|
33889
33863
|
continue;
|
33890
33864
|
}
|
33891
33865
|
result.push(res);
|
33892
33866
|
}
|
33893
33867
|
return result;
|
33894
33868
|
}
|
33895
|
-
function toUtf8String(
|
33896
|
-
return helper(getUtf8CodePoints(
|
33869
|
+
function toUtf8String(bytes3) {
|
33870
|
+
return helper(getUtf8CodePoints(bytes3));
|
33897
33871
|
}
|
33898
33872
|
|
33899
33873
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/ripemd160.js
|
@@ -33994,11 +33968,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33994
33968
|
var ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());
|
33995
33969
|
|
33996
33970
|
// ../crypto/dist/index.mjs
|
33997
|
-
var
|
33998
|
-
var
|
33971
|
+
var import_crypto = __toESM(__require("crypto"), 1);
|
33972
|
+
var import_crypto2 = __require("crypto");
|
33973
|
+
var import_crypto3 = __toESM(__require("crypto"), 1);
|
33999
33974
|
var import_crypto4 = __toESM(__require("crypto"), 1);
|
34000
|
-
var import_crypto5 =
|
34001
|
-
var import_crypto6 = __require("crypto");
|
33975
|
+
var import_crypto5 = __require("crypto");
|
34002
33976
|
var scrypt2 = (params) => {
|
34003
33977
|
const { password, salt, n, p, r, dklen } = params;
|
34004
33978
|
const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
|
@@ -34025,7 +33999,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34025
33999
|
Object.freeze(ripemd1602);
|
34026
34000
|
var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
|
34027
34001
|
var locked2 = false;
|
34028
|
-
var PBKDF2 = (password, salt, iterations, keylen, algo) => (0,
|
34002
|
+
var PBKDF2 = (password, salt, iterations, keylen, algo) => (0, import_crypto2.pbkdf2Sync)(password, salt, iterations, keylen, algo);
|
34029
34003
|
var pBkdf2 = PBKDF2;
|
34030
34004
|
function pbkdf22(_password, _salt, iterations, keylen, algo) {
|
34031
34005
|
const password = arrayify(_password, "password");
|
@@ -34043,8 +34017,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34043
34017
|
pBkdf2 = func;
|
34044
34018
|
};
|
34045
34019
|
Object.freeze(pbkdf22);
|
34046
|
-
var
|
34047
|
-
const randomValues = Uint8Array.from(
|
34020
|
+
var randomBytes = (length) => {
|
34021
|
+
const randomValues = Uint8Array.from(import_crypto3.default.randomBytes(length));
|
34048
34022
|
return randomValues;
|
34049
34023
|
};
|
34050
34024
|
var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
|
@@ -34055,11 +34029,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34055
34029
|
return arrayify(key);
|
34056
34030
|
};
|
34057
34031
|
var encrypt = async (password, data) => {
|
34058
|
-
const iv =
|
34059
|
-
const salt =
|
34032
|
+
const iv = randomBytes(16);
|
34033
|
+
const salt = randomBytes(32);
|
34060
34034
|
const secret = keyFromPassword(password, salt);
|
34061
34035
|
const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
|
34062
|
-
const cipher = await
|
34036
|
+
const cipher = await import_crypto.default.createCipheriv(ALGORITHM, secret, iv);
|
34063
34037
|
let cipherData = cipher.update(dataBuffer);
|
34064
34038
|
cipherData = Buffer.concat([cipherData, cipher.final()]);
|
34065
34039
|
return {
|
@@ -34073,7 +34047,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34073
34047
|
const salt = bufferFromString(keystore.salt);
|
34074
34048
|
const secret = keyFromPassword(password, salt);
|
34075
34049
|
const encryptedText = bufferFromString(keystore.data);
|
34076
|
-
const decipher = await
|
34050
|
+
const decipher = await import_crypto.default.createDecipheriv(ALGORITHM, secret, iv);
|
34077
34051
|
const decrypted = decipher.update(encryptedText);
|
34078
34052
|
const deBuff = Buffer.concat([decrypted, decipher.final()]);
|
34079
34053
|
const decryptedData = Buffer.from(deBuff).toString("utf-8");
|
@@ -34084,17 +34058,17 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34084
34058
|
}
|
34085
34059
|
};
|
34086
34060
|
async function encryptJsonWalletData(data, key, iv) {
|
34087
|
-
const cipher = await
|
34061
|
+
const cipher = await import_crypto4.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
34088
34062
|
const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
|
34089
34063
|
return new Uint8Array(encrypted);
|
34090
34064
|
}
|
34091
34065
|
async function decryptJsonWalletData(data, key, iv) {
|
34092
|
-
const decipher =
|
34066
|
+
const decipher = import_crypto4.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
34093
34067
|
const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
|
34094
34068
|
return new Uint8Array(decrypted);
|
34095
34069
|
}
|
34096
34070
|
var locked3 = false;
|
34097
|
-
var COMPUTEHMAC = (algorithm, key, data) => (0,
|
34071
|
+
var COMPUTEHMAC = (algorithm, key, data) => (0, import_crypto5.createHmac)(algorithm, key).update(data).digest();
|
34098
34072
|
var computeHMAC = COMPUTEHMAC;
|
34099
34073
|
function computeHmac(algorithm, _key, _data) {
|
34100
34074
|
const key = arrayify(_key, "key");
|
@@ -34118,7 +34092,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34118
34092
|
decrypt,
|
34119
34093
|
encrypt,
|
34120
34094
|
keyFromPassword,
|
34121
|
-
randomBytes
|
34095
|
+
randomBytes,
|
34122
34096
|
scrypt: scrypt2,
|
34123
34097
|
keccak256,
|
34124
34098
|
decryptJsonWalletData,
|
@@ -34133,7 +34107,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34133
34107
|
decrypt: decrypt2,
|
34134
34108
|
encrypt: encrypt2,
|
34135
34109
|
keyFromPassword: keyFromPassword2,
|
34136
|
-
randomBytes:
|
34110
|
+
randomBytes: randomBytes2,
|
34137
34111
|
stringFromBuffer: stringFromBuffer2,
|
34138
34112
|
scrypt: scrypt22,
|
34139
34113
|
keccak256: keccak2562,
|
@@ -34311,15 +34285,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34311
34285
|
if (data.length < this.encodedLength) {
|
34312
34286
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 data size.`);
|
34313
34287
|
}
|
34314
|
-
let
|
34315
|
-
const decoded = bn(
|
34288
|
+
let bytes3 = data.slice(offset, offset + this.encodedLength);
|
34289
|
+
const decoded = bn(bytes3);
|
34316
34290
|
if (decoded.isZero()) {
|
34317
|
-
|
34291
|
+
bytes3 = new Uint8Array(32);
|
34318
34292
|
}
|
34319
|
-
if (
|
34293
|
+
if (bytes3.length !== this.encodedLength) {
|
34320
34294
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 byte data size.`);
|
34321
34295
|
}
|
34322
|
-
return [toHex(
|
34296
|
+
return [toHex(bytes3, 32), offset + 32];
|
34323
34297
|
}
|
34324
34298
|
};
|
34325
34299
|
var B512Coder = class extends Coder {
|
@@ -34342,15 +34316,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34342
34316
|
if (data.length < this.encodedLength) {
|
34343
34317
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 data size.`);
|
34344
34318
|
}
|
34345
|
-
let
|
34346
|
-
const decoded = bn(
|
34319
|
+
let bytes3 = data.slice(offset, offset + this.encodedLength);
|
34320
|
+
const decoded = bn(bytes3);
|
34347
34321
|
if (decoded.isZero()) {
|
34348
|
-
|
34322
|
+
bytes3 = new Uint8Array(64);
|
34349
34323
|
}
|
34350
|
-
if (
|
34324
|
+
if (bytes3.length !== this.encodedLength) {
|
34351
34325
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 byte data size.`);
|
34352
34326
|
}
|
34353
|
-
return [toHex(
|
34327
|
+
return [toHex(bytes3, this.encodedLength), offset + this.encodedLength];
|
34354
34328
|
}
|
34355
34329
|
};
|
34356
34330
|
var encodedLengths = {
|
@@ -34362,24 +34336,24 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34362
34336
|
super("bigNumber", baseType, encodedLengths[baseType]);
|
34363
34337
|
}
|
34364
34338
|
encode(value) {
|
34365
|
-
let
|
34339
|
+
let bytes3;
|
34366
34340
|
try {
|
34367
|
-
|
34341
|
+
bytes3 = toBytes2(value, this.encodedLength);
|
34368
34342
|
} catch (error) {
|
34369
34343
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.type}.`);
|
34370
34344
|
}
|
34371
|
-
return
|
34345
|
+
return bytes3;
|
34372
34346
|
}
|
34373
34347
|
decode(data, offset) {
|
34374
34348
|
if (data.length < this.encodedLength) {
|
34375
34349
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} data size.`);
|
34376
34350
|
}
|
34377
|
-
let
|
34378
|
-
|
34379
|
-
if (
|
34351
|
+
let bytes3 = data.slice(offset, offset + this.encodedLength);
|
34352
|
+
bytes3 = bytes3.slice(0, this.encodedLength);
|
34353
|
+
if (bytes3.length !== this.encodedLength) {
|
34380
34354
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} byte data size.`);
|
34381
34355
|
}
|
34382
|
-
return [bn(
|
34356
|
+
return [bn(bytes3), offset + this.encodedLength];
|
34383
34357
|
}
|
34384
34358
|
};
|
34385
34359
|
var BooleanCoder = class extends Coder {
|
@@ -34402,11 +34376,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34402
34376
|
if (data.length < this.encodedLength) {
|
34403
34377
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
|
34404
34378
|
}
|
34405
|
-
const
|
34406
|
-
if (
|
34379
|
+
const bytes3 = bn(data.slice(offset, offset + this.encodedLength));
|
34380
|
+
if (bytes3.isZero()) {
|
34407
34381
|
return [false, offset + this.encodedLength];
|
34408
34382
|
}
|
34409
|
-
if (!
|
34383
|
+
if (!bytes3.eq(bn(1))) {
|
34410
34384
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean value.`);
|
34411
34385
|
}
|
34412
34386
|
return [true, offset + this.encodedLength];
|
@@ -34417,9 +34391,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34417
34391
|
super("struct", "struct Bytes", WORD_SIZE);
|
34418
34392
|
}
|
34419
34393
|
encode(value) {
|
34420
|
-
const
|
34421
|
-
const lengthBytes = new BigNumberCoder("u64").encode(
|
34422
|
-
return new Uint8Array([...lengthBytes, ...
|
34394
|
+
const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
34395
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
|
34396
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
34423
34397
|
}
|
34424
34398
|
decode(data, offset) {
|
34425
34399
|
if (data.length < WORD_SIZE) {
|
@@ -34546,26 +34520,26 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34546
34520
|
this.options = options;
|
34547
34521
|
}
|
34548
34522
|
encode(value) {
|
34549
|
-
let
|
34523
|
+
let bytes3;
|
34550
34524
|
try {
|
34551
|
-
|
34525
|
+
bytes3 = toBytes2(value);
|
34552
34526
|
} catch (error) {
|
34553
34527
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
|
34554
34528
|
}
|
34555
|
-
if (
|
34529
|
+
if (bytes3.length > this.encodedLength) {
|
34556
34530
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
|
34557
34531
|
}
|
34558
|
-
return toBytes2(
|
34532
|
+
return toBytes2(bytes3, this.encodedLength);
|
34559
34533
|
}
|
34560
34534
|
decode(data, offset) {
|
34561
34535
|
if (data.length < this.encodedLength) {
|
34562
34536
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number data size.`);
|
34563
34537
|
}
|
34564
|
-
const
|
34565
|
-
if (
|
34538
|
+
const bytes3 = data.slice(offset, offset + this.encodedLength);
|
34539
|
+
if (bytes3.length !== this.encodedLength) {
|
34566
34540
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
|
34567
34541
|
}
|
34568
|
-
return [toNumber(
|
34542
|
+
return [toNumber(bytes3), offset + this.encodedLength];
|
34569
34543
|
}
|
34570
34544
|
};
|
34571
34545
|
var OptionCoder = class extends EnumCoder {
|
@@ -34583,9 +34557,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34583
34557
|
const [decoded, newOffset] = super.decode(data, offset);
|
34584
34558
|
return [this.toOption(decoded), newOffset];
|
34585
34559
|
}
|
34586
|
-
toOption(
|
34587
|
-
if (
|
34588
|
-
return
|
34560
|
+
toOption(output3) {
|
34561
|
+
if (output3 && "Some" in output3) {
|
34562
|
+
return output3.Some;
|
34589
34563
|
}
|
34590
34564
|
return void 0;
|
34591
34565
|
}
|
@@ -34599,9 +34573,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34599
34573
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
34600
34574
|
}
|
34601
34575
|
const internalCoder = new ArrayCoder(new NumberCoder("u8"), value.length);
|
34602
|
-
const
|
34603
|
-
const lengthBytes = new BigNumberCoder("u64").encode(
|
34604
|
-
return new Uint8Array([...lengthBytes, ...
|
34576
|
+
const bytes3 = internalCoder.encode(value);
|
34577
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
|
34578
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
34605
34579
|
}
|
34606
34580
|
decode(data, offset) {
|
34607
34581
|
if (data.length < this.encodedLength) {
|
@@ -34624,9 +34598,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34624
34598
|
super("struct", "struct String", WORD_SIZE);
|
34625
34599
|
}
|
34626
34600
|
encode(value) {
|
34627
|
-
const
|
34601
|
+
const bytes3 = toUtf8Bytes(value);
|
34628
34602
|
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
34629
|
-
return new Uint8Array([...lengthBytes, ...
|
34603
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
34630
34604
|
}
|
34631
34605
|
decode(data, offset) {
|
34632
34606
|
if (data.length < this.encodedLength) {
|
@@ -34648,9 +34622,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34648
34622
|
super("strSlice", "str", WORD_SIZE);
|
34649
34623
|
}
|
34650
34624
|
encode(value) {
|
34651
|
-
const
|
34625
|
+
const bytes3 = toUtf8Bytes(value);
|
34652
34626
|
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
34653
|
-
return new Uint8Array([...lengthBytes, ...
|
34627
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
34654
34628
|
}
|
34655
34629
|
decode(data, offset) {
|
34656
34630
|
if (data.length < this.encodedLength) {
|
@@ -34659,11 +34633,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34659
34633
|
const offsetAndLength = offset + WORD_SIZE;
|
34660
34634
|
const lengthBytes = data.slice(offset, offsetAndLength);
|
34661
34635
|
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
34662
|
-
const
|
34663
|
-
if (
|
34636
|
+
const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
|
34637
|
+
if (bytes3.length !== length) {
|
34664
34638
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
34665
34639
|
}
|
34666
|
-
return [toUtf8String(
|
34640
|
+
return [toUtf8String(bytes3), offsetAndLength + length];
|
34667
34641
|
}
|
34668
34642
|
};
|
34669
34643
|
__publicField4(StrSliceCoder, "memorySize", 1);
|
@@ -34681,11 +34655,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34681
34655
|
if (data.length < this.encodedLength) {
|
34682
34656
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string data size.`);
|
34683
34657
|
}
|
34684
|
-
const
|
34685
|
-
if (
|
34658
|
+
const bytes3 = data.slice(offset, offset + this.encodedLength);
|
34659
|
+
if (bytes3.length !== this.encodedLength) {
|
34686
34660
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string byte data size.`);
|
34687
34661
|
}
|
34688
|
-
return [toUtf8String(
|
34662
|
+
return [toUtf8String(bytes3), offset + this.encodedLength];
|
34689
34663
|
}
|
34690
34664
|
};
|
34691
34665
|
var StructCoder = class extends Coder {
|
@@ -34703,7 +34677,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34703
34677
|
this.#hasNestedOption = hasNestedOption(coders);
|
34704
34678
|
}
|
34705
34679
|
encode(value) {
|
34706
|
-
return
|
34680
|
+
return concatBytes(
|
34707
34681
|
Object.keys(this.coders).map((fieldName) => {
|
34708
34682
|
const fieldCoder = this.coders[fieldName];
|
34709
34683
|
const fieldValue = value[fieldName];
|
@@ -34745,7 +34719,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34745
34719
|
if (this.coders.length !== value.length) {
|
34746
34720
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Types/values length mismatch.`);
|
34747
34721
|
}
|
34748
|
-
return
|
34722
|
+
return concatBytes(this.coders.map((coder, i) => coder.encode(value[i])));
|
34749
34723
|
}
|
34750
34724
|
decode(data, offset) {
|
34751
34725
|
if (!this.#hasNestedOption && data.length < this.encodedLength) {
|
@@ -34779,9 +34753,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34779
34753
|
if (isUint8Array(value)) {
|
34780
34754
|
return new Uint8Array([...lengthCoder.encode(value.length), ...value]);
|
34781
34755
|
}
|
34782
|
-
const
|
34756
|
+
const bytes3 = value.map((v) => this.coder.encode(v));
|
34783
34757
|
const lengthBytes = lengthCoder.encode(value.length);
|
34784
|
-
return new Uint8Array([...lengthBytes, ...
|
34758
|
+
return new Uint8Array([...lengthBytes, ...concatBytes(bytes3)]);
|
34785
34759
|
}
|
34786
34760
|
decode(data, offset) {
|
34787
34761
|
if (!this.#hasNestedOption && data.length < this.encodedLength || data.length > MAX_BYTES) {
|
@@ -35160,10 +35134,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
35160
35134
|
throw new FuelError(ErrorCode.ABI_TYPES_AND_VALUES_MISMATCH, errorMsg);
|
35161
35135
|
}
|
35162
35136
|
decodeArguments(data) {
|
35163
|
-
const
|
35137
|
+
const bytes3 = arrayify(data);
|
35164
35138
|
const nonEmptyInputs = findNonEmptyInputs(this.jsonAbi, this.jsonFn.inputs);
|
35165
35139
|
if (nonEmptyInputs.length === 0) {
|
35166
|
-
if (
|
35140
|
+
if (bytes3.length === 0) {
|
35167
35141
|
return void 0;
|
35168
35142
|
}
|
35169
35143
|
throw new FuelError(
|
@@ -35172,12 +35146,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
35172
35146
|
count: {
|
35173
35147
|
types: this.jsonFn.inputs.length,
|
35174
35148
|
nonEmptyInputs: nonEmptyInputs.length,
|
35175
|
-
values:
|
35149
|
+
values: bytes3.length
|
35176
35150
|
},
|
35177
35151
|
value: {
|
35178
35152
|
args: this.jsonFn.inputs,
|
35179
35153
|
nonEmptyInputs,
|
35180
|
-
values:
|
35154
|
+
values: bytes3
|
35181
35155
|
}
|
35182
35156
|
})}`
|
35183
35157
|
);
|
@@ -35185,7 +35159,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
35185
35159
|
const result = nonEmptyInputs.reduce(
|
35186
35160
|
(obj, input) => {
|
35187
35161
|
const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
|
35188
|
-
const [decodedValue, decodedValueByteSize] = coder.decode(
|
35162
|
+
const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
|
35189
35163
|
return {
|
35190
35164
|
decoded: [...obj.decoded, decodedValue],
|
35191
35165
|
offset: obj.offset + decodedValueByteSize
|
@@ -35200,11 +35174,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
35200
35174
|
if (outputAbiType.type === "()") {
|
35201
35175
|
return [void 0, 0];
|
35202
35176
|
}
|
35203
|
-
const
|
35177
|
+
const bytes3 = arrayify(data);
|
35204
35178
|
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
|
35205
35179
|
encoding: this.encoding
|
35206
35180
|
});
|
35207
|
-
return coder.decode(
|
35181
|
+
return coder.decode(bytes3, 0);
|
35208
35182
|
}
|
35209
35183
|
/**
|
35210
35184
|
* Checks if the function is read-only i.e. it only reads from storage, does not write to it.
|
@@ -35338,9 +35312,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
35338
35312
|
}
|
35339
35313
|
return addressLike;
|
35340
35314
|
};
|
35341
|
-
var getRandomB256 = () => hexlify(
|
35315
|
+
var getRandomB256 = () => hexlify(randomBytes2(32));
|
35342
35316
|
var clearFirst12BytesFromB256 = (b256) => {
|
35343
|
-
let
|
35317
|
+
let bytes3;
|
35344
35318
|
try {
|
35345
35319
|
if (!isB256(b256)) {
|
35346
35320
|
throw new FuelError(
|
@@ -35348,15 +35322,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
35348
35322
|
`Invalid Bech32 Address: ${b256}.`
|
35349
35323
|
);
|
35350
35324
|
}
|
35351
|
-
|
35352
|
-
|
35325
|
+
bytes3 = getBytesFromBech32(toBech32(b256));
|
35326
|
+
bytes3 = hexlify(bytes3.fill(0, 0, 12));
|
35353
35327
|
} catch (error) {
|
35354
35328
|
throw new FuelError(
|
35355
35329
|
FuelError.CODES.PARSE_FAILED,
|
35356
35330
|
`Cannot generate EVM Address B256 from: ${b256}.`
|
35357
35331
|
);
|
35358
35332
|
}
|
35359
|
-
return
|
35333
|
+
return bytes3;
|
35360
35334
|
};
|
35361
35335
|
var padFirst12BytesOfEvmAddress = (address) => {
|
35362
35336
|
if (!isEvmAddress(address)) {
|
@@ -36036,9 +36010,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
36036
36010
|
return sha2562(concat(parts));
|
36037
36011
|
}
|
36038
36012
|
static encodeData(messageData) {
|
36039
|
-
const
|
36040
|
-
const dataLength =
|
36041
|
-
return new ByteArrayCoder(dataLength).encode(
|
36013
|
+
const bytes3 = arrayify(messageData || "0x");
|
36014
|
+
const dataLength = bytes3.length;
|
36015
|
+
return new ByteArrayCoder(dataLength).encode(bytes3);
|
36042
36016
|
}
|
36043
36017
|
encode(value) {
|
36044
36018
|
const parts = [];
|
@@ -36060,9 +36034,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
36060
36034
|
return concat(parts);
|
36061
36035
|
}
|
36062
36036
|
static decodeData(messageData) {
|
36063
|
-
const
|
36064
|
-
const dataLength =
|
36065
|
-
const [data] = new ByteArrayCoder(dataLength).decode(
|
36037
|
+
const bytes3 = arrayify(messageData);
|
36038
|
+
const dataLength = bytes3.length;
|
36039
|
+
const [data] = new ByteArrayCoder(dataLength).decode(bytes3, 0);
|
36066
36040
|
return arrayify(data);
|
36067
36041
|
}
|
36068
36042
|
decode(data, offset) {
|
@@ -37142,9 +37116,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
37142
37116
|
}
|
37143
37117
|
};
|
37144
37118
|
|
37145
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
37119
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/abstract/utils.js
|
37146
37120
|
var utils_exports = {};
|
37147
37121
|
__export(utils_exports, {
|
37122
|
+
abytes: () => abytes,
|
37148
37123
|
bitGet: () => bitGet,
|
37149
37124
|
bitLen: () => bitLen,
|
37150
37125
|
bitMask: () => bitMask,
|
@@ -37152,7 +37127,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
37152
37127
|
bytesToHex: () => bytesToHex,
|
37153
37128
|
bytesToNumberBE: () => bytesToNumberBE,
|
37154
37129
|
bytesToNumberLE: () => bytesToNumberLE,
|
37155
|
-
concatBytes: () =>
|
37130
|
+
concatBytes: () => concatBytes2,
|
37156
37131
|
createHmacDrbg: () => createHmacDrbg,
|
37157
37132
|
ensureBytes: () => ensureBytes,
|
37158
37133
|
equalBytes: () => equalBytes,
|
@@ -37172,13 +37147,16 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
37172
37147
|
function isBytes3(a) {
|
37173
37148
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
37174
37149
|
}
|
37175
|
-
|
37176
|
-
|
37177
|
-
if (!isBytes3(bytes2))
|
37150
|
+
function abytes(item) {
|
37151
|
+
if (!isBytes3(item))
|
37178
37152
|
throw new Error("Uint8Array expected");
|
37153
|
+
}
|
37154
|
+
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
37155
|
+
function bytesToHex(bytes3) {
|
37156
|
+
abytes(bytes3);
|
37179
37157
|
let hex = "";
|
37180
|
-
for (let i = 0; i <
|
37181
|
-
hex += hexes[
|
37158
|
+
for (let i = 0; i < bytes3.length; i++) {
|
37159
|
+
hex += hexes[bytes3[i]];
|
37182
37160
|
}
|
37183
37161
|
return hex;
|
37184
37162
|
}
|
@@ -37220,13 +37198,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
37220
37198
|
}
|
37221
37199
|
return array;
|
37222
37200
|
}
|
37223
|
-
function bytesToNumberBE(
|
37224
|
-
return hexToNumber(bytesToHex(
|
37201
|
+
function bytesToNumberBE(bytes3) {
|
37202
|
+
return hexToNumber(bytesToHex(bytes3));
|
37225
37203
|
}
|
37226
|
-
function bytesToNumberLE(
|
37227
|
-
|
37228
|
-
|
37229
|
-
return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse()));
|
37204
|
+
function bytesToNumberLE(bytes3) {
|
37205
|
+
abytes(bytes3);
|
37206
|
+
return hexToNumber(bytesToHex(Uint8Array.from(bytes3).reverse()));
|
37230
37207
|
}
|
37231
37208
|
function numberToBytesBE(n, len) {
|
37232
37209
|
return hexToBytes(n.toString(16).padStart(len * 2, "0"));
|
@@ -37255,17 +37232,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
37255
37232
|
throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);
|
37256
37233
|
return res;
|
37257
37234
|
}
|
37258
|
-
function
|
37235
|
+
function concatBytes2(...arrays) {
|
37259
37236
|
let sum = 0;
|
37260
37237
|
for (let i = 0; i < arrays.length; i++) {
|
37261
37238
|
const a = arrays[i];
|
37262
|
-
|
37263
|
-
throw new Error("Uint8Array expected");
|
37239
|
+
abytes(a);
|
37264
37240
|
sum += a.length;
|
37265
37241
|
}
|
37266
|
-
|
37267
|
-
let pad3 = 0;
|
37268
|
-
for (let i = 0; i < arrays.length; i++) {
|
37242
|
+
const res = new Uint8Array(sum);
|
37243
|
+
for (let i = 0, pad3 = 0; i < arrays.length; i++) {
|
37269
37244
|
const a = arrays[i];
|
37270
37245
|
res.set(a, pad3);
|
37271
37246
|
pad3 += a.length;
|
@@ -37294,9 +37269,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
37294
37269
|
function bitGet(n, pos) {
|
37295
37270
|
return n >> BigInt(pos) & _1n2;
|
37296
37271
|
}
|
37297
|
-
|
37272
|
+
function bitSet(n, pos, value) {
|
37298
37273
|
return n | (value ? _1n2 : _0n2) << BigInt(pos);
|
37299
|
-
}
|
37274
|
+
}
|
37300
37275
|
var bitMask = (n) => (_2n2 << BigInt(n - 1)) - _1n2;
|
37301
37276
|
var u8n = (data) => new Uint8Array(data);
|
37302
37277
|
var u8fr = (arr) => Uint8Array.from(arr);
|
@@ -37335,7 +37310,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
37335
37310
|
out.push(sl);
|
37336
37311
|
len += v.length;
|
37337
37312
|
}
|
37338
|
-
return
|
37313
|
+
return concatBytes2(...out);
|
37339
37314
|
};
|
37340
37315
|
const genUntil = (seed, pred) => {
|
37341
37316
|
reset();
|
@@ -37599,19 +37574,19 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
37599
37574
|
return "GraphQLError";
|
37600
37575
|
}
|
37601
37576
|
toString() {
|
37602
|
-
let
|
37577
|
+
let output3 = this.message;
|
37603
37578
|
if (this.nodes) {
|
37604
37579
|
for (const node of this.nodes) {
|
37605
37580
|
if (node.loc) {
|
37606
|
-
|
37581
|
+
output3 += "\n\n" + printLocation(node.loc);
|
37607
37582
|
}
|
37608
37583
|
}
|
37609
37584
|
} else if (this.source && this.locations) {
|
37610
37585
|
for (const location of this.locations) {
|
37611
|
-
|
37586
|
+
output3 += "\n\n" + printSourceLocation(this.source, location);
|
37612
37587
|
}
|
37613
37588
|
}
|
37614
|
-
return
|
37589
|
+
return output3;
|
37615
37590
|
}
|
37616
37591
|
toJSON() {
|
37617
37592
|
const formattedError = {
|
@@ -42369,8 +42344,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
42369
42344
|
*
|
42370
42345
|
* Pushes an output to the list without any side effects and returns the index
|
42371
42346
|
*/
|
42372
|
-
pushOutput(
|
42373
|
-
this.outputs.push(
|
42347
|
+
pushOutput(output3) {
|
42348
|
+
this.outputs.push(output3);
|
42374
42349
|
return this.outputs.length - 1;
|
42375
42350
|
}
|
42376
42351
|
/**
|
@@ -42454,7 +42429,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
42454
42429
|
*/
|
42455
42430
|
getCoinOutputs() {
|
42456
42431
|
return this.outputs.filter(
|
42457
|
-
(
|
42432
|
+
(output3) => output3.type === OutputType.Coin
|
42458
42433
|
);
|
42459
42434
|
}
|
42460
42435
|
/**
|
@@ -42464,7 +42439,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
42464
42439
|
*/
|
42465
42440
|
getChangeOutputs() {
|
42466
42441
|
return this.outputs.filter(
|
42467
|
-
(
|
42442
|
+
(output3) => output3.type === OutputType.Change
|
42468
42443
|
);
|
42469
42444
|
}
|
42470
42445
|
/**
|
@@ -42614,7 +42589,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
42614
42589
|
*/
|
42615
42590
|
addChangeOutput(to, assetId) {
|
42616
42591
|
const changeOutput = this.getChangeOutputs().find(
|
42617
|
-
(
|
42592
|
+
(output3) => hexlify(output3.assetId) === assetId
|
42618
42593
|
);
|
42619
42594
|
if (!changeOutput) {
|
42620
42595
|
this.pushOutput({
|
@@ -42692,12 +42667,12 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
42692
42667
|
usedQuantity = bn("1000000000000000000");
|
42693
42668
|
}
|
42694
42669
|
if (assetInput && "assetId" in assetInput) {
|
42695
|
-
assetInput.id = hexlify(
|
42670
|
+
assetInput.id = hexlify(randomBytes2(UTXO_ID_LEN));
|
42696
42671
|
assetInput.amount = usedQuantity;
|
42697
42672
|
} else {
|
42698
42673
|
this.addResources([
|
42699
42674
|
{
|
42700
|
-
id: hexlify(
|
42675
|
+
id: hexlify(randomBytes2(UTXO_ID_LEN)),
|
42701
42676
|
amount: usedQuantity,
|
42702
42677
|
assetId,
|
42703
42678
|
owner: resourcesOwner || Address.fromRandom(),
|
@@ -42793,8 +42768,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
42793
42768
|
return inputClone;
|
42794
42769
|
}
|
42795
42770
|
});
|
42796
|
-
transaction.outputs = transaction.outputs.map((
|
42797
|
-
const outputClone = clone_default(
|
42771
|
+
transaction.outputs = transaction.outputs.map((output3) => {
|
42772
|
+
const outputClone = clone_default(output3);
|
42798
42773
|
switch (outputClone.type) {
|
42799
42774
|
case OutputType.Contract: {
|
42800
42775
|
outputClone.balanceRoot = ZeroBytes32;
|
@@ -42896,7 +42871,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
42896
42871
|
*/
|
42897
42872
|
getContractCreatedOutputs() {
|
42898
42873
|
return this.outputs.filter(
|
42899
|
-
(
|
42874
|
+
(output3) => output3.type === OutputType.ContractCreated
|
42900
42875
|
);
|
42901
42876
|
}
|
42902
42877
|
/**
|
@@ -43022,7 +42997,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
43022
42997
|
*/
|
43023
42998
|
getContractOutputs() {
|
43024
42999
|
return this.outputs.filter(
|
43025
|
-
(
|
43000
|
+
(output3) => output3.type === OutputType.Contract
|
43026
43001
|
);
|
43027
43002
|
}
|
43028
43003
|
/**
|
@@ -43032,7 +43007,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
43032
43007
|
*/
|
43033
43008
|
getVariableOutputs() {
|
43034
43009
|
return this.outputs.filter(
|
43035
|
-
(
|
43010
|
+
(output3) => output3.type === OutputType.Variable
|
43036
43011
|
);
|
43037
43012
|
}
|
43038
43013
|
/**
|
@@ -43455,8 +43430,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
43455
43430
|
}) {
|
43456
43431
|
const contractCallReceipts = getReceiptsCall(receipts);
|
43457
43432
|
const contractOutputs = getOutputsContract(outputs);
|
43458
|
-
const contractCallOperations = contractOutputs.reduce((prevOutputCallOps,
|
43459
|
-
const contractInput = getInputContractFromIndex(inputs,
|
43433
|
+
const contractCallOperations = contractOutputs.reduce((prevOutputCallOps, output3) => {
|
43434
|
+
const contractInput = getInputContractFromIndex(inputs, output3.inputIndex);
|
43460
43435
|
if (contractInput) {
|
43461
43436
|
const newCallOps = contractCallReceipts.reduce((prevContractCallOps, receipt) => {
|
43462
43437
|
if (receipt.to === contractInput.contractID) {
|
@@ -43510,7 +43485,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
43510
43485
|
let { from: fromAddress } = receipt;
|
43511
43486
|
const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
|
43512
43487
|
if (ZeroBytes32 === fromAddress) {
|
43513
|
-
const change = changeOutputs.find((
|
43488
|
+
const change = changeOutputs.find((output3) => output3.assetId === assetId);
|
43514
43489
|
fromAddress = change?.to || fromAddress;
|
43515
43490
|
}
|
43516
43491
|
const fromType = contractInputs.some((input) => input.contractID === fromAddress) ? 0 /* contract */ : 1 /* account */;
|
@@ -43541,8 +43516,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
43541
43516
|
const coinOutputs = getOutputsCoin(outputs);
|
43542
43517
|
const contractInputs = getInputsContract(inputs);
|
43543
43518
|
const changeOutputs = getOutputsChange(outputs);
|
43544
|
-
coinOutputs.forEach((
|
43545
|
-
const { amount, assetId, to } =
|
43519
|
+
coinOutputs.forEach((output3) => {
|
43520
|
+
const { amount, assetId, to } = output3;
|
43546
43521
|
const changeOutput = changeOutputs.find((change) => change.assetId === assetId);
|
43547
43522
|
if (changeOutput) {
|
43548
43523
|
operations = addOperation(operations, {
|
@@ -43580,7 +43555,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
43580
43555
|
}
|
43581
43556
|
function getPayProducerOperations(outputs) {
|
43582
43557
|
const coinOutputs = getOutputsCoin(outputs);
|
43583
|
-
const payProducerOperations = coinOutputs.reduce((prev,
|
43558
|
+
const payProducerOperations = coinOutputs.reduce((prev, output3) => {
|
43584
43559
|
const operations = addOperation(prev, {
|
43585
43560
|
name: "Pay network fee to block producer" /* payBlockProducer */,
|
43586
43561
|
from: {
|
@@ -43589,12 +43564,12 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
43589
43564
|
},
|
43590
43565
|
to: {
|
43591
43566
|
type: 1 /* account */,
|
43592
|
-
address:
|
43567
|
+
address: output3.to.toString()
|
43593
43568
|
},
|
43594
43569
|
assetsSent: [
|
43595
43570
|
{
|
43596
|
-
assetId:
|
43597
|
-
amount:
|
43571
|
+
assetId: output3.assetId.toString(),
|
43572
|
+
amount: output3.amount
|
43598
43573
|
}
|
43599
43574
|
]
|
43600
43575
|
});
|
@@ -44839,6 +44814,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44839
44814
|
* @returns A promise that resolves to the coins.
|
44840
44815
|
*/
|
44841
44816
|
async getCoins(owner, assetId, paginationArgs) {
|
44817
|
+
this.validatePaginationArgs(paginationArgs);
|
44842
44818
|
const ownerAddress = Address.fromAddressOrString(owner);
|
44843
44819
|
const {
|
44844
44820
|
coins: { edges, pageInfo }
|
@@ -45073,8 +45049,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45073
45049
|
balances: { edges }
|
45074
45050
|
} = await this.operations.getBalances({
|
45075
45051
|
/**
|
45076
|
-
* The query
|
45077
|
-
* current Fuel-Core implementation does not support pagination yet
|
45052
|
+
* The query parameters for this method were designed to support pagination,
|
45053
|
+
* but the current Fuel-Core implementation does not support pagination yet.
|
45078
45054
|
*/
|
45079
45055
|
first: 1e4,
|
45080
45056
|
filter: { owner: Address.fromAddressOrString(owner).toB256() }
|
@@ -45093,6 +45069,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45093
45069
|
* @returns A promise that resolves to the messages.
|
45094
45070
|
*/
|
45095
45071
|
async getMessages(address, paginationArgs) {
|
45072
|
+
this.validatePaginationArgs(paginationArgs);
|
45096
45073
|
const {
|
45097
45074
|
messages: { edges, pageInfo }
|
45098
45075
|
} = await this.operations.getMessages({
|
@@ -45297,6 +45274,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45297
45274
|
}
|
45298
45275
|
return relayedTransactionStatus;
|
45299
45276
|
}
|
45277
|
+
/**
|
45278
|
+
* @hidden
|
45279
|
+
*/
|
45280
|
+
validatePaginationArgs({ first, last } = {}) {
|
45281
|
+
const MAX_PAGINATION_LIMIT = 1e3;
|
45282
|
+
if ((first || 0) > MAX_PAGINATION_LIMIT || (last || 0) > MAX_PAGINATION_LIMIT) {
|
45283
|
+
throw new FuelError(
|
45284
|
+
ErrorCode.INVALID_INPUT_PARAMETERS,
|
45285
|
+
"Pagination limit cannot exceed 1000 items"
|
45286
|
+
);
|
45287
|
+
}
|
45288
|
+
}
|
45300
45289
|
/**
|
45301
45290
|
* @hidden
|
45302
45291
|
*/
|
@@ -45863,7 +45852,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45863
45852
|
*/
|
45864
45853
|
generateFakeResources(coins) {
|
45865
45854
|
return coins.map((coin) => ({
|
45866
|
-
id: hexlify(
|
45855
|
+
id: hexlify(randomBytes2(UTXO_ID_LEN)),
|
45867
45856
|
owner: this.address,
|
45868
45857
|
blockCreated: bn(1),
|
45869
45858
|
txCreatedIdx: bn(1),
|
@@ -45922,7 +45911,349 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45922
45911
|
}
|
45923
45912
|
};
|
45924
45913
|
|
45925
|
-
// ../../node_modules/.pnpm/@noble+
|
45914
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/_assert.js
|
45915
|
+
function number2(n) {
|
45916
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
45917
|
+
throw new Error(`positive integer expected, not ${n}`);
|
45918
|
+
}
|
45919
|
+
function isBytes4(a) {
|
45920
|
+
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
45921
|
+
}
|
45922
|
+
function bytes2(b, ...lengths) {
|
45923
|
+
if (!isBytes4(b))
|
45924
|
+
throw new Error("Uint8Array expected");
|
45925
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
45926
|
+
throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
|
45927
|
+
}
|
45928
|
+
function hash3(h) {
|
45929
|
+
if (typeof h !== "function" || typeof h.create !== "function")
|
45930
|
+
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
45931
|
+
number2(h.outputLen);
|
45932
|
+
number2(h.blockLen);
|
45933
|
+
}
|
45934
|
+
function exists2(instance, checkFinished = true) {
|
45935
|
+
if (instance.destroyed)
|
45936
|
+
throw new Error("Hash instance has been destroyed");
|
45937
|
+
if (checkFinished && instance.finished)
|
45938
|
+
throw new Error("Hash#digest() has already been called");
|
45939
|
+
}
|
45940
|
+
function output2(out, instance) {
|
45941
|
+
bytes2(out);
|
45942
|
+
const min = instance.outputLen;
|
45943
|
+
if (out.length < min) {
|
45944
|
+
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
45945
|
+
}
|
45946
|
+
}
|
45947
|
+
|
45948
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/cryptoNode.js
|
45949
|
+
var nc = __toESM(__require("crypto"), 1);
|
45950
|
+
var crypto4 = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : void 0;
|
45951
|
+
|
45952
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/utils.js
|
45953
|
+
var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
45954
|
+
var rotr2 = (word, shift) => word << 32 - shift | word >>> shift;
|
45955
|
+
var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
45956
|
+
function utf8ToBytes3(str) {
|
45957
|
+
if (typeof str !== "string")
|
45958
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
45959
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
45960
|
+
}
|
45961
|
+
function toBytes3(data) {
|
45962
|
+
if (typeof data === "string")
|
45963
|
+
data = utf8ToBytes3(data);
|
45964
|
+
bytes2(data);
|
45965
|
+
return data;
|
45966
|
+
}
|
45967
|
+
function concatBytes3(...arrays) {
|
45968
|
+
let sum = 0;
|
45969
|
+
for (let i = 0; i < arrays.length; i++) {
|
45970
|
+
const a = arrays[i];
|
45971
|
+
bytes2(a);
|
45972
|
+
sum += a.length;
|
45973
|
+
}
|
45974
|
+
const res = new Uint8Array(sum);
|
45975
|
+
for (let i = 0, pad3 = 0; i < arrays.length; i++) {
|
45976
|
+
const a = arrays[i];
|
45977
|
+
res.set(a, pad3);
|
45978
|
+
pad3 += a.length;
|
45979
|
+
}
|
45980
|
+
return res;
|
45981
|
+
}
|
45982
|
+
var Hash2 = class {
|
45983
|
+
// Safe version that clones internal state
|
45984
|
+
clone() {
|
45985
|
+
return this._cloneInto();
|
45986
|
+
}
|
45987
|
+
};
|
45988
|
+
var toStr2 = {}.toString;
|
45989
|
+
function wrapConstructor2(hashCons) {
|
45990
|
+
const hashC = (msg) => hashCons().update(toBytes3(msg)).digest();
|
45991
|
+
const tmp = hashCons();
|
45992
|
+
hashC.outputLen = tmp.outputLen;
|
45993
|
+
hashC.blockLen = tmp.blockLen;
|
45994
|
+
hashC.create = () => hashCons();
|
45995
|
+
return hashC;
|
45996
|
+
}
|
45997
|
+
function randomBytes3(bytesLength = 32) {
|
45998
|
+
if (crypto4 && typeof crypto4.getRandomValues === "function") {
|
45999
|
+
return crypto4.getRandomValues(new Uint8Array(bytesLength));
|
46000
|
+
}
|
46001
|
+
throw new Error("crypto.getRandomValues must be defined");
|
46002
|
+
}
|
46003
|
+
|
46004
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/_md.js
|
46005
|
+
function setBigUint642(view, byteOffset, value, isLE3) {
|
46006
|
+
if (typeof view.setBigUint64 === "function")
|
46007
|
+
return view.setBigUint64(byteOffset, value, isLE3);
|
46008
|
+
const _32n2 = BigInt(32);
|
46009
|
+
const _u32_max = BigInt(4294967295);
|
46010
|
+
const wh = Number(value >> _32n2 & _u32_max);
|
46011
|
+
const wl = Number(value & _u32_max);
|
46012
|
+
const h = isLE3 ? 4 : 0;
|
46013
|
+
const l = isLE3 ? 0 : 4;
|
46014
|
+
view.setUint32(byteOffset + h, wh, isLE3);
|
46015
|
+
view.setUint32(byteOffset + l, wl, isLE3);
|
46016
|
+
}
|
46017
|
+
var Chi2 = (a, b, c) => a & b ^ ~a & c;
|
46018
|
+
var Maj2 = (a, b, c) => a & b ^ a & c ^ b & c;
|
46019
|
+
var HashMD = class extends Hash2 {
|
46020
|
+
constructor(blockLen, outputLen, padOffset, isLE3) {
|
46021
|
+
super();
|
46022
|
+
this.blockLen = blockLen;
|
46023
|
+
this.outputLen = outputLen;
|
46024
|
+
this.padOffset = padOffset;
|
46025
|
+
this.isLE = isLE3;
|
46026
|
+
this.finished = false;
|
46027
|
+
this.length = 0;
|
46028
|
+
this.pos = 0;
|
46029
|
+
this.destroyed = false;
|
46030
|
+
this.buffer = new Uint8Array(blockLen);
|
46031
|
+
this.view = createView2(this.buffer);
|
46032
|
+
}
|
46033
|
+
update(data) {
|
46034
|
+
exists2(this);
|
46035
|
+
const { view, buffer, blockLen } = this;
|
46036
|
+
data = toBytes3(data);
|
46037
|
+
const len = data.length;
|
46038
|
+
for (let pos = 0; pos < len; ) {
|
46039
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
46040
|
+
if (take === blockLen) {
|
46041
|
+
const dataView = createView2(data);
|
46042
|
+
for (; blockLen <= len - pos; pos += blockLen)
|
46043
|
+
this.process(dataView, pos);
|
46044
|
+
continue;
|
46045
|
+
}
|
46046
|
+
buffer.set(data.subarray(pos, pos + take), this.pos);
|
46047
|
+
this.pos += take;
|
46048
|
+
pos += take;
|
46049
|
+
if (this.pos === blockLen) {
|
46050
|
+
this.process(view, 0);
|
46051
|
+
this.pos = 0;
|
46052
|
+
}
|
46053
|
+
}
|
46054
|
+
this.length += data.length;
|
46055
|
+
this.roundClean();
|
46056
|
+
return this;
|
46057
|
+
}
|
46058
|
+
digestInto(out) {
|
46059
|
+
exists2(this);
|
46060
|
+
output2(out, this);
|
46061
|
+
this.finished = true;
|
46062
|
+
const { buffer, view, blockLen, isLE: isLE3 } = this;
|
46063
|
+
let { pos } = this;
|
46064
|
+
buffer[pos++] = 128;
|
46065
|
+
this.buffer.subarray(pos).fill(0);
|
46066
|
+
if (this.padOffset > blockLen - pos) {
|
46067
|
+
this.process(view, 0);
|
46068
|
+
pos = 0;
|
46069
|
+
}
|
46070
|
+
for (let i = pos; i < blockLen; i++)
|
46071
|
+
buffer[i] = 0;
|
46072
|
+
setBigUint642(view, blockLen - 8, BigInt(this.length * 8), isLE3);
|
46073
|
+
this.process(view, 0);
|
46074
|
+
const oview = createView2(out);
|
46075
|
+
const len = this.outputLen;
|
46076
|
+
if (len % 4)
|
46077
|
+
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
46078
|
+
const outLen = len / 4;
|
46079
|
+
const state = this.get();
|
46080
|
+
if (outLen > state.length)
|
46081
|
+
throw new Error("_sha2: outputLen bigger than state");
|
46082
|
+
for (let i = 0; i < outLen; i++)
|
46083
|
+
oview.setUint32(4 * i, state[i], isLE3);
|
46084
|
+
}
|
46085
|
+
digest() {
|
46086
|
+
const { buffer, outputLen } = this;
|
46087
|
+
this.digestInto(buffer);
|
46088
|
+
const res = buffer.slice(0, outputLen);
|
46089
|
+
this.destroy();
|
46090
|
+
return res;
|
46091
|
+
}
|
46092
|
+
_cloneInto(to) {
|
46093
|
+
to || (to = new this.constructor());
|
46094
|
+
to.set(...this.get());
|
46095
|
+
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
46096
|
+
to.length = length;
|
46097
|
+
to.pos = pos;
|
46098
|
+
to.finished = finished;
|
46099
|
+
to.destroyed = destroyed;
|
46100
|
+
if (length % blockLen)
|
46101
|
+
to.buffer.set(buffer);
|
46102
|
+
return to;
|
46103
|
+
}
|
46104
|
+
};
|
46105
|
+
|
46106
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/sha256.js
|
46107
|
+
var SHA256_K2 = /* @__PURE__ */ new Uint32Array([
|
46108
|
+
1116352408,
|
46109
|
+
1899447441,
|
46110
|
+
3049323471,
|
46111
|
+
3921009573,
|
46112
|
+
961987163,
|
46113
|
+
1508970993,
|
46114
|
+
2453635748,
|
46115
|
+
2870763221,
|
46116
|
+
3624381080,
|
46117
|
+
310598401,
|
46118
|
+
607225278,
|
46119
|
+
1426881987,
|
46120
|
+
1925078388,
|
46121
|
+
2162078206,
|
46122
|
+
2614888103,
|
46123
|
+
3248222580,
|
46124
|
+
3835390401,
|
46125
|
+
4022224774,
|
46126
|
+
264347078,
|
46127
|
+
604807628,
|
46128
|
+
770255983,
|
46129
|
+
1249150122,
|
46130
|
+
1555081692,
|
46131
|
+
1996064986,
|
46132
|
+
2554220882,
|
46133
|
+
2821834349,
|
46134
|
+
2952996808,
|
46135
|
+
3210313671,
|
46136
|
+
3336571891,
|
46137
|
+
3584528711,
|
46138
|
+
113926993,
|
46139
|
+
338241895,
|
46140
|
+
666307205,
|
46141
|
+
773529912,
|
46142
|
+
1294757372,
|
46143
|
+
1396182291,
|
46144
|
+
1695183700,
|
46145
|
+
1986661051,
|
46146
|
+
2177026350,
|
46147
|
+
2456956037,
|
46148
|
+
2730485921,
|
46149
|
+
2820302411,
|
46150
|
+
3259730800,
|
46151
|
+
3345764771,
|
46152
|
+
3516065817,
|
46153
|
+
3600352804,
|
46154
|
+
4094571909,
|
46155
|
+
275423344,
|
46156
|
+
430227734,
|
46157
|
+
506948616,
|
46158
|
+
659060556,
|
46159
|
+
883997877,
|
46160
|
+
958139571,
|
46161
|
+
1322822218,
|
46162
|
+
1537002063,
|
46163
|
+
1747873779,
|
46164
|
+
1955562222,
|
46165
|
+
2024104815,
|
46166
|
+
2227730452,
|
46167
|
+
2361852424,
|
46168
|
+
2428436474,
|
46169
|
+
2756734187,
|
46170
|
+
3204031479,
|
46171
|
+
3329325298
|
46172
|
+
]);
|
46173
|
+
var SHA256_IV = /* @__PURE__ */ new Uint32Array([
|
46174
|
+
1779033703,
|
46175
|
+
3144134277,
|
46176
|
+
1013904242,
|
46177
|
+
2773480762,
|
46178
|
+
1359893119,
|
46179
|
+
2600822924,
|
46180
|
+
528734635,
|
46181
|
+
1541459225
|
46182
|
+
]);
|
46183
|
+
var SHA256_W2 = /* @__PURE__ */ new Uint32Array(64);
|
46184
|
+
var SHA2562 = class extends HashMD {
|
46185
|
+
constructor() {
|
46186
|
+
super(64, 32, 8, false);
|
46187
|
+
this.A = SHA256_IV[0] | 0;
|
46188
|
+
this.B = SHA256_IV[1] | 0;
|
46189
|
+
this.C = SHA256_IV[2] | 0;
|
46190
|
+
this.D = SHA256_IV[3] | 0;
|
46191
|
+
this.E = SHA256_IV[4] | 0;
|
46192
|
+
this.F = SHA256_IV[5] | 0;
|
46193
|
+
this.G = SHA256_IV[6] | 0;
|
46194
|
+
this.H = SHA256_IV[7] | 0;
|
46195
|
+
}
|
46196
|
+
get() {
|
46197
|
+
const { A, B, C, D, E, F, G, H } = this;
|
46198
|
+
return [A, B, C, D, E, F, G, H];
|
46199
|
+
}
|
46200
|
+
// prettier-ignore
|
46201
|
+
set(A, B, C, D, E, F, G, H) {
|
46202
|
+
this.A = A | 0;
|
46203
|
+
this.B = B | 0;
|
46204
|
+
this.C = C | 0;
|
46205
|
+
this.D = D | 0;
|
46206
|
+
this.E = E | 0;
|
46207
|
+
this.F = F | 0;
|
46208
|
+
this.G = G | 0;
|
46209
|
+
this.H = H | 0;
|
46210
|
+
}
|
46211
|
+
process(view, offset) {
|
46212
|
+
for (let i = 0; i < 16; i++, offset += 4)
|
46213
|
+
SHA256_W2[i] = view.getUint32(offset, false);
|
46214
|
+
for (let i = 16; i < 64; i++) {
|
46215
|
+
const W15 = SHA256_W2[i - 15];
|
46216
|
+
const W2 = SHA256_W2[i - 2];
|
46217
|
+
const s0 = rotr2(W15, 7) ^ rotr2(W15, 18) ^ W15 >>> 3;
|
46218
|
+
const s1 = rotr2(W2, 17) ^ rotr2(W2, 19) ^ W2 >>> 10;
|
46219
|
+
SHA256_W2[i] = s1 + SHA256_W2[i - 7] + s0 + SHA256_W2[i - 16] | 0;
|
46220
|
+
}
|
46221
|
+
let { A, B, C, D, E, F, G, H } = this;
|
46222
|
+
for (let i = 0; i < 64; i++) {
|
46223
|
+
const sigma1 = rotr2(E, 6) ^ rotr2(E, 11) ^ rotr2(E, 25);
|
46224
|
+
const T1 = H + sigma1 + Chi2(E, F, G) + SHA256_K2[i] + SHA256_W2[i] | 0;
|
46225
|
+
const sigma0 = rotr2(A, 2) ^ rotr2(A, 13) ^ rotr2(A, 22);
|
46226
|
+
const T2 = sigma0 + Maj2(A, B, C) | 0;
|
46227
|
+
H = G;
|
46228
|
+
G = F;
|
46229
|
+
F = E;
|
46230
|
+
E = D + T1 | 0;
|
46231
|
+
D = C;
|
46232
|
+
C = B;
|
46233
|
+
B = A;
|
46234
|
+
A = T1 + T2 | 0;
|
46235
|
+
}
|
46236
|
+
A = A + this.A | 0;
|
46237
|
+
B = B + this.B | 0;
|
46238
|
+
C = C + this.C | 0;
|
46239
|
+
D = D + this.D | 0;
|
46240
|
+
E = E + this.E | 0;
|
46241
|
+
F = F + this.F | 0;
|
46242
|
+
G = G + this.G | 0;
|
46243
|
+
H = H + this.H | 0;
|
46244
|
+
this.set(A, B, C, D, E, F, G, H);
|
46245
|
+
}
|
46246
|
+
roundClean() {
|
46247
|
+
SHA256_W2.fill(0);
|
46248
|
+
}
|
46249
|
+
destroy() {
|
46250
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
46251
|
+
this.buffer.fill(0);
|
46252
|
+
}
|
46253
|
+
};
|
46254
|
+
var sha2563 = /* @__PURE__ */ wrapConstructor2(() => new SHA2562());
|
46255
|
+
|
46256
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/abstract/modular.js
|
45926
46257
|
var _0n3 = BigInt(0);
|
45927
46258
|
var _1n3 = BigInt(1);
|
45928
46259
|
var _2n3 = BigInt(2);
|
@@ -45958,11 +46289,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45958
46289
|
}
|
45959
46290
|
return res;
|
45960
46291
|
}
|
45961
|
-
function invert(
|
45962
|
-
if (
|
45963
|
-
throw new Error(`invert: expected positive integers, got n=${
|
46292
|
+
function invert(number3, modulo) {
|
46293
|
+
if (number3 === _0n3 || modulo <= _0n3) {
|
46294
|
+
throw new Error(`invert: expected positive integers, got n=${number3} mod=${modulo}`);
|
45964
46295
|
}
|
45965
|
-
let a = mod(
|
46296
|
+
let a = mod(number3, modulo);
|
45966
46297
|
let b = modulo;
|
45967
46298
|
let x = _0n3, y = _1n3, u = _1n3, v = _0n3;
|
45968
46299
|
while (a !== _0n3) {
|
@@ -46117,7 +46448,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46117
46448
|
const nByteLength = Math.ceil(_nBitLength / 8);
|
46118
46449
|
return { nBitLength: _nBitLength, nByteLength };
|
46119
46450
|
}
|
46120
|
-
function Field(ORDER, bitLen2,
|
46451
|
+
function Field(ORDER, bitLen2, isLE3 = false, redef = {}) {
|
46121
46452
|
if (ORDER <= _0n3)
|
46122
46453
|
throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
|
46123
46454
|
const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
|
@@ -46158,11 +46489,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46158
46489
|
// TODO: do we really need constant cmov?
|
46159
46490
|
// We don't have const-time bigints anyway, so probably will be not very useful
|
46160
46491
|
cmov: (a, b, c) => c ? b : a,
|
46161
|
-
toBytes: (num) =>
|
46162
|
-
fromBytes: (
|
46163
|
-
if (
|
46164
|
-
throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${
|
46165
|
-
return
|
46492
|
+
toBytes: (num) => isLE3 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
|
46493
|
+
fromBytes: (bytes3) => {
|
46494
|
+
if (bytes3.length !== BYTES)
|
46495
|
+
throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes3.length}`);
|
46496
|
+
return isLE3 ? bytesToNumberLE(bytes3) : bytesToNumberBE(bytes3);
|
46166
46497
|
}
|
46167
46498
|
});
|
46168
46499
|
return Object.freeze(f2);
|
@@ -46177,18 +46508,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46177
46508
|
const length = getFieldBytesLength(fieldOrder);
|
46178
46509
|
return length + Math.ceil(length / 2);
|
46179
46510
|
}
|
46180
|
-
function mapHashToField(key, fieldOrder,
|
46511
|
+
function mapHashToField(key, fieldOrder, isLE3 = false) {
|
46181
46512
|
const len = key.length;
|
46182
46513
|
const fieldLen = getFieldBytesLength(fieldOrder);
|
46183
46514
|
const minLen = getMinHashLength(fieldOrder);
|
46184
46515
|
if (len < 16 || len < minLen || len > 1024)
|
46185
46516
|
throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
|
46186
|
-
const num =
|
46517
|
+
const num = isLE3 ? bytesToNumberBE(key) : bytesToNumberLE(key);
|
46187
46518
|
const reduced = mod(num, fieldOrder - _1n3) + _1n3;
|
46188
|
-
return
|
46519
|
+
return isLE3 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
|
46189
46520
|
}
|
46190
46521
|
|
46191
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
46522
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/abstract/curve.js
|
46192
46523
|
var _0n4 = BigInt(0);
|
46193
46524
|
var _1n4 = BigInt(1);
|
46194
46525
|
function wNAF(c, bits) {
|
@@ -46306,7 +46637,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46306
46637
|
});
|
46307
46638
|
}
|
46308
46639
|
|
46309
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
46640
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/abstract/weierstrass.js
|
46310
46641
|
function validatePointOpts(curve) {
|
46311
46642
|
const opts = validateBasic(curve);
|
46312
46643
|
validateObject(opts, {
|
@@ -46357,8 +46688,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46357
46688
|
toSig(hex) {
|
46358
46689
|
const { Err: E } = DER;
|
46359
46690
|
const data = typeof hex === "string" ? h2b(hex) : hex;
|
46360
|
-
|
46361
|
-
throw new Error("ui8a expected");
|
46691
|
+
abytes(data);
|
46362
46692
|
let l = data.length;
|
46363
46693
|
if (l < 2 || data[0] != 48)
|
46364
46694
|
throw new E("Invalid signature tag");
|
@@ -46393,12 +46723,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46393
46723
|
function weierstrassPoints(opts) {
|
46394
46724
|
const CURVE = validatePointOpts(opts);
|
46395
46725
|
const { Fp: Fp2 } = CURVE;
|
46396
|
-
const
|
46726
|
+
const toBytes4 = CURVE.toBytes || ((_c, point, _isCompressed) => {
|
46397
46727
|
const a = point.toAffine();
|
46398
|
-
return
|
46728
|
+
return concatBytes2(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
|
46399
46729
|
});
|
46400
|
-
const fromBytes = CURVE.fromBytes || ((
|
46401
|
-
const tail =
|
46730
|
+
const fromBytes = CURVE.fromBytes || ((bytes3) => {
|
46731
|
+
const tail = bytes3.subarray(1);
|
46402
46732
|
const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES));
|
46403
46733
|
const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES));
|
46404
46734
|
return { x, y };
|
@@ -46761,7 +47091,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46761
47091
|
}
|
46762
47092
|
toRawBytes(isCompressed = true) {
|
46763
47093
|
this.assertValidity();
|
46764
|
-
return
|
47094
|
+
return toBytes4(Point2, this, isCompressed);
|
46765
47095
|
}
|
46766
47096
|
toHex(isCompressed = true) {
|
46767
47097
|
return bytesToHex(this.toRawBytes(isCompressed));
|
@@ -46811,23 +47141,29 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46811
47141
|
toBytes(_c, point, isCompressed) {
|
46812
47142
|
const a = point.toAffine();
|
46813
47143
|
const x = Fp2.toBytes(a.x);
|
46814
|
-
const cat =
|
47144
|
+
const cat = concatBytes2;
|
46815
47145
|
if (isCompressed) {
|
46816
47146
|
return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x);
|
46817
47147
|
} else {
|
46818
47148
|
return cat(Uint8Array.from([4]), x, Fp2.toBytes(a.y));
|
46819
47149
|
}
|
46820
47150
|
},
|
46821
|
-
fromBytes(
|
46822
|
-
const len =
|
46823
|
-
const head =
|
46824
|
-
const tail =
|
47151
|
+
fromBytes(bytes3) {
|
47152
|
+
const len = bytes3.length;
|
47153
|
+
const head = bytes3[0];
|
47154
|
+
const tail = bytes3.subarray(1);
|
46825
47155
|
if (len === compressedLen && (head === 2 || head === 3)) {
|
46826
47156
|
const x = bytesToNumberBE(tail);
|
46827
47157
|
if (!isValidFieldElement(x))
|
46828
47158
|
throw new Error("Point is not on curve");
|
46829
47159
|
const y2 = weierstrassEquation(x);
|
46830
|
-
let y
|
47160
|
+
let y;
|
47161
|
+
try {
|
47162
|
+
y = Fp2.sqrt(y2);
|
47163
|
+
} catch (sqrtError) {
|
47164
|
+
const suffix = sqrtError instanceof Error ? ": " + sqrtError.message : "";
|
47165
|
+
throw new Error("Point is not on curve" + suffix);
|
47166
|
+
}
|
46831
47167
|
const isYOdd = (y & _1n5) === _1n5;
|
46832
47168
|
const isHeadOdd = (head & 1) === 1;
|
46833
47169
|
if (isHeadOdd !== isYOdd)
|
@@ -46843,9 +47179,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46843
47179
|
}
|
46844
47180
|
});
|
46845
47181
|
const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
|
46846
|
-
function isBiggerThanHalfOrder(
|
47182
|
+
function isBiggerThanHalfOrder(number3) {
|
46847
47183
|
const HALF = CURVE_ORDER >> _1n5;
|
46848
|
-
return
|
47184
|
+
return number3 > HALF;
|
46849
47185
|
}
|
46850
47186
|
function normalizeS(s) {
|
46851
47187
|
return isBiggerThanHalfOrder(s) ? modN(-s) : s;
|
@@ -46975,13 +47311,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46975
47311
|
const b = Point2.fromHex(publicB);
|
46976
47312
|
return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
|
46977
47313
|
}
|
46978
|
-
const bits2int = CURVE.bits2int || function(
|
46979
|
-
const num = bytesToNumberBE(
|
46980
|
-
const delta =
|
47314
|
+
const bits2int = CURVE.bits2int || function(bytes3) {
|
47315
|
+
const num = bytesToNumberBE(bytes3);
|
47316
|
+
const delta = bytes3.length * 8 - CURVE.nBitLength;
|
46981
47317
|
return delta > 0 ? num >> BigInt(delta) : num;
|
46982
47318
|
};
|
46983
|
-
const bits2int_modN = CURVE.bits2int_modN || function(
|
46984
|
-
return modN(bits2int(
|
47319
|
+
const bits2int_modN = CURVE.bits2int_modN || function(bytes3) {
|
47320
|
+
return modN(bits2int(bytes3));
|
46985
47321
|
};
|
46986
47322
|
const ORDER_MASK = bitMask(CURVE.nBitLength);
|
46987
47323
|
function int2octets(num) {
|
@@ -46994,21 +47330,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46994
47330
|
function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
|
46995
47331
|
if (["recovered", "canonical"].some((k) => k in opts))
|
46996
47332
|
throw new Error("sign() legacy options not supported");
|
46997
|
-
const { hash:
|
47333
|
+
const { hash: hash4, randomBytes: randomBytes4 } = CURVE;
|
46998
47334
|
let { lowS, prehash, extraEntropy: ent } = opts;
|
46999
47335
|
if (lowS == null)
|
47000
47336
|
lowS = true;
|
47001
47337
|
msgHash = ensureBytes("msgHash", msgHash);
|
47002
47338
|
if (prehash)
|
47003
|
-
msgHash = ensureBytes("prehashed msgHash",
|
47339
|
+
msgHash = ensureBytes("prehashed msgHash", hash4(msgHash));
|
47004
47340
|
const h1int = bits2int_modN(msgHash);
|
47005
47341
|
const d = normPrivateKeyToScalar(privateKey);
|
47006
47342
|
const seedArgs = [int2octets(d), int2octets(h1int)];
|
47007
|
-
if (ent != null) {
|
47008
|
-
const e = ent === true ?
|
47343
|
+
if (ent != null && ent !== false) {
|
47344
|
+
const e = ent === true ? randomBytes4(Fp2.BYTES) : ent;
|
47009
47345
|
seedArgs.push(ensureBytes("extraEntropy", e));
|
47010
47346
|
}
|
47011
|
-
const seed =
|
47347
|
+
const seed = concatBytes2(...seedArgs);
|
47012
47348
|
const m = h1int;
|
47013
47349
|
function k2sig(kBytes) {
|
47014
47350
|
const k = bits2int(kBytes);
|
@@ -47098,20 +47434,85 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47098
47434
|
};
|
47099
47435
|
}
|
47100
47436
|
|
47101
|
-
// ../../node_modules/.pnpm/@noble+
|
47102
|
-
|
47437
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/hmac.js
|
47438
|
+
var HMAC2 = class extends Hash2 {
|
47439
|
+
constructor(hash4, _key) {
|
47440
|
+
super();
|
47441
|
+
this.finished = false;
|
47442
|
+
this.destroyed = false;
|
47443
|
+
hash3(hash4);
|
47444
|
+
const key = toBytes3(_key);
|
47445
|
+
this.iHash = hash4.create();
|
47446
|
+
if (typeof this.iHash.update !== "function")
|
47447
|
+
throw new Error("Expected instance of class which extends utils.Hash");
|
47448
|
+
this.blockLen = this.iHash.blockLen;
|
47449
|
+
this.outputLen = this.iHash.outputLen;
|
47450
|
+
const blockLen = this.blockLen;
|
47451
|
+
const pad3 = new Uint8Array(blockLen);
|
47452
|
+
pad3.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
|
47453
|
+
for (let i = 0; i < pad3.length; i++)
|
47454
|
+
pad3[i] ^= 54;
|
47455
|
+
this.iHash.update(pad3);
|
47456
|
+
this.oHash = hash4.create();
|
47457
|
+
for (let i = 0; i < pad3.length; i++)
|
47458
|
+
pad3[i] ^= 54 ^ 92;
|
47459
|
+
this.oHash.update(pad3);
|
47460
|
+
pad3.fill(0);
|
47461
|
+
}
|
47462
|
+
update(buf) {
|
47463
|
+
exists2(this);
|
47464
|
+
this.iHash.update(buf);
|
47465
|
+
return this;
|
47466
|
+
}
|
47467
|
+
digestInto(out) {
|
47468
|
+
exists2(this);
|
47469
|
+
bytes2(out, this.outputLen);
|
47470
|
+
this.finished = true;
|
47471
|
+
this.iHash.digestInto(out);
|
47472
|
+
this.oHash.update(out);
|
47473
|
+
this.oHash.digestInto(out);
|
47474
|
+
this.destroy();
|
47475
|
+
}
|
47476
|
+
digest() {
|
47477
|
+
const out = new Uint8Array(this.oHash.outputLen);
|
47478
|
+
this.digestInto(out);
|
47479
|
+
return out;
|
47480
|
+
}
|
47481
|
+
_cloneInto(to) {
|
47482
|
+
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
47483
|
+
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
47484
|
+
to = to;
|
47485
|
+
to.finished = finished;
|
47486
|
+
to.destroyed = destroyed;
|
47487
|
+
to.blockLen = blockLen;
|
47488
|
+
to.outputLen = outputLen;
|
47489
|
+
to.oHash = oHash._cloneInto(to.oHash);
|
47490
|
+
to.iHash = iHash._cloneInto(to.iHash);
|
47491
|
+
return to;
|
47492
|
+
}
|
47493
|
+
destroy() {
|
47494
|
+
this.destroyed = true;
|
47495
|
+
this.oHash.destroy();
|
47496
|
+
this.iHash.destroy();
|
47497
|
+
}
|
47498
|
+
};
|
47499
|
+
var hmac2 = (hash4, key, message) => new HMAC2(hash4, key).update(message).digest();
|
47500
|
+
hmac2.create = (hash4, key) => new HMAC2(hash4, key);
|
47501
|
+
|
47502
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/_shortw_utils.js
|
47503
|
+
function getHash(hash4) {
|
47103
47504
|
return {
|
47104
|
-
hash:
|
47105
|
-
hmac: (key, ...msgs) =>
|
47106
|
-
randomBytes
|
47505
|
+
hash: hash4,
|
47506
|
+
hmac: (key, ...msgs) => hmac2(hash4, key, concatBytes3(...msgs)),
|
47507
|
+
randomBytes: randomBytes3
|
47107
47508
|
};
|
47108
47509
|
}
|
47109
47510
|
function createCurve(curveDef, defHash) {
|
47110
|
-
const create = (
|
47511
|
+
const create = (hash4) => weierstrass({ ...curveDef, ...getHash(hash4) });
|
47111
47512
|
return Object.freeze({ ...create(defHash), create });
|
47112
47513
|
}
|
47113
47514
|
|
47114
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
47515
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/secp256k1.js
|
47115
47516
|
var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
|
47116
47517
|
var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
47117
47518
|
var _1n6 = BigInt(1);
|
@@ -47187,7 +47588,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47187
47588
|
return { k1neg, k1, k2neg, k2 };
|
47188
47589
|
}
|
47189
47590
|
}
|
47190
|
-
},
|
47591
|
+
}, sha2563);
|
47191
47592
|
var _0n6 = BigInt(0);
|
47192
47593
|
var Point = secp256k1.ProjectivePoint;
|
47193
47594
|
|
@@ -47280,7 +47681,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47280
47681
|
* @returns random 32-byte hashed
|
47281
47682
|
*/
|
47282
47683
|
static generatePrivateKey(entropy) {
|
47283
|
-
return entropy ? hash2(concat([
|
47684
|
+
return entropy ? hash2(concat([randomBytes2(32), arrayify(entropy)])) : randomBytes2(32);
|
47284
47685
|
}
|
47285
47686
|
/**
|
47286
47687
|
* Extended publicKey from a compact publicKey
|
@@ -47356,7 +47757,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47356
47757
|
async function encryptKeystoreWallet(privateKey, address, password) {
|
47357
47758
|
const privateKeyBuffer = bufferFromString2(removeHexPrefix(privateKey), "hex");
|
47358
47759
|
const ownerAddress = Address.fromAddressOrString(address);
|
47359
|
-
const salt =
|
47760
|
+
const salt = randomBytes2(DEFAULT_KEY_SIZE);
|
47360
47761
|
const key = scrypt22({
|
47361
47762
|
password: bufferFromString2(password),
|
47362
47763
|
salt,
|
@@ -47365,7 +47766,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47365
47766
|
r: DEFAULT_KDF_PARAMS_R,
|
47366
47767
|
p: DEFAULT_KDF_PARAMS_P
|
47367
47768
|
});
|
47368
|
-
const iv =
|
47769
|
+
const iv = randomBytes2(DEFAULT_IV_SIZE);
|
47369
47770
|
const ciphertext = await encryptJsonWalletData2(privateKeyBuffer, key, iv);
|
47370
47771
|
const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
|
47371
47772
|
const macHashUint8Array = keccak2562(data);
|
@@ -49861,7 +50262,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49861
50262
|
* @returns A randomly generated mnemonic
|
49862
50263
|
*/
|
49863
50264
|
static generate(size = 32, extraEntropy = "") {
|
49864
|
-
const entropy = extraEntropy ? sha2562(concat([
|
50265
|
+
const entropy = extraEntropy ? sha2562(concat([randomBytes2(size), arrayify(extraEntropy)])) : randomBytes2(size);
|
49865
50266
|
return Mnemonic.entropyToMnemonic(entropy);
|
49866
50267
|
}
|
49867
50268
|
};
|
@@ -49962,9 +50363,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49962
50363
|
data.set(arrayify(this.publicKey));
|
49963
50364
|
}
|
49964
50365
|
data.set(toBytes2(index, 4), 33);
|
49965
|
-
const
|
49966
|
-
const IL =
|
49967
|
-
const IR =
|
50366
|
+
const bytes3 = arrayify(computeHmac2("sha512", chainCode, data));
|
50367
|
+
const IL = bytes3.slice(0, 32);
|
50368
|
+
const IR = bytes3.slice(32);
|
49968
50369
|
if (privateKey) {
|
49969
50370
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
49970
50371
|
const ki = bn(IL).add(privateKey).mod(N).toBytes(32);
|
@@ -50034,26 +50435,26 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50034
50435
|
}
|
50035
50436
|
static fromExtendedKey(extendedKey) {
|
50036
50437
|
const decoded = hexlify(toBytes2(decodeBase58(extendedKey)));
|
50037
|
-
const
|
50038
|
-
const validChecksum = base58check(
|
50039
|
-
if (
|
50438
|
+
const bytes3 = arrayify(decoded);
|
50439
|
+
const validChecksum = base58check(bytes3.slice(0, 78)) === extendedKey;
|
50440
|
+
if (bytes3.length !== 82 || !isValidExtendedKey(bytes3)) {
|
50040
50441
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
50041
50442
|
}
|
50042
50443
|
if (!validChecksum) {
|
50043
50444
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
50044
50445
|
}
|
50045
|
-
const depth =
|
50046
|
-
const parentFingerprint = hexlify(
|
50047
|
-
const index = parseInt(hexlify(
|
50048
|
-
const chainCode = hexlify(
|
50049
|
-
const key =
|
50446
|
+
const depth = bytes3[4];
|
50447
|
+
const parentFingerprint = hexlify(bytes3.slice(5, 9));
|
50448
|
+
const index = parseInt(hexlify(bytes3.slice(9, 13)).substring(2), 16);
|
50449
|
+
const chainCode = hexlify(bytes3.slice(13, 45));
|
50450
|
+
const key = bytes3.slice(45, 78);
|
50050
50451
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
50051
50452
|
throw new FuelError(
|
50052
50453
|
ErrorCode.HD_WALLET_ERROR,
|
50053
50454
|
"Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
|
50054
50455
|
);
|
50055
50456
|
}
|
50056
|
-
if (isPublicExtendedKey(
|
50457
|
+
if (isPublicExtendedKey(bytes3)) {
|
50057
50458
|
if (key[0] !== 3) {
|
50058
50459
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
|
50059
50460
|
}
|
@@ -50235,7 +50636,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50235
50636
|
var seedTestWallet = async (wallet, quantities, utxosAmount = 1) => {
|
50236
50637
|
const accountsToBeFunded = Array.isArray(wallet) ? wallet : [wallet];
|
50237
50638
|
const [{ provider }] = accountsToBeFunded;
|
50238
|
-
const genesisWallet = new WalletUnlocked(process.env.GENESIS_SECRET ||
|
50639
|
+
const genesisWallet = new WalletUnlocked(process.env.GENESIS_SECRET || randomBytes2(32), provider);
|
50239
50640
|
const request = new ScriptTransactionRequest();
|
50240
50641
|
quantities.map(coinQuantityfy).forEach(
|
50241
50642
|
({ amount, assetId }) => accountsToBeFunded.forEach(({ address }) => {
|
@@ -50315,7 +50716,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50315
50716
|
const signer = new Signer(pk);
|
50316
50717
|
process.env.GENESIS_SECRET = hexlify(pk);
|
50317
50718
|
coins.push({
|
50318
|
-
tx_id: hexlify(
|
50719
|
+
tx_id: hexlify(randomBytes2(BYTES_32)),
|
50319
50720
|
owner: signer.address.toHexString(),
|
50320
50721
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
50321
50722
|
amount: "18446744073709551615",
|
@@ -50480,7 +50881,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50480
50881
|
static random(count = 1) {
|
50481
50882
|
const assetIds = [];
|
50482
50883
|
for (let i = 0; i < count; i++) {
|
50483
|
-
assetIds.push(new _AssetId(hexlify(
|
50884
|
+
assetIds.push(new _AssetId(hexlify(randomBytes2(32))));
|
50484
50885
|
}
|
50485
50886
|
return assetIds;
|
50486
50887
|
}
|
@@ -50501,7 +50902,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50501
50902
|
generateWallets = () => {
|
50502
50903
|
const generatedWallets = [];
|
50503
50904
|
for (let index = 1; index <= this.options.count; index++) {
|
50504
|
-
generatedWallets.push(new WalletUnlocked(
|
50905
|
+
generatedWallets.push(new WalletUnlocked(randomBytes2(32)));
|
50505
50906
|
}
|
50506
50907
|
return generatedWallets;
|
50507
50908
|
};
|
@@ -50558,7 +50959,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50558
50959
|
tx_pointer_block_height: 0,
|
50559
50960
|
tx_pointer_tx_idx: 0,
|
50560
50961
|
output_index: 0,
|
50561
|
-
tx_id: hexlify(
|
50962
|
+
tx_id: hexlify(randomBytes2(32))
|
50562
50963
|
});
|
50563
50964
|
}
|
50564
50965
|
});
|
@@ -50664,7 +51065,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50664
51065
|
constructor({
|
50665
51066
|
sender = Address.fromRandom(),
|
50666
51067
|
recipient = Address.fromRandom(),
|
50667
|
-
nonce = hexlify(
|
51068
|
+
nonce = hexlify(randomBytes2(32)),
|
50668
51069
|
amount = 1e6,
|
50669
51070
|
data = "02",
|
50670
51071
|
da_height = 0
|
@@ -50712,6 +51113,9 @@ mime-types/index.js:
|
|
50712
51113
|
@noble/curves/esm/abstract/utils.js:
|
50713
51114
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
50714
51115
|
|
51116
|
+
@noble/hashes/esm/utils.js:
|
51117
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
51118
|
+
|
50715
51119
|
@noble/curves/esm/abstract/modular.js:
|
50716
51120
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
50717
51121
|
|