@fuel-ts/account 0.0.0-rc-2143-20240516153006 → 0.0.0-rc-2322-20240517060059

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.

@@ -6,7 +6,7 @@ export type LaunchNodeOptions = {
6
6
  ip?: string;
7
7
  port?: string;
8
8
  args?: string[];
9
- fuelCorePath?: string;
9
+ useSystemFuelCore?: boolean;
10
10
  loggingEnabled?: boolean;
11
11
  debugEnabled?: boolean;
12
12
  basePath?: string;
@@ -31,12 +31,12 @@ export declare const killNode: (params: KillNodeParams) => void;
31
31
  * @param ip - the ip to bind to. (optional, defaults to 0.0.0.0)
32
32
  * @param port - the port to bind to. (optional, defaults to 4000 or the next available port)
33
33
  * @param args - additional arguments to pass to fuel-core.
34
- * @param fuelCorePath - the path to the fuel-core binary. (optional, defaults to 'fuel-core')
34
+ * @param useSystemFuelCore - whether to use the system fuel-core binary or the one provided by the \@fuel-ts/fuel-core package.
35
35
  * @param loggingEnabled - whether the node should output logs. (optional, defaults to true)
36
36
  * @param debugEnabled - whether the node should log debug messages. (optional, defaults to false)
37
37
  * @param basePath - the base path to use for the temporary folder. (optional, defaults to os.tmpdir())
38
38
  * */
39
- export declare const launchNode: ({ ip, port, args, fuelCorePath, loggingEnabled, debugEnabled, basePath, }: LaunchNodeOptions) => LaunchNodeResult;
39
+ export declare const launchNode: ({ ip, port, args, useSystemFuelCore, loggingEnabled, debugEnabled, basePath, }: LaunchNodeOptions) => LaunchNodeResult;
40
40
  export type LaunchNodeAndGetWalletsResult = Promise<{
41
41
  wallets: WalletUnlocked[];
42
42
  stop: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"launchNode.d.ts","sourceRoot":"","sources":["../../src/test-utils/launchNode.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AASpE,OAAO,EAAE,QAAQ,EA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CAAC"}
@@ -9511,16 +9511,16 @@ spurious results.`);
9511
9511
  },
9512
9512
  // Document
9513
9513
  Document: {
9514
- leave: (node) => join2(node.definitions, "\n\n")
9514
+ leave: (node) => join3(node.definitions, "\n\n")
9515
9515
  },
9516
9516
  OperationDefinition: {
9517
9517
  leave(node) {
9518
- const varDefs = wrap2("(", join2(node.variableDefinitions, ", "), ")");
9519
- const prefix = join2(
9518
+ const varDefs = wrap2("(", join3(node.variableDefinitions, ", "), ")");
9519
+ const prefix = join3(
9520
9520
  [
9521
9521
  node.operation,
9522
- join2([node.name, varDefs]),
9523
- join2(node.directives, " ")
9522
+ join3([node.name, varDefs]),
9523
+ join3(node.directives, " ")
9524
9524
  ],
9525
9525
  " "
9526
9526
  );
@@ -9528,7 +9528,7 @@ spurious results.`);
9528
9528
  }
9529
9529
  },
9530
9530
  VariableDefinition: {
9531
- leave: ({ variable, type: type3, defaultValue, directives }) => variable + ": " + type3 + wrap2(" = ", defaultValue) + wrap2(" ", join2(directives, " "))
9531
+ leave: ({ variable, type: type3, defaultValue, directives }) => variable + ": " + type3 + wrap2(" = ", defaultValue) + wrap2(" ", join3(directives, " "))
9532
9532
  },
