@fuel-ts/account 0.0.0-rc-1356-20240511074927 → 0.0.0-rc-1356-20240513141855

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.

@@ -36325,11 +36325,18 @@ This unreleased fuel-core build may include features and updates not yet support
36325
36325
  this.#isOptionVec = this.coder instanceof OptionCoder2;
36326
36326
  }
36327
36327
  encode(value) {
36328
- if (!Array.isArray(value)) {
36329
- throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
36328
+ if (!Array.isArray(value) && !isUint8Array(value)) {
36329
+ throw new FuelError(
36330
+ ErrorCode.ENCODE_ERROR,
36331
+ `Expected array value, or a Uint8Array. You can use arrayify to convert a value to a Uint8Array.`
36332
+ );
36333
+ }
36334
+ const lengthCoder = new BigNumberCoder("u64");
36335
+ if (isUint8Array(value)) {
36336
+ return new Uint8Array([...lengthCoder.encode(value.length), ...value]);
36330
36337
  }
36331
36338
  const bytes2 = value.map((v) => this.coder.encode(v));
36332
- const lengthBytes = new BigNumberCoder("u64").encode(value.length);
36339
+ const lengthBytes = lengthCoder.encode(value.length);
36333
36340
  return new Uint8Array([...lengthBytes, ...concatBytes2(bytes2)]);
36334
36341
  }
36335
36342
  decode(data, offset) {