@fuel-ts/account 0.94.4 → 0.94.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configs.d.ts +6 -0
- package/dist/configs.d.ts.map +1 -1
- package/dist/configs.global.js.map +1 -1
- package/dist/configs.js.map +1 -1
- package/dist/configs.mjs.map +1 -1
- package/dist/connectors/fuel-connector.d.ts +3 -4
- package/dist/connectors/fuel-connector.d.ts.map +1 -1
- package/dist/connectors/types/data-type.d.ts +7 -0
- package/dist/connectors/types/data-type.d.ts.map +1 -1
- package/dist/connectors/types/local-storage.d.ts +0 -1
- package/dist/connectors/types/local-storage.d.ts.map +1 -1
- package/dist/index.global.js +1659 -1135
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1329 -416
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1271 -367
- package/dist/index.mjs.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +169 -0
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/assets/assets.d.ts +1 -1
- package/dist/providers/assets/assets.d.ts.map +1 -1
- package/dist/providers/assets/utils/network.d.ts.map +1 -1
- package/dist/providers/assets/utils/resolveIconPaths.d.ts +1 -1
- package/dist/providers/chains.d.ts +2 -0
- package/dist/providers/chains.d.ts.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts +0 -2
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +17 -4
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/resource.d.ts.map +1 -1
- package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
- package/dist/providers/transaction-request/index.d.ts +2 -0
- package/dist/providers/transaction-request/index.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +2 -2
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/types.d.ts +8 -2
- package/dist/providers/transaction-request/types.d.ts.map +1 -1
- package/dist/providers/transaction-request/upgrade-transaction-request.d.ts +87 -0
- package/dist/providers/transaction-request/upgrade-transaction-request.d.ts.map +1 -0
- package/dist/providers/transaction-request/upload-transaction-request.d.ts +82 -0
- package/dist/providers/transaction-request/upload-transaction-request.d.ts.map +1 -0
- package/dist/providers/transaction-request/utils.d.ts +6 -0
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts +3 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/input.d.ts.map +1 -1
- package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
- package/dist/providers/transaction-summary/output.d.ts.map +1 -1
- package/dist/providers/transaction-summary/receipt.d.ts.map +1 -1
- package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts +16 -0
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/providers/utils/receipts.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils/resources.d.ts.map +1 -1
- package/dist/test-utils/transactionRequest.d.ts.map +1 -1
- package/dist/test-utils.global.js +1653 -1131
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +1238 -341
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +1195 -300
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet-manager/wallet-manager.d.ts +0 -1
- package/dist/wallet-manager/wallet-manager.d.ts.map +1 -1
- package/package.json +18 -17
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(number2, base, endian) {
|
89
|
+
if (BN2.isBN(number2)) {
|
90
|
+
return number2;
|
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 (number2 !== null) {
|
97
97
|
if (base === "le" || base === "be") {
|
98
98
|
endian = base;
|
99
99
|
base = 10;
|
100
100
|
}
|
101
|
-
this._init(
|
101
|
+
this._init(number2 || 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(number2, base, endian) {
|
137
|
+
if (typeof number2 === "number") {
|
138
|
+
return this._initNumber(number2, base, endian);
|
139
139
|
}
|
140
|
-
if (typeof
|
141
|
-
return this._initArray(
|
140
|
+
if (typeof number2 === "object") {
|
141
|
+
return this._initArray(number2, 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
|
+
number2 = number2.toString().replace(/\s+/g, "");
|
148
148
|
var start = 0;
|
149
|
-
if (
|
149
|
+
if (number2[0] === "-") {
|
150
150
|
start++;
|
151
151
|
this.negative = 1;
|
152
152
|
}
|
153
|
-
if (start <
|
153
|
+
if (start < number2.length) {
|
154
154
|
if (base === 16) {
|
155
|
-
this._parseHex(
|
155
|
+
this._parseHex(number2, start, endian);
|
156
156
|
} else {
|
157
|
-
this._parseBase(
|
157
|
+
this._parseBase(number2, 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(number2, base, endian) {
|
165
|
+
if (number2 < 0) {
|
166
166
|
this.negative = 1;
|
167
|
-
|
167
|
+
number2 = -number2;
|
168
168
|
}
|
169
|
-
if (
|
170
|
-
this.words = [
|
169
|
+
if (number2 < 67108864) {
|
170
|
+
this.words = [number2 & 67108863];
|
171
171
|
this.length = 1;
|
172
|
-
} else if (
|
172
|
+
} else if (number2 < 4503599627370496) {
|
173
173
|
this.words = [
|
174
|
-
|
175
|
-
|
174
|
+
number2 & 67108863,
|
175
|
+
number2 / 67108864 & 67108863
|
176
176
|
];
|
177
177
|
this.length = 2;
|
178
178
|
} else {
|
179
|
-
assert2(
|
179
|
+
assert2(number2 < 9007199254740992);
|
180
180
|
this.words = [
|
181
|
-
|
182
|
-
|
181
|
+
number2 & 67108863,
|
182
|
+
number2 / 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(number2, base, endian) {
|
192
|
+
assert2(typeof number2.length === "number");
|
193
|
+
if (number2.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(number2.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 = number2.length - 1, j = 0; i >= 0; i -= 3) {
|
207
|
+
w = number2[i] | number2[i - 1] << 8 | number2[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 < number2.length; i += 3) {
|
218
|
+
w = number2[i] | number2[i + 1] << 8 | number2[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(number2, start, endian) {
|
250
|
+
this.length = Math.ceil((number2.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 = number2.length - 1; i >= start; i -= 2) {
|
260
|
+
w = parseHexByte(number2, 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 = number2.length - start;
|
272
|
+
for (i = parseLength % 2 === 0 ? start + 1 : start; i < number2.length; i += 2) {
|
273
|
+
w = parseHexByte(number2, 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(number2, 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 = number2.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(number2, 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(number2, i, number2.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, output2) {
|
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
|
+
output2.words[i] = input.words[i];
|
2659
2659
|
}
|
2660
|
-
|
2660
|
+
output2.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
|
+
output2.words[output2.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(bytes2) {
|
3064
|
+
return convert2(bytes2, 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 output2 = [];
|
3604
3604
|
for (let i = 0; i < input.length; ++i) {
|
3605
3605
|
if (input[i] !== 37) {
|
3606
|
-
|
3606
|
+
output2.push(input[i]);
|
3607
3607
|
} else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) {
|
3608
|
-
|
3608
|
+
output2.push(parseInt(input.slice(i + 1, i + 3).toString(), 16));
|
3609
3609
|
i += 2;
|
3610
3610
|
} else {
|
3611
|
-
|
3611
|
+
output2.push(input[i]);
|
3612
3612
|
}
|
3613
3613
|
}
|
3614
|
-
return new Buffer(
|
3614
|
+
return new Buffer(output2).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 output2 = "";
|
3691
3691
|
let n = address;
|
3692
3692
|
for (let i = 1; i <= 4; ++i) {
|
3693
|
-
|
3693
|
+
output2 = String(n % 256) + output2;
|
3694
3694
|
if (i !== 4) {
|
3695
|
-
|
3695
|
+
output2 = "." + output2;
|
3696
3696
|
}
|
3697
3697
|
n = Math.floor(n / 256);
|
3698
3698
|
}
|
3699
|
-
return
|
3699
|
+
return output2;
|
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 number2 = parseInt(at(input, pointer));
|
3758
3758
|
if (ipv4Piece === null) {
|
3759
|
-
ipv4Piece =
|
3759
|
+
ipv4Piece = number2;
|
3760
3760
|
} else if (ipv4Piece === 0) {
|
3761
3761
|
return failure;
|
3762
3762
|
} else {
|
3763
|
-
ipv4Piece = ipv4Piece * 10 +
|
3763
|
+
ipv4Piece = ipv4Piece * 10 + number2;
|
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 output2 = "";
|
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
|
+
output2 += separator;
|
3820
3820
|
ignore0 = true;
|
3821
3821
|
continue;
|
3822
3822
|
}
|
3823
|
-
|
3823
|
+
output2 += address[pieceIndex].toString(16);
|
3824
3824
|
if (pieceIndex !== 7) {
|
3825
|
-
|
3825
|
+
output2 += ":";
|
3826
3826
|
}
|
3827
3827
|
}
|
3828
|
-
return
|
3828
|
+
return output2;
|
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 output2 = "";
|
3859
3859
|
const decoded = punycode.ucs2.decode(input);
|
3860
3860
|
for (let i = 0; i < decoded.length; ++i) {
|
3861
|
-
|
3861
|
+
output2 += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
|
3862
3862
|
}
|
3863
|
-
return
|
3863
|
+
return output2;
|
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 output2 = url.scheme + ":";
|
4489
4489
|
if (url.host !== null) {
|
4490
|
-
|
4490
|
+
output2 += "//";
|
4491
4491
|
if (url.username !== "" || url.password !== "") {
|
4492
|
-
|
4492
|
+
output2 += url.username;
|
4493
4493
|
if (url.password !== "") {
|
4494
|
-
|
4494
|
+
output2 += ":" + url.password;
|
4495
4495
|
}
|
4496
|
-
|
4496
|
+
output2 += "@";
|
4497
4497
|
}
|
4498
|
-
|
4498
|
+
output2 += serializeHost(url.host);
|
4499
4499
|
if (url.port !== null) {
|
4500
|
-
|
4500
|
+
output2 += ":" + url.port;
|
4501
4501
|
}
|
4502
4502
|
} else if (url.host === null && url.scheme === "file") {
|
4503
|
-
|
4503
|
+
output2 += "//";
|
4504
4504
|
}
|
4505
4505
|
if (url.cannotBeABaseURL) {
|
4506
|
-
|
4506
|
+
output2 += url.path[0];
|
4507
4507
|
} else {
|
4508
4508
|
for (const string of url.path) {
|
4509
|
-
|
4509
|
+
output2 += "/" + string;
|
4510
4510
|
}
|
4511
4511
|
}
|
4512
4512
|
if (url.query !== null) {
|
4513
|
-
|
4513
|
+
output2 += "?" + url.query;
|
4514
4514
|
}
|
4515
4515
|
if (!excludeFragment && url.fragment !== null) {
|
4516
|
-
|
4516
|
+
output2 += "#" + url.fragment;
|
4517
4517
|
}
|
4518
|
-
return
|
4518
|
+
return output2;
|
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 output2 = this.message;
|
6463
6463
|
if (this.nodes) {
|
6464
6464
|
for (const node of this.nodes) {
|
6465
6465
|
if (node.loc) {
|
6466
|
-
|
6466
|
+
output2 += "\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
|
+
output2 += "\n\n" + (0, _printLocation.printSourceLocation)(this.source, location);
|
6472
6472
|
}
|
6473
6473
|
}
|
6474
|
-
return
|
6474
|
+
return output2;
|
6475
6475
|
}
|
6476
6476
|
toJSON() {
|
6477
6477
|
const formattedError = {
|
@@ -18788,7 +18788,7 @@ spurious results.`);
|
|
18788
18788
|
module.exports = iterate;
|
18789
18789
|
function iterate(list, iterator, state, callback) {
|
18790
18790
|
var key = state["keyedList"] ? state["keyedList"][state.index] : state.index;
|
18791
|
-
state.jobs[key] = runJob(iterator, key, list[key], function(error,
|
18791
|
+
state.jobs[key] = runJob(iterator, key, list[key], function(error, output2) {
|
18792
18792
|
if (!(key in state.jobs)) {
|
18793
18793
|
return;
|
18794
18794
|
}
|
@@ -18796,7 +18796,7 @@ spurious results.`);
|
|
18796
18796
|
if (error) {
|
18797
18797
|
abort(state);
|
18798
18798
|
} else {
|
18799
|
-
state.results[key] =
|
18799
|
+
state.results[key] = output2;
|
18800
18800
|
}
|
18801
18801
|
callback(error, state.results);
|
18802
18802
|
});
|
@@ -20558,8 +20558,8 @@ spurious results.`);
|
|
20558
20558
|
const ret3 = wasm$1.retd(addr, len);
|
20559
20559
|
return Instruction.__wrap(ret3);
|
20560
20560
|
}
|
20561
|
-
function aloc(
|
20562
|
-
const ret3 = wasm$1.aloc(
|
20561
|
+
function aloc(bytes2) {
|
20562
|
+
const ret3 = wasm$1.aloc(bytes2);
|
20563
20563
|
return Instruction.__wrap(ret3);
|
20564
20564
|
}
|
20565
20565
|
function mcl(dst_addr, len) {
|
@@ -21791,9 +21791,9 @@ spurious results.`);
|
|
21791
21791
|
* Construct the instruction from its parts.
|
21792
21792
|
* @param {RegId} bytes
|
21793
21793
|
*/
|
21794
|
-
constructor(
|
21795
|
-
_assertClass(
|
21796
|
-
var ptr0 =
|
21794
|
+
constructor(bytes2) {
|
21795
|
+
_assertClass(bytes2, RegId);
|
21796
|
+
var ptr0 = bytes2.__destroy_into_raw();
|
21797
21797
|
const ret3 = wasm$1.aloc_new_typescript(ptr0);
|
21798
21798
|
this.__wbg_ptr = ret3 >>> 0;
|
21799
21799
|
return this;
|
@@ -28464,8 +28464,8 @@ spurious results.`);
|
|
28464
28464
|
}
|
28465
28465
|
}
|
28466
28466
|
}
|
28467
|
-
const
|
28468
|
-
return await WebAssembly.instantiate(
|
28467
|
+
const bytes2 = await module2.arrayBuffer();
|
28468
|
+
return await WebAssembly.instantiate(bytes2, imports);
|
28469
28469
|
} else {
|
28470
28470
|
const instance = await WebAssembly.instantiate(module2, imports);
|
28471
28471
|
if (instance instanceof WebAssembly.Instance) {
|
@@ -28799,9 +28799,9 @@ spurious results.`);
|
|
28799
28799
|
// ../versions/dist/index.mjs
|
28800
28800
|
function getBuiltinVersions() {
|
28801
28801
|
return {
|
28802
|
-
FORC: "0.63.
|
28802
|
+
FORC: "0.63.5",
|
28803
28803
|
FUEL_CORE: "0.35.0",
|
28804
|
-
FUELS: "0.94.
|
28804
|
+
FUELS: "0.94.6"
|
28805
28805
|
};
|
28806
28806
|
}
|
28807
28807
|
function parseVersion(version) {
|
@@ -28884,6 +28884,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
28884
28884
|
ErrorCode2["MISSING_PROVIDER"] = "missing-provider";
|
28885
28885
|
ErrorCode2["INVALID_PROVIDER"] = "invalid-provider";
|
28886
28886
|
ErrorCode2["CONNECTION_REFUSED"] = "connection-refused";
|
28887
|
+
ErrorCode2["INVALID_URL"] = "invalid-url";
|
28887
28888
|
ErrorCode2["INVALID_PUBLIC_KEY"] = "invalid-public-key";
|
28888
28889
|
ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
|
28889
28890
|
ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
|
@@ -29015,15 +29016,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29015
29016
|
// ANCHOR: HELPERS
|
29016
29017
|
// make sure we always include `0x` in hex strings
|
29017
29018
|
toString(base, length) {
|
29018
|
-
const
|
29019
|
+
const output2 = super.toString(base, length);
|
29019
29020
|
if (base === 16 || base === "hex") {
|
29020
|
-
return `0x${
|
29021
|
+
return `0x${output2}`;
|
29021
29022
|
}
|
29022
|
-
return
|
29023
|
+
return output2;
|
29023
29024
|
}
|
29024
29025
|
toHex(bytesPadding) {
|
29025
|
-
const
|
29026
|
-
const bytesLength =
|
29026
|
+
const bytes2 = bytesPadding || 0;
|
29027
|
+
const bytesLength = bytes2 * 2;
|
29027
29028
|
if (this.isNeg()) {
|
29028
29029
|
throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to hex.");
|
29029
29030
|
}
|
@@ -29134,21 +29135,21 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29134
29135
|
// END ANCHOR: OVERRIDES to output our BN type
|
29135
29136
|
// ANCHOR: OVERRIDES to avoid losing references
|
29136
29137
|
caller(v, methodName) {
|
29137
|
-
const
|
29138
|
-
if (BN.isBN(
|
29139
|
-
return new BN(
|
29138
|
+
const output2 = super[methodName](new BN(v));
|
29139
|
+
if (BN.isBN(output2)) {
|
29140
|
+
return new BN(output2.toArray());
|
29140
29141
|
}
|
29141
|
-
if (typeof
|
29142
|
-
return
|
29142
|
+
if (typeof output2 === "boolean") {
|
29143
|
+
return output2;
|
29143
29144
|
}
|
29144
|
-
return
|
29145
|
+
return output2;
|
29145
29146
|
}
|
29146
29147
|
clone() {
|
29147
29148
|
return new BN(this.toArray());
|
29148
29149
|
}
|
29149
29150
|
mulTo(num, out) {
|
29150
|
-
const
|
29151
|
-
return new BN(
|
29151
|
+
const output2 = new import_bn.default(this.toArray()).mulTo(num, out);
|
29152
|
+
return new BN(output2.toArray());
|
29152
29153
|
}
|
29153
29154
|
egcd(p) {
|
29154
29155
|
const { a, b, gcd } = new import_bn.default(this.toArray()).egcd(p);
|
@@ -29206,15 +29207,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29206
29207
|
__defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
29207
29208
|
return value;
|
29208
29209
|
};
|
29209
|
-
var chunkAndPadBytes = (
|
29210
|
+
var chunkAndPadBytes = (bytes2, chunkSize) => {
|
29210
29211
|
const chunks = [];
|
29211
|
-
for (let offset = 0; offset <
|
29212
|
+
for (let offset = 0; offset < bytes2.length; offset += chunkSize) {
|
29212
29213
|
const chunk = new Uint8Array(chunkSize);
|
29213
|
-
chunk.set(
|
29214
|
+
chunk.set(bytes2.slice(offset, offset + chunkSize));
|
29214
29215
|
chunks.push(chunk);
|
29215
29216
|
}
|
29216
29217
|
const lastChunk = chunks[chunks.length - 1];
|
29217
|
-
const remainingBytes =
|
29218
|
+
const remainingBytes = bytes2.length % chunkSize;
|
29218
29219
|
const paddedChunkLength = remainingBytes + (8 - remainingBytes % 8) % 8;
|
29219
29220
|
const newChunk = lastChunk.slice(0, paddedChunkLength);
|
29220
29221
|
chunks[chunks.length - 1] = newChunk;
|
@@ -29257,15 +29258,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29257
29258
|
return concatenated;
|
29258
29259
|
};
|
29259
29260
|
var concat = (arrays) => {
|
29260
|
-
const
|
29261
|
-
return concatBytes(
|
29261
|
+
const bytes2 = arrays.map((v) => arrayify(v));
|
29262
|
+
return concatBytes(bytes2);
|
29262
29263
|
};
|
29263
29264
|
var HexCharacters = "0123456789abcdef";
|
29264
29265
|
function hexlify(data) {
|
29265
|
-
const
|
29266
|
+
const bytes2 = arrayify(data);
|
29266
29267
|
let result = "0x";
|
29267
|
-
for (let i = 0; i <
|
29268
|
-
const v =
|
29268
|
+
for (let i = 0; i < bytes2.length; i++) {
|
29269
|
+
const v = bytes2[i];
|
29269
29270
|
result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15];
|
29270
29271
|
}
|
29271
29272
|
return result;
|
@@ -29358,15 +29359,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29358
29359
|
return bn(result);
|
29359
29360
|
}
|
29360
29361
|
function encodeBase58(_value) {
|
29361
|
-
const
|
29362
|
-
let value = bn(
|
29362
|
+
const bytes2 = arrayify(_value);
|
29363
|
+
let value = bn(bytes2);
|
29363
29364
|
let result = "";
|
29364
29365
|
while (value.gt(BN_0)) {
|
29365
29366
|
result = Alphabet[Number(value.mod(BN_58))] + result;
|
29366
29367
|
value = value.div(BN_58);
|
29367
29368
|
}
|
29368
|
-
for (let i = 0; i <
|
29369
|
-
if (
|
29369
|
+
for (let i = 0; i < bytes2.length; i++) {
|
29370
|
+
if (bytes2[i]) {
|
29370
29371
|
break;
|
29371
29372
|
}
|
29372
29373
|
result = Alphabet[0] + result;
|
@@ -29382,11 +29383,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29382
29383
|
return result;
|
29383
29384
|
}
|
29384
29385
|
function dataSlice(data, start, end) {
|
29385
|
-
const
|
29386
|
-
if (end != null && end >
|
29386
|
+
const bytes2 = arrayify(data);
|
29387
|
+
if (end != null && end > bytes2.length) {
|
29387
29388
|
throw new FuelError(ErrorCode.INVALID_DATA, "cannot slice beyond data bounds");
|
29388
29389
|
}
|
29389
|
-
return hexlify(
|
29390
|
+
return hexlify(bytes2.slice(start == null ? 0 : start, end == null ? bytes2.length : end));
|
29390
29391
|
}
|
29391
29392
|
function toUtf8Bytes(stri, form = true) {
|
29392
29393
|
let str = stri;
|
@@ -29423,8 +29424,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29423
29424
|
}
|
29424
29425
|
return new Uint8Array(result);
|
29425
29426
|
}
|
29426
|
-
function onError(reason, offset,
|
29427
|
-
console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${
|
29427
|
+
function onError(reason, offset, bytes2, output2, badCodepoint) {
|
29428
|
+
console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${bytes2}`);
|
29428
29429
|
return offset;
|
29429
29430
|
}
|
29430
29431
|
function helper(codePoints) {
|
@@ -29440,11 +29441,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29440
29441
|
}).join("");
|
29441
29442
|
}
|
29442
29443
|
function getUtf8CodePoints(_bytes) {
|
29443
|
-
const
|
29444
|
+
const bytes2 = arrayify(_bytes, "bytes");
|
29444
29445
|
const result = [];
|
29445
29446
|
let i = 0;
|
29446
|
-
while (i <
|
29447
|
-
const c =
|
29447
|
+
while (i < bytes2.length) {
|
29448
|
+
const c = bytes2[i++];
|
29448
29449
|
if (c >> 7 === 0) {
|
29449
29450
|
result.push(c);
|
29450
29451
|
continue;
|
@@ -29462,21 +29463,21 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29462
29463
|
overlongMask = 65535;
|
29463
29464
|
} else {
|
29464
29465
|
if ((c & 192) === 128) {
|
29465
|
-
i += onError("UNEXPECTED_CONTINUE", i - 1,
|
29466
|
+
i += onError("UNEXPECTED_CONTINUE", i - 1, bytes2, result);
|
29466
29467
|
} else {
|
29467
|
-
i += onError("BAD_PREFIX", i - 1,
|
29468
|
+
i += onError("BAD_PREFIX", i - 1, bytes2, result);
|
29468
29469
|
}
|
29469
29470
|
continue;
|
29470
29471
|
}
|
29471
|
-
if (i - 1 + extraLength >=
|
29472
|
-
i += onError("OVERRUN", i - 1,
|
29472
|
+
if (i - 1 + extraLength >= bytes2.length) {
|
29473
|
+
i += onError("OVERRUN", i - 1, bytes2, result);
|
29473
29474
|
continue;
|
29474
29475
|
}
|
29475
29476
|
let res = c & (1 << 8 - extraLength - 1) - 1;
|
29476
29477
|
for (let j = 0; j < extraLength; j++) {
|
29477
|
-
const nextChar =
|
29478
|
+
const nextChar = bytes2[i];
|
29478
29479
|
if ((nextChar & 192) !== 128) {
|
29479
|
-
i += onError("MISSING_CONTINUE", i,
|
29480
|
+
i += onError("MISSING_CONTINUE", i, bytes2, result);
|
29480
29481
|
res = null;
|
29481
29482
|
break;
|
29482
29483
|
}
|
@@ -29487,47 +29488,47 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29487
29488
|
continue;
|
29488
29489
|
}
|
29489
29490
|
if (res > 1114111) {
|
29490
|
-
i += onError("OUT_OF_RANGE", i - 1 - extraLength,
|
29491
|
+
i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes2, result, res);
|
29491
29492
|
continue;
|
29492
29493
|
}
|
29493
29494
|
if (res >= 55296 && res <= 57343) {
|
29494
|
-
i += onError("UTF16_SURROGATE", i - 1 - extraLength,
|
29495
|
+
i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes2, result, res);
|
29495
29496
|
continue;
|
29496
29497
|
}
|
29497
29498
|
if (res <= overlongMask) {
|
29498
|
-
i += onError("OVERLONG", i - 1 - extraLength,
|
29499
|
+
i += onError("OVERLONG", i - 1 - extraLength, bytes2, result, res);
|
29499
29500
|
continue;
|
29500
29501
|
}
|
29501
29502
|
result.push(res);
|
29502
29503
|
}
|
29503
29504
|
return result;
|
29504
29505
|
}
|
29505
|
-
function toUtf8String(
|
29506
|
-
return helper(getUtf8CodePoints(
|
29506
|
+
function toUtf8String(bytes2) {
|
29507
|
+
return helper(getUtf8CodePoints(bytes2));
|
29507
29508
|
}
|
29508
29509
|
function assertUnreachable(_x) {
|
29509
29510
|
throw new Error("Didn't expect to get here");
|
29510
29511
|
}
|
29511
29512
|
|
29512
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
29513
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.js
|
29513
29514
|
function number(n) {
|
29514
29515
|
if (!Number.isSafeInteger(n) || n < 0)
|
29515
|
-
throw new Error(`
|
29516
|
+
throw new Error(`positive integer expected, not ${n}`);
|
29516
29517
|
}
|
29517
29518
|
function isBytes(a) {
|
29518
29519
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
29519
29520
|
}
|
29520
29521
|
function bytes(b, ...lengths) {
|
29521
29522
|
if (!isBytes(b))
|
29522
|
-
throw new Error("
|
29523
|
+
throw new Error("Uint8Array expected");
|
29523
29524
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
29524
|
-
throw new Error(`
|
29525
|
+
throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
|
29525
29526
|
}
|
29526
|
-
function hash(
|
29527
|
-
if (typeof
|
29527
|
+
function hash(h) {
|
29528
|
+
if (typeof h !== "function" || typeof h.create !== "function")
|
29528
29529
|
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
29529
|
-
number(
|
29530
|
-
number(
|
29530
|
+
number(h.outputLen);
|
29531
|
+
number(h.blockLen);
|
29531
29532
|
}
|
29532
29533
|
function exists(instance, checkFinished = true) {
|
29533
29534
|
if (instance.destroyed)
|
@@ -29543,16 +29544,22 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29543
29544
|
}
|
29544
29545
|
}
|
29545
29546
|
|
29546
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
29547
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/cryptoNode.js
|
29548
|
+
var nc = __toESM(__require("crypto"), 1);
|
29549
|
+
var crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
|
29550
|
+
|
29551
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js
|
29547
29552
|
var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
29548
|
-
function isBytes2(a) {
|
29549
|
-
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
29550
|
-
}
|
29551
29553
|
var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
29552
29554
|
var rotr = (word, shift) => word << 32 - shift | word >>> shift;
|
29555
|
+
var rotl = (word, shift) => word << shift | word >>> 32 - shift >>> 0;
|
29553
29556
|
var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
29554
|
-
|
29555
|
-
|
29557
|
+
var byteSwap = (word) => word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
29558
|
+
function byteSwap32(arr) {
|
29559
|
+
for (let i = 0; i < arr.length; i++) {
|
29560
|
+
arr[i] = byteSwap(arr[i]);
|
29561
|
+
}
|
29562
|
+
}
|
29556
29563
|
function utf8ToBytes(str) {
|
29557
29564
|
if (typeof str !== "string")
|
29558
29565
|
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
@@ -29561,10 +29568,24 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29561
29568
|
function toBytes2(data) {
|
29562
29569
|
if (typeof data === "string")
|
29563
29570
|
data = utf8ToBytes(data);
|
29564
|
-
|
29565
|
-
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
29571
|
+
bytes(data);
|
29566
29572
|
return data;
|
29567
29573
|
}
|
29574
|
+
function concatBytes2(...arrays) {
|
29575
|
+
let sum = 0;
|
29576
|
+
for (let i = 0; i < arrays.length; i++) {
|
29577
|
+
const a = arrays[i];
|
29578
|
+
bytes(a);
|
29579
|
+
sum += a.length;
|
29580
|
+
}
|
29581
|
+
const res = new Uint8Array(sum);
|
29582
|
+
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
29583
|
+
const a = arrays[i];
|
29584
|
+
res.set(a, pad);
|
29585
|
+
pad += a.length;
|
29586
|
+
}
|
29587
|
+
return res;
|
29588
|
+
}
|
29568
29589
|
var Hash = class {
|
29569
29590
|
// Safe version that clones internal state
|
29570
29591
|
clone() {
|
@@ -29594,27 +29615,38 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29594
29615
|
hashC.create = (opts) => hashCons(opts);
|
29595
29616
|
return hashC;
|
29596
29617
|
}
|
29618
|
+
function randomBytes(bytesLength = 32) {
|
29619
|
+
if (crypto && typeof crypto.getRandomValues === "function") {
|
29620
|
+
return crypto.getRandomValues(new Uint8Array(bytesLength));
|
29621
|
+
}
|
29622
|
+
if (crypto && typeof crypto.randomBytes === "function") {
|
29623
|
+
return crypto.randomBytes(bytesLength);
|
29624
|
+
}
|
29625
|
+
throw new Error("crypto.getRandomValues must be defined");
|
29626
|
+
}
|
29597
29627
|
|
29598
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
29599
|
-
function setBigUint64(view, byteOffset, value,
|
29628
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_md.js
|
29629
|
+
function setBigUint64(view, byteOffset, value, isLE2) {
|
29600
29630
|
if (typeof view.setBigUint64 === "function")
|
29601
|
-
return view.setBigUint64(byteOffset, value,
|
29631
|
+
return view.setBigUint64(byteOffset, value, isLE2);
|
29602
29632
|
const _32n2 = BigInt(32);
|
29603
29633
|
const _u32_max = BigInt(4294967295);
|
29604
29634
|
const wh = Number(value >> _32n2 & _u32_max);
|
29605
29635
|
const wl = Number(value & _u32_max);
|
29606
|
-
const h =
|
29607
|
-
const l =
|
29608
|
-
view.setUint32(byteOffset + h, wh,
|
29609
|
-
view.setUint32(byteOffset + l, wl,
|
29636
|
+
const h = isLE2 ? 4 : 0;
|
29637
|
+
const l = isLE2 ? 0 : 4;
|
29638
|
+
view.setUint32(byteOffset + h, wh, isLE2);
|
29639
|
+
view.setUint32(byteOffset + l, wl, isLE2);
|
29610
29640
|
}
|
29611
|
-
var
|
29612
|
-
|
29641
|
+
var Chi = (a, b, c) => a & b ^ ~a & c;
|
29642
|
+
var Maj = (a, b, c) => a & b ^ a & c ^ b & c;
|
29643
|
+
var HashMD = class extends Hash {
|
29644
|
+
constructor(blockLen, outputLen, padOffset, isLE2) {
|
29613
29645
|
super();
|
29614
29646
|
this.blockLen = blockLen;
|
29615
29647
|
this.outputLen = outputLen;
|
29616
29648
|
this.padOffset = padOffset;
|
29617
|
-
this.isLE =
|
29649
|
+
this.isLE = isLE2;
|
29618
29650
|
this.finished = false;
|
29619
29651
|
this.length = 0;
|
29620
29652
|
this.pos = 0;
|
@@ -29651,7 +29683,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29651
29683
|
exists(this);
|
29652
29684
|
output(out, this);
|
29653
29685
|
this.finished = true;
|
29654
|
-
const { buffer, view, blockLen, isLE:
|
29686
|
+
const { buffer, view, blockLen, isLE: isLE2 } = this;
|
29655
29687
|
let { pos } = this;
|
29656
29688
|
buffer[pos++] = 128;
|
29657
29689
|
this.buffer.subarray(pos).fill(0);
|
@@ -29661,7 +29693,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29661
29693
|
}
|
29662
29694
|
for (let i = pos; i < blockLen; i++)
|
29663
29695
|
buffer[i] = 0;
|
29664
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8),
|
29696
|
+
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
|
29665
29697
|
this.process(view, 0);
|
29666
29698
|
const oview = createView(out);
|
29667
29699
|
const len = this.outputLen;
|
@@ -29672,7 +29704,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29672
29704
|
if (outLen > state.length)
|
29673
29705
|
throw new Error("_sha2: outputLen bigger than state");
|
29674
29706
|
for (let i = 0; i < outLen; i++)
|
29675
|
-
oview.setUint32(4 * i, state[i],
|
29707
|
+
oview.setUint32(4 * i, state[i], isLE2);
|
29676
29708
|
}
|
29677
29709
|
digest() {
|
29678
29710
|
const { buffer, outputLen } = this;
|
@@ -29695,9 +29727,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29695
29727
|
}
|
29696
29728
|
};
|
29697
29729
|
|
29698
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
29699
|
-
var Chi = (a, b, c) => a & b ^ ~a & c;
|
29700
|
-
var Maj = (a, b, c) => a & b ^ a & c ^ b & c;
|
29730
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/sha256.js
|
29701
29731
|
var SHA256_K = /* @__PURE__ */ new Uint32Array([
|
29702
29732
|
1116352408,
|
29703
29733
|
1899447441,
|
@@ -29764,7 +29794,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29764
29794
|
3204031479,
|
29765
29795
|
3329325298
|
29766
29796
|
]);
|
29767
|
-
var
|
29797
|
+
var SHA256_IV = /* @__PURE__ */ new Uint32Array([
|
29768
29798
|
1779033703,
|
29769
29799
|
3144134277,
|
29770
29800
|
1013904242,
|
@@ -29775,17 +29805,17 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29775
29805
|
1541459225
|
29776
29806
|
]);
|
29777
29807
|
var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
29778
|
-
var SHA256 = class extends
|
29808
|
+
var SHA256 = class extends HashMD {
|
29779
29809
|
constructor() {
|
29780
29810
|
super(64, 32, 8, false);
|
29781
|
-
this.A =
|
29782
|
-
this.B =
|
29783
|
-
this.C =
|
29784
|
-
this.D =
|
29785
|
-
this.E =
|
29786
|
-
this.F =
|
29787
|
-
this.G =
|
29788
|
-
this.H =
|
29811
|
+
this.A = SHA256_IV[0] | 0;
|
29812
|
+
this.B = SHA256_IV[1] | 0;
|
29813
|
+
this.C = SHA256_IV[2] | 0;
|
29814
|
+
this.D = SHA256_IV[3] | 0;
|
29815
|
+
this.E = SHA256_IV[4] | 0;
|
29816
|
+
this.F = SHA256_IV[5] | 0;
|
29817
|
+
this.G = SHA256_IV[6] | 0;
|
29818
|
+
this.H = SHA256_IV[7] | 0;
|
29789
29819
|
}
|
29790
29820
|
get() {
|
29791
29821
|
const { A, B, C, D, E, F, G, H } = this;
|
@@ -29847,26 +29877,26 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29847
29877
|
};
|
29848
29878
|
var sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
|
29849
29879
|
|
29850
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
29880
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/hmac.js
|
29851
29881
|
var HMAC = class extends Hash {
|
29852
|
-
constructor(
|
29882
|
+
constructor(hash3, _key) {
|
29853
29883
|
super();
|
29854
29884
|
this.finished = false;
|
29855
29885
|
this.destroyed = false;
|
29856
|
-
hash(
|
29886
|
+
hash(hash3);
|
29857
29887
|
const key = toBytes2(_key);
|
29858
|
-
this.iHash =
|
29888
|
+
this.iHash = hash3.create();
|
29859
29889
|
if (typeof this.iHash.update !== "function")
|
29860
29890
|
throw new Error("Expected instance of class which extends utils.Hash");
|
29861
29891
|
this.blockLen = this.iHash.blockLen;
|
29862
29892
|
this.outputLen = this.iHash.outputLen;
|
29863
29893
|
const blockLen = this.blockLen;
|
29864
29894
|
const pad = new Uint8Array(blockLen);
|
29865
|
-
pad.set(key.length > blockLen ?
|
29895
|
+
pad.set(key.length > blockLen ? hash3.create().update(key).digest() : key);
|
29866
29896
|
for (let i = 0; i < pad.length; i++)
|
29867
29897
|
pad[i] ^= 54;
|
29868
29898
|
this.iHash.update(pad);
|
29869
|
-
this.oHash =
|
29899
|
+
this.oHash = hash3.create();
|
29870
29900
|
for (let i = 0; i < pad.length; i++)
|
29871
29901
|
pad[i] ^= 54 ^ 92;
|
29872
29902
|
this.oHash.update(pad);
|
@@ -29909,12 +29939,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29909
29939
|
this.iHash.destroy();
|
29910
29940
|
}
|
29911
29941
|
};
|
29912
|
-
var hmac = (
|
29913
|
-
hmac.create = (
|
29942
|
+
var hmac = (hash3, key, message) => new HMAC(hash3, key).update(message).digest();
|
29943
|
+
hmac.create = (hash3, key) => new HMAC(hash3, key);
|
29914
29944
|
|
29915
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
29916
|
-
function pbkdf2Init(
|
29917
|
-
hash(
|
29945
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/pbkdf2.js
|
29946
|
+
function pbkdf2Init(hash3, _password, _salt, _opts) {
|
29947
|
+
hash(hash3);
|
29918
29948
|
const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
|
29919
29949
|
const { c, dkLen, asyncTick } = opts;
|
29920
29950
|
number(c);
|
@@ -29925,7 +29955,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29925
29955
|
const password = toBytes2(_password);
|
29926
29956
|
const salt = toBytes2(_salt);
|
29927
29957
|
const DK = new Uint8Array(dkLen);
|
29928
|
-
const PRF = hmac.create(
|
29958
|
+
const PRF = hmac.create(hash3, password);
|
29929
29959
|
const PRFSalt = PRF._cloneInto().update(salt);
|
29930
29960
|
return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
|
29931
29961
|
}
|
@@ -29937,8 +29967,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29937
29967
|
u.fill(0);
|
29938
29968
|
return DK;
|
29939
29969
|
}
|
29940
|
-
function pbkdf2(
|
29941
|
-
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(
|
29970
|
+
function pbkdf2(hash3, password, salt, opts) {
|
29971
|
+
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash3, password, salt, opts);
|
29942
29972
|
let prfW;
|
29943
29973
|
const arr = new Uint8Array(4);
|
29944
29974
|
const view = createView(arr);
|
@@ -29957,8 +29987,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
29957
29987
|
return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
|
29958
29988
|
}
|
29959
29989
|
|
29960
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
29961
|
-
var rotl = (a, b) => a << b | a >>> 32 - b;
|
29990
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/scrypt.js
|
29962
29991
|
function XorAndSalsa(prev, pi, input, ii, out, oi) {
|
29963
29992
|
let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];
|
29964
29993
|
let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];
|
@@ -30049,8 +30078,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30049
30078
|
throw new Error("progressCb should be function");
|
30050
30079
|
const blockSize = 128 * r;
|
30051
30080
|
const blockSize32 = blockSize / 4;
|
30052
|
-
if (N <= 1 || (N & N - 1) !== 0 || N
|
30053
|
-
throw new Error("Scrypt: N must be larger than 1, a power of 2,
|
30081
|
+
if (N <= 1 || (N & N - 1) !== 0 || N > 2 ** 32) {
|
30082
|
+
throw new Error("Scrypt: N must be larger than 1, a power of 2, and less than 2^32");
|
30054
30083
|
}
|
30055
30084
|
if (p < 0 || p > (2 ** 32 - 1) * 32 / blockSize) {
|
30056
30085
|
throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");
|
@@ -30089,6 +30118,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30089
30118
|
}
|
30090
30119
|
function scrypt(password, salt, opts) {
|
30091
30120
|
const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts);
|
30121
|
+
if (!isLE)
|
30122
|
+
byteSwap32(B32);
|
30092
30123
|
for (let pi = 0; pi < p; pi++) {
|
30093
30124
|
const Pi2 = blockSize32 * pi;
|
30094
30125
|
for (let i = 0; i < blockSize32; i++)
|
@@ -30107,10 +30138,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30107
30138
|
blockMixCb();
|
30108
30139
|
}
|
30109
30140
|
}
|
30141
|
+
if (!isLE)
|
30142
|
+
byteSwap32(B32);
|
30110
30143
|
return scryptOutput(password, dkLen, B, V, tmp);
|
30111
30144
|
}
|
30112
30145
|
|
30113
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
30146
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.js
|
30114
30147
|
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
30115
30148
|
var _32n = /* @__PURE__ */ BigInt(32);
|
30116
30149
|
function fromBig(n, le = false) {
|
@@ -30132,8 +30165,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30132
30165
|
var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
30133
30166
|
var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
30134
30167
|
|
30135
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
30136
|
-
var
|
30168
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js
|
30169
|
+
var SHA3_PI = [];
|
30170
|
+
var SHA3_ROTL = [];
|
30171
|
+
var _SHA3_IOTA = [];
|
30137
30172
|
var _0n = /* @__PURE__ */ BigInt(0);
|
30138
30173
|
var _1n = /* @__PURE__ */ BigInt(1);
|
30139
30174
|
var _2n = /* @__PURE__ */ BigInt(2);
|
@@ -30215,7 +30250,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30215
30250
|
this.state32 = u32(this.state);
|
30216
30251
|
}
|
30217
30252
|
keccak() {
|
30253
|
+
if (!isLE)
|
30254
|
+
byteSwap32(this.state32);
|
30218
30255
|
keccakP(this.state32, this.rounds);
|
30256
|
+
if (!isLE)
|
30257
|
+
byteSwap32(this.state32);
|
30219
30258
|
this.posOut = 0;
|
30220
30259
|
this.pos = 0;
|
30221
30260
|
}
|
@@ -30265,9 +30304,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30265
30304
|
throw new Error("XOF is not possible for this instance");
|
30266
30305
|
return this.writeInto(out);
|
30267
30306
|
}
|
30268
|
-
xof(
|
30269
|
-
number(
|
30270
|
-
return this.xofInto(new Uint8Array(
|
30307
|
+
xof(bytes2) {
|
30308
|
+
number(bytes2);
|
30309
|
+
return this.xofInto(new Uint8Array(bytes2));
|
30271
30310
|
}
|
30272
30311
|
digestInto(out) {
|
30273
30312
|
output(out, this);
|
@@ -30312,9 +30351,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30312
30351
|
var shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8);
|
30313
30352
|
var shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8);
|
30314
30353
|
|
30315
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
30354
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/ripemd160.js
|
30316
30355
|
var Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
|
30317
|
-
var Id = /* @__PURE__ */ Uint8Array
|
30356
|
+
var Id = /* @__PURE__ */ new Uint8Array(new Array(16).fill(0).map((_, i) => i));
|
30318
30357
|
var Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);
|
30319
30358
|
var idxL = [Id];
|
30320
30359
|
var idxR = [Pi];
|
@@ -30344,7 +30383,6 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30344
30383
|
2053994217,
|
30345
30384
|
0
|
30346
30385
|
]);
|
30347
|
-
var rotl2 = (word, shift) => word << shift | word >>> 32 - shift;
|
30348
30386
|
function f(group, x, y, z) {
|
30349
30387
|
if (group === 0)
|
30350
30388
|
return x ^ y ^ z;
|
@@ -30357,8 +30395,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30357
30395
|
else
|
30358
30396
|
return x ^ (y | ~z);
|
30359
30397
|
}
|
30360
|
-
var
|
30361
|
-
var RIPEMD160 = class extends
|
30398
|
+
var R_BUF = /* @__PURE__ */ new Uint32Array(16);
|
30399
|
+
var RIPEMD160 = class extends HashMD {
|
30362
30400
|
constructor() {
|
30363
30401
|
super(64, 20, 8, true);
|
30364
30402
|
this.h0 = 1732584193 | 0;
|
@@ -30380,7 +30418,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30380
30418
|
}
|
30381
30419
|
process(view, offset) {
|
30382
30420
|
for (let i = 0; i < 16; i++, offset += 4)
|
30383
|
-
|
30421
|
+
R_BUF[i] = view.getUint32(offset, true);
|
30384
30422
|
let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;
|
30385
30423
|
for (let group = 0; group < 5; group++) {
|
30386
30424
|
const rGroup = 4 - group;
|
@@ -30388,18 +30426,18 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30388
30426
|
const rl = idxL[group], rr = idxR[group];
|
30389
30427
|
const sl = shiftsL[group], sr = shiftsR[group];
|
30390
30428
|
for (let i = 0; i < 16; i++) {
|
30391
|
-
const tl =
|
30392
|
-
al = el, el = dl, dl =
|
30429
|
+
const tl = rotl(al + f(group, bl, cl, dl) + R_BUF[rl[i]] + hbl, sl[i]) + el | 0;
|
30430
|
+
al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl;
|
30393
30431
|
}
|
30394
30432
|
for (let i = 0; i < 16; i++) {
|
30395
|
-
const tr2 =
|
30396
|
-
ar = er, er = dr, dr =
|
30433
|
+
const tr2 = rotl(ar + f(rGroup, br, cr, dr) + R_BUF[rr[i]] + hbr, sr[i]) + er | 0;
|
30434
|
+
ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr2;
|
30397
30435
|
}
|
30398
30436
|
}
|
30399
30437
|
this.set(this.h1 + cl + dr | 0, this.h2 + dl + er | 0, this.h3 + el + ar | 0, this.h4 + al + br | 0, this.h0 + bl + cr | 0);
|
30400
30438
|
}
|
30401
30439
|
roundClean() {
|
30402
|
-
|
30440
|
+
R_BUF.fill(0);
|
30403
30441
|
}
|
30404
30442
|
destroy() {
|
30405
30443
|
this.destroyed = true;
|
@@ -30410,12 +30448,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30410
30448
|
var ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());
|
30411
30449
|
|
30412
30450
|
// ../crypto/dist/index.mjs
|
30413
|
-
var
|
30414
|
-
var
|
30415
|
-
var import_crypto3 = __toESM(__require("crypto"), 1);
|
30451
|
+
var import_crypto2 = __toESM(__require("crypto"), 1);
|
30452
|
+
var import_crypto3 = __require("crypto");
|
30416
30453
|
var import_crypto4 = __toESM(__require("crypto"), 1);
|
30417
|
-
var import_crypto5 = __require("crypto");
|
30454
|
+
var import_crypto5 = __toESM(__require("crypto"), 1);
|
30418
30455
|
var import_crypto6 = __require("crypto");
|
30456
|
+
var import_crypto7 = __require("crypto");
|
30419
30457
|
var scrypt2 = (params) => {
|
30420
30458
|
const { password, salt, n, p, r, dklen } = params;
|
30421
30459
|
const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
|
@@ -30430,10 +30468,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30430
30468
|
function pbkdf22(_password, _salt, iterations, keylen, algo) {
|
30431
30469
|
const password = arrayify(_password, "password");
|
30432
30470
|
const salt = arrayify(_salt, "salt");
|
30433
|
-
return hexlify((0,
|
30471
|
+
return hexlify((0, import_crypto3.pbkdf2Sync)(password, salt, iterations, keylen, algo));
|
30434
30472
|
}
|
30435
|
-
var
|
30436
|
-
const randomValues = Uint8Array.from(
|
30473
|
+
var randomBytes2 = (length) => {
|
30474
|
+
const randomValues = Uint8Array.from(import_crypto4.default.randomBytes(length));
|
30437
30475
|
return randomValues;
|
30438
30476
|
};
|
30439
30477
|
var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
|
@@ -30444,11 +30482,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30444
30482
|
return arrayify(key);
|
30445
30483
|
};
|
30446
30484
|
var encrypt = async (password, data) => {
|
30447
|
-
const iv =
|
30448
|
-
const salt =
|
30485
|
+
const iv = randomBytes2(16);
|
30486
|
+
const salt = randomBytes2(32);
|
30449
30487
|
const secret = keyFromPassword(password, salt);
|
30450
30488
|
const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
|
30451
|
-
const cipher = await
|
30489
|
+
const cipher = await import_crypto2.default.createCipheriv(ALGORITHM, secret, iv);
|
30452
30490
|
let cipherData = cipher.update(dataBuffer);
|
30453
30491
|
cipherData = Buffer.concat([cipherData, cipher.final()]);
|
30454
30492
|
return {
|
@@ -30462,7 +30500,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30462
30500
|
const salt = bufferFromString(keystore.salt);
|
30463
30501
|
const secret = keyFromPassword(password, salt);
|
30464
30502
|
const encryptedText = bufferFromString(keystore.data);
|
30465
|
-
const decipher = await
|
30503
|
+
const decipher = await import_crypto2.default.createDecipheriv(ALGORITHM, secret, iv);
|
30466
30504
|
const decrypted = decipher.update(encryptedText);
|
30467
30505
|
const deBuff = Buffer.concat([decrypted, decipher.final()]);
|
30468
30506
|
const decryptedData = Buffer.from(deBuff).toString("utf-8");
|
@@ -30473,28 +30511,28 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30473
30511
|
}
|
30474
30512
|
};
|
30475
30513
|
async function encryptJsonWalletData(data, key, iv) {
|
30476
|
-
const cipher = await
|
30514
|
+
const cipher = await import_crypto5.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30477
30515
|
const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
|
30478
30516
|
return new Uint8Array(encrypted);
|
30479
30517
|
}
|
30480
30518
|
async function decryptJsonWalletData(data, key, iv) {
|
30481
|
-
const decipher =
|
30519
|
+
const decipher = import_crypto5.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30482
30520
|
const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
|
30483
30521
|
return new Uint8Array(decrypted);
|
30484
30522
|
}
|
30485
30523
|
function computeHmac(algorithm, _key, _data) {
|
30486
30524
|
const key = arrayify(_key, "key");
|
30487
30525
|
const data = arrayify(_data, "data");
|
30488
|
-
return hexlify((0,
|
30526
|
+
return hexlify((0, import_crypto6.createHmac)(algorithm, key).update(data).digest());
|
30489
30527
|
}
|
30490
|
-
var randomUUID = () => (0,
|
30528
|
+
var randomUUID = () => (0, import_crypto7.randomUUID)();
|
30491
30529
|
var api = {
|
30492
30530
|
bufferFromString,
|
30493
30531
|
stringFromBuffer,
|
30494
30532
|
decrypt,
|
30495
30533
|
encrypt,
|
30496
30534
|
keyFromPassword,
|
30497
|
-
randomBytes,
|
30535
|
+
randomBytes: randomBytes2,
|
30498
30536
|
scrypt: scrypt2,
|
30499
30537
|
keccak256,
|
30500
30538
|
decryptJsonWalletData,
|
@@ -30510,7 +30548,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30510
30548
|
decrypt: decrypt2,
|
30511
30549
|
encrypt: encrypt2,
|
30512
30550
|
keyFromPassword: keyFromPassword2,
|
30513
|
-
randomBytes:
|
30551
|
+
randomBytes: randomBytes22,
|
30514
30552
|
stringFromBuffer: stringFromBuffer2,
|
30515
30553
|
scrypt: scrypt22,
|
30516
30554
|
keccak256: keccak2562,
|
@@ -30574,9 +30612,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30574
30612
|
var STR_SLICE_CODER_TYPE = "str";
|
30575
30613
|
var VOID_TYPE = "()";
|
30576
30614
|
var optionRegEx = /^enum (std::option::)?Option$/m;
|
30577
|
-
var stringRegEx =
|
30578
|
-
var arrayRegEx =
|
30579
|
-
var structRegEx =
|
30615
|
+
var stringRegEx = /^str\[(?<length>[0-9]+)\]/;
|
30616
|
+
var arrayRegEx = /^\[(?<item>[\w\s\\[\]]+);\s*(?<length>[0-9]+)\]/;
|
30617
|
+
var structRegEx = /^struct.+/;
|
30580
30618
|
var enumRegEx = /^enum.+$/;
|
30581
30619
|
var tupleRegEx = /^\((?<items>.*)\)$/;
|
30582
30620
|
var genericRegEx = /^generic.+$/;
|
@@ -30692,15 +30730,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30692
30730
|
if (data.length < this.encodedLength) {
|
30693
30731
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 data size.`);
|
30694
30732
|
}
|
30695
|
-
let
|
30696
|
-
const decoded = bn(
|
30733
|
+
let bytes2 = data.slice(offset, offset + this.encodedLength);
|
30734
|
+
const decoded = bn(bytes2);
|
30697
30735
|
if (decoded.isZero()) {
|
30698
|
-
|
30736
|
+
bytes2 = new Uint8Array(32);
|
30699
30737
|
}
|
30700
|
-
if (
|
30738
|
+
if (bytes2.length !== this.encodedLength) {
|
30701
30739
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 byte data size.`);
|
30702
30740
|
}
|
30703
|
-
return [toHex(
|
30741
|
+
return [toHex(bytes2, 32), offset + 32];
|
30704
30742
|
}
|
30705
30743
|
};
|
30706
30744
|
var B512Coder = class extends Coder {
|
@@ -30723,15 +30761,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30723
30761
|
if (data.length < this.encodedLength) {
|
30724
30762
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 data size.`);
|
30725
30763
|
}
|
30726
|
-
let
|
30727
|
-
const decoded = bn(
|
30764
|
+
let bytes2 = data.slice(offset, offset + this.encodedLength);
|
30765
|
+
const decoded = bn(bytes2);
|
30728
30766
|
if (decoded.isZero()) {
|
30729
|
-
|
30767
|
+
bytes2 = new Uint8Array(64);
|
30730
30768
|
}
|
30731
|
-
if (
|
30769
|
+
if (bytes2.length !== this.encodedLength) {
|
30732
30770
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 byte data size.`);
|
30733
30771
|
}
|
30734
|
-
return [toHex(
|
30772
|
+
return [toHex(bytes2, this.encodedLength), offset + this.encodedLength];
|
30735
30773
|
}
|
30736
30774
|
};
|
30737
30775
|
var encodedLengths = {
|
@@ -30743,24 +30781,24 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30743
30781
|
super("bigNumber", baseType, encodedLengths[baseType]);
|
30744
30782
|
}
|
30745
30783
|
encode(value) {
|
30746
|
-
let
|
30784
|
+
let bytes2;
|
30747
30785
|
try {
|
30748
|
-
|
30786
|
+
bytes2 = toBytes(value, this.encodedLength);
|
30749
30787
|
} catch (error) {
|
30750
30788
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.type}.`);
|
30751
30789
|
}
|
30752
|
-
return
|
30790
|
+
return bytes2;
|
30753
30791
|
}
|
30754
30792
|
decode(data, offset) {
|
30755
30793
|
if (data.length < this.encodedLength) {
|
30756
30794
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} data size.`);
|
30757
30795
|
}
|
30758
|
-
let
|
30759
|
-
|
30760
|
-
if (
|
30796
|
+
let bytes2 = data.slice(offset, offset + this.encodedLength);
|
30797
|
+
bytes2 = bytes2.slice(0, this.encodedLength);
|
30798
|
+
if (bytes2.length !== this.encodedLength) {
|
30761
30799
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} byte data size.`);
|
30762
30800
|
}
|
30763
|
-
return [bn(
|
30801
|
+
return [bn(bytes2), offset + this.encodedLength];
|
30764
30802
|
}
|
30765
30803
|
};
|
30766
30804
|
var BooleanCoder = class extends Coder {
|
@@ -30783,11 +30821,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30783
30821
|
if (data.length < this.encodedLength) {
|
30784
30822
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
|
30785
30823
|
}
|
30786
|
-
const
|
30787
|
-
if (
|
30824
|
+
const bytes2 = bn(data.slice(offset, offset + this.encodedLength));
|
30825
|
+
if (bytes2.isZero()) {
|
30788
30826
|
return [false, offset + this.encodedLength];
|
30789
30827
|
}
|
30790
|
-
if (!
|
30828
|
+
if (!bytes2.eq(bn(1))) {
|
30791
30829
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean value.`);
|
30792
30830
|
}
|
30793
30831
|
return [true, offset + this.encodedLength];
|
@@ -30798,9 +30836,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30798
30836
|
super("struct", "struct Bytes", WORD_SIZE);
|
30799
30837
|
}
|
30800
30838
|
encode(value) {
|
30801
|
-
const
|
30802
|
-
const lengthBytes = new BigNumberCoder("u64").encode(
|
30803
|
-
return new Uint8Array([...lengthBytes, ...
|
30839
|
+
const bytes2 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
30840
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
|
30841
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
30804
30842
|
}
|
30805
30843
|
decode(data, offset) {
|
30806
30844
|
if (data.length < WORD_SIZE) {
|
@@ -30922,26 +30960,26 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30922
30960
|
this.options = options;
|
30923
30961
|
}
|
30924
30962
|
encode(value) {
|
30925
|
-
let
|
30963
|
+
let bytes2;
|
30926
30964
|
try {
|
30927
|
-
|
30965
|
+
bytes2 = toBytes(value);
|
30928
30966
|
} catch (error) {
|
30929
30967
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
|
30930
30968
|
}
|
30931
|
-
if (
|
30969
|
+
if (bytes2.length > this.encodedLength) {
|
30932
30970
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
|
30933
30971
|
}
|
30934
|
-
return toBytes(
|
30972
|
+
return toBytes(bytes2, this.encodedLength);
|
30935
30973
|
}
|
30936
30974
|
decode(data, offset) {
|
30937
30975
|
if (data.length < this.encodedLength) {
|
30938
30976
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number data size.`);
|
30939
30977
|
}
|
30940
|
-
const
|
30941
|
-
if (
|
30978
|
+
const bytes2 = data.slice(offset, offset + this.encodedLength);
|
30979
|
+
if (bytes2.length !== this.encodedLength) {
|
30942
30980
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
|
30943
30981
|
}
|
30944
|
-
return [toNumber(
|
30982
|
+
return [toNumber(bytes2), offset + this.encodedLength];
|
30945
30983
|
}
|
30946
30984
|
};
|
30947
30985
|
var OptionCoder = class extends EnumCoder {
|
@@ -30959,9 +30997,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30959
30997
|
const [decoded, newOffset] = super.decode(data, offset);
|
30960
30998
|
return [this.toOption(decoded), newOffset];
|
30961
30999
|
}
|
30962
|
-
toOption(
|
30963
|
-
if (
|
30964
|
-
return
|
31000
|
+
toOption(output2) {
|
31001
|
+
if (output2 && "Some" in output2) {
|
31002
|
+
return output2.Some;
|
30965
31003
|
}
|
30966
31004
|
return void 0;
|
30967
31005
|
}
|
@@ -30975,9 +31013,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
30975
31013
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
30976
31014
|
}
|
30977
31015
|
const internalCoder = new ArrayCoder(new NumberCoder("u8"), value.length);
|
30978
|
-
const
|
30979
|
-
const lengthBytes = new BigNumberCoder("u64").encode(
|
30980
|
-
return new Uint8Array([...lengthBytes, ...
|
31016
|
+
const bytes2 = internalCoder.encode(value);
|
31017
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
|
31018
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
30981
31019
|
}
|
30982
31020
|
decode(data, offset) {
|
30983
31021
|
if (data.length < this.encodedLength) {
|
@@ -31000,9 +31038,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31000
31038
|
super("struct", "struct String", WORD_SIZE);
|
31001
31039
|
}
|
31002
31040
|
encode(value) {
|
31003
|
-
const
|
31041
|
+
const bytes2 = toUtf8Bytes(value);
|
31004
31042
|
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
31005
|
-
return new Uint8Array([...lengthBytes, ...
|
31043
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
31006
31044
|
}
|
31007
31045
|
decode(data, offset) {
|
31008
31046
|
if (data.length < this.encodedLength) {
|
@@ -31024,9 +31062,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31024
31062
|
super("strSlice", "str", WORD_SIZE);
|
31025
31063
|
}
|
31026
31064
|
encode(value) {
|
31027
|
-
const
|
31065
|
+
const bytes2 = toUtf8Bytes(value);
|
31028
31066
|
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
31029
|
-
return new Uint8Array([...lengthBytes, ...
|
31067
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
31030
31068
|
}
|
31031
31069
|
decode(data, offset) {
|
31032
31070
|
if (data.length < this.encodedLength) {
|
@@ -31035,11 +31073,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31035
31073
|
const offsetAndLength = offset + WORD_SIZE;
|
31036
31074
|
const lengthBytes = data.slice(offset, offsetAndLength);
|
31037
31075
|
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
31038
|
-
const
|
31039
|
-
if (
|
31076
|
+
const bytes2 = data.slice(offsetAndLength, offsetAndLength + length);
|
31077
|
+
if (bytes2.length !== length) {
|
31040
31078
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
31041
31079
|
}
|
31042
|
-
return [toUtf8String(
|
31080
|
+
return [toUtf8String(bytes2), offsetAndLength + length];
|
31043
31081
|
}
|
31044
31082
|
};
|
31045
31083
|
__publicField4(StrSliceCoder, "memorySize", 1);
|
@@ -31057,11 +31095,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31057
31095
|
if (data.length < this.encodedLength) {
|
31058
31096
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string data size.`);
|
31059
31097
|
}
|
31060
|
-
const
|
31061
|
-
if (
|
31098
|
+
const bytes2 = data.slice(offset, offset + this.encodedLength);
|
31099
|
+
if (bytes2.length !== this.encodedLength) {
|
31062
31100
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string byte data size.`);
|
31063
31101
|
}
|
31064
|
-
return [toUtf8String(
|
31102
|
+
return [toUtf8String(bytes2), offset + this.encodedLength];
|
31065
31103
|
}
|
31066
31104
|
};
|
31067
31105
|
var StructCoder = class extends Coder {
|
@@ -31155,9 +31193,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31155
31193
|
if (isUint8Array(value)) {
|
31156
31194
|
return new Uint8Array([...lengthCoder.encode(value.length), ...value]);
|
31157
31195
|
}
|
31158
|
-
const
|
31196
|
+
const bytes2 = value.map((v) => this.coder.encode(v));
|
31159
31197
|
const lengthBytes = lengthCoder.encode(value.length);
|
31160
|
-
return new Uint8Array([...lengthBytes, ...concatBytes(
|
31198
|
+
return new Uint8Array([...lengthBytes, ...concatBytes(bytes2)]);
|
31161
31199
|
}
|
31162
31200
|
decode(data, offset) {
|
31163
31201
|
if (!this.#hasNestedOption && data.length < this.encodedLength || data.length > MAX_BYTES) {
|
@@ -31545,10 +31583,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31545
31583
|
return new TupleCoder(coders).encode(argumentValues);
|
31546
31584
|
}
|
31547
31585
|
decodeArguments(data) {
|
31548
|
-
const
|
31586
|
+
const bytes2 = arrayify(data);
|
31549
31587
|
const nonVoidInputs = findNonVoidInputs(this.jsonAbiOld, this.jsonFnOld.inputs);
|
31550
31588
|
if (nonVoidInputs.length === 0) {
|
31551
|
-
if (
|
31589
|
+
if (bytes2.length === 0) {
|
31552
31590
|
return void 0;
|
31553
31591
|
}
|
31554
31592
|
throw new FuelError(
|
@@ -31557,12 +31595,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31557
31595
|
count: {
|
31558
31596
|
types: this.jsonFn.inputs.length,
|
31559
31597
|
nonVoidInputs: nonVoidInputs.length,
|
31560
|
-
values:
|
31598
|
+
values: bytes2.length
|
31561
31599
|
},
|
31562
31600
|
value: {
|
31563
31601
|
args: this.jsonFn.inputs,
|
31564
31602
|
nonVoidInputs,
|
31565
|
-
values:
|
31603
|
+
values: bytes2
|
31566
31604
|
}
|
31567
31605
|
})}`
|
31568
31606
|
);
|
@@ -31570,7 +31608,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31570
31608
|
const result = this.jsonFnOld.inputs.reduce(
|
31571
31609
|
(obj, input) => {
|
31572
31610
|
const coder = AbiCoder.getCoder(this.jsonAbiOld, input, { encoding: this.encoding });
|
31573
|
-
const [decodedValue, decodedValueByteSize] = coder.decode(
|
31611
|
+
const [decodedValue, decodedValueByteSize] = coder.decode(bytes2, obj.offset);
|
31574
31612
|
return {
|
31575
31613
|
decoded: [...obj.decoded, decodedValue],
|
31576
31614
|
offset: obj.offset + decodedValueByteSize
|
@@ -31581,11 +31619,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31581
31619
|
return result.decoded;
|
31582
31620
|
}
|
31583
31621
|
decodeOutput(data) {
|
31584
|
-
const
|
31622
|
+
const bytes2 = arrayify(data);
|
31585
31623
|
const coder = AbiCoder.getCoder(this.jsonAbiOld, this.jsonFnOld.output, {
|
31586
31624
|
encoding: this.encoding
|
31587
31625
|
});
|
31588
|
-
return coder.decode(
|
31626
|
+
return coder.decode(bytes2, 0);
|
31589
31627
|
}
|
31590
31628
|
/**
|
31591
31629
|
* Checks if the function is read-only i.e. it only reads from storage, does not write to it.
|
@@ -31673,8 +31711,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31673
31711
|
const inputs = fn.inputs.map(
|
31674
31712
|
({ concreteTypeId, name }) => parseConcreteType(abi, types, concreteTypeId, name)
|
31675
31713
|
);
|
31676
|
-
const
|
31677
|
-
return { ...fn, inputs, output:
|
31714
|
+
const output2 = parseConcreteType(abi, types, fn.output, "");
|
31715
|
+
return { ...fn, inputs, output: output2 };
|
31678
31716
|
});
|
31679
31717
|
const configurables = abi.configurables.map((conf) => ({
|
31680
31718
|
name: conf.name,
|
@@ -31836,9 +31874,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31836
31874
|
}
|
31837
31875
|
return addressLike;
|
31838
31876
|
};
|
31839
|
-
var getRandomB256 = () => hexlify(
|
31877
|
+
var getRandomB256 = () => hexlify(randomBytes22(32));
|
31840
31878
|
var clearFirst12BytesFromB256 = (b256) => {
|
31841
|
-
let
|
31879
|
+
let bytes2;
|
31842
31880
|
try {
|
31843
31881
|
if (!isB256(b256)) {
|
31844
31882
|
throw new FuelError(
|
@@ -31846,15 +31884,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
31846
31884
|
`Invalid Bech32 Address: ${b256}.`
|
31847
31885
|
);
|
31848
31886
|
}
|
31849
|
-
|
31850
|
-
|
31887
|
+
bytes2 = getBytesFromBech32(toBech32(b256));
|
31888
|
+
bytes2 = hexlify(bytes2.fill(0, 0, 12));
|
31851
31889
|
} catch (error) {
|
31852
31890
|
throw new FuelError(
|
31853
31891
|
FuelError.CODES.PARSE_FAILED,
|
31854
31892
|
`Cannot generate EVM Address B256 from: ${b256}.`
|
31855
31893
|
);
|
31856
31894
|
}
|
31857
|
-
return
|
31895
|
+
return bytes2;
|
31858
31896
|
};
|
31859
31897
|
var padFirst12BytesOfEvmAddress = (address) => {
|
31860
31898
|
if (!isEvmAddress(address)) {
|
@@ -32255,9 +32293,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32255
32293
|
return sha2562(concat(parts));
|
32256
32294
|
}
|
32257
32295
|
static encodeData(messageData) {
|
32258
|
-
const
|
32259
|
-
const dataLength =
|
32260
|
-
return new ByteArrayCoder(dataLength).encode(
|
32296
|
+
const bytes2 = arrayify(messageData || "0x");
|
32297
|
+
const dataLength = bytes2.length;
|
32298
|
+
return new ByteArrayCoder(dataLength).encode(bytes2);
|
32261
32299
|
}
|
32262
32300
|
encode(value) {
|
32263
32301
|
const parts = [];
|
@@ -32279,9 +32317,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32279
32317
|
return concat(parts);
|
32280
32318
|
}
|
32281
32319
|
static decodeData(messageData) {
|
32282
|
-
const
|
32283
|
-
const dataLength =
|
32284
|
-
const [data] = new ByteArrayCoder(dataLength).decode(
|
32320
|
+
const bytes2 = arrayify(messageData);
|
32321
|
+
const dataLength = bytes2.length;
|
32322
|
+
const [data] = new ByteArrayCoder(dataLength).decode(bytes2, 0);
|
32285
32323
|
return arrayify(data);
|
32286
32324
|
}
|
32287
32325
|
decode(data, offset) {
|
@@ -32710,150 +32748,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32710
32748
|
ReceiptType2[ReceiptType2["Burn"] = 12] = "Burn";
|
32711
32749
|
return ReceiptType2;
|
32712
32750
|
})(ReceiptType || {});
|
32713
|
-
var ReceiptMessageOutCoder = class extends Coder {
|
32714
|
-
constructor() {
|
32715
|
-
super("ReceiptMessageOut", "struct ReceiptMessageOut", 0);
|
32716
|
-
}
|
32717
|
-
static getMessageId(value) {
|
32718
|
-
const parts = [];
|
32719
|
-
parts.push(new ByteArrayCoder(32).encode(value.sender));
|
32720
|
-
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
32721
|
-
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
32722
|
-
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
32723
|
-
parts.push(arrayify(value.data || "0x"));
|
32724
|
-
return sha2562(concat(parts));
|
32725
|
-
}
|
32726
|
-
encode(value) {
|
32727
|
-
const parts = [];
|
32728
|
-
parts.push(new B256Coder().encode(value.sender));
|
32729
|
-
parts.push(new B256Coder().encode(value.recipient));
|
32730
|
-
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
32731
|
-
parts.push(new B256Coder().encode(value.nonce));
|
32732
|
-
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.data.length));
|
32733
|
-
parts.push(new B256Coder().encode(value.digest));
|
32734
|
-
parts.push(new ByteArrayCoder(value.data.length).encode(value.data));
|
32735
|
-
return concat(parts);
|
32736
|
-
}
|
32737
|
-
decode(data, offset) {
|
32738
|
-
let decoded;
|
32739
|
-
let o = offset;
|
32740
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32741
|
-
const sender = decoded;
|
32742
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32743
|
-
const recipient = decoded;
|
32744
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32745
|
-
const amount = decoded;
|
32746
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32747
|
-
const nonce = decoded;
|
32748
|
-
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
32749
|
-
const len = decoded;
|
32750
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32751
|
-
const digest = decoded;
|
32752
|
-
[decoded, o] = new ByteArrayCoder(len).decode(data, o);
|
32753
|
-
const messageData = arrayify(decoded);
|
32754
|
-
const receiptMessageOut = {
|
32755
|
-
type: 10,
|
32756
|
-
messageId: "",
|
32757
|
-
sender,
|
32758
|
-
recipient,
|
32759
|
-
amount,
|
32760
|
-
nonce,
|
32761
|
-
digest,
|
32762
|
-
data: messageData
|
32763
|
-
};
|
32764
|
-
receiptMessageOut.messageId = ReceiptMessageOutCoder.getMessageId(receiptMessageOut);
|
32765
|
-
return [receiptMessageOut, o];
|
32766
|
-
}
|
32767
|
-
};
|
32768
32751
|
var getMintedAssetId = (contractId, subId) => {
|
32769
32752
|
const contractIdBytes = arrayify(contractId);
|
32770
32753
|
const subIdBytes = arrayify(subId);
|
32771
32754
|
return sha2562(concat([contractIdBytes, subIdBytes]));
|
32772
32755
|
};
|
32773
|
-
var ReceiptMintCoder = class extends Coder {
|
32774
|
-
constructor() {
|
32775
|
-
super("ReceiptMint", "struct ReceiptMint", 0);
|
32776
|
-
}
|
32777
|
-
static getAssetId(contractId, subId) {
|
32778
|
-
return getMintedAssetId(contractId, subId);
|
32779
|
-
}
|
32780
|
-
encode(value) {
|
32781
|
-
const parts = [];
|
32782
|
-
parts.push(new B256Coder().encode(value.subId));
|
32783
|
-
parts.push(new B256Coder().encode(value.contractId));
|
32784
|
-
parts.push(new BigNumberCoder("u64").encode(value.val));
|
32785
|
-
parts.push(new BigNumberCoder("u64").encode(value.pc));
|
32786
|
-
parts.push(new BigNumberCoder("u64").encode(value.is));
|
32787
|
-
return concat(parts);
|
32788
|
-
}
|
32789
|
-
decode(data, offset) {
|
32790
|
-
let decoded;
|
32791
|
-
let o = offset;
|
32792
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32793
|
-
const subId = decoded;
|
32794
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32795
|
-
const contractId = decoded;
|
32796
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32797
|
-
const val = decoded;
|
32798
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32799
|
-
const pc = decoded;
|
32800
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32801
|
-
const is = decoded;
|
32802
|
-
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
32803
|
-
const receiptMint = {
|
32804
|
-
type: 11,
|
32805
|
-
subId,
|
32806
|
-
contractId,
|
32807
|
-
val,
|
32808
|
-
pc,
|
32809
|
-
is,
|
32810
|
-
assetId
|
32811
|
-
};
|
32812
|
-
return [receiptMint, o];
|
32813
|
-
}
|
32814
|
-
};
|
32815
|
-
var ReceiptBurnCoder = class extends Coder {
|
32816
|
-
constructor() {
|
32817
|
-
super("ReceiptBurn", "struct ReceiptBurn", 0);
|
32818
|
-
}
|
32819
|
-
static getAssetId(contractId, subId) {
|
32820
|
-
return getMintedAssetId(contractId, subId);
|
32821
|
-
}
|
32822
|
-
encode(value) {
|
32823
|
-
const parts = [];
|
32824
|
-
parts.push(new B256Coder().encode(value.subId));
|
32825
|
-
parts.push(new B256Coder().encode(value.contractId));
|
32826
|
-
parts.push(new BigNumberCoder("u64").encode(value.val));
|
32827
|
-
parts.push(new BigNumberCoder("u64").encode(value.pc));
|
32828
|
-
parts.push(new BigNumberCoder("u64").encode(value.is));
|
32829
|
-
return concat(parts);
|
32830
|
-
}
|
32831
|
-
decode(data, offset) {
|
32832
|
-
let decoded;
|
32833
|
-
let o = offset;
|
32834
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32835
|
-
const subId = decoded;
|
32836
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32837
|
-
const contractId = decoded;
|
32838
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32839
|
-
const val = decoded;
|
32840
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32841
|
-
const pc = decoded;
|
32842
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32843
|
-
const is = decoded;
|
32844
|
-
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
32845
|
-
const receiptBurn = {
|
32846
|
-
type: 12,
|
32847
|
-
subId,
|
32848
|
-
contractId,
|
32849
|
-
val,
|
32850
|
-
pc,
|
32851
|
-
is,
|
32852
|
-
assetId
|
32853
|
-
};
|
32854
|
-
return [receiptBurn, o];
|
32855
|
-
}
|
32856
|
-
};
|
32857
32756
|
var StorageSlotCoder = class extends StructCoder {
|
32858
32757
|
constructor() {
|
32859
32758
|
super("StorageSlot", {
|
@@ -32862,6 +32761,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32862
32761
|
});
|
32863
32762
|
}
|
32864
32763
|
};
|
32764
|
+
var UpgradePurposeTypeEnum = /* @__PURE__ */ ((UpgradePurposeTypeEnum2) => {
|
32765
|
+
UpgradePurposeTypeEnum2[UpgradePurposeTypeEnum2["ConsensusParameters"] = 0] = "ConsensusParameters";
|
32766
|
+
UpgradePurposeTypeEnum2[UpgradePurposeTypeEnum2["StateTransition"] = 1] = "StateTransition";
|
32767
|
+
return UpgradePurposeTypeEnum2;
|
32768
|
+
})(UpgradePurposeTypeEnum || {});
|
32865
32769
|
var UpgradePurposeCoder = class extends Coder {
|
32866
32770
|
constructor() {
|
32867
32771
|
super("UpgradePurpose", "UpgradePurpose", 0);
|
@@ -33592,9 +33496,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33592
33496
|
return coinQuantities;
|
33593
33497
|
};
|
33594
33498
|
|
33595
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
33499
|
+
// ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/abstract/utils.js
|
33596
33500
|
var utils_exports = {};
|
33597
33501
|
__export(utils_exports, {
|
33502
|
+
aInRange: () => aInRange,
|
33503
|
+
abool: () => abool,
|
33598
33504
|
abytes: () => abytes,
|
33599
33505
|
bitGet: () => bitGet,
|
33600
33506
|
bitLen: () => bitLen,
|
@@ -33603,13 +33509,16 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33603
33509
|
bytesToHex: () => bytesToHex,
|
33604
33510
|
bytesToNumberBE: () => bytesToNumberBE,
|
33605
33511
|
bytesToNumberLE: () => bytesToNumberLE,
|
33606
|
-
concatBytes: () =>
|
33512
|
+
concatBytes: () => concatBytes3,
|
33607
33513
|
createHmacDrbg: () => createHmacDrbg,
|
33608
33514
|
ensureBytes: () => ensureBytes,
|
33609
33515
|
equalBytes: () => equalBytes,
|
33610
33516
|
hexToBytes: () => hexToBytes,
|
33611
33517
|
hexToNumber: () => hexToNumber,
|
33612
|
-
|
33518
|
+
inRange: () => inRange,
|
33519
|
+
isBytes: () => isBytes2,
|
33520
|
+
memoized: () => memoized,
|
33521
|
+
notImplemented: () => notImplemented,
|
33613
33522
|
numberToBytesBE: () => numberToBytesBE,
|
33614
33523
|
numberToBytesLE: () => numberToBytesLE,
|
33615
33524
|
numberToHexUnpadded: () => numberToHexUnpadded,
|
@@ -33620,19 +33529,23 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33620
33529
|
var _0n2 = /* @__PURE__ */ BigInt(0);
|
33621
33530
|
var _1n2 = /* @__PURE__ */ BigInt(1);
|
33622
33531
|
var _2n2 = /* @__PURE__ */ BigInt(2);
|
33623
|
-
function
|
33532
|
+
function isBytes2(a) {
|
33624
33533
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
33625
33534
|
}
|
33626
33535
|
function abytes(item) {
|
33627
|
-
if (!
|
33536
|
+
if (!isBytes2(item))
|
33628
33537
|
throw new Error("Uint8Array expected");
|
33629
33538
|
}
|
33539
|
+
function abool(title, value) {
|
33540
|
+
if (typeof value !== "boolean")
|
33541
|
+
throw new Error(`${title} must be valid boolean, got "${value}".`);
|
33542
|
+
}
|
33630
33543
|
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
33631
|
-
function bytesToHex(
|
33632
|
-
abytes(
|
33544
|
+
function bytesToHex(bytes2) {
|
33545
|
+
abytes(bytes2);
|
33633
33546
|
let hex = "";
|
33634
|
-
for (let i = 0; i <
|
33635
|
-
hex += hexes[
|
33547
|
+
for (let i = 0; i < bytes2.length; i++) {
|
33548
|
+
hex += hexes[bytes2[i]];
|
33636
33549
|
}
|
33637
33550
|
return hex;
|
33638
33551
|
}
|
@@ -33674,12 +33587,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33674
33587
|
}
|
33675
33588
|
return array;
|
33676
33589
|
}
|
33677
|
-
function bytesToNumberBE(
|
33678
|
-
return hexToNumber(bytesToHex(
|
33590
|
+
function bytesToNumberBE(bytes2) {
|
33591
|
+
return hexToNumber(bytesToHex(bytes2));
|
33679
33592
|
}
|
33680
|
-
function bytesToNumberLE(
|
33681
|
-
abytes(
|
33682
|
-
return hexToNumber(bytesToHex(Uint8Array.from(
|
33593
|
+
function bytesToNumberLE(bytes2) {
|
33594
|
+
abytes(bytes2);
|
33595
|
+
return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse()));
|
33683
33596
|
}
|
33684
33597
|
function numberToBytesBE(n, len) {
|
33685
33598
|
return hexToBytes(n.toString(16).padStart(len * 2, "0"));
|
@@ -33698,7 +33611,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33698
33611
|
} catch (e) {
|
33699
33612
|
throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`);
|
33700
33613
|
}
|
33701
|
-
} else if (
|
33614
|
+
} else if (isBytes2(hex)) {
|
33702
33615
|
res = Uint8Array.from(hex);
|
33703
33616
|
} else {
|
33704
33617
|
throw new Error(`${title} must be hex string or Uint8Array`);
|
@@ -33708,7 +33621,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33708
33621
|
throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);
|
33709
33622
|
return res;
|
33710
33623
|
}
|
33711
|
-
function
|
33624
|
+
function concatBytes3(...arrays) {
|
33712
33625
|
let sum = 0;
|
33713
33626
|
for (let i = 0; i < arrays.length; i++) {
|
33714
33627
|
const a = arrays[i];
|
@@ -33736,6 +33649,14 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33736
33649
|
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
33737
33650
|
return new Uint8Array(new TextEncoder().encode(str));
|
33738
33651
|
}
|
33652
|
+
var isPosBig = (n) => typeof n === "bigint" && _0n2 <= n;
|
33653
|
+
function inRange(n, min, max) {
|
33654
|
+
return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
|
33655
|
+
}
|
33656
|
+
function aInRange(title, n, min, max) {
|
33657
|
+
if (!inRange(n, min, max))
|
33658
|
+
throw new Error(`expected valid ${title}: ${min} <= n < ${max}, got ${typeof n} ${n}`);
|
33659
|
+
}
|
33739
33660
|
function bitLen(n) {
|
33740
33661
|
let len;
|
33741
33662
|
for (len = 0; n > _0n2; n >>= _1n2, len += 1)
|
@@ -33786,7 +33707,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33786
33707
|
out.push(sl);
|
33787
33708
|
len += v.length;
|
33788
33709
|
}
|
33789
|
-
return
|
33710
|
+
return concatBytes3(...out);
|
33790
33711
|
};
|
33791
33712
|
const genUntil = (seed, pred) => {
|
33792
33713
|
reset();
|
@@ -33804,7 +33725,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33804
33725
|
function: (val) => typeof val === "function",
|
33805
33726
|
boolean: (val) => typeof val === "boolean",
|
33806
33727
|
string: (val) => typeof val === "string",
|
33807
|
-
stringOrUint8Array: (val) => typeof val === "string" ||
|
33728
|
+
stringOrUint8Array: (val) => typeof val === "string" || isBytes2(val),
|
33808
33729
|
isSafeInteger: (val) => Number.isSafeInteger(val),
|
33809
33730
|
array: (val) => Array.isArray(val),
|
33810
33731
|
field: (val, object) => object.Fp.isValid(val),
|
@@ -33828,6 +33749,20 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
33828
33749
|
checkField(fieldName, type3, true);
|
33829
33750
|
return object;
|
33830
33751
|
}
|
33752
|
+
var notImplemented = () => {
|
33753
|
+
throw new Error("not implemented");
|
33754
|
+
};
|
33755
|
+
function memoized(fn) {
|
33756
|
+
const map = /* @__PURE__ */ new WeakMap();
|
33757
|
+
return (arg, ...args) => {
|
33758
|
+
const val = map.get(arg);
|
33759
|
+
if (val !== void 0)
|
33760
|
+
return val;
|
33761
|
+
const computed = fn(arg, ...args);
|
33762
|
+
map.set(arg, computed);
|
33763
|
+
return computed;
|
33764
|
+
};
|
33765
|
+
}
|
33831
33766
|
|
33832
33767
|
// src/providers/provider.ts
|
33833
33768
|
var import_graphql_request = __toESM(require_dist2());
|
@@ -34050,19 +33985,19 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
34050
33985
|
return "GraphQLError";
|
34051
33986
|
}
|
34052
33987
|
toString() {
|
34053
|
-
let
|
33988
|
+
let output2 = this.message;
|
34054
33989
|
if (this.nodes) {
|
34055
33990
|
for (const node of this.nodes) {
|
34056
33991
|
if (node.loc) {
|
34057
|
-
|
33992
|
+
output2 += "\n\n" + printLocation(node.loc);
|
34058
33993
|
}
|
34059
33994
|
}
|
34060
33995
|
} else if (this.source && this.locations) {
|
34061
33996
|
for (const location of this.locations) {
|
34062
|
-
|
33997
|
+
output2 += "\n\n" + printSourceLocation(this.source, location);
|
34063
33998
|
}
|
34064
33999
|
}
|
34065
|
-
return
|
34000
|
+
return output2;
|
34066
34001
|
}
|
34067
34002
|
toJSON() {
|
34068
34003
|
const formattedError = {
|
@@ -37940,6 +37875,13 @@ ${MessageFragmentDoc}`;
|
|
37940
37875
|
submitAndAwait(tx: $encodedTransaction) {
|
37941
37876
|
...transactionStatusSubscriptionFragment
|
37942
37877
|
}
|
37878
|
+
}
|
37879
|
+
${TransactionStatusSubscriptionFragmentDoc}`;
|
37880
|
+
var SubmitAndAwaitStatusDocument = lib_default2`
|
37881
|
+
subscription submitAndAwaitStatus($encodedTransaction: HexString!) {
|
37882
|
+
submitAndAwaitStatus(tx: $encodedTransaction) {
|
37883
|
+
...transactionStatusSubscriptionFragment
|
37884
|
+
}
|
37943
37885
|
}
|
37944
37886
|
${TransactionStatusSubscriptionFragmentDoc}`;
|
37945
37887
|
var StatusChangeDocument = lib_default2`
|
@@ -38038,6 +37980,9 @@ ${MessageFragmentDoc}`;
|
|
38038
37980
|
submitAndAwait(variables, options) {
|
38039
37981
|
return requester(SubmitAndAwaitDocument, variables, options);
|
38040
37982
|
},
|
37983
|
+
submitAndAwaitStatus(variables, options) {
|
37984
|
+
return requester(SubmitAndAwaitStatusDocument, variables, options);
|
37985
|
+
},
|
38041
37986
|
statusChange(variables, options) {
|
38042
37987
|
return requester(StatusChangeDocument, variables, options);
|
38043
37988
|
}
|
@@ -38062,7 +38007,9 @@ ${MessageFragmentDoc}`;
|
|
38062
38007
|
Accept: "text/event-stream"
|
38063
38008
|
}
|
38064
38009
|
});
|
38065
|
-
|
38010
|
+
const [errorReader, resultReader] = response.body.tee().map((stream) => stream.getReader());
|
38011
|
+
await new _FuelGraphqlSubscriber(errorReader).next();
|
38012
|
+
return new _FuelGraphqlSubscriber(resultReader);
|
38066
38013
|
}
|
38067
38014
|
events = [];
|
38068
38015
|
parsingLeftover = "";
|
@@ -38105,10 +38052,8 @@ ${MessageFragmentDoc}`;
|
|
38105
38052
|
/**
|
38106
38053
|
* Gets called when `break` is called in a `for-await-of` loop.
|
38107
38054
|
*/
|
38108
|
-
|
38109
|
-
|
38110
|
-
this.stream.releaseLock();
|
38111
|
-
return { done: true, value: void 0 };
|
38055
|
+
return() {
|
38056
|
+
return Promise.resolve({ done: true, value: void 0 });
|
38112
38057
|
}
|
38113
38058
|
[Symbol.asyncIterator]() {
|
38114
38059
|
return this;
|
@@ -38528,12 +38473,12 @@ ${MessageFragmentDoc}`;
|
|
38528
38473
|
const amount = bn(receipt.amount);
|
38529
38474
|
const data = receipt.data ? arrayify(receipt.data) : Uint8Array.from([]);
|
38530
38475
|
const digest = hexOrZero(receipt.digest);
|
38531
|
-
const messageId =
|
38476
|
+
const messageId = InputMessageCoder.getMessageId({
|
38532
38477
|
sender,
|
38533
38478
|
recipient,
|
38534
38479
|
nonce,
|
38535
38480
|
amount,
|
38536
|
-
data
|
38481
|
+
data: hexlify(data)
|
38537
38482
|
});
|
38538
38483
|
const receiptMessageOut = {
|
38539
38484
|
type: ReceiptType.MessageOut,
|
@@ -38550,7 +38495,7 @@ ${MessageFragmentDoc}`;
|
|
38550
38495
|
case "MINT" /* Mint */: {
|
38551
38496
|
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
38552
38497
|
const subId = hexOrZero(receipt.subId);
|
38553
|
-
const assetId =
|
38498
|
+
const assetId = getMintedAssetId(contractId, subId);
|
38554
38499
|
const mintReceipt = {
|
38555
38500
|
type: ReceiptType.Mint,
|
38556
38501
|
subId,
|
@@ -38565,7 +38510,7 @@ ${MessageFragmentDoc}`;
|
|
38565
38510
|
case "BURN" /* Burn */: {
|
38566
38511
|
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
38567
38512
|
const subId = hexOrZero(receipt.subId);
|
38568
|
-
const assetId =
|
38513
|
+
const assetId = getMintedAssetId(contractId, subId);
|
38569
38514
|
const burnReceipt = {
|
38570
38515
|
type: ReceiptType.Burn,
|
38571
38516
|
subId,
|
@@ -38583,7 +38528,7 @@ ${MessageFragmentDoc}`;
|
|
38583
38528
|
}
|
38584
38529
|
|
38585
38530
|
// src/providers/utils/block-explorer.ts
|
38586
|
-
var DEFAULT_BLOCK_EXPLORER_URL = "https://
|
38531
|
+
var DEFAULT_BLOCK_EXPLORER_URL = "https://app.fuel.network";
|
38587
38532
|
var getPathFromInput = (key, value) => {
|
38588
38533
|
const pathMap = {
|
38589
38534
|
address: `address`,
|
@@ -38740,6 +38685,39 @@ ${MessageFragmentDoc}`;
|
|
38740
38685
|
const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
|
38741
38686
|
return txId.add(blobLen);
|
38742
38687
|
}
|
38688
|
+
function calculateMetadataGasForTxUpgrade({
|
38689
|
+
gasCosts,
|
38690
|
+
txBytesSize,
|
38691
|
+
consensusSize
|
38692
|
+
}) {
|
38693
|
+
const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
38694
|
+
if (consensusSize) {
|
38695
|
+
const consensusLen = resolveGasDependentCosts(consensusSize, gasCosts.s256);
|
38696
|
+
txId.add(consensusLen);
|
38697
|
+
}
|
38698
|
+
return txId;
|
38699
|
+
}
|
38700
|
+
function calculateMetadataGasForTxUpload({
|
38701
|
+
gasCosts,
|
38702
|
+
txBytesSize,
|
38703
|
+
subsectionSize,
|
38704
|
+
subsectionsSize
|
38705
|
+
}) {
|
38706
|
+
const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
38707
|
+
const subsectionLen = resolveGasDependentCosts(subsectionSize, gasCosts.s256);
|
38708
|
+
txId.add(subsectionLen);
|
38709
|
+
const subsectionsLen = resolveGasDependentCosts(subsectionsSize, gasCosts.stateRoot);
|
38710
|
+
txId.add(subsectionsLen);
|
38711
|
+
return txId;
|
38712
|
+
}
|
38713
|
+
function calculateMinGasForTxUpload({
|
38714
|
+
gasCosts,
|
38715
|
+
baseMinGas,
|
38716
|
+
subsectionSize
|
38717
|
+
}) {
|
38718
|
+
const additionalStoragePerByte = bn(gasCosts.newStoragePerByte).mul(subsectionSize);
|
38719
|
+
return bn(baseMinGas).add(additionalStoragePerByte);
|
38720
|
+
}
|
38743
38721
|
var calculateGasFee = (params) => {
|
38744
38722
|
const { gas, gasPrice, priceFactor, tip } = params;
|
38745
38723
|
return gas.mul(gasPrice).div(priceFactor).add(bn(tip));
|
@@ -39038,8 +39016,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39038
39016
|
*
|
39039
39017
|
* Pushes an output to the list without any side effects and returns the index
|
39040
39018
|
*/
|
39041
|
-
pushOutput(
|
39042
|
-
this.outputs.push(
|
39019
|
+
pushOutput(output2) {
|
39020
|
+
this.outputs.push(output2);
|
39043
39021
|
return this.outputs.length - 1;
|
39044
39022
|
}
|
39045
39023
|
/**
|
@@ -39123,7 +39101,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39123
39101
|
*/
|
39124
39102
|
getCoinOutputs() {
|
39125
39103
|
return this.outputs.filter(
|
39126
|
-
(
|
39104
|
+
(output2) => output2.type === OutputType.Coin
|
39127
39105
|
);
|
39128
39106
|
}
|
39129
39107
|
/**
|
@@ -39133,7 +39111,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39133
39111
|
*/
|
39134
39112
|
getChangeOutputs() {
|
39135
39113
|
return this.outputs.filter(
|
39136
|
-
(
|
39114
|
+
(output2) => output2.type === OutputType.Change
|
39137
39115
|
);
|
39138
39116
|
}
|
39139
39117
|
/**
|
@@ -39286,7 +39264,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39286
39264
|
*/
|
39287
39265
|
addChangeOutput(to, assetId) {
|
39288
39266
|
const changeOutput = this.getChangeOutputs().find(
|
39289
|
-
(
|
39267
|
+
(output2) => hexlify(output2.assetId) === assetId
|
39290
39268
|
);
|
39291
39269
|
if (!changeOutput) {
|
39292
39270
|
this.pushOutput({
|
@@ -39366,12 +39344,12 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39366
39344
|
usedQuantity = bn("1000000000000000000");
|
39367
39345
|
}
|
39368
39346
|
if (assetInput && "assetId" in assetInput) {
|
39369
|
-
assetInput.id = hexlify(
|
39347
|
+
assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
|
39370
39348
|
assetInput.amount = usedQuantity;
|
39371
39349
|
} else {
|
39372
39350
|
this.addResources([
|
39373
39351
|
{
|
39374
|
-
id: hexlify(
|
39352
|
+
id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
39375
39353
|
amount: usedQuantity,
|
39376
39354
|
assetId,
|
39377
39355
|
owner: resourcesOwner || Address.fromRandom(),
|
@@ -39471,8 +39449,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39471
39449
|
return inputClone;
|
39472
39450
|
}
|
39473
39451
|
});
|
39474
|
-
transaction.outputs = transaction.outputs.map((
|
39475
|
-
const outputClone = clone_default(
|
39452
|
+
transaction.outputs = transaction.outputs.map((output2) => {
|
39453
|
+
const outputClone = clone_default(output2);
|
39476
39454
|
switch (outputClone.type) {
|
39477
39455
|
case OutputType.Contract: {
|
39478
39456
|
outputClone.balanceRoot = ZeroBytes32;
|
@@ -39632,7 +39610,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39632
39610
|
*/
|
39633
39611
|
getContractCreatedOutputs() {
|
39634
39612
|
return this.outputs.filter(
|
39635
|
-
(
|
39613
|
+
(output2) => output2.type === OutputType.ContractCreated
|
39636
39614
|
);
|
39637
39615
|
}
|
39638
39616
|
/**
|
@@ -39755,7 +39733,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39755
39733
|
*/
|
39756
39734
|
getContractOutputs() {
|
39757
39735
|
return this.outputs.filter(
|
39758
|
-
(
|
39736
|
+
(output2) => output2.type === OutputType.Contract
|
39759
39737
|
);
|
39760
39738
|
}
|
39761
39739
|
/**
|
@@ -39765,7 +39743,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39765
39743
|
*/
|
39766
39744
|
getVariableOutputs() {
|
39767
39745
|
return this.outputs.filter(
|
39768
|
-
(
|
39746
|
+
(output2) => output2.type === OutputType.Variable
|
39769
39747
|
);
|
39770
39748
|
}
|
39771
39749
|
/**
|
@@ -39872,9 +39850,257 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39872
39850
|
}
|
39873
39851
|
};
|
39874
39852
|
|
39853
|
+
// src/providers/transaction-request/upgrade-transaction-request.ts
|
39854
|
+
var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
39855
|
+
static from(obj) {
|
39856
|
+
if (obj instanceof UpgradeTransactionRequest) {
|
39857
|
+
return obj;
|
39858
|
+
}
|
39859
|
+
return new this(clone_default(obj));
|
39860
|
+
}
|
39861
|
+
/** The type of transaction */
|
39862
|
+
type = TransactionType.Upgrade;
|
39863
|
+
/** The upgrade purpose */
|
39864
|
+
upgradePurpose;
|
39865
|
+
/** Witness index of consensus */
|
39866
|
+
bytecodeWitnessIndex;
|
39867
|
+
/**
|
39868
|
+
* Creates an instance `UpgradeTransactionRequest`.
|
39869
|
+
*
|
39870
|
+
* @param upgradeTransactionRequestLike - The initial values for the instance
|
39871
|
+
*/
|
39872
|
+
constructor({
|
39873
|
+
upgradePurpose,
|
39874
|
+
bytecodeWitnessIndex,
|
39875
|
+
...rest
|
39876
|
+
} = {}) {
|
39877
|
+
super(rest);
|
39878
|
+
this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
|
39879
|
+
this.upgradePurpose = upgradePurpose ?? {
|
39880
|
+
type: UpgradePurposeTypeEnum.ConsensusParameters,
|
39881
|
+
checksum: "0x"
|
39882
|
+
};
|
39883
|
+
}
|
39884
|
+
/**
|
39885
|
+
* Adds a consensus parameters upgrade purpose.
|
39886
|
+
*
|
39887
|
+
* @param consensus - The consensus bytecode.
|
39888
|
+
*
|
39889
|
+
* @returns - The current instance of `UpgradeTransactionRequest`.
|
39890
|
+
*/
|
39891
|
+
addConsensusParametersUpgradePurpose(consensus) {
|
39892
|
+
this.bytecodeWitnessIndex = this.addWitness(consensus);
|
39893
|
+
this.upgradePurpose = {
|
39894
|
+
type: UpgradePurposeTypeEnum.ConsensusParameters,
|
39895
|
+
checksum: hash2(consensus)
|
39896
|
+
};
|
39897
|
+
return this;
|
39898
|
+
}
|
39899
|
+
/**
|
39900
|
+
* Adds a state transition upgrade purpose.
|
39901
|
+
*
|
39902
|
+
* @param bytecodeRoot - The Merkle root of the state transition.
|
39903
|
+
*
|
39904
|
+
* @returns - The current instance of `UpgradeTransactionRequest`.
|
39905
|
+
*/
|
39906
|
+
addStateTransitionUpgradePurpose(bytecodeRoot) {
|
39907
|
+
this.upgradePurpose = {
|
39908
|
+
type: UpgradePurposeTypeEnum.StateTransition,
|
39909
|
+
data: hexlify(bytecodeRoot)
|
39910
|
+
};
|
39911
|
+
return this;
|
39912
|
+
}
|
39913
|
+
/**
|
39914
|
+
* Adds an upgrade purpose.
|
39915
|
+
*
|
39916
|
+
* @param type - The upgrade purpose type.
|
39917
|
+
* @param data - The bytecode or merkle root of upgrade purpose
|
39918
|
+
*
|
39919
|
+
* @returns - The current instance of `UpgradeTransactionRequest`.
|
39920
|
+
*/
|
39921
|
+
addUpgradePurpose(type3, data) {
|
39922
|
+
if (type3 === UpgradePurposeTypeEnum.ConsensusParameters) {
|
39923
|
+
this.addConsensusParametersUpgradePurpose(data);
|
39924
|
+
}
|
39925
|
+
if (type3 === UpgradePurposeTypeEnum.StateTransition) {
|
39926
|
+
this.addStateTransitionUpgradePurpose(data);
|
39927
|
+
}
|
39928
|
+
return this;
|
39929
|
+
}
|
39930
|
+
/**
|
39931
|
+
* Converts the transaction request to a `TransactionUpgrade`.
|
39932
|
+
*
|
39933
|
+
* @returns The transaction create object.
|
39934
|
+
*/
|
39935
|
+
toTransaction() {
|
39936
|
+
let upgradePurpose;
|
39937
|
+
if (this.upgradePurpose.type === UpgradePurposeTypeEnum.ConsensusParameters) {
|
39938
|
+
upgradePurpose = {
|
39939
|
+
type: UpgradePurposeTypeEnum.ConsensusParameters,
|
39940
|
+
data: {
|
39941
|
+
witnessIndex: this.bytecodeWitnessIndex,
|
39942
|
+
checksum: this.upgradePurpose.checksum
|
39943
|
+
}
|
39944
|
+
};
|
39945
|
+
} else if (this.upgradePurpose.type === UpgradePurposeTypeEnum.StateTransition) {
|
39946
|
+
upgradePurpose = {
|
39947
|
+
type: UpgradePurposeTypeEnum.StateTransition,
|
39948
|
+
data: {
|
39949
|
+
bytecodeRoot: hexlify(this.upgradePurpose.data)
|
39950
|
+
}
|
39951
|
+
};
|
39952
|
+
} else {
|
39953
|
+
throw new FuelError(FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
39954
|
+
}
|
39955
|
+
return {
|
39956
|
+
type: TransactionType.Upgrade,
|
39957
|
+
...super.getBaseTransaction(),
|
39958
|
+
upgradePurpose
|
39959
|
+
};
|
39960
|
+
}
|
39961
|
+
/**
|
39962
|
+
* Gets the Transaction ID by hashing the transaction
|
39963
|
+
*
|
39964
|
+
* @param chainId - The chain ID.
|
39965
|
+
*
|
39966
|
+
* @returns - A hash of the transaction, which is the transaction ID.
|
39967
|
+
*/
|
39968
|
+
getTransactionId(chainId) {
|
39969
|
+
return hashTransaction(this, chainId);
|
39970
|
+
}
|
39971
|
+
/**
|
39972
|
+
* Calculates the metadata gas cost for an upgrade transaction.
|
39973
|
+
*
|
39974
|
+
* @param gasCosts - gas costs passed from the chain.
|
39975
|
+
*
|
39976
|
+
* @returns metadata gas cost for the upgrade transaction.
|
39977
|
+
*/
|
39978
|
+
metadataGas(gasCosts) {
|
39979
|
+
const txBytesSize = this.byteSize();
|
39980
|
+
if (this.upgradePurpose.type === UpgradePurposeTypeEnum.ConsensusParameters) {
|
39981
|
+
const witnessIndex = this.bytecodeWitnessIndex;
|
39982
|
+
const consensusSize = this.witnesses[witnessIndex].length;
|
39983
|
+
return calculateMetadataGasForTxUpgrade({
|
39984
|
+
gasCosts,
|
39985
|
+
txBytesSize,
|
39986
|
+
consensusSize
|
39987
|
+
});
|
39988
|
+
}
|
39989
|
+
if (this.upgradePurpose.type === UpgradePurposeTypeEnum.StateTransition) {
|
39990
|
+
return calculateMetadataGasForTxUpgrade({
|
39991
|
+
gasCosts,
|
39992
|
+
txBytesSize
|
39993
|
+
});
|
39994
|
+
}
|
39995
|
+
throw new FuelError(FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
39996
|
+
}
|
39997
|
+
};
|
39998
|
+
|
39999
|
+
// src/providers/transaction-request/upload-transaction-request.ts
|
40000
|
+
var UploadTransactionRequest = class extends BaseTransactionRequest {
|
40001
|
+
static from(obj) {
|
40002
|
+
if (obj instanceof UploadTransactionRequest) {
|
40003
|
+
return obj;
|
40004
|
+
}
|
40005
|
+
return new this(clone_default(obj));
|
40006
|
+
}
|
40007
|
+
/** Type of the transaction */
|
40008
|
+
type = TransactionType.Upload;
|
40009
|
+
/** The witness index of the subsection of the bytecode. */
|
40010
|
+
witnessIndex;
|
40011
|
+
/** The subsection data. */
|
40012
|
+
subsection;
|
40013
|
+
/**
|
40014
|
+
* Creates an instance `UploadTransactionRequest`.
|
40015
|
+
*
|
40016
|
+
* @param uploadTransactionRequestLike - The initial values for the instance
|
40017
|
+
*/
|
40018
|
+
constructor({ witnessIndex, subsection, ...rest } = {}) {
|
40019
|
+
super(rest);
|
40020
|
+
this.witnessIndex = witnessIndex ?? 0;
|
40021
|
+
this.subsection = subsection ?? {
|
40022
|
+
proofSet: [],
|
40023
|
+
root: ZeroBytes32,
|
40024
|
+
subsectionIndex: 0,
|
40025
|
+
subsectionsNumber: 0
|
40026
|
+
};
|
40027
|
+
}
|
40028
|
+
/**
|
40029
|
+
* Adds the subsection.
|
40030
|
+
*
|
40031
|
+
* @param subsection - The subsection data.
|
40032
|
+
*/
|
40033
|
+
addSubsection(subsection) {
|
40034
|
+
const { subsection: subsectionBytecode, ...rest } = subsection;
|
40035
|
+
this.subsection = rest;
|
40036
|
+
this.witnessIndex = this.addWitness(subsectionBytecode);
|
40037
|
+
}
|
40038
|
+
/**
|
40039
|
+
* Gets the Transaction Request by hashing the transaction.
|
40040
|
+
*
|
40041
|
+
* @param chainId - The chain ID.
|
40042
|
+
*
|
40043
|
+
* @returns - A hash of the transaction, which is the transaction ID.
|
40044
|
+
*/
|
40045
|
+
getTransactionId(chainId) {
|
40046
|
+
return hashTransaction(this, chainId);
|
40047
|
+
}
|
40048
|
+
/**
|
40049
|
+
* Converts the transaction request to a `TransactionUpload`.
|
40050
|
+
*
|
40051
|
+
* @returns The transaction create object.
|
40052
|
+
*/
|
40053
|
+
toTransaction() {
|
40054
|
+
const baseTransaction = this.getBaseTransaction();
|
40055
|
+
const { subsectionIndex, subsectionsNumber, root, proofSet } = this.subsection;
|
40056
|
+
return {
|
40057
|
+
type: TransactionType.Upload,
|
40058
|
+
...baseTransaction,
|
40059
|
+
subsectionIndex,
|
40060
|
+
subsectionsNumber,
|
40061
|
+
root: hexlify(root),
|
40062
|
+
proofSet: proofSet.map(hexlify),
|
40063
|
+
witnessIndex: this.witnessIndex,
|
40064
|
+
proofSetCount: proofSet.length
|
40065
|
+
};
|
40066
|
+
}
|
40067
|
+
/**
|
40068
|
+
* Calculates the metadata gas cost for an upload transaction.
|
40069
|
+
*
|
40070
|
+
* @param gasCosts - gas costs passed from the chain.
|
40071
|
+
*
|
40072
|
+
* @returns metadata gas cost for the upload transaction.
|
40073
|
+
*/
|
40074
|
+
metadataGas(gasCosts) {
|
40075
|
+
return calculateMetadataGasForTxUpload({
|
40076
|
+
gasCosts,
|
40077
|
+
txBytesSize: this.byteSize(),
|
40078
|
+
subsectionSize: arrayify(this.witnesses[this.witnessIndex]).length,
|
40079
|
+
subsectionsSize: this.subsection.subsectionsNumber
|
40080
|
+
});
|
40081
|
+
}
|
40082
|
+
/**
|
40083
|
+
* Calculates the minimum gas for an upload transaction.
|
40084
|
+
*
|
40085
|
+
* @param chainInfo - The chain information.
|
40086
|
+
*
|
40087
|
+
* @returns the minimum gas for the upload transaction
|
40088
|
+
*/
|
40089
|
+
calculateMinGas(chainInfo) {
|
40090
|
+
const minGas = super.calculateMinGas(chainInfo);
|
40091
|
+
const { gasCosts } = chainInfo.consensusParameters;
|
40092
|
+
const bytecode = this.witnesses[this.witnessIndex] ?? ZeroBytes32;
|
40093
|
+
return calculateMinGasForTxUpload({
|
40094
|
+
gasCosts,
|
40095
|
+
baseMinGas: minGas.toNumber(),
|
40096
|
+
subsectionSize: arrayify(bytecode).length
|
40097
|
+
});
|
40098
|
+
}
|
40099
|
+
};
|
40100
|
+
|
39875
40101
|
// src/providers/transaction-request/utils.ts
|
39876
40102
|
var transactionRequestify = (obj) => {
|
39877
|
-
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest) {
|
40103
|
+
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
|
39878
40104
|
return obj;
|
39879
40105
|
}
|
39880
40106
|
const { type: type3 } = obj;
|
@@ -39888,6 +40114,12 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39888
40114
|
case TransactionType.Blob: {
|
39889
40115
|
return BlobTransactionRequest.from(obj);
|
39890
40116
|
}
|
40117
|
+
case TransactionType.Upgrade: {
|
40118
|
+
return UpgradeTransactionRequest.from(obj);
|
40119
|
+
}
|
40120
|
+
case TransactionType.Upload: {
|
40121
|
+
return UploadTransactionRequest.from(obj);
|
40122
|
+
}
|
39891
40123
|
default: {
|
39892
40124
|
throw new FuelError(
|
39893
40125
|
ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
|
@@ -39899,6 +40131,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39899
40131
|
var isTransactionTypeScript = (request) => request.type === TransactionType.Script;
|
39900
40132
|
var isTransactionTypeCreate = (request) => request.type === TransactionType.Create;
|
39901
40133
|
var isTransactionTypeBlob = (request) => request.type === TransactionType.Blob;
|
40134
|
+
var isTransactionTypeUpgrade = (request) => request.type === TransactionType.Upgrade;
|
40135
|
+
var isTransactionTypeUpload = (request) => request.type === TransactionType.Upload;
|
39902
40136
|
|
39903
40137
|
// src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
|
39904
40138
|
var calculateTXFeeForSummary = (params) => {
|
@@ -40158,6 +40392,10 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40158
40392
|
return "Script" /* Script */;
|
40159
40393
|
case TransactionType.Blob:
|
40160
40394
|
return "Blob" /* Blob */;
|
40395
|
+
case TransactionType.Upgrade:
|
40396
|
+
return "Upgrade" /* Upgrade */;
|
40397
|
+
case TransactionType.Upload:
|
40398
|
+
return "Upload" /* Upload */;
|
40161
40399
|
default:
|
40162
40400
|
throw new FuelError(
|
40163
40401
|
ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
|
@@ -40339,8 +40577,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40339
40577
|
}) {
|
40340
40578
|
const contractCallReceipts = getReceiptsCall(receipts);
|
40341
40579
|
const contractOutputs = getOutputsContract(outputs);
|
40342
|
-
return contractOutputs.flatMap((
|
40343
|
-
const contractInput = getInputContractFromIndex(inputs,
|
40580
|
+
return contractOutputs.flatMap((output2) => {
|
40581
|
+
const contractInput = getInputContractFromIndex(inputs, output2.inputIndex);
|
40344
40582
|
if (!contractInput) {
|
40345
40583
|
return [];
|
40346
40584
|
}
|
@@ -40362,7 +40600,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40362
40600
|
let { from: fromAddress } = receipt;
|
40363
40601
|
const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
|
40364
40602
|
if (ZeroBytes32 === fromAddress) {
|
40365
|
-
const change = changeOutputs.find((
|
40603
|
+
const change = changeOutputs.find((output2) => output2.assetId === assetId);
|
40366
40604
|
fromAddress = change?.to || fromAddress;
|
40367
40605
|
}
|
40368
40606
|
const fromType = contractInputs.some((input) => input.contractID === fromAddress) ? 0 /* contract */ : 1 /* account */;
|
@@ -40440,7 +40678,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40440
40678
|
}
|
40441
40679
|
function getPayProducerOperations(outputs) {
|
40442
40680
|
const coinOutputs = getOutputsCoin(outputs);
|
40443
|
-
const payProducerOperations = coinOutputs.reduce((prev,
|
40681
|
+
const payProducerOperations = coinOutputs.reduce((prev, output2) => {
|
40444
40682
|
const operations = addOperation(prev, {
|
40445
40683
|
name: "Pay network fee to block producer" /* payBlockProducer */,
|
40446
40684
|
from: {
|
@@ -40449,12 +40687,12 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40449
40687
|
},
|
40450
40688
|
to: {
|
40451
40689
|
type: 1 /* account */,
|
40452
|
-
address:
|
40690
|
+
address: output2.to.toString()
|
40453
40691
|
},
|
40454
40692
|
assetsSent: [
|
40455
40693
|
{
|
40456
|
-
assetId:
|
40457
|
-
amount:
|
40694
|
+
assetId: output2.assetId.toString(),
|
40695
|
+
amount: output2.amount
|
40458
40696
|
}
|
40459
40697
|
]
|
40460
40698
|
});
|
@@ -40751,29 +40989,30 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40751
40989
|
});
|
40752
40990
|
}
|
40753
40991
|
var TransactionResponse = class {
|
40754
|
-
/** Transaction ID */
|
40755
|
-
id;
|
40756
|
-
/** Current provider */
|
40757
|
-
provider;
|
40758
|
-
/** Gas used on the transaction */
|
40759
|
-
gasUsed = bn(0);
|
40760
|
-
/** The graphql Transaction with receipts object. */
|
40761
|
-
gqlTransaction;
|
40762
|
-
request;
|
40763
|
-
status;
|
40764
|
-
abis;
|
40765
40992
|
/**
|
40766
40993
|
* Constructor for `TransactionResponse`.
|
40767
40994
|
*
|
40768
40995
|
* @param tx - The transaction ID or TransactionRequest.
|
40769
40996
|
* @param provider - The provider.
|
40770
40997
|
*/
|
40771
|
-
constructor(tx, provider, abis) {
|
40998
|
+
constructor(tx, provider, abis, submitTxSubscription) {
|
40999
|
+
this.submitTxSubscription = submitTxSubscription;
|
40772
41000
|
this.id = typeof tx === "string" ? tx : tx.getTransactionId(provider.getChainId());
|
40773
41001
|
this.provider = provider;
|
40774
41002
|
this.abis = abis;
|
40775
41003
|
this.request = typeof tx === "string" ? void 0 : tx;
|
40776
41004
|
}
|
41005
|
+
/** Transaction ID */
|
41006
|
+
id;
|
41007
|
+
/** Current provider */
|
41008
|
+
provider;
|
41009
|
+
/** Gas used on the transaction */
|
41010
|
+
gasUsed = bn(0);
|
41011
|
+
/** The graphql Transaction with receipts object. */
|
41012
|
+
gqlTransaction;
|
41013
|
+
request;
|
41014
|
+
status;
|
41015
|
+
abis;
|
40777
41016
|
/**
|
40778
41017
|
* Async constructor for `TransactionResponse`. This method can be used to create
|
40779
41018
|
* an instance of `TransactionResponse` and wait for the transaction to be fetched
|
@@ -40906,10 +41145,11 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40906
41145
|
if (status && status !== "SubmittedStatus") {
|
40907
41146
|
return;
|
40908
41147
|
}
|
40909
|
-
const subscription = await this.provider.operations.statusChange({
|
41148
|
+
const subscription = this.submitTxSubscription ?? await this.provider.operations.statusChange({
|
40910
41149
|
transactionId: this.id
|
40911
41150
|
});
|
40912
|
-
for await (const
|
41151
|
+
for await (const sub of subscription) {
|
41152
|
+
const statusChange = "statusChange" in sub ? sub.statusChange : sub.submitAndAwaitStatus;
|
40913
41153
|
this.status = statusChange;
|
40914
41154
|
if (statusChange.type === "SqueezedOutStatus") {
|
40915
41155
|
this.unsetResourceCache();
|
@@ -41113,21 +41353,31 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41113
41353
|
* @hidden
|
41114
41354
|
*/
|
41115
41355
|
constructor(url, options = {}) {
|
41116
|
-
this.url = url;
|
41117
41356
|
/**
|
41118
41357
|
* @hidden
|
41119
41358
|
*/
|
41120
41359
|
__privateAdd(this, _cacheInputs);
|
41121
41360
|
__publicField(this, "operations");
|
41122
41361
|
__publicField(this, "cache");
|
41362
|
+
/** @hidden */
|
41363
|
+
__publicField(this, "url");
|
41364
|
+
/** @hidden */
|
41365
|
+
__publicField(this, "urlWithoutAuth");
|
41123
41366
|
__publicField(this, "options", {
|
41124
41367
|
timeout: void 0,
|
41125
41368
|
resourceCacheTTL: void 0,
|
41126
41369
|
fetch: void 0,
|
41127
|
-
retryOptions: void 0
|
41370
|
+
retryOptions: void 0,
|
41371
|
+
headers: void 0
|
41128
41372
|
});
|
41373
|
+
const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
|
41374
|
+
this.url = rawUrl;
|
41375
|
+
this.urlWithoutAuth = urlWithoutAuth;
|
41129
41376
|
this.options = { ...this.options, ...options };
|
41130
41377
|
this.url = url;
|
41378
|
+
if (headers) {
|
41379
|
+
this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
|
41380
|
+
}
|
41131
41381
|
this.operations = this.createOperations();
|
41132
41382
|
const { resourceCacheTTL } = this.options;
|
41133
41383
|
if (isDefined(resourceCacheTTL)) {
|
@@ -41149,12 +41399,16 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41149
41399
|
* @hidden
|
41150
41400
|
*/
|
41151
41401
|
static getFetchFn(options) {
|
41152
|
-
const { retryOptions, timeout } = options;
|
41402
|
+
const { retryOptions, timeout, headers } = options;
|
41153
41403
|
return autoRetryFetch(async (...args) => {
|
41154
41404
|
const url = args[0];
|
41155
41405
|
const request = args[1];
|
41156
41406
|
const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
|
41157
|
-
let fullRequest = {
|
41407
|
+
let fullRequest = {
|
41408
|
+
...request,
|
41409
|
+
signal,
|
41410
|
+
headers: { ...request?.headers, ...headers }
|
41411
|
+
};
|
41158
41412
|
if (options.requestMiddleware) {
|
41159
41413
|
fullRequest = await options.requestMiddleware(fullRequest);
|
41160
41414
|
}
|
@@ -41162,15 +41416,23 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41162
41416
|
}, retryOptions);
|
41163
41417
|
}
|
41164
41418
|
static extractBasicAuth(url) {
|
41165
|
-
|
41419
|
+
let parsedUrl;
|
41420
|
+
try {
|
41421
|
+
parsedUrl = new URL(url);
|
41422
|
+
} catch (error) {
|
41423
|
+
throw new FuelError(FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
|
41424
|
+
}
|
41166
41425
|
const username = parsedUrl.username;
|
41167
41426
|
const password = parsedUrl.password;
|
41168
|
-
const
|
41427
|
+
const urlWithoutAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
|
41169
41428
|
if (!(username && password)) {
|
41170
|
-
return { url,
|
41429
|
+
return { url, urlWithoutAuth: url, headers: void 0 };
|
41171
41430
|
}
|
41172
|
-
|
41173
|
-
|
41431
|
+
return {
|
41432
|
+
url,
|
41433
|
+
urlWithoutAuth,
|
41434
|
+
headers: { Authorization: `Basic ${btoa(`${username}:${password}`)}` }
|
41435
|
+
};
|
41174
41436
|
}
|
41175
41437
|
/**
|
41176
41438
|
* Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
|
@@ -41181,17 +41443,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41181
41443
|
* @returns A promise that resolves to a Provider instance.
|
41182
41444
|
*/
|
41183
41445
|
static async create(url, options = {}) {
|
41184
|
-
const
|
41185
|
-
const provider = new _Provider(urlToUse, {
|
41186
|
-
...options,
|
41187
|
-
requestMiddleware: async (request) => {
|
41188
|
-
if (auth) {
|
41189
|
-
request.headers ??= {};
|
41190
|
-
request.headers.Authorization = auth;
|
41191
|
-
}
|
41192
|
-
return options.requestMiddleware?.(request) ?? request;
|
41193
|
-
}
|
41194
|
-
});
|
41446
|
+
const provider = new _Provider(url, options);
|
41195
41447
|
await provider.fetchChainAndNodeInfo();
|
41196
41448
|
return provider;
|
41197
41449
|
}
|
@@ -41201,7 +41453,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41201
41453
|
* @returns the chain information configuration.
|
41202
41454
|
*/
|
41203
41455
|
getChain() {
|
41204
|
-
const chain = _Provider.chainInfoCache[this.
|
41456
|
+
const chain = _Provider.chainInfoCache[this.urlWithoutAuth];
|
41205
41457
|
if (!chain) {
|
41206
41458
|
throw new FuelError(
|
41207
41459
|
ErrorCode.CHAIN_INFO_CACHE_EMPTY,
|
@@ -41216,7 +41468,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41216
41468
|
* @returns the node information configuration.
|
41217
41469
|
*/
|
41218
41470
|
getNode() {
|
41219
|
-
const node = _Provider.nodeInfoCache[this.
|
41471
|
+
const node = _Provider.nodeInfoCache[this.urlWithoutAuth];
|
41220
41472
|
if (!node) {
|
41221
41473
|
throw new FuelError(
|
41222
41474
|
ErrorCode.NODE_INFO_CACHE_EMPTY,
|
@@ -41250,8 +41502,11 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41250
41502
|
* @param options - Additional options for the provider.
|
41251
41503
|
*/
|
41252
41504
|
async connect(url, options) {
|
41253
|
-
|
41505
|
+
const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
|
41506
|
+
this.url = rawUrl;
|
41507
|
+
this.urlWithoutAuth = urlWithoutAuth;
|
41254
41508
|
this.options = options ?? this.options;
|
41509
|
+
this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
|
41255
41510
|
this.operations = this.createOperations();
|
41256
41511
|
await this.fetchChainAndNodeInfo();
|
41257
41512
|
}
|
@@ -41291,7 +41546,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41291
41546
|
*/
|
41292
41547
|
createOperations() {
|
41293
41548
|
const fetchFn = _Provider.getFetchFn(this.options);
|
41294
|
-
const gqlClient = new import_graphql_request.GraphQLClient(this.
|
41549
|
+
const gqlClient = new import_graphql_request.GraphQLClient(this.urlWithoutAuth, {
|
41295
41550
|
fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
|
41296
41551
|
responseMiddleware: (response) => {
|
41297
41552
|
if ("response" in response) {
|
@@ -41309,7 +41564,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41309
41564
|
const isSubscription = opDefinition?.operation === "subscription";
|
41310
41565
|
if (isSubscription) {
|
41311
41566
|
return FuelGraphqlSubscriber.create({
|
41312
|
-
url: this.
|
41567
|
+
url: this.urlWithoutAuth,
|
41313
41568
|
query,
|
41314
41569
|
fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
|
41315
41570
|
variables: vars
|
@@ -41372,7 +41627,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41372
41627
|
utxoValidation: nodeInfo.utxoValidation,
|
41373
41628
|
vmBacktrace: nodeInfo.vmBacktrace
|
41374
41629
|
};
|
41375
|
-
_Provider.nodeInfoCache[this.
|
41630
|
+
_Provider.nodeInfoCache[this.urlWithoutAuth] = processedNodeInfo;
|
41376
41631
|
return processedNodeInfo;
|
41377
41632
|
}
|
41378
41633
|
/**
|
@@ -41383,7 +41638,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41383
41638
|
async fetchChain() {
|
41384
41639
|
const { chain } = await this.operations.getChain();
|
41385
41640
|
const processedChain = processGqlChain(chain);
|
41386
|
-
_Provider.chainInfoCache[this.
|
41641
|
+
_Provider.chainInfoCache[this.urlWithoutAuth] = processedChain;
|
41387
41642
|
return processedChain;
|
41388
41643
|
}
|
41389
41644
|
/**
|
@@ -41445,11 +41700,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41445
41700
|
if (isTransactionTypeScript(transactionRequest)) {
|
41446
41701
|
abis = transactionRequest.abis;
|
41447
41702
|
}
|
41448
|
-
const {
|
41449
|
-
|
41450
|
-
|
41451
|
-
__privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionId);
|
41452
|
-
return new TransactionResponse(transactionRequest, this, abis);
|
41703
|
+
const subscription = await this.operations.submitAndAwaitStatus({ encodedTransaction });
|
41704
|
+
__privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionRequest.getTransactionId(this.getChainId()));
|
41705
|
+
return new TransactionResponse(transactionRequest, this, abis, subscription);
|
41453
41706
|
}
|
41454
41707
|
/**
|
41455
41708
|
* Executes a transaction without actually submitting it to the chain.
|
@@ -42540,10 +42793,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42540
42793
|
gasPrice,
|
42541
42794
|
baseAssetId
|
42542
42795
|
});
|
42543
|
-
const
|
42796
|
+
const output2 = {
|
42544
42797
|
...transactionSummary
|
42545
42798
|
};
|
42546
|
-
return
|
42799
|
+
return output2;
|
42547
42800
|
});
|
42548
42801
|
return {
|
42549
42802
|
transactions,
|
@@ -42554,12 +42807,14 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42554
42807
|
// src/providers/chains.ts
|
42555
42808
|
var CHAIN_IDS = {
|
42556
42809
|
eth: {
|
42810
|
+
mainnet: 1,
|
42557
42811
|
sepolia: 11155111,
|
42558
42812
|
foundry: 31337
|
42559
42813
|
},
|
42560
42814
|
fuel: {
|
42561
42815
|
devnet: 0,
|
42562
|
-
testnet: 0
|
42816
|
+
testnet: 0,
|
42817
|
+
mainnet: 9889
|
42563
42818
|
}
|
42564
42819
|
};
|
42565
42820
|
|
@@ -42659,6 +42914,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42659
42914
|
chainId: CHAIN_IDS.eth.foundry,
|
42660
42915
|
decimals: 18
|
42661
42916
|
},
|
42917
|
+
{
|
42918
|
+
type: "ethereum",
|
42919
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
42920
|
+
decimals: 18
|
42921
|
+
},
|
42662
42922
|
{
|
42663
42923
|
type: "fuel",
|
42664
42924
|
chainId: CHAIN_IDS.fuel.devnet,
|
@@ -42670,6 +42930,571 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42670
42930
|
chainId: CHAIN_IDS.fuel.testnet,
|
42671
42931
|
decimals: 9,
|
42672
42932
|
assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
|
42933
|
+
},
|
42934
|
+
{
|
42935
|
+
type: "fuel",
|
42936
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
42937
|
+
decimals: 9,
|
42938
|
+
assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
|
42939
|
+
}
|
42940
|
+
]
|
42941
|
+
},
|
42942
|
+
{
|
42943
|
+
name: "WETH",
|
42944
|
+
symbol: "WETH",
|
42945
|
+
icon: "weth.svg",
|
42946
|
+
networks: [
|
42947
|
+
{
|
42948
|
+
type: "ethereum",
|
42949
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
42950
|
+
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
42951
|
+
decimals: 18
|
42952
|
+
},
|
42953
|
+
{
|
42954
|
+
type: "fuel",
|
42955
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
42956
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
42957
|
+
assetId: "0xa38a5a8beeb08d95744bc7f58528073f4052b254def59eba20c99c202b5acaa3",
|
42958
|
+
decimals: 18
|
42959
|
+
}
|
42960
|
+
]
|
42961
|
+
},
|
42962
|
+
{
|
42963
|
+
name: "weETH",
|
42964
|
+
symbol: "weETH",
|
42965
|
+
icon: "weETH.webp",
|
42966
|
+
networks: [
|
42967
|
+
{
|
42968
|
+
type: "ethereum",
|
42969
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
42970
|
+
address: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
|
42971
|
+
decimals: 18
|
42972
|
+
},
|
42973
|
+
{
|
42974
|
+
type: "fuel",
|
42975
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
42976
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
42977
|
+
assetId: "0x239ed6e12b7ce4089ee245244e3bf906999a6429c2a9a445a1e1faf56914a4ab",
|
42978
|
+
decimals: 18
|
42979
|
+
}
|
42980
|
+
]
|
42981
|
+
},
|
42982
|
+
{
|
42983
|
+
name: "rsETH",
|
42984
|
+
symbol: "rsETH",
|
42985
|
+
icon: "rsETH.webp",
|
42986
|
+
networks: [
|
42987
|
+
{
|
42988
|
+
type: "ethereum",
|
42989
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
42990
|
+
address: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
|
42991
|
+
decimals: 18
|
42992
|
+
},
|
42993
|
+
{
|
42994
|
+
type: "fuel",
|
42995
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
42996
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
42997
|
+
assetId: "0xbae80f7fb8aa6b90d9b01ef726ec847cc4f59419c4d5f2ea88fec785d1b0e849",
|
42998
|
+
decimals: 18
|
42999
|
+
}
|
43000
|
+
]
|
43001
|
+
},
|
43002
|
+
{
|
43003
|
+
name: "rETH",
|
43004
|
+
symbol: "rETH",
|
43005
|
+
icon: "reth.svg",
|
43006
|
+
networks: [
|
43007
|
+
{
|
43008
|
+
type: "ethereum",
|
43009
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43010
|
+
address: "0xae78736cd615f374d3085123a210448e74fc6393",
|
43011
|
+
decimals: 18
|
43012
|
+
},
|
43013
|
+
{
|
43014
|
+
type: "fuel",
|
43015
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43016
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43017
|
+
assetId: "0xf3f9a0ed0ce8eac5f89d6b83e41b3848212d5b5f56108c54a205bb228ca30c16",
|
43018
|
+
decimals: 18
|
43019
|
+
}
|
43020
|
+
]
|
43021
|
+
},
|
43022
|
+
{
|
43023
|
+
name: "wbETH",
|
43024
|
+
symbol: "wbETH",
|
43025
|
+
icon: "wbeth.png",
|
43026
|
+
networks: [
|
43027
|
+
{
|
43028
|
+
type: "ethereum",
|
43029
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43030
|
+
address: "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
|
43031
|
+
decimals: 18
|
43032
|
+
},
|
43033
|
+
{
|
43034
|
+
type: "fuel",
|
43035
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43036
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43037
|
+
assetId: "0x7843c74bef935e837f2bcf67b5d64ecb46dd53ff86375530b0caf3699e8ffafe",
|
43038
|
+
decimals: 18
|
43039
|
+
}
|
43040
|
+
]
|
43041
|
+
},
|
43042
|
+
{
|
43043
|
+
name: "rstETH",
|
43044
|
+
symbol: "rstETH",
|
43045
|
+
icon: "rstETH.webp",
|
43046
|
+
networks: [
|
43047
|
+
{
|
43048
|
+
type: "ethereum",
|
43049
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43050
|
+
address: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
43051
|
+
decimals: 18
|
43052
|
+
},
|
43053
|
+
{
|
43054
|
+
type: "fuel",
|
43055
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43056
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43057
|
+
assetId: "0x962792286fbc9b1d5860b4551362a12249362c21594c77abf4b3fe2bbe8d977a",
|
43058
|
+
decimals: 18
|
43059
|
+
}
|
43060
|
+
]
|
43061
|
+
},
|
43062
|
+
{
|
43063
|
+
name: "amphrETH",
|
43064
|
+
symbol: "amphrETH",
|
43065
|
+
icon: "amphrETH.png",
|
43066
|
+
networks: [
|
43067
|
+
{
|
43068
|
+
type: "ethereum",
|
43069
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43070
|
+
address: "0x5fD13359Ba15A84B76f7F87568309040176167cd",
|
43071
|
+
decimals: 18
|
43072
|
+
},
|
43073
|
+
{
|
43074
|
+
type: "fuel",
|
43075
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43076
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43077
|
+
assetId: "0x05fc623e57bd7bc1258efa8e4f62b05af5471d73df6f2c2dc11ecc81134c4f36",
|
43078
|
+
decimals: 18
|
43079
|
+
}
|
43080
|
+
]
|
43081
|
+
},
|
43082
|
+
{
|
43083
|
+
name: "Manta mBTC",
|
43084
|
+
symbol: "Manta mBTC",
|
43085
|
+
icon: "manta-mbtc.svg",
|
43086
|
+
networks: [
|
43087
|
+
{
|
43088
|
+
type: "ethereum",
|
43089
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43090
|
+
address: "0x4041381e947CFD3D483d67a25C6aa9Dc924250c5",
|
43091
|
+
decimals: 18
|
43092
|
+
},
|
43093
|
+
{
|
43094
|
+
type: "fuel",
|
43095
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43096
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43097
|
+
assetId: "0xaf3111a248ff7a3238cdeea845bb2d43cf3835f1f6b8c9d28360728b55b9ce5b",
|
43098
|
+
decimals: 18
|
43099
|
+
}
|
43100
|
+
]
|
43101
|
+
},
|
43102
|
+
{
|
43103
|
+
name: "Manta mETH",
|
43104
|
+
symbol: "Manta mETH",
|
43105
|
+
icon: "manta-meth.svg",
|
43106
|
+
networks: [
|
43107
|
+
{
|
43108
|
+
type: "ethereum",
|
43109
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43110
|
+
address: "0x8CdF550C04Bc9B9F10938368349C9c8051A772b6",
|
43111
|
+
decimals: 18
|
43112
|
+
},
|
43113
|
+
{
|
43114
|
+
type: "fuel",
|
43115
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43116
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43117
|
+
assetId: "0xafd219f513317b1750783c6581f55530d6cf189a5863fd18bd1b3ffcec1714b4",
|
43118
|
+
decimals: 18
|
43119
|
+
}
|
43120
|
+
]
|
43121
|
+
},
|
43122
|
+
{
|
43123
|
+
name: "Manta mUSD",
|
43124
|
+
symbol: "Manta mUSD",
|
43125
|
+
icon: "manta-musd.svg",
|
43126
|
+
networks: [
|
43127
|
+
{
|
43128
|
+
type: "ethereum",
|
43129
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43130
|
+
address: "0x3f24E1d7a973867fC2A03fE199E5502514E0e11E",
|
43131
|
+
decimals: 18
|
43132
|
+
},
|
43133
|
+
{
|
43134
|
+
type: "fuel",
|
43135
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43136
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43137
|
+
assetId: "0x89cb9401e55d49c3269654dd1cdfb0e80e57823a4a7db98ba8fc5953b120fef4",
|
43138
|
+
decimals: 18
|
43139
|
+
}
|
43140
|
+
]
|
43141
|
+
},
|
43142
|
+
{
|
43143
|
+
name: "pumpBTC",
|
43144
|
+
symbol: "pumpBTC",
|
43145
|
+
icon: "pumpbtc.webp",
|
43146
|
+
networks: [
|
43147
|
+
{
|
43148
|
+
type: "ethereum",
|
43149
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43150
|
+
address: "0xf469fbd2abcd6b9de8e169d128226c0fc90a012e",
|
43151
|
+
decimals: 8
|
43152
|
+
},
|
43153
|
+
{
|
43154
|
+
type: "fuel",
|
43155
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43156
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43157
|
+
assetId: "0x0aa5eb2bb97ca915288b653a2529355d4dc66de2b37533213f0e4aeee3d3421f",
|
43158
|
+
decimals: 8
|
43159
|
+
}
|
43160
|
+
]
|
43161
|
+
},
|
43162
|
+
{
|
43163
|
+
name: "FBTC",
|
43164
|
+
symbol: "FBTC",
|
43165
|
+
icon: "fbtc.svg",
|
43166
|
+
networks: [
|
43167
|
+
{
|
43168
|
+
type: "ethereum",
|
43169
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43170
|
+
address: "0xc96de26018a54d51c097160568752c4e3bd6c364",
|
43171
|
+
decimals: 8
|
43172
|
+
},
|
43173
|
+
{
|
43174
|
+
type: "fuel",
|
43175
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43176
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43177
|
+
assetId: "0xb5ecb0a1e08e2abbabf624ffea089df933376855f468ade35c6375b00c33996a",
|
43178
|
+
decimals: 8
|
43179
|
+
}
|
43180
|
+
]
|
43181
|
+
},
|
43182
|
+
{
|
43183
|
+
name: "SolvBTC",
|
43184
|
+
symbol: "SolvBTC",
|
43185
|
+
icon: "solvBTC.webp",
|
43186
|
+
networks: [
|
43187
|
+
{
|
43188
|
+
type: "ethereum",
|
43189
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43190
|
+
address: "0x7a56e1c57c7475ccf742a1832b028f0456652f97",
|
43191
|
+
decimals: 18
|
43192
|
+
},
|
43193
|
+
{
|
43194
|
+
type: "fuel",
|
43195
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43196
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43197
|
+
assetId: "0x1186afea9affb88809c210e13e2330b5258c2cef04bb8fff5eff372b7bd3f40f",
|
43198
|
+
decimals: 18
|
43199
|
+
}
|
43200
|
+
]
|
43201
|
+
},
|
43202
|
+
{
|
43203
|
+
name: "SolvBTC.BBN",
|
43204
|
+
symbol: "SolvBTC.BBN",
|
43205
|
+
icon: "SolvBTC.BBN.png",
|
43206
|
+
networks: [
|
43207
|
+
{
|
43208
|
+
type: "ethereum",
|
43209
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43210
|
+
address: "0xd9d920aa40f578ab794426f5c90f6c731d159def",
|
43211
|
+
decimals: 18
|
43212
|
+
},
|
43213
|
+
{
|
43214
|
+
type: "fuel",
|
43215
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43216
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43217
|
+
assetId: "0x7a4f087c957d30218223c2baaaa365355c9ca81b6ea49004cfb1590a5399216f",
|
43218
|
+
decimals: 18
|
43219
|
+
}
|
43220
|
+
]
|
43221
|
+
},
|
43222
|
+
{
|
43223
|
+
name: "Mantle mETH",
|
43224
|
+
symbol: "Mantle mETH",
|
43225
|
+
icon: "mantle-meth.svg",
|
43226
|
+
networks: [
|
43227
|
+
{
|
43228
|
+
type: "ethereum",
|
43229
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43230
|
+
address: "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa",
|
43231
|
+
decimals: 18
|
43232
|
+
},
|
43233
|
+
{
|
43234
|
+
type: "fuel",
|
43235
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43236
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43237
|
+
assetId: "0x642a5db59ec323c2f846d4d4cf3e58d78aff64accf4f8f6455ba0aa3ef000a3b",
|
43238
|
+
decimals: 18
|
43239
|
+
}
|
43240
|
+
]
|
43241
|
+
},
|
43242
|
+
{
|
43243
|
+
name: "sDAI",
|
43244
|
+
symbol: "sDAI",
|
43245
|
+
icon: "sdai.svg",
|
43246
|
+
networks: [
|
43247
|
+
{
|
43248
|
+
type: "ethereum",
|
43249
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43250
|
+
address: "0x83f20f44975d03b1b09e64809b757c47f942beea",
|
43251
|
+
decimals: 18
|
43252
|
+
},
|
43253
|
+
{
|
43254
|
+
type: "fuel",
|
43255
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43256
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43257
|
+
assetId: "0x9e46f919fbf978f3cad7cd34cca982d5613af63ff8aab6c379e4faa179552958",
|
43258
|
+
decimals: 18
|
43259
|
+
}
|
43260
|
+
]
|
43261
|
+
},
|
43262
|
+
{
|
43263
|
+
name: "USDT",
|
43264
|
+
symbol: "USDT",
|
43265
|
+
icon: "usdt.svg",
|
43266
|
+
networks: [
|
43267
|
+
{
|
43268
|
+
type: "ethereum",
|
43269
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43270
|
+
address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
43271
|
+
decimals: 6
|
43272
|
+
},
|
43273
|
+
{
|
43274
|
+
type: "fuel",
|
43275
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43276
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43277
|
+
assetId: "0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e",
|
43278
|
+
decimals: 6
|
43279
|
+
}
|
43280
|
+
]
|
43281
|
+
},
|
43282
|
+
{
|
43283
|
+
name: "USDC",
|
43284
|
+
symbol: "USDC",
|
43285
|
+
icon: "usdc.svg",
|
43286
|
+
networks: [
|
43287
|
+
{
|
43288
|
+
type: "ethereum",
|
43289
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43290
|
+
address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
43291
|
+
decimals: 6
|
43292
|
+
},
|
43293
|
+
{
|
43294
|
+
type: "fuel",
|
43295
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43296
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43297
|
+
assetId: "0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b",
|
43298
|
+
decimals: 6
|
43299
|
+
}
|
43300
|
+
]
|
43301
|
+
},
|
43302
|
+
{
|
43303
|
+
name: "USDe",
|
43304
|
+
symbol: "USDe",
|
43305
|
+
icon: "USDe.svg",
|
43306
|
+
networks: [
|
43307
|
+
{
|
43308
|
+
type: "ethereum",
|
43309
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43310
|
+
address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
|
43311
|
+
decimals: 18
|
43312
|
+
},
|
43313
|
+
{
|
43314
|
+
type: "ethereum",
|
43315
|
+
chainId: CHAIN_IDS.eth.sepolia,
|
43316
|
+
address: "0xc6387efad0f184a90b34f397c3d6fd63135ef790",
|
43317
|
+
decimals: 18
|
43318
|
+
},
|
43319
|
+
{
|
43320
|
+
type: "fuel",
|
43321
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43322
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43323
|
+
assetId: "0xb6133b2ef9f6153eb869125d23dcf20d1e735331b5e41b15a6a7a6cec70e8651",
|
43324
|
+
decimals: 18
|
43325
|
+
},
|
43326
|
+
{
|
43327
|
+
type: "fuel",
|
43328
|
+
chainId: CHAIN_IDS.fuel.testnet,
|
43329
|
+
contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
|
43330
|
+
assetId: "0xf5c6d72d0f2c782fa47d8e228c198a08654e9fc66ca60ad85902b1d09046a7ab",
|
43331
|
+
decimals: 18
|
43332
|
+
}
|
43333
|
+
]
|
43334
|
+
},
|
43335
|
+
{
|
43336
|
+
name: "sUSDe",
|
43337
|
+
symbol: "sUSDe",
|
43338
|
+
icon: "sUSDe.webp",
|
43339
|
+
networks: [
|
43340
|
+
{
|
43341
|
+
type: "ethereum",
|
43342
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43343
|
+
address: "0x9d39a5de30e57443bff2a8307a4256c8797a3497",
|
43344
|
+
decimals: 18
|
43345
|
+
},
|
43346
|
+
{
|
43347
|
+
type: "ethereum",
|
43348
|
+
chainId: CHAIN_IDS.eth.sepolia,
|
43349
|
+
address: "0xb8f4f4eafc1d2a3c0a4d519bbf1114c311cc9b1b",
|
43350
|
+
decimals: 18
|
43351
|
+
},
|
43352
|
+
{
|
43353
|
+
type: "fuel",
|
43354
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43355
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43356
|
+
assetId: "0xd05563025104fc36496c15c7021ad6b31034b0e89a356f4f818045d1f48808bc",
|
43357
|
+
decimals: 18
|
43358
|
+
},
|
43359
|
+
{
|
43360
|
+
type: "fuel",
|
43361
|
+
chainId: CHAIN_IDS.fuel.testnet,
|
43362
|
+
contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
|
43363
|
+
assetId: "0xa86e37d385c08beddbb02c8260f9ec535d484c8ea908fc19d4e6dc8d5141fb2e",
|
43364
|
+
decimals: 18
|
43365
|
+
}
|
43366
|
+
]
|
43367
|
+
},
|
43368
|
+
{
|
43369
|
+
name: "rsUSDe",
|
43370
|
+
symbol: "rsUSDe",
|
43371
|
+
icon: "rsUSDe.svg",
|
43372
|
+
networks: [
|
43373
|
+
{
|
43374
|
+
type: "ethereum",
|
43375
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43376
|
+
address: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26",
|
43377
|
+
decimals: 18
|
43378
|
+
},
|
43379
|
+
{
|
43380
|
+
type: "fuel",
|
43381
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43382
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43383
|
+
assetId: "0x78d4522ec607f6e8efb66ea49439d1ee48623cf763f9688a8eada025def033d9",
|
43384
|
+
decimals: 18
|
43385
|
+
}
|
43386
|
+
]
|
43387
|
+
},
|
43388
|
+
{
|
43389
|
+
name: "wstETH",
|
43390
|
+
symbol: "wstETH",
|
43391
|
+
icon: "wsteth.svg",
|
43392
|
+
networks: [
|
43393
|
+
{
|
43394
|
+
type: "ethereum",
|
43395
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43396
|
+
address: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
|
43397
|
+
decimals: 18
|
43398
|
+
},
|
43399
|
+
{
|
43400
|
+
type: "ethereum",
|
43401
|
+
chainId: CHAIN_IDS.eth.sepolia,
|
43402
|
+
address: "0xB82381A3fBD3FaFA77B3a7bE693342618240067b",
|
43403
|
+
decimals: 18
|
43404
|
+
},
|
43405
|
+
{
|
43406
|
+
type: "fuel",
|
43407
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43408
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43409
|
+
assetId: "0x1a7815cc9f75db5c24a5b0814bfb706bb9fe485333e98254015de8f48f84c67b",
|
43410
|
+
decimals: 18
|
43411
|
+
},
|
43412
|
+
{
|
43413
|
+
type: "fuel",
|
43414
|
+
chainId: CHAIN_IDS.fuel.testnet,
|
43415
|
+
contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
|
43416
|
+
assetId: "0x4c467e3fd4f32179e1aad3b92ebbdaa6ff6aeda5b8da5f8e64e96405eb52a7f5",
|
43417
|
+
decimals: 18
|
43418
|
+
}
|
43419
|
+
]
|
43420
|
+
},
|
43421
|
+
{
|
43422
|
+
name: "ezETH",
|
43423
|
+
symbol: "ezETH",
|
43424
|
+
icon: "ezeth.webp",
|
43425
|
+
networks: [
|
43426
|
+
{
|
43427
|
+
type: "ethereum",
|
43428
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43429
|
+
address: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
|
43430
|
+
decimals: 18
|
43431
|
+
},
|
43432
|
+
{
|
43433
|
+
type: "fuel",
|
43434
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43435
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43436
|
+
assetId: "0x91b3559edb2619cde8ffb2aa7b3c3be97efd794ea46700db7092abeee62281b0",
|
43437
|
+
decimals: 18
|
43438
|
+
}
|
43439
|
+
]
|
43440
|
+
},
|
43441
|
+
{
|
43442
|
+
name: "pzETH",
|
43443
|
+
symbol: "pzETH",
|
43444
|
+
icon: "pzETH.webp",
|
43445
|
+
networks: [
|
43446
|
+
{
|
43447
|
+
type: "ethereum",
|
43448
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43449
|
+
address: "0x8c9532a60e0e7c6bbd2b2c1303f63ace1c3e9811",
|
43450
|
+
decimals: 18
|
43451
|
+
},
|
43452
|
+
{
|
43453
|
+
type: "fuel",
|
43454
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43455
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43456
|
+
assetId: "0x1493d4ec82124de8f9b625682de69dcccda79e882b89a55a8c737b12de67bd68",
|
43457
|
+
decimals: 18
|
43458
|
+
}
|
43459
|
+
]
|
43460
|
+
},
|
43461
|
+
{
|
43462
|
+
name: "Re7LRT",
|
43463
|
+
symbol: "Re7LRT",
|
43464
|
+
icon: "Re7LRT.png",
|
43465
|
+
networks: [
|
43466
|
+
{
|
43467
|
+
type: "ethereum",
|
43468
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43469
|
+
address: "0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a",
|
43470
|
+
decimals: 18
|
43471
|
+
},
|
43472
|
+
{
|
43473
|
+
type: "fuel",
|
43474
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43475
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43476
|
+
assetId: "0xf2fc648c23a5db24610a1cf696acc4f0f6d9a7d6028dd9944964ab23f6e35995",
|
43477
|
+
decimals: 18
|
43478
|
+
}
|
43479
|
+
]
|
43480
|
+
},
|
43481
|
+
{
|
43482
|
+
name: "steakLRT",
|
43483
|
+
symbol: "steakLRT",
|
43484
|
+
icon: "steakLRT.png",
|
43485
|
+
networks: [
|
43486
|
+
{
|
43487
|
+
type: "ethereum",
|
43488
|
+
chainId: CHAIN_IDS.eth.mainnet,
|
43489
|
+
address: "0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc",
|
43490
|
+
decimals: 18
|
43491
|
+
},
|
43492
|
+
{
|
43493
|
+
type: "fuel",
|
43494
|
+
chainId: CHAIN_IDS.fuel.mainnet,
|
43495
|
+
contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
|
43496
|
+
assetId: "0x4fc8ac9f101df07e2c2dec4a53c8c42c439bdbe5e36ea2d863a61ff60afafc30",
|
43497
|
+
decimals: 18
|
42673
43498
|
}
|
42674
43499
|
]
|
42675
43500
|
}
|
@@ -43206,7 +44031,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43206
44031
|
*/
|
43207
44032
|
generateFakeResources(coins) {
|
43208
44033
|
return coins.map((coin) => ({
|
43209
|
-
id: hexlify(
|
44034
|
+
id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
43210
44035
|
owner: this.address,
|
43211
44036
|
blockCreated: bn(1),
|
43212
44037
|
txCreatedIdx: bn(1),
|
@@ -43263,414 +44088,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43263
44088
|
}
|
43264
44089
|
};
|
43265
44090
|
|
43266
|
-
// ../../node_modules/.pnpm/@noble+
|
43267
|
-
function number2(n) {
|
43268
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
43269
|
-
throw new Error(`positive integer expected, not ${n}`);
|
43270
|
-
}
|
43271
|
-
function isBytes4(a) {
|
43272
|
-
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
43273
|
-
}
|
43274
|
-
function bytes2(b, ...lengths) {
|
43275
|
-
if (!isBytes4(b))
|
43276
|
-
throw new Error("Uint8Array expected");
|
43277
|
-
if (lengths.length > 0 && !lengths.includes(b.length))
|
43278
|
-
throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
|
43279
|
-
}
|
43280
|
-
function hash3(h) {
|
43281
|
-
if (typeof h !== "function" || typeof h.create !== "function")
|
43282
|
-
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
43283
|
-
number2(h.outputLen);
|
43284
|
-
number2(h.blockLen);
|
43285
|
-
}
|
43286
|
-
function exists2(instance, checkFinished = true) {
|
43287
|
-
if (instance.destroyed)
|
43288
|
-
throw new Error("Hash instance has been destroyed");
|
43289
|
-
if (checkFinished && instance.finished)
|
43290
|
-
throw new Error("Hash#digest() has already been called");
|
43291
|
-
}
|
43292
|
-
function output2(out, instance) {
|
43293
|
-
bytes2(out);
|
43294
|
-
const min = instance.outputLen;
|
43295
|
-
if (out.length < min) {
|
43296
|
-
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
43297
|
-
}
|
43298
|
-
}
|
43299
|
-
|
43300
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/cryptoNode.js
|
43301
|
-
var nc = __toESM(__require("crypto"), 1);
|
43302
|
-
var crypto4 = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : void 0;
|
43303
|
-
|
43304
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/utils.js
|
43305
|
-
var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
43306
|
-
var rotr2 = (word, shift) => word << 32 - shift | word >>> shift;
|
43307
|
-
var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
43308
|
-
function utf8ToBytes3(str) {
|
43309
|
-
if (typeof str !== "string")
|
43310
|
-
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
43311
|
-
return new Uint8Array(new TextEncoder().encode(str));
|
43312
|
-
}
|
43313
|
-
function toBytes3(data) {
|
43314
|
-
if (typeof data === "string")
|
43315
|
-
data = utf8ToBytes3(data);
|
43316
|
-
bytes2(data);
|
43317
|
-
return data;
|
43318
|
-
}
|
43319
|
-
function concatBytes3(...arrays) {
|
43320
|
-
let sum = 0;
|
43321
|
-
for (let i = 0; i < arrays.length; i++) {
|
43322
|
-
const a = arrays[i];
|
43323
|
-
bytes2(a);
|
43324
|
-
sum += a.length;
|
43325
|
-
}
|
43326
|
-
const res = new Uint8Array(sum);
|
43327
|
-
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
43328
|
-
const a = arrays[i];
|
43329
|
-
res.set(a, pad);
|
43330
|
-
pad += a.length;
|
43331
|
-
}
|
43332
|
-
return res;
|
43333
|
-
}
|
43334
|
-
var Hash2 = class {
|
43335
|
-
// Safe version that clones internal state
|
43336
|
-
clone() {
|
43337
|
-
return this._cloneInto();
|
43338
|
-
}
|
43339
|
-
};
|
43340
|
-
var toStr2 = {}.toString;
|
43341
|
-
function wrapConstructor2(hashCons) {
|
43342
|
-
const hashC = (msg) => hashCons().update(toBytes3(msg)).digest();
|
43343
|
-
const tmp = hashCons();
|
43344
|
-
hashC.outputLen = tmp.outputLen;
|
43345
|
-
hashC.blockLen = tmp.blockLen;
|
43346
|
-
hashC.create = () => hashCons();
|
43347
|
-
return hashC;
|
43348
|
-
}
|
43349
|
-
function randomBytes3(bytesLength = 32) {
|
43350
|
-
if (crypto4 && typeof crypto4.getRandomValues === "function") {
|
43351
|
-
return crypto4.getRandomValues(new Uint8Array(bytesLength));
|
43352
|
-
}
|
43353
|
-
throw new Error("crypto.getRandomValues must be defined");
|
43354
|
-
}
|
43355
|
-
|
43356
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/_md.js
|
43357
|
-
function setBigUint642(view, byteOffset, value, isLE3) {
|
43358
|
-
if (typeof view.setBigUint64 === "function")
|
43359
|
-
return view.setBigUint64(byteOffset, value, isLE3);
|
43360
|
-
const _32n2 = BigInt(32);
|
43361
|
-
const _u32_max = BigInt(4294967295);
|
43362
|
-
const wh = Number(value >> _32n2 & _u32_max);
|
43363
|
-
const wl = Number(value & _u32_max);
|
43364
|
-
const h = isLE3 ? 4 : 0;
|
43365
|
-
const l = isLE3 ? 0 : 4;
|
43366
|
-
view.setUint32(byteOffset + h, wh, isLE3);
|
43367
|
-
view.setUint32(byteOffset + l, wl, isLE3);
|
43368
|
-
}
|
43369
|
-
var Chi2 = (a, b, c) => a & b ^ ~a & c;
|
43370
|
-
var Maj2 = (a, b, c) => a & b ^ a & c ^ b & c;
|
43371
|
-
var HashMD = class extends Hash2 {
|
43372
|
-
constructor(blockLen, outputLen, padOffset, isLE3) {
|
43373
|
-
super();
|
43374
|
-
this.blockLen = blockLen;
|
43375
|
-
this.outputLen = outputLen;
|
43376
|
-
this.padOffset = padOffset;
|
43377
|
-
this.isLE = isLE3;
|
43378
|
-
this.finished = false;
|
43379
|
-
this.length = 0;
|
43380
|
-
this.pos = 0;
|
43381
|
-
this.destroyed = false;
|
43382
|
-
this.buffer = new Uint8Array(blockLen);
|
43383
|
-
this.view = createView2(this.buffer);
|
43384
|
-
}
|
43385
|
-
update(data) {
|
43386
|
-
exists2(this);
|
43387
|
-
const { view, buffer, blockLen } = this;
|
43388
|
-
data = toBytes3(data);
|
43389
|
-
const len = data.length;
|
43390
|
-
for (let pos = 0; pos < len; ) {
|
43391
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
43392
|
-
if (take === blockLen) {
|
43393
|
-
const dataView = createView2(data);
|
43394
|
-
for (; blockLen <= len - pos; pos += blockLen)
|
43395
|
-
this.process(dataView, pos);
|
43396
|
-
continue;
|
43397
|
-
}
|
43398
|
-
buffer.set(data.subarray(pos, pos + take), this.pos);
|
43399
|
-
this.pos += take;
|
43400
|
-
pos += take;
|
43401
|
-
if (this.pos === blockLen) {
|
43402
|
-
this.process(view, 0);
|
43403
|
-
this.pos = 0;
|
43404
|
-
}
|
43405
|
-
}
|
43406
|
-
this.length += data.length;
|
43407
|
-
this.roundClean();
|
43408
|
-
return this;
|
43409
|
-
}
|
43410
|
-
digestInto(out) {
|
43411
|
-
exists2(this);
|
43412
|
-
output2(out, this);
|
43413
|
-
this.finished = true;
|
43414
|
-
const { buffer, view, blockLen, isLE: isLE3 } = this;
|
43415
|
-
let { pos } = this;
|
43416
|
-
buffer[pos++] = 128;
|
43417
|
-
this.buffer.subarray(pos).fill(0);
|
43418
|
-
if (this.padOffset > blockLen - pos) {
|
43419
|
-
this.process(view, 0);
|
43420
|
-
pos = 0;
|
43421
|
-
}
|
43422
|
-
for (let i = pos; i < blockLen; i++)
|
43423
|
-
buffer[i] = 0;
|
43424
|
-
setBigUint642(view, blockLen - 8, BigInt(this.length * 8), isLE3);
|
43425
|
-
this.process(view, 0);
|
43426
|
-
const oview = createView2(out);
|
43427
|
-
const len = this.outputLen;
|
43428
|
-
if (len % 4)
|
43429
|
-
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
43430
|
-
const outLen = len / 4;
|
43431
|
-
const state = this.get();
|
43432
|
-
if (outLen > state.length)
|
43433
|
-
throw new Error("_sha2: outputLen bigger than state");
|
43434
|
-
for (let i = 0; i < outLen; i++)
|
43435
|
-
oview.setUint32(4 * i, state[i], isLE3);
|
43436
|
-
}
|
43437
|
-
digest() {
|
43438
|
-
const { buffer, outputLen } = this;
|
43439
|
-
this.digestInto(buffer);
|
43440
|
-
const res = buffer.slice(0, outputLen);
|
43441
|
-
this.destroy();
|
43442
|
-
return res;
|
43443
|
-
}
|
43444
|
-
_cloneInto(to) {
|
43445
|
-
to || (to = new this.constructor());
|
43446
|
-
to.set(...this.get());
|
43447
|
-
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
43448
|
-
to.length = length;
|
43449
|
-
to.pos = pos;
|
43450
|
-
to.finished = finished;
|
43451
|
-
to.destroyed = destroyed;
|
43452
|
-
if (length % blockLen)
|
43453
|
-
to.buffer.set(buffer);
|
43454
|
-
return to;
|
43455
|
-
}
|
43456
|
-
};
|
43457
|
-
|
43458
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/sha256.js
|
43459
|
-
var SHA256_K2 = /* @__PURE__ */ new Uint32Array([
|
43460
|
-
1116352408,
|
43461
|
-
1899447441,
|
43462
|
-
3049323471,
|
43463
|
-
3921009573,
|
43464
|
-
961987163,
|
43465
|
-
1508970993,
|
43466
|
-
2453635748,
|
43467
|
-
2870763221,
|
43468
|
-
3624381080,
|
43469
|
-
310598401,
|
43470
|
-
607225278,
|
43471
|
-
1426881987,
|
43472
|
-
1925078388,
|
43473
|
-
2162078206,
|
43474
|
-
2614888103,
|
43475
|
-
3248222580,
|
43476
|
-
3835390401,
|
43477
|
-
4022224774,
|
43478
|
-
264347078,
|
43479
|
-
604807628,
|
43480
|
-
770255983,
|
43481
|
-
1249150122,
|
43482
|
-
1555081692,
|
43483
|
-
1996064986,
|
43484
|
-
2554220882,
|
43485
|
-
2821834349,
|
43486
|
-
2952996808,
|
43487
|
-
3210313671,
|
43488
|
-
3336571891,
|
43489
|
-
3584528711,
|
43490
|
-
113926993,
|
43491
|
-
338241895,
|
43492
|
-
666307205,
|
43493
|
-
773529912,
|
43494
|
-
1294757372,
|
43495
|
-
1396182291,
|
43496
|
-
1695183700,
|
43497
|
-
1986661051,
|
43498
|
-
2177026350,
|
43499
|
-
2456956037,
|
43500
|
-
2730485921,
|
43501
|
-
2820302411,
|
43502
|
-
3259730800,
|
43503
|
-
3345764771,
|
43504
|
-
3516065817,
|
43505
|
-
3600352804,
|
43506
|
-
4094571909,
|
43507
|
-
275423344,
|
43508
|
-
430227734,
|
43509
|
-
506948616,
|
43510
|
-
659060556,
|
43511
|
-
883997877,
|
43512
|
-
958139571,
|
43513
|
-
1322822218,
|
43514
|
-
1537002063,
|
43515
|
-
1747873779,
|
43516
|
-
1955562222,
|
43517
|
-
2024104815,
|
43518
|
-
2227730452,
|
43519
|
-
2361852424,
|
43520
|
-
2428436474,
|
43521
|
-
2756734187,
|
43522
|
-
3204031479,
|
43523
|
-
3329325298
|
43524
|
-
]);
|
43525
|
-
var SHA256_IV = /* @__PURE__ */ new Uint32Array([
|
43526
|
-
1779033703,
|
43527
|
-
3144134277,
|
43528
|
-
1013904242,
|
43529
|
-
2773480762,
|
43530
|
-
1359893119,
|
43531
|
-
2600822924,
|
43532
|
-
528734635,
|
43533
|
-
1541459225
|
43534
|
-
]);
|
43535
|
-
var SHA256_W2 = /* @__PURE__ */ new Uint32Array(64);
|
43536
|
-
var SHA2562 = class extends HashMD {
|
43537
|
-
constructor() {
|
43538
|
-
super(64, 32, 8, false);
|
43539
|
-
this.A = SHA256_IV[0] | 0;
|
43540
|
-
this.B = SHA256_IV[1] | 0;
|
43541
|
-
this.C = SHA256_IV[2] | 0;
|
43542
|
-
this.D = SHA256_IV[3] | 0;
|
43543
|
-
this.E = SHA256_IV[4] | 0;
|
43544
|
-
this.F = SHA256_IV[5] | 0;
|
43545
|
-
this.G = SHA256_IV[6] | 0;
|
43546
|
-
this.H = SHA256_IV[7] | 0;
|
43547
|
-
}
|
43548
|
-
get() {
|
43549
|
-
const { A, B, C, D, E, F, G, H } = this;
|
43550
|
-
return [A, B, C, D, E, F, G, H];
|
43551
|
-
}
|
43552
|
-
// prettier-ignore
|
43553
|
-
set(A, B, C, D, E, F, G, H) {
|
43554
|
-
this.A = A | 0;
|
43555
|
-
this.B = B | 0;
|
43556
|
-
this.C = C | 0;
|
43557
|
-
this.D = D | 0;
|
43558
|
-
this.E = E | 0;
|
43559
|
-
this.F = F | 0;
|
43560
|
-
this.G = G | 0;
|
43561
|
-
this.H = H | 0;
|
43562
|
-
}
|
43563
|
-
process(view, offset) {
|
43564
|
-
for (let i = 0; i < 16; i++, offset += 4)
|
43565
|
-
SHA256_W2[i] = view.getUint32(offset, false);
|
43566
|
-
for (let i = 16; i < 64; i++) {
|
43567
|
-
const W15 = SHA256_W2[i - 15];
|
43568
|
-
const W2 = SHA256_W2[i - 2];
|
43569
|
-
const s0 = rotr2(W15, 7) ^ rotr2(W15, 18) ^ W15 >>> 3;
|
43570
|
-
const s1 = rotr2(W2, 17) ^ rotr2(W2, 19) ^ W2 >>> 10;
|
43571
|
-
SHA256_W2[i] = s1 + SHA256_W2[i - 7] + s0 + SHA256_W2[i - 16] | 0;
|
43572
|
-
}
|
43573
|
-
let { A, B, C, D, E, F, G, H } = this;
|
43574
|
-
for (let i = 0; i < 64; i++) {
|
43575
|
-
const sigma1 = rotr2(E, 6) ^ rotr2(E, 11) ^ rotr2(E, 25);
|
43576
|
-
const T1 = H + sigma1 + Chi2(E, F, G) + SHA256_K2[i] + SHA256_W2[i] | 0;
|
43577
|
-
const sigma0 = rotr2(A, 2) ^ rotr2(A, 13) ^ rotr2(A, 22);
|
43578
|
-
const T2 = sigma0 + Maj2(A, B, C) | 0;
|
43579
|
-
H = G;
|
43580
|
-
G = F;
|
43581
|
-
F = E;
|
43582
|
-
E = D + T1 | 0;
|
43583
|
-
D = C;
|
43584
|
-
C = B;
|
43585
|
-
B = A;
|
43586
|
-
A = T1 + T2 | 0;
|
43587
|
-
}
|
43588
|
-
A = A + this.A | 0;
|
43589
|
-
B = B + this.B | 0;
|
43590
|
-
C = C + this.C | 0;
|
43591
|
-
D = D + this.D | 0;
|
43592
|
-
E = E + this.E | 0;
|
43593
|
-
F = F + this.F | 0;
|
43594
|
-
G = G + this.G | 0;
|
43595
|
-
H = H + this.H | 0;
|
43596
|
-
this.set(A, B, C, D, E, F, G, H);
|
43597
|
-
}
|
43598
|
-
roundClean() {
|
43599
|
-
SHA256_W2.fill(0);
|
43600
|
-
}
|
43601
|
-
destroy() {
|
43602
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
43603
|
-
this.buffer.fill(0);
|
43604
|
-
}
|
43605
|
-
};
|
43606
|
-
var sha2563 = /* @__PURE__ */ wrapConstructor2(() => new SHA2562());
|
43607
|
-
|
43608
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/hmac.js
|
43609
|
-
var HMAC2 = class extends Hash2 {
|
43610
|
-
constructor(hash4, _key) {
|
43611
|
-
super();
|
43612
|
-
this.finished = false;
|
43613
|
-
this.destroyed = false;
|
43614
|
-
hash3(hash4);
|
43615
|
-
const key = toBytes3(_key);
|
43616
|
-
this.iHash = hash4.create();
|
43617
|
-
if (typeof this.iHash.update !== "function")
|
43618
|
-
throw new Error("Expected instance of class which extends utils.Hash");
|
43619
|
-
this.blockLen = this.iHash.blockLen;
|
43620
|
-
this.outputLen = this.iHash.outputLen;
|
43621
|
-
const blockLen = this.blockLen;
|
43622
|
-
const pad = new Uint8Array(blockLen);
|
43623
|
-
pad.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
|
43624
|
-
for (let i = 0; i < pad.length; i++)
|
43625
|
-
pad[i] ^= 54;
|
43626
|
-
this.iHash.update(pad);
|
43627
|
-
this.oHash = hash4.create();
|
43628
|
-
for (let i = 0; i < pad.length; i++)
|
43629
|
-
pad[i] ^= 54 ^ 92;
|
43630
|
-
this.oHash.update(pad);
|
43631
|
-
pad.fill(0);
|
43632
|
-
}
|
43633
|
-
update(buf) {
|
43634
|
-
exists2(this);
|
43635
|
-
this.iHash.update(buf);
|
43636
|
-
return this;
|
43637
|
-
}
|
43638
|
-
digestInto(out) {
|
43639
|
-
exists2(this);
|
43640
|
-
bytes2(out, this.outputLen);
|
43641
|
-
this.finished = true;
|
43642
|
-
this.iHash.digestInto(out);
|
43643
|
-
this.oHash.update(out);
|
43644
|
-
this.oHash.digestInto(out);
|
43645
|
-
this.destroy();
|
43646
|
-
}
|
43647
|
-
digest() {
|
43648
|
-
const out = new Uint8Array(this.oHash.outputLen);
|
43649
|
-
this.digestInto(out);
|
43650
|
-
return out;
|
43651
|
-
}
|
43652
|
-
_cloneInto(to) {
|
43653
|
-
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
43654
|
-
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
43655
|
-
to = to;
|
43656
|
-
to.finished = finished;
|
43657
|
-
to.destroyed = destroyed;
|
43658
|
-
to.blockLen = blockLen;
|
43659
|
-
to.outputLen = outputLen;
|
43660
|
-
to.oHash = oHash._cloneInto(to.oHash);
|
43661
|
-
to.iHash = iHash._cloneInto(to.iHash);
|
43662
|
-
return to;
|
43663
|
-
}
|
43664
|
-
destroy() {
|
43665
|
-
this.destroyed = true;
|
43666
|
-
this.oHash.destroy();
|
43667
|
-
this.iHash.destroy();
|
43668
|
-
}
|
43669
|
-
};
|
43670
|
-
var hmac2 = (hash4, key, message) => new HMAC2(hash4, key).update(message).digest();
|
43671
|
-
hmac2.create = (hash4, key) => new HMAC2(hash4, key);
|
43672
|
-
|
43673
|
-
// ../../node_modules/.pnpm/@noble+curves@1.4.2/node_modules/@noble/curves/esm/abstract/modular.js
|
44091
|
+
// ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/abstract/modular.js
|
43674
44092
|
var _0n3 = BigInt(0);
|
43675
44093
|
var _1n3 = BigInt(1);
|
43676
44094
|
var _2n3 = BigInt(2);
|
@@ -43706,11 +44124,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43706
44124
|
}
|
43707
44125
|
return res;
|
43708
44126
|
}
|
43709
|
-
function invert(
|
43710
|
-
if (
|
43711
|
-
throw new Error(`invert: expected positive integers, got n=${
|
44127
|
+
function invert(number2, modulo) {
|
44128
|
+
if (number2 === _0n3 || modulo <= _0n3) {
|
44129
|
+
throw new Error(`invert: expected positive integers, got n=${number2} mod=${modulo}`);
|
43712
44130
|
}
|
43713
|
-
let a = mod(
|
44131
|
+
let a = mod(number2, modulo);
|
43714
44132
|
let b = modulo;
|
43715
44133
|
let x = _0n3, y = _1n3, u = _1n3, v = _0n3;
|
43716
44134
|
while (a !== _0n3) {
|
@@ -43865,7 +44283,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43865
44283
|
const nByteLength = Math.ceil(_nBitLength / 8);
|
43866
44284
|
return { nBitLength: _nBitLength, nByteLength };
|
43867
44285
|
}
|
43868
|
-
function Field(ORDER, bitLen2,
|
44286
|
+
function Field(ORDER, bitLen2, isLE2 = false, redef = {}) {
|
43869
44287
|
if (ORDER <= _0n3)
|
43870
44288
|
throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
|
43871
44289
|
const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
|
@@ -43906,11 +44324,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43906
44324
|
// TODO: do we really need constant cmov?
|
43907
44325
|
// We don't have const-time bigints anyway, so probably will be not very useful
|
43908
44326
|
cmov: (a, b, c) => c ? b : a,
|
43909
|
-
toBytes: (num) =>
|
43910
|
-
fromBytes: (
|
43911
|
-
if (
|
43912
|
-
throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${
|
43913
|
-
return
|
44327
|
+
toBytes: (num) => isLE2 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
|
44328
|
+
fromBytes: (bytes2) => {
|
44329
|
+
if (bytes2.length !== BYTES)
|
44330
|
+
throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes2.length}`);
|
44331
|
+
return isLE2 ? bytesToNumberLE(bytes2) : bytesToNumberBE(bytes2);
|
43914
44332
|
}
|
43915
44333
|
});
|
43916
44334
|
return Object.freeze(f2);
|
@@ -43925,26 +44343,33 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43925
44343
|
const length = getFieldBytesLength(fieldOrder);
|
43926
44344
|
return length + Math.ceil(length / 2);
|
43927
44345
|
}
|
43928
|
-
function mapHashToField(key, fieldOrder,
|
44346
|
+
function mapHashToField(key, fieldOrder, isLE2 = false) {
|
43929
44347
|
const len = key.length;
|
43930
44348
|
const fieldLen = getFieldBytesLength(fieldOrder);
|
43931
44349
|
const minLen = getMinHashLength(fieldOrder);
|
43932
44350
|
if (len < 16 || len < minLen || len > 1024)
|
43933
44351
|
throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
|
43934
|
-
const num =
|
44352
|
+
const num = isLE2 ? bytesToNumberBE(key) : bytesToNumberLE(key);
|
43935
44353
|
const reduced = mod(num, fieldOrder - _1n3) + _1n3;
|
43936
|
-
return
|
44354
|
+
return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
|
43937
44355
|
}
|
43938
44356
|
|
43939
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
44357
|
+
// ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/abstract/curve.js
|
43940
44358
|
var _0n4 = BigInt(0);
|
43941
44359
|
var _1n4 = BigInt(1);
|
44360
|
+
var pointPrecomputes = /* @__PURE__ */ new WeakMap();
|
44361
|
+
var pointWindowSizes = /* @__PURE__ */ new WeakMap();
|
43942
44362
|
function wNAF(c, bits) {
|
43943
44363
|
const constTimeNegate = (condition, item) => {
|
43944
44364
|
const neg = item.negate();
|
43945
44365
|
return condition ? neg : item;
|
43946
44366
|
};
|
44367
|
+
const validateW = (W) => {
|
44368
|
+
if (!Number.isSafeInteger(W) || W <= 0 || W > bits)
|
44369
|
+
throw new Error(`Wrong window size=${W}, should be [1..${bits}]`);
|
44370
|
+
};
|
43947
44371
|
const opts = (W) => {
|
44372
|
+
validateW(W);
|
43948
44373
|
const windows = Math.ceil(bits / W) + 1;
|
43949
44374
|
const windowSize = 2 ** (W - 1);
|
43950
44375
|
return { windows, windowSize };
|
@@ -44023,19 +44448,62 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44023
44448
|
}
|
44024
44449
|
return { p, f: f2 };
|
44025
44450
|
},
|
44026
|
-
wNAFCached(P,
|
44027
|
-
const W = P
|
44028
|
-
let comp =
|
44451
|
+
wNAFCached(P, n, transform) {
|
44452
|
+
const W = pointWindowSizes.get(P) || 1;
|
44453
|
+
let comp = pointPrecomputes.get(P);
|
44029
44454
|
if (!comp) {
|
44030
44455
|
comp = this.precomputeWindow(P, W);
|
44031
|
-
if (W !== 1)
|
44032
|
-
|
44033
|
-
}
|
44456
|
+
if (W !== 1)
|
44457
|
+
pointPrecomputes.set(P, transform(comp));
|
44034
44458
|
}
|
44035
44459
|
return this.wNAF(W, comp, n);
|
44460
|
+
},
|
44461
|
+
// We calculate precomputes for elliptic curve point multiplication
|
44462
|
+
// using windowed method. This specifies window size and
|
44463
|
+
// stores precomputed values. Usually only base point would be precomputed.
|
44464
|
+
setWindowSize(P, W) {
|
44465
|
+
validateW(W);
|
44466
|
+
pointWindowSizes.set(P, W);
|
44467
|
+
pointPrecomputes.delete(P);
|
44036
44468
|
}
|
44037
44469
|
};
|
44038
44470
|
}
|
44471
|
+
function pippenger(c, field, points, scalars) {
|
44472
|
+
if (!Array.isArray(points) || !Array.isArray(scalars) || scalars.length !== points.length)
|
44473
|
+
throw new Error("arrays of points and scalars must have equal length");
|
44474
|
+
scalars.forEach((s, i) => {
|
44475
|
+
if (!field.isValid(s))
|
44476
|
+
throw new Error(`wrong scalar at index ${i}`);
|
44477
|
+
});
|
44478
|
+
points.forEach((p, i) => {
|
44479
|
+
if (!(p instanceof c))
|
44480
|
+
throw new Error(`wrong point at index ${i}`);
|
44481
|
+
});
|
44482
|
+
const wbits = bitLen(BigInt(points.length));
|
44483
|
+
const windowSize = wbits > 12 ? wbits - 3 : wbits > 4 ? wbits - 2 : wbits ? 2 : 1;
|
44484
|
+
const MASK = (1 << windowSize) - 1;
|
44485
|
+
const buckets = new Array(MASK + 1).fill(c.ZERO);
|
44486
|
+
const lastBits = Math.floor((field.BITS - 1) / windowSize) * windowSize;
|
44487
|
+
let sum = c.ZERO;
|
44488
|
+
for (let i = lastBits; i >= 0; i -= windowSize) {
|
44489
|
+
buckets.fill(c.ZERO);
|
44490
|
+
for (let j = 0; j < scalars.length; j++) {
|
44491
|
+
const scalar = scalars[j];
|
44492
|
+
const wbits2 = Number(scalar >> BigInt(i) & BigInt(MASK));
|
44493
|
+
buckets[wbits2] = buckets[wbits2].add(points[j]);
|
44494
|
+
}
|
44495
|
+
let resI = c.ZERO;
|
44496
|
+
for (let j = buckets.length - 1, sumI = c.ZERO; j > 0; j--) {
|
44497
|
+
sumI = sumI.add(buckets[j]);
|
44498
|
+
resI = resI.add(sumI);
|
44499
|
+
}
|
44500
|
+
sum = sum.add(resI);
|
44501
|
+
if (i !== 0)
|
44502
|
+
for (let j = 0; j < windowSize; j++)
|
44503
|
+
sum = sum.double();
|
44504
|
+
}
|
44505
|
+
return sum;
|
44506
|
+
}
|
44039
44507
|
function validateBasic(curve) {
|
44040
44508
|
validateField(curve.Fp);
|
44041
44509
|
validateObject(curve, {
|
@@ -44054,7 +44522,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44054
44522
|
});
|
44055
44523
|
}
|
44056
44524
|
|
44057
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
44525
|
+
// ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/abstract/weierstrass.js
|
44526
|
+
function validateSigVerOpts(opts) {
|
44527
|
+
if (opts.lowS !== void 0)
|
44528
|
+
abool("lowS", opts.lowS);
|
44529
|
+
if (opts.prehash !== void 0)
|
44530
|
+
abool("prehash", opts.prehash);
|
44531
|
+
}
|
44058
44532
|
function validatePointOpts(curve) {
|
44059
44533
|
const opts = validateBasic(curve);
|
44060
44534
|
validateObject(opts, {
|
@@ -44088,48 +44562,99 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44088
44562
|
super(m);
|
44089
44563
|
}
|
44090
44564
|
},
|
44091
|
-
|
44092
|
-
|
44093
|
-
|
44094
|
-
|
44095
|
-
|
44096
|
-
|
44097
|
-
|
44098
|
-
|
44099
|
-
|
44100
|
-
|
44101
|
-
|
44102
|
-
|
44103
|
-
|
44565
|
+
// Basic building block is TLV (Tag-Length-Value)
|
44566
|
+
_tlv: {
|
44567
|
+
encode: (tag, data) => {
|
44568
|
+
const { Err: E } = DER;
|
44569
|
+
if (tag < 0 || tag > 256)
|
44570
|
+
throw new E("tlv.encode: wrong tag");
|
44571
|
+
if (data.length & 1)
|
44572
|
+
throw new E("tlv.encode: unpadded data");
|
44573
|
+
const dataLen = data.length / 2;
|
44574
|
+
const len = numberToHexUnpadded(dataLen);
|
44575
|
+
if (len.length / 2 & 128)
|
44576
|
+
throw new E("tlv.encode: long form length too big");
|
44577
|
+
const lenLen = dataLen > 127 ? numberToHexUnpadded(len.length / 2 | 128) : "";
|
44578
|
+
return `${numberToHexUnpadded(tag)}${lenLen}${len}${data}`;
|
44579
|
+
},
|
44580
|
+
// v - value, l - left bytes (unparsed)
|
44581
|
+
decode(tag, data) {
|
44582
|
+
const { Err: E } = DER;
|
44583
|
+
let pos = 0;
|
44584
|
+
if (tag < 0 || tag > 256)
|
44585
|
+
throw new E("tlv.encode: wrong tag");
|
44586
|
+
if (data.length < 2 || data[pos++] !== tag)
|
44587
|
+
throw new E("tlv.decode: wrong tlv");
|
44588
|
+
const first = data[pos++];
|
44589
|
+
const isLong = !!(first & 128);
|
44590
|
+
let length = 0;
|
44591
|
+
if (!isLong)
|
44592
|
+
length = first;
|
44593
|
+
else {
|
44594
|
+
const lenLen = first & 127;
|
44595
|
+
if (!lenLen)
|
44596
|
+
throw new E("tlv.decode(long): indefinite length not supported");
|
44597
|
+
if (lenLen > 4)
|
44598
|
+
throw new E("tlv.decode(long): byte length is too big");
|
44599
|
+
const lengthBytes = data.subarray(pos, pos + lenLen);
|
44600
|
+
if (lengthBytes.length !== lenLen)
|
44601
|
+
throw new E("tlv.decode: length bytes not complete");
|
44602
|
+
if (lengthBytes[0] === 0)
|
44603
|
+
throw new E("tlv.decode(long): zero leftmost byte");
|
44604
|
+
for (const b of lengthBytes)
|
44605
|
+
length = length << 8 | b;
|
44606
|
+
pos += lenLen;
|
44607
|
+
if (length < 128)
|
44608
|
+
throw new E("tlv.decode(long): not minimal encoding");
|
44609
|
+
}
|
44610
|
+
const v = data.subarray(pos, pos + length);
|
44611
|
+
if (v.length !== length)
|
44612
|
+
throw new E("tlv.decode: wrong value length");
|
44613
|
+
return { v, l: data.subarray(pos + length) };
|
44614
|
+
}
|
44615
|
+
},
|
44616
|
+
// https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
|
44617
|
+
// since we always use positive integers here. It must always be empty:
|
44618
|
+
// - add zero byte if exists
|
44619
|
+
// - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
|
44620
|
+
_int: {
|
44621
|
+
encode(num) {
|
44622
|
+
const { Err: E } = DER;
|
44623
|
+
if (num < _0n5)
|
44624
|
+
throw new E("integer: negative integers are not allowed");
|
44625
|
+
let hex = numberToHexUnpadded(num);
|
44626
|
+
if (Number.parseInt(hex[0], 16) & 8)
|
44627
|
+
hex = "00" + hex;
|
44628
|
+
if (hex.length & 1)
|
44629
|
+
throw new E("unexpected assertion");
|
44630
|
+
return hex;
|
44631
|
+
},
|
44632
|
+
decode(data) {
|
44633
|
+
const { Err: E } = DER;
|
44634
|
+
if (data[0] & 128)
|
44635
|
+
throw new E("Invalid signature integer: negative");
|
44636
|
+
if (data[0] === 0 && !(data[1] & 128))
|
44637
|
+
throw new E("Invalid signature integer: unnecessary leading zero");
|
44638
|
+
return b2n(data);
|
44639
|
+
}
|
44104
44640
|
},
|
44105
44641
|
toSig(hex) {
|
44106
|
-
const { Err: E } = DER;
|
44642
|
+
const { Err: E, _int: int, _tlv: tlv } = DER;
|
44107
44643
|
const data = typeof hex === "string" ? h2b(hex) : hex;
|
44108
44644
|
abytes(data);
|
44109
|
-
|
44110
|
-
if (
|
44111
|
-
throw new E("Invalid signature
|
44112
|
-
|
44113
|
-
|
44114
|
-
|
44115
|
-
const { d: s, l: rBytesLeft } = DER._parseInt(sBytes);
|
44116
|
-
if (rBytesLeft.length)
|
44645
|
+
const { v: seqBytes, l: seqLeftBytes } = tlv.decode(48, data);
|
44646
|
+
if (seqLeftBytes.length)
|
44647
|
+
throw new E("Invalid signature: left bytes after parsing");
|
44648
|
+
const { v: rBytes, l: rLeftBytes } = tlv.decode(2, seqBytes);
|
44649
|
+
const { v: sBytes, l: sLeftBytes } = tlv.decode(2, rLeftBytes);
|
44650
|
+
if (sLeftBytes.length)
|
44117
44651
|
throw new E("Invalid signature: left bytes after parsing");
|
44118
|
-
return { r, s };
|
44652
|
+
return { r: int.decode(rBytes), s: int.decode(sBytes) };
|
44119
44653
|
},
|
44120
44654
|
hexFromSig(sig) {
|
44121
|
-
const
|
44122
|
-
const
|
44123
|
-
|
44124
|
-
return hex.length & 1 ? `0${hex}` : hex;
|
44125
|
-
};
|
44126
|
-
const s = slice(h(sig.s));
|
44127
|
-
const r = slice(h(sig.r));
|
44128
|
-
const shl = s.length / 2;
|
44129
|
-
const rhl = r.length / 2;
|
44130
|
-
const sl = h(shl);
|
44131
|
-
const rl = h(rhl);
|
44132
|
-
return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;
|
44655
|
+
const { _tlv: tlv, _int: int } = DER;
|
44656
|
+
const seq = `${tlv.encode(2, int.encode(sig.r))}${tlv.encode(2, int.encode(sig.s))}`;
|
44657
|
+
return tlv.encode(48, seq);
|
44133
44658
|
}
|
44134
44659
|
};
|
44135
44660
|
var _0n5 = BigInt(0);
|
@@ -44140,12 +44665,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44140
44665
|
function weierstrassPoints(opts) {
|
44141
44666
|
const CURVE = validatePointOpts(opts);
|
44142
44667
|
const { Fp: Fp2 } = CURVE;
|
44143
|
-
const
|
44668
|
+
const Fn = Field(CURVE.n, CURVE.nBitLength);
|
44669
|
+
const toBytes3 = CURVE.toBytes || ((_c, point, _isCompressed) => {
|
44144
44670
|
const a = point.toAffine();
|
44145
|
-
return
|
44671
|
+
return concatBytes3(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
|
44146
44672
|
});
|
44147
|
-
const fromBytes = CURVE.fromBytes || ((
|
44148
|
-
const tail =
|
44673
|
+
const fromBytes = CURVE.fromBytes || ((bytes2) => {
|
44674
|
+
const tail = bytes2.subarray(1);
|
44149
44675
|
const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES));
|
44150
44676
|
const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES));
|
44151
44677
|
return { x, y };
|
@@ -44159,16 +44685,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44159
44685
|
if (!Fp2.eql(Fp2.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))
|
44160
44686
|
throw new Error("bad generator point: equation left != right");
|
44161
44687
|
function isWithinCurveOrder(num) {
|
44162
|
-
return
|
44163
|
-
}
|
44164
|
-
function assertGE(num) {
|
44165
|
-
if (!isWithinCurveOrder(num))
|
44166
|
-
throw new Error("Expected valid bigint: 0 < bigint < curve.n");
|
44688
|
+
return inRange(num, _1n5, CURVE.n);
|
44167
44689
|
}
|
44168
44690
|
function normPrivateKeyToScalar(key) {
|
44169
|
-
const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE;
|
44691
|
+
const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: N } = CURVE;
|
44170
44692
|
if (lengths && typeof key !== "bigint") {
|
44171
|
-
if (
|
44693
|
+
if (isBytes2(key))
|
44172
44694
|
key = bytesToHex(key);
|
44173
44695
|
if (typeof key !== "string" || !lengths.includes(key.length))
|
44174
44696
|
throw new Error("Invalid key");
|
@@ -44181,15 +44703,47 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44181
44703
|
throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);
|
44182
44704
|
}
|
44183
44705
|
if (wrapPrivateKey)
|
44184
|
-
num = mod(num,
|
44185
|
-
|
44706
|
+
num = mod(num, N);
|
44707
|
+
aInRange("private key", num, _1n5, N);
|
44186
44708
|
return num;
|
44187
44709
|
}
|
44188
|
-
const pointPrecomputes = /* @__PURE__ */ new Map();
|
44189
44710
|
function assertPrjPoint(other) {
|
44190
44711
|
if (!(other instanceof Point2))
|
44191
44712
|
throw new Error("ProjectivePoint expected");
|
44192
44713
|
}
|
44714
|
+
const toAffineMemo = memoized((p, iz) => {
|
44715
|
+
const { px: x, py: y, pz: z } = p;
|
44716
|
+
if (Fp2.eql(z, Fp2.ONE))
|
44717
|
+
return { x, y };
|
44718
|
+
const is0 = p.is0();
|
44719
|
+
if (iz == null)
|
44720
|
+
iz = is0 ? Fp2.ONE : Fp2.inv(z);
|
44721
|
+
const ax = Fp2.mul(x, iz);
|
44722
|
+
const ay = Fp2.mul(y, iz);
|
44723
|
+
const zz = Fp2.mul(z, iz);
|
44724
|
+
if (is0)
|
44725
|
+
return { x: Fp2.ZERO, y: Fp2.ZERO };
|
44726
|
+
if (!Fp2.eql(zz, Fp2.ONE))
|
44727
|
+
throw new Error("invZ was invalid");
|
44728
|
+
return { x: ax, y: ay };
|
44729
|
+
});
|
44730
|
+
const assertValidMemo = memoized((p) => {
|
44731
|
+
if (p.is0()) {
|
44732
|
+
if (CURVE.allowInfinityPoint && !Fp2.is0(p.py))
|
44733
|
+
return;
|
44734
|
+
throw new Error("bad point: ZERO");
|
44735
|
+
}
|
44736
|
+
const { x, y } = p.toAffine();
|
44737
|
+
if (!Fp2.isValid(x) || !Fp2.isValid(y))
|
44738
|
+
throw new Error("bad point: x or y not FE");
|
44739
|
+
const left = Fp2.sqr(y);
|
44740
|
+
const right = weierstrassEquation(x);
|
44741
|
+
if (!Fp2.eql(left, right))
|
44742
|
+
throw new Error("bad point: equation left != right");
|
44743
|
+
if (!p.isTorsionFree())
|
44744
|
+
throw new Error("bad point: not in prime-order subgroup");
|
44745
|
+
return true;
|
44746
|
+
});
|
44193
44747
|
class Point2 {
|
44194
44748
|
constructor(px, py, pz) {
|
44195
44749
|
this.px = px;
|
@@ -44201,6 +44755,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44201
44755
|
throw new Error("y required");
|
44202
44756
|
if (pz == null || !Fp2.isValid(pz))
|
44203
44757
|
throw new Error("z required");
|
44758
|
+
Object.freeze(this);
|
44204
44759
|
}
|
44205
44760
|
// Does not validate if the point is on-curve.
|
44206
44761
|
// Use fromHex instead, or call assertValidity() later.
|
@@ -44244,27 +44799,17 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44244
44799
|
static fromPrivateKey(privateKey) {
|
44245
44800
|
return Point2.BASE.multiply(normPrivateKeyToScalar(privateKey));
|
44246
44801
|
}
|
44802
|
+
// Multiscalar Multiplication
|
44803
|
+
static msm(points, scalars) {
|
44804
|
+
return pippenger(Point2, Fn, points, scalars);
|
44805
|
+
}
|
44247
44806
|
// "Private method", don't use it directly
|
44248
44807
|
_setWindowSize(windowSize) {
|
44249
|
-
this
|
44250
|
-
pointPrecomputes.delete(this);
|
44808
|
+
wnaf.setWindowSize(this, windowSize);
|
44251
44809
|
}
|
44252
44810
|
// A point on curve is valid if it conforms to equation.
|
44253
44811
|
assertValidity() {
|
44254
|
-
|
44255
|
-
if (CURVE.allowInfinityPoint && !Fp2.is0(this.py))
|
44256
|
-
return;
|
44257
|
-
throw new Error("bad point: ZERO");
|
44258
|
-
}
|
44259
|
-
const { x, y } = this.toAffine();
|
44260
|
-
if (!Fp2.isValid(x) || !Fp2.isValid(y))
|
44261
|
-
throw new Error("bad point: x or y not FE");
|
44262
|
-
const left = Fp2.sqr(y);
|
44263
|
-
const right = weierstrassEquation(x);
|
44264
|
-
if (!Fp2.eql(left, right))
|
44265
|
-
throw new Error("bad point: equation left != right");
|
44266
|
-
if (!this.isTorsionFree())
|
44267
|
-
throw new Error("bad point: not in prime-order subgroup");
|
44812
|
+
assertValidMemo(this);
|
44268
44813
|
}
|
44269
44814
|
hasEvenY() {
|
44270
44815
|
const { y } = this.toAffine();
|
@@ -44391,27 +44936,24 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44391
44936
|
return this.equals(Point2.ZERO);
|
44392
44937
|
}
|
44393
44938
|
wNAF(n) {
|
44394
|
-
return wnaf.wNAFCached(this,
|
44395
|
-
const toInv = Fp2.invertBatch(comp.map((p) => p.pz));
|
44396
|
-
return comp.map((p, i) => p.toAffine(toInv[i])).map(Point2.fromAffine);
|
44397
|
-
});
|
44939
|
+
return wnaf.wNAFCached(this, n, Point2.normalizeZ);
|
44398
44940
|
}
|
44399
44941
|
/**
|
44400
44942
|
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
44401
44943
|
* It's faster, but should only be used when you don't care about
|
44402
44944
|
* an exposed private key e.g. sig verification, which works over *public* keys.
|
44403
44945
|
*/
|
44404
|
-
multiplyUnsafe(
|
44946
|
+
multiplyUnsafe(sc) {
|
44947
|
+
aInRange("scalar", sc, _0n5, CURVE.n);
|
44405
44948
|
const I = Point2.ZERO;
|
44406
|
-
if (
|
44949
|
+
if (sc === _0n5)
|
44407
44950
|
return I;
|
44408
|
-
|
44409
|
-
if (n === _1n5)
|
44951
|
+
if (sc === _1n5)
|
44410
44952
|
return this;
|
44411
44953
|
const { endo } = CURVE;
|
44412
44954
|
if (!endo)
|
44413
|
-
return wnaf.unsafeLadder(this,
|
44414
|
-
let { k1neg, k1, k2neg, k2 } = endo.splitScalar(
|
44955
|
+
return wnaf.unsafeLadder(this, sc);
|
44956
|
+
let { k1neg, k1, k2neg, k2 } = endo.splitScalar(sc);
|
44415
44957
|
let k1p = I;
|
44416
44958
|
let k2p = I;
|
44417
44959
|
let d = this;
|
@@ -44441,12 +44983,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44441
44983
|
* @returns New point
|
44442
44984
|
*/
|
44443
44985
|
multiply(scalar) {
|
44444
|
-
|
44445
|
-
|
44986
|
+
const { endo, n: N } = CURVE;
|
44987
|
+
aInRange("scalar", scalar, _1n5, N);
|
44446
44988
|
let point, fake;
|
44447
|
-
const { endo } = CURVE;
|
44448
44989
|
if (endo) {
|
44449
|
-
const { k1neg, k1, k2neg, k2 } = endo.splitScalar(
|
44990
|
+
const { k1neg, k1, k2neg, k2 } = endo.splitScalar(scalar);
|
44450
44991
|
let { p: k1p, f: f1p } = this.wNAF(k1);
|
44451
44992
|
let { p: k2p, f: f2p } = this.wNAF(k2);
|
44452
44993
|
k1p = wnaf.constTimeNegate(k1neg, k1p);
|
@@ -44455,7 +44996,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44455
44996
|
point = k1p.add(k2p);
|
44456
44997
|
fake = f1p.add(f2p);
|
44457
44998
|
} else {
|
44458
|
-
const { p, f: f2 } = this.wNAF(
|
44999
|
+
const { p, f: f2 } = this.wNAF(scalar);
|
44459
45000
|
point = p;
|
44460
45001
|
fake = f2;
|
44461
45002
|
}
|
@@ -44477,18 +45018,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44477
45018
|
// Can accept precomputed Z^-1 - for example, from invertBatch.
|
44478
45019
|
// (x, y, z) ∋ (x=x/z, y=y/z)
|
44479
45020
|
toAffine(iz) {
|
44480
|
-
|
44481
|
-
const is0 = this.is0();
|
44482
|
-
if (iz == null)
|
44483
|
-
iz = is0 ? Fp2.ONE : Fp2.inv(z);
|
44484
|
-
const ax = Fp2.mul(x, iz);
|
44485
|
-
const ay = Fp2.mul(y, iz);
|
44486
|
-
const zz = Fp2.mul(z, iz);
|
44487
|
-
if (is0)
|
44488
|
-
return { x: Fp2.ZERO, y: Fp2.ZERO };
|
44489
|
-
if (!Fp2.eql(zz, Fp2.ONE))
|
44490
|
-
throw new Error("invZ was invalid");
|
44491
|
-
return { x: ax, y: ay };
|
45021
|
+
return toAffineMemo(this, iz);
|
44492
45022
|
}
|
44493
45023
|
isTorsionFree() {
|
44494
45024
|
const { h: cofactor, isTorsionFree } = CURVE;
|
@@ -44507,10 +45037,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44507
45037
|
return this.multiplyUnsafe(CURVE.h);
|
44508
45038
|
}
|
44509
45039
|
toRawBytes(isCompressed = true) {
|
45040
|
+
abool("isCompressed", isCompressed);
|
44510
45041
|
this.assertValidity();
|
44511
|
-
return
|
45042
|
+
return toBytes3(Point2, this, isCompressed);
|
44512
45043
|
}
|
44513
45044
|
toHex(isCompressed = true) {
|
45045
|
+
abool("isCompressed", isCompressed);
|
44514
45046
|
return bytesToHex(this.toRawBytes(isCompressed));
|
44515
45047
|
}
|
44516
45048
|
}
|
@@ -44544,9 +45076,6 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44544
45076
|
const { Fp: Fp2, n: CURVE_ORDER } = CURVE;
|
44545
45077
|
const compressedLen = Fp2.BYTES + 1;
|
44546
45078
|
const uncompressedLen = 2 * Fp2.BYTES + 1;
|
44547
|
-
function isValidFieldElement(num) {
|
44548
|
-
return _0n5 < num && num < Fp2.ORDER;
|
44549
|
-
}
|
44550
45079
|
function modN(a) {
|
44551
45080
|
return mod(a, CURVE_ORDER);
|
44552
45081
|
}
|
@@ -44558,20 +45087,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44558
45087
|
toBytes(_c, point, isCompressed) {
|
44559
45088
|
const a = point.toAffine();
|
44560
45089
|
const x = Fp2.toBytes(a.x);
|
44561
|
-
const cat =
|
45090
|
+
const cat = concatBytes3;
|
45091
|
+
abool("isCompressed", isCompressed);
|
44562
45092
|
if (isCompressed) {
|
44563
45093
|
return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x);
|
44564
45094
|
} else {
|
44565
45095
|
return cat(Uint8Array.from([4]), x, Fp2.toBytes(a.y));
|
44566
45096
|
}
|
44567
45097
|
},
|
44568
|
-
fromBytes(
|
44569
|
-
const len =
|
44570
|
-
const head =
|
44571
|
-
const tail =
|
45098
|
+
fromBytes(bytes2) {
|
45099
|
+
const len = bytes2.length;
|
45100
|
+
const head = bytes2[0];
|
45101
|
+
const tail = bytes2.subarray(1);
|
44572
45102
|
if (len === compressedLen && (head === 2 || head === 3)) {
|
44573
45103
|
const x = bytesToNumberBE(tail);
|
44574
|
-
if (!
|
45104
|
+
if (!inRange(x, _1n5, Fp2.ORDER))
|
44575
45105
|
throw new Error("Point is not on curve");
|
44576
45106
|
const y2 = weierstrassEquation(x);
|
44577
45107
|
let y;
|
@@ -44596,9 +45126,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44596
45126
|
}
|
44597
45127
|
});
|
44598
45128
|
const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
|
44599
|
-
function isBiggerThanHalfOrder(
|
45129
|
+
function isBiggerThanHalfOrder(number2) {
|
44600
45130
|
const HALF = CURVE_ORDER >> _1n5;
|
44601
|
-
return
|
45131
|
+
return number2 > HALF;
|
44602
45132
|
}
|
44603
45133
|
function normalizeS(s) {
|
44604
45134
|
return isBiggerThanHalfOrder(s) ? modN(-s) : s;
|
@@ -44624,10 +45154,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44624
45154
|
return new Signature(r, s);
|
44625
45155
|
}
|
44626
45156
|
assertValidity() {
|
44627
|
-
|
44628
|
-
|
44629
|
-
if (!isWithinCurveOrder(this.s))
|
44630
|
-
throw new Error("s must be 0 < s < CURVE.n");
|
45157
|
+
aInRange("r", this.r, _1n5, CURVE_ORDER);
|
45158
|
+
aInRange("s", this.s, _1n5, CURVE_ORDER);
|
44631
45159
|
}
|
44632
45160
|
addRecoveryBit(recovery) {
|
44633
45161
|
return new Signature(this.r, this.s, recovery);
|
@@ -44709,7 +45237,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44709
45237
|
return Point2.fromPrivateKey(privateKey).toRawBytes(isCompressed);
|
44710
45238
|
}
|
44711
45239
|
function isProbPub(item) {
|
44712
|
-
const arr =
|
45240
|
+
const arr = isBytes2(item);
|
44713
45241
|
const str = typeof item === "string";
|
44714
45242
|
const len = (arr || str) && item.length;
|
44715
45243
|
if (arr)
|
@@ -44728,40 +45256,38 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44728
45256
|
const b = Point2.fromHex(publicB);
|
44729
45257
|
return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
|
44730
45258
|
}
|
44731
|
-
const bits2int = CURVE.bits2int || function(
|
44732
|
-
const num = bytesToNumberBE(
|
44733
|
-
const delta =
|
45259
|
+
const bits2int = CURVE.bits2int || function(bytes2) {
|
45260
|
+
const num = bytesToNumberBE(bytes2);
|
45261
|
+
const delta = bytes2.length * 8 - CURVE.nBitLength;
|
44734
45262
|
return delta > 0 ? num >> BigInt(delta) : num;
|
44735
45263
|
};
|
44736
|
-
const bits2int_modN = CURVE.bits2int_modN || function(
|
44737
|
-
return modN(bits2int(
|
45264
|
+
const bits2int_modN = CURVE.bits2int_modN || function(bytes2) {
|
45265
|
+
return modN(bits2int(bytes2));
|
44738
45266
|
};
|
44739
45267
|
const ORDER_MASK = bitMask(CURVE.nBitLength);
|
44740
45268
|
function int2octets(num) {
|
44741
|
-
|
44742
|
-
throw new Error("bigint expected");
|
44743
|
-
if (!(_0n5 <= num && num < ORDER_MASK))
|
44744
|
-
throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);
|
45269
|
+
aInRange(`num < 2^${CURVE.nBitLength}`, num, _0n5, ORDER_MASK);
|
44745
45270
|
return numberToBytesBE(num, CURVE.nByteLength);
|
44746
45271
|
}
|
44747
45272
|
function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
|
44748
45273
|
if (["recovered", "canonical"].some((k) => k in opts))
|
44749
45274
|
throw new Error("sign() legacy options not supported");
|
44750
|
-
const { hash:
|
45275
|
+
const { hash: hash3, randomBytes: randomBytes3 } = CURVE;
|
44751
45276
|
let { lowS, prehash, extraEntropy: ent } = opts;
|
44752
45277
|
if (lowS == null)
|
44753
45278
|
lowS = true;
|
44754
45279
|
msgHash = ensureBytes("msgHash", msgHash);
|
45280
|
+
validateSigVerOpts(opts);
|
44755
45281
|
if (prehash)
|
44756
|
-
msgHash = ensureBytes("prehashed msgHash",
|
45282
|
+
msgHash = ensureBytes("prehashed msgHash", hash3(msgHash));
|
44757
45283
|
const h1int = bits2int_modN(msgHash);
|
44758
45284
|
const d = normPrivateKeyToScalar(privateKey);
|
44759
45285
|
const seedArgs = [int2octets(d), int2octets(h1int)];
|
44760
45286
|
if (ent != null && ent !== false) {
|
44761
|
-
const e = ent === true ?
|
45287
|
+
const e = ent === true ? randomBytes3(Fp2.BYTES) : ent;
|
44762
45288
|
seedArgs.push(ensureBytes("extraEntropy", e));
|
44763
45289
|
}
|
44764
|
-
const seed =
|
45290
|
+
const seed = concatBytes3(...seedArgs);
|
44765
45291
|
const m = h1int;
|
44766
45292
|
function k2sig(kBytes) {
|
44767
45293
|
const k = bits2int(kBytes);
|
@@ -44800,11 +45326,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44800
45326
|
publicKey = ensureBytes("publicKey", publicKey);
|
44801
45327
|
if ("strict" in opts)
|
44802
45328
|
throw new Error("options.strict was renamed to lowS");
|
45329
|
+
validateSigVerOpts(opts);
|
44803
45330
|
const { lowS, prehash } = opts;
|
44804
45331
|
let _sig = void 0;
|
44805
45332
|
let P;
|
44806
45333
|
try {
|
44807
|
-
if (typeof sg === "string" ||
|
45334
|
+
if (typeof sg === "string" || isBytes2(sg)) {
|
44808
45335
|
try {
|
44809
45336
|
_sig = Signature.fromDER(sg);
|
44810
45337
|
} catch (derError) {
|
@@ -44851,20 +45378,20 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44851
45378
|
};
|
44852
45379
|
}
|
44853
45380
|
|
44854
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
44855
|
-
function getHash(
|
45381
|
+
// ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/_shortw_utils.js
|
45382
|
+
function getHash(hash3) {
|
44856
45383
|
return {
|
44857
|
-
hash:
|
44858
|
-
hmac: (key, ...msgs) =>
|
44859
|
-
randomBytes
|
45384
|
+
hash: hash3,
|
45385
|
+
hmac: (key, ...msgs) => hmac(hash3, key, concatBytes2(...msgs)),
|
45386
|
+
randomBytes
|
44860
45387
|
};
|
44861
45388
|
}
|
44862
45389
|
function createCurve(curveDef, defHash) {
|
44863
|
-
const create = (
|
45390
|
+
const create = (hash3) => weierstrass({ ...curveDef, ...getHash(hash3) });
|
44864
45391
|
return Object.freeze({ ...create(defHash), create });
|
44865
45392
|
}
|
44866
45393
|
|
44867
|
-
// ../../node_modules/.pnpm/@noble+curves@1.
|
45394
|
+
// ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/secp256k1.js
|
44868
45395
|
var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
|
44869
45396
|
var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
44870
45397
|
var _1n6 = BigInt(1);
|
@@ -44940,7 +45467,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44940
45467
|
return { k1neg, k1, k2neg, k2 };
|
44941
45468
|
}
|
44942
45469
|
}
|
44943
|
-
},
|
45470
|
+
}, sha256);
|
44944
45471
|
var _0n6 = BigInt(0);
|
44945
45472
|
var Point = secp256k1.ProjectivePoint;
|
44946
45473
|
|
@@ -45033,7 +45560,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45033
45560
|
* @returns random 32-byte hashed
|
45034
45561
|
*/
|
45035
45562
|
static generatePrivateKey(entropy) {
|
45036
|
-
return entropy ? hash2(concat([
|
45563
|
+
return entropy ? hash2(concat([randomBytes22(32), arrayify(entropy)])) : randomBytes22(32);
|
45037
45564
|
}
|
45038
45565
|
/**
|
45039
45566
|
* Extended publicKey from a compact publicKey
|
@@ -45062,7 +45589,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45062
45589
|
async function encryptKeystoreWallet(privateKey, address, password) {
|
45063
45590
|
const privateKeyBuffer = bufferFromString2(removeHexPrefix(privateKey), "hex");
|
45064
45591
|
const ownerAddress = Address.fromAddressOrString(address);
|
45065
|
-
const salt =
|
45592
|
+
const salt = randomBytes22(DEFAULT_KEY_SIZE);
|
45066
45593
|
const key = scrypt22({
|
45067
45594
|
password: bufferFromString2(password),
|
45068
45595
|
salt,
|
@@ -45071,7 +45598,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45071
45598
|
r: DEFAULT_KDF_PARAMS_R,
|
45072
45599
|
p: DEFAULT_KDF_PARAMS_P
|
45073
45600
|
});
|
45074
|
-
const iv =
|
45601
|
+
const iv = randomBytes22(DEFAULT_IV_SIZE);
|
45075
45602
|
const ciphertext = await encryptJsonWalletData2(privateKeyBuffer, key, iv);
|
45076
45603
|
const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
|
45077
45604
|
const macHashUint8Array = keccak2562(data);
|
@@ -47572,7 +48099,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47572
48099
|
* @returns A randomly generated mnemonic
|
47573
48100
|
*/
|
47574
48101
|
static generate(size = 32, extraEntropy = "") {
|
47575
|
-
const entropy = extraEntropy ? sha2562(concat([
|
48102
|
+
const entropy = extraEntropy ? sha2562(concat([randomBytes22(size), arrayify(extraEntropy)])) : randomBytes22(size);
|
47576
48103
|
return Mnemonic.entropyToMnemonic(entropy);
|
47577
48104
|
}
|
47578
48105
|
};
|
@@ -47673,9 +48200,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47673
48200
|
data.set(arrayify(this.publicKey));
|
47674
48201
|
}
|
47675
48202
|
data.set(toBytes(index, 4), 33);
|
47676
|
-
const
|
47677
|
-
const IL =
|
47678
|
-
const IR =
|
48203
|
+
const bytes2 = arrayify(computeHmac2("sha512", chainCode, data));
|
48204
|
+
const IL = bytes2.slice(0, 32);
|
48205
|
+
const IR = bytes2.slice(32);
|
47679
48206
|
if (privateKey) {
|
47680
48207
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
47681
48208
|
const ki = bn(IL).add(privateKey).mod(N).toBytes(32);
|
@@ -47745,26 +48272,26 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47745
48272
|
}
|
47746
48273
|
static fromExtendedKey(extendedKey) {
|
47747
48274
|
const decoded = hexlify(toBytes(decodeBase58(extendedKey)));
|
47748
|
-
const
|
47749
|
-
const validChecksum = base58check(
|
47750
|
-
if (
|
48275
|
+
const bytes2 = arrayify(decoded);
|
48276
|
+
const validChecksum = base58check(bytes2.slice(0, 78)) === extendedKey;
|
48277
|
+
if (bytes2.length !== 82 || !isValidExtendedKey(bytes2)) {
|
47751
48278
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
47752
48279
|
}
|
47753
48280
|
if (!validChecksum) {
|
47754
48281
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
47755
48282
|
}
|
47756
|
-
const depth =
|
47757
|
-
const parentFingerprint = hexlify(
|
47758
|
-
const index = parseInt(hexlify(
|
47759
|
-
const chainCode = hexlify(
|
47760
|
-
const key =
|
48283
|
+
const depth = bytes2[4];
|
48284
|
+
const parentFingerprint = hexlify(bytes2.slice(5, 9));
|
48285
|
+
const index = parseInt(hexlify(bytes2.slice(9, 13)).substring(2), 16);
|
48286
|
+
const chainCode = hexlify(bytes2.slice(13, 45));
|
48287
|
+
const key = bytes2.slice(45, 78);
|
47761
48288
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
47762
48289
|
throw new FuelError(
|
47763
48290
|
ErrorCode.HD_WALLET_ERROR,
|
47764
48291
|
"Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
|
47765
48292
|
);
|
47766
48293
|
}
|
47767
|
-
if (isPublicExtendedKey(
|
48294
|
+
if (isPublicExtendedKey(bytes2)) {
|
47768
48295
|
if (key[0] !== 3) {
|
47769
48296
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
|
47770
48297
|
}
|
@@ -48408,8 +48935,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48408
48935
|
// src/predicate/utils/getPredicateRoot.ts
|
48409
48936
|
var getPredicateRoot = (bytecode) => {
|
48410
48937
|
const chunkSize = 16 * 1024;
|
48411
|
-
const
|
48412
|
-
const chunks = chunkAndPadBytes(
|
48938
|
+
const bytes2 = arrayify(bytecode);
|
48939
|
+
const chunks = chunkAndPadBytes(bytes2, chunkSize);
|
48413
48940
|
const codeRoot = calcRoot(chunks.map((c) => hexlify(c)));
|
48414
48941
|
const predicateRoot = hash2(concat(["0x4655454C", codeRoot]));
|
48415
48942
|
return predicateRoot;
|
@@ -48505,8 +49032,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48505
49032
|
* @param configurableConstants - Optional configurable constants for the predicate.
|
48506
49033
|
* @returns An object containing the new predicate bytes and interface.
|
48507
49034
|
*/
|
48508
|
-
static processPredicateData(
|
48509
|
-
let predicateBytes = arrayify(
|
49035
|
+
static processPredicateData(bytes2, jsonAbi, configurableConstants) {
|
49036
|
+
let predicateBytes = arrayify(bytes2);
|
48510
49037
|
let abiInterface;
|
48511
49038
|
if (jsonAbi) {
|
48512
49039
|
abiInterface = new Interface(jsonAbi);
|
@@ -48569,8 +49096,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48569
49096
|
* @param abiInterface - The ABI interface of the predicate.
|
48570
49097
|
* @returns The mutated bytes with the configurable constants set.
|
48571
49098
|
*/
|
48572
|
-
static setConfigurableConstants(
|
48573
|
-
const mutatedBytes =
|
49099
|
+
static setConfigurableConstants(bytes2, configurableConstants, abiInterface) {
|
49100
|
+
const mutatedBytes = bytes2;
|
48574
49101
|
try {
|
48575
49102
|
if (!abiInterface) {
|
48576
49103
|
throw new FuelError(
|
@@ -49335,9 +49862,6 @@ mime-types/index.js:
|
|
49335
49862
|
@noble/curves/esm/abstract/utils.js:
|
49336
49863
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
49337
49864
|
|
49338
|
-
@noble/hashes/esm/utils.js:
|
49339
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
49340
|
-
|
49341
49865
|
@noble/curves/esm/abstract/modular.js:
|
49342
49866
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
49343
49867
|
|