@fuel-ts/account 0.0.0-rc-1895-20240404023124 → 0.0.0-rc-1832-20240404064601
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/index.global.js +84 -177
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +468 -551
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +240 -328
- package/dist/index.mjs.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/utils/index.d.ts +0 -1
- package/dist/providers/utils/index.d.ts.map +1 -1
- package/dist/test-utils.global.js +84 -177
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +434 -511
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +213 -298
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
- package/dist/providers/utils/extract-tx-error.d.ts +0 -36
- package/dist/providers/utils/extract-tx-error.d.ts.map +0 -1
package/dist/index.global.js
CHANGED
@@ -29013,7 +29013,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29013
29013
|
ErrorCode2["ABI_TYPES_AND_VALUES_MISMATCH"] = "abi-types-and-values-mismatch";
|
29014
29014
|
ErrorCode2["ABI_MAIN_METHOD_MISSING"] = "abi-main-method-missing";
|
29015
29015
|
ErrorCode2["INVALID_COMPONENT"] = "invalid-component";
|
29016
|
-
ErrorCode2["FRAGMENT_NOT_FOUND"] = "fragment-not-found";
|
29017
29016
|
ErrorCode2["CONFIGURABLE_NOT_FOUND"] = "configurable-not-found";
|
29018
29017
|
ErrorCode2["TYPE_NOT_FOUND"] = "type-not-found";
|
29019
29018
|
ErrorCode2["TYPE_NOT_SUPPORTED"] = "type-not-supported";
|
@@ -29028,14 +29027,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29028
29027
|
ErrorCode2["INVALID_BECH32_ADDRESS"] = "invalid-bech32-address";
|
29029
29028
|
ErrorCode2["INVALID_EVM_ADDRESS"] = "invalid-evm-address";
|
29030
29029
|
ErrorCode2["INVALID_B256_ADDRESS"] = "invalid-b256-address";
|
29031
|
-
ErrorCode2["INVALID_URL"] = "invalid-url";
|
29032
29030
|
ErrorCode2["CHAIN_INFO_CACHE_EMPTY"] = "chain-info-cache-empty";
|
29033
29031
|
ErrorCode2["NODE_INFO_CACHE_EMPTY"] = "node-info-cache-empty";
|
29034
29032
|
ErrorCode2["MISSING_PROVIDER"] = "missing-provider";
|
29035
29033
|
ErrorCode2["INVALID_PROVIDER"] = "invalid-provider";
|
29036
29034
|
ErrorCode2["CONNECTION_REFUSED"] = "connection-refused";
|
29037
29035
|
ErrorCode2["INVALID_PUBLIC_KEY"] = "invalid-public-key";
|
29038
|
-
ErrorCode2["INSUFFICIENT_BALANCE"] = "insufficient-balance";
|
29039
29036
|
ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
|
29040
29037
|
ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
|
29041
29038
|
ErrorCode2["MISSING_CONNECTOR"] = "missing-connector";
|
@@ -29052,7 +29049,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29052
29049
|
ErrorCode2["ELEMENT_NOT_FOUND"] = "element-not-found";
|
29053
29050
|
ErrorCode2["MISSING_REQUIRED_PARAMETER"] = "missing-required-parameter";
|
29054
29051
|
ErrorCode2["INVALID_REQUEST"] = "invalid-request";
|
29055
|
-
ErrorCode2["UNEXPECTED_HEX_VALUE"] = "unexpected-hex-value";
|
29056
29052
|
ErrorCode2["INVALID_TRANSFER_AMOUNT"] = "invalid-transfer-amount";
|
29057
29053
|
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
|
29058
29054
|
ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
|
@@ -29076,7 +29072,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29076
29072
|
ErrorCode2["INVALID_PASSWORD"] = "invalid-password";
|
29077
29073
|
ErrorCode2["ACCOUNT_REQUIRED"] = "account-required";
|
29078
29074
|
ErrorCode2["UNLOCKED_WALLET_REQUIRED"] = "unlocked-wallet-required";
|
29079
|
-
ErrorCode2["LATEST_BLOCK_UNAVAILABLE"] = "latest-block-unavailable";
|
29080
29075
|
ErrorCode2["ERROR_BUILDING_BLOCK_EXPLORER_URL"] = "error-building-block-explorer-url";
|
29081
29076
|
ErrorCode2["UNSUPPORTED_FUEL_CLIENT_VERSION"] = "unsupported-fuel-client-version";
|
29082
29077
|
ErrorCode2["VITEPRESS_PLUGIN_ERROR"] = "vitepress-plugin-error";
|
@@ -29088,7 +29083,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29088
29083
|
})(ErrorCode || {});
|
29089
29084
|
var _FuelError = class extends Error {
|
29090
29085
|
VERSIONS = versions;
|
29091
|
-
metadata;
|
29092
29086
|
static parse(e) {
|
29093
29087
|
const error = e;
|
29094
29088
|
if (error.code === void 0) {
|
@@ -29108,15 +29102,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29108
29102
|
return new _FuelError(error.code, error.message);
|
29109
29103
|
}
|
29110
29104
|
code;
|
29111
|
-
constructor(code, message
|
29105
|
+
constructor(code, message) {
|
29112
29106
|
super(message);
|
29113
29107
|
this.code = code;
|
29114
29108
|
this.name = "FuelError";
|
29115
|
-
this.metadata = metadata;
|
29116
29109
|
}
|
29117
29110
|
toObject() {
|
29118
|
-
const { code, name, message,
|
29119
|
-
return { code, name, message,
|
29111
|
+
const { code, name, message, VERSIONS } = this;
|
29112
|
+
return { code, name, message, VERSIONS };
|
29120
29113
|
}
|
29121
29114
|
};
|
29122
29115
|
var FuelError = _FuelError;
|
@@ -31920,9 +31913,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31920
31913
|
__privateAdd2(this, _getPaddedData);
|
31921
31914
|
}
|
31922
31915
|
encode(value) {
|
31923
|
-
if (!Array.isArray(value)) {
|
31924
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
31925
|
-
}
|
31926
31916
|
const parts = [];
|
31927
31917
|
const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
|
31928
31918
|
const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
|
@@ -31949,7 +31939,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31949
31939
|
};
|
31950
31940
|
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
31951
31941
|
getPaddedData_fn = function(value) {
|
31952
|
-
const data = [Uint8Array
|
31942
|
+
const data = value instanceof Uint8Array ? [value] : [new Uint8Array(value)];
|
31953
31943
|
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
31954
31944
|
if (paddingLength) {
|
31955
31945
|
data.push(new Uint8Array(paddingLength));
|
@@ -31972,7 +31962,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31972
31962
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
31973
31963
|
0
|
31974
31964
|
);
|
31975
|
-
super(
|
31965
|
+
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
31976
31966
|
this.name = name;
|
31977
31967
|
this.coders = coders;
|
31978
31968
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -32042,7 +32032,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32042
32032
|
return { None: [] };
|
32043
32033
|
}
|
32044
32034
|
decode(data, offset) {
|
32045
|
-
if (data.length < this.encodedLength
|
32035
|
+
if (data.length < this.encodedLength) {
|
32046
32036
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
32047
32037
|
}
|
32048
32038
|
const [decoded, newOffset] = super.decode(data, offset);
|
@@ -32625,11 +32615,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32625
32615
|
super("struct", "struct Bytes", WORD_SIZE);
|
32626
32616
|
}
|
32627
32617
|
encode(value) {
|
32628
|
-
|
32629
|
-
|
32630
|
-
}
|
32631
|
-
const bytes3 = new Uint8Array(value);
|
32632
|
-
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
32618
|
+
const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
32619
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
|
32633
32620
|
return new Uint8Array([...lengthBytes, ...bytes3]);
|
32634
32621
|
}
|
32635
32622
|
decode(data, offset) {
|
@@ -32662,7 +32649,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32662
32649
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32663
32650
|
0
|
32664
32651
|
);
|
32665
|
-
super(
|
32652
|
+
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
32666
32653
|
this.name = name;
|
32667
32654
|
this.coders = coders;
|
32668
32655
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -32760,6 +32747,28 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32760
32747
|
return [toNumber2(bytes3), offset + this.length];
|
32761
32748
|
}
|
32762
32749
|
};
|
32750
|
+
var OptionCoder2 = class extends EnumCoder2 {
|
32751
|
+
encode(value) {
|
32752
|
+
const result = super.encode(this.toSwayOption(value));
|
32753
|
+
return result;
|
32754
|
+
}
|
32755
|
+
toSwayOption(input) {
|
32756
|
+
if (input !== void 0) {
|
32757
|
+
return { Some: input };
|
32758
|
+
}
|
32759
|
+
return { None: [] };
|
32760
|
+
}
|
32761
|
+
decode(data, offset) {
|
32762
|
+
const [decoded, newOffset] = super.decode(data, offset);
|
32763
|
+
return [this.toOption(decoded), newOffset];
|
32764
|
+
}
|
32765
|
+
toOption(output3) {
|
32766
|
+
if (output3 && "Some" in output3) {
|
32767
|
+
return output3.Some;
|
32768
|
+
}
|
32769
|
+
return void 0;
|
32770
|
+
}
|
32771
|
+
};
|
32763
32772
|
var RawSliceCoder2 = class extends Coder {
|
32764
32773
|
constructor() {
|
32765
32774
|
super("raw untyped slice", "raw untyped slice", WORD_SIZE);
|
@@ -32813,6 +32822,30 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32813
32822
|
}
|
32814
32823
|
};
|
32815
32824
|
__publicField4(StdStringCoder2, "memorySize", 1);
|
32825
|
+
var StrSliceCoder = class extends Coder {
|
32826
|
+
constructor() {
|
32827
|
+
super("strSlice", "str", WORD_SIZE);
|
32828
|
+
}
|
32829
|
+
encode(value) {
|
32830
|
+
const bytes3 = toUtf8Bytes(value);
|
32831
|
+
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
32832
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
32833
|
+
}
|
32834
|
+
decode(data, offset) {
|
32835
|
+
if (data.length < this.encodedLength) {
|
32836
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice data size.`);
|
32837
|
+
}
|
32838
|
+
const offsetAndLength = offset + WORD_SIZE;
|
32839
|
+
const lengthBytes = data.slice(offset, offsetAndLength);
|
32840
|
+
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
32841
|
+
const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
|
32842
|
+
if (bytes3.length !== length) {
|
32843
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
32844
|
+
}
|
32845
|
+
return [toUtf8String(bytes3), offsetAndLength + length];
|
32846
|
+
}
|
32847
|
+
};
|
32848
|
+
__publicField4(StrSliceCoder, "memorySize", 1);
|
32816
32849
|
var StringCoder2 = class extends Coder {
|
32817
32850
|
constructor(length) {
|
32818
32851
|
super("string", `str[${length}]`, length);
|
@@ -32851,7 +32884,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32851
32884
|
Object.keys(this.coders).map((fieldName) => {
|
32852
32885
|
const fieldCoder = this.coders[fieldName];
|
32853
32886
|
const fieldValue = value[fieldName];
|
32854
|
-
if (!(fieldCoder instanceof
|
32887
|
+
if (!(fieldCoder instanceof OptionCoder2) && fieldValue == null) {
|
32855
32888
|
throw new FuelError(
|
32856
32889
|
ErrorCode.ENCODE_ERROR,
|
32857
32890
|
`Invalid ${this.type}. Field "${fieldName}" not present.`
|
@@ -32959,6 +32992,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32959
32992
|
return new ByteCoder2();
|
32960
32993
|
case STD_STRING_CODER_TYPE:
|
32961
32994
|
return new StdStringCoder2();
|
32995
|
+
case STR_SLICE_CODER_TYPE:
|
32996
|
+
return new StrSliceCoder();
|
32962
32997
|
default:
|
32963
32998
|
break;
|
32964
32999
|
}
|
@@ -33003,7 +33038,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33003
33038
|
const coders = getCoders(components, { getCoder: getCoder2 });
|
33004
33039
|
const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
|
33005
33040
|
if (isOptionEnum) {
|
33006
|
-
return new
|
33041
|
+
return new OptionCoder2(enumMatch.name, coders);
|
33007
33042
|
}
|
33008
33043
|
return new EnumCoder2(enumMatch.name, coders);
|
33009
33044
|
}
|
@@ -33014,12 +33049,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33014
33049
|
);
|
33015
33050
|
return new TupleCoder2(coders);
|
33016
33051
|
}
|
33017
|
-
if (resolvedAbiType.type === STR_SLICE_CODER_TYPE) {
|
33018
|
-
throw new FuelError(
|
33019
|
-
ErrorCode.INVALID_DATA,
|
33020
|
-
"String slices can not be decoded from logs. Convert the slice to `str[N]` with `__to_str_array`"
|
33021
|
-
);
|
33022
|
-
}
|
33023
33052
|
throw new FuelError(
|
33024
33053
|
ErrorCode.CODER_NOT_FOUND,
|
33025
33054
|
`Coder not found: ${JSON.stringify(resolvedAbiType)}.`
|
@@ -33055,6 +33084,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33055
33084
|
var FunctionFragment = class {
|
33056
33085
|
signature;
|
33057
33086
|
selector;
|
33087
|
+
selectorBytes;
|
33088
|
+
encoding;
|
33058
33089
|
name;
|
33059
33090
|
jsonFn;
|
33060
33091
|
attributes;
|
@@ -33067,6 +33098,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33067
33098
|
this.name = name;
|
33068
33099
|
this.signature = FunctionFragment.getSignature(this.jsonAbi, this.jsonFn);
|
33069
33100
|
this.selector = FunctionFragment.getFunctionSelector(this.signature);
|
33101
|
+
this.selectorBytes = new StdStringCoder2().encode(name);
|
33102
|
+
this.encoding = this.jsonAbi.encoding ?? ENCODING_V0;
|
33070
33103
|
this.isInputDataPointer = this.#isInputDataPointer();
|
33071
33104
|
this.outputMetadata = {
|
33072
33105
|
isHeapType: this.#isOutputDataHeap(),
|
@@ -33120,11 +33153,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33120
33153
|
}
|
33121
33154
|
const coders = nonEmptyInputs.map(
|
33122
33155
|
(t) => AbiCoder.getCoder(this.jsonAbi, t, {
|
33123
|
-
isRightPadded: nonEmptyInputs.length > 1
|
33156
|
+
isRightPadded: nonEmptyInputs.length > 1,
|
33157
|
+
encoding: this.encoding
|
33124
33158
|
})
|
33125
33159
|
);
|
33126
|
-
|
33127
|
-
|
33160
|
+
if (this.encoding === ENCODING_V1) {
|
33161
|
+
return new TupleCoder2(coders).encode(shallowCopyValues);
|
33162
|
+
}
|
33163
|
+
const results = new TupleCoder(coders).encode(shallowCopyValues);
|
33128
33164
|
return unpackDynamicData(results, offset, results.byteLength);
|
33129
33165
|
}
|
33130
33166
|
static verifyArgsAndInputsAlign(args, inputs, abi) {
|
@@ -33171,7 +33207,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33171
33207
|
}
|
33172
33208
|
const result = nonEmptyInputs.reduce(
|
33173
33209
|
(obj, input) => {
|
33174
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, input);
|
33210
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
|
33175
33211
|
const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
|
33176
33212
|
return {
|
33177
33213
|
decoded: [...obj.decoded, decodedValue],
|
@@ -33191,7 +33227,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33191
33227
|
return [void 0, 0];
|
33192
33228
|
}
|
33193
33229
|
const bytes3 = arrayify(data);
|
33194
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output
|
33230
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
|
33231
|
+
encoding: this.encoding
|
33232
|
+
});
|
33195
33233
|
return coder.decode(bytes3, 0);
|
33196
33234
|
}
|
33197
33235
|
};
|
@@ -33224,16 +33262,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33224
33262
|
}
|
33225
33263
|
decodeFunctionData(functionFragment, data) {
|
33226
33264
|
const fragment = typeof functionFragment === "string" ? this.getFunction(functionFragment) : functionFragment;
|
33227
|
-
if (!fragment) {
|
33228
|
-
throw new FuelError(ErrorCode.FRAGMENT_NOT_FOUND, "Fragment not found.");
|
33229
|
-
}
|
33230
33265
|
return fragment.decodeArguments(data);
|
33231
33266
|
}
|
33232
33267
|
encodeFunctionData(functionFragment, values, offset = 0) {
|
33233
33268
|
const fragment = typeof functionFragment === "string" ? this.getFunction(functionFragment) : functionFragment;
|
33234
|
-
if (!fragment) {
|
33235
|
-
throw new FuelError(ErrorCode.FRAGMENT_NOT_FOUND, "Fragment not found.");
|
33236
|
-
}
|
33237
33269
|
return fragment.encodeArguments(values, offset);
|
33238
33270
|
}
|
33239
33271
|
// Decode the result of a function call
|
@@ -33259,7 +33291,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33259
33291
|
}
|
33260
33292
|
);
|
33261
33293
|
return AbiCoder.encode(this.jsonAbi, configurable.configurableType, value, {
|
33262
|
-
isRightPadded: true
|
33294
|
+
isRightPadded: true,
|
33295
|
+
encoding: this.jsonAbi.encoding
|
33263
33296
|
});
|
33264
33297
|
}
|
33265
33298
|
getTypeById(typeId) {
|
@@ -38964,60 +38997,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38964
38997
|
var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
|
38965
38998
|
var MAX_PREDICATE_LENGTH = 1024 * 1024;
|
38966
38999
|
var MAX_PREDICATE_DATA_LENGTH = 1024 * 1024;
|
38967
|
-
var FAILED_REQUIRE_SIGNAL = "0xffffffffffff0000";
|
38968
39000
|
var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
|
38969
|
-
var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
|
38970
|
-
var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
|
38971
|
-
var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
|
38972
|
-
var PANIC_REASONS = [
|
38973
|
-
"UnknownPanicReason",
|
38974
|
-
"Revert",
|
38975
|
-
"OutOfGas",
|
38976
|
-
"TransactionValidity",
|
38977
|
-
"MemoryOverflow",
|
38978
|
-
"ArithmeticOverflow",
|
38979
|
-
"ContractNotFound",
|
38980
|
-
"MemoryOwnership",
|
38981
|
-
"NotEnoughBalance",
|
38982
|
-
"ExpectedInternalContext",
|
38983
|
-
"AssetIdNotFound",
|
38984
|
-
"InputNotFound",
|
38985
|
-
"OutputNotFound",
|
38986
|
-
"WitnessNotFound",
|
38987
|
-
"TransactionMaturity",
|
38988
|
-
"InvalidMetadataIdentifier",
|
38989
|
-
"MalformedCallStructure",
|
38990
|
-
"ReservedRegisterNotWritable",
|
38991
|
-
"InvalidFlags",
|
38992
|
-
"InvalidImmediateValue",
|
38993
|
-
"ExpectedCoinInput",
|
38994
|
-
"EcalError",
|
38995
|
-
"MemoryWriteOverlap",
|
38996
|
-
"ContractNotInInputs",
|
38997
|
-
"InternalBalanceOverflow",
|
38998
|
-
"ContractMaxSize",
|
38999
|
-
"ExpectedUnallocatedStack",
|
39000
|
-
"MaxStaticContractsReached",
|
39001
|
-
"TransferAmountCannotBeZero",
|
39002
|
-
"ExpectedOutputVariable",
|
39003
|
-
"ExpectedParentInternalContext",
|
39004
|
-
"PredicateReturnedNonOne",
|
39005
|
-
"ContractIdAlreadyDeployed",
|
39006
|
-
"ContractMismatch",
|
39007
|
-
"MessageDataTooLong",
|
39008
|
-
"ArithmeticError",
|
39009
|
-
"ContractInstructionNotAllowed",
|
39010
|
-
"TransferZeroCoins",
|
39011
|
-
"InvalidInstruction",
|
39012
|
-
"MemoryNotExecutable",
|
39013
|
-
"PolicyIsNotSet",
|
39014
|
-
"PolicyNotFound",
|
39015
|
-
"TooManyReceipts",
|
39016
|
-
"BalanceOverflow",
|
39017
|
-
"InvalidBlockHeight",
|
39018
|
-
"TooManySlots"
|
39019
|
-
];
|
39020
|
-
var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
|
39021
39001
|
|
39022
39002
|
// src/providers/utils/receipts.ts
|
39023
39003
|
var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
|
@@ -39391,74 +39371,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39391
39371
|
});
|
39392
39372
|
}
|
39393
39373
|
|
39394
|
-
// src/providers/utils/extract-tx-error.ts
|
39395
|
-
var assemblePanicError = (status) => {
|
39396
|
-
let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
|
39397
|
-
const reason = status.reason;
|
39398
|
-
if (PANIC_REASONS.includes(status.reason)) {
|
39399
|
-
errorMessage = `${errorMessage}
|
39400
|
-
|
39401
|
-
You can read more about this error at:
|
39402
|
-
|
39403
|
-
${PANIC_DOC_URL}#variant.${status.reason}`;
|
39404
|
-
}
|
39405
|
-
return { errorMessage, reason };
|
39406
|
-
};
|
39407
|
-
var stringify2 = (obj) => JSON.stringify(obj, null, 2);
|
39408
|
-
var assembleRevertError = (receipts, logs) => {
|
39409
|
-
let errorMessage = "The transaction reverted with an unknown reason.";
|
39410
|
-
const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
|
39411
|
-
let reason = "";
|
39412
|
-
if (revertReceipt) {
|
39413
|
-
const reasonHex = bn(revertReceipt.val).toHex();
|
39414
|
-
switch (reasonHex) {
|
39415
|
-
case FAILED_REQUIRE_SIGNAL: {
|
39416
|
-
reason = "require";
|
39417
|
-
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify2(logs[0]) : "an error."}.`;
|
39418
|
-
break;
|
39419
|
-
}
|
39420
|
-
case FAILED_ASSERT_EQ_SIGNAL: {
|
39421
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
39422
|
-
reason = "assert_eq";
|
39423
|
-
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
|
39424
|
-
break;
|
39425
|
-
}
|
39426
|
-
case FAILED_ASSERT_NE_SIGNAL: {
|
39427
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
39428
|
-
reason = "assert_ne";
|
39429
|
-
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
|
39430
|
-
break;
|
39431
|
-
}
|
39432
|
-
case FAILED_ASSERT_SIGNAL:
|
39433
|
-
reason = "assert";
|
39434
|
-
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
39435
|
-
break;
|
39436
|
-
case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
39437
|
-
reason = "MissingOutputChange";
|
39438
|
-
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
39439
|
-
break;
|
39440
|
-
default:
|
39441
|
-
reason = "unknown";
|
39442
|
-
errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
|
39443
|
-
}
|
39444
|
-
}
|
39445
|
-
return { errorMessage, reason };
|
39446
|
-
};
|
39447
|
-
var extractTxError = (params) => {
|
39448
|
-
const { receipts, status, logs } = params;
|
39449
|
-
const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
|
39450
|
-
const isRevert = receipts.some(({ type: type3 }) => type3 === ReceiptType.Revert);
|
39451
|
-
const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
|
39452
|
-
const metadata = {
|
39453
|
-
logs,
|
39454
|
-
receipts,
|
39455
|
-
panic: isPanic,
|
39456
|
-
revert: isRevert,
|
39457
|
-
reason
|
39458
|
-
};
|
39459
|
-
return new FuelError(ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
|
39460
|
-
};
|
39461
|
-
|
39462
39374
|
// src/providers/transaction-request/errors.ts
|
39463
39375
|
var ChangeOutputCollisionError = class extends Error {
|
39464
39376
|
name = "ChangeOutputCollisionError";
|
@@ -41275,26 +41187,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41275
41187
|
gqlTransaction: this.gqlTransaction,
|
41276
41188
|
...transactionSummary
|
41277
41189
|
};
|
41278
|
-
let logs = [];
|
41279
41190
|
if (this.abis) {
|
41280
|
-
logs = getDecodedLogs(
|
41191
|
+
const logs = getDecodedLogs(
|
41281
41192
|
transactionSummary.receipts,
|
41282
41193
|
this.abis.main,
|
41283
41194
|
this.abis.otherContractsAbis
|
41284
41195
|
);
|
41285
41196
|
transactionResult.logs = logs;
|
41286
41197
|
}
|
41287
|
-
if (transactionResult.isStatusFailure) {
|
41288
|
-
const {
|
41289
|
-
receipts,
|
41290
|
-
gqlTransaction: { status }
|
41291
|
-
} = transactionResult;
|
41292
|
-
throw extractTxError({
|
41293
|
-
receipts,
|
41294
|
-
status,
|
41295
|
-
logs
|
41296
|
-
});
|
41297
|
-
}
|
41298
41198
|
return transactionResult;
|
41299
41199
|
}
|
41300
41200
|
/**
|
@@ -41303,7 +41203,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
41303
41203
|
* @param contractsAbiMap - The contracts ABI map.
|
41304
41204
|
*/
|
41305
41205
|
async wait(contractsAbiMap) {
|
41306
|
-
|
41206
|
+
const result = await this.waitForResult(contractsAbiMap);
|
41207
|
+
if (result.isStatusFailure) {
|
41208
|
+
throw new FuelError(
|
41209
|
+
ErrorCode.TRANSACTION_FAILED,
|
41210
|
+
`Transaction failed: ${result.gqlTransaction.status.reason}`
|
41211
|
+
);
|
41212
|
+
}
|
41213
|
+
return result;
|
41307
41214
|
}
|
41308
41215
|
};
|
41309
41216
|
|