@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
package/dist/index.global.js
CHANGED
@@ -85,20 +85,20 @@
|
|
85
85
|
ctor.prototype = new TempCtor();
|
86
86
|
ctor.prototype.constructor = ctor;
|
87
87
|
}
|
88
|
-
function BN2(
|
89
|
-
if (BN2.isBN(
|
90
|
-
return
|
88
|
+
function BN2(number3, base, endian) {
|
89
|
+
if (BN2.isBN(number3)) {
|
90
|
+
return number3;
|
91
91
|
}
|
92
92
|
this.negative = 0;
|
93
93
|
this.words = null;
|
94
94
|
this.length = 0;
|
95
95
|
this.red = null;
|
96
|
-
if (
|
96
|
+
if (number3 !== null) {
|
97
97
|
if (base === "le" || base === "be") {
|
98
98
|
endian = base;
|
99
99
|
base = 10;
|
100
100
|
}
|
101
|
-
this._init(
|
101
|
+
this._init(number3 || 0, base || 10, endian || "be");
|
102
102
|
}
|
103
103
|
}
|
104
104
|
if (typeof module2 === "object") {
|
@@ -133,53 +133,53 @@
|
|
133
133
|
return left;
|
134
134
|
return right;
|
135
135
|
};
|
136
|
-
BN2.prototype._init = function init(
|
137
|
-
if (typeof
|
138
|
-
return this._initNumber(
|
136
|
+
BN2.prototype._init = function init(number3, base, endian) {
|
137
|
+
if (typeof number3 === "number") {
|
138
|
+
return this._initNumber(number3, base, endian);
|
139
139
|
}
|
140
|
-
if (typeof
|
141
|
-
return this._initArray(
|
140
|
+
if (typeof number3 === "object") {
|
141
|
+
return this._initArray(number3, base, endian);
|
142
142
|
}
|
143
143
|
if (base === "hex") {
|
144
144
|
base = 16;
|
145
145
|
}
|
146
146
|
assert2(base === (base | 0) && base >= 2 && base <= 36);
|
147
|
-
|
147
|
+
number3 = number3.toString().replace(/\s+/g, "");
|
148
148
|
var start = 0;
|
149
|
-
if (
|
149
|
+
if (number3[0] === "-") {
|
150
150
|
start++;
|
151
151
|
this.negative = 1;
|
152
152
|
}
|
153
|
-
if (start <
|
153
|
+
if (start < number3.length) {
|
154
154
|
if (base === 16) {
|
155
|
-
this._parseHex(
|
155
|
+
this._parseHex(number3, start, endian);
|
156
156
|
} else {
|
157
|
-
this._parseBase(
|
157
|
+
this._parseBase(number3, base, start);
|
158
158
|
if (endian === "le") {
|
159
159
|
this._initArray(this.toArray(), base, endian);
|
160
160
|
}
|
161
161
|
}
|
162
162
|
}
|
163
163
|
};
|
164
|
-
BN2.prototype._initNumber = function _initNumber(
|
165
|
-
if (
|
164
|
+
BN2.prototype._initNumber = function _initNumber(number3, base, endian) {
|
165
|
+
if (number3 < 0) {
|
166
166
|
this.negative = 1;
|
167
|
-
|
167
|
+
number3 = -number3;
|
168
168
|
}
|
169
|
-
if (
|
170
|
-
this.words = [
|
169
|
+
if (number3 < 67108864) {
|
170
|
+
this.words = [number3 & 67108863];
|
171
171
|
this.length = 1;
|
172
|
-
} else if (
|
172
|
+
} else if (number3 < 4503599627370496) {
|
173
173
|
this.words = [
|
174
|
-
|
175
|
-
|
174
|
+
number3 & 67108863,
|
175
|
+
number3 / 67108864 & 67108863
|
176
176
|
];
|
177
177
|
this.length = 2;
|
178
178
|
} else {
|
179
|
-
assert2(
|
179
|
+
assert2(number3 < 9007199254740992);
|
180
180
|
this.words = [
|
181
|
-
|
182
|
-
|
181
|
+
number3 & 67108863,
|
182
|
+
number3 / 67108864 & 67108863,
|
183
183
|
1
|
184
184
|
];
|
185
185
|
this.length = 3;
|
@@ -188,14 +188,14 @@
|
|
188
188
|
return;
|
189
189
|
this._initArray(this.toArray(), base, endian);
|
190
190
|
};
|
191
|
-
BN2.prototype._initArray = function _initArray(
|
192
|
-
assert2(typeof
|
193
|
-
if (
|
191
|
+
BN2.prototype._initArray = function _initArray(number3, base, endian) {
|
192
|
+
assert2(typeof number3.length === "number");
|
193
|
+
if (number3.length <= 0) {
|
194
194
|
this.words = [0];
|
195
195
|
this.length = 1;
|
196
196
|
return this;
|
197
197
|
}
|
198
|
-
this.length = Math.ceil(
|
198
|
+
this.length = Math.ceil(number3.length / 3);
|
199
199
|
this.words = new Array(this.length);
|
200
200
|
for (var i = 0; i < this.length; i++) {
|
201
201
|
this.words[i] = 0;
|
@@ -203,8 +203,8 @@
|
|
203
203
|
var j, w;
|
204
204
|
var off = 0;
|
205
205
|
if (endian === "be") {
|
206
|
-
for (i =
|
207
|
-
w =
|
206
|
+
for (i = number3.length - 1, j = 0; i >= 0; i -= 3) {
|
207
|
+
w = number3[i] | number3[i - 1] << 8 | number3[i - 2] << 16;
|
208
208
|
this.words[j] |= w << off & 67108863;
|
209
209
|
this.words[j + 1] = w >>> 26 - off & 67108863;
|
210
210
|
off += 24;
|
@@ -214,8 +214,8 @@
|
|
214
214
|
}
|
215
215
|
}
|
216
216
|
} else if (endian === "le") {
|
217
|
-
for (i = 0, j = 0; i <
|
218
|
-
w =
|
217
|
+
for (i = 0, j = 0; i < number3.length; i += 3) {
|
218
|
+
w = number3[i] | number3[i + 1] << 8 | number3[i + 2] << 16;
|
219
219
|
this.words[j] |= w << off & 67108863;
|
220
220
|
this.words[j + 1] = w >>> 26 - off & 67108863;
|
221
221
|
off += 24;
|
@@ -246,8 +246,8 @@
|
|
246
246
|
}
|
247
247
|
return r;
|
248
248
|
}
|
249
|
-
BN2.prototype._parseHex = function _parseHex(
|
250
|
-
this.length = Math.ceil((
|
249
|
+
BN2.prototype._parseHex = function _parseHex(number3, start, endian) {
|
250
|
+
this.length = Math.ceil((number3.length - start) / 6);
|
251
251
|
this.words = new Array(this.length);
|
252
252
|
for (var i = 0; i < this.length; i++) {
|
253
253
|
this.words[i] = 0;
|
@@ -256,8 +256,8 @@
|
|
256
256
|
var j = 0;
|
257
257
|
var w;
|
258
258
|
if (endian === "be") {
|
259
|
-
for (i =
|
260
|
-
w = parseHexByte(
|
259
|
+
for (i = number3.length - 1; i >= start; i -= 2) {
|
260
|
+
w = parseHexByte(number3, start, i) << off;
|
261
261
|
this.words[j] |= w & 67108863;
|
262
262
|
if (off >= 18) {
|
263
263
|
off -= 18;
|
@@ -268,9 +268,9 @@
|
|
268
268
|
}
|
269
269
|
}
|
270
270
|
} else {
|
271
|
-
var parseLength =
|
272
|
-
for (i = parseLength % 2 === 0 ? start + 1 : start; i <
|
273
|
-
w = parseHexByte(
|
271
|
+
var parseLength = number3.length - start;
|
272
|
+
for (i = parseLength % 2 === 0 ? start + 1 : start; i < number3.length; i += 2) {
|
273
|
+
w = parseHexByte(number3, start, i) << off;
|
274
274
|
this.words[j] |= w & 67108863;
|
275
275
|
if (off >= 18) {
|
276
276
|
off -= 18;
|
@@ -302,7 +302,7 @@
|
|
302
302
|
}
|
303
303
|
return r;
|
304
304
|
}
|
305
|
-
BN2.prototype._parseBase = function _parseBase(
|
305
|
+
BN2.prototype._parseBase = function _parseBase(number3, base, start) {
|
306
306
|
this.words = [0];
|
307
307
|
this.length = 1;
|
308
308
|
for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) {
|
@@ -310,12 +310,12 @@
|
|
310
310
|
}
|
311
311
|
limbLen--;
|
312
312
|
limbPow = limbPow / base | 0;
|
313
|
-
var total =
|
313
|
+
var total = number3.length - start;
|
314
314
|
var mod2 = total % limbLen;
|
315
315
|
var end = Math.min(total, total - mod2) + start;
|
316
316
|
var word = 0;
|
317
317
|
for (var i = start; i < end; i += limbLen) {
|
318
|
-
word = parseBase(
|
318
|
+
word = parseBase(number3, i, i + limbLen, base);
|
319
319
|
this.imuln(limbPow);
|
320
320
|
if (this.words[0] + word < 67108864) {
|
321
321
|
this.words[0] += word;
|
@@ -325,7 +325,7 @@
|
|
325
325
|
}
|
326
326
|
if (mod2 !== 0) {
|
327
327
|
var pow3 = 1;
|
328
|
-
word = parseBase(
|
328
|
+
word = parseBase(number3, i, number3.length, base);
|
329
329
|
for (i = 0; i < mod2; i++) {
|
330
330
|
pow3 *= base;
|
331
331
|
}
|
@@ -2651,20 +2651,20 @@
|
|
2651
2651
|
);
|
2652
2652
|
}
|
2653
2653
|
inherits(K256, MPrime);
|
2654
|
-
K256.prototype.split = function split2(input,
|
2654
|
+
K256.prototype.split = function split2(input, output3) {
|
2655
2655
|
var mask = 4194303;
|
2656
2656
|
var outLen = Math.min(input.length, 9);
|
2657
2657
|
for (var i = 0; i < outLen; i++) {
|
2658
|
-
|
2658
|
+
output3.words[i] = input.words[i];
|
2659
2659
|
}
|
2660
|
-
|
2660
|
+
output3.length = outLen;
|
2661
2661
|
if (input.length <= 9) {
|
2662
2662
|
input.words[0] = 0;
|
2663
2663
|
input.length = 1;
|
2664
2664
|
return;
|
2665
2665
|
}
|
2666
2666
|
var prev = input.words[9];
|
2667
|
-
|
2667
|
+
output3.words[output3.length++] = prev & mask;
|
2668
2668
|
for (i = 10; i < input.length; i++) {
|
2669
2669
|
var next = input.words[i] | 0;
|
2670
2670
|
input.words[i - 10] = (next & mask) << 4 | prev >>> 22;
|
@@ -3060,8 +3060,8 @@
|
|
3060
3060
|
}
|
3061
3061
|
return result;
|
3062
3062
|
}
|
3063
|
-
function toWords(
|
3064
|
-
return convert2(
|
3063
|
+
function toWords(bytes3) {
|
3064
|
+
return convert2(bytes3, 8, 5, true);
|
3065
3065
|
}
|
3066
3066
|
function fromWordsUnsafe(words) {
|
3067
3067
|
const res = convert2(words, 5, 8, false);
|
@@ -3600,18 +3600,18 @@
|
|
3600
3600
|
}
|
3601
3601
|
function utf8PercentDecode(str) {
|
3602
3602
|
const input = new Buffer(str);
|
3603
|
-
const
|
3603
|
+
const output3 = [];
|
3604
3604
|
for (let i = 0; i < input.length; ++i) {
|
3605
3605
|
if (input[i] !== 37) {
|
3606
|
-
|
3606
|
+
output3.push(input[i]);
|
3607
3607
|
} else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) {
|
3608
|
-
|
3608
|
+
output3.push(parseInt(input.slice(i + 1, i + 3).toString(), 16));
|
3609
3609
|
i += 2;
|
3610
3610
|
} else {
|
3611
|
-
|
3611
|
+
output3.push(input[i]);
|
3612
3612
|
}
|
3613
3613
|
}
|
3614
|
-
return new Buffer(
|
3614
|
+
return new Buffer(output3).toString();
|
3615
3615
|
}
|
3616
3616
|
function isC0ControlPercentEncode(c) {
|
3617
3617
|
return c <= 31 || c > 126;
|
@@ -3687,16 +3687,16 @@
|
|
3687
3687
|
return ipv4;
|
3688
3688
|
}
|
3689
3689
|
function serializeIPv4(address) {
|
3690
|
-
let
|
3690
|
+
let output3 = "";
|
3691
3691
|
let n = address;
|
3692
3692
|
for (let i = 1; i <= 4; ++i) {
|
3693
|
-
|
3693
|
+
output3 = String(n % 256) + output3;
|
3694
3694
|
if (i !== 4) {
|
3695
|
-
|
3695
|
+
output3 = "." + output3;
|
3696
3696
|
}
|
3697
3697
|
n = Math.floor(n / 256);
|
3698
3698
|
}
|
3699
|
-
return
|
3699
|
+
return output3;
|
3700
3700
|
}
|
3701
3701
|
function parseIPv6(input) {
|
3702
3702
|
const address = [0, 0, 0, 0, 0, 0, 0, 0];
|
@@ -3754,13 +3754,13 @@
|
|
3754
3754
|
return failure;
|
3755
3755
|
}
|
3756
3756
|
while (isASCIIDigit(input[pointer])) {
|
3757
|
-
const
|
3757
|
+
const number3 = parseInt(at(input, pointer));
|
3758
3758
|
if (ipv4Piece === null) {
|
3759
|
-
ipv4Piece =
|
3759
|
+
ipv4Piece = number3;
|
3760
3760
|
} else if (ipv4Piece === 0) {
|
3761
3761
|
return failure;
|
3762
3762
|
} else {
|
3763
|
-
ipv4Piece = ipv4Piece * 10 +
|
3763
|
+
ipv4Piece = ipv4Piece * 10 + number3;
|
3764
3764
|
}
|
3765
3765
|
if (ipv4Piece > 255) {
|
3766
3766
|
return failure;
|
@@ -3804,7 +3804,7 @@
|
|
3804
3804
|
return address;
|
3805
3805
|
}
|
3806
3806
|
function serializeIPv6(address) {
|
3807
|
-
let
|
3807
|
+
let output3 = "";
|
3808
3808
|
const seqResult = findLongestZeroSequence(address);
|
3809
3809
|
const compress = seqResult.idx;
|
3810
3810
|
let ignore0 = false;
|
@@ -3816,16 +3816,16 @@
|
|
3816
3816
|
}
|
3817
3817
|
if (compress === pieceIndex) {
|
3818
3818
|
const separator = pieceIndex === 0 ? "::" : ":";
|
3819
|
-
|
3819
|
+
output3 += separator;
|
3820
3820
|
ignore0 = true;
|
3821
3821
|
continue;
|
3822
3822
|
}
|
3823
|
-
|
3823
|
+
output3 += address[pieceIndex].toString(16);
|
3824
3824
|
if (pieceIndex !== 7) {
|
3825
|
-
|
3825
|
+
output3 += ":";
|
3826
3826
|
}
|
3827
3827
|
}
|
3828
|
-
return
|
3828
|
+
return output3;
|
3829
3829
|
}
|
3830
3830
|
function parseHost(input, isSpecialArg) {
|
3831
3831
|
if (input[0] === "[") {
|
@@ -3855,12 +3855,12 @@
|
|
3855
3855
|
if (containsForbiddenHostCodePointExcludingPercent(input)) {
|
3856
3856
|
return failure;
|
3857
3857
|
}
|
3858
|
-
let
|
3858
|
+
let output3 = "";
|
3859
3859
|
const decoded = punycode.ucs2.decode(input);
|
3860
3860
|
for (let i = 0; i < decoded.length; ++i) {
|
3861
|
-
|
3861
|
+
output3 += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
|
3862
3862
|
}
|
3863
|
-
return
|
3863
|
+
return output3;
|
3864
3864
|
}
|
3865
3865
|
function findLongestZeroSequence(arr) {
|
3866
3866
|
let maxIdx = null;
|
@@ -4485,37 +4485,37 @@
|
|
4485
4485
|
return true;
|
4486
4486
|
};
|
4487
4487
|
function serializeURL(url, excludeFragment) {
|
4488
|
-
let
|
4488
|
+
let output3 = url.scheme + ":";
|
4489
4489
|
if (url.host !== null) {
|
4490
|
-
|
4490
|
+
output3 += "//";
|
4491
4491
|
if (url.username !== "" || url.password !== "") {
|
4492
|
-
|
4492
|
+
output3 += url.username;
|
4493
4493
|
if (url.password !== "") {
|
4494
|
-
|
4494
|
+
output3 += ":" + url.password;
|
4495
4495
|
}
|
4496
|
-
|
4496
|
+
output3 += "@";
|
4497
4497
|
}
|
4498
|
-
|
4498
|
+
output3 += serializeHost(url.host);
|
4499
4499
|
if (url.port !== null) {
|
4500
|
-
|
4500
|
+
output3 += ":" + url.port;
|
4501
4501
|
}
|
4502
4502
|
} else if (url.host === null && url.scheme === "file") {
|
4503
|
-
|
4503
|
+
output3 += "//";
|
4504
4504
|
}
|
4505
4505
|
if (url.cannotBeABaseURL) {
|
4506
|
-
|
4506
|
+
output3 += url.path[0];
|
4507
4507
|
} else {
|
4508
4508
|
for (const string of url.path) {
|
4509
|
-
|
4509
|
+
output3 += "/" + string;
|
4510
4510
|
}
|
4511
4511
|
}
|
4512
4512
|
if (url.query !== null) {
|
4513
|
-
|
4513
|
+
output3 += "?" + url.query;
|
4514
4514
|
}
|
4515
4515
|
if (!excludeFragment && url.fragment !== null) {
|
4516
|
-
|
4516
|
+
output3 += "#" + url.fragment;
|
4517
4517
|
}
|
4518
|
-
return
|
4518
|
+
return output3;
|
4519
4519
|
}
|
4520
4520
|
function serializeOrigin(tuple) {
|
4521
4521
|
let result = tuple.scheme + "://";
|
@@ -6459,19 +6459,19 @@
|
|
6459
6459
|
return "GraphQLError";
|
6460
6460
|
}
|
6461
6461
|
toString() {
|
6462
|
-
let
|
6462
|
+
let output3 = this.message;
|
6463
6463
|
if (this.nodes) {
|
6464
6464
|
for (const node of this.nodes) {
|
6465
6465
|
if (node.loc) {
|
6466
|
-
|
6466
|
+
output3 += "\n\n" + (0, _printLocation.printLocation)(node.loc);
|
6467
6467
|
}
|
6468
6468
|
}
|
6469
6469
|
} else if (this.source && this.locations) {
|
6470
6470
|
for (const location of this.locations) {
|
6471
|
-
|
6471
|
+
output3 += "\n\n" + (0, _printLocation.printSourceLocation)(this.source, location);
|
6472
6472
|
}
|
6473
6473
|
}
|
6474
|
-
return
|
6474
|
+
return output3;
|
6475
6475
|
}
|
6476
6476
|
toJSON() {
|
6477
6477
|
const formattedError = {
|
@@ -18786,7 +18786,7 @@ spurious results.`);
|
|
18786
18786
|
module.exports = iterate;
|
18787
18787
|
function iterate(list, iterator, state, callback) {
|
18788
18788
|
var key = state["keyedList"] ? state["keyedList"][state.index] : state.index;
|
18789
|
-
state.jobs[key] = runJob(iterator, key, list[key], function(error,
|
18789
|
+
state.jobs[key] = runJob(iterator, key, list[key], function(error, output3) {
|
18790
18790
|
if (!(key in state.jobs)) {
|
18791
18791
|
return;
|
18792
18792
|
}
|
@@ -18794,7 +18794,7 @@ spurious results.`);
|
|
18794
18794
|
if (error) {
|
18795
18795
|
abort(state);
|
18796
18796
|
} else {
|
18797
|
-
state.results[key] =
|
18797
|
+
state.results[key] = output3;
|
18798
18798
|
}
|
18799
18799
|
callback(error, state.results);
|
18800
18800
|
});
|
@@ -20556,8 +20556,8 @@ spurious results.`);
|
|
20556
20556
|
const ret3 = wasm$1.retd(addr, len);
|
20557
20557
|
return Instruction.__wrap(ret3);
|
20558
20558
|
}
|
20559
|
-
function aloc(
|
20560
|
-
const ret3 = wasm$1.aloc(
|
20559
|
+
function aloc(bytes3) {
|
20560
|
+
const ret3 = wasm$1.aloc(bytes3);
|
20561
20561
|
return Instruction.__wrap(ret3);
|
20562
20562
|
}
|
20563
20563
|
function mcl(dst_addr, len) {
|
@@ -21766,9 +21766,9 @@ spurious results.`);
|
|
21766
21766
|
* Construct the instruction from its parts.
|
21767
21767
|
* @param {RegId} bytes
|
21768
21768
|
*/
|
21769
|
-
constructor(
|
21770
|
-
_assertClass(
|
21771
|
-
var ptr0 =
|
21769
|
+
constructor(bytes3) {
|
21770
|
+
_assertClass(bytes3, RegId);
|
21771
|
+
var ptr0 = bytes3.__destroy_into_raw();
|
21772
21772
|
const ret3 = wasm$1.aloc_new_typescript(ptr0);
|
21773
21773
|
this.__wbg_ptr = ret3 >>> 0;
|
21774
21774
|
return this;
|
@@ -28305,8 +28305,8 @@ spurious results.`);
|
|
28305
28305
|
}
|
28306
28306
|
}
|
28307
28307
|
}
|
28308
|
-
const
|
28309
|
-
return await WebAssembly.instantiate(
|
28308
|
+
const bytes3 = await module2.arrayBuffer();
|
28309
|
+
return await WebAssembly.instantiate(bytes3, imports);
|
28310
28310
|
} else {
|
28311
28311
|
const instance = await WebAssembly.instantiate(module2, imports);
|
28312
28312
|
if (instance instanceof WebAssembly.Instance) {
|
@@ -28839,15 +28839,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
28839
28839
|
// ANCHOR: HELPERS
|
28840
28840
|
// make sure we always include `0x` in hex strings
|
28841
28841
|
toString(base, length) {
|
28842
|
-
const
|
28842
|
+
const output3 = super.toString(base, length);
|
28843
28843
|
if (base === 16 || base === "hex") {
|
28844
|
-
return `0x${
|
28844
|
+
return `0x${output3}`;
|
28845
28845
|
}
|
28846
|
-
return
|
28846
|
+
return output3;
|
28847
28847
|
}
|
28848
28848
|
toHex(bytesPadding) {
|
28849
|
-
const
|
28850
|
-
const bytesLength =
|
28849
|
+
const bytes3 = bytesPadding || 0;
|
28850
|
+
const bytesLength = bytes3 * 2;
|
28851
28851
|
if (this.isNeg()) {
|
28852
28852
|
throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to hex.");
|
28853
28853
|
}
|
@@ -28958,21 +28958,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
28958
28958
|
// END ANCHOR: OVERRIDES to output our BN type
|
28959
28959
|
// ANCHOR: OVERRIDES to avoid losing references
|
28960
28960
|
caller(v, methodName) {
|
28961
|
-
const
|
28962
|
-
if (BN.isBN(
|
28963
|
-
return new BN(
|
28961
|
+
const output3 = super[methodName](new BN(v));
|
28962
|
+
if (BN.isBN(output3)) {
|
28963
|
+
return new BN(output3.toArray());
|
28964
28964
|
}
|
28965
|
-
if (typeof
|
28966
|
-
return
|
28965
|
+
if (typeof output3 === "boolean") {
|
28966
|
+
return output3;
|
28967
28967
|
}
|
28968
|
-
return
|
28968
|
+
return output3;
|
28969
28969
|
}
|
28970
28970
|
clone() {
|
28971
28971
|
return new BN(this.toArray());
|
28972
28972
|
}
|
28973
28973
|
mulTo(num, out) {
|
28974
|
-
const
|
28975
|
-
return new BN(
|
28974
|
+
const output3 = new import_bn.default(this.toArray()).mulTo(num, out);
|
28975
|
+
return new BN(output3.toArray());
|
28976
28976
|
}
|
28977
28977
|
egcd(p) {
|
28978
28978
|
const { a, b, gcd } = new import_bn.default(this.toArray()).egcd(p);
|
@@ -29030,15 +29030,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29030
29030
|
__defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
29031
29031
|
return value;
|
29032
29032
|
};
|
29033
|
-
var chunkAndPadBytes = (
|
29033
|
+
var chunkAndPadBytes = (bytes3, chunkSize) => {
|
29034
29034
|
const chunks = [];
|
29035
|
-
for (let offset = 0; offset <
|
29035
|
+
for (let offset = 0; offset < bytes3.length; offset += chunkSize) {
|
29036
29036
|
const chunk = new Uint8Array(chunkSize);
|
29037
|
-
chunk.set(
|
29037
|
+
chunk.set(bytes3.slice(offset, offset + chunkSize));
|
29038
29038
|
chunks.push(chunk);
|
29039
29039
|
}
|
29040
29040
|
const lastChunk = chunks[chunks.length - 1];
|
29041
|
-
const remainingBytes =
|
29041
|
+
const remainingBytes = bytes3.length % chunkSize;
|
29042
29042
|
const paddedChunkLength = remainingBytes + (8 - remainingBytes % 8) % 8;
|
29043
29043
|
const newChunk = lastChunk.slice(0, paddedChunkLength);
|
29044
29044
|
chunks[chunks.length - 1] = newChunk;
|
@@ -29081,15 +29081,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29081
29081
|
return concatenated;
|
29082
29082
|
};
|
29083
29083
|
var concat = (arrays) => {
|
29084
|
-
const
|
29085
|
-
return concatBytes(
|
29084
|
+
const bytes3 = arrays.map((v) => arrayify(v));
|
29085
|
+
return concatBytes(bytes3);
|
29086
29086
|
};
|
29087
29087
|
var HexCharacters = "0123456789abcdef";
|
29088
29088
|
function hexlify(data) {
|
29089
|
-
const
|
29089
|
+
const bytes3 = arrayify(data);
|
29090
29090
|
let result = "0x";
|
29091
|
-
for (let i = 0; i <
|
29092
|
-
const v =
|
29091
|
+
for (let i = 0; i < bytes3.length; i++) {
|
29092
|
+
const v = bytes3[i];
|
29093
29093
|
result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15];
|
29094
29094
|
}
|
29095
29095
|
return result;
|
@@ -29182,15 +29182,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29182
29182
|
return bn(result);
|
29183
29183
|
}
|
29184
29184
|
function encodeBase58(_value) {
|
29185
|
-
const
|
29186
|
-
let value = bn(
|
29185
|
+
const bytes3 = arrayify(_value);
|
29186
|
+
let value = bn(bytes3);
|
29187
29187
|
let result = "";
|
29188
29188
|
while (value.gt(BN_0)) {
|
29189
29189
|
result = Alphabet[Number(value.mod(BN_58))] + result;
|
29190
29190
|
value = value.div(BN_58);
|
29191
29191
|
}
|
29192
|
-
for (let i = 0; i <
|
29193
|
-
if (
|
29192
|
+
for (let i = 0; i < bytes3.length; i++) {
|
29193
|
+
if (bytes3[i]) {
|
29194
29194
|
break;
|
29195
29195
|
}
|
29196
29196
|
result = Alphabet[0] + result;
|
@@ -29206,11 +29206,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29206
29206
|
return result;
|
29207
29207
|
}
|
29208
29208
|
function dataSlice(data, start, end) {
|
29209
|
-
const
|
29210
|
-
if (end != null && end >
|
29209
|
+
const bytes3 = arrayify(data);
|
29210
|
+
if (end != null && end > bytes3.length) {
|
29211
29211
|
throw new FuelError(ErrorCode.INVALID_DATA, "cannot slice beyond data bounds");
|
29212
29212
|
}
|
29213
|
-
return hexlify(
|
29213
|
+
return hexlify(bytes3.slice(start == null ? 0 : start, end == null ? bytes3.length : end));
|
29214
29214
|
}
|
29215
29215
|
function toUtf8Bytes(stri, form = true) {
|
29216
29216
|
let str = stri;
|
@@ -29247,8 +29247,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29247
29247
|
}
|
29248
29248
|
return new Uint8Array(result);
|
29249
29249
|
}
|
29250
|
-
function onError(reason, offset,
|
29251
|
-
console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${
|
29250
|
+
function onError(reason, offset, bytes3, output3, badCodepoint) {
|
29251
|
+
console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${bytes3}`);
|
29252
29252
|
return offset;
|
29253
29253
|
}
|
29254
29254
|
function helper(codePoints) {
|
@@ -29264,11 +29264,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29264
29264
|
}).join("");
|
29265
29265
|
}
|
29266
29266
|
function getUtf8CodePoints(_bytes) {
|
29267
|
-
const
|
29267
|
+
const bytes3 = arrayify(_bytes, "bytes");
|
29268
29268
|
const result = [];
|
29269
29269
|
let i = 0;
|
29270
|
-
while (i <
|
29271
|
-
const c =
|
29270
|
+
while (i < bytes3.length) {
|
29271
|
+
const c = bytes3[i++];
|
29272
29272
|
if (c >> 7 === 0) {
|
29273
29273
|
result.push(c);
|
29274
29274
|
continue;
|
@@ -29286,21 +29286,21 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29286
29286
|
overlongMask = 65535;
|
29287
29287
|
} else {
|
29288
29288
|
if ((c & 192) === 128) {
|
29289
|
-
i += onError("UNEXPECTED_CONTINUE", i - 1,
|
29289
|
+
i += onError("UNEXPECTED_CONTINUE", i - 1, bytes3, result);
|
29290
29290
|
} else {
|
29291
|
-
i += onError("BAD_PREFIX", i - 1,
|
29291
|
+
i += onError("BAD_PREFIX", i - 1, bytes3, result);
|
29292
29292
|
}
|
29293
29293
|
continue;
|
29294
29294
|
}
|
29295
|
-
if (i - 1 + extraLength >=
|
29296
|
-
i += onError("OVERRUN", i - 1,
|
29295
|
+
if (i - 1 + extraLength >= bytes3.length) {
|
29296
|
+
i += onError("OVERRUN", i - 1, bytes3, result);
|
29297
29297
|
continue;
|
29298
29298
|
}
|
29299
29299
|
let res = c & (1 << 8 - extraLength - 1) - 1;
|
29300
29300
|
for (let j = 0; j < extraLength; j++) {
|
29301
|
-
const nextChar =
|
29301
|
+
const nextChar = bytes3[i];
|
29302
29302
|
if ((nextChar & 192) !== 128) {
|
29303
|
-
i += onError("MISSING_CONTINUE", i,
|
29303
|
+
i += onError("MISSING_CONTINUE", i, bytes3, result);
|
29304
29304
|
res = null;
|
29305
29305
|
break;
|
29306
29306
|
}
|
@@ -29311,23 +29311,23 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29311
29311
|
continue;
|
29312
29312
|
}
|
29313
29313
|
if (res > 1114111) {
|
29314
|
-
i += onError("OUT_OF_RANGE", i - 1 - extraLength,
|
29314
|
+
i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes3, result, res);
|
29315
29315
|
continue;
|
29316
29316
|
}
|
29317
29317
|
if (res >= 55296 && res <= 57343) {
|
29318
|
-
i += onError("UTF16_SURROGATE", i - 1 - extraLength,
|
29318
|
+
i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes3, result, res);
|
29319
29319
|
continue;
|
29320
29320
|
}
|
29321
29321
|
if (res <= overlongMask) {
|
29322
|
-
i += onError("OVERLONG", i - 1 - extraLength,
|
29322
|
+
i += onError("OVERLONG", i - 1 - extraLength, bytes3, result, res);
|
29323
29323
|
continue;
|
29324
29324
|
}
|
29325
29325
|
result.push(res);
|
29326
29326
|
}
|
29327
29327
|
return result;
|
29328
29328
|
}
|
29329
|
-
function toUtf8String(
|
29330
|
-
return helper(getUtf8CodePoints(
|
29329
|
+
function toUtf8String(bytes3) {
|
29330
|
+
return helper(getUtf8CodePoints(bytes3));
|
29331
29331
|
}
|
29332
29332
|
|
29333
29333
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/_assert.js
|
@@ -29344,11 +29344,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29344
29344
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
29345
29345
|
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
29346
29346
|
}
|
29347
|
-
function hash(
|
29348
|
-
if (typeof
|
29347
|
+
function hash(hash4) {
|
29348
|
+
if (typeof hash4 !== "function" || typeof hash4.create !== "function")
|
29349
29349
|
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
29350
|
-
number(
|
29351
|
-
number(
|
29350
|
+
number(hash4.outputLen);
|
29351
|
+
number(hash4.blockLen);
|
29352
29352
|
}
|
29353
29353
|
function exists(instance, checkFinished = true) {
|
29354
29354
|
if (instance.destroyed)
|
@@ -29364,10 +29364,6 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29364
29364
|
}
|
29365
29365
|
}
|
29366
29366
|
|
29367
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
|
29368
|
-
var nc = __toESM(__require("crypto"), 1);
|
29369
|
-
var crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : void 0;
|
29370
|
-
|
29371
29367
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js
|
29372
29368
|
var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
29373
29369
|
function isBytes2(a) {
|
@@ -29390,22 +29386,6 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29390
29386
|
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
29391
29387
|
return data;
|
29392
29388
|
}
|
29393
|
-
function concatBytes2(...arrays) {
|
29394
|
-
let sum = 0;
|
29395
|
-
for (let i = 0; i < arrays.length; i++) {
|
29396
|
-
const a = arrays[i];
|
29397
|
-
if (!isBytes2(a))
|
29398
|
-
throw new Error("Uint8Array expected");
|
29399
|
-
sum += a.length;
|
29400
|
-
}
|
29401
|
-
const res = new Uint8Array(sum);
|
29402
|
-
for (let i = 0, pad3 = 0; i < arrays.length; i++) {
|
29403
|
-
const a = arrays[i];
|
29404
|
-
res.set(a, pad3);
|
29405
|
-
pad3 += a.length;
|
29406
|
-
}
|
29407
|
-
return res;
|
29408
|
-
}
|
29409
29389
|
var Hash = class {
|
29410
29390
|
// Safe version that clones internal state
|
29411
29391
|
clone() {
|
@@ -29435,33 +29415,27 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29435
29415
|
hashC.create = (opts) => hashCons(opts);
|
29436
29416
|
return hashC;
|
29437
29417
|
}
|
29438
|
-
function randomBytes(bytesLength = 32) {
|
29439
|
-
if (crypto && typeof crypto.getRandomValues === "function") {
|
29440
|
-
return crypto.getRandomValues(new Uint8Array(bytesLength));
|
29441
|
-
}
|
29442
|
-
throw new Error("crypto.getRandomValues must be defined");
|
29443
|
-
}
|
29444
29418
|
|
29445
29419
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.js
|
29446
|
-
function setBigUint64(view, byteOffset, value,
|
29420
|
+
function setBigUint64(view, byteOffset, value, isLE3) {
|
29447
29421
|
if (typeof view.setBigUint64 === "function")
|
29448
|
-
return view.setBigUint64(byteOffset, value,
|
29422
|
+
return view.setBigUint64(byteOffset, value, isLE3);
|
29449
29423
|
const _32n2 = BigInt(32);
|
29450
29424
|
const _u32_max = BigInt(4294967295);
|
29451
29425
|
const wh = Number(value >> _32n2 & _u32_max);
|
29452
29426
|
const wl = Number(value & _u32_max);
|
29453
|
-
const h =
|
29454
|
-
const l =
|
29455
|
-
view.setUint32(byteOffset + h, wh,
|
29456
|
-
view.setUint32(byteOffset + l, wl,
|
29427
|
+
const h = isLE3 ? 4 : 0;
|
29428
|
+
const l = isLE3 ? 0 : 4;
|
29429
|
+
view.setUint32(byteOffset + h, wh, isLE3);
|
29430
|
+
view.setUint32(byteOffset + l, wl, isLE3);
|
29457
29431
|
}
|
29458
29432
|
var SHA2 = class extends Hash {
|
29459
|
-
constructor(blockLen, outputLen, padOffset,
|
29433
|
+
constructor(blockLen, outputLen, padOffset, isLE3) {
|
29460
29434
|
super();
|
29461
29435
|
this.blockLen = blockLen;
|
29462
29436
|
this.outputLen = outputLen;
|
29463
29437
|
this.padOffset = padOffset;
|
29464
|
-
this.isLE =
|
29438
|
+
this.isLE = isLE3;
|
29465
29439
|
this.finished = false;
|
29466
29440
|
this.length = 0;
|
29467
29441
|
this.pos = 0;
|
@@ -29498,7 +29472,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29498
29472
|
exists(this);
|
29499
29473
|
output(out, this);
|
29500
29474
|
this.finished = true;
|
29501
|
-
const { buffer, view, blockLen, isLE:
|
29475
|
+
const { buffer, view, blockLen, isLE: isLE3 } = this;
|
29502
29476
|
let { pos } = this;
|
29503
29477
|
buffer[pos++] = 128;
|
29504
29478
|
this.buffer.subarray(pos).fill(0);
|
@@ -29508,7 +29482,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29508
29482
|
}
|
29509
29483
|
for (let i = pos; i < blockLen; i++)
|
29510
29484
|
buffer[i] = 0;
|
29511
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8),
|
29485
|
+
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE3);
|
29512
29486
|
this.process(view, 0);
|
29513
29487
|
const oview = createView(out);
|
29514
29488
|
const len = this.outputLen;
|
@@ -29519,7 +29493,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29519
29493
|
if (outLen > state.length)
|
29520
29494
|
throw new Error("_sha2: outputLen bigger than state");
|
29521
29495
|
for (let i = 0; i < outLen; i++)
|
29522
|
-
oview.setUint32(4 * i, state[i],
|
29496
|
+
oview.setUint32(4 * i, state[i], isLE3);
|
29523
29497
|
}
|
29524
29498
|
digest() {
|
29525
29499
|
const { buffer, outputLen } = this;
|
@@ -29696,24 +29670,24 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29696
29670
|
|
29697
29671
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/hmac.js
|
29698
29672
|
var HMAC = class extends Hash {
|
29699
|
-
constructor(
|
29673
|
+
constructor(hash4, _key) {
|
29700
29674
|
super();
|
29701
29675
|
this.finished = false;
|
29702
29676
|
this.destroyed = false;
|
29703
|
-
hash(
|
29677
|
+
hash(hash4);
|
29704
29678
|
const key = toBytes2(_key);
|
29705
|
-
this.iHash =
|
29679
|
+
this.iHash = hash4.create();
|
29706
29680
|
if (typeof this.iHash.update !== "function")
|
29707
29681
|
throw new Error("Expected instance of class which extends utils.Hash");
|
29708
29682
|
this.blockLen = this.iHash.blockLen;
|
29709
29683
|
this.outputLen = this.iHash.outputLen;
|
29710
29684
|
const blockLen = this.blockLen;
|
29711
29685
|
const pad3 = new Uint8Array(blockLen);
|
29712
|
-
pad3.set(key.length > blockLen ?
|
29686
|
+
pad3.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
|
29713
29687
|
for (let i = 0; i < pad3.length; i++)
|
29714
29688
|
pad3[i] ^= 54;
|
29715
29689
|
this.iHash.update(pad3);
|
29716
|
-
this.oHash =
|
29690
|
+
this.oHash = hash4.create();
|
29717
29691
|
for (let i = 0; i < pad3.length; i++)
|
29718
29692
|
pad3[i] ^= 54 ^ 92;
|
29719
29693
|
this.oHash.update(pad3);
|
@@ -29756,12 +29730,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29756
29730
|
this.iHash.destroy();
|
29757
29731
|
}
|
29758
29732
|
};
|
29759
|
-
var hmac = (
|
29760
|
-
hmac.create = (
|
29733
|
+
var hmac = (hash4, key, message) => new HMAC(hash4, key).update(message).digest();
|
29734
|
+
hmac.create = (hash4, key) => new HMAC(hash4, key);
|
29761
29735
|
|
29762
29736
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/pbkdf2.js
|
29763
|
-
function pbkdf2Init(
|
29764
|
-
hash(
|
29737
|
+
function pbkdf2Init(hash4, _password, _salt, _opts) {
|
29738
|
+
hash(hash4);
|
29765
29739
|
const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
|
29766
29740
|
const { c, dkLen, asyncTick } = opts;
|
29767
29741
|
number(c);
|
@@ -29772,7 +29746,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29772
29746
|
const password = toBytes2(_password);
|
29773
29747
|
const salt = toBytes2(_salt);
|
29774
29748
|
const DK = new Uint8Array(dkLen);
|
29775
|
-
const PRF = hmac.create(
|
29749
|
+
const PRF = hmac.create(hash4, password);
|
29776
29750
|
const PRFSalt = PRF._cloneInto().update(salt);
|
29777
29751
|
return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
|
29778
29752
|
}
|
@@ -29784,8 +29758,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29784
29758
|
u.fill(0);
|
29785
29759
|
return DK;
|
29786
29760
|
}
|
29787
|
-
function pbkdf2(
|
29788
|
-
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(
|
29761
|
+
function pbkdf2(hash4, password, salt, opts) {
|
29762
|
+
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash4, password, salt, opts);
|
29789
29763
|
let prfW;
|
29790
29764
|
const arr = new Uint8Array(4);
|
29791
29765
|
const view = createView(arr);
|
@@ -30112,9 +30086,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30112
30086
|
throw new Error("XOF is not possible for this instance");
|
30113
30087
|
return this.writeInto(out);
|
30114
30088
|
}
|
30115
|
-
xof(
|
30116
|
-
number(
|
30117
|
-
return this.xofInto(new Uint8Array(
|
30089
|
+
xof(bytes3) {
|
30090
|
+
number(bytes3);
|
30091
|
+
return this.xofInto(new Uint8Array(bytes3));
|
30118
30092
|
}
|
30119
30093
|
digestInto(out) {
|
30120
30094
|
output(out, this);
|
@@ -30257,11 +30231,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30257
30231
|
var ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());
|
30258
30232
|
|
30259
30233
|
// ../crypto/dist/index.mjs
|
30260
|
-
var
|
30261
|
-
var
|
30234
|
+
var import_crypto = __toESM(__require("crypto"), 1);
|
30235
|
+
var import_crypto2 = __require("crypto");
|
30236
|
+
var import_crypto3 = __toESM(__require("crypto"), 1);
|
30262
30237
|
var import_crypto4 = __toESM(__require("crypto"), 1);
|
30263
|
-
var import_crypto5 =
|
30264
|
-
var import_crypto6 = __require("crypto");
|
30238
|
+
var import_crypto5 = __require("crypto");
|
30265
30239
|
var scrypt2 = (params) => {
|
30266
30240
|
const { password, salt, n, p, r, dklen } = params;
|
30267
30241
|
const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
|
@@ -30288,7 +30262,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30288
30262
|
Object.freeze(ripemd1602);
|
30289
30263
|
var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
|
30290
30264
|
var locked2 = false;
|
30291
|
-
var PBKDF2 = (password, salt, iterations, keylen, algo) => (0,
|
30265
|
+
var PBKDF2 = (password, salt, iterations, keylen, algo) => (0, import_crypto2.pbkdf2Sync)(password, salt, iterations, keylen, algo);
|
30292
30266
|
var pBkdf2 = PBKDF2;
|
30293
30267
|
function pbkdf22(_password, _salt, iterations, keylen, algo) {
|
30294
30268
|
const password = arrayify(_password, "password");
|
@@ -30306,8 +30280,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30306
30280
|
pBkdf2 = func;
|
30307
30281
|
};
|
30308
30282
|
Object.freeze(pbkdf22);
|
30309
|
-
var
|
30310
|
-
const randomValues = Uint8Array.from(
|
30283
|
+
var randomBytes = (length) => {
|
30284
|
+
const randomValues = Uint8Array.from(import_crypto3.default.randomBytes(length));
|
30311
30285
|
return randomValues;
|
30312
30286
|
};
|
30313
30287
|
var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
|
@@ -30318,11 +30292,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30318
30292
|
return arrayify(key);
|
30319
30293
|
};
|
30320
30294
|
var encrypt = async (password, data) => {
|
30321
|
-
const iv =
|
30322
|
-
const salt =
|
30295
|
+
const iv = randomBytes(16);
|
30296
|
+
const salt = randomBytes(32);
|
30323
30297
|
const secret = keyFromPassword(password, salt);
|
30324
30298
|
const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
|
30325
|
-
const cipher = await
|
30299
|
+
const cipher = await import_crypto.default.createCipheriv(ALGORITHM, secret, iv);
|
30326
30300
|
let cipherData = cipher.update(dataBuffer);
|
30327
30301
|
cipherData = Buffer.concat([cipherData, cipher.final()]);
|
30328
30302
|
return {
|
@@ -30336,7 +30310,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30336
30310
|
const salt = bufferFromString(keystore.salt);
|
30337
30311
|
const secret = keyFromPassword(password, salt);
|
30338
30312
|
const encryptedText = bufferFromString(keystore.data);
|
30339
|
-
const decipher = await
|
30313
|
+
const decipher = await import_crypto.default.createDecipheriv(ALGORITHM, secret, iv);
|
30340
30314
|
const decrypted = decipher.update(encryptedText);
|
30341
30315
|
const deBuff = Buffer.concat([decrypted, decipher.final()]);
|
30342
30316
|
const decryptedData = Buffer.from(deBuff).toString("utf-8");
|
@@ -30347,17 +30321,17 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30347
30321
|
}
|
30348
30322
|
};
|
30349
30323
|
async function encryptJsonWalletData(data, key, iv) {
|
30350
|
-
const cipher = await
|
30324
|
+
const cipher = await import_crypto4.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30351
30325
|
const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
|
30352
30326
|
return new Uint8Array(encrypted);
|
30353
30327
|
}
|
30354
30328
|
async function decryptJsonWalletData(data, key, iv) {
|
30355
|
-
const decipher =
|
30329
|
+
const decipher = import_crypto4.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30356
30330
|
const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
|
30357
30331
|
return new Uint8Array(decrypted);
|
30358
30332
|
}
|
30359
30333
|
var locked3 = false;
|
30360
|
-
var COMPUTEHMAC = (algorithm, key, data) => (0,
|
30334
|
+
var COMPUTEHMAC = (algorithm, key, data) => (0, import_crypto5.createHmac)(algorithm, key).update(data).digest();
|
30361
30335
|
var computeHMAC = COMPUTEHMAC;
|
30362
30336
|
function computeHmac(algorithm, _key, _data) {
|
30363
30337
|
const key = arrayify(_key, "key");
|
@@ -30381,7 +30355,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30381
30355
|
decrypt,
|
30382
30356
|
encrypt,
|
30383
30357
|
keyFromPassword,
|
30384
|
-
randomBytes
|
30358
|
+
randomBytes,
|
30385
30359
|
scrypt: scrypt2,
|
30386
30360
|
keccak256,
|
30387
30361
|
decryptJsonWalletData,
|
@@ -30396,7 +30370,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30396
30370
|
decrypt: decrypt2,
|
30397
30371
|
encrypt: encrypt2,
|
30398
30372
|
keyFromPassword: keyFromPassword2,
|
30399
|
-
randomBytes:
|
30373
|
+
randomBytes: randomBytes2,
|
30400
30374
|
stringFromBuffer: stringFromBuffer2,
|
30401
30375
|
scrypt: scrypt22,
|
30402
30376
|
keccak256: keccak2562,
|
@@ -30574,15 +30548,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30574
30548
|
if (data.length < this.encodedLength) {
|
30575
30549
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 data size.`);
|
30576
30550
|
}
|
30577
|
-
let
|
30578
|
-
const decoded = bn(
|
30551
|
+
let bytes3 = data.slice(offset, offset + this.encodedLength);
|
30552
|
+
const decoded = bn(bytes3);
|
30579
30553
|
if (decoded.isZero()) {
|
30580
|
-
|
30554
|
+
bytes3 = new Uint8Array(32);
|
30581
30555
|
}
|
30582
|
-
if (
|
30556
|
+
if (bytes3.length !== this.encodedLength) {
|
30583
30557
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 byte data size.`);
|
30584
30558
|
}
|
30585
|
-
return [toHex(
|
30559
|
+
return [toHex(bytes3, 32), offset + 32];
|
30586
30560
|
}
|
30587
30561
|
};
|
30588
30562
|
var B512Coder = class extends Coder {
|
@@ -30605,15 +30579,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30605
30579
|
if (data.length < this.encodedLength) {
|
30606
30580
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 data size.`);
|
30607
30581
|
}
|
30608
|
-
let
|
30609
|
-
const decoded = bn(
|
30582
|
+
let bytes3 = data.slice(offset, offset + this.encodedLength);
|
30583
|
+
const decoded = bn(bytes3);
|
30610
30584
|
if (decoded.isZero()) {
|
30611
|
-
|
30585
|
+
bytes3 = new Uint8Array(64);
|
30612
30586
|
}
|
30613
|
-
if (
|
30587
|
+
if (bytes3.length !== this.encodedLength) {
|
30614
30588
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 byte data size.`);
|
30615
30589
|
}
|
30616
|
-
return [toHex(
|
30590
|
+
return [toHex(bytes3, this.encodedLength), offset + this.encodedLength];
|
30617
30591
|
}
|
30618
30592
|
};
|
30619
30593
|
var encodedLengths = {
|
@@ -30625,24 +30599,24 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30625
30599
|
super("bigNumber", baseType, encodedLengths[baseType]);
|
30626
30600
|
}
|
30627
30601
|
encode(value) {
|
30628
|
-
let
|
30602
|
+
let bytes3;
|
30629
30603
|
try {
|
30630
|
-
|
30604
|
+
bytes3 = toBytes(value, this.encodedLength);
|
30631
30605
|
} catch (error) {
|
30632
30606
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.type}.`);
|
30633
30607
|
}
|
30634
|
-
return
|
30608
|
+
return bytes3;
|
30635
30609
|
}
|
30636
30610
|
decode(data, offset) {
|
30637
30611
|
if (data.length < this.encodedLength) {
|
30638
30612
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} data size.`);
|
30639
30613
|
}
|
30640
|
-
let
|
30641
|
-
|
30642
|
-
if (
|
30614
|
+
let bytes3 = data.slice(offset, offset + this.encodedLength);
|
30615
|
+
bytes3 = bytes3.slice(0, this.encodedLength);
|
30616
|
+
if (bytes3.length !== this.encodedLength) {
|
30643
30617
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} byte data size.`);
|
30644
30618
|
}
|
30645
|
-
return [bn(
|
30619
|
+
return [bn(bytes3), offset + this.encodedLength];
|
30646
30620
|
}
|
30647
30621
|
};
|
30648
30622
|
var BooleanCoder = class extends Coder {
|
@@ -30665,11 +30639,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30665
30639
|
if (data.length < this.encodedLength) {
|
30666
30640
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
|
30667
30641
|
}
|
30668
|
-
const
|
30669
|
-
if (
|
30642
|
+
const bytes3 = bn(data.slice(offset, offset + this.encodedLength));
|
30643
|
+
if (bytes3.isZero()) {
|
30670
30644
|
return [false, offset + this.encodedLength];
|
30671
30645
|
}
|
30672
|
-
if (!
|
30646
|
+
if (!bytes3.eq(bn(1))) {
|
30673
30647
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean value.`);
|
30674
30648
|
}
|
30675
30649
|
return [true, offset + this.encodedLength];
|
@@ -30680,9 +30654,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30680
30654
|
super("struct", "struct Bytes", WORD_SIZE);
|
30681
30655
|
}
|
30682
30656
|
encode(value) {
|
30683
|
-
const
|
30684
|
-
const lengthBytes = new BigNumberCoder("u64").encode(
|
30685
|
-
return new Uint8Array([...lengthBytes, ...
|
30657
|
+
const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
30658
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
|
30659
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
30686
30660
|
}
|
30687
30661
|
decode(data, offset) {
|
30688
30662
|
if (data.length < WORD_SIZE) {
|
@@ -30809,26 +30783,26 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30809
30783
|
this.options = options;
|
30810
30784
|
}
|
30811
30785
|
encode(value) {
|
30812
|
-
let
|
30786
|
+
let bytes3;
|
30813
30787
|
try {
|
30814
|
-
|
30788
|
+
bytes3 = toBytes(value);
|
30815
30789
|
} catch (error) {
|
30816
30790
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
|
30817
30791
|
}
|
30818
|
-
if (
|
30792
|
+
if (bytes3.length > this.encodedLength) {
|
30819
30793
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
|
30820
30794
|
}
|
30821
|
-
return toBytes(
|
30795
|
+
return toBytes(bytes3, this.encodedLength);
|
30822
30796
|
}
|
30823
30797
|
decode(data, offset) {
|
30824
30798
|
if (data.length < this.encodedLength) {
|
30825
30799
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number data size.`);
|
30826
30800
|
}
|
30827
|
-
const
|
30828
|
-
if (
|
30801
|
+
const bytes3 = data.slice(offset, offset + this.encodedLength);
|
30802
|
+
if (bytes3.length !== this.encodedLength) {
|
30829
30803
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
|
30830
30804
|
}
|
30831
|
-
return [toNumber(
|
30805
|
+
return [toNumber(bytes3), offset + this.encodedLength];
|
30832
30806
|
}
|
30833
30807
|
};
|
30834
30808
|
var OptionCoder = class extends EnumCoder {
|
@@ -30846,9 +30820,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30846
30820
|
const [decoded, newOffset] = super.decode(data, offset);
|
30847
30821
|
return [this.toOption(decoded), newOffset];
|
30848
30822
|
}
|
30849
|
-
toOption(
|
30850
|
-
if (
|
30851
|
-
return
|
30823
|
+
toOption(output3) {
|
30824
|
+
if (output3 && "Some" in output3) {
|
30825
|
+
return output3.Some;
|
30852
30826
|
}
|
30853
30827
|
return void 0;
|
30854
30828
|
}
|
@@ -30862,9 +30836,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30862
30836
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
30863
30837
|
}
|
30864
30838
|
const internalCoder = new ArrayCoder(new NumberCoder("u8"), value.length);
|
30865
|
-
const
|
30866
|
-
const lengthBytes = new BigNumberCoder("u64").encode(
|
30867
|
-
return new Uint8Array([...lengthBytes, ...
|
30839
|
+
const bytes3 = internalCoder.encode(value);
|
30840
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
|
30841
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
30868
30842
|
}
|
30869
30843
|
decode(data, offset) {
|
30870
30844
|
if (data.length < this.encodedLength) {
|
@@ -30887,9 +30861,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30887
30861
|
super("struct", "struct String", WORD_SIZE);
|
30888
30862
|
}
|
30889
30863
|
encode(value) {
|
30890
|
-
const
|
30864
|
+
const bytes3 = toUtf8Bytes(value);
|
30891
30865
|
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
30892
|
-
return new Uint8Array([...lengthBytes, ...
|
30866
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
30893
30867
|
}
|
30894
30868
|
decode(data, offset) {
|
30895
30869
|
if (data.length < this.encodedLength) {
|
@@ -30911,9 +30885,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30911
30885
|
super("strSlice", "str", WORD_SIZE);
|
30912
30886
|
}
|
30913
30887
|
encode(value) {
|
30914
|
-
const
|
30888
|
+
const bytes3 = toUtf8Bytes(value);
|
30915
30889
|
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
30916
|
-
return new Uint8Array([...lengthBytes, ...
|
30890
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
30917
30891
|
}
|
30918
30892
|
decode(data, offset) {
|
30919
30893
|
if (data.length < this.encodedLength) {
|
@@ -30922,11 +30896,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30922
30896
|
const offsetAndLength = offset + WORD_SIZE;
|
30923
30897
|
const lengthBytes = data.slice(offset, offsetAndLength);
|
30924
30898
|
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
30925
|
-
const
|
30926
|
-
if (
|
30899
|
+
const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
|
30900
|
+
if (bytes3.length !== length) {
|
30927
30901
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
30928
30902
|
}
|
30929
|
-
return [toUtf8String(
|
30903
|
+
return [toUtf8String(bytes3), offsetAndLength + length];
|
30930
30904
|
}
|
30931
30905
|
};
|
30932
30906
|
__publicField4(StrSliceCoder, "memorySize", 1);
|
@@ -30944,11 +30918,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30944
30918
|
if (data.length < this.encodedLength) {
|
30945
30919
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string data size.`);
|
30946
30920
|
}
|
30947
|
-
const
|
30948
|
-
if (
|
30921
|
+
const bytes3 = data.slice(offset, offset + this.encodedLength);
|
30922
|
+
if (bytes3.length !== this.encodedLength) {
|
30949
30923
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string byte data size.`);
|
30950
30924
|
}
|
30951
|
-
return [toUtf8String(
|
30925
|
+
return [toUtf8String(bytes3), offset + this.encodedLength];
|
30952
30926
|
}
|
30953
30927
|
};
|
30954
30928
|
var StructCoder = class extends Coder {
|
@@ -31042,9 +31016,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31042
31016
|
if (isUint8Array(value)) {
|
31043
31017
|
return new Uint8Array([...lengthCoder.encode(value.length), ...value]);
|
31044
31018
|
}
|
31045
|
-
const
|
31019
|
+
const bytes3 = value.map((v) => this.coder.encode(v));
|
31046
31020
|
const lengthBytes = lengthCoder.encode(value.length);
|
31047
|
-
return new Uint8Array([...lengthBytes, ...concatBytes(
|
31021
|
+
return new Uint8Array([...lengthBytes, ...concatBytes(bytes3)]);
|
31048
31022
|
}
|
31049
31023
|
decode(data, offset) {
|
31050
31024
|
if (!this.#hasNestedOption && data.length < this.encodedLength || data.length > MAX_BYTES) {
|
@@ -31423,10 +31397,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31423
31397
|
throw new FuelError(ErrorCode.ABI_TYPES_AND_VALUES_MISMATCH, errorMsg);
|
31424
31398
|
}
|
31425
31399
|
decodeArguments(data) {
|
31426
|
-
const
|
31400
|
+
const bytes3 = arrayify(data);
|
31427
31401
|
const nonEmptyInputs = findNonEmptyInputs(this.jsonAbi, this.jsonFn.inputs);
|
31428
31402
|
if (nonEmptyInputs.length === 0) {
|
31429
|
-
if (
|
31403
|
+
if (bytes3.length === 0) {
|
31430
31404
|
return void 0;
|
31431
31405
|
}
|
31432
31406
|
throw new FuelError(
|
@@ -31435,12 +31409,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31435
31409
|
count: {
|
31436
31410
|
types: this.jsonFn.inputs.length,
|
31437
31411
|
nonEmptyInputs: nonEmptyInputs.length,
|
31438
|
-
values:
|
31412
|
+
values: bytes3.length
|
31439
31413
|
},
|
31440
31414
|
value: {
|
31441
31415
|
args: this.jsonFn.inputs,
|
31442
31416
|
nonEmptyInputs,
|
31443
|
-
values:
|
31417
|
+
values: bytes3
|
31444
31418
|
}
|
31445
31419
|
})}`
|
31446
31420
|
);
|
@@ -31448,7 +31422,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31448
31422
|
const result = nonEmptyInputs.reduce(
|
31449
31423
|
(obj, input) => {
|
31450
31424
|
const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
|
31451
|
-
const [decodedValue, decodedValueByteSize] = coder.decode(
|
31425
|
+
const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
|
31452
31426
|
return {
|
31453
31427
|
decoded: [...obj.decoded, decodedValue],
|
31454
31428
|
offset: obj.offset + decodedValueByteSize
|
@@ -31463,11 +31437,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31463
31437
|
if (outputAbiType.type === "()") {
|
31464
31438
|
return [void 0, 0];
|
31465
31439
|
}
|
31466
|
-
const
|
31440
|
+
const bytes3 = arrayify(data);
|
31467
31441
|
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
|
31468
31442
|
encoding: this.encoding
|
31469
31443
|
});
|
31470
|
-
return coder.decode(
|
31444
|
+
return coder.decode(bytes3, 0);
|
31471
31445
|
}
|
31472
31446
|
/**
|
31473
31447
|
* Checks if the function is read-only i.e. it only reads from storage, does not write to it.
|
@@ -31601,9 +31575,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31601
31575
|
}
|
31602
31576
|
return addressLike;
|
31603
31577
|
};
|
31604
|
-
var getRandomB256 = () => hexlify(
|
31578
|
+
var getRandomB256 = () => hexlify(randomBytes2(32));
|
31605
31579
|
var clearFirst12BytesFromB256 = (b256) => {
|
31606
|
-
let
|
31580
|
+
let bytes3;
|
31607
31581
|
try {
|
31608
31582
|
if (!isB256(b256)) {
|
31609
31583
|
throw new FuelError(
|
@@ -31611,15 +31585,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31611
31585
|
`Invalid Bech32 Address: ${b256}.`
|
31612
31586
|
);
|
31613
31587
|
}
|
31614
|
-
|
31615
|
-
|
31588
|
+
bytes3 = getBytesFromBech32(toBech32(b256));
|
31589
|
+
bytes3 = hexlify(bytes3.fill(0, 0, 12));
|
31616
31590
|
} catch (error) {
|
31617
31591
|
throw new FuelError(
|
31618
31592
|
FuelError.CODES.PARSE_FAILED,
|
31619
31593
|
`Cannot generate EVM Address B256 from: ${b256}.`
|
31620
31594
|
);
|
31621
31595
|
}
|
31622
|
-
return
|
31596
|
+
return bytes3;
|
31623
31597
|
};
|
31624
31598
|
var padFirst12BytesOfEvmAddress = (address) => {
|
31625
31599
|
if (!isEvmAddress(address)) {
|
@@ -32193,9 +32167,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32193
32167
|
return sha2562(concat(parts));
|
32194
32168
|
}
|
32195
32169
|
static encodeData(messageData) {
|
32196
|
-
const
|
32197
|
-
const dataLength =
|
32198
|
-
return new ByteArrayCoder(dataLength).encode(
|
32170
|
+
const bytes3 = arrayify(messageData || "0x");
|
32171
|
+
const dataLength = bytes3.length;
|
32172
|
+
return new ByteArrayCoder(dataLength).encode(bytes3);
|
32199
32173
|
}
|
32200
32174
|
encode(value) {
|
32201
32175
|
const parts = [];
|
@@ -32217,9 +32191,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32217
32191
|
return concat(parts);
|
32218
32192
|
}
|
32219
32193
|
static decodeData(messageData) {
|
32220
|
-
const
|
32221
|
-
const dataLength =
|
32222
|
-
const [data] = new ByteArrayCoder(dataLength).decode(
|
32194
|
+
const bytes3 = arrayify(messageData);
|
32195
|
+
const dataLength = bytes3.length;
|
32196
|
+
const [data] = new ByteArrayCoder(dataLength).decode(bytes3, 0);
|
32223
32197
|
return arrayify(data);
|
32224
32198
|
}
|
32225
32199
|
decode(data, offset) {
|
@@ -33299,9 +33273,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33299
33273
|
}
|
33300
33274
|
};
|
33301
33275
|
|
33302
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
33276
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/abstract/utils.js
|
33303
33277
|
var utils_exports = {};
|
33304
33278
|
__export(utils_exports, {
|
33279
|
+
abytes: () => abytes,
|
33305
33280
|
bitGet: () => bitGet,
|
33306
33281
|
bitLen: () => bitLen,
|
33307
33282
|
bitMask: () => bitMask,
|
@@ -33309,7 +33284,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33309
33284
|
bytesToHex: () => bytesToHex,
|
33310
33285
|
bytesToNumberBE: () => bytesToNumberBE,
|
33311
33286
|
bytesToNumberLE: () => bytesToNumberLE,
|
33312
|
-
concatBytes: () =>
|
33287
|
+
concatBytes: () => concatBytes2,
|
33313
33288
|
createHmacDrbg: () => createHmacDrbg,
|
33314
33289
|
ensureBytes: () => ensureBytes,
|
33315
33290
|
equalBytes: () => equalBytes,
|
@@ -33329,13 +33304,16 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33329
33304
|
function isBytes3(a) {
|
33330
33305
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
33331
33306
|
}
|
33332
|
-
|
33333
|
-
|
33334
|
-
if (!isBytes3(bytes2))
|
33307
|
+
function abytes(item) {
|
33308
|
+
if (!isBytes3(item))
|
33335
33309
|
throw new Error("Uint8Array expected");
|
33310
|
+
}
|
33311
|
+
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
33312
|
+
function bytesToHex(bytes3) {
|
33313
|
+
abytes(bytes3);
|
33336
33314
|
let hex = "";
|
33337
|
-
for (let i = 0; i <
|
33338
|
-
hex += hexes[
|
33315
|
+
for (let i = 0; i < bytes3.length; i++) {
|
33316
|
+
hex += hexes[bytes3[i]];
|
33339
33317
|
}
|
33340
33318
|
return hex;
|
33341
33319
|
}
|
@@ -33377,13 +33355,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33377
33355
|
}
|
33378
33356
|
return array;
|
33379
33357
|
}
|
33380
|
-
function bytesToNumberBE(
|
33381
|
-
return hexToNumber(bytesToHex(
|
33358
|
+
function bytesToNumberBE(bytes3) {
|
33359
|
+
return hexToNumber(bytesToHex(bytes3));
|
33382
33360
|
}
|
33383
|
-
function bytesToNumberLE(
|
33384
|
-
|
33385
|
-
|
33386
|
-
return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse()));
|
33361
|
+
function bytesToNumberLE(bytes3) {
|
33362
|
+
abytes(bytes3);
|
33363
|
+
return hexToNumber(bytesToHex(Uint8Array.from(bytes3).reverse()));
|
33387
33364
|
}
|
33388
33365
|
function numberToBytesBE(n, len) {
|
33389
33366
|
return hexToBytes(n.toString(16).padStart(len * 2, "0"));
|
@@ -33412,17 +33389,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33412
33389
|
throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);
|
33413
33390
|
return res;
|
33414
33391
|
}
|
33415
|
-
function
|
33392
|
+
function concatBytes2(...arrays) {
|
33416
33393
|
let sum = 0;
|
33417
33394
|
for (let i = 0; i < arrays.length; i++) {
|
33418
33395
|
const a = arrays[i];
|
33419
|
-
|
33420
|
-
throw new Error("Uint8Array expected");
|
33396
|
+
abytes(a);
|
33421
33397
|
sum += a.length;
|
33422
33398
|
}
|
33423
|
-
|
33424
|
-
let pad3 = 0;
|
33425
|
-
for (let i = 0; i < arrays.length; i++) {
|
33399
|
+
const res = new Uint8Array(sum);
|
33400
|
+
for (let i = 0, pad3 = 0; i < arrays.length; i++) {
|
33426
33401
|
const a = arrays[i];
|
33427
33402
|
res.set(a, pad3);
|
33428
33403
|
pad3 += a.length;
|
@@ -33451,9 +33426,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33451
33426
|
function bitGet(n, pos) {
|
33452
33427
|
return n >> BigInt(pos) & _1n2;
|
33453
33428
|
}
|
33454
|
-
|
33429
|
+
function bitSet(n, pos, value) {
|
33455
33430
|
return n | (value ? _1n2 : _0n2) << BigInt(pos);
|
33456
|
-
}
|
33431
|
+
}
|
33457
33432
|
var bitMask = (n) => (_2n2 << BigInt(n - 1)) - _1n2;
|
33458
33433
|
var u8n = (data) => new Uint8Array(data);
|
33459
33434
|
var u8fr = (arr) => Uint8Array.from(arr);
|
@@ -33492,7 +33467,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33492
33467
|
out.push(sl);
|
33493
33468
|
len += v.length;
|
33494
33469
|
}
|
33495
|
-
return
|
33470
|
+
return concatBytes2(...out);
|
33496
33471
|
};
|
33497
33472
|
const genUntil = (seed, pred) => {
|
33498
33473
|
reset();
|
@@ -33756,19 +33731,19 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33756
33731
|
return "GraphQLError";
|
33757
33732
|
}
|
33758
33733
|
toString() {
|
33759
|
-
let
|
33734
|
+
let output3 = this.message;
|
33760
33735
|
if (this.nodes) {
|
33761
33736
|
for (const node of this.nodes) {
|
33762
33737
|
if (node.loc) {
|
33763
|
-
|
33738
|
+
output3 += "\n\n" + printLocation(node.loc);
|
33764
33739
|
}
|
33765
33740
|
}
|
33766
33741
|
} else if (this.source && this.locations) {
|
33767
33742
|
for (const location of this.locations) {
|
33768
|
-
|
33743
|
+
output3 += "\n\n" + printSourceLocation(this.source, location);
|
33769
33744
|
}
|
33770
33745
|
}
|
33771
|
-
return
|
33746
|
+
return output3;
|
33772
33747
|
}
|
33773
33748
|
toJSON() {
|
33774
33749
|
const formattedError = {
|
@@ -38616,8 +38591,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
38616
38591
|
*
|
38617
38592
|
* Pushes an output to the list without any side effects and returns the index
|
38618
38593
|
*/
|
38619
|
-
pushOutput(
|
38620
|
-
this.outputs.push(
|
38594
|
+
pushOutput(output3) {
|
38595
|
+
this.outputs.push(output3);
|
38621
38596
|
return this.outputs.length - 1;
|
38622
38597
|
}
|
38623
38598
|
/**
|
@@ -38701,7 +38676,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
38701
38676
|
*/
|
38702
38677
|
getCoinOutputs() {
|
38703
38678
|
return this.outputs.filter(
|
38704
|
-
(
|
38679
|
+
(output3) => output3.type === OutputType.Coin
|
38705
38680
|
);
|
38706
38681
|
}
|
38707
38682
|
/**
|
@@ -38711,7 +38686,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
38711
38686
|
*/
|
38712
38687
|
getChangeOutputs() {
|
38713
38688
|
return this.outputs.filter(
|
38714
|
-
(
|
38689
|
+
(output3) => output3.type === OutputType.Change
|
38715
38690
|
);
|
38716
38691
|
}
|
38717
38692
|
/**
|
@@ -38861,7 +38836,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
38861
38836
|
*/
|
38862
38837
|
addChangeOutput(to, assetId) {
|
38863
38838
|
const changeOutput = this.getChangeOutputs().find(
|
38864
|
-
(
|
38839
|
+
(output3) => hexlify(output3.assetId) === assetId
|
38865
38840
|
);
|
38866
38841
|
if (!changeOutput) {
|
38867
38842
|
this.pushOutput({
|
@@ -38939,12 +38914,12 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
38939
38914
|
usedQuantity = bn("1000000000000000000");
|
38940
38915
|
}
|
38941
38916
|
if (assetInput && "assetId" in assetInput) {
|
38942
|
-
assetInput.id = hexlify(
|
38917
|
+
assetInput.id = hexlify(randomBytes2(UTXO_ID_LEN));
|
38943
38918
|
assetInput.amount = usedQuantity;
|
38944
38919
|
} else {
|
38945
38920
|
this.addResources([
|
38946
38921
|
{
|
38947
|
-
id: hexlify(
|
38922
|
+
id: hexlify(randomBytes2(UTXO_ID_LEN)),
|
38948
38923
|
amount: usedQuantity,
|
38949
38924
|
assetId,
|
38950
38925
|
owner: resourcesOwner || Address.fromRandom(),
|
@@ -39040,8 +39015,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39040
39015
|
return inputClone;
|
39041
39016
|
}
|
39042
39017
|
});
|
39043
|
-
transaction.outputs = transaction.outputs.map((
|
39044
|
-
const outputClone = clone_default(
|
39018
|
+
transaction.outputs = transaction.outputs.map((output3) => {
|
39019
|
+
const outputClone = clone_default(output3);
|
39045
39020
|
switch (outputClone.type) {
|
39046
39021
|
case OutputType.Contract: {
|
39047
39022
|
outputClone.balanceRoot = ZeroBytes32;
|
@@ -39143,7 +39118,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39143
39118
|
*/
|
39144
39119
|
getContractCreatedOutputs() {
|
39145
39120
|
return this.outputs.filter(
|
39146
|
-
(
|
39121
|
+
(output3) => output3.type === OutputType.ContractCreated
|
39147
39122
|
);
|
39148
39123
|
}
|
39149
39124
|
/**
|
@@ -39269,7 +39244,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39269
39244
|
*/
|
39270
39245
|
getContractOutputs() {
|
39271
39246
|
return this.outputs.filter(
|
39272
|
-
(
|
39247
|
+
(output3) => output3.type === OutputType.Contract
|
39273
39248
|
);
|
39274
39249
|
}
|
39275
39250
|
/**
|
@@ -39279,7 +39254,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39279
39254
|
*/
|
39280
39255
|
getVariableOutputs() {
|
39281
39256
|
return this.outputs.filter(
|
39282
|
-
(
|
39257
|
+
(output3) => output3.type === OutputType.Variable
|
39283
39258
|
);
|
39284
39259
|
}
|
39285
39260
|
/**
|
@@ -39751,8 +39726,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39751
39726
|
}) {
|
39752
39727
|
const contractCallReceipts = getReceiptsCall(receipts);
|
39753
39728
|
const contractOutputs = getOutputsContract(outputs);
|
39754
|
-
const contractCallOperations = contractOutputs.reduce((prevOutputCallOps,
|
39755
|
-
const contractInput = getInputContractFromIndex(inputs,
|
39729
|
+
const contractCallOperations = contractOutputs.reduce((prevOutputCallOps, output3) => {
|
39730
|
+
const contractInput = getInputContractFromIndex(inputs, output3.inputIndex);
|
39756
39731
|
if (contractInput) {
|
39757
39732
|
const newCallOps = contractCallReceipts.reduce((prevContractCallOps, receipt) => {
|
39758
39733
|
if (receipt.to === contractInput.contractID) {
|
@@ -39806,7 +39781,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39806
39781
|
let { from: fromAddress } = receipt;
|
39807
39782
|
const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
|
39808
39783
|
if (ZeroBytes32 === fromAddress) {
|
39809
|
-
const change = changeOutputs.find((
|
39784
|
+
const change = changeOutputs.find((output3) => output3.assetId === assetId);
|
39810
39785
|
fromAddress = change?.to || fromAddress;
|
39811
39786
|
}
|
39812
39787
|
const fromType = contractInputs.some((input) => input.contractID === fromAddress) ? 0 /* contract */ : 1 /* account */;
|
@@ -39837,8 +39812,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39837
39812
|
const coinOutputs = getOutputsCoin(outputs);
|
39838
39813
|
const contractInputs = getInputsContract(inputs);
|
39839
39814
|
const changeOutputs = getOutputsChange(outputs);
|
39840
|
-
coinOutputs.forEach((
|
39841
|
-
const { amount, assetId, to } =
|
39815
|
+
coinOutputs.forEach((output3) => {
|
39816
|
+
const { amount, assetId, to } = output3;
|
39842
39817
|
const changeOutput = changeOutputs.find((change) => change.assetId === assetId);
|
39843
39818
|
if (changeOutput) {
|
39844
39819
|
operations = addOperation(operations, {
|
@@ -39876,7 +39851,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39876
39851
|
}
|
39877
39852
|
function getPayProducerOperations(outputs) {
|
39878
39853
|
const coinOutputs = getOutputsCoin(outputs);
|
39879
|
-
const payProducerOperations = coinOutputs.reduce((prev,
|
39854
|
+
const payProducerOperations = coinOutputs.reduce((prev, output3) => {
|
39880
39855
|
const operations = addOperation(prev, {
|
39881
39856
|
name: "Pay network fee to block producer" /* payBlockProducer */,
|
39882
39857
|
from: {
|
@@ -39885,12 +39860,12 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39885
39860
|
},
|
39886
39861
|
to: {
|
39887
39862
|
type: 1 /* account */,
|
39888
|
-
address:
|
39863
|
+
address: output3.to.toString()
|
39889
39864
|
},
|
39890
39865
|
assetsSent: [
|
39891
39866
|
{
|
39892
|
-
assetId:
|
39893
|
-
amount:
|
39867
|
+
assetId: output3.assetId.toString(),
|
39868
|
+
amount: output3.amount
|
39894
39869
|
}
|
39895
39870
|
]
|
39896
39871
|
});
|
@@ -41135,6 +41110,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41135
41110
|
* @returns A promise that resolves to the coins.
|
41136
41111
|
*/
|
41137
41112
|
async getCoins(owner, assetId, paginationArgs) {
|
41113
|
+
this.validatePaginationArgs(paginationArgs);
|
41138
41114
|
const ownerAddress = Address.fromAddressOrString(owner);
|
41139
41115
|
const {
|
41140
41116
|
coins: { edges, pageInfo }
|
@@ -41369,8 +41345,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41369
41345
|
balances: { edges }
|
41370
41346
|
} = await this.operations.getBalances({
|
41371
41347
|
/**
|
41372
|
-
* The query
|
41373
|
-
* current Fuel-Core implementation does not support pagination yet
|
41348
|
+
* The query parameters for this method were designed to support pagination,
|
41349
|
+
* but the current Fuel-Core implementation does not support pagination yet.
|
41374
41350
|
*/
|
41375
41351
|
first: 1e4,
|
41376
41352
|
filter: { owner: Address.fromAddressOrString(owner).toB256() }
|
@@ -41389,6 +41365,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41389
41365
|
* @returns A promise that resolves to the messages.
|
41390
41366
|
*/
|
41391
41367
|
async getMessages(address, paginationArgs) {
|
41368
|
+
this.validatePaginationArgs(paginationArgs);
|
41392
41369
|
const {
|
41393
41370
|
messages: { edges, pageInfo }
|
41394
41371
|
} = await this.operations.getMessages({
|
@@ -41593,6 +41570,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41593
41570
|
}
|
41594
41571
|
return relayedTransactionStatus;
|
41595
41572
|
}
|
41573
|
+
/**
|
41574
|
+
* @hidden
|
41575
|
+
*/
|
41576
|
+
validatePaginationArgs({ first, last } = {}) {
|
41577
|
+
const MAX_PAGINATION_LIMIT = 1e3;
|
41578
|
+
if ((first || 0) > MAX_PAGINATION_LIMIT || (last || 0) > MAX_PAGINATION_LIMIT) {
|
41579
|
+
throw new FuelError(
|
41580
|
+
ErrorCode.INVALID_INPUT_PARAMETERS,
|
41581
|
+
"Pagination limit cannot exceed 1000 items"
|
41582
|
+
);
|
41583
|
+
}
|
41584
|
+
}
|
41596
41585
|
/**
|
41597
41586
|
* @hidden
|
41598
41587
|
*/
|
@@ -41741,11 +41730,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41741
41730
|
gasPrice,
|
41742
41731
|
baseAssetId
|
41743
41732
|
});
|
41744
|
-
const
|
41733
|
+
const output3 = {
|
41745
41734
|
gqlTransaction,
|
41746
41735
|
...transactionSummary
|
41747
41736
|
};
|
41748
|
-
return
|
41737
|
+
return output3;
|
41749
41738
|
});
|
41750
41739
|
return {
|
41751
41740
|
transactions,
|
@@ -42336,7 +42325,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42336
42325
|
*/
|
42337
42326
|
generateFakeResources(coins) {
|
42338
42327
|
return coins.map((coin) => ({
|
42339
|
-
id: hexlify(
|
42328
|
+
id: hexlify(randomBytes2(UTXO_ID_LEN)),
|
42340
42329
|
owner: this.address,
|
42341
42330
|
blockCreated: bn(1),
|
42342
42331
|
txCreatedIdx: bn(1),
|
@@ -42395,7 +42384,349 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42395
42384
|
}
|
42396
42385
|
};
|
42397
42386
|
|
42398
|
-
// ../../node_modules/.pnpm/@noble+
|
42387
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/_assert.js
|
42388
|
+
function number2(n) {
|
42389
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
42390
|
+
throw new Error(`positive integer expected, not ${n}`);
|
42391
|
+
}
|
42392
|
+
function isBytes4(a) {
|
42393
|
+
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
42394
|
+
}
|
42395
|
+
function bytes2(b, ...lengths) {
|
42396
|
+
if (!isBytes4(b))
|
42397
|
+
throw new Error("Uint8Array expected");
|
42398
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
42399
|
+
throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
|
42400
|
+
}
|
42401
|
+
function hash3(h) {
|
42402
|
+
if (typeof h !== "function" || typeof h.create !== "function")
|
42403
|
+
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
42404
|
+
number2(h.outputLen);
|
42405
|
+
number2(h.blockLen);
|
42406
|
+
}
|
42407
|
+
function exists2(instance, checkFinished = true) {
|
42408
|
+
if (instance.destroyed)
|
42409
|
+
throw new Error("Hash instance has been destroyed");
|
42410
|
+
if (checkFinished && instance.finished)
|
42411
|
+
throw new Error("Hash#digest() has already been called");
|
42412
|
+
}
|
42413
|
+
function output2(out, instance) {
|
42414
|
+
bytes2(out);
|
42415
|
+
const min = instance.outputLen;
|
42416
|
+
if (out.length < min) {
|
42417
|
+
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
42418
|
+
}
|
42419
|
+
}
|
42420
|
+
|
42421
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/cryptoNode.js
|
42422
|
+
var nc = __toESM(__require("crypto"), 1);
|
42423
|
+
var crypto4 = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : void 0;
|
42424
|
+
|
42425
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/utils.js
|
42426
|
+
var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
42427
|
+
var rotr2 = (word, shift) => word << 32 - shift | word >>> shift;
|
42428
|
+
var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
42429
|
+
function utf8ToBytes3(str) {
|
42430
|
+
if (typeof str !== "string")
|
42431
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
42432
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
42433
|
+
}
|
42434
|
+
function toBytes3(data) {
|
42435
|
+
if (typeof data === "string")
|
42436
|
+
data = utf8ToBytes3(data);
|
42437
|
+
bytes2(data);
|
42438
|
+
return data;
|
42439
|
+
}
|
42440
|
+
function concatBytes3(...arrays) {
|
42441
|
+
let sum = 0;
|
42442
|
+
for (let i = 0; i < arrays.length; i++) {
|
42443
|
+
const a = arrays[i];
|
42444
|
+
bytes2(a);
|
42445
|
+
sum += a.length;
|
42446
|
+
}
|
42447
|
+
const res = new Uint8Array(sum);
|
42448
|
+
for (let i = 0, pad3 = 0; i < arrays.length; i++) {
|
42449
|
+
const a = arrays[i];
|
42450
|
+
res.set(a, pad3);
|
42451
|
+
pad3 += a.length;
|
42452
|
+
}
|
42453
|
+
return res;
|
42454
|
+
}
|
42455
|
+
var Hash2 = class {
|
42456
|
+
// Safe version that clones internal state
|
42457
|
+
clone() {
|
42458
|
+
return this._cloneInto();
|
42459
|
+
}
|
42460
|
+
};
|
42461
|
+
var toStr2 = {}.toString;
|
42462
|
+
function wrapConstructor2(hashCons) {
|
42463
|
+
const hashC = (msg) => hashCons().update(toBytes3(msg)).digest();
|
42464
|
+
const tmp = hashCons();
|
42465
|
+
hashC.outputLen = tmp.outputLen;
|
42466
|
+
hashC.blockLen = tmp.blockLen;
|
42467
|
+
hashC.create = () => hashCons();
|
42468
|
+
return hashC;
|
42469
|
+
}
|
42470
|
+
function randomBytes3(bytesLength = 32) {
|
42471
|
+
if (crypto4 && typeof crypto4.getRandomValues === "function") {
|
42472
|
+
return crypto4.getRandomValues(new Uint8Array(bytesLength));
|
42473
|
+
}
|
42474
|
+
throw new Error("crypto.getRandomValues must be defined");
|
42475
|
+
}
|
42476
|
+
|
42477
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/_md.js
|
42478
|
+
function setBigUint642(view, byteOffset, value, isLE3) {
|
42479
|
+
if (typeof view.setBigUint64 === "function")
|
42480
|
+
return view.setBigUint64(byteOffset, value, isLE3);
|
42481
|
+
const _32n2 = BigInt(32);
|
42482
|
+
const _u32_max = BigInt(4294967295);
|
42483
|
+
const wh = Number(value >> _32n2 & _u32_max);
|
42484
|
+
const wl = Number(value & _u32_max);
|
42485
|
+
const h = isLE3 ? 4 : 0;
|
42486
|
+
const l = isLE3 ? 0 : 4;
|
42487
|
+
view.setUint32(byteOffset + h, wh, isLE3);
|
42488
|
+
view.setUint32(byteOffset + l, wl, isLE3);
|
42489
|
+
}
|
42490
|
+
var Chi2 = (a, b, c) => a & b ^ ~a & c;
|
42491
|
+
var Maj2 = (a, b, c) => a & b ^ a & c ^ b & c;
|
42492
|
+
var HashMD = class extends Hash2 {
|
42493
|
+
constructor(blockLen, outputLen, padOffset, isLE3) {
|
42494
|
+
super();
|
42495
|
+
this.blockLen = blockLen;
|
42496
|
+
this.outputLen = outputLen;
|
42497
|
+
this.padOffset = padOffset;
|
42498
|
+
this.isLE = isLE3;
|
42499
|
+
this.finished = false;
|
42500
|
+
this.length = 0;
|
42501
|
+
this.pos = 0;
|
42502
|
+
this.destroyed = false;
|
42503
|
+
this.buffer = new Uint8Array(blockLen);
|
42504
|
+
this.view = createView2(this.buffer);
|
42505
|
+
}
|
42506
|
+
update(data) {
|
42507
|
+
exists2(this);
|
42508
|
+
const { view, buffer, blockLen } = this;
|
42509
|
+
data = toBytes3(data);
|
42510
|
+
const len = data.length;
|
42511
|
+
for (let pos = 0; pos < len; ) {
|
42512
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
42513
|
+
if (take === blockLen) {
|
42514
|
+
const dataView = createView2(data);
|
42515
|
+
for (; blockLen <= len - pos; pos += blockLen)
|
42516
|
+
this.process(dataView, pos);
|
42517
|
+
continue;
|
42518
|
+
}
|
42519
|
+
buffer.set(data.subarray(pos, pos + take), this.pos);
|
42520
|
+
this.pos += take;
|
42521
|
+
pos += take;
|
42522
|
+
if (this.pos === blockLen) {
|
42523
|
+
this.process(view, 0);
|
42524
|
+
this.pos = 0;
|
42525
|
+
}
|
42526
|
+
}
|
42527
|
+
this.length += data.length;
|
42528
|
+
this.roundClean();
|
42529
|
+
return this;
|
42530
|
+
}
|
42531
|
+
digestInto(out) {
|
42532
|
+
exists2(this);
|
42533
|
+
output2(out, this);
|
42534
|
+
this.finished = true;
|
42535
|
+
const { buffer, view, blockLen, isLE: isLE3 } = this;
|
42536
|
+
let { pos } = this;
|
42537
|
+
buffer[pos++] = 128;
|
42538
|
+
this.buffer.subarray(pos).fill(0);
|
42539
|
+
if (this.padOffset > blockLen - pos) {
|
42540
|
+
this.process(view, 0);
|
42541
|
+
pos = 0;
|
42542
|
+
}
|
42543
|
+
for (let i = pos; i < blockLen; i++)
|
42544
|
+
buffer[i] = 0;
|
42545
|
+
setBigUint642(view, blockLen - 8, BigInt(this.length * 8), isLE3);
|
42546
|
+
this.process(view, 0);
|
42547
|
+
const oview = createView2(out);
|
42548
|
+
const len = this.outputLen;
|
42549
|
+
if (len % 4)
|
42550
|
+
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
42551
|
+
const outLen = len / 4;
|
42552
|
+
const state = this.get();
|
42553
|
+
if (outLen > state.length)
|
42554
|
+
throw new Error("_sha2: outputLen bigger than state");
|
42555
|
+
for (let i = 0; i < outLen; i++)
|
42556
|
+
oview.setUint32(4 * i, state[i], isLE3);
|
42557
|
+
}
|
42558
|
+
digest() {
|
42559
|
+
const { buffer, outputLen } = this;
|
42560
|
+
this.digestInto(buffer);
|
42561
|
+
const res = buffer.slice(0, outputLen);
|
42562
|
+
this.destroy();
|
42563
|
+
return res;
|
42564
|
+
}
|
42565
|
+
_cloneInto(to) {
|
42566
|
+
to || (to = new this.constructor());
|
42567
|
+
to.set(...this.get());
|
42568
|
+
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
42569
|
+
to.length = length;
|
42570
|
+
to.pos = pos;
|
42571
|
+
to.finished = finished;
|
42572
|
+
to.destroyed = destroyed;
|
42573
|
+
if (length % blockLen)
|
42574
|
+
to.buffer.set(buffer);
|
42575
|
+
return to;
|
42576
|
+
}
|
42577
|
+
};
|
42578
|
+
|
42579
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/sha256.js
|
42580
|
+
var SHA256_K2 = /* @__PURE__ */ new Uint32Array([
|
42581
|
+
1116352408,
|
42582
|
+
1899447441,
|
42583
|
+
3049323471,
|
42584
|
+
3921009573,
|
42585
|
+
961987163,
|
42586
|
+
1508970993,
|
42587
|
+
2453635748,
|
42588
|
+
2870763221,
|
42589
|
+
3624381080,
|
42590
|
+
310598401,
|
42591
|
+
607225278,
|
42592
|
+
1426881987,
|
42593
|
+
1925078388,
|
42594
|
+
2162078206,
|
42595
|
+
2614888103,
|
42596
|
+
3248222580,
|
42597
|
+
3835390401,
|
42598
|
+
4022224774,
|
42599
|
+
264347078,
|
42600
|
+
604807628,
|
42601
|
+
770255983,
|
42602
|
+
1249150122,
|
42603
|
+
1555081692,
|
42604
|
+
1996064986,
|
42605
|
+
2554220882,
|
42606
|
+
2821834349,
|
42607
|
+
2952996808,
|
42608
|
+
3210313671,
|
42609
|
+
3336571891,
|
42610
|
+
3584528711,
|
42611
|
+
113926993,
|
42612
|
+
338241895,
|
42613
|
+
666307205,
|
42614
|
+
773529912,
|
42615
|
+
1294757372,
|
42616
|
+
1396182291,
|
42617
|
+
1695183700,
|
42618
|
+
1986661051,
|
42619
|
+
2177026350,
|
42620
|
+
2456956037,
|
42621
|
+
2730485921,
|
42622
|
+
2820302411,
|
42623
|
+
3259730800,
|
42624
|
+
3345764771,
|
42625
|
+
3516065817,
|
42626
|
+
3600352804,
|
42627
|
+
4094571909,
|
42628
|
+
275423344,
|
42629
|
+
430227734,
|
42630
|
+
506948616,
|
42631
|
+
659060556,
|
42632
|
+
883997877,
|
42633
|
+
958139571,
|
42634
|
+
1322822218,
|
42635
|
+
1537002063,
|
42636
|
+
1747873779,
|
42637
|
+
1955562222,
|
42638
|
+
2024104815,
|
42639
|
+
2227730452,
|
42640
|
+
2361852424,
|
42641
|
+
2428436474,
|
42642
|
+
2756734187,
|
42643
|
+
3204031479,
|
42644
|
+
3329325298
|
42645
|
+
]);
|
42646
|
+
var SHA256_IV = /* @__PURE__ */ new Uint32Array([
|
42647
|
+
1779033703,
|
42648
|
+
3144134277,
|
42649
|
+
1013904242,
|
42650
|
+
2773480762,
|
42651
|
+
1359893119,
|
42652
|
+
2600822924,
|
42653
|
+
528734635,
|
42654
|
+
1541459225
|
42655
|
+
]);
|
42656
|
+
var SHA256_W2 = /* @__PURE__ */ new Uint32Array(64);
|
42657
|
+
var SHA2562 = class extends HashMD {
|
42658
|
+
constructor() {
|
42659
|
+
super(64, 32, 8, false);
|
42660
|
+
this.A = SHA256_IV[0] | 0;
|
42661
|
+
this.B = SHA256_IV[1] | 0;
|
42662
|
+
this.C = SHA256_IV[2] | 0;
|
42663
|
+
this.D = SHA256_IV[3] | 0;
|
42664
|
+
this.E = SHA256_IV[4] | 0;
|
42665
|
+
this.F = SHA256_IV[5] | 0;
|
42666
|
+
this.G = SHA256_IV[6] | 0;
|
42667
|
+
this.H = SHA256_IV[7] | 0;
|
42668
|
+
}
|
42669
|
+
get() {
|
42670
|
+
const { A, B, C, D, E, F, G, H } = this;
|
42671
|
+
return [A, B, C, D, E, F, G, H];
|
42672
|
+
}
|
42673
|
+
// prettier-ignore
|
42674
|
+
set(A, B, C, D, E, F, G, H) {
|
42675
|
+
this.A = A | 0;
|
42676
|
+
this.B = B | 0;
|
42677
|
+
this.C = C | 0;
|
42678
|
+
this.D = D | 0;
|
42679
|
+
this.E = E | 0;
|
42680
|
+
this.F = F | 0;
|
42681
|
+
this.G = G | 0;
|
42682
|
+
this.H = H | 0;
|
42683
|
+
}
|
42684
|
+
process(view, offset) {
|
42685
|
+
for (let i = 0; i < 16; i++, offset += 4)
|
42686
|
+
SHA256_W2[i] = view.getUint32(offset, false);
|
42687
|
+
for (let i = 16; i < 64; i++) {
|
42688
|
+
const W15 = SHA256_W2[i - 15];
|
42689
|
+
const W2 = SHA256_W2[i - 2];
|
42690
|
+
const s0 = rotr2(W15, 7) ^ rotr2(W15, 18) ^ W15 >>> 3;
|
42691
|
+
const s1 = rotr2(W2, 17) ^ rotr2(W2, 19) ^ W2 >>> 10;
|
42692
|
+
SHA256_W2[i] = s1 + SHA256_W2[i - 7] + s0 + SHA256_W2[i - 16] | 0;
|
42693
|
+
}
|
42694
|
+
let { A, B, C, D, E, F, G, H } = this;
|
42695
|
+
for (let i = 0; i < 64; i++) {
|
42696
|
+
const sigma1 = rotr2(E, 6) ^ rotr2(E, 11) ^ rotr2(E, 25);
|
42697
|
+
const T1 = H + sigma1 + Chi2(E, F, G) + SHA256_K2[i] + SHA256_W2[i] | 0;
|
42698
|
+
const sigma0 = rotr2(A, 2) ^ rotr2(A, 13) ^ rotr2(A, 22);
|
42699
|
+
const T2 = sigma0 + Maj2(A, B, C) | 0;
|
42700
|
+
H = G;
|
42701
|
+
G = F;
|
42702
|
+
F = E;
|
42703
|
+
E = D + T1 | 0;
|
42704
|
+
D = C;
|
42705
|
+
C = B;
|
42706
|
+
B = A;
|
42707
|
+
A = T1 + T2 | 0;
|
42708
|
+
}
|
42709
|
+
A = A + this.A | 0;
|
42710
|
+
B = B + this.B | 0;
|
42711
|
+
C = C + this.C | 0;
|
42712
|
+
D = D + this.D | 0;
|
42713
|
+
E = E + this.E | 0;
|
42714
|
+
F = F + this.F | 0;
|
42715
|
+
G = G + this.G | 0;
|
42716
|
+
H = H + this.H | 0;
|
42717
|
+
this.set(A, B, C, D, E, F, G, H);
|
42718
|
+
}
|
42719
|
+
roundClean() {
|
42720
|
+
SHA256_W2.fill(0);
|
42721
|
+
}
|
42722
|
+
destroy() {
|
42723
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
42724
|
+
this.buffer.fill(0);
|
42725
|
+
}
|
42726
|
+
};
|
42727
|
+
var sha2563 = /* @__PURE__ */ wrapConstructor2(() => new SHA2562());
|
42728
|
+
|
42729
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/abstract/modular.js
|
42399
42730
|
var _0n3 = BigInt(0);
|
42400
42731
|
var _1n3 = BigInt(1);
|
42401
42732
|
var _2n3 = BigInt(2);
|
@@ -42431,11 +42762,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42431
42762
|
}
|
42432
42763
|
return res;
|
42433
42764
|
}
|
42434
|
-
function invert(
|
42435
|
-
if (
|
42436
|
-
throw new Error(`invert: expected positive integers, got n=${
|
42765
|
+
function invert(number3, modulo) {
|
42766
|
+
if (number3 === _0n3 || modulo <= _0n3) {
|
42767
|
+
throw new Error(`invert: expected positive integers, got n=${number3} mod=${modulo}`);
|
42437
42768
|
}
|
42438
|
-
let a = mod(
|
42769
|
+
let a = mod(number3, modulo);
|
42439
42770
|
let b = modulo;
|
42440
42771
|
let x = _0n3, y = _1n3, u = _1n3, v = _0n3;
|
42441
42772
|
while (a !== _0n3) {
|
@@ -42590,7 +42921,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42590
42921
|
const nByteLength = Math.ceil(_nBitLength / 8);
|
42591
42922
|
return { nBitLength: _nBitLength, nByteLength };
|
42592
42923
|
}
|
42593
|
-
function Field(ORDER, bitLen2,
|
42924
|
+
function Field(ORDER, bitLen2, isLE3 = false, redef = {}) {
|
42594
42925
|
if (ORDER <= _0n3)
|
42595
42926
|
throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
|
42596
42927
|
const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
|
@@ -42631,11 +42962,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42631
42962
|
// TODO: do we really need constant cmov?
|
42632
42963
|
// We don't have const-time bigints anyway, so probably will be not very useful
|
42633
42964
|
cmov: (a, b, c) => c ? b : a,
|
42634
|
-
toBytes: (num) =>
|
42635
|
-
fromBytes: (
|
42636
|
-
if (
|
42637
|
-
throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${
|
42638
|
-
return
|
42965
|
+
toBytes: (num) => isLE3 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
|
42966
|
+
fromBytes: (bytes3) => {
|
42967
|
+
if (bytes3.length !== BYTES)
|
42968
|
+
throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes3.length}`);
|
42969
|
+
return isLE3 ? bytesToNumberLE(bytes3) : bytesToNumberBE(bytes3);
|
42639
42970
|
}
|
42640
42971
|
});
|
42641
42972
|
return Object.freeze(f2);
|
@@ -42650,18 +42981,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42650
42981
|
const length = getFieldBytesLength(fieldOrder);
|
42651
42982
|
return length + Math.ceil(length / 2);
|
42652
42983
|
}
|
42653
|
-
function mapHashToField(key, fieldOrder,
|
42984
|
+
function mapHashToField(key, fieldOrder, isLE3 = false) {
|
42654
42985
|
const len = key.length;
|
42655
42986
|
const fieldLen = getFieldBytesLength(fieldOrder);
|
42656
42987
|
const minLen = getMinHashLength(fieldOrder);
|
42657
42988
|
if (len < 16 || len < minLen || len > 1024)
|
42658
42989
|
throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
|
42659
|
-
const num =
|
42990
|
+
const num = isLE3 ? bytesToNumberBE(key) : bytesToNumberLE(key);
|
42660
42991
|
const reduced = mod(num, fieldOrder - _1n3) + _1n3;
|
42661
|
-
return
|
42992
|
+
return isLE3 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
|
42662
42993
|
}
|
42663
42994
|
|
42664
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
42995
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/abstract/curve.js
|
42665
42996
|
var _0n4 = BigInt(0);
|
42666
42997
|
var _1n4 = BigInt(1);
|
42667
42998
|
function wNAF(c, bits) {
|
@@ -42779,7 +43110,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42779
43110
|
});
|
42780
43111
|
}
|
42781
43112
|
|
42782
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
43113
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/abstract/weierstrass.js
|
42783
43114
|
function validatePointOpts(curve) {
|
42784
43115
|
const opts = validateBasic(curve);
|
42785
43116
|
validateObject(opts, {
|
@@ -42830,8 +43161,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42830
43161
|
toSig(hex) {
|
42831
43162
|
const { Err: E } = DER;
|
42832
43163
|
const data = typeof hex === "string" ? h2b(hex) : hex;
|
42833
|
-
|
42834
|
-
throw new Error("ui8a expected");
|
43164
|
+
abytes(data);
|
42835
43165
|
let l = data.length;
|
42836
43166
|
if (l < 2 || data[0] != 48)
|
42837
43167
|
throw new E("Invalid signature tag");
|
@@ -42866,12 +43196,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42866
43196
|
function weierstrassPoints(opts) {
|
42867
43197
|
const CURVE = validatePointOpts(opts);
|
42868
43198
|
const { Fp: Fp2 } = CURVE;
|
42869
|
-
const
|
43199
|
+
const toBytes4 = CURVE.toBytes || ((_c, point, _isCompressed) => {
|
42870
43200
|
const a = point.toAffine();
|
42871
|
-
return
|
43201
|
+
return concatBytes2(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
|
42872
43202
|
});
|
42873
|
-
const fromBytes = CURVE.fromBytes || ((
|
42874
|
-
const tail =
|
43203
|
+
const fromBytes = CURVE.fromBytes || ((bytes3) => {
|
43204
|
+
const tail = bytes3.subarray(1);
|
42875
43205
|
const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES));
|
42876
43206
|
const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES));
|
42877
43207
|
return { x, y };
|
@@ -43234,7 +43564,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43234
43564
|
}
|
43235
43565
|
toRawBytes(isCompressed = true) {
|
43236
43566
|
this.assertValidity();
|
43237
|
-
return
|
43567
|
+
return toBytes4(Point2, this, isCompressed);
|
43238
43568
|
}
|
43239
43569
|
toHex(isCompressed = true) {
|
43240
43570
|
return bytesToHex(this.toRawBytes(isCompressed));
|
@@ -43284,23 +43614,29 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43284
43614
|
toBytes(_c, point, isCompressed) {
|
43285
43615
|
const a = point.toAffine();
|
43286
43616
|
const x = Fp2.toBytes(a.x);
|
43287
|
-
const cat =
|
43617
|
+
const cat = concatBytes2;
|
43288
43618
|
if (isCompressed) {
|
43289
43619
|
return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x);
|
43290
43620
|
} else {
|
43291
43621
|
return cat(Uint8Array.from([4]), x, Fp2.toBytes(a.y));
|
43292
43622
|
}
|
43293
43623
|
},
|
43294
|
-
fromBytes(
|
43295
|
-
const len =
|
43296
|
-
const head =
|
43297
|
-
const tail =
|
43624
|
+
fromBytes(bytes3) {
|
43625
|
+
const len = bytes3.length;
|
43626
|
+
const head = bytes3[0];
|
43627
|
+
const tail = bytes3.subarray(1);
|
43298
43628
|
if (len === compressedLen && (head === 2 || head === 3)) {
|
43299
43629
|
const x = bytesToNumberBE(tail);
|
43300
43630
|
if (!isValidFieldElement(x))
|
43301
43631
|
throw new Error("Point is not on curve");
|
43302
43632
|
const y2 = weierstrassEquation(x);
|
43303
|
-
let y
|
43633
|
+
let y;
|
43634
|
+
try {
|
43635
|
+
y = Fp2.sqrt(y2);
|
43636
|
+
} catch (sqrtError) {
|
43637
|
+
const suffix = sqrtError instanceof Error ? ": " + sqrtError.message : "";
|
43638
|
+
throw new Error("Point is not on curve" + suffix);
|
43639
|
+
}
|
43304
43640
|
const isYOdd = (y & _1n5) === _1n5;
|
43305
43641
|
const isHeadOdd = (head & 1) === 1;
|
43306
43642
|
if (isHeadOdd !== isYOdd)
|
@@ -43316,9 +43652,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43316
43652
|
}
|
43317
43653
|
});
|
43318
43654
|
const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
|
43319
|
-
function isBiggerThanHalfOrder(
|
43655
|
+
function isBiggerThanHalfOrder(number3) {
|
43320
43656
|
const HALF = CURVE_ORDER >> _1n5;
|
43321
|
-
return
|
43657
|
+
return number3 > HALF;
|
43322
43658
|
}
|
43323
43659
|
function normalizeS(s) {
|
43324
43660
|
return isBiggerThanHalfOrder(s) ? modN(-s) : s;
|
@@ -43448,13 +43784,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43448
43784
|
const b = Point2.fromHex(publicB);
|
43449
43785
|
return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
|
43450
43786
|
}
|
43451
|
-
const bits2int = CURVE.bits2int || function(
|
43452
|
-
const num = bytesToNumberBE(
|
43453
|
-
const delta =
|
43787
|
+
const bits2int = CURVE.bits2int || function(bytes3) {
|
43788
|
+
const num = bytesToNumberBE(bytes3);
|
43789
|
+
const delta = bytes3.length * 8 - CURVE.nBitLength;
|
43454
43790
|
return delta > 0 ? num >> BigInt(delta) : num;
|
43455
43791
|
};
|
43456
|
-
const bits2int_modN = CURVE.bits2int_modN || function(
|
43457
|
-
return modN(bits2int(
|
43792
|
+
const bits2int_modN = CURVE.bits2int_modN || function(bytes3) {
|
43793
|
+
return modN(bits2int(bytes3));
|
43458
43794
|
};
|
43459
43795
|
const ORDER_MASK = bitMask(CURVE.nBitLength);
|
43460
43796
|
function int2octets(num) {
|
@@ -43467,21 +43803,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43467
43803
|
function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
|
43468
43804
|
if (["recovered", "canonical"].some((k) => k in opts))
|
43469
43805
|
throw new Error("sign() legacy options not supported");
|
43470
|
-
const { hash:
|
43806
|
+
const { hash: hash4, randomBytes: randomBytes4 } = CURVE;
|
43471
43807
|
let { lowS, prehash, extraEntropy: ent } = opts;
|
43472
43808
|
if (lowS == null)
|
43473
43809
|
lowS = true;
|
43474
43810
|
msgHash = ensureBytes("msgHash", msgHash);
|
43475
43811
|
if (prehash)
|
43476
|
-
msgHash = ensureBytes("prehashed msgHash",
|
43812
|
+
msgHash = ensureBytes("prehashed msgHash", hash4(msgHash));
|
43477
43813
|
const h1int = bits2int_modN(msgHash);
|
43478
43814
|
const d = normPrivateKeyToScalar(privateKey);
|
43479
43815
|
const seedArgs = [int2octets(d), int2octets(h1int)];
|
43480
|
-
if (ent != null) {
|
43481
|
-
const e = ent === true ?
|
43816
|
+
if (ent != null && ent !== false) {
|
43817
|
+
const e = ent === true ? randomBytes4(Fp2.BYTES) : ent;
|
43482
43818
|
seedArgs.push(ensureBytes("extraEntropy", e));
|
43483
43819
|
}
|
43484
|
-
const seed =
|
43820
|
+
const seed = concatBytes2(...seedArgs);
|
43485
43821
|
const m = h1int;
|
43486
43822
|
function k2sig(kBytes) {
|
43487
43823
|
const k = bits2int(kBytes);
|
@@ -43571,20 +43907,85 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43571
43907
|
};
|
43572
43908
|
}
|
43573
43909
|
|
43574
|
-
// ../../node_modules/.pnpm/@noble+
|
43575
|
-
|
43910
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/hmac.js
|
43911
|
+
var HMAC2 = class extends Hash2 {
|
43912
|
+
constructor(hash4, _key) {
|
43913
|
+
super();
|
43914
|
+
this.finished = false;
|
43915
|
+
this.destroyed = false;
|
43916
|
+
hash3(hash4);
|
43917
|
+
const key = toBytes3(_key);
|
43918
|
+
this.iHash = hash4.create();
|
43919
|
+
if (typeof this.iHash.update !== "function")
|
43920
|
+
throw new Error("Expected instance of class which extends utils.Hash");
|
43921
|
+
this.blockLen = this.iHash.blockLen;
|
43922
|
+
this.outputLen = this.iHash.outputLen;
|
43923
|
+
const blockLen = this.blockLen;
|
43924
|
+
const pad3 = new Uint8Array(blockLen);
|
43925
|
+
pad3.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
|
43926
|
+
for (let i = 0; i < pad3.length; i++)
|
43927
|
+
pad3[i] ^= 54;
|
43928
|
+
this.iHash.update(pad3);
|
43929
|
+
this.oHash = hash4.create();
|
43930
|
+
for (let i = 0; i < pad3.length; i++)
|
43931
|
+
pad3[i] ^= 54 ^ 92;
|
43932
|
+
this.oHash.update(pad3);
|
43933
|
+
pad3.fill(0);
|
43934
|
+
}
|
43935
|
+
update(buf) {
|
43936
|
+
exists2(this);
|
43937
|
+
this.iHash.update(buf);
|
43938
|
+
return this;
|
43939
|
+
}
|
43940
|
+
digestInto(out) {
|
43941
|
+
exists2(this);
|
43942
|
+
bytes2(out, this.outputLen);
|
43943
|
+
this.finished = true;
|
43944
|
+
this.iHash.digestInto(out);
|
43945
|
+
this.oHash.update(out);
|
43946
|
+
this.oHash.digestInto(out);
|
43947
|
+
this.destroy();
|
43948
|
+
}
|
43949
|
+
digest() {
|
43950
|
+
const out = new Uint8Array(this.oHash.outputLen);
|
43951
|
+
this.digestInto(out);
|
43952
|
+
return out;
|
43953
|
+
}
|
43954
|
+
_cloneInto(to) {
|
43955
|
+
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
43956
|
+
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
43957
|
+
to = to;
|
43958
|
+
to.finished = finished;
|
43959
|
+
to.destroyed = destroyed;
|
43960
|
+
to.blockLen = blockLen;
|
43961
|
+
to.outputLen = outputLen;
|
43962
|
+
to.oHash = oHash._cloneInto(to.oHash);
|
43963
|
+
to.iHash = iHash._cloneInto(to.iHash);
|
43964
|
+
return to;
|
43965
|
+
}
|
43966
|
+
destroy() {
|
43967
|
+
this.destroyed = true;
|
43968
|
+
this.oHash.destroy();
|
43969
|
+
this.iHash.destroy();
|
43970
|
+
}
|
43971
|
+
};
|
43972
|
+
var hmac2 = (hash4, key, message) => new HMAC2(hash4, key).update(message).digest();
|
43973
|
+
hmac2.create = (hash4, key) => new HMAC2(hash4, key);
|
43974
|
+
|
43975
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/_shortw_utils.js
|
43976
|
+
function getHash(hash4) {
|
43576
43977
|
return {
|
43577
|
-
hash:
|
43578
|
-
hmac: (key, ...msgs) =>
|
43579
|
-
randomBytes
|
43978
|
+
hash: hash4,
|
43979
|
+
hmac: (key, ...msgs) => hmac2(hash4, key, concatBytes3(...msgs)),
|
43980
|
+
randomBytes: randomBytes3
|
43580
43981
|
};
|
43581
43982
|
}
|
43582
43983
|
function createCurve(curveDef, defHash) {
|
43583
|
-
const create = (
|
43984
|
+
const create = (hash4) => weierstrass({ ...curveDef, ...getHash(hash4) });
|
43584
43985
|
return Object.freeze({ ...create(defHash), create });
|
43585
43986
|
}
|
43586
43987
|
|
43587
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
43988
|
+
// ../../node_modules/.pnpm/@noble+curves@1.4.0/node_modules/@noble/curves/esm/secp256k1.js
|
43588
43989
|
var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
|
43589
43990
|
var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
43590
43991
|
var _1n6 = BigInt(1);
|
@@ -43660,7 +44061,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43660
44061
|
return { k1neg, k1, k2neg, k2 };
|
43661
44062
|
}
|
43662
44063
|
}
|
43663
|
-
},
|
44064
|
+
}, sha2563);
|
43664
44065
|
var _0n6 = BigInt(0);
|
43665
44066
|
var Point = secp256k1.ProjectivePoint;
|
43666
44067
|
|
@@ -43753,7 +44154,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43753
44154
|
* @returns random 32-byte hashed
|
43754
44155
|
*/
|
43755
44156
|
static generatePrivateKey(entropy) {
|
43756
|
-
return entropy ? hash2(concat([
|
44157
|
+
return entropy ? hash2(concat([randomBytes2(32), arrayify(entropy)])) : randomBytes2(32);
|
43757
44158
|
}
|
43758
44159
|
/**
|
43759
44160
|
* Extended publicKey from a compact publicKey
|
@@ -43829,7 +44230,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43829
44230
|
async function encryptKeystoreWallet(privateKey, address, password) {
|
43830
44231
|
const privateKeyBuffer = bufferFromString2(removeHexPrefix(privateKey), "hex");
|
43831
44232
|
const ownerAddress = Address.fromAddressOrString(address);
|
43832
|
-
const salt =
|
44233
|
+
const salt = randomBytes2(DEFAULT_KEY_SIZE);
|
43833
44234
|
const key = scrypt22({
|
43834
44235
|
password: bufferFromString2(password),
|
43835
44236
|
salt,
|
@@ -43838,7 +44239,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43838
44239
|
r: DEFAULT_KDF_PARAMS_R,
|
43839
44240
|
p: DEFAULT_KDF_PARAMS_P
|
43840
44241
|
});
|
43841
|
-
const iv =
|
44242
|
+
const iv = randomBytes2(DEFAULT_IV_SIZE);
|
43842
44243
|
const ciphertext = await encryptJsonWalletData2(privateKeyBuffer, key, iv);
|
43843
44244
|
const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
|
43844
44245
|
const macHashUint8Array = keccak2562(data);
|
@@ -46340,7 +46741,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46340
46741
|
* @returns A randomly generated mnemonic
|
46341
46742
|
*/
|
46342
46743
|
static generate(size = 32, extraEntropy = "") {
|
46343
|
-
const entropy = extraEntropy ? sha2562(concat([
|
46744
|
+
const entropy = extraEntropy ? sha2562(concat([randomBytes2(size), arrayify(extraEntropy)])) : randomBytes2(size);
|
46344
46745
|
return Mnemonic.entropyToMnemonic(entropy);
|
46345
46746
|
}
|
46346
46747
|
};
|
@@ -46441,9 +46842,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46441
46842
|
data.set(arrayify(this.publicKey));
|
46442
46843
|
}
|
46443
46844
|
data.set(toBytes(index, 4), 33);
|
46444
|
-
const
|
46445
|
-
const IL =
|
46446
|
-
const IR =
|
46845
|
+
const bytes3 = arrayify(computeHmac2("sha512", chainCode, data));
|
46846
|
+
const IL = bytes3.slice(0, 32);
|
46847
|
+
const IR = bytes3.slice(32);
|
46447
46848
|
if (privateKey) {
|
46448
46849
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
46449
46850
|
const ki = bn(IL).add(privateKey).mod(N).toBytes(32);
|
@@ -46513,26 +46914,26 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
46513
46914
|
}
|
46514
46915
|
static fromExtendedKey(extendedKey) {
|
46515
46916
|
const decoded = hexlify(toBytes(decodeBase58(extendedKey)));
|
46516
|
-
const
|
46517
|
-
const validChecksum = base58check(
|
46518
|
-
if (
|
46917
|
+
const bytes3 = arrayify(decoded);
|
46918
|
+
const validChecksum = base58check(bytes3.slice(0, 78)) === extendedKey;
|
46919
|
+
if (bytes3.length !== 82 || !isValidExtendedKey(bytes3)) {
|
46519
46920
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
46520
46921
|
}
|
46521
46922
|
if (!validChecksum) {
|
46522
46923
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
46523
46924
|
}
|
46524
|
-
const depth =
|
46525
|
-
const parentFingerprint = hexlify(
|
46526
|
-
const index = parseInt(hexlify(
|
46527
|
-
const chainCode = hexlify(
|
46528
|
-
const key =
|
46925
|
+
const depth = bytes3[4];
|
46926
|
+
const parentFingerprint = hexlify(bytes3.slice(5, 9));
|
46927
|
+
const index = parseInt(hexlify(bytes3.slice(9, 13)).substring(2), 16);
|
46928
|
+
const chainCode = hexlify(bytes3.slice(13, 45));
|
46929
|
+
const key = bytes3.slice(45, 78);
|
46529
46930
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
46530
46931
|
throw new FuelError(
|
46531
46932
|
ErrorCode.HD_WALLET_ERROR,
|
46532
46933
|
"Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
|
46533
46934
|
);
|
46534
46935
|
}
|
46535
|
-
if (isPublicExtendedKey(
|
46936
|
+
if (isPublicExtendedKey(bytes3)) {
|
46536
46937
|
if (key[0] !== 3) {
|
46537
46938
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
|
46538
46939
|
}
|
@@ -47176,8 +47577,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47176
47577
|
// src/predicate/utils/getPredicateRoot.ts
|
47177
47578
|
var getPredicateRoot = (bytecode) => {
|
47178
47579
|
const chunkSize = 16 * 1024;
|
47179
|
-
const
|
47180
|
-
const chunks = chunkAndPadBytes(
|
47580
|
+
const bytes3 = arrayify(bytecode);
|
47581
|
+
const chunks = chunkAndPadBytes(bytes3, chunkSize);
|
47181
47582
|
const codeRoot = calcRoot(chunks.map((c) => hexlify(c)));
|
47182
47583
|
const predicateRoot = hash2(concat(["0x4655454C", codeRoot]));
|
47183
47584
|
return predicateRoot;
|
@@ -47273,8 +47674,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47273
47674
|
* @param configurableConstants - Optional configurable constants for the predicate.
|
47274
47675
|
* @returns An object containing the new predicate bytes and interface.
|
47275
47676
|
*/
|
47276
|
-
static processPredicateData(
|
47277
|
-
let predicateBytes = arrayify(
|
47677
|
+
static processPredicateData(bytes3, jsonAbi, configurableConstants) {
|
47678
|
+
let predicateBytes = arrayify(bytes3);
|
47278
47679
|
let abiInterface;
|
47279
47680
|
if (jsonAbi) {
|
47280
47681
|
abiInterface = new Interface(jsonAbi);
|
@@ -47337,8 +47738,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47337
47738
|
* @param abiInterface - The ABI interface of the predicate.
|
47338
47739
|
* @returns The mutated bytes with the configurable constants set.
|
47339
47740
|
*/
|
47340
|
-
static setConfigurableConstants(
|
47341
|
-
const mutatedBytes =
|
47741
|
+
static setConfigurableConstants(bytes3, configurableConstants, abiInterface) {
|
47742
|
+
const mutatedBytes = bytes3;
|
47342
47743
|
try {
|
47343
47744
|
if (!abiInterface) {
|
47344
47745
|
throw new Error(
|
@@ -48082,6 +48483,9 @@ mime-types/index.js:
|
|
48082
48483
|
@noble/curves/esm/abstract/utils.js:
|
48083
48484
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
48084
48485
|
|
48486
|
+
@noble/hashes/esm/utils.js:
|
48487
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
48488
|
+
|
48085
48489
|
@noble/curves/esm/abstract/modular.js:
|
48086
48490
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
48087
48491
|
|