@fuel-ts/account 0.100.1 → 0.100.3

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.
@@ -5,7 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
9
  var __export = (target, all) => {
10
10
  for (var name in all)
11
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -27,23 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var __publicField = (obj, key, value) => {
31
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
- return value;
33
- };
34
- var __accessCheck = (obj, member, msg) => {
35
- if (!member.has(obj))
36
- throw TypeError("Cannot " + msg);
37
- };
38
- var __privateAdd = (obj, member, value) => {
39
- if (member.has(obj))
40
- throw TypeError("Cannot add the same private member more than once");
41
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
42
- };
43
- var __privateMethod = (obj, member, method) => {
44
- __accessCheck(obj, member, "access private method");
45
- return method;
46
- };
47
30
 
48
31
  // src/test-utils.ts
49
32
  var test_utils_exports = {};
@@ -72,7 +55,10 @@ var import_hasher = require("@fuel-ts/hasher");
72
55
  var import_math = require("@fuel-ts/math");
73
56
  var import_utils = require("@fuel-ts/utils");
74
57
  var import_secp256k1 = require("@noble/curves/secp256k1");
75
- var Signer = class {
58
+ var Signer = class _Signer {
59
+ static {
60
+ __name(this, "Signer");
61
+ }
76
62
  address;
77
63
  publicKey;
78
64
  compressedPublicKey;
@@ -151,7 +137,7 @@ var Signer = class {
151
137
  * @returns Address from signature
152
138
  */
153
139
  static recoverAddress(data, signature) {
154
- return new import_address.Address(Signer.recoverPublicKey(data, signature));
140
+ return new import_address.Address(_Signer.recoverPublicKey(data, signature));
155
141
  }
156
142
  /**
157
143
  * Generate a random privateKey
@@ -175,14 +161,14 @@ var Signer = class {
175
161
  };
176
162
 
177
163
  // src/test-utils/launchNode.ts
178
- var getFlagValueFromArgs = (args, flag) => {
164
+ var getFlagValueFromArgs = /* @__PURE__ */ __name((args, flag) => {
179
165
  const flagIndex = args.indexOf(flag);
180
166
  if (flagIndex === -1) {
181
167
  return void 0;
182
168
  }
183
169
  return args[flagIndex + 1];
184
- };
185
- var extractRemainingArgs = (args, flagsToRemove) => {
170
+ }, "getFlagValueFromArgs");
171
+ var extractRemainingArgs = /* @__PURE__ */ __name((args, flagsToRemove) => {
186
172
  const newArgs = [...args];
187
173
  flagsToRemove.forEach((flag) => {
188
174
  const flagIndex = newArgs.indexOf(flag);
@@ -191,7 +177,7 @@ var extractRemainingArgs = (args, flagsToRemove) => {
191
177
  }
192
178
  });
193
179
  return newArgs;
194
- };
180
+ }, "extractRemainingArgs");
195
181
  function getFinalStateConfigJSON({
196
182
  stateConfig,
197
183
  chainConfig,
@@ -250,7 +236,8 @@ function getFinalStateConfigJSON({
250
236
  const regexMakeNumber = /("amount":)"(\d+)"/gm;
251
237
  return json.replace(regexMakeNumber, "$1$2");
252
238
  }
253
- var launchNode = async ({
239
+ __name(getFinalStateConfigJSON, "getFinalStateConfigJSON");
240
+ var launchNode = /* @__PURE__ */ __name(async ({
254
241
  ip,
255
242
  port,
256
243
  args = [],
@@ -336,18 +323,18 @@ var launchNode = async ({
336
323
  console.log(chunk.toString());
337
324
  });
338
325
  }
339
- const removeChildListeners = () => {
326
+ const removeChildListeners = /* @__PURE__ */ __name(() => {
340
327
  child.stderr.removeAllListeners();
341
- };
342
- const removeTempDir = () => {
328
+ }, "removeChildListeners");
329
+ const removeTempDir = /* @__PURE__ */ __name(() => {
343
330
  if ((0, import_fs.existsSync)(tempDir)) {
344
331
  (0, import_fs.rmSync)(tempDir, { recursive: true });
345
332
  }
346
- };
333
+ }, "removeTempDir");
347
334
  const childState = {
348
335
  isDead: false
349
336
  };
350
- const cleanup = () => {
337
+ const cleanup = /* @__PURE__ */ __name(() => {
351
338
  if (childState.isDead) {
352
339
  return;
353
340
  }
@@ -372,7 +359,7 @@ var launchNode = async ({
372
359
  console.error("No PID available for the child process, unable to kill launched node");
373
360
  }
374
361
  removeTempDir();
375
- };
362
+ }, "cleanup");
376
363
  child.stderr.on("data", (chunk) => {
377
364
  const text = typeof chunk === "string" ? chunk : chunk.toString();
378
365
  if (text.indexOf(graphQLStartSubstring) !== -1) {
@@ -413,7 +400,7 @@ var launchNode = async ({
413
400
  reject(err);
414
401
  });
415
402
  })
416
- );
403
+ ), "launchNode");
417
404
 
418
405
  // src/test-utils/setup-test-provider-and-wallets.ts
419
406
  var import_utils44 = require("@fuel-ts/utils");
@@ -422,7 +409,7 @@ var import_ramda10 = require("ramda");
422
409
  // src/providers/coin-quantity.ts
423
410
  var import_math2 = require("@fuel-ts/math");
424
411
  var import_utils3 = require("@fuel-ts/utils");
425
- var coinQuantityfy = (coinQuantityLike) => {
412
+ var coinQuantityfy = /* @__PURE__ */ __name((coinQuantityLike) => {
426
413
  let assetId;
427
414
  let amount;
428
415
  let max;
@@ -440,8 +427,8 @@ var coinQuantityfy = (coinQuantityLike) => {
440
427
  amount: (0, import_math2.bn)(amount),
441
428
  max: max ? (0, import_math2.bn)(max) : void 0
442
429
  };
443
- };
444
- var addAmountToCoinQuantities = (params) => {
430
+ }, "coinQuantityfy");
431
+ var addAmountToCoinQuantities = /* @__PURE__ */ __name((params) => {
445
432
  const { amount, assetId } = params;
446
433
  const coinQuantities = [...params.coinQuantities];
447
434
  const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
@@ -451,30 +438,19 @@ var addAmountToCoinQuantities = (params) => {
451
438
  coinQuantities.push({ assetId, amount });
452
439
  }
453
440
  return coinQuantities;
454
- };
441
+ }, "addAmountToCoinQuantities");
455
442
 
456
443
  // src/providers/provider.ts
457
444
  var import_address4 = require("@fuel-ts/address");
458
- var import_errors21 = require("@fuel-ts/errors");
445
+ var import_errors20 = require("@fuel-ts/errors");
459
446
  var import_math19 = require("@fuel-ts/math");
460
- var import_transactions23 = require("@fuel-ts/transactions");
447
+ var import_transactions24 = require("@fuel-ts/transactions");
461
448
  var import_utils30 = require("@fuel-ts/utils");
462
449
  var import_versions = require("@fuel-ts/versions");
463
450
  var import_graphql_request = require("graphql-request");
464
451
  var import_graphql_tag2 = __toESM(require("graphql-tag"));
465
452
  var import_ramda8 = require("ramda");
466
453
 
467
- // src/connectors/utils/promises.ts
468
- var import_errors2 = require("@fuel-ts/errors");
469
- function deferPromise() {
470
- const defer = {};
471
- defer.promise = new Promise((resolve, reject) => {
472
- defer.reject = reject;
473
- defer.resolve = resolve;
474
- });
475
- return defer;
476
- }
477
-
478
454
  // src/providers/__generated__/operations.ts
479
455
  var import_graphql_tag = __toESM(require("graphql-tag"));
480
456
  var SubmittedStatusFragmentDoc = import_graphql_tag.default`
@@ -966,6 +942,11 @@ var NodeInfoFragmentDoc = import_graphql_tag.default`
966
942
  maxTx
967
943
  maxDepth
968
944
  nodeVersion
945
+ indexation {
946
+ balances
947
+ coinsToSpend
948
+ assetMetadata
949
+ }
969
950
  }
970
951
  `;
971
952
  var RelayedTransactionStatusFragmentDoc = import_graphql_tag.default`
@@ -1247,7 +1228,7 @@ var GetBalancesDocument = import_graphql_tag.default`
1247
1228
  }
1248
1229
  `;
1249
1230
  var GetBalancesV2Document = import_graphql_tag.default`
1250
- query getBalancesV2($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
1231
+ query getBalancesV2($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int, $supportsPagination: Boolean!) {
1251
1232
  balances(
1252
1233
  filter: $filter
1253
1234
  after: $after
@@ -1255,7 +1236,7 @@ var GetBalancesV2Document = import_graphql_tag.default`
1255
1236
  first: $first
1256
1237
  last: $last
1257
1238
  ) {
1258
- pageInfo {
1239
+ pageInfo @include(if: $supportsPagination) {
1259
1240
  ...pageInfoFragment
1260
1241
  }
1261
1242
  edges {
@@ -1525,37 +1506,38 @@ function getSdk(requester) {
1525
1506
  }
1526
1507
  };
1527
1508
  }
1509
+ __name(getSdk, "getSdk");
1528
1510
 
1529
1511
  // src/providers/fuel-graphql-subscriber.ts
1530
- var import_errors4 = require("@fuel-ts/errors");
1512
+ var import_errors3 = require("@fuel-ts/errors");
1531
1513
  var import_graphql = require("graphql");
1532
1514
 
1533
1515
  // src/providers/utils/handle-gql-error-message.ts
1534
- var import_errors3 = require("@fuel-ts/errors");
1535
- var mapGqlErrorMessage = (error) => {
1516
+ var import_errors2 = require("@fuel-ts/errors");
1517
+ var mapGqlErrorMessage = /* @__PURE__ */ __name((error) => {
1536
1518
  if (new RegExp("the target cannot be met due to no coins available or exceeding the \\d+ coin limit." /* NOT_ENOUGH_COINS_MAX_COINS */).test(error.message)) {
1537
- return new import_errors3.FuelError(
1538
- import_errors3.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
1519
+ return new import_errors2.FuelError(
1520
+ import_errors2.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
1539
1521
  `Insufficient funds or too many small value coins. Consider combining UTXOs.`,
1540
1522
  {},
1541
1523
  error
1542
1524
  );
1543
1525
  }
1544
1526
  if (new RegExp("resource was not found in table" /* ASSET_NOT_FOUND */).test(error.message)) {
1545
- return new import_errors3.FuelError(
1546
- import_errors3.ErrorCode.ASSET_NOT_FOUND,
1527
+ return new import_errors2.FuelError(
1528
+ import_errors2.ErrorCode.ASSET_NOT_FOUND,
1547
1529
  `Asset not found for given asset id.`,
1548
1530
  {},
1549
1531
  error
1550
1532
  );
1551
1533
  }
1552
- return new import_errors3.FuelError(import_errors3.ErrorCode.INVALID_REQUEST, error.message, {}, error);
1553
- };
1554
- var mapGqlErrorWithIncompatibleNodeVersion = (error, incompatibleNodeVersionMessage) => {
1534
+ return new import_errors2.FuelError(import_errors2.ErrorCode.INVALID_REQUEST, error.message, {}, error);
1535
+ }, "mapGqlErrorMessage");
1536
+ var mapGqlErrorWithIncompatibleNodeVersion = /* @__PURE__ */ __name((error, incompatibleNodeVersionMessage) => {
1555
1537
  if (!incompatibleNodeVersionMessage) {
1556
1538
  return error;
1557
1539
  }
1558
- return new import_errors3.FuelError(
1540
+ return new import_errors2.FuelError(
1559
1541
  error.code,
1560
1542
  `${error.message}
1561
1543
 
@@ -1563,8 +1545,8 @@ ${incompatibleNodeVersionMessage}`,
1563
1545
  error.metadata,
1564
1546
  error.rawError
1565
1547
  );
1566
- };
1567
- var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = false) => {
1548
+ }, "mapGqlErrorWithIncompatibleNodeVersion");
1549
+ var assertGqlResponseHasNoErrors = /* @__PURE__ */ __name((errors, incompatibleNodeVersionMessage = false) => {
1568
1550
  if (!Array.isArray(errors)) {
1569
1551
  return;
1570
1552
  }
@@ -1574,16 +1556,21 @@ var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = fal
1574
1556
  }
1575
1557
  const errorMessage = mappedErrors.map((err) => err.message).join("\n");
1576
1558
  throw mapGqlErrorWithIncompatibleNodeVersion(
1577
- new import_errors3.FuelError(import_errors3.ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
1559
+ new import_errors2.FuelError(import_errors2.ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
1578
1560
  incompatibleNodeVersionMessage
1579
1561
  );
1580
- };
1562
+ }, "assertGqlResponseHasNoErrors");
1581
1563
 
1582
1564
  // src/providers/fuel-graphql-subscriber.ts
1583
- var _FuelGraphqlSubscriber = class {
1565
+ var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
1584
1566
  constructor(stream) {
1585
1567
  this.stream = stream;
1586
1568
  }
1569
+ static {
1570
+ __name(this, "FuelGraphqlSubscriber");
1571
+ }
1572
+ static incompatibleNodeVersionMessage = false;
1573
+ static textDecoder = new TextDecoder();
1587
1574
  static async create(options) {
1588
1575
  const { url, query, variables, fetchFn } = options;
1589
1576
  const response = await fetchFn(`${url}-sub`, {
@@ -1625,8 +1612,8 @@ var _FuelGraphqlSubscriber = class {
1625
1612
  try {
1626
1613
  this.events.push(JSON.parse(match.replace(/^data:/, "")));
1627
1614
  } catch (e) {
1628
- throw new import_errors4.FuelError(
1629
- import_errors4.ErrorCode.STREAM_PARSING_ERROR,
1615
+ throw new import_errors3.FuelError(
1616
+ import_errors3.ErrorCode.STREAM_PARSING_ERROR,
1630
1617
  `Error while parsing stream data response: ${text}`
1631
1618
  );
1632
1619
  }
@@ -1644,22 +1631,19 @@ var _FuelGraphqlSubscriber = class {
1644
1631
  return this;
1645
1632
  }
1646
1633
  };
1647
- var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
1648
- __publicField(FuelGraphqlSubscriber, "incompatibleNodeVersionMessage", false);
1649
- __publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
1650
1634
 
1651
1635
  // src/providers/resource-cache.ts
1652
- var import_errors15 = require("@fuel-ts/errors");
1636
+ var import_errors14 = require("@fuel-ts/errors");
1653
1637
  var import_utils23 = require("@fuel-ts/utils");
1654
1638
 
1655
1639
  // src/providers/transaction-request/input.ts
1656
1640
  var import_abi_coder2 = require("@fuel-ts/abi-coder");
1657
1641
  var import_configs = require("@fuel-ts/address/configs");
1658
- var import_errors5 = require("@fuel-ts/errors");
1642
+ var import_errors4 = require("@fuel-ts/errors");
1659
1643
  var import_math3 = require("@fuel-ts/math");
1660
1644
  var import_transactions = require("@fuel-ts/transactions");
1661
1645
  var import_utils4 = require("@fuel-ts/utils");
1662
- var inputify = (value) => {
1646
+ var inputify = /* @__PURE__ */ __name((value) => {
1663
1647
  const { type } = value;
1664
1648
  switch (value.type) {
1665
1649
  case import_transactions.InputType.Coin: {
@@ -1719,21 +1703,21 @@ var inputify = (value) => {
1719
1703
  };
1720
1704
  }
1721
1705
  default: {
1722
- throw new import_errors5.FuelError(
1723
- import_errors5.ErrorCode.INVALID_TRANSACTION_INPUT,
1706
+ throw new import_errors4.FuelError(
1707
+ import_errors4.ErrorCode.INVALID_TRANSACTION_INPUT,
1724
1708
  `Invalid transaction input type: ${type}.`
1725
1709
  );
1726
1710
  }
1727
1711
  }
1728
- };
1712
+ }, "inputify");
1729
1713
 
1730
1714
  // src/providers/transaction-request/output.ts
1731
1715
  var import_configs2 = require("@fuel-ts/address/configs");
1732
- var import_errors6 = require("@fuel-ts/errors");
1716
+ var import_errors5 = require("@fuel-ts/errors");
1733
1717
  var import_math4 = require("@fuel-ts/math");
1734
1718
  var import_transactions2 = require("@fuel-ts/transactions");
1735
1719
  var import_utils5 = require("@fuel-ts/utils");
1736
- var outputify = (value) => {
1720
+ var outputify = /* @__PURE__ */ __name((value) => {
1737
1721
  const { type } = value;
1738
1722
  switch (type) {
1739
1723
  case import_transactions2.OutputType.Coin: {
@@ -1776,29 +1760,29 @@ var outputify = (value) => {
1776
1760
  };
1777
1761
  }
1778
1762
  default: {
1779
- throw new import_errors6.FuelError(
1780
- import_errors6.ErrorCode.INVALID_TRANSACTION_INPUT,
1763
+ throw new import_errors5.FuelError(
1764
+ import_errors5.ErrorCode.INVALID_TRANSACTION_INPUT,
1781
1765
  `Invalid transaction output type: ${type}.`
1782
1766
  );
1783
1767
  }
1784
1768
  }
1785
- };
1769
+ }, "outputify");
1786
1770
 
1787
1771
  // src/providers/transaction-request/transaction-request.ts
1788
1772
  var import_abi_coder3 = require("@fuel-ts/abi-coder");
1789
1773
  var import_address2 = require("@fuel-ts/address");
1790
1774
  var import_configs6 = require("@fuel-ts/address/configs");
1791
1775
  var import_crypto3 = require("@fuel-ts/crypto");
1792
- var import_errors11 = require("@fuel-ts/errors");
1776
+ var import_errors10 = require("@fuel-ts/errors");
1793
1777
  var import_math9 = require("@fuel-ts/math");
1794
1778
  var import_transactions8 = require("@fuel-ts/transactions");
1795
1779
  var import_utils11 = require("@fuel-ts/utils");
1796
1780
 
1797
1781
  // src/providers/message.ts
1798
- var isMessageCoin = (message) => !("data" in message);
1782
+ var isMessageCoin = /* @__PURE__ */ __name((message) => !("data" in message), "isMessageCoin");
1799
1783
 
1800
1784
  // src/providers/resource.ts
1801
- var isCoin = (resource) => "id" in resource;
1785
+ var isCoin = /* @__PURE__ */ __name((resource) => "id" in resource, "isCoin");
1802
1786
 
1803
1787
  // src/providers/utils/receipts.ts
1804
1788
  var import_transactions4 = require("@fuel-ts/transactions");
@@ -1806,11 +1790,11 @@ var import_configs4 = require("@fuel-ts/transactions/configs");
1806
1790
 
1807
1791
  // src/providers/utils/serialization.ts
1808
1792
  var import_configs3 = require("@fuel-ts/address/configs");
1809
- var import_errors7 = require("@fuel-ts/errors");
1793
+ var import_errors6 = require("@fuel-ts/errors");
1810
1794
  var import_math5 = require("@fuel-ts/math");
1811
1795
  var import_transactions3 = require("@fuel-ts/transactions");
1812
1796
  var import_utils6 = require("@fuel-ts/utils");
1813
- var deserializeChain = (chain) => {
1797
+ var deserializeChain = /* @__PURE__ */ __name((chain) => {
1814
1798
  const { name, daHeight, consensusParameters } = chain;
1815
1799
  const {
1816
1800
  contractParams,
@@ -1864,8 +1848,8 @@ var deserializeChain = (chain) => {
1864
1848
  gasCosts
1865
1849
  }
1866
1850
  };
1867
- };
1868
- var serializeChain = (chain) => {
1851
+ }, "deserializeChain");
1852
+ var serializeChain = /* @__PURE__ */ __name((chain) => {
1869
1853
  const { name, baseChainHeight, consensusParameters } = chain;
1870
1854
  const {
1871
1855
  contractParameters,
@@ -1919,39 +1903,41 @@ var serializeChain = (chain) => {
1919
1903
  gasCosts
1920
1904
  }
1921
1905
  };
1922
- };
1923
- var deserializeNodeInfo = (nodeInfo) => {
1924
- const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
1906
+ }, "serializeChain");
1907
+ var deserializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
1908
+ const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace, indexation } = nodeInfo;
1925
1909
  return {
1926
1910
  maxDepth: (0, import_math5.bn)(maxDepth),
1927
1911
  maxTx: (0, import_math5.bn)(maxTx),
1928
1912
  nodeVersion,
1929
1913
  utxoValidation,
1930
- vmBacktrace
1914
+ vmBacktrace,
1915
+ indexation
1931
1916
  };
1932
- };
1933
- var serializeNodeInfo = (nodeInfo) => {
1934
- const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
1917
+ }, "deserializeNodeInfo");
1918
+ var serializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
1919
+ const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace, indexation } = nodeInfo;
1935
1920
  return {
1936
1921
  maxDepth: maxDepth.toString(),
1937
1922
  maxTx: maxTx.toString(),
1938
1923
  nodeVersion,
1939
1924
  utxoValidation,
1940
- vmBacktrace
1925
+ vmBacktrace,
1926
+ indexation
1941
1927
  };
1942
- };
1943
- var deserializeProviderCache = (cache2) => ({
1928
+ }, "serializeNodeInfo");
1929
+ var deserializeProviderCache = /* @__PURE__ */ __name((cache2) => ({
1944
1930
  consensusParametersTimestamp: cache2.consensusParametersTimestamp,
1945
1931
  chain: deserializeChain(cache2.chain),
1946
1932
  nodeInfo: deserializeNodeInfo(cache2.nodeInfo)
1947
- });
1948
- var serializeProviderCache = async (provider) => ({
1933
+ }), "deserializeProviderCache");
1934
+ var serializeProviderCache = /* @__PURE__ */ __name(async (provider) => ({
1949
1935
  consensusParametersTimestamp: provider.consensusParametersTimestamp,
1950
1936
  chain: serializeChain(await provider.getChain()),
1951
1937
  nodeInfo: serializeNodeInfo(await provider.getNode())
1952
- });
1953
- var hexOrZero = (hex) => hex || import_configs3.ZeroBytes32;
1954
- var deserializeReceipt = (receipt) => {
1938
+ }), "serializeProviderCache");
1939
+ var hexOrZero = /* @__PURE__ */ __name((hex) => hex || import_configs3.ZeroBytes32, "hexOrZero");
1940
+ var deserializeReceipt = /* @__PURE__ */ __name((receipt) => {
1955
1941
  const { receiptType } = receipt;
1956
1942
  switch (receiptType) {
1957
1943
  case "CALL" /* Call */: {
@@ -2141,14 +2127,14 @@ var deserializeReceipt = (receipt) => {
2141
2127
  return burnReceipt;
2142
2128
  }
2143
2129
  default:
2144
- throw new import_errors7.FuelError(import_errors7.ErrorCode.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
2130
+ throw new import_errors6.FuelError(import_errors6.ErrorCode.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
2145
2131
  }
2146
- };
2132
+ }, "deserializeReceipt");
2147
2133
 
2148
2134
  // src/providers/utils/receipts.ts
2149
- var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions4.ReceiptType.Revert && receipt.val.toString("hex") === import_configs4.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
2150
- var doesReceiptHaveMissingContractId = (receipt) => receipt.type === import_transactions4.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
2151
- var getReceiptsWithMissingData = (receipts) => receipts.reduce(
2135
+ var doesReceiptHaveMissingOutputVariables = /* @__PURE__ */ __name((receipt) => receipt.type === import_transactions4.ReceiptType.Revert && receipt.val.toString("hex") === import_configs4.FAILED_TRANSFER_TO_ADDRESS_SIGNAL, "doesReceiptHaveMissingOutputVariables");
2136
+ var doesReceiptHaveMissingContractId = /* @__PURE__ */ __name((receipt) => receipt.type === import_transactions4.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000", "doesReceiptHaveMissingContractId");
2137
+ var getReceiptsWithMissingData = /* @__PURE__ */ __name((receipts) => receipts.reduce(
2152
2138
  (memo, receipt) => {
2153
2139
  if (doesReceiptHaveMissingOutputVariables(receipt)) {
2154
2140
  memo.missingOutputVariables.push(receipt);
@@ -2162,22 +2148,22 @@ var getReceiptsWithMissingData = (receipts) => receipts.reduce(
2162
2148
  missingOutputVariables: [],
2163
2149
  missingOutputContractIds: []
2164
2150
  }
2165
- );
2151
+ ), "getReceiptsWithMissingData");
2166
2152
 
2167
2153
  // src/providers/utils/block-explorer.ts
2168
- var import_errors8 = require("@fuel-ts/errors");
2154
+ var import_errors7 = require("@fuel-ts/errors");
2169
2155
 
2170
2156
  // src/providers/utils/gas.ts
2171
2157
  var import_math6 = require("@fuel-ts/math");
2172
2158
  var import_transactions5 = require("@fuel-ts/transactions");
2173
2159
  var import_utils7 = require("@fuel-ts/utils");
2174
- var getGasUsedFromReceipts = (receipts) => {
2160
+ var getGasUsedFromReceipts = /* @__PURE__ */ __name((receipts) => {
2175
2161
  const scriptResult = receipts.filter(
2176
2162
  (receipt) => receipt.type === import_transactions5.ReceiptType.ScriptResult
2177
2163
  );
2178
2164
  const gasUsed = scriptResult.reduce((prev, receipt) => prev.add(receipt.gasUsed), (0, import_math6.bn)(0));
2179
2165
  return gasUsed;
2180
- };
2166
+ }, "getGasUsedFromReceipts");
2181
2167
  function resolveGasDependentCosts(byteSize, gasDependentCost) {
2182
2168
  const base = (0, import_math6.bn)(gasDependentCost.base);
2183
2169
  let dependentValue = (0, import_math6.bn)(0);
@@ -2188,6 +2174,7 @@ function resolveGasDependentCosts(byteSize, gasDependentCost) {
2188
2174
  }
2189
2175
  return base.add(dependentValue);
2190
2176
  }
2177
+ __name(resolveGasDependentCosts, "resolveGasDependentCosts");
2191
2178
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
2192
2179
  const witnessCache = [];
2193
2180
  const chargeableInputs = inputs.filter((input) => {
@@ -2214,6 +2201,7 @@ function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
2214
2201
  }, (0, import_math6.bn)(0));
2215
2202
  return totalGas;
2216
2203
  }
2204
+ __name(gasUsedByInputs, "gasUsedByInputs");
2217
2205
  function getMinGas(params) {
2218
2206
  const { gasCosts, gasPerByte, inputs, metadataGas, txBytesSize } = params;
2219
2207
  const vmInitGas = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
@@ -2222,6 +2210,7 @@ function getMinGas(params) {
2222
2210
  const minGas = vmInitGas.add(bytesGas).add(inputsGas).add(metadataGas).maxU64();
2223
2211
  return minGas;
2224
2212
  }
2213
+ __name(getMinGas, "getMinGas");
2225
2214
  function getMaxGas(params) {
2226
2215
  const {
2227
2216
  gasPerByte,
@@ -2238,6 +2227,7 @@ function getMaxGas(params) {
2238
2227
  const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
2239
2228
  return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
2240
2229
  }
2230
+ __name(getMaxGas, "getMaxGas");
2241
2231
  function calculateMetadataGasForTxCreate({
2242
2232
  gasCosts,
2243
2233
  stateRootSize,
@@ -2252,12 +2242,14 @@ function calculateMetadataGasForTxCreate({
2252
2242
  const metadataGas = contractRootGas.add(stateRootGas).add(txIdGas).add(contractIdGas);
2253
2243
  return metadataGas.maxU64();
2254
2244
  }
2245
+ __name(calculateMetadataGasForTxCreate, "calculateMetadataGasForTxCreate");
2255
2246
  function calculateMetadataGasForTxScript({
2256
2247
  gasCosts,
2257
2248
  txBytesSize
2258
2249
  }) {
2259
2250
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2260
2251
  }
2252
+ __name(calculateMetadataGasForTxScript, "calculateMetadataGasForTxScript");
2261
2253
  function calculateMetadataGasForTxBlob({
2262
2254
  gasCosts,
2263
2255
  txBytesSize,
@@ -2267,6 +2259,7 @@ function calculateMetadataGasForTxBlob({
2267
2259
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
2268
2260
  return txId.add(blobLen);
2269
2261
  }
2262
+ __name(calculateMetadataGasForTxBlob, "calculateMetadataGasForTxBlob");
2270
2263
  function calculateMetadataGasForTxUpgrade({
2271
2264
  gasCosts,
2272
2265
  txBytesSize,
@@ -2279,6 +2272,7 @@ function calculateMetadataGasForTxUpgrade({
2279
2272
  }
2280
2273
  return txId;
2281
2274
  }
2275
+ __name(calculateMetadataGasForTxUpgrade, "calculateMetadataGasForTxUpgrade");
2282
2276
  function calculateMetadataGasForTxUpload({
2283
2277
  gasCosts,
2284
2278
  txBytesSize,
@@ -2292,6 +2286,7 @@ function calculateMetadataGasForTxUpload({
2292
2286
  txId.add(subsectionsLen);
2293
2287
  return txId;
2294
2288
  }
2289
+ __name(calculateMetadataGasForTxUpload, "calculateMetadataGasForTxUpload");
2295
2290
  function calculateMinGasForTxUpload({
2296
2291
  gasCosts,
2297
2292
  baseMinGas,
@@ -2300,10 +2295,11 @@ function calculateMinGasForTxUpload({
2300
2295
  const additionalStoragePerByte = (0, import_math6.bn)(gasCosts.newStoragePerByte).mul(subsectionSize);
2301
2296
  return (0, import_math6.bn)(baseMinGas).add(additionalStoragePerByte);
2302
2297
  }
2303
- var calculateGasFee = (params) => {
2298
+ __name(calculateMinGasForTxUpload, "calculateMinGasForTxUpload");
2299
+ var calculateGasFee = /* @__PURE__ */ __name((params) => {
2304
2300
  const { gas, gasPrice, priceFactor, tip } = params;
2305
2301
  return gas.mul(gasPrice).div(priceFactor).add((0, import_math6.bn)(tip));
2306
- };
2302
+ }, "calculateGasFee");
2307
2303
 
2308
2304
  // src/providers/utils/json.ts
2309
2305
  var import_utils8 = require("@fuel-ts/utils");
@@ -2332,16 +2328,18 @@ function normalize(object) {
2332
2328
  });
2333
2329
  return object;
2334
2330
  }
2331
+ __name(normalize, "normalize");
2335
2332
  function normalizeJSON(root) {
2336
2333
  return normalize((0, import_ramda.clone)(root));
2337
2334
  }
2335
+ __name(normalizeJSON, "normalizeJSON");
2338
2336
 
2339
2337
  // src/providers/utils/extract-tx-error.ts
2340
- var import_errors9 = require("@fuel-ts/errors");
2338
+ var import_errors8 = require("@fuel-ts/errors");
2341
2339
  var import_math7 = require("@fuel-ts/math");
2342
2340
  var import_transactions6 = require("@fuel-ts/transactions");
2343
2341
  var import_configs5 = require("@fuel-ts/transactions/configs");
2344
- var assemblePanicError = (statusReason, metadata) => {
2342
+ var assemblePanicError = /* @__PURE__ */ __name((statusReason, metadata) => {
2345
2343
  let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
2346
2344
  if (import_configs5.PANIC_REASONS.includes(statusReason)) {
2347
2345
  errorMessage = `${errorMessage}
@@ -2350,13 +2348,13 @@ You can read more about this error at:
2350
2348
 
2351
2349
  ${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
2352
2350
  }
2353
- return new import_errors9.FuelError(import_errors9.ErrorCode.SCRIPT_REVERTED, errorMessage, {
2351
+ return new import_errors8.FuelError(import_errors8.ErrorCode.SCRIPT_REVERTED, errorMessage, {
2354
2352
  ...metadata,
2355
2353
  reason: statusReason
2356
2354
  });
2357
- };
2358
- var stringify = (obj) => JSON.stringify(obj, null, 2);
2359
- var assembleRevertError = (receipts, logs, metadata) => {
2355
+ }, "assemblePanicError");
2356
+ var stringify = /* @__PURE__ */ __name((obj) => JSON.stringify(obj, null, 2), "stringify");
2357
+ var assembleRevertError = /* @__PURE__ */ __name((receipts, logs, metadata) => {
2360
2358
  let errorMessage = "The transaction reverted with an unknown reason.";
2361
2359
  const revertReceipt = receipts.find(({ type }) => type === import_transactions6.ReceiptType.Revert);
2362
2360
  let reason = "";
@@ -2391,8 +2389,8 @@ var assembleRevertError = (receipts, logs, metadata) => {
2391
2389
  errorMessage = `The transaction reverted because it's missing an "OutputVariable".`;
2392
2390
  break;
2393
2391
  default:
2394
- throw new import_errors9.FuelError(
2395
- import_errors9.ErrorCode.UNKNOWN,
2392
+ throw new import_errors8.FuelError(
2393
+ import_errors8.ErrorCode.UNKNOWN,
2396
2394
  `The transaction reverted with an unknown reason: ${revertReceipt.val}`,
2397
2395
  {
2398
2396
  ...metadata,
@@ -2401,17 +2399,18 @@ var assembleRevertError = (receipts, logs, metadata) => {
2401
2399
  );
2402
2400
  }
2403
2401
  }
2404
- return new import_errors9.FuelError(import_errors9.ErrorCode.SCRIPT_REVERTED, errorMessage, {
2402
+ return new import_errors8.FuelError(import_errors8.ErrorCode.SCRIPT_REVERTED, errorMessage, {
2405
2403
  ...metadata,
2406
2404
  reason
2407
2405
  });
2408
- };
2409
- var extractTxError = (params) => {
2410
- const { receipts, statusReason, logs } = params;
2406
+ }, "assembleRevertError");
2407
+ var extractTxError = /* @__PURE__ */ __name((params) => {
2408
+ const { receipts, statusReason, logs, groupedLogs } = params;
2411
2409
  const isPanic = receipts.some(({ type }) => type === import_transactions6.ReceiptType.Panic);
2412
2410
  const isRevert = receipts.some(({ type }) => type === import_transactions6.ReceiptType.Revert);
2413
2411
  const metadata = {
2414
2412
  logs,
2413
+ groupedLogs,
2415
2414
  receipts,
2416
2415
  panic: isPanic,
2417
2416
  revert: isRevert,
@@ -2421,7 +2420,7 @@ var extractTxError = (params) => {
2421
2420
  return assemblePanicError(statusReason, metadata);
2422
2421
  }
2423
2422
  return assembleRevertError(receipts, logs, metadata);
2424
- };
2423
+ }, "extractTxError");
2425
2424
 
2426
2425
  // src/providers/transaction-request/errors.ts
2427
2426
  var NoWitnessAtIndexError = class extends Error {
@@ -2430,23 +2429,26 @@ var NoWitnessAtIndexError = class extends Error {
2430
2429
  this.index = index;
2431
2430
  this.message = `Witness at index "${index}" was not found`;
2432
2431
  }
2432
+ static {
2433
+ __name(this, "NoWitnessAtIndexError");
2434
+ }
2433
2435
  name = "NoWitnessAtIndexError";
2434
2436
  };
2435
2437
 
2436
2438
  // src/providers/transaction-request/helpers.ts
2437
- var import_errors10 = require("@fuel-ts/errors");
2439
+ var import_errors9 = require("@fuel-ts/errors");
2438
2440
  var import_math8 = require("@fuel-ts/math");
2439
2441
  var import_transactions7 = require("@fuel-ts/transactions");
2440
2442
  var import_utils9 = require("@fuel-ts/utils");
2441
- var isRequestInputCoin = (input) => input.type === import_transactions7.InputType.Coin;
2442
- var isRequestInputMessage = (input) => input.type === import_transactions7.InputType.Message;
2443
- var isRequestInputMessageWithoutData = (input) => input.type === import_transactions7.InputType.Message && (0, import_math8.bn)(input.data).isZero();
2444
- var isRequestInputCoinOrMessage = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
2445
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessageWithoutData(input);
2446
- var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
2447
- var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
2448
- var isPredicate = (input) => isRequestInputCoinOrMessage(input) && !!input.predicate && (0, import_utils9.hexlify)(input.predicate) !== "0x";
2449
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
2443
+ var isRequestInputCoin = /* @__PURE__ */ __name((input) => input.type === import_transactions7.InputType.Coin, "isRequestInputCoin");
2444
+ var isRequestInputMessage = /* @__PURE__ */ __name((input) => input.type === import_transactions7.InputType.Message, "isRequestInputMessage");
2445
+ var isRequestInputMessageWithoutData = /* @__PURE__ */ __name((input) => input.type === import_transactions7.InputType.Message && (0, import_math8.bn)(input.data).isZero(), "isRequestInputMessageWithoutData");
2446
+ var isRequestInputCoinOrMessage = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) || isRequestInputMessage(input), "isRequestInputCoinOrMessage");
2447
+ var isRequestInputResource = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) || isRequestInputMessageWithoutData(input), "isRequestInputResource");
2448
+ var getRequestInputResourceOwner = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) ? input.owner : input.recipient, "getRequestInputResourceOwner");
2449
+ var isRequestInputResourceFromOwner = /* @__PURE__ */ __name((input, owner) => getRequestInputResourceOwner(input) === owner.toB256(), "isRequestInputResourceFromOwner");
2450
+ var isPredicate = /* @__PURE__ */ __name((input) => isRequestInputCoinOrMessage(input) && !!input.predicate && (0, import_utils9.hexlify)(input.predicate) !== "0x", "isPredicate");
2451
+ var getAssetAmountInRequestInputs = /* @__PURE__ */ __name((inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
2450
2452
  if (isRequestInputCoin(input) && input.assetId === assetId) {
2451
2453
  return acc.add(input.amount);
2452
2454
  }
@@ -2454,8 +2456,8 @@ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filte
2454
2456
  return acc.add(input.amount);
2455
2457
  }
2456
2458
  return acc;
2457
- }, (0, import_math8.bn)(0));
2458
- var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2459
+ }, (0, import_math8.bn)(0)), "getAssetAmountInRequestInputs");
2460
+ var cacheRequestInputsResourcesFromOwner = /* @__PURE__ */ __name((inputs, owner) => inputs.reduce(
2459
2461
  (acc, input) => {
2460
2462
  if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
2461
2463
  acc.utxos.push(input.id);
@@ -2468,8 +2470,8 @@ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2468
2470
  utxos: [],
2469
2471
  messages: []
2470
2472
  }
2471
- );
2472
- var getBurnableAssetCount = (baseAssetId, transactionRequest) => {
2473
+ ), "cacheRequestInputsResourcesFromOwner");
2474
+ var getBurnableAssetCount = /* @__PURE__ */ __name((baseAssetId, transactionRequest) => {
2473
2475
  const { inputs, outputs } = transactionRequest;
2474
2476
  const coinInputs = new Set(inputs.filter(isRequestInputCoin).map((input) => input.assetId));
2475
2477
  if (inputs.some((i) => isRequestInputMessage(i) && (0, import_math8.bn)(i.amount).gt(0))) {
@@ -2480,8 +2482,8 @@ var getBurnableAssetCount = (baseAssetId, transactionRequest) => {
2480
2482
  );
2481
2483
  const difference = new Set([...coinInputs].filter((x) => !changeOutputs.has(x)));
2482
2484
  return difference.size;
2483
- };
2484
- var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAssetBurn = false) => {
2485
+ }, "getBurnableAssetCount");
2486
+ var validateTransactionForAssetBurn = /* @__PURE__ */ __name((baseAssetId, transactionRequest, enableAssetBurn = false) => {
2485
2487
  if (enableAssetBurn === true) {
2486
2488
  return;
2487
2489
  }
@@ -2493,21 +2495,24 @@ var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAs
2493
2495
  "Add the relevant change outputs to the transaction to avoid burning assets.",
2494
2496
  "Or enable asset burn, upon sending the transaction."
2495
2497
  ].join("\n");
2496
- throw new import_errors10.FuelError(import_errors10.ErrorCode.ASSET_BURN_DETECTED, message);
2497
- };
2498
+ throw new import_errors9.FuelError(import_errors9.ErrorCode.ASSET_BURN_DETECTED, message);
2499
+ }, "validateTransactionForAssetBurn");
2498
2500
 
2499
2501
  // src/providers/transaction-request/witness.ts
2500
2502
  var import_utils10 = require("@fuel-ts/utils");
2501
- var witnessify = (value) => {
2503
+ var witnessify = /* @__PURE__ */ __name((value) => {
2502
2504
  const data = (0, import_utils10.arrayify)(value);
2503
2505
  return {
2504
2506
  data: (0, import_utils10.hexlify)(data),
2505
2507
  dataLength: data.length
2506
2508
  };
2507
- };
2509
+ }, "witnessify");
2508
2510
 
2509
2511
  // src/providers/transaction-request/transaction-request.ts
2510
- var BaseTransactionRequest = class {
2512
+ var BaseTransactionRequest = class _BaseTransactionRequest {
2513
+ static {
2514
+ __name(this, "BaseTransactionRequest");
2515
+ }
2511
2516
  /** Gas price for transaction */
2512
2517
  tip;
2513
2518
  /** Block until which tx cannot be included */
@@ -2590,7 +2595,7 @@ var BaseTransactionRequest = class {
2590
2595
  const inputs = this.inputs?.map(inputify) ?? [];
2591
2596
  const outputs = this.outputs?.map(outputify) ?? [];
2592
2597
  const witnesses = this.witnesses?.map(witnessify) ?? [];
2593
- const { policyTypes, policies } = BaseTransactionRequest.getPolicyMeta(this);
2598
+ const { policyTypes, policies } = _BaseTransactionRequest.getPolicyMeta(this);
2594
2599
  return {
2595
2600
  policyTypes,
2596
2601
  inputs,
@@ -2891,7 +2896,7 @@ var BaseTransactionRequest = class {
2891
2896
  * @hidden
2892
2897
  */
2893
2898
  metadataGas(_gasCosts) {
2894
- throw new import_errors11.FuelError(import_errors11.FuelError.CODES.NOT_IMPLEMENTED, "Not implemented");
2899
+ throw new import_errors10.FuelError(import_errors10.FuelError.CODES.NOT_IMPLEMENTED, "Not implemented");
2895
2900
  }
2896
2901
  /**
2897
2902
  * @hidden
@@ -2938,13 +2943,13 @@ var BaseTransactionRequest = class {
2938
2943
  * Please use `Account.generateFakeResources` along with `this.addResources` instead.
2939
2944
  */
2940
2945
  fundWithFakeUtxos(quantities, baseAssetId, resourcesOwner) {
2941
- const findAssetInput = (assetId) => this.inputs.find((input) => {
2946
+ const findAssetInput = /* @__PURE__ */ __name((assetId) => this.inputs.find((input) => {
2942
2947
  if ("assetId" in input) {
2943
2948
  return input.assetId === assetId;
2944
2949
  }
2945
2950
  return false;
2946
- });
2947
- const updateAssetInput = (assetId, quantity) => {
2951
+ }), "findAssetInput");
2952
+ const updateAssetInput = /* @__PURE__ */ __name((assetId, quantity) => {
2948
2953
  const assetInput = findAssetInput(assetId);
2949
2954
  let usedQuantity = quantity;
2950
2955
  if (assetId === baseAssetId) {
@@ -2965,7 +2970,7 @@ var BaseTransactionRequest = class {
2965
2970
  }
2966
2971
  ]);
2967
2972
  }
2968
- };
2973
+ }, "updateAssetInput");
2969
2974
  updateAssetInput(baseAssetId, (0, import_math9.bn)(1e11));
2970
2975
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2971
2976
  return this;
@@ -3053,6 +3058,7 @@ function hashTransaction(transactionRequest, chainId) {
3053
3058
  transaction.inputs = transaction.inputs.map((input) => {
3054
3059
  const inputClone = (0, import_ramda2.clone)(input);
3055
3060
  switch (inputClone.type) {
3061
+ // Zero out on signing: txPointer, predicateGasUsed
3056
3062
  case import_transactions9.InputType.Coin: {
3057
3063
  inputClone.txPointer = {
3058
3064
  blockHeight: 0,
@@ -3061,10 +3067,12 @@ function hashTransaction(transactionRequest, chainId) {
3061
3067
  inputClone.predicateGasUsed = (0, import_math10.bn)(0);
3062
3068
  return inputClone;
3063
3069
  }
3070
+ // Zero out on signing: predicateGasUsed
3064
3071
  case import_transactions9.InputType.Message: {
3065
3072
  inputClone.predicateGasUsed = (0, import_math10.bn)(0);
3066
3073
  return inputClone;
3067
3074
  }
3075
+ // Zero out on signing: txID, outputIndex, balanceRoot, stateRoot, and txPointer
3068
3076
  case import_transactions9.InputType.Contract: {
3069
3077
  inputClone.txPointer = {
3070
3078
  blockHeight: 0,
@@ -3083,15 +3091,18 @@ function hashTransaction(transactionRequest, chainId) {
3083
3091
  transaction.outputs = transaction.outputs.map((output) => {
3084
3092
  const outputClone = (0, import_ramda2.clone)(output);
3085
3093
  switch (outputClone.type) {
3094
+ // Zero out on signing: balanceRoot, stateRoot
3086
3095
  case import_transactions9.OutputType.Contract: {
3087
3096
  outputClone.balanceRoot = import_configs7.ZeroBytes32;
3088
3097
  outputClone.stateRoot = import_configs7.ZeroBytes32;
3089
3098
  return outputClone;
3090
3099
  }
3100
+ // Zero out on signing: amount
3091
3101
  case import_transactions9.OutputType.Change: {
3092
3102
  outputClone.amount = (0, import_math10.bn)(0);
3093
3103
  return outputClone;
3094
3104
  }
3105
+ // Zero out on signing: amount, to and assetId
3095
3106
  case import_transactions9.OutputType.Variable: {
3096
3107
  outputClone.to = import_configs7.ZeroBytes32;
3097
3108
  outputClone.amount = (0, import_math10.bn)(0);
@@ -3108,9 +3119,13 @@ function hashTransaction(transactionRequest, chainId) {
3108
3119
  const concatenatedData = (0, import_utils13.concat)([chainIdBytes, new import_transactions9.TransactionCoder().encode(transaction)]);
3109
3120
  return (0, import_hasher2.sha256)(concatenatedData);
3110
3121
  }
3122
+ __name(hashTransaction, "hashTransaction");
3111
3123
 
3112
3124
  // src/providers/transaction-request/blob-transaction-request.ts
3113
3125
  var BlobTransactionRequest = class extends BaseTransactionRequest {
3126
+ static {
3127
+ __name(this, "BlobTransactionRequest");
3128
+ }
3114
3129
  static from(obj) {
3115
3130
  return new this((0, import_ramda3.clone)(obj));
3116
3131
  }
@@ -3179,12 +3194,12 @@ var import_ramda4 = require("ramda");
3179
3194
 
3180
3195
  // src/providers/transaction-request/storage-slot.ts
3181
3196
  var import_utils15 = require("@fuel-ts/utils");
3182
- var getStorageValue = (value) => {
3197
+ var getStorageValue = /* @__PURE__ */ __name((value) => {
3183
3198
  const v = new Uint8Array(32);
3184
3199
  v.set((0, import_utils15.arrayify)(value));
3185
3200
  return v;
3186
- };
3187
- var storageSlotify = (storageSlot) => {
3201
+ }, "getStorageValue");
3202
+ var storageSlotify = /* @__PURE__ */ __name((storageSlot) => {
3188
3203
  let key;
3189
3204
  let value;
3190
3205
  if (Array.isArray(storageSlot)) {
@@ -3198,10 +3213,13 @@ var storageSlotify = (storageSlot) => {
3198
3213
  key: (0, import_utils15.hexlify)(key),
3199
3214
  value: (0, import_utils15.hexlify)(getStorageValue(value))
3200
3215
  };
3201
- };
3216
+ }, "storageSlotify");
3202
3217
 
3203
3218
  // src/providers/transaction-request/create-transaction-request.ts
3204
3219
  var CreateTransactionRequest = class extends BaseTransactionRequest {
3220
+ static {
3221
+ __name(this, "CreateTransactionRequest");
3222
+ }
3205
3223
  static from(obj) {
3206
3224
  return new this((0, import_ramda4.clone)(obj));
3207
3225
  }
@@ -3303,7 +3321,7 @@ var returnZeroScript = {
3303
3321
  */
3304
3322
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
3305
3323
  bytes: (0, import_utils17.arrayify)("0x24000000"),
3306
- encodeScriptData: () => new Uint8Array(0)
3324
+ encodeScriptData: /* @__PURE__ */ __name(() => new Uint8Array(0), "encodeScriptData")
3307
3325
  };
3308
3326
  var withdrawScript = {
3309
3327
  /*
@@ -3317,11 +3335,14 @@ var withdrawScript = {
3317
3335
  */
3318
3336
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
3319
3337
  bytes: (0, import_utils17.arrayify)("0x5040C0105D44C0064C40001124000000"),
3320
- encodeScriptData: () => new Uint8Array(0)
3338
+ encodeScriptData: /* @__PURE__ */ __name(() => new Uint8Array(0), "encodeScriptData")
3321
3339
  };
3322
3340
 
3323
3341
  // src/providers/transaction-request/script-transaction-request.ts
3324
3342
  var ScriptTransactionRequest = class extends BaseTransactionRequest {
3343
+ static {
3344
+ __name(this, "ScriptTransactionRequest");
3345
+ }
3325
3346
  static from(obj) {
3326
3347
  return new this((0, import_ramda5.clone)(obj));
3327
3348
  }
@@ -3514,14 +3535,17 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
3514
3535
  };
3515
3536
 
3516
3537
  // src/providers/transaction-request/upgrade-transaction-request.ts
3517
- var import_errors13 = require("@fuel-ts/errors");
3538
+ var import_errors12 = require("@fuel-ts/errors");
3518
3539
  var import_hasher3 = require("@fuel-ts/hasher");
3519
3540
  var import_transactions12 = require("@fuel-ts/transactions");
3520
3541
  var import_utils19 = require("@fuel-ts/utils");
3521
3542
  var import_ramda6 = require("ramda");
3522
- var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3543
+ var UpgradeTransactionRequest = class _UpgradeTransactionRequest extends BaseTransactionRequest {
3544
+ static {
3545
+ __name(this, "UpgradeTransactionRequest");
3546
+ }
3523
3547
  static from(obj) {
3524
- if (obj instanceof UpgradeTransactionRequest) {
3548
+ if (obj instanceof _UpgradeTransactionRequest) {
3525
3549
  return obj;
3526
3550
  }
3527
3551
  return new this((0, import_ramda6.clone)(obj));
@@ -3618,7 +3642,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3618
3642
  }
3619
3643
  };
3620
3644
  } else {
3621
- throw new import_errors13.FuelError(import_errors13.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3645
+ throw new import_errors12.FuelError(import_errors12.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3622
3646
  }
3623
3647
  return {
3624
3648
  type: import_transactions12.TransactionType.Upgrade,
@@ -3660,7 +3684,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3660
3684
  txBytesSize
3661
3685
  });
3662
3686
  }
3663
- throw new import_errors13.FuelError(import_errors13.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3687
+ throw new import_errors12.FuelError(import_errors12.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3664
3688
  }
3665
3689
  };
3666
3690
 
@@ -3669,9 +3693,12 @@ var import_configs10 = require("@fuel-ts/address/configs");
3669
3693
  var import_transactions13 = require("@fuel-ts/transactions");
3670
3694
  var import_utils21 = require("@fuel-ts/utils");
3671
3695
  var import_ramda7 = require("ramda");
3672
- var UploadTransactionRequest = class extends BaseTransactionRequest {
3696
+ var UploadTransactionRequest = class _UploadTransactionRequest extends BaseTransactionRequest {
3697
+ static {
3698
+ __name(this, "UploadTransactionRequest");
3699
+ }
3673
3700
  static from(obj) {
3674
- if (obj instanceof UploadTransactionRequest) {
3701
+ if (obj instanceof _UploadTransactionRequest) {
3675
3702
  return obj;
3676
3703
  }
3677
3704
  return new this((0, import_ramda7.clone)(obj));
@@ -3771,9 +3798,9 @@ var UploadTransactionRequest = class extends BaseTransactionRequest {
3771
3798
  };
3772
3799
 
3773
3800
  // src/providers/transaction-request/utils.ts
3774
- var import_errors14 = require("@fuel-ts/errors");
3801
+ var import_errors13 = require("@fuel-ts/errors");
3775
3802
  var import_transactions14 = require("@fuel-ts/transactions");
3776
- var transactionRequestify = (obj) => {
3803
+ var transactionRequestify = /* @__PURE__ */ __name((obj) => {
3777
3804
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
3778
3805
  return obj;
3779
3806
  }
@@ -3795,25 +3822,28 @@ var transactionRequestify = (obj) => {
3795
3822
  return UploadTransactionRequest.from(obj);
3796
3823
  }
3797
3824
  default: {
3798
- throw new import_errors14.FuelError(
3799
- import_errors14.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3825
+ throw new import_errors13.FuelError(
3826
+ import_errors13.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3800
3827
  `Unsupported transaction type: ${type}.`
3801
3828
  );
3802
3829
  }
3803
3830
  }
3804
- };
3805
- var isTransactionTypeScript = (request) => request.type === import_transactions14.TransactionType.Script;
3806
- var isTransactionTypeCreate = (request) => request.type === import_transactions14.TransactionType.Create;
3831
+ }, "transactionRequestify");
3832
+ var isTransactionTypeScript = /* @__PURE__ */ __name((request) => request.type === import_transactions14.TransactionType.Script, "isTransactionTypeScript");
3833
+ var isTransactionTypeCreate = /* @__PURE__ */ __name((request) => request.type === import_transactions14.TransactionType.Create, "isTransactionTypeCreate");
3807
3834
 
3808
3835
  // src/providers/resource-cache.ts
3809
3836
  var cache = /* @__PURE__ */ new Map();
3810
3837
  var ResourceCache = class {
3838
+ static {
3839
+ __name(this, "ResourceCache");
3840
+ }
3811
3841
  ttl;
3812
3842
  constructor(ttl) {
3813
3843
  this.ttl = ttl;
3814
3844
  if (typeof ttl !== "number" || this.ttl <= 0) {
3815
- throw new import_errors15.FuelError(
3816
- import_errors15.ErrorCode.INVALID_TTL,
3845
+ throw new import_errors14.FuelError(
3846
+ import_errors14.ErrorCode.INVALID_TTL,
3817
3847
  `Invalid TTL: ${this.ttl}. Use a value greater than zero.`
3818
3848
  );
3819
3849
  }
@@ -3897,7 +3927,7 @@ var ResourceCache = class {
3897
3927
  };
3898
3928
 
3899
3929
  // src/providers/transaction-response/transaction-response.ts
3900
- var import_errors19 = require("@fuel-ts/errors");
3930
+ var import_errors18 = require("@fuel-ts/errors");
3901
3931
  var import_math18 = require("@fuel-ts/math");
3902
3932
  var import_transactions22 = require("@fuel-ts/transactions");
3903
3933
  var import_utils27 = require("@fuel-ts/utils");
@@ -3911,7 +3941,7 @@ var import_utils25 = require("@fuel-ts/utils");
3911
3941
  var import_math13 = require("@fuel-ts/math");
3912
3942
  var import_transactions15 = require("@fuel-ts/transactions");
3913
3943
  var import_utils24 = require("@fuel-ts/utils");
3914
- var calculateTXFeeForSummary = (params) => {
3944
+ var calculateTXFeeForSummary = /* @__PURE__ */ __name((params) => {
3915
3945
  const {
3916
3946
  gasPrice,
3917
3947
  rawPayload,
@@ -3971,43 +4001,51 @@ var calculateTXFeeForSummary = (params) => {
3971
4001
  tip
3972
4002
  });
3973
4003
  return maxFee;
3974
- };
4004
+ }, "calculateTXFeeForSummary");
3975
4005
 
3976
4006
  // src/providers/transaction-summary/operations.ts
3977
4007
  var import_configs11 = require("@fuel-ts/address/configs");
3978
- var import_errors17 = require("@fuel-ts/errors");
4008
+ var import_errors16 = require("@fuel-ts/errors");
3979
4009
  var import_math15 = require("@fuel-ts/math");
3980
4010
  var import_transactions18 = require("@fuel-ts/transactions");
3981
4011
 
3982
4012
  // src/providers/transaction-summary/input.ts
3983
- var import_errors16 = require("@fuel-ts/errors");
4013
+ var import_errors15 = require("@fuel-ts/errors");
3984
4014
  var import_math14 = require("@fuel-ts/math");
3985
4015
  var import_transactions16 = require("@fuel-ts/transactions");
3986
4016
  function getInputsByTypes(inputs, types) {
3987
4017
  return inputs.filter((i) => types.includes(i.type));
3988
4018
  }
4019
+ __name(getInputsByTypes, "getInputsByTypes");
3989
4020
  function getInputsByType(inputs, type) {
3990
4021
  return inputs.filter((i) => i.type === type);
3991
4022
  }
4023
+ __name(getInputsByType, "getInputsByType");
3992
4024
  function getInputsCoin(inputs) {
3993
4025
  return getInputsByType(inputs, import_transactions16.InputType.Coin);
3994
4026
  }
4027
+ __name(getInputsCoin, "getInputsCoin");
3995
4028
  function getInputsMessage(inputs) {
3996
4029
  return getInputsByType(inputs, import_transactions16.InputType.Message);
3997
4030
  }
4031
+ __name(getInputsMessage, "getInputsMessage");
3998
4032
  function getInputsCoinAndMessage(inputs) {
3999
4033
  return getInputsByTypes(inputs, [import_transactions16.InputType.Coin, import_transactions16.InputType.Message]);
4000
4034
  }
4035
+ __name(getInputsCoinAndMessage, "getInputsCoinAndMessage");
4001
4036
  function isInputCoin(input) {
4002
4037
  return input.type === import_transactions16.InputType.Coin;
4003
4038
  }
4039
+ __name(isInputCoin, "isInputCoin");
4004
4040
  function getInputsContract(inputs) {
4005
4041
  return getInputsByType(inputs, import_transactions16.InputType.Contract);
4006
4042
  }
4043
+ __name(getInputsContract, "getInputsContract");
4007
4044
  function findCoinInput(inputs, assetId) {
4008
4045
  const coinInputs = getInputsCoin(inputs);
4009
4046
  return coinInputs.find((i) => i.assetId === assetId);
4010
4047
  }
4048
+ __name(findCoinInput, "findCoinInput");
4011
4049
  function aggregateInputsAmountsByAssetAndOwner(inputs, baseAssetId) {
4012
4050
  const aggregated = /* @__PURE__ */ new Map();
4013
4051
  getInputsCoinAndMessage(inputs).forEach((input) => {
@@ -4027,9 +4065,11 @@ function aggregateInputsAmountsByAssetAndOwner(inputs, baseAssetId) {
4027
4065
  });
4028
4066
  return aggregated;
4029
4067
  }
4068
+ __name(aggregateInputsAmountsByAssetAndOwner, "aggregateInputsAmountsByAssetAndOwner");
4030
4069
  function findMessageInput(inputs) {
4031
4070
  return getInputsMessage(inputs)?.[0];
4032
4071
  }
4072
+ __name(findMessageInput, "findMessageInput");
4033
4073
  function getInputFromAssetId(inputs, assetId, isBaseAsset = false) {
4034
4074
  const coinInput = findCoinInput(inputs, assetId);
4035
4075
  if (coinInput) {
@@ -4040,6 +4080,7 @@ function getInputFromAssetId(inputs, assetId, isBaseAsset = false) {
4040
4080
  }
4041
4081
  return void 0;
4042
4082
  }
4083
+ __name(getInputFromAssetId, "getInputFromAssetId");
4043
4084
  function getInputContractFromIndex(inputs, inputIndex) {
4044
4085
  if (inputIndex == null) {
4045
4086
  return void 0;
@@ -4049,13 +4090,14 @@ function getInputContractFromIndex(inputs, inputIndex) {
4049
4090
  return void 0;
4050
4091
  }
4051
4092
  if (contractInput.type !== import_transactions16.InputType.Contract) {
4052
- throw new import_errors16.FuelError(
4053
- import_errors16.ErrorCode.INVALID_TRANSACTION_INPUT,
4093
+ throw new import_errors15.FuelError(
4094
+ import_errors15.ErrorCode.INVALID_TRANSACTION_INPUT,
4054
4095
  `Contract input should be of type 'contract'.`
4055
4096
  );
4056
4097
  }
4057
4098
  return contractInput;
4058
4099
  }
4100
+ __name(getInputContractFromIndex, "getInputContractFromIndex");
4059
4101
  function getInputAccountAddress(input) {
4060
4102
  if (input.type === import_transactions16.InputType.Coin) {
4061
4103
  return input.owner.toString();
@@ -4065,29 +4107,36 @@ function getInputAccountAddress(input) {
4065
4107
  }
4066
4108
  return "";
4067
4109
  }
4110
+ __name(getInputAccountAddress, "getInputAccountAddress");
4068
4111
 
4069
4112
  // src/providers/transaction-summary/output.ts
4070
4113
  var import_transactions17 = require("@fuel-ts/transactions");
4071
4114
  function getOutputsByType(outputs, type) {
4072
4115
  return outputs.filter((o) => o.type === type);
4073
4116
  }
4117
+ __name(getOutputsByType, "getOutputsByType");
4074
4118
  function getOutputsContractCreated(outputs) {
4075
4119
  return getOutputsByType(outputs, import_transactions17.OutputType.ContractCreated);
4076
4120
  }
4121
+ __name(getOutputsContractCreated, "getOutputsContractCreated");
4077
4122
  function getOutputsCoin(outputs) {
4078
4123
  return getOutputsByType(outputs, import_transactions17.OutputType.Coin);
4079
4124
  }
4125
+ __name(getOutputsCoin, "getOutputsCoin");
4080
4126
  function getOutputsChange(outputs) {
4081
4127
  return getOutputsByType(outputs, import_transactions17.OutputType.Change);
4082
4128
  }
4129
+ __name(getOutputsChange, "getOutputsChange");
4083
4130
  function getOutputsContract(outputs) {
4084
4131
  return getOutputsByType(outputs, import_transactions17.OutputType.Contract);
4085
4132
  }
4133
+ __name(getOutputsContract, "getOutputsContract");
4086
4134
 
4087
4135
  // src/providers/transaction-summary/operations.ts
4088
4136
  function getReceiptsByType(receipts, type) {
4089
4137
  return (receipts ?? []).filter((r) => r.type === type);
4090
4138
  }
4139
+ __name(getReceiptsByType, "getReceiptsByType");
4091
4140
  function getTransactionTypeName(transactionType) {
4092
4141
  switch (transactionType) {
4093
4142
  case import_transactions18.TransactionType.Mint:
@@ -4103,40 +4152,50 @@ function getTransactionTypeName(transactionType) {
4103
4152
  case import_transactions18.TransactionType.Upload:
4104
4153
  return "Upload" /* Upload */;
4105
4154
  default:
4106
- throw new import_errors17.FuelError(
4107
- import_errors17.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
4155
+ throw new import_errors16.FuelError(
4156
+ import_errors16.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
4108
4157
  `Unsupported transaction type: ${transactionType}.`
4109
4158
  );
4110
4159
  }
4111
4160
  }
4161
+ __name(getTransactionTypeName, "getTransactionTypeName");
4112
4162
  function isType(transactionType, type) {
4113
4163
  const txType = getTransactionTypeName(transactionType);
4114
4164
  return txType === type;
4115
4165
  }
4166
+ __name(isType, "isType");
4116
4167
  function isTypeMint(transactionType) {
4117
4168
  return isType(transactionType, "Mint" /* Mint */);
4118
4169
  }
4170
+ __name(isTypeMint, "isTypeMint");
4119
4171
  function isTypeCreate(transactionType) {
4120
4172
  return isType(transactionType, "Create" /* Create */);
4121
4173
  }
4174
+ __name(isTypeCreate, "isTypeCreate");
4122
4175
  function isTypeScript(transactionType) {
4123
4176
  return isType(transactionType, "Script" /* Script */);
4124
4177
  }
4178
+ __name(isTypeScript, "isTypeScript");
4125
4179
  function isTypeUpgrade(transactionType) {
4126
4180
  return isType(transactionType, "Upgrade" /* Upgrade */);
4127
4181
  }
4182
+ __name(isTypeUpgrade, "isTypeUpgrade");
4128
4183
  function isTypeUpload(transactionType) {
4129
4184
  return isType(transactionType, "Upload" /* Upload */);
4130
4185
  }
4186
+ __name(isTypeUpload, "isTypeUpload");
4131
4187
  function isTypeBlob(transactionType) {
4132
4188
  return isType(transactionType, "Blob" /* Blob */);
4133
4189
  }
4190
+ __name(isTypeBlob, "isTypeBlob");
4134
4191
  function getReceiptsCall(receipts) {
4135
4192
  return getReceiptsByType(receipts, import_transactions18.ReceiptType.Call);
4136
4193
  }
4194
+ __name(getReceiptsCall, "getReceiptsCall");
4137
4195
  function getReceiptsMessageOut(receipts) {
4138
4196
  return getReceiptsByType(receipts, import_transactions18.ReceiptType.MessageOut);
4139
4197
  }
4198
+ __name(getReceiptsMessageOut, "getReceiptsMessageOut");
4140
4199
  function mergeAssets(op1, op2) {
4141
4200
  const assets1 = op1.assetsSent || [];
4142
4201
  const assets2 = op2.assetsSent || [];
@@ -4154,21 +4213,25 @@ function mergeAssets(op1, op2) {
4154
4213
  });
4155
4214
  return Array.from(assetMap.values());
4156
4215
  }
4216
+ __name(mergeAssets, "mergeAssets");
4157
4217
  function isSameOperation(a, b) {
4158
4218
  return a.name === b.name && a.from?.address === b.from?.address && a.to?.address === b.to?.address && a.from?.type === b.from?.type && a.to?.type === b.to?.type;
4159
4219
  }
4220
+ __name(isSameOperation, "isSameOperation");
4160
4221
  function mergeAssetsSent(existing, toAdd) {
4161
4222
  if (!toAdd.assetsSent?.length) {
4162
4223
  return existing.assetsSent;
4163
4224
  }
4164
4225
  return existing.assetsSent?.length ? mergeAssets(existing, toAdd) : toAdd.assetsSent;
4165
4226
  }
4227
+ __name(mergeAssetsSent, "mergeAssetsSent");
4166
4228
  function mergeCalls(existing, toAdd) {
4167
4229
  if (!toAdd.calls?.length) {
4168
4230
  return existing.calls;
4169
4231
  }
4170
4232
  return [...existing.calls || [], ...toAdd.calls];
4171
4233
  }
4234
+ __name(mergeCalls, "mergeCalls");
4172
4235
  function mergeOperations(existing, toAdd) {
4173
4236
  return {
4174
4237
  ...existing,
@@ -4180,6 +4243,7 @@ function mergeOperations(existing, toAdd) {
4180
4243
  ]
4181
4244
  };
4182
4245
  }
4246
+ __name(mergeOperations, "mergeOperations");
4183
4247
  function addOperation(operations, toAdd) {
4184
4248
  const existingIndex = operations.findIndex((op) => isSameOperation(op, toAdd));
4185
4249
  if (existingIndex === -1) {
@@ -4187,6 +4251,7 @@ function addOperation(operations, toAdd) {
4187
4251
  }
4188
4252
  return operations.map((op, index) => index === existingIndex ? mergeOperations(op, toAdd) : op);
4189
4253
  }
4254
+ __name(addOperation, "addOperation");
4190
4255
  function getWithdrawFromFuelOperations({
4191
4256
  inputs,
4192
4257
  receipts,
@@ -4225,6 +4290,7 @@ function getWithdrawFromFuelOperations({
4225
4290
  );
4226
4291
  return withdrawFromFuelOperations;
4227
4292
  }
4293
+ __name(getWithdrawFromFuelOperations, "getWithdrawFromFuelOperations");
4228
4294
  function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInputs) {
4229
4295
  const abi = abiMap?.[contractInput.contractID];
4230
4296
  if (!abi) {
@@ -4232,6 +4298,7 @@ function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInpu
4232
4298
  }
4233
4299
  return [];
4234
4300
  }
4301
+ __name(getContractCalls, "getContractCalls");
4235
4302
  function getAssetsSent(receipt) {
4236
4303
  return receipt.amount?.isZero() ? void 0 : [
4237
4304
  {
@@ -4240,6 +4307,7 @@ function getAssetsSent(receipt) {
4240
4307
  }
4241
4308
  ];
4242
4309
  }
4310
+ __name(getAssetsSent, "getAssetsSent");
4243
4311
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
4244
4312
  const assetId = receipt.assetId === import_configs11.ZeroBytes32 ? baseAssetId : receipt.assetId;
4245
4313
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
@@ -4265,6 +4333,7 @@ function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload,
4265
4333
  }
4266
4334
  ];
4267
4335
  }
4336
+ __name(processCallReceipt, "processCallReceipt");
4268
4337
  function getContractCallOperations({
4269
4338
  inputs,
4270
4339
  outputs,
@@ -4294,6 +4363,7 @@ function getContractCallOperations({
4294
4363
  );
4295
4364
  });
4296
4365
  }
4366
+ __name(getContractCallOperations, "getContractCallOperations");
4297
4367
  function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs) {
4298
4368
  const { to: toAddress, assetId, amount } = receipt;
4299
4369
  let { id: fromAddress } = receipt;
@@ -4322,6 +4392,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
4322
4392
  receipts: [receipt]
4323
4393
  };
4324
4394
  }
4395
+ __name(extractTransferOperationFromReceipt, "extractTransferOperationFromReceipt");
4325
4396
  function getTransferOperations({
4326
4397
  inputs,
4327
4398
  outputs,
@@ -4376,6 +4447,7 @@ function getTransferOperations({
4376
4447
  });
4377
4448
  return operations;
4378
4449
  }
4450
+ __name(getTransferOperations, "getTransferOperations");
4379
4451
  function getPayProducerOperations(outputs) {
4380
4452
  const coinOutputs = getOutputsCoin(outputs);
4381
4453
  const payProducerOperations = coinOutputs.reduce((prev, output) => {
@@ -4400,6 +4472,7 @@ function getPayProducerOperations(outputs) {
4400
4472
  }, []);
4401
4473
  return payProducerOperations;
4402
4474
  }
4475
+ __name(getPayProducerOperations, "getPayProducerOperations");
4403
4476
  function getContractCreatedOperations({ inputs, outputs }) {
4404
4477
  const contractCreatedOutputs = getOutputsContractCreated(outputs);
4405
4478
  const input = getInputsCoinAndMessage(inputs)[0];
@@ -4420,6 +4493,7 @@ function getContractCreatedOperations({ inputs, outputs }) {
4420
4493
  }, []);
4421
4494
  return contractCreatedOperations;
4422
4495
  }
4496
+ __name(getContractCreatedOperations, "getContractCreatedOperations");
4423
4497
  function getOperations({
4424
4498
  transactionType,
4425
4499
  inputs,
@@ -4450,10 +4524,11 @@ function getOperations({
4450
4524
  }
4451
4525
  return [...getPayProducerOperations(outputs)];
4452
4526
  }
4527
+ __name(getOperations, "getOperations");
4453
4528
 
4454
4529
  // src/providers/transaction-summary/receipt.ts
4455
4530
  var import_transactions19 = require("@fuel-ts/transactions");
4456
- var extractMintedAssetsFromReceipts = (receipts) => {
4531
+ var extractMintedAssetsFromReceipts = /* @__PURE__ */ __name((receipts) => {
4457
4532
  const mintedAssets = [];
4458
4533
  receipts.forEach((receipt) => {
4459
4534
  if (receipt.type === import_transactions19.ReceiptType.Mint) {
@@ -4466,8 +4541,8 @@ var extractMintedAssetsFromReceipts = (receipts) => {
4466
4541
  }
4467
4542
  });
4468
4543
  return mintedAssets;
4469
- };
4470
- var extractBurnedAssetsFromReceipts = (receipts) => {
4544
+ }, "extractMintedAssetsFromReceipts");
4545
+ var extractBurnedAssetsFromReceipts = /* @__PURE__ */ __name((receipts) => {
4471
4546
  const burnedAssets = [];
4472
4547
  receipts.forEach((receipt) => {
4473
4548
  if (receipt.type === import_transactions19.ReceiptType.Burn) {
@@ -4480,12 +4555,12 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
4480
4555
  }
4481
4556
  });
4482
4557
  return burnedAssets;
4483
- };
4558
+ }, "extractBurnedAssetsFromReceipts");
4484
4559
 
4485
4560
  // src/providers/transaction-summary/status.ts
4486
- var import_errors18 = require("@fuel-ts/errors");
4561
+ var import_errors17 = require("@fuel-ts/errors");
4487
4562
  var import_math16 = require("@fuel-ts/math");
4488
- var getTransactionStatusName = (gqlStatus) => {
4563
+ var getTransactionStatusName = /* @__PURE__ */ __name((gqlStatus) => {
4489
4564
  switch (gqlStatus) {
4490
4565
  case "FailureStatus":
4491
4566
  return "failure" /* failure */;
@@ -4496,13 +4571,13 @@ var getTransactionStatusName = (gqlStatus) => {
4496
4571
  case "SqueezedOutStatus":
4497
4572
  return "squeezedout" /* squeezedout */;
4498
4573
  default:
4499
- throw new import_errors18.FuelError(
4500
- import_errors18.ErrorCode.INVALID_TRANSACTION_STATUS,
4574
+ throw new import_errors17.FuelError(
4575
+ import_errors17.ErrorCode.INVALID_TRANSACTION_STATUS,
4501
4576
  `Invalid transaction status: ${gqlStatus}.`
4502
4577
  );
4503
4578
  }
4504
- };
4505
- var processGraphqlStatus = (gqlTransactionStatus) => {
4579
+ }, "getTransactionStatusName");
4580
+ var processGraphqlStatus = /* @__PURE__ */ __name((gqlTransactionStatus) => {
4506
4581
  let time;
4507
4582
  let blockId;
4508
4583
  let status;
@@ -4546,8 +4621,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
4546
4621
  isStatusPending
4547
4622
  };
4548
4623
  return processedGraphqlStatus;
4549
- };
4550
- var getTotalFeeFromStatus = (status) => status && "totalFee" in status ? (0, import_math16.bn)(status.totalFee) : void 0;
4624
+ }, "processGraphqlStatus");
4625
+ var getTotalFeeFromStatus = /* @__PURE__ */ __name((status) => status && "totalFee" in status ? (0, import_math16.bn)(status.totalFee) : void 0, "getTotalFeeFromStatus");
4551
4626
 
4552
4627
  // src/providers/transaction-summary/assemble-transaction-summary.ts
4553
4628
  function assembleTransactionSummary(params) {
@@ -4627,12 +4702,14 @@ function assembleTransactionSummary(params) {
4627
4702
  };
4628
4703
  return transactionSummary;
4629
4704
  }
4705
+ __name(assembleTransactionSummary, "assembleTransactionSummary");
4630
4706
 
4631
- // src/providers/transaction-response/getDecodedLogs.ts
4707
+ // src/providers/transaction-response/getAllDecodedLogs.ts
4632
4708
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
4633
4709
  var import_configs12 = require("@fuel-ts/address/configs");
4634
4710
  var import_transactions21 = require("@fuel-ts/transactions");
4635
- function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
4711
+ function getAllDecodedLogs(opts) {
4712
+ const { receipts, mainAbi, externalAbis = {} } = opts;
4636
4713
  let mainContract = "";
4637
4714
  if (mainAbi.programType === "contract") {
4638
4715
  const firstCallReceipt = receipts.find(
@@ -4640,20 +4717,25 @@ function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
4640
4717
  );
4641
4718
  mainContract = firstCallReceipt.to;
4642
4719
  }
4643
- return receipts.reduce((logs, receipt) => {
4644
- if (receipt.type === import_transactions21.ReceiptType.LogData || receipt.type === import_transactions21.ReceiptType.Log) {
4645
- const isLogFromMainAbi = receipt.id === import_configs12.ZeroBytes32 || mainContract === receipt.id;
4646
- const isDecodable = isLogFromMainAbi || externalAbis[receipt.id];
4647
- if (isDecodable) {
4648
- const interfaceToUse = isLogFromMainAbi ? new import_abi_coder5.Interface(mainAbi) : new import_abi_coder5.Interface(externalAbis[receipt.id]);
4649
- const data = receipt.type === import_transactions21.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
4650
- const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
4651
- logs.push(decodedLog);
4720
+ return receipts.reduce(
4721
+ ({ logs, groupedLogs }, receipt) => {
4722
+ if (receipt.type === import_transactions21.ReceiptType.LogData || receipt.type === import_transactions21.ReceiptType.Log) {
4723
+ const isLogFromMainAbi = receipt.id === import_configs12.ZeroBytes32 || mainContract === receipt.id;
4724
+ const isDecodable = isLogFromMainAbi || externalAbis[receipt.id];
4725
+ if (isDecodable) {
4726
+ const interfaceToUse = isLogFromMainAbi ? new import_abi_coder5.Interface(mainAbi) : new import_abi_coder5.Interface(externalAbis[receipt.id]);
4727
+ const data = receipt.type === import_transactions21.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
4728
+ const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
4729
+ logs.push(decodedLog);
4730
+ groupedLogs[receipt.id] = [...groupedLogs[receipt.id] || [], decodedLog];
4731
+ }
4652
4732
  }
4653
- }
4654
- return logs;
4655
- }, []);
4733
+ return { logs, groupedLogs };
4734
+ },
4735
+ { logs: [], groupedLogs: {} }
4736
+ );
4656
4737
  }
4738
+ __name(getAllDecodedLogs, "getAllDecodedLogs");
4657
4739
 
4658
4740
  // src/providers/transaction-response/transaction-response.ts
4659
4741
  function mapGqlOutputsToTxOutputs(outputs) {
@@ -4686,7 +4768,8 @@ function mapGqlOutputsToTxOutputs(outputs) {
4686
4768
  }
4687
4769
  });
4688
4770
  }
4689
- var TransactionResponse = class {
4771
+ __name(mapGqlOutputsToTxOutputs, "mapGqlOutputsToTxOutputs");
4772
+ var TransactionResponse = class _TransactionResponse {
4690
4773
  /**
4691
4774
  * Constructor for `TransactionResponse`.
4692
4775
  *
@@ -4701,6 +4784,9 @@ var TransactionResponse = class {
4701
4784
  this.request = typeof tx === "string" ? void 0 : tx;
4702
4785
  this.waitForResult = this.waitForResult.bind(this);
4703
4786
  }
4787
+ static {
4788
+ __name(this, "TransactionResponse");
4789
+ }
4704
4790
  /** Transaction ID */
4705
4791
  id;
4706
4792
  /** Current provider */
@@ -4722,7 +4808,7 @@ var TransactionResponse = class {
4722
4808
  */
4723
4809
  static async create(id, provider, abis) {
4724
4810
  const chainId = await provider.getChainId();
4725
- const response = new TransactionResponse(id, provider, chainId, abis);
4811
+ const response = new _TransactionResponse(id, provider, chainId, abis);
4726
4812
  await response.fetch();
4727
4813
  return response;
4728
4814
  }
@@ -4854,8 +4940,8 @@ var TransactionResponse = class {
4854
4940
  this.status = statusChange;
4855
4941
  if (statusChange.type === "SqueezedOutStatus") {
4856
4942
  this.unsetResourceCache();
4857
- throw new import_errors19.FuelError(
4858
- import_errors19.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4943
+ throw new import_errors18.FuelError(
4944
+ import_errors18.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4859
4945
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
4860
4946
  );
4861
4947
  }
@@ -4881,14 +4967,15 @@ var TransactionResponse = class {
4881
4967
  const transactionResult = {
4882
4968
  ...transactionSummary
4883
4969
  };
4884
- let logs = [];
4970
+ let { logs, groupedLogs } = { logs: [], groupedLogs: {} };
4885
4971
  if (this.abis) {
4886
- logs = getDecodedLogs(
4887
- transactionSummary.receipts,
4888
- this.abis.main,
4889
- this.abis.otherContractsAbis
4890
- );
4972
+ ({ logs, groupedLogs } = getAllDecodedLogs({
4973
+ receipts: transactionSummary.receipts,
4974
+ mainAbi: this.abis.main,
4975
+ externalAbis: this.abis.otherContractsAbis
4976
+ }));
4891
4977
  transactionResult.logs = logs;
4978
+ transactionResult.groupedLogs = groupedLogs;
4892
4979
  }
4893
4980
  const { receipts } = transactionResult;
4894
4981
  const status = this.status ?? this.gqlTransaction?.status;
@@ -4897,7 +4984,8 @@ var TransactionResponse = class {
4897
4984
  throw extractTxError({
4898
4985
  receipts,
4899
4986
  statusReason: reason,
4900
- logs
4987
+ logs,
4988
+ groupedLogs
4901
4989
  });
4902
4990
  }
4903
4991
  return transactionResult;
@@ -4925,6 +5013,11 @@ var TransactionResponse = class {
4925
5013
  }
4926
5014
  };
4927
5015
 
5016
+ // src/providers/transaction-response/getDecodedLogs.ts
5017
+ var import_abi_coder6 = require("@fuel-ts/abi-coder");
5018
+ var import_configs13 = require("@fuel-ts/address/configs");
5019
+ var import_transactions23 = require("@fuel-ts/transactions");
5020
+
4928
5021
  // src/providers/utils/auto-retry-fetch.ts
4929
5022
  var import_utils29 = require("@fuel-ts/utils");
4930
5023
  function getWaitDelay(options, retryAttemptNum) {
@@ -4939,6 +5032,7 @@ function getWaitDelay(options, retryAttemptNum) {
4939
5032
  return 2 ** (retryAttemptNum - 1) * duration;
4940
5033
  }
4941
5034
  }
5035
+ __name(getWaitDelay, "getWaitDelay");
4942
5036
  function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4943
5037
  if (options === void 0) {
4944
5038
  return fetchFn;
@@ -4961,9 +5055,10 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4961
5055
  }
4962
5056
  };
4963
5057
  }
5058
+ __name(autoRetryFetch, "autoRetryFetch");
4964
5059
 
4965
5060
  // src/providers/utils/helpers.ts
4966
- var adjustResourcesToExclude = (params) => {
5061
+ var adjustResourcesToExclude = /* @__PURE__ */ __name((params) => {
4967
5062
  const { userInput, cached, maxInputs } = params;
4968
5063
  const final = { ...userInput };
4969
5064
  let total = final.utxos.length + final.messages.length;
@@ -4976,34 +5071,34 @@ var adjustResourcesToExclude = (params) => {
4976
5071
  final.messages = [...final.messages, ...cached.messages.slice(0, maxInputs - total)];
4977
5072
  }
4978
5073
  return final;
4979
- };
5074
+ }, "adjustResourcesToExclude");
4980
5075
 
4981
5076
  // src/providers/utils/validate-pagination-args.ts
4982
- var import_errors20 = require("@fuel-ts/errors");
4983
- var validatePaginationArgs = (params) => {
5077
+ var import_errors19 = require("@fuel-ts/errors");
5078
+ var validatePaginationArgs = /* @__PURE__ */ __name((params) => {
4984
5079
  const { paginationLimit, inputArgs = {} } = params;
4985
5080
  const { first, last, after, before } = inputArgs;
4986
5081
  if (after && before) {
4987
- throw new import_errors20.FuelError(
4988
- import_errors20.ErrorCode.INVALID_INPUT_PARAMETERS,
5082
+ throw new import_errors19.FuelError(
5083
+ import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
4989
5084
  'Pagination arguments "after" and "before" cannot be used together'
4990
5085
  );
4991
5086
  }
4992
5087
  if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
4993
- throw new import_errors20.FuelError(
4994
- import_errors20.ErrorCode.INVALID_INPUT_PARAMETERS,
5088
+ throw new import_errors19.FuelError(
5089
+ import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
4995
5090
  `Pagination limit for this query cannot exceed ${paginationLimit} items`
4996
5091
  );
4997
5092
  }
4998
5093
  if (first && before) {
4999
- throw new import_errors20.FuelError(
5000
- import_errors20.ErrorCode.INVALID_INPUT_PARAMETERS,
5094
+ throw new import_errors19.FuelError(
5095
+ import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
5001
5096
  'The use of pagination argument "first" with "before" is not supported'
5002
5097
  );
5003
5098
  }
5004
5099
  if (last && after) {
5005
- throw new import_errors20.FuelError(
5006
- import_errors20.ErrorCode.INVALID_INPUT_PARAMETERS,
5100
+ throw new import_errors19.FuelError(
5101
+ import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
5007
5102
  'The use of pagination argument "last" with "after" is not supported'
5008
5103
  );
5009
5104
  }
@@ -5011,18 +5106,71 @@ var validatePaginationArgs = (params) => {
5011
5106
  inputArgs.first = paginationLimit;
5012
5107
  }
5013
5108
  return inputArgs;
5014
- };
5109
+ }, "validatePaginationArgs");
5015
5110
 
5016
5111
  // src/providers/provider.ts
5017
5112
  var MAX_RETRIES = 10;
5018
5113
  var RESOURCES_PAGE_SIZE_LIMIT = 512;
5019
5114
  var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
5020
5115
  var BALANCES_PAGE_SIZE_LIMIT = 100;
5116
+ var NON_PAGINATED_BALANCES_SIZE = 1e4;
5021
5117
  var BLOCKS_PAGE_SIZE_LIMIT = 5;
5022
5118
  var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
5023
5119
  var GAS_USED_MODIFIER = 1.2;
5024
- var _cacheInputs, cacheInputs_fn;
5025
- var _Provider = class {
5120
+ var Provider = class _Provider {
5121
+ static {
5122
+ __name(this, "Provider");
5123
+ }
5124
+ operations;
5125
+ cache;
5126
+ /** @hidden */
5127
+ static clearChainAndNodeCaches() {
5128
+ _Provider.inflightFetchChainAndNodeInfoRequests = {};
5129
+ _Provider.nodeInfoCache = {};
5130
+ _Provider.chainInfoCache = {};
5131
+ }
5132
+ /** @hidden */
5133
+ url;
5134
+ /** @hidden */
5135
+ urlWithoutAuth;
5136
+ /** @hidden */
5137
+ static inflightFetchChainAndNodeInfoRequests = {};
5138
+ /** @hidden */
5139
+ static chainInfoCache = {};
5140
+ /** @hidden */
5141
+ static nodeInfoCache = {};
5142
+ /** @hidden */
5143
+ static incompatibleNodeVersionMessage = "";
5144
+ /** @hidden */
5145
+ consensusParametersTimestamp;
5146
+ options = {
5147
+ timeout: void 0,
5148
+ resourceCacheTTL: void 0,
5149
+ fetch: void 0,
5150
+ retryOptions: void 0,
5151
+ headers: void 0,
5152
+ cache: void 0
5153
+ };
5154
+ /**
5155
+ * @hidden
5156
+ */
5157
+ static getFetchFn(options) {
5158
+ const { retryOptions, timeout, headers } = options;
5159
+ return autoRetryFetch(async (...args) => {
5160
+ const url = args[0];
5161
+ const request = args[1];
5162
+ const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
5163
+ let fullRequest = {
5164
+ ...request,
5165
+ signal,
5166
+ headers: { ...request?.headers, ...headers }
5167
+ };
5168
+ if (options.requestMiddleware) {
5169
+ fullRequest = await options.requestMiddleware(fullRequest);
5170
+ }
5171
+ return options.fetch ? options.fetch(url, fullRequest, options) : fetch(url, fullRequest);
5172
+ }, retryOptions);
5173
+ }
5026
5174
  /**
5027
5175
  * Constructor to initialize a Provider.
5028
5176
  *
@@ -5031,31 +5179,6 @@ var _Provider = class {
5031
5179
  * @hidden
5032
5180
  */
5033
5181
  constructor(url, options = {}) {
5034
- /**
5035
- * @hidden
5036
- */
5037
- __privateAdd(this, _cacheInputs);
5038
- __publicField(this, "operations");
5039
- __publicField(this, "cache");
5040
- /** @hidden */
5041
- __publicField(this, "url");
5042
- /** @hidden */
5043
- __publicField(this, "urlWithoutAuth");
5044
- /** @hidden */
5045
- __publicField(this, "features", {
5046
- balancePagination: false,
5047
- amount128: false
5048
- });
5049
- /** @hidden */
5050
- __publicField(this, "consensusParametersTimestamp");
5051
- __publicField(this, "options", {
5052
- timeout: void 0,
5053
- resourceCacheTTL: void 0,
5054
- fetch: void 0,
5055
- retryOptions: void 0,
5056
- headers: void 0,
5057
- cache: void 0
5058
- });
5059
5182
  const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
5060
5183
  this.url = rawUrl;
5061
5184
  this.urlWithoutAuth = urlWithoutAuth;
@@ -5085,38 +5208,12 @@ var _Provider = class {
5085
5208
  this.cache = new ResourceCache(DEFAULT_RESOURCE_CACHE_TTL);
5086
5209
  }
5087
5210
  }
5088
- /** @hidden */
5089
- static clearChainAndNodeCaches() {
5090
- _Provider.inflightFetchChainAndNodeInfoRequests = {};
5091
- _Provider.nodeInfoCache = {};
5092
- _Provider.chainInfoCache = {};
5093
- }
5094
- /**
5095
- * @hidden
5096
- */
5097
- static getFetchFn(options) {
5098
- const { retryOptions, timeout, headers } = options;
5099
- return autoRetryFetch(async (...args) => {
5100
- const url = args[0];
5101
- const request = args[1];
5102
- const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
5103
- let fullRequest = {
5104
- ...request,
5105
- signal,
5106
- headers: { ...request?.headers, ...headers }
5107
- };
5108
- if (options.requestMiddleware) {
5109
- fullRequest = await options.requestMiddleware(fullRequest);
5110
- }
5111
- return options.fetch ? options.fetch(url, fullRequest, options) : fetch(url, fullRequest);
5112
- }, retryOptions);
5113
- }
5114
5211
  static extractBasicAuth(url) {
5115
5212
  let parsedUrl;
5116
5213
  try {
5117
5214
  parsedUrl = new URL(url);
5118
5215
  } catch (error) {
5119
- throw new import_errors21.FuelError(import_errors21.FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
5216
+ throw new import_errors20.FuelError(import_errors20.FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
5120
5217
  }
5121
5218
  const username = parsedUrl.username;
5122
5219
  const password = parsedUrl.password;
@@ -5134,8 +5231,7 @@ var _Provider = class {
5134
5231
  * Initialize Provider async stuff
5135
5232
  */
5136
5233
  async init() {
5137
- const { nodeInfo } = await this.fetchChainAndNodeInfo();
5138
- this.setupFeatures(nodeInfo.nodeVersion);
5234
+ await this.fetchChainAndNodeInfo();
5139
5235
  return this;
5140
5236
  }
5141
5237
  /**
@@ -5195,39 +5291,52 @@ var _Provider = class {
5195
5291
  * @returns A promise that resolves to the Chain and NodeInfo.
5196
5292
  */
5197
5293
  async fetchChainAndNodeInfo(ignoreCache = false) {
5198
- let nodeInfo;
5199
- let chain;
5200
- try {
5201
- nodeInfo = _Provider.nodeInfoCache[this.urlWithoutAuth];
5202
- chain = _Provider.chainInfoCache[this.urlWithoutAuth];
5203
- const noCache = !nodeInfo || !chain;
5204
- if (ignoreCache || noCache) {
5205
- throw new Error(`Jumps to the catch block and re-fetch`);
5206
- }
5207
- } catch (_err) {
5208
- const inflightRequest = _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
5209
- if (inflightRequest) {
5210
- const now2 = await inflightRequest;
5211
- this.consensusParametersTimestamp = now2;
5212
- return this.fetchChainAndNodeInfo();
5213
- }
5214
- const { promise, resolve } = deferPromise();
5215
- _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth] = promise;
5216
- const data = await this.operations.getChainAndNodeInfo();
5217
- nodeInfo = deserializeNodeInfo(data.nodeInfo);
5218
- chain = deserializeChain(data.chain);
5219
- _Provider.setIncompatibleNodeVersionMessage(nodeInfo);
5220
- _Provider.chainInfoCache[this.urlWithoutAuth] = chain;
5221
- _Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
5222
- const now = Date.now();
5223
- this.consensusParametersTimestamp = now;
5224
- resolve(now);
5225
- delete _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
5294
+ const nodeInfo = _Provider.nodeInfoCache[this.urlWithoutAuth];
5295
+ const chain = _Provider.chainInfoCache[this.urlWithoutAuth];
5296
+ const hasCache = nodeInfo && chain;
5297
+ if (hasCache && !ignoreCache) {
5298
+ return { nodeInfo, chain };
5299
+ }
5300
+ const inflightRequest = _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
5301
+ if (inflightRequest) {
5302
+ return inflightRequest.then((data) => {
5303
+ this.consensusParametersTimestamp = data.consensusParametersTimestamp;
5304
+ return {
5305
+ nodeInfo: _Provider.nodeInfoCache[this.urlWithoutAuth],
5306
+ chain: _Provider.chainInfoCache[this.urlWithoutAuth]
5307
+ };
5308
+ });
5226
5309
  }
5227
- return {
5228
- chain,
5229
- nodeInfo
5230
- };
5310
+ const getChainAndNodeInfoFromNetwork = this.operations.getChainAndNodeInfo().then((data) => ({
5311
+ chain: deserializeChain(data.chain),
5312
+ nodeInfo: deserializeNodeInfo(data.nodeInfo),
5313
+ consensusParametersTimestamp: Date.now()
5314
+ })).then((data) => {
5315
+ _Provider.setIncompatibleNodeVersionMessage(data.nodeInfo);
5316
+ _Provider.chainInfoCache[this.urlWithoutAuth] = data.chain;
5317
+ _Provider.nodeInfoCache[this.urlWithoutAuth] = data.nodeInfo;
5318
+ this.consensusParametersTimestamp = data.consensusParametersTimestamp;
5319
+ return data;
5320
+ }).catch((err) => {
5321
+ const error = new import_errors20.FuelError(
5322
+ import_errors20.FuelError.CODES.CONNECTION_REFUSED,
5323
+ "Unable to fetch chain and node info from the network",
5324
+ { url: this.urlWithoutAuth },
5325
+ err
5326
+ );
5327
+ error.cause = { code: "ECONNREFUSED" };
5328
+ throw error;
5329
+ }).finally(() => {
5330
+ delete _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
5331
+ });
5332
+ _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth] = getChainAndNodeInfoFromNetwork;
5333
+ return _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth].then((data) => {
5334
+ this.consensusParametersTimestamp = data.consensusParametersTimestamp;
5335
+ return {
5336
+ nodeInfo: _Provider.nodeInfoCache[this.urlWithoutAuth],
5337
+ chain: _Provider.chainInfoCache[this.urlWithoutAuth]
5338
+ };
5339
+ });
5231
5340
  }
5232
5341
  /**
5233
5342
  * @hidden
@@ -5252,8 +5361,8 @@ var _Provider = class {
5252
5361
  createOperations() {
5253
5362
  const fetchFn = _Provider.getFetchFn(this.options);
5254
5363
  const gqlClient = new import_graphql_request.GraphQLClient(this.urlWithoutAuth, {
5255
- fetch: (input, requestInit) => fetchFn(input.toString(), requestInit || {}, this.options),
5256
- responseMiddleware: (response) => {
5364
+ fetch: /* @__PURE__ */ __name((input, requestInit) => fetchFn(input.toString(), requestInit || {}, this.options), "fetch"),
5365
+ responseMiddleware: /* @__PURE__ */ __name((response) => {
5257
5366
  if ("response" in response) {
5258
5367
  const graphQlResponse = response.response;
5259
5368
  assertGqlResponseHasNoErrors(
@@ -5261,22 +5370,22 @@ var _Provider = class {
5261
5370
  _Provider.incompatibleNodeVersionMessage
5262
5371
  );
5263
5372
  }
5264
- }
5373
+ }, "responseMiddleware")
5265
5374
  });
5266
- const executeQuery = (query, vars) => {
5375
+ const executeQuery = /* @__PURE__ */ __name((query, vars) => {
5267
5376
  const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
5268
5377
  const isSubscription = opDefinition?.operation === "subscription";
5269
5378
  if (isSubscription) {
5270
5379
  return FuelGraphqlSubscriber.create({
5271
5380
  url: this.urlWithoutAuth,
5272
5381
  query,
5273
- fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
5382
+ fetchFn: /* @__PURE__ */ __name((url, requestInit) => fetchFn(url, requestInit, this.options), "fetchFn"),
5274
5383
  variables: vars
5275
5384
  });
5276
5385
  }
5277
5386
  return gqlClient.request(query, vars);
5278
- };
5279
- const customOperations = (requester) => ({
5387
+ }, "executeQuery");
5388
+ const customOperations = /* @__PURE__ */ __name((requester) => ({
5280
5389
  getBlobs(variables) {
5281
5390
  const queryParams = variables.blobIds.map((_, i) => `$blobId${i}: BlobId!`).join(", ");
5282
5391
  const blobParams = variables.blobIds.map((_, i) => `blob${i}: blob(id: $blobId${i}) { id }`).join("\n");
@@ -5294,18 +5403,9 @@ var _Provider = class {
5294
5403
  `;
5295
5404
  return requester(document, updatedVariables);
5296
5405
  }
5297
- });
5406
+ }), "customOperations");
5298
5407
  return { ...getSdk(executeQuery), ...customOperations(executeQuery) };
5299
5408
  }
5300
- /**
5301
- * @hidden
5302
- */
5303
- setupFeatures(nodeVersion) {
5304
- if ((0, import_versions.gte)(nodeVersion, "0.41.0")) {
5305
- this.features.balancePagination = true;
5306
- this.features.amount128 = true;
5307
- }
5308
- }
5309
5409
  /**
5310
5410
  * Returns the version of the connected node.
5311
5411
  *
@@ -5382,6 +5482,13 @@ var _Provider = class {
5382
5482
  * @returns A promise that resolves to an object containing the asset details.
5383
5483
  */
5384
5484
  async getAssetDetails(assetId) {
5485
+ const { assetMetadata } = await this.getNodeFeatures();
5486
+ if (!assetMetadata) {
5487
+ throw new import_errors20.FuelError(
5488
+ import_errors20.ErrorCode.UNSUPPORTED_FEATURE,
5489
+ "The current node does not supports fetching asset details"
5490
+ );
5491
+ }
5385
5492
  const { assetDetails } = await this.operations.getAssetDetails({ assetId });
5386
5493
  const { contractId, subId, totalSupply } = assetDetails;
5387
5494
  return {
@@ -5390,6 +5497,15 @@ var _Provider = class {
5390
5497
  totalSupply: (0, import_math19.bn)(totalSupply)
5391
5498
  };
5392
5499
  }
5500
+ /**
5501
+ * @hidden
5502
+ */
5503
+ #cacheInputs(inputs, transactionId) {
5504
+ if (!this.cache) {
5505
+ return;
5506
+ }
5507
+ this.cache.set(transactionId, inputs);
5508
+ }
5393
5509
  /**
5394
5510
  * @hidden
5395
5511
  */
@@ -5400,14 +5516,14 @@ var _Provider = class {
5400
5516
  }
5401
5517
  } = await this.getChain();
5402
5518
  if ((0, import_math19.bn)(tx.inputs.length).gt(maxInputs)) {
5403
- throw new import_errors21.FuelError(
5404
- import_errors21.ErrorCode.MAX_INPUTS_EXCEEDED,
5519
+ throw new import_errors20.FuelError(
5520
+ import_errors20.ErrorCode.MAX_INPUTS_EXCEEDED,
5405
5521
  `The transaction exceeds the maximum allowed number of inputs. Tx inputs: ${tx.inputs.length}, max inputs: ${maxInputs}`
5406
5522
  );
5407
5523
  }
5408
5524
  if ((0, import_math19.bn)(tx.outputs.length).gt(maxOutputs)) {
5409
- throw new import_errors21.FuelError(
5410
- import_errors21.ErrorCode.MAX_OUTPUTS_EXCEEDED,
5525
+ throw new import_errors20.FuelError(
5526
+ import_errors20.ErrorCode.MAX_OUTPUTS_EXCEEDED,
5411
5527
  `The transaction exceeds the maximum allowed number of outputs. Tx outputs: ${tx.outputs.length}, max outputs: ${maxOutputs}`
5412
5528
  );
5413
5529
  }
@@ -5439,7 +5555,10 @@ var _Provider = class {
5439
5555
  abis = transactionRequest.abis;
5440
5556
  }
5441
5557
  const subscription = await this.operations.submitAndAwaitStatus({ encodedTransaction });
5442
- __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionRequest.getTransactionId(await this.getChainId()));
5558
+ this.#cacheInputs(
5559
+ transactionRequest.inputs,
5560
+ transactionRequest.getTransactionId(await this.getChainId())
5561
+ );
5443
5562
  const chainId = await this.getChainId();
5444
5563
  return new TransactionResponse(transactionRequest, this, chainId, abis, subscription);
5445
5564
  }
@@ -6085,7 +6204,7 @@ var _Provider = class {
6085
6204
  },
6086
6205
  transactionIds: block.transactions.map((tx) => tx.id),
6087
6206
  transactions: block.transactions.map(
6088
- (tx) => new import_transactions23.TransactionCoder().decode((0, import_utils30.arrayify)(tx.rawPayload), 0)?.[0]
6207
+ (tx) => new import_transactions24.TransactionCoder().decode((0, import_utils30.arrayify)(tx.rawPayload), 0)?.[0]
6089
6208
  )
6090
6209
  };
6091
6210
  }
@@ -6101,12 +6220,12 @@ var _Provider = class {
6101
6220
  return null;
6102
6221
  }
6103
6222
  try {
6104
- return new import_transactions23.TransactionCoder().decode(
6223
+ return new import_transactions24.TransactionCoder().decode(
6105
6224
  (0, import_utils30.arrayify)(transaction.rawPayload),
6106
6225
  0
6107
6226
  )?.[0];
6108
6227
  } catch (error) {
6109
- if (error instanceof import_errors21.FuelError && error.code === import_errors21.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
6228
+ if (error instanceof import_errors20.FuelError && error.code === import_errors20.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
6110
6229
  console.warn("Unsupported transaction type encountered");
6111
6230
  return null;
6112
6231
  }
@@ -6127,12 +6246,12 @@ var _Provider = class {
6127
6246
  paginationLimit: TRANSACTIONS_PAGE_SIZE_LIMIT
6128
6247
  })
6129
6248
  });
6130
- const coder = new import_transactions23.TransactionCoder();
6249
+ const coder = new import_transactions24.TransactionCoder();
6131
6250
  const transactions = edges.map(({ node: { rawPayload } }) => {
6132
6251
  try {
6133
6252
  return coder.decode((0, import_utils30.arrayify)(rawPayload), 0)[0];
6134
6253
  } catch (error) {
6135
- if (error instanceof import_errors21.FuelError && error.code === import_errors21.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
6254
+ if (error instanceof import_errors20.FuelError && error.code === import_errors20.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
6136
6255
  console.warn("Unsupported transaction type encountered");
6137
6256
  return null;
6138
6257
  }
@@ -6191,18 +6310,9 @@ var _Provider = class {
6191
6310
  * @returns A promise that resolves to the balance.
6192
6311
  */
6193
6312
  async getBalance(owner, assetId) {
6194
- const ownerStr = new import_address4.Address(owner).toB256();
6195
- const assetIdStr = (0, import_utils30.hexlify)(assetId);
6196
- if (!this.features.amount128) {
6197
- const { balance: balance2 } = await this.operations.getBalance({
6198
- owner: ownerStr,
6199
- assetId: assetIdStr
6200
- });
6201
- return (0, import_math19.bn)(balance2.amount, 10);
6202
- }
6203
6313
  const { balance } = await this.operations.getBalanceV2({
6204
- owner: ownerStr,
6205
- assetId: assetIdStr
6314
+ owner: new import_address4.Address(owner).toB256(),
6315
+ assetId: (0, import_utils30.hexlify)(assetId)
6206
6316
  });
6207
6317
  return (0, import_math19.bn)(balance.amountU128, 10);
6208
6318
  }
@@ -6214,49 +6324,29 @@ var _Provider = class {
6214
6324
  * @returns A promise that resolves to the balances.
6215
6325
  */
6216
6326
  async getBalances(owner, paginationArgs) {
6217
- if (!this.features.balancePagination) {
6218
- return this.getBalancesV1(owner, paginationArgs);
6327
+ let args = { first: NON_PAGINATED_BALANCES_SIZE };
6328
+ const { balancesPagination: supportsPagination } = await this.getNodeFeatures();
6329
+ if (supportsPagination) {
6330
+ args = validatePaginationArgs({
6331
+ inputArgs: paginationArgs,
6332
+ paginationLimit: BALANCES_PAGE_SIZE_LIMIT
6333
+ });
6219
6334
  }
6220
- return this.getBalancesV2(owner, paginationArgs);
6221
- }
6222
- /**
6223
- * @hidden
6224
- */
6225
- async getBalancesV1(owner, _paginationArgs) {
6226
- const {
6227
- balances: { edges }
6228
- } = await this.operations.getBalances({
6229
- /**
6230
- * The query parameters for this method were designed to support pagination,
6231
- * but the current Fuel-Core implementation does not support pagination yet.
6232
- */
6233
- first: 1e4,
6234
- filter: { owner: new import_address4.Address(owner).toB256() }
6235
- });
6236
- const balances = edges.map(({ node }) => ({
6237
- assetId: node.assetId,
6238
- amount: (0, import_math19.bn)(node.amount)
6239
- }));
6240
- return { balances };
6241
- }
6242
- /**
6243
- * @hidden
6244
- */
6245
- async getBalancesV2(owner, paginationArgs) {
6246
6335
  const {
6247
6336
  balances: { edges, pageInfo }
6248
6337
  } = await this.operations.getBalancesV2({
6249
- ...validatePaginationArgs({
6250
- inputArgs: paginationArgs,
6251
- paginationLimit: BALANCES_PAGE_SIZE_LIMIT
6252
- }),
6253
- filter: { owner: new import_address4.Address(owner).toB256() }
6338
+ ...args,
6339
+ filter: { owner: new import_address4.Address(owner).toB256() },
6340
+ supportsPagination
6254
6341
  });
6255
6342
  const balances = edges.map(({ node }) => ({
6256
6343
  assetId: node.assetId,
6257
6344
  amount: (0, import_math19.bn)(node.amountU128)
6258
6345
  }));
6259
- return { balances, pageInfo };
6346
+ return {
6347
+ balances,
6348
+ ...supportsPagination ? { pageInfo } : {}
6349
+ };
6260
6350
  }
6261
6351
  /**
6262
6352
  * Returns message for the given address.
@@ -6276,7 +6366,7 @@ var _Provider = class {
6276
6366
  owner: new import_address4.Address(address).toB256()
6277
6367
  });
6278
6368
  const messages = edges.map(({ node }) => ({
6279
- messageId: import_transactions23.InputMessageCoder.getMessageId({
6369
+ messageId: import_transactions24.InputMessageCoder.getMessageId({
6280
6370
  sender: node.sender,
6281
6371
  recipient: node.recipient,
6282
6372
  nonce: node.nonce,
@@ -6287,7 +6377,7 @@ var _Provider = class {
6287
6377
  recipient: new import_address4.Address(node.recipient),
6288
6378
  nonce: node.nonce,
6289
6379
  amount: (0, import_math19.bn)(node.amount),
6290
- data: import_transactions23.InputMessageCoder.decodeData(node.data),
6380
+ data: import_transactions24.InputMessageCoder.decodeData(node.data),
6291
6381
  daHeight: (0, import_math19.bn)(node.daHeight)
6292
6382
  }));
6293
6383
  return {
@@ -6310,8 +6400,8 @@ var _Provider = class {
6310
6400
  nonce
6311
6401
  };
6312
6402
  if (commitBlockId && commitBlockHeight) {
6313
- throw new import_errors21.FuelError(
6314
- import_errors21.ErrorCode.INVALID_INPUT_PARAMETERS,
6403
+ throw new import_errors20.FuelError(
6404
+ import_errors20.ErrorCode.INVALID_INPUT_PARAMETERS,
6315
6405
  "commitBlockId and commitBlockHeight cannot be used together"
6316
6406
  );
6317
6407
  }
@@ -6493,7 +6583,7 @@ var _Provider = class {
6493
6583
  return null;
6494
6584
  }
6495
6585
  const message = {
6496
- messageId: import_transactions23.InputMessageCoder.getMessageId({
6586
+ messageId: import_transactions24.InputMessageCoder.getMessageId({
6497
6587
  sender: rawMessage.sender,
6498
6588
  recipient: rawMessage.recipient,
6499
6589
  nonce,
@@ -6504,7 +6594,7 @@ var _Provider = class {
6504
6594
  recipient: new import_address4.Address(rawMessage.recipient),
6505
6595
  nonce,
6506
6596
  amount: (0, import_math19.bn)(rawMessage.amount),
6507
- data: import_transactions23.InputMessageCoder.decodeData(rawMessage.data),
6597
+ data: import_transactions24.InputMessageCoder.decodeData(rawMessage.data),
6508
6598
  daHeight: (0, import_math19.bn)(rawMessage.daHeight)
6509
6599
  };
6510
6600
  return message;
@@ -6530,19 +6620,32 @@ var _Provider = class {
6530
6620
  extractDryRunError(transactionRequest, receipts, dryRunStatus) {
6531
6621
  const status = dryRunStatus;
6532
6622
  let logs = [];
6623
+ let groupedLogs = {};
6533
6624
  if (transactionRequest.abis) {
6534
- logs = getDecodedLogs(
6625
+ ({ logs, groupedLogs } = getAllDecodedLogs({
6535
6626
  receipts,
6536
- transactionRequest.abis.main,
6537
- transactionRequest.abis.otherContractsAbis
6538
- );
6627
+ mainAbi: transactionRequest.abis.main,
6628
+ externalAbis: transactionRequest.abis.otherContractsAbis
6629
+ }));
6539
6630
  }
6540
6631
  return extractTxError({
6541
6632
  logs,
6633
+ groupedLogs,
6542
6634
  receipts,
6543
6635
  statusReason: status.reason
6544
6636
  });
6545
6637
  }
6638
+ /**
6639
+ * @hidden
6640
+ */
6641
+ async getNodeFeatures() {
6642
+ const { indexation } = await this.getNode();
6643
+ return {
6644
+ assetMetadata: Boolean(indexation?.assetMetadata),
6645
+ balancesPagination: Boolean(indexation?.balances),
6646
+ coinsToSpend: Boolean(indexation?.coinsToSpend)
6647
+ };
6648
+ }
6546
6649
  /**
6547
6650
  * @hidden
6548
6651
  */
@@ -6557,41 +6660,34 @@ var _Provider = class {
6557
6660
  return transactionRequest;
6558
6661
  }
6559
6662
  };
6560
- var Provider = _Provider;
6561
- _cacheInputs = new WeakSet();
6562
- cacheInputs_fn = function(inputs, transactionId) {
6563
- if (!this.cache) {
6564
- return;
6565
- }
6566
- this.cache.set(transactionId, inputs);
6567
- };
6568
- /** @hidden */
6569
- __publicField(Provider, "inflightFetchChainAndNodeInfoRequests", {});
6570
- /** @hidden */
6571
- __publicField(Provider, "chainInfoCache", {});
6572
- /** @hidden */
6573
- __publicField(Provider, "nodeInfoCache", {});
6574
- /** @hidden */
6575
- __publicField(Provider, "incompatibleNodeVersionMessage", "");
6576
6663
 
6577
6664
  // src/providers/transaction-summary/get-transaction-summary.ts
6578
- var import_errors22 = require("@fuel-ts/errors");
6665
+ var import_errors21 = require("@fuel-ts/errors");
6579
6666
  var import_math20 = require("@fuel-ts/math");
6580
- var import_transactions24 = require("@fuel-ts/transactions");
6667
+ var import_transactions25 = require("@fuel-ts/transactions");
6581
6668
  var import_utils32 = require("@fuel-ts/utils");
6582
6669
 
6583
6670
  // src/providers/transaction-summary/assemble-transaction-summary-from-serialized.ts
6584
6671
  var import_math21 = require("@fuel-ts/math");
6585
- var import_transactions25 = require("@fuel-ts/transactions");
6672
+ var import_transactions26 = require("@fuel-ts/transactions");
6586
6673
  var import_utils33 = require("@fuel-ts/utils");
6587
6674
 
6588
6675
  // src/test-utils/test-asset-id.ts
6589
6676
  var import_crypto4 = require("@fuel-ts/crypto");
6590
6677
  var import_utils34 = require("@fuel-ts/utils");
6591
- var _TestAssetId = class {
6678
+ var TestAssetId = class _TestAssetId {
6592
6679
  constructor(value) {
6593
6680
  this.value = value;
6594
6681
  }
6682
+ static {
6683
+ __name(this, "TestAssetId");
6684
+ }
6685
+ static A = new _TestAssetId(
6686
+ "0x0101010101010101010101010101010101010101010101010101010101010101"
6687
+ );
6688
+ static B = new _TestAssetId(
6689
+ "0x0202020202020202020202020202020202020202020202020202020202020202"
6690
+ );
6595
6691
  static random(count = 1) {
6596
6692
  const assetIds = [];
6597
6693
  for (let i = 0; i < count; i++) {
@@ -6600,17 +6696,10 @@ var _TestAssetId = class {
6600
6696
  return assetIds;
6601
6697
  }
6602
6698
  };
6603
- var TestAssetId = _TestAssetId;
6604
- __publicField(TestAssetId, "A", new _TestAssetId(
6605
- "0x0101010101010101010101010101010101010101010101010101010101010101"
6606
- ));
6607
- __publicField(TestAssetId, "B", new _TestAssetId(
6608
- "0x0202020202020202020202020202020202020202020202020202020202020202"
6609
- ));
6610
6699
 
6611
6700
  // src/test-utils/wallet-config.ts
6612
6701
  var import_crypto9 = require("@fuel-ts/crypto");
6613
- var import_errors28 = require("@fuel-ts/errors");
6702
+ var import_errors27 = require("@fuel-ts/errors");
6614
6703
  var import_math24 = require("@fuel-ts/math");
6615
6704
  var import_utils43 = require("@fuel-ts/utils");
6616
6705
 
@@ -6619,17 +6708,17 @@ var import_hasher4 = require("@fuel-ts/hasher");
6619
6708
  var import_utils38 = require("@fuel-ts/utils");
6620
6709
 
6621
6710
  // src/account.ts
6622
- var import_abi_coder7 = require("@fuel-ts/abi-coder");
6711
+ var import_abi_coder8 = require("@fuel-ts/abi-coder");
6623
6712
  var import_address6 = require("@fuel-ts/address");
6624
6713
  var import_crypto5 = require("@fuel-ts/crypto");
6625
- var import_errors23 = require("@fuel-ts/errors");
6714
+ var import_errors22 = require("@fuel-ts/errors");
6626
6715
  var import_math22 = require("@fuel-ts/math");
6627
- var import_transactions26 = require("@fuel-ts/transactions");
6716
+ var import_transactions27 = require("@fuel-ts/transactions");
6628
6717
  var import_utils36 = require("@fuel-ts/utils");
6629
6718
  var import_ramda9 = require("ramda");
6630
6719
 
6631
6720
  // src/providers/utils/merge-quantities.ts
6632
- var mergeQuantities = (...coinQuantities) => {
6721
+ var mergeQuantities = /* @__PURE__ */ __name((...coinQuantities) => {
6633
6722
  const resultMap = {};
6634
6723
  function addToMap({ amount, assetId }) {
6635
6724
  if (resultMap[assetId]) {
@@ -6638,34 +6727,38 @@ var mergeQuantities = (...coinQuantities) => {
6638
6727
  resultMap[assetId] = amount;
6639
6728
  }
6640
6729
  }
6730
+ __name(addToMap, "addToMap");
6641
6731
  coinQuantities.forEach((arr) => arr.forEach(addToMap));
6642
6732
  return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
6643
- };
6733
+ }, "mergeQuantities");
6644
6734
 
6645
6735
  // src/types.ts
6646
6736
  var AbstractAccount = class {
6737
+ static {
6738
+ __name(this, "AbstractAccount");
6739
+ }
6647
6740
  };
6648
6741
 
6649
6742
  // src/utils/formatTransferToContractScriptData.ts
6650
- var import_abi_coder6 = require("@fuel-ts/abi-coder");
6743
+ var import_abi_coder7 = require("@fuel-ts/abi-coder");
6651
6744
  var import_address5 = require("@fuel-ts/address");
6652
6745
  var import_utils35 = require("@fuel-ts/utils");
6653
6746
  var asm = __toESM(require("@fuels/vm-asm"));
6654
- var formatTransferToContractScriptData = (transferParams) => {
6655
- const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
6747
+ var formatTransferToContractScriptData = /* @__PURE__ */ __name((transferParams) => {
6748
+ const numberCoder = new import_abi_coder7.BigNumberCoder("u64");
6656
6749
  return transferParams.reduce((acc, transferParam) => {
6657
6750
  const { assetId, amount, contractId } = transferParam;
6658
6751
  const encoded = numberCoder.encode(amount);
6659
6752
  const scriptData = (0, import_utils35.concat)([new import_address5.Address(contractId).toBytes(), encoded, (0, import_utils35.arrayify)(assetId)]);
6660
6753
  return (0, import_utils35.concat)([acc, scriptData]);
6661
6754
  }, new Uint8Array());
6662
- };
6663
- var assembleTransferToContractScript = async (transferParams) => {
6755
+ }, "formatTransferToContractScriptData");
6756
+ var assembleTransferToContractScript = /* @__PURE__ */ __name(async (transferParams) => {
6664
6757
  const scriptData = formatTransferToContractScriptData(transferParams);
6665
6758
  await asm.initWasm();
6666
6759
  let script = new Uint8Array();
6667
6760
  transferParams.forEach((_, i) => {
6668
- const offset = (import_abi_coder6.CONTRACT_ID_LEN + import_abi_coder6.WORD_SIZE + import_abi_coder6.ASSET_ID_LEN) * i;
6761
+ const offset = (import_abi_coder7.CONTRACT_ID_LEN + import_abi_coder7.WORD_SIZE + import_abi_coder7.ASSET_ID_LEN) * i;
6669
6762
  script = (0, import_utils35.concat)([
6670
6763
  script,
6671
6764
  // Load ScriptData into register 0x10.
@@ -6673,22 +6766,25 @@ var assembleTransferToContractScript = async (transferParams) => {
6673
6766
  // Add the offset to 0x10 so it will point to the current contract ID, store in 0x11.
6674
6767
  asm.addi(17, 16, offset).to_bytes(),
6675
6768
  // Add CONTRACT_ID_LEN to 0x11 to point to the amount in the ScriptData, store in 0x12.
6676
- asm.addi(18, 17, import_abi_coder6.CONTRACT_ID_LEN).to_bytes(),
6769
+ asm.addi(18, 17, import_abi_coder7.CONTRACT_ID_LEN).to_bytes(),
6677
6770
  // Load word to the amount at 0x12 into register 0x13.
6678
6771
  asm.lw(19, 18, 0).to_bytes(),
6679
6772
  // Add WORD_SIZE to 0x12 to point to the asset ID in the ScriptData, store in 0x14.
6680
- asm.addi(20, 18, import_abi_coder6.WORD_SIZE).to_bytes(),
6773
+ asm.addi(20, 18, import_abi_coder7.WORD_SIZE).to_bytes(),
6681
6774
  // Perform the transfer using contract ID in 0x11, amount in 0x13, and asset ID in 0x14.
6682
6775
  asm.tr(17, 19, 20).to_bytes()
6683
6776
  ]);
6684
6777
  });
6685
6778
  script = (0, import_utils35.concat)([script, asm.ret(1).to_bytes()]);
6686
6779
  return { script, scriptData };
6687
- };
6780
+ }, "assembleTransferToContractScript");
6688
6781
 
6689
6782
  // src/account.ts
6690
6783
  var MAX_FUNDING_ATTEMPTS = 5;
6691
6784
  var Account = class extends AbstractAccount {
6785
+ static {
6786
+ __name(this, "Account");
6787
+ }
6692
6788
  /**
6693
6789
  * The address associated with the account.
6694
6790
  */
@@ -6723,7 +6819,7 @@ var Account = class extends AbstractAccount {
6723
6819
  */
6724
6820
  get provider() {
6725
6821
  if (!this._provider) {
6726
- throw new import_errors23.FuelError(import_errors23.ErrorCode.MISSING_PROVIDER, "Provider not set");
6822
+ throw new import_errors22.FuelError(import_errors22.ErrorCode.MISSING_PROVIDER, "Provider not set");
6727
6823
  }
6728
6824
  return this._provider;
6729
6825
  }
@@ -6882,8 +6978,8 @@ var Account = class extends AbstractAccount {
6882
6978
  fundingAttempts += 1;
6883
6979
  }
6884
6980
  if (needsToBeFunded) {
6885
- throw new import_errors23.FuelError(
6886
- import_errors23.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
6981
+ throw new import_errors22.FuelError(
6982
+ import_errors22.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
6887
6983
  `The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
6888
6984
  );
6889
6985
  }
@@ -7002,8 +7098,8 @@ var Account = class extends AbstractAccount {
7002
7098
  const contractAddress = new import_address6.Address(transferParam.contractId);
7003
7099
  const assetId = transferParam.assetId ? (0, import_utils36.hexlify)(transferParam.assetId) : defaultAssetId;
7004
7100
  if (amount.lte(0)) {
7005
- throw new import_errors23.FuelError(
7006
- import_errors23.ErrorCode.INVALID_TRANSFER_AMOUNT,
7101
+ throw new import_errors22.FuelError(
7102
+ import_errors22.ErrorCode.INVALID_TRANSFER_AMOUNT,
7007
7103
  "Transfer amount must be a positive number."
7008
7104
  );
7009
7105
  }
@@ -7072,16 +7168,16 @@ var Account = class extends AbstractAccount {
7072
7168
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
7073
7169
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
7074
7170
  const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: (0, import_math22.bn)("100000000000000000") }];
7075
- const findAssetInput = (assetId) => txRequestClone.inputs.find((input) => {
7076
- if (input.type === import_transactions26.InputType.Coin) {
7171
+ const findAssetInput = /* @__PURE__ */ __name((assetId) => txRequestClone.inputs.find((input) => {
7172
+ if (input.type === import_transactions27.InputType.Coin) {
7077
7173
  return input.assetId === assetId;
7078
7174
  }
7079
7175
  if (isRequestInputMessageWithoutData(input)) {
7080
7176
  return baseAssetId === assetId;
7081
7177
  }
7082
7178
  return false;
7083
- });
7084
- const updateAssetInput = (assetId, quantity) => {
7179
+ }), "findAssetInput");
7180
+ const updateAssetInput = /* @__PURE__ */ __name((assetId, quantity) => {
7085
7181
  const assetInput = findAssetInput(assetId);
7086
7182
  const usedQuantity = quantity;
7087
7183
  if (assetInput && "amount" in assetInput) {
@@ -7096,7 +7192,7 @@ var Account = class extends AbstractAccount {
7096
7192
  ])
7097
7193
  );
7098
7194
  }
7099
- };
7195
+ }, "updateAssetInput");
7100
7196
  mergeQuantities(requiredQuantities, transactionFeeForDryRun).forEach(
7101
7197
  ({ amount, assetId }) => updateAssetInput(assetId, amount)
7102
7198
  );
@@ -7119,7 +7215,7 @@ var Account = class extends AbstractAccount {
7119
7215
  */
7120
7216
  async signMessage(message) {
7121
7217
  if (!this._connector) {
7122
- throw new import_errors23.FuelError(import_errors23.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
7218
+ throw new import_errors22.FuelError(import_errors22.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
7123
7219
  }
7124
7220
  return this._connector.signMessage(this.address.toString(), message);
7125
7221
  }
@@ -7131,8 +7227,8 @@ var Account = class extends AbstractAccount {
7131
7227
  */
7132
7228
  async signTransaction(transactionRequestLike) {
7133
7229
  if (!this._connector) {
7134
- throw new import_errors23.FuelError(
7135
- import_errors23.ErrorCode.MISSING_CONNECTOR,
7230
+ throw new import_errors22.FuelError(
7231
+ import_errors22.ErrorCode.MISSING_CONNECTOR,
7136
7232
  "A connector is required to sign transactions."
7137
7233
  );
7138
7234
  }
@@ -7196,7 +7292,7 @@ var Account = class extends AbstractAccount {
7196
7292
  */
7197
7293
  generateFakeResources(coins) {
7198
7294
  return coins.map((coin) => ({
7199
- id: (0, import_utils36.hexlify)((0, import_crypto5.randomBytes)(import_abi_coder7.UTXO_ID_LEN)),
7295
+ id: (0, import_utils36.hexlify)((0, import_crypto5.randomBytes)(import_abi_coder8.UTXO_ID_LEN)),
7200
7296
  owner: this.address,
7201
7297
  blockCreated: (0, import_math22.bn)(1),
7202
7298
  txCreatedIdx: (0, import_math22.bn)(1),
@@ -7228,8 +7324,8 @@ var Account = class extends AbstractAccount {
7228
7324
  /** @hidden * */
7229
7325
  validateTransferAmount(amount) {
7230
7326
  if ((0, import_math22.bn)(amount).lte(0)) {
7231
- throw new import_errors23.FuelError(
7232
- import_errors23.ErrorCode.INVALID_TRANSFER_AMOUNT,
7327
+ throw new import_errors22.FuelError(
7328
+ import_errors22.ErrorCode.INVALID_TRANSFER_AMOUNT,
7233
7329
  "Transfer amount must be a positive number."
7234
7330
  );
7235
7331
  }
@@ -7258,16 +7354,16 @@ var Account = class extends AbstractAccount {
7258
7354
  if (!(0, import_utils36.isDefined)(setGasLimit)) {
7259
7355
  request.gasLimit = gasUsed;
7260
7356
  } else if (gasUsed.gt(setGasLimit)) {
7261
- throw new import_errors23.FuelError(
7262
- import_errors23.ErrorCode.GAS_LIMIT_TOO_LOW,
7357
+ throw new import_errors22.FuelError(
7358
+ import_errors22.ErrorCode.GAS_LIMIT_TOO_LOW,
7263
7359
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
7264
7360
  );
7265
7361
  }
7266
7362
  if (!(0, import_utils36.isDefined)(setMaxFee)) {
7267
7363
  request.maxFee = maxFee;
7268
7364
  } else if (maxFee.gt(setMaxFee)) {
7269
- throw new import_errors23.FuelError(
7270
- import_errors23.ErrorCode.MAX_FEE_TOO_LOW,
7365
+ throw new import_errors22.FuelError(
7366
+ import_errors22.ErrorCode.MAX_FEE_TOO_LOW,
7271
7367
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
7272
7368
  );
7273
7369
  }
@@ -7278,19 +7374,19 @@ var Account = class extends AbstractAccount {
7278
7374
  // src/wallet/keystore-wallet.ts
7279
7375
  var import_address7 = require("@fuel-ts/address");
7280
7376
  var import_crypto6 = require("@fuel-ts/crypto");
7281
- var import_errors24 = require("@fuel-ts/errors");
7377
+ var import_errors23 = require("@fuel-ts/errors");
7282
7378
  var import_utils37 = require("@fuel-ts/utils");
7283
7379
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
7284
7380
  var DEFAULT_KDF_PARAMS_R = 8;
7285
7381
  var DEFAULT_KDF_PARAMS_P = 1;
7286
7382
  var DEFAULT_KEY_SIZE = 32;
7287
7383
  var DEFAULT_IV_SIZE = 16;
7288
- var removeHexPrefix = (hexString) => {
7384
+ var removeHexPrefix = /* @__PURE__ */ __name((hexString) => {
7289
7385
  if (/^0x/.test(hexString)) {
7290
7386
  return hexString.slice(2);
7291
7387
  }
7292
7388
  return hexString;
7293
- };
7389
+ }, "removeHexPrefix");
7294
7390
  async function encryptKeystoreWallet(privateKey, address, password) {
7295
7391
  const privateKeyBuffer = (0, import_crypto6.bufferFromString)(removeHexPrefix(privateKey), "hex");
7296
7392
  const ownerAddress = new import_address7.Address(address);
@@ -7329,6 +7425,7 @@ async function encryptKeystoreWallet(privateKey, address, password) {
7329
7425
  };
7330
7426
  return JSON.stringify(keystore);
7331
7427
  }
7428
+ __name(encryptKeystoreWallet, "encryptKeystoreWallet");
7332
7429
  async function decryptKeystoreWallet(jsonWallet, password) {
7333
7430
  const keystoreWallet = JSON.parse(jsonWallet);
7334
7431
  const {
@@ -7355,8 +7452,8 @@ async function decryptKeystoreWallet(jsonWallet, password) {
7355
7452
  const macHashUint8Array = (0, import_crypto6.keccak256)(data);
7356
7453
  const macHash = (0, import_crypto6.stringFromBuffer)(macHashUint8Array, "hex");
7357
7454
  if (mac !== macHash) {
7358
- throw new import_errors24.FuelError(
7359
- import_errors24.ErrorCode.INVALID_PASSWORD,
7455
+ throw new import_errors23.FuelError(
7456
+ import_errors23.ErrorCode.INVALID_PASSWORD,
7360
7457
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
7361
7458
  );
7362
7459
  }
@@ -7364,9 +7461,17 @@ async function decryptKeystoreWallet(jsonWallet, password) {
7364
7461
  const privateKey = (0, import_utils37.hexlify)(buffer);
7365
7462
  return privateKey;
7366
7463
  }
7464
+ __name(decryptKeystoreWallet, "decryptKeystoreWallet");
7367
7465
 
7368
7466
  // src/wallet/base-wallet-unlocked.ts
7369
7467
  var BaseWalletUnlocked = class extends Account {
7468
+ static {
7469
+ __name(this, "BaseWalletUnlocked");
7470
+ }
7471
+ /**
7472
+ * Default HDWallet path.
7473
+ */
7474
+ static defaultPath = "m/44'/1179993420'/0'/0/0";
7370
7475
  /**
7371
7476
  * A function that returns the wallet's signer.
7372
7477
  */
@@ -7484,21 +7589,17 @@ var BaseWalletUnlocked = class extends Account {
7484
7589
  return encryptKeystoreWallet(this.privateKey, this.address, password);
7485
7590
  }
7486
7591
  };
7487
- /**
7488
- * Default HDWallet path.
7489
- */
7490
- __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
7491
7592
 
7492
7593
  // src/hdwallet/hdwallet.ts
7493
7594
  var import_crypto8 = require("@fuel-ts/crypto");
7494
- var import_errors27 = require("@fuel-ts/errors");
7595
+ var import_errors26 = require("@fuel-ts/errors");
7495
7596
  var import_hasher7 = require("@fuel-ts/hasher");
7496
7597
  var import_math23 = require("@fuel-ts/math");
7497
7598
  var import_utils42 = require("@fuel-ts/utils");
7498
7599
 
7499
7600
  // src/mnemonic/mnemonic.ts
7500
7601
  var import_crypto7 = require("@fuel-ts/crypto");
7501
- var import_errors26 = require("@fuel-ts/errors");
7602
+ var import_errors25 = require("@fuel-ts/errors");
7502
7603
  var import_hasher6 = require("@fuel-ts/hasher");
7503
7604
  var import_utils40 = require("@fuel-ts/utils");
7504
7605
 
@@ -9555,27 +9656,31 @@ var english = [
9555
9656
  ];
9556
9657
 
9557
9658
  // src/mnemonic/utils.ts
9558
- var import_errors25 = require("@fuel-ts/errors");
9659
+ var import_errors24 = require("@fuel-ts/errors");
9559
9660
  var import_hasher5 = require("@fuel-ts/hasher");
9560
9661
  var import_utils39 = require("@fuel-ts/utils");
9561
9662
  function getLowerMask(bits) {
9562
9663
  return (1 << bits) - 1;
9563
9664
  }
9665
+ __name(getLowerMask, "getLowerMask");
9564
9666
  function getUpperMask(bits) {
9565
9667
  return (1 << bits) - 1 << 8 - bits;
9566
9668
  }
9669
+ __name(getUpperMask, "getUpperMask");
9567
9670
  function getWords(mnemonic) {
9568
9671
  if (!Array.isArray(mnemonic)) {
9569
9672
  return mnemonic.split(/\s+/);
9570
9673
  }
9571
9674
  return mnemonic;
9572
9675
  }
9676
+ __name(getWords, "getWords");
9573
9677
  function getPhrase(mnemonic) {
9574
9678
  if (Array.isArray(mnemonic)) {
9575
9679
  return mnemonic.join(" ");
9576
9680
  }
9577
9681
  return mnemonic;
9578
9682
  }
9683
+ __name(getPhrase, "getPhrase");
9579
9684
  function entropyToMnemonicIndices(entropy) {
9580
9685
  const indices = [0];
9581
9686
  let remainingBits = 11;
@@ -9597,6 +9702,7 @@ function entropyToMnemonicIndices(entropy) {
9597
9702
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
9598
9703
  return indices;
9599
9704
  }
9705
+ __name(entropyToMnemonicIndices, "entropyToMnemonicIndices");
9600
9706
  function mnemonicWordsToEntropy(words, wordlist) {
9601
9707
  const size = Math.ceil(11 * words.length / 8);
9602
9708
  const entropy = (0, import_utils39.arrayify)(new Uint8Array(size));
@@ -9604,8 +9710,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
9604
9710
  for (let i = 0; i < words.length; i += 1) {
9605
9711
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
9606
9712
  if (index === -1) {
9607
- throw new import_errors25.FuelError(
9608
- import_errors25.ErrorCode.INVALID_MNEMONIC,
9713
+ throw new import_errors24.FuelError(
9714
+ import_errors24.ErrorCode.INVALID_MNEMONIC,
9609
9715
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
9610
9716
  );
9611
9717
  }
@@ -9621,13 +9727,14 @@ function mnemonicWordsToEntropy(words, wordlist) {
9621
9727
  const checksumMask = getUpperMask(checksumBits);
9622
9728
  const checksum = (0, import_utils39.arrayify)((0, import_hasher5.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9623
9729
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
9624
- throw new import_errors25.FuelError(
9625
- import_errors25.ErrorCode.INVALID_CHECKSUM,
9730
+ throw new import_errors24.FuelError(
9731
+ import_errors24.ErrorCode.INVALID_CHECKSUM,
9626
9732
  "Checksum validation failed for the provided mnemonic."
9627
9733
  );
9628
9734
  }
9629
9735
  return entropy.slice(0, entropyBits / 8);
9630
9736
  }
9737
+ __name(mnemonicWordsToEntropy, "mnemonicWordsToEntropy");
9631
9738
 
9632
9739
  // src/mnemonic/mnemonic.ts
9633
9740
  var MasterSecret = (0, import_utils40.toUtf8Bytes)("Bitcoin seed");
@@ -9636,29 +9743,35 @@ var TestnetPRV = "0x04358394";
9636
9743
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
9637
9744
  function assertWordList(wordlist) {
9638
9745
  if (wordlist.length !== 2048) {
9639
- throw new import_errors26.FuelError(
9640
- import_errors26.ErrorCode.INVALID_WORD_LIST,
9746
+ throw new import_errors25.FuelError(
9747
+ import_errors25.ErrorCode.INVALID_WORD_LIST,
9641
9748
  `Expected word list length of 2048, but got ${wordlist.length}.`
9642
9749
  );
9643
9750
  }
9644
9751
  }
9752
+ __name(assertWordList, "assertWordList");
9645
9753
  function assertEntropy(entropy) {
9646
9754
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
9647
- throw new import_errors26.FuelError(
9648
- import_errors26.ErrorCode.INVALID_ENTROPY,
9755
+ throw new import_errors25.FuelError(
9756
+ import_errors25.ErrorCode.INVALID_ENTROPY,
9649
9757
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
9650
9758
  );
9651
9759
  }
9652
9760
  }
9761
+ __name(assertEntropy, "assertEntropy");
9653
9762
  function assertMnemonic(words) {
9654
9763
  if (!MNEMONIC_SIZES.includes(words.length)) {
9655
9764
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
9656
9765
  ", "
9657
9766
  )}] words, but got ${words.length}.`;
9658
- throw new import_errors26.FuelError(import_errors26.ErrorCode.INVALID_MNEMONIC, errorMsg);
9767
+ throw new import_errors25.FuelError(import_errors25.ErrorCode.INVALID_MNEMONIC, errorMsg);
9659
9768
  }
9660
9769
  }
9661
- var Mnemonic = class {
9770
+ __name(assertMnemonic, "assertMnemonic");
9771
+ var Mnemonic = class _Mnemonic {
9772
+ static {
9773
+ __name(this, "Mnemonic");
9774
+ }
9662
9775
  wordlist;
9663
9776
  /**
9664
9777
  *
@@ -9675,7 +9788,7 @@ var Mnemonic = class {
9675
9788
  * @returns Entropy hash
9676
9789
  */
9677
9790
  mnemonicToEntropy(phrase) {
9678
- return Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
9791
+ return _Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
9679
9792
  }
9680
9793
  /**
9681
9794
  *
@@ -9683,7 +9796,7 @@ var Mnemonic = class {
9683
9796
  * @returns Mnemonic phrase
9684
9797
  */
9685
9798
  entropyToMnemonic(entropy) {
9686
- return Mnemonic.entropyToMnemonic(entropy, this.wordlist);
9799
+ return _Mnemonic.entropyToMnemonic(entropy, this.wordlist);
9687
9800
  }
9688
9801
  /**
9689
9802
  *
@@ -9724,8 +9837,8 @@ var Mnemonic = class {
9724
9837
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
9725
9838
  */
9726
9839
  static mnemonicToMasterKeys(phrase, passphrase = "") {
9727
- const seed = Mnemonic.mnemonicToSeed(phrase, passphrase);
9728
- return Mnemonic.masterKeysFromSeed(seed);
9840
+ const seed = _Mnemonic.mnemonicToSeed(phrase, passphrase);
9841
+ return _Mnemonic.masterKeysFromSeed(seed);
9729
9842
  }
9730
9843
  /**
9731
9844
  * Validates if given mnemonic is valid
@@ -9741,7 +9854,7 @@ var Mnemonic = class {
9741
9854
  return false;
9742
9855
  }
9743
9856
  while (i < words.length) {
9744
- if (Mnemonic.binarySearch(words[i]) === false) {
9857
+ if (_Mnemonic.binarySearch(words[i]) === false) {
9745
9858
  return false;
9746
9859
  }
9747
9860
  i += 1;
@@ -9773,8 +9886,8 @@ var Mnemonic = class {
9773
9886
  static masterKeysFromSeed(seed) {
9774
9887
  const seedArray = (0, import_utils40.arrayify)(seed);
9775
9888
  if (seedArray.length < 16 || seedArray.length > 64) {
9776
- throw new import_errors26.FuelError(
9777
- import_errors26.ErrorCode.INVALID_SEED,
9889
+ throw new import_errors25.FuelError(
9890
+ import_errors25.ErrorCode.INVALID_SEED,
9778
9891
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
9779
9892
  );
9780
9893
  }
@@ -9788,7 +9901,7 @@ var Mnemonic = class {
9788
9901
  * @returns BIP-32 extended private key
9789
9902
  */
9790
9903
  static seedToExtendedKey(seed, testnet = false) {
9791
- const masterKey = Mnemonic.masterKeysFromSeed(seed);
9904
+ const masterKey = _Mnemonic.masterKeysFromSeed(seed);
9792
9905
  const prefix = (0, import_utils40.arrayify)(testnet ? TestnetPRV : MainnetPRV);
9793
9906
  const depth = "0x00";
9794
9907
  const fingerprint = "0x00000000";
@@ -9820,7 +9933,7 @@ var Mnemonic = class {
9820
9933
  */
9821
9934
  static generate(size = 32, extraEntropy = "") {
9822
9935
  const entropy = extraEntropy ? (0, import_hasher6.sha256)((0, import_utils40.concat)([(0, import_crypto7.randomBytes)(size), (0, import_utils40.arrayify)(extraEntropy)])) : (0, import_crypto7.randomBytes)(size);
9823
- return Mnemonic.entropyToMnemonic(entropy);
9936
+ return _Mnemonic.entropyToMnemonic(entropy);
9824
9937
  }
9825
9938
  };
9826
9939
  var mnemonic_default = Mnemonic;
@@ -9834,24 +9947,28 @@ var TestnetPUB = (0, import_utils42.hexlify)("0x043587cf");
9834
9947
  function base58check(data) {
9835
9948
  return (0, import_utils42.encodeBase58)((0, import_utils42.concat)([data, (0, import_utils42.dataSlice)((0, import_hasher7.sha256)((0, import_hasher7.sha256)(data)), 0, 4)]));
9836
9949
  }
9950
+ __name(base58check, "base58check");
9837
9951
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9838
9952
  if (isPublic) {
9839
9953
  return testnet ? TestnetPUB : MainnetPUB;
9840
9954
  }
9841
9955
  return testnet ? TestnetPRV2 : MainnetPRV2;
9842
9956
  }
9957
+ __name(getExtendedKeyPrefix, "getExtendedKeyPrefix");
9843
9958
  function isPublicExtendedKey(extendedKey) {
9844
9959
  return [MainnetPUB, TestnetPUB].includes((0, import_utils42.hexlify)(extendedKey.slice(0, 4)));
9845
9960
  }
9961
+ __name(isPublicExtendedKey, "isPublicExtendedKey");
9846
9962
  function isValidExtendedKey(extendedKey) {
9847
9963
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9848
9964
  (0, import_utils42.hexlify)(extendedKey.slice(0, 4))
9849
9965
  );
9850
9966
  }
9967
+ __name(isValidExtendedKey, "isValidExtendedKey");
9851
9968
  function parsePath(path2, depth = 0) {
9852
9969
  const components = path2.split("/");
9853
9970
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
9854
- throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
9971
+ throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
9855
9972
  }
9856
9973
  if (components[0] === "m") {
9857
9974
  components.shift();
@@ -9860,7 +9977,11 @@ function parsePath(path2, depth = 0) {
9860
9977
  (p) => ~p.indexOf(`'`) ? parseInt(p, 10) + HARDENED_INDEX : parseInt(p, 10)
9861
9978
  );
9862
9979
  }
9863
- var HDWallet = class {
9980
+ __name(parsePath, "parsePath");
9981
+ var HDWallet = class _HDWallet {
9982
+ static {
9983
+ __name(this, "HDWallet");
9984
+ }
9864
9985
  depth = 0;
9865
9986
  index = 0;
9866
9987
  fingerprint = (0, import_utils42.hexlify)("0x00000000");
@@ -9880,8 +10001,8 @@ var HDWallet = class {
9880
10001
  this.privateKey = (0, import_utils42.hexlify)(config.privateKey);
9881
10002
  } else {
9882
10003
  if (!config.publicKey) {
9883
- throw new import_errors27.FuelError(
9884
- import_errors27.ErrorCode.HD_WALLET_ERROR,
10004
+ throw new import_errors26.FuelError(
10005
+ import_errors26.ErrorCode.HD_WALLET_ERROR,
9885
10006
  "Both public and private Key cannot be missing. At least one should be provided."
9886
10007
  );
9887
10008
  }
@@ -9910,8 +10031,8 @@ var HDWallet = class {
9910
10031
  const data = new Uint8Array(37);
9911
10032
  if (index & HARDENED_INDEX) {
9912
10033
  if (!privateKey) {
9913
- throw new import_errors27.FuelError(
9914
- import_errors27.ErrorCode.HD_WALLET_ERROR,
10034
+ throw new import_errors26.FuelError(
10035
+ import_errors26.ErrorCode.HD_WALLET_ERROR,
9915
10036
  "Cannot derive a hardened index without a private Key."
9916
10037
  );
9917
10038
  }
@@ -9926,7 +10047,7 @@ var HDWallet = class {
9926
10047
  if (privateKey) {
9927
10048
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
9928
10049
  const ki = (0, import_math23.bn)(IL).add(privateKey).mod(N).toBytes(32);
9929
- return new HDWallet({
10050
+ return new _HDWallet({
9930
10051
  privateKey: ki,
9931
10052
  chainCode: IR,
9932
10053
  index,
@@ -9936,7 +10057,7 @@ var HDWallet = class {
9936
10057
  }
9937
10058
  const signer = new Signer((0, import_utils42.hexlify)(IL));
9938
10059
  const Ki = signer.addPoint(publicKey);
9939
- return new HDWallet({
10060
+ return new _HDWallet({
9940
10061
  publicKey: Ki,
9941
10062
  chainCode: IR,
9942
10063
  index,
@@ -9963,8 +10084,8 @@ var HDWallet = class {
9963
10084
  */
9964
10085
  toExtendedKey(isPublic = false, testnet = false) {
9965
10086
  if (this.depth >= 256) {
9966
- throw new import_errors27.FuelError(
9967
- import_errors27.ErrorCode.HD_WALLET_ERROR,
10087
+ throw new import_errors26.FuelError(
10088
+ import_errors26.ErrorCode.HD_WALLET_ERROR,
9968
10089
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
9969
10090
  );
9970
10091
  }
@@ -9985,7 +10106,7 @@ var HDWallet = class {
9985
10106
  */
9986
10107
  static fromSeed(seed) {
9987
10108
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
9988
- return new HDWallet({
10109
+ return new _HDWallet({
9989
10110
  chainCode: (0, import_utils42.arrayify)(masterKey.slice(32)),
9990
10111
  privateKey: (0, import_utils42.arrayify)(masterKey.slice(0, 32))
9991
10112
  });
@@ -9995,10 +10116,10 @@ var HDWallet = class {
9995
10116
  const bytes = (0, import_utils42.arrayify)(decoded);
9996
10117
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9997
10118
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
9998
- throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
10119
+ throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
9999
10120
  }
10000
10121
  if (!validChecksum) {
10001
- throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
10122
+ throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
10002
10123
  }
10003
10124
  const depth = bytes[4];
10004
10125
  const parentFingerprint = (0, import_utils42.hexlify)(bytes.slice(5, 9));
@@ -10006,16 +10127,16 @@ var HDWallet = class {
10006
10127
  const chainCode = (0, import_utils42.hexlify)(bytes.slice(13, 45));
10007
10128
  const key = bytes.slice(45, 78);
10008
10129
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
10009
- throw new import_errors27.FuelError(
10010
- import_errors27.ErrorCode.HD_WALLET_ERROR,
10130
+ throw new import_errors26.FuelError(
10131
+ import_errors26.ErrorCode.HD_WALLET_ERROR,
10011
10132
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
10012
10133
  );
10013
10134
  }
10014
10135
  if (isPublicExtendedKey(bytes)) {
10015
10136
  if (key[0] !== 3) {
10016
- throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
10137
+ throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
10017
10138
  }
10018
- return new HDWallet({
10139
+ return new _HDWallet({
10019
10140
  publicKey: key,
10020
10141
  chainCode,
10021
10142
  index,
@@ -10024,9 +10145,9 @@ var HDWallet = class {
10024
10145
  });
10025
10146
  }
10026
10147
  if (key[0] !== 0) {
10027
- throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
10148
+ throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
10028
10149
  }
10029
- return new HDWallet({
10150
+ return new _HDWallet({
10030
10151
  privateKey: key.slice(1),
10031
10152
  chainCode,
10032
10153
  index,
@@ -10039,6 +10160,9 @@ var hdwallet_default = HDWallet;
10039
10160
 
10040
10161
  // src/wallet/wallets.ts
10041
10162
  var WalletLocked = class extends Account {
10163
+ static {
10164
+ __name(this, "WalletLocked");
10165
+ }
10042
10166
  /**
10043
10167
  * Unlocks the wallet using the provided private key and returns an instance of WalletUnlocked.
10044
10168
  *
@@ -10049,7 +10173,10 @@ var WalletLocked = class extends Account {
10049
10173
  return new WalletUnlocked(privateKey, this._provider);
10050
10174
  }
10051
10175
  };
10052
- var WalletUnlocked = class extends BaseWalletUnlocked {
10176
+ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
10177
+ static {
10178
+ __name(this, "WalletUnlocked");
10179
+ }
10053
10180
  /**
10054
10181
  * Locks the wallet and returns an instance of WalletLocked.
10055
10182
  *
@@ -10067,7 +10194,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10067
10194
  */
10068
10195
  static generate(generateOptions) {
10069
10196
  const privateKey = Signer.generatePrivateKey(generateOptions?.entropy);
10070
- return new WalletUnlocked(privateKey, generateOptions?.provider);
10197
+ return new _WalletUnlocked(privateKey, generateOptions?.provider);
10071
10198
  }
10072
10199
  /**
10073
10200
  * Create a Wallet Unlocked from a seed.
@@ -10079,8 +10206,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10079
10206
  */
10080
10207
  static fromSeed(seed, path2, provider) {
10081
10208
  const hdWallet = hdwallet_default.fromSeed(seed);
10082
- const childWallet = hdWallet.derivePath(path2 || WalletUnlocked.defaultPath);
10083
- return new WalletUnlocked(childWallet.privateKey, provider);
10209
+ const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
10210
+ return new _WalletUnlocked(childWallet.privateKey, provider);
10084
10211
  }
10085
10212
  /**
10086
10213
  * Create a Wallet Unlocked from a mnemonic phrase.
@@ -10094,8 +10221,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10094
10221
  static fromMnemonic(mnemonic, path2, passphrase, provider) {
10095
10222
  const seed = mnemonic_default.mnemonicToSeed(mnemonic, passphrase);
10096
10223
  const hdWallet = hdwallet_default.fromSeed(seed);
10097
- const childWallet = hdWallet.derivePath(path2 || WalletUnlocked.defaultPath);
10098
- return new WalletUnlocked(childWallet.privateKey, provider);
10224
+ const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
10225
+ return new _WalletUnlocked(childWallet.privateKey, provider);
10099
10226
  }
10100
10227
  /**
10101
10228
  * Create a Wallet Unlocked from an extended key.
@@ -10106,7 +10233,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10106
10233
  */
10107
10234
  static fromExtendedKey(extendedKey, provider) {
10108
10235
  const hdWallet = hdwallet_default.fromExtendedKey(extendedKey);
10109
- return new WalletUnlocked(hdWallet.privateKey, provider);
10236
+ return new _WalletUnlocked(hdWallet.privateKey, provider);
10110
10237
  }
10111
10238
  /**
10112
10239
  * Create a Wallet Unlocked from an encrypted JSON.
@@ -10118,12 +10245,15 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10118
10245
  */
10119
10246
  static async fromEncryptedJson(jsonWallet, password, provider) {
10120
10247
  const privateKey = await decryptKeystoreWallet(jsonWallet, password);
10121
- return new WalletUnlocked(privateKey, provider);
10248
+ return new _WalletUnlocked(privateKey, provider);
10122
10249
  }
10123
10250
  };
10124
10251
 
10125
10252
  // src/wallet/wallet.ts
10126
10253
  var Wallet = class {
10254
+ static {
10255
+ __name(this, "Wallet");
10256
+ }
10127
10257
  /**
10128
10258
  * Creates a locked wallet instance from an address and a provider.
10129
10259
  *
@@ -10144,71 +10274,74 @@ var Wallet = class {
10144
10274
  static fromPrivateKey(privateKey, provider) {
10145
10275
  return new WalletUnlocked(privateKey, provider);
10146
10276
  }
10277
+ /**
10278
+ * Generate a new Wallet Unlocked with a random key pair.
10279
+ *
10280
+ * @param generateOptions - Options to customize the generation process (optional).
10281
+ * @returns An unlocked wallet instance.
10282
+ */
10283
+ static generate = WalletUnlocked.generate;
10284
+ /**
10285
+ * Create a Wallet Unlocked from a seed.
10286
+ *
10287
+ * @param seed - The seed phrase.
10288
+ * @param provider - A Provider instance (optional).
10289
+ * @param path - The derivation path (optional).
10290
+ * @returns An unlocked wallet instance.
10291
+ */
10292
+ static fromSeed = WalletUnlocked.fromSeed;
10293
+ /**
10294
+ * Create a Wallet Unlocked from a mnemonic phrase.
10295
+ *
10296
+ * @param mnemonic - The mnemonic phrase.
10297
+ * @param provider - A Provider instance (optional).
10298
+ * @param path - The derivation path (optional).
10299
+ * @param passphrase - The passphrase for the mnemonic (optional).
10300
+ * @returns An unlocked wallet instance.
10301
+ */
10302
+ static fromMnemonic = WalletUnlocked.fromMnemonic;
10303
+ /**
10304
+ * Create a Wallet Unlocked from an extended key.
10305
+ *
10306
+ * @param extendedKey - The extended key.
10307
+ * @param provider - A Provider instance (optional).
10308
+ * @returns An unlocked wallet instance.
10309
+ */
10310
+ static fromExtendedKey = WalletUnlocked.fromExtendedKey;
10311
+ /**
10312
+ * Create a Wallet Unlocked from an encrypted JSON.
10313
+ *
10314
+ * @param jsonWallet - The encrypted JSON keystore.
10315
+ * @param password - The password to decrypt the JSON.
10316
+ * @param provider - A Provider instance (optional).
10317
+ * @returns An unlocked wallet instance.
10318
+ */
10319
+ static fromEncryptedJson = WalletUnlocked.fromEncryptedJson;
10147
10320
  };
10148
- /**
10149
- * Generate a new Wallet Unlocked with a random key pair.
10150
- *
10151
- * @param generateOptions - Options to customize the generation process (optional).
10152
- * @returns An unlocked wallet instance.
10153
- */
10154
- __publicField(Wallet, "generate", WalletUnlocked.generate);
10155
- /**
10156
- * Create a Wallet Unlocked from a seed.
10157
- *
10158
- * @param seed - The seed phrase.
10159
- * @param provider - A Provider instance (optional).
10160
- * @param path - The derivation path (optional).
10161
- * @returns An unlocked wallet instance.
10162
- */
10163
- __publicField(Wallet, "fromSeed", WalletUnlocked.fromSeed);
10164
- /**
10165
- * Create a Wallet Unlocked from a mnemonic phrase.
10166
- *
10167
- * @param mnemonic - The mnemonic phrase.
10168
- * @param provider - A Provider instance (optional).
10169
- * @param path - The derivation path (optional).
10170
- * @param passphrase - The passphrase for the mnemonic (optional).
10171
- * @returns An unlocked wallet instance.
10172
- */
10173
- __publicField(Wallet, "fromMnemonic", WalletUnlocked.fromMnemonic);
10174
- /**
10175
- * Create a Wallet Unlocked from an extended key.
10176
- *
10177
- * @param extendedKey - The extended key.
10178
- * @param provider - A Provider instance (optional).
10179
- * @returns An unlocked wallet instance.
10180
- */
10181
- __publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
10182
- /**
10183
- * Create a Wallet Unlocked from an encrypted JSON.
10184
- *
10185
- * @param jsonWallet - The encrypted JSON keystore.
10186
- * @param password - The password to decrypt the JSON.
10187
- * @param provider - A Provider instance (optional).
10188
- * @returns An unlocked wallet instance.
10189
- */
10190
- __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
10191
10321
 
10192
10322
  // src/test-utils/wallet-config.ts
10193
- var WalletsConfig = class {
10323
+ var WalletsConfig = class _WalletsConfig {
10324
+ static {
10325
+ __name(this, "WalletsConfig");
10326
+ }
10194
10327
  initialState;
10195
10328
  options;
10196
10329
  wallets;
10197
- generateWallets = () => {
10330
+ generateWallets = /* @__PURE__ */ __name(() => {
10198
10331
  const generatedWallets = [];
10199
10332
  for (let index = 1; index <= this.options.count; index++) {
10200
10333
  generatedWallets.push(new WalletUnlocked((0, import_crypto9.randomBytes)(32)));
10201
10334
  }
10202
10335
  return generatedWallets;
10203
- };
10336
+ }, "generateWallets");
10204
10337
  constructor(baseAssetId, config) {
10205
- WalletsConfig.validate(config);
10338
+ _WalletsConfig.validate(config);
10206
10339
  this.options = config;
10207
10340
  const { assets, coinsPerAsset, amountPerCoin, messages } = this.options;
10208
10341
  this.wallets = this.generateWallets();
10209
10342
  this.initialState = {
10210
- messages: WalletsConfig.createMessages(this.wallets, messages),
10211
- coins: WalletsConfig.createCoins(
10343
+ messages: _WalletsConfig.createMessages(this.wallets, messages),
10344
+ coins: _WalletsConfig.createCoins(
10212
10345
  this.wallets,
10213
10346
  baseAssetId,
10214
10347
  assets,
@@ -10268,26 +10401,26 @@ var WalletsConfig = class {
10268
10401
  amountPerCoin
10269
10402
  }) {
10270
10403
  if (Array.isArray(wallets) && wallets.length === 0 || typeof wallets === "number" && wallets <= 0) {
10271
- throw new import_errors28.FuelError(
10272
- import_errors28.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10404
+ throw new import_errors27.FuelError(
10405
+ import_errors27.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10273
10406
  "Number of wallets must be greater than zero."
10274
10407
  );
10275
10408
  }
10276
10409
  if (Array.isArray(assets) && assets.length === 0 || typeof assets === "number" && assets <= 0) {
10277
- throw new import_errors28.FuelError(
10278
- import_errors28.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10410
+ throw new import_errors27.FuelError(
10411
+ import_errors27.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10279
10412
  "Number of assets per wallet must be greater than zero."
10280
10413
  );
10281
10414
  }
10282
10415
  if (coinsPerAsset <= 0) {
10283
- throw new import_errors28.FuelError(
10284
- import_errors28.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10416
+ throw new import_errors27.FuelError(
10417
+ import_errors27.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10285
10418
  "Number of coins per asset must be greater than zero."
10286
10419
  );
10287
10420
  }
10288
10421
  if ((0, import_math24.bn)(amountPerCoin).lt(0)) {
10289
- throw new import_errors28.FuelError(
10290
- import_errors28.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10422
+ throw new import_errors27.FuelError(
10423
+ import_errors27.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10291
10424
  "Amount per coin must be greater than or equal to zero."
10292
10425
  );
10293
10426
  }
@@ -10330,9 +10463,9 @@ async function setupTestProviderAndWallets({
10330
10463
  if (launchNodeServerPort) {
10331
10464
  const serverUrl = `http://localhost:${launchNodeServerPort}`;
10332
10465
  url = await (await fetch(serverUrl, { method: "POST", body: JSON.stringify(launchNodeOptions) })).text();
10333
- cleanup = () => {
10466
+ cleanup = /* @__PURE__ */ __name(() => {
10334
10467
  fetch(`${serverUrl}/cleanup/${url}`);
10335
- };
10468
+ }, "cleanup");
10336
10469
  } else {
10337
10470
  const settings = await launchNode(launchNodeOptions);
10338
10471
  url = settings.url;
@@ -10357,6 +10490,7 @@ async function setupTestProviderAndWallets({
10357
10490
  [Symbol.dispose]: cleanup
10358
10491
  };
10359
10492
  }
10493
+ __name(setupTestProviderAndWallets, "setupTestProviderAndWallets");
10360
10494
 
10361
10495
  // src/test-utils/test-message.ts
10362
10496
  var import_address8 = require("@fuel-ts/address");
@@ -10364,6 +10498,9 @@ var import_crypto10 = require("@fuel-ts/crypto");
10364
10498
  var import_math25 = require("@fuel-ts/math");
10365
10499
  var import_utils45 = require("@fuel-ts/utils");
10366
10500
  var TestMessage = class {
10501
+ static {
10502
+ __name(this, "TestMessage");
10503
+ }
10367
10504
  sender;
10368
10505
  recipient;
10369
10506
  nonce;