@fuel-ts/account 0.100.0 → 0.100.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- var __accessCheck = (obj, member, msg) => {
8
- if (!member.has(obj))
9
- throw TypeError("Cannot " + msg);
10
- };
11
- var __privateAdd = (obj, member, value) => {
12
- if (member.has(obj))
13
- throw TypeError("Cannot add the same private member more than once");
14
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
15
- };
16
- var __privateMethod = (obj, member, method) => {
17
- __accessCheck(obj, member, "access private method");
18
- return method;
19
- };
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
20
3
 
21
4
  // src/test-utils/launchNode.ts
22
5
  import { BYTES_32 } from "@fuel-ts/abi-coder";
@@ -34,7 +17,10 @@ import { hash } from "@fuel-ts/hasher";
34
17
  import { toBytes } from "@fuel-ts/math";
35
18
  import { hexlify, concat, arrayify } from "@fuel-ts/utils";
36
19
  import { secp256k1 } from "@noble/curves/secp256k1";
37
- var Signer = class {
20
+ var Signer = class _Signer {
21
+ static {
22
+ __name(this, "Signer");
23
+ }
38
24
  address;
39
25
  publicKey;
40
26
  compressedPublicKey;
@@ -113,7 +99,7 @@ var Signer = class {
113
99
  * @returns Address from signature
114
100
  */
115
101
  static recoverAddress(data, signature) {
116
- return new Address(Signer.recoverPublicKey(data, signature));
102
+ return new Address(_Signer.recoverPublicKey(data, signature));
117
103
  }
118
104
  /**
119
105
  * Generate a random privateKey
@@ -137,14 +123,14 @@ var Signer = class {
137
123
  };
138
124
 
139
125
  // src/test-utils/launchNode.ts
140
- var getFlagValueFromArgs = (args, flag) => {
126
+ var getFlagValueFromArgs = /* @__PURE__ */ __name((args, flag) => {
141
127
  const flagIndex = args.indexOf(flag);
142
128
  if (flagIndex === -1) {
143
129
  return void 0;
144
130
  }
145
131
  return args[flagIndex + 1];
146
- };
147
- var extractRemainingArgs = (args, flagsToRemove) => {
132
+ }, "getFlagValueFromArgs");
133
+ var extractRemainingArgs = /* @__PURE__ */ __name((args, flagsToRemove) => {
148
134
  const newArgs = [...args];
149
135
  flagsToRemove.forEach((flag) => {
150
136
  const flagIndex = newArgs.indexOf(flag);
@@ -153,7 +139,7 @@ var extractRemainingArgs = (args, flagsToRemove) => {
153
139
  }
154
140
  });
155
141
  return newArgs;
156
- };
142
+ }, "extractRemainingArgs");
157
143
  function getFinalStateConfigJSON({
158
144
  stateConfig,
159
145
  chainConfig,
@@ -212,7 +198,8 @@ function getFinalStateConfigJSON({
212
198
  const regexMakeNumber = /("amount":)"(\d+)"/gm;
213
199
  return json.replace(regexMakeNumber, "$1$2");
214
200
  }
215
- var launchNode = async ({
201
+ __name(getFinalStateConfigJSON, "getFinalStateConfigJSON");
202
+ var launchNode = /* @__PURE__ */ __name(async ({
216
203
  ip,
217
204
  port,
218
205
  args = [],
@@ -298,18 +285,18 @@ var launchNode = async ({
298
285
  console.log(chunk.toString());
299
286
  });
300
287
  }
301
- const removeChildListeners = () => {
288
+ const removeChildListeners = /* @__PURE__ */ __name(() => {
302
289
  child.stderr.removeAllListeners();
303
- };
304
- const removeTempDir = () => {
290
+ }, "removeChildListeners");
291
+ const removeTempDir = /* @__PURE__ */ __name(() => {
305
292
  if (existsSync(tempDir)) {
306
293
  rmSync(tempDir, { recursive: true });
307
294
  }
308
- };
295
+ }, "removeTempDir");
309
296
  const childState = {
310
297
  isDead: false
311
298
  };
312
- const cleanup = () => {
299
+ const cleanup = /* @__PURE__ */ __name(() => {
313
300
  if (childState.isDead) {
314
301
  return;
315
302
  }
@@ -334,7 +321,7 @@ var launchNode = async ({
334
321
  console.error("No PID available for the child process, unable to kill launched node");
335
322
  }
336
323
  removeTempDir();
337
- };
324
+ }, "cleanup");
338
325
  child.stderr.on("data", (chunk) => {
339
326
  const text = typeof chunk === "string" ? chunk : chunk.toString();
340
327
  if (text.indexOf(graphQLStartSubstring) !== -1) {
@@ -375,7 +362,7 @@ var launchNode = async ({
375
362
  reject(err);
376
363
  });
377
364
  })
378
- );
365
+ ), "launchNode");
379
366
 
380
367
  // src/test-utils/setup-test-provider-and-wallets.ts
381
368
  import { defaultSnapshotConfigs as defaultSnapshotConfigs3 } from "@fuel-ts/utils";
@@ -384,7 +371,7 @@ import { mergeDeepRight } from "ramda";
384
371
  // src/providers/coin-quantity.ts
385
372
  import { bn } from "@fuel-ts/math";
386
373
  import { hexlify as hexlify3 } from "@fuel-ts/utils";
387
- var coinQuantityfy = (coinQuantityLike) => {
374
+ var coinQuantityfy = /* @__PURE__ */ __name((coinQuantityLike) => {
388
375
  let assetId;
389
376
  let amount;
390
377
  let max;
@@ -402,8 +389,8 @@ var coinQuantityfy = (coinQuantityLike) => {
402
389
  amount: bn(amount),
403
390
  max: max ? bn(max) : void 0
404
391
  };
405
- };
406
- var addAmountToCoinQuantities = (params) => {
392
+ }, "coinQuantityfy");
393
+ var addAmountToCoinQuantities = /* @__PURE__ */ __name((params) => {
407
394
  const { amount, assetId } = params;
408
395
  const coinQuantities = [...params.coinQuantities];
409
396
  const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
@@ -413,19 +400,31 @@ var addAmountToCoinQuantities = (params) => {
413
400
  coinQuantities.push({ assetId, amount });
414
401
  }
415
402
  return coinQuantities;
416
- };
403
+ }, "addAmountToCoinQuantities");
417
404
 
418
405
  // src/providers/provider.ts
419
406
  import { Address as Address3, isB256 } from "@fuel-ts/address";
420
- import { ErrorCode as ErrorCode16, FuelError as FuelError19 } from "@fuel-ts/errors";
407
+ import { ErrorCode as ErrorCode16, FuelError as FuelError20 } from "@fuel-ts/errors";
421
408
  import { bn as bn17 } from "@fuel-ts/math";
422
409
  import { InputMessageCoder as InputMessageCoder2, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
423
410
  import { arrayify as arrayify13, hexlify as hexlify18, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
424
- import { checkFuelCoreVersionCompatibility, gte, versions } from "@fuel-ts/versions";
411
+ import { checkFuelCoreVersionCompatibility, versions } from "@fuel-ts/versions";
425
412
  import { GraphQLClient } from "graphql-request";
426
413
  import gql2 from "graphql-tag";
427
414
  import { clone as clone8 } from "ramda";
428
415
 
416
+ // src/connectors/utils/promises.ts
417
+ import { FuelError as FuelError2 } from "@fuel-ts/errors";
418
+ function deferPromise() {
419
+ const defer = {};
420
+ defer.promise = new Promise((resolve, reject) => {
421
+ defer.reject = reject;
422
+ defer.resolve = resolve;
423
+ });
424
+ return defer;
425
+ }
426
+ __name(deferPromise, "deferPromise");
427
+
429
428
  // src/providers/__generated__/operations.ts
430
429
  import gql from "graphql-tag";
431
430
  var SubmittedStatusFragmentDoc = gql`
@@ -917,6 +916,11 @@ var NodeInfoFragmentDoc = gql`
917
916
  maxTx
918
917
  maxDepth
919
918
  nodeVersion
919
+ indexation {
920
+ balances
921
+ coinsToSpend
922
+ assetMetadata
923
+ }
920
924
  }
921
925
  `;
922
926
  var RelayedTransactionStatusFragmentDoc = gql`
@@ -1198,7 +1202,7 @@ var GetBalancesDocument = gql`
1198
1202
  }
1199
1203
  `;
1200
1204
  var GetBalancesV2Document = gql`
1201
- query getBalancesV2($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
1205
+ query getBalancesV2($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int, $supportsPagination: Boolean!) {
1202
1206
  balances(
1203
1207
  filter: $filter
1204
1208
  after: $after
@@ -1206,7 +1210,7 @@ var GetBalancesV2Document = gql`
1206
1210
  first: $first
1207
1211
  last: $last
1208
1212
  ) {
1209
- pageInfo {
1213
+ pageInfo @include(if: $supportsPagination) {
1210
1214
  ...pageInfoFragment
1211
1215
  }
1212
1216
  edges {
@@ -1476,16 +1480,17 @@ function getSdk(requester) {
1476
1480
  }
1477
1481
  };
1478
1482
  }
1483
+ __name(getSdk, "getSdk");
1479
1484
 
1480
1485
  // src/providers/fuel-graphql-subscriber.ts
1481
- import { ErrorCode as ErrorCode2, FuelError as FuelError3 } from "@fuel-ts/errors";
1486
+ import { ErrorCode as ErrorCode2, FuelError as FuelError4 } from "@fuel-ts/errors";
1482
1487
  import { print } from "graphql";
1483
1488
 
1484
1489
  // src/providers/utils/handle-gql-error-message.ts
1485
- import { ErrorCode, FuelError as FuelError2 } from "@fuel-ts/errors";
1486
- var mapGqlErrorMessage = (error) => {
1490
+ import { ErrorCode, FuelError as FuelError3 } from "@fuel-ts/errors";
1491
+ var mapGqlErrorMessage = /* @__PURE__ */ __name((error) => {
1487
1492
  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)) {
1488
- return new FuelError2(
1493
+ return new FuelError3(
1489
1494
  ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
1490
1495
  `Insufficient funds or too many small value coins. Consider combining UTXOs.`,
1491
1496
  {},
@@ -1493,20 +1498,20 @@ var mapGqlErrorMessage = (error) => {
1493
1498
  );
1494
1499
  }
1495
1500
  if (new RegExp("resource was not found in table" /* ASSET_NOT_FOUND */).test(error.message)) {
1496
- return new FuelError2(
1501
+ return new FuelError3(
1497
1502
  ErrorCode.ASSET_NOT_FOUND,
1498
1503
  `Asset not found for given asset id.`,
1499
1504
  {},
1500
1505
  error
1501
1506
  );
1502
1507
  }
1503
- return new FuelError2(ErrorCode.INVALID_REQUEST, error.message, {}, error);
1504
- };
1505
- var mapGqlErrorWithIncompatibleNodeVersion = (error, incompatibleNodeVersionMessage) => {
1508
+ return new FuelError3(ErrorCode.INVALID_REQUEST, error.message, {}, error);
1509
+ }, "mapGqlErrorMessage");
1510
+ var mapGqlErrorWithIncompatibleNodeVersion = /* @__PURE__ */ __name((error, incompatibleNodeVersionMessage) => {
1506
1511
  if (!incompatibleNodeVersionMessage) {
1507
1512
  return error;
1508
1513
  }
1509
- return new FuelError2(
1514
+ return new FuelError3(
1510
1515
  error.code,
1511
1516
  `${error.message}
1512
1517
 
@@ -1514,8 +1519,8 @@ ${incompatibleNodeVersionMessage}`,
1514
1519
  error.metadata,
1515
1520
  error.rawError
1516
1521
  );
1517
- };
1518
- var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = false) => {
1522
+ }, "mapGqlErrorWithIncompatibleNodeVersion");
1523
+ var assertGqlResponseHasNoErrors = /* @__PURE__ */ __name((errors, incompatibleNodeVersionMessage = false) => {
1519
1524
  if (!Array.isArray(errors)) {
1520
1525
  return;
1521
1526
  }
@@ -1525,16 +1530,21 @@ var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = fal
1525
1530
  }
1526
1531
  const errorMessage = mappedErrors.map((err) => err.message).join("\n");
1527
1532
  throw mapGqlErrorWithIncompatibleNodeVersion(
1528
- new FuelError2(ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
1533
+ new FuelError3(ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
1529
1534
  incompatibleNodeVersionMessage
1530
1535
  );
1531
- };
1536
+ }, "assertGqlResponseHasNoErrors");
1532
1537
 
1533
1538
  // src/providers/fuel-graphql-subscriber.ts
1534
- var _FuelGraphqlSubscriber = class {
1539
+ var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
1535
1540
  constructor(stream) {
1536
1541
  this.stream = stream;
1537
1542
  }
1543
+ static {
1544
+ __name(this, "FuelGraphqlSubscriber");
1545
+ }
1546
+ static incompatibleNodeVersionMessage = false;
1547
+ static textDecoder = new TextDecoder();
1538
1548
  static async create(options) {
1539
1549
  const { url, query, variables, fetchFn } = options;
1540
1550
  const response = await fetchFn(`${url}-sub`, {
@@ -1576,7 +1586,7 @@ var _FuelGraphqlSubscriber = class {
1576
1586
  try {
1577
1587
  this.events.push(JSON.parse(match.replace(/^data:/, "")));
1578
1588
  } catch (e) {
1579
- throw new FuelError3(
1589
+ throw new FuelError4(
1580
1590
  ErrorCode2.STREAM_PARSING_ERROR,
1581
1591
  `Error while parsing stream data response: ${text}`
1582
1592
  );
@@ -1595,22 +1605,19 @@ var _FuelGraphqlSubscriber = class {
1595
1605
  return this;
1596
1606
  }
1597
1607
  };
1598
- var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
1599
- __publicField(FuelGraphqlSubscriber, "incompatibleNodeVersionMessage", false);
1600
- __publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
1601
1608
 
1602
1609
  // src/providers/resource-cache.ts
1603
- import { FuelError as FuelError13, ErrorCode as ErrorCode10 } from "@fuel-ts/errors";
1610
+ import { FuelError as FuelError14, ErrorCode as ErrorCode10 } from "@fuel-ts/errors";
1604
1611
  import { hexlify as hexlify16 } from "@fuel-ts/utils";
1605
1612
 
1606
1613
  // src/providers/transaction-request/input.ts
1607
1614
  import { BYTES_32 as BYTES_322, UTXO_ID_LEN } from "@fuel-ts/abi-coder";
1608
1615
  import { ZeroBytes32 } from "@fuel-ts/address/configs";
1609
- import { ErrorCode as ErrorCode3, FuelError as FuelError4 } from "@fuel-ts/errors";
1616
+ import { ErrorCode as ErrorCode3, FuelError as FuelError5 } from "@fuel-ts/errors";
1610
1617
  import { bn as bn2, toNumber } from "@fuel-ts/math";
1611
1618
  import { InputType } from "@fuel-ts/transactions";
1612
1619
  import { arrayify as arrayify2, hexlify as hexlify4 } from "@fuel-ts/utils";
1613
- var inputify = (value) => {
1620
+ var inputify = /* @__PURE__ */ __name((value) => {
1614
1621
  const { type } = value;
1615
1622
  switch (value.type) {
1616
1623
  case InputType.Coin: {
@@ -1670,21 +1677,21 @@ var inputify = (value) => {
1670
1677
  };
1671
1678
  }
1672
1679
  default: {
1673
- throw new FuelError4(
1680
+ throw new FuelError5(
1674
1681
  ErrorCode3.INVALID_TRANSACTION_INPUT,
1675
1682
  `Invalid transaction input type: ${type}.`
1676
1683
  );
1677
1684
  }
1678
1685
  }
1679
- };
1686
+ }, "inputify");
1680
1687
 
1681
1688
  // src/providers/transaction-request/output.ts
1682
1689
  import { ZeroBytes32 as ZeroBytes322 } from "@fuel-ts/address/configs";
1683
- import { ErrorCode as ErrorCode4, FuelError as FuelError5 } from "@fuel-ts/errors";
1690
+ import { ErrorCode as ErrorCode4, FuelError as FuelError6 } from "@fuel-ts/errors";
1684
1691
  import { bn as bn3 } from "@fuel-ts/math";
1685
1692
  import { OutputType } from "@fuel-ts/transactions";
1686
1693
  import { hexlify as hexlify5 } from "@fuel-ts/utils";
1687
- var outputify = (value) => {
1694
+ var outputify = /* @__PURE__ */ __name((value) => {
1688
1695
  const { type } = value;
1689
1696
  switch (type) {
1690
1697
  case OutputType.Coin: {
@@ -1727,20 +1734,20 @@ var outputify = (value) => {
1727
1734
  };
1728
1735
  }
1729
1736
  default: {
1730
- throw new FuelError5(
1737
+ throw new FuelError6(
1731
1738
  ErrorCode4.INVALID_TRANSACTION_INPUT,
1732
1739
  `Invalid transaction output type: ${type}.`
1733
1740
  );
1734
1741
  }
1735
1742
  }
1736
- };
1743
+ }, "outputify");
1737
1744
 
1738
1745
  // src/providers/transaction-request/transaction-request.ts
1739
1746
  import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
1740
1747
  import { Address as Address2, addressify } from "@fuel-ts/address";
1741
1748
  import { ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
1742
1749
  import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
1743
- import { FuelError as FuelError10 } from "@fuel-ts/errors";
1750
+ import { FuelError as FuelError11 } from "@fuel-ts/errors";
1744
1751
  import { bn as bn8 } from "@fuel-ts/math";
1745
1752
  import {
1746
1753
  PolicyType,
@@ -1752,10 +1759,10 @@ import {
1752
1759
  import { concat as concat2, hexlify as hexlify10, isDefined } from "@fuel-ts/utils";
1753
1760
 
1754
1761
  // src/providers/message.ts
1755
- var isMessageCoin = (message) => !("data" in message);
1762
+ var isMessageCoin = /* @__PURE__ */ __name((message) => !("data" in message), "isMessageCoin");
1756
1763
 
1757
1764
  // src/providers/resource.ts
1758
- var isCoin = (resource) => "id" in resource;
1765
+ var isCoin = /* @__PURE__ */ __name((resource) => "id" in resource, "isCoin");
1759
1766
 
1760
1767
  // src/providers/utils/receipts.ts
1761
1768
  import { ReceiptType as ReceiptType2 } from "@fuel-ts/transactions";
@@ -1763,11 +1770,11 @@ import { FAILED_TRANSFER_TO_ADDRESS_SIGNAL } from "@fuel-ts/transactions/configs
1763
1770
 
1764
1771
  // src/providers/utils/serialization.ts
1765
1772
  import { ZeroBytes32 as ZeroBytes323 } from "@fuel-ts/address/configs";
1766
- import { ErrorCode as ErrorCode5, FuelError as FuelError6 } from "@fuel-ts/errors";
1773
+ import { ErrorCode as ErrorCode5, FuelError as FuelError7 } from "@fuel-ts/errors";
1767
1774
  import { bn as bn4 } from "@fuel-ts/math";
1768
1775
  import { getMintedAssetId, InputMessageCoder, ReceiptType } from "@fuel-ts/transactions";
1769
1776
  import { hexlify as hexlify6, arrayify as arrayify3 } from "@fuel-ts/utils";
1770
- var deserializeChain = (chain) => {
1777
+ var deserializeChain = /* @__PURE__ */ __name((chain) => {
1771
1778
  const { name, daHeight, consensusParameters } = chain;
1772
1779
  const {
1773
1780
  contractParams,
@@ -1821,8 +1828,8 @@ var deserializeChain = (chain) => {
1821
1828
  gasCosts
1822
1829
  }
1823
1830
  };
1824
- };
1825
- var serializeChain = (chain) => {
1831
+ }, "deserializeChain");
1832
+ var serializeChain = /* @__PURE__ */ __name((chain) => {
1826
1833
  const { name, baseChainHeight, consensusParameters } = chain;
1827
1834
  const {
1828
1835
  contractParameters,
@@ -1876,39 +1883,41 @@ var serializeChain = (chain) => {
1876
1883
  gasCosts
1877
1884
  }
1878
1885
  };
1879
- };
1880
- var deserializeNodeInfo = (nodeInfo) => {
1881
- const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
1886
+ }, "serializeChain");
1887
+ var deserializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
1888
+ const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace, indexation } = nodeInfo;
1882
1889
  return {
1883
1890
  maxDepth: bn4(maxDepth),
1884
1891
  maxTx: bn4(maxTx),
1885
1892
  nodeVersion,
1886
1893
  utxoValidation,
1887
- vmBacktrace
1894
+ vmBacktrace,
1895
+ indexation
1888
1896
  };
1889
- };
1890
- var serializeNodeInfo = (nodeInfo) => {
1891
- const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
1897
+ }, "deserializeNodeInfo");
1898
+ var serializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
1899
+ const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace, indexation } = nodeInfo;
1892
1900
  return {
1893
1901
  maxDepth: maxDepth.toString(),
1894
1902
  maxTx: maxTx.toString(),
1895
1903
  nodeVersion,
1896
1904
  utxoValidation,
1897
- vmBacktrace
1905
+ vmBacktrace,
1906
+ indexation
1898
1907
  };
1899
- };
1900
- var deserializeProviderCache = (cache2) => ({
1908
+ }, "serializeNodeInfo");
1909
+ var deserializeProviderCache = /* @__PURE__ */ __name((cache2) => ({
1901
1910
  consensusParametersTimestamp: cache2.consensusParametersTimestamp,
1902
1911
  chain: deserializeChain(cache2.chain),
1903
1912
  nodeInfo: deserializeNodeInfo(cache2.nodeInfo)
1904
- });
1905
- var serializeProviderCache = async (provider) => ({
1913
+ }), "deserializeProviderCache");
1914
+ var serializeProviderCache = /* @__PURE__ */ __name(async (provider) => ({
1906
1915
  consensusParametersTimestamp: provider.consensusParametersTimestamp,
1907
1916
  chain: serializeChain(await provider.getChain()),
1908
1917
  nodeInfo: serializeNodeInfo(await provider.getNode())
1909
- });
1910
- var hexOrZero = (hex) => hex || ZeroBytes323;
1911
- var deserializeReceipt = (receipt) => {
1918
+ }), "serializeProviderCache");
1919
+ var hexOrZero = /* @__PURE__ */ __name((hex) => hex || ZeroBytes323, "hexOrZero");
1920
+ var deserializeReceipt = /* @__PURE__ */ __name((receipt) => {
1912
1921
  const { receiptType } = receipt;
1913
1922
  switch (receiptType) {
1914
1923
  case "CALL" /* Call */: {
@@ -2098,14 +2107,14 @@ var deserializeReceipt = (receipt) => {
2098
2107
  return burnReceipt;
2099
2108
  }
2100
2109
  default:
2101
- throw new FuelError6(ErrorCode5.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
2110
+ throw new FuelError7(ErrorCode5.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
2102
2111
  }
2103
- };
2112
+ }, "deserializeReceipt");
2104
2113
 
2105
2114
  // src/providers/utils/receipts.ts
2106
- var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType2.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
2107
- var doesReceiptHaveMissingContractId = (receipt) => receipt.type === ReceiptType2.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
2108
- var getReceiptsWithMissingData = (receipts) => receipts.reduce(
2115
+ var doesReceiptHaveMissingOutputVariables = /* @__PURE__ */ __name((receipt) => receipt.type === ReceiptType2.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL, "doesReceiptHaveMissingOutputVariables");
2116
+ var doesReceiptHaveMissingContractId = /* @__PURE__ */ __name((receipt) => receipt.type === ReceiptType2.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000", "doesReceiptHaveMissingContractId");
2117
+ var getReceiptsWithMissingData = /* @__PURE__ */ __name((receipts) => receipts.reduce(
2109
2118
  (memo, receipt) => {
2110
2119
  if (doesReceiptHaveMissingOutputVariables(receipt)) {
2111
2120
  memo.missingOutputVariables.push(receipt);
@@ -2119,22 +2128,22 @@ var getReceiptsWithMissingData = (receipts) => receipts.reduce(
2119
2128
  missingOutputVariables: [],
2120
2129
  missingOutputContractIds: []
2121
2130
  }
2122
- );
2131
+ ), "getReceiptsWithMissingData");
2123
2132
 
2124
2133
  // src/providers/utils/block-explorer.ts
2125
- import { ErrorCode as ErrorCode6, FuelError as FuelError7 } from "@fuel-ts/errors";
2134
+ import { ErrorCode as ErrorCode6, FuelError as FuelError8 } from "@fuel-ts/errors";
2126
2135
 
2127
2136
  // src/providers/utils/gas.ts
2128
2137
  import { bn as bn5 } from "@fuel-ts/math";
2129
2138
  import { ReceiptType as ReceiptType3 } from "@fuel-ts/transactions";
2130
2139
  import { arrayify as arrayify4 } from "@fuel-ts/utils";
2131
- var getGasUsedFromReceipts = (receipts) => {
2140
+ var getGasUsedFromReceipts = /* @__PURE__ */ __name((receipts) => {
2132
2141
  const scriptResult = receipts.filter(
2133
2142
  (receipt) => receipt.type === ReceiptType3.ScriptResult
2134
2143
  );
2135
2144
  const gasUsed = scriptResult.reduce((prev, receipt) => prev.add(receipt.gasUsed), bn5(0));
2136
2145
  return gasUsed;
2137
- };
2146
+ }, "getGasUsedFromReceipts");
2138
2147
  function resolveGasDependentCosts(byteSize, gasDependentCost) {
2139
2148
  const base = bn5(gasDependentCost.base);
2140
2149
  let dependentValue = bn5(0);
@@ -2145,6 +2154,7 @@ function resolveGasDependentCosts(byteSize, gasDependentCost) {
2145
2154
  }
2146
2155
  return base.add(dependentValue);
2147
2156
  }
2157
+ __name(resolveGasDependentCosts, "resolveGasDependentCosts");
2148
2158
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
2149
2159
  const witnessCache = [];
2150
2160
  const chargeableInputs = inputs.filter((input) => {
@@ -2171,6 +2181,7 @@ function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
2171
2181
  }, bn5(0));
2172
2182
  return totalGas;
2173
2183
  }
2184
+ __name(gasUsedByInputs, "gasUsedByInputs");
2174
2185
  function getMinGas(params) {
2175
2186
  const { gasCosts, gasPerByte, inputs, metadataGas, txBytesSize } = params;
2176
2187
  const vmInitGas = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
@@ -2179,6 +2190,7 @@ function getMinGas(params) {
2179
2190
  const minGas = vmInitGas.add(bytesGas).add(inputsGas).add(metadataGas).maxU64();
2180
2191
  return minGas;
2181
2192
  }
2193
+ __name(getMinGas, "getMinGas");
2182
2194
  function getMaxGas(params) {
2183
2195
  const {
2184
2196
  gasPerByte,
@@ -2195,6 +2207,7 @@ function getMaxGas(params) {
2195
2207
  const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
2196
2208
  return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
2197
2209
  }
2210
+ __name(getMaxGas, "getMaxGas");
2198
2211
  function calculateMetadataGasForTxCreate({
2199
2212
  gasCosts,
2200
2213
  stateRootSize,
@@ -2209,12 +2222,14 @@ function calculateMetadataGasForTxCreate({
2209
2222
  const metadataGas = contractRootGas.add(stateRootGas).add(txIdGas).add(contractIdGas);
2210
2223
  return metadataGas.maxU64();
2211
2224
  }
2225
+ __name(calculateMetadataGasForTxCreate, "calculateMetadataGasForTxCreate");
2212
2226
  function calculateMetadataGasForTxScript({
2213
2227
  gasCosts,
2214
2228
  txBytesSize
2215
2229
  }) {
2216
2230
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2217
2231
  }
2232
+ __name(calculateMetadataGasForTxScript, "calculateMetadataGasForTxScript");
2218
2233
  function calculateMetadataGasForTxBlob({
2219
2234
  gasCosts,
2220
2235
  txBytesSize,
@@ -2224,6 +2239,7 @@ function calculateMetadataGasForTxBlob({
2224
2239
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
2225
2240
  return txId.add(blobLen);
2226
2241
  }
2242
+ __name(calculateMetadataGasForTxBlob, "calculateMetadataGasForTxBlob");
2227
2243
  function calculateMetadataGasForTxUpgrade({
2228
2244
  gasCosts,
2229
2245
  txBytesSize,
@@ -2236,6 +2252,7 @@ function calculateMetadataGasForTxUpgrade({
2236
2252
  }
2237
2253
  return txId;
2238
2254
  }
2255
+ __name(calculateMetadataGasForTxUpgrade, "calculateMetadataGasForTxUpgrade");
2239
2256
  function calculateMetadataGasForTxUpload({
2240
2257
  gasCosts,
2241
2258
  txBytesSize,
@@ -2249,6 +2266,7 @@ function calculateMetadataGasForTxUpload({
2249
2266
  txId.add(subsectionsLen);
2250
2267
  return txId;
2251
2268
  }
2269
+ __name(calculateMetadataGasForTxUpload, "calculateMetadataGasForTxUpload");
2252
2270
  function calculateMinGasForTxUpload({
2253
2271
  gasCosts,
2254
2272
  baseMinGas,
@@ -2257,10 +2275,11 @@ function calculateMinGasForTxUpload({
2257
2275
  const additionalStoragePerByte = bn5(gasCosts.newStoragePerByte).mul(subsectionSize);
2258
2276
  return bn5(baseMinGas).add(additionalStoragePerByte);
2259
2277
  }
2260
- var calculateGasFee = (params) => {
2278
+ __name(calculateMinGasForTxUpload, "calculateMinGasForTxUpload");
2279
+ var calculateGasFee = /* @__PURE__ */ __name((params) => {
2261
2280
  const { gas, gasPrice, priceFactor, tip } = params;
2262
2281
  return gas.mul(gasPrice).div(priceFactor).add(bn5(tip));
2263
- };
2282
+ }, "calculateGasFee");
2264
2283
 
2265
2284
  // src/providers/utils/json.ts
2266
2285
  import { hexlify as hexlify7 } from "@fuel-ts/utils";
@@ -2289,12 +2308,14 @@ function normalize(object) {
2289
2308
  });
2290
2309
  return object;
2291
2310
  }
2311
+ __name(normalize, "normalize");
2292
2312
  function normalizeJSON(root) {
2293
2313
  return normalize(clone(root));
2294
2314
  }
2315
+ __name(normalizeJSON, "normalizeJSON");
2295
2316
 
2296
2317
  // src/providers/utils/extract-tx-error.ts
2297
- import { ErrorCode as ErrorCode7, FuelError as FuelError8 } from "@fuel-ts/errors";
2318
+ import { ErrorCode as ErrorCode7, FuelError as FuelError9 } from "@fuel-ts/errors";
2298
2319
  import { bn as bn6 } from "@fuel-ts/math";
2299
2320
  import { ReceiptType as ReceiptType4 } from "@fuel-ts/transactions";
2300
2321
  import {
@@ -2306,7 +2327,7 @@ import {
2306
2327
  PANIC_REASONS,
2307
2328
  PANIC_DOC_URL
2308
2329
  } from "@fuel-ts/transactions/configs";
2309
- var assemblePanicError = (statusReason, metadata) => {
2330
+ var assemblePanicError = /* @__PURE__ */ __name((statusReason, metadata) => {
2310
2331
  let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
2311
2332
  if (PANIC_REASONS.includes(statusReason)) {
2312
2333
  errorMessage = `${errorMessage}
@@ -2315,13 +2336,13 @@ You can read more about this error at:
2315
2336
 
2316
2337
  ${PANIC_DOC_URL}#variant.${statusReason}`;
2317
2338
  }
2318
- return new FuelError8(ErrorCode7.SCRIPT_REVERTED, errorMessage, {
2339
+ return new FuelError9(ErrorCode7.SCRIPT_REVERTED, errorMessage, {
2319
2340
  ...metadata,
2320
2341
  reason: statusReason
2321
2342
  });
2322
- };
2323
- var stringify = (obj) => JSON.stringify(obj, null, 2);
2324
- var assembleRevertError = (receipts, logs, metadata) => {
2343
+ }, "assemblePanicError");
2344
+ var stringify = /* @__PURE__ */ __name((obj) => JSON.stringify(obj, null, 2), "stringify");
2345
+ var assembleRevertError = /* @__PURE__ */ __name((receipts, logs, metadata) => {
2325
2346
  let errorMessage = "The transaction reverted with an unknown reason.";
2326
2347
  const revertReceipt = receipts.find(({ type }) => type === ReceiptType4.Revert);
2327
2348
  let reason = "";
@@ -2356,7 +2377,7 @@ var assembleRevertError = (receipts, logs, metadata) => {
2356
2377
  errorMessage = `The transaction reverted because it's missing an "OutputVariable".`;
2357
2378
  break;
2358
2379
  default:
2359
- throw new FuelError8(
2380
+ throw new FuelError9(
2360
2381
  ErrorCode7.UNKNOWN,
2361
2382
  `The transaction reverted with an unknown reason: ${revertReceipt.val}`,
2362
2383
  {
@@ -2366,12 +2387,12 @@ var assembleRevertError = (receipts, logs, metadata) => {
2366
2387
  );
2367
2388
  }
2368
2389
  }
2369
- return new FuelError8(ErrorCode7.SCRIPT_REVERTED, errorMessage, {
2390
+ return new FuelError9(ErrorCode7.SCRIPT_REVERTED, errorMessage, {
2370
2391
  ...metadata,
2371
2392
  reason
2372
2393
  });
2373
- };
2374
- var extractTxError = (params) => {
2394
+ }, "assembleRevertError");
2395
+ var extractTxError = /* @__PURE__ */ __name((params) => {
2375
2396
  const { receipts, statusReason, logs } = params;
2376
2397
  const isPanic = receipts.some(({ type }) => type === ReceiptType4.Panic);
2377
2398
  const isRevert = receipts.some(({ type }) => type === ReceiptType4.Revert);
@@ -2386,7 +2407,7 @@ var extractTxError = (params) => {
2386
2407
  return assemblePanicError(statusReason, metadata);
2387
2408
  }
2388
2409
  return assembleRevertError(receipts, logs, metadata);
2389
- };
2410
+ }, "extractTxError");
2390
2411
 
2391
2412
  // src/providers/transaction-request/errors.ts
2392
2413
  var NoWitnessAtIndexError = class extends Error {
@@ -2395,23 +2416,26 @@ var NoWitnessAtIndexError = class extends Error {
2395
2416
  this.index = index;
2396
2417
  this.message = `Witness at index "${index}" was not found`;
2397
2418
  }
2419
+ static {
2420
+ __name(this, "NoWitnessAtIndexError");
2421
+ }
2398
2422
  name = "NoWitnessAtIndexError";
2399
2423
  };
2400
2424
 
2401
2425
  // src/providers/transaction-request/helpers.ts
2402
- import { ErrorCode as ErrorCode8, FuelError as FuelError9 } from "@fuel-ts/errors";
2426
+ import { ErrorCode as ErrorCode8, FuelError as FuelError10 } from "@fuel-ts/errors";
2403
2427
  import { bn as bn7 } from "@fuel-ts/math";
2404
2428
  import { InputType as InputType2, OutputType as OutputType2 } from "@fuel-ts/transactions";
2405
2429
  import { hexlify as hexlify8 } from "@fuel-ts/utils";
2406
- var isRequestInputCoin = (input) => input.type === InputType2.Coin;
2407
- var isRequestInputMessage = (input) => input.type === InputType2.Message;
2408
- var isRequestInputMessageWithoutData = (input) => input.type === InputType2.Message && bn7(input.data).isZero();
2409
- var isRequestInputCoinOrMessage = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
2410
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessageWithoutData(input);
2411
- var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
2412
- var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
2413
- var isPredicate = (input) => isRequestInputCoinOrMessage(input) && !!input.predicate && hexlify8(input.predicate) !== "0x";
2414
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
2430
+ var isRequestInputCoin = /* @__PURE__ */ __name((input) => input.type === InputType2.Coin, "isRequestInputCoin");
2431
+ var isRequestInputMessage = /* @__PURE__ */ __name((input) => input.type === InputType2.Message, "isRequestInputMessage");
2432
+ var isRequestInputMessageWithoutData = /* @__PURE__ */ __name((input) => input.type === InputType2.Message && bn7(input.data).isZero(), "isRequestInputMessageWithoutData");
2433
+ var isRequestInputCoinOrMessage = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) || isRequestInputMessage(input), "isRequestInputCoinOrMessage");
2434
+ var isRequestInputResource = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) || isRequestInputMessageWithoutData(input), "isRequestInputResource");
2435
+ var getRequestInputResourceOwner = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) ? input.owner : input.recipient, "getRequestInputResourceOwner");
2436
+ var isRequestInputResourceFromOwner = /* @__PURE__ */ __name((input, owner) => getRequestInputResourceOwner(input) === owner.toB256(), "isRequestInputResourceFromOwner");
2437
+ var isPredicate = /* @__PURE__ */ __name((input) => isRequestInputCoinOrMessage(input) && !!input.predicate && hexlify8(input.predicate) !== "0x", "isPredicate");
2438
+ var getAssetAmountInRequestInputs = /* @__PURE__ */ __name((inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
2415
2439
  if (isRequestInputCoin(input) && input.assetId === assetId) {
2416
2440
  return acc.add(input.amount);
2417
2441
  }
@@ -2419,8 +2443,8 @@ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filte
2419
2443
  return acc.add(input.amount);
2420
2444
  }
2421
2445
  return acc;
2422
- }, bn7(0));
2423
- var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2446
+ }, bn7(0)), "getAssetAmountInRequestInputs");
2447
+ var cacheRequestInputsResourcesFromOwner = /* @__PURE__ */ __name((inputs, owner) => inputs.reduce(
2424
2448
  (acc, input) => {
2425
2449
  if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
2426
2450
  acc.utxos.push(input.id);
@@ -2433,8 +2457,8 @@ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2433
2457
  utxos: [],
2434
2458
  messages: []
2435
2459
  }
2436
- );
2437
- var getBurnableAssetCount = (baseAssetId, transactionRequest) => {
2460
+ ), "cacheRequestInputsResourcesFromOwner");
2461
+ var getBurnableAssetCount = /* @__PURE__ */ __name((baseAssetId, transactionRequest) => {
2438
2462
  const { inputs, outputs } = transactionRequest;
2439
2463
  const coinInputs = new Set(inputs.filter(isRequestInputCoin).map((input) => input.assetId));
2440
2464
  if (inputs.some((i) => isRequestInputMessage(i) && bn7(i.amount).gt(0))) {
@@ -2445,8 +2469,8 @@ var getBurnableAssetCount = (baseAssetId, transactionRequest) => {
2445
2469
  );
2446
2470
  const difference = new Set([...coinInputs].filter((x) => !changeOutputs.has(x)));
2447
2471
  return difference.size;
2448
- };
2449
- var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAssetBurn = false) => {
2472
+ }, "getBurnableAssetCount");
2473
+ var validateTransactionForAssetBurn = /* @__PURE__ */ __name((baseAssetId, transactionRequest, enableAssetBurn = false) => {
2450
2474
  if (enableAssetBurn === true) {
2451
2475
  return;
2452
2476
  }
@@ -2458,21 +2482,24 @@ var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAs
2458
2482
  "Add the relevant change outputs to the transaction to avoid burning assets.",
2459
2483
  "Or enable asset burn, upon sending the transaction."
2460
2484
  ].join("\n");
2461
- throw new FuelError9(ErrorCode8.ASSET_BURN_DETECTED, message);
2462
- };
2485
+ throw new FuelError10(ErrorCode8.ASSET_BURN_DETECTED, message);
2486
+ }, "validateTransactionForAssetBurn");
2463
2487
 
2464
2488
  // src/providers/transaction-request/witness.ts
2465
2489
  import { arrayify as arrayify5, hexlify as hexlify9 } from "@fuel-ts/utils";
2466
- var witnessify = (value) => {
2490
+ var witnessify = /* @__PURE__ */ __name((value) => {
2467
2491
  const data = arrayify5(value);
2468
2492
  return {
2469
2493
  data: hexlify9(data),
2470
2494
  dataLength: data.length
2471
2495
  };
2472
- };
2496
+ }, "witnessify");
2473
2497
 
2474
2498
  // src/providers/transaction-request/transaction-request.ts
2475
- var BaseTransactionRequest = class {
2499
+ var BaseTransactionRequest = class _BaseTransactionRequest {
2500
+ static {
2501
+ __name(this, "BaseTransactionRequest");
2502
+ }
2476
2503
  /** Gas price for transaction */
2477
2504
  tip;
2478
2505
  /** Block until which tx cannot be included */
@@ -2555,7 +2582,7 @@ var BaseTransactionRequest = class {
2555
2582
  const inputs = this.inputs?.map(inputify) ?? [];
2556
2583
  const outputs = this.outputs?.map(outputify) ?? [];
2557
2584
  const witnesses = this.witnesses?.map(witnessify) ?? [];
2558
- const { policyTypes, policies } = BaseTransactionRequest.getPolicyMeta(this);
2585
+ const { policyTypes, policies } = _BaseTransactionRequest.getPolicyMeta(this);
2559
2586
  return {
2560
2587
  policyTypes,
2561
2588
  inputs,
@@ -2856,7 +2883,7 @@ var BaseTransactionRequest = class {
2856
2883
  * @hidden
2857
2884
  */
2858
2885
  metadataGas(_gasCosts) {
2859
- throw new FuelError10(FuelError10.CODES.NOT_IMPLEMENTED, "Not implemented");
2886
+ throw new FuelError11(FuelError11.CODES.NOT_IMPLEMENTED, "Not implemented");
2860
2887
  }
2861
2888
  /**
2862
2889
  * @hidden
@@ -2903,13 +2930,13 @@ var BaseTransactionRequest = class {
2903
2930
  * Please use `Account.generateFakeResources` along with `this.addResources` instead.
2904
2931
  */
2905
2932
  fundWithFakeUtxos(quantities, baseAssetId, resourcesOwner) {
2906
- const findAssetInput = (assetId) => this.inputs.find((input) => {
2933
+ const findAssetInput = /* @__PURE__ */ __name((assetId) => this.inputs.find((input) => {
2907
2934
  if ("assetId" in input) {
2908
2935
  return input.assetId === assetId;
2909
2936
  }
2910
2937
  return false;
2911
- });
2912
- const updateAssetInput = (assetId, quantity) => {
2938
+ }), "findAssetInput");
2939
+ const updateAssetInput = /* @__PURE__ */ __name((assetId, quantity) => {
2913
2940
  const assetInput = findAssetInput(assetId);
2914
2941
  let usedQuantity = quantity;
2915
2942
  if (assetId === baseAssetId) {
@@ -2930,7 +2957,7 @@ var BaseTransactionRequest = class {
2930
2957
  }
2931
2958
  ]);
2932
2959
  }
2933
- };
2960
+ }, "updateAssetInput");
2934
2961
  updateAssetInput(baseAssetId, bn8(1e11));
2935
2962
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2936
2963
  return this;
@@ -3018,6 +3045,7 @@ function hashTransaction(transactionRequest, chainId) {
3018
3045
  transaction.inputs = transaction.inputs.map((input) => {
3019
3046
  const inputClone = clone2(input);
3020
3047
  switch (inputClone.type) {
3048
+ // Zero out on signing: txPointer, predicateGasUsed
3021
3049
  case InputType4.Coin: {
3022
3050
  inputClone.txPointer = {
3023
3051
  blockHeight: 0,
@@ -3026,10 +3054,12 @@ function hashTransaction(transactionRequest, chainId) {
3026
3054
  inputClone.predicateGasUsed = bn9(0);
3027
3055
  return inputClone;
3028
3056
  }
3057
+ // Zero out on signing: predicateGasUsed
3029
3058
  case InputType4.Message: {
3030
3059
  inputClone.predicateGasUsed = bn9(0);
3031
3060
  return inputClone;
3032
3061
  }
3062
+ // Zero out on signing: txID, outputIndex, balanceRoot, stateRoot, and txPointer
3033
3063
  case InputType4.Contract: {
3034
3064
  inputClone.txPointer = {
3035
3065
  blockHeight: 0,
@@ -3048,15 +3078,18 @@ function hashTransaction(transactionRequest, chainId) {
3048
3078
  transaction.outputs = transaction.outputs.map((output) => {
3049
3079
  const outputClone = clone2(output);
3050
3080
  switch (outputClone.type) {
3081
+ // Zero out on signing: balanceRoot, stateRoot
3051
3082
  case OutputType4.Contract: {
3052
3083
  outputClone.balanceRoot = ZeroBytes325;
3053
3084
  outputClone.stateRoot = ZeroBytes325;
3054
3085
  return outputClone;
3055
3086
  }
3087
+ // Zero out on signing: amount
3056
3088
  case OutputType4.Change: {
3057
3089
  outputClone.amount = bn9(0);
3058
3090
  return outputClone;
3059
3091
  }
3092
+ // Zero out on signing: amount, to and assetId
3060
3093
  case OutputType4.Variable: {
3061
3094
  outputClone.to = ZeroBytes325;
3062
3095
  outputClone.amount = bn9(0);
@@ -3073,9 +3106,13 @@ function hashTransaction(transactionRequest, chainId) {
3073
3106
  const concatenatedData = concat3([chainIdBytes, new TransactionCoder2().encode(transaction)]);
3074
3107
  return sha256(concatenatedData);
3075
3108
  }
3109
+ __name(hashTransaction, "hashTransaction");
3076
3110
 
3077
3111
  // src/providers/transaction-request/blob-transaction-request.ts
3078
3112
  var BlobTransactionRequest = class extends BaseTransactionRequest {
3113
+ static {
3114
+ __name(this, "BlobTransactionRequest");
3115
+ }
3079
3116
  static from(obj) {
3080
3117
  return new this(clone3(obj));
3081
3118
  }
@@ -3144,12 +3181,12 @@ import { clone as clone4 } from "ramda";
3144
3181
 
3145
3182
  // src/providers/transaction-request/storage-slot.ts
3146
3183
  import { arrayify as arrayify6, hexlify as hexlify11 } from "@fuel-ts/utils";
3147
- var getStorageValue = (value) => {
3184
+ var getStorageValue = /* @__PURE__ */ __name((value) => {
3148
3185
  const v = new Uint8Array(32);
3149
3186
  v.set(arrayify6(value));
3150
3187
  return v;
3151
- };
3152
- var storageSlotify = (storageSlot) => {
3188
+ }, "getStorageValue");
3189
+ var storageSlotify = /* @__PURE__ */ __name((storageSlot) => {
3153
3190
  let key;
3154
3191
  let value;
3155
3192
  if (Array.isArray(storageSlot)) {
@@ -3163,10 +3200,13 @@ var storageSlotify = (storageSlot) => {
3163
3200
  key: hexlify11(key),
3164
3201
  value: hexlify11(getStorageValue(value))
3165
3202
  };
3166
- };
3203
+ }, "storageSlotify");
3167
3204
 
3168
3205
  // src/providers/transaction-request/create-transaction-request.ts
3169
3206
  var CreateTransactionRequest = class extends BaseTransactionRequest {
3207
+ static {
3208
+ __name(this, "CreateTransactionRequest");
3209
+ }
3170
3210
  static from(obj) {
3171
3211
  return new this(clone4(obj));
3172
3212
  }
@@ -3268,7 +3308,7 @@ var returnZeroScript = {
3268
3308
  */
3269
3309
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
3270
3310
  bytes: arrayify8("0x24000000"),
3271
- encodeScriptData: () => new Uint8Array(0)
3311
+ encodeScriptData: /* @__PURE__ */ __name(() => new Uint8Array(0), "encodeScriptData")
3272
3312
  };
3273
3313
  var withdrawScript = {
3274
3314
  /*
@@ -3282,11 +3322,14 @@ var withdrawScript = {
3282
3322
  */
3283
3323
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
3284
3324
  bytes: arrayify8("0x5040C0105D44C0064C40001124000000"),
3285
- encodeScriptData: () => new Uint8Array(0)
3325
+ encodeScriptData: /* @__PURE__ */ __name(() => new Uint8Array(0), "encodeScriptData")
3286
3326
  };
3287
3327
 
3288
3328
  // src/providers/transaction-request/script-transaction-request.ts
3289
3329
  var ScriptTransactionRequest = class extends BaseTransactionRequest {
3330
+ static {
3331
+ __name(this, "ScriptTransactionRequest");
3332
+ }
3290
3333
  static from(obj) {
3291
3334
  return new this(clone5(obj));
3292
3335
  }
@@ -3479,7 +3522,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
3479
3522
  };
3480
3523
 
3481
3524
  // src/providers/transaction-request/upgrade-transaction-request.ts
3482
- import { FuelError as FuelError11 } from "@fuel-ts/errors";
3525
+ import { FuelError as FuelError12 } from "@fuel-ts/errors";
3483
3526
  import { hash as hash2 } from "@fuel-ts/hasher";
3484
3527
  import {
3485
3528
  TransactionType as TransactionType5,
@@ -3487,9 +3530,12 @@ import {
3487
3530
  } from "@fuel-ts/transactions";
3488
3531
  import { hexlify as hexlify14 } from "@fuel-ts/utils";
3489
3532
  import { clone as clone6 } from "ramda";
3490
- var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3533
+ var UpgradeTransactionRequest = class _UpgradeTransactionRequest extends BaseTransactionRequest {
3534
+ static {
3535
+ __name(this, "UpgradeTransactionRequest");
3536
+ }
3491
3537
  static from(obj) {
3492
- if (obj instanceof UpgradeTransactionRequest) {
3538
+ if (obj instanceof _UpgradeTransactionRequest) {
3493
3539
  return obj;
3494
3540
  }
3495
3541
  return new this(clone6(obj));
@@ -3586,7 +3632,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3586
3632
  }
3587
3633
  };
3588
3634
  } else {
3589
- throw new FuelError11(FuelError11.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3635
+ throw new FuelError12(FuelError12.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3590
3636
  }
3591
3637
  return {
3592
3638
  type: TransactionType5.Upgrade,
@@ -3628,7 +3674,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3628
3674
  txBytesSize
3629
3675
  });
3630
3676
  }
3631
- throw new FuelError11(FuelError11.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3677
+ throw new FuelError12(FuelError12.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3632
3678
  }
3633
3679
  };
3634
3680
 
@@ -3637,9 +3683,12 @@ import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
3637
3683
  import { TransactionType as TransactionType6 } from "@fuel-ts/transactions";
3638
3684
  import { arrayify as arrayify10, hexlify as hexlify15 } from "@fuel-ts/utils";
3639
3685
  import { clone as clone7 } from "ramda";
3640
- var UploadTransactionRequest = class extends BaseTransactionRequest {
3686
+ var UploadTransactionRequest = class _UploadTransactionRequest extends BaseTransactionRequest {
3687
+ static {
3688
+ __name(this, "UploadTransactionRequest");
3689
+ }
3641
3690
  static from(obj) {
3642
- if (obj instanceof UploadTransactionRequest) {
3691
+ if (obj instanceof _UploadTransactionRequest) {
3643
3692
  return obj;
3644
3693
  }
3645
3694
  return new this(clone7(obj));
@@ -3739,9 +3788,9 @@ var UploadTransactionRequest = class extends BaseTransactionRequest {
3739
3788
  };
3740
3789
 
3741
3790
  // src/providers/transaction-request/utils.ts
3742
- import { ErrorCode as ErrorCode9, FuelError as FuelError12 } from "@fuel-ts/errors";
3791
+ import { ErrorCode as ErrorCode9, FuelError as FuelError13 } from "@fuel-ts/errors";
3743
3792
  import { TransactionType as TransactionType7 } from "@fuel-ts/transactions";
3744
- var transactionRequestify = (obj) => {
3793
+ var transactionRequestify = /* @__PURE__ */ __name((obj) => {
3745
3794
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
3746
3795
  return obj;
3747
3796
  }
@@ -3763,24 +3812,27 @@ var transactionRequestify = (obj) => {
3763
3812
  return UploadTransactionRequest.from(obj);
3764
3813
  }
3765
3814
  default: {
3766
- throw new FuelError12(
3815
+ throw new FuelError13(
3767
3816
  ErrorCode9.UNSUPPORTED_TRANSACTION_TYPE,
3768
3817
  `Unsupported transaction type: ${type}.`
3769
3818
  );
3770
3819
  }
3771
3820
  }
3772
- };
3773
- var isTransactionTypeScript = (request) => request.type === TransactionType7.Script;
3774
- var isTransactionTypeCreate = (request) => request.type === TransactionType7.Create;
3821
+ }, "transactionRequestify");
3822
+ var isTransactionTypeScript = /* @__PURE__ */ __name((request) => request.type === TransactionType7.Script, "isTransactionTypeScript");
3823
+ var isTransactionTypeCreate = /* @__PURE__ */ __name((request) => request.type === TransactionType7.Create, "isTransactionTypeCreate");
3775
3824
 
3776
3825
  // src/providers/resource-cache.ts
3777
3826
  var cache = /* @__PURE__ */ new Map();
3778
3827
  var ResourceCache = class {
3828
+ static {
3829
+ __name(this, "ResourceCache");
3830
+ }
3779
3831
  ttl;
3780
3832
  constructor(ttl) {
3781
3833
  this.ttl = ttl;
3782
3834
  if (typeof ttl !== "number" || this.ttl <= 0) {
3783
- throw new FuelError13(
3835
+ throw new FuelError14(
3784
3836
  ErrorCode10.INVALID_TTL,
3785
3837
  `Invalid TTL: ${this.ttl}. Use a value greater than zero.`
3786
3838
  );
@@ -3865,7 +3917,7 @@ var ResourceCache = class {
3865
3917
  };
3866
3918
 
3867
3919
  // src/providers/transaction-response/transaction-response.ts
3868
- import { ErrorCode as ErrorCode14, FuelError as FuelError17 } from "@fuel-ts/errors";
3920
+ import { ErrorCode as ErrorCode14, FuelError as FuelError18 } from "@fuel-ts/errors";
3869
3921
  import { bn as bn16 } from "@fuel-ts/math";
3870
3922
  import { OutputType as OutputType8, TransactionCoder as TransactionCoder4, TxPointerCoder } from "@fuel-ts/transactions";
3871
3923
  import { arrayify as arrayify12, assertUnreachable } from "@fuel-ts/utils";
@@ -3879,7 +3931,7 @@ import { DateTime, hexlify as hexlify17 } from "@fuel-ts/utils";
3879
3931
  import { bn as bn12 } from "@fuel-ts/math";
3880
3932
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType8 } from "@fuel-ts/transactions";
3881
3933
  import { arrayify as arrayify11 } from "@fuel-ts/utils";
3882
- var calculateTXFeeForSummary = (params) => {
3934
+ var calculateTXFeeForSummary = /* @__PURE__ */ __name((params) => {
3883
3935
  const {
3884
3936
  gasPrice,
3885
3937
  rawPayload,
@@ -3939,43 +3991,51 @@ var calculateTXFeeForSummary = (params) => {
3939
3991
  tip
3940
3992
  });
3941
3993
  return maxFee;
3942
- };
3994
+ }, "calculateTXFeeForSummary");
3943
3995
 
3944
3996
  // src/providers/transaction-summary/operations.ts
3945
3997
  import { ZeroBytes32 as ZeroBytes329 } from "@fuel-ts/address/configs";
3946
- import { ErrorCode as ErrorCode12, FuelError as FuelError15 } from "@fuel-ts/errors";
3998
+ import { ErrorCode as ErrorCode12, FuelError as FuelError16 } from "@fuel-ts/errors";
3947
3999
  import { bn as bn13 } from "@fuel-ts/math";
3948
4000
  import { ReceiptType as ReceiptType5, TransactionType as TransactionType9 } from "@fuel-ts/transactions";
3949
4001
 
3950
4002
  // src/providers/transaction-summary/input.ts
3951
- import { ErrorCode as ErrorCode11, FuelError as FuelError14 } from "@fuel-ts/errors";
4003
+ import { ErrorCode as ErrorCode11, FuelError as FuelError15 } from "@fuel-ts/errors";
3952
4004
  import { BN } from "@fuel-ts/math";
3953
4005
  import { InputType as InputType6 } from "@fuel-ts/transactions";
3954
4006
  function getInputsByTypes(inputs, types) {
3955
4007
  return inputs.filter((i) => types.includes(i.type));
3956
4008
  }
4009
+ __name(getInputsByTypes, "getInputsByTypes");
3957
4010
  function getInputsByType(inputs, type) {
3958
4011
  return inputs.filter((i) => i.type === type);
3959
4012
  }
4013
+ __name(getInputsByType, "getInputsByType");
3960
4014
  function getInputsCoin(inputs) {
3961
4015
  return getInputsByType(inputs, InputType6.Coin);
3962
4016
  }
4017
+ __name(getInputsCoin, "getInputsCoin");
3963
4018
  function getInputsMessage(inputs) {
3964
4019
  return getInputsByType(inputs, InputType6.Message);
3965
4020
  }
4021
+ __name(getInputsMessage, "getInputsMessage");
3966
4022
  function getInputsCoinAndMessage(inputs) {
3967
4023
  return getInputsByTypes(inputs, [InputType6.Coin, InputType6.Message]);
3968
4024
  }
4025
+ __name(getInputsCoinAndMessage, "getInputsCoinAndMessage");
3969
4026
  function isInputCoin(input) {
3970
4027
  return input.type === InputType6.Coin;
3971
4028
  }
4029
+ __name(isInputCoin, "isInputCoin");
3972
4030
  function getInputsContract(inputs) {
3973
4031
  return getInputsByType(inputs, InputType6.Contract);
3974
4032
  }
4033
+ __name(getInputsContract, "getInputsContract");
3975
4034
  function findCoinInput(inputs, assetId) {
3976
4035
  const coinInputs = getInputsCoin(inputs);
3977
4036
  return coinInputs.find((i) => i.assetId === assetId);
3978
4037
  }
4038
+ __name(findCoinInput, "findCoinInput");
3979
4039
  function aggregateInputsAmountsByAssetAndOwner(inputs, baseAssetId) {
3980
4040
  const aggregated = /* @__PURE__ */ new Map();
3981
4041
  getInputsCoinAndMessage(inputs).forEach((input) => {
@@ -3995,9 +4055,11 @@ function aggregateInputsAmountsByAssetAndOwner(inputs, baseAssetId) {
3995
4055
  });
3996
4056
  return aggregated;
3997
4057
  }
4058
+ __name(aggregateInputsAmountsByAssetAndOwner, "aggregateInputsAmountsByAssetAndOwner");
3998
4059
  function findMessageInput(inputs) {
3999
4060
  return getInputsMessage(inputs)?.[0];
4000
4061
  }
4062
+ __name(findMessageInput, "findMessageInput");
4001
4063
  function getInputFromAssetId(inputs, assetId, isBaseAsset = false) {
4002
4064
  const coinInput = findCoinInput(inputs, assetId);
4003
4065
  if (coinInput) {
@@ -4008,6 +4070,7 @@ function getInputFromAssetId(inputs, assetId, isBaseAsset = false) {
4008
4070
  }
4009
4071
  return void 0;
4010
4072
  }
4073
+ __name(getInputFromAssetId, "getInputFromAssetId");
4011
4074
  function getInputContractFromIndex(inputs, inputIndex) {
4012
4075
  if (inputIndex == null) {
4013
4076
  return void 0;
@@ -4017,13 +4080,14 @@ function getInputContractFromIndex(inputs, inputIndex) {
4017
4080
  return void 0;
4018
4081
  }
4019
4082
  if (contractInput.type !== InputType6.Contract) {
4020
- throw new FuelError14(
4083
+ throw new FuelError15(
4021
4084
  ErrorCode11.INVALID_TRANSACTION_INPUT,
4022
4085
  `Contract input should be of type 'contract'.`
4023
4086
  );
4024
4087
  }
4025
4088
  return contractInput;
4026
4089
  }
4090
+ __name(getInputContractFromIndex, "getInputContractFromIndex");
4027
4091
  function getInputAccountAddress(input) {
4028
4092
  if (input.type === InputType6.Coin) {
4029
4093
  return input.owner.toString();
@@ -4033,29 +4097,36 @@ function getInputAccountAddress(input) {
4033
4097
  }
4034
4098
  return "";
4035
4099
  }
4100
+ __name(getInputAccountAddress, "getInputAccountAddress");
4036
4101
 
4037
4102
  // src/providers/transaction-summary/output.ts
4038
4103
  import { OutputType as OutputType7 } from "@fuel-ts/transactions";
4039
4104
  function getOutputsByType(outputs, type) {
4040
4105
  return outputs.filter((o) => o.type === type);
4041
4106
  }
4107
+ __name(getOutputsByType, "getOutputsByType");
4042
4108
  function getOutputsContractCreated(outputs) {
4043
4109
  return getOutputsByType(outputs, OutputType7.ContractCreated);
4044
4110
  }
4111
+ __name(getOutputsContractCreated, "getOutputsContractCreated");
4045
4112
  function getOutputsCoin(outputs) {
4046
4113
  return getOutputsByType(outputs, OutputType7.Coin);
4047
4114
  }
4115
+ __name(getOutputsCoin, "getOutputsCoin");
4048
4116
  function getOutputsChange(outputs) {
4049
4117
  return getOutputsByType(outputs, OutputType7.Change);
4050
4118
  }
4119
+ __name(getOutputsChange, "getOutputsChange");
4051
4120
  function getOutputsContract(outputs) {
4052
4121
  return getOutputsByType(outputs, OutputType7.Contract);
4053
4122
  }
4123
+ __name(getOutputsContract, "getOutputsContract");
4054
4124
 
4055
4125
  // src/providers/transaction-summary/operations.ts
4056
4126
  function getReceiptsByType(receipts, type) {
4057
4127
  return (receipts ?? []).filter((r) => r.type === type);
4058
4128
  }
4129
+ __name(getReceiptsByType, "getReceiptsByType");
4059
4130
  function getTransactionTypeName(transactionType) {
4060
4131
  switch (transactionType) {
4061
4132
  case TransactionType9.Mint:
@@ -4071,40 +4142,50 @@ function getTransactionTypeName(transactionType) {
4071
4142
  case TransactionType9.Upload:
4072
4143
  return "Upload" /* Upload */;
4073
4144
  default:
4074
- throw new FuelError15(
4145
+ throw new FuelError16(
4075
4146
  ErrorCode12.UNSUPPORTED_TRANSACTION_TYPE,
4076
4147
  `Unsupported transaction type: ${transactionType}.`
4077
4148
  );
4078
4149
  }
4079
4150
  }
4151
+ __name(getTransactionTypeName, "getTransactionTypeName");
4080
4152
  function isType(transactionType, type) {
4081
4153
  const txType = getTransactionTypeName(transactionType);
4082
4154
  return txType === type;
4083
4155
  }
4156
+ __name(isType, "isType");
4084
4157
  function isTypeMint(transactionType) {
4085
4158
  return isType(transactionType, "Mint" /* Mint */);
4086
4159
  }
4160
+ __name(isTypeMint, "isTypeMint");
4087
4161
  function isTypeCreate(transactionType) {
4088
4162
  return isType(transactionType, "Create" /* Create */);
4089
4163
  }
4164
+ __name(isTypeCreate, "isTypeCreate");
4090
4165
  function isTypeScript(transactionType) {
4091
4166
  return isType(transactionType, "Script" /* Script */);
4092
4167
  }
4168
+ __name(isTypeScript, "isTypeScript");
4093
4169
  function isTypeUpgrade(transactionType) {
4094
4170
  return isType(transactionType, "Upgrade" /* Upgrade */);
4095
4171
  }
4172
+ __name(isTypeUpgrade, "isTypeUpgrade");
4096
4173
  function isTypeUpload(transactionType) {
4097
4174
  return isType(transactionType, "Upload" /* Upload */);
4098
4175
  }
4176
+ __name(isTypeUpload, "isTypeUpload");
4099
4177
  function isTypeBlob(transactionType) {
4100
4178
  return isType(transactionType, "Blob" /* Blob */);
4101
4179
  }
4180
+ __name(isTypeBlob, "isTypeBlob");
4102
4181
  function getReceiptsCall(receipts) {
4103
4182
  return getReceiptsByType(receipts, ReceiptType5.Call);
4104
4183
  }
4184
+ __name(getReceiptsCall, "getReceiptsCall");
4105
4185
  function getReceiptsMessageOut(receipts) {
4106
4186
  return getReceiptsByType(receipts, ReceiptType5.MessageOut);
4107
4187
  }
4188
+ __name(getReceiptsMessageOut, "getReceiptsMessageOut");
4108
4189
  function mergeAssets(op1, op2) {
4109
4190
  const assets1 = op1.assetsSent || [];
4110
4191
  const assets2 = op2.assetsSent || [];
@@ -4122,21 +4203,25 @@ function mergeAssets(op1, op2) {
4122
4203
  });
4123
4204
  return Array.from(assetMap.values());
4124
4205
  }
4206
+ __name(mergeAssets, "mergeAssets");
4125
4207
  function isSameOperation(a, b) {
4126
4208
  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;
4127
4209
  }
4210
+ __name(isSameOperation, "isSameOperation");
4128
4211
  function mergeAssetsSent(existing, toAdd) {
4129
4212
  if (!toAdd.assetsSent?.length) {
4130
4213
  return existing.assetsSent;
4131
4214
  }
4132
4215
  return existing.assetsSent?.length ? mergeAssets(existing, toAdd) : toAdd.assetsSent;
4133
4216
  }
4217
+ __name(mergeAssetsSent, "mergeAssetsSent");
4134
4218
  function mergeCalls(existing, toAdd) {
4135
4219
  if (!toAdd.calls?.length) {
4136
4220
  return existing.calls;
4137
4221
  }
4138
4222
  return [...existing.calls || [], ...toAdd.calls];
4139
4223
  }
4224
+ __name(mergeCalls, "mergeCalls");
4140
4225
  function mergeOperations(existing, toAdd) {
4141
4226
  return {
4142
4227
  ...existing,
@@ -4148,6 +4233,7 @@ function mergeOperations(existing, toAdd) {
4148
4233
  ]
4149
4234
  };
4150
4235
  }
4236
+ __name(mergeOperations, "mergeOperations");
4151
4237
  function addOperation(operations, toAdd) {
4152
4238
  const existingIndex = operations.findIndex((op) => isSameOperation(op, toAdd));
4153
4239
  if (existingIndex === -1) {
@@ -4155,6 +4241,7 @@ function addOperation(operations, toAdd) {
4155
4241
  }
4156
4242
  return operations.map((op, index) => index === existingIndex ? mergeOperations(op, toAdd) : op);
4157
4243
  }
4244
+ __name(addOperation, "addOperation");
4158
4245
  function getWithdrawFromFuelOperations({
4159
4246
  inputs,
4160
4247
  receipts,
@@ -4193,6 +4280,7 @@ function getWithdrawFromFuelOperations({
4193
4280
  );
4194
4281
  return withdrawFromFuelOperations;
4195
4282
  }
4283
+ __name(getWithdrawFromFuelOperations, "getWithdrawFromFuelOperations");
4196
4284
  function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInputs) {
4197
4285
  const abi = abiMap?.[contractInput.contractID];
4198
4286
  if (!abi) {
@@ -4200,6 +4288,7 @@ function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInpu
4200
4288
  }
4201
4289
  return [];
4202
4290
  }
4291
+ __name(getContractCalls, "getContractCalls");
4203
4292
  function getAssetsSent(receipt) {
4204
4293
  return receipt.amount?.isZero() ? void 0 : [
4205
4294
  {
@@ -4208,6 +4297,7 @@ function getAssetsSent(receipt) {
4208
4297
  }
4209
4298
  ];
4210
4299
  }
4300
+ __name(getAssetsSent, "getAssetsSent");
4211
4301
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
4212
4302
  const assetId = receipt.assetId === ZeroBytes329 ? baseAssetId : receipt.assetId;
4213
4303
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
@@ -4233,6 +4323,7 @@ function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload,
4233
4323
  }
4234
4324
  ];
4235
4325
  }
4326
+ __name(processCallReceipt, "processCallReceipt");
4236
4327
  function getContractCallOperations({
4237
4328
  inputs,
4238
4329
  outputs,
@@ -4262,6 +4353,7 @@ function getContractCallOperations({
4262
4353
  );
4263
4354
  });
4264
4355
  }
4356
+ __name(getContractCallOperations, "getContractCallOperations");
4265
4357
  function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs) {
4266
4358
  const { to: toAddress, assetId, amount } = receipt;
4267
4359
  let { id: fromAddress } = receipt;
@@ -4290,6 +4382,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
4290
4382
  receipts: [receipt]
4291
4383
  };
4292
4384
  }
4385
+ __name(extractTransferOperationFromReceipt, "extractTransferOperationFromReceipt");
4293
4386
  function getTransferOperations({
4294
4387
  inputs,
4295
4388
  outputs,
@@ -4344,6 +4437,7 @@ function getTransferOperations({
4344
4437
  });
4345
4438
  return operations;
4346
4439
  }
4440
+ __name(getTransferOperations, "getTransferOperations");
4347
4441
  function getPayProducerOperations(outputs) {
4348
4442
  const coinOutputs = getOutputsCoin(outputs);
4349
4443
  const payProducerOperations = coinOutputs.reduce((prev, output) => {
@@ -4368,6 +4462,7 @@ function getPayProducerOperations(outputs) {
4368
4462
  }, []);
4369
4463
  return payProducerOperations;
4370
4464
  }
4465
+ __name(getPayProducerOperations, "getPayProducerOperations");
4371
4466
  function getContractCreatedOperations({ inputs, outputs }) {
4372
4467
  const contractCreatedOutputs = getOutputsContractCreated(outputs);
4373
4468
  const input = getInputsCoinAndMessage(inputs)[0];
@@ -4388,6 +4483,7 @@ function getContractCreatedOperations({ inputs, outputs }) {
4388
4483
  }, []);
4389
4484
  return contractCreatedOperations;
4390
4485
  }
4486
+ __name(getContractCreatedOperations, "getContractCreatedOperations");
4391
4487
  function getOperations({
4392
4488
  transactionType,
4393
4489
  inputs,
@@ -4418,10 +4514,11 @@ function getOperations({
4418
4514
  }
4419
4515
  return [...getPayProducerOperations(outputs)];
4420
4516
  }
4517
+ __name(getOperations, "getOperations");
4421
4518
 
4422
4519
  // src/providers/transaction-summary/receipt.ts
4423
4520
  import { ReceiptType as ReceiptType6 } from "@fuel-ts/transactions";
4424
- var extractMintedAssetsFromReceipts = (receipts) => {
4521
+ var extractMintedAssetsFromReceipts = /* @__PURE__ */ __name((receipts) => {
4425
4522
  const mintedAssets = [];
4426
4523
  receipts.forEach((receipt) => {
4427
4524
  if (receipt.type === ReceiptType6.Mint) {
@@ -4434,8 +4531,8 @@ var extractMintedAssetsFromReceipts = (receipts) => {
4434
4531
  }
4435
4532
  });
4436
4533
  return mintedAssets;
4437
- };
4438
- var extractBurnedAssetsFromReceipts = (receipts) => {
4534
+ }, "extractMintedAssetsFromReceipts");
4535
+ var extractBurnedAssetsFromReceipts = /* @__PURE__ */ __name((receipts) => {
4439
4536
  const burnedAssets = [];
4440
4537
  receipts.forEach((receipt) => {
4441
4538
  if (receipt.type === ReceiptType6.Burn) {
@@ -4448,12 +4545,12 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
4448
4545
  }
4449
4546
  });
4450
4547
  return burnedAssets;
4451
- };
4548
+ }, "extractBurnedAssetsFromReceipts");
4452
4549
 
4453
4550
  // src/providers/transaction-summary/status.ts
4454
- import { ErrorCode as ErrorCode13, FuelError as FuelError16 } from "@fuel-ts/errors";
4551
+ import { ErrorCode as ErrorCode13, FuelError as FuelError17 } from "@fuel-ts/errors";
4455
4552
  import { bn as bn14 } from "@fuel-ts/math";
4456
- var getTransactionStatusName = (gqlStatus) => {
4553
+ var getTransactionStatusName = /* @__PURE__ */ __name((gqlStatus) => {
4457
4554
  switch (gqlStatus) {
4458
4555
  case "FailureStatus":
4459
4556
  return "failure" /* failure */;
@@ -4464,13 +4561,13 @@ var getTransactionStatusName = (gqlStatus) => {
4464
4561
  case "SqueezedOutStatus":
4465
4562
  return "squeezedout" /* squeezedout */;
4466
4563
  default:
4467
- throw new FuelError16(
4564
+ throw new FuelError17(
4468
4565
  ErrorCode13.INVALID_TRANSACTION_STATUS,
4469
4566
  `Invalid transaction status: ${gqlStatus}.`
4470
4567
  );
4471
4568
  }
4472
- };
4473
- var processGraphqlStatus = (gqlTransactionStatus) => {
4569
+ }, "getTransactionStatusName");
4570
+ var processGraphqlStatus = /* @__PURE__ */ __name((gqlTransactionStatus) => {
4474
4571
  let time;
4475
4572
  let blockId;
4476
4573
  let status;
@@ -4514,8 +4611,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
4514
4611
  isStatusPending
4515
4612
  };
4516
4613
  return processedGraphqlStatus;
4517
- };
4518
- var getTotalFeeFromStatus = (status) => status && "totalFee" in status ? bn14(status.totalFee) : void 0;
4614
+ }, "processGraphqlStatus");
4615
+ var getTotalFeeFromStatus = /* @__PURE__ */ __name((status) => status && "totalFee" in status ? bn14(status.totalFee) : void 0, "getTotalFeeFromStatus");
4519
4616
 
4520
4617
  // src/providers/transaction-summary/assemble-transaction-summary.ts
4521
4618
  function assembleTransactionSummary(params) {
@@ -4595,21 +4692,35 @@ function assembleTransactionSummary(params) {
4595
4692
  };
4596
4693
  return transactionSummary;
4597
4694
  }
4695
+ __name(assembleTransactionSummary, "assembleTransactionSummary");
4598
4696
 
4599
4697
  // src/providers/transaction-response/getDecodedLogs.ts
4600
4698
  import { Interface as Interface2, BigNumberCoder } from "@fuel-ts/abi-coder";
4699
+ import { ZeroBytes32 as ZeroBytes3210 } from "@fuel-ts/address/configs";
4601
4700
  import { ReceiptType as ReceiptType7 } from "@fuel-ts/transactions";
4602
4701
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
4702
+ let mainContract = "";
4703
+ if (mainAbi.programType === "contract") {
4704
+ const firstCallReceipt = receipts.find(
4705
+ (r) => r.type === ReceiptType7.Call && r.id === ZeroBytes3210
4706
+ );
4707
+ mainContract = firstCallReceipt.to;
4708
+ }
4603
4709
  return receipts.reduce((logs, receipt) => {
4604
4710
  if (receipt.type === ReceiptType7.LogData || receipt.type === ReceiptType7.Log) {
4605
- const interfaceToUse = new Interface2(externalAbis[receipt.id] || mainAbi);
4606
- const data = receipt.type === ReceiptType7.Log ? new BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
4607
- const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
4608
- logs.push(decodedLog);
4711
+ const isLogFromMainAbi = receipt.id === ZeroBytes3210 || mainContract === receipt.id;
4712
+ const isDecodable = isLogFromMainAbi || externalAbis[receipt.id];
4713
+ if (isDecodable) {
4714
+ const interfaceToUse = isLogFromMainAbi ? new Interface2(mainAbi) : new Interface2(externalAbis[receipt.id]);
4715
+ const data = receipt.type === ReceiptType7.Log ? new BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
4716
+ const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
4717
+ logs.push(decodedLog);
4718
+ }
4609
4719
  }
4610
4720
  return logs;
4611
4721
  }, []);
4612
4722
  }
4723
+ __name(getDecodedLogs, "getDecodedLogs");
4613
4724
 
4614
4725
  // src/providers/transaction-response/transaction-response.ts
4615
4726
  function mapGqlOutputsToTxOutputs(outputs) {
@@ -4642,7 +4753,8 @@ function mapGqlOutputsToTxOutputs(outputs) {
4642
4753
  }
4643
4754
  });
4644
4755
  }
4645
- var TransactionResponse = class {
4756
+ __name(mapGqlOutputsToTxOutputs, "mapGqlOutputsToTxOutputs");
4757
+ var TransactionResponse = class _TransactionResponse {
4646
4758
  /**
4647
4759
  * Constructor for `TransactionResponse`.
4648
4760
  *
@@ -4657,6 +4769,9 @@ var TransactionResponse = class {
4657
4769
  this.request = typeof tx === "string" ? void 0 : tx;
4658
4770
  this.waitForResult = this.waitForResult.bind(this);
4659
4771
  }
4772
+ static {
4773
+ __name(this, "TransactionResponse");
4774
+ }
4660
4775
  /** Transaction ID */
4661
4776
  id;
4662
4777
  /** Current provider */
@@ -4678,7 +4793,7 @@ var TransactionResponse = class {
4678
4793
  */
4679
4794
  static async create(id, provider, abis) {
4680
4795
  const chainId = await provider.getChainId();
4681
- const response = new TransactionResponse(id, provider, chainId, abis);
4796
+ const response = new _TransactionResponse(id, provider, chainId, abis);
4682
4797
  await response.fetch();
4683
4798
  return response;
4684
4799
  }
@@ -4810,7 +4925,7 @@ var TransactionResponse = class {
4810
4925
  this.status = statusChange;
4811
4926
  if (statusChange.type === "SqueezedOutStatus") {
4812
4927
  this.unsetResourceCache();
4813
- throw new FuelError17(
4928
+ throw new FuelError18(
4814
4929
  ErrorCode14.TRANSACTION_SQUEEZED_OUT,
4815
4930
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
4816
4931
  );
@@ -4895,6 +5010,7 @@ function getWaitDelay(options, retryAttemptNum) {
4895
5010
  return 2 ** (retryAttemptNum - 1) * duration;
4896
5011
  }
4897
5012
  }
5013
+ __name(getWaitDelay, "getWaitDelay");
4898
5014
  function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4899
5015
  if (options === void 0) {
4900
5016
  return fetchFn;
@@ -4917,9 +5033,10 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4917
5033
  }
4918
5034
  };
4919
5035
  }
5036
+ __name(autoRetryFetch, "autoRetryFetch");
4920
5037
 
4921
5038
  // src/providers/utils/helpers.ts
4922
- var adjustResourcesToExclude = (params) => {
5039
+ var adjustResourcesToExclude = /* @__PURE__ */ __name((params) => {
4923
5040
  const { userInput, cached, maxInputs } = params;
4924
5041
  const final = { ...userInput };
4925
5042
  let total = final.utxos.length + final.messages.length;
@@ -4932,33 +5049,33 @@ var adjustResourcesToExclude = (params) => {
4932
5049
  final.messages = [...final.messages, ...cached.messages.slice(0, maxInputs - total)];
4933
5050
  }
4934
5051
  return final;
4935
- };
5052
+ }, "adjustResourcesToExclude");
4936
5053
 
4937
5054
  // src/providers/utils/validate-pagination-args.ts
4938
- import { FuelError as FuelError18, ErrorCode as ErrorCode15 } from "@fuel-ts/errors";
4939
- var validatePaginationArgs = (params) => {
5055
+ import { FuelError as FuelError19, ErrorCode as ErrorCode15 } from "@fuel-ts/errors";
5056
+ var validatePaginationArgs = /* @__PURE__ */ __name((params) => {
4940
5057
  const { paginationLimit, inputArgs = {} } = params;
4941
5058
  const { first, last, after, before } = inputArgs;
4942
5059
  if (after && before) {
4943
- throw new FuelError18(
5060
+ throw new FuelError19(
4944
5061
  ErrorCode15.INVALID_INPUT_PARAMETERS,
4945
5062
  'Pagination arguments "after" and "before" cannot be used together'
4946
5063
  );
4947
5064
  }
4948
5065
  if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
4949
- throw new FuelError18(
5066
+ throw new FuelError19(
4950
5067
  ErrorCode15.INVALID_INPUT_PARAMETERS,
4951
5068
  `Pagination limit for this query cannot exceed ${paginationLimit} items`
4952
5069
  );
4953
5070
  }
4954
5071
  if (first && before) {
4955
- throw new FuelError18(
5072
+ throw new FuelError19(
4956
5073
  ErrorCode15.INVALID_INPUT_PARAMETERS,
4957
5074
  'The use of pagination argument "first" with "before" is not supported'
4958
5075
  );
4959
5076
  }
4960
5077
  if (last && after) {
4961
- throw new FuelError18(
5078
+ throw new FuelError19(
4962
5079
  ErrorCode15.INVALID_INPUT_PARAMETERS,
4963
5080
  'The use of pagination argument "last" with "after" is not supported'
4964
5081
  );
@@ -4967,18 +5084,71 @@ var validatePaginationArgs = (params) => {
4967
5084
  inputArgs.first = paginationLimit;
4968
5085
  }
4969
5086
  return inputArgs;
4970
- };
5087
+ }, "validatePaginationArgs");
4971
5088
 
4972
5089
  // src/providers/provider.ts
4973
5090
  var MAX_RETRIES = 10;
4974
5091
  var RESOURCES_PAGE_SIZE_LIMIT = 512;
4975
5092
  var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
4976
5093
  var BALANCES_PAGE_SIZE_LIMIT = 100;
5094
+ var NON_PAGINATED_BALANCES_SIZE = 1e4;
4977
5095
  var BLOCKS_PAGE_SIZE_LIMIT = 5;
4978
5096
  var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
4979
5097
  var GAS_USED_MODIFIER = 1.2;
4980
- var _cacheInputs, cacheInputs_fn;
4981
- var _Provider = class {
5098
+ var Provider = class _Provider {
5099
+ static {
5100
+ __name(this, "Provider");
5101
+ }
5102
+ operations;
5103
+ cache;
5104
+ /** @hidden */
5105
+ static clearChainAndNodeCaches() {
5106
+ _Provider.inflightFetchChainAndNodeInfoRequests = {};
5107
+ _Provider.nodeInfoCache = {};
5108
+ _Provider.chainInfoCache = {};
5109
+ }
5110
+ /** @hidden */
5111
+ url;
5112
+ /** @hidden */
5113
+ urlWithoutAuth;
5114
+ /** @hidden */
5115
+ static inflightFetchChainAndNodeInfoRequests = {};
5116
+ /** @hidden */
5117
+ static chainInfoCache = {};
5118
+ /** @hidden */
5119
+ static nodeInfoCache = {};
5120
+ /** @hidden */
5121
+ static incompatibleNodeVersionMessage = "";
5122
+ /** @hidden */
5123
+ consensusParametersTimestamp;
5124
+ options = {
5125
+ timeout: void 0,
5126
+ resourceCacheTTL: void 0,
5127
+ fetch: void 0,
5128
+ retryOptions: void 0,
5129
+ headers: void 0,
5130
+ cache: void 0
5131
+ };
5132
+ /**
5133
+ * @hidden
5134
+ */
5135
+ static getFetchFn(options) {
5136
+ const { retryOptions, timeout, headers } = options;
5137
+ return autoRetryFetch(async (...args) => {
5138
+ const url = args[0];
5139
+ const request = args[1];
5140
+ const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
5141
+ let fullRequest = {
5142
+ ...request,
5143
+ signal,
5144
+ headers: { ...request?.headers, ...headers }
5145
+ };
5146
+ if (options.requestMiddleware) {
5147
+ fullRequest = await options.requestMiddleware(fullRequest);
5148
+ }
5149
+ return options.fetch ? options.fetch(url, fullRequest, options) : fetch(url, fullRequest);
5150
+ }, retryOptions);
5151
+ }
4982
5152
  /**
4983
5153
  * Constructor to initialize a Provider.
4984
5154
  *
@@ -4987,31 +5157,6 @@ var _Provider = class {
4987
5157
  * @hidden
4988
5158
  */
4989
5159
  constructor(url, options = {}) {
4990
- /**
4991
- * @hidden
4992
- */
4993
- __privateAdd(this, _cacheInputs);
4994
- __publicField(this, "operations");
4995
- __publicField(this, "cache");
4996
- /** @hidden */
4997
- __publicField(this, "url");
4998
- /** @hidden */
4999
- __publicField(this, "urlWithoutAuth");
5000
- /** @hidden */
5001
- __publicField(this, "features", {
5002
- balancePagination: false,
5003
- amount128: false
5004
- });
5005
- /** @hidden */
5006
- __publicField(this, "consensusParametersTimestamp");
5007
- __publicField(this, "options", {
5008
- timeout: void 0,
5009
- resourceCacheTTL: void 0,
5010
- fetch: void 0,
5011
- retryOptions: void 0,
5012
- headers: void 0,
5013
- cache: void 0
5014
- });
5015
5160
  const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
5016
5161
  this.url = rawUrl;
5017
5162
  this.urlWithoutAuth = urlWithoutAuth;
@@ -5041,37 +5186,12 @@ var _Provider = class {
5041
5186
  this.cache = new ResourceCache(DEFAULT_RESOURCE_CACHE_TTL);
5042
5187
  }
5043
5188
  }
5044
- /** @hidden */
5045
- static clearChainAndNodeCaches() {
5046
- _Provider.nodeInfoCache = {};
5047
- _Provider.chainInfoCache = {};
5048
- }
5049
- /**
5050
- * @hidden
5051
- */
5052
- static getFetchFn(options) {
5053
- const { retryOptions, timeout, headers } = options;
5054
- return autoRetryFetch(async (...args) => {
5055
- const url = args[0];
5056
- const request = args[1];
5057
- const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
5058
- let fullRequest = {
5059
- ...request,
5060
- signal,
5061
- headers: { ...request?.headers, ...headers }
5062
- };
5063
- if (options.requestMiddleware) {
5064
- fullRequest = await options.requestMiddleware(fullRequest);
5065
- }
5066
- return options.fetch ? options.fetch(url, fullRequest, options) : fetch(url, fullRequest);
5067
- }, retryOptions);
5068
- }
5069
5189
  static extractBasicAuth(url) {
5070
5190
  let parsedUrl;
5071
5191
  try {
5072
5192
  parsedUrl = new URL(url);
5073
5193
  } catch (error) {
5074
- throw new FuelError19(FuelError19.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
5194
+ throw new FuelError20(FuelError20.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
5075
5195
  }
5076
5196
  const username = parsedUrl.username;
5077
5197
  const password = parsedUrl.password;
@@ -5089,8 +5209,7 @@ var _Provider = class {
5089
5209
  * Initialize Provider async stuff
5090
5210
  */
5091
5211
  async init() {
5092
- const { nodeInfo } = await this.fetchChainAndNodeInfo();
5093
- this.setupFeatures(nodeInfo.nodeVersion);
5212
+ await this.fetchChainAndNodeInfo();
5094
5213
  return this;
5095
5214
  }
5096
5215
  /**
@@ -5160,13 +5279,24 @@ var _Provider = class {
5160
5279
  throw new Error(`Jumps to the catch block and re-fetch`);
5161
5280
  }
5162
5281
  } catch (_err) {
5282
+ const inflightRequest = _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
5283
+ if (inflightRequest) {
5284
+ const now2 = await inflightRequest;
5285
+ this.consensusParametersTimestamp = now2;
5286
+ return this.fetchChainAndNodeInfo();
5287
+ }
5288
+ const { promise, resolve } = deferPromise();
5289
+ _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth] = promise;
5163
5290
  const data = await this.operations.getChainAndNodeInfo();
5164
5291
  nodeInfo = deserializeNodeInfo(data.nodeInfo);
5165
- _Provider.setIncompatibleNodeVersionMessage(nodeInfo);
5166
5292
  chain = deserializeChain(data.chain);
5293
+ _Provider.setIncompatibleNodeVersionMessage(nodeInfo);
5167
5294
  _Provider.chainInfoCache[this.urlWithoutAuth] = chain;
5168
5295
  _Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
5169
- this.consensusParametersTimestamp = Date.now();
5296
+ const now = Date.now();
5297
+ this.consensusParametersTimestamp = now;
5298
+ resolve(now);
5299
+ delete _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
5170
5300
  }
5171
5301
  return {
5172
5302
  chain,
@@ -5196,8 +5326,8 @@ var _Provider = class {
5196
5326
  createOperations() {
5197
5327
  const fetchFn = _Provider.getFetchFn(this.options);
5198
5328
  const gqlClient = new GraphQLClient(this.urlWithoutAuth, {
5199
- fetch: (input, requestInit) => fetchFn(input.toString(), requestInit || {}, this.options),
5200
- responseMiddleware: (response) => {
5329
+ fetch: /* @__PURE__ */ __name((input, requestInit) => fetchFn(input.toString(), requestInit || {}, this.options), "fetch"),
5330
+ responseMiddleware: /* @__PURE__ */ __name((response) => {
5201
5331
  if ("response" in response) {
5202
5332
  const graphQlResponse = response.response;
5203
5333
  assertGqlResponseHasNoErrors(
@@ -5205,22 +5335,22 @@ var _Provider = class {
5205
5335
  _Provider.incompatibleNodeVersionMessage
5206
5336
  );
5207
5337
  }
5208
- }
5338
+ }, "responseMiddleware")
5209
5339
  });
5210
- const executeQuery = (query, vars) => {
5340
+ const executeQuery = /* @__PURE__ */ __name((query, vars) => {
5211
5341
  const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
5212
5342
  const isSubscription = opDefinition?.operation === "subscription";
5213
5343
  if (isSubscription) {
5214
5344
  return FuelGraphqlSubscriber.create({
5215
5345
  url: this.urlWithoutAuth,
5216
5346
  query,
5217
- fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
5347
+ fetchFn: /* @__PURE__ */ __name((url, requestInit) => fetchFn(url, requestInit, this.options), "fetchFn"),
5218
5348
  variables: vars
5219
5349
  });
5220
5350
  }
5221
5351
  return gqlClient.request(query, vars);
5222
- };
5223
- const customOperations = (requester) => ({
5352
+ }, "executeQuery");
5353
+ const customOperations = /* @__PURE__ */ __name((requester) => ({
5224
5354
  getBlobs(variables) {
5225
5355
  const queryParams = variables.blobIds.map((_, i) => `$blobId${i}: BlobId!`).join(", ");
5226
5356
  const blobParams = variables.blobIds.map((_, i) => `blob${i}: blob(id: $blobId${i}) { id }`).join("\n");
@@ -5238,18 +5368,9 @@ var _Provider = class {
5238
5368
  `;
5239
5369
  return requester(document, updatedVariables);
5240
5370
  }
5241
- });
5371
+ }), "customOperations");
5242
5372
  return { ...getSdk(executeQuery), ...customOperations(executeQuery) };
5243
5373
  }
5244
- /**
5245
- * @hidden
5246
- */
5247
- setupFeatures(nodeVersion) {
5248
- if (gte(nodeVersion, "0.41.0")) {
5249
- this.features.balancePagination = true;
5250
- this.features.amount128 = true;
5251
- }
5252
- }
5253
5374
  /**
5254
5375
  * Returns the version of the connected node.
5255
5376
  *
@@ -5326,6 +5447,13 @@ var _Provider = class {
5326
5447
  * @returns A promise that resolves to an object containing the asset details.
5327
5448
  */
5328
5449
  async getAssetDetails(assetId) {
5450
+ const { assetMetadata } = await this.getNodeFeatures();
5451
+ if (!assetMetadata) {
5452
+ throw new FuelError20(
5453
+ ErrorCode16.UNSUPPORTED_FEATURE,
5454
+ "The current node does not supports fetching asset details"
5455
+ );
5456
+ }
5329
5457
  const { assetDetails } = await this.operations.getAssetDetails({ assetId });
5330
5458
  const { contractId, subId, totalSupply } = assetDetails;
5331
5459
  return {
@@ -5334,6 +5462,15 @@ var _Provider = class {
5334
5462
  totalSupply: bn17(totalSupply)
5335
5463
  };
5336
5464
  }
5465
+ /**
5466
+ * @hidden
5467
+ */
5468
+ #cacheInputs(inputs, transactionId) {
5469
+ if (!this.cache) {
5470
+ return;
5471
+ }
5472
+ this.cache.set(transactionId, inputs);
5473
+ }
5337
5474
  /**
5338
5475
  * @hidden
5339
5476
  */
@@ -5344,13 +5481,13 @@ var _Provider = class {
5344
5481
  }
5345
5482
  } = await this.getChain();
5346
5483
  if (bn17(tx.inputs.length).gt(maxInputs)) {
5347
- throw new FuelError19(
5484
+ throw new FuelError20(
5348
5485
  ErrorCode16.MAX_INPUTS_EXCEEDED,
5349
5486
  `The transaction exceeds the maximum allowed number of inputs. Tx inputs: ${tx.inputs.length}, max inputs: ${maxInputs}`
5350
5487
  );
5351
5488
  }
5352
5489
  if (bn17(tx.outputs.length).gt(maxOutputs)) {
5353
- throw new FuelError19(
5490
+ throw new FuelError20(
5354
5491
  ErrorCode16.MAX_OUTPUTS_EXCEEDED,
5355
5492
  `The transaction exceeds the maximum allowed number of outputs. Tx outputs: ${tx.outputs.length}, max outputs: ${maxOutputs}`
5356
5493
  );
@@ -5383,7 +5520,10 @@ var _Provider = class {
5383
5520
  abis = transactionRequest.abis;
5384
5521
  }
5385
5522
  const subscription = await this.operations.submitAndAwaitStatus({ encodedTransaction });
5386
- __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionRequest.getTransactionId(await this.getChainId()));
5523
+ this.#cacheInputs(
5524
+ transactionRequest.inputs,
5525
+ transactionRequest.getTransactionId(await this.getChainId())
5526
+ );
5387
5527
  const chainId = await this.getChainId();
5388
5528
  return new TransactionResponse(transactionRequest, this, chainId, abis, subscription);
5389
5529
  }
@@ -6050,7 +6190,7 @@ var _Provider = class {
6050
6190
  0
6051
6191
  )?.[0];
6052
6192
  } catch (error) {
6053
- if (error instanceof FuelError19 && error.code === ErrorCode16.UNSUPPORTED_TRANSACTION_TYPE) {
6193
+ if (error instanceof FuelError20 && error.code === ErrorCode16.UNSUPPORTED_TRANSACTION_TYPE) {
6054
6194
  console.warn("Unsupported transaction type encountered");
6055
6195
  return null;
6056
6196
  }
@@ -6076,7 +6216,7 @@ var _Provider = class {
6076
6216
  try {
6077
6217
  return coder.decode(arrayify13(rawPayload), 0)[0];
6078
6218
  } catch (error) {
6079
- if (error instanceof FuelError19 && error.code === ErrorCode16.UNSUPPORTED_TRANSACTION_TYPE) {
6219
+ if (error instanceof FuelError20 && error.code === ErrorCode16.UNSUPPORTED_TRANSACTION_TYPE) {
6080
6220
  console.warn("Unsupported transaction type encountered");
6081
6221
  return null;
6082
6222
  }
@@ -6135,18 +6275,9 @@ var _Provider = class {
6135
6275
  * @returns A promise that resolves to the balance.
6136
6276
  */
6137
6277
  async getBalance(owner, assetId) {
6138
- const ownerStr = new Address3(owner).toB256();
6139
- const assetIdStr = hexlify18(assetId);
6140
- if (!this.features.amount128) {
6141
- const { balance: balance2 } = await this.operations.getBalance({
6142
- owner: ownerStr,
6143
- assetId: assetIdStr
6144
- });
6145
- return bn17(balance2.amount, 10);
6146
- }
6147
6278
  const { balance } = await this.operations.getBalanceV2({
6148
- owner: ownerStr,
6149
- assetId: assetIdStr
6279
+ owner: new Address3(owner).toB256(),
6280
+ assetId: hexlify18(assetId)
6150
6281
  });
6151
6282
  return bn17(balance.amountU128, 10);
6152
6283
  }
@@ -6158,49 +6289,29 @@ var _Provider = class {
6158
6289
  * @returns A promise that resolves to the balances.
6159
6290
  */
6160
6291
  async getBalances(owner, paginationArgs) {
6161
- if (!this.features.balancePagination) {
6162
- return this.getBalancesV1(owner, paginationArgs);
6292
+ let args = { first: NON_PAGINATED_BALANCES_SIZE };
6293
+ const { balancesPagination: supportsPagination } = await this.getNodeFeatures();
6294
+ if (supportsPagination) {
6295
+ args = validatePaginationArgs({
6296
+ inputArgs: paginationArgs,
6297
+ paginationLimit: BALANCES_PAGE_SIZE_LIMIT
6298
+ });
6163
6299
  }
6164
- return this.getBalancesV2(owner, paginationArgs);
6165
- }
6166
- /**
6167
- * @hidden
6168
- */
6169
- async getBalancesV1(owner, _paginationArgs) {
6170
- const {
6171
- balances: { edges }
6172
- } = await this.operations.getBalances({
6173
- /**
6174
- * The query parameters for this method were designed to support pagination,
6175
- * but the current Fuel-Core implementation does not support pagination yet.
6176
- */
6177
- first: 1e4,
6178
- filter: { owner: new Address3(owner).toB256() }
6179
- });
6180
- const balances = edges.map(({ node }) => ({
6181
- assetId: node.assetId,
6182
- amount: bn17(node.amount)
6183
- }));
6184
- return { balances };
6185
- }
6186
- /**
6187
- * @hidden
6188
- */
6189
- async getBalancesV2(owner, paginationArgs) {
6190
6300
  const {
6191
6301
  balances: { edges, pageInfo }
6192
6302
  } = await this.operations.getBalancesV2({
6193
- ...validatePaginationArgs({
6194
- inputArgs: paginationArgs,
6195
- paginationLimit: BALANCES_PAGE_SIZE_LIMIT
6196
- }),
6197
- filter: { owner: new Address3(owner).toB256() }
6303
+ ...args,
6304
+ filter: { owner: new Address3(owner).toB256() },
6305
+ supportsPagination
6198
6306
  });
6199
6307
  const balances = edges.map(({ node }) => ({
6200
6308
  assetId: node.assetId,
6201
6309
  amount: bn17(node.amountU128)
6202
6310
  }));
6203
- return { balances, pageInfo };
6311
+ return {
6312
+ balances,
6313
+ ...supportsPagination ? { pageInfo } : {}
6314
+ };
6204
6315
  }
6205
6316
  /**
6206
6317
  * Returns message for the given address.
@@ -6254,7 +6365,7 @@ var _Provider = class {
6254
6365
  nonce
6255
6366
  };
6256
6367
  if (commitBlockId && commitBlockHeight) {
6257
- throw new FuelError19(
6368
+ throw new FuelError20(
6258
6369
  ErrorCode16.INVALID_INPUT_PARAMETERS,
6259
6370
  "commitBlockId and commitBlockHeight cannot be used together"
6260
6371
  );
@@ -6487,6 +6598,17 @@ var _Provider = class {
6487
6598
  statusReason: status.reason
6488
6599
  });
6489
6600
  }
6601
+ /**
6602
+ * @hidden
6603
+ */
6604
+ async getNodeFeatures() {
6605
+ const { indexation } = await this.getNode();
6606
+ return {
6607
+ assetMetadata: Boolean(indexation?.assetMetadata),
6608
+ balancesPagination: Boolean(indexation?.balances),
6609
+ coinsToSpend: Boolean(indexation?.coinsToSpend)
6610
+ };
6611
+ }
6490
6612
  /**
6491
6613
  * @hidden
6492
6614
  */
@@ -6501,23 +6623,9 @@ var _Provider = class {
6501
6623
  return transactionRequest;
6502
6624
  }
6503
6625
  };
6504
- var Provider = _Provider;
6505
- _cacheInputs = new WeakSet();
6506
- cacheInputs_fn = function(inputs, transactionId) {
6507
- if (!this.cache) {
6508
- return;
6509
- }
6510
- this.cache.set(transactionId, inputs);
6511
- };
6512
- /** @hidden */
6513
- __publicField(Provider, "chainInfoCache", {});
6514
- /** @hidden */
6515
- __publicField(Provider, "nodeInfoCache", {});
6516
- /** @hidden */
6517
- __publicField(Provider, "incompatibleNodeVersionMessage", "");
6518
6626
 
6519
6627
  // src/providers/transaction-summary/get-transaction-summary.ts
6520
- import { ErrorCode as ErrorCode17, FuelError as FuelError20 } from "@fuel-ts/errors";
6628
+ import { ErrorCode as ErrorCode17, FuelError as FuelError21 } from "@fuel-ts/errors";
6521
6629
  import { bn as bn18 } from "@fuel-ts/math";
6522
6630
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
6523
6631
  import { arrayify as arrayify14 } from "@fuel-ts/utils";
@@ -6530,10 +6638,19 @@ import { arrayify as arrayify15 } from "@fuel-ts/utils";
6530
6638
  // src/test-utils/test-asset-id.ts
6531
6639
  import { randomBytes as randomBytes4 } from "@fuel-ts/crypto";
6532
6640
  import { hexlify as hexlify19 } from "@fuel-ts/utils";
6533
- var _TestAssetId = class {
6641
+ var TestAssetId = class _TestAssetId {
6534
6642
  constructor(value) {
6535
6643
  this.value = value;
6536
6644
  }
6645
+ static {
6646
+ __name(this, "TestAssetId");
6647
+ }
6648
+ static A = new _TestAssetId(
6649
+ "0x0101010101010101010101010101010101010101010101010101010101010101"
6650
+ );
6651
+ static B = new _TestAssetId(
6652
+ "0x0202020202020202020202020202020202020202020202020202020202020202"
6653
+ );
6537
6654
  static random(count = 1) {
6538
6655
  const assetIds = [];
6539
6656
  for (let i = 0; i < count; i++) {
@@ -6542,17 +6659,10 @@ var _TestAssetId = class {
6542
6659
  return assetIds;
6543
6660
  }
6544
6661
  };
6545
- var TestAssetId = _TestAssetId;
6546
- __publicField(TestAssetId, "A", new _TestAssetId(
6547
- "0x0101010101010101010101010101010101010101010101010101010101010101"
6548
- ));
6549
- __publicField(TestAssetId, "B", new _TestAssetId(
6550
- "0x0202020202020202020202020202020202020202020202020202020202020202"
6551
- ));
6552
6662
 
6553
6663
  // src/test-utils/wallet-config.ts
6554
6664
  import { randomBytes as randomBytes8 } from "@fuel-ts/crypto";
6555
- import { FuelError as FuelError26 } from "@fuel-ts/errors";
6665
+ import { FuelError as FuelError27 } from "@fuel-ts/errors";
6556
6666
  import { bn as bn22 } from "@fuel-ts/math";
6557
6667
  import { defaultSnapshotConfigs as defaultSnapshotConfigs2, hexlify as hexlify25 } from "@fuel-ts/utils";
6558
6668
 
@@ -6564,14 +6674,14 @@ import { hexlify as hexlify22 } from "@fuel-ts/utils";
6564
6674
  import { UTXO_ID_LEN as UTXO_ID_LEN3 } from "@fuel-ts/abi-coder";
6565
6675
  import { Address as Address5 } from "@fuel-ts/address";
6566
6676
  import { randomBytes as randomBytes5 } from "@fuel-ts/crypto";
6567
- import { ErrorCode as ErrorCode18, FuelError as FuelError21 } from "@fuel-ts/errors";
6677
+ import { ErrorCode as ErrorCode18, FuelError as FuelError22 } from "@fuel-ts/errors";
6568
6678
  import { bn as bn20 } from "@fuel-ts/math";
6569
6679
  import { InputType as InputType7 } from "@fuel-ts/transactions";
6570
6680
  import { arrayify as arrayify17, hexlify as hexlify20, isDefined as isDefined3 } from "@fuel-ts/utils";
6571
6681
  import { clone as clone9 } from "ramda";
6572
6682
 
6573
6683
  // src/providers/utils/merge-quantities.ts
6574
- var mergeQuantities = (...coinQuantities) => {
6684
+ var mergeQuantities = /* @__PURE__ */ __name((...coinQuantities) => {
6575
6685
  const resultMap = {};
6576
6686
  function addToMap({ amount, assetId }) {
6577
6687
  if (resultMap[assetId]) {
@@ -6580,12 +6690,16 @@ var mergeQuantities = (...coinQuantities) => {
6580
6690
  resultMap[assetId] = amount;
6581
6691
  }
6582
6692
  }
6693
+ __name(addToMap, "addToMap");
6583
6694
  coinQuantities.forEach((arr) => arr.forEach(addToMap));
6584
6695
  return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
6585
- };
6696
+ }, "mergeQuantities");
6586
6697
 
6587
6698
  // src/types.ts
6588
6699
  var AbstractAccount = class {
6700
+ static {
6701
+ __name(this, "AbstractAccount");
6702
+ }
6589
6703
  };
6590
6704
 
6591
6705
  // src/utils/formatTransferToContractScriptData.ts
@@ -6593,7 +6707,7 @@ import { ASSET_ID_LEN, BigNumberCoder as BigNumberCoder2, CONTRACT_ID_LEN, WORD_
6593
6707
  import { Address as Address4 } from "@fuel-ts/address";
6594
6708
  import { arrayify as arrayify16, concat as concat4 } from "@fuel-ts/utils";
6595
6709
  import * as asm from "@fuels/vm-asm";
6596
- var formatTransferToContractScriptData = (transferParams) => {
6710
+ var formatTransferToContractScriptData = /* @__PURE__ */ __name((transferParams) => {
6597
6711
  const numberCoder = new BigNumberCoder2("u64");
6598
6712
  return transferParams.reduce((acc, transferParam) => {
6599
6713
  const { assetId, amount, contractId } = transferParam;
@@ -6601,8 +6715,8 @@ var formatTransferToContractScriptData = (transferParams) => {
6601
6715
  const scriptData = concat4([new Address4(contractId).toBytes(), encoded, arrayify16(assetId)]);
6602
6716
  return concat4([acc, scriptData]);
6603
6717
  }, new Uint8Array());
6604
- };
6605
- var assembleTransferToContractScript = async (transferParams) => {
6718
+ }, "formatTransferToContractScriptData");
6719
+ var assembleTransferToContractScript = /* @__PURE__ */ __name(async (transferParams) => {
6606
6720
  const scriptData = formatTransferToContractScriptData(transferParams);
6607
6721
  await asm.initWasm();
6608
6722
  let script = new Uint8Array();
@@ -6626,11 +6740,14 @@ var assembleTransferToContractScript = async (transferParams) => {
6626
6740
  });
6627
6741
  script = concat4([script, asm.ret(1).to_bytes()]);
6628
6742
  return { script, scriptData };
6629
- };
6743
+ }, "assembleTransferToContractScript");
6630
6744
 
6631
6745
  // src/account.ts
6632
6746
  var MAX_FUNDING_ATTEMPTS = 5;
6633
6747
  var Account = class extends AbstractAccount {
6748
+ static {
6749
+ __name(this, "Account");
6750
+ }
6634
6751
  /**
6635
6752
  * The address associated with the account.
6636
6753
  */
@@ -6665,7 +6782,7 @@ var Account = class extends AbstractAccount {
6665
6782
  */
6666
6783
  get provider() {
6667
6784
  if (!this._provider) {
6668
- throw new FuelError21(ErrorCode18.MISSING_PROVIDER, "Provider not set");
6785
+ throw new FuelError22(ErrorCode18.MISSING_PROVIDER, "Provider not set");
6669
6786
  }
6670
6787
  return this._provider;
6671
6788
  }
@@ -6824,7 +6941,7 @@ var Account = class extends AbstractAccount {
6824
6941
  fundingAttempts += 1;
6825
6942
  }
6826
6943
  if (needsToBeFunded) {
6827
- throw new FuelError21(
6944
+ throw new FuelError22(
6828
6945
  ErrorCode18.INSUFFICIENT_FUNDS_OR_MAX_COINS,
6829
6946
  `The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
6830
6947
  );
@@ -6944,7 +7061,7 @@ var Account = class extends AbstractAccount {
6944
7061
  const contractAddress = new Address5(transferParam.contractId);
6945
7062
  const assetId = transferParam.assetId ? hexlify20(transferParam.assetId) : defaultAssetId;
6946
7063
  if (amount.lte(0)) {
6947
- throw new FuelError21(
7064
+ throw new FuelError22(
6948
7065
  ErrorCode18.INVALID_TRANSFER_AMOUNT,
6949
7066
  "Transfer amount must be a positive number."
6950
7067
  );
@@ -7014,7 +7131,7 @@ var Account = class extends AbstractAccount {
7014
7131
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
7015
7132
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
7016
7133
  const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: bn20("100000000000000000") }];
7017
- const findAssetInput = (assetId) => txRequestClone.inputs.find((input) => {
7134
+ const findAssetInput = /* @__PURE__ */ __name((assetId) => txRequestClone.inputs.find((input) => {
7018
7135
  if (input.type === InputType7.Coin) {
7019
7136
  return input.assetId === assetId;
7020
7137
  }
@@ -7022,8 +7139,8 @@ var Account = class extends AbstractAccount {
7022
7139
  return baseAssetId === assetId;
7023
7140
  }
7024
7141
  return false;
7025
- });
7026
- const updateAssetInput = (assetId, quantity) => {
7142
+ }), "findAssetInput");
7143
+ const updateAssetInput = /* @__PURE__ */ __name((assetId, quantity) => {
7027
7144
  const assetInput = findAssetInput(assetId);
7028
7145
  const usedQuantity = quantity;
7029
7146
  if (assetInput && "amount" in assetInput) {
@@ -7038,7 +7155,7 @@ var Account = class extends AbstractAccount {
7038
7155
  ])
7039
7156
  );
7040
7157
  }
7041
- };
7158
+ }, "updateAssetInput");
7042
7159
  mergeQuantities(requiredQuantities, transactionFeeForDryRun).forEach(
7043
7160
  ({ amount, assetId }) => updateAssetInput(assetId, amount)
7044
7161
  );
@@ -7061,7 +7178,7 @@ var Account = class extends AbstractAccount {
7061
7178
  */
7062
7179
  async signMessage(message) {
7063
7180
  if (!this._connector) {
7064
- throw new FuelError21(ErrorCode18.MISSING_CONNECTOR, "A connector is required to sign messages.");
7181
+ throw new FuelError22(ErrorCode18.MISSING_CONNECTOR, "A connector is required to sign messages.");
7065
7182
  }
7066
7183
  return this._connector.signMessage(this.address.toString(), message);
7067
7184
  }
@@ -7073,7 +7190,7 @@ var Account = class extends AbstractAccount {
7073
7190
  */
7074
7191
  async signTransaction(transactionRequestLike) {
7075
7192
  if (!this._connector) {
7076
- throw new FuelError21(
7193
+ throw new FuelError22(
7077
7194
  ErrorCode18.MISSING_CONNECTOR,
7078
7195
  "A connector is required to sign transactions."
7079
7196
  );
@@ -7170,7 +7287,7 @@ var Account = class extends AbstractAccount {
7170
7287
  /** @hidden * */
7171
7288
  validateTransferAmount(amount) {
7172
7289
  if (bn20(amount).lte(0)) {
7173
- throw new FuelError21(
7290
+ throw new FuelError22(
7174
7291
  ErrorCode18.INVALID_TRANSFER_AMOUNT,
7175
7292
  "Transfer amount must be a positive number."
7176
7293
  );
@@ -7200,7 +7317,7 @@ var Account = class extends AbstractAccount {
7200
7317
  if (!isDefined3(setGasLimit)) {
7201
7318
  request.gasLimit = gasUsed;
7202
7319
  } else if (gasUsed.gt(setGasLimit)) {
7203
- throw new FuelError21(
7320
+ throw new FuelError22(
7204
7321
  ErrorCode18.GAS_LIMIT_TOO_LOW,
7205
7322
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
7206
7323
  );
@@ -7208,7 +7325,7 @@ var Account = class extends AbstractAccount {
7208
7325
  if (!isDefined3(setMaxFee)) {
7209
7326
  request.maxFee = maxFee;
7210
7327
  } else if (maxFee.gt(setMaxFee)) {
7211
- throw new FuelError21(
7328
+ throw new FuelError22(
7212
7329
  ErrorCode18.MAX_FEE_TOO_LOW,
7213
7330
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
7214
7331
  );
@@ -7229,19 +7346,19 @@ import {
7229
7346
  encryptJsonWalletData,
7230
7347
  randomUUID as randomUUID2
7231
7348
  } from "@fuel-ts/crypto";
7232
- import { ErrorCode as ErrorCode19, FuelError as FuelError22 } from "@fuel-ts/errors";
7349
+ import { ErrorCode as ErrorCode19, FuelError as FuelError23 } from "@fuel-ts/errors";
7233
7350
  import { hexlify as hexlify21 } from "@fuel-ts/utils";
7234
7351
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
7235
7352
  var DEFAULT_KDF_PARAMS_R = 8;
7236
7353
  var DEFAULT_KDF_PARAMS_P = 1;
7237
7354
  var DEFAULT_KEY_SIZE = 32;
7238
7355
  var DEFAULT_IV_SIZE = 16;
7239
- var removeHexPrefix = (hexString) => {
7356
+ var removeHexPrefix = /* @__PURE__ */ __name((hexString) => {
7240
7357
  if (/^0x/.test(hexString)) {
7241
7358
  return hexString.slice(2);
7242
7359
  }
7243
7360
  return hexString;
7244
- };
7361
+ }, "removeHexPrefix");
7245
7362
  async function encryptKeystoreWallet(privateKey, address, password) {
7246
7363
  const privateKeyBuffer = bufferFromString(removeHexPrefix(privateKey), "hex");
7247
7364
  const ownerAddress = new Address6(address);
@@ -7280,6 +7397,7 @@ async function encryptKeystoreWallet(privateKey, address, password) {
7280
7397
  };
7281
7398
  return JSON.stringify(keystore);
7282
7399
  }
7400
+ __name(encryptKeystoreWallet, "encryptKeystoreWallet");
7283
7401
  async function decryptKeystoreWallet(jsonWallet, password) {
7284
7402
  const keystoreWallet = JSON.parse(jsonWallet);
7285
7403
  const {
@@ -7306,7 +7424,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
7306
7424
  const macHashUint8Array = keccak256(data);
7307
7425
  const macHash = stringFromBuffer(macHashUint8Array, "hex");
7308
7426
  if (mac !== macHash) {
7309
- throw new FuelError22(
7427
+ throw new FuelError23(
7310
7428
  ErrorCode19.INVALID_PASSWORD,
7311
7429
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
7312
7430
  );
@@ -7315,9 +7433,17 @@ async function decryptKeystoreWallet(jsonWallet, password) {
7315
7433
  const privateKey = hexlify21(buffer);
7316
7434
  return privateKey;
7317
7435
  }
7436
+ __name(decryptKeystoreWallet, "decryptKeystoreWallet");
7318
7437
 
7319
7438
  // src/wallet/base-wallet-unlocked.ts
7320
7439
  var BaseWalletUnlocked = class extends Account {
7440
+ static {
7441
+ __name(this, "BaseWalletUnlocked");
7442
+ }
7443
+ /**
7444
+ * Default HDWallet path.
7445
+ */
7446
+ static defaultPath = "m/44'/1179993420'/0'/0/0";
7321
7447
  /**
7322
7448
  * A function that returns the wallet's signer.
7323
7449
  */
@@ -7435,21 +7561,17 @@ var BaseWalletUnlocked = class extends Account {
7435
7561
  return encryptKeystoreWallet(this.privateKey, this.address, password);
7436
7562
  }
7437
7563
  };
7438
- /**
7439
- * Default HDWallet path.
7440
- */
7441
- __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
7442
7564
 
7443
7565
  // src/hdwallet/hdwallet.ts
7444
7566
  import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
7445
- import { ErrorCode as ErrorCode22, FuelError as FuelError25 } from "@fuel-ts/errors";
7567
+ import { ErrorCode as ErrorCode22, FuelError as FuelError26 } from "@fuel-ts/errors";
7446
7568
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
7447
7569
  import { bn as bn21, toBytes as toBytes2, toHex } from "@fuel-ts/math";
7448
7570
  import { arrayify as arrayify20, hexlify as hexlify24, concat as concat6, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
7449
7571
 
7450
7572
  // src/mnemonic/mnemonic.ts
7451
7573
  import { randomBytes as randomBytes7, pbkdf2, computeHmac } from "@fuel-ts/crypto";
7452
- import { ErrorCode as ErrorCode21, FuelError as FuelError24 } from "@fuel-ts/errors";
7574
+ import { ErrorCode as ErrorCode21, FuelError as FuelError25 } from "@fuel-ts/errors";
7453
7575
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
7454
7576
  import { arrayify as arrayify19, hexlify as hexlify23, concat as concat5, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
7455
7577
 
@@ -9506,27 +9628,31 @@ var english = [
9506
9628
  ];
9507
9629
 
9508
9630
  // src/mnemonic/utils.ts
9509
- import { ErrorCode as ErrorCode20, FuelError as FuelError23 } from "@fuel-ts/errors";
9631
+ import { ErrorCode as ErrorCode20, FuelError as FuelError24 } from "@fuel-ts/errors";
9510
9632
  import { sha256 as sha2562 } from "@fuel-ts/hasher";
9511
9633
  import { arrayify as arrayify18 } from "@fuel-ts/utils";
9512
9634
  function getLowerMask(bits) {
9513
9635
  return (1 << bits) - 1;
9514
9636
  }
9637
+ __name(getLowerMask, "getLowerMask");
9515
9638
  function getUpperMask(bits) {
9516
9639
  return (1 << bits) - 1 << 8 - bits;
9517
9640
  }
9641
+ __name(getUpperMask, "getUpperMask");
9518
9642
  function getWords(mnemonic) {
9519
9643
  if (!Array.isArray(mnemonic)) {
9520
9644
  return mnemonic.split(/\s+/);
9521
9645
  }
9522
9646
  return mnemonic;
9523
9647
  }
9648
+ __name(getWords, "getWords");
9524
9649
  function getPhrase(mnemonic) {
9525
9650
  if (Array.isArray(mnemonic)) {
9526
9651
  return mnemonic.join(" ");
9527
9652
  }
9528
9653
  return mnemonic;
9529
9654
  }
9655
+ __name(getPhrase, "getPhrase");
9530
9656
  function entropyToMnemonicIndices(entropy) {
9531
9657
  const indices = [0];
9532
9658
  let remainingBits = 11;
@@ -9548,6 +9674,7 @@ function entropyToMnemonicIndices(entropy) {
9548
9674
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
9549
9675
  return indices;
9550
9676
  }
9677
+ __name(entropyToMnemonicIndices, "entropyToMnemonicIndices");
9551
9678
  function mnemonicWordsToEntropy(words, wordlist) {
9552
9679
  const size = Math.ceil(11 * words.length / 8);
9553
9680
  const entropy = arrayify18(new Uint8Array(size));
@@ -9555,7 +9682,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
9555
9682
  for (let i = 0; i < words.length; i += 1) {
9556
9683
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
9557
9684
  if (index === -1) {
9558
- throw new FuelError23(
9685
+ throw new FuelError24(
9559
9686
  ErrorCode20.INVALID_MNEMONIC,
9560
9687
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
9561
9688
  );
@@ -9572,13 +9699,14 @@ function mnemonicWordsToEntropy(words, wordlist) {
9572
9699
  const checksumMask = getUpperMask(checksumBits);
9573
9700
  const checksum = arrayify18(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9574
9701
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
9575
- throw new FuelError23(
9702
+ throw new FuelError24(
9576
9703
  ErrorCode20.INVALID_CHECKSUM,
9577
9704
  "Checksum validation failed for the provided mnemonic."
9578
9705
  );
9579
9706
  }
9580
9707
  return entropy.slice(0, entropyBits / 8);
9581
9708
  }
9709
+ __name(mnemonicWordsToEntropy, "mnemonicWordsToEntropy");
9582
9710
 
9583
9711
  // src/mnemonic/mnemonic.ts
9584
9712
  var MasterSecret = toUtf8Bytes("Bitcoin seed");
@@ -9587,29 +9715,35 @@ var TestnetPRV = "0x04358394";
9587
9715
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
9588
9716
  function assertWordList(wordlist) {
9589
9717
  if (wordlist.length !== 2048) {
9590
- throw new FuelError24(
9718
+ throw new FuelError25(
9591
9719
  ErrorCode21.INVALID_WORD_LIST,
9592
9720
  `Expected word list length of 2048, but got ${wordlist.length}.`
9593
9721
  );
9594
9722
  }
9595
9723
  }
9724
+ __name(assertWordList, "assertWordList");
9596
9725
  function assertEntropy(entropy) {
9597
9726
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
9598
- throw new FuelError24(
9727
+ throw new FuelError25(
9599
9728
  ErrorCode21.INVALID_ENTROPY,
9600
9729
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
9601
9730
  );
9602
9731
  }
9603
9732
  }
9733
+ __name(assertEntropy, "assertEntropy");
9604
9734
  function assertMnemonic(words) {
9605
9735
  if (!MNEMONIC_SIZES.includes(words.length)) {
9606
9736
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
9607
9737
  ", "
9608
9738
  )}] words, but got ${words.length}.`;
9609
- throw new FuelError24(ErrorCode21.INVALID_MNEMONIC, errorMsg);
9739
+ throw new FuelError25(ErrorCode21.INVALID_MNEMONIC, errorMsg);
9610
9740
  }
9611
9741
  }
9612
- var Mnemonic = class {
9742
+ __name(assertMnemonic, "assertMnemonic");
9743
+ var Mnemonic = class _Mnemonic {
9744
+ static {
9745
+ __name(this, "Mnemonic");
9746
+ }
9613
9747
  wordlist;
9614
9748
  /**
9615
9749
  *
@@ -9626,7 +9760,7 @@ var Mnemonic = class {
9626
9760
  * @returns Entropy hash
9627
9761
  */
9628
9762
  mnemonicToEntropy(phrase) {
9629
- return Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
9763
+ return _Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
9630
9764
  }
9631
9765
  /**
9632
9766
  *
@@ -9634,7 +9768,7 @@ var Mnemonic = class {
9634
9768
  * @returns Mnemonic phrase
9635
9769
  */
9636
9770
  entropyToMnemonic(entropy) {
9637
- return Mnemonic.entropyToMnemonic(entropy, this.wordlist);
9771
+ return _Mnemonic.entropyToMnemonic(entropy, this.wordlist);
9638
9772
  }
9639
9773
  /**
9640
9774
  *
@@ -9675,8 +9809,8 @@ var Mnemonic = class {
9675
9809
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
9676
9810
  */
9677
9811
  static mnemonicToMasterKeys(phrase, passphrase = "") {
9678
- const seed = Mnemonic.mnemonicToSeed(phrase, passphrase);
9679
- return Mnemonic.masterKeysFromSeed(seed);
9812
+ const seed = _Mnemonic.mnemonicToSeed(phrase, passphrase);
9813
+ return _Mnemonic.masterKeysFromSeed(seed);
9680
9814
  }
9681
9815
  /**
9682
9816
  * Validates if given mnemonic is valid
@@ -9692,7 +9826,7 @@ var Mnemonic = class {
9692
9826
  return false;
9693
9827
  }
9694
9828
  while (i < words.length) {
9695
- if (Mnemonic.binarySearch(words[i]) === false) {
9829
+ if (_Mnemonic.binarySearch(words[i]) === false) {
9696
9830
  return false;
9697
9831
  }
9698
9832
  i += 1;
@@ -9724,7 +9858,7 @@ var Mnemonic = class {
9724
9858
  static masterKeysFromSeed(seed) {
9725
9859
  const seedArray = arrayify19(seed);
9726
9860
  if (seedArray.length < 16 || seedArray.length > 64) {
9727
- throw new FuelError24(
9861
+ throw new FuelError25(
9728
9862
  ErrorCode21.INVALID_SEED,
9729
9863
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
9730
9864
  );
@@ -9739,7 +9873,7 @@ var Mnemonic = class {
9739
9873
  * @returns BIP-32 extended private key
9740
9874
  */
9741
9875
  static seedToExtendedKey(seed, testnet = false) {
9742
- const masterKey = Mnemonic.masterKeysFromSeed(seed);
9876
+ const masterKey = _Mnemonic.masterKeysFromSeed(seed);
9743
9877
  const prefix = arrayify19(testnet ? TestnetPRV : MainnetPRV);
9744
9878
  const depth = "0x00";
9745
9879
  const fingerprint = "0x00000000";
@@ -9771,7 +9905,7 @@ var Mnemonic = class {
9771
9905
  */
9772
9906
  static generate(size = 32, extraEntropy = "") {
9773
9907
  const entropy = extraEntropy ? sha2563(concat5([randomBytes7(size), arrayify19(extraEntropy)])) : randomBytes7(size);
9774
- return Mnemonic.entropyToMnemonic(entropy);
9908
+ return _Mnemonic.entropyToMnemonic(entropy);
9775
9909
  }
9776
9910
  };
9777
9911
  var mnemonic_default = Mnemonic;
@@ -9785,24 +9919,28 @@ var TestnetPUB = hexlify24("0x043587cf");
9785
9919
  function base58check(data) {
9786
9920
  return encodeBase582(concat6([data, dataSlice2(sha2564(sha2564(data)), 0, 4)]));
9787
9921
  }
9922
+ __name(base58check, "base58check");
9788
9923
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9789
9924
  if (isPublic) {
9790
9925
  return testnet ? TestnetPUB : MainnetPUB;
9791
9926
  }
9792
9927
  return testnet ? TestnetPRV2 : MainnetPRV2;
9793
9928
  }
9929
+ __name(getExtendedKeyPrefix, "getExtendedKeyPrefix");
9794
9930
  function isPublicExtendedKey(extendedKey) {
9795
9931
  return [MainnetPUB, TestnetPUB].includes(hexlify24(extendedKey.slice(0, 4)));
9796
9932
  }
9933
+ __name(isPublicExtendedKey, "isPublicExtendedKey");
9797
9934
  function isValidExtendedKey(extendedKey) {
9798
9935
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9799
9936
  hexlify24(extendedKey.slice(0, 4))
9800
9937
  );
9801
9938
  }
9939
+ __name(isValidExtendedKey, "isValidExtendedKey");
9802
9940
  function parsePath(path2, depth = 0) {
9803
9941
  const components = path2.split("/");
9804
9942
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
9805
- throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, `invalid path - ${path2}`);
9943
+ throw new FuelError26(ErrorCode22.HD_WALLET_ERROR, `invalid path - ${path2}`);
9806
9944
  }
9807
9945
  if (components[0] === "m") {
9808
9946
  components.shift();
@@ -9811,7 +9949,11 @@ function parsePath(path2, depth = 0) {
9811
9949
  (p) => ~p.indexOf(`'`) ? parseInt(p, 10) + HARDENED_INDEX : parseInt(p, 10)
9812
9950
  );
9813
9951
  }
9814
- var HDWallet = class {
9952
+ __name(parsePath, "parsePath");
9953
+ var HDWallet = class _HDWallet {
9954
+ static {
9955
+ __name(this, "HDWallet");
9956
+ }
9815
9957
  depth = 0;
9816
9958
  index = 0;
9817
9959
  fingerprint = hexlify24("0x00000000");
@@ -9831,7 +9973,7 @@ var HDWallet = class {
9831
9973
  this.privateKey = hexlify24(config.privateKey);
9832
9974
  } else {
9833
9975
  if (!config.publicKey) {
9834
- throw new FuelError25(
9976
+ throw new FuelError26(
9835
9977
  ErrorCode22.HD_WALLET_ERROR,
9836
9978
  "Both public and private Key cannot be missing. At least one should be provided."
9837
9979
  );
@@ -9861,7 +10003,7 @@ var HDWallet = class {
9861
10003
  const data = new Uint8Array(37);
9862
10004
  if (index & HARDENED_INDEX) {
9863
10005
  if (!privateKey) {
9864
- throw new FuelError25(
10006
+ throw new FuelError26(
9865
10007
  ErrorCode22.HD_WALLET_ERROR,
9866
10008
  "Cannot derive a hardened index without a private Key."
9867
10009
  );
@@ -9877,7 +10019,7 @@ var HDWallet = class {
9877
10019
  if (privateKey) {
9878
10020
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
9879
10021
  const ki = bn21(IL).add(privateKey).mod(N).toBytes(32);
9880
- return new HDWallet({
10022
+ return new _HDWallet({
9881
10023
  privateKey: ki,
9882
10024
  chainCode: IR,
9883
10025
  index,
@@ -9887,7 +10029,7 @@ var HDWallet = class {
9887
10029
  }
9888
10030
  const signer = new Signer(hexlify24(IL));
9889
10031
  const Ki = signer.addPoint(publicKey);
9890
- return new HDWallet({
10032
+ return new _HDWallet({
9891
10033
  publicKey: Ki,
9892
10034
  chainCode: IR,
9893
10035
  index,
@@ -9914,7 +10056,7 @@ var HDWallet = class {
9914
10056
  */
9915
10057
  toExtendedKey(isPublic = false, testnet = false) {
9916
10058
  if (this.depth >= 256) {
9917
- throw new FuelError25(
10059
+ throw new FuelError26(
9918
10060
  ErrorCode22.HD_WALLET_ERROR,
9919
10061
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
9920
10062
  );
@@ -9936,7 +10078,7 @@ var HDWallet = class {
9936
10078
  */
9937
10079
  static fromSeed(seed) {
9938
10080
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
9939
- return new HDWallet({
10081
+ return new _HDWallet({
9940
10082
  chainCode: arrayify20(masterKey.slice(32)),
9941
10083
  privateKey: arrayify20(masterKey.slice(0, 32))
9942
10084
  });
@@ -9946,10 +10088,10 @@ var HDWallet = class {
9946
10088
  const bytes = arrayify20(decoded);
9947
10089
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9948
10090
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
9949
- throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
10091
+ throw new FuelError26(ErrorCode22.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
9950
10092
  }
9951
10093
  if (!validChecksum) {
9952
- throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
10094
+ throw new FuelError26(ErrorCode22.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
9953
10095
  }
9954
10096
  const depth = bytes[4];
9955
10097
  const parentFingerprint = hexlify24(bytes.slice(5, 9));
@@ -9957,16 +10099,16 @@ var HDWallet = class {
9957
10099
  const chainCode = hexlify24(bytes.slice(13, 45));
9958
10100
  const key = bytes.slice(45, 78);
9959
10101
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
9960
- throw new FuelError25(
10102
+ throw new FuelError26(
9961
10103
  ErrorCode22.HD_WALLET_ERROR,
9962
10104
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
9963
10105
  );
9964
10106
  }
9965
10107
  if (isPublicExtendedKey(bytes)) {
9966
10108
  if (key[0] !== 3) {
9967
- throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, "Invalid public extended key.");
10109
+ throw new FuelError26(ErrorCode22.HD_WALLET_ERROR, "Invalid public extended key.");
9968
10110
  }
9969
- return new HDWallet({
10111
+ return new _HDWallet({
9970
10112
  publicKey: key,
9971
10113
  chainCode,
9972
10114
  index,
@@ -9975,9 +10117,9 @@ var HDWallet = class {
9975
10117
  });
9976
10118
  }
9977
10119
  if (key[0] !== 0) {
9978
- throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, "Invalid private extended key.");
10120
+ throw new FuelError26(ErrorCode22.HD_WALLET_ERROR, "Invalid private extended key.");
9979
10121
  }
9980
- return new HDWallet({
10122
+ return new _HDWallet({
9981
10123
  privateKey: key.slice(1),
9982
10124
  chainCode,
9983
10125
  index,
@@ -9990,6 +10132,9 @@ var hdwallet_default = HDWallet;
9990
10132
 
9991
10133
  // src/wallet/wallets.ts
9992
10134
  var WalletLocked = class extends Account {
10135
+ static {
10136
+ __name(this, "WalletLocked");
10137
+ }
9993
10138
  /**
9994
10139
  * Unlocks the wallet using the provided private key and returns an instance of WalletUnlocked.
9995
10140
  *
@@ -10000,7 +10145,10 @@ var WalletLocked = class extends Account {
10000
10145
  return new WalletUnlocked(privateKey, this._provider);
10001
10146
  }
10002
10147
  };
10003
- var WalletUnlocked = class extends BaseWalletUnlocked {
10148
+ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
10149
+ static {
10150
+ __name(this, "WalletUnlocked");
10151
+ }
10004
10152
  /**
10005
10153
  * Locks the wallet and returns an instance of WalletLocked.
10006
10154
  *
@@ -10018,7 +10166,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10018
10166
  */
10019
10167
  static generate(generateOptions) {
10020
10168
  const privateKey = Signer.generatePrivateKey(generateOptions?.entropy);
10021
- return new WalletUnlocked(privateKey, generateOptions?.provider);
10169
+ return new _WalletUnlocked(privateKey, generateOptions?.provider);
10022
10170
  }
10023
10171
  /**
10024
10172
  * Create a Wallet Unlocked from a seed.
@@ -10030,8 +10178,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10030
10178
  */
10031
10179
  static fromSeed(seed, path2, provider) {
10032
10180
  const hdWallet = hdwallet_default.fromSeed(seed);
10033
- const childWallet = hdWallet.derivePath(path2 || WalletUnlocked.defaultPath);
10034
- return new WalletUnlocked(childWallet.privateKey, provider);
10181
+ const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
10182
+ return new _WalletUnlocked(childWallet.privateKey, provider);
10035
10183
  }
10036
10184
  /**
10037
10185
  * Create a Wallet Unlocked from a mnemonic phrase.
@@ -10045,8 +10193,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10045
10193
  static fromMnemonic(mnemonic, path2, passphrase, provider) {
10046
10194
  const seed = mnemonic_default.mnemonicToSeed(mnemonic, passphrase);
10047
10195
  const hdWallet = hdwallet_default.fromSeed(seed);
10048
- const childWallet = hdWallet.derivePath(path2 || WalletUnlocked.defaultPath);
10049
- return new WalletUnlocked(childWallet.privateKey, provider);
10196
+ const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
10197
+ return new _WalletUnlocked(childWallet.privateKey, provider);
10050
10198
  }
10051
10199
  /**
10052
10200
  * Create a Wallet Unlocked from an extended key.
@@ -10057,7 +10205,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10057
10205
  */
10058
10206
  static fromExtendedKey(extendedKey, provider) {
10059
10207
  const hdWallet = hdwallet_default.fromExtendedKey(extendedKey);
10060
- return new WalletUnlocked(hdWallet.privateKey, provider);
10208
+ return new _WalletUnlocked(hdWallet.privateKey, provider);
10061
10209
  }
10062
10210
  /**
10063
10211
  * Create a Wallet Unlocked from an encrypted JSON.
@@ -10069,12 +10217,15 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10069
10217
  */
10070
10218
  static async fromEncryptedJson(jsonWallet, password, provider) {
10071
10219
  const privateKey = await decryptKeystoreWallet(jsonWallet, password);
10072
- return new WalletUnlocked(privateKey, provider);
10220
+ return new _WalletUnlocked(privateKey, provider);
10073
10221
  }
10074
10222
  };
10075
10223
 
10076
10224
  // src/wallet/wallet.ts
10077
10225
  var Wallet = class {
10226
+ static {
10227
+ __name(this, "Wallet");
10228
+ }
10078
10229
  /**
10079
10230
  * Creates a locked wallet instance from an address and a provider.
10080
10231
  *
@@ -10095,71 +10246,74 @@ var Wallet = class {
10095
10246
  static fromPrivateKey(privateKey, provider) {
10096
10247
  return new WalletUnlocked(privateKey, provider);
10097
10248
  }
10249
+ /**
10250
+ * Generate a new Wallet Unlocked with a random key pair.
10251
+ *
10252
+ * @param generateOptions - Options to customize the generation process (optional).
10253
+ * @returns An unlocked wallet instance.
10254
+ */
10255
+ static generate = WalletUnlocked.generate;
10256
+ /**
10257
+ * Create a Wallet Unlocked from a seed.
10258
+ *
10259
+ * @param seed - The seed phrase.
10260
+ * @param provider - A Provider instance (optional).
10261
+ * @param path - The derivation path (optional).
10262
+ * @returns An unlocked wallet instance.
10263
+ */
10264
+ static fromSeed = WalletUnlocked.fromSeed;
10265
+ /**
10266
+ * Create a Wallet Unlocked from a mnemonic phrase.
10267
+ *
10268
+ * @param mnemonic - The mnemonic phrase.
10269
+ * @param provider - A Provider instance (optional).
10270
+ * @param path - The derivation path (optional).
10271
+ * @param passphrase - The passphrase for the mnemonic (optional).
10272
+ * @returns An unlocked wallet instance.
10273
+ */
10274
+ static fromMnemonic = WalletUnlocked.fromMnemonic;
10275
+ /**
10276
+ * Create a Wallet Unlocked from an extended key.
10277
+ *
10278
+ * @param extendedKey - The extended key.
10279
+ * @param provider - A Provider instance (optional).
10280
+ * @returns An unlocked wallet instance.
10281
+ */
10282
+ static fromExtendedKey = WalletUnlocked.fromExtendedKey;
10283
+ /**
10284
+ * Create a Wallet Unlocked from an encrypted JSON.
10285
+ *
10286
+ * @param jsonWallet - The encrypted JSON keystore.
10287
+ * @param password - The password to decrypt the JSON.
10288
+ * @param provider - A Provider instance (optional).
10289
+ * @returns An unlocked wallet instance.
10290
+ */
10291
+ static fromEncryptedJson = WalletUnlocked.fromEncryptedJson;
10098
10292
  };
10099
- /**
10100
- * Generate a new Wallet Unlocked with a random key pair.
10101
- *
10102
- * @param generateOptions - Options to customize the generation process (optional).
10103
- * @returns An unlocked wallet instance.
10104
- */
10105
- __publicField(Wallet, "generate", WalletUnlocked.generate);
10106
- /**
10107
- * Create a Wallet Unlocked from a seed.
10108
- *
10109
- * @param seed - The seed phrase.
10110
- * @param provider - A Provider instance (optional).
10111
- * @param path - The derivation path (optional).
10112
- * @returns An unlocked wallet instance.
10113
- */
10114
- __publicField(Wallet, "fromSeed", WalletUnlocked.fromSeed);
10115
- /**
10116
- * Create a Wallet Unlocked from a mnemonic phrase.
10117
- *
10118
- * @param mnemonic - The mnemonic phrase.
10119
- * @param provider - A Provider instance (optional).
10120
- * @param path - The derivation path (optional).
10121
- * @param passphrase - The passphrase for the mnemonic (optional).
10122
- * @returns An unlocked wallet instance.
10123
- */
10124
- __publicField(Wallet, "fromMnemonic", WalletUnlocked.fromMnemonic);
10125
- /**
10126
- * Create a Wallet Unlocked from an extended key.
10127
- *
10128
- * @param extendedKey - The extended key.
10129
- * @param provider - A Provider instance (optional).
10130
- * @returns An unlocked wallet instance.
10131
- */
10132
- __publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
10133
- /**
10134
- * Create a Wallet Unlocked from an encrypted JSON.
10135
- *
10136
- * @param jsonWallet - The encrypted JSON keystore.
10137
- * @param password - The password to decrypt the JSON.
10138
- * @param provider - A Provider instance (optional).
10139
- * @returns An unlocked wallet instance.
10140
- */
10141
- __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
10142
10293
 
10143
10294
  // src/test-utils/wallet-config.ts
10144
- var WalletsConfig = class {
10295
+ var WalletsConfig = class _WalletsConfig {
10296
+ static {
10297
+ __name(this, "WalletsConfig");
10298
+ }
10145
10299
  initialState;
10146
10300
  options;
10147
10301
  wallets;
10148
- generateWallets = () => {
10302
+ generateWallets = /* @__PURE__ */ __name(() => {
10149
10303
  const generatedWallets = [];
10150
10304
  for (let index = 1; index <= this.options.count; index++) {
10151
10305
  generatedWallets.push(new WalletUnlocked(randomBytes8(32)));
10152
10306
  }
10153
10307
  return generatedWallets;
10154
- };
10308
+ }, "generateWallets");
10155
10309
  constructor(baseAssetId, config) {
10156
- WalletsConfig.validate(config);
10310
+ _WalletsConfig.validate(config);
10157
10311
  this.options = config;
10158
10312
  const { assets, coinsPerAsset, amountPerCoin, messages } = this.options;
10159
10313
  this.wallets = this.generateWallets();
10160
10314
  this.initialState = {
10161
- messages: WalletsConfig.createMessages(this.wallets, messages),
10162
- coins: WalletsConfig.createCoins(
10315
+ messages: _WalletsConfig.createMessages(this.wallets, messages),
10316
+ coins: _WalletsConfig.createCoins(
10163
10317
  this.wallets,
10164
10318
  baseAssetId,
10165
10319
  assets,
@@ -10219,26 +10373,26 @@ var WalletsConfig = class {
10219
10373
  amountPerCoin
10220
10374
  }) {
10221
10375
  if (Array.isArray(wallets) && wallets.length === 0 || typeof wallets === "number" && wallets <= 0) {
10222
- throw new FuelError26(
10223
- FuelError26.CODES.INVALID_INPUT_PARAMETERS,
10376
+ throw new FuelError27(
10377
+ FuelError27.CODES.INVALID_INPUT_PARAMETERS,
10224
10378
  "Number of wallets must be greater than zero."
10225
10379
  );
10226
10380
  }
10227
10381
  if (Array.isArray(assets) && assets.length === 0 || typeof assets === "number" && assets <= 0) {
10228
- throw new FuelError26(
10229
- FuelError26.CODES.INVALID_INPUT_PARAMETERS,
10382
+ throw new FuelError27(
10383
+ FuelError27.CODES.INVALID_INPUT_PARAMETERS,
10230
10384
  "Number of assets per wallet must be greater than zero."
10231
10385
  );
10232
10386
  }
10233
10387
  if (coinsPerAsset <= 0) {
10234
- throw new FuelError26(
10235
- FuelError26.CODES.INVALID_INPUT_PARAMETERS,
10388
+ throw new FuelError27(
10389
+ FuelError27.CODES.INVALID_INPUT_PARAMETERS,
10236
10390
  "Number of coins per asset must be greater than zero."
10237
10391
  );
10238
10392
  }
10239
10393
  if (bn22(amountPerCoin).lt(0)) {
10240
- throw new FuelError26(
10241
- FuelError26.CODES.INVALID_INPUT_PARAMETERS,
10394
+ throw new FuelError27(
10395
+ FuelError27.CODES.INVALID_INPUT_PARAMETERS,
10242
10396
  "Amount per coin must be greater than or equal to zero."
10243
10397
  );
10244
10398
  }
@@ -10281,9 +10435,9 @@ async function setupTestProviderAndWallets({
10281
10435
  if (launchNodeServerPort) {
10282
10436
  const serverUrl = `http://localhost:${launchNodeServerPort}`;
10283
10437
  url = await (await fetch(serverUrl, { method: "POST", body: JSON.stringify(launchNodeOptions) })).text();
10284
- cleanup = () => {
10438
+ cleanup = /* @__PURE__ */ __name(() => {
10285
10439
  fetch(`${serverUrl}/cleanup/${url}`);
10286
- };
10440
+ }, "cleanup");
10287
10441
  } else {
10288
10442
  const settings = await launchNode(launchNodeOptions);
10289
10443
  url = settings.url;
@@ -10308,6 +10462,7 @@ async function setupTestProviderAndWallets({
10308
10462
  [Symbol.dispose]: cleanup
10309
10463
  };
10310
10464
  }
10465
+ __name(setupTestProviderAndWallets, "setupTestProviderAndWallets");
10311
10466
 
10312
10467
  // src/test-utils/test-message.ts
10313
10468
  import { Address as Address7 } from "@fuel-ts/address";
@@ -10315,6 +10470,9 @@ import { randomBytes as randomBytes9 } from "@fuel-ts/crypto";
10315
10470
  import { bn as bn23 } from "@fuel-ts/math";
10316
10471
  import { hexlify as hexlify26 } from "@fuel-ts/utils";
10317
10472
  var TestMessage = class {
10473
+ static {
10474
+ __name(this, "TestMessage");
10475
+ }
10318
10476
  sender;
10319
10477
  recipient;
10320
10478
  nonce;