@fuel-ts/account 0.0.0-rc-1976-20240405090158 → 0.0.0-rc-1976-20240405092005
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 +212 -38
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +540 -457
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +328 -240
- package/dist/index.mjs.map +1 -1
- 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 +212 -38
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +501 -424
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +298 -213
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
package/dist/index.global.js
CHANGED
@@ -29083,6 +29083,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29083
29083
|
})(ErrorCode || {});
|
29084
29084
|
var _FuelError = class extends Error {
|
29085
29085
|
VERSIONS = versions;
|
29086
|
+
metadata;
|
29086
29087
|
static parse(e) {
|
29087
29088
|
const error = e;
|
29088
29089
|
if (error.code === void 0) {
|
@@ -29102,14 +29103,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29102
29103
|
return new _FuelError(error.code, error.message);
|
29103
29104
|
}
|
29104
29105
|
code;
|
29105
|
-
constructor(code, message) {
|
29106
|
+
constructor(code, message, metadata = {}) {
|
29106
29107
|
super(message);
|
29107
29108
|
this.code = code;
|
29108
29109
|
this.name = "FuelError";
|
29110
|
+
this.metadata = metadata;
|
29109
29111
|
}
|
29110
29112
|
toObject() {
|
29111
|
-
const { code, name, message, VERSIONS } = this;
|
29112
|
-
return { code, name, message, VERSIONS };
|
29113
|
+
const { code, name, message, metadata, VERSIONS } = this;
|
29114
|
+
return { code, name, message, metadata, VERSIONS };
|
29113
29115
|
}
|
29114
29116
|
};
|
29115
29117
|
var FuelError = _FuelError;
|
@@ -31909,9 +31911,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31909
31911
|
__privateAdd2(this, _getPaddedData);
|
31910
31912
|
}
|
31911
31913
|
encode(value) {
|
31912
|
-
if (!Array.isArray(value)) {
|
31913
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
31914
|
-
}
|
31915
31914
|
const parts = [];
|
31916
31915
|
const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
|
31917
31916
|
const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
|
@@ -31938,7 +31937,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31938
31937
|
};
|
31939
31938
|
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
31940
31939
|
getPaddedData_fn = function(value) {
|
31941
|
-
const data = [Uint8Array
|
31940
|
+
const data = value instanceof Uint8Array ? [value] : [new Uint8Array(value)];
|
31942
31941
|
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
31943
31942
|
if (paddingLength) {
|
31944
31943
|
data.push(new Uint8Array(paddingLength));
|
@@ -31961,7 +31960,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31961
31960
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
31962
31961
|
0
|
31963
31962
|
);
|
31964
|
-
super(
|
31963
|
+
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
31965
31964
|
this.name = name;
|
31966
31965
|
this.coders = coders;
|
31967
31966
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -32031,7 +32030,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32031
32030
|
return { None: [] };
|
32032
32031
|
}
|
32033
32032
|
decode(data, offset) {
|
32034
|
-
if (data.length < this.encodedLength
|
32033
|
+
if (data.length < this.encodedLength) {
|
32035
32034
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
32036
32035
|
}
|
32037
32036
|
const [decoded, newOffset] = super.decode(data, offset);
|
@@ -32614,11 +32613,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32614
32613
|
super("struct", "struct Bytes", WORD_SIZE);
|
32615
32614
|
}
|
32616
32615
|
encode(value) {
|
32617
|
-
|
32618
|
-
|
32619
|
-
}
|
32620
|
-
const bytes3 = new Uint8Array(value);
|
32621
|
-
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
32616
|
+
const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
32617
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
|
32622
32618
|
return new Uint8Array([...lengthBytes, ...bytes3]);
|
32623
32619
|
}
|
32624
32620
|
decode(data, offset) {
|
@@ -32651,7 +32647,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32651
32647
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
32652
32648
|
0
|
32653
32649
|
);
|
32654
|
-
super(
|
32650
|
+
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
32655
32651
|
this.name = name;
|
32656
32652
|
this.coders = coders;
|
32657
32653
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -32749,6 +32745,28 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32749
32745
|
return [toNumber2(bytes3), offset + this.length];
|
32750
32746
|
}
|
32751
32747
|
};
|
32748
|
+
var OptionCoder2 = class extends EnumCoder2 {
|
32749
|
+
encode(value) {
|
32750
|
+
const result = super.encode(this.toSwayOption(value));
|
32751
|
+
return result;
|
32752
|
+
}
|
32753
|
+
toSwayOption(input) {
|
32754
|
+
if (input !== void 0) {
|
32755
|
+
return { Some: input };
|
32756
|
+
}
|
32757
|
+
return { None: [] };
|
32758
|
+
}
|
32759
|
+
decode(data, offset) {
|
32760
|
+
const [decoded, newOffset] = super.decode(data, offset);
|
32761
|
+
return [this.toOption(decoded), newOffset];
|
32762
|
+
}
|
32763
|
+
toOption(output3) {
|
32764
|
+
if (output3 && "Some" in output3) {
|
32765
|
+
return output3.Some;
|
32766
|
+
}
|
32767
|
+
return void 0;
|
32768
|
+
}
|
32769
|
+
};
|
32752
32770
|
var RawSliceCoder2 = class extends Coder {
|
32753
32771
|
constructor() {
|
32754
32772
|
super("raw untyped slice", "raw untyped slice", WORD_SIZE);
|
@@ -32802,6 +32820,30 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32802
32820
|
}
|
32803
32821
|
};
|
32804
32822
|
__publicField4(StdStringCoder2, "memorySize", 1);
|
32823
|
+
var StrSliceCoder = class extends Coder {
|
32824
|
+
constructor() {
|
32825
|
+
super("strSlice", "str", WORD_SIZE);
|
32826
|
+
}
|
32827
|
+
encode(value) {
|
32828
|
+
const bytes3 = toUtf8Bytes(value);
|
32829
|
+
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
32830
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
32831
|
+
}
|
32832
|
+
decode(data, offset) {
|
32833
|
+
if (data.length < this.encodedLength) {
|
32834
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice data size.`);
|
32835
|
+
}
|
32836
|
+
const offsetAndLength = offset + WORD_SIZE;
|
32837
|
+
const lengthBytes = data.slice(offset, offsetAndLength);
|
32838
|
+
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
32839
|
+
const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
|
32840
|
+
if (bytes3.length !== length) {
|
32841
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
32842
|
+
}
|
32843
|
+
return [toUtf8String(bytes3), offsetAndLength + length];
|
32844
|
+
}
|
32845
|
+
};
|
32846
|
+
__publicField4(StrSliceCoder, "memorySize", 1);
|
32805
32847
|
var StringCoder2 = class extends Coder {
|
32806
32848
|
constructor(length) {
|
32807
32849
|
super("string", `str[${length}]`, length);
|
@@ -32840,7 +32882,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32840
32882
|
Object.keys(this.coders).map((fieldName) => {
|
32841
32883
|
const fieldCoder = this.coders[fieldName];
|
32842
32884
|
const fieldValue = value[fieldName];
|
32843
|
-
if (!(fieldCoder instanceof
|
32885
|
+
if (!(fieldCoder instanceof OptionCoder2) && fieldValue == null) {
|
32844
32886
|
throw new FuelError(
|
32845
32887
|
ErrorCode.ENCODE_ERROR,
|
32846
32888
|
`Invalid ${this.type}. Field "${fieldName}" not present.`
|
@@ -32948,6 +32990,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32948
32990
|
return new ByteCoder2();
|
32949
32991
|
case STD_STRING_CODER_TYPE:
|
32950
32992
|
return new StdStringCoder2();
|
32993
|
+
case STR_SLICE_CODER_TYPE:
|
32994
|
+
return new StrSliceCoder();
|
32951
32995
|
default:
|
32952
32996
|
break;
|
32953
32997
|
}
|
@@ -32992,7 +33036,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32992
33036
|
const coders = getCoders(components, { getCoder: getCoder2 });
|
32993
33037
|
const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
|
32994
33038
|
if (isOptionEnum) {
|
32995
|
-
return new
|
33039
|
+
return new OptionCoder2(enumMatch.name, coders);
|
32996
33040
|
}
|
32997
33041
|
return new EnumCoder2(enumMatch.name, coders);
|
32998
33042
|
}
|
@@ -33003,12 +33047,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33003
33047
|
);
|
33004
33048
|
return new TupleCoder2(coders);
|
33005
33049
|
}
|
33006
|
-
if (resolvedAbiType.type === STR_SLICE_CODER_TYPE) {
|
33007
|
-
throw new FuelError(
|
33008
|
-
ErrorCode.INVALID_DATA,
|
33009
|
-
"String slices can not be decoded from logs. Convert the slice to `str[N]` with `__to_str_array`"
|
33010
|
-
);
|
33011
|
-
}
|
33012
33050
|
throw new FuelError(
|
33013
33051
|
ErrorCode.CODER_NOT_FOUND,
|
33014
33052
|
`Coder not found: ${JSON.stringify(resolvedAbiType)}.`
|
@@ -33044,6 +33082,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33044
33082
|
var FunctionFragment = class {
|
33045
33083
|
signature;
|
33046
33084
|
selector;
|
33085
|
+
selectorBytes;
|
33086
|
+
encoding;
|
33047
33087
|
name;
|
33048
33088
|
jsonFn;
|
33049
33089
|
attributes;
|
@@ -33056,6 +33096,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33056
33096
|
this.name = name;
|
33057
33097
|
this.signature = FunctionFragment.getSignature(this.jsonAbi, this.jsonFn);
|
33058
33098
|
this.selector = FunctionFragment.getFunctionSelector(this.signature);
|
33099
|
+
this.selectorBytes = new StdStringCoder2().encode(name);
|
33100
|
+
this.encoding = this.jsonAbi.encoding ?? ENCODING_V0;
|
33059
33101
|
this.isInputDataPointer = this.#isInputDataPointer();
|
33060
33102
|
this.outputMetadata = {
|
33061
33103
|
isHeapType: this.#isOutputDataHeap(),
|
@@ -33109,11 +33151,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33109
33151
|
}
|
33110
33152
|
const coders = nonEmptyInputs.map(
|
33111
33153
|
(t) => AbiCoder.getCoder(this.jsonAbi, t, {
|
33112
|
-
isRightPadded: nonEmptyInputs.length > 1
|
33154
|
+
isRightPadded: nonEmptyInputs.length > 1,
|
33155
|
+
encoding: this.encoding
|
33113
33156
|
})
|
33114
33157
|
);
|
33115
|
-
|
33116
|
-
|
33158
|
+
if (this.encoding === ENCODING_V1) {
|
33159
|
+
return new TupleCoder2(coders).encode(shallowCopyValues);
|
33160
|
+
}
|
33161
|
+
const results = new TupleCoder(coders).encode(shallowCopyValues);
|
33117
33162
|
return unpackDynamicData(results, offset, results.byteLength);
|
33118
33163
|
}
|
33119
33164
|
static verifyArgsAndInputsAlign(args, inputs, abi) {
|
@@ -33160,7 +33205,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33160
33205
|
}
|
33161
33206
|
const result = nonEmptyInputs.reduce(
|
33162
33207
|
(obj, input) => {
|
33163
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, input);
|
33208
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
|
33164
33209
|
const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
|
33165
33210
|
return {
|
33166
33211
|
decoded: [...obj.decoded, decodedValue],
|
@@ -33180,7 +33225,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33180
33225
|
return [void 0, 0];
|
33181
33226
|
}
|
33182
33227
|
const bytes3 = arrayify(data);
|
33183
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output
|
33228
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
|
33229
|
+
encoding: this.encoding
|
33230
|
+
});
|
33184
33231
|
return coder.decode(bytes3, 0);
|
33185
33232
|
}
|
33186
33233
|
};
|
@@ -33242,7 +33289,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33242
33289
|
}
|
33243
33290
|
);
|
33244
33291
|
return AbiCoder.encode(this.jsonAbi, configurable.configurableType, value, {
|
33245
|
-
isRightPadded: true
|
33292
|
+
isRightPadded: true,
|
33293
|
+
encoding: this.jsonAbi.encoding
|
33246
33294
|
});
|
33247
33295
|
}
|
33248
33296
|
getTypeById(typeId) {
|
@@ -38950,7 +38998,60 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38950
38998
|
var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
|
38951
38999
|
var MAX_PREDICATE_LENGTH = 1024 * 1024;
|
38952
39000
|
var MAX_PREDICATE_DATA_LENGTH = 1024 * 1024;
|
39001
|
+
var FAILED_REQUIRE_SIGNAL = "0xffffffffffff0000";
|
38953
39002
|
var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
|
39003
|
+
var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
|
39004
|
+
var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
|
39005
|
+
var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
|
39006
|
+
var PANIC_REASONS = [
|
39007
|
+
"UnknownPanicReason",
|
39008
|
+
"Revert",
|
39009
|
+
"OutOfGas",
|
39010
|
+
"TransactionValidity",
|
39011
|
+
"MemoryOverflow",
|
39012
|
+
"ArithmeticOverflow",
|
39013
|
+
"ContractNotFound",
|
39014
|
+
"MemoryOwnership",
|
39015
|
+
"NotEnoughBalance",
|
39016
|
+
"ExpectedInternalContext",
|
39017
|
+
"AssetIdNotFound",
|
39018
|
+
"InputNotFound",
|
39019
|
+
"OutputNotFound",
|
39020
|
+
"WitnessNotFound",
|
39021
|
+
"TransactionMaturity",
|
39022
|
+
"InvalidMetadataIdentifier",
|
39023
|
+
"MalformedCallStructure",
|
39024
|
+
"ReservedRegisterNotWritable",
|
39025
|
+
"InvalidFlags",
|
39026
|
+
"InvalidImmediateValue",
|
39027
|
+
"ExpectedCoinInput",
|
39028
|
+
"EcalError",
|
39029
|
+
"MemoryWriteOverlap",
|
39030
|
+
"ContractNotInInputs",
|
39031
|
+
"InternalBalanceOverflow",
|
39032
|
+
"ContractMaxSize",
|
39033
|
+
"ExpectedUnallocatedStack",
|
39034
|
+
"MaxStaticContractsReached",
|
39035
|
+
"TransferAmountCannotBeZero",
|
39036
|
+
"ExpectedOutputVariable",
|
39037
|
+
"ExpectedParentInternalContext",
|
39038
|
+
"PredicateReturnedNonOne",
|
39039
|
+
"ContractIdAlreadyDeployed",
|
39040
|
+
"ContractMismatch",
|
39041
|
+
"MessageDataTooLong",
|
39042
|
+
"ArithmeticError",
|
39043
|
+
"ContractInstructionNotAllowed",
|
39044
|
+
"TransferZeroCoins",
|
39045
|
+
"InvalidInstruction",
|
39046
|
+
"MemoryNotExecutable",
|
39047
|
+
"PolicyIsNotSet",
|
39048
|
+
"PolicyNotFound",
|
39049
|
+
"TooManyReceipts",
|
39050
|
+
"BalanceOverflow",
|
39051
|
+
"InvalidBlockHeight",
|
39052
|
+
"TooManySlots"
|
39053
|
+
];
|
39054
|
+
var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
|
38954
39055
|
|
38955
39056
|
// src/providers/utils/receipts.ts
|
38956
39057
|
var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
|
@@ -39324,6 +39425,74 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
39324
39425
|
});
|
39325
39426
|
}
|
39326
39427
|
|
39428
|
+
// src/providers/utils/extract-tx-error.ts
|
39429
|
+
var assemblePanicError = (status) => {
|
39430
|
+
let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
|
39431
|
+
const reason = status.reason;
|
39432
|
+
if (PANIC_REASONS.includes(status.reason)) {
|
39433
|
+
errorMessage = `${errorMessage}
|
39434
|
+
|
39435
|
+
You can read more about this error at:
|
39436
|
+
|
39437
|
+
${PANIC_DOC_URL}#variant.${status.reason}`;
|
39438
|
+
}
|
39439
|
+
return { errorMessage, reason };
|
39440
|
+
};
|
39441
|
+
var stringify2 = (obj) => JSON.stringify(obj, null, 2);
|
39442
|
+
var assembleRevertError = (receipts, logs) => {
|
39443
|
+
let errorMessage = "The transaction reverted with an unknown reason.";
|
39444
|
+
const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
|
39445
|
+
let reason = "";
|
39446
|
+
if (revertReceipt) {
|
39447
|
+
const reasonHex = bn(revertReceipt.val).toHex();
|
39448
|
+
switch (reasonHex) {
|
39449
|
+
case FAILED_REQUIRE_SIGNAL: {
|
39450
|
+
reason = "require";
|
39451
|
+
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify2(logs[0]) : "an error."}.`;
|
39452
|
+
break;
|
39453
|
+
}
|
39454
|
+
case FAILED_ASSERT_EQ_SIGNAL: {
|
39455
|
+
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
39456
|
+
reason = "assert_eq";
|
39457
|
+
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
|
39458
|
+
break;
|
39459
|
+
}
|
39460
|
+
case FAILED_ASSERT_NE_SIGNAL: {
|
39461
|
+
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
39462
|
+
reason = "assert_ne";
|
39463
|
+
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
|
39464
|
+
break;
|
39465
|
+
}
|
39466
|
+
case FAILED_ASSERT_SIGNAL:
|
39467
|
+
reason = "assert";
|
39468
|
+
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
39469
|
+
break;
|
39470
|
+
case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
39471
|
+
reason = "MissingOutputChange";
|
39472
|
+
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
39473
|
+
break;
|
39474
|
+
default:
|
39475
|
+
reason = "unknown";
|
39476
|
+
errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
|
39477
|
+
}
|
39478
|
+
}
|
39479
|
+
return { errorMessage, reason };
|
39480
|
+
};
|
39481
|
+
var extractTxError = (params) => {
|
39482
|
+
const { receipts, status, logs } = params;
|
39483
|
+
const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
|
39484
|
+
const isRevert = receipts.some(({ type: type3 }) => type3 === ReceiptType.Revert);
|
39485
|
+
const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
|
39486
|
+
const metadata = {
|
39487
|
+
logs,
|
39488
|
+
receipts,
|
39489
|
+
panic: isPanic,
|
39490
|
+
revert: isRevert,
|
39491
|
+
reason
|
39492
|
+
};
|
39493
|
+
return new FuelError(ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
|
39494
|
+
};
|
39495
|
+
|
39327
39496
|
// src/providers/transaction-request/errors.ts
|
39328
39497
|
var ChangeOutputCollisionError = class extends Error {
|
39329
39498
|
name = "ChangeOutputCollisionError";
|
@@ -41142,14 +41311,26 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41142
41311
|
gqlTransaction: this.gqlTransaction,
|
41143
41312
|
...transactionSummary
|
41144
41313
|
};
|
41314
|
+
let logs = [];
|
41145
41315
|
if (this.abis) {
|
41146
|
-
|
41316
|
+
logs = getDecodedLogs(
|
41147
41317
|
transactionSummary.receipts,
|
41148
41318
|
this.abis.main,
|
41149
41319
|
this.abis.otherContractsAbis
|
41150
41320
|
);
|
41151
41321
|
transactionResult.logs = logs;
|
41152
41322
|
}
|
41323
|
+
if (transactionResult.isStatusFailure) {
|
41324
|
+
const {
|
41325
|
+
receipts,
|
41326
|
+
gqlTransaction: { status }
|
41327
|
+
} = transactionResult;
|
41328
|
+
throw extractTxError({
|
41329
|
+
receipts,
|
41330
|
+
status,
|
41331
|
+
logs
|
41332
|
+
});
|
41333
|
+
}
|
41153
41334
|
return transactionResult;
|
41154
41335
|
}
|
41155
41336
|
/**
|
@@ -41158,14 +41339,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41158
41339
|
* @param contractsAbiMap - The contracts ABI map.
|
41159
41340
|
*/
|
41160
41341
|
async wait(contractsAbiMap) {
|
41161
|
-
|
41162
|
-
if (result.isStatusFailure) {
|
41163
|
-
throw new FuelError(
|
41164
|
-
ErrorCode.TRANSACTION_FAILED,
|
41165
|
-
`Transaction failed: ${result.gqlTransaction.status.reason}`
|
41166
|
-
);
|
41167
|
-
}
|
41168
|
-
return result;
|
41342
|
+
return this.waitForResult(contractsAbiMap);
|
41169
41343
|
}
|
41170
41344
|
};
|
41171
41345
|
|