@fuel-ts/account 0.0.0-rc-1356-20240322130951 → 0.0.0-rc-1832-20240322144804

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.

@@ -28952,7 +28952,7 @@ spurious results.`);
28952
28952
  // ../versions/dist/index.mjs
28953
28953
  function getBuiltinVersions() {
28954
28954
  return {
28955
- FORC: "0.51.1",
28955
+ FORC: "git:xunilrj/encoding-contract-call",
28956
28956
  FUEL_CORE: "0.22.1",
28957
28957
  FUELS: "0.77.0"
28958
28958
  };
@@ -29245,13 +29245,6 @@ This unreleased fuel-core build may include features and updates not yet support
29245
29245
  };
29246
29246
  var DateTime = _DateTime;
29247
29247
  __publicField3(DateTime, "TAI64_NULL", "");
29248
- function sleep(time) {
29249
- return new Promise((resolve) => {
29250
- setTimeout(() => {
29251
- resolve(true);
29252
- }, time);
29253
- });
29254
- }
29255
29248
 
29256
29249
  // ../crypto/dist/index.mjs
29257
29250
  var import_crypto8 = __toESM(__require("crypto"), 1);
@@ -31925,9 +31918,6 @@ This unreleased fuel-core build may include features and updates not yet support
31925
31918
  __privateAdd2(this, _getPaddedData);
31926
31919
  }
31927
31920
  encode(value) {
31928
- if (!Array.isArray(value)) {
31929
- throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
31930
- }
31931
31921
  const parts = [];
31932
31922
  const pointer = new BigNumberCoder("u64").encode(BASE_VECTOR_OFFSET);
31933
31923
  const data = __privateMethod2(this, _getPaddedData, getPaddedData_fn).call(this, value);
@@ -31954,7 +31944,8 @@ This unreleased fuel-core build may include features and updates not yet support
31954
31944
  };
31955
31945
  _getPaddedData = /* @__PURE__ */ new WeakSet();
31956
31946
  getPaddedData_fn = function(value) {
31957
- const data = [Uint8Array.from(value)];
31947
+ const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
31948
+ const data = [Uint8Array.from(bytes3)];
31958
31949
  const paddingLength = (WORD_SIZE - value.length % WORD_SIZE) % WORD_SIZE;
31959
31950
  if (paddingLength) {
31960
31951
  data.push(new Uint8Array(paddingLength));
@@ -32047,7 +32038,7 @@ This unreleased fuel-core build may include features and updates not yet support
32047
32038
  return { None: [] };
32048
32039
  }
32049
32040
  decode(data, offset) {
32050
- if (data.length < this.encodedLength - 1) {
32041
+ if (data.length < this.encodedLength) {
32051
32042
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid option data size.`);
32052
32043
  }
32053
32044
  const [decoded, newOffset] = super.decode(data, offset);
@@ -32630,11 +32621,8 @@ This unreleased fuel-core build may include features and updates not yet support
32630
32621
  super("struct", "struct Bytes", WORD_SIZE);
32631
32622
  }
32632
32623
  encode(value) {
32633
- if (!Array.isArray(value)) {
32634
- throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
32635
- }
32636
- const bytes3 = new Uint8Array(value);
32637
- const lengthBytes = new BigNumberCoder("u64").encode(value.length);
32624
+ const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
32625
+ const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
32638
32626
  return new Uint8Array([...lengthBytes, ...bytes3]);
32639
32627
  }
32640
32628
  decode(data, offset) {
@@ -32765,6 +32753,28 @@ This unreleased fuel-core build may include features and updates not yet support
32765
32753
  return [toNumber2(bytes3), offset + this.length];
32766
32754
  }
32767
32755
  };