9533
9533
  SelectionSet: {
9534
9534
  leave: ({ selections }) => block2(selections)
@@ -9536,11 +9536,11 @@ spurious results.`);
9536
9536
  Field: {
9537
9537
  leave({ alias, name, arguments: args, directives, selectionSet }) {
9538
9538
  const prefix = wrap2("", alias, ": ") + name;
9539
- let argsLine = prefix + wrap2("(", join2(args, ", "), ")");
9539
+ let argsLine = prefix + wrap2("(", join3(args, ", "), ")");
9540
9540
  if (argsLine.length > MAX_LINE_LENGTH2) {
9541
- argsLine = prefix + wrap2("(\n", indent2(join2(args, "\n")), "\n)");
9541
+ argsLine = prefix + wrap2("(\n", indent2(join3(args, "\n")), "\n)");
9542
9542
  }
9543
- return join2([argsLine, join2(directives, " "), selectionSet], " ");
9543
+ return join3([argsLine, join3(directives, " "), selectionSet], " ");
9544
9544
  }
9545
9545
  },
9546
9546
  Argument: {
@@ -9548,14 +9548,14 @@ spurious results.`);
9548
9548
  },
9549
9549
  // Fragments
9550
9550
  FragmentSpread: {
9551
- leave: ({ name, directives }) => "..." + name + wrap2(" ", join2(directives, " "))
9551
+ leave: ({ name, directives }) => "..." + name + wrap2(" ", join3(directives, " "))
9552
9552
  },
