@fuel-ts/account 0.0.0-rc-1895-20240404064636 → 0.0.0-rc-1832-20240404073329

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.

@@ -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,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAK/F,cAAc;AACd,MAAM,MAAM,4BAA4B,GAAG,WAAW,CAAC;AACvD,cAAc;AACd,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC;AAC3D,cAAc;AACd,MAAM,MAAM,kCAAkC,GAAG,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AACtF,cAAc;AACd,MAAM,MAAM,6BAA6B,GAAG,YAAY,CAAC;AACzD,cAAc;AACd,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC;AAC3D,cAAc;AACd,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC;AACrD,cAAc;AACd,MAAM,MAAM,+BAA+B,GAAG,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAChF,cAAc;AACd,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AE,MAAM,EACV,QAAQ,EAAE,QAAQ,EAClB,IAAI,CAAC,EAAE,oBAAoB,GAC1B,OAAO,CAAC,mBAAmB,CAAC;IAM/B;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,cAAc,CAAC;IAwBtC;;;;;OAKG;IACH,iBAAiB,CAAC,gBAAgB,GAAG,IAAI,EAAE,uBAAuB,EAAE,cAAc;IAOlF;;;;;;OAMG;IACG,qBAAqB,CAAC,gBAAgB,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;IAsC/C;;;;OAIG;IACG,IAAI,CAAC,gBAAgB,GAAG,IAAI,EAChC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;CAGhD"}
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,EACV,kBAAkB,EAElB,cAAc,EACd,MAAM,EACP,MAAM,8BAA8B,CAAC;AAItC,c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'./json';
5
5
  export * from './sleep';
6
- export * from './extract-tx-error';
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -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;AACxB,cAAc,oBAAoB,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"}
@@ -32045,7 +32045,6 @@ This unreleased fuel-core build may include features and updates not yet support
32045
32045
  })(ErrorCode || {});
32046
32046
  var _FuelError = class extends Error {
32047
32047
  VERSIONS = versions;
32048
- metadata;
32049
32048
  static parse(e) {
32050
32049
  const error = e;
32051
32050
  if (error.code === void 0) {
@@ -32065,15 +32064,14 @@ This unreleased fuel-core build may include features and updates not yet support
32065
32064
  return new _FuelError(error.code, error.message);
32066
32065
  }
32067
32066
  code;
32068
- constructor(code, message, metadata = {}) {
32067
+ constructor(code, message) {
32069
32068
  super(message);
32070
32069
  this.code = code;
32071
32070
  this.name = "FuelError";
32072
- this.metadata = metadata;
32073
32071
  }
32074
32072
  toObject() {
32075
- const { code, name, message, metadata, VERSIONS } = this;
32076
- return { code, name, message, metadata, VERSIONS };
32073
+ const { code, name, message, VERSIONS } = this;
32074
+ return { code, name, message, VERSIONS };
32077
32075
  }
32078
32076
  };
32079
32077
  var FuelError = _FuelError;
@@ -35380,9 +35378,6 @@ This unreleased fuel-core build may include features and updates not yet support
35380
35378
  __privateAdd2(this, _getPaddedData);
35381
35379
  }
35382
35380
  encode(value) {
35383
- if (!Array.isArray(value)) {
35384
- throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
35385
- }
35386
35381
  const parts = [];
35387
35382
  const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
35388
35383
  const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
@@ -35409,7 +35404,7 @@ This unreleased fuel-core build may include features and updates not yet support
35409
35404
  };
35410
35405
  _getPaddedData = /* @__PURE__ */ new WeakSet();
35411
35406
  getPaddedData_fn = function(value) {
35412
- const data = [Uint8Array.from(value)];
35407
+ const data = value instanceof Uint8Array ? [value] : [new Uint8Array(value)];
35413
35408
  const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
35414
35409
  if (paddingLength) {
35415
35410
  data.push(new Uint8Array(paddingLength));
@@ -35432,7 +35427,7 @@ This unreleased fuel-core build may include features and updates not yet support
35432
35427
  (max2, coder) => Math.max(max2, coder.encodedLength),
35433
35428
  0
35434
35429
  );
35435
- super("enum", `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
35430
+ super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
35436
35431
  this.name = name;
35437
35432
  this.coders = coders;
35438
35433
  this.#caseIndexCoder = caseIndexCoder;
@@ -35502,7 +35497,7 @@ This unreleased fuel-core build may include features and updates not yet support
35502
35497
  return { None: [] };
35503
35498
  }
35504
35499
  decode(data, offset) {
35505
- if (data.length < this.encodedLength - 1) {
35500
+ if (data.length < this.encodedLength) {
35506
35501
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
35507
35502
  }
35508
35503
  const [decoded, newOffset] = super.decode(data, offset);
@@ -36085,11 +36080,8 @@ This unreleased fuel-core build may include features and updates not yet support
36085
36080
  super("struct", "struct Bytes", WORD_SIZE);
36086
36081
  }
36087
36082
  encode(value) {
36088
- if (!Array.isArray(value)) {
36089
- throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
36090
- }
36091
- const bytes3 = new Uint8Array(value);
36092
- const lengthBytes = new BigNumberCoder("u64").encode(value.length);
36083
+ const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
36084
+ const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
36093
36085
  return new Uint8Array([...lengthBytes, ...bytes3]);
36094
36086
  }
36095
36087
  decode(data, offset) {
@@ -36122,7 +36114,7 @@ This unreleased fuel-core build may include features and updates not yet support
36122
36114
  (max2, coder) => Math.max(max2, coder.encodedLength),
36123
36115
  0
36124
36116
  );
36125
- super("enum", `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
36117
+ super(`enum ${name}`, `enum ${name}`, caseIndexCoder.encodedLength + encodedValueSize);
36126
36118
  this.name = name;
36127
36119
  this.coders = coders;
36128
36120
  this.#caseIndexCoder = caseIndexCoder;
@@ -36220,6 +36212,28 @@ This unreleased fuel-core build may include features and updates not yet support
36220
36212
  return [toNumber2(bytes3), offset + this.length];
36221
36213
  }
36222
36214
  };
36215
+ var OptionCoder2 = class extends EnumCoder2 {
36216
+ encode(value) {
36217
+ const result = super.encode(this.toSwayOption(value));
36218
+ return result;
36219
+ }
36220
+ toSwayOption(input) {
36221
+ if (input !== void 0) {
36222
+ return { Some: input };
36223
+ }
36224
+ return { None: [] };
36225
+ }
36226
+ decode(data, offset) {
36227
+ const [decoded, newOffset] = super.decode(data, offset);
36228
+ return [this.toOption(decoded), newOffset];
36229
+ }
36230
+ toOption(output3) {
36231
+ if (output3 && "Some" in output3) {
36232
+ return output3.Some;
36233
+ }
36234
+ return void 0;
36235
+ }
36236
+ };
36223
36237
  var RawSliceCoder2 = class extends Coder {
36224
36238
  constructor() {
36225
36239
  super("raw untyped slice", "raw untyped slice", WORD_SIZE);
@@ -36273,6 +36287,30 @@ This unreleased fuel-core build may include features and updates not yet support
36273
36287
  }
36274
36288
  };
36275
36289
  __publicField4(StdStringCoder2, "memorySize", 1);
36290
+ var StrSliceCoder = class extends Coder {
36291
+ constructor() {
36292
+ super("strSlice", "str", WORD_SIZE);
36293
+ }
36294
+ encode(value) {
36295
+ const bytes3 = toUtf8Bytes(value);
36296
+ const lengthBytes = new BigNumberCoder("u64").encode(value.length);
36297
+ return new Uint8Array([...lengthBytes, ...bytes3]);
36298
+ }
36299
+ decode(data, offset) {
36300
+ if (data.length < this.encodedLength) {
36301
+ throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice data size.`);
36302
+ }
36303
+ const offsetAndLength = offset + WORD_SIZE;
36304
+ const lengthBytes = data.slice(offset, offsetAndLength);
36305
+ const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
36306
+ const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
36307
+ if (bytes3.length !== length) {
36308
+ throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
36309
+ }
36310
+ return [toUtf8String(bytes3), offsetAndLength + length];
36311
+ }
36312
+ };
36313
+ __publicField4(StrSliceCoder, "memorySize", 1);
36276
36314
  var StringCoder2 = class extends Coder {
36277
36315
  constructor(length) {
36278
36316
  super("string", `str[${length}]`, length);
@@ -36311,7 +36349,7 @@ This unreleased fuel-core build may include features and updates not yet support
36311
36349
  Object.keys(this.coders).map((fieldName) => {
36312
36350
  const fieldCoder = this.coders[fieldName];
36313
36351
  const fieldValue = value[fieldName];
36314
- if (!(fieldCoder instanceof OptionCoder) && fieldValue == null) {
36352
+ if (!(fieldCoder instanceof OptionCoder2) && fieldValue == null) {
36315
36353
  throw new FuelError(
36316
36354
  ErrorCode.ENCODE_ERROR,
36317
36355
  `Invalid ${this.type}. Field "${fieldName}" not present.`
@@ -36419,6 +36457,8 @@ This unreleased fuel-core build may include features and updates not yet support
36419
36457
  return new ByteCoder2();
36420
36458
  case STD_STRING_CODER_TYPE:
36421
36459
  return new StdStringCoder2();
36460
+ case STR_SLICE_CODER_TYPE:
36461
+ return new StrSliceCoder();
36422
36462
  default:
36423
36463
  break;
36424
36464
  }
@@ -36463,7 +36503,7 @@ This unreleased fuel-core build may include features and updates not yet support
36463
36503
  const coders = getCoders(components, { getCoder: getCoder2 });
36464
36504
  const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
36465
36505
  if (isOptionEnum) {
36466
- return new OptionCoder(enumMatch.name, coders);
36506
+ return new OptionCoder2(enumMatch.name, coders);
36467
36507
  }
36468
36508
  return new EnumCoder2(enumMatch.name, coders);
36469
36509
  }
@@ -36474,12 +36514,6 @@ This unreleased fuel-core build may include features and updates not yet support
36474
36514
  );
36475
36515
  return new TupleCoder2(coders);
36476
36516
  }
36477
- if (resolvedAbiType.type === STR_SLICE_CODER_TYPE) {
36478
- throw new FuelError(
36479
- ErrorCode.INVALID_DATA,
36480
- "String slices can not be decoded from logs. Convert the slice to `str[N]` with `__to_str_array`"
36481
- );
36482
- }
36483
36517
  throw new FuelError(
36484
36518
  ErrorCode.CODER_NOT_FOUND,
36485
36519
  `Coder not found: ${JSON.stringify(resolvedAbiType)}.`
@@ -36515,6 +36549,8 @@ This unreleased fuel-core build may include features and updates not yet support
36515
36549
  var FunctionFragment = class {
36516
36550
  signature;
36517
36551
  selector;
36552
+ selectorBytes;
36553
+ encoding;
36518
36554
  name;
36519
36555
  jsonFn;
36520
36556
  attributes;
@@ -36527,6 +36563,8 @@ This unreleased fuel-core build may include features and updates not yet support
36527
36563
  this.name = name;
36528
36564
  this.signature = FunctionFragment.getSignature(this.jsonAbi, this.jsonFn);
36529
36565
  this.selector = FunctionFragment.getFunctionSelector(this.signature);
36566
+ this.selectorBytes = new StdStringCoder2().encode(name);
36567
+ this.encoding = this.jsonAbi.encoding ?? ENCODING_V0;
36530
36568
  this.isInputDataPointer = this.#isInputDataPointer();
36531
36569
  this.outputMetadata = {
36532
36570
  isHeapType: this.#isOutputDataHeap(),
@@ -36580,11 +36618,14 @@ This unreleased fuel-core build may include features and updates not yet support
36580
36618
  }
36581
36619
  const coders = nonEmptyInputs.map(
36582
36620
  (t) => AbiCoder.getCoder(this.jsonAbi, t, {
36583
- isRightPadded: nonEmptyInputs.length > 1
36621
+ isRightPadded: nonEmptyInputs.length > 1,
36622
+ encoding: this.encoding
36584
36623
  })
36585
36624
  );
36586
- const coder = new TupleCoder(coders);
36587
- const results = coder.encode(shallowCopyValues);
36625
+ if (this.encoding === ENCODING_V1) {
36626
+ return new TupleCoder2(coders).encode(shallowCopyValues);
36627
+ }
36628
+ const results = new TupleCoder(coders).encode(shallowCopyValues);
36588
36629
  return unpackDynamicData(results, offset, results.byteLength);
36589
36630
  }
36590
36631
  static verifyArgsAndInputsAlign(args, inputs, abi) {
@@ -36631,7 +36672,7 @@ This unreleased fuel-core build may include features and updates not yet support
36631
36672
  }
36632
36673
  const result = nonEmptyInputs.reduce(
36633
36674
  (obj, input) => {
36634
- const coder = AbiCoder.getCoder(this.jsonAbi, input);
36675
+ const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
36635
36676
  const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
36636
36677
  return {
36637
36678
  decoded: [...obj.decoded, decodedValue],
@@ -36651,7 +36692,9 @@ This unreleased fuel-core build may include features and updates not yet support
36651
36692
  return [void 0, 0];
36652
36693
  }
36653
36694
  const bytes3 = arrayify(data);
36654
- const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output);
36695
+ const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
36696
+ encoding: this.encoding
36697
+ });
36655
36698
  return coder.decode(bytes3, 0);
36656
36699
  }
36657
36700
  };
@@ -36713,7 +36756,8 @@ This unreleased fuel-core build may include features and updates not yet support
36713
36756
  }
36714
36757
  );
36715
36758
  return AbiCoder.encode(this.jsonAbi, configurable.configurableType, value, {
36716
- isRightPadded: true
36759
+ isRightPadded: true,
36760
+ encoding: this.jsonAbi.encoding
36717
36761
  });
36718
36762
  }
36719
36763
  getTypeById(typeId) {
@@ -42415,60 +42459,7 @@ ${MessageCoinFragmentFragmentDoc}`;
42415
42459
  var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
42416
42460
  var MAX_PREDICATE_LENGTH = 1024 * 1024;
42417
42461
  var MAX_PREDICATE_DATA_LENGTH = 1024 * 1024;
42418
- var FAILED_REQUIRE_SIGNAL = "0xffffffffffff0000";
42419
42462
  var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
42420
- var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
42421
- var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
42422
- var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
42423
- var PANIC_REASONS = [
42424
- "UnknownPanicReason",
42425
- "Revert",
42426
- "OutOfGas",
42427
- "TransactionValidity",
42428
- "MemoryOverflow",
42429
- "ArithmeticOverflow",
42430
- "ContractNotFound",
42431
- "MemoryOwnership",
42432
- "NotEnoughBalance",
42433
- "ExpectedInternalContext",
42434
- "AssetIdNotFound",
42435
- "InputNotFound",
42436
- "OutputNotFound",
42437
- "WitnessNotFound",
42438
- "TransactionMaturity",
42439
- "InvalidMetadataIdentifier",
42440
- "MalformedCallStructure",
42441
- "ReservedRegisterNotWritable",
42442
- "InvalidFlags",
42443
- "InvalidImmediateValue",
42444
- "ExpectedCoinInput",
42445
- "EcalError",
42446
- "MemoryWriteOverlap",
42447
- "ContractNotInInputs",
42448
- "InternalBalanceOverflow",
42449
- "ContractMaxSize",
42450
- "ExpectedUnallocatedStack",
42451
- "MaxStaticContractsReached",
42452
- "TransferAmountCannotBeZero",
42453
- "ExpectedOutputVariable",
42454
- "ExpectedParentInternalContext",
42455
- "PredicateReturnedNonOne",
42456
- "ContractIdAlreadyDeployed",
42457
- "ContractMismatch",
42458
- "MessageDataTooLong",
42459
- "ArithmeticError",
42460
- "ContractInstructionNotAllowed",
42461
- "TransferZeroCoins",
42462
- "InvalidInstruction",
42463
- "MemoryNotExecutable",
42464
- "PolicyIsNotSet",
42465
- "PolicyNotFound",
42466
- "TooManyReceipts",
42467
- "BalanceOverflow",
42468
- "InvalidBlockHeight",
42469
- "TooManySlots"
42470
- ];
42471
- var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
42472
42463
 
42473
42464
  // src/providers/utils/receipts.ts
42474
42465
  var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
@@ -42781,74 +42772,6 @@ ${MessageCoinFragmentFragmentDoc}`;
42781
42772
  });
42782
42773
  }
42783
42774
 
42784
- // src/providers/utils/extract-tx-error.ts
42785
- var assemblePanicError = (status) => {
42786
- let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
42787
- const reason = status.reason;
42788
- if (PANIC_REASONS.includes(status.reason)) {
42789
- errorMessage = `${errorMessage}
42790
-
42791
- You can read more about this error at:
42792
-
42793
- ${PANIC_DOC_URL}#variant.${status.reason}`;
42794
- }
42795
- return { errorMessage, reason };
42796
- };
42797
- var stringify2 = (obj) => JSON.stringify(obj, null, 2);
42798
- var assembleRevertError = (receipts, logs) => {
42799
- let errorMessage = "The transaction reverted with an unknown reason.";
42800
- const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
42801
- let reason = "";
42802
- if (revertReceipt) {
42803
- const reasonHex = bn(revertReceipt.val).toHex();
42804
- switch (reasonHex) {
42805
- case FAILED_REQUIRE_SIGNAL: {
42806
- reason = "require";
42807
- errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify2(logs[0]) : "an error."}.`;
42808
- break;
42809
- }
42810
- case FAILED_ASSERT_EQ_SIGNAL: {
42811
- const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
42812
- reason = "assert_eq";
42813
- errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
42814
- break;
42815
- }
42816
- case FAILED_ASSERT_NE_SIGNAL: {
42817
- const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
42818
- reason = "assert_ne";
42819
- errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
42820
- break;
42821
- }
42822
- case FAILED_ASSERT_SIGNAL:
42823
- reason = "assert";
42824
- errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
42825
- break;
42826
- case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
42827
- reason = "MissingOutputChange";
42828
- errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
42829
- break;
42830
- default:
42831
- reason = "unknown";
42832
- errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
42833
- }
42834
- }
42835
- return { errorMessage, reason };
42836
- };
42837
- var extractTxError = (params) => {
42838
- const { receipts, status, logs } = params;
42839
- const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
42840
- const isRevert = receipts.some(({ type: type3 }) => type3 === ReceiptType.Revert);
42841
- const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
42842
- const metadata = {
42843
- logs,
42844
- receipts,
42845
- panic: isPanic,
42846
- revert: isRevert,
42847
- reason
42848
- };
42849
- return new FuelError(ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
42850
- };
42851
-
42852
42775
  // src/providers/transaction-request/errors.ts
42853
42776
  var NoWitnessAtIndexError = class extends Error {
42854
42777
  constructor(index) {
@@ -44606,26 +44529,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44606
44529
  gqlTransaction: this.gqlTransaction,
44607
44530
  ...transactionSummary
44608
44531
  };
44609
- let logs = [];
44610
44532
  if (this.abis) {
44611
- logs = getDecodedLogs(
44533
+ const logs = getDecodedLogs(
44612
44534
  transactionSummary.receipts,
44613
44535
  this.abis.main,
44614
44536
  this.abis.otherContractsAbis
44615
44537
  );
44616
44538
  transactionResult.logs = logs;
44617
44539
  }
44618
- if (transactionResult.isStatusFailure) {
44619
- const {
44620
- receipts,
44621
- gqlTransaction: { status }
44622
- } = transactionResult;
44623
- throw extractTxError({
44624
- receipts,
44625
- status,
44626
- logs
44627
- });
44628
- }
44629
44540
  return transactionResult;
44630
44541
  }
44631
44542
  /**
@@ -44634,7 +44545,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44634
44545
  * @param contractsAbiMap - The contracts ABI map.
44635
44546
  */
44636
44547
  async wait(contractsAbiMap) {
44637
- return this.waitForResult(contractsAbiMap);
44548
+ const result = await this.waitForResult(contractsAbiMap);
44549
+ if (result.isStatusFailure) {
44550
+ throw new FuelError(
44551
+ ErrorCode.TRANSACTION_FAILED,
44552
+ `Transaction failed: ${result.gqlTransaction.status.reason}`
44553
+ );
44554
+ }
44555
+ return result;
44638
44556
  }
44639
44557
  };
44640
44558