@fuel-ts/account 0.0.0-rc-1895-20240403004459 → 0.0.0-rc-1832-20240403144616
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 -166
- 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 -166
- 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
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction-response.d.ts","sourceRoot":"","sources":["../../../src/providers/transaction-response/transaction-response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"transaction-response.d.ts","sourceRoot":"","sources":["../../../src/providers/transaction-response/transaction-response.ts"],"names":[],"mapp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AgB,GAAG,IAAI,EACjD,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;YAgClC,mBAAmB;IAyBjC;;;;OAIG;IACG,aAAa,CAAC,gBAAgB,GAAG,IAAI,EACzC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAuB/C;;;;OAIG;IACG,IAAI,CAAC,gBAAgB,GAAG,IAAI,EAChC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;CAYhD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
@@ -32050,7 +32050,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32050
32050
|
})(ErrorCode || {});
|
32051
32051
|
var _FuelError = class extends Error {
|
32052
32052
|
VERSIONS = versions;
|
32053
|
-
metadata;
|
32054
32053
|
static parse(e) {
|
32055
32054
|
const error = e;
|
32056
32055
|
if (error.code === void 0) {
|
@@ -32070,15 +32069,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32070
32069
|
return new _FuelError(error.code, error.message);
|
32071
32070
|
}
|
32072
32071
|
code;
|
32073
|
-
constructor(code, message
|
32072
|
+
constructor(code, message) {
|
32074
32073
|
super(message);
|
32075
32074
|
this.code = code;
|
32076
32075
|
this.name = "FuelError";
|
32077
|
-
this.metadata = metadata;
|
32078
32076
|
}
|
32079
32077
|
toObject() {
|
32080
|
-
const { code, name, message,
|
32081
|
-
return { code, name, message,
|
32078
|
+
const { code, name, message, VERSIONS } = this;
|
32079
|
+
return { code, name, message, VERSIONS };
|
32082
32080
|
}
|
32083
32081
|
};
|
32084
32082
|
var FuelError = _FuelError;
|
@@ -35385,9 +35383,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35385
35383
|
__privateAdd2(this, _getPaddedData);
|
35386
35384
|
}
|
35387
35385
|
encode(value) {
|
35388
|
-
if (!Array.isArray(value)) {
|
35389
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
35390
|
-
}
|
35391
35386
|
const parts = [];
|
35392
35387
|
const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
|
35393
35388
|
const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
|
@@ -35414,7 +35409,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35414
35409
|
};
|
35415
35410
|
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
35416
35411
|
getPaddedData_fn = function(value) {
|
35417
|
-
const data = [Uint8Array
|
35412
|
+
const data = value instanceof Uint8Array ? [value] : [new Uint8Array(value)];
|
35418
35413
|
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
35419
35414
|
if (paddingLength) {
|
35420
35415
|
data.push(new Uint8Array(paddingLength));
|
@@ -35437,7 +35432,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35437
35432
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
35438
35433
|
0
|
35439
35434
|
);
|
35440
|
-
super(
|
35435
|
+
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
35441
35436
|
this.name = name;
|
35442
35437
|
this.coders = coders;
|
35443
35438
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -35507,7 +35502,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35507
35502
|
return { None: [] };
|
35508
35503
|
}
|
35509
35504
|
decode(data, offset) {
|
35510
|
-
if (data.length < this.encodedLength
|
35505
|
+
if (data.length < this.encodedLength) {
|
35511
35506
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
35512
35507
|
}
|
35513
35508
|
const [decoded, newOffset] = super.decode(data, offset);
|
@@ -36090,11 +36085,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36090
36085
|
super("struct", "struct Bytes", WORD_SIZE);
|
36091
36086
|
}
|
36092
36087
|
encode(value) {
|
36093
|
-
|
36094
|
-
|
36095
|
-
}
|
36096
|
-
const bytes3 = new Uint8Array(value);
|
36097
|
-
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
36088
|
+
const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
36089
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
|
36098
36090
|
return new Uint8Array([...lengthBytes, ...bytes3]);
|
36099
36091
|
}
|
36100
36092
|
decode(data, offset) {
|
@@ -36127,7 +36119,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36127
36119
|
(max2, coder) => Math.max(max2, coder.encodedLength),
|
36128
36120
|
0
|
36129
36121
|
);
|
36130
|
-
super(
|
36122
|
+
super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
|
36131
36123
|
this.name = name;
|
36132
36124
|
this.coders = coders;
|
36133
36125
|
this.#caseIndexCoder = caseIndexCoder;
|
@@ -36225,6 +36217,28 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36225
36217
|
return [toNumber2(bytes3), offset + this.length];
|
36226
36218
|
}
|
36227
36219
|
};
|
36220
|
+
var OptionCoder2 = class extends EnumCoder2 {
|
36221
|
+
encode(value) {
|
36222
|
+
const result = super.encode(this.toSwayOption(value));
|
36223
|
+
return result;
|
36224
|
+
}
|
36225
|
+
toSwayOption(input) {
|
36226
|
+
if (input !== void 0) {
|
36227
|
+
return { Some: input };
|
36228
|
+
}
|
36229
|
+
return { None: [] };
|
36230
|
+
}
|
36231
|
+
decode(data, offset) {
|
36232
|
+
const [decoded, newOffset] = super.decode(data, offset);
|
36233
|
+
return [this.toOption(decoded), newOffset];
|
36234
|
+
}
|
36235
|
+
toOption(output3) {
|
36236
|
+
if (output3 && "Some" in output3) {
|
36237
|
+
return output3.Some;
|
36238
|
+
}
|
36239
|
+
return void 0;
|
36240
|
+
}
|
36241
|
+
};
|
36228
36242
|
var RawSliceCoder2 = class extends Coder {
|
36229
36243
|
constructor() {
|
36230
36244
|
super("raw untyped slice", "raw untyped slice", WORD_SIZE);
|
@@ -36278,6 +36292,30 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36278
36292
|
}
|
36279
36293
|
};
|
36280
36294
|
__publicField4(StdStringCoder2, "memorySize", 1);
|
36295
|
+
var StrSliceCoder = class extends Coder {
|
36296
|
+
constructor() {
|
36297
|
+
super("strSlice", "str", WORD_SIZE);
|
36298
|
+
}
|
36299
|
+
encode(value) {
|
36300
|
+
const bytes3 = toUtf8Bytes(value);
|
36301
|
+
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
36302
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
36303
|
+
}
|
36304
|
+
decode(data, offset) {
|
36305
|
+
if (data.length < this.encodedLength) {
|
36306
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice data size.`);
|
36307
|
+
}
|
36308
|
+
const offsetAndLength = offset + WORD_SIZE;
|
36309
|
+
const lengthBytes = data.slice(offset, offsetAndLength);
|
36310
|
+
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
36311
|
+
const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
|
36312
|
+
if (bytes3.length !== length) {
|
36313
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
36314
|
+
}
|
36315
|
+
return [toUtf8String(bytes3), offsetAndLength + length];
|
36316
|
+
}
|
36317
|
+
};
|
36318
|
+
__publicField4(StrSliceCoder, "memorySize", 1);
|
36281
36319
|
var StringCoder2 = class extends Coder {
|
36282
36320
|
constructor(length) {
|
36283
36321
|
super("string", `str[${length}]`, length);
|
@@ -36316,7 +36354,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36316
36354
|
Object.keys(this.coders).map((fieldName) => {
|
36317
36355
|
const fieldCoder = this.coders[fieldName];
|
36318
36356
|
const fieldValue = value[fieldName];
|
36319
|
-
if (!(fieldCoder instanceof
|
36357
|
+
if (!(fieldCoder instanceof OptionCoder2) && fieldValue == null) {
|
36320
36358
|
throw new FuelError(
|
36321
36359
|
ErrorCode.ENCODE_ERROR,
|
36322
36360
|
`Invalid ${this.type}. Field "${fieldName}" not present.`
|
@@ -36424,6 +36462,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36424
36462
|
return new ByteCoder2();
|
36425
36463
|
case STD_STRING_CODER_TYPE:
|
36426
36464
|
return new StdStringCoder2();
|
36465
|
+
case STR_SLICE_CODER_TYPE:
|
36466
|
+
return new StrSliceCoder();
|
36427
36467
|
default:
|
36428
36468
|
break;
|
36429
36469
|
}
|
@@ -36468,7 +36508,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36468
36508
|
const coders = getCoders(components, { getCoder: getCoder2 });
|
36469
36509
|
const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
|
36470
36510
|
if (isOptionEnum) {
|
36471
|
-
return new
|
36511
|
+
return new OptionCoder2(enumMatch.name, coders);
|
36472
36512
|
}
|
36473
36513
|
return new EnumCoder2(enumMatch.name, coders);
|
36474
36514
|
}
|
@@ -36479,12 +36519,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36479
36519
|
);
|
36480
36520
|
return new TupleCoder2(coders);
|
36481
36521
|
}
|
36482
|
-
if (resolvedAbiType.type === STR_SLICE_CODER_TYPE) {
|
36483
|
-
throw new FuelError(
|
36484
|
-
ErrorCode.INVALID_DATA,
|
36485
|
-
"String slices can not be decoded from logs. Convert the slice to `str[N]` with `__to_str_array`"
|
36486
|
-
);
|
36487
|
-
}
|
36488
36522
|
throw new FuelError(
|
36489
36523
|
ErrorCode.CODER_NOT_FOUND,
|
36490
36524
|
`Coder not found: ${JSON.stringify(resolvedAbiType)}.`
|
@@ -36520,6 +36554,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36520
36554
|
var FunctionFragment = class {
|
36521
36555
|
signature;
|
36522
36556
|
selector;
|
36557
|
+
selectorBytes;
|
36558
|
+
encoding;
|
36523
36559
|
name;
|
36524
36560
|
jsonFn;
|
36525
36561
|
attributes;
|
@@ -36532,6 +36568,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36532
36568
|
this.name = name;
|
36533
36569
|
this.signature = FunctionFragment.getSignature(this.jsonAbi, this.jsonFn);
|
36534
36570
|
this.selector = FunctionFragment.getFunctionSelector(this.signature);
|
36571
|
+
this.selectorBytes = new StdStringCoder2().encode(name);
|
36572
|
+
this.encoding = this.jsonAbi.encoding ?? ENCODING_V0;
|
36535
36573
|
this.isInputDataPointer = this.#isInputDataPointer();
|
36536
36574
|
this.outputMetadata = {
|
36537
36575
|
isHeapType: this.#isOutputDataHeap(),
|
@@ -36585,11 +36623,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36585
36623
|
}
|
36586
36624
|
const coders = nonEmptyInputs.map(
|
36587
36625
|
(t) => AbiCoder.getCoder(this.jsonAbi, t, {
|
36588
|
-
isRightPadded: nonEmptyInputs.length > 1
|
36626
|
+
isRightPadded: nonEmptyInputs.length > 1,
|
36627
|
+
encoding: this.encoding
|
36589
36628
|
})
|
36590
36629
|
);
|
36591
|
-
|
36592
|
-
|
36630
|
+
if (this.encoding === ENCODING_V1) {
|
36631
|
+
return new TupleCoder2(coders).encode(shallowCopyValues);
|
36632
|
+
}
|
36633
|
+
const results = new TupleCoder(coders).encode(shallowCopyValues);
|
36593
36634
|
return unpackDynamicData(results, offset, results.byteLength);
|
36594
36635
|
}
|
36595
36636
|
static verifyArgsAndInputsAlign(args, inputs, abi) {
|
@@ -36636,7 +36677,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36636
36677
|
}
|
36637
36678
|
const result = nonEmptyInputs.reduce(
|
36638
36679
|
(obj, input) => {
|
36639
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, input);
|
36680
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
|
36640
36681
|
const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
|
36641
36682
|
return {
|
36642
36683
|
decoded: [...obj.decoded, decodedValue],
|
@@ -36656,7 +36697,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36656
36697
|
return [void 0, 0];
|
36657
36698
|
}
|
36658
36699
|
const bytes3 = arrayify(data);
|
36659
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output
|
36700
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
|
36701
|
+
encoding: this.encoding
|
36702
|
+
});
|
36660
36703
|
return coder.decode(bytes3, 0);
|
36661
36704
|
}
|
36662
36705
|
};
|
@@ -36724,7 +36767,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36724
36767
|
}
|
36725
36768
|
);
|
36726
36769
|
return AbiCoder.encode(this.jsonAbi, configurable.configurableType, value, {
|
36727
|
-
isRightPadded: true
|
36770
|
+
isRightPadded: true,
|
36771
|
+
encoding: this.jsonAbi.encoding
|
36728
36772
|
});
|
36729
36773
|
}
|
36730
36774
|
getTypeById(typeId) {
|
@@ -42426,60 +42470,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42426
42470
|
var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
|
42427
42471
|
var MAX_PREDICATE_LENGTH = 1024 * 1024;
|
42428
42472
|
var MAX_PREDICATE_DATA_LENGTH = 1024 * 1024;
|
42429
|
-
var FAILED_REQUIRE_SIGNAL = "0xffffffffffff0000";
|
42430
42473
|
var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
|
42431
|
-
var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
|
42432
|
-
var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
|
42433
|
-
var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
|
42434
|
-
var PANIC_REASONS = [
|
42435
|
-
"UnknownPanicReason",
|
42436
|
-
"Revert",
|
42437
|
-
"OutOfGas",
|
42438
|
-
"TransactionValidity",
|
42439
|
-
"MemoryOverflow",
|
42440
|
-
"ArithmeticOverflow",
|
42441
|
-
"ContractNotFound",
|
42442
|
-
"MemoryOwnership",
|
42443
|
-
"NotEnoughBalance",
|
42444
|
-
"ExpectedInternalContext",
|
42445
|
-
"AssetIdNotFound",
|
42446
|
-
"InputNotFound",
|
42447
|
-
"OutputNotFound",
|
42448
|
-
"WitnessNotFound",
|
42449
|
-
"TransactionMaturity",
|
42450
|
-
"InvalidMetadataIdentifier",
|
42451
|
-
"MalformedCallStructure",
|
42452
|
-
"ReservedRegisterNotWritable",
|
42453
|
-
"InvalidFlags",
|
42454
|
-
"InvalidImmediateValue",
|
42455
|
-
"ExpectedCoinInput",
|
42456
|
-
"EcalError",
|
42457
|
-
"MemoryWriteOverlap",
|
42458
|
-
"ContractNotInInputs",
|
42459
|
-
"InternalBalanceOverflow",
|
42460
|
-
"ContractMaxSize",
|
42461
|
-
"ExpectedUnallocatedStack",
|
42462
|
-
"MaxStaticContractsReached",
|
42463
|
-
"TransferAmountCannotBeZero",
|
42464
|
-
"ExpectedOutputVariable",
|
42465
|
-
"ExpectedParentInternalContext",
|
42466
|
-
"PredicateReturnedNonOne",
|
42467
|
-
"ContractIdAlreadyDeployed",
|
42468
|
-
"ContractMismatch",
|
42469
|
-
"MessageDataTooLong",
|
42470
|
-
"ArithmeticError",
|
42471
|
-
"ContractInstructionNotAllowed",
|
42472
|
-
"TransferZeroCoins",
|
42473
|
-
"InvalidInstruction",
|
42474
|
-
"MemoryNotExecutable",
|
42475
|
-
"PolicyIsNotSet",
|
42476
|
-
"PolicyNotFound",
|
42477
|
-
"TooManyReceipts",
|
42478
|
-
"BalanceOverflow",
|
42479
|
-
"InvalidBlockHeight",
|
42480
|
-
"TooManySlots"
|
42481
|
-
];
|
42482
|
-
var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
|
42483
42474
|
|
42484
42475
|
// src/providers/utils/receipts.ts
|
42485
42476
|
var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
|
@@ -42792,74 +42783,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42792
42783
|
});
|
42793
42784
|
}
|
42794
42785
|
|
42795
|
-
// src/providers/utils/extract-tx-error.ts
|
42796
|
-
var assemblePanicError = (status) => {
|
42797
|
-
let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
|
42798
|
-
const reason = status.reason;
|
42799
|
-
if (PANIC_REASONS.includes(status.reason)) {
|
42800
|
-
errorMessage = `${errorMessage}
|
42801
|
-
|
42802
|
-
You can read more about this error at:
|
42803
|
-
|
42804
|
-
${PANIC_DOC_URL}#variant.${status.reason}`;
|
42805
|
-
}
|
42806
|
-
return { errorMessage, reason };
|
42807
|
-
};
|
42808
|
-
var stringify2 = (obj) => JSON.stringify(obj, null, 2);
|
42809
|
-
var assembleRevertError = (receipts, logs) => {
|
42810
|
-
let errorMessage = "The transaction reverted with an unknown reason.";
|
42811
|
-
const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
|
42812
|
-
let reason = "";
|
42813
|
-
if (revertReceipt) {
|
42814
|
-
const reasonHex = bn(revertReceipt.val).toHex();
|
42815
|
-
switch (reasonHex) {
|
42816
|
-
case FAILED_REQUIRE_SIGNAL: {
|
42817
|
-
reason = "require";
|
42818
|
-
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify2(logs[0]) : "an error."}.`;
|
42819
|
-
break;
|
42820
|
-
}
|
42821
|
-
case FAILED_ASSERT_EQ_SIGNAL: {
|
42822
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42823
|
-
reason = "assert_eq";
|
42824
|
-
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
|
42825
|
-
break;
|
42826
|
-
}
|
42827
|
-
case FAILED_ASSERT_NE_SIGNAL: {
|
42828
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42829
|
-
reason = "assert_ne";
|
42830
|
-
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
|
42831
|
-
break;
|
42832
|
-
}
|
42833
|
-
case FAILED_ASSERT_SIGNAL:
|
42834
|
-
reason = "assert";
|
42835
|
-
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
42836
|
-
break;
|
42837
|
-
case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
42838
|
-
reason = "MissingOutputChange";
|
42839
|
-
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
42840
|
-
break;
|
42841
|
-
default:
|
42842
|
-
reason = "unknown";
|
42843
|
-
errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
|
42844
|
-
}
|
42845
|
-
}
|
42846
|
-
return { errorMessage, reason };
|
42847
|
-
};
|
42848
|
-
var extractTxError = (params) => {
|
42849
|
-
const { receipts, status, logs } = params;
|
42850
|
-
const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
|
42851
|
-
const isRevert = receipts.some(({ type: type3 }) => type3 === ReceiptType.Revert);
|
42852
|
-
const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
|
42853
|
-
const metadata = {
|
42854
|
-
logs,
|
42855
|
-
receipts,
|
42856
|
-
panic: isPanic,
|
42857
|
-
revert: isRevert,
|
42858
|
-
reason
|
42859
|
-
};
|
42860
|
-
return new FuelError(ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
|
42861
|
-
};
|
42862
|
-
|
42863
42786
|
// src/providers/transaction-request/errors.ts
|
42864
42787
|
var NoWitnessAtIndexError = class extends Error {
|
42865
42788
|
constructor(index) {
|
@@ -44617,26 +44540,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44617
44540
|
gqlTransaction: this.gqlTransaction,
|
44618
44541
|
...transactionSummary
|
44619
44542
|
};
|
44620
|
-
let logs = [];
|
44621
44543
|
if (this.abis) {
|
44622
|
-
logs = getDecodedLogs(
|
44544
|
+
const logs = getDecodedLogs(
|
44623
44545
|
transactionSummary.receipts,
|
44624
44546
|
this.abis.main,
|
44625
44547
|
this.abis.otherContractsAbis
|
44626
44548
|
);
|
44627
44549
|
transactionResult.logs = logs;
|
44628
44550
|
}
|
44629
|
-
if (transactionResult.isStatusFailure) {
|
44630
|
-
const {
|
44631
|
-
receipts,
|
44632
|
-
gqlTransaction: { status }
|
44633
|
-
} = transactionResult;
|
44634
|
-
throw extractTxError({
|
44635
|
-
receipts,
|
44636
|
-
status,
|
44637
|
-
logs
|
44638
|
-
});
|
44639
|
-
}
|
44640
44551
|
return transactionResult;
|
44641
44552
|
}
|
44642
44553
|
/**
|
@@ -44645,7 +44556,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
44645
44556
|
* @param contractsAbiMap - The contracts ABI map.
|
44646
44557
|
*/
|
44647
44558
|
async wait(contractsAbiMap) {
|
44648
|
-
|
44559
|
+
const result = await this.waitForResult(contractsAbiMap);
|
44560
|
+
if (result.isStatusFailure) {
|
44561
|
+
throw new FuelError(
|
44562
|
+
ErrorCode.TRANSACTION_FAILED,
|
44563
|
+
`Transaction failed: ${result.gqlTransaction.status.reason}`
|
44564
|
+
);
|
44565
|
+
}
|
44566
|
+
return result;
|
44649
44567
|
}
|
44650
44568
|
};
|
44651
44569
|
|