@fuel-ts/account 0.0.0-rc-1895-20240401111027 → 0.0.0-rc-1832-20240401150257
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 +80 -149
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +468 -541
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +240 -318
- 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 +80 -149
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +434 -501
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +213 -288
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
- package/dist/providers/utils/extract-tx-error.d.ts +0 -30
- 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"}
|
@@ -35383,9 +35383,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35383
35383
|
__privateAdd2(this, _getPaddedData);
|
35384
35384
|
}
|
35385
35385
|
encode(value) {
|
35386
|
-
if (!Array.isArray(value)) {
|
35387
|
-
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
35388
|
-
}
|
35389
35386
|
const parts = [];
|
35390
35387
|
const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
|
35391
35388
|
const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
|
@@ -35412,7 +35409,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35412
35409
|
};
|
35413
35410
|
_getPaddedData = /* @__PURE__ */ new WeakSet();
|
35414
35411
|
getPaddedData_fn = function(value) {
|
35415
|
-
const
|
35412
|
+
const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
35413
|
+
const data = [Uint8Array.from(bytes3)];
|
35416
35414
|
const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
|
35417
35415
|
if (paddingLength) {
|
35418
35416
|
data.push(new Uint8Array(paddingLength));
|
@@ -35505,7 +35503,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35505
35503
|
return { None: [] };
|
35506
35504
|
}
|
35507
35505
|
decode(data, offset) {
|
35508
|
-
if (data.length < this.encodedLength
|
35506
|
+
if (data.length < this.encodedLength) {
|
35509
35507
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
|
35510
35508
|
}
|
35511
35509
|
const [decoded, newOffset] = super.decode(data, offset);
|
@@ -36088,11 +36086,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36088
36086
|
super("struct", "struct Bytes", WORD_SIZE);
|
36089
36087
|
}
|
36090
36088
|
encode(value) {
|
36091
|
-
|
36092
|
-
|
36093
|
-
}
|
36094
|
-
const bytes3 = new Uint8Array(value);
|
36095
|
-
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
36089
|
+
const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
36090
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
|
36096
36091
|
return new Uint8Array([...lengthBytes, ...bytes3]);
|
36097
36092
|
}
|
36098
36093
|
decode(data, offset) {
|
@@ -36223,6 +36218,28 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36223
36218
|
return [toNumber2(bytes3), offset + this.length];
|
36224
36219
|
}
|
36225
36220
|
};
|
36221
|
+
var OptionCoder2 = class extends EnumCoder2 {
|
36222
|
+
encode(value) {
|
36223
|
+
const result = super.encode(this.toSwayOption(value));
|
36224
|
+
return result;
|
36225
|
+
}
|
36226
|
+
toSwayOption(input) {
|
36227
|
+
if (input !== void 0) {
|
36228
|
+
return { Some: input };
|
36229
|
+
}
|
36230
|
+
return { None: [] };
|
36231
|
+
}
|
36232
|
+
decode(data, offset) {
|
36233
|
+
const [decoded, newOffset] = super.decode(data, offset);
|
36234
|
+
return [this.toOption(decoded), newOffset];
|
36235
|
+
}
|
36236
|
+
toOption(output3) {
|
36237
|
+
if (output3 && "Some" in output3) {
|
36238
|
+
return output3.Some;
|
36239
|
+
}
|
36240
|
+
return void 0;
|
36241
|
+
}
|
36242
|
+
};
|
36226
36243
|
var RawSliceCoder2 = class extends Coder {
|
36227
36244
|
constructor() {
|
36228
36245
|
super("raw untyped slice", "raw untyped slice", WORD_SIZE);
|
@@ -36276,6 +36293,30 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36276
36293
|
}
|
36277
36294
|
};
|
36278
36295
|
__publicField4(StdStringCoder2, "memorySize", 1);
|
36296
|
+
var StrSliceCoder = class extends Coder {
|
36297
|
+
constructor() {
|
36298
|
+
super("strSlice", "str", WORD_SIZE);
|
36299
|
+
}
|
36300
|
+
encode(value) {
|
36301
|
+
const bytes3 = toUtf8Bytes(value);
|
36302
|
+
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
36303
|
+
return new Uint8Array([...lengthBytes, ...bytes3]);
|
36304
|
+
}
|
36305
|
+
decode(data, offset) {
|
36306
|
+
if (data.length < this.encodedLength) {
|
36307
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice data size.`);
|
36308
|
+
}
|
36309
|
+
const offsetAndLength = offset + WORD_SIZE;
|
36310
|
+
const lengthBytes = data.slice(offset, offsetAndLength);
|
36311
|
+
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
36312
|
+
const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
|
36313
|
+
if (bytes3.length !== length) {
|
36314
|
+
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
36315
|
+
}
|
36316
|
+
return [toUtf8String(bytes3), offsetAndLength + length];
|
36317
|
+
}
|
36318
|
+
};
|
36319
|
+
__publicField4(StrSliceCoder, "memorySize", 1);
|
36279
36320
|
var StringCoder2 = class extends Coder {
|
36280
36321
|
constructor(length) {
|
36281
36322
|
super("string", `str[${length}]`, length);
|
@@ -36314,7 +36355,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36314
36355
|
Object.keys(this.coders).map((fieldName) => {
|
36315
36356
|
const fieldCoder = this.coders[fieldName];
|
36316
36357
|
const fieldValue = value[fieldName];
|
36317
|
-
if (!(fieldCoder instanceof
|
36358
|
+
if (!(fieldCoder instanceof OptionCoder2) && fieldValue == null) {
|
36318
36359
|
throw new FuelError(
|
36319
36360
|
ErrorCode.ENCODE_ERROR,
|
36320
36361
|
`Invalid ${this.type}. Field "${fieldName}" not present.`
|
@@ -36422,6 +36463,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36422
36463
|
return new ByteCoder2();
|
36423
36464
|
case STD_STRING_CODER_TYPE:
|
36424
36465
|
return new StdStringCoder2();
|
36466
|
+
case STR_SLICE_CODER_TYPE:
|
36467
|
+
return new StrSliceCoder();
|
36425
36468
|
default:
|
36426
36469
|
break;
|
36427
36470
|
}
|
@@ -36466,7 +36509,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36466
36509
|
const coders = getCoders(components, { getCoder: getCoder2 });
|
36467
36510
|
const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
|
36468
36511
|
if (isOptionEnum) {
|
36469
|
-
return new
|
36512
|
+
return new OptionCoder2(enumMatch.name, coders);
|
36470
36513
|
}
|
36471
36514
|
return new EnumCoder2(enumMatch.name, coders);
|
36472
36515
|
}
|
@@ -36477,12 +36520,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36477
36520
|
);
|
36478
36521
|
return new TupleCoder2(coders);
|
36479
36522
|
}
|
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
36523
|
throw new FuelError(
|
36487
36524
|
ErrorCode.CODER_NOT_FOUND,
|
36488
36525
|
`Coder not found: ${JSON.stringify(resolvedAbiType)}.`
|
@@ -36518,6 +36555,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36518
36555
|
var FunctionFragment = class {
|
36519
36556
|
signature;
|
36520
36557
|
selector;
|
36558
|
+
selectorBytes;
|
36559
|
+
encoding;
|
36521
36560
|
name;
|
36522
36561
|
jsonFn;
|
36523
36562
|
attributes;
|
@@ -36530,6 +36569,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36530
36569
|
this.name = name;
|
36531
36570
|
this.signature = FunctionFragment.getSignature(this.jsonAbi, this.jsonFn);
|
36532
36571
|
this.selector = FunctionFragment.getFunctionSelector(this.signature);
|
36572
|
+
this.selectorBytes = new StdStringCoder2().encode(name);
|
36573
|
+
this.encoding = this.jsonAbi.encoding;
|
36533
36574
|
this.isInputDataPointer = this.#isInputDataPointer();
|
36534
36575
|
this.outputMetadata = {
|
36535
36576
|
isHeapType: this.#isOutputDataHeap(),
|
@@ -36583,11 +36624,14 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36583
36624
|
}
|
36584
36625
|
const coders = nonEmptyInputs.map(
|
36585
36626
|
(t) => AbiCoder.getCoder(this.jsonAbi, t, {
|
36586
|
-
isRightPadded: nonEmptyInputs.length > 1
|
36627
|
+
isRightPadded: nonEmptyInputs.length > 1,
|
36628
|
+
encoding: this.encoding
|
36587
36629
|
})
|
36588
36630
|
);
|
36589
|
-
|
36590
|
-
|
36631
|
+
if (this.encoding === ENCODING_V1) {
|
36632
|
+
return new TupleCoder2(coders).encode(shallowCopyValues);
|
36633
|
+
}
|
36634
|
+
const results = new TupleCoder(coders).encode(shallowCopyValues);
|
36591
36635
|
return unpackDynamicData(results, offset, results.byteLength);
|
36592
36636
|
}
|
36593
36637
|
static verifyArgsAndInputsAlign(args, inputs, abi) {
|
@@ -36634,7 +36678,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36634
36678
|
}
|
36635
36679
|
const result = nonEmptyInputs.reduce(
|
36636
36680
|
(obj, input) => {
|
36637
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, input);
|
36681
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
|
36638
36682
|
const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
|
36639
36683
|
return {
|
36640
36684
|
decoded: [...obj.decoded, decodedValue],
|
@@ -36654,7 +36698,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36654
36698
|
return [void 0, 0];
|
36655
36699
|
}
|
36656
36700
|
const bytes3 = arrayify(data);
|
36657
|
-
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output
|
36701
|
+
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
|
36702
|
+
encoding: this.encoding
|
36703
|
+
});
|
36658
36704
|
return coder.decode(bytes3, 0);
|
36659
36705
|
}
|
36660
36706
|
};
|
@@ -36722,7 +36768,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36722
36768
|
}
|
36723
36769
|
);
|
36724
36770
|
return AbiCoder.encode(this.jsonAbi, configurable.configurableType, value, {
|
36725
|
-
isRightPadded: true
|
36771
|
+
isRightPadded: true,
|
36772
|
+
encoding: this.jsonAbi.encoding
|
36726
36773
|
});
|
36727
36774
|
}
|
36728
36775
|
getTypeById(typeId) {
|
@@ -42424,60 +42471,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42424
42471
|
var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
|
42425
42472
|
var MAX_PREDICATE_LENGTH = 1024 * 1024;
|
42426
42473
|
var MAX_PREDICATE_DATA_LENGTH = 1024 * 1024;
|
42427
|
-
var FAILED_REQUIRE_SIGNAL = "0xffffffffffff0000";
|
42428
42474
|
var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
|
42429
|
-
var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
|
42430
|
-
var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
|
42431
|
-
var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
|
42432
|
-
var PANIC_REASONS = [
|
42433
|
-
"UnknownPanicReason",
|
42434
|
-
"Revert",
|
42435
|
-
"OutOfGas",
|
42436
|
-
"TransactionValidity",
|
42437
|
-
"MemoryOverflow",
|
42438
|
-
"ArithmeticOverflow",
|
42439
|
-
"ContractNotFound",
|
42440
|
-
"MemoryOwnership",
|
42441
|
-
"NotEnoughBalance",
|
42442
|
-
"ExpectedInternalContext",
|
42443
|
-
"AssetIdNotFound",
|
42444
|
-
"InputNotFound",
|
42445
|
-
"OutputNotFound",
|
42446
|
-
"WitnessNotFound",
|
42447
|
-
"TransactionMaturity",
|
42448
|
-
"InvalidMetadataIdentifier",
|
42449
|
-
"MalformedCallStructure",
|
42450
|
-
"ReservedRegisterNotWritable",
|
42451
|
-
"InvalidFlags",
|
42452
|
-
"InvalidImmediateValue",
|
42453
|
-
"ExpectedCoinInput",
|
42454
|
-
"EcalError",
|
42455
|
-
"MemoryWriteOverlap",
|
42456
|
-
"ContractNotInInputs",
|
42457
|
-
"InternalBalanceOverflow",
|
42458
|
-
"ContractMaxSize",
|
42459
|
-
"ExpectedUnallocatedStack",
|
42460
|
-
"MaxStaticContractsReached",
|
42461
|
-
"TransferAmountCannotBeZero",
|
42462
|
-
"ExpectedOutputVariable",
|
42463
|
-
"ExpectedParentInternalContext",
|
42464
|
-
"PredicateReturnedNonOne",
|
42465
|
-
"ContractIdAlreadyDeployed",
|
42466
|
-
"ContractMismatch",
|
42467
|
-
"MessageDataTooLong",
|
42468
|
-
"ArithmeticError",
|
42469
|
-
"ContractInstructionNotAllowed",
|
42470
|
-
"TransferZeroCoins",
|
42471
|
-
"InvalidInstruction",
|
42472
|
-
"MemoryNotExecutable",
|
42473
|
-
"PolicyIsNotSet",
|
42474
|
-
"PolicyNotFound",
|
42475
|
-
"TooManyReceipts",
|
42476
|
-
"BalanceOverflow",
|
42477
|
-
"InvalidBlockHeight",
|
42478
|
-
"TooManySlots"
|
42479
|
-
];
|
42480
|
-
var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
|
42481
42475
|
|
42482
42476
|
// src/providers/utils/receipts.ts
|
42483
42477
|
var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
|
@@ -42790,64 +42784,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42790
42784
|
});
|
42791
42785
|
}
|
42792
42786
|
|
42793
|
-
// src/providers/utils/extract-tx-error.ts
|
42794
|
-
var assemblePanicError = (status) => {
|
42795
|
-
let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
|
42796
|
-
if (PANIC_REASONS.includes(status.reason)) {
|
42797
|
-
errorMessage = `${errorMessage}
|
42798
|
-
|
42799
|
-
You can read more about this error at:
|
42800
|
-
|
42801
|
-
${PANIC_DOC_URL}#variant.${status.reason}`;
|
42802
|
-
}
|
42803
|
-
return errorMessage;
|
42804
|
-
};
|
42805
|
-
var stringify2 = (obj) => JSON.stringify(obj, null, 2);
|
42806
|
-
var assembleRevertError = (receipts, logs) => {
|
42807
|
-
let errorMessage = "The transaction reverted with an unknown reason.";
|
42808
|
-
const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
|
42809
|
-
if (revertReceipt) {
|
42810
|
-
const reasonHex = bn(revertReceipt.val).toHex();
|
42811
|
-
switch (reasonHex) {
|
42812
|
-
case FAILED_REQUIRE_SIGNAL: {
|
42813
|
-
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify2(logs[0]) : "an error."}.`;
|
42814
|
-
break;
|
42815
|
-
}
|
42816
|
-
case FAILED_ASSERT_EQ_SIGNAL: {
|
42817
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42818
|
-
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
|
42819
|
-
break;
|
42820
|
-
}
|
42821
|
-
case FAILED_ASSERT_NE_SIGNAL: {
|
42822
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42823
|
-
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
|
42824
|
-
break;
|
42825
|
-
}
|
42826
|
-
case FAILED_ASSERT_SIGNAL:
|
42827
|
-
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
42828
|
-
break;
|
42829
|
-
case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
42830
|
-
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
42831
|
-
break;
|
42832
|
-
default:
|
42833
|
-
errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
|
42834
|
-
}
|
42835
|
-
}
|
42836
|
-
return errorMessage;
|
42837
|
-
};
|
42838
|
-
var extractTxError = (params) => {
|
42839
|
-
const { receipts, status, logs } = params;
|
42840
|
-
const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
|
42841
|
-
let err = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
|
42842
|
-
err += `
|
42843
|
-
|
42844
|
-
logs: ${JSON.stringify(logs, null, 2)}`;
|
42845
|
-
err += `
|
42846
|
-
|
42847
|
-
receipts: ${JSON.stringify(receipts, null, 2)}`;
|
42848
|
-
return new FuelError(ErrorCode.SCRIPT_REVERTED, err);
|
42849
|
-
};
|
42850
|
-
|
42851
42787
|
// src/providers/transaction-request/errors.ts
|
42852
42788
|
var NoWitnessAtIndexError = class extends Error {
|
42853
42789
|
constructor(index) {
|
@@ -44605,26 +44541,14 @@ receipts: ${JSON.stringify(receipts, null, 2)}`;
|
|
44605
44541
|
gqlTransaction: this.gqlTransaction,
|
44606
44542
|
...transactionSummary
|
44607
44543
|
};
|
44608
|
-
let logs = [];
|
44609
44544
|
if (this.abis) {
|
44610
|
-
logs = getDecodedLogs(
|
44545
|
+
const logs = getDecodedLogs(
|
44611
44546
|
transactionSummary.receipts,
|
44612
44547
|
this.abis.main,
|
44613
44548
|
this.abis.otherContractsAbis
|
44614
44549
|
);
|
44615
44550
|
transactionResult.logs = logs;
|
44616
44551
|
}
|
44617
|
-
if (transactionResult.isStatusFailure) {
|
44618
|
-
const {
|
44619
|
-
receipts,
|
44620
|
-
gqlTransaction: { status }
|
44621
|
-
} = transactionResult;
|
44622
|
-
throw extractTxError({
|
44623
|
-
receipts,
|
44624
|
-
status,
|
44625
|
-
logs
|
44626
|
-
});
|
44627
|
-
}
|
44628
44552
|
return transactionResult;
|
44629
44553
|
}
|
44630
44554
|
/**
|
@@ -44633,7 +44557,14 @@ receipts: ${JSON.stringify(receipts, null, 2)}`;
|
|
44633
44557
|
* @param contractsAbiMap - The contracts ABI map.
|
44634
44558
|
*/
|
44635
44559
|
async wait(contractsAbiMap) {
|
44636
|
-
|
44560
|
+
const result = await this.waitForResult(contractsAbiMap);
|
44561
|
+
if (result.isStatusFailure) {
|
44562
|
+
throw new FuelError(
|
44563
|
+
ErrorCode.TRANSACTION_FAILED,
|
44564
|
+
`Transaction failed: ${result.gqlTransaction.status.reason}`
|
44565
|
+
);
|
44566
|
+
}
|
44567
|
+
return result;
|
44637
44568
|
}
|
44638
44569
|
};
|
44639
44570
|
|