@fuel-ts/account 0.0.0-rc-2272-20240517112040 → 0.0.0-rc-2272-20240517113706

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.

@@ -30970,16 +30970,34 @@ This unreleased fuel-core build may include features and updates not yet support
30970
30970
  WORD_SIZE + // Predicate size
30971
30971
  WORD_SIZE + // Predicate data size
30972
30972
  WORD_SIZE;
30973
+ var isUint8Array = (value) => value instanceof Uint8Array;
30974
+ var hasNestedOption = (coders) => {
30975
+ const array = Array.isArray(coders) ? coders : Object.values(coders);
30976
+ for (const node of array) {
30977
+ if (node.type === OPTION_CODER_TYPE) {
30978
+ return true;
30979
+ }
30980
+ if ("coder" in node && node.coder.type === OPTION_CODER_TYPE) {
30981
+ return true;
30982
+ }
30983
+ if ("coders" in node) {
30984
+ const child = hasNestedOption(node.coders);
30985
+ if (child) {
30986
+ return true;
30987
+ }
30988
+ }
30989
+ }
30990
+ return false;
30991
+ };
30973
30992
  var ArrayCoder = class extends Coder {
30974
30993
  coder;
30975
30994
  length;
30976
30995
  #hasNestedOption;
30977
30996
  constructor(coder, length) {
30978
- const hasNestedOption = coder.type === OPTION_CODER_TYPE;
30979
30997
  super("array", `[${coder.type}; ${length}]`, length * coder.encodedLength);
30980
30998
  this.coder = coder;
30981
30999
  this.length = length;
30982
- this.#hasNestedOption = hasNestedOption;
31000
+ this.#hasNestedOption = hasNestedOption([coder]);
30983
31001
  }
30984
31002
  encode(value) {
30985
31003
  if (!Array.isArray(value)) {
@@ -31159,7 +31177,6 @@ This unreleased fuel-core build may include features and updates not yet support
31159
31177
  #encodedValueSize;
31160
31178
  #hasNestedOption;
31161
31179
  constructor(name, coders) {
31162
- const hasNestedOption = Object.values(coders).some((coder) => coder.type === OPTION_CODER_TYPE);
31163
31180
  const caseIndexCoder = new BigNumberCoder("u64");
31164
31181
  const encodedValueSize = Object.values(coders).reduce(
31165
31182
  (max, coder) => Math.max(max, coder.encodedLength),
@@ -31170,7 +31187,7 @@ This unreleased fuel-core build may include features and updates not yet support
31170
31187
  this.coders = coders;
31171
31188
  this.#caseIndexCoder = caseIndexCoder;
31172
31189
  this.#encodedValueSize = encodedValueSize;
31173
- this.#hasNestedOption = hasNestedOption;
31190
+ this.#hasNestedOption = hasNestedOption(coders);
31174
31191
  }
31175
31192
  #encodeNativeEnum(value) {
31176
31193
  const valueCoder = this.coders[value];
@@ -31391,7 +31408,6 @@ This unreleased fuel-core build may include features and updates not yet support
31391
31408
  coders;
31392
31409
  #hasNestedOption;
31393
31410
  constructor(name, coders) {
31394
- const hasNestedOption = Object.values(coders).some((coder) => coder.type === OPTION_CODER_TYPE);
31395
31411
  const encodedLength = Object.values(coders).reduce(
31396
31412
  (acc, coder) => acc + coder.encodedLength,
31397
31413
  0
@@ -31399,7 +31415,7 @@ This unreleased fuel-core build may include features and updates not yet support
31399
31415
  super("struct", `struct ${name}`, encodedLength);
31400
31416
  this.name = name;
31401
31417
  this.coders = coders;
31402
- this.#hasNestedOption = hasNestedOption;
31418
+ this.#hasNestedOption = hasNestedOption(coders);
31403
31419
  }
31404
31420
  encode(value) {
31405
31421
  return concatBytes2(
@@ -31435,11 +31451,10 @@ This unreleased fuel-core build may include features and updates not yet support
31435
31451
  coders;
31436
31452
  #hasNestedOption;
31437
31453
  constructor(coders) {
31438
- const hasNestedOption = coders.some((coder) => coder.type === OPTION_CODER_TYPE);
31439
31454
  const encodedLength = coders.reduce((acc, coder) => acc + coder.encodedLength, 0);
31440
31455
  super("tuple", `(${coders.map((coder) => coder.type).join(", ")})`, encodedLength);
31441
31456
  this.coders = coders;
31442
- this.#hasNestedOption = hasNestedOption;
31457
+ this.#hasNestedOption = hasNestedOption(coders);
31443
31458
  }
31444
31459
  encode(value) {
31445
31460
  if (this.coders.length !== value.length) {
@@ -31460,14 +31475,13 @@ This unreleased fuel-core build may include features and updates not yet support
31460
31475
  return [decodedValue, newOffset];
31461
31476
  }
31462
31477
  };
31463
- var isUint8Array = (value) => value instanceof Uint8Array;
31464
31478
  var VecCoder = class extends Coder {
31465
31479
  coder;
31466
31480
  #hasNestedOption;
31467
31481
  constructor(coder) {
31468
31482
  super("struct", `struct Vec`, coder.encodedLength + WORD_SIZE);
31469
31483
  this.coder = coder;
31470
- this.#hasNestedOption = coder.type === OPTION_CODER_TYPE;
31484
+ this.#hasNestedOption = hasNestedOption([coder]);
31471
31485
  }
31472
31486
  encode(value) {
31473
31487
  if (!Array.isArray(value) && !isUint8Array(value)) {