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

@@ -32512,11 +32512,18 @@ This unreleased fuel-core build may include features and updates not yet support
32512
32512
  this.#isOptionVec = this.coder instanceof OptionCoder2;
32513
32513
  }
32514
32514
  encode(value) {
32515
- if (!Array.isArray(value)) {
32516
- throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
32515
+ if (!Array.isArray(value) && !isUint8Array(value)) {
32516
+ throw new FuelError(
32517
+ ErrorCode.ENCODE_ERROR,
32518
+ `Expected array value, or a Uint8Array. You can use arrayify to convert a value to a Uint8Array.`
32519
+ );
32520
+ }
32521
+ const lengthCoder = new BigNumberCoder("u64");
32522
+ if (isUint8Array(value)) {
32523
+ return new Uint8Array([...lengthCoder.encode(value.length), ...value]);
32517
32524
  }
32518
32525
  const bytes2 = value.map((v) => this.coder.encode(v));
32519
- const lengthBytes = new BigNumberCoder("u64").encode(value.length);
32526
+ const lengthBytes = lengthCoder.encode(value.length);
32520
32527
  return new Uint8Array([...lengthBytes, ...concatBytes2(bytes2)]);
32521
32528
  }
32522
32529
  decode(data, offset) {