9553
9553
  InlineFragment: {
9554
- leave: ({ typeCondition, directives, selectionSet }) => join2(
9554
+ leave: ({ typeCondition, directives, selectionSet }) => join3(
9555
9555
  [
9556
9556
  "...",
9557
9557
  wrap2("on ", typeCondition),
9558
- join2(directives, " "),
9558
+ join3(directives, " "),
9559
9559
  selectionSet
9560
9560
  ],
9561
9561
  " "
@@ -9564,7 +9564,7 @@ spurious results.`);
9564
9564
  FragmentDefinition: {
9565
9565
  leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => (
9566
9566
  // or removed in the future.
9567
- `fragment ${name}${wrap2("(", join2(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap2("", join2(directives, " "), " ")}` + selectionSet
9567
+ `fragment ${name}${wrap2("(", join3(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap2("", join3(directives, " "), " ")}` + selectionSet
9568
9568
  )
9569
9569
  },
9570
9570
  // Value
@@ -9587,17 +9587,17 @@ spurious results.`);
9587
9587
  leave: ({ value }) => value
9588
9588
  },
9589
9589
  ListValue: {
9590
- leave: ({ values }) => "[" + join2(values, ", ") + "]"
9590
+ leave: ({ values }) => "[" + join3(values, ", ") + "]"
9591
9591
  },
9592
9592
  ObjectValue: {
9593
- leave: ({ fields }) => "{" + join2(fields, ", ") + "}"
9593
+ leave: ({ fields }) => "{" + join3(fields, ", ") + "}"
9594
9594
  },
9595
9595
  ObjectField: {
9596
9596
  leave: ({ name, value }) => name + ": " + value
9597
9597
  },
9598
9598
  // Directive
9599
9599
  Directive: {
9600
- leave: ({ name, arguments: args }) => "@" + name + wrap2("(", join2(args, ", "), ")")
9600
+ leave: ({ name, arguments: args }) => "@" + name + wrap2("(", join3(args, ", "), ")")
9601
9601
  },
9602
9602
  // Type
9603
9603
  NamedType: {
@@ -9611,122 +9611,122 @@ spurious results.`);
9611
9611
  },
9612
9612
  // Type System Definitions
9613
9613
  SchemaDefinition: {
9614
- leave: ({ description, directives, operationTypes }) => wrap2("", description, "\n") + join2(["schema", join2(directives, " "), block2(operationTypes)], " ")
9614
+ leave: ({ description, directives, operationTypes }) => wrap2("", description, "\n") + join3(["schema", join3(directives, " "), block2(operationTypes)], " ")
9615
9615
  },
9616
9616
  OperationTypeDefinition: {
9617
9617
  leave: ({ operation, type: type3 }) => operation + ": " + type3
9618
9618
  },
9619
9619
  ScalarTypeDefinition: {
9620
- leave: ({ description, name, directives }) => wrap2("", description, "\n") + join2(["scalar", name, join2(directives, " ")], " ")
9620
+ leave: ({ description, name, directives }) => wrap2("", description, "\n") + join3(["scalar", name, join3(directives, " ")], " ")
9621
9621
  },
9622
9622
  ObjectTypeDefinition: {
9623
- leave: ({ description, name, interfaces, directives, fields }) => wrap2("", description, "\n") + join2(
9623
+ leave: ({ description, name, interfaces, directives, fields }) => wrap2("", description, "\n") + join3(
9624
9624
  [
9625
9625
  "type",
9626
9626
  name,
9627
- wrap2("implements ", join2(interfaces, " & ")),
9628
- join2(directives, " "),
9627
+ wrap2("implements ", join3(interfaces, " & ")),
9628
+ join3(directives, " "),
9629
9629
  block2(fields)
9630
9630
  ],
9631
9631
  " "
9632
9632
  )
9633
9633
  },
9634
9634
  FieldDefinition: {
9635
- leave: ({ description, name, arguments: args, type: type3, directives }) => wrap2("", description, "\n") + name + (hasMultilineItems2(args) ? wrap2("(\n", indent2(join2(args, "\n")), "\n)") : wrap2("(", join2(args, ", "), ")")) + ": " + type3 + wrap2(" ", join2(directives, " "))
9635
+ leave: ({ description, name, arguments: args, type: type3, directives }) => wrap2("", description, "\n") + name + (hasMultilineItems2(args) ? wrap2("(\n", indent2(join3(args, "\n")), "\n)") : wrap2("(", join3(args, ", "), ")")) + ": " + type3 + wrap2(" ", join3(directives, " "))
9636
9636
  },
9637
9637
  InputValueDefinition: {
9638
- leave: ({ description, name, type: type3, defaultValue, directives }) => wrap2("", description, "\n") + join2(
9639
- [name + ": " + type3, wrap2("= ", defaultValue), join2(directives, " ")],
9638
+ leave: ({ description, name, type: type3, defaultValue, directives }) => wrap2("", description, "\n") + join3(
9639
+ [name + ": " + type3, wrap2("= ", defaultValue), join3(directives, " ")],
9640
9640
  " "
9641
9641
  )
9642
9642
  },
9643
9643
  InterfaceTypeDefinition: {
9644
- leave: ({ description, name, interfaces, directives, fields }) => wrap2("", description, "\n") + join2(
9644
+ leave: ({ description, name, interfaces, directives, fields }) => wrap2("", description, "\n") + join3(
9645
9645
  [
9646
9646
  "interface",
9647
9647
  name,
9648
- wrap2("implements ", join2(interfaces, " & ")),
9649
- join2(directives, " "),
9648
+ wrap2("implements ", join3(interfaces, " & ")),
9649
+ join3(directives, " "),
9650
9650
  block2(fields)
9651
9651
  ],
9652
9652
  " "
9653
9653
  )
9654
9654
  },
9655
9655
  UnionTypeDefinition: {
9656
- leave: ({ description, name, directives, types }) => wrap2("", description, "\n") + join2(
9657
- ["union", name, join2(directives, " "), wrap2("= ", join2(types, " | "))],
9656
+ leave: ({ description, name, directives, types }) => wrap2("", description, "\n") + join3(
9657
+ ["union", name, join3(directives, " "), wrap2("= ", join3(types, " | "))],
9658
9658
  " "
9659
9659
  )
9660
9660
  },
9661
9661
  EnumTypeDefinition: {
9662
- leave: ({ description, name, directives, values }) => wrap2("", description, "\n") + join2(["enum", name, join2(directives, " "), block2(values)], " ")
9662
+ leave: ({ description, name, directives, values }) => wrap2("", description, "\n") + join3(["enum", name, join3(directives, " "), block2(values)], " ")
9663
9663
  },
9664
9664
  EnumValueDefinition: {
9665
- leave: ({ description, name, directives }) => wrap2("", description, "\n") + join2([name, join2(directives, " ")], " ")
9665
+ leave: ({ description, name, directives }) => wrap2("", description, "\n") + join3([name, join3(directives, " ")], " ")
9666
9666
  },
9667
9667
  InputObjectTypeDefinition: {
9668
- leave: ({ description, name, directives, fields }) => wrap2("", description, "\n") + join2(["input", name, join2(directives, " "), block2(fields)], " ")
9668
+ leave: ({ description, name, directives, fields }) => wrap2("", description, "\n") + join3(["input", name, join3(directives, " "), block2(fields)], " ")
9669
9669
  },
9670
9670
  DirectiveDefinition: {
9671
- leave: ({ description, name, arguments: args, repeatable, locations }) => wrap2("", description, "\n") + "directive @" + name + (hasMultilineItems2(args) ? wrap2("(\n", indent2(join2(args, "\n")), "\n)") : wrap2("(", join2(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join2(locations, " | ")
9671
+ leave: ({ description, name, arguments: args, repeatable, locations }) => wrap2("", description, "\n") + "directive @" + name + (hasMultilineItems2(args) ? wrap2("(\n", indent2(join3(args, "\n")), "\n)") : wrap2("(", join3(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join3(locations, " | ")
9672
9672
  },
9673
9673
  SchemaExtension: {
9674
- leave: ({ directives, operationTypes }) => join2(
9675
- ["extend schema", join2(directives, " "), block2(operationTypes)],
9674
+ leave: ({ directives, operationTypes }) => join3(
9675
+ ["extend schema", join3(directives, " "), block2(operationTypes)],
9676
9676
  " "
9677
9677
  )
9678
9678
  },
9679
9679
  ScalarTypeExtension: {
9680
- leave: ({ name, directives }) => join2(["extend scalar", name, join2(directives, " ")], " ")
9680
+ leave: ({ name, directives }) => join3(["extend scalar", name, join3(directives, " ")], " ")
9681
9681
  },
9682
9682
  ObjectTypeExtension: {
9683
- leave: ({ name, interfaces, directives, fields }) => join2(
9683
+ leave: ({ name, interfaces, directives, fields }) => join3(
9684
9684
  [
9685
9685
  "extend type",
9686
9686
  name,
9687
- wrap2("implements ", join2(interfaces, " & ")),
9688
- join2(directives, " "),
9687
+ wrap2("implements ", join3(interfaces, " & ")),
9688
+ join3(directives, " "),
9689
9689
  block2(fields)
9690
9690
  ],
9691
9691
  " "
9692
9692
  )
9693
9693
  },
9694
9694
  InterfaceTypeExtension: {
9695
- leave: ({ name, interfaces, directives, fields }) => join2(
9695
+ leave: ({ name, interfaces, directives, fields }) => join3(
9696
9696
  [
9697
9697
  "extend interface",
9698
9698
  name,
9699
- wrap2("implements ", join2(interfaces, " & ")),
9700
- join2(directives, " "),
9699
+ wrap2("implements ", join3(interfaces, " & ")),
9700
+ join3(directives, " "),
9701
9701
  block2(fields)
9702
9702
  ],
9703
9703
  " "
9704
9704
  )
9705
9705
  },
9706
9706
  UnionTypeExtension: {
9707
- leave: ({ name, directives, types }) => join2(
9707
+ leave: ({ name, directives, types }) => join3(
9708
9708
  [
9709
9709
  "extend union",
9710
9710
  name,
9711
- join2(directives, " "),
9712
- wrap2("= ", join2(types, " | "))
9711
+ join3(directives, " "),
9712
+ wrap2("= ", join3(types, " | "))
9713
9713
  ],
9714
9714
  " "
9715
9715
  )
9716
9716
  },
9717
9717
  EnumTypeExtension: {
9718
- leave: ({ name, directives, values }) => join2(["extend enum", name, join2(directives, " "), block2(values)], " ")
9718
+ leave: ({ name, directives, values }) => join3(["extend enum", name, join3(directives, " "), block2(values)], " ")
9719
9719
  },
9720
9720
  InputObjectTypeExtension: {
9721
- leave: ({ name, directives, fields }) => join2(["extend input", name, join2(directives, " "), block2(fields)], " ")
9721
+ leave: ({ name, directives, fields }) => join3(["extend input", name, join3(directives, " "), block2(fields)], " ")
9722
9722
  }
9723
9723
  };
9724
- function join2(maybeArray, separator = "") {
9724
+ function join3(maybeArray, separator = "") {
9725
9725
  var _maybeArray$filter$jo;
9726
9726
  return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : "";
9727
9727
  }
9728
9728
  function block2(array) {
9729
- return wrap2("{\n", indent2(join2(array, "\n")), "\n}");
9729
+ return wrap2("{\n", indent2(join3(array, "\n")), "\n}");
9730
9730
  }
9731
9731
  function wrap2(start, maybeString, end = "") {
9732
9732
  return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
@@ -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;
@@ -49905,12 +49917,27 @@ Supported fuel-core version: ${supportedVersion}.`
49905
49917
  return wallet;
49906
49918
  };
49907
49919
 
49920
+ // ../utils/dist/cli-utils.mjs
49921
+ var import_fs = __require("fs");
49922
+ var import_path7 = __require("path");
49923
+ var findBinPath = (binCommandName, startingDir) => {
49924
+ const cmdPath = (0, import_path7.join)(startingDir, "node_modules", ".bin", binCommandName);
49925
+ const parentDir = (0, import_path7.join)(startingDir, "..");
49926
+ if ((0, import_fs.existsSync)(cmdPath)) {
49927
+ return cmdPath;
49928
+ }
49929
+ if (parentDir === startingDir) {
49930
+ throw new Error(`Command not found: ${binCommandName}`);
49931
+ }
49932
+ return findBinPath(binCommandName, parentDir);
49933
+ };
49934
+
49908
49935
  // src/test-utils/launchNode.ts
49909
49936
  var import_child_process = __require("child_process");
49910
49937
  var import_crypto19 = __require("crypto");
49911
- var import_fs = __require("fs");
49938
+ var import_fs2 = __require("fs");
49912
49939
  var import_os = __toESM(__require("os"));
49913
- var import_path7 = __toESM(__require("path"));
49940
+ var import_path8 = __toESM(__require("path"));
49914
49941
  var import_portfinder = __toESM(require_portfinder());
49915
49942
  var import_tree_kill = __toESM(require_tree_kill());
49916
49943
  var getFlagValueFromArgs = (args, flag) => {
@@ -49939,8 +49966,8 @@ Supported fuel-core version: ${supportedVersion}.`
49939
49966
  }
49940
49967
  child.stdout.removeAllListeners();
49941
49968
  child.stderr.removeAllListeners();
49942
- if ((0, import_fs.existsSync)(configPath)) {
49943
- (0, import_fs.rmSync)(configPath, { recursive: true });
49969
+ if ((0, import_fs2.existsSync)(configPath)) {
49970
+ (0, import_fs2.rmSync)(configPath, { recursive: true });
49944
49971
  }
49945
49972
  }
49946
49973
  };
@@ -49948,7 +49975,7 @@ Supported fuel-core version: ${supportedVersion}.`
49948
49975
  ip,
49949
49976
  port,
49950
49977
  args = [],
49951
- fuelCorePath = process.env.FUEL_CORE_PATH ?? void 0,
49978
+ useSystemFuelCore = false,
49952
49979
  loggingEnabled = true,
49953
49980
  debugEnabled = false,
49954
49981
  basePath
@@ -49968,7 +49995,8 @@ Supported fuel-core version: ${supportedVersion}.`
49968
49995
  const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
49969
49996
  const poaInstant = poaInstantFlagValue === "true" || poaInstantFlagValue === void 0;
49970
49997
  const graphQLStartSubstring = "Binding GraphQL provider to";
49971
- const command = fuelCorePath ?? "fuel-core";
49998
+ const binPath = findBinPath("fuels-core", __dirname);
49999
+ const command = useSystemFuelCore ? "fuel-core" : binPath;
49972
50000
  const ipToUse = ip || "0.0.0.0";
49973
50001
  const portToUse = port || (await (0, import_portfinder.getPortPromise)({
49974
50002
  port: 4e3,
@@ -49979,12 +50007,12 @@ Supported fuel-core version: ${supportedVersion}.`
49979
50007
  let snapshotDirToUse;
49980
50008
  const prefix = basePath || import_os.default.tmpdir();
49981
50009
  const suffix = basePath ? "" : (0, import_crypto19.randomUUID)();
49982
- const tempDirPath = import_path7.default.join(prefix, ".fuels", suffix, "snapshotDir");
50010
+ const tempDirPath = import_path8.default.join(prefix, ".fuels", suffix, "snapshotDir");
49983
50011
  if (snapshotDir) {
49984
50012
  snapshotDirToUse = snapshotDir;
49985
50013
  } else {
49986
- if (!(0, import_fs.existsSync)(tempDirPath)) {
49987
- (0, import_fs.mkdirSync)(tempDirPath, { recursive: true });
50014
+ if (!(0, import_fs2.existsSync)(tempDirPath)) {
50015
+ (0, import_fs2.mkdirSync)(tempDirPath, { recursive: true });
49988
50016
  }
49989
50017
  let { stateConfigJson } = defaultSnapshotConfigs;
49990
50018
  const { chainConfigJson, metadataJson } = defaultSnapshotConfigs;
@@ -50020,14 +50048,14 @@ Supported fuel-core version: ${supportedVersion}.`
50020
50048
  let fixedStateConfigJSON = JSON.stringify(stateConfigJson);
50021
50049
  const regexMakeNumber = /("amount":)"(\d+)"/gm;
50022
50050
  fixedStateConfigJSON = fixedStateConfigJSON.replace(regexMakeNumber, "$1$2");
50023
- const chainConfigWritePath = import_path7.default.join(tempDirPath, "chainConfig.json");
50024
- const stateConfigWritePath = import_path7.default.join(tempDirPath, "stateConfig.json");
50025
- const metadataWritePath = import_path7.default.join(tempDirPath, "metadata.json");
50026
- const stateTransitionWritePath = import_path7.default.join(tempDirPath, "state_transition_bytecode.wasm");
50027
- (0, import_fs.writeFileSync)(chainConfigWritePath, JSON.stringify(chainConfigJson), "utf8");
50028
- (0, import_fs.writeFileSync)(stateConfigWritePath, fixedStateConfigJSON, "utf8");
50029
- (0, import_fs.writeFileSync)(metadataWritePath, JSON.stringify(metadataJson), "utf8");
50030
- (0, import_fs.writeFileSync)(stateTransitionWritePath, JSON.stringify(""));
50051
+ const chainConfigWritePath = import_path8.default.join(tempDirPath, "chainConfig.json");
50052
+ const stateConfigWritePath = import_path8.default.join(tempDirPath, "stateConfig.json");
50053
+ const metadataWritePath = import_path8.default.join(tempDirPath, "metadata.json");
50054
+ const stateTransitionWritePath = import_path8.default.join(tempDirPath, "state_transition_bytecode.wasm");
50055
+ (0, import_fs2.writeFileSync)(chainConfigWritePath, JSON.stringify(chainConfigJson), "utf8");
50056
+ (0, import_fs2.writeFileSync)(stateConfigWritePath, fixedStateConfigJSON, "utf8");
50057
+ (0, import_fs2.writeFileSync)(metadataWritePath, JSON.stringify(metadataJson), "utf8");
50058
+ (0, import_fs2.writeFileSync)(stateTransitionWritePath, JSON.stringify(""));
50031
50059
  snapshotDirToUse = tempDirPath;
50032
50060
  }
50033
50061
  const child = (0, import_child_process.spawn)(