@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.

@@ -32434,7 +32434,7 @@ spurious results.`);
32434
32434
  return {
32435
32435
  FORC: "0.58.0",
32436
32436
  FUEL_CORE: "0.26.0",
32437
- FUELS: "0.86.0"
32437
+ FUELS: "0.87.0"
32438
32438
  };
32439
32439
  }
32440
32440
  function parseVersion(version) {
@@ -34680,10 +34680,13 @@ This unreleased fuel-core build may include features and updates not yet support
34680
34680
  var ArrayCoder = class extends Coder {
34681
34681
  coder;
34682
34682
  length;
34683
+ #hasNestedOption;
34683
34684
  constructor(coder, length) {
34685
+ const hasNestedOption = coder.type === OPTION_CODER_TYPE;
34684
34686
  super("array", `[${coder.type}; ${length}]`, length * coder.encodedLength);
34685
34687
  this.coder = coder;
34686
34688
  this.length = length;
34689
+ this.#hasNestedOption = hasNestedOption;
34687
34690
  }
34688
34691
  encode(value) {
34689
34692
  if (!Array.isArray(value)) {
@@ -34695,7 +34698,7 @@ This unreleased fuel-core build may include features and updates not yet support
34695
34698
  return concat(Array.from(value).map((v) => this.coder.encode(v)));
34696
34699
  }
34697
34700
  decode(data, offset) {
34698
- if (data.length < this.encodedLength || data.length > MAX_BYTES) {
34701
+ if (!this.#hasNestedOption && data.length < this.encodedLength || data.length > MAX_BYTES) {
34699
34702
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid array data size.`);
34700
34703
  }
34701
34704
  let newOffset = offset;
@@ -34861,7 +34864,9 @@ This unreleased fuel-core build may include features and updates not yet support
34861
34864
  coders;
34862
34865
  #caseIndexCoder;
34863
34866
  #encodedValueSize;
34867
+ #hasNestedOption;
34864
34868
  constructor(name, coders) {
34869
+ const hasNestedOption = Object.values(coders).some((coder) => coder.type === OPTION_CODER_TYPE);
34865
34870
  const caseIndexCoder = new BigNumberCoder("u64");
34866
34871
  const encodedValueSize = Object.values(coders).reduce(
34867
34872
  (max, coder) => Math.max(max, coder.encodedLength),
@@ -34872,6 +34877,7 @@ This unreleased fuel-core build may include features and updates not yet support
34872
34877
  this.coders = coders;
34873
34878
  this.#caseIndexCoder = caseIndexCoder;
34874
34879
  this.#encodedValueSize = encodedValueSize;
34880
+ this.#hasNestedOption = hasNestedOption;
34875
34881
  }
34876
34882
  #encodeNativeEnum(value) {
34877
34883
  const valueCoder = this.coders[value];
@@ -34900,7 +34906,7 @@ This unreleased fuel-core build may include features and updates not yet support
34900
34906
  return [caseKey, newOffset];
34901
34907
  }
34902
34908
  decode(data, offset) {
34903
- if (data.length < this.#encodedValueSize) {
34909
+ if (!this.#hasNestedOption && data.length < this.#encodedValueSize) {
34904
34910
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid enum data size.`);
34905
34911
  }
34906
34912
  const caseBytes = new BigNumberCoder("u64").decode(data, offset)[0];
@@ -35090,7 +35096,9 @@ This unreleased fuel-core build may include features and updates not yet support
35090
35096
  var StructCoder = class extends Coder {
35091
35097
  name;
35092
35098
  coders;
35099
+ #hasNestedOption;
35093
35100
  constructor(name, coders) {
35101
+ const hasNestedOption = Object.values(coders).some((coder) => coder.type === OPTION_CODER_TYPE);
35094
35102
  const encodedLength = Object.values(coders).reduce(
35095
35103
  (acc, coder) => acc + coder.encodedLength,
35096
35104
  0
@@ -35098,6 +35106,7 @@ This unreleased fuel-core build may include features and updates not yet support
35098
35106
  super("struct", `struct ${name}`, encodedLength);
35099
35107
  this.name = name;
35100
35108
  this.coders = coders;
35109
+ this.#hasNestedOption = hasNestedOption;
35101
35110
  }
35102
35111
  encode(value) {
35103
35112
  return concatBytes2(
@@ -35115,7 +35124,7 @@ This unreleased fuel-core build may include features and updates not yet support
35115
35124
  );
35116
35125
  }
35117
35126
  decode(data, offset) {
35118
- if (data.length < this.encodedLength) {
35127
+ if (!this.#hasNestedOption && data.length < this.encodedLength) {
35119
35128
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid struct data size.`);
35120
35129
  }
35121
35130
  let newOffset = offset;
@@ -35131,10 +35140,13 @@ This unreleased fuel-core build may include features and updates not yet support
35131
35140
  };
