@fuel-ts/account 0.78.0 → 0.80.0
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/configs.d.ts +1 -0
- package/dist/configs.d.ts.map +1 -1
- package/dist/configs.global.js +1 -0
- package/dist/configs.global.js.map +1 -1
- package/dist/configs.js +3 -0
- package/dist/configs.js.map +1 -1
- package/dist/configs.mjs +2 -0
- package/dist/configs.mjs.map +1 -1
- package/dist/index.global.js +388 -210
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +668 -550
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +422 -299
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +0 -1
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +13 -2
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/input.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts +3 -0
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/types.d.ts +5 -0
- package/dist/providers/transaction-request/types.d.ts.map +1 -1
- package/dist/providers/transaction-response/getDecodedLogs.d.ts +2 -2
- package/dist/providers/transaction-response/getDecodedLogs.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts +5 -2
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/utils/extract-tx-error.d.ts +36 -0
- package/dist/providers/utils/extract-tx-error.d.ts.map +1 -0
- package/dist/providers/utils/index.d.ts +1 -0
- package/dist/providers/utils/index.d.ts.map +1 -1
- package/dist/test-utils.global.js +390 -196
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +625 -499
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +392 -258
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
@@ -31914,9 +31914,9 @@ spurious results.`);
|
|
31914
31914
|
// ../versions/dist/index.mjs
|
31915
31915
|
function getBuiltinVersions() {
|
31916
31916
|
return {
|
31917
|
-
FORC: "0.
|
31917
|
+
FORC: "0.49.3",
|
31918
31918
|
FUEL_CORE: "0.22.1",
|
31919
|
-
FUELS: "0.
|
31919
|
+
FUELS: "0.80.0"
|
31920
31920
|
};
|
31921
31921
|
}
|
31922
31922
|
function parseVersion(version2) {
|
@@ -31975,9 +31975,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31975
31975
|
ErrorCode2["ABI_TYPES_AND_VALUES_MISMATCH"] = "abi-types-and-values-mismatch";
|
31976
31976
|
ErrorCode2["ABI_MAIN_METHOD_MISSING"] = "abi-main-method-missing";
|
31977
31977
|
ErrorCode2["INVALID_COMPONENT"] = "invalid-component";
|
31978
|
-
ErrorCode2["FRAGMENT_NOT_FOUND"] = "fragment-not-found";
|
31979
31978
|
ErrorCode2["CONFIGURABLE_NOT_FOUND"] = "configurable-not-found";
|
31980
31979
|
ErrorCode2["TYPE_NOT_FOUND"] = "type-not-found";
|
31980
|
+
ErrorCode2["LOG_TYPE_NOT_FOUND"] = "log-type-not-found";
|
31981
31981
|
ErrorCode2["TYPE_NOT_SUPPORTED"] = "type-not-supported";
|
31982
31982
|
ErrorCode2["INVALID_DECODE_VALUE"] = "invalid-decode-value";
|
31983
31983
|
ErrorCode2["JSON_ABI_ERROR"] = "json-abi-error";
|
@@ -31990,14 +31990,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31990
31990
|
ErrorCode2["INVALID_BECH32_ADDRESS"] = "invalid-bech32-address";
|
31991
31991
|
ErrorCode2["INVALID_EVM_ADDRESS"] = "invalid-evm-address";
|
31992
31992
|
ErrorCode2["INVALID_B256_ADDRESS"] = "invalid-b256-address";
|
31993
|
-
ErrorCode2["INVALID_URL"] = "invalid-url";
|
31994
31993
|
ErrorCode2["CHAIN_INFO_CACHE_EMPTY"] = "chain-info-cache-empty";
|
31995
31994
|
ErrorCode2["NODE_INFO_CACHE_EMPTY"] = "node-info-cache-empty";
|
31996
31995
|
ErrorCode2["MISSING_PROVIDER"] = "missing-provider";
|
31997
31996
|
ErrorCode2["INVALID_PROVIDER"] = "invalid-provider";
|
31998
31997
|
ErrorCode2["CONNECTION_REFUSED"] = "connection-refused";
|
31999
31998
|
ErrorCode2["INVALID_PUBLIC_KEY"] = "invalid-public-key";
|
32000
|
-
ErrorCode2["INSUFFICIENT_BALANCE"] = "insufficient-balance";
|
32001
31999
|
ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
|
32002
32000
|
ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
|
32003
32001
|
ErrorCode2["MISSING_CONNECTOR"] = "missing-connector";
|
@@ -32014,7 +32012,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32014
32012
|
ErrorCode2["ELEMENT_NOT_FOUND"] = "element-not-found";
|
32015
32013
|
ErrorCode2["MISSING_REQUIRED_PARAMETER"] = "missing-required-parameter";
|
32016
32014
|
ErrorCode2["INVALID_REQUEST"] = "invalid-request";
|
32017
|
-
ErrorCode2["UNEXPECTED_HEX_VALUE"] = "unexpected-hex-value";
|
32018
32015
|
ErrorCode2["INVALID_TRANSFER_AMOUNT"] = "invalid-transfer-amount";
|
32019
32016
|
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
|
32020
32017
|
ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
|
@@ -32038,7 +32035,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32038
32035
|
ErrorCode2["INVALID_PASSWORD"] = "invalid-password";
|
32039
32036
|
ErrorCode2["ACCOUNT_REQUIRED"] = "account-required";
|
32040
32037
|
ErrorCode2["UNLOCKED_WALLET_REQUIRED"] = "unlocked-wallet-required";
|
32041
|
-
ErrorCode2["LATEST_BLOCK_UNAVAILABLE"] = "latest-block-unavailable";
|
32042
32038
|
ErrorCode2["ERROR_BUILDING_BLOCK_EXPLORER_URL"] = "error-building-block-explorer-url";
|
32043
32039
|
ErrorCode2["UNSUPPORTED_FUEL_CLIENT_VERSION"] = "unsupported-fuel-client-version";
|
32044
32040
|
ErrorCode2["VITEPRESS_PLUGIN_ERROR"] = "vitepress-plugin-error";
|
@@ -32050,6 +32046,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32050
32046
|
})(ErrorCode || {});
|
32051
32047
|
var _FuelError = class extends Error {
|
32052
32048
|
VERSIONS = versions;
|
32049
|
+
metadata;
|
32053
32050
|
static parse(e) {
|
32054
32051
|
const error = e;
|
32055
32052
|
if (error.code === void 0) {
|
@@ -32069,14 +32066,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32069
32066
|
return new _FuelError(error.code, error.message);
|
32070
32067
|
}
|
32071
32068
|
code;
|
32072
|
-
constructor(code, message) {
|
32069
|
+
constructor(code, message, metadata = {}) {
|
32073
32070
|
super(message);
|
32074
32071
|
this.code = code;
|
32075
32072
|
this.name = "FuelError";
|
32073
|
+
this.metadata = metadata;
|
32076
32074
|
}
|
32077
32075
|
toObject() {
|
32078
|
-
const { code, name, message, VERSIONS } = this;
|
32079
|
-
return { code, name, message, VERSIONS };
|
32076
|
+
const { code, name, message, metadata, VERSIONS } = this;
|
32077
|
+
return { code, name, message, metadata, VERSIONS };
|
32080
32078
|
}
|
32081
32079
|
};
|
32082
32080
|
var FuelError = _FuelError;
|
@@ -34765,7 +34763,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34765
34763
|
var import_bn = __toESM(require_bn(), 1);
|
34766
34764
|
var DEFAULT_PRECISION = 9;
|
34767
34765
|
var DEFAULT_MIN_PRECISION = 3;
|
34768
|
-
var
|
34766
|
+
var DEFAULT_DECIMAL_UNITS = 9;
|
34769
34767
|
function toFixed(value, options) {
|
34770
34768
|
const { precision = DEFAULT_PRECISION, minPrecision = DEFAULT_MIN_PRECISION } = options || {};
|
34771
34769
|
const [valueUnits = "0", valueDecimals = "0"] = String(value || "0.0").split(".");
|
@@ -34831,7 +34829,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34831
34829
|
}
|
34832
34830
|
format(options) {
|
34833
34831
|
const {
|
34834
|
-
units =
|
34832
|
+
units = DEFAULT_DECIMAL_UNITS,
|
34835
34833
|
precision = DEFAULT_PRECISION,
|
34836
34834
|
minPrecision = DEFAULT_MIN_PRECISION
|
34837
34835
|
} = options || {};
|
@@ -34847,7 +34845,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34847
34845
|
}
|
34848
34846
|
return formattedFixed;
|
34849
34847
|
}
|
34850
|
-
formatUnits(units =
|
34848
|
+
formatUnits(units = DEFAULT_DECIMAL_UNITS) {
|
34851
34849
|
const valueUnits = this.toString().slice(0, units * -1);
|
34852
34850
|
const valueDecimals = this.toString().slice(units * -1);
|
34853
34851
|
const length = valueDecimals.length;
|
@@ -34956,7 +34954,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34956
34954
|
// END ANCHOR: OVERRIDES to avoid losing references
|
34957
34955
|
};
|
34958
34956
|
var bn = (value, base, endian) => new BN(value, base, endian);
|
34959
|
-
bn.parseUnits = (value, units =
|
34957
|
+
bn.parseUnits = (value, units = DEFAULT_DECIMAL_UNITS) => {
|
34960
34958
|
const valueToParse = value === "." ? "0." : value;
|
34961
34959
|
const [valueUnits = "0", valueDecimals = "0"] = valueToParse.split(".");
|
34962
34960
|
const length = valueDecimals.length;
|
@@ -35072,6 +35070,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35072
35070
|
var ENCODING_V1 = "1";
|
35073
35071
|
var WORD_SIZE = 8;
|
35074
35072
|
var BYTES_32 = 32;
|
35073
|
+
var UTXO_ID_LEN = BYTES_32 + 1;
|
35075
35074
|
var ASSET_ID_LEN = BYTES_32;
|
35076
35075
|
var ADDRESS_LEN = BYTES_32;
|
35077
35076
|
var NONCE_LEN = BYTES_32;
|
@@ -35222,15 +35221,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35222
35221
|
}
|
35223
35222
|
};
|
35224
35223
|
var isHeapType = (type3) => type3 === VEC_CODER_TYPE || type3 === BYTES_CODER_TYPE || type3 === STD_STRING_CODER_TYPE;
|
35225
|
-
function findOrThrow(arr, predicate, throwFn = () => {
|
35226
|
-
throw new FuelError(ErrorCode.ELEMENT_NOT_FOUND, "Element not found in the array.");
|
35227
|
-
}) {
|
35228
|
-
const found = arr.find(predicate);
|
35229
|
-
if (found === void 0) {
|
35230
|
-
throwFn();
|
35231
|
-
}
|
35232
|
-
return found;
|
35233
|
-
}
|
35234
35224
|
var isMultipleOfWordSize = (length) => length % WORD_SIZE === 0;
|
35235
35225
|
var getWordSizePadding = (length) => WORD_SIZE - length % WORD_SIZE;
|
35236
35226
|
var rightPadToWordSize = (encoded) => {
|
@@ -35240,6 +35230,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35240
35230
|
const padding = new Uint8Array(WORD_SIZE - encoded.length % WORD_SIZE);
|
35241
35231
|
return concatBytes2([encoded, padding]);
|
35242
35232
|
};
|
35233
|
+
var isUint8Array = (value) => value instanceof Uint8Array;
|
35243
35234
|
var ArrayCoder = class extends Coder {
|
35244
35235
|
coder;
|
35245
35236
|
length;
|
@@ -35383,9 +35374,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35383
35374
|
__privateAdd2(this, _getPaddedData);
|
35384
35375
|
}
|
35385
35376
|
encode(value) {
|
35386
|
-
if (!Array.isArray(value)) {
|
35387
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
35388
|
-
}
|
35389
35377
|
const parts = [];
|
35390
35378
|
const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
|
35391
35379
|
const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
|
@@ -35412,7 +35400,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35412
35400
|
};
|
35413
35401
|
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
35414
35402
|
getPaddedData_fn = function(value) {
|
35415
|
-
const data = [Uint8Array
|
35403
|
+
const data = value instanceof Uint8Array ? [value] : [new Uint8Array(value)];
|
35416
35404
|
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
35417
35405
|
if (paddingLength) {
|
35418
35406
|
data.push(new Uint8Array(paddingLength));
|
@@ -35435,7 +35423,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35435
35423
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
35436
35424
|
0
|
35437
35425
|
);
|
35438
|
-
super(
|
35426
|
+
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
35439
35427
|
this.name = name;
|
35440
35428
|
this.coders = coders;
|
35441
35429
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -35505,7 +35493,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35505
35493
|
return { None: [] };
|
35506
35494
|
}
|
35507
35495
|
decode(data, offset) {
|
35508
|
-
if (data.length < this.encodedLength
|
35496
|
+
if (data.length < this.encodedLength) {
|
35509
35497
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
35510
35498
|
}
|
35511
35499
|
const [decoded, newOffset] = super.decode(data, offset);
|
@@ -35784,8 +35772,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35784
35772
|
this.coder = coder;
|
35785
35773
|
}
|
35786
35774
|
encode(value) {
|
35787
|
-
if (!Array.isArray(value)) {
|
35788
|
-
throw new FuelError(
|
35775
|
+
if (!Array.isArray(value) && !isUint8Array(value)) {
|
35776
|
+
throw new FuelError(
|
35777
|
+
ErrorCode.ENCODE_ERROR,
|
35778
|
+
`Expected array value, or a Uint8Array. You can use arrayify to convert a value to a Uint8Array.`
|
35779
|
+
);
|
35789
35780
|
}
|
35790
35781
|
const parts = [];
|
35791
35782
|
const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
|
@@ -35816,6 +35807,38 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35816
35807
|
];
|
35817
35808
|
}
|
35818
35809
|
};
|
35810
|
+
var findFunctionByName = (abi, name) => {
|
35811
|
+
const fn = abi.functions.find((f2) => f2.name === name);
|
35812
|
+
if (!fn) {
|
35813
|
+
throw new FuelError(
|
35814
|
+
ErrorCode.FUNCTION_NOT_FOUND,
|
35815
|
+
`Function with name '${name}' doesn't exist in the ABI`
|
35816
|
+
);
|
35817
|
+
}
|
35818
|
+
return fn;
|
35819
|
+
};
|
35820
|
+
var findTypeById = (abi, typeId) => {
|
35821
|
+
const type3 = abi.types.find((t) => t.typeId === typeId);
|
35822
|
+
if (!type3) {
|
35823
|
+
throw new FuelError(
|
35824
|
+
ErrorCode.TYPE_NOT_FOUND,
|
35825
|
+
`Type with typeId '${typeId}' doesn't exist in the ABI.`
|
35826
|
+
);
|
35827
|
+
}
|
35828
|
+
return type3;
|
35829
|
+
};
|
35830
|
+
var findNonEmptyInputs = (abi, inputs) => inputs.filter((input) => findTypeById(abi, input.type).type !== "()");
|
35831
|
+
var findVectorBufferArgument = (components) => {
|
35832
|
+
const bufferComponent = components.find((c) => c.name === "buf");
|
35833
|
+
const bufferTypeArgument = bufferComponent?.originalTypeArguments?.[0];
|
35834
|
+
if (!bufferComponent || !bufferTypeArgument) {
|
35835
|
+
throw new FuelError(
|
35836
|
+
ErrorCode.INVALID_COMPONENT,
|
35837
|
+
`The Vec type provided is missing or has a malformed 'buf' component.`
|
35838
|
+
);
|
35839
|
+
}
|
35840
|
+
return bufferTypeArgument;
|
35841
|
+
};
|
35819
35842
|
var ResolvedAbiType = class {
|
35820
35843
|
abi;
|
35821
35844
|
name;
|
@@ -35824,20 +35847,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35824
35847
|
components;
|
35825
35848
|
constructor(abi, argument) {
|
35826
35849
|
this.abi = abi;
|
35827
|
-
const type3 = findOrThrow(
|
35828
|
-
abi.types,
|
35829
|
-
(t) => t.typeId === argument.type,
|
35830
|
-
() => {
|
35831
|
-
throw new FuelError(
|
35832
|
-
ErrorCode.TYPE_NOT_FOUND,
|
35833
|
-
`Type does not exist in the provided abi: ${JSON.stringify({
|
35834
|
-
argument,
|
35835
|
-
abi: this.abi
|
35836
|
-
})}`
|
35837
|
-
);
|
35838
|
-
}
|
35839
|
-
);
|
35840
35850
|
this.name = argument.name;
|
35851
|
+
const type3 = findTypeById(abi, argument.type);
|
35841
35852
|
this.type = type3.type;
|
35842
35853
|
this.originalTypeArguments = argument.typeArguments;
|
35843
35854
|
this.components = ResolvedAbiType.getResolvedGenericComponents(
|
@@ -35889,7 +35900,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35889
35900
|
)
|
35890
35901
|
};
|
35891
35902
|
}
|
35892
|
-
const argType =
|
35903
|
+
const argType = findTypeById(abi, arg.type);
|
35893
35904
|
const implicitTypeParameters = this.getImplicitGenericTypeParameters(abi, argType.components);
|
35894
35905
|
if (implicitTypeParameters && implicitTypeParameters.length > 0) {
|
35895
35906
|
return {
|
@@ -35906,7 +35917,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35906
35917
|
}
|
35907
35918
|
const implicitGenericParameters = implicitGenericParametersParam ?? [];
|
35908
35919
|
args.forEach((a) => {
|
35909
|
-
const argType =
|
35920
|
+
const argType = findTypeById(abi, a.type);
|
35910
35921
|
if (genericRegEx.test(argType.type)) {
|
35911
35922
|
implicitGenericParameters.push(argType.typeId);
|
35912
35923
|
return;
|
@@ -36015,13 +36026,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36015
36026
|
return new ArrayCoder(arrayElementCoder, length);
|
36016
36027
|
}
|
36017
36028
|
if (resolvedAbiType.type === VEC_CODER_TYPE) {
|
36018
|
-
const arg =
|
36019
|
-
if (!arg) {
|
36020
|
-
throw new FuelError(
|
36021
|
-
ErrorCode.INVALID_COMPONENT,
|
36022
|
-
`The provided Vec type is missing the 'type argument'.`
|
36023
|
-
);
|
36024
|
-
}
|
36029
|
+
const arg = findVectorBufferArgument(components);
|
36025
36030
|
const argType = new ResolvedAbiType(resolvedAbiType.abi, arg);
|
36026
36031
|
const itemCoder = getCoder(argType, { isSmallBytes: true, encoding: ENCODING_V0 });
|
36027
36032
|
return new VecCoder(itemCoder);
|
@@ -36088,11 +36093,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36088
36093
|
super("struct", "struct Bytes", WORD_SIZE);
|
36089
36094
|
}
|
36090
36095
|
encode(value) {
|
36091
|
-
|
36092
|
-
|
36093
|
-
}
|
36094
|
-
const bytes3 = new Uint8Array(value);
|
36095
|
-
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
36096
|
+
const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
36097
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
|
36096
36098
|
return new Uint8Array([...lengthBytes, ...bytes3]);
|
36097
36099
|
}
|
36098
36100
|
decode(data, offset) {
|
@@ -36125,7 +36127,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36125
36127
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
36126
36128
|
0
|
36127
36129
|
);
|
36128
|
-
super(
|
36130
|
+
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
36129
36131
|
this.name = name;
|
36130
36132
|
this.coders = coders;
|
36131
36133
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -36223,6 +36225,28 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36223
36225
|
return [toNumber2(bytes3), offset + this.length];
|
36224
36226
|
}
|
36225
36227
|
};
|
36228
|
+
var OptionCoder2 = class extends EnumCoder2 {
|
36229
|
+
encode(value) {
|
36230
|
+
const result = super.encode(this.toSwayOption(value));
|
36231
|
+
return result;
|
36232
|
+
}
|
36233
|
+
toSwayOption(input) {
|
36234
|
+
if (input !== void 0) {
|
36235
|
+
return { Some: input };
|
36236
|
+
}
|
36237
|
+
return { None: [] };
|
36238
|
+
}
|
36239
|
+
decode(data, offset) {
|
36240
|
+
const [decoded, newOffset] = super.decode(data, offset);
|
36241
|
+
return [this.toOption(decoded), newOffset];
|
36242
|
+
}
|
36243
|
+
toOption(output3) {
|
36244
|
+
if (output3 && "Some" in output3) {
|
36245
|
+
return output3.Some;
|
36246
|
+
}
|
36247
|
+
return void 0;
|
36248
|
+
}
|
36249
|
+
};
|
36226
36250
|
var RawSliceCoder2 = class extends Coder {
|
36227
36251
|
constructor() {
|
36228
36252
|
super("raw untyped slice", "raw untyped slice", WORD_SIZE);
|
@@ -36276,6 +36300,30 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36276
36300
|
}
|
36277
36301
|
};
|
36278
36302
|
__publicField4(StdStringCoder2, "memorySize", 1);
|
36303
|
+
var StrSliceCoder = class extends Coder {
|
36304
|
+
constructor() {
|
36305
|
+
super("strSlice", "str", WORD_SIZE);
|
36306
|
+
}
|
36307
|
+
encode(value) {
|
36308
|
+
const bytes3 = toUtf8Bytes(value);
|
36309
|
+
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
36310
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
36311
|
+
}
|
36312
|
+
decode(data, offset) {
|
36313
|
+
if (data.length < this.encodedLength) {
|
36314
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice data size.`);
|
36315
|
+
}
|
36316
|
+
const offsetAndLength = offset + WORD_SIZE;
|
36317
|
+
const lengthBytes = data.slice(offset, offsetAndLength);
|
36318
|
+
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
36319
|
+
const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
|
36320
|
+
if (bytes3.length !== length) {
|
36321
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
36322
|
+
}
|
36323
|
+
return [toUtf8String(bytes3), offsetAndLength + length];
|
36324
|
+
}
|
36325
|
+
};
|
36326
|
+
__publicField4(StrSliceCoder, "memorySize", 1);
|
36279
36327
|
var StringCoder2 = class extends Coder {
|
36280
36328
|
constructor(length) {
|
36281
36329
|
super("string", `str[${length}]`, length);
|
@@ -36314,7 +36362,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36314
36362
|
Object.keys(this.coders).map((fieldName) => {
|
36315
36363
|
const fieldCoder = this.coders[fieldName];
|
36316
36364
|
const fieldValue = value[fieldName];
|
36317
|
-
if (!(fieldCoder instanceof
|
36365
|
+
if (!(fieldCoder instanceof OptionCoder2) && fieldValue == null) {
|
36318
36366
|
throw new FuelError(
|
36319
36367
|
ErrorCode.ENCODE_ERROR,
|
36320
36368
|
`Invalid ${this.type}. Field "${fieldName}" not present.`
|
@@ -36422,6 +36470,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36422
36470
|
return new ByteCoder2();
|
36423
36471
|
case STD_STRING_CODER_TYPE:
|
36424
36472
|
return new StdStringCoder2();
|
36473
|
+
case STR_SLICE_CODER_TYPE:
|
36474
|
+
return new StrSliceCoder();
|
36425
36475
|
default:
|
36426
36476
|
break;
|
36427
36477
|
}
|
@@ -36445,13 +36495,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36445
36495
|
return new ArrayCoder(arrayElementCoder, length);
|
36446
36496
|
}
|
36447
36497
|
if (resolvedAbiType.type === VEC_CODER_TYPE) {
|
36448
|
-
const arg =
|
36449
|
-
if (!arg) {
|
36450
|
-
throw new FuelError(
|
36451
|
-
ErrorCode.INVALID_COMPONENT,
|
36452
|
-
`The provided Vec type is missing the 'type argument'.`
|
36453
|
-
);
|
36454
|
-
}
|
36498
|
+
const arg = findVectorBufferArgument(components);
|
36455
36499
|
const argType = new ResolvedAbiType(resolvedAbiType.abi, arg);
|
36456
36500
|
const itemCoder = getCoder2(argType, { isSmallBytes: true, encoding: ENCODING_V0 });
|
36457
36501
|
return new VecCoder2(itemCoder);
|
@@ -36466,7 +36510,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36466
36510
|
const coders = getCoders(components, { getCoder: getCoder2 });
|
36467
36511
|
const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
|
36468
36512
|
if (isOptionEnum) {
|
36469
|
-
return new
|
36513
|
+
return new OptionCoder2(enumMatch.name, coders);
|
36470
36514
|
}
|
36471
36515
|
return new EnumCoder2(enumMatch.name, coders);
|
36472
36516
|
}
|
@@ -36477,12 +36521,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36477
36521
|
);
|
36478
36522
|
return new TupleCoder2(coders);
|
36479
36523
|
}
|
36480
|
-
if (resolvedAbiType.type === STR_SLICE_CODER_TYPE) {
|
36481
|
-
throw new FuelError(
|
36482
|
-
ErrorCode.INVALID_DATA,
|
36483
|
-
"String slices can not be decoded from logs. Convert the slice to `str[N]` with `__to_str_array`"
|
36484
|
-
);
|
36485
|
-
}
|
36486
36524
|
throw new FuelError(
|
36487
36525
|
ErrorCode.CODER_NOT_FOUND,
|
36488
36526
|
`Coder not found: ${JSON.stringify(resolvedAbiType)}.`
|
@@ -36518,6 +36556,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36518
36556
|
var FunctionFragment = class {
|
36519
36557
|
signature;
|
36520
36558
|
selector;
|
36559
|
+
selectorBytes;
|
36560
|
+
encoding;
|
36521
36561
|
name;
|
36522
36562
|
jsonFn;
|
36523
36563
|
attributes;
|
@@ -36526,10 +36566,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36526
36566
|
jsonAbi;
|
36527
36567
|
constructor(jsonAbi, name) {
|
36528
36568
|
this.jsonAbi = jsonAbi;
|
36529
|
-
this.jsonFn =
|
36569
|
+
this.jsonFn = findFunctionByName(this.jsonAbi, name);
|
36530
36570
|
this.name = name;
|
36531
36571
|
this.signature = FunctionFragment.getSignature(this.jsonAbi, this.jsonFn);
|
36532
36572
|
this.selector = FunctionFragment.getFunctionSelector(this.signature);
|
36573
|
+
this.selectorBytes = new StdStringCoder2().encode(name);
|
36574
|
+
this.encoding = this.jsonAbi.encoding ?? ENCODING_V0;
|
36533
36575
|
this.isInputDataPointer = this.#isInputDataPointer();
|
36534
36576
|
this.outputMetadata = {
|
36535
36577
|
isHeapType: this.#isOutputDataHeap(),
|
@@ -36548,13 +36590,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36548
36590
|
return bn(hashedFunctionSignature.slice(0, 10)).toHex(8);
|
36549
36591
|
}
|
36550
36592
|
#isInputDataPointer() {
|
36551
|
-
const inputTypes = this.jsonFn.inputs.map(
|
36552
|
-
(i) => this.jsonAbi.types.find((t) => t.typeId === i.type)
|
36553
|
-
);
|
36593
|
+
const inputTypes = this.jsonFn.inputs.map((i) => findTypeById(this.jsonAbi, i.type));
|
36554
36594
|
return this.jsonFn.inputs.length > 1 || isPointerType(inputTypes[0]?.type || "");
|
36555
36595
|
}
|
36556
36596
|
#isOutputDataHeap() {
|
36557
|
-
const outputType =
|
36597
|
+
const outputType = findTypeById(this.jsonAbi, this.jsonFn.output.type);
|
36558
36598
|
return isHeapType(outputType?.type || "");
|
36559
36599
|
}
|
36560
36600
|
#getOutputEncodedLength() {
|
@@ -36574,27 +36614,28 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36574
36614
|
encodeArguments(values, offset = 0) {
|
36575
36615
|
FunctionFragment.verifyArgsAndInputsAlign(values, this.jsonFn.inputs, this.jsonAbi);
|
36576
36616
|
const shallowCopyValues = values.slice();
|
36577
|
-
const nonEmptyInputs = this.jsonFn.inputs
|
36578
|
-
(x) => findOrThrow(this.jsonAbi.types, (t) => t.typeId === x.type).type !== "()"
|
36579
|
-
);
|
36617
|
+
const nonEmptyInputs = findNonEmptyInputs(this.jsonAbi, this.jsonFn.inputs);
|
36580
36618
|
if (Array.isArray(values) && nonEmptyInputs.length !== values.length) {
|
36581
36619
|
shallowCopyValues.length = this.jsonFn.inputs.length;
|
36582
36620
|
shallowCopyValues.fill(void 0, values.length);
|
36583
36621
|
}
|
36584
36622
|
const coders = nonEmptyInputs.map(
|
36585
36623
|
(t) => AbiCoder.getCoder(this.jsonAbi, t, {
|
36586
|
-
isRightPadded: nonEmptyInputs.length > 1
|
36624
|
+
isRightPadded: nonEmptyInputs.length > 1,
|
36625
|
+
encoding: this.encoding
|
36587
36626
|
})
|
36588
36627
|
);
|
36589
|
-
|
36590
|
-
|
36628
|
+
if (this.encoding === ENCODING_V1) {
|
36629
|
+
return new TupleCoder2(coders).encode(shallowCopyValues);
|
36630
|
+
}
|
36631
|
+
const results = new TupleCoder(coders).encode(shallowCopyValues);
|
36591
36632
|
return unpackDynamicData(results, offset, results.byteLength);
|
36592
36633
|
}
|
36593
36634
|
static verifyArgsAndInputsAlign(args, inputs, abi) {
|
36594
36635
|
if (args.length === inputs.length) {
|
36595
36636
|
return;
|
36596
36637
|
}
|
36597
|
-
const inputTypes = inputs.map((
|
36638
|
+
const inputTypes = inputs.map((input) => findTypeById(abi, input.type));
|
36598
36639
|
const optionalInputs = inputTypes.filter(
|
36599
36640
|
(x) => x.type === OPTION_CODER_TYPE || x.type === "()"
|
36600
36641
|
);
|
@@ -36609,9 +36650,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36609
36650
|
}
|
36610
36651
|
decodeArguments(data) {
|
36611
36652
|
const bytes3 = arrayify(data);
|
36612
|
-
const nonEmptyInputs = this.jsonFn.inputs
|
36613
|
-
(x) => findOrThrow(this.jsonAbi.types, (t) => t.typeId === x.type).type !== "()"
|
36614
|
-
);
|
36653
|
+
const nonEmptyInputs = findNonEmptyInputs(this.jsonAbi, this.jsonFn.inputs);
|
36615
36654
|
if (nonEmptyInputs.length === 0) {
|
36616
36655
|
if (bytes3.length === 0) {
|
36617
36656
|
return void 0;
|
@@ -36634,7 +36673,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36634
36673
|
}
|
36635
36674
|
const result = nonEmptyInputs.reduce(
|
36636
36675
|
(obj, input) => {
|
36637
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, input);
|
36676
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
|
36638
36677
|
const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
|
36639
36678
|
return {
|
36640
36679
|
decoded: [...obj.decoded, decodedValue],
|
@@ -36646,33 +36685,32 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36646
36685
|
return result.decoded;
|
36647
36686
|
}
|
36648
36687
|
decodeOutput(data) {
|
36649
|
-
const outputAbiType =
|
36650
|
-
this.jsonAbi.types,
|
36651
|
-
(t) => t.typeId === this.jsonFn.output.type
|
36652
|
-
);
|
36688
|
+
const outputAbiType = findTypeById(this.jsonAbi, this.jsonFn.output.type);
|
36653
36689
|
if (outputAbiType.type === "()") {
|
36654
36690
|
return [void 0, 0];
|
36655
36691
|
}
|
36656
36692
|
const bytes3 = arrayify(data);
|
36657
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output
|
36693
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
|
36694
|
+
encoding: this.encoding
|
36695
|
+
});
|
36658
36696
|
return coder.decode(bytes3, 0);
|
36659
36697
|
}
|
36698
|
+
/**
|
36699
|
+
* Checks if the function is read-only i.e. it only reads from storage, does not write to it.
|
36700
|
+
*
|
36701
|
+
* @returns True if the function is read-only or pure, false otherwise.
|
36702
|
+
*/
|
36703
|
+
isReadOnly() {
|
36704
|
+
const storageAttribute = this.attributes.find((attr) => attr.name === "storage");
|
36705
|
+
return !storageAttribute?.arguments.includes("write");
|
36706
|
+
}
|
36660
36707
|
};
|
36661
36708
|
var Interface = class {
|
36662
36709
|
functions;
|
36663
36710
|
configurables;
|
36664
|
-
/*
|
36665
|
-
TODO: Refactor so that there's no need for externalLoggedTypes
|
36666
|
-
|
36667
|
-
This is dedicated to external contracts added via `<base-invocation-scope.ts>.addContracts()` method.
|
36668
|
-
This is used to decode logs from contracts other than the main contract
|
36669
|
-
we're interacting with.
|
36670
|
-
*/
|
36671
|
-
externalLoggedTypes;
|
36672
36711
|
jsonAbi;
|
36673
36712
|
constructor(jsonAbi) {
|
36674
36713
|
this.jsonAbi = jsonAbi;
|
36675
|
-
this.externalLoggedTypes = {};
|
36676
36714
|
this.functions = Object.fromEntries(
|
36677
36715
|
this.jsonAbi.functions.map((x) => [x.name, new FunctionFragment(this.jsonAbi, x.name)])
|
36678
36716
|
);
|
@@ -36696,16 +36734,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36696
36734
|
}
|
36697
36735
|
decodeFunctionData(functionFragment, data) {
|
36698
36736
|
const fragment = typeof functionFragment === "string" ? this.getFunction(functionFragment) : functionFragment;
|
36699
|
-
if (!fragment) {
|
36700
|
-
throw new FuelError(ErrorCode.FRAGMENT_NOT_FOUND, "Fragment not found.");
|
36701
|
-
}
|
36702
36737
|
return fragment.decodeArguments(data);
|
36703
36738
|
}
|
36704
36739
|
encodeFunctionData(functionFragment, values, offset = 0) {
|
36705
36740
|
const fragment = typeof functionFragment === "string" ? this.getFunction(functionFragment) : functionFragment;
|
36706
|
-
if (!fragment) {
|
36707
|
-
throw new FuelError(ErrorCode.FRAGMENT_NOT_FOUND, "Fragment not found.");
|
36708
|
-
}
|
36709
36741
|
return fragment.encodeArguments(values, offset);
|
36710
36742
|
}
|
36711
36743
|
// Decode the result of a function call
|
@@ -36713,46 +36745,34 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36713
36745
|
const fragment = typeof functionFragment === "string" ? this.getFunction(functionFragment) : functionFragment;
|
36714
36746
|
return fragment.decodeOutput(data);
|
36715
36747
|
}
|
36716
|
-
decodeLog(data, logId
|
36717
|
-
const
|
36718
|
-
if (
|
36719
|
-
|
36720
|
-
|
36748
|
+
decodeLog(data, logId) {
|
36749
|
+
const loggedType = this.jsonAbi.loggedTypes.find((type3) => type3.logId === logId);
|
36750
|
+
if (!loggedType) {
|
36751
|
+
throw new FuelError(
|
36752
|
+
ErrorCode.LOG_TYPE_NOT_FOUND,
|
36753
|
+
`Log type with logId '${logId}' doesn't exist in the ABI.`
|
36754
|
+
);
|
36721
36755
|
}
|
36722
|
-
|
36723
|
-
return AbiCoder.decode(this.jsonAbi, loggedType, arrayify(data), 0, {
|
36756
|
+
return AbiCoder.decode(this.jsonAbi, loggedType.loggedType, arrayify(data), 0, {
|
36724
36757
|
encoding: this.jsonAbi.encoding
|
36725
36758
|
});
|
36726
36759
|
}
|
36727
|
-
updateExternalLoggedTypes(id, loggedTypes) {
|
36728
|
-
this.externalLoggedTypes[id] = loggedTypes;
|
36729
|
-
}
|
36730
36760
|
encodeConfigurable(name, value) {
|
36731
|
-
const configurable =
|
36732
|
-
|
36733
|
-
|
36734
|
-
|
36735
|
-
|
36736
|
-
|
36737
|
-
|
36738
|
-
);
|
36739
|
-
}
|
36740
|
-
);
|
36761
|
+
const configurable = this.jsonAbi.configurables.find((c) => c.name === name);
|
36762
|
+
if (!configurable) {
|
36763
|
+
throw new FuelError(
|
36764
|
+
ErrorCode.CONFIGURABLE_NOT_FOUND,
|
36765
|
+
`A configurable with the '${name}' was not found in the ABI.`
|
36766
|
+
);
|
36767
|
+
}
|
36741
36768
|
return AbiCoder.encode(this.jsonAbi, configurable.configurableType, value, {
|
36742
|
-
isRightPadded: true
|
36769
|
+
isRightPadded: true,
|
36770
|
+
// TODO: Review support for configurables in v1 encoding when it becomes available
|
36771
|
+
encoding: ENCODING_V0
|
36743
36772
|
});
|
36744
36773
|
}
|
36745
36774
|
getTypeById(typeId) {
|
36746
|
-
return
|
36747
|
-
this.jsonAbi.types,
|
36748
|
-
(t) => t.typeId === typeId,
|
36749
|
-
() => {
|
36750
|
-
throw new FuelError(
|
36751
|
-
ErrorCode.TYPE_NOT_FOUND,
|
36752
|
-
`Type with typeId '${typeId}' doesn't exist in the ABI.`
|
36753
|
-
);
|
36754
|
-
}
|
36755
|
-
);
|
36775
|
+
return findTypeById(this.jsonAbi, typeId);
|
36756
36776
|
}
|
36757
36777
|
};
|
36758
36778
|
|
@@ -37442,7 +37462,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37442
37462
|
return [receiptMessageOut, o];
|
37443
37463
|
}
|
37444
37464
|
};
|
37445
|
-
var
|
37465
|
+
var getMintedAssetId = (contractId, subId) => {
|
37446
37466
|
const contractIdBytes = arrayify(contractId);
|
37447
37467
|
const subIdBytes = arrayify(subId);
|
37448
37468
|
return sha2563(concat([contractIdBytes, subIdBytes]));
|
@@ -37452,7 +37472,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37452
37472
|
super("ReceiptMint", "struct ReceiptMint", 0);
|
37453
37473
|
}
|
37454
37474
|
static getAssetId(contractId, subId) {
|
37455
|
-
return
|
37475
|
+
return getMintedAssetId(contractId, subId);
|
37456
37476
|
}
|
37457
37477
|
encode(value) {
|
37458
37478
|
const parts = [];
|
@@ -37494,7 +37514,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37494
37514
|
super("ReceiptBurn", "struct ReceiptBurn", 0);
|
37495
37515
|
}
|
37496
37516
|
static getAssetId(contractId, subId) {
|
37497
|
-
return
|
37517
|
+
return getMintedAssetId(contractId, subId);
|
37498
37518
|
}
|
37499
37519
|
encode(value) {
|
37500
37520
|
const parts = [];
|
@@ -42319,8 +42339,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42319
42339
|
const predicateData = arrayify(value.predicateData ?? "0x");
|
42320
42340
|
return {
|
42321
42341
|
type: InputType.Coin,
|
42322
|
-
txID: hexlify(arrayify(value.id).slice(0,
|
42323
|
-
outputIndex: arrayify(value.id)
|
42342
|
+
txID: hexlify(arrayify(value.id).slice(0, BYTES_32)),
|
42343
|
+
outputIndex: toNumber2(arrayify(value.id).slice(BYTES_32, UTXO_ID_LEN)),
|
42324
42344
|
owner: hexlify(value.owner),
|
42325
42345
|
amount: bn(value.amount),
|
42326
42346
|
assetId: hexlify(value.assetId),
|
@@ -42441,7 +42461,60 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42441
42461
|
var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
|
42442
42462
|
var MAX_PREDICATE_LENGTH = 1024 * 1024;
|
42443
42463
|
var MAX_PREDICATE_DATA_LENGTH = 1024 * 1024;
|
42464
|
+
var FAILED_REQUIRE_SIGNAL = "0xffffffffffff0000";
|
42444
42465
|
var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
|
42466
|
+
var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
|
42467
|
+
var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
|
42468
|
+
var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
|
42469
|
+
var PANIC_REASONS = [
|
42470
|
+
"UnknownPanicReason",
|
42471
|
+
"Revert",
|
42472
|
+
"OutOfGas",
|
42473
|
+
"TransactionValidity",
|
42474
|
+
"MemoryOverflow",
|
42475
|
+
"ArithmeticOverflow",
|
42476
|
+
"ContractNotFound",
|
42477
|
+
"MemoryOwnership",
|
42478
|
+
"NotEnoughBalance",
|
42479
|
+
"ExpectedInternalContext",
|
42480
|
+
"AssetIdNotFound",
|
42481
|
+
"InputNotFound",
|
42482
|
+
"OutputNotFound",
|
42483
|
+
"WitnessNotFound",
|
42484
|
+
"TransactionMaturity",
|
42485
|
+
"InvalidMetadataIdentifier",
|
42486
|
+
"MalformedCallStructure",
|
42487
|
+
"ReservedRegisterNotWritable",
|
42488
|
+
"InvalidFlags",
|
42489
|
+
"InvalidImmediateValue",
|
42490
|
+
"ExpectedCoinInput",
|
42491
|
+
"EcalError",
|
42492
|
+
"MemoryWriteOverlap",
|
42493
|
+
"ContractNotInInputs",
|
42494
|
+
"InternalBalanceOverflow",
|
42495
|
+
"ContractMaxSize",
|
42496
|
+
"ExpectedUnallocatedStack",
|
42497
|
+
"MaxStaticContractsReached",
|
42498
|
+
"TransferAmountCannotBeZero",
|
42499
|
+
"ExpectedOutputVariable",
|
42500
|
+
"ExpectedParentInternalContext",
|
42501
|
+
"PredicateReturnedNonOne",
|
42502
|
+
"ContractIdAlreadyDeployed",
|
42503
|
+
"ContractMismatch",
|
42504
|
+
"MessageDataTooLong",
|
42505
|
+
"ArithmeticError",
|
42506
|
+
"ContractInstructionNotAllowed",
|
42507
|
+
"TransferZeroCoins",
|
42508
|
+
"InvalidInstruction",
|
42509
|
+
"MemoryNotExecutable",
|
42510
|
+
"PolicyIsNotSet",
|
42511
|
+
"PolicyNotFound",
|
42512
|
+
"TooManyReceipts",
|
42513
|
+
"BalanceOverflow",
|
42514
|
+
"InvalidBlockHeight",
|
42515
|
+
"TooManySlots"
|
42516
|
+
];
|
42517
|
+
var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
|
42445
42518
|
|
42446
42519
|
// src/providers/utils/receipts.ts
|
42447
42520
|
var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
|
@@ -42754,6 +42827,74 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42754
42827
|
});
|
42755
42828
|
}
|
42756
42829
|
|
42830
|
+
// src/providers/utils/extract-tx-error.ts
|
42831
|
+
var assemblePanicError = (status) => {
|
42832
|
+
let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
|
42833
|
+
const reason = status.reason;
|
42834
|
+
if (PANIC_REASONS.includes(status.reason)) {
|
42835
|
+
errorMessage = `${errorMessage}
|
42836
|
+
|
42837
|
+
You can read more about this error at:
|
42838
|
+
|
42839
|
+
${PANIC_DOC_URL}#variant.${status.reason}`;
|
42840
|
+
}
|
42841
|
+
return { errorMessage, reason };
|
42842
|
+
};
|
42843
|
+
var stringify2 = (obj) => JSON.stringify(obj, null, 2);
|
42844
|
+
var assembleRevertError = (receipts, logs) => {
|
42845
|
+
let errorMessage = "The transaction reverted with an unknown reason.";
|
42846
|
+
const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
|
42847
|
+
let reason = "";
|
42848
|
+
if (revertReceipt) {
|
42849
|
+
const reasonHex = bn(revertReceipt.val).toHex();
|
42850
|
+
switch (reasonHex) {
|
42851
|
+
case FAILED_REQUIRE_SIGNAL: {
|
42852
|
+
reason = "require";
|
42853
|
+
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify2(logs[0]) : "an error."}.`;
|
42854
|
+
break;
|
42855
|
+
}
|
42856
|
+
case FAILED_ASSERT_EQ_SIGNAL: {
|
42857
|
+
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42858
|
+
reason = "assert_eq";
|
42859
|
+
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
|
42860
|
+
break;
|
42861
|
+
}
|
42862
|
+
case FAILED_ASSERT_NE_SIGNAL: {
|
42863
|
+
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42864
|
+
reason = "assert_ne";
|
42865
|
+
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
|
42866
|
+
break;
|
42867
|
+
}
|
42868
|
+
case FAILED_ASSERT_SIGNAL:
|
42869
|
+
reason = "assert";
|
42870
|
+
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
42871
|
+
break;
|
42872
|
+
case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
42873
|
+
reason = "MissingOutputChange";
|
42874
|
+
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
42875
|
+
break;
|
42876
|
+
default:
|
42877
|
+
reason = "unknown";
|
42878
|
+
errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
|
42879
|
+
}
|
42880
|
+
}
|
42881
|
+
return { errorMessage, reason };
|
42882
|
+
};
|
42883
|
+
var extractTxError = (params) => {
|
42884
|
+
const { receipts, status, logs } = params;
|
42885
|
+
const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
|
42886
|
+
const isRevert = receipts.some(({ type: type3 }) => type3 === ReceiptType.Revert);
|
42887
|
+
const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
|
42888
|
+
const metadata = {
|
42889
|
+
logs,
|
42890
|
+
receipts,
|
42891
|
+
panic: isPanic,
|
42892
|
+
revert: isRevert,
|
42893
|
+
reason
|
42894
|
+
};
|
42895
|
+
return new FuelError(ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
|
42896
|
+
};
|
42897
|
+
|
42757
42898
|
// src/providers/transaction-request/errors.ts
|
42758
42899
|
var NoWitnessAtIndexError = class extends Error {
|
42759
42900
|
constructor(index) {
|
@@ -43022,8 +43163,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43022
43163
|
assetId,
|
43023
43164
|
txPointer: "0x00000000000000000000000000000000",
|
43024
43165
|
witnessIndex,
|
43025
|
-
predicate: predicate?.bytes
|
43026
|
-
predicateData: predicate?.predicateDataBytes
|
43166
|
+
predicate: predicate?.bytes
|
43027
43167
|
};
|
43028
43168
|
this.pushInput(input);
|
43029
43169
|
this.addChangeOutput(owner, assetId);
|
@@ -43055,8 +43195,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43055
43195
|
recipient: recipient.toB256(),
|
43056
43196
|
amount,
|
43057
43197
|
witnessIndex,
|
43058
|
-
predicate: predicate?.bytes
|
43059
|
-
predicateData: predicate?.predicateDataBytes
|
43198
|
+
predicate: predicate?.bytes
|
43060
43199
|
};
|
43061
43200
|
this.pushInput(input);
|
43062
43201
|
this.addChangeOutput(recipient, assetId);
|
@@ -43211,12 +43350,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43211
43350
|
* @param quantities - CoinQuantity Array.
|
43212
43351
|
*/
|
43213
43352
|
fundWithFakeUtxos(quantities, resourcesOwner) {
|
43214
|
-
let idCounter = 0;
|
43215
|
-
const generateId = () => {
|
43216
|
-
const counterString = String(idCounter++);
|
43217
|
-
const id = ZeroBytes32.slice(0, -counterString.length).concat(counterString);
|
43218
|
-
return id;
|
43219
|
-
};
|
43220
43353
|
const findAssetInput = (assetId) => this.inputs.find((input) => {
|
43221
43354
|
if ("assetId" in input) {
|
43222
43355
|
return input.assetId === assetId;
|
@@ -43226,12 +43359,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43226
43359
|
const updateAssetInput = (assetId, quantity) => {
|
43227
43360
|
const assetInput = findAssetInput(assetId);
|
43228
43361
|
if (assetInput && "assetId" in assetInput) {
|
43229
|
-
assetInput.id =
|
43362
|
+
assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
|
43230
43363
|
assetInput.amount = quantity;
|
43231
43364
|
} else {
|
43232
43365
|
this.addResources([
|
43233
43366
|
{
|
43234
|
-
id:
|
43367
|
+
id: hexlify(randomBytes22(UTXO_ID_LEN)),
|
43235
43368
|
amount: quantity,
|
43236
43369
|
assetId,
|
43237
43370
|
owner: resourcesOwner || Address.fromRandom(),
|
@@ -43513,6 +43646,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43513
43646
|
script;
|
43514
43647
|
/** Script input data (parameters) */
|
43515
43648
|
scriptData;
|
43649
|
+
abis;
|
43516
43650
|
/**
|
43517
43651
|
* Constructor for `ScriptTransactionRequest`.
|
43518
43652
|
*
|
@@ -43523,6 +43657,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
43523
43657
|
this.gasLimit = bn(gasLimit);
|
43524
43658
|
this.script = arrayify(script ?? returnZeroScript.bytes);
|
43525
43659
|
this.scriptData = arrayify(scriptData ?? returnZeroScript.encodeScriptData());
|
43660
|
+
this.abis = rest.abis;
|
43526
43661
|
}
|
43527
43662
|
/**
|
43528
43663
|
* Converts the transaction request to a `TransactionScript`.
|
@@ -44361,6 +44496,19 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44361
44496
|
return transactionSummary;
|
44362
44497
|
}
|
44363
44498
|
|
44499
|
+
// src/providers/transaction-response/getDecodedLogs.ts
|
44500
|
+
function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
44501
|
+
return receipts.reduce((logs, receipt) => {
|
44502
|
+
if (receipt.type === ReceiptType.LogData || receipt.type === ReceiptType.Log) {
|
44503
|
+
const interfaceToUse = new Interface(externalAbis[receipt.id] || mainAbi);
|
44504
|
+
const data = receipt.type === ReceiptType.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
|
44505
|
+
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
|
44506
|
+
logs.push(decodedLog);
|
44507
|
+
}
|
44508
|
+
return logs;
|
44509
|
+
}, []);
|
44510
|
+
}
|
44511
|
+
|
44364
44512
|
// src/providers/transaction-response/transaction-response.ts
|
44365
44513
|
var TransactionResponse2 = class {
|
44366
44514
|
/** Transaction ID */
|
@@ -44371,15 +44519,17 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44371
44519
|
gasUsed = bn(0);
|
44372
44520
|
/** The graphql Transaction with receipts object. */
|
44373
44521
|
gqlTransaction;
|
44522
|
+
abis;
|
44374
44523
|
/**
|
44375
44524
|
* Constructor for `TransactionResponse`.
|
44376
44525
|
*
|
44377
44526
|
* @param id - The transaction ID.
|
44378
44527
|
* @param provider - The provider.
|
44379
44528
|
*/
|
44380
|
-
constructor(id, provider) {
|
44529
|
+
constructor(id, provider, abis) {
|
44381
44530
|
this.id = id;
|
44382
44531
|
this.provider = provider;
|
44532
|
+
this.abis = abis;
|
44383
44533
|
}
|
44384
44534
|
/**
|
44385
44535
|
* Async constructor for `TransactionResponse`. This method can be used to create
|
@@ -44389,8 +44539,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44389
44539
|
* @param id - The transaction ID.
|
44390
44540
|
* @param provider - The provider.
|
44391
44541
|
*/
|
44392
|
-
static async create(id, provider) {
|
44393
|
-
const response = new TransactionResponse2(id, provider);
|
44542
|
+
static async create(id, provider, abis) {
|
44543
|
+
const response = new TransactionResponse2(id, provider, abis);
|
44394
44544
|
await response.fetch();
|
44395
44545
|
return response;
|
44396
44546
|
}
|
@@ -44494,6 +44644,26 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44494
44644
|
gqlTransaction: this.gqlTransaction,
|
44495
44645
|
...transactionSummary
|
44496
44646
|
};
|
44647
|
+
let logs = [];
|
44648
|
+
if (this.abis) {
|
44649
|
+
logs = getDecodedLogs(
|
44650
|
+
transactionSummary.receipts,
|
44651
|
+
this.abis.main,
|
44652
|
+
this.abis.otherContractsAbis
|
44653
|
+
);
|
44654
|
+
transactionResult.logs = logs;
|
44655
|
+
}
|
44656
|
+
if (transactionResult.isStatusFailure) {
|
44657
|
+
const {
|
44658
|
+
receipts,
|
44659
|
+
gqlTransaction: { status }
|
44660
|
+
} = transactionResult;
|
44661
|
+
throw extractTxError({
|
44662
|
+
receipts,
|
44663
|
+
status,
|
44664
|
+
logs
|
44665
|
+
});
|
44666
|
+
}
|
44497
44667
|
return transactionResult;
|
44498
44668
|
}
|
44499
44669
|
/**
|
@@ -44502,14 +44672,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44502
44672
|
* @param contractsAbiMap - The contracts ABI map.
|
44503
44673
|
*/
|
44504
44674
|
async wait(contractsAbiMap) {
|
44505
|
-
|
44506
|
-
if (result.isStatusFailure) {
|
44507
|
-
throw new FuelError(
|
44508
|
-
ErrorCode.TRANSACTION_FAILED,
|
44509
|
-
`Transaction failed: ${result.gqlTransaction.status.reason}`
|
44510
|
-
);
|
44511
|
-
}
|
44512
|
-
return result;
|
44675
|
+
return this.waitForResult(contractsAbiMap);
|
44513
44676
|
}
|
44514
44677
|
};
|
44515
44678
|
|
@@ -44847,6 +45010,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44847
45010
|
await this.estimateTxDependencies(transactionRequest);
|
44848
45011
|
}
|
44849
45012
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
45013
|
+
let abis;
|
45014
|
+
if (transactionRequest.type === TransactionType.Script) {
|
45015
|
+
abis = transactionRequest.abis;
|
45016
|
+
}
|
44850
45017
|
if (awaitExecution) {
|
44851
45018
|
const subscription = this.operations.submitAndAwait({ encodedTransaction });
|
44852
45019
|
for await (const { submitAndAwait } of subscription) {
|
@@ -44861,14 +45028,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44861
45028
|
}
|
44862
45029
|
}
|
44863
45030
|
const transactionId2 = transactionRequest.getTransactionId(this.getChainId());
|
44864
|
-
const response = new TransactionResponse2(transactionId2, this);
|
45031
|
+
const response = new TransactionResponse2(transactionId2, this, abis);
|
44865
45032
|
await response.fetch();
|
44866
45033
|
return response;
|
44867
45034
|
}
|
44868
45035
|
const {
|
44869
45036
|
submit: { id: transactionId }
|
44870
45037
|
} = await this.operations.submit({ encodedTransaction });
|
44871
|
-
return new TransactionResponse2(transactionId, this);
|
45038
|
+
return new TransactionResponse2(transactionId, this, abis);
|
44872
45039
|
}
|
44873
45040
|
/**
|
44874
45041
|
* Executes a transaction without actually submitting it to the chain.
|
@@ -44976,6 +45143,36 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
44976
45143
|
missingContractIds
|
44977
45144
|
};
|
44978
45145
|
}
|
45146
|
+
/**
|
45147
|
+
* Estimates the transaction gas and fee based on the provided transaction request.
|
45148
|
+
* @param transactionRequest - The transaction request object.
|
45149
|
+
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
45150
|
+
*/
|
45151
|
+
estimateTxGasAndFee(params) {
|
45152
|
+
const { transactionRequest } = params;
|
45153
|
+
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
45154
|
+
const chainInfo = this.getChain();
|
45155
|
+
const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
|
45156
|
+
transactionRequest.gasPrice = gasPrice;
|
45157
|
+
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
45158
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
45159
|
+
if (transactionRequest.type === TransactionType.Script) {
|
45160
|
+
if (transactionRequest.gasLimit.eq(0)) {
|
45161
|
+
transactionRequest.gasLimit = minGas;
|
45162
|
+
transactionRequest.gasLimit = maxGasPerTx.sub(
|
45163
|
+
transactionRequest.calculateMaxGas(chainInfo, minGas)
|
45164
|
+
);
|
45165
|
+
}
|
45166
|
+
}
|
45167
|
+
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
45168
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
45169
|
+
return {
|
45170
|
+
minGas,
|
45171
|
+
minFee,
|
45172
|
+
maxGas,
|
45173
|
+
maxFee
|
45174
|
+
};
|
45175
|
+
}
|
44979
45176
|
/**
|
44980
45177
|
* Executes a signed transaction without applying the states changes
|
44981
45178
|
* on the chain.
|
@@ -45023,17 +45220,16 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45023
45220
|
signatureCallback
|
45024
45221
|
} = {}) {
|
45025
45222
|
const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
|
45026
|
-
const
|
45027
|
-
const
|
45028
|
-
const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
45223
|
+
const { minGasPrice } = this.getGasConfig();
|
45224
|
+
const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
45029
45225
|
const isScriptTransaction = txRequestClone.type === TransactionType.Script;
|
45030
45226
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
45031
45227
|
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
45032
45228
|
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
45229
|
+
if (isScriptTransaction) {
|
45230
|
+
txRequestClone.gasLimit = bn(0);
|
45231
|
+
}
|
45033
45232
|
if (estimatePredicates) {
|
45034
|
-
if (isScriptTransaction) {
|
45035
|
-
txRequestClone.gasLimit = bn(0);
|
45036
|
-
}
|
45037
45233
|
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
45038
45234
|
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
45039
45235
|
}
|
@@ -45042,36 +45238,34 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
45042
45238
|
if (signatureCallback && isScriptTransaction) {
|
45043
45239
|
await signatureCallback(txRequestClone);
|
45044
45240
|
}
|
45045
|
-
|
45046
|
-
|
45241
|
+
let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
45242
|
+
transactionRequest: txRequestClone
|
45243
|
+
});
|
45047
45244
|
let receipts = [];
|
45048
45245
|
let missingContractIds = [];
|
45049
45246
|
let outputVariables = 0;
|
45247
|
+
let gasUsed = bn(0);
|
45050
45248
|
if (isScriptTransaction && estimateTxDependencies) {
|
45051
45249
|
txRequestClone.gasPrice = bn(0);
|
45052
|
-
txRequestClone.gasLimit = bn(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
|
45053
45250
|
const result = await this.estimateTxDependencies(txRequestClone);
|
45054
45251
|
receipts = result.receipts;
|
45055
45252
|
outputVariables = result.outputVariables;
|
45056
45253
|
missingContractIds = result.missingContractIds;
|
45254
|
+
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
45255
|
+
txRequestClone.gasLimit = gasUsed;
|
45256
|
+
txRequestClone.gasPrice = setGasPrice;
|
45257
|
+
({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
45258
|
+
transactionRequest: txRequestClone
|
45259
|
+
}));
|
45057
45260
|
}
|
45058
|
-
const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
|
45059
|
-
const usedFee = calculatePriceWithFactor(
|
45060
|
-
gasUsed,
|
45061
|
-
gasPrice,
|
45062
|
-
gasPriceFactor
|
45063
|
-
).normalizeZeroToOne();
|
45064
|
-
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
45065
|
-
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
45066
45261
|
return {
|
45067
45262
|
requiredQuantities: allQuantities,
|
45068
45263
|
receipts,
|
45069
45264
|
gasUsed,
|
45070
45265
|
minGasPrice,
|
45071
|
-
gasPrice,
|
45266
|
+
gasPrice: setGasPrice,
|
45072
45267
|
minGas,
|
45073
45268
|
maxGas,
|
45074
|
-
usedFee,
|
45075
45269
|
minFee,
|
45076
45270
|
maxFee,
|
45077
45271
|
estimatedInputs: txRequestClone.inputs,
|
@@ -47357,12 +47551,12 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47357
47551
|
};
|
47358
47552
|
|
47359
47553
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
|
47360
|
-
var
|
47554
|
+
var import_crypto16 = __toESM(__require("crypto"));
|
47361
47555
|
var rnds8Pool = new Uint8Array(256);
|
47362
47556
|
var poolPtr = rnds8Pool.length;
|
47363
47557
|
function rng() {
|
47364
47558
|
if (poolPtr > rnds8Pool.length - 16) {
|
47365
|
-
|
47559
|
+
import_crypto16.default.randomFillSync(rnds8Pool);
|
47366
47560
|
poolPtr = 0;
|
47367
47561
|
}
|
47368
47562
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
@@ -47378,9 +47572,9 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
47378
47572
|
}
|
47379
47573
|
|
47380
47574
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
|
47381
|
-
var
|
47575
|
+
var import_crypto17 = __toESM(__require("crypto"));
|
47382
47576
|
var native_default = {
|
47383
|
-
randomUUID:
|
47577
|
+
randomUUID: import_crypto17.default.randomUUID
|
47384
47578
|
};
|
47385
47579
|
|
47386
47580
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
|
@@ -50360,7 +50554,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
50360
50554
|
|
50361
50555
|
// src/test-utils/launchNode.ts
|
50362
50556
|
var import_child_process = __require("child_process");
|
50363
|
-
var
|
50557
|
+
var import_crypto21 = __require("crypto");
|
50364
50558
|
var import_fs2 = __require("fs");
|
50365
50559
|
var import_os = __toESM(__require("os"));
|
50366
50560
|
var import_path8 = __toESM(__require("path"));
|
@@ -50432,7 +50626,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
50432
50626
|
})).toString();
|
50433
50627
|
let chainConfigPathToUse;
|
50434
50628
|
const prefix = basePath || import_os.default.tmpdir();
|
50435
|
-
const suffix = basePath ? "" : (0,
|
50629
|
+
const suffix = basePath ? "" : (0, import_crypto21.randomUUID)();
|
50436
50630
|
const tempDirPath = import_path8.default.join(prefix, ".fuels", suffix);
|
50437
50631
|
if (chainConfigPath) {
|
50438
50632
|
chainConfigPathToUse = chainConfigPath;
|