32756
+ var OptionCoder2 = class extends EnumCoder2 {
32757
+ encode(value) {
32758
+ const result = super.encode(this.toSwayOption(value));
32759
+ return result;
32760
+ }
32761
+ toSwayOption(input) {
32762
+ if (input !== void 0) {
32763
+ return { Some: input };
32764
+ }
32765
+ return { None: [] };
32766
+ }
32767
+ decode(data, offset) {
32768
+ const [decoded, newOffset] = super.decode(data, offset);
32769
+ return [this.toOption(decoded), newOffset];
32770
+ }
32771
+ toOption(output3) {
32772
+ if (output3 && "Some" in output3) {
32773
+ return output3.Some;
32774
+ }
32775
+ return void 0;
32776
+ }
32777
+ };
32768
32778
  var RawSliceCoder2 = class extends Coder {
32769
32779
  constructor() {
32770
32780
  super("raw untyped slice", "raw untyped slice", WORD_SIZE);
@@ -32818,6 +32828,30 @@ This unreleased fuel-core build may include features and updates not yet support
32818
32828
  }
32819
32829
  };
32820
32830
  __publicField4(StdStringCoder2, "memorySize", 1);
32831
+ var StrSliceCoder = class extends Coder {
32832
+ constructor() {
32833
+ super("strSlice", "str", WORD_SIZE);
32834
+ }
32835
+ encode(value) {
32836
+ const bytes3 = toUtf8Bytes(value);
32837
+ const lengthBytes = new BigNumberCoder("u64").encode(value.length);
32838
+ return new Uint8Array([...lengthBytes, ...bytes3]);
32839
+ }
32840
+ decode(data, offset) {
32841
+ if (data.length < this.encodedLength) {
32842
+ throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice data size.`);
32843
+ }
32844
+ const offsetAndLength = offset + WORD_SIZE;
32845
+ const lengthBytes = data.slice(offset, offsetAndLength);
32846
+ const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
32847
+ const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
32848
+ if (bytes3.length !== length) {
32849
+ throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
32850
+ }
32851
+ return [toUtf8String(bytes3), offsetAndLength + length];
32852
+ }
32853
+ };
32854
+ __publicField4(StrSliceCoder, "memorySize", 1);
32821
32855
  var StringCoder2 = class extends Coder {
32822
32856
  constructor(length) {
32823
32857
  super("string", `str[${length}]`, length);
@@ -32856,7 +32890,7 @@ This unreleased fuel-core build may include features and updates not yet support
32856
32890
  Object.keys(this.coders).map((fieldName) => {
32857
32891
  const fieldCoder = this.coders[fieldName];
32858
32892
  const fieldValue = value[fieldName];
32859
- if (!(fieldCoder instanceof OptionCoder) && fieldValue == null) {
32893
+ if (!(fieldCoder instanceof OptionCoder2) && fieldValue == null) {
32860
32894
  throw new FuelError(
32861
32895
  ErrorCode.ENCODE_ERROR,
32862
32896
  `Invalid ${this.type}. Field "${fieldName}" not present.`
@@ -32964,6 +32998,8 @@ This unreleased fuel-core build may include features and updates not yet support
32964
32998
  return new ByteCoder2();
32965
32999
  case STD_STRING_CODER_TYPE:
32966
33000
  return new StdStringCoder2();
33001
+ case STR_SLICE_CODER_TYPE:
33002
+ return new StrSliceCoder();
32967
33003
  default:
32968
33004
  break;
32969
33005
  }
@@ -33008,7 +33044,7 @@ This unreleased fuel-core build may include features and updates not yet support
33008
33044
  const coders = getCoders(components, { getCoder: getCoder2 });
33009
33045
  const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
33010
33046
  if (isOptionEnum) {
33011
- return new OptionCoder(enumMatch.name, coders);
33047
+ return new OptionCoder2(enumMatch.name, coders);
33012
33048
  }
33013
33049
  return new EnumCoder2(enumMatch.name, coders);
33014
33050
  }
@@ -33019,12 +33055,6 @@ This unreleased fuel-core build may include features and updates not yet support
33019
33055
  );
33020
33056
  return new TupleCoder2(coders);
33021
33057
  }
33022
- if (resolvedAbiType.type === STR_SLICE_CODER_TYPE) {
33023
- throw new FuelError(
33024
- ErrorCode.INVALID_DATA,
33025
- "String slices can not be decoded from logs. Convert the slice to `str[N]` with `__to_str_array`"
33026
- );
33027
- }
33028
33058
  throw new FuelError(
33029
33059
  ErrorCode.CODER_NOT_FOUND,
33030
33060
  `Coder not found: ${JSON.stringify(resolvedAbiType)}.`
@@ -33060,6 +33090,8 @@ This unreleased fuel-core build may include features and updates not yet support
33060
33090
  var FunctionFragment = class {
33061
33091
  signature;
33062
33092
  selector;
33093
+ selectorBytes;
33094
+ encoding;
33063
33095
  name;
33064
33096
  jsonFn;
33065
33097
  attributes;
@@ -33072,6 +33104,8 @@ This unreleased fuel-core build may include features and updates not yet support
33072
33104
  this.name = name;
33073
33105
  this.signature = FunctionFragment.getSignature(this.jsonAbi, this.jsonFn);
33074
33106
  this.selector = FunctionFragment.getFunctionSelector(this.signature);
33107
+ this.selectorBytes = new StdStringCoder2().encode(name);
33108
+ this.encoding = this.jsonAbi.encoding;
33075
33109
  this.isInputDataPointer = this.#isInputDataPointer();
33076
33110
  this.outputMetadata = {
33077
33111
  isHeapType: this.#isOutputDataHeap(),
@@ -33125,11 +33159,14 @@ This unreleased fuel-core build may include features and updates not yet support
33125
33159
  }
33126
33160
  const coders = nonEmptyInputs.map(
33127
33161
  (t) => AbiCoder.getCoder(this.jsonAbi, t, {
33128
- isRightPadded: nonEmptyInputs.length > 1
33162
+ isRightPadded: nonEmptyInputs.length > 1,
33163
+ encoding: this.encoding
33129
33164
  })
33130
33165
  );
33131
- const coder = new TupleCoder(coders);
33132
- const results = coder.encode(shallowCopyValues);
33166
+ if (this.encoding === ENCODING_V1) {
33167
+ return new TupleCoder2(coders).encode(shallowCopyValues);
33168
+ }
33169
+ const results = new TupleCoder(coders).encode(shallowCopyValues);
33133
33170
  return unpackDynamicData(results, offset, results.byteLength);
33134
33171
  }
33135
33172
  static verifyArgsAndInputsAlign(args, inputs, abi) {
@@ -33176,7 +33213,7 @@ This unreleased fuel-core build may include features and updates not yet support
33176
33213
  }
33177
33214
  const result = nonEmptyInputs.reduce(
33178
33215
  (obj, input) => {
33179
- const coder = AbiCoder.getCoder(this.jsonAbi, input);
33216
+ const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
33180
33217
  const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
33181
33218
  return {
33182
33219
  decoded: [...obj.decoded, decodedValue],
@@ -33196,7 +33233,9 @@ This unreleased fuel-core build may include features and updates not yet support
33196
33233
  return [void 0, 0];
33197
33234
  }
33198
33235
  const bytes3 = arrayify(data);
33199
- const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output);
33236
+ const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
33237
+ encoding: this.encoding
33238
+ });
33200
33239
  return coder.decode(bytes3, 0);
33201
33240
  }
33202
33241
  };
@@ -33281,7 +33320,8 @@ This unreleased fuel-core build may include features and updates not yet support
33281
33320
  }
33282
33321
  );
33283
33322
  return AbiCoder.encode(this.jsonAbi, configurable.configurableType, value, {
33284
- isRightPadded: true
33323
+ isRightPadded: true,
33324
+ encoding: this.jsonAbi.encoding
33285
33325
  });
33286
33326
  }
33287
33327
  getTypeById(typeId) {
@@ -39351,6 +39391,15 @@ ${MessageCoinFragmentFragmentDoc}`;
39351
39391
  return normalize2(clone_default(root));
39352
39392
  }
39353
39393
 
39394
+ // src/providers/utils/sleep.ts
39395
+ function sleep(time) {
39396
+ return new Promise((resolve) => {
39397
+ setTimeout(() => {
39398
+ resolve(true);
39399
+ }, time);
39400
+ });
39401
+ }
39402
+
39354
39403
  // src/providers/transaction-request/errors.ts
39355
39404
  var ChangeOutputCollisionError = class extends Error {
39356
39405
  name = "ChangeOutputCollisionError";