35132
35141
  var TupleCoder = class extends Coder {
35133
35142
  coders;
35143
+ #hasNestedOption;
35134
35144
  constructor(coders) {
35145
+ const hasNestedOption = coders.some((coder) => coder.type === OPTION_CODER_TYPE);
35135
35146
  const encodedLength = coders.reduce((acc, coder) => acc + coder.encodedLength, 0);
35136
35147
  super("tuple", `(${coders.map((coder) => coder.type).join(", ")})`, encodedLength);
35137
35148
  this.coders = coders;
35149
+ this.#hasNestedOption = hasNestedOption;
35138
35150
  }
35139
35151
  encode(value) {
35140
35152
  if (this.coders.length !== value.length) {
@@ -35143,7 +35155,7 @@ This unreleased fuel-core build may include features and updates not yet support
35143
35155
  return concatBytes2(this.coders.map((coder, i) => coder.encode(value[i])));
35144
35156
  }
35145
35157
  decode(data, offset) {
35146
- if (data.length < this.encodedLength) {
35158
+ if (!this.#hasNestedOption && data.length < this.encodedLength) {
35147
35159
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid tuple data size.`);
35148
35160
  }
35149
35161
  let newOffset = offset;
@@ -35158,11 +35170,11 @@ This unreleased fuel-core build may include features and updates not yet support
35158
35170
  var isUint8Array = (value) => value instanceof Uint8Array;
35159
35171
  var VecCoder = class extends Coder {
35160
35172
  coder;
35161
- #isOptionVec;
35173
+ #hasNestedOption;
35162
35174
  constructor(coder) {
35163
35175
  super("struct", `struct Vec`, coder.encodedLength + WORD_SIZE);
35164
35176
  this.coder = coder;
35165
- this.#isOptionVec = this.coder instanceof OptionCoder;
35177
+ this.#hasNestedOption = coder.type === OPTION_CODER_TYPE;
35166
35178
  }
35167
35179
  encode(value) {
35168
35180
  if (!Array.isArray(value) && !isUint8Array(value)) {
@@ -35180,7 +35192,7 @@ This unreleased fuel-core build may include features and updates not yet support
35180
35192
  return new Uint8Array([...lengthBytes, ...concatBytes2(bytes2)]);
35181
35193
  }
35182
35194
  decode(data, offset) {
35183
- if (!this.#isOptionVec && (data.length < this.encodedLength || data.length > MAX_BYTES)) {
35195
+ if (!this.#hasNestedOption && data.length < this.encodedLength || data.length > MAX_BYTES) {
35184
35196
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid vec data size.`);
35185
35197
  }
35186
35198
  const offsetAndLength = offset + WORD_SIZE;
@@ -35188,7 +35200,7 @@ This unreleased fuel-core build may include features and updates not yet support
35188
35200
  const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
35189
35201
  const dataLength = length * this.coder.encodedLength;
35190
35202
  const dataBytes = data.slice(offsetAndLength, offsetAndLength + dataLength);
35191
- if (!this.#isOptionVec && dataBytes.length !== dataLength) {
35203
+ if (!this.#hasNestedOption && dataBytes.length !== dataLength) {
35192
35204
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid vec byte data size.`);
35193
35205
  }
35194
35206
  let newOffset = offsetAndLength;