@fuel-ts/account 0.0.0-pr-1784-20240221124858 → 0.0.0-pr-1788-20240222085506
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/account.d.ts +1 -2
- package/dist/account.d.ts.map +1 -1
- package/dist/hdwallet/hdwallet.d.ts +1 -1
- package/dist/hdwallet/hdwallet.d.ts.map +1 -1
- package/dist/index.global.js +183 -183
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +188 -188
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +120 -132
- package/dist/index.mjs.map +1 -1
- package/dist/mnemonic/mnemonic.d.ts +1 -1
- package/dist/mnemonic/mnemonic.d.ts.map +1 -1
- package/dist/mnemonic/utils.d.ts +1 -1
- package/dist/mnemonic/utils.d.ts.map +1 -1
- package/dist/predicate/utils/getPredicateRoot.d.ts +1 -1
- package/dist/predicate/utils/getPredicateRoot.d.ts.map +1 -1
- package/dist/providers/coin-quantity.d.ts +1 -1
- package/dist/providers/coin-quantity.d.ts.map +1 -1
- package/dist/providers/memory-cache.d.ts +1 -1
- package/dist/providers/memory-cache.d.ts.map +1 -1
- package/dist/providers/message.d.ts +1 -2
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +1 -2
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/resource.d.ts +1 -1
- package/dist/providers/resource.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/hash-transaction.d.ts.map +1 -1
- package/dist/providers/transaction-request/input.d.ts +1 -1
- package/dist/providers/transaction-request/input.d.ts.map +1 -1
- package/dist/providers/transaction-request/output.d.ts +1 -1
- package/dist/providers/transaction-request/output.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts +1 -2
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/storage-slot.d.ts +1 -1
- package/dist/providers/transaction-request/storage-slot.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +2 -3
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/witness.d.ts +1 -1
- package/dist/providers/transaction-request/witness.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/signer/signer.d.ts +1 -1
- package/dist/signer/signer.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +2888 -2888
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +183 -183
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +112 -124
- package/dist/test-utils.mjs.map +1 -1
- package/dist/utils/formatTransferToContractScriptData.d.ts +1 -2
- package/dist/utils/formatTransferToContractScriptData.d.ts.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/dist/wallet/wallet.d.ts +1 -2
- package/dist/wallet/wallet.d.ts.map +1 -1
- package/dist/wallet/wallets.d.ts +1 -1
- package/dist/wallet/wallets.d.ts.map +1 -1
- package/package.json +16 -16
package/dist/index.global.js
CHANGED
@@ -30260,6 +30260,66 @@ spurious results.`);
|
|
30260
30260
|
var FuelError = _FuelError;
|
30261
30261
|
__publicField2(FuelError, "CODES", ErrorCode);
|
30262
30262
|
|
30263
|
+
// ../utils/dist/index.mjs
|
30264
|
+
var chunkAndPadBytes = (bytes4, chunkSize) => {
|
30265
|
+
const chunks = [];
|
30266
|
+
for (let offset = 0; offset < bytes4.length; offset += chunkSize) {
|
30267
|
+
const chunk = new Uint8Array(chunkSize);
|
30268
|
+
chunk.set(bytes4.slice(offset, offset + chunkSize));
|
30269
|
+
chunks.push(chunk);
|
30270
|
+
}
|
30271
|
+
const lastChunk = chunks[chunks.length - 1];
|
30272
|
+
const remainingBytes = bytes4.length % chunkSize;
|
30273
|
+
const paddedChunkLength = remainingBytes + (8 - remainingBytes % 8) % 8;
|
30274
|
+
const newChunk = lastChunk.slice(0, paddedChunkLength);
|
30275
|
+
chunks[chunks.length - 1] = newChunk;
|
30276
|
+
return chunks;
|
30277
|
+
};
|
30278
|
+
var arrayify = (value) => {
|
30279
|
+
if (value instanceof Uint8Array) {
|
30280
|
+
return new Uint8Array(value);
|
30281
|
+
}
|
30282
|
+
if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
|
30283
|
+
const result = new Uint8Array((value.length - 2) / 2);
|
30284
|
+
let offset = 2;
|
30285
|
+
for (let i = 0; i < result.length; i++) {
|
30286
|
+
result[i] = parseInt(value.substring(offset, offset + 2), 16);
|
30287
|
+
offset += 2;
|
30288
|
+
}
|
30289
|
+
return result;
|
30290
|
+
}
|
30291
|
+
throw new FuelError(ErrorCode.PARSE_FAILED, "invalid BytesLike value");
|
30292
|
+
};
|
30293
|
+
var concatBytes2 = (arrays) => {
|
30294
|
+
const byteArrays = arrays.map((array) => {
|
30295
|
+
if (array instanceof Uint8Array) {
|
30296
|
+
return array;
|
30297
|
+
}
|
30298
|
+
return Uint8Array.from(array);
|
30299
|
+
});
|
30300
|
+
const totalSize = byteArrays.reduce((accum, item) => accum + item.length, 0);
|
30301
|
+
const concatenated = new Uint8Array(totalSize);
|
30302
|
+
byteArrays.reduce((offset, object) => {
|
30303
|
+
concatenated.set(object, offset);
|
30304
|
+
return offset + object.length;
|
30305
|
+
}, 0);
|
30306
|
+
return concatenated;
|
30307
|
+
};
|
30308
|
+
var concat = (arrays) => {
|
30309
|
+
const bytes4 = arrays.map((v) => arrayify(v));
|
30310
|
+
return concatBytes2(bytes4);
|
30311
|
+
};
|
30312
|
+
var HexCharacters = "0123456789abcdef";
|
30313
|
+
function hexlify(data) {
|
30314
|
+
const bytes4 = arrayify(data);
|
30315
|
+
let result = "0x";
|
30316
|
+
for (let i = 0; i < bytes4.length; i++) {
|
30317
|
+
const v = bytes4[i];
|
30318
|
+
result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15];
|
30319
|
+
}
|
30320
|
+
return result;
|
30321
|
+
}
|
30322
|
+
|
30263
30323
|
// ../crypto/dist/index.mjs
|
30264
30324
|
var import_crypto9 = __toESM(__require("crypto"), 1);
|
30265
30325
|
|
@@ -30428,9 +30488,6 @@ spurious results.`);
|
|
30428
30488
|
function getBytes(value, name) {
|
30429
30489
|
return _getBytes(value, name, false);
|
30430
30490
|
}
|
30431
|
-
function getBytesCopy(value, name) {
|
30432
|
-
return _getBytes(value, name, true);
|
30433
|
-
}
|
30434
30491
|
function isHexString(value, length) {
|
30435
30492
|
if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
|
30436
30493
|
return false;
|
@@ -30443,19 +30500,16 @@ spurious results.`);
|
|
30443
30500
|
}
|
30444
30501
|
return true;
|
30445
30502
|
}
|
30446
|
-
var
|
30447
|
-
function
|
30503
|
+
var HexCharacters2 = "0123456789abcdef";
|
30504
|
+
function hexlify2(data) {
|
30448
30505
|
const bytes4 = getBytes(data);
|
30449
30506
|
let result = "0x";
|
30450
30507
|
for (let i = 0; i < bytes4.length; i++) {
|
30451
30508
|
const v = bytes4[i];
|
30452
|
-
result +=
|
30509
|
+
result += HexCharacters2[(v & 240) >> 4] + HexCharacters2[v & 15];
|
30453
30510
|
}
|
30454
30511
|
return result;
|
30455
30512
|
}
|
30456
|
-
function concat(datas) {
|
30457
|
-
return "0x" + datas.map((d) => hexlify(d).substring(2)).join("");
|
30458
|
-
}
|
30459
30513
|
function dataSlice(data, start, end) {
|
30460
30514
|
const bytes4 = getBytes(data);
|
30461
30515
|
if (end != null && end > bytes4.length) {
|
@@ -30465,7 +30519,7 @@ spurious results.`);
|
|
30465
30519
|
offset: end
|
30466
30520
|
});
|
30467
30521
|
}
|
30468
|
-
return
|
30522
|
+
return hexlify2(bytes4.slice(start == null ? 0 : start, end == null ? bytes4.length : end));
|
30469
30523
|
}
|
30470
30524
|
|
30471
30525
|
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/maths.js
|
@@ -30748,7 +30802,7 @@ spurious results.`);
|
|
30748
30802
|
function computeHmac(algorithm, _key, _data) {
|
30749
30803
|
const key = getBytes(_key, "key");
|
30750
30804
|
const data = getBytes(_data, "data");
|
30751
|
-
return
|
30805
|
+
return hexlify2(__computeHmac(algorithm, key, data));
|
30752
30806
|
}
|
30753
30807
|
computeHmac._ = _computeHmac;
|
30754
30808
|
computeHmac.lock = function() {
|
@@ -31103,7 +31157,7 @@ spurious results.`);
|
|
31103
31157
|
var __keccak256 = _keccak256;
|
31104
31158
|
function keccak2562(_data) {
|
31105
31159
|
const data = getBytes(_data, "data");
|
31106
|
-
return
|
31160
|
+
return hexlify2(__keccak256(data));
|
31107
31161
|
}
|
31108
31162
|
keccak2562._ = _keccak256;
|
31109
31163
|
keccak2562.lock = function() {
|
@@ -31302,7 +31356,7 @@ spurious results.`);
|
|
31302
31356
|
var __ripemd160 = _ripemd160;
|
31303
31357
|
function ripemd1602(_data) {
|
31304
31358
|
const data = getBytes(_data, "data");
|
31305
|
-
return
|
31359
|
+
return hexlify2(__ripemd160(data));
|
31306
31360
|
}
|
31307
31361
|
ripemd1602._ = _ripemd160;
|
31308
31362
|
ripemd1602.lock = function() {
|
@@ -31325,7 +31379,7 @@ spurious results.`);
|
|
31325
31379
|
function pbkdf22(_password, _salt, iterations, keylen, algo) {
|
31326
31380
|
const password = getBytes(_password, "password");
|
31327
31381
|
const salt = getBytes(_salt, "salt");
|
31328
|
-
return
|
31382
|
+
return hexlify2(__pbkdf2(password, salt, iterations, keylen, algo));
|
31329
31383
|
}
|
31330
31384
|
pbkdf22._ = _pbkdf2;
|
31331
31385
|
pbkdf22.lock = function() {
|
@@ -31352,7 +31406,7 @@ spurious results.`);
|
|
31352
31406
|
var locked512 = false;
|
31353
31407
|
function sha2562(_data) {
|
31354
31408
|
const data = getBytes(_data, "data");
|
31355
|
-
return
|
31409
|
+
return hexlify2(__sha256(data));
|
31356
31410
|
}
|
31357
31411
|
sha2562._ = _sha256;
|
31358
31412
|
sha2562.lock = function() {
|
@@ -31367,7 +31421,7 @@ spurious results.`);
|
|
31367
31421
|
Object.freeze(sha2562);
|
31368
31422
|
function sha512(_data) {
|
31369
31423
|
const data = getBytes(_data, "data");
|
31370
|
-
return
|
31424
|
+
return hexlify2(__sha512(data));
|
31371
31425
|
}
|
31372
31426
|
sha512._ = _sha512;
|
31373
31427
|
sha512.lock = function() {
|
@@ -31983,7 +32037,7 @@ spurious results.`);
|
|
31983
32037
|
var keyFromPassword = (password, saltBuffer) => {
|
31984
32038
|
const passBuffer = bufferFromString(String(password).normalize("NFKC"), "utf-8");
|
31985
32039
|
const key = pbkdf22(passBuffer, saltBuffer, 1e5, 32, "sha256");
|
31986
|
-
return
|
32040
|
+
return arrayify(key);
|
31987
32041
|
};
|
31988
32042
|
var encrypt = async (password, data) => {
|
31989
32043
|
const iv = randomBytes3(16);
|
@@ -32069,7 +32123,7 @@ spurious results.`);
|
|
32069
32123
|
function toBech32(address) {
|
32070
32124
|
return import_bech32.bech32m.encode(
|
32071
32125
|
FUEL_BECH32_HRP_PREFIX,
|
32072
|
-
import_bech32.bech32m.toWords(
|
32126
|
+
import_bech32.bech32m.toWords(arrayify(hexlify(address)))
|
32073
32127
|
);
|
32074
32128
|
}
|
32075
32129
|
function isBech32(address) {
|
@@ -32248,7 +32302,7 @@ spurious results.`);
|
|
32248
32302
|
if (!isPublicKey(publicKey)) {
|
32249
32303
|
throw new FuelError(FuelError.CODES.INVALID_PUBLIC_KEY, `Invalid Public Key: ${publicKey}.`);
|
32250
32304
|
}
|
32251
|
-
const b256Address = sha2562(hexlify(
|
32305
|
+
const b256Address = sha2562(hexlify(arrayify(publicKey)));
|
32252
32306
|
return new Address(toBech32(b256Address));
|
32253
32307
|
}
|
32254
32308
|
/**
|
@@ -32596,56 +32650,6 @@ spurious results.`);
|
|
32596
32650
|
return coinQuantities;
|
32597
32651
|
};
|
32598
32652
|
|
32599
|
-
// ../utils/dist/index.mjs
|
32600
|
-
var chunkAndPadBytes = (bytes4, chunkSize) => {
|
32601
|
-
const chunks = [];
|
32602
|
-
for (let offset = 0; offset < bytes4.length; offset += chunkSize) {
|
32603
|
-
const chunk = new Uint8Array(chunkSize);
|
32604
|
-
chunk.set(bytes4.slice(offset, offset + chunkSize));
|
32605
|
-
chunks.push(chunk);
|
32606
|
-
}
|
32607
|
-
const lastChunk = chunks[chunks.length - 1];
|
32608
|
-
const remainingBytes = bytes4.length % chunkSize;
|
32609
|
-
const paddedChunkLength = remainingBytes + (8 - remainingBytes % 8) % 8;
|
32610
|
-
const newChunk = lastChunk.slice(0, paddedChunkLength);
|
32611
|
-
chunks[chunks.length - 1] = newChunk;
|
32612
|
-
return chunks;
|
32613
|
-
};
|
32614
|
-
var arrayify = (value) => {
|
32615
|
-
if (value instanceof Uint8Array) {
|
32616
|
-
return new Uint8Array(value);
|
32617
|
-
}
|
32618
|
-
if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
|
32619
|
-
const result = new Uint8Array((value.length - 2) / 2);
|
32620
|
-
let offset = 2;
|
32621
|
-
for (let i = 0; i < result.length; i++) {
|
32622
|
-
result[i] = parseInt(value.substring(offset, offset + 2), 16);
|
32623
|
-
offset += 2;
|
32624
|
-
}
|
32625
|
-
return result;
|
32626
|
-
}
|
32627
|
-
throw new FuelError(ErrorCode.PARSE_FAILED, "invalid BytesLike value");
|
32628
|
-
};
|
32629
|
-
var concatBytes2 = (arrays) => {
|
32630
|
-
const byteArrays = arrays.map((array) => {
|
32631
|
-
if (array instanceof Uint8Array) {
|
32632
|
-
return array;
|
32633
|
-
}
|
32634
|
-
return Uint8Array.from(array);
|
32635
|
-
});
|
32636
|
-
const totalSize = byteArrays.reduce((accum, item) => accum + item.length, 0);
|
32637
|
-
const concatenated = new Uint8Array(totalSize);
|
32638
|
-
byteArrays.reduce((offset, object) => {
|
32639
|
-
concatenated.set(object, offset);
|
32640
|
-
return offset + object.length;
|
32641
|
-
}, 0);
|
32642
|
-
return concatenated;
|
32643
|
-
};
|
32644
|
-
var concat2 = (arrays) => {
|
32645
|
-
const bytes4 = arrays.map((v) => arrayify(v));
|
32646
|
-
return concatBytes2(bytes4);
|
32647
|
-
};
|
32648
|
-
|
32649
32653
|
// ../abi-coder/dist/index.mjs
|
32650
32654
|
var __defProp3 = Object.defineProperty;
|
32651
32655
|
var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
@@ -32768,7 +32772,7 @@ spurious results.`);
|
|
32768
32772
|
topLevelData[parseInt(pointerIndex, 10) + totalIndex] = vData;
|
32769
32773
|
});
|
32770
32774
|
}
|
32771
|
-
const byteArray =
|
32775
|
+
const byteArray = arrayify(item);
|
32772
32776
|
totalIndex += byteArray.byteLength / WORD_SIZE;
|
32773
32777
|
return byteArray;
|
32774
32778
|
});
|
@@ -32785,7 +32789,7 @@ spurious results.`);
|
|
32785
32789
|
}
|
32786
32790
|
function unpackDynamicData(results, baseOffset, dataOffset) {
|
32787
32791
|
if (!results.dynamicData) {
|
32788
|
-
return
|
32792
|
+
return concat([results]);
|
32789
32793
|
}
|
32790
32794
|
let cumulativeDynamicByteLength = 0;
|
32791
32795
|
let updatedResults = results;
|
@@ -32803,7 +32807,7 @@ spurious results.`);
|
|
32803
32807
|
dataOffset + vData.byteLength + cumulativeDynamicByteLength
|
32804
32808
|
)
|
32805
32809
|
) : vData;
|
32806
|
-
updatedResults =
|
32810
|
+
updatedResults = concat([updatedResults, dataToAppend]);
|
32807
32811
|
cumulativeDynamicByteLength += dataToAppend.byteLength;
|
32808
32812
|
});
|
32809
32813
|
return updatedResults;
|
@@ -32889,7 +32893,7 @@ spurious results.`);
|
|
32889
32893
|
encode(value) {
|
32890
32894
|
let encodedValue;
|
32891
32895
|
try {
|
32892
|
-
encodedValue =
|
32896
|
+
encodedValue = arrayify(value);
|
32893
32897
|
} catch (error) {
|
32894
32898
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.type}.`);
|
32895
32899
|
}
|
@@ -32920,7 +32924,7 @@ spurious results.`);
|
|
32920
32924
|
encode(value) {
|
32921
32925
|
let encodedValue;
|
32922
32926
|
try {
|
32923
|
-
encodedValue =
|
32927
|
+
encodedValue = arrayify(value);
|
32924
32928
|
} catch (error) {
|
32925
32929
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.type}.`);
|
32926
32930
|
}
|
@@ -33029,7 +33033,7 @@ spurious results.`);
|
|
33029
33033
|
if (paddingLength) {
|
33030
33034
|
data.push(new Uint8Array(paddingLength));
|
33031
33035
|
}
|
33032
|
-
return
|
33036
|
+
return concat(data);
|
33033
33037
|
};
|
33034
33038
|
__publicField3(ByteCoder, "memorySize", 1);
|
33035
33039
|
var isFullyNativeEnum = (enumCoders) => Object.values(enumCoders).every(
|
@@ -33058,7 +33062,7 @@ spurious results.`);
|
|
33058
33062
|
const encodedValue = valueCoder.encode([]);
|
33059
33063
|
const caseIndex = Object.keys(this.coders).indexOf(value);
|
33060
33064
|
const padding = new Uint8Array(this.#encodedValueSize - valueCoder.encodedLength);
|
33061
|
-
return
|
33065
|
+
return concat([this.#caseIndexCoder.encode(caseIndex), padding, encodedValue]);
|
33062
33066
|
}
|
33063
33067
|
encode(value) {
|
33064
33068
|
if (typeof value === "string" && this.coders[value]) {
|
@@ -33268,7 +33272,7 @@ spurious results.`);
|
|
33268
33272
|
if (paddingLength) {
|
33269
33273
|
data.push(new Uint8Array(paddingLength));
|
33270
33274
|
}
|
33271
|
-
return
|
33275
|
+
return concat(data);
|
33272
33276
|
};
|
33273
33277
|
__publicField3(StdStringCoder, "memorySize", 1);
|
33274
33278
|
var StringCoder = class extends Coder {
|
@@ -33287,7 +33291,7 @@ spurious results.`);
|
|
33287
33291
|
}
|
33288
33292
|
const encoded = toUtf8Bytes(value);
|
33289
33293
|
const padding = new Uint8Array(this.#paddingLength);
|
33290
|
-
return
|
33294
|
+
return concat([encoded, padding]);
|
33291
33295
|
}
|
33292
33296
|
decode(data, offset) {
|
33293
33297
|
if (data.length < this.encodedLength) {
|
@@ -34067,7 +34071,7 @@ spurious results.`);
|
|
34067
34071
|
throw new FuelError(ErrorCode.ABI_TYPES_AND_VALUES_MISMATCH, errorMsg);
|
34068
34072
|
}
|
34069
34073
|
decodeArguments(data) {
|
34070
|
-
const bytes4 =
|
34074
|
+
const bytes4 = arrayify(data);
|
34071
34075
|
const nonEmptyInputs = this.jsonFn.inputs.filter(
|
34072
34076
|
(x) => findOrThrow(this.jsonAbi.types, (t) => t.typeId === x.type).type !== "()"
|
34073
34077
|
);
|
@@ -34112,7 +34116,7 @@ spurious results.`);
|
|
34112
34116
|
if (outputAbiType.type === "()") {
|
34113
34117
|
return [void 0, 0];
|
34114
34118
|
}
|
34115
|
-
const bytes4 =
|
34119
|
+
const bytes4 = arrayify(data);
|
34116
34120
|
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output);
|
34117
34121
|
return coder.decode(bytes4, 0);
|
34118
34122
|
}
|
@@ -34179,7 +34183,7 @@ spurious results.`);
|
|
34179
34183
|
return externalInterface.decodeLog(data, logId, receiptId);
|
34180
34184
|
}
|
34181
34185
|
const { loggedType } = findOrThrow(this.jsonAbi.loggedTypes, (type3) => type3.logId === logId);
|
34182
|
-
return AbiCoder.decode(this.jsonAbi, loggedType,
|
34186
|
+
return AbiCoder.decode(this.jsonAbi, loggedType, arrayify(data), 0, {
|
34183
34187
|
version: this.jsonAbi.encoding
|
34184
34188
|
});
|
34185
34189
|
}
|
@@ -34236,12 +34240,12 @@ spurious results.`);
|
|
34236
34240
|
}
|
34237
34241
|
encode(value) {
|
34238
34242
|
const parts = [];
|
34239
|
-
const data =
|
34243
|
+
const data = arrayify(value);
|
34240
34244
|
parts.push(data);
|
34241
34245
|
if (this.#paddingLength) {
|
34242
34246
|
parts.push(new Uint8Array(this.#paddingLength));
|
34243
34247
|
}
|
34244
|
-
return
|
34248
|
+
return concat(parts);
|
34245
34249
|
}
|
34246
34250
|
decode(data, offset) {
|
34247
34251
|
let decoded;
|
@@ -34287,7 +34291,7 @@ spurious results.`);
|
|
34287
34291
|
parts.push(new NumberCoder("u32").encode(value.predicateDataLength));
|
34288
34292
|
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
34289
34293
|
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
34290
|
-
return
|
34294
|
+
return concat(parts);
|
34291
34295
|
}
|
34292
34296
|
decode(data, offset) {
|
34293
34297
|
let decoded;
|
@@ -34351,7 +34355,7 @@ spurious results.`);
|
|
34351
34355
|
parts.push(new B256Coder().encode(value.stateRoot));
|
34352
34356
|
parts.push(new TxPointerCoder().encode(value.txPointer));
|
34353
34357
|
parts.push(new B256Coder().encode(value.contractID));
|
34354
|
-
return
|
34358
|
+
return concat(parts);
|
34355
34359
|
}
|
34356
34360
|
decode(data, offset) {
|
34357
34361
|
let decoded;
|
@@ -34392,11 +34396,11 @@ spurious results.`);
|
|
34392
34396
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
34393
34397
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
34394
34398
|
parts.push(new U64Coder().encode(value.amount));
|
34395
|
-
parts.push(
|
34396
|
-
return sha2562(
|
34399
|
+
parts.push(arrayify(value.data || "0x"));
|
34400
|
+
return sha2562(concat(parts));
|
34397
34401
|
}
|
34398
34402
|
static encodeData(messageData) {
|
34399
|
-
const bytes4 =
|
34403
|
+
const bytes4 = arrayify(messageData || "0x");
|
34400
34404
|
const dataLength2 = bytes4.length;
|
34401
34405
|
return new ByteArrayCoder(dataLength2).encode(bytes4);
|
34402
34406
|
}
|
@@ -34415,13 +34419,13 @@ spurious results.`);
|
|
34415
34419
|
parts.push(new ByteArrayCoder(data.length).encode(data));
|
34416
34420
|
parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate));
|
34417
34421
|
parts.push(new ByteArrayCoder(value.predicateDataLength).encode(value.predicateData));
|
34418
|
-
return
|
34422
|
+
return concat(parts);
|
34419
34423
|
}
|
34420
34424
|
static decodeData(messageData) {
|
34421
|
-
const bytes4 =
|
34425
|
+
const bytes4 = arrayify(messageData);
|
34422
34426
|
const dataLength2 = bytes4.length;
|
34423
34427
|
const [data] = new ByteArrayCoder(dataLength2).decode(bytes4, 0);
|
34424
|
-
return
|
34428
|
+
return arrayify(data);
|
34425
34429
|
}
|
34426
34430
|
decode(data, offset) {
|
34427
34431
|
let decoded;
|
@@ -34498,7 +34502,7 @@ spurious results.`);
|
|
34498
34502
|
);
|
34499
34503
|
}
|
34500
34504
|
}
|
34501
|
-
return
|
34505
|
+
return concat(parts);
|
34502
34506
|
}
|
34503
34507
|
decode(data, offset) {
|
34504
34508
|
let decoded;
|
@@ -34544,7 +34548,7 @@ spurious results.`);
|
|
34544
34548
|
parts.push(new B256Coder().encode(value.to));
|
34545
34549
|
parts.push(new U64Coder().encode(value.amount));
|
34546
34550
|
parts.push(new B256Coder().encode(value.assetId));
|
34547
|
-
return
|
34551
|
+
return concat(parts);
|
34548
34552
|
}
|
34549
34553
|
decode(data, offset) {
|
34550
34554
|
let decoded;
|
@@ -34575,7 +34579,7 @@ spurious results.`);
|
|
34575
34579
|
parts.push(new NumberCoder("u8").encode(value.inputIndex));
|
34576
34580
|
parts.push(new B256Coder().encode(value.balanceRoot));
|
34577
34581
|
parts.push(new B256Coder().encode(value.stateRoot));
|
34578
|
-
return
|
34582
|
+
return concat(parts);
|
34579
34583
|
}
|
34580
34584
|
decode(data, offset) {
|
34581
34585
|
let decoded;
|
@@ -34606,7 +34610,7 @@ spurious results.`);
|
|
34606
34610
|
parts.push(new B256Coder().encode(value.to));
|
34607
34611
|
parts.push(new U64Coder().encode(value.amount));
|
34608
34612
|
parts.push(new B256Coder().encode(value.assetId));
|
34609
|
-
return
|
34613
|
+
return concat(parts);
|
34610
34614
|
}
|
34611
34615
|
decode(data, offset) {
|
34612
34616
|
let decoded;
|
@@ -34637,7 +34641,7 @@ spurious results.`);
|
|
34637
34641
|
parts.push(new B256Coder().encode(value.to));
|
34638
34642
|
parts.push(new U64Coder().encode(value.amount));
|
34639
34643
|
parts.push(new B256Coder().encode(value.assetId));
|
34640
|
-
return
|
34644
|
+
return concat(parts);
|
34641
34645
|
}
|
34642
34646
|
decode(data, offset) {
|
34643
34647
|
let decoded;
|
@@ -34667,7 +34671,7 @@ spurious results.`);
|
|
34667
34671
|
const parts = [];
|
34668
34672
|
parts.push(new B256Coder().encode(value.contractId));
|
34669
34673
|
parts.push(new B256Coder().encode(value.stateRoot));
|
34670
|
-
return
|
34674
|
+
return concat(parts);
|
34671
34675
|
}
|
34672
34676
|
decode(data, offset) {
|
34673
34677
|
let decoded;
|
@@ -34722,7 +34726,7 @@ spurious results.`);
|
|
34722
34726
|
);
|
34723
34727
|
}
|
34724
34728
|
}
|
34725
|
-
return
|
34729
|
+
return concat(parts);
|
34726
34730
|
}
|
34727
34731
|
decode(data, offset) {
|
34728
34732
|
let decoded;
|
@@ -34802,7 +34806,7 @@ spurious results.`);
|
|
34802
34806
|
}
|
34803
34807
|
}
|
34804
34808
|
});
|
34805
|
-
return
|
34809
|
+
return concat(parts);
|
34806
34810
|
}
|
34807
34811
|
decode(data, offset, policyTypes) {
|
34808
34812
|
let o = offset;
|
@@ -34856,8 +34860,8 @@ spurious results.`);
|
|
34856
34860
|
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
34857
34861
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
34858
34862
|
parts.push(new U64Coder().encode(value.amount));
|
34859
|
-
parts.push(
|
34860
|
-
return sha2562(
|
34863
|
+
parts.push(arrayify(value.data || "0x"));
|
34864
|
+
return sha2562(concat(parts));
|
34861
34865
|
}
|
34862
34866
|
encode(value) {
|
34863
34867
|
const parts = [];
|
@@ -34868,7 +34872,7 @@ spurious results.`);
|
|
34868
34872
|
parts.push(new NumberCoder("u16").encode(value.data.length));
|
34869
34873
|
parts.push(new B256Coder().encode(value.digest));
|
34870
34874
|
parts.push(new ByteArrayCoder(value.data.length).encode(value.data));
|
34871
|
-
return
|
34875
|
+
return concat(parts);
|
34872
34876
|
}
|
34873
34877
|
decode(data, offset) {
|
34874
34878
|
let decoded;
|
@@ -34886,7 +34890,7 @@ spurious results.`);
|
|
34886
34890
|
[decoded, o] = new B256Coder().decode(data, o);
|
34887
34891
|
const digest = decoded;
|
34888
34892
|
[decoded, o] = new ByteArrayCoder(len).decode(data, o);
|
34889
|
-
const messageData =
|
34893
|
+
const messageData = arrayify(decoded);
|
34890
34894
|
const receiptMessageOut = {
|
34891
34895
|
type: 10,
|
34892
34896
|
messageId: "",
|
@@ -34902,9 +34906,9 @@ spurious results.`);
|
|
34902
34906
|
}
|
34903
34907
|
};
|
34904
34908
|
var getAssetId = (contractId, subId) => {
|
34905
|
-
const contractIdBytes =
|
34906
|
-
const subIdBytes =
|
34907
|
-
return sha2562(
|
34909
|
+
const contractIdBytes = arrayify(contractId);
|
34910
|
+
const subIdBytes = arrayify(subId);
|
34911
|
+
return sha2562(concat([contractIdBytes, subIdBytes]));
|
34908
34912
|
};
|
34909
34913
|
var ReceiptMintCoder = class extends Coder {
|
34910
34914
|
constructor() {
|
@@ -34920,7 +34924,7 @@ spurious results.`);
|
|
34920
34924
|
parts.push(new U64Coder().encode(value.val));
|
34921
34925
|
parts.push(new U64Coder().encode(value.pc));
|
34922
34926
|
parts.push(new U64Coder().encode(value.is));
|
34923
|
-
return
|
34927
|
+
return concat(parts);
|
34924
34928
|
}
|
34925
34929
|
decode(data, offset) {
|
34926
34930
|
let decoded;
|
@@ -34962,7 +34966,7 @@ spurious results.`);
|
|
34962
34966
|
parts.push(new U64Coder().encode(value.val));
|
34963
34967
|
parts.push(new U64Coder().encode(value.pc));
|
34964
34968
|
parts.push(new U64Coder().encode(value.is));
|
34965
|
-
return
|
34969
|
+
return concat(parts);
|
34966
34970
|
}
|
34967
34971
|
decode(data, offset) {
|
34968
34972
|
let decoded;
|
@@ -35011,7 +35015,7 @@ spurious results.`);
|
|
35011
35015
|
const parts = [];
|
35012
35016
|
parts.push(new NumberCoder("u16").encode(value.dataLength));
|
35013
35017
|
parts.push(new ByteArrayCoder(value.dataLength).encode(value.data));
|
35014
|
-
return
|
35018
|
+
return concat(parts);
|
35015
35019
|
}
|
35016
35020
|
decode(data, offset) {
|
35017
35021
|
let decoded;
|
@@ -35055,7 +35059,7 @@ spurious results.`);
|
|
35055
35059
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
35056
35060
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
35057
35061
|
parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
|
35058
|
-
return
|
35062
|
+
return concat(parts);
|
35059
35063
|
}
|
35060
35064
|
decode(data, offset) {
|
35061
35065
|
let decoded;
|
@@ -35131,7 +35135,7 @@ spurious results.`);
|
|
35131
35135
|
parts.push(new ArrayCoder(new InputCoder(), value.inputsCount).encode(value.inputs));
|
35132
35136
|
parts.push(new ArrayCoder(new OutputCoder(), value.outputsCount).encode(value.outputs));
|
35133
35137
|
parts.push(new ArrayCoder(new WitnessCoder(), value.witnessesCount).encode(value.witnesses));
|
35134
|
-
return
|
35138
|
+
return concat(parts);
|
35135
35139
|
}
|
35136
35140
|
decode(data, offset) {
|
35137
35141
|
let decoded;
|
@@ -35194,7 +35198,7 @@ spurious results.`);
|
|
35194
35198
|
parts.push(new OutputContractCoder().encode(value.outputContract));
|
35195
35199
|
parts.push(new U64Coder().encode(value.mintAmount));
|
35196
35200
|
parts.push(new B256Coder().encode(value.mintAssetId));
|
35197
|
-
return
|
35201
|
+
return concat(parts);
|
35198
35202
|
}
|
35199
35203
|
decode(data, offset) {
|
35200
35204
|
let decoded;
|
@@ -35254,7 +35258,7 @@ spurious results.`);
|
|
35254
35258
|
);
|
35255
35259
|
}
|
35256
35260
|
}
|
35257
|
-
return
|
35261
|
+
return concat(parts);
|
35258
35262
|
}
|
35259
35263
|
decode(data, offset) {
|
35260
35264
|
let decoded;
|
@@ -39766,18 +39770,18 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39766
39770
|
const { type: type3 } = value;
|
39767
39771
|
switch (value.type) {
|
39768
39772
|
case InputType.Coin: {
|
39769
|
-
const predicate =
|
39770
|
-
const predicateData =
|
39773
|
+
const predicate = arrayify(value.predicate ?? "0x");
|
39774
|
+
const predicateData = arrayify(value.predicateData ?? "0x");
|
39771
39775
|
return {
|
39772
39776
|
type: InputType.Coin,
|
39773
|
-
txID: hexlify(
|
39774
|
-
outputIndex:
|
39777
|
+
txID: hexlify(arrayify(value.id).slice(0, 32)),
|
39778
|
+
outputIndex: arrayify(value.id)[32],
|
39775
39779
|
owner: hexlify(value.owner),
|
39776
39780
|
amount: bn(value.amount),
|
39777
39781
|
assetId: hexlify(value.assetId),
|
39778
39782
|
txPointer: {
|
39779
|
-
blockHeight: toNumber2(
|
39780
|
-
txIndex: toNumber2(
|
39783
|
+
blockHeight: toNumber2(arrayify(value.txPointer).slice(0, 8)),
|
39784
|
+
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
39781
39785
|
},
|
39782
39786
|
witnessIndex: value.witnessIndex,
|
39783
39787
|
maturity: value.maturity ?? 0,
|
@@ -39796,16 +39800,16 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39796
39800
|
balanceRoot: ZeroBytes32,
|
39797
39801
|
stateRoot: ZeroBytes32,
|
39798
39802
|
txPointer: {
|
39799
|
-
blockHeight: toNumber2(
|
39800
|
-
txIndex: toNumber2(
|
39803
|
+
blockHeight: toNumber2(arrayify(value.txPointer).slice(0, 8)),
|
39804
|
+
txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
|
39801
39805
|
},
|
39802
39806
|
contractID: hexlify(value.contractId)
|
39803
39807
|
};
|
39804
39808
|
}
|
39805
39809
|
case InputType.Message: {
|
39806
|
-
const predicate =
|
39807
|
-
const predicateData =
|
39808
|
-
const data =
|
39810
|
+
const predicate = arrayify(value.predicate ?? "0x");
|
39811
|
+
const predicateData = arrayify(value.predicateData ?? "0x");
|
39812
|
+
const data = arrayify(value.data ?? "0x");
|
39809
39813
|
return {
|
39810
39814
|
type: InputType.Message,
|
39811
39815
|
sender: hexlify(value.sender),
|
@@ -40041,7 +40045,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40041
40045
|
const recipient = hexOrZero(receipt.recipient);
|
40042
40046
|
const nonce = hexOrZero(receipt.nonce);
|
40043
40047
|
const amount = bn(receipt.amount);
|
40044
|
-
const data = receipt.data ?
|
40048
|
+
const data = receipt.data ? arrayify(receipt.data) : Uint8Array.from([]);
|
40045
40049
|
const digest = hexOrZero(receipt.digest);
|
40046
40050
|
const messageId = ReceiptMessageOutCoder.getMessageId({
|
40047
40051
|
sender,
|
@@ -40183,9 +40187,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40183
40187
|
const totalGas = inputs.reduce((total, input) => {
|
40184
40188
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
40185
40189
|
return total.add(
|
40186
|
-
resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(
|
40187
|
-
resolveGasDependentCosts(getBytesCopy(input.predicate).length, gasCosts.contractRoot)
|
40188
|
-
).add(bn(input.predicateGasUsed))
|
40190
|
+
resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify(input.predicate).length, gasCosts.contractRoot)).add(bn(input.predicateGasUsed))
|
40189
40191
|
);
|
40190
40192
|
}
|
40191
40193
|
if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
|
@@ -40299,7 +40301,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40299
40301
|
|
40300
40302
|
// src/providers/transaction-request/witness.ts
|
40301
40303
|
var witnessify = (value) => {
|
40302
|
-
const data =
|
40304
|
+
const data = arrayify(value);
|
40303
40305
|
return {
|
40304
40306
|
data: hexlify(data),
|
40305
40307
|
dataLength: data.length
|
@@ -40880,7 +40882,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40880
40882
|
// src/providers/transaction-request/storage-slot.ts
|
40881
40883
|
var getStorageValue = (value) => {
|
40882
40884
|
const v = new Uint8Array(32);
|
40883
|
-
v.set(
|
40885
|
+
v.set(arrayify(value));
|
40884
40886
|
return v;
|
40885
40887
|
};
|
40886
40888
|
var storageSlotify = (storageSlot) => {
|
@@ -40985,7 +40987,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40985
40987
|
}
|
40986
40988
|
metadataGas(gasCosts) {
|
40987
40989
|
return calculateMetadataGasForTxCreate({
|
40988
|
-
contractBytesSize: bn(
|
40990
|
+
contractBytesSize: bn(arrayify(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
|
40989
40991
|
gasCosts,
|
40990
40992
|
stateRootSize: this.storageSlots.length,
|
40991
40993
|
txBytesSize: this.byteSize()
|
@@ -41000,7 +41002,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41000
41002
|
Opcode::NOOP
|
41001
41003
|
*/
|
41002
41004
|
// TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
|
41003
|
-
bytes:
|
41005
|
+
bytes: arrayify("0x24000000"),
|
41004
41006
|
encodeScriptData: () => new Uint8Array(0)
|
41005
41007
|
};
|
41006
41008
|
var withdrawScript = {
|
@@ -41014,7 +41016,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41014
41016
|
00000000 00000000 [amount value]
|
41015
41017
|
*/
|
41016
41018
|
// TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
|
41017
|
-
bytes:
|
41019
|
+
bytes: arrayify("0x5040C0105D44C0064C40001124000000"),
|
41018
41020
|
encodeScriptData: () => new Uint8Array(0)
|
41019
41021
|
};
|
41020
41022
|
|
@@ -41042,8 +41044,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41042
41044
|
constructor({ script, scriptData, gasLimit, ...rest } = {}) {
|
41043
41045
|
super(rest);
|
41044
41046
|
this.gasLimit = bn(gasLimit);
|
41045
|
-
this.script =
|
41046
|
-
this.scriptData =
|
41047
|
+
this.script = arrayify(script ?? returnZeroScript.bytes);
|
41048
|
+
this.scriptData = arrayify(scriptData ?? returnZeroScript.encodeScriptData());
|
41047
41049
|
}
|
41048
41050
|
/**
|
41049
41051
|
* Converts the transaction request to a `TransactionScript`.
|
@@ -41051,8 +41053,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41051
41053
|
* @returns The transaction script object.
|
41052
41054
|
*/
|
41053
41055
|
toTransaction() {
|
41054
|
-
const script =
|
41055
|
-
const scriptData =
|
41056
|
+
const script = arrayify(this.script ?? "0x");
|
41057
|
+
const scriptData = arrayify(this.scriptData ?? "0x");
|
41056
41058
|
return {
|
41057
41059
|
type: TransactionType.Script,
|
41058
41060
|
scriptGasLimit: this.gasLimit,
|
@@ -41215,7 +41217,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41215
41217
|
} = params;
|
41216
41218
|
const gasPerByte = bn(feeParams.gasPerByte);
|
41217
41219
|
const gasPriceFactor = bn(feeParams.gasPriceFactor);
|
41218
|
-
const transactionBytes =
|
41220
|
+
const transactionBytes = arrayify(rawPayload);
|
41219
41221
|
const [transaction] = new TransactionCoder().decode(transactionBytes, 0);
|
41220
41222
|
if (transaction.type === TransactionType.Mint) {
|
41221
41223
|
return {
|
@@ -41230,7 +41232,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41230
41232
|
let gasLimit = bn(0);
|
41231
41233
|
if (type3 === TransactionType.Create) {
|
41232
41234
|
const { bytecodeWitnessIndex, storageSlots } = transaction;
|
41233
|
-
const contractBytesSize = bn(
|
41235
|
+
const contractBytesSize = bn(arrayify(witnesses[bytecodeWitnessIndex].data).length);
|
41234
41236
|
metadataGas = calculateMetadataGasForTxCreate({
|
41235
41237
|
contractBytesSize,
|
41236
41238
|
gasCosts,
|
@@ -42023,7 +42025,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42023
42025
|
*/
|
42024
42026
|
decodeTransaction(transactionWithReceipts) {
|
42025
42027
|
return new TransactionCoder().decode(
|
42026
|
-
|
42028
|
+
arrayify(transactionWithReceipts.rawPayload),
|
42027
42029
|
0
|
42028
42030
|
)?.[0];
|
42029
42031
|
}
|
@@ -42049,7 +42051,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42049
42051
|
id: this.id,
|
42050
42052
|
receipts,
|
42051
42053
|
transaction: decodedTransaction,
|
42052
|
-
transactionBytes:
|
42054
|
+
transactionBytes: arrayify(transaction.rawPayload),
|
42053
42055
|
gqlTransactionStatus: transaction.status,
|
42054
42056
|
gasPerByte,
|
42055
42057
|
gasPriceFactor,
|
@@ -42825,7 +42827,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42825
42827
|
time: block2.header.time,
|
42826
42828
|
transactionIds: block2.transactions.map((tx) => tx.id),
|
42827
42829
|
transactions: block2.transactions.map(
|
42828
|
-
(tx) => new TransactionCoder().decode(
|
42830
|
+
(tx) => new TransactionCoder().decode(arrayify(tx.rawPayload), 0)?.[0]
|
42829
42831
|
)
|
42830
42832
|
};
|
42831
42833
|
}
|
@@ -42841,7 +42843,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42841
42843
|
return null;
|
42842
42844
|
}
|
42843
42845
|
return new TransactionCoder().decode(
|
42844
|
-
|
42846
|
+
arrayify(transaction.rawPayload),
|
42845
42847
|
0
|
42846
42848
|
)?.[0];
|
42847
42849
|
}
|
@@ -43080,7 +43082,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43080
43082
|
);
|
43081
43083
|
}
|
43082
43084
|
const [decodedTransaction] = new TransactionCoder().decode(
|
43083
|
-
|
43085
|
+
arrayify(gqlTransaction.rawPayload),
|
43084
43086
|
0
|
43085
43087
|
);
|
43086
43088
|
const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
|
@@ -43091,7 +43093,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43091
43093
|
id: gqlTransaction.id,
|
43092
43094
|
receipts,
|
43093
43095
|
transaction: decodedTransaction,
|
43094
|
-
transactionBytes:
|
43096
|
+
transactionBytes: arrayify(gqlTransaction.rawPayload),
|
43095
43097
|
gqlTransactionStatus: gqlTransaction.status,
|
43096
43098
|
gasPerByte: bn(gasPerByte),
|
43097
43099
|
gasPriceFactor: bn(gasPriceFactor),
|
@@ -43133,13 +43135,13 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43133
43135
|
const transactions = edges.map((edge) => {
|
43134
43136
|
const { node: gqlTransaction } = edge;
|
43135
43137
|
const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
|
43136
|
-
const [decodedTransaction] = new TransactionCoder().decode(
|
43138
|
+
const [decodedTransaction] = new TransactionCoder().decode(arrayify(rawPayload), 0);
|
43137
43139
|
const receipts = gqlReceipts?.map(processGqlReceipt) || [];
|
43138
43140
|
const transactionSummary = assembleTransactionSummary({
|
43139
43141
|
id,
|
43140
43142
|
receipts,
|
43141
43143
|
transaction: decodedTransaction,
|
43142
|
-
transactionBytes:
|
43144
|
+
transactionBytes: arrayify(rawPayload),
|
43143
43145
|
gqlTransactionStatus: status,
|
43144
43146
|
abiMap,
|
43145
43147
|
gasPerByte,
|
@@ -43287,9 +43289,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43287
43289
|
const numberCoder = new U64Coder();
|
43288
43290
|
const encoded = numberCoder.encode(new BN(amountToTransfer).toNumber());
|
43289
43291
|
const scriptData = Uint8Array.from([
|
43290
|
-
...
|
43292
|
+
...arrayify(hexlifiedContractId),
|
43291
43293
|
...encoded,
|
43292
|
-
...
|
43294
|
+
...arrayify(assetId)
|
43293
43295
|
]);
|
43294
43296
|
return scriptData;
|
43295
43297
|
};
|
@@ -43617,14 +43619,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43617
43619
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
43618
43620
|
const { minGasPrice } = this.provider.getGasConfig();
|
43619
43621
|
const recipientAddress = Address.fromAddressOrString(recipient);
|
43620
|
-
const recipientDataArray =
|
43622
|
+
const recipientDataArray = arrayify(
|
43621
43623
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
43622
43624
|
);
|
43623
|
-
const amountDataArray =
|
43625
|
+
const amountDataArray = arrayify(
|
43624
43626
|
"0x".concat(bn(amount).toHex().substring(2).padStart(16, "0"))
|
43625
43627
|
);
|
43626
43628
|
const script = new Uint8Array([
|
43627
|
-
...
|
43629
|
+
...arrayify(withdrawScript.bytes),
|
43628
43630
|
...recipientDataArray,
|
43629
43631
|
...amountDataArray
|
43630
43632
|
]);
|
@@ -45424,11 +45426,11 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45424
45426
|
* @returns hashed signature
|
45425
45427
|
*/
|
45426
45428
|
sign(data) {
|
45427
|
-
const signature = secp256k1.sign(
|
45429
|
+
const signature = secp256k1.sign(arrayify(data), arrayify(this.privateKey));
|
45428
45430
|
const r = toBytes3(`0x${signature.r.toString(16)}`, 32);
|
45429
45431
|
const s = toBytes3(`0x${signature.s.toString(16)}`, 32);
|
45430
45432
|
s[0] |= (signature.recovery || 0) << 7;
|
45431
|
-
return concat([r, s]);
|
45433
|
+
return hexlify(concat([r, s]));
|
45432
45434
|
}
|
45433
45435
|
/**
|
45434
45436
|
* Add point on the current elliptic curve
|
@@ -45437,8 +45439,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45437
45439
|
* @returns compressed point on the curve
|
45438
45440
|
*/
|
45439
45441
|
addPoint(point) {
|
45440
|
-
const p0 = secp256k1.ProjectivePoint.fromHex(
|
45441
|
-
const p1 = secp256k1.ProjectivePoint.fromHex(
|
45442
|
+
const p0 = secp256k1.ProjectivePoint.fromHex(arrayify(this.compressedPublicKey));
|
45443
|
+
const p1 = secp256k1.ProjectivePoint.fromHex(arrayify(point));
|
45442
45444
|
const result = p0.add(p1);
|
45443
45445
|
return `0x${result.toHex(true)}`;
|
45444
45446
|
}
|
@@ -45450,7 +45452,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45450
45452
|
* @returns public key from signature from the
|
45451
45453
|
*/
|
45452
45454
|
static recoverPublicKey(data, signature) {
|
45453
|
-
const signedMessageBytes =
|
45455
|
+
const signedMessageBytes = arrayify(signature);
|
45454
45456
|
const r = signedMessageBytes.slice(0, 32);
|
45455
45457
|
const s = signedMessageBytes.slice(32, 64);
|
45456
45458
|
const recoveryParam = (s[0] & 128) >> 7;
|
@@ -45458,7 +45460,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45458
45460
|
const sig = new secp256k1.Signature(BigInt(hexlify(r)), BigInt(hexlify(s))).addRecoveryBit(
|
45459
45461
|
recoveryParam
|
45460
45462
|
);
|
45461
|
-
const publicKey = sig.recoverPublicKey(
|
45463
|
+
const publicKey = sig.recoverPublicKey(arrayify(data)).toRawBytes(false).slice(1);
|
45462
45464
|
return hexlify(publicKey);
|
45463
45465
|
}
|
45464
45466
|
/**
|
@@ -45478,7 +45480,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45478
45480
|
* @returns random 32-byte hashed
|
45479
45481
|
*/
|
45480
45482
|
static generatePrivateKey(entropy) {
|
45481
|
-
return entropy ? hash3(concat([randomBytes22(32),
|
45483
|
+
return entropy ? hash3(concat([randomBytes22(32), arrayify(entropy)])) : randomBytes22(32);
|
45482
45484
|
}
|
45483
45485
|
/**
|
45484
45486
|
* Extended publicKey from a compact publicKey
|
@@ -45487,7 +45489,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45487
45489
|
* @returns extended publicKey
|
45488
45490
|
*/
|
45489
45491
|
static extendPublicKey(publicKey) {
|
45490
|
-
const point = secp256k1.ProjectivePoint.fromHex(
|
45492
|
+
const point = secp256k1.ProjectivePoint.fromHex(arrayify(publicKey));
|
45491
45493
|
return hexlify(point.toRawBytes(false).slice(1));
|
45492
45494
|
}
|
45493
45495
|
};
|
@@ -45666,7 +45668,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45666
45668
|
*/
|
45667
45669
|
async signMessage(message) {
|
45668
45670
|
const signedMessage = await this.signer().sign(hashMessage(message));
|
45669
|
-
return signedMessage;
|
45671
|
+
return hexlify(signedMessage);
|
45670
45672
|
}
|
45671
45673
|
/**
|
45672
45674
|
* Signs a transaction with the wallet's private key.
|
@@ -45679,7 +45681,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45679
45681
|
const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
|
45680
45682
|
const hashedTransaction = transactionRequest.getTransactionId(chainId);
|
45681
45683
|
const signature = await this.signer().sign(hashedTransaction);
|
45682
|
-
return signature;
|
45684
|
+
return hexlify(signature);
|
45683
45685
|
}
|
45684
45686
|
/**
|
45685
45687
|
* Populates a transaction with the witnesses signature.
|
@@ -47862,14 +47864,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47862
47864
|
}
|
47863
47865
|
}
|
47864
47866
|
const checksumBits = entropy.length / 4;
|
47865
|
-
const checksum =
|
47867
|
+
const checksum = arrayify(sha2562(entropy))[0] & getUpperMask(checksumBits);
|
47866
47868
|
indices[indices.length - 1] <<= checksumBits;
|
47867
47869
|
indices[indices.length - 1] |= checksum >> 8 - checksumBits;
|
47868
47870
|
return indices;
|
47869
47871
|
}
|
47870
47872
|
function mnemonicWordsToEntropy(words, wordlist) {
|
47871
47873
|
const size = Math.ceil(11 * words.length / 8);
|
47872
|
-
const entropy =
|
47874
|
+
const entropy = arrayify(new Uint8Array(size));
|
47873
47875
|
let offset = 0;
|
47874
47876
|
for (let i = 0; i < words.length; i += 1) {
|
47875
47877
|
const index = wordlist.indexOf(words[i].normalize("NFKD"));
|
@@ -47889,7 +47891,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47889
47891
|
const entropyBits = 32 * words.length / 3;
|
47890
47892
|
const checksumBits = words.length / 3;
|
47891
47893
|
const checksumMask = getUpperMask(checksumBits);
|
47892
|
-
const checksum =
|
47894
|
+
const checksum = arrayify(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
|
47893
47895
|
if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
|
47894
47896
|
throw new FuelError(
|
47895
47897
|
ErrorCode.INVALID_CHECKSUM,
|
@@ -47972,7 +47974,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47972
47974
|
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
47973
47975
|
*/
|
47974
47976
|
static entropyToMnemonic(entropy, wordlist = english) {
|
47975
|
-
const entropyBytes =
|
47977
|
+
const entropyBytes = arrayify(entropy);
|
47976
47978
|
assertWordList(wordlist);
|
47977
47979
|
assertEntropy(entropyBytes);
|
47978
47980
|
return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
|
@@ -48041,14 +48043,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48041
48043
|
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
48042
48044
|
*/
|
48043
48045
|
static masterKeysFromSeed(seed) {
|
48044
|
-
const seedArray =
|
48046
|
+
const seedArray = arrayify(seed);
|
48045
48047
|
if (seedArray.length < 16 || seedArray.length > 64) {
|
48046
48048
|
throw new FuelError(
|
48047
48049
|
ErrorCode.INVALID_SEED,
|
48048
48050
|
`Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
|
48049
48051
|
);
|
48050
48052
|
}
|
48051
|
-
return
|
48053
|
+
return arrayify(computeHmac("sha512", MasterSecret, seedArray));
|
48052
48054
|
}
|
48053
48055
|
/**
|
48054
48056
|
* Get the extendKey as defined on BIP-32 from the provided seed
|
@@ -48059,7 +48061,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48059
48061
|
*/
|
48060
48062
|
static seedToExtendedKey(seed, testnet = false) {
|
48061
48063
|
const masterKey = Mnemonic.masterKeysFromSeed(seed);
|
48062
|
-
const prefix =
|
48064
|
+
const prefix = arrayify(testnet ? TestnetPRV : MainnetPRV);
|
48063
48065
|
const depth = "0x00";
|
48064
48066
|
const fingerprint = "0x00000000";
|
48065
48067
|
const index = "0x00000000";
|
@@ -48089,7 +48091,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48089
48091
|
* @returns A randomly generated mnemonic
|
48090
48092
|
*/
|
48091
48093
|
static generate(size = 32, extraEntropy = "") {
|
48092
|
-
const entropy = extraEntropy ? sha2562(concat([randomBytes22(size),
|
48094
|
+
const entropy = extraEntropy ? sha2562(concat([randomBytes22(size), arrayify(extraEntropy)])) : randomBytes22(size);
|
48093
48095
|
return Mnemonic.entropyToMnemonic(entropy);
|
48094
48096
|
}
|
48095
48097
|
};
|
@@ -48174,9 +48176,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48174
48176
|
* @returns A new instance of HDWallet on the derived index
|
48175
48177
|
*/
|
48176
48178
|
deriveIndex(index) {
|
48177
|
-
const privateKey = this.privateKey &&
|
48178
|
-
const publicKey =
|
48179
|
-
const chainCode =
|
48179
|
+
const privateKey = this.privateKey && arrayify(this.privateKey);
|
48180
|
+
const publicKey = arrayify(this.publicKey);
|
48181
|
+
const chainCode = arrayify(this.chainCode);
|
48180
48182
|
const data = new Uint8Array(37);
|
48181
48183
|
if (index & HARDENED_INDEX) {
|
48182
48184
|
if (!privateKey) {
|
@@ -48187,10 +48189,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48187
48189
|
}
|
48188
48190
|
data.set(privateKey, 1);
|
48189
48191
|
} else {
|
48190
|
-
data.set(
|
48192
|
+
data.set(arrayify(this.publicKey));
|
48191
48193
|
}
|
48192
48194
|
data.set(toBytes3(index, 4), 33);
|
48193
|
-
const bytes4 =
|
48195
|
+
const bytes4 = arrayify(computeHmac("sha512", chainCode, data));
|
48194
48196
|
const IL = bytes4.slice(0, 32);
|
48195
48197
|
const IR = bytes4.slice(32);
|
48196
48198
|
if (privateKey) {
|
@@ -48244,9 +48246,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48244
48246
|
const index = toHex(this.index, 4);
|
48245
48247
|
const chainCode = this.chainCode;
|
48246
48248
|
const key = this.privateKey != null && !isPublic ? concat(["0x00", this.privateKey]) : this.publicKey;
|
48247
|
-
const extendedKey =
|
48248
|
-
concat([prefix, depth, parentFingerprint, index, chainCode, key])
|
48249
|
-
);
|
48249
|
+
const extendedKey = arrayify(concat([prefix, depth, parentFingerprint, index, chainCode, key]));
|
48250
48250
|
return base58check(extendedKey);
|
48251
48251
|
}
|
48252
48252
|
/**
|
@@ -48258,13 +48258,13 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48258
48258
|
static fromSeed(seed) {
|
48259
48259
|
const masterKey = mnemonic_default.masterKeysFromSeed(seed);
|
48260
48260
|
return new HDWallet({
|
48261
|
-
chainCode:
|
48262
|
-
privateKey:
|
48261
|
+
chainCode: arrayify(masterKey.slice(32)),
|
48262
|
+
privateKey: arrayify(masterKey.slice(0, 32))
|
48263
48263
|
});
|
48264
48264
|
}
|
48265
48265
|
static fromExtendedKey(extendedKey) {
|
48266
48266
|
const decoded = toBeHex(decodeBase58(extendedKey));
|
48267
|
-
const bytes4 =
|
48267
|
+
const bytes4 = arrayify(decoded);
|
48268
48268
|
const validChecksum = base58check(bytes4.slice(0, 78)) === extendedKey;
|
48269
48269
|
if (bytes4.length !== 82 || !isValidExtendedKey(bytes4)) {
|
48270
48270
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
@@ -48930,7 +48930,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
48930
48930
|
// src/predicate/utils/getPredicateRoot.ts
|
48931
48931
|
var getPredicateRoot = (bytecode) => {
|
48932
48932
|
const chunkSize = 16 * 1024;
|
48933
|
-
const bytes4 =
|
48933
|
+
const bytes4 = arrayify(bytecode);
|
48934
48934
|
const chunks = chunkAndPadBytes(bytes4, chunkSize);
|
48935
48935
|
const codeRoot = calcRoot(chunks.map((c) => hexlify(c)));
|
48936
48936
|
const predicateRoot = hash3(concat(["0x4655454C", codeRoot]));
|
@@ -49043,7 +49043,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
49043
49043
|
* @returns An object containing the new predicate bytes and interface.
|
49044
49044
|
*/
|
49045
49045
|
static processPredicateData(bytes4, jsonAbi, configurableConstants) {
|
49046
|
-
let predicateBytes =
|
49046
|
+
let predicateBytes = arrayify(bytes4);
|
49047
49047
|
let abiInterface;
|
49048
49048
|
if (jsonAbi) {
|
49049
49049
|
abiInterface = new Interface(jsonAbi);
|