@fuel-ts/account 0.100.0 → 0.100.2

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,11 +438,11 @@ 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_errors20 = require("@fuel-ts/errors");
445
+ var import_errors21 = require("@fuel-ts/errors");
459
446
  var import_math19 = require("@fuel-ts/math");
460
447
  var import_transactions23 = require("@fuel-ts/transactions");
461
448
  var import_utils30 = require("@fuel-ts/utils");
@@ -464,6 +451,18 @@ 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
 
454
+ // src/connectors/utils/promises.ts
455
+ var import_errors2 = require("@fuel-ts/errors");
456
+ function deferPromise() {
457
+ const defer = {};
458
+ defer.promise = new Promise((resolve, reject) => {
459
+ defer.reject = reject;
460
+ defer.resolve = resolve;
461
+ });
462
+ return defer;
463
+ }
464
+ __name(deferPromise, "deferPromise");
465
+
467
466
  // src/providers/__generated__/operations.ts
468
467
  var import_graphql_tag = __toESM(require("graphql-tag"));
469
468
  var SubmittedStatusFragmentDoc = import_graphql_tag.default`
@@ -955,6 +954,11 @@ var NodeInfoFragmentDoc = import_graphql_tag.default`
955
954
  maxTx
956
955
  maxDepth
957
956
  nodeVersion
957
+ indexation {
958
+ balances
959
+ coinsToSpend
960
+ assetMetadata
961
+ }
958
962
  }
959
963
  `;
960
964
  var RelayedTransactionStatusFragmentDoc = import_graphql_tag.default`
@@ -1236,7 +1240,7 @@ var GetBalancesDocument = import_graphql_tag.default`
1236
1240
  }
1237
1241
  `;
1238
1242
  var GetBalancesV2Document = import_graphql_tag.default`
1239
- query getBalancesV2($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
1243
+ query getBalancesV2($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int, $supportsPagination: Boolean!) {
1240
1244
  balances(
1241
1245
  filter: $filter
1242
1246
  after: $after
@@ -1244,7 +1248,7 @@ var GetBalancesV2Document = import_graphql_tag.default`
1244
1248
  first: $first
1245
1249
  last: $last
1246
1250
  ) {
1247
- pageInfo {
1251
+ pageInfo @include(if: $supportsPagination) {
1248
1252
  ...pageInfoFragment
1249
1253
  }
1250
1254
  edges {
@@ -1514,37 +1518,38 @@ function getSdk(requester) {
1514
1518
  }
1515
1519
  };
1516
1520
  }
1521
+ __name(getSdk, "getSdk");
1517
1522
 
1518
1523
  // src/providers/fuel-graphql-subscriber.ts
1519
- var import_errors3 = require("@fuel-ts/errors");
1524
+ var import_errors4 = require("@fuel-ts/errors");
1520
1525
  var import_graphql = require("graphql");
1521
1526
 
1522
1527
  // src/providers/utils/handle-gql-error-message.ts
1523
- var import_errors2 = require("@fuel-ts/errors");
1524
- var mapGqlErrorMessage = (error) => {
1528
+ var import_errors3 = require("@fuel-ts/errors");
1529
+ var mapGqlErrorMessage = /* @__PURE__ */ __name((error) => {
1525
1530
  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)) {
1526
- return new import_errors2.FuelError(
1527
- import_errors2.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
1531
+ return new import_errors3.FuelError(
1532
+ import_errors3.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
1528
1533
  `Insufficient funds or too many small value coins. Consider combining UTXOs.`,
1529
1534
  {},
1530
1535
  error
1531
1536
  );
1532
1537
  }
1533
1538
  if (new RegExp("resource was not found in table" /* ASSET_NOT_FOUND */).test(error.message)) {
1534
- return new import_errors2.FuelError(
1535
- import_errors2.ErrorCode.ASSET_NOT_FOUND,
1539
+ return new import_errors3.FuelError(
1540
+ import_errors3.ErrorCode.ASSET_NOT_FOUND,
1536
1541
  `Asset not found for given asset id.`,
1537
1542
  {},
1538
1543
  error
1539
1544
  );
1540
1545
  }
1541
- return new import_errors2.FuelError(import_errors2.ErrorCode.INVALID_REQUEST, error.message, {}, error);
1542
- };
1543
- var mapGqlErrorWithIncompatibleNodeVersion = (error, incompatibleNodeVersionMessage) => {
1546
+ return new import_errors3.FuelError(import_errors3.ErrorCode.INVALID_REQUEST, error.message, {}, error);
1547
+ }, "mapGqlErrorMessage");
1548
+ var mapGqlErrorWithIncompatibleNodeVersion = /* @__PURE__ */ __name((error, incompatibleNodeVersionMessage) => {
1544
1549
  if (!incompatibleNodeVersionMessage) {
1545
1550
  return error;
1546
1551
  }
1547
- return new import_errors2.FuelError(
1552
+ return new import_errors3.FuelError(
1548
1553
  error.code,
1549
1554
  `${error.message}
1550
1555
 
@@ -1552,8 +1557,8 @@ ${incompatibleNodeVersionMessage}`,
1552
1557
  error.metadata,
1553
1558
  error.rawError
1554
1559
  );
1555
- };
1556
- var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = false) => {
1560
+ }, "mapGqlErrorWithIncompatibleNodeVersion");
1561
+ var assertGqlResponseHasNoErrors = /* @__PURE__ */ __name((errors, incompatibleNodeVersionMessage = false) => {
1557
1562
  if (!Array.isArray(errors)) {
1558
1563
  return;
1559
1564
  }
@@ -1563,16 +1568,21 @@ var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = fal
1563
1568
  }
1564
1569
  const errorMessage = mappedErrors.map((err) => err.message).join("\n");
1565
1570
  throw mapGqlErrorWithIncompatibleNodeVersion(
1566
- new import_errors2.FuelError(import_errors2.ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
1571
+ new import_errors3.FuelError(import_errors3.ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
1567
1572
  incompatibleNodeVersionMessage
1568
1573
  );
1569
- };
1574
+ }, "assertGqlResponseHasNoErrors");
1570
1575
 
1571
1576
  // src/providers/fuel-graphql-subscriber.ts
1572
- var _FuelGraphqlSubscriber = class {
1577
+ var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
1573
1578
  constructor(stream) {
1574
1579
  this.stream = stream;
1575
1580
  }
1581
+ static {
1582
+ __name(this, "FuelGraphqlSubscriber");
1583
+ }
1584
+ static incompatibleNodeVersionMessage = false;
1585
+ static textDecoder = new TextDecoder();
1576
1586
  static async create(options) {
1577
1587
  const { url, query, variables, fetchFn } = options;
1578
1588
  const response = await fetchFn(`${url}-sub`, {
@@ -1614,8 +1624,8 @@ var _FuelGraphqlSubscriber = class {
1614
1624
  try {
1615
1625
  this.events.push(JSON.parse(match.replace(/^data:/, "")));
1616
1626
  } catch (e) {
1617
- throw new import_errors3.FuelError(
1618
- import_errors3.ErrorCode.STREAM_PARSING_ERROR,
1627
+ throw new import_errors4.FuelError(
1628
+ import_errors4.ErrorCode.STREAM_PARSING_ERROR,
1619
1629
  `Error while parsing stream data response: ${text}`
1620
1630
  );
1621
1631
  }
@@ -1633,22 +1643,19 @@ var _FuelGraphqlSubscriber = class {
1633
1643
  return this;
1634
1644
  }
1635
1645
  };
1636
- var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
1637
- __publicField(FuelGraphqlSubscriber, "incompatibleNodeVersionMessage", false);
1638
- __publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
1639
1646
 
1640
1647
  // src/providers/resource-cache.ts
1641
- var import_errors14 = require("@fuel-ts/errors");
1648
+ var import_errors15 = require("@fuel-ts/errors");
1642
1649
  var import_utils23 = require("@fuel-ts/utils");
1643
1650
 
1644
1651
  // src/providers/transaction-request/input.ts
1645
1652
  var import_abi_coder2 = require("@fuel-ts/abi-coder");
1646
1653
  var import_configs = require("@fuel-ts/address/configs");
1647
- var import_errors4 = require("@fuel-ts/errors");
1654
+ var import_errors5 = require("@fuel-ts/errors");
1648
1655
  var import_math3 = require("@fuel-ts/math");
1649
1656
  var import_transactions = require("@fuel-ts/transactions");
1650
1657
  var import_utils4 = require("@fuel-ts/utils");
1651
- var inputify = (value) => {
1658
+ var inputify = /* @__PURE__ */ __name((value) => {
1652
1659
  const { type } = value;
1653
1660
  switch (value.type) {
1654
1661
  case import_transactions.InputType.Coin: {
@@ -1708,21 +1715,21 @@ var inputify = (value) => {
1708
1715
  };
1709
1716
  }
1710
1717
  default: {
1711
- throw new import_errors4.FuelError(
1712
- import_errors4.ErrorCode.INVALID_TRANSACTION_INPUT,
1718
+ throw new import_errors5.FuelError(
1719
+ import_errors5.ErrorCode.INVALID_TRANSACTION_INPUT,
1713
1720
  `Invalid transaction input type: ${type}.`
1714
1721
  );
1715
1722
  }
1716
1723
  }
1717
- };
1724
+ }, "inputify");
1718
1725
 
1719
1726
  // src/providers/transaction-request/output.ts
1720
1727
  var import_configs2 = require("@fuel-ts/address/configs");
1721
- var import_errors5 = require("@fuel-ts/errors");
1728
+ var import_errors6 = require("@fuel-ts/errors");
1722
1729
  var import_math4 = require("@fuel-ts/math");
1723
1730
  var import_transactions2 = require("@fuel-ts/transactions");
1724
1731
  var import_utils5 = require("@fuel-ts/utils");
1725
- var outputify = (value) => {
1732
+ var outputify = /* @__PURE__ */ __name((value) => {
1726
1733
  const { type } = value;
1727
1734
  switch (type) {
1728
1735
  case import_transactions2.OutputType.Coin: {
@@ -1765,29 +1772,29 @@ var outputify = (value) => {
1765
1772
  };
1766
1773
  }
1767
1774
  default: {
1768
- throw new import_errors5.FuelError(
1769
- import_errors5.ErrorCode.INVALID_TRANSACTION_INPUT,
1775
+ throw new import_errors6.FuelError(
1776
+ import_errors6.ErrorCode.INVALID_TRANSACTION_INPUT,
1770
1777
  `Invalid transaction output type: ${type}.`
1771
1778
  );
1772
1779
  }
1773
1780
  }
1774
- };
1781
+ }, "outputify");
1775
1782
 
1776
1783
  // src/providers/transaction-request/transaction-request.ts
1777
1784
  var import_abi_coder3 = require("@fuel-ts/abi-coder");
1778
1785
  var import_address2 = require("@fuel-ts/address");
1779
1786
  var import_configs6 = require("@fuel-ts/address/configs");
1780
1787
  var import_crypto3 = require("@fuel-ts/crypto");
1781
- var import_errors10 = require("@fuel-ts/errors");
1788
+ var import_errors11 = require("@fuel-ts/errors");
1782
1789
  var import_math9 = require("@fuel-ts/math");
1783
1790
  var import_transactions8 = require("@fuel-ts/transactions");
1784
1791
  var import_utils11 = require("@fuel-ts/utils");
1785
1792
 
1786
1793
  // src/providers/message.ts
1787
- var isMessageCoin = (message) => !("data" in message);
1794
+ var isMessageCoin = /* @__PURE__ */ __name((message) => !("data" in message), "isMessageCoin");
1788
1795
 
1789
1796
  // src/providers/resource.ts
1790
- var isCoin = (resource) => "id" in resource;
1797
+ var isCoin = /* @__PURE__ */ __name((resource) => "id" in resource, "isCoin");
1791
1798
 
1792
1799
  // src/providers/utils/receipts.ts
1793
1800
  var import_transactions4 = require("@fuel-ts/transactions");
@@ -1795,11 +1802,11 @@ var import_configs4 = require("@fuel-ts/transactions/configs");
1795
1802
 
1796
1803
  // src/providers/utils/serialization.ts
1797
1804
  var import_configs3 = require("@fuel-ts/address/configs");
1798
- var import_errors6 = require("@fuel-ts/errors");
1805
+ var import_errors7 = require("@fuel-ts/errors");
1799
1806
  var import_math5 = require("@fuel-ts/math");
1800
1807
  var import_transactions3 = require("@fuel-ts/transactions");
1801
1808
  var import_utils6 = require("@fuel-ts/utils");
1802
- var deserializeChain = (chain) => {
1809
+ var deserializeChain = /* @__PURE__ */ __name((chain) => {
1803
1810
  const { name, daHeight, consensusParameters } = chain;
1804
1811
  const {
1805
1812
  contractParams,
@@ -1853,8 +1860,8 @@ var deserializeChain = (chain) => {
1853
1860
  gasCosts
1854
1861
  }
1855
1862
  };
1856
- };
1857
- var serializeChain = (chain) => {
1863
+ }, "deserializeChain");
1864
+ var serializeChain = /* @__PURE__ */ __name((chain) => {
1858
1865
  const { name, baseChainHeight, consensusParameters } = chain;
1859
1866
  const {
1860
1867
  contractParameters,
@@ -1908,39 +1915,41 @@ var serializeChain = (chain) => {
1908
1915
  gasCosts
1909
1916
  }
1910
1917
  };
1911
- };
1912
- var deserializeNodeInfo = (nodeInfo) => {
1913
- const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
1918
+ }, "serializeChain");
1919
+ var deserializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
1920
+ const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace, indexation } = nodeInfo;
1914
1921
  return {
1915
1922
  maxDepth: (0, import_math5.bn)(maxDepth),
1916
1923
  maxTx: (0, import_math5.bn)(maxTx),
1917
1924
  nodeVersion,
1918
1925
  utxoValidation,
1919
- vmBacktrace
1926
+ vmBacktrace,
1927
+ indexation
1920
1928
  };
1921
- };
1922
- var serializeNodeInfo = (nodeInfo) => {
1923
- const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
1929
+ }, "deserializeNodeInfo");
1930
+ var serializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
1931
+ const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace, indexation } = nodeInfo;
1924
1932
  return {
1925
1933
  maxDepth: maxDepth.toString(),
1926
1934
  maxTx: maxTx.toString(),
1927
1935
  nodeVersion,
1928
1936
  utxoValidation,
1929
- vmBacktrace
1937
+ vmBacktrace,
1938
+ indexation
1930
1939
  };
1931
- };
1932
- var deserializeProviderCache = (cache2) => ({
1940
+ }, "serializeNodeInfo");
1941
+ var deserializeProviderCache = /* @__PURE__ */ __name((cache2) => ({
1933
1942
  consensusParametersTimestamp: cache2.consensusParametersTimestamp,
1934
1943
  chain: deserializeChain(cache2.chain),
1935
1944
  nodeInfo: deserializeNodeInfo(cache2.nodeInfo)
1936
- });
1937
- var serializeProviderCache = async (provider) => ({
1945
+ }), "deserializeProviderCache");
1946
+ var serializeProviderCache = /* @__PURE__ */ __name(async (provider) => ({
1938
1947
  consensusParametersTimestamp: provider.consensusParametersTimestamp,
1939
1948
  chain: serializeChain(await provider.getChain()),
1940
1949
  nodeInfo: serializeNodeInfo(await provider.getNode())
1941
- });
1942
- var hexOrZero = (hex) => hex || import_configs3.ZeroBytes32;
1943
- var deserializeReceipt = (receipt) => {
1950
+ }), "serializeProviderCache");
1951
+ var hexOrZero = /* @__PURE__ */ __name((hex) => hex || import_configs3.ZeroBytes32, "hexOrZero");
1952
+ var deserializeReceipt = /* @__PURE__ */ __name((receipt) => {
1944
1953
  const { receiptType } = receipt;
1945
1954
  switch (receiptType) {
1946
1955
  case "CALL" /* Call */: {
@@ -2130,14 +2139,14 @@ var deserializeReceipt = (receipt) => {
2130
2139
  return burnReceipt;
2131
2140
  }
2132
2141
  default:
2133
- throw new import_errors6.FuelError(import_errors6.ErrorCode.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
2142
+ throw new import_errors7.FuelError(import_errors7.ErrorCode.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
2134
2143
  }
2135
- };
2144
+ }, "deserializeReceipt");
2136
2145
 
2137
2146
  // src/providers/utils/receipts.ts
2138
- var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions4.ReceiptType.Revert && receipt.val.toString("hex") === import_configs4.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
2139
- var doesReceiptHaveMissingContractId = (receipt) => receipt.type === import_transactions4.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
2140
- var getReceiptsWithMissingData = (receipts) => receipts.reduce(
2147
+ var doesReceiptHaveMissingOutputVariables = /* @__PURE__ */ __name((receipt) => receipt.type === import_transactions4.ReceiptType.Revert && receipt.val.toString("hex") === import_configs4.FAILED_TRANSFER_TO_ADDRESS_SIGNAL, "doesReceiptHaveMissingOutputVariables");
2148
+ var doesReceiptHaveMissingContractId = /* @__PURE__ */ __name((receipt) => receipt.type === import_transactions4.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000", "doesReceiptHaveMissingContractId");
2149
+ var getReceiptsWithMissingData = /* @__PURE__ */ __name((receipts) => receipts.reduce(
2141
2150
  (memo, receipt) => {
2142
2151
  if (doesReceiptHaveMissingOutputVariables(receipt)) {
2143
2152
  memo.missingOutputVariables.push(receipt);
@@ -2151,22 +2160,22 @@ var getReceiptsWithMissingData = (receipts) => receipts.reduce(
2151
2160
  missingOutputVariables: [],
2152
2161
  missingOutputContractIds: []
2153
2162
  }
2154
- );
2163
+ ), "getReceiptsWithMissingData");
2155
2164
 
2156
2165
  // src/providers/utils/block-explorer.ts
2157
- var import_errors7 = require("@fuel-ts/errors");
2166
+ var import_errors8 = require("@fuel-ts/errors");
2158
2167
 
2159
2168
  // src/providers/utils/gas.ts
2160
2169
  var import_math6 = require("@fuel-ts/math");
2161
2170
  var import_transactions5 = require("@fuel-ts/transactions");
2162
2171
  var import_utils7 = require("@fuel-ts/utils");
2163
- var getGasUsedFromReceipts = (receipts) => {
2172
+ var getGasUsedFromReceipts = /* @__PURE__ */ __name((receipts) => {
2164
2173
  const scriptResult = receipts.filter(
2165
2174
  (receipt) => receipt.type === import_transactions5.ReceiptType.ScriptResult
2166
2175
  );
2167
2176
  const gasUsed = scriptResult.reduce((prev, receipt) => prev.add(receipt.gasUsed), (0, import_math6.bn)(0));
2168
2177
  return gasUsed;
2169
- };
2178
+ }, "getGasUsedFromReceipts");
2170
2179
  function resolveGasDependentCosts(byteSize, gasDependentCost) {
2171
2180
  const base = (0, import_math6.bn)(gasDependentCost.base);
2172
2181
  let dependentValue = (0, import_math6.bn)(0);
@@ -2177,6 +2186,7 @@ function resolveGasDependentCosts(byteSize, gasDependentCost) {
2177
2186
  }
2178
2187
  return base.add(dependentValue);
2179
2188
  }
2189
+ __name(resolveGasDependentCosts, "resolveGasDependentCosts");
2180
2190
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
2181
2191
  const witnessCache = [];
2182
2192
  const chargeableInputs = inputs.filter((input) => {
@@ -2203,6 +2213,7 @@ function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
2203
2213
  }, (0, import_math6.bn)(0));
2204
2214
  return totalGas;
2205
2215
  }
2216
+ __name(gasUsedByInputs, "gasUsedByInputs");
2206
2217
  function getMinGas(params) {
2207
2218
  const { gasCosts, gasPerByte, inputs, metadataGas, txBytesSize } = params;
2208
2219
  const vmInitGas = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
@@ -2211,6 +2222,7 @@ function getMinGas(params) {
2211
2222
  const minGas = vmInitGas.add(bytesGas).add(inputsGas).add(metadataGas).maxU64();
2212
2223
  return minGas;
2213
2224
  }
2225
+ __name(getMinGas, "getMinGas");
2214
2226
  function getMaxGas(params) {
2215
2227
  const {
2216
2228
  gasPerByte,
@@ -2227,6 +2239,7 @@ function getMaxGas(params) {
2227
2239
  const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
2228
2240
  return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
2229
2241
  }
2242
+ __name(getMaxGas, "getMaxGas");
2230
2243
  function calculateMetadataGasForTxCreate({
2231
2244
  gasCosts,
2232
2245
  stateRootSize,
@@ -2241,12 +2254,14 @@ function calculateMetadataGasForTxCreate({
2241
2254
  const metadataGas = contractRootGas.add(stateRootGas).add(txIdGas).add(contractIdGas);
2242
2255
  return metadataGas.maxU64();
2243
2256
  }
2257
+ __name(calculateMetadataGasForTxCreate, "calculateMetadataGasForTxCreate");
2244
2258
  function calculateMetadataGasForTxScript({
2245
2259
  gasCosts,
2246
2260
  txBytesSize
2247
2261
  }) {
2248
2262
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2249
2263
  }
2264
+ __name(calculateMetadataGasForTxScript, "calculateMetadataGasForTxScript");
2250
2265
  function calculateMetadataGasForTxBlob({
2251
2266
  gasCosts,
2252
2267
  txBytesSize,
@@ -2256,6 +2271,7 @@ function calculateMetadataGasForTxBlob({
2256
2271
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
2257
2272
  return txId.add(blobLen);
2258
2273
  }
2274
+ __name(calculateMetadataGasForTxBlob, "calculateMetadataGasForTxBlob");
2259
2275
  function calculateMetadataGasForTxUpgrade({
2260
2276
  gasCosts,
2261
2277
  txBytesSize,
@@ -2268,6 +2284,7 @@ function calculateMetadataGasForTxUpgrade({
2268
2284
  }
2269
2285
  return txId;
2270
2286
  }
2287
+ __name(calculateMetadataGasForTxUpgrade, "calculateMetadataGasForTxUpgrade");
2271
2288
  function calculateMetadataGasForTxUpload({
2272
2289
  gasCosts,
2273
2290
  txBytesSize,
@@ -2281,6 +2298,7 @@ function calculateMetadataGasForTxUpload({
2281
2298
  txId.add(subsectionsLen);
2282
2299
  return txId;
2283
2300
  }
2301
+ __name(calculateMetadataGasForTxUpload, "calculateMetadataGasForTxUpload");
2284
2302
  function calculateMinGasForTxUpload({
2285
2303
  gasCosts,
2286
2304
  baseMinGas,
@@ -2289,10 +2307,11 @@ function calculateMinGasForTxUpload({
2289
2307
  const additionalStoragePerByte = (0, import_math6.bn)(gasCosts.newStoragePerByte).mul(subsectionSize);
2290
2308
  return (0, import_math6.bn)(baseMinGas).add(additionalStoragePerByte);
2291
2309
  }
2292
- var calculateGasFee = (params) => {
2310
+ __name(calculateMinGasForTxUpload, "calculateMinGasForTxUpload");
2311
+ var calculateGasFee = /* @__PURE__ */ __name((params) => {
2293
2312
  const { gas, gasPrice, priceFactor, tip } = params;
2294
2313
  return gas.mul(gasPrice).div(priceFactor).add((0, import_math6.bn)(tip));
2295
- };
2314
+ }, "calculateGasFee");
2296
2315
 
2297
2316
  // src/providers/utils/json.ts
2298
2317
  var import_utils8 = require("@fuel-ts/utils");
@@ -2321,16 +2340,18 @@ function normalize(object) {
2321
2340
  });
2322
2341
  return object;
2323
2342
  }
2343
+ __name(normalize, "normalize");
2324
2344
  function normalizeJSON(root) {
2325
2345
  return normalize((0, import_ramda.clone)(root));
2326
2346
  }
2347
+ __name(normalizeJSON, "normalizeJSON");
2327
2348
 
2328
2349
  // src/providers/utils/extract-tx-error.ts
2329
- var import_errors8 = require("@fuel-ts/errors");
2350
+ var import_errors9 = require("@fuel-ts/errors");
2330
2351
  var import_math7 = require("@fuel-ts/math");
2331
2352
  var import_transactions6 = require("@fuel-ts/transactions");
2332
2353
  var import_configs5 = require("@fuel-ts/transactions/configs");
2333
- var assemblePanicError = (statusReason, metadata) => {
2354
+ var assemblePanicError = /* @__PURE__ */ __name((statusReason, metadata) => {
2334
2355
  let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
2335
2356
  if (import_configs5.PANIC_REASONS.includes(statusReason)) {
2336
2357
  errorMessage = `${errorMessage}
@@ -2339,13 +2360,13 @@ You can read more about this error at:
2339
2360
 
2340
2361
  ${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
2341
2362
  }
2342
- return new import_errors8.FuelError(import_errors8.ErrorCode.SCRIPT_REVERTED, errorMessage, {
2363
+ return new import_errors9.FuelError(import_errors9.ErrorCode.SCRIPT_REVERTED, errorMessage, {
2343
2364
  ...metadata,
2344
2365
  reason: statusReason
2345
2366
  });
2346
- };
2347
- var stringify = (obj) => JSON.stringify(obj, null, 2);
2348
- var assembleRevertError = (receipts, logs, metadata) => {
2367
+ }, "assemblePanicError");
2368
+ var stringify = /* @__PURE__ */ __name((obj) => JSON.stringify(obj, null, 2), "stringify");
2369
+ var assembleRevertError = /* @__PURE__ */ __name((receipts, logs, metadata) => {
2349
2370
  let errorMessage = "The transaction reverted with an unknown reason.";
2350
2371
  const revertReceipt = receipts.find(({ type }) => type === import_transactions6.ReceiptType.Revert);
2351
2372
  let reason = "";
@@ -2380,8 +2401,8 @@ var assembleRevertError = (receipts, logs, metadata) => {
2380
2401
  errorMessage = `The transaction reverted because it's missing an "OutputVariable".`;
2381
2402
  break;
2382
2403
  default:
2383
- throw new import_errors8.FuelError(
2384
- import_errors8.ErrorCode.UNKNOWN,
2404
+ throw new import_errors9.FuelError(
2405
+ import_errors9.ErrorCode.UNKNOWN,
2385
2406
  `The transaction reverted with an unknown reason: ${revertReceipt.val}`,
2386
2407
  {
2387
2408
  ...metadata,
@@ -2390,12 +2411,12 @@ var assembleRevertError = (receipts, logs, metadata) => {
2390
2411
  );
2391
2412
  }
2392
2413
  }
2393
- return new import_errors8.FuelError(import_errors8.ErrorCode.SCRIPT_REVERTED, errorMessage, {
2414
+ return new import_errors9.FuelError(import_errors9.ErrorCode.SCRIPT_REVERTED, errorMessage, {
2394
2415
  ...metadata,
2395
2416
  reason
2396
2417
  });
2397
- };
2398
- var extractTxError = (params) => {
2418
+ }, "assembleRevertError");
2419
+ var extractTxError = /* @__PURE__ */ __name((params) => {
2399
2420
  const { receipts, statusReason, logs } = params;
2400
2421
  const isPanic = receipts.some(({ type }) => type === import_transactions6.ReceiptType.Panic);
2401
2422
  const isRevert = receipts.some(({ type }) => type === import_transactions6.ReceiptType.Revert);
@@ -2410,7 +2431,7 @@ var extractTxError = (params) => {
2410
2431
  return assemblePanicError(statusReason, metadata);
2411
2432
  }
2412
2433
  return assembleRevertError(receipts, logs, metadata);
2413
- };
2434
+ }, "extractTxError");
2414
2435
 
2415
2436
  // src/providers/transaction-request/errors.ts
2416
2437
  var NoWitnessAtIndexError = class extends Error {
@@ -2419,23 +2440,26 @@ var NoWitnessAtIndexError = class extends Error {
2419
2440
  this.index = index;
2420
2441
  this.message = `Witness at index "${index}" was not found`;
2421
2442
  }
2443
+ static {
2444
+ __name(this, "NoWitnessAtIndexError");
2445
+ }
2422
2446
  name = "NoWitnessAtIndexError";
2423
2447
  };
2424
2448
 
2425
2449
  // src/providers/transaction-request/helpers.ts
2426
- var import_errors9 = require("@fuel-ts/errors");
2450
+ var import_errors10 = require("@fuel-ts/errors");
2427
2451
  var import_math8 = require("@fuel-ts/math");
2428
2452
  var import_transactions7 = require("@fuel-ts/transactions");
2429
2453
  var import_utils9 = require("@fuel-ts/utils");
2430
- var isRequestInputCoin = (input) => input.type === import_transactions7.InputType.Coin;
2431
- var isRequestInputMessage = (input) => input.type === import_transactions7.InputType.Message;
2432
- var isRequestInputMessageWithoutData = (input) => input.type === import_transactions7.InputType.Message && (0, import_math8.bn)(input.data).isZero();
2433
- var isRequestInputCoinOrMessage = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
2434
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessageWithoutData(input);
2435
- var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
2436
- var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
2437
- var isPredicate = (input) => isRequestInputCoinOrMessage(input) && !!input.predicate && (0, import_utils9.hexlify)(input.predicate) !== "0x";
2438
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
2454
+ var isRequestInputCoin = /* @__PURE__ */ __name((input) => input.type === import_transactions7.InputType.Coin, "isRequestInputCoin");
2455
+ var isRequestInputMessage = /* @__PURE__ */ __name((input) => input.type === import_transactions7.InputType.Message, "isRequestInputMessage");
2456
+ var isRequestInputMessageWithoutData = /* @__PURE__ */ __name((input) => input.type === import_transactions7.InputType.Message && (0, import_math8.bn)(input.data).isZero(), "isRequestInputMessageWithoutData");
2457
+ var isRequestInputCoinOrMessage = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) || isRequestInputMessage(input), "isRequestInputCoinOrMessage");
2458
+ var isRequestInputResource = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) || isRequestInputMessageWithoutData(input), "isRequestInputResource");
2459
+ var getRequestInputResourceOwner = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) ? input.owner : input.recipient, "getRequestInputResourceOwner");
2460
+ var isRequestInputResourceFromOwner = /* @__PURE__ */ __name((input, owner) => getRequestInputResourceOwner(input) === owner.toB256(), "isRequestInputResourceFromOwner");
2461
+ var isPredicate = /* @__PURE__ */ __name((input) => isRequestInputCoinOrMessage(input) && !!input.predicate && (0, import_utils9.hexlify)(input.predicate) !== "0x", "isPredicate");
2462
+ var getAssetAmountInRequestInputs = /* @__PURE__ */ __name((inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
2439
2463
  if (isRequestInputCoin(input) && input.assetId === assetId) {
2440
2464
  return acc.add(input.amount);
2441
2465
  }
@@ -2443,8 +2467,8 @@ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filte
2443
2467
  return acc.add(input.amount);
2444
2468
  }
2445
2469
  return acc;
2446
- }, (0, import_math8.bn)(0));
2447
- var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2470
+ }, (0, import_math8.bn)(0)), "getAssetAmountInRequestInputs");
2471
+ var cacheRequestInputsResourcesFromOwner = /* @__PURE__ */ __name((inputs, owner) => inputs.reduce(
2448
2472
  (acc, input) => {
2449
2473
  if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
2450
2474
  acc.utxos.push(input.id);
@@ -2457,8 +2481,8 @@ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2457
2481
  utxos: [],
2458
2482
  messages: []
2459
2483
  }
2460
- );
2461
- var getBurnableAssetCount = (baseAssetId, transactionRequest) => {
2484
+ ), "cacheRequestInputsResourcesFromOwner");
2485
+ var getBurnableAssetCount = /* @__PURE__ */ __name((baseAssetId, transactionRequest) => {
2462
2486
  const { inputs, outputs } = transactionRequest;
2463
2487
  const coinInputs = new Set(inputs.filter(isRequestInputCoin).map((input) => input.assetId));
2464
2488
  if (inputs.some((i) => isRequestInputMessage(i) && (0, import_math8.bn)(i.amount).gt(0))) {
@@ -2469,8 +2493,8 @@ var getBurnableAssetCount = (baseAssetId, transactionRequest) => {
2469
2493
  );
2470
2494
  const difference = new Set([...coinInputs].filter((x) => !changeOutputs.has(x)));
2471
2495
  return difference.size;
2472
- };
2473
- var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAssetBurn = false) => {
2496
+ }, "getBurnableAssetCount");
2497
+ var validateTransactionForAssetBurn = /* @__PURE__ */ __name((baseAssetId, transactionRequest, enableAssetBurn = false) => {
2474
2498
  if (enableAssetBurn === true) {
2475
2499
  return;
2476
2500
  }
@@ -2482,21 +2506,24 @@ var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAs
2482
2506
  "Add the relevant change outputs to the transaction to avoid burning assets.",
2483
2507
  "Or enable asset burn, upon sending the transaction."
2484
2508
  ].join("\n");
2485
- throw new import_errors9.FuelError(import_errors9.ErrorCode.ASSET_BURN_DETECTED, message);
2486
- };
2509
+ throw new import_errors10.FuelError(import_errors10.ErrorCode.ASSET_BURN_DETECTED, message);
2510
+ }, "validateTransactionForAssetBurn");
2487
2511
 
2488
2512
  // src/providers/transaction-request/witness.ts
2489
2513
  var import_utils10 = require("@fuel-ts/utils");
2490
- var witnessify = (value) => {
2514
+ var witnessify = /* @__PURE__ */ __name((value) => {
2491
2515
  const data = (0, import_utils10.arrayify)(value);
2492
2516
  return {
2493
2517
  data: (0, import_utils10.hexlify)(data),
2494
2518
  dataLength: data.length
2495
2519
  };
2496
- };
2520
+ }, "witnessify");
2497
2521
 
2498
2522
  // src/providers/transaction-request/transaction-request.ts
2499
- var BaseTransactionRequest = class {
2523
+ var BaseTransactionRequest = class _BaseTransactionRequest {
2524
+ static {
2525
+ __name(this, "BaseTransactionRequest");
2526
+ }
2500
2527
  /** Gas price for transaction */
2501
2528
  tip;
2502
2529
  /** Block until which tx cannot be included */
@@ -2579,7 +2606,7 @@ var BaseTransactionRequest = class {
2579
2606
  const inputs = this.inputs?.map(inputify) ?? [];
2580
2607
  const outputs = this.outputs?.map(outputify) ?? [];
2581
2608
  const witnesses = this.witnesses?.map(witnessify) ?? [];
2582
- const { policyTypes, policies } = BaseTransactionRequest.getPolicyMeta(this);
2609
+ const { policyTypes, policies } = _BaseTransactionRequest.getPolicyMeta(this);
2583
2610
  return {
2584
2611
  policyTypes,
2585
2612
  inputs,
@@ -2880,7 +2907,7 @@ var BaseTransactionRequest = class {
2880
2907
  * @hidden
2881
2908
  */
2882
2909
  metadataGas(_gasCosts) {
2883
- throw new import_errors10.FuelError(import_errors10.FuelError.CODES.NOT_IMPLEMENTED, "Not implemented");
2910
+ throw new import_errors11.FuelError(import_errors11.FuelError.CODES.NOT_IMPLEMENTED, "Not implemented");
2884
2911
  }
2885
2912
  /**
2886
2913
  * @hidden
@@ -2927,13 +2954,13 @@ var BaseTransactionRequest = class {
2927
2954
  * Please use `Account.generateFakeResources` along with `this.addResources` instead.
2928
2955
  */
2929
2956
  fundWithFakeUtxos(quantities, baseAssetId, resourcesOwner) {
2930
- const findAssetInput = (assetId) => this.inputs.find((input) => {
2957
+ const findAssetInput = /* @__PURE__ */ __name((assetId) => this.inputs.find((input) => {
2931
2958
  if ("assetId" in input) {
2932
2959
  return input.assetId === assetId;
2933
2960
  }
2934
2961
  return false;
2935
- });
2936
- const updateAssetInput = (assetId, quantity) => {
2962
+ }), "findAssetInput");
2963
+ const updateAssetInput = /* @__PURE__ */ __name((assetId, quantity) => {
2937
2964
  const assetInput = findAssetInput(assetId);
2938
2965
  let usedQuantity = quantity;
2939
2966
  if (assetId === baseAssetId) {
@@ -2954,7 +2981,7 @@ var BaseTransactionRequest = class {
2954
2981
  }
2955
2982
  ]);
2956
2983
  }
2957
- };
2984
+ }, "updateAssetInput");
2958
2985
  updateAssetInput(baseAssetId, (0, import_math9.bn)(1e11));
2959
2986
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2960
2987
  return this;
@@ -3042,6 +3069,7 @@ function hashTransaction(transactionRequest, chainId) {
3042
3069
  transaction.inputs = transaction.inputs.map((input) => {
3043
3070
  const inputClone = (0, import_ramda2.clone)(input);
3044
3071
  switch (inputClone.type) {
3072
+ // Zero out on signing: txPointer, predicateGasUsed
3045
3073
  case import_transactions9.InputType.Coin: {
3046
3074
  inputClone.txPointer = {
3047
3075
  blockHeight: 0,
@@ -3050,10 +3078,12 @@ function hashTransaction(transactionRequest, chainId) {
3050
3078
  inputClone.predicateGasUsed = (0, import_math10.bn)(0);
3051
3079
  return inputClone;
3052
3080
  }
3081
+ // Zero out on signing: predicateGasUsed
3053
3082
  case import_transactions9.InputType.Message: {
3054
3083
  inputClone.predicateGasUsed = (0, import_math10.bn)(0);
3055
3084
  return inputClone;
3056
3085
  }
3086
+ // Zero out on signing: txID, outputIndex, balanceRoot, stateRoot, and txPointer
3057
3087
  case import_transactions9.InputType.Contract: {
3058
3088
  inputClone.txPointer = {
3059
3089
  blockHeight: 0,
@@ -3072,15 +3102,18 @@ function hashTransaction(transactionRequest, chainId) {
3072
3102
  transaction.outputs = transaction.outputs.map((output) => {
3073
3103
  const outputClone = (0, import_ramda2.clone)(output);
3074
3104
  switch (outputClone.type) {
3105
+ // Zero out on signing: balanceRoot, stateRoot
3075
3106
  case import_transactions9.OutputType.Contract: {
3076
3107
  outputClone.balanceRoot = import_configs7.ZeroBytes32;
3077
3108
  outputClone.stateRoot = import_configs7.ZeroBytes32;
3078
3109
  return outputClone;
3079
3110
  }
3111
+ // Zero out on signing: amount
3080
3112
  case import_transactions9.OutputType.Change: {
3081
3113
  outputClone.amount = (0, import_math10.bn)(0);
3082
3114
  return outputClone;
3083
3115
  }
3116
+ // Zero out on signing: amount, to and assetId
3084
3117
  case import_transactions9.OutputType.Variable: {
3085
3118
  outputClone.to = import_configs7.ZeroBytes32;
3086
3119
  outputClone.amount = (0, import_math10.bn)(0);
@@ -3097,9 +3130,13 @@ function hashTransaction(transactionRequest, chainId) {
3097
3130
  const concatenatedData = (0, import_utils13.concat)([chainIdBytes, new import_transactions9.TransactionCoder().encode(transaction)]);
3098
3131
  return (0, import_hasher2.sha256)(concatenatedData);
3099
3132
  }
3133
+ __name(hashTransaction, "hashTransaction");
3100
3134
 
3101
3135
  // src/providers/transaction-request/blob-transaction-request.ts
3102
3136
  var BlobTransactionRequest = class extends BaseTransactionRequest {
3137
+ static {
3138
+ __name(this, "BlobTransactionRequest");
3139
+ }
3103
3140
  static from(obj) {
3104
3141
  return new this((0, import_ramda3.clone)(obj));
3105
3142
  }
@@ -3168,12 +3205,12 @@ var import_ramda4 = require("ramda");
3168
3205
 
3169
3206
  // src/providers/transaction-request/storage-slot.ts
3170
3207
  var import_utils15 = require("@fuel-ts/utils");
3171
- var getStorageValue = (value) => {
3208
+ var getStorageValue = /* @__PURE__ */ __name((value) => {
3172
3209
  const v = new Uint8Array(32);
3173
3210
  v.set((0, import_utils15.arrayify)(value));
3174
3211
  return v;
3175
- };
3176
- var storageSlotify = (storageSlot) => {
3212
+ }, "getStorageValue");
3213
+ var storageSlotify = /* @__PURE__ */ __name((storageSlot) => {
3177
3214
  let key;
3178
3215
  let value;
3179
3216
  if (Array.isArray(storageSlot)) {
@@ -3187,10 +3224,13 @@ var storageSlotify = (storageSlot) => {
3187
3224
  key: (0, import_utils15.hexlify)(key),
3188
3225
  value: (0, import_utils15.hexlify)(getStorageValue(value))
3189
3226
  };
3190
- };
3227
+ }, "storageSlotify");
3191
3228
 
3192
3229
  // src/providers/transaction-request/create-transaction-request.ts
3193
3230
  var CreateTransactionRequest = class extends BaseTransactionRequest {
3231
+ static {
3232
+ __name(this, "CreateTransactionRequest");
3233
+ }
3194
3234
  static from(obj) {
3195
3235
  return new this((0, import_ramda4.clone)(obj));
3196
3236
  }
@@ -3292,7 +3332,7 @@ var returnZeroScript = {
3292
3332
  */
3293
3333
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
3294
3334
  bytes: (0, import_utils17.arrayify)("0x24000000"),
3295
- encodeScriptData: () => new Uint8Array(0)
3335
+ encodeScriptData: /* @__PURE__ */ __name(() => new Uint8Array(0), "encodeScriptData")
3296
3336
  };
3297
3337
  var withdrawScript = {
3298
3338
  /*
@@ -3306,11 +3346,14 @@ var withdrawScript = {
3306
3346
  */
3307
3347
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
3308
3348
  bytes: (0, import_utils17.arrayify)("0x5040C0105D44C0064C40001124000000"),
3309
- encodeScriptData: () => new Uint8Array(0)
3349
+ encodeScriptData: /* @__PURE__ */ __name(() => new Uint8Array(0), "encodeScriptData")
3310
3350
  };
3311
3351
 
3312
3352
  // src/providers/transaction-request/script-transaction-request.ts
3313
3353
  var ScriptTransactionRequest = class extends BaseTransactionRequest {
3354
+ static {
3355
+ __name(this, "ScriptTransactionRequest");
3356
+ }
3314
3357
  static from(obj) {
3315
3358
  return new this((0, import_ramda5.clone)(obj));
3316
3359
  }
@@ -3503,14 +3546,17 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
3503
3546
  };
3504
3547
 
3505
3548
  // src/providers/transaction-request/upgrade-transaction-request.ts
3506
- var import_errors12 = require("@fuel-ts/errors");
3549
+ var import_errors13 = require("@fuel-ts/errors");
3507
3550
  var import_hasher3 = require("@fuel-ts/hasher");
3508
3551
  var import_transactions12 = require("@fuel-ts/transactions");
3509
3552
  var import_utils19 = require("@fuel-ts/utils");
3510
3553
  var import_ramda6 = require("ramda");
3511
- var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3554
+ var UpgradeTransactionRequest = class _UpgradeTransactionRequest extends BaseTransactionRequest {
3555
+ static {
3556
+ __name(this, "UpgradeTransactionRequest");
3557
+ }
3512
3558
  static from(obj) {
3513
- if (obj instanceof UpgradeTransactionRequest) {
3559
+ if (obj instanceof _UpgradeTransactionRequest) {
3514
3560
  return obj;
3515
3561
  }
3516
3562
  return new this((0, import_ramda6.clone)(obj));
@@ -3607,7 +3653,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3607
3653
  }
3608
3654
  };
3609
3655
  } else {
3610
- throw new import_errors12.FuelError(import_errors12.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3656
+ throw new import_errors13.FuelError(import_errors13.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3611
3657
  }
3612
3658
  return {
3613
3659
  type: import_transactions12.TransactionType.Upgrade,
@@ -3649,7 +3695,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3649
3695
  txBytesSize
3650
3696
  });
3651
3697
  }
3652
- throw new import_errors12.FuelError(import_errors12.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3698
+ throw new import_errors13.FuelError(import_errors13.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3653
3699
  }
3654
3700
  };
3655
3701
 
@@ -3658,9 +3704,12 @@ var import_configs10 = require("@fuel-ts/address/configs");
3658
3704
  var import_transactions13 = require("@fuel-ts/transactions");
3659
3705
  var import_utils21 = require("@fuel-ts/utils");
3660
3706
  var import_ramda7 = require("ramda");
3661
- var UploadTransactionRequest = class extends BaseTransactionRequest {
3707
+ var UploadTransactionRequest = class _UploadTransactionRequest extends BaseTransactionRequest {
3708
+ static {
3709
+ __name(this, "UploadTransactionRequest");
3710
+ }
3662
3711
  static from(obj) {
3663
- if (obj instanceof UploadTransactionRequest) {
3712
+ if (obj instanceof _UploadTransactionRequest) {
3664
3713
  return obj;
3665
3714
  }
3666
3715
  return new this((0, import_ramda7.clone)(obj));
@@ -3760,9 +3809,9 @@ var UploadTransactionRequest = class extends BaseTransactionRequest {
3760
3809
  };
3761
3810
 
3762
3811
  // src/providers/transaction-request/utils.ts
3763
- var import_errors13 = require("@fuel-ts/errors");
3812
+ var import_errors14 = require("@fuel-ts/errors");
3764
3813
  var import_transactions14 = require("@fuel-ts/transactions");
3765
- var transactionRequestify = (obj) => {
3814
+ var transactionRequestify = /* @__PURE__ */ __name((obj) => {
3766
3815
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
3767
3816
  return obj;
3768
3817
  }
@@ -3784,25 +3833,28 @@ var transactionRequestify = (obj) => {
3784
3833
  return UploadTransactionRequest.from(obj);
3785
3834
  }
3786
3835
  default: {
3787
- throw new import_errors13.FuelError(
3788
- import_errors13.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3836
+ throw new import_errors14.FuelError(
3837
+ import_errors14.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3789
3838
  `Unsupported transaction type: ${type}.`
3790
3839
  );
3791
3840
  }
3792
3841
  }
3793
- };
3794
- var isTransactionTypeScript = (request) => request.type === import_transactions14.TransactionType.Script;
3795
- var isTransactionTypeCreate = (request) => request.type === import_transactions14.TransactionType.Create;
3842
+ }, "transactionRequestify");
3843
+ var isTransactionTypeScript = /* @__PURE__ */ __name((request) => request.type === import_transactions14.TransactionType.Script, "isTransactionTypeScript");
3844
+ var isTransactionTypeCreate = /* @__PURE__ */ __name((request) => request.type === import_transactions14.TransactionType.Create, "isTransactionTypeCreate");
3796
3845
 
3797
3846
  // src/providers/resource-cache.ts
3798
3847
  var cache = /* @__PURE__ */ new Map();
3799
3848
  var ResourceCache = class {
3849
+ static {
3850
+ __name(this, "ResourceCache");
3851
+ }
3800
3852
  ttl;
3801
3853
  constructor(ttl) {
3802
3854
  this.ttl = ttl;
3803
3855
  if (typeof ttl !== "number" || this.ttl <= 0) {
3804
- throw new import_errors14.FuelError(
3805
- import_errors14.ErrorCode.INVALID_TTL,
3856
+ throw new import_errors15.FuelError(
3857
+ import_errors15.ErrorCode.INVALID_TTL,
3806
3858
  `Invalid TTL: ${this.ttl}. Use a value greater than zero.`
3807
3859
  );
3808
3860
  }
@@ -3886,7 +3938,7 @@ var ResourceCache = class {
3886
3938
  };
3887
3939
 
3888
3940
  // src/providers/transaction-response/transaction-response.ts
3889
- var import_errors18 = require("@fuel-ts/errors");
3941
+ var import_errors19 = require("@fuel-ts/errors");
3890
3942
  var import_math18 = require("@fuel-ts/math");
3891
3943
  var import_transactions22 = require("@fuel-ts/transactions");
3892
3944
  var import_utils27 = require("@fuel-ts/utils");
@@ -3900,7 +3952,7 @@ var import_utils25 = require("@fuel-ts/utils");
3900
3952
  var import_math13 = require("@fuel-ts/math");
3901
3953
  var import_transactions15 = require("@fuel-ts/transactions");
3902
3954
  var import_utils24 = require("@fuel-ts/utils");
3903
- var calculateTXFeeForSummary = (params) => {
3955
+ var calculateTXFeeForSummary = /* @__PURE__ */ __name((params) => {
3904
3956
  const {
3905
3957
  gasPrice,
3906
3958
  rawPayload,
@@ -3960,43 +4012,51 @@ var calculateTXFeeForSummary = (params) => {
3960
4012
  tip
3961
4013
  });
3962
4014
  return maxFee;
3963
- };
4015
+ }, "calculateTXFeeForSummary");
3964
4016
 
3965
4017
  // src/providers/transaction-summary/operations.ts
3966
4018
  var import_configs11 = require("@fuel-ts/address/configs");
3967
- var import_errors16 = require("@fuel-ts/errors");
4019
+ var import_errors17 = require("@fuel-ts/errors");
3968
4020
  var import_math15 = require("@fuel-ts/math");
3969
4021
  var import_transactions18 = require("@fuel-ts/transactions");
3970
4022
 
3971
4023
  // src/providers/transaction-summary/input.ts
3972
- var import_errors15 = require("@fuel-ts/errors");
4024
+ var import_errors16 = require("@fuel-ts/errors");
3973
4025
  var import_math14 = require("@fuel-ts/math");
3974
4026
  var import_transactions16 = require("@fuel-ts/transactions");
3975
4027
  function getInputsByTypes(inputs, types) {
3976
4028
  return inputs.filter((i) => types.includes(i.type));
3977
4029
  }
4030
+ __name(getInputsByTypes, "getInputsByTypes");
3978
4031
  function getInputsByType(inputs, type) {
3979
4032
  return inputs.filter((i) => i.type === type);
3980
4033
  }
4034
+ __name(getInputsByType, "getInputsByType");
3981
4035
  function getInputsCoin(inputs) {
3982
4036
  return getInputsByType(inputs, import_transactions16.InputType.Coin);
3983
4037
  }
4038
+ __name(getInputsCoin, "getInputsCoin");
3984
4039
  function getInputsMessage(inputs) {
3985
4040
  return getInputsByType(inputs, import_transactions16.InputType.Message);
3986
4041
  }
4042
+ __name(getInputsMessage, "getInputsMessage");
3987
4043
  function getInputsCoinAndMessage(inputs) {
3988
4044
  return getInputsByTypes(inputs, [import_transactions16.InputType.Coin, import_transactions16.InputType.Message]);
3989
4045
  }
4046
+ __name(getInputsCoinAndMessage, "getInputsCoinAndMessage");
3990
4047
  function isInputCoin(input) {
3991
4048
  return input.type === import_transactions16.InputType.Coin;
3992
4049
  }
4050
+ __name(isInputCoin, "isInputCoin");
3993
4051
  function getInputsContract(inputs) {
3994
4052
  return getInputsByType(inputs, import_transactions16.InputType.Contract);
3995
4053
  }
4054
+ __name(getInputsContract, "getInputsContract");
3996
4055
  function findCoinInput(inputs, assetId) {
3997
4056
  const coinInputs = getInputsCoin(inputs);
3998
4057
  return coinInputs.find((i) => i.assetId === assetId);
3999
4058
  }
4059
+ __name(findCoinInput, "findCoinInput");
4000
4060
  function aggregateInputsAmountsByAssetAndOwner(inputs, baseAssetId) {
4001
4061
  const aggregated = /* @__PURE__ */ new Map();
4002
4062
  getInputsCoinAndMessage(inputs).forEach((input) => {
@@ -4016,9 +4076,11 @@ function aggregateInputsAmountsByAssetAndOwner(inputs, baseAssetId) {
4016
4076
  });
4017
4077
  return aggregated;
4018
4078
  }
4079
+ __name(aggregateInputsAmountsByAssetAndOwner, "aggregateInputsAmountsByAssetAndOwner");
4019
4080
  function findMessageInput(inputs) {
4020
4081
  return getInputsMessage(inputs)?.[0];
4021
4082
  }
4083
+ __name(findMessageInput, "findMessageInput");
4022
4084
  function getInputFromAssetId(inputs, assetId, isBaseAsset = false) {
4023
4085
  const coinInput = findCoinInput(inputs, assetId);
4024
4086
  if (coinInput) {
@@ -4029,6 +4091,7 @@ function getInputFromAssetId(inputs, assetId, isBaseAsset = false) {
4029
4091
  }
4030
4092
  return void 0;
4031
4093
  }
4094
+ __name(getInputFromAssetId, "getInputFromAssetId");
4032
4095
  function getInputContractFromIndex(inputs, inputIndex) {
4033
4096
  if (inputIndex == null) {
4034
4097
  return void 0;
@@ -4038,13 +4101,14 @@ function getInputContractFromIndex(inputs, inputIndex) {
4038
4101
  return void 0;
4039
4102
  }
4040
4103
  if (contractInput.type !== import_transactions16.InputType.Contract) {
4041
- throw new import_errors15.FuelError(
4042
- import_errors15.ErrorCode.INVALID_TRANSACTION_INPUT,
4104
+ throw new import_errors16.FuelError(
4105
+ import_errors16.ErrorCode.INVALID_TRANSACTION_INPUT,
4043
4106
  `Contract input should be of type 'contract'.`
4044
4107
  );
4045
4108
  }
4046
4109
  return contractInput;
4047
4110
  }
4111
+ __name(getInputContractFromIndex, "getInputContractFromIndex");
4048
4112
  function getInputAccountAddress(input) {
4049
4113
  if (input.type === import_transactions16.InputType.Coin) {
4050
4114
  return input.owner.toString();
@@ -4054,29 +4118,36 @@ function getInputAccountAddress(input) {
4054
4118
  }
4055
4119
  return "";
4056
4120
  }
4121
+ __name(getInputAccountAddress, "getInputAccountAddress");
4057
4122
 
4058
4123
  // src/providers/transaction-summary/output.ts
4059
4124
  var import_transactions17 = require("@fuel-ts/transactions");
4060
4125
  function getOutputsByType(outputs, type) {
4061
4126
  return outputs.filter((o) => o.type === type);
4062
4127
  }
4128
+ __name(getOutputsByType, "getOutputsByType");
4063
4129
  function getOutputsContractCreated(outputs) {
4064
4130
  return getOutputsByType(outputs, import_transactions17.OutputType.ContractCreated);
4065
4131
  }
4132
+ __name(getOutputsContractCreated, "getOutputsContractCreated");
4066
4133
  function getOutputsCoin(outputs) {
4067
4134
  return getOutputsByType(outputs, import_transactions17.OutputType.Coin);
4068
4135
  }
4136
+ __name(getOutputsCoin, "getOutputsCoin");
4069
4137
  function getOutputsChange(outputs) {
4070
4138
  return getOutputsByType(outputs, import_transactions17.OutputType.Change);
4071
4139
  }
4140
+ __name(getOutputsChange, "getOutputsChange");
4072
4141
  function getOutputsContract(outputs) {
4073
4142
  return getOutputsByType(outputs, import_transactions17.OutputType.Contract);
4074
4143
  }
4144
+ __name(getOutputsContract, "getOutputsContract");
4075
4145
 
4076
4146
  // src/providers/transaction-summary/operations.ts
4077
4147
  function getReceiptsByType(receipts, type) {
4078
4148
  return (receipts ?? []).filter((r) => r.type === type);
4079
4149
  }
4150
+ __name(getReceiptsByType, "getReceiptsByType");
4080
4151
  function getTransactionTypeName(transactionType) {
4081
4152
  switch (transactionType) {
4082
4153
  case import_transactions18.TransactionType.Mint:
@@ -4092,40 +4163,50 @@ function getTransactionTypeName(transactionType) {
4092
4163
  case import_transactions18.TransactionType.Upload:
4093
4164
  return "Upload" /* Upload */;
4094
4165
  default:
4095
- throw new import_errors16.FuelError(
4096
- import_errors16.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
4166
+ throw new import_errors17.FuelError(
4167
+ import_errors17.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
4097
4168
  `Unsupported transaction type: ${transactionType}.`
4098
4169
  );
4099
4170
  }
4100
4171
  }
4172
+ __name(getTransactionTypeName, "getTransactionTypeName");
4101
4173
  function isType(transactionType, type) {
4102
4174
  const txType = getTransactionTypeName(transactionType);
4103
4175
  return txType === type;
4104
4176
  }
4177
+ __name(isType, "isType");
4105
4178
  function isTypeMint(transactionType) {
4106
4179
  return isType(transactionType, "Mint" /* Mint */);
4107
4180
  }
4181
+ __name(isTypeMint, "isTypeMint");
4108
4182
  function isTypeCreate(transactionType) {
4109
4183
  return isType(transactionType, "Create" /* Create */);
4110
4184
  }
4185
+ __name(isTypeCreate, "isTypeCreate");
4111
4186
  function isTypeScript(transactionType) {
4112
4187
  return isType(transactionType, "Script" /* Script */);
4113
4188
  }
4189
+ __name(isTypeScript, "isTypeScript");
4114
4190
  function isTypeUpgrade(transactionType) {
4115
4191
  return isType(transactionType, "Upgrade" /* Upgrade */);
4116
4192
  }
4193
+ __name(isTypeUpgrade, "isTypeUpgrade");
4117
4194
  function isTypeUpload(transactionType) {
4118
4195
  return isType(transactionType, "Upload" /* Upload */);
4119
4196
  }
4197
+ __name(isTypeUpload, "isTypeUpload");
4120
4198
  function isTypeBlob(transactionType) {
4121
4199
  return isType(transactionType, "Blob" /* Blob */);
4122
4200
  }
4201
+ __name(isTypeBlob, "isTypeBlob");
4123
4202
  function getReceiptsCall(receipts) {
4124
4203
  return getReceiptsByType(receipts, import_transactions18.ReceiptType.Call);
4125
4204
  }
4205
+ __name(getReceiptsCall, "getReceiptsCall");
4126
4206
  function getReceiptsMessageOut(receipts) {
4127
4207
  return getReceiptsByType(receipts, import_transactions18.ReceiptType.MessageOut);
4128
4208
  }
4209
+ __name(getReceiptsMessageOut, "getReceiptsMessageOut");
4129
4210
  function mergeAssets(op1, op2) {
4130
4211
  const assets1 = op1.assetsSent || [];
4131
4212
  const assets2 = op2.assetsSent || [];
@@ -4143,21 +4224,25 @@ function mergeAssets(op1, op2) {
4143
4224
  });
4144
4225
  return Array.from(assetMap.values());
4145
4226
  }
4227
+ __name(mergeAssets, "mergeAssets");
4146
4228
  function isSameOperation(a, b) {
4147
4229
  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;
4148
4230
  }
4231
+ __name(isSameOperation, "isSameOperation");
4149
4232
  function mergeAssetsSent(existing, toAdd) {
4150
4233
  if (!toAdd.assetsSent?.length) {
4151
4234
  return existing.assetsSent;
4152
4235
  }
4153
4236
  return existing.assetsSent?.length ? mergeAssets(existing, toAdd) : toAdd.assetsSent;
4154
4237
  }
4238
+ __name(mergeAssetsSent, "mergeAssetsSent");
4155
4239
  function mergeCalls(existing, toAdd) {
4156
4240
  if (!toAdd.calls?.length) {
4157
4241
  return existing.calls;
4158
4242
  }
4159
4243
  return [...existing.calls || [], ...toAdd.calls];
4160
4244
  }
4245
+ __name(mergeCalls, "mergeCalls");
4161
4246
  function mergeOperations(existing, toAdd) {
4162
4247
  return {
4163
4248
  ...existing,
@@ -4169,6 +4254,7 @@ function mergeOperations(existing, toAdd) {
4169
4254
  ]
4170
4255
  };
4171
4256
  }
4257
+ __name(mergeOperations, "mergeOperations");
4172
4258
  function addOperation(operations, toAdd) {
4173
4259
  const existingIndex = operations.findIndex((op) => isSameOperation(op, toAdd));
4174
4260
  if (existingIndex === -1) {
@@ -4176,6 +4262,7 @@ function addOperation(operations, toAdd) {
4176
4262
  }
4177
4263
  return operations.map((op, index) => index === existingIndex ? mergeOperations(op, toAdd) : op);
4178
4264
  }
4265
+ __name(addOperation, "addOperation");
4179
4266
  function getWithdrawFromFuelOperations({
4180
4267
  inputs,
4181
4268
  receipts,
@@ -4214,6 +4301,7 @@ function getWithdrawFromFuelOperations({
4214
4301
  );
4215
4302
  return withdrawFromFuelOperations;
4216
4303
  }
4304
+ __name(getWithdrawFromFuelOperations, "getWithdrawFromFuelOperations");
4217
4305
  function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInputs) {
4218
4306
  const abi = abiMap?.[contractInput.contractID];
4219
4307
  if (!abi) {
@@ -4221,6 +4309,7 @@ function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInpu
4221
4309
  }
4222
4310
  return [];
4223
4311
  }
4312
+ __name(getContractCalls, "getContractCalls");
4224
4313
  function getAssetsSent(receipt) {
4225
4314
  return receipt.amount?.isZero() ? void 0 : [
4226
4315
  {
@@ -4229,6 +4318,7 @@ function getAssetsSent(receipt) {
4229
4318
  }
4230
4319
  ];
4231
4320
  }
4321
+ __name(getAssetsSent, "getAssetsSent");
4232
4322
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
4233
4323
  const assetId = receipt.assetId === import_configs11.ZeroBytes32 ? baseAssetId : receipt.assetId;
4234
4324
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
@@ -4254,6 +4344,7 @@ function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload,
4254
4344
  }
4255
4345
  ];
4256
4346
  }
4347
+ __name(processCallReceipt, "processCallReceipt");
4257
4348
  function getContractCallOperations({
4258
4349
  inputs,
4259
4350
  outputs,
@@ -4283,6 +4374,7 @@ function getContractCallOperations({
4283
4374
  );
4284
4375
  });
4285
4376
  }
4377
+ __name(getContractCallOperations, "getContractCallOperations");
4286
4378
  function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs) {
4287
4379
  const { to: toAddress, assetId, amount } = receipt;
4288
4380
  let { id: fromAddress } = receipt;
@@ -4311,6 +4403,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
4311
4403
  receipts: [receipt]
4312
4404
  };
4313
4405
  }
4406
+ __name(extractTransferOperationFromReceipt, "extractTransferOperationFromReceipt");
4314
4407
  function getTransferOperations({
4315
4408
  inputs,
4316
4409
  outputs,
@@ -4365,6 +4458,7 @@ function getTransferOperations({
4365
4458
  });
4366
4459
  return operations;
4367
4460
  }
4461
+ __name(getTransferOperations, "getTransferOperations");
4368
4462
  function getPayProducerOperations(outputs) {
4369
4463
  const coinOutputs = getOutputsCoin(outputs);
4370
4464
  const payProducerOperations = coinOutputs.reduce((prev, output) => {
@@ -4389,6 +4483,7 @@ function getPayProducerOperations(outputs) {
4389
4483
  }, []);
4390
4484
  return payProducerOperations;
4391
4485
  }
4486
+ __name(getPayProducerOperations, "getPayProducerOperations");
4392
4487
  function getContractCreatedOperations({ inputs, outputs }) {
4393
4488
  const contractCreatedOutputs = getOutputsContractCreated(outputs);
4394
4489
  const input = getInputsCoinAndMessage(inputs)[0];
@@ -4409,6 +4504,7 @@ function getContractCreatedOperations({ inputs, outputs }) {
4409
4504
  }, []);
4410
4505
  return contractCreatedOperations;
4411
4506
  }
4507
+ __name(getContractCreatedOperations, "getContractCreatedOperations");
4412
4508
  function getOperations({
4413
4509
  transactionType,
4414
4510
  inputs,
@@ -4439,10 +4535,11 @@ function getOperations({
4439
4535
  }
4440
4536
  return [...getPayProducerOperations(outputs)];
4441
4537
  }
4538
+ __name(getOperations, "getOperations");
4442
4539
 
4443
4540
  // src/providers/transaction-summary/receipt.ts
4444
4541
  var import_transactions19 = require("@fuel-ts/transactions");
4445
- var extractMintedAssetsFromReceipts = (receipts) => {
4542
+ var extractMintedAssetsFromReceipts = /* @__PURE__ */ __name((receipts) => {
4446
4543
  const mintedAssets = [];
4447
4544
  receipts.forEach((receipt) => {
4448
4545
  if (receipt.type === import_transactions19.ReceiptType.Mint) {
@@ -4455,8 +4552,8 @@ var extractMintedAssetsFromReceipts = (receipts) => {
4455
4552
  }
4456
4553
  });
4457
4554
  return mintedAssets;
4458
- };
4459
- var extractBurnedAssetsFromReceipts = (receipts) => {
4555
+ }, "extractMintedAssetsFromReceipts");
4556
+ var extractBurnedAssetsFromReceipts = /* @__PURE__ */ __name((receipts) => {
4460
4557
  const burnedAssets = [];
4461
4558
  receipts.forEach((receipt) => {
4462
4559
  if (receipt.type === import_transactions19.ReceiptType.Burn) {
@@ -4469,12 +4566,12 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
4469
4566
  }
4470
4567
  });
4471
4568
  return burnedAssets;
4472
- };
4569
+ }, "extractBurnedAssetsFromReceipts");
4473
4570
 
4474
4571
  // src/providers/transaction-summary/status.ts
4475
- var import_errors17 = require("@fuel-ts/errors");
4572
+ var import_errors18 = require("@fuel-ts/errors");
4476
4573
  var import_math16 = require("@fuel-ts/math");
4477
- var getTransactionStatusName = (gqlStatus) => {
4574
+ var getTransactionStatusName = /* @__PURE__ */ __name((gqlStatus) => {
4478
4575
  switch (gqlStatus) {
4479
4576
  case "FailureStatus":
4480
4577
  return "failure" /* failure */;
@@ -4485,13 +4582,13 @@ var getTransactionStatusName = (gqlStatus) => {
4485
4582
  case "SqueezedOutStatus":
4486
4583
  return "squeezedout" /* squeezedout */;
4487
4584
  default:
4488
- throw new import_errors17.FuelError(
4489
- import_errors17.ErrorCode.INVALID_TRANSACTION_STATUS,
4585
+ throw new import_errors18.FuelError(
4586
+ import_errors18.ErrorCode.INVALID_TRANSACTION_STATUS,
4490
4587
  `Invalid transaction status: ${gqlStatus}.`
4491
4588
  );
4492
4589
  }
4493
- };
4494
- var processGraphqlStatus = (gqlTransactionStatus) => {
4590
+ }, "getTransactionStatusName");
4591
+ var processGraphqlStatus = /* @__PURE__ */ __name((gqlTransactionStatus) => {
4495
4592
  let time;
4496
4593
  let blockId;
4497
4594
  let status;
@@ -4535,8 +4632,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
4535
4632
  isStatusPending
4536
4633
  };
4537
4634
  return processedGraphqlStatus;
4538
- };
4539
- var getTotalFeeFromStatus = (status) => status && "totalFee" in status ? (0, import_math16.bn)(status.totalFee) : void 0;
4635
+ }, "processGraphqlStatus");
4636
+ var getTotalFeeFromStatus = /* @__PURE__ */ __name((status) => status && "totalFee" in status ? (0, import_math16.bn)(status.totalFee) : void 0, "getTotalFeeFromStatus");
4540
4637
 
4541
4638
  // src/providers/transaction-summary/assemble-transaction-summary.ts
4542
4639
  function assembleTransactionSummary(params) {
@@ -4616,21 +4713,35 @@ function assembleTransactionSummary(params) {
4616
4713
  };
4617
4714
  return transactionSummary;
4618
4715
  }
4716
+ __name(assembleTransactionSummary, "assembleTransactionSummary");
4619
4717
 
4620
4718
  // src/providers/transaction-response/getDecodedLogs.ts
4621
4719
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
4720
+ var import_configs12 = require("@fuel-ts/address/configs");
4622
4721
  var import_transactions21 = require("@fuel-ts/transactions");
4623
4722
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
4723
+ let mainContract = "";
4724
+ if (mainAbi.programType === "contract") {
4725
+ const firstCallReceipt = receipts.find(
4726
+ (r) => r.type === import_transactions21.ReceiptType.Call && r.id === import_configs12.ZeroBytes32
4727
+ );
4728
+ mainContract = firstCallReceipt.to;
4729
+ }
4624
4730
  return receipts.reduce((logs, receipt) => {
4625
4731
  if (receipt.type === import_transactions21.ReceiptType.LogData || receipt.type === import_transactions21.ReceiptType.Log) {
4626
- const interfaceToUse = new import_abi_coder5.Interface(externalAbis[receipt.id] || mainAbi);
4627
- const data = receipt.type === import_transactions21.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
4628
- const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
4629
- logs.push(decodedLog);
4732
+ const isLogFromMainAbi = receipt.id === import_configs12.ZeroBytes32 || mainContract === receipt.id;
4733
+ const isDecodable = isLogFromMainAbi || externalAbis[receipt.id];
4734
+ if (isDecodable) {
4735
+ const interfaceToUse = isLogFromMainAbi ? new import_abi_coder5.Interface(mainAbi) : new import_abi_coder5.Interface(externalAbis[receipt.id]);
4736
+ const data = receipt.type === import_transactions21.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
4737
+ const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
4738
+ logs.push(decodedLog);
4739
+ }
4630
4740
  }
4631
4741
  return logs;
4632
4742
  }, []);
4633
4743
  }
4744
+ __name(getDecodedLogs, "getDecodedLogs");
4634
4745
 
4635
4746
  // src/providers/transaction-response/transaction-response.ts
4636
4747
  function mapGqlOutputsToTxOutputs(outputs) {
@@ -4663,7 +4774,8 @@ function mapGqlOutputsToTxOutputs(outputs) {
4663
4774
  }
4664
4775
  });
4665
4776
  }
4666
- var TransactionResponse = class {
4777
+ __name(mapGqlOutputsToTxOutputs, "mapGqlOutputsToTxOutputs");
4778
+ var TransactionResponse = class _TransactionResponse {
4667
4779
  /**
4668
4780
  * Constructor for `TransactionResponse`.
4669
4781
  *
@@ -4678,6 +4790,9 @@ var TransactionResponse = class {
4678
4790
  this.request = typeof tx === "string" ? void 0 : tx;
4679
4791
  this.waitForResult = this.waitForResult.bind(this);
4680
4792
  }
4793
+ static {
4794
+ __name(this, "TransactionResponse");
4795
+ }
4681
4796
  /** Transaction ID */
4682
4797
  id;
4683
4798
  /** Current provider */
@@ -4699,7 +4814,7 @@ var TransactionResponse = class {
4699
4814
  */
4700
4815
  static async create(id, provider, abis) {
4701
4816
  const chainId = await provider.getChainId();
4702
- const response = new TransactionResponse(id, provider, chainId, abis);
4817
+ const response = new _TransactionResponse(id, provider, chainId, abis);
4703
4818
  await response.fetch();
4704
4819
  return response;
4705
4820
  }
@@ -4831,8 +4946,8 @@ var TransactionResponse = class {
4831
4946
  this.status = statusChange;
4832
4947
  if (statusChange.type === "SqueezedOutStatus") {
4833
4948
  this.unsetResourceCache();
4834
- throw new import_errors18.FuelError(
4835
- import_errors18.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4949
+ throw new import_errors19.FuelError(
4950
+ import_errors19.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4836
4951
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
4837
4952
  );
4838
4953
  }
@@ -4916,6 +5031,7 @@ function getWaitDelay(options, retryAttemptNum) {
4916
5031
  return 2 ** (retryAttemptNum - 1) * duration;
4917
5032
  }
4918
5033
  }
5034
+ __name(getWaitDelay, "getWaitDelay");
4919
5035
  function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4920
5036
  if (options === void 0) {
4921
5037
  return fetchFn;
@@ -4938,9 +5054,10 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4938
5054
  }
4939
5055
  };
4940
5056
  }
5057
+ __name(autoRetryFetch, "autoRetryFetch");
4941
5058
 
4942
5059
  // src/providers/utils/helpers.ts
4943
- var adjustResourcesToExclude = (params) => {
5060
+ var adjustResourcesToExclude = /* @__PURE__ */ __name((params) => {
4944
5061
  const { userInput, cached, maxInputs } = params;
4945
5062
  const final = { ...userInput };
4946
5063
  let total = final.utxos.length + final.messages.length;
@@ -4953,34 +5070,34 @@ var adjustResourcesToExclude = (params) => {
4953
5070
  final.messages = [...final.messages, ...cached.messages.slice(0, maxInputs - total)];
4954
5071
  }
4955
5072
  return final;
4956
- };
5073
+ }, "adjustResourcesToExclude");
4957
5074
 
4958
5075
  // src/providers/utils/validate-pagination-args.ts
4959
- var import_errors19 = require("@fuel-ts/errors");
4960
- var validatePaginationArgs = (params) => {
5076
+ var import_errors20 = require("@fuel-ts/errors");
5077
+ var validatePaginationArgs = /* @__PURE__ */ __name((params) => {
4961
5078
  const { paginationLimit, inputArgs = {} } = params;
4962
5079
  const { first, last, after, before } = inputArgs;
4963
5080
  if (after && before) {
4964
- throw new import_errors19.FuelError(
4965
- import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
5081
+ throw new import_errors20.FuelError(
5082
+ import_errors20.ErrorCode.INVALID_INPUT_PARAMETERS,
4966
5083
  'Pagination arguments "after" and "before" cannot be used together'
4967
5084
  );
4968
5085
  }
4969
5086
  if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
4970
- throw new import_errors19.FuelError(
4971
- import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
5087
+ throw new import_errors20.FuelError(
5088
+ import_errors20.ErrorCode.INVALID_INPUT_PARAMETERS,
4972
5089
  `Pagination limit for this query cannot exceed ${paginationLimit} items`
4973
5090
  );
4974
5091
  }
4975
5092
  if (first && before) {
4976
- throw new import_errors19.FuelError(
4977
- import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
5093
+ throw new import_errors20.FuelError(
5094
+ import_errors20.ErrorCode.INVALID_INPUT_PARAMETERS,
4978
5095
  'The use of pagination argument "first" with "before" is not supported'
4979
5096
  );
4980
5097
  }
4981
5098
  if (last && after) {
4982
- throw new import_errors19.FuelError(
4983
- import_errors19.ErrorCode.INVALID_INPUT_PARAMETERS,
5099
+ throw new import_errors20.FuelError(
5100
+ import_errors20.ErrorCode.INVALID_INPUT_PARAMETERS,
4984
5101
  'The use of pagination argument "last" with "after" is not supported'
4985
5102
  );
4986
5103
  }
@@ -4988,18 +5105,71 @@ var validatePaginationArgs = (params) => {
4988
5105
  inputArgs.first = paginationLimit;
4989
5106
  }
4990
5107
  return inputArgs;
4991
- };
5108
+ }, "validatePaginationArgs");
4992
5109
 
4993
5110
  // src/providers/provider.ts
4994
5111
  var MAX_RETRIES = 10;
4995
5112
  var RESOURCES_PAGE_SIZE_LIMIT = 512;
4996
5113
  var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
4997
5114
  var BALANCES_PAGE_SIZE_LIMIT = 100;
5115
+ var NON_PAGINATED_BALANCES_SIZE = 1e4;
4998
5116
  var BLOCKS_PAGE_SIZE_LIMIT = 5;
4999
5117
  var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
5000
5118
  var GAS_USED_MODIFIER = 1.2;
5001
- var _cacheInputs, cacheInputs_fn;
5002
- var _Provider = class {
5119
+ var Provider = class _Provider {
5120
+ static {
5121
+ __name(this, "Provider");
5122
+ }
5123
+ operations;
5124
+ cache;
5125
+ /** @hidden */
5126
+ static clearChainAndNodeCaches() {
5127
+ _Provider.inflightFetchChainAndNodeInfoRequests = {};
5128
+ _Provider.nodeInfoCache = {};
5129
+ _Provider.chainInfoCache = {};
5130
+ }
5131
+ /** @hidden */
5132
+ url;
5133
+ /** @hidden */
5134
+ urlWithoutAuth;
5135
+ /** @hidden */
5136
+ static inflightFetchChainAndNodeInfoRequests = {};
5137
+ /** @hidden */
5138
+ static chainInfoCache = {};
5139
+ /** @hidden */
5140
+ static nodeInfoCache = {};
5141
+ /** @hidden */
5142
+ static incompatibleNodeVersionMessage = "";
5143
+ /** @hidden */
5144
+ consensusParametersTimestamp;
5145
+ options = {
5146
+ timeout: void 0,
5147
+ resourceCacheTTL: void 0,
5148
+ fetch: void 0,
5149
+ retryOptions: void 0,
5150
+ headers: void 0,
5151
+ cache: void 0
5152
+ };
5153
+ /**
5154
+ * @hidden
5155
+ */
5156
+ static getFetchFn(options) {
5157
+ const { retryOptions, timeout, headers } = options;
5158
+ return autoRetryFetch(async (...args) => {
5159
+ const url = args[0];
5160
+ const request = args[1];
5161
+ const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
5162
+ let fullRequest = {
5163
+ ...request,
5164
+ signal,
5165
+ headers: { ...request?.headers, ...headers }
5166
+ };
5167
+ if (options.requestMiddleware) {
5168
+ fullRequest = await options.requestMiddleware(fullRequest);
5169
+ }
5170
+ return options.fetch ? options.fetch(url, fullRequest, options) : fetch(url, fullRequest);
5171
+ }, retryOptions);
5172
+ }
5003
5173
  /**
5004
5174
  * Constructor to initialize a Provider.
5005
5175
  *
@@ -5008,31 +5178,6 @@ var _Provider = class {
5008
5178
  * @hidden
5009
5179
  */
5010
5180
  constructor(url, options = {}) {
5011
- /**
5012
- * @hidden
5013
- */
5014
- __privateAdd(this, _cacheInputs);
5015
- __publicField(this, "operations");
5016
- __publicField(this, "cache");
5017
- /** @hidden */
5018
- __publicField(this, "url");
5019
- /** @hidden */
5020
- __publicField(this, "urlWithoutAuth");
5021
- /** @hidden */
5022
- __publicField(this, "features", {
5023
- balancePagination: false,
5024
- amount128: false
5025
- });
5026
- /** @hidden */
5027
- __publicField(this, "consensusParametersTimestamp");
5028
- __publicField(this, "options", {
5029
- timeout: void 0,
5030
- resourceCacheTTL: void 0,
5031
- fetch: void 0,
5032
- retryOptions: void 0,
5033
- headers: void 0,
5034
- cache: void 0
5035
- });
5036
5181
  const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
5037
5182
  this.url = rawUrl;
5038
5183
  this.urlWithoutAuth = urlWithoutAuth;
@@ -5062,37 +5207,12 @@ var _Provider = class {
5062
5207
  this.cache = new ResourceCache(DEFAULT_RESOURCE_CACHE_TTL);
5063
5208
  }
5064
5209
  }
5065
- /** @hidden */
5066
- static clearChainAndNodeCaches() {
5067
- _Provider.nodeInfoCache = {};
5068
- _Provider.chainInfoCache = {};
5069
- }
5070
- /**
5071
- * @hidden
5072
- */
5073
- static getFetchFn(options) {
5074
- const { retryOptions, timeout, headers } = options;
5075
- return autoRetryFetch(async (...args) => {
5076
- const url = args[0];
5077
- const request = args[1];
5078
- const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
5079
- let fullRequest = {
5080
- ...request,
5081
- signal,
5082
- headers: { ...request?.headers, ...headers }
5083
- };
5084
- if (options.requestMiddleware) {
5085
- fullRequest = await options.requestMiddleware(fullRequest);
5086
- }
5087
- return options.fetch ? options.fetch(url, fullRequest, options) : fetch(url, fullRequest);
5088
- }, retryOptions);
5089
- }
5090
5210
  static extractBasicAuth(url) {
5091
5211
  let parsedUrl;
5092
5212
  try {
5093
5213
  parsedUrl = new URL(url);
5094
5214
  } catch (error) {
5095
- throw new import_errors20.FuelError(import_errors20.FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
5215
+ throw new import_errors21.FuelError(import_errors21.FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
5096
5216
  }
5097
5217
  const username = parsedUrl.username;
5098
5218
  const password = parsedUrl.password;
@@ -5110,8 +5230,7 @@ var _Provider = class {
5110
5230
  * Initialize Provider async stuff
5111
5231
  */
5112
5232
  async init() {
5113
- const { nodeInfo } = await this.fetchChainAndNodeInfo();
5114
- this.setupFeatures(nodeInfo.nodeVersion);
5233
+ await this.fetchChainAndNodeInfo();
5115
5234
  return this;
5116
5235
  }
5117
5236
  /**
@@ -5181,13 +5300,24 @@ var _Provider = class {
5181
5300
  throw new Error(`Jumps to the catch block and re-fetch`);
5182
5301
  }
5183
5302
  } catch (_err) {
5303
+ const inflightRequest = _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
5304
+ if (inflightRequest) {
5305
+ const now2 = await inflightRequest;
5306
+ this.consensusParametersTimestamp = now2;
5307
+ return this.fetchChainAndNodeInfo();
5308
+ }
5309
+ const { promise, resolve } = deferPromise();
5310
+ _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth] = promise;
5184
5311
  const data = await this.operations.getChainAndNodeInfo();
5185
5312
  nodeInfo = deserializeNodeInfo(data.nodeInfo);
5186
- _Provider.setIncompatibleNodeVersionMessage(nodeInfo);
5187
5313
  chain = deserializeChain(data.chain);
5314
+ _Provider.setIncompatibleNodeVersionMessage(nodeInfo);
5188
5315
  _Provider.chainInfoCache[this.urlWithoutAuth] = chain;
5189
5316
  _Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
5190
- this.consensusParametersTimestamp = Date.now();
5317
+ const now = Date.now();
5318
+ this.consensusParametersTimestamp = now;
5319
+ resolve(now);
5320
+ delete _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
5191
5321
  }
5192
5322
  return {
5193
5323
  chain,
@@ -5217,8 +5347,8 @@ var _Provider = class {
5217
5347
  createOperations() {
5218
5348
  const fetchFn = _Provider.getFetchFn(this.options);
5219
5349
  const gqlClient = new import_graphql_request.GraphQLClient(this.urlWithoutAuth, {
5220
- fetch: (input, requestInit) => fetchFn(input.toString(), requestInit || {}, this.options),
5221
- responseMiddleware: (response) => {
5350
+ fetch: /* @__PURE__ */ __name((input, requestInit) => fetchFn(input.toString(), requestInit || {}, this.options), "fetch"),
5351
+ responseMiddleware: /* @__PURE__ */ __name((response) => {
5222
5352
  if ("response" in response) {
5223
5353
  const graphQlResponse = response.response;
5224
5354
  assertGqlResponseHasNoErrors(
@@ -5226,22 +5356,22 @@ var _Provider = class {
5226
5356
  _Provider.incompatibleNodeVersionMessage
5227
5357
  );
5228
5358
  }
5229
- }
5359
+ }, "responseMiddleware")
5230
5360
  });
5231
- const executeQuery = (query, vars) => {
5361
+ const executeQuery = /* @__PURE__ */ __name((query, vars) => {
5232
5362
  const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
5233
5363
  const isSubscription = opDefinition?.operation === "subscription";
5234
5364
  if (isSubscription) {
5235
5365
  return FuelGraphqlSubscriber.create({
5236
5366
  url: this.urlWithoutAuth,
5237
5367
  query,
5238
- fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
5368
+ fetchFn: /* @__PURE__ */ __name((url, requestInit) => fetchFn(url, requestInit, this.options), "fetchFn"),
5239
5369
  variables: vars
5240
5370
  });
5241
5371
  }
5242
5372
  return gqlClient.request(query, vars);
5243
- };
5244
- const customOperations = (requester) => ({
5373
+ }, "executeQuery");
5374
+ const customOperations = /* @__PURE__ */ __name((requester) => ({
5245
5375
  getBlobs(variables) {
5246
5376
  const queryParams = variables.blobIds.map((_, i) => `$blobId${i}: BlobId!`).join(", ");
5247
5377
  const blobParams = variables.blobIds.map((_, i) => `blob${i}: blob(id: $blobId${i}) { id }`).join("\n");
@@ -5259,18 +5389,9 @@ var _Provider = class {
5259
5389
  `;
5260
5390
  return requester(document, updatedVariables);
5261
5391
  }
5262
- });
5392
+ }), "customOperations");
5263
5393
  return { ...getSdk(executeQuery), ...customOperations(executeQuery) };
5264
5394
  }
5265
- /**
5266
- * @hidden
5267
- */
5268
- setupFeatures(nodeVersion) {
5269
- if ((0, import_versions.gte)(nodeVersion, "0.41.0")) {
5270
- this.features.balancePagination = true;
5271
- this.features.amount128 = true;
5272
- }
5273
- }
5274
5395
  /**
5275
5396
  * Returns the version of the connected node.
5276
5397
  *
@@ -5347,6 +5468,13 @@ var _Provider = class {
5347
5468
  * @returns A promise that resolves to an object containing the asset details.
5348
5469
  */
5349
5470
  async getAssetDetails(assetId) {
5471
+ const { assetMetadata } = await this.getNodeFeatures();
5472
+ if (!assetMetadata) {
5473
+ throw new import_errors21.FuelError(
5474
+ import_errors21.ErrorCode.UNSUPPORTED_FEATURE,
5475
+ "The current node does not supports fetching asset details"
5476
+ );
5477
+ }
5350
5478
  const { assetDetails } = await this.operations.getAssetDetails({ assetId });
5351
5479
  const { contractId, subId, totalSupply } = assetDetails;
5352
5480
  return {
@@ -5355,6 +5483,15 @@ var _Provider = class {
5355
5483
  totalSupply: (0, import_math19.bn)(totalSupply)
5356
5484
  };
5357
5485
  }
5486
+ /**
5487
+ * @hidden
5488
+ */
5489
+ #cacheInputs(inputs, transactionId) {
5490
+ if (!this.cache) {
5491
+ return;
5492
+ }
5493
+ this.cache.set(transactionId, inputs);
5494
+ }
5358
5495
  /**
5359
5496
  * @hidden
5360
5497
  */
@@ -5365,14 +5502,14 @@ var _Provider = class {
5365
5502
  }
5366
5503
  } = await this.getChain();
5367
5504
  if ((0, import_math19.bn)(tx.inputs.length).gt(maxInputs)) {
5368
- throw new import_errors20.FuelError(
5369
- import_errors20.ErrorCode.MAX_INPUTS_EXCEEDED,
5505
+ throw new import_errors21.FuelError(
5506
+ import_errors21.ErrorCode.MAX_INPUTS_EXCEEDED,
5370
5507
  `The transaction exceeds the maximum allowed number of inputs. Tx inputs: ${tx.inputs.length}, max inputs: ${maxInputs}`
5371
5508
  );
5372
5509
  }
5373
5510
  if ((0, import_math19.bn)(tx.outputs.length).gt(maxOutputs)) {
5374
- throw new import_errors20.FuelError(
5375
- import_errors20.ErrorCode.MAX_OUTPUTS_EXCEEDED,
5511
+ throw new import_errors21.FuelError(
5512
+ import_errors21.ErrorCode.MAX_OUTPUTS_EXCEEDED,
5376
5513
  `The transaction exceeds the maximum allowed number of outputs. Tx outputs: ${tx.outputs.length}, max outputs: ${maxOutputs}`
5377
5514
  );
5378
5515
  }
@@ -5404,7 +5541,10 @@ var _Provider = class {
5404
5541
  abis = transactionRequest.abis;
5405
5542
  }
5406
5543
  const subscription = await this.operations.submitAndAwaitStatus({ encodedTransaction });
5407
- __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionRequest.getTransactionId(await this.getChainId()));
5544
+ this.#cacheInputs(
5545
+ transactionRequest.inputs,
5546
+ transactionRequest.getTransactionId(await this.getChainId())
5547
+ );
5408
5548
  const chainId = await this.getChainId();
5409
5549
  return new TransactionResponse(transactionRequest, this, chainId, abis, subscription);
5410
5550
  }
@@ -6071,7 +6211,7 @@ var _Provider = class {
6071
6211
  0
6072
6212
  )?.[0];
6073
6213
  } catch (error) {
6074
- if (error instanceof import_errors20.FuelError && error.code === import_errors20.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
6214
+ if (error instanceof import_errors21.FuelError && error.code === import_errors21.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
6075
6215
  console.warn("Unsupported transaction type encountered");
6076
6216
  return null;
6077
6217
  }
@@ -6097,7 +6237,7 @@ var _Provider = class {
6097
6237
  try {
6098
6238
  return coder.decode((0, import_utils30.arrayify)(rawPayload), 0)[0];
6099
6239
  } catch (error) {
6100
- if (error instanceof import_errors20.FuelError && error.code === import_errors20.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
6240
+ if (error instanceof import_errors21.FuelError && error.code === import_errors21.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
6101
6241
  console.warn("Unsupported transaction type encountered");
6102
6242
  return null;
6103
6243
  }
@@ -6156,18 +6296,9 @@ var _Provider = class {
6156
6296
  * @returns A promise that resolves to the balance.
6157
6297
  */
6158
6298
  async getBalance(owner, assetId) {
6159
- const ownerStr = new import_address4.Address(owner).toB256();
6160
- const assetIdStr = (0, import_utils30.hexlify)(assetId);
6161
- if (!this.features.amount128) {
6162
- const { balance: balance2 } = await this.operations.getBalance({
6163
- owner: ownerStr,
6164
- assetId: assetIdStr
6165
- });
6166
- return (0, import_math19.bn)(balance2.amount, 10);
6167
- }
6168
6299
  const { balance } = await this.operations.getBalanceV2({
6169
- owner: ownerStr,
6170
- assetId: assetIdStr
6300
+ owner: new import_address4.Address(owner).toB256(),
6301
+ assetId: (0, import_utils30.hexlify)(assetId)
6171
6302
  });
6172
6303
  return (0, import_math19.bn)(balance.amountU128, 10);
6173
6304
  }
@@ -6179,49 +6310,29 @@ var _Provider = class {
6179
6310
  * @returns A promise that resolves to the balances.
6180
6311
  */
6181
6312
  async getBalances(owner, paginationArgs) {
6182
- if (!this.features.balancePagination) {
6183
- return this.getBalancesV1(owner, paginationArgs);
6313
+ let args = { first: NON_PAGINATED_BALANCES_SIZE };
6314
+ const { balancesPagination: supportsPagination } = await this.getNodeFeatures();
6315
+ if (supportsPagination) {
6316
+ args = validatePaginationArgs({
6317
+ inputArgs: paginationArgs,
6318
+ paginationLimit: BALANCES_PAGE_SIZE_LIMIT
6319
+ });
6184
6320
  }
6185
- return this.getBalancesV2(owner, paginationArgs);
6186
- }
6187
- /**
6188
- * @hidden
6189
- */
6190
- async getBalancesV1(owner, _paginationArgs) {
6191
- const {
6192
- balances: { edges }
6193
- } = await this.operations.getBalances({
6194
- /**
6195
- * The query parameters for this method were designed to support pagination,
6196
- * but the current Fuel-Core implementation does not support pagination yet.
6197
- */
6198
- first: 1e4,
6199
- filter: { owner: new import_address4.Address(owner).toB256() }
6200
- });
6201
- const balances = edges.map(({ node }) => ({
6202
- assetId: node.assetId,
6203
- amount: (0, import_math19.bn)(node.amount)
6204
- }));
6205
- return { balances };
6206
- }
6207
- /**
6208
- * @hidden
6209
- */
6210
- async getBalancesV2(owner, paginationArgs) {
6211
6321
  const {
6212
6322
  balances: { edges, pageInfo }
6213
6323
  } = await this.operations.getBalancesV2({
6214
- ...validatePaginationArgs({
6215
- inputArgs: paginationArgs,
6216
- paginationLimit: BALANCES_PAGE_SIZE_LIMIT
6217
- }),
6218
- filter: { owner: new import_address4.Address(owner).toB256() }
6324
+ ...args,
6325
+ filter: { owner: new import_address4.Address(owner).toB256() },
6326
+ supportsPagination
6219
6327
  });
6220
6328
  const balances = edges.map(({ node }) => ({
6221
6329
  assetId: node.assetId,
6222
6330
  amount: (0, import_math19.bn)(node.amountU128)
6223
6331
  }));
6224
- return { balances, pageInfo };
6332
+ return {
6333
+ balances,
6334
+ ...supportsPagination ? { pageInfo } : {}
6335
+ };
6225
6336
  }
6226
6337
  /**
6227
6338
  * Returns message for the given address.
@@ -6275,8 +6386,8 @@ var _Provider = class {
6275
6386
  nonce
6276
6387
  };
6277
6388
  if (commitBlockId && commitBlockHeight) {
6278
- throw new import_errors20.FuelError(
6279
- import_errors20.ErrorCode.INVALID_INPUT_PARAMETERS,
6389
+ throw new import_errors21.FuelError(
6390
+ import_errors21.ErrorCode.INVALID_INPUT_PARAMETERS,
6280
6391
  "commitBlockId and commitBlockHeight cannot be used together"
6281
6392
  );
6282
6393
  }
@@ -6508,6 +6619,17 @@ var _Provider = class {
6508
6619
  statusReason: status.reason
6509
6620
  });
6510
6621
  }
6622
+ /**
6623
+ * @hidden
6624
+ */
6625
+ async getNodeFeatures() {
6626
+ const { indexation } = await this.getNode();
6627
+ return {
6628
+ assetMetadata: Boolean(indexation?.assetMetadata),
6629
+ balancesPagination: Boolean(indexation?.balances),
6630
+ coinsToSpend: Boolean(indexation?.coinsToSpend)
6631
+ };
6632
+ }
6511
6633
  /**
6512
6634
  * @hidden
6513
6635
  */
@@ -6522,23 +6644,9 @@ var _Provider = class {
6522
6644
  return transactionRequest;
6523
6645
  }
6524
6646
  };
6525
- var Provider = _Provider;
6526
- _cacheInputs = new WeakSet();
6527
- cacheInputs_fn = function(inputs, transactionId) {
6528
- if (!this.cache) {
6529
- return;
6530
- }
6531
- this.cache.set(transactionId, inputs);
6532
- };
6533
- /** @hidden */
6534
- __publicField(Provider, "chainInfoCache", {});
6535
- /** @hidden */
6536
- __publicField(Provider, "nodeInfoCache", {});
6537
- /** @hidden */
6538
- __publicField(Provider, "incompatibleNodeVersionMessage", "");
6539
6647
 
6540
6648
  // src/providers/transaction-summary/get-transaction-summary.ts
6541
- var import_errors21 = require("@fuel-ts/errors");
6649
+ var import_errors22 = require("@fuel-ts/errors");
6542
6650
  var import_math20 = require("@fuel-ts/math");
6543
6651
  var import_transactions24 = require("@fuel-ts/transactions");
6544
6652
  var import_utils32 = require("@fuel-ts/utils");
@@ -6551,10 +6659,19 @@ var import_utils33 = require("@fuel-ts/utils");
6551
6659
  // src/test-utils/test-asset-id.ts
6552
6660
  var import_crypto4 = require("@fuel-ts/crypto");
6553
6661
  var import_utils34 = require("@fuel-ts/utils");
6554
- var _TestAssetId = class {
6662
+ var TestAssetId = class _TestAssetId {
6555
6663
  constructor(value) {
6556
6664
  this.value = value;
6557
6665
  }
6666
+ static {
6667
+ __name(this, "TestAssetId");
6668
+ }
6669
+ static A = new _TestAssetId(
6670
+ "0x0101010101010101010101010101010101010101010101010101010101010101"
6671
+ );
6672
+ static B = new _TestAssetId(
6673
+ "0x0202020202020202020202020202020202020202020202020202020202020202"
6674
+ );
6558
6675
  static random(count = 1) {
6559
6676
  const assetIds = [];
6560
6677
  for (let i = 0; i < count; i++) {
@@ -6563,17 +6680,10 @@ var _TestAssetId = class {
6563
6680
  return assetIds;
6564
6681
  }
6565
6682
  };
6566
- var TestAssetId = _TestAssetId;
6567
- __publicField(TestAssetId, "A", new _TestAssetId(
6568
- "0x0101010101010101010101010101010101010101010101010101010101010101"
6569
- ));
6570
- __publicField(TestAssetId, "B", new _TestAssetId(
6571
- "0x0202020202020202020202020202020202020202020202020202020202020202"
6572
- ));
6573
6683
 
6574
6684
  // src/test-utils/wallet-config.ts
6575
6685
  var import_crypto9 = require("@fuel-ts/crypto");
6576
- var import_errors27 = require("@fuel-ts/errors");
6686
+ var import_errors28 = require("@fuel-ts/errors");
6577
6687
  var import_math24 = require("@fuel-ts/math");
6578
6688
  var import_utils43 = require("@fuel-ts/utils");
6579
6689
 
@@ -6585,14 +6695,14 @@ var import_utils38 = require("@fuel-ts/utils");
6585
6695
  var import_abi_coder7 = require("@fuel-ts/abi-coder");
6586
6696
  var import_address6 = require("@fuel-ts/address");
6587
6697
  var import_crypto5 = require("@fuel-ts/crypto");
6588
- var import_errors22 = require("@fuel-ts/errors");
6698
+ var import_errors23 = require("@fuel-ts/errors");
6589
6699
  var import_math22 = require("@fuel-ts/math");
6590
6700
  var import_transactions26 = require("@fuel-ts/transactions");
6591
6701
  var import_utils36 = require("@fuel-ts/utils");
6592
6702
  var import_ramda9 = require("ramda");
6593
6703
 
6594
6704
  // src/providers/utils/merge-quantities.ts
6595
- var mergeQuantities = (...coinQuantities) => {
6705
+ var mergeQuantities = /* @__PURE__ */ __name((...coinQuantities) => {
6596
6706
  const resultMap = {};
6597
6707
  function addToMap({ amount, assetId }) {
6598
6708
  if (resultMap[assetId]) {
@@ -6601,12 +6711,16 @@ var mergeQuantities = (...coinQuantities) => {
6601
6711
  resultMap[assetId] = amount;
6602
6712
  }
6603
6713
  }
6714
+ __name(addToMap, "addToMap");
6604
6715
  coinQuantities.forEach((arr) => arr.forEach(addToMap));
6605
6716
  return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
6606
- };
6717
+ }, "mergeQuantities");
6607
6718
 
6608
6719
  // src/types.ts
6609
6720
  var AbstractAccount = class {
6721
+ static {
6722
+ __name(this, "AbstractAccount");
6723
+ }
6610
6724
  };
6611
6725
 
6612
6726
  // src/utils/formatTransferToContractScriptData.ts
@@ -6614,7 +6728,7 @@ var import_abi_coder6 = require("@fuel-ts/abi-coder");
6614
6728
  var import_address5 = require("@fuel-ts/address");
6615
6729
  var import_utils35 = require("@fuel-ts/utils");
6616
6730
  var asm = __toESM(require("@fuels/vm-asm"));
6617
- var formatTransferToContractScriptData = (transferParams) => {
6731
+ var formatTransferToContractScriptData = /* @__PURE__ */ __name((transferParams) => {
6618
6732
  const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
6619
6733
  return transferParams.reduce((acc, transferParam) => {
6620
6734
  const { assetId, amount, contractId } = transferParam;
@@ -6622,8 +6736,8 @@ var formatTransferToContractScriptData = (transferParams) => {
6622
6736
  const scriptData = (0, import_utils35.concat)([new import_address5.Address(contractId).toBytes(), encoded, (0, import_utils35.arrayify)(assetId)]);
6623
6737
  return (0, import_utils35.concat)([acc, scriptData]);
6624
6738
  }, new Uint8Array());
6625
- };
6626
- var assembleTransferToContractScript = async (transferParams) => {
6739
+ }, "formatTransferToContractScriptData");
6740
+ var assembleTransferToContractScript = /* @__PURE__ */ __name(async (transferParams) => {
6627
6741
  const scriptData = formatTransferToContractScriptData(transferParams);
6628
6742
  await asm.initWasm();
6629
6743
  let script = new Uint8Array();
@@ -6647,11 +6761,14 @@ var assembleTransferToContractScript = async (transferParams) => {
6647
6761
  });
6648
6762
  script = (0, import_utils35.concat)([script, asm.ret(1).to_bytes()]);
6649
6763
  return { script, scriptData };
6650
- };
6764
+ }, "assembleTransferToContractScript");
6651
6765
 
6652
6766
  // src/account.ts
6653
6767
  var MAX_FUNDING_ATTEMPTS = 5;
6654
6768
  var Account = class extends AbstractAccount {
6769
+ static {
6770
+ __name(this, "Account");
6771
+ }
6655
6772
  /**
6656
6773
  * The address associated with the account.
6657
6774
  */
@@ -6686,7 +6803,7 @@ var Account = class extends AbstractAccount {
6686
6803
  */
6687
6804
  get provider() {
6688
6805
  if (!this._provider) {
6689
- throw new import_errors22.FuelError(import_errors22.ErrorCode.MISSING_PROVIDER, "Provider not set");
6806
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.MISSING_PROVIDER, "Provider not set");
6690
6807
  }
6691
6808
  return this._provider;
6692
6809
  }
@@ -6845,8 +6962,8 @@ var Account = class extends AbstractAccount {
6845
6962
  fundingAttempts += 1;
6846
6963
  }
6847
6964
  if (needsToBeFunded) {
6848
- throw new import_errors22.FuelError(
6849
- import_errors22.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
6965
+ throw new import_errors23.FuelError(
6966
+ import_errors23.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
6850
6967
  `The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
6851
6968
  );
6852
6969
  }
@@ -6965,8 +7082,8 @@ var Account = class extends AbstractAccount {
6965
7082
  const contractAddress = new import_address6.Address(transferParam.contractId);
6966
7083
  const assetId = transferParam.assetId ? (0, import_utils36.hexlify)(transferParam.assetId) : defaultAssetId;
6967
7084
  if (amount.lte(0)) {
6968
- throw new import_errors22.FuelError(
6969
- import_errors22.ErrorCode.INVALID_TRANSFER_AMOUNT,
7085
+ throw new import_errors23.FuelError(
7086
+ import_errors23.ErrorCode.INVALID_TRANSFER_AMOUNT,
6970
7087
  "Transfer amount must be a positive number."
6971
7088
  );
6972
7089
  }
@@ -7035,7 +7152,7 @@ var Account = class extends AbstractAccount {
7035
7152
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
7036
7153
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
7037
7154
  const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: (0, import_math22.bn)("100000000000000000") }];
7038
- const findAssetInput = (assetId) => txRequestClone.inputs.find((input) => {
7155
+ const findAssetInput = /* @__PURE__ */ __name((assetId) => txRequestClone.inputs.find((input) => {
7039
7156
  if (input.type === import_transactions26.InputType.Coin) {
7040
7157
  return input.assetId === assetId;
7041
7158
  }
@@ -7043,8 +7160,8 @@ var Account = class extends AbstractAccount {
7043
7160
  return baseAssetId === assetId;
7044
7161
  }
7045
7162
  return false;
7046
- });
7047
- const updateAssetInput = (assetId, quantity) => {
7163
+ }), "findAssetInput");
7164
+ const updateAssetInput = /* @__PURE__ */ __name((assetId, quantity) => {
7048
7165
  const assetInput = findAssetInput(assetId);
7049
7166
  const usedQuantity = quantity;
7050
7167
  if (assetInput && "amount" in assetInput) {
@@ -7059,7 +7176,7 @@ var Account = class extends AbstractAccount {
7059
7176
  ])
7060
7177
  );
7061
7178
  }
7062
- };
7179
+ }, "updateAssetInput");
7063
7180
  mergeQuantities(requiredQuantities, transactionFeeForDryRun).forEach(
7064
7181
  ({ amount, assetId }) => updateAssetInput(assetId, amount)
7065
7182
  );
@@ -7082,7 +7199,7 @@ var Account = class extends AbstractAccount {
7082
7199
  */
7083
7200
  async signMessage(message) {
7084
7201
  if (!this._connector) {
7085
- throw new import_errors22.FuelError(import_errors22.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
7202
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
7086
7203
  }
7087
7204
  return this._connector.signMessage(this.address.toString(), message);
7088
7205
  }
@@ -7094,8 +7211,8 @@ var Account = class extends AbstractAccount {
7094
7211
  */
7095
7212
  async signTransaction(transactionRequestLike) {
7096
7213
  if (!this._connector) {
7097
- throw new import_errors22.FuelError(
7098
- import_errors22.ErrorCode.MISSING_CONNECTOR,
7214
+ throw new import_errors23.FuelError(
7215
+ import_errors23.ErrorCode.MISSING_CONNECTOR,
7099
7216
  "A connector is required to sign transactions."
7100
7217
  );
7101
7218
  }
@@ -7191,8 +7308,8 @@ var Account = class extends AbstractAccount {
7191
7308
  /** @hidden * */
7192
7309
  validateTransferAmount(amount) {
7193
7310
  if ((0, import_math22.bn)(amount).lte(0)) {
7194
- throw new import_errors22.FuelError(
7195
- import_errors22.ErrorCode.INVALID_TRANSFER_AMOUNT,
7311
+ throw new import_errors23.FuelError(
7312
+ import_errors23.ErrorCode.INVALID_TRANSFER_AMOUNT,
7196
7313
  "Transfer amount must be a positive number."
7197
7314
  );
7198
7315
  }
@@ -7221,16 +7338,16 @@ var Account = class extends AbstractAccount {
7221
7338
  if (!(0, import_utils36.isDefined)(setGasLimit)) {
7222
7339
  request.gasLimit = gasUsed;
7223
7340
  } else if (gasUsed.gt(setGasLimit)) {
7224
- throw new import_errors22.FuelError(
7225
- import_errors22.ErrorCode.GAS_LIMIT_TOO_LOW,
7341
+ throw new import_errors23.FuelError(
7342
+ import_errors23.ErrorCode.GAS_LIMIT_TOO_LOW,
7226
7343
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
7227
7344
  );
7228
7345
  }
7229
7346
  if (!(0, import_utils36.isDefined)(setMaxFee)) {
7230
7347
  request.maxFee = maxFee;
7231
7348
  } else if (maxFee.gt(setMaxFee)) {
7232
- throw new import_errors22.FuelError(
7233
- import_errors22.ErrorCode.MAX_FEE_TOO_LOW,
7349
+ throw new import_errors23.FuelError(
7350
+ import_errors23.ErrorCode.MAX_FEE_TOO_LOW,
7234
7351
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
7235
7352
  );
7236
7353
  }
@@ -7241,19 +7358,19 @@ var Account = class extends AbstractAccount {
7241
7358
  // src/wallet/keystore-wallet.ts
7242
7359
  var import_address7 = require("@fuel-ts/address");
7243
7360
  var import_crypto6 = require("@fuel-ts/crypto");
7244
- var import_errors23 = require("@fuel-ts/errors");
7361
+ var import_errors24 = require("@fuel-ts/errors");
7245
7362
  var import_utils37 = require("@fuel-ts/utils");
7246
7363
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
7247
7364
  var DEFAULT_KDF_PARAMS_R = 8;
7248
7365
  var DEFAULT_KDF_PARAMS_P = 1;
7249
7366
  var DEFAULT_KEY_SIZE = 32;
7250
7367
  var DEFAULT_IV_SIZE = 16;
7251
- var removeHexPrefix = (hexString) => {
7368
+ var removeHexPrefix = /* @__PURE__ */ __name((hexString) => {
7252
7369
  if (/^0x/.test(hexString)) {
7253
7370
  return hexString.slice(2);
7254
7371
  }
7255
7372
  return hexString;
7256
- };
7373
+ }, "removeHexPrefix");
7257
7374
  async function encryptKeystoreWallet(privateKey, address, password) {
7258
7375
  const privateKeyBuffer = (0, import_crypto6.bufferFromString)(removeHexPrefix(privateKey), "hex");
7259
7376
  const ownerAddress = new import_address7.Address(address);
@@ -7292,6 +7409,7 @@ async function encryptKeystoreWallet(privateKey, address, password) {
7292
7409
  };
7293
7410
  return JSON.stringify(keystore);
7294
7411
  }
7412
+ __name(encryptKeystoreWallet, "encryptKeystoreWallet");
7295
7413
  async function decryptKeystoreWallet(jsonWallet, password) {
7296
7414
  const keystoreWallet = JSON.parse(jsonWallet);
7297
7415
  const {
@@ -7318,8 +7436,8 @@ async function decryptKeystoreWallet(jsonWallet, password) {
7318
7436
  const macHashUint8Array = (0, import_crypto6.keccak256)(data);
7319
7437
  const macHash = (0, import_crypto6.stringFromBuffer)(macHashUint8Array, "hex");
7320
7438
  if (mac !== macHash) {
7321
- throw new import_errors23.FuelError(
7322
- import_errors23.ErrorCode.INVALID_PASSWORD,
7439
+ throw new import_errors24.FuelError(
7440
+ import_errors24.ErrorCode.INVALID_PASSWORD,
7323
7441
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
7324
7442
  );
7325
7443
  }
@@ -7327,9 +7445,17 @@ async function decryptKeystoreWallet(jsonWallet, password) {
7327
7445
  const privateKey = (0, import_utils37.hexlify)(buffer);
7328
7446
  return privateKey;
7329
7447
  }
7448
+ __name(decryptKeystoreWallet, "decryptKeystoreWallet");
7330
7449
 
7331
7450
  // src/wallet/base-wallet-unlocked.ts
7332
7451
  var BaseWalletUnlocked = class extends Account {
7452
+ static {
7453
+ __name(this, "BaseWalletUnlocked");
7454
+ }
7455
+ /**
7456
+ * Default HDWallet path.
7457
+ */
7458
+ static defaultPath = "m/44'/1179993420'/0'/0/0";
7333
7459
  /**
7334
7460
  * A function that returns the wallet's signer.
7335
7461
  */
@@ -7447,21 +7573,17 @@ var BaseWalletUnlocked = class extends Account {
7447
7573
  return encryptKeystoreWallet(this.privateKey, this.address, password);
7448
7574
  }
7449
7575
  };
7450
- /**
7451
- * Default HDWallet path.
7452
- */
7453
- __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
7454
7576
 
7455
7577
  // src/hdwallet/hdwallet.ts
7456
7578
  var import_crypto8 = require("@fuel-ts/crypto");
7457
- var import_errors26 = require("@fuel-ts/errors");
7579
+ var import_errors27 = require("@fuel-ts/errors");
7458
7580
  var import_hasher7 = require("@fuel-ts/hasher");
7459
7581
  var import_math23 = require("@fuel-ts/math");
7460
7582
  var import_utils42 = require("@fuel-ts/utils");
7461
7583
 
7462
7584
  // src/mnemonic/mnemonic.ts
7463
7585
  var import_crypto7 = require("@fuel-ts/crypto");
7464
- var import_errors25 = require("@fuel-ts/errors");
7586
+ var import_errors26 = require("@fuel-ts/errors");
7465
7587
  var import_hasher6 = require("@fuel-ts/hasher");
7466
7588
  var import_utils40 = require("@fuel-ts/utils");
7467
7589
 
@@ -9518,27 +9640,31 @@ var english = [
9518
9640
  ];
9519
9641
 
9520
9642
  // src/mnemonic/utils.ts
9521
- var import_errors24 = require("@fuel-ts/errors");
9643
+ var import_errors25 = require("@fuel-ts/errors");
9522
9644
  var import_hasher5 = require("@fuel-ts/hasher");
9523
9645
  var import_utils39 = require("@fuel-ts/utils");
9524
9646
  function getLowerMask(bits) {
9525
9647
  return (1 << bits) - 1;
9526
9648
  }
9649
+ __name(getLowerMask, "getLowerMask");
9527
9650
  function getUpperMask(bits) {
9528
9651
  return (1 << bits) - 1 << 8 - bits;
9529
9652
  }
9653
+ __name(getUpperMask, "getUpperMask");
9530
9654
  function getWords(mnemonic) {
9531
9655
  if (!Array.isArray(mnemonic)) {
9532
9656
  return mnemonic.split(/\s+/);
9533
9657
  }
9534
9658
  return mnemonic;
9535
9659
  }
9660
+ __name(getWords, "getWords");
9536
9661
  function getPhrase(mnemonic) {
9537
9662
  if (Array.isArray(mnemonic)) {
9538
9663
  return mnemonic.join(" ");
9539
9664
  }
9540
9665
  return mnemonic;
9541
9666
  }
9667
+ __name(getPhrase, "getPhrase");
9542
9668
  function entropyToMnemonicIndices(entropy) {
9543
9669
  const indices = [0];
9544
9670
  let remainingBits = 11;
@@ -9560,6 +9686,7 @@ function entropyToMnemonicIndices(entropy) {
9560
9686
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
9561
9687
  return indices;
9562
9688
  }
9689
+ __name(entropyToMnemonicIndices, "entropyToMnemonicIndices");
9563
9690
  function mnemonicWordsToEntropy(words, wordlist) {
9564
9691
  const size = Math.ceil(11 * words.length / 8);
9565
9692
  const entropy = (0, import_utils39.arrayify)(new Uint8Array(size));
@@ -9567,8 +9694,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
9567
9694
  for (let i = 0; i < words.length; i += 1) {
9568
9695
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
9569
9696
  if (index === -1) {
9570
- throw new import_errors24.FuelError(
9571
- import_errors24.ErrorCode.INVALID_MNEMONIC,
9697
+ throw new import_errors25.FuelError(
9698
+ import_errors25.ErrorCode.INVALID_MNEMONIC,
9572
9699
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
9573
9700
  );
9574
9701
  }
@@ -9584,13 +9711,14 @@ function mnemonicWordsToEntropy(words, wordlist) {
9584
9711
  const checksumMask = getUpperMask(checksumBits);
9585
9712
  const checksum = (0, import_utils39.arrayify)((0, import_hasher5.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9586
9713
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
9587
- throw new import_errors24.FuelError(
9588
- import_errors24.ErrorCode.INVALID_CHECKSUM,
9714
+ throw new import_errors25.FuelError(
9715
+ import_errors25.ErrorCode.INVALID_CHECKSUM,
9589
9716
  "Checksum validation failed for the provided mnemonic."
9590
9717
  );
9591
9718
  }
9592
9719
  return entropy.slice(0, entropyBits / 8);
9593
9720
  }
9721
+ __name(mnemonicWordsToEntropy, "mnemonicWordsToEntropy");
9594
9722
 
9595
9723
  // src/mnemonic/mnemonic.ts
9596
9724
  var MasterSecret = (0, import_utils40.toUtf8Bytes)("Bitcoin seed");
@@ -9599,29 +9727,35 @@ var TestnetPRV = "0x04358394";
9599
9727
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
9600
9728
  function assertWordList(wordlist) {
9601
9729
  if (wordlist.length !== 2048) {
9602
- throw new import_errors25.FuelError(
9603
- import_errors25.ErrorCode.INVALID_WORD_LIST,
9730
+ throw new import_errors26.FuelError(
9731
+ import_errors26.ErrorCode.INVALID_WORD_LIST,
9604
9732
  `Expected word list length of 2048, but got ${wordlist.length}.`
9605
9733
  );
9606
9734
  }
9607
9735
  }
9736
+ __name(assertWordList, "assertWordList");
9608
9737
  function assertEntropy(entropy) {
9609
9738
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
9610
- throw new import_errors25.FuelError(
9611
- import_errors25.ErrorCode.INVALID_ENTROPY,
9739
+ throw new import_errors26.FuelError(
9740
+ import_errors26.ErrorCode.INVALID_ENTROPY,
9612
9741
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
9613
9742
  );
9614
9743
  }
9615
9744
  }
9745
+ __name(assertEntropy, "assertEntropy");
9616
9746
  function assertMnemonic(words) {
9617
9747
  if (!MNEMONIC_SIZES.includes(words.length)) {
9618
9748
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
9619
9749
  ", "
9620
9750
  )}] words, but got ${words.length}.`;
9621
- throw new import_errors25.FuelError(import_errors25.ErrorCode.INVALID_MNEMONIC, errorMsg);
9751
+ throw new import_errors26.FuelError(import_errors26.ErrorCode.INVALID_MNEMONIC, errorMsg);
9622
9752
  }
9623
9753
  }
9624
- var Mnemonic = class {
9754
+ __name(assertMnemonic, "assertMnemonic");
9755
+ var Mnemonic = class _Mnemonic {
9756
+ static {
9757
+ __name(this, "Mnemonic");
9758
+ }
9625
9759
  wordlist;
9626
9760
  /**
9627
9761
  *
@@ -9638,7 +9772,7 @@ var Mnemonic = class {
9638
9772
  * @returns Entropy hash
9639
9773
  */
9640
9774
  mnemonicToEntropy(phrase) {
9641
- return Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
9775
+ return _Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
9642
9776
  }
9643
9777
  /**
9644
9778
  *
@@ -9646,7 +9780,7 @@ var Mnemonic = class {
9646
9780
  * @returns Mnemonic phrase
9647
9781
  */
9648
9782
  entropyToMnemonic(entropy) {
9649
- return Mnemonic.entropyToMnemonic(entropy, this.wordlist);
9783
+ return _Mnemonic.entropyToMnemonic(entropy, this.wordlist);
9650
9784
  }
9651
9785
  /**
9652
9786
  *
@@ -9687,8 +9821,8 @@ var Mnemonic = class {
9687
9821
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
9688
9822
  */
9689
9823
  static mnemonicToMasterKeys(phrase, passphrase = "") {
9690
- const seed = Mnemonic.mnemonicToSeed(phrase, passphrase);
9691
- return Mnemonic.masterKeysFromSeed(seed);
9824
+ const seed = _Mnemonic.mnemonicToSeed(phrase, passphrase);
9825
+ return _Mnemonic.masterKeysFromSeed(seed);
9692
9826
  }
9693
9827
  /**
9694
9828
  * Validates if given mnemonic is valid
@@ -9704,7 +9838,7 @@ var Mnemonic = class {
9704
9838
  return false;
9705
9839
  }
9706
9840
  while (i < words.length) {
9707
- if (Mnemonic.binarySearch(words[i]) === false) {
9841
+ if (_Mnemonic.binarySearch(words[i]) === false) {
9708
9842
  return false;
9709
9843
  }
9710
9844
  i += 1;
@@ -9736,8 +9870,8 @@ var Mnemonic = class {
9736
9870
  static masterKeysFromSeed(seed) {
9737
9871
  const seedArray = (0, import_utils40.arrayify)(seed);
9738
9872
  if (seedArray.length < 16 || seedArray.length > 64) {
9739
- throw new import_errors25.FuelError(
9740
- import_errors25.ErrorCode.INVALID_SEED,
9873
+ throw new import_errors26.FuelError(
9874
+ import_errors26.ErrorCode.INVALID_SEED,
9741
9875
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
9742
9876
  );
9743
9877
  }
@@ -9751,7 +9885,7 @@ var Mnemonic = class {
9751
9885
  * @returns BIP-32 extended private key
9752
9886
  */
9753
9887
  static seedToExtendedKey(seed, testnet = false) {
9754
- const masterKey = Mnemonic.masterKeysFromSeed(seed);
9888
+ const masterKey = _Mnemonic.masterKeysFromSeed(seed);
9755
9889
  const prefix = (0, import_utils40.arrayify)(testnet ? TestnetPRV : MainnetPRV);
9756
9890
  const depth = "0x00";
9757
9891
  const fingerprint = "0x00000000";
@@ -9783,7 +9917,7 @@ var Mnemonic = class {
9783
9917
  */
9784
9918
  static generate(size = 32, extraEntropy = "") {
9785
9919
  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);
9786
- return Mnemonic.entropyToMnemonic(entropy);
9920
+ return _Mnemonic.entropyToMnemonic(entropy);
9787
9921
  }
9788
9922
  };
9789
9923
  var mnemonic_default = Mnemonic;
@@ -9797,24 +9931,28 @@ var TestnetPUB = (0, import_utils42.hexlify)("0x043587cf");
9797
9931
  function base58check(data) {
9798
9932
  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)]));
9799
9933
  }
9934
+ __name(base58check, "base58check");
9800
9935
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9801
9936
  if (isPublic) {
9802
9937
  return testnet ? TestnetPUB : MainnetPUB;
9803
9938
  }
9804
9939
  return testnet ? TestnetPRV2 : MainnetPRV2;
9805
9940
  }
9941
+ __name(getExtendedKeyPrefix, "getExtendedKeyPrefix");
9806
9942
  function isPublicExtendedKey(extendedKey) {
9807
9943
  return [MainnetPUB, TestnetPUB].includes((0, import_utils42.hexlify)(extendedKey.slice(0, 4)));
9808
9944
  }
9945
+ __name(isPublicExtendedKey, "isPublicExtendedKey");
9809
9946
  function isValidExtendedKey(extendedKey) {
9810
9947
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9811
9948
  (0, import_utils42.hexlify)(extendedKey.slice(0, 4))
9812
9949
  );
9813
9950
  }
9951
+ __name(isValidExtendedKey, "isValidExtendedKey");
9814
9952
  function parsePath(path2, depth = 0) {
9815
9953
  const components = path2.split("/");
9816
9954
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
9817
- throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
9955
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
9818
9956
  }
9819
9957
  if (components[0] === "m") {
9820
9958
  components.shift();
@@ -9823,7 +9961,11 @@ function parsePath(path2, depth = 0) {
9823
9961
  (p) => ~p.indexOf(`'`) ? parseInt(p, 10) + HARDENED_INDEX : parseInt(p, 10)
9824
9962
  );
9825
9963
  }
9826
- var HDWallet = class {
9964
+ __name(parsePath, "parsePath");
9965
+ var HDWallet = class _HDWallet {
9966
+ static {
9967
+ __name(this, "HDWallet");
9968
+ }
9827
9969
  depth = 0;
9828
9970
  index = 0;
9829
9971
  fingerprint = (0, import_utils42.hexlify)("0x00000000");
@@ -9843,8 +9985,8 @@ var HDWallet = class {
9843
9985
  this.privateKey = (0, import_utils42.hexlify)(config.privateKey);
9844
9986
  } else {
9845
9987
  if (!config.publicKey) {
9846
- throw new import_errors26.FuelError(
9847
- import_errors26.ErrorCode.HD_WALLET_ERROR,
9988
+ throw new import_errors27.FuelError(
9989
+ import_errors27.ErrorCode.HD_WALLET_ERROR,
9848
9990
  "Both public and private Key cannot be missing. At least one should be provided."
9849
9991
  );
9850
9992
  }
@@ -9873,8 +10015,8 @@ var HDWallet = class {
9873
10015
  const data = new Uint8Array(37);
9874
10016
  if (index & HARDENED_INDEX) {
9875
10017
  if (!privateKey) {
9876
- throw new import_errors26.FuelError(
9877
- import_errors26.ErrorCode.HD_WALLET_ERROR,
10018
+ throw new import_errors27.FuelError(
10019
+ import_errors27.ErrorCode.HD_WALLET_ERROR,
9878
10020
  "Cannot derive a hardened index without a private Key."
9879
10021
  );
9880
10022
  }
@@ -9889,7 +10031,7 @@ var HDWallet = class {
9889
10031
  if (privateKey) {
9890
10032
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
9891
10033
  const ki = (0, import_math23.bn)(IL).add(privateKey).mod(N).toBytes(32);
9892
- return new HDWallet({
10034
+ return new _HDWallet({
9893
10035
  privateKey: ki,
9894
10036
  chainCode: IR,
9895
10037
  index,
@@ -9899,7 +10041,7 @@ var HDWallet = class {
9899
10041
  }
9900
10042
  const signer = new Signer((0, import_utils42.hexlify)(IL));
9901
10043
  const Ki = signer.addPoint(publicKey);
9902
- return new HDWallet({
10044
+ return new _HDWallet({
9903
10045
  publicKey: Ki,
9904
10046
  chainCode: IR,
9905
10047
  index,
@@ -9926,8 +10068,8 @@ var HDWallet = class {
9926
10068
  */
9927
10069
  toExtendedKey(isPublic = false, testnet = false) {
9928
10070
  if (this.depth >= 256) {
9929
- throw new import_errors26.FuelError(
9930
- import_errors26.ErrorCode.HD_WALLET_ERROR,
10071
+ throw new import_errors27.FuelError(
10072
+ import_errors27.ErrorCode.HD_WALLET_ERROR,
9931
10073
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
9932
10074
  );
9933
10075
  }
@@ -9948,7 +10090,7 @@ var HDWallet = class {
9948
10090
  */
9949
10091
  static fromSeed(seed) {
9950
10092
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
9951
- return new HDWallet({
10093
+ return new _HDWallet({
9952
10094
  chainCode: (0, import_utils42.arrayify)(masterKey.slice(32)),
9953
10095
  privateKey: (0, import_utils42.arrayify)(masterKey.slice(0, 32))
9954
10096
  });
@@ -9958,10 +10100,10 @@ var HDWallet = class {
9958
10100
  const bytes = (0, import_utils42.arrayify)(decoded);
9959
10101
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9960
10102
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
9961
- throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
10103
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
9962
10104
  }
9963
10105
  if (!validChecksum) {
9964
- throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
10106
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
9965
10107
  }
9966
10108
  const depth = bytes[4];
9967
10109
  const parentFingerprint = (0, import_utils42.hexlify)(bytes.slice(5, 9));
@@ -9969,16 +10111,16 @@ var HDWallet = class {
9969
10111
  const chainCode = (0, import_utils42.hexlify)(bytes.slice(13, 45));
9970
10112
  const key = bytes.slice(45, 78);
9971
10113
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
9972
- throw new import_errors26.FuelError(
9973
- import_errors26.ErrorCode.HD_WALLET_ERROR,
10114
+ throw new import_errors27.FuelError(
10115
+ import_errors27.ErrorCode.HD_WALLET_ERROR,
9974
10116
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
9975
10117
  );
9976
10118
  }
9977
10119
  if (isPublicExtendedKey(bytes)) {
9978
10120
  if (key[0] !== 3) {
9979
- throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
10121
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
9980
10122
  }
9981
- return new HDWallet({
10123
+ return new _HDWallet({
9982
10124
  publicKey: key,
9983
10125
  chainCode,
9984
10126
  index,
@@ -9987,9 +10129,9 @@ var HDWallet = class {
9987
10129
  });
9988
10130
  }
9989
10131
  if (key[0] !== 0) {
9990
- throw new import_errors26.FuelError(import_errors26.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
10132
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
9991
10133
  }
9992
- return new HDWallet({
10134
+ return new _HDWallet({
9993
10135
  privateKey: key.slice(1),
9994
10136
  chainCode,
9995
10137
  index,
@@ -10002,6 +10144,9 @@ var hdwallet_default = HDWallet;
10002
10144
 
10003
10145
  // src/wallet/wallets.ts
10004
10146
  var WalletLocked = class extends Account {
10147
+ static {
10148
+ __name(this, "WalletLocked");
10149
+ }
10005
10150
  /**
10006
10151
  * Unlocks the wallet using the provided private key and returns an instance of WalletUnlocked.
10007
10152
  *
@@ -10012,7 +10157,10 @@ var WalletLocked = class extends Account {
10012
10157
  return new WalletUnlocked(privateKey, this._provider);
10013
10158
  }
10014
10159
  };
10015
- var WalletUnlocked = class extends BaseWalletUnlocked {
10160
+ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
10161
+ static {
10162
+ __name(this, "WalletUnlocked");
10163
+ }
10016
10164
  /**
10017
10165
  * Locks the wallet and returns an instance of WalletLocked.
10018
10166
  *
@@ -10030,7 +10178,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10030
10178
  */
10031
10179
  static generate(generateOptions) {
10032
10180
  const privateKey = Signer.generatePrivateKey(generateOptions?.entropy);
10033
- return new WalletUnlocked(privateKey, generateOptions?.provider);
10181
+ return new _WalletUnlocked(privateKey, generateOptions?.provider);
10034
10182
  }
10035
10183
  /**
10036
10184
  * Create a Wallet Unlocked from a seed.
@@ -10042,8 +10190,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10042
10190
  */
10043
10191
  static fromSeed(seed, path2, provider) {
10044
10192
  const hdWallet = hdwallet_default.fromSeed(seed);
10045
- const childWallet = hdWallet.derivePath(path2 || WalletUnlocked.defaultPath);
10046
- return new WalletUnlocked(childWallet.privateKey, provider);
10193
+ const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
10194
+ return new _WalletUnlocked(childWallet.privateKey, provider);
10047
10195
  }
10048
10196
  /**
10049
10197
  * Create a Wallet Unlocked from a mnemonic phrase.
@@ -10057,8 +10205,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10057
10205
  static fromMnemonic(mnemonic, path2, passphrase, provider) {
10058
10206
  const seed = mnemonic_default.mnemonicToSeed(mnemonic, passphrase);
10059
10207
  const hdWallet = hdwallet_default.fromSeed(seed);
10060
- const childWallet = hdWallet.derivePath(path2 || WalletUnlocked.defaultPath);
10061
- return new WalletUnlocked(childWallet.privateKey, provider);
10208
+ const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
10209
+ return new _WalletUnlocked(childWallet.privateKey, provider);
10062
10210
  }
10063
10211
  /**
10064
10212
  * Create a Wallet Unlocked from an extended key.
@@ -10069,7 +10217,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10069
10217
  */
10070
10218
  static fromExtendedKey(extendedKey, provider) {
10071
10219
  const hdWallet = hdwallet_default.fromExtendedKey(extendedKey);
10072
- return new WalletUnlocked(hdWallet.privateKey, provider);
10220
+ return new _WalletUnlocked(hdWallet.privateKey, provider);
10073
10221
  }
10074
10222
  /**
10075
10223
  * Create a Wallet Unlocked from an encrypted JSON.
@@ -10081,12 +10229,15 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10081
10229
  */
10082
10230
  static async fromEncryptedJson(jsonWallet, password, provider) {
10083
10231
  const privateKey = await decryptKeystoreWallet(jsonWallet, password);
10084
- return new WalletUnlocked(privateKey, provider);
10232
+ return new _WalletUnlocked(privateKey, provider);
10085
10233
  }
10086
10234
  };
10087
10235
 
10088
10236
  // src/wallet/wallet.ts
10089
10237
  var Wallet = class {
10238
+ static {
10239
+ __name(this, "Wallet");
10240
+ }
10090
10241
  /**
10091
10242
  * Creates a locked wallet instance from an address and a provider.
10092
10243
  *
@@ -10107,71 +10258,74 @@ var Wallet = class {
10107
10258
  static fromPrivateKey(privateKey, provider) {
10108
10259
  return new WalletUnlocked(privateKey, provider);
10109
10260
  }
10261
+ /**
10262
+ * Generate a new Wallet Unlocked with a random key pair.
10263
+ *
10264
+ * @param generateOptions - Options to customize the generation process (optional).
10265
+ * @returns An unlocked wallet instance.
10266
+ */
10267
+ static generate = WalletUnlocked.generate;
10268
+ /**
10269
+ * Create a Wallet Unlocked from a seed.
10270
+ *
10271
+ * @param seed - The seed phrase.
10272
+ * @param provider - A Provider instance (optional).
10273
+ * @param path - The derivation path (optional).
10274
+ * @returns An unlocked wallet instance.
10275
+ */
10276
+ static fromSeed = WalletUnlocked.fromSeed;
10277
+ /**
10278
+ * Create a Wallet Unlocked from a mnemonic phrase.
10279
+ *
10280
+ * @param mnemonic - The mnemonic phrase.
10281
+ * @param provider - A Provider instance (optional).
10282
+ * @param path - The derivation path (optional).
10283
+ * @param passphrase - The passphrase for the mnemonic (optional).
10284
+ * @returns An unlocked wallet instance.
10285
+ */
10286
+ static fromMnemonic = WalletUnlocked.fromMnemonic;
10287
+ /**
10288
+ * Create a Wallet Unlocked from an extended key.
10289
+ *
10290
+ * @param extendedKey - The extended key.
10291
+ * @param provider - A Provider instance (optional).
10292
+ * @returns An unlocked wallet instance.
10293
+ */
10294
+ static fromExtendedKey = WalletUnlocked.fromExtendedKey;
10295
+ /**
10296
+ * Create a Wallet Unlocked from an encrypted JSON.
10297
+ *
10298
+ * @param jsonWallet - The encrypted JSON keystore.
10299
+ * @param password - The password to decrypt the JSON.
10300
+ * @param provider - A Provider instance (optional).
10301
+ * @returns An unlocked wallet instance.
10302
+ */
10303
+ static fromEncryptedJson = WalletUnlocked.fromEncryptedJson;
10110
10304
  };
10111
- /**
10112
- * Generate a new Wallet Unlocked with a random key pair.
10113
- *
10114
- * @param generateOptions - Options to customize the generation process (optional).
10115
- * @returns An unlocked wallet instance.
10116
- */
10117
- __publicField(Wallet, "generate", WalletUnlocked.generate);
10118
- /**
10119
- * Create a Wallet Unlocked from a seed.
10120
- *
10121
- * @param seed - The seed phrase.
10122
- * @param provider - A Provider instance (optional).
10123
- * @param path - The derivation path (optional).
10124
- * @returns An unlocked wallet instance.
10125
- */
10126
- __publicField(Wallet, "fromSeed", WalletUnlocked.fromSeed);
10127
- /**
10128
- * Create a Wallet Unlocked from a mnemonic phrase.
10129
- *
10130
- * @param mnemonic - The mnemonic phrase.
10131
- * @param provider - A Provider instance (optional).
10132
- * @param path - The derivation path (optional).
10133
- * @param passphrase - The passphrase for the mnemonic (optional).
10134
- * @returns An unlocked wallet instance.
10135
- */
10136
- __publicField(Wallet, "fromMnemonic", WalletUnlocked.fromMnemonic);
10137
- /**
10138
- * Create a Wallet Unlocked from an extended key.
10139
- *
10140
- * @param extendedKey - The extended key.
10141
- * @param provider - A Provider instance (optional).
10142
- * @returns An unlocked wallet instance.
10143
- */
10144
- __publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
10145
- /**
10146
- * Create a Wallet Unlocked from an encrypted JSON.
10147
- *
10148
- * @param jsonWallet - The encrypted JSON keystore.
10149
- * @param password - The password to decrypt the JSON.
10150
- * @param provider - A Provider instance (optional).
10151
- * @returns An unlocked wallet instance.
10152
- */
10153
- __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
10154
10305
 
10155
10306
  // src/test-utils/wallet-config.ts
10156
- var WalletsConfig = class {
10307
+ var WalletsConfig = class _WalletsConfig {
10308
+ static {
10309
+ __name(this, "WalletsConfig");
10310
+ }
10157
10311
  initialState;
10158
10312
  options;
10159
10313
  wallets;
10160
- generateWallets = () => {
10314
+ generateWallets = /* @__PURE__ */ __name(() => {
10161
10315
  const generatedWallets = [];
10162
10316
  for (let index = 1; index <= this.options.count; index++) {
10163
10317
  generatedWallets.push(new WalletUnlocked((0, import_crypto9.randomBytes)(32)));
10164
10318
  }
10165
10319
  return generatedWallets;
10166
- };
10320
+ }, "generateWallets");
10167
10321
  constructor(baseAssetId, config) {
10168
- WalletsConfig.validate(config);
10322
+ _WalletsConfig.validate(config);
10169
10323
  this.options = config;
10170
10324
  const { assets, coinsPerAsset, amountPerCoin, messages } = this.options;
10171
10325
  this.wallets = this.generateWallets();
10172
10326
  this.initialState = {
10173
- messages: WalletsConfig.createMessages(this.wallets, messages),
10174
- coins: WalletsConfig.createCoins(
10327
+ messages: _WalletsConfig.createMessages(this.wallets, messages),
10328
+ coins: _WalletsConfig.createCoins(
10175
10329
  this.wallets,
10176
10330
  baseAssetId,
10177
10331
  assets,
@@ -10231,26 +10385,26 @@ var WalletsConfig = class {
10231
10385
  amountPerCoin
10232
10386
  }) {
10233
10387
  if (Array.isArray(wallets) && wallets.length === 0 || typeof wallets === "number" && wallets <= 0) {
10234
- throw new import_errors27.FuelError(
10235
- import_errors27.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10388
+ throw new import_errors28.FuelError(
10389
+ import_errors28.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10236
10390
  "Number of wallets must be greater than zero."
10237
10391
  );
10238
10392
  }
10239
10393
  if (Array.isArray(assets) && assets.length === 0 || typeof assets === "number" && assets <= 0) {
10240
- throw new import_errors27.FuelError(
10241
- import_errors27.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10394
+ throw new import_errors28.FuelError(
10395
+ import_errors28.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10242
10396
  "Number of assets per wallet must be greater than zero."
10243
10397
  );
10244
10398
  }
10245
10399
  if (coinsPerAsset <= 0) {
10246
- throw new import_errors27.FuelError(
10247
- import_errors27.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10400
+ throw new import_errors28.FuelError(
10401
+ import_errors28.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10248
10402
  "Number of coins per asset must be greater than zero."
10249
10403
  );
10250
10404
  }
10251
10405
  if ((0, import_math24.bn)(amountPerCoin).lt(0)) {
10252
- throw new import_errors27.FuelError(
10253
- import_errors27.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10406
+ throw new import_errors28.FuelError(
10407
+ import_errors28.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10254
10408
  "Amount per coin must be greater than or equal to zero."
10255
10409
  );
10256
10410
  }
@@ -10293,9 +10447,9 @@ async function setupTestProviderAndWallets({
10293
10447
  if (launchNodeServerPort) {
10294
10448
  const serverUrl = `http://localhost:${launchNodeServerPort}`;
10295
10449
  url = await (await fetch(serverUrl, { method: "POST", body: JSON.stringify(launchNodeOptions) })).text();
10296
- cleanup = () => {
10450
+ cleanup = /* @__PURE__ */ __name(() => {
10297
10451
  fetch(`${serverUrl}/cleanup/${url}`);
10298
- };
10452
+ }, "cleanup");
10299
10453
  } else {
10300
10454
  const settings = await launchNode(launchNodeOptions);
10301
10455
  url = settings.url;
@@ -10320,6 +10474,7 @@ async function setupTestProviderAndWallets({
10320
10474
  [Symbol.dispose]: cleanup
10321
10475
  };
10322
10476
  }
10477
+ __name(setupTestProviderAndWallets, "setupTestProviderAndWallets");
10323
10478
 
10324
10479
  // src/test-utils/test-message.ts
10325
10480
  var import_address8 = require("@fuel-ts/address");
@@ -10327,6 +10482,9 @@ var import_crypto10 = require("@fuel-ts/crypto");
10327
10482
  var import_math25 = require("@fuel-ts/math");
10328
10483
  var import_utils45 = require("@fuel-ts/utils");
10329
10484
  var TestMessage = class {
10485
+ static {
10486
+ __name(this, "TestMessage");
10487
+ }
10330
10488
  sender;
10331
10489
  recipient;
10332
10490
  nonce;