@fuel-ts/account 0.86.0 → 0.87.0

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.

@@ -29472,7 +29472,7 @@ spurious results.`);
29472
29472
  return {
29473
29473
  FORC: "0.58.0",
29474
29474
  FUEL_CORE: "0.26.0",
29475
- FUELS: "0.86.0"
29475
+ FUELS: "0.87.0"
29476
29476
  };
29477
29477
  }
29478
29478
  function parseVersion(version) {
@@ -30973,10 +30973,13 @@ This unreleased fuel-core build may include features and updates not yet support
30973
30973
  var ArrayCoder = class extends Coder {
30974
30974
  coder;
30975
30975
  length;
30976
+ #hasNestedOption;
30976
30977
  constructor(coder, length) {
30978
+ const hasNestedOption = coder.type === OPTION_CODER_TYPE;
30977
30979
  super("array", `[${coder.type}; ${length}]`, length * coder.encodedLength);
30978
30980
  this.coder = coder;
30979
30981
  this.length = length;
30982
+ this.#hasNestedOption = hasNestedOption;
30980
30983
  }
30981
30984
  encode(value) {
30982
30985
  if (!Array.isArray(value)) {
@@ -30988,7 +30991,7 @@ This unreleased fuel-core build may include features and updates not yet support
30988
30991
  return concat(Array.from(value).map((v) => this.coder.encode(v)));
30989
30992
  }
30990
30993
  decode(data, offset) {
30991
- if (data.length < this.encodedLength || data.length > MAX_BYTES) {
30994
+ if (!this.#hasNestedOption && data.length < this.encodedLength || data.length > MAX_BYTES) {
30992
30995
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid array data size.`);
30993
30996
  }
30994
30997
  let newOffset = offset;
@@ -31154,7 +31157,9 @@ This unreleased fuel-core build may include features and updates not yet support
31154
31157
  coders;
31155
31158
  #caseIndexCoder;
31156
31159
  #encodedValueSize;
31160
+ #hasNestedOption;
31157
31161
  constructor(name, coders) {
31162
+ const hasNestedOption = Object.values(coders).some((coder) => coder.type === OPTION_CODER_TYPE);
31158
31163
  const caseIndexCoder = new BigNumberCoder("u64");
31159
31164
  const encodedValueSize = Object.values(coders).reduce(
31160
31165
  (max, coder) => Math.max(max, coder.encodedLength),
@@ -31165,6 +31170,7 @@ This unreleased fuel-core build may include features and updates not yet support
31165
31170
  this.coders = coders;
31166
31171
  this.#caseIndexCoder = caseIndexCoder;
31167
31172
  this.#encodedValueSize = encodedValueSize;
31173
+ this.#hasNestedOption = hasNestedOption;
31168
31174
  }
31169
31175
  #encodeNativeEnum(value) {
31170
31176
  const valueCoder = this.coders[value];
@@ -31193,7 +31199,7 @@ This unreleased fuel-core build may include features and updates not yet support
31193
31199
  return [caseKey, newOffset];
31194
31200
  }
31195
31201
  decode(data, offset) {
31196
- if (data.length < this.#encodedValueSize) {
31202
+ if (!this.#hasNestedOption && data.length < this.#encodedValueSize) {
31197
31203
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid enum data size.`);
31198
31204
  }
31199
31205
  const caseBytes = new BigNumberCoder("u64").decode(data, offset)[0];
@@ -31383,7 +31389,9 @@ This unreleased fuel-core build may include features and updates not yet support
31383
31389
  var StructCoder = class extends Coder {
31384
31390
  name;
31385
31391
  coders;
31392
+ #hasNestedOption;
31386
31393
  constructor(name, coders) {
31394
+ const hasNestedOption = Object.values(coders).some((coder) => coder.type === OPTION_CODER_TYPE);
31387
31395
  const encodedLength = Object.values(coders).reduce(
31388
31396
  (acc, coder) => acc + coder.encodedLength,
31389
31397
  0
@@ -31391,6 +31399,7 @@ This unreleased fuel-core build may include features and updates not yet support
31391
31399
  super("struct", `struct ${name}`, encodedLength);
31392
31400
  this.name = name;
31393
31401
  this.coders = coders;
31402
+ this.#hasNestedOption = hasNestedOption;
31394
31403
  }
31395
31404
  encode(value) {
31396
31405
  return concatBytes2(
@@ -31408,7 +31417,7 @@ This unreleased fuel-core build may include features and updates not yet support
31408
31417
  );
31409
31418
  }
31410
31419
  decode(data, offset) {
31411
- if (data.length < this.encodedLength) {
31420
+ if (!this.#hasNestedOption && data.length < this.encodedLength) {
31412
31421
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid struct data size.`);
31413
31422
  }
31414
31423
  let newOffset = offset;
@@ -31424,10 +31433,13 @@ This unreleased fuel-core build may include features and updates not yet support
31424
31433
  };
31425
31434
  var TupleCoder = class extends Coder {
31426
31435
  coders;
31436
+ #hasNestedOption;
31427
31437
  constructor(coders) {
31438
+ const hasNestedOption = coders.some((coder) => coder.type === OPTION_CODER_TYPE);
31428
31439
  const encodedLength = coders.reduce((acc, coder) => acc + coder.encodedLength, 0);
31429
31440
  super("tuple", `(${coders.map((coder) => coder.type).join(", ")})`, encodedLength);
31430
31441
  this.coders = coders;
31442
+ this.#hasNestedOption = hasNestedOption;
31431
31443
  }
31432
31444
  encode(value) {
31433
31445
  if (this.coders.length !== value.length) {
@@ -31436,7 +31448,7 @@ This unreleased fuel-core build may include features and updates not yet support
31436
31448
  return concatBytes2(this.coders.map((coder, i) => coder.encode(value[i])));
31437
31449
  }
31438
31450
  decode(data, offset) {
31439
- if (data.length < this.encodedLength) {
31451
+ if (!this.#hasNestedOption && data.length < this.encodedLength) {
31440
31452
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid tuple data size.`);
31441
31453
  }
31442
31454
  let newOffset = offset;
@@ -31451,11 +31463,11 @@ This unreleased fuel-core build may include features and updates not yet support
31451
31463
  var isUint8Array = (value) => value instanceof Uint8Array;
31452
31464
  var VecCoder = class extends Coder {
31453
31465
  coder;
31454
- #isOptionVec;
31466
+ #hasNestedOption;
31455
31467
  constructor(coder) {
31456
31468
  super("struct", `struct Vec`, coder.encodedLength + WORD_SIZE);
31457
31469
  this.coder = coder;
31458
- this.#isOptionVec = this.coder instanceof OptionCoder;
31470
+ this.#hasNestedOption = coder.type === OPTION_CODER_TYPE;
31459
31471
  }
31460
31472
  encode(value) {
31461
31473
  if (!Array.isArray(value) && !isUint8Array(value)) {
@@ -31473,7 +31485,7 @@ This unreleased fuel-core build may include features and updates not yet support
31473
31485
  return new Uint8Array([...lengthBytes, ...concatBytes2(bytes2)]);
31474
31486
  }
31475
31487
  decode(data, offset) {
31476
- if (!this.#isOptionVec && (data.length < this.encodedLength || data.length > MAX_BYTES)) {
31488
+ if (!this.#hasNestedOption && data.length < this.encodedLength || data.length > MAX_BYTES) {
31477
31489
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid vec data size.`);
31478
31490
  }
31479
31491
  const offsetAndLength = offset + WORD_SIZE;
@@ -31481,7 +31493,7 @@ This unreleased fuel-core build may include features and updates not yet support
31481
31493
  const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
31482
31494
  const dataLength = length * this.coder.encodedLength;
31483
31495
  const dataBytes = data.slice(offsetAndLength, offsetAndLength + dataLength);
31484
- if (!this.#isOptionVec && dataBytes.length !== dataLength) {
31496
+ if (!this.#hasNestedOption && dataBytes.length !== dataLength) {
31485
31497
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid vec byte data size.`);
31486
31498
  }
31487
31499
  let newOffset = offsetAndLength;