@fuel-ts/account 0.100.1 → 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,7 +438,7 @@ 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");
@@ -474,6 +461,7 @@ function deferPromise() {
474
461
  });
475
462
  return defer;
476
463
  }
464
+ __name(deferPromise, "deferPromise");
477
465
 
478
466
  // src/providers/__generated__/operations.ts
479
467
  var import_graphql_tag = __toESM(require("graphql-tag"));
@@ -966,6 +954,11 @@ var NodeInfoFragmentDoc = import_graphql_tag.default`
966
954
  maxTx
967
955
  maxDepth
968
956
  nodeVersion
957
+ indexation {
958
+ balances
959
+ coinsToSpend
960
+ assetMetadata
961
+ }
969
962
  }
970
963
  `;
971
964
  var RelayedTransactionStatusFragmentDoc = import_graphql_tag.default`
@@ -1247,7 +1240,7 @@ var GetBalancesDocument = import_graphql_tag.default`
1247
1240
  }
1248
1241
  `;
1249
1242
  var GetBalancesV2Document = import_graphql_tag.default`
1250
- 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!) {
1251
1244
  balances(
1252
1245
  filter: $filter
1253
1246
  after: $after
@@ -1255,7 +1248,7 @@ var GetBalancesV2Document = import_graphql_tag.default`
1255
1248
  first: $first
1256
1249
  last: $last
1257
1250
  ) {
1258
- pageInfo {
1251
+ pageInfo @include(if: $supportsPagination) {
1259
1252
  ...pageInfoFragment
1260
1253
  }
1261
1254
  edges {
@@ -1525,6 +1518,7 @@ function getSdk(requester) {
1525
1518
  }
1526
1519
  };
1527
1520
  }
1521
+ __name(getSdk, "getSdk");
1528
1522
 
1529
1523
  // src/providers/fuel-graphql-subscriber.ts
1530
1524
  var import_errors4 = require("@fuel-ts/errors");
@@ -1532,7 +1526,7 @@ var import_graphql = require("graphql");
1532
1526
 
1533
1527
  // src/providers/utils/handle-gql-error-message.ts
1534
1528
  var import_errors3 = require("@fuel-ts/errors");
1535
- var mapGqlErrorMessage = (error) => {
1529
+ var mapGqlErrorMessage = /* @__PURE__ */ __name((error) => {
1536
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)) {
1537
1531
  return new import_errors3.FuelError(
1538
1532
  import_errors3.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
@@ -1550,8 +1544,8 @@ var mapGqlErrorMessage = (error) => {
1550
1544
  );
1551
1545
  }
1552
1546
  return new import_errors3.FuelError(import_errors3.ErrorCode.INVALID_REQUEST, error.message, {}, error);
1553
- };
1554
- var mapGqlErrorWithIncompatibleNodeVersion = (error, incompatibleNodeVersionMessage) => {
1547
+ }, "mapGqlErrorMessage");
1548
+ var mapGqlErrorWithIncompatibleNodeVersion = /* @__PURE__ */ __name((error, incompatibleNodeVersionMessage) => {
1555
1549
  if (!incompatibleNodeVersionMessage) {
1556
1550
  return error;
1557
1551
  }
@@ -1563,8 +1557,8 @@ ${incompatibleNodeVersionMessage}`,
1563
1557
  error.metadata,
1564
1558
  error.rawError
1565
1559
  );
1566
- };
1567
- var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = false) => {
1560
+ }, "mapGqlErrorWithIncompatibleNodeVersion");
1561
+ var assertGqlResponseHasNoErrors = /* @__PURE__ */ __name((errors, incompatibleNodeVersionMessage = false) => {
1568
1562
  if (!Array.isArray(errors)) {
1569
1563
  return;
1570
1564
  }
@@ -1577,13 +1571,18 @@ var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = fal
1577
1571
  new import_errors3.FuelError(import_errors3.ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
1578
1572
  incompatibleNodeVersionMessage
1579
1573
  );
1580
- };
1574
+ }, "assertGqlResponseHasNoErrors");
1581
1575
 
1582
1576
  // src/providers/fuel-graphql-subscriber.ts
1583
- var _FuelGraphqlSubscriber = class {
1577
+ var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
1584
1578
  constructor(stream) {
1585
1579
  this.stream = stream;
1586
1580
  }
1581
+ static {
1582
+ __name(this, "FuelGraphqlSubscriber");
1583
+ }
1584
+ static incompatibleNodeVersionMessage = false;
1585
+ static textDecoder = new TextDecoder();
1587
1586
  static async create(options) {
1588
1587
  const { url, query, variables, fetchFn } = options;
1589
1588
  const response = await fetchFn(`${url}-sub`, {
@@ -1644,9 +1643,6 @@ var _FuelGraphqlSubscriber = class {
1644
1643
  return this;
1645
1644
  }
1646
1645
  };
1647
- var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
1648
- __publicField(FuelGraphqlSubscriber, "incompatibleNodeVersionMessage", false);
1649
- __publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
1650
1646
 
1651
1647
  // src/providers/resource-cache.ts
1652
1648
  var import_errors15 = require("@fuel-ts/errors");
@@ -1659,7 +1655,7 @@ var import_errors5 = require("@fuel-ts/errors");
1659
1655
  var import_math3 = require("@fuel-ts/math");
1660
1656
  var import_transactions = require("@fuel-ts/transactions");
1661
1657
  var import_utils4 = require("@fuel-ts/utils");
1662
- var inputify = (value) => {
1658
+ var inputify = /* @__PURE__ */ __name((value) => {
1663
1659
  const { type } = value;
1664
1660
  switch (value.type) {
1665
1661
  case import_transactions.InputType.Coin: {
@@ -1725,7 +1721,7 @@ var inputify = (value) => {
1725
1721
  );
1726
1722
  }
1727
1723
  }
1728
- };
1724
+ }, "inputify");
1729
1725
 
1730
1726
  // src/providers/transaction-request/output.ts
1731
1727
  var import_configs2 = require("@fuel-ts/address/configs");
@@ -1733,7 +1729,7 @@ var import_errors6 = require("@fuel-ts/errors");
1733
1729
  var import_math4 = require("@fuel-ts/math");
1734
1730
  var import_transactions2 = require("@fuel-ts/transactions");
1735
1731
  var import_utils5 = require("@fuel-ts/utils");
1736
- var outputify = (value) => {
1732
+ var outputify = /* @__PURE__ */ __name((value) => {
1737
1733
  const { type } = value;
1738
1734
  switch (type) {
1739
1735
  case import_transactions2.OutputType.Coin: {
@@ -1782,7 +1778,7 @@ var outputify = (value) => {
1782
1778
  );
1783
1779
  }
1784
1780
  }
1785
- };
1781
+ }, "outputify");
1786
1782
 
1787
1783
  // src/providers/transaction-request/transaction-request.ts
1788
1784
  var import_abi_coder3 = require("@fuel-ts/abi-coder");
@@ -1795,10 +1791,10 @@ var import_transactions8 = require("@fuel-ts/transactions");
1795
1791
  var import_utils11 = require("@fuel-ts/utils");
1796
1792
 
1797
1793
  // src/providers/message.ts
1798
- var isMessageCoin = (message) => !("data" in message);
1794
+ var isMessageCoin = /* @__PURE__ */ __name((message) => !("data" in message), "isMessageCoin");
1799
1795
 
1800
1796
  // src/providers/resource.ts
1801
- var isCoin = (resource) => "id" in resource;
1797
+ var isCoin = /* @__PURE__ */ __name((resource) => "id" in resource, "isCoin");
1802
1798
 
1803
1799
  // src/providers/utils/receipts.ts
1804
1800
  var import_transactions4 = require("@fuel-ts/transactions");
@@ -1810,7 +1806,7 @@ var import_errors7 = require("@fuel-ts/errors");
1810
1806
  var import_math5 = require("@fuel-ts/math");
1811
1807
  var import_transactions3 = require("@fuel-ts/transactions");
1812
1808
  var import_utils6 = require("@fuel-ts/utils");
1813
- var deserializeChain = (chain) => {
1809
+ var deserializeChain = /* @__PURE__ */ __name((chain) => {
1814
1810
  const { name, daHeight, consensusParameters } = chain;
1815
1811
  const {
1816
1812
  contractParams,
@@ -1864,8 +1860,8 @@ var deserializeChain = (chain) => {
1864
1860
  gasCosts
1865
1861
  }
1866
1862
  };
1867
- };
1868
- var serializeChain = (chain) => {
1863
+ }, "deserializeChain");
1864
+ var serializeChain = /* @__PURE__ */ __name((chain) => {
1869
1865
  const { name, baseChainHeight, consensusParameters } = chain;
1870
1866
  const {
1871
1867
  contractParameters,
@@ -1919,39 +1915,41 @@ var serializeChain = (chain) => {
1919
1915
  gasCosts
1920
1916
  }
1921
1917
  };
1922
- };
1923
- var deserializeNodeInfo = (nodeInfo) => {
1924
- const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
1918
+ }, "serializeChain");
1919
+ var deserializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
1920
+ const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace, indexation } = nodeInfo;
1925
1921
  return {
1926
1922
  maxDepth: (0, import_math5.bn)(maxDepth),
1927
1923
  maxTx: (0, import_math5.bn)(maxTx),
1928
1924
  nodeVersion,
1929
1925
  utxoValidation,
1930
- vmBacktrace
1926
+ vmBacktrace,
1927
+ indexation
1931
1928
  };
1932
- };
1933
- var serializeNodeInfo = (nodeInfo) => {
1934
- const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
1929
+ }, "deserializeNodeInfo");
1930
+ var serializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
1931
+ const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace, indexation } = nodeInfo;
1935
1932
  return {
1936
1933
  maxDepth: maxDepth.toString(),
1937
1934
  maxTx: maxTx.toString(),
1938
1935
  nodeVersion,
1939
1936
  utxoValidation,
1940
- vmBacktrace
1937
+ vmBacktrace,
1938
+ indexation
1941
1939
  };
1942
- };
1943
- var deserializeProviderCache = (cache2) => ({
1940
+ }, "serializeNodeInfo");
1941
+ var deserializeProviderCache = /* @__PURE__ */ __name((cache2) => ({
1944
1942
  consensusParametersTimestamp: cache2.consensusParametersTimestamp,
1945
1943
  chain: deserializeChain(cache2.chain),
1946
1944
  nodeInfo: deserializeNodeInfo(cache2.nodeInfo)
1947
- });
1948
- var serializeProviderCache = async (provider) => ({
1945
+ }), "deserializeProviderCache");
1946
+ var serializeProviderCache = /* @__PURE__ */ __name(async (provider) => ({
1949
1947
  consensusParametersTimestamp: provider.consensusParametersTimestamp,
1950
1948
  chain: serializeChain(await provider.getChain()),
1951
1949
  nodeInfo: serializeNodeInfo(await provider.getNode())
1952
- });
1953
- var hexOrZero = (hex) => hex || import_configs3.ZeroBytes32;
1954
- var deserializeReceipt = (receipt) => {
1950
+ }), "serializeProviderCache");
1951
+ var hexOrZero = /* @__PURE__ */ __name((hex) => hex || import_configs3.ZeroBytes32, "hexOrZero");
1952
+ var deserializeReceipt = /* @__PURE__ */ __name((receipt) => {
1955
1953
  const { receiptType } = receipt;
1956
1954
  switch (receiptType) {
1957
1955
  case "CALL" /* Call */: {
@@ -2143,12 +2141,12 @@ var deserializeReceipt = (receipt) => {
2143
2141
  default:
2144
2142
  throw new import_errors7.FuelError(import_errors7.ErrorCode.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
2145
2143
  }
2146
- };
2144
+ }, "deserializeReceipt");
2147
2145
 
2148
2146
  // src/providers/utils/receipts.ts
2149
- var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions4.ReceiptType.Revert && receipt.val.toString("hex") === import_configs4.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
2150
- var doesReceiptHaveMissingContractId = (receipt) => receipt.type === import_transactions4.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
2151
- var getReceiptsWithMissingData = (receipts) => receipts.reduce(
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(
2152
2150
  (memo, receipt) => {
2153
2151
  if (doesReceiptHaveMissingOutputVariables(receipt)) {
2154
2152
  memo.missingOutputVariables.push(receipt);
@@ -2162,7 +2160,7 @@ var getReceiptsWithMissingData = (receipts) => receipts.reduce(
2162
2160
  missingOutputVariables: [],
2163
2161
  missingOutputContractIds: []
2164
2162
  }
2165
- );
2163
+ ), "getReceiptsWithMissingData");
2166
2164
 
2167
2165
  // src/providers/utils/block-explorer.ts
2168
2166
  var import_errors8 = require("@fuel-ts/errors");
@@ -2171,13 +2169,13 @@ var import_errors8 = require("@fuel-ts/errors");
2171
2169
  var import_math6 = require("@fuel-ts/math");
2172
2170
  var import_transactions5 = require("@fuel-ts/transactions");
2173
2171
  var import_utils7 = require("@fuel-ts/utils");
2174
- var getGasUsedFromReceipts = (receipts) => {
2172
+ var getGasUsedFromReceipts = /* @__PURE__ */ __name((receipts) => {
2175
2173
  const scriptResult = receipts.filter(
2176
2174
  (receipt) => receipt.type === import_transactions5.ReceiptType.ScriptResult
2177
2175
  );
2178
2176
  const gasUsed = scriptResult.reduce((prev, receipt) => prev.add(receipt.gasUsed), (0, import_math6.bn)(0));
2179
2177
  return gasUsed;
2180
- };
2178
+ }, "getGasUsedFromReceipts");
2181
2179
  function resolveGasDependentCosts(byteSize, gasDependentCost) {
2182
2180
  const base = (0, import_math6.bn)(gasDependentCost.base);
2183
2181
  let dependentValue = (0, import_math6.bn)(0);
@@ -2188,6 +2186,7 @@ function resolveGasDependentCosts(byteSize, gasDependentCost) {
2188
2186
  }
2189
2187
  return base.add(dependentValue);
2190
2188
  }
2189
+ __name(resolveGasDependentCosts, "resolveGasDependentCosts");
2191
2190
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
2192
2191
  const witnessCache = [];
2193
2192
  const chargeableInputs = inputs.filter((input) => {
@@ -2214,6 +2213,7 @@ function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
2214
2213
  }, (0, import_math6.bn)(0));
2215
2214
  return totalGas;
2216
2215
  }
2216
+ __name(gasUsedByInputs, "gasUsedByInputs");
2217
2217
  function getMinGas(params) {
2218
2218
  const { gasCosts, gasPerByte, inputs, metadataGas, txBytesSize } = params;
2219
2219
  const vmInitGas = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
@@ -2222,6 +2222,7 @@ function getMinGas(params) {
2222
2222
  const minGas = vmInitGas.add(bytesGas).add(inputsGas).add(metadataGas).maxU64();
2223
2223
  return minGas;
2224
2224
  }
2225
+ __name(getMinGas, "getMinGas");
2225
2226
  function getMaxGas(params) {
2226
2227
  const {
2227
2228
  gasPerByte,
@@ -2238,6 +2239,7 @@ function getMaxGas(params) {
2238
2239
  const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
2239
2240
  return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
2240
2241
  }
2242
+ __name(getMaxGas, "getMaxGas");
2241
2243
  function calculateMetadataGasForTxCreate({
2242
2244
  gasCosts,
2243
2245
  stateRootSize,
@@ -2252,12 +2254,14 @@ function calculateMetadataGasForTxCreate({
2252
2254
  const metadataGas = contractRootGas.add(stateRootGas).add(txIdGas).add(contractIdGas);
2253
2255
  return metadataGas.maxU64();
2254
2256
  }
2257
+ __name(calculateMetadataGasForTxCreate, "calculateMetadataGasForTxCreate");
2255
2258
  function calculateMetadataGasForTxScript({
2256
2259
  gasCosts,
2257
2260
  txBytesSize
2258
2261
  }) {
2259
2262
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2260
2263
  }
2264
+ __name(calculateMetadataGasForTxScript, "calculateMetadataGasForTxScript");
2261
2265
  function calculateMetadataGasForTxBlob({
2262
2266
  gasCosts,
2263
2267
  txBytesSize,
@@ -2267,6 +2271,7 @@ function calculateMetadataGasForTxBlob({
2267
2271
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
2268
2272
  return txId.add(blobLen);
2269
2273
  }
2274
+ __name(calculateMetadataGasForTxBlob, "calculateMetadataGasForTxBlob");
2270
2275
  function calculateMetadataGasForTxUpgrade({
2271
2276
  gasCosts,
2272
2277
  txBytesSize,
@@ -2279,6 +2284,7 @@ function calculateMetadataGasForTxUpgrade({
2279
2284
  }
2280
2285
  return txId;
2281
2286
  }
2287
+ __name(calculateMetadataGasForTxUpgrade, "calculateMetadataGasForTxUpgrade");
2282
2288
  function calculateMetadataGasForTxUpload({
2283
2289
  gasCosts,
2284
2290
  txBytesSize,
@@ -2292,6 +2298,7 @@ function calculateMetadataGasForTxUpload({
2292
2298
  txId.add(subsectionsLen);
2293
2299
  return txId;
2294
2300
  }
2301
+ __name(calculateMetadataGasForTxUpload, "calculateMetadataGasForTxUpload");
2295
2302
  function calculateMinGasForTxUpload({
2296
2303
  gasCosts,
2297
2304
  baseMinGas,
@@ -2300,10 +2307,11 @@ function calculateMinGasForTxUpload({
2300
2307
  const additionalStoragePerByte = (0, import_math6.bn)(gasCosts.newStoragePerByte).mul(subsectionSize);
2301
2308
  return (0, import_math6.bn)(baseMinGas).add(additionalStoragePerByte);
2302
2309
  }
2303
- var calculateGasFee = (params) => {
2310
+ __name(calculateMinGasForTxUpload, "calculateMinGasForTxUpload");
2311
+ var calculateGasFee = /* @__PURE__ */ __name((params) => {
2304
2312
  const { gas, gasPrice, priceFactor, tip } = params;
2305
2313
  return gas.mul(gasPrice).div(priceFactor).add((0, import_math6.bn)(tip));
2306
- };
2314
+ }, "calculateGasFee");
2307
2315
 
2308
2316
  // src/providers/utils/json.ts
2309
2317
  var import_utils8 = require("@fuel-ts/utils");
@@ -2332,16 +2340,18 @@ function normalize(object) {
2332
2340
  });
2333
2341
  return object;
2334
2342
  }
2343
+ __name(normalize, "normalize");
2335
2344
  function normalizeJSON(root) {
2336
2345
  return normalize((0, import_ramda.clone)(root));
2337
2346
  }
2347
+ __name(normalizeJSON, "normalizeJSON");
2338
2348
 
2339
2349
  // src/providers/utils/extract-tx-error.ts
2340
2350
  var import_errors9 = require("@fuel-ts/errors");
2341
2351
  var import_math7 = require("@fuel-ts/math");
2342
2352
  var import_transactions6 = require("@fuel-ts/transactions");
2343
2353
  var import_configs5 = require("@fuel-ts/transactions/configs");
2344
- var assemblePanicError = (statusReason, metadata) => {
2354
+ var assemblePanicError = /* @__PURE__ */ __name((statusReason, metadata) => {
2345
2355
  let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
2346
2356
  if (import_configs5.PANIC_REASONS.includes(statusReason)) {
2347
2357
  errorMessage = `${errorMessage}
@@ -2354,9 +2364,9 @@ ${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
2354
2364
  ...metadata,
2355
2365
  reason: statusReason
2356
2366
  });
2357
- };
2358
- var stringify = (obj) => JSON.stringify(obj, null, 2);
2359
- 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) => {
2360
2370
  let errorMessage = "The transaction reverted with an unknown reason.";
2361
2371
  const revertReceipt = receipts.find(({ type }) => type === import_transactions6.ReceiptType.Revert);
2362
2372
  let reason = "";
@@ -2405,8 +2415,8 @@ var assembleRevertError = (receipts, logs, metadata) => {
2405
2415
  ...metadata,
2406
2416
  reason
2407
2417
  });
2408
- };
2409
- var extractTxError = (params) => {
2418
+ }, "assembleRevertError");
2419
+ var extractTxError = /* @__PURE__ */ __name((params) => {
2410
2420
  const { receipts, statusReason, logs } = params;
2411
2421
  const isPanic = receipts.some(({ type }) => type === import_transactions6.ReceiptType.Panic);
2412
2422
  const isRevert = receipts.some(({ type }) => type === import_transactions6.ReceiptType.Revert);
@@ -2421,7 +2431,7 @@ var extractTxError = (params) => {
2421
2431
  return assemblePanicError(statusReason, metadata);
2422
2432
  }
2423
2433
  return assembleRevertError(receipts, logs, metadata);
2424
- };
2434
+ }, "extractTxError");
2425
2435
 
2426
2436
  // src/providers/transaction-request/errors.ts
2427
2437
  var NoWitnessAtIndexError = class extends Error {
@@ -2430,6 +2440,9 @@ var NoWitnessAtIndexError = class extends Error {
2430
2440
  this.index = index;
2431
2441
  this.message = `Witness at index "${index}" was not found`;
2432
2442
  }
2443
+ static {
2444
+ __name(this, "NoWitnessAtIndexError");
2445
+ }
2433
2446
  name = "NoWitnessAtIndexError";
2434
2447
  };
2435
2448
 
@@ -2438,15 +2451,15 @@ var import_errors10 = require("@fuel-ts/errors");
2438
2451
  var import_math8 = require("@fuel-ts/math");
2439
2452
  var import_transactions7 = require("@fuel-ts/transactions");
2440
2453
  var import_utils9 = require("@fuel-ts/utils");
2441
- var isRequestInputCoin = (input) => input.type === import_transactions7.InputType.Coin;
2442
- var isRequestInputMessage = (input) => input.type === import_transactions7.InputType.Message;
2443
- var isRequestInputMessageWithoutData = (input) => input.type === import_transactions7.InputType.Message && (0, import_math8.bn)(input.data).isZero();
2444
- var isRequestInputCoinOrMessage = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
2445
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessageWithoutData(input);
2446
- var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
2447
- var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
2448
- var isPredicate = (input) => isRequestInputCoinOrMessage(input) && !!input.predicate && (0, import_utils9.hexlify)(input.predicate) !== "0x";
2449
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
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) => {
2450
2463
  if (isRequestInputCoin(input) && input.assetId === assetId) {
2451
2464
  return acc.add(input.amount);
2452
2465
  }
@@ -2454,8 +2467,8 @@ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filte
2454
2467
  return acc.add(input.amount);
2455
2468
  }
2456
2469
  return acc;
2457
- }, (0, import_math8.bn)(0));
2458
- var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2470
+ }, (0, import_math8.bn)(0)), "getAssetAmountInRequestInputs");
2471
+ var cacheRequestInputsResourcesFromOwner = /* @__PURE__ */ __name((inputs, owner) => inputs.reduce(
2459
2472
  (acc, input) => {
2460
2473
  if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
2461
2474
  acc.utxos.push(input.id);
@@ -2468,8 +2481,8 @@ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2468
2481
  utxos: [],
2469
2482
  messages: []
2470
2483
  }
2471
- );
2472
- var getBurnableAssetCount = (baseAssetId, transactionRequest) => {
2484
+ ), "cacheRequestInputsResourcesFromOwner");
2485
+ var getBurnableAssetCount = /* @__PURE__ */ __name((baseAssetId, transactionRequest) => {
2473
2486
  const { inputs, outputs } = transactionRequest;
2474
2487
  const coinInputs = new Set(inputs.filter(isRequestInputCoin).map((input) => input.assetId));
2475
2488
  if (inputs.some((i) => isRequestInputMessage(i) && (0, import_math8.bn)(i.amount).gt(0))) {
@@ -2480,8 +2493,8 @@ var getBurnableAssetCount = (baseAssetId, transactionRequest) => {
2480
2493
  );
2481
2494
  const difference = new Set([...coinInputs].filter((x) => !changeOutputs.has(x)));
2482
2495
  return difference.size;
2483
- };
2484
- var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAssetBurn = false) => {
2496
+ }, "getBurnableAssetCount");
2497
+ var validateTransactionForAssetBurn = /* @__PURE__ */ __name((baseAssetId, transactionRequest, enableAssetBurn = false) => {
2485
2498
  if (enableAssetBurn === true) {
2486
2499
  return;
2487
2500
  }
@@ -2494,20 +2507,23 @@ var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAs
2494
2507
  "Or enable asset burn, upon sending the transaction."
2495
2508
  ].join("\n");
2496
2509
  throw new import_errors10.FuelError(import_errors10.ErrorCode.ASSET_BURN_DETECTED, message);
2497
- };
2510
+ }, "validateTransactionForAssetBurn");
2498
2511
 
2499
2512
  // src/providers/transaction-request/witness.ts
2500
2513
  var import_utils10 = require("@fuel-ts/utils");
2501
- var witnessify = (value) => {
2514
+ var witnessify = /* @__PURE__ */ __name((value) => {
2502
2515
  const data = (0, import_utils10.arrayify)(value);
2503
2516
  return {
2504
2517
  data: (0, import_utils10.hexlify)(data),
2505
2518
  dataLength: data.length
2506
2519
  };
2507
- };
2520
+ }, "witnessify");
2508
2521
 
2509
2522
  // src/providers/transaction-request/transaction-request.ts
2510
- var BaseTransactionRequest = class {
2523
+ var BaseTransactionRequest = class _BaseTransactionRequest {
2524
+ static {
2525
+ __name(this, "BaseTransactionRequest");
2526
+ }
2511
2527
  /** Gas price for transaction */
2512
2528
  tip;
2513
2529
  /** Block until which tx cannot be included */
@@ -2590,7 +2606,7 @@ var BaseTransactionRequest = class {
2590
2606
  const inputs = this.inputs?.map(inputify) ?? [];
2591
2607
  const outputs = this.outputs?.map(outputify) ?? [];
2592
2608
  const witnesses = this.witnesses?.map(witnessify) ?? [];
2593
- const { policyTypes, policies } = BaseTransactionRequest.getPolicyMeta(this);
2609
+ const { policyTypes, policies } = _BaseTransactionRequest.getPolicyMeta(this);
2594
2610
  return {
2595
2611
  policyTypes,
2596
2612
  inputs,
@@ -2938,13 +2954,13 @@ var BaseTransactionRequest = class {
2938
2954
  * Please use `Account.generateFakeResources` along with `this.addResources` instead.
2939
2955
  */
2940
2956
  fundWithFakeUtxos(quantities, baseAssetId, resourcesOwner) {
2941
- const findAssetInput = (assetId) => this.inputs.find((input) => {
2957
+ const findAssetInput = /* @__PURE__ */ __name((assetId) => this.inputs.find((input) => {
2942
2958
  if ("assetId" in input) {
2943
2959
  return input.assetId === assetId;
2944
2960
  }
2945
2961
  return false;
2946
- });
2947
- const updateAssetInput = (assetId, quantity) => {
2962
+ }), "findAssetInput");
2963
+ const updateAssetInput = /* @__PURE__ */ __name((assetId, quantity) => {
2948
2964
  const assetInput = findAssetInput(assetId);
2949
2965
  let usedQuantity = quantity;
2950
2966
  if (assetId === baseAssetId) {
@@ -2965,7 +2981,7 @@ var BaseTransactionRequest = class {
2965
2981
  }
2966
2982
  ]);
2967
2983
  }
2968
- };
2984
+ }, "updateAssetInput");
2969
2985
  updateAssetInput(baseAssetId, (0, import_math9.bn)(1e11));
2970
2986
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2971
2987
  return this;
@@ -3053,6 +3069,7 @@ function hashTransaction(transactionRequest, chainId) {
3053
3069
  transaction.inputs = transaction.inputs.map((input) => {
3054
3070
  const inputClone = (0, import_ramda2.clone)(input);
3055
3071
  switch (inputClone.type) {
3072
+ // Zero out on signing: txPointer, predicateGasUsed
3056
3073
  case import_transactions9.InputType.Coin: {
3057
3074
  inputClone.txPointer = {
3058
3075
  blockHeight: 0,
@@ -3061,10 +3078,12 @@ function hashTransaction(transactionRequest, chainId) {
3061
3078
  inputClone.predicateGasUsed = (0, import_math10.bn)(0);
3062
3079
  return inputClone;
3063
3080
  }
3081
+ // Zero out on signing: predicateGasUsed
3064
3082
  case import_transactions9.InputType.Message: {
3065
3083
  inputClone.predicateGasUsed = (0, import_math10.bn)(0);
3066
3084
  return inputClone;
3067
3085
  }
3086
+ // Zero out on signing: txID, outputIndex, balanceRoot, stateRoot, and txPointer
3068
3087
  case import_transactions9.InputType.Contract: {
3069
3088
  inputClone.txPointer = {
3070
3089
  blockHeight: 0,
@@ -3083,15 +3102,18 @@ function hashTransaction(transactionRequest, chainId) {
3083
3102
  transaction.outputs = transaction.outputs.map((output) => {
3084
3103
  const outputClone = (0, import_ramda2.clone)(output);
3085
3104
  switch (outputClone.type) {
3105
+ // Zero out on signing: balanceRoot, stateRoot
3086
3106
  case import_transactions9.OutputType.Contract: {
3087
3107
  outputClone.balanceRoot = import_configs7.ZeroBytes32;
3088
3108
  outputClone.stateRoot = import_configs7.ZeroBytes32;
3089
3109
  return outputClone;
3090
3110
  }
3111
+ // Zero out on signing: amount
3091
3112
  case import_transactions9.OutputType.Change: {
3092
3113
  outputClone.amount = (0, import_math10.bn)(0);
3093
3114
  return outputClone;
3094
3115
  }
3116
+ // Zero out on signing: amount, to and assetId
3095
3117
  case import_transactions9.OutputType.Variable: {
3096
3118
  outputClone.to = import_configs7.ZeroBytes32;
3097
3119
  outputClone.amount = (0, import_math10.bn)(0);
@@ -3108,9 +3130,13 @@ function hashTransaction(transactionRequest, chainId) {
3108
3130
  const concatenatedData = (0, import_utils13.concat)([chainIdBytes, new import_transactions9.TransactionCoder().encode(transaction)]);
3109
3131
  return (0, import_hasher2.sha256)(concatenatedData);
3110
3132
  }
3133
+ __name(hashTransaction, "hashTransaction");
3111
3134
 
3112
3135
  // src/providers/transaction-request/blob-transaction-request.ts
3113
3136
  var BlobTransactionRequest = class extends BaseTransactionRequest {
3137
+ static {
3138
+ __name(this, "BlobTransactionRequest");
3139
+ }
3114
3140
  static from(obj) {
3115
3141
  return new this((0, import_ramda3.clone)(obj));
3116
3142
  }
@@ -3179,12 +3205,12 @@ var import_ramda4 = require("ramda");
3179
3205
 
3180
3206
  // src/providers/transaction-request/storage-slot.ts
3181
3207
  var import_utils15 = require("@fuel-ts/utils");
3182
- var getStorageValue = (value) => {
3208
+ var getStorageValue = /* @__PURE__ */ __name((value) => {
3183
3209
  const v = new Uint8Array(32);
3184
3210
  v.set((0, import_utils15.arrayify)(value));
3185
3211
  return v;
3186
- };
3187
- var storageSlotify = (storageSlot) => {
3212
+ }, "getStorageValue");
3213
+ var storageSlotify = /* @__PURE__ */ __name((storageSlot) => {
3188
3214
  let key;
3189
3215
  let value;
3190
3216
  if (Array.isArray(storageSlot)) {
@@ -3198,10 +3224,13 @@ var storageSlotify = (storageSlot) => {
3198
3224
  key: (0, import_utils15.hexlify)(key),
3199
3225
  value: (0, import_utils15.hexlify)(getStorageValue(value))
3200
3226
  };
3201
- };
3227
+ }, "storageSlotify");
3202
3228
 
3203
3229
  // src/providers/transaction-request/create-transaction-request.ts
3204
3230
  var CreateTransactionRequest = class extends BaseTransactionRequest {
3231
+ static {
3232
+ __name(this, "CreateTransactionRequest");
3233
+ }
3205
3234
  static from(obj) {
3206
3235
  return new this((0, import_ramda4.clone)(obj));
3207
3236
  }
@@ -3303,7 +3332,7 @@ var returnZeroScript = {
3303
3332
  */
3304
3333
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
3305
3334
  bytes: (0, import_utils17.arrayify)("0x24000000"),
3306
- encodeScriptData: () => new Uint8Array(0)
3335
+ encodeScriptData: /* @__PURE__ */ __name(() => new Uint8Array(0), "encodeScriptData")
3307
3336
  };
3308
3337
  var withdrawScript = {
3309
3338
  /*
@@ -3317,11 +3346,14 @@ var withdrawScript = {
3317
3346
  */
3318
3347
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
3319
3348
  bytes: (0, import_utils17.arrayify)("0x5040C0105D44C0064C40001124000000"),
3320
- encodeScriptData: () => new Uint8Array(0)
3349
+ encodeScriptData: /* @__PURE__ */ __name(() => new Uint8Array(0), "encodeScriptData")
3321
3350
  };
3322
3351
 
3323
3352
  // src/providers/transaction-request/script-transaction-request.ts
3324
3353
  var ScriptTransactionRequest = class extends BaseTransactionRequest {
3354
+ static {
3355
+ __name(this, "ScriptTransactionRequest");
3356
+ }
3325
3357
  static from(obj) {
3326
3358
  return new this((0, import_ramda5.clone)(obj));
3327
3359
  }
@@ -3519,9 +3551,12 @@ var import_hasher3 = require("@fuel-ts/hasher");
3519
3551
  var import_transactions12 = require("@fuel-ts/transactions");
3520
3552
  var import_utils19 = require("@fuel-ts/utils");
3521
3553
  var import_ramda6 = require("ramda");
3522
- var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3554
+ var UpgradeTransactionRequest = class _UpgradeTransactionRequest extends BaseTransactionRequest {
3555
+ static {
3556
+ __name(this, "UpgradeTransactionRequest");
3557
+ }
3523
3558
  static from(obj) {
3524
- if (obj instanceof UpgradeTransactionRequest) {
3559
+ if (obj instanceof _UpgradeTransactionRequest) {
3525
3560
  return obj;
3526
3561
  }
3527
3562
  return new this((0, import_ramda6.clone)(obj));
@@ -3669,9 +3704,12 @@ var import_configs10 = require("@fuel-ts/address/configs");
3669
3704
  var import_transactions13 = require("@fuel-ts/transactions");
3670
3705
  var import_utils21 = require("@fuel-ts/utils");
3671
3706
  var import_ramda7 = require("ramda");
3672
- var UploadTransactionRequest = class extends BaseTransactionRequest {
3707
+ var UploadTransactionRequest = class _UploadTransactionRequest extends BaseTransactionRequest {
3708
+ static {
3709
+ __name(this, "UploadTransactionRequest");
3710
+ }
3673
3711
  static from(obj) {
3674
- if (obj instanceof UploadTransactionRequest) {
3712
+ if (obj instanceof _UploadTransactionRequest) {
3675
3713
  return obj;
3676
3714
  }
3677
3715
  return new this((0, import_ramda7.clone)(obj));
@@ -3773,7 +3811,7 @@ var UploadTransactionRequest = class extends BaseTransactionRequest {
3773
3811
  // src/providers/transaction-request/utils.ts
3774
3812
  var import_errors14 = require("@fuel-ts/errors");
3775
3813
  var import_transactions14 = require("@fuel-ts/transactions");
3776
- var transactionRequestify = (obj) => {
3814
+ var transactionRequestify = /* @__PURE__ */ __name((obj) => {
3777
3815
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
3778
3816
  return obj;
3779
3817
  }
@@ -3801,13 +3839,16 @@ var transactionRequestify = (obj) => {
3801
3839
  );
3802
3840
  }
3803
3841
  }
3804
- };
3805
- var isTransactionTypeScript = (request) => request.type === import_transactions14.TransactionType.Script;
3806
- 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");
3807
3845
 
3808
3846
  // src/providers/resource-cache.ts
3809
3847
  var cache = /* @__PURE__ */ new Map();
3810
3848
  var ResourceCache = class {
3849
+ static {
3850
+ __name(this, "ResourceCache");
3851
+ }
3811
3852
  ttl;
3812
3853
  constructor(ttl) {
3813
3854
  this.ttl = ttl;
@@ -3911,7 +3952,7 @@ var import_utils25 = require("@fuel-ts/utils");
3911
3952
  var import_math13 = require("@fuel-ts/math");
3912
3953
  var import_transactions15 = require("@fuel-ts/transactions");
3913
3954
  var import_utils24 = require("@fuel-ts/utils");
3914
- var calculateTXFeeForSummary = (params) => {
3955
+ var calculateTXFeeForSummary = /* @__PURE__ */ __name((params) => {
3915
3956
  const {
3916
3957
  gasPrice,
3917
3958
  rawPayload,
@@ -3971,7 +4012,7 @@ var calculateTXFeeForSummary = (params) => {
3971
4012
  tip
3972
4013
  });
3973
4014
  return maxFee;
3974
- };
4015
+ }, "calculateTXFeeForSummary");
3975
4016
 
3976
4017
  // src/providers/transaction-summary/operations.ts
3977
4018
  var import_configs11 = require("@fuel-ts/address/configs");
@@ -3986,28 +4027,36 @@ var import_transactions16 = require("@fuel-ts/transactions");
3986
4027
  function getInputsByTypes(inputs, types) {
3987
4028
  return inputs.filter((i) => types.includes(i.type));
3988
4029
  }
4030
+ __name(getInputsByTypes, "getInputsByTypes");
3989
4031
  function getInputsByType(inputs, type) {
3990
4032
  return inputs.filter((i) => i.type === type);
3991
4033
  }
4034
+ __name(getInputsByType, "getInputsByType");
3992
4035
  function getInputsCoin(inputs) {
3993
4036
  return getInputsByType(inputs, import_transactions16.InputType.Coin);
3994
4037
  }
4038
+ __name(getInputsCoin, "getInputsCoin");
3995
4039
  function getInputsMessage(inputs) {
3996
4040
  return getInputsByType(inputs, import_transactions16.InputType.Message);
3997
4041
  }
4042
+ __name(getInputsMessage, "getInputsMessage");
3998
4043
  function getInputsCoinAndMessage(inputs) {
3999
4044
  return getInputsByTypes(inputs, [import_transactions16.InputType.Coin, import_transactions16.InputType.Message]);
4000
4045
  }
4046
+ __name(getInputsCoinAndMessage, "getInputsCoinAndMessage");
4001
4047
  function isInputCoin(input) {
4002
4048
  return input.type === import_transactions16.InputType.Coin;
4003
4049
  }
4050
+ __name(isInputCoin, "isInputCoin");
4004
4051
  function getInputsContract(inputs) {
4005
4052
  return getInputsByType(inputs, import_transactions16.InputType.Contract);
4006
4053
  }
4054
+ __name(getInputsContract, "getInputsContract");
4007
4055
  function findCoinInput(inputs, assetId) {
4008
4056
  const coinInputs = getInputsCoin(inputs);
4009
4057
  return coinInputs.find((i) => i.assetId === assetId);
4010
4058
  }
4059
+ __name(findCoinInput, "findCoinInput");
4011
4060
  function aggregateInputsAmountsByAssetAndOwner(inputs, baseAssetId) {
4012
4061
  const aggregated = /* @__PURE__ */ new Map();
4013
4062
  getInputsCoinAndMessage(inputs).forEach((input) => {
@@ -4027,9 +4076,11 @@ function aggregateInputsAmountsByAssetAndOwner(inputs, baseAssetId) {
4027
4076
  });
4028
4077
  return aggregated;
4029
4078
  }
4079
+ __name(aggregateInputsAmountsByAssetAndOwner, "aggregateInputsAmountsByAssetAndOwner");
4030
4080
  function findMessageInput(inputs) {
4031
4081
  return getInputsMessage(inputs)?.[0];
4032
4082
  }
4083
+ __name(findMessageInput, "findMessageInput");
4033
4084
  function getInputFromAssetId(inputs, assetId, isBaseAsset = false) {
4034
4085
  const coinInput = findCoinInput(inputs, assetId);
4035
4086
  if (coinInput) {
@@ -4040,6 +4091,7 @@ function getInputFromAssetId(inputs, assetId, isBaseAsset = false) {
4040
4091
  }
4041
4092
  return void 0;
4042
4093
  }
4094
+ __name(getInputFromAssetId, "getInputFromAssetId");
4043
4095
  function getInputContractFromIndex(inputs, inputIndex) {
4044
4096
  if (inputIndex == null) {
4045
4097
  return void 0;
@@ -4056,6 +4108,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
4056
4108
  }
4057
4109
  return contractInput;
4058
4110
  }
4111
+ __name(getInputContractFromIndex, "getInputContractFromIndex");
4059
4112
  function getInputAccountAddress(input) {
4060
4113
  if (input.type === import_transactions16.InputType.Coin) {
4061
4114
  return input.owner.toString();
@@ -4065,29 +4118,36 @@ function getInputAccountAddress(input) {
4065
4118
  }
4066
4119
  return "";
4067
4120
  }
4121
+ __name(getInputAccountAddress, "getInputAccountAddress");
4068
4122
 
4069
4123
  // src/providers/transaction-summary/output.ts
4070
4124
  var import_transactions17 = require("@fuel-ts/transactions");
4071
4125
  function getOutputsByType(outputs, type) {
4072
4126
  return outputs.filter((o) => o.type === type);
4073
4127
  }
4128
+ __name(getOutputsByType, "getOutputsByType");
4074
4129
  function getOutputsContractCreated(outputs) {
4075
4130
  return getOutputsByType(outputs, import_transactions17.OutputType.ContractCreated);
4076
4131
  }
4132
+ __name(getOutputsContractCreated, "getOutputsContractCreated");
4077
4133
  function getOutputsCoin(outputs) {
4078
4134
  return getOutputsByType(outputs, import_transactions17.OutputType.Coin);
4079
4135
  }
4136
+ __name(getOutputsCoin, "getOutputsCoin");
4080
4137
  function getOutputsChange(outputs) {
4081
4138
  return getOutputsByType(outputs, import_transactions17.OutputType.Change);
4082
4139
  }
4140
+ __name(getOutputsChange, "getOutputsChange");
4083
4141
  function getOutputsContract(outputs) {
4084
4142
  return getOutputsByType(outputs, import_transactions17.OutputType.Contract);
4085
4143
  }
4144
+ __name(getOutputsContract, "getOutputsContract");
4086
4145
 
4087
4146
  // src/providers/transaction-summary/operations.ts
4088
4147
  function getReceiptsByType(receipts, type) {
4089
4148
  return (receipts ?? []).filter((r) => r.type === type);
4090
4149
  }
4150
+ __name(getReceiptsByType, "getReceiptsByType");
4091
4151
  function getTransactionTypeName(transactionType) {
4092
4152
  switch (transactionType) {
4093
4153
  case import_transactions18.TransactionType.Mint:
@@ -4109,34 +4169,44 @@ function getTransactionTypeName(transactionType) {
4109
4169
  );
4110
4170
  }
4111
4171
  }
4172
+ __name(getTransactionTypeName, "getTransactionTypeName");
4112
4173
  function isType(transactionType, type) {
4113
4174
  const txType = getTransactionTypeName(transactionType);
4114
4175
  return txType === type;
4115
4176
  }
4177
+ __name(isType, "isType");
4116
4178
  function isTypeMint(transactionType) {
4117
4179
  return isType(transactionType, "Mint" /* Mint */);
4118
4180
  }
4181
+ __name(isTypeMint, "isTypeMint");
4119
4182
  function isTypeCreate(transactionType) {
4120
4183
  return isType(transactionType, "Create" /* Create */);
4121
4184
  }
4185
+ __name(isTypeCreate, "isTypeCreate");
4122
4186
  function isTypeScript(transactionType) {
4123
4187
  return isType(transactionType, "Script" /* Script */);
4124
4188
  }
4189
+ __name(isTypeScript, "isTypeScript");
4125
4190
  function isTypeUpgrade(transactionType) {
4126
4191
  return isType(transactionType, "Upgrade" /* Upgrade */);
4127
4192
  }
4193
+ __name(isTypeUpgrade, "isTypeUpgrade");
4128
4194
  function isTypeUpload(transactionType) {
4129
4195
  return isType(transactionType, "Upload" /* Upload */);
4130
4196
  }
4197
+ __name(isTypeUpload, "isTypeUpload");
4131
4198
  function isTypeBlob(transactionType) {
4132
4199
  return isType(transactionType, "Blob" /* Blob */);
4133
4200
  }
4201
+ __name(isTypeBlob, "isTypeBlob");
4134
4202
  function getReceiptsCall(receipts) {
4135
4203
  return getReceiptsByType(receipts, import_transactions18.ReceiptType.Call);
4136
4204
  }
4205
+ __name(getReceiptsCall, "getReceiptsCall");
4137
4206
  function getReceiptsMessageOut(receipts) {
4138
4207
  return getReceiptsByType(receipts, import_transactions18.ReceiptType.MessageOut);
4139
4208
  }
4209
+ __name(getReceiptsMessageOut, "getReceiptsMessageOut");
4140
4210
  function mergeAssets(op1, op2) {
4141
4211
  const assets1 = op1.assetsSent || [];
4142
4212
  const assets2 = op2.assetsSent || [];
@@ -4154,21 +4224,25 @@ function mergeAssets(op1, op2) {
4154
4224
  });
4155
4225
  return Array.from(assetMap.values());
4156
4226
  }
4227
+ __name(mergeAssets, "mergeAssets");
4157
4228
  function isSameOperation(a, b) {
4158
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;
4159
4230
  }
4231
+ __name(isSameOperation, "isSameOperation");
4160
4232
  function mergeAssetsSent(existing, toAdd) {
4161
4233
  if (!toAdd.assetsSent?.length) {
4162
4234
  return existing.assetsSent;
4163
4235
  }
4164
4236
  return existing.assetsSent?.length ? mergeAssets(existing, toAdd) : toAdd.assetsSent;
4165
4237
  }
4238
+ __name(mergeAssetsSent, "mergeAssetsSent");
4166
4239
  function mergeCalls(existing, toAdd) {
4167
4240
  if (!toAdd.calls?.length) {
4168
4241
  return existing.calls;
4169
4242
  }
4170
4243
  return [...existing.calls || [], ...toAdd.calls];
4171
4244
  }
4245
+ __name(mergeCalls, "mergeCalls");
4172
4246
  function mergeOperations(existing, toAdd) {
4173
4247
  return {
4174
4248
  ...existing,
@@ -4180,6 +4254,7 @@ function mergeOperations(existing, toAdd) {
4180
4254
  ]
4181
4255
  };
4182
4256
  }
4257
+ __name(mergeOperations, "mergeOperations");
4183
4258
  function addOperation(operations, toAdd) {
4184
4259
  const existingIndex = operations.findIndex((op) => isSameOperation(op, toAdd));
4185
4260
  if (existingIndex === -1) {
@@ -4187,6 +4262,7 @@ function addOperation(operations, toAdd) {
4187
4262
  }
4188
4263
  return operations.map((op, index) => index === existingIndex ? mergeOperations(op, toAdd) : op);
4189
4264
  }
4265
+ __name(addOperation, "addOperation");
4190
4266
  function getWithdrawFromFuelOperations({
4191
4267
  inputs,
4192
4268
  receipts,
@@ -4225,6 +4301,7 @@ function getWithdrawFromFuelOperations({
4225
4301
  );
4226
4302
  return withdrawFromFuelOperations;
4227
4303
  }
4304
+ __name(getWithdrawFromFuelOperations, "getWithdrawFromFuelOperations");
4228
4305
  function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInputs) {
4229
4306
  const abi = abiMap?.[contractInput.contractID];
4230
4307
  if (!abi) {
@@ -4232,6 +4309,7 @@ function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInpu
4232
4309
  }
4233
4310
  return [];
4234
4311
  }
4312
+ __name(getContractCalls, "getContractCalls");
4235
4313
  function getAssetsSent(receipt) {
4236
4314
  return receipt.amount?.isZero() ? void 0 : [
4237
4315
  {
@@ -4240,6 +4318,7 @@ function getAssetsSent(receipt) {
4240
4318
  }
4241
4319
  ];
4242
4320
  }
4321
+ __name(getAssetsSent, "getAssetsSent");
4243
4322
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
4244
4323
  const assetId = receipt.assetId === import_configs11.ZeroBytes32 ? baseAssetId : receipt.assetId;
4245
4324
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
@@ -4265,6 +4344,7 @@ function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload,
4265
4344
  }
4266
4345
  ];
4267
4346
  }
4347
+ __name(processCallReceipt, "processCallReceipt");
4268
4348
  function getContractCallOperations({
4269
4349
  inputs,
4270
4350
  outputs,
@@ -4294,6 +4374,7 @@ function getContractCallOperations({
4294
4374
  );
4295
4375
  });
4296
4376
  }
4377
+ __name(getContractCallOperations, "getContractCallOperations");
4297
4378
  function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs) {
4298
4379
  const { to: toAddress, assetId, amount } = receipt;
4299
4380
  let { id: fromAddress } = receipt;
@@ -4322,6 +4403,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
4322
4403
  receipts: [receipt]
4323
4404
  };
4324
4405
  }
4406
+ __name(extractTransferOperationFromReceipt, "extractTransferOperationFromReceipt");
4325
4407
  function getTransferOperations({
4326
4408
  inputs,
4327
4409
  outputs,
@@ -4376,6 +4458,7 @@ function getTransferOperations({
4376
4458
  });
4377
4459
  return operations;
4378
4460
  }
4461
+ __name(getTransferOperations, "getTransferOperations");
4379
4462
  function getPayProducerOperations(outputs) {
4380
4463
  const coinOutputs = getOutputsCoin(outputs);
4381
4464
  const payProducerOperations = coinOutputs.reduce((prev, output) => {
@@ -4400,6 +4483,7 @@ function getPayProducerOperations(outputs) {
4400
4483
  }, []);
4401
4484
  return payProducerOperations;
4402
4485
  }
4486
+ __name(getPayProducerOperations, "getPayProducerOperations");
4403
4487
  function getContractCreatedOperations({ inputs, outputs }) {
4404
4488
  const contractCreatedOutputs = getOutputsContractCreated(outputs);
4405
4489
  const input = getInputsCoinAndMessage(inputs)[0];
@@ -4420,6 +4504,7 @@ function getContractCreatedOperations({ inputs, outputs }) {
4420
4504
  }, []);
4421
4505
  return contractCreatedOperations;
4422
4506
  }
4507
+ __name(getContractCreatedOperations, "getContractCreatedOperations");
4423
4508
  function getOperations({
4424
4509
  transactionType,
4425
4510
  inputs,
@@ -4450,10 +4535,11 @@ function getOperations({
4450
4535
  }
4451
4536
  return [...getPayProducerOperations(outputs)];
4452
4537
  }
4538
+ __name(getOperations, "getOperations");
4453
4539
 
4454
4540
  // src/providers/transaction-summary/receipt.ts
4455
4541
  var import_transactions19 = require("@fuel-ts/transactions");
4456
- var extractMintedAssetsFromReceipts = (receipts) => {
4542
+ var extractMintedAssetsFromReceipts = /* @__PURE__ */ __name((receipts) => {
4457
4543
  const mintedAssets = [];
4458
4544
  receipts.forEach((receipt) => {
4459
4545
  if (receipt.type === import_transactions19.ReceiptType.Mint) {
@@ -4466,8 +4552,8 @@ var extractMintedAssetsFromReceipts = (receipts) => {
4466
4552
  }
4467
4553
  });
4468
4554
  return mintedAssets;
4469
- };
4470
- var extractBurnedAssetsFromReceipts = (receipts) => {
4555
+ }, "extractMintedAssetsFromReceipts");
4556
+ var extractBurnedAssetsFromReceipts = /* @__PURE__ */ __name((receipts) => {
4471
4557
  const burnedAssets = [];
4472
4558
  receipts.forEach((receipt) => {
4473
4559
  if (receipt.type === import_transactions19.ReceiptType.Burn) {
@@ -4480,12 +4566,12 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
4480
4566
  }
4481
4567
  });
4482
4568
  return burnedAssets;
4483
- };
4569
+ }, "extractBurnedAssetsFromReceipts");
4484
4570
 
4485
4571
  // src/providers/transaction-summary/status.ts
4486
4572
  var import_errors18 = require("@fuel-ts/errors");
4487
4573
  var import_math16 = require("@fuel-ts/math");
4488
- var getTransactionStatusName = (gqlStatus) => {
4574
+ var getTransactionStatusName = /* @__PURE__ */ __name((gqlStatus) => {
4489
4575
  switch (gqlStatus) {
4490
4576
  case "FailureStatus":
4491
4577
  return "failure" /* failure */;
@@ -4501,8 +4587,8 @@ var getTransactionStatusName = (gqlStatus) => {
4501
4587
  `Invalid transaction status: ${gqlStatus}.`
4502
4588
  );
4503
4589
  }
4504
- };
4505
- var processGraphqlStatus = (gqlTransactionStatus) => {
4590
+ }, "getTransactionStatusName");
4591
+ var processGraphqlStatus = /* @__PURE__ */ __name((gqlTransactionStatus) => {
4506
4592
  let time;
4507
4593
  let blockId;
4508
4594
  let status;
@@ -4546,8 +4632,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
4546
4632
  isStatusPending
4547
4633
  };
4548
4634
  return processedGraphqlStatus;
4549
- };
4550
- 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");
4551
4637
 
4552
4638
  // src/providers/transaction-summary/assemble-transaction-summary.ts
4553
4639
  function assembleTransactionSummary(params) {
@@ -4627,6 +4713,7 @@ function assembleTransactionSummary(params) {
4627
4713
  };
4628
4714
  return transactionSummary;
4629
4715
  }
4716
+ __name(assembleTransactionSummary, "assembleTransactionSummary");
4630
4717
 
4631
4718
  // src/providers/transaction-response/getDecodedLogs.ts
4632
4719
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
@@ -4654,6 +4741,7 @@ function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
4654
4741
  return logs;
4655
4742
  }, []);
4656
4743
  }
4744
+ __name(getDecodedLogs, "getDecodedLogs");
4657
4745
 
4658
4746
  // src/providers/transaction-response/transaction-response.ts
4659
4747
  function mapGqlOutputsToTxOutputs(outputs) {
@@ -4686,7 +4774,8 @@ function mapGqlOutputsToTxOutputs(outputs) {
4686
4774
  }
4687
4775
  });
4688
4776
  }
4689
- var TransactionResponse = class {
4777
+ __name(mapGqlOutputsToTxOutputs, "mapGqlOutputsToTxOutputs");
4778
+ var TransactionResponse = class _TransactionResponse {
4690
4779
  /**
4691
4780
  * Constructor for `TransactionResponse`.
4692
4781
  *
@@ -4701,6 +4790,9 @@ var TransactionResponse = class {
4701
4790
  this.request = typeof tx === "string" ? void 0 : tx;
4702
4791
  this.waitForResult = this.waitForResult.bind(this);
4703
4792
  }
4793
+ static {
4794
+ __name(this, "TransactionResponse");
4795
+ }
4704
4796
  /** Transaction ID */
4705
4797
  id;
4706
4798
  /** Current provider */
@@ -4722,7 +4814,7 @@ var TransactionResponse = class {
4722
4814
  */
4723
4815
  static async create(id, provider, abis) {
4724
4816
  const chainId = await provider.getChainId();
4725
- const response = new TransactionResponse(id, provider, chainId, abis);
4817
+ const response = new _TransactionResponse(id, provider, chainId, abis);
4726
4818
  await response.fetch();
4727
4819
  return response;
4728
4820
  }
@@ -4939,6 +5031,7 @@ function getWaitDelay(options, retryAttemptNum) {
4939
5031
  return 2 ** (retryAttemptNum - 1) * duration;
4940
5032
  }
4941
5033
  }
5034
+ __name(getWaitDelay, "getWaitDelay");
4942
5035
  function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4943
5036
  if (options === void 0) {
4944
5037
  return fetchFn;
@@ -4961,9 +5054,10 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4961
5054
  }
4962
5055
  };
4963
5056
  }
5057
+ __name(autoRetryFetch, "autoRetryFetch");
4964
5058
 
4965
5059
  // src/providers/utils/helpers.ts
4966
- var adjustResourcesToExclude = (params) => {
5060
+ var adjustResourcesToExclude = /* @__PURE__ */ __name((params) => {
4967
5061
  const { userInput, cached, maxInputs } = params;
4968
5062
  const final = { ...userInput };
4969
5063
  let total = final.utxos.length + final.messages.length;
@@ -4976,11 +5070,11 @@ var adjustResourcesToExclude = (params) => {
4976
5070
  final.messages = [...final.messages, ...cached.messages.slice(0, maxInputs - total)];
4977
5071
  }
4978
5072
  return final;
4979
- };
5073
+ }, "adjustResourcesToExclude");
4980
5074
 
4981
5075
  // src/providers/utils/validate-pagination-args.ts
4982
5076
  var import_errors20 = require("@fuel-ts/errors");
4983
- var validatePaginationArgs = (params) => {
5077
+ var validatePaginationArgs = /* @__PURE__ */ __name((params) => {
4984
5078
  const { paginationLimit, inputArgs = {} } = params;
4985
5079
  const { first, last, after, before } = inputArgs;
4986
5080
  if (after && before) {
@@ -5011,18 +5105,71 @@ var validatePaginationArgs = (params) => {
5011
5105
  inputArgs.first = paginationLimit;
5012
5106
  }
5013
5107
  return inputArgs;
5014
- };
5108
+ }, "validatePaginationArgs");
5015
5109
 
5016
5110
  // src/providers/provider.ts
5017
5111
  var MAX_RETRIES = 10;
5018
5112
  var RESOURCES_PAGE_SIZE_LIMIT = 512;
5019
5113
  var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
5020
5114
  var BALANCES_PAGE_SIZE_LIMIT = 100;
5115
+ var NON_PAGINATED_BALANCES_SIZE = 1e4;
5021
5116
  var BLOCKS_PAGE_SIZE_LIMIT = 5;
5022
5117
  var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
5023
5118
  var GAS_USED_MODIFIER = 1.2;
5024
- var _cacheInputs, cacheInputs_fn;
5025
- 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
+ }
5026
5173
  /**
5027
5174
  * Constructor to initialize a Provider.
5028
5175
  *
@@ -5031,31 +5178,6 @@ var _Provider = class {
5031
5178
  * @hidden
5032
5179
  */
5033
5180
  constructor(url, options = {}) {
5034
- /**
5035
- * @hidden
5036
- */
5037
- __privateAdd(this, _cacheInputs);
5038
- __publicField(this, "operations");
5039
- __publicField(this, "cache");
5040
- /** @hidden */
5041
- __publicField(this, "url");
5042
- /** @hidden */
5043
- __publicField(this, "urlWithoutAuth");
5044
- /** @hidden */
5045
- __publicField(this, "features", {
5046
- balancePagination: false,
5047
- amount128: false
5048
- });
5049
- /** @hidden */
5050
- __publicField(this, "consensusParametersTimestamp");
5051
- __publicField(this, "options", {
5052
- timeout: void 0,
5053
- resourceCacheTTL: void 0,
5054
- fetch: void 0,
5055
- retryOptions: void 0,
5056
- headers: void 0,
5057
- cache: void 0
5058
- });
5059
5181
  const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
5060
5182
  this.url = rawUrl;
5061
5183
  this.urlWithoutAuth = urlWithoutAuth;
@@ -5085,32 +5207,6 @@ var _Provider = class {
5085
5207
  this.cache = new ResourceCache(DEFAULT_RESOURCE_CACHE_TTL);
5086
5208
  }
5087
5209
  }
5088
- /** @hidden */
5089
- static clearChainAndNodeCaches() {
5090
- _Provider.inflightFetchChainAndNodeInfoRequests = {};
5091
- _Provider.nodeInfoCache = {};
5092
- _Provider.chainInfoCache = {};
5093
- }
5094
- /**
5095
- * @hidden
5096
- */
5097
- static getFetchFn(options) {
5098
- const { retryOptions, timeout, headers } = options;
5099
- return autoRetryFetch(async (...args) => {
5100
- const url = args[0];
5101
- const request = args[1];
5102
- const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
5103
- let fullRequest = {
5104
- ...request,
5105
- signal,
5106
- headers: { ...request?.headers, ...headers }
5107
- };
5108
- if (options.requestMiddleware) {
5109
- fullRequest = await options.requestMiddleware(fullRequest);
5110
- }
5111
- return options.fetch ? options.fetch(url, fullRequest, options) : fetch(url, fullRequest);
5112
- }, retryOptions);
5113
- }
5114
5210
  static extractBasicAuth(url) {
5115
5211
  let parsedUrl;
5116
5212
  try {
@@ -5134,8 +5230,7 @@ var _Provider = class {
5134
5230
  * Initialize Provider async stuff
5135
5231
  */
5136
5232
  async init() {
5137
- const { nodeInfo } = await this.fetchChainAndNodeInfo();
5138
- this.setupFeatures(nodeInfo.nodeVersion);
5233
+ await this.fetchChainAndNodeInfo();
5139
5234
  return this;
5140
5235
  }
5141
5236
  /**
@@ -5252,8 +5347,8 @@ var _Provider = class {
5252
5347
  createOperations() {
5253
5348
  const fetchFn = _Provider.getFetchFn(this.options);
5254
5349
  const gqlClient = new import_graphql_request.GraphQLClient(this.urlWithoutAuth, {
5255
- fetch: (input, requestInit) => fetchFn(input.toString(), requestInit || {}, this.options),
5256
- responseMiddleware: (response) => {
5350
+ fetch: /* @__PURE__ */ __name((input, requestInit) => fetchFn(input.toString(), requestInit || {}, this.options), "fetch"),
5351
+ responseMiddleware: /* @__PURE__ */ __name((response) => {
5257
5352
  if ("response" in response) {
5258
5353
  const graphQlResponse = response.response;
5259
5354
  assertGqlResponseHasNoErrors(
@@ -5261,22 +5356,22 @@ var _Provider = class {
5261
5356
  _Provider.incompatibleNodeVersionMessage
5262
5357
  );
5263
5358
  }
5264
- }
5359
+ }, "responseMiddleware")
5265
5360
  });
5266
- const executeQuery = (query, vars) => {
5361
+ const executeQuery = /* @__PURE__ */ __name((query, vars) => {
5267
5362
  const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
5268
5363
  const isSubscription = opDefinition?.operation === "subscription";
5269
5364
  if (isSubscription) {
5270
5365
  return FuelGraphqlSubscriber.create({
5271
5366
  url: this.urlWithoutAuth,
5272
5367
  query,
5273
- fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
5368
+ fetchFn: /* @__PURE__ */ __name((url, requestInit) => fetchFn(url, requestInit, this.options), "fetchFn"),
5274
5369
  variables: vars
5275
5370
  });
5276
5371
  }
5277
5372
  return gqlClient.request(query, vars);
5278
- };
5279
- const customOperations = (requester) => ({
5373
+ }, "executeQuery");
5374
+ const customOperations = /* @__PURE__ */ __name((requester) => ({
5280
5375
  getBlobs(variables) {
5281
5376
  const queryParams = variables.blobIds.map((_, i) => `$blobId${i}: BlobId!`).join(", ");
5282
5377
  const blobParams = variables.blobIds.map((_, i) => `blob${i}: blob(id: $blobId${i}) { id }`).join("\n");
@@ -5294,18 +5389,9 @@ var _Provider = class {
5294
5389
  `;
5295
5390
  return requester(document, updatedVariables);
5296
5391
  }
5297
- });
5392
+ }), "customOperations");
5298
5393
  return { ...getSdk(executeQuery), ...customOperations(executeQuery) };
5299
5394
  }
5300
- /**
5301
- * @hidden
5302
- */
5303
- setupFeatures(nodeVersion) {
5304
- if ((0, import_versions.gte)(nodeVersion, "0.41.0")) {
5305
- this.features.balancePagination = true;
5306
- this.features.amount128 = true;
5307
- }
5308
- }
5309
5395
  /**
5310
5396
  * Returns the version of the connected node.
5311
5397
  *
@@ -5382,6 +5468,13 @@ var _Provider = class {
5382
5468
  * @returns A promise that resolves to an object containing the asset details.
5383
5469
  */
5384
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
+ }
5385
5478
  const { assetDetails } = await this.operations.getAssetDetails({ assetId });
5386
5479
  const { contractId, subId, totalSupply } = assetDetails;
5387
5480
  return {
@@ -5390,6 +5483,15 @@ var _Provider = class {
5390
5483
  totalSupply: (0, import_math19.bn)(totalSupply)
5391
5484
  };
5392
5485
  }
5486
+ /**
5487
+ * @hidden
5488
+ */
5489
+ #cacheInputs(inputs, transactionId) {
5490
+ if (!this.cache) {
5491
+ return;
5492
+ }
5493
+ this.cache.set(transactionId, inputs);
5494
+ }
5393
5495
  /**
5394
5496
  * @hidden
5395
5497
  */
@@ -5439,7 +5541,10 @@ var _Provider = class {
5439
5541
  abis = transactionRequest.abis;
5440
5542
  }
5441
5543
  const subscription = await this.operations.submitAndAwaitStatus({ encodedTransaction });
5442
- __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
+ );
5443
5548
  const chainId = await this.getChainId();
5444
5549
  return new TransactionResponse(transactionRequest, this, chainId, abis, subscription);
5445
5550
  }
@@ -6191,18 +6296,9 @@ var _Provider = class {
6191
6296
  * @returns A promise that resolves to the balance.
6192
6297
  */
6193
6298
  async getBalance(owner, assetId) {
6194
- const ownerStr = new import_address4.Address(owner).toB256();
6195
- const assetIdStr = (0, import_utils30.hexlify)(assetId);
6196
- if (!this.features.amount128) {
6197
- const { balance: balance2 } = await this.operations.getBalance({
6198
- owner: ownerStr,
6199
- assetId: assetIdStr
6200
- });
6201
- return (0, import_math19.bn)(balance2.amount, 10);
6202
- }
6203
6299
  const { balance } = await this.operations.getBalanceV2({
6204
- owner: ownerStr,
6205
- assetId: assetIdStr
6300
+ owner: new import_address4.Address(owner).toB256(),
6301
+ assetId: (0, import_utils30.hexlify)(assetId)
6206
6302
  });
6207
6303
  return (0, import_math19.bn)(balance.amountU128, 10);
6208
6304
  }
@@ -6214,49 +6310,29 @@ var _Provider = class {
6214
6310
  * @returns A promise that resolves to the balances.
6215
6311
  */
6216
6312
  async getBalances(owner, paginationArgs) {
6217
- if (!this.features.balancePagination) {
6218
- 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
+ });
6219
6320
  }
6220
- return this.getBalancesV2(owner, paginationArgs);
6221
- }
6222
- /**
6223
- * @hidden
6224
- */
6225
- async getBalancesV1(owner, _paginationArgs) {
6226
- const {
6227
- balances: { edges }
6228
- } = await this.operations.getBalances({
6229
- /**
6230
- * The query parameters for this method were designed to support pagination,
6231
- * but the current Fuel-Core implementation does not support pagination yet.
6232
- */
6233
- first: 1e4,
6234
- filter: { owner: new import_address4.Address(owner).toB256() }
6235
- });
6236
- const balances = edges.map(({ node }) => ({
6237
- assetId: node.assetId,
6238
- amount: (0, import_math19.bn)(node.amount)
6239
- }));
6240
- return { balances };
6241
- }
6242
- /**
6243
- * @hidden
6244
- */
6245
- async getBalancesV2(owner, paginationArgs) {
6246
6321
  const {
6247
6322
  balances: { edges, pageInfo }
6248
6323
  } = await this.operations.getBalancesV2({
6249
- ...validatePaginationArgs({
6250
- inputArgs: paginationArgs,
6251
- paginationLimit: BALANCES_PAGE_SIZE_LIMIT
6252
- }),
6253
- filter: { owner: new import_address4.Address(owner).toB256() }
6324
+ ...args,
6325
+ filter: { owner: new import_address4.Address(owner).toB256() },
6326
+ supportsPagination
6254
6327
  });
6255
6328
  const balances = edges.map(({ node }) => ({
6256
6329
  assetId: node.assetId,
6257
6330
  amount: (0, import_math19.bn)(node.amountU128)
6258
6331
  }));
6259
- return { balances, pageInfo };
6332
+ return {
6333
+ balances,
6334
+ ...supportsPagination ? { pageInfo } : {}
6335
+ };
6260
6336
  }
6261
6337
  /**
6262
6338
  * Returns message for the given address.
@@ -6543,6 +6619,17 @@ var _Provider = class {
6543
6619
  statusReason: status.reason
6544
6620
  });
6545
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
+ }
6546
6633
  /**
6547
6634
  * @hidden
6548
6635
  */
@@ -6557,22 +6644,6 @@ var _Provider = class {
6557
6644
  return transactionRequest;
6558
6645
  }
6559
6646
  };
6560
- var Provider = _Provider;
6561
- _cacheInputs = new WeakSet();
6562
- cacheInputs_fn = function(inputs, transactionId) {
6563
- if (!this.cache) {
6564
- return;
6565
- }
6566
- this.cache.set(transactionId, inputs);
6567
- };
6568
- /** @hidden */
6569
- __publicField(Provider, "inflightFetchChainAndNodeInfoRequests", {});
6570
- /** @hidden */
6571
- __publicField(Provider, "chainInfoCache", {});
6572
- /** @hidden */
6573
- __publicField(Provider, "nodeInfoCache", {});
6574
- /** @hidden */
6575
- __publicField(Provider, "incompatibleNodeVersionMessage", "");
6576
6647
 
6577
6648
  // src/providers/transaction-summary/get-transaction-summary.ts
6578
6649
  var import_errors22 = require("@fuel-ts/errors");
@@ -6588,10 +6659,19 @@ var import_utils33 = require("@fuel-ts/utils");
6588
6659
  // src/test-utils/test-asset-id.ts
6589
6660
  var import_crypto4 = require("@fuel-ts/crypto");
6590
6661
  var import_utils34 = require("@fuel-ts/utils");
6591
- var _TestAssetId = class {
6662
+ var TestAssetId = class _TestAssetId {
6592
6663
  constructor(value) {
6593
6664
  this.value = value;
6594
6665
  }
6666
+ static {
6667
+ __name(this, "TestAssetId");
6668
+ }
6669
+ static A = new _TestAssetId(
6670
+ "0x0101010101010101010101010101010101010101010101010101010101010101"
6671
+ );
6672
+ static B = new _TestAssetId(
6673
+ "0x0202020202020202020202020202020202020202020202020202020202020202"
6674
+ );
6595
6675
  static random(count = 1) {
6596
6676
  const assetIds = [];
6597
6677
  for (let i = 0; i < count; i++) {
@@ -6600,13 +6680,6 @@ var _TestAssetId = class {
6600
6680
  return assetIds;
6601
6681
  }
6602
6682
  };
6603
- var TestAssetId = _TestAssetId;
6604
- __publicField(TestAssetId, "A", new _TestAssetId(
6605
- "0x0101010101010101010101010101010101010101010101010101010101010101"
6606
- ));
6607
- __publicField(TestAssetId, "B", new _TestAssetId(
6608
- "0x0202020202020202020202020202020202020202020202020202020202020202"
6609
- ));
6610
6683
 
6611
6684
  // src/test-utils/wallet-config.ts
6612
6685
  var import_crypto9 = require("@fuel-ts/crypto");
@@ -6629,7 +6702,7 @@ var import_utils36 = require("@fuel-ts/utils");
6629
6702
  var import_ramda9 = require("ramda");
6630
6703
 
6631
6704
  // src/providers/utils/merge-quantities.ts
6632
- var mergeQuantities = (...coinQuantities) => {
6705
+ var mergeQuantities = /* @__PURE__ */ __name((...coinQuantities) => {
6633
6706
  const resultMap = {};
6634
6707
  function addToMap({ amount, assetId }) {
6635
6708
  if (resultMap[assetId]) {
@@ -6638,12 +6711,16 @@ var mergeQuantities = (...coinQuantities) => {
6638
6711
  resultMap[assetId] = amount;
6639
6712
  }
6640
6713
  }
6714
+ __name(addToMap, "addToMap");
6641
6715
  coinQuantities.forEach((arr) => arr.forEach(addToMap));
6642
6716
  return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
6643
- };
6717
+ }, "mergeQuantities");
6644
6718
 
6645
6719
  // src/types.ts
6646
6720
  var AbstractAccount = class {
6721
+ static {
6722
+ __name(this, "AbstractAccount");
6723
+ }
6647
6724
  };
6648
6725
 
6649
6726
  // src/utils/formatTransferToContractScriptData.ts
@@ -6651,7 +6728,7 @@ var import_abi_coder6 = require("@fuel-ts/abi-coder");
6651
6728
  var import_address5 = require("@fuel-ts/address");
6652
6729
  var import_utils35 = require("@fuel-ts/utils");
6653
6730
  var asm = __toESM(require("@fuels/vm-asm"));
6654
- var formatTransferToContractScriptData = (transferParams) => {
6731
+ var formatTransferToContractScriptData = /* @__PURE__ */ __name((transferParams) => {
6655
6732
  const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
6656
6733
  return transferParams.reduce((acc, transferParam) => {
6657
6734
  const { assetId, amount, contractId } = transferParam;
@@ -6659,8 +6736,8 @@ var formatTransferToContractScriptData = (transferParams) => {
6659
6736
  const scriptData = (0, import_utils35.concat)([new import_address5.Address(contractId).toBytes(), encoded, (0, import_utils35.arrayify)(assetId)]);
6660
6737
  return (0, import_utils35.concat)([acc, scriptData]);
6661
6738
  }, new Uint8Array());
6662
- };
6663
- var assembleTransferToContractScript = async (transferParams) => {
6739
+ }, "formatTransferToContractScriptData");
6740
+ var assembleTransferToContractScript = /* @__PURE__ */ __name(async (transferParams) => {
6664
6741
  const scriptData = formatTransferToContractScriptData(transferParams);
6665
6742
  await asm.initWasm();
6666
6743
  let script = new Uint8Array();
@@ -6684,11 +6761,14 @@ var assembleTransferToContractScript = async (transferParams) => {
6684
6761
  });
6685
6762
  script = (0, import_utils35.concat)([script, asm.ret(1).to_bytes()]);
6686
6763
  return { script, scriptData };
6687
- };
6764
+ }, "assembleTransferToContractScript");
6688
6765
 
6689
6766
  // src/account.ts
6690
6767
  var MAX_FUNDING_ATTEMPTS = 5;
6691
6768
  var Account = class extends AbstractAccount {
6769
+ static {
6770
+ __name(this, "Account");
6771
+ }
6692
6772
  /**
6693
6773
  * The address associated with the account.
6694
6774
  */
@@ -7072,7 +7152,7 @@ var Account = class extends AbstractAccount {
7072
7152
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
7073
7153
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
7074
7154
  const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: (0, import_math22.bn)("100000000000000000") }];
7075
- const findAssetInput = (assetId) => txRequestClone.inputs.find((input) => {
7155
+ const findAssetInput = /* @__PURE__ */ __name((assetId) => txRequestClone.inputs.find((input) => {
7076
7156
  if (input.type === import_transactions26.InputType.Coin) {
7077
7157
  return input.assetId === assetId;
7078
7158
  }
@@ -7080,8 +7160,8 @@ var Account = class extends AbstractAccount {
7080
7160
  return baseAssetId === assetId;
7081
7161
  }
7082
7162
  return false;
7083
- });
7084
- const updateAssetInput = (assetId, quantity) => {
7163
+ }), "findAssetInput");
7164
+ const updateAssetInput = /* @__PURE__ */ __name((assetId, quantity) => {
7085
7165
  const assetInput = findAssetInput(assetId);
7086
7166
  const usedQuantity = quantity;
7087
7167
  if (assetInput && "amount" in assetInput) {
@@ -7096,7 +7176,7 @@ var Account = class extends AbstractAccount {
7096
7176
  ])
7097
7177
  );
7098
7178
  }
7099
- };
7179
+ }, "updateAssetInput");
7100
7180
  mergeQuantities(requiredQuantities, transactionFeeForDryRun).forEach(
7101
7181
  ({ amount, assetId }) => updateAssetInput(assetId, amount)
7102
7182
  );
@@ -7285,12 +7365,12 @@ var DEFAULT_KDF_PARAMS_R = 8;
7285
7365
  var DEFAULT_KDF_PARAMS_P = 1;
7286
7366
  var DEFAULT_KEY_SIZE = 32;
7287
7367
  var DEFAULT_IV_SIZE = 16;
7288
- var removeHexPrefix = (hexString) => {
7368
+ var removeHexPrefix = /* @__PURE__ */ __name((hexString) => {
7289
7369
  if (/^0x/.test(hexString)) {
7290
7370
  return hexString.slice(2);
7291
7371
  }
7292
7372
  return hexString;
7293
- };
7373
+ }, "removeHexPrefix");
7294
7374
  async function encryptKeystoreWallet(privateKey, address, password) {
7295
7375
  const privateKeyBuffer = (0, import_crypto6.bufferFromString)(removeHexPrefix(privateKey), "hex");
7296
7376
  const ownerAddress = new import_address7.Address(address);
@@ -7329,6 +7409,7 @@ async function encryptKeystoreWallet(privateKey, address, password) {
7329
7409
  };
7330
7410
  return JSON.stringify(keystore);
7331
7411
  }
7412
+ __name(encryptKeystoreWallet, "encryptKeystoreWallet");
7332
7413
  async function decryptKeystoreWallet(jsonWallet, password) {
7333
7414
  const keystoreWallet = JSON.parse(jsonWallet);
7334
7415
  const {
@@ -7364,9 +7445,17 @@ async function decryptKeystoreWallet(jsonWallet, password) {
7364
7445
  const privateKey = (0, import_utils37.hexlify)(buffer);
7365
7446
  return privateKey;
7366
7447
  }
7448
+ __name(decryptKeystoreWallet, "decryptKeystoreWallet");
7367
7449
 
7368
7450
  // src/wallet/base-wallet-unlocked.ts
7369
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";
7370
7459
  /**
7371
7460
  * A function that returns the wallet's signer.
7372
7461
  */
@@ -7484,10 +7573,6 @@ var BaseWalletUnlocked = class extends Account {
7484
7573
  return encryptKeystoreWallet(this.privateKey, this.address, password);
7485
7574
  }
7486
7575
  };
7487
- /**
7488
- * Default HDWallet path.
7489
- */
7490
- __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
7491
7576
 
7492
7577
  // src/hdwallet/hdwallet.ts
7493
7578
  var import_crypto8 = require("@fuel-ts/crypto");
@@ -9561,21 +9646,25 @@ var import_utils39 = require("@fuel-ts/utils");
9561
9646
  function getLowerMask(bits) {
9562
9647
  return (1 << bits) - 1;
9563
9648
  }
9649
+ __name(getLowerMask, "getLowerMask");
9564
9650
  function getUpperMask(bits) {
9565
9651
  return (1 << bits) - 1 << 8 - bits;
9566
9652
  }
9653
+ __name(getUpperMask, "getUpperMask");
9567
9654
  function getWords(mnemonic) {
9568
9655
  if (!Array.isArray(mnemonic)) {
9569
9656
  return mnemonic.split(/\s+/);
9570
9657
  }
9571
9658
  return mnemonic;
9572
9659
  }
9660
+ __name(getWords, "getWords");
9573
9661
  function getPhrase(mnemonic) {
9574
9662
  if (Array.isArray(mnemonic)) {
9575
9663
  return mnemonic.join(" ");
9576
9664
  }
9577
9665
  return mnemonic;
9578
9666
  }
9667
+ __name(getPhrase, "getPhrase");
9579
9668
  function entropyToMnemonicIndices(entropy) {
9580
9669
  const indices = [0];
9581
9670
  let remainingBits = 11;
@@ -9597,6 +9686,7 @@ function entropyToMnemonicIndices(entropy) {
9597
9686
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
9598
9687
  return indices;
9599
9688
  }
9689
+ __name(entropyToMnemonicIndices, "entropyToMnemonicIndices");
9600
9690
  function mnemonicWordsToEntropy(words, wordlist) {
9601
9691
  const size = Math.ceil(11 * words.length / 8);
9602
9692
  const entropy = (0, import_utils39.arrayify)(new Uint8Array(size));
@@ -9628,6 +9718,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
9628
9718
  }
9629
9719
  return entropy.slice(0, entropyBits / 8);
9630
9720
  }
9721
+ __name(mnemonicWordsToEntropy, "mnemonicWordsToEntropy");
9631
9722
 
9632
9723
  // src/mnemonic/mnemonic.ts
9633
9724
  var MasterSecret = (0, import_utils40.toUtf8Bytes)("Bitcoin seed");
@@ -9642,6 +9733,7 @@ function assertWordList(wordlist) {
9642
9733
  );
9643
9734
  }
9644
9735
  }
9736
+ __name(assertWordList, "assertWordList");
9645
9737
  function assertEntropy(entropy) {
9646
9738
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
9647
9739
  throw new import_errors26.FuelError(
@@ -9650,6 +9742,7 @@ function assertEntropy(entropy) {
9650
9742
  );
9651
9743
  }
9652
9744
  }
9745
+ __name(assertEntropy, "assertEntropy");
9653
9746
  function assertMnemonic(words) {
9654
9747
  if (!MNEMONIC_SIZES.includes(words.length)) {
9655
9748
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
@@ -9658,7 +9751,11 @@ function assertMnemonic(words) {
9658
9751
  throw new import_errors26.FuelError(import_errors26.ErrorCode.INVALID_MNEMONIC, errorMsg);
9659
9752
  }
9660
9753
  }
9661
- var Mnemonic = class {
9754
+ __name(assertMnemonic, "assertMnemonic");
9755
+ var Mnemonic = class _Mnemonic {
9756
+ static {
9757
+ __name(this, "Mnemonic");
9758
+ }
9662
9759
  wordlist;
9663
9760
  /**
9664
9761
  *
@@ -9675,7 +9772,7 @@ var Mnemonic = class {
9675
9772
  * @returns Entropy hash
9676
9773
  */
9677
9774
  mnemonicToEntropy(phrase) {
9678
- return Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
9775
+ return _Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
9679
9776
  }
9680
9777
  /**
9681
9778
  *
@@ -9683,7 +9780,7 @@ var Mnemonic = class {
9683
9780
  * @returns Mnemonic phrase
9684
9781
  */
9685
9782
  entropyToMnemonic(entropy) {
9686
- return Mnemonic.entropyToMnemonic(entropy, this.wordlist);
9783
+ return _Mnemonic.entropyToMnemonic(entropy, this.wordlist);
9687
9784
  }
9688
9785
  /**
9689
9786
  *
@@ -9724,8 +9821,8 @@ var Mnemonic = class {
9724
9821
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
9725
9822
  */
9726
9823
  static mnemonicToMasterKeys(phrase, passphrase = "") {
9727
- const seed = Mnemonic.mnemonicToSeed(phrase, passphrase);
9728
- return Mnemonic.masterKeysFromSeed(seed);
9824
+ const seed = _Mnemonic.mnemonicToSeed(phrase, passphrase);
9825
+ return _Mnemonic.masterKeysFromSeed(seed);
9729
9826
  }
9730
9827
  /**
9731
9828
  * Validates if given mnemonic is valid
@@ -9741,7 +9838,7 @@ var Mnemonic = class {
9741
9838
  return false;
9742
9839
  }
9743
9840
  while (i < words.length) {
9744
- if (Mnemonic.binarySearch(words[i]) === false) {
9841
+ if (_Mnemonic.binarySearch(words[i]) === false) {
9745
9842
  return false;
9746
9843
  }
9747
9844
  i += 1;
@@ -9788,7 +9885,7 @@ var Mnemonic = class {
9788
9885
  * @returns BIP-32 extended private key
9789
9886
  */
9790
9887
  static seedToExtendedKey(seed, testnet = false) {
9791
- const masterKey = Mnemonic.masterKeysFromSeed(seed);
9888
+ const masterKey = _Mnemonic.masterKeysFromSeed(seed);
9792
9889
  const prefix = (0, import_utils40.arrayify)(testnet ? TestnetPRV : MainnetPRV);
9793
9890
  const depth = "0x00";
9794
9891
  const fingerprint = "0x00000000";
@@ -9820,7 +9917,7 @@ var Mnemonic = class {
9820
9917
  */
9821
9918
  static generate(size = 32, extraEntropy = "") {
9822
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);
9823
- return Mnemonic.entropyToMnemonic(entropy);
9920
+ return _Mnemonic.entropyToMnemonic(entropy);
9824
9921
  }
9825
9922
  };
9826
9923
  var mnemonic_default = Mnemonic;
@@ -9834,20 +9931,24 @@ var TestnetPUB = (0, import_utils42.hexlify)("0x043587cf");
9834
9931
  function base58check(data) {
9835
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)]));
9836
9933
  }
9934
+ __name(base58check, "base58check");
9837
9935
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9838
9936
  if (isPublic) {
9839
9937
  return testnet ? TestnetPUB : MainnetPUB;
9840
9938
  }
9841
9939
  return testnet ? TestnetPRV2 : MainnetPRV2;
9842
9940
  }
9941
+ __name(getExtendedKeyPrefix, "getExtendedKeyPrefix");
9843
9942
  function isPublicExtendedKey(extendedKey) {
9844
9943
  return [MainnetPUB, TestnetPUB].includes((0, import_utils42.hexlify)(extendedKey.slice(0, 4)));
9845
9944
  }
9945
+ __name(isPublicExtendedKey, "isPublicExtendedKey");
9846
9946
  function isValidExtendedKey(extendedKey) {
9847
9947
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9848
9948
  (0, import_utils42.hexlify)(extendedKey.slice(0, 4))
9849
9949
  );
9850
9950
  }
9951
+ __name(isValidExtendedKey, "isValidExtendedKey");
9851
9952
  function parsePath(path2, depth = 0) {
9852
9953
  const components = path2.split("/");
9853
9954
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
@@ -9860,7 +9961,11 @@ function parsePath(path2, depth = 0) {
9860
9961
  (p) => ~p.indexOf(`'`) ? parseInt(p, 10) + HARDENED_INDEX : parseInt(p, 10)
9861
9962
  );
9862
9963
  }
9863
- var HDWallet = class {
9964
+ __name(parsePath, "parsePath");
9965
+ var HDWallet = class _HDWallet {
9966
+ static {
9967
+ __name(this, "HDWallet");
9968
+ }
9864
9969
  depth = 0;
9865
9970
  index = 0;
9866
9971
  fingerprint = (0, import_utils42.hexlify)("0x00000000");
@@ -9926,7 +10031,7 @@ var HDWallet = class {
9926
10031
  if (privateKey) {
9927
10032
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
9928
10033
  const ki = (0, import_math23.bn)(IL).add(privateKey).mod(N).toBytes(32);
9929
- return new HDWallet({
10034
+ return new _HDWallet({
9930
10035
  privateKey: ki,
9931
10036
  chainCode: IR,
9932
10037
  index,
@@ -9936,7 +10041,7 @@ var HDWallet = class {
9936
10041
  }
9937
10042
  const signer = new Signer((0, import_utils42.hexlify)(IL));
9938
10043
  const Ki = signer.addPoint(publicKey);
9939
- return new HDWallet({
10044
+ return new _HDWallet({
9940
10045
  publicKey: Ki,
9941
10046
  chainCode: IR,
9942
10047
  index,
@@ -9985,7 +10090,7 @@ var HDWallet = class {
9985
10090
  */
9986
10091
  static fromSeed(seed) {
9987
10092
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
9988
- return new HDWallet({
10093
+ return new _HDWallet({
9989
10094
  chainCode: (0, import_utils42.arrayify)(masterKey.slice(32)),
9990
10095
  privateKey: (0, import_utils42.arrayify)(masterKey.slice(0, 32))
9991
10096
  });
@@ -10015,7 +10120,7 @@ var HDWallet = class {
10015
10120
  if (key[0] !== 3) {
10016
10121
  throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
10017
10122
  }
10018
- return new HDWallet({
10123
+ return new _HDWallet({
10019
10124
  publicKey: key,
10020
10125
  chainCode,
10021
10126
  index,
@@ -10026,7 +10131,7 @@ var HDWallet = class {
10026
10131
  if (key[0] !== 0) {
10027
10132
  throw new import_errors27.FuelError(import_errors27.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
10028
10133
  }
10029
- return new HDWallet({
10134
+ return new _HDWallet({
10030
10135
  privateKey: key.slice(1),
10031
10136
  chainCode,
10032
10137
  index,
@@ -10039,6 +10144,9 @@ var hdwallet_default = HDWallet;
10039
10144
 
10040
10145
  // src/wallet/wallets.ts
10041
10146
  var WalletLocked = class extends Account {
10147
+ static {
10148
+ __name(this, "WalletLocked");
10149
+ }
10042
10150
  /**
10043
10151
  * Unlocks the wallet using the provided private key and returns an instance of WalletUnlocked.
10044
10152
  *
@@ -10049,7 +10157,10 @@ var WalletLocked = class extends Account {
10049
10157
  return new WalletUnlocked(privateKey, this._provider);
10050
10158
  }
10051
10159
  };
10052
- var WalletUnlocked = class extends BaseWalletUnlocked {
10160
+ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
10161
+ static {
10162
+ __name(this, "WalletUnlocked");
10163
+ }
10053
10164
  /**
10054
10165
  * Locks the wallet and returns an instance of WalletLocked.
10055
10166
  *
@@ -10067,7 +10178,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10067
10178
  */
10068
10179
  static generate(generateOptions) {
10069
10180
  const privateKey = Signer.generatePrivateKey(generateOptions?.entropy);
10070
- return new WalletUnlocked(privateKey, generateOptions?.provider);
10181
+ return new _WalletUnlocked(privateKey, generateOptions?.provider);
10071
10182
  }
10072
10183
  /**
10073
10184
  * Create a Wallet Unlocked from a seed.
@@ -10079,8 +10190,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10079
10190
  */
10080
10191
  static fromSeed(seed, path2, provider) {
10081
10192
  const hdWallet = hdwallet_default.fromSeed(seed);
10082
- const childWallet = hdWallet.derivePath(path2 || WalletUnlocked.defaultPath);
10083
- return new WalletUnlocked(childWallet.privateKey, provider);
10193
+ const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
10194
+ return new _WalletUnlocked(childWallet.privateKey, provider);
10084
10195
  }
10085
10196
  /**
10086
10197
  * Create a Wallet Unlocked from a mnemonic phrase.
@@ -10094,8 +10205,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10094
10205
  static fromMnemonic(mnemonic, path2, passphrase, provider) {
10095
10206
  const seed = mnemonic_default.mnemonicToSeed(mnemonic, passphrase);
10096
10207
  const hdWallet = hdwallet_default.fromSeed(seed);
10097
- const childWallet = hdWallet.derivePath(path2 || WalletUnlocked.defaultPath);
10098
- return new WalletUnlocked(childWallet.privateKey, provider);
10208
+ const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
10209
+ return new _WalletUnlocked(childWallet.privateKey, provider);
10099
10210
  }
10100
10211
  /**
10101
10212
  * Create a Wallet Unlocked from an extended key.
@@ -10106,7 +10217,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10106
10217
  */
10107
10218
  static fromExtendedKey(extendedKey, provider) {
10108
10219
  const hdWallet = hdwallet_default.fromExtendedKey(extendedKey);
10109
- return new WalletUnlocked(hdWallet.privateKey, provider);
10220
+ return new _WalletUnlocked(hdWallet.privateKey, provider);
10110
10221
  }
10111
10222
  /**
10112
10223
  * Create a Wallet Unlocked from an encrypted JSON.
@@ -10118,12 +10229,15 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10118
10229
  */
10119
10230
  static async fromEncryptedJson(jsonWallet, password, provider) {
10120
10231
  const privateKey = await decryptKeystoreWallet(jsonWallet, password);
10121
- return new WalletUnlocked(privateKey, provider);
10232
+ return new _WalletUnlocked(privateKey, provider);
10122
10233
  }
10123
10234
  };
10124
10235
 
10125
10236
  // src/wallet/wallet.ts
10126
10237
  var Wallet = class {
10238
+ static {
10239
+ __name(this, "Wallet");
10240
+ }
10127
10241
  /**
10128
10242
  * Creates a locked wallet instance from an address and a provider.
10129
10243
  *
@@ -10144,71 +10258,74 @@ var Wallet = class {
10144
10258
  static fromPrivateKey(privateKey, provider) {
10145
10259
  return new WalletUnlocked(privateKey, provider);
10146
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;
10147
10304
  };
10148
- /**
10149
- * Generate a new Wallet Unlocked with a random key pair.
10150
- *
10151
- * @param generateOptions - Options to customize the generation process (optional).
10152
- * @returns An unlocked wallet instance.
10153
- */
10154
- __publicField(Wallet, "generate", WalletUnlocked.generate);
10155
- /**
10156
- * Create a Wallet Unlocked from a seed.
10157
- *
10158
- * @param seed - The seed phrase.
10159
- * @param provider - A Provider instance (optional).
10160
- * @param path - The derivation path (optional).
10161
- * @returns An unlocked wallet instance.
10162
- */
10163
- __publicField(Wallet, "fromSeed", WalletUnlocked.fromSeed);
10164
- /**
10165
- * Create a Wallet Unlocked from a mnemonic phrase.
10166
- *
10167
- * @param mnemonic - The mnemonic phrase.
10168
- * @param provider - A Provider instance (optional).
10169
- * @param path - The derivation path (optional).
10170
- * @param passphrase - The passphrase for the mnemonic (optional).
10171
- * @returns An unlocked wallet instance.
10172
- */
10173
- __publicField(Wallet, "fromMnemonic", WalletUnlocked.fromMnemonic);
10174
- /**
10175
- * Create a Wallet Unlocked from an extended key.
10176
- *
10177
- * @param extendedKey - The extended key.
10178
- * @param provider - A Provider instance (optional).
10179
- * @returns An unlocked wallet instance.
10180
- */
10181
- __publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
10182
- /**
10183
- * Create a Wallet Unlocked from an encrypted JSON.
10184
- *
10185
- * @param jsonWallet - The encrypted JSON keystore.
10186
- * @param password - The password to decrypt the JSON.
10187
- * @param provider - A Provider instance (optional).
10188
- * @returns An unlocked wallet instance.
10189
- */
10190
- __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
10191
10305
 
10192
10306
  // src/test-utils/wallet-config.ts
10193
- var WalletsConfig = class {
10307
+ var WalletsConfig = class _WalletsConfig {
10308
+ static {
10309
+ __name(this, "WalletsConfig");
10310
+ }
10194
10311
  initialState;
10195
10312
  options;
10196
10313
  wallets;
10197
- generateWallets = () => {
10314
+ generateWallets = /* @__PURE__ */ __name(() => {
10198
10315
  const generatedWallets = [];
10199
10316
  for (let index = 1; index <= this.options.count; index++) {
10200
10317
  generatedWallets.push(new WalletUnlocked((0, import_crypto9.randomBytes)(32)));
10201
10318
  }
10202
10319
  return generatedWallets;
10203
- };
10320
+ }, "generateWallets");
10204
10321
  constructor(baseAssetId, config) {
10205
- WalletsConfig.validate(config);
10322
+ _WalletsConfig.validate(config);
10206
10323
  this.options = config;
10207
10324
  const { assets, coinsPerAsset, amountPerCoin, messages } = this.options;
10208
10325
  this.wallets = this.generateWallets();
10209
10326
  this.initialState = {
10210
- messages: WalletsConfig.createMessages(this.wallets, messages),
10211
- coins: WalletsConfig.createCoins(
10327
+ messages: _WalletsConfig.createMessages(this.wallets, messages),
10328
+ coins: _WalletsConfig.createCoins(
10212
10329
  this.wallets,
10213
10330
  baseAssetId,
10214
10331
  assets,
@@ -10330,9 +10447,9 @@ async function setupTestProviderAndWallets({
10330
10447
  if (launchNodeServerPort) {
10331
10448
  const serverUrl = `http://localhost:${launchNodeServerPort}`;
10332
10449
  url = await (await fetch(serverUrl, { method: "POST", body: JSON.stringify(launchNodeOptions) })).text();
10333
- cleanup = () => {
10450
+ cleanup = /* @__PURE__ */ __name(() => {
10334
10451
  fetch(`${serverUrl}/cleanup/${url}`);
10335
- };
10452
+ }, "cleanup");
10336
10453
  } else {
10337
10454
  const settings = await launchNode(launchNodeOptions);
10338
10455
  url = settings.url;
@@ -10357,6 +10474,7 @@ async function setupTestProviderAndWallets({
10357
10474
  [Symbol.dispose]: cleanup
10358
10475
  };
10359
10476
  }
10477
+ __name(setupTestProviderAndWallets, "setupTestProviderAndWallets");
10360
10478
 
10361
10479
  // src/test-utils/test-message.ts
10362
10480
  var import_address8 = require("@fuel-ts/address");
@@ -10364,6 +10482,9 @@ var import_crypto10 = require("@fuel-ts/crypto");
10364
10482
  var import_math25 = require("@fuel-ts/math");
10365
10483
  var import_utils45 = require("@fuel-ts/utils");
10366
10484
  var TestMessage = class {
10485
+ static {
10486
+ __name(this, "TestMessage");
10487
+ }
10367
10488
  sender;
10368
10489
  recipient;
10369
10490
  nonce;