@fuel-ts/account 0.100.1 → 0.100.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,31 +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 __privateGet = (obj, member, getter) => {
12
- __accessCheck(obj, member, "read from private field");
13
- return getter ? getter.call(obj) : member.get(obj);
14
- };
15
- var __privateAdd = (obj, member, value) => {
16
- if (member.has(obj))
17
- throw TypeError("Cannot add the same private member more than once");
18
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
19
- };
20
- var __privateSet = (obj, member, value, setter) => {
21
- __accessCheck(obj, member, "write to private field");
22
- setter ? setter.call(obj, value) : member.set(obj, value);
23
- return value;
24
- };
25
- var __privateMethod = (obj, member, method) => {
26
- __accessCheck(obj, member, "access private method");
27
- return method;
28
- };
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
29
3
 
30
4
  // src/providers/chains.ts
31
5
  var CHAIN_IDS = {
@@ -42,7 +16,7 @@ var CHAIN_IDS = {
42
16
  };
43
17
 
44
18
  // src/assets/utils/network.ts
45
- var getDefaultChainId = (networkType) => {
19
+ var getDefaultChainId = /* @__PURE__ */ __name((networkType) => {
46
20
  if (networkType === "ethereum") {
47
21
  return CHAIN_IDS.eth.sepolia;
48
22
  }
@@ -50,8 +24,8 @@ var getDefaultChainId = (networkType) => {
50
24
  return CHAIN_IDS.fuel.testnet;
51
25
  }
52
26
  return void 0;
53
- };
54
- var getAssetNetwork = ({
27
+ }, "getDefaultChainId");
28
+ var getAssetNetwork = /* @__PURE__ */ __name(({
55
29
  asset,
56
30
  chainId,
57
31
  networkType
@@ -60,8 +34,8 @@ var getAssetNetwork = ({
60
34
  (item) => item.chainId === chainId && item.type === networkType
61
35
  );
62
36
  return network;
63
- };
64
- var getAssetWithNetwork = ({
37
+ }, "getAssetNetwork");
38
+ var getAssetWithNetwork = /* @__PURE__ */ __name(({
65
39
  asset,
66
40
  chainId,
67
41
  networkType
@@ -83,22 +57,22 @@ var getAssetWithNetwork = ({
83
57
  ...assetRest,
84
58
  ...assetNetwork
85
59
  };
86
- };
87
- var getAssetEth = (asset, chainId) => getAssetWithNetwork({
60
+ }, "getAssetWithNetwork");
61
+ var getAssetEth = /* @__PURE__ */ __name((asset, chainId) => getAssetWithNetwork({
88
62
  asset,
89
63
  networkType: "ethereum",
90
64
  chainId
91
- });
92
- var getAssetFuel = (asset, chainId) => getAssetWithNetwork({
65
+ }), "getAssetEth");
66
+ var getAssetFuel = /* @__PURE__ */ __name((asset, chainId) => getAssetWithNetwork({
93
67
  asset,
94
68
  networkType: "fuel",
95
69
  chainId
96
- });
70
+ }), "getAssetFuel");
97
71
 
98
72
  // src/assets/utils/url.ts
99
73
  var DELIMITER_PATH = "/";
100
74
  var trimRegex = /^\/|\/$/g;
101
- var trimPath = (path = "") => path.replace(trimRegex, "");
75
+ var trimPath = /* @__PURE__ */ __name((path = "") => path.replace(trimRegex, ""), "trimPath");
102
76
  function urlJoin(baseUrl, ...paths) {
103
77
  const hasBaseUrl = baseUrl !== null && baseUrl !== void 0;
104
78
  const rootPath = baseUrl?.[0] === "/" && baseUrl.length > 1;
@@ -108,6 +82,7 @@ function urlJoin(baseUrl, ...paths) {
108
82
  }
109
83
  return allPaths.join(DELIMITER_PATH);
110
84
  }
85
+ __name(urlJoin, "urlJoin");
111
86
 
112
87
  // src/assets/utils/resolveIconPaths.ts
113
88
  function resolveIconPaths(assets2, basePath = "./") {
@@ -116,6 +91,7 @@ function resolveIconPaths(assets2, basePath = "./") {
116
91
  icon: urlJoin(basePath, asset.icon)
117
92
  }));
118
93
  }
94
+ __name(resolveIconPaths, "resolveIconPaths");
119
95
 
120
96
  // src/assets/utils/fuelAssetsBaseUrl.ts
121
97
  var fuelAssetsBaseUrl = "https://assets.fuel.network/providers/";
@@ -690,7 +666,7 @@ var networks = {
690
666
  mainnet: "https://mainnet-explorer.fuel.network",
691
667
  testnet: "https://explorer-indexer-testnet.fuel.network"
692
668
  };
693
- var request = async (url, slug) => {
669
+ var request = /* @__PURE__ */ __name(async (url, slug) => {
694
670
  const response = await fetch(`${url}${slug}`, {
695
671
  headers: {
696
672
  "Content-Type": "application/json",
@@ -702,20 +678,20 @@ var request = async (url, slug) => {
702
678
  } catch (error) {
703
679
  return null;
704
680
  }
705
- };
706
- var buildQueryString = (parameters) => {
681
+ }, "request");
682
+ var buildQueryString = /* @__PURE__ */ __name((parameters) => {
707
683
  const query = new URLSearchParams();
708
684
  Object.entries(parameters).forEach(([key, value]) => {
709
685
  query.set(key, value.toString());
710
686
  });
711
687
  return query.size > 0 ? `?${query.toString()}` : "";
712
- };
713
- var getAssetById = (opts) => {
688
+ }, "buildQueryString");
689
+ var getAssetById = /* @__PURE__ */ __name((opts) => {
714
690
  const { network = "mainnet", assetId } = opts;
715
691
  const url = networks[network];
716
692
  return request(url, `/assets/${assetId}`);
717
- };
718
- var getAssetsByOwner = async (opts) => {
693
+ }, "getAssetById");
694
+ var getAssetsByOwner = /* @__PURE__ */ __name(async (opts) => {
719
695
  const { network = "mainnet", owner, pagination = { last: 10 } } = opts;
720
696
  const url = networks[network];
721
697
  const { last } = pagination;
@@ -725,7 +701,7 @@ var getAssetsByOwner = async (opts) => {
725
701
  return { data: [], pageInfo: { count: 0 } };
726
702
  }
727
703
  return response;
728
- };
704
+ }, "getAssetsByOwner");
729
705
 
730
706
  // src/account.ts
731
707
  import { UTXO_ID_LEN as UTXO_ID_LEN3 } from "@fuel-ts/abi-coder";
@@ -740,7 +716,7 @@ import { clone as clone9 } from "ramda";
740
716
  // src/providers/coin-quantity.ts
741
717
  import { bn } from "@fuel-ts/math";
742
718
  import { hexlify } from "@fuel-ts/utils";
743
- var coinQuantityfy = (coinQuantityLike) => {
719
+ var coinQuantityfy = /* @__PURE__ */ __name((coinQuantityLike) => {
744
720
  let assetId;
745
721
  let amount;
746
722
  let max;
@@ -758,8 +734,8 @@ var coinQuantityfy = (coinQuantityLike) => {
758
734
  amount: bn(amount),
759
735
  max: max ? bn(max) : void 0
760
736
  };
761
- };
762
- var addAmountToCoinQuantities = (params) => {
737
+ }, "coinQuantityfy");
738
+ var addAmountToCoinQuantities = /* @__PURE__ */ __name((params) => {
763
739
  const { amount, assetId } = params;
764
740
  const coinQuantities = [...params.coinQuantities];
765
741
  const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
@@ -769,7 +745,7 @@ var addAmountToCoinQuantities = (params) => {
769
745
  coinQuantities.push({ assetId, amount });
770
746
  }
771
747
  return coinQuantities;
772
- };
748
+ }, "addAmountToCoinQuantities");
773
749
 
774
750
  // src/providers/provider.ts
775
751
  import { Address as Address2, isB256 } from "@fuel-ts/address";
@@ -777,7 +753,7 @@ import { ErrorCode as ErrorCode16, FuelError as FuelError19 } from "@fuel-ts/err
777
753
  import { bn as bn17 } from "@fuel-ts/math";
778
754
  import { InputMessageCoder as InputMessageCoder2, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
779
755
  import { arrayify as arrayify12, hexlify as hexlify16, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
780
- import { checkFuelCoreVersionCompatibility, gte, versions } from "@fuel-ts/versions";
756
+ import { checkFuelCoreVersionCompatibility, versions } from "@fuel-ts/versions";
781
757
  import { GraphQLClient } from "graphql-request";
782
758
  import gql2 from "graphql-tag";
783
759
  import { clone as clone8 } from "ramda";
@@ -792,6 +768,7 @@ function deferPromise() {
792
768
  });
793
769
  return defer;
794
770
  }
771
+ __name(deferPromise, "deferPromise");
795
772
  async function withTimeout(promise, timeout = 1050) {
796
773
  const timeoutPromise = new Promise((resolve, reject) => {
797
774
  setTimeout(() => {
@@ -800,6 +777,7 @@ async function withTimeout(promise, timeout = 1050) {
800
777
  });
801
778
  return Promise.race([timeoutPromise, promise]);
802
779
  }
780
+ __name(withTimeout, "withTimeout");
803
781
 
804
782
  // src/providers/__generated__/operations.ts
805
783
  import gql from "graphql-tag";
@@ -1292,6 +1270,11 @@ var NodeInfoFragmentDoc = gql`
1292
1270
  maxTx
1293
1271
  maxDepth
1294
1272
  nodeVersion
1273
+ indexation {
1274
+ balances
1275
+ coinsToSpend
1276
+ assetMetadata
1277
+ }
1295
1278
  }
1296
1279
  `;
1297
1280
  var RelayedTransactionStatusFragmentDoc = gql`
@@ -1573,7 +1556,7 @@ var GetBalancesDocument = gql`
1573
1556
  }
1574
1557
  `;
1575
1558
  var GetBalancesV2Document = gql`
1576
- query getBalancesV2($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
1559
+ query getBalancesV2($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int, $supportsPagination: Boolean!) {
1577
1560
  balances(
1578
1561
  filter: $filter
1579
1562
  after: $after
@@ -1581,7 +1564,7 @@ var GetBalancesV2Document = gql`
1581
1564
  first: $first
1582
1565
  last: $last
1583
1566
  ) {
1584
- pageInfo {
1567
+ pageInfo @include(if: $supportsPagination) {
1585
1568
  ...pageInfoFragment
1586
1569
  }
1587
1570
  edges {
@@ -1851,6 +1834,7 @@ function getSdk(requester) {
1851
1834
  }
1852
1835
  };
1853
1836
  }
1837
+ __name(getSdk, "getSdk");
1854
1838
 
1855
1839
  // src/providers/fuel-graphql-subscriber.ts
1856
1840
  import { ErrorCode as ErrorCode2, FuelError as FuelError3 } from "@fuel-ts/errors";
@@ -1858,7 +1842,7 @@ import { print } from "graphql";
1858
1842
 
1859
1843
  // src/providers/utils/handle-gql-error-message.ts
1860
1844
  import { ErrorCode, FuelError as FuelError2 } from "@fuel-ts/errors";
1861
- var mapGqlErrorMessage = (error) => {
1845
+ var mapGqlErrorMessage = /* @__PURE__ */ __name((error) => {
1862
1846
  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)) {
1863
1847
  return new FuelError2(
1864
1848
  ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
@@ -1876,8 +1860,8 @@ var mapGqlErrorMessage = (error) => {
1876
1860
  );
1877
1861
  }
1878
1862
  return new FuelError2(ErrorCode.INVALID_REQUEST, error.message, {}, error);
1879
- };
1880
- var mapGqlErrorWithIncompatibleNodeVersion = (error, incompatibleNodeVersionMessage) => {
1863
+ }, "mapGqlErrorMessage");
1864
+ var mapGqlErrorWithIncompatibleNodeVersion = /* @__PURE__ */ __name((error, incompatibleNodeVersionMessage) => {
1881
1865
  if (!incompatibleNodeVersionMessage) {
1882
1866
  return error;
1883
1867
  }
@@ -1889,8 +1873,8 @@ ${incompatibleNodeVersionMessage}`,
1889
1873
  error.metadata,
1890
1874
  error.rawError
1891
1875
  );
1892
- };
1893
- var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = false) => {
1876
+ }, "mapGqlErrorWithIncompatibleNodeVersion");
1877
+ var assertGqlResponseHasNoErrors = /* @__PURE__ */ __name((errors, incompatibleNodeVersionMessage = false) => {
1894
1878
  if (!Array.isArray(errors)) {
1895
1879
  return;
1896
1880
  }
@@ -1903,13 +1887,18 @@ var assertGqlResponseHasNoErrors = (errors, incompatibleNodeVersionMessage = fal
1903
1887
  new FuelError2(ErrorCode.INVALID_REQUEST, errorMessage, {}, mappedErrors),
1904
1888
  incompatibleNodeVersionMessage
1905
1889
  );
1906
- };
1890
+ }, "assertGqlResponseHasNoErrors");
1907
1891
 
1908
1892
  // src/providers/fuel-graphql-subscriber.ts
1909
- var _FuelGraphqlSubscriber = class {
1893
+ var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
1910
1894
  constructor(stream) {
1911
1895
  this.stream = stream;
1912
1896
  }
1897
+ static {
1898
+ __name(this, "FuelGraphqlSubscriber");
1899
+ }
1900
+ static incompatibleNodeVersionMessage = false;
1901
+ static textDecoder = new TextDecoder();
1913
1902
  static async create(options) {
1914
1903
  const { url, query, variables, fetchFn } = options;
1915
1904
  const response = await fetchFn(`${url}-sub`, {
@@ -1970,9 +1959,6 @@ var _FuelGraphqlSubscriber = class {
1970
1959
  return this;
1971
1960
  }
1972
1961
  };
1973
- var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
1974
- __publicField(FuelGraphqlSubscriber, "incompatibleNodeVersionMessage", false);
1975
- __publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
1976
1962
 
1977
1963
  // src/providers/resource-cache.ts
1978
1964
  import { FuelError as FuelError13, ErrorCode as ErrorCode10 } from "@fuel-ts/errors";
@@ -1985,7 +1971,7 @@ import { ErrorCode as ErrorCode3, FuelError as FuelError4 } from "@fuel-ts/error
1985
1971
  import { bn as bn2, toNumber } from "@fuel-ts/math";
1986
1972
  import { InputType } from "@fuel-ts/transactions";
1987
1973
  import { arrayify, hexlify as hexlify2 } from "@fuel-ts/utils";
1988
- var inputify = (value) => {
1974
+ var inputify = /* @__PURE__ */ __name((value) => {
1989
1975
  const { type } = value;
1990
1976
  switch (value.type) {
1991
1977
  case InputType.Coin: {
@@ -2051,7 +2037,7 @@ var inputify = (value) => {
2051
2037
  );
2052
2038
  }
2053
2039
  }
2054
- };
2040
+ }, "inputify");
2055
2041
 
2056
2042
  // src/providers/transaction-request/output.ts
2057
2043
  import { ZeroBytes32 as ZeroBytes322 } from "@fuel-ts/address/configs";
@@ -2059,7 +2045,7 @@ import { ErrorCode as ErrorCode4, FuelError as FuelError5 } from "@fuel-ts/error
2059
2045
  import { bn as bn3 } from "@fuel-ts/math";
2060
2046
  import { OutputType } from "@fuel-ts/transactions";
2061
2047
  import { hexlify as hexlify3 } from "@fuel-ts/utils";
2062
- var outputify = (value) => {
2048
+ var outputify = /* @__PURE__ */ __name((value) => {
2063
2049
  const { type } = value;
2064
2050
  switch (type) {
2065
2051
  case OutputType.Coin: {
@@ -2108,7 +2094,7 @@ var outputify = (value) => {
2108
2094
  );
2109
2095
  }
2110
2096
  }
2111
- };
2097
+ }, "outputify");
2112
2098
 
2113
2099
  // src/providers/transaction-request/transaction-request.ts
2114
2100
  import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
@@ -2127,13 +2113,13 @@ import {
2127
2113
  import { concat, hexlify as hexlify8, isDefined } from "@fuel-ts/utils";
2128
2114
 
2129
2115
  // src/providers/message.ts
2130
- var isMessageCoin = (message) => !("data" in message);
2116
+ var isMessageCoin = /* @__PURE__ */ __name((message) => !("data" in message), "isMessageCoin");
2131
2117
 
2132
2118
  // src/providers/resource.ts
2133
- var isRawCoin = (resource) => "utxoId" in resource;
2134
- var isRawMessage = (resource) => "recipient" in resource;
2135
- var isCoin = (resource) => "id" in resource;
2136
- var isMessage = (resource) => "recipient" in resource;
2119
+ var isRawCoin = /* @__PURE__ */ __name((resource) => "utxoId" in resource, "isRawCoin");
2120
+ var isRawMessage = /* @__PURE__ */ __name((resource) => "recipient" in resource, "isRawMessage");
2121
+ var isCoin = /* @__PURE__ */ __name((resource) => "id" in resource, "isCoin");
2122
+ var isMessage = /* @__PURE__ */ __name((resource) => "recipient" in resource, "isMessage");
2137
2123
 
2138
2124
  // src/providers/utils/receipts.ts
2139
2125
  import { ReceiptType as ReceiptType2 } from "@fuel-ts/transactions";
@@ -2145,7 +2131,7 @@ import { ErrorCode as ErrorCode5, FuelError as FuelError6 } from "@fuel-ts/error
2145
2131
  import { bn as bn4 } from "@fuel-ts/math";
2146
2132
  import { getMintedAssetId, InputMessageCoder, ReceiptType } from "@fuel-ts/transactions";
2147
2133
  import { hexlify as hexlify4, arrayify as arrayify2 } from "@fuel-ts/utils";
2148
- var deserializeChain = (chain) => {
2134
+ var deserializeChain = /* @__PURE__ */ __name((chain) => {
2149
2135
  const { name, daHeight, consensusParameters } = chain;
2150
2136
  const {
2151
2137
  contractParams,
@@ -2199,8 +2185,8 @@ var deserializeChain = (chain) => {
2199
2185
  gasCosts
2200
2186
  }
2201
2187
  };
2202
- };
2203
- var serializeChain = (chain) => {
2188
+ }, "deserializeChain");
2189
+ var serializeChain = /* @__PURE__ */ __name((chain) => {
2204
2190
  const { name, baseChainHeight, consensusParameters } = chain;
2205
2191
  const {
2206
2192
  contractParameters,
@@ -2254,39 +2240,41 @@ var serializeChain = (chain) => {
2254
2240
  gasCosts
2255
2241
  }
2256
2242
  };
2257
- };
2258
- var deserializeNodeInfo = (nodeInfo) => {
2259
- const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
2243
+ }, "serializeChain");
2244
+ var deserializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
2245
+ const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace, indexation } = nodeInfo;
2260
2246
  return {
2261
2247
  maxDepth: bn4(maxDepth),
2262
2248
  maxTx: bn4(maxTx),
2263
2249
  nodeVersion,
2264
2250
  utxoValidation,
2265
- vmBacktrace
2251
+ vmBacktrace,
2252
+ indexation
2266
2253
  };
2267
- };
2268
- var serializeNodeInfo = (nodeInfo) => {
2269
- const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
2254
+ }, "deserializeNodeInfo");
2255
+ var serializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
2256
+ const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace, indexation } = nodeInfo;
2270
2257
  return {
2271
2258
  maxDepth: maxDepth.toString(),
2272
2259
  maxTx: maxTx.toString(),
2273
2260
  nodeVersion,
2274
2261
  utxoValidation,
2275
- vmBacktrace
2262
+ vmBacktrace,
2263
+ indexation
2276
2264
  };
2277
- };
2278
- var deserializeProviderCache = (cache2) => ({
2265
+ }, "serializeNodeInfo");
2266
+ var deserializeProviderCache = /* @__PURE__ */ __name((cache2) => ({
2279
2267
  consensusParametersTimestamp: cache2.consensusParametersTimestamp,
2280
2268
  chain: deserializeChain(cache2.chain),
2281
2269
  nodeInfo: deserializeNodeInfo(cache2.nodeInfo)
2282
- });
2283
- var serializeProviderCache = async (provider) => ({
2270
+ }), "deserializeProviderCache");
2271
+ var serializeProviderCache = /* @__PURE__ */ __name(async (provider) => ({
2284
2272
  consensusParametersTimestamp: provider.consensusParametersTimestamp,
2285
2273
  chain: serializeChain(await provider.getChain()),
2286
2274
  nodeInfo: serializeNodeInfo(await provider.getNode())
2287
- });
2288
- var hexOrZero = (hex) => hex || ZeroBytes323;
2289
- var deserializeReceipt = (receipt) => {
2275
+ }), "serializeProviderCache");
2276
+ var hexOrZero = /* @__PURE__ */ __name((hex) => hex || ZeroBytes323, "hexOrZero");
2277
+ var deserializeReceipt = /* @__PURE__ */ __name((receipt) => {
2290
2278
  const { receiptType } = receipt;
2291
2279
  switch (receiptType) {
2292
2280
  case "CALL" /* Call */: {
@@ -2478,12 +2466,12 @@ var deserializeReceipt = (receipt) => {
2478
2466
  default:
2479
2467
  throw new FuelError6(ErrorCode5.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
2480
2468
  }
2481
- };
2469
+ }, "deserializeReceipt");
2482
2470
 
2483
2471
  // src/providers/utils/receipts.ts
2484
- var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType2.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
2485
- var doesReceiptHaveMissingContractId = (receipt) => receipt.type === ReceiptType2.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
2486
- var getReceiptsWithMissingData = (receipts) => receipts.reduce(
2472
+ var doesReceiptHaveMissingOutputVariables = /* @__PURE__ */ __name((receipt) => receipt.type === ReceiptType2.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL, "doesReceiptHaveMissingOutputVariables");
2473
+ var doesReceiptHaveMissingContractId = /* @__PURE__ */ __name((receipt) => receipt.type === ReceiptType2.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000", "doesReceiptHaveMissingContractId");
2474
+ var getReceiptsWithMissingData = /* @__PURE__ */ __name((receipts) => receipts.reduce(
2487
2475
  (memo, receipt) => {
2488
2476
  if (doesReceiptHaveMissingOutputVariables(receipt)) {
2489
2477
  memo.missingOutputVariables.push(receipt);
@@ -2497,13 +2485,13 @@ var getReceiptsWithMissingData = (receipts) => receipts.reduce(
2497
2485
  missingOutputVariables: [],
2498
2486
  missingOutputContractIds: []
2499
2487
  }
2500
- );
2501
- var assembleReceiptByType = (gqlReceipt) => deserializeReceipt(gqlReceipt);
2488
+ ), "getReceiptsWithMissingData");
2489
+ var assembleReceiptByType = /* @__PURE__ */ __name((gqlReceipt) => deserializeReceipt(gqlReceipt), "assembleReceiptByType");
2502
2490
 
2503
2491
  // src/providers/utils/block-explorer.ts
2504
2492
  import { ErrorCode as ErrorCode6, FuelError as FuelError7 } from "@fuel-ts/errors";
2505
2493
  var DEFAULT_BLOCK_EXPLORER_URL = "https://app.fuel.network";
2506
- var getPathFromInput = (key, value) => {
2494
+ var getPathFromInput = /* @__PURE__ */ __name((key, value) => {
2507
2495
  const pathMap = {
2508
2496
  address: `address`,
2509
2497
  txId: `transaction`,
@@ -2511,8 +2499,8 @@ var getPathFromInput = (key, value) => {
2511
2499
  };
2512
2500
  const path = pathMap[key] || key;
2513
2501
  return `${path}/${value}`;
2514
- };
2515
- var buildBlockExplorerUrl = (options = {}) => {
2502
+ }, "getPathFromInput");
2503
+ var buildBlockExplorerUrl = /* @__PURE__ */ __name((options = {}) => {
2516
2504
  const { blockExplorerUrl, path, providerUrl, address, txId, blockNumber } = options;
2517
2505
  const explorerUrl = blockExplorerUrl || DEFAULT_BLOCK_EXPLORER_URL;
2518
2506
  const customInputParams = [
@@ -2560,19 +2548,19 @@ var buildBlockExplorerUrl = (options = {}) => {
2560
2548
  const providerUrlProtocol = cleanProviderUrl?.match(/^https?:\/\//) ? "" : "https://";
2561
2549
  const url = `${protocol}${cleanBlockExplorerUrl}/${cleanPath}${encodedProviderUrl ? `?providerUrl=${providerUrlProtocol}${encodedProviderUrl}` : ""}`;
2562
2550
  return url;
2563
- };
2551
+ }, "buildBlockExplorerUrl");
2564
2552
 
2565
2553
  // src/providers/utils/gas.ts
2566
2554
  import { bn as bn5 } from "@fuel-ts/math";
2567
2555
  import { ReceiptType as ReceiptType3 } from "@fuel-ts/transactions";
2568
2556
  import { arrayify as arrayify3 } from "@fuel-ts/utils";
2569
- var getGasUsedFromReceipts = (receipts) => {
2557
+ var getGasUsedFromReceipts = /* @__PURE__ */ __name((receipts) => {
2570
2558
  const scriptResult = receipts.filter(
2571
2559
  (receipt) => receipt.type === ReceiptType3.ScriptResult
2572
2560
  );
2573
2561
  const gasUsed = scriptResult.reduce((prev, receipt) => prev.add(receipt.gasUsed), bn5(0));
2574
2562
  return gasUsed;
2575
- };
2563
+ }, "getGasUsedFromReceipts");
2576
2564
  function resolveGasDependentCosts(byteSize, gasDependentCost) {
2577
2565
  const base = bn5(gasDependentCost.base);
2578
2566
  let dependentValue = bn5(0);
@@ -2583,6 +2571,7 @@ function resolveGasDependentCosts(byteSize, gasDependentCost) {
2583
2571
  }
2584
2572
  return base.add(dependentValue);
2585
2573
  }
2574
+ __name(resolveGasDependentCosts, "resolveGasDependentCosts");
2586
2575
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
2587
2576
  const witnessCache = [];
2588
2577
  const chargeableInputs = inputs.filter((input) => {
@@ -2609,6 +2598,7 @@ function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
2609
2598
  }, bn5(0));
2610
2599
  return totalGas;
2611
2600
  }
2601
+ __name(gasUsedByInputs, "gasUsedByInputs");
2612
2602
  function getMinGas(params) {
2613
2603
  const { gasCosts, gasPerByte, inputs, metadataGas, txBytesSize } = params;
2614
2604
  const vmInitGas = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
@@ -2617,6 +2607,7 @@ function getMinGas(params) {
2617
2607
  const minGas = vmInitGas.add(bytesGas).add(inputsGas).add(metadataGas).maxU64();
2618
2608
  return minGas;
2619
2609
  }
2610
+ __name(getMinGas, "getMinGas");
2620
2611
  function getMaxGas(params) {
2621
2612
  const {
2622
2613
  gasPerByte,
@@ -2633,6 +2624,7 @@ function getMaxGas(params) {
2633
2624
  const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
2634
2625
  return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
2635
2626
  }
2627
+ __name(getMaxGas, "getMaxGas");
2636
2628
  function calculateMetadataGasForTxCreate({
2637
2629
  gasCosts,
2638
2630
  stateRootSize,
@@ -2647,12 +2639,14 @@ function calculateMetadataGasForTxCreate({
2647
2639
  const metadataGas = contractRootGas.add(stateRootGas).add(txIdGas).add(contractIdGas);
2648
2640
  return metadataGas.maxU64();
2649
2641
  }
2642
+ __name(calculateMetadataGasForTxCreate, "calculateMetadataGasForTxCreate");
2650
2643
  function calculateMetadataGasForTxScript({
2651
2644
  gasCosts,
2652
2645
  txBytesSize
2653
2646
  }) {
2654
2647
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2655
2648
  }
2649
+ __name(calculateMetadataGasForTxScript, "calculateMetadataGasForTxScript");
2656
2650
  function calculateMetadataGasForTxBlob({
2657
2651
  gasCosts,
2658
2652
  txBytesSize,
@@ -2662,6 +2656,7 @@ function calculateMetadataGasForTxBlob({
2662
2656
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
2663
2657
  return txId.add(blobLen);
2664
2658
  }
2659
+ __name(calculateMetadataGasForTxBlob, "calculateMetadataGasForTxBlob");
2665
2660
  function calculateMetadataGasForTxUpgrade({
2666
2661
  gasCosts,
2667
2662
  txBytesSize,
@@ -2674,6 +2669,7 @@ function calculateMetadataGasForTxUpgrade({
2674
2669
  }
2675
2670
  return txId;
2676
2671
  }
2672
+ __name(calculateMetadataGasForTxUpgrade, "calculateMetadataGasForTxUpgrade");
2677
2673
  function calculateMetadataGasForTxUpload({
2678
2674
  gasCosts,
2679
2675
  txBytesSize,
@@ -2687,6 +2683,7 @@ function calculateMetadataGasForTxUpload({
2687
2683
  txId.add(subsectionsLen);
2688
2684
  return txId;
2689
2685
  }
2686
+ __name(calculateMetadataGasForTxUpload, "calculateMetadataGasForTxUpload");
2690
2687
  function calculateMinGasForTxUpload({
2691
2688
  gasCosts,
2692
2689
  baseMinGas,
@@ -2695,10 +2692,11 @@ function calculateMinGasForTxUpload({
2695
2692
  const additionalStoragePerByte = bn5(gasCosts.newStoragePerByte).mul(subsectionSize);
2696
2693
  return bn5(baseMinGas).add(additionalStoragePerByte);
2697
2694
  }
2698
- var calculateGasFee = (params) => {
2695
+ __name(calculateMinGasForTxUpload, "calculateMinGasForTxUpload");
2696
+ var calculateGasFee = /* @__PURE__ */ __name((params) => {
2699
2697
  const { gas, gasPrice, priceFactor, tip } = params;
2700
2698
  return gas.mul(gasPrice).div(priceFactor).add(bn5(tip));
2701
- };
2699
+ }, "calculateGasFee");
2702
2700
 
2703
2701
  // src/providers/utils/json.ts
2704
2702
  import { hexlify as hexlify5 } from "@fuel-ts/utils";
@@ -2727,9 +2725,11 @@ function normalize(object) {
2727
2725
  });
2728
2726
  return object;
2729
2727
  }
2728
+ __name(normalize, "normalize");
2730
2729
  function normalizeJSON(root) {
2731
2730
  return normalize(clone(root));
2732
2731
  }
2732
+ __name(normalizeJSON, "normalizeJSON");
2733
2733
 
2734
2734
  // src/providers/utils/extract-tx-error.ts
2735
2735
  import { ErrorCode as ErrorCode7, FuelError as FuelError8 } from "@fuel-ts/errors";
@@ -2744,7 +2744,7 @@ import {
2744
2744
  PANIC_REASONS,
2745
2745
  PANIC_DOC_URL
2746
2746
  } from "@fuel-ts/transactions/configs";
2747
- var assemblePanicError = (statusReason, metadata) => {
2747
+ var assemblePanicError = /* @__PURE__ */ __name((statusReason, metadata) => {
2748
2748
  let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
2749
2749
  if (PANIC_REASONS.includes(statusReason)) {
2750
2750
  errorMessage = `${errorMessage}
@@ -2757,9 +2757,9 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
2757
2757
  ...metadata,
2758
2758
  reason: statusReason
2759
2759
  });
2760
- };
2761
- var stringify = (obj) => JSON.stringify(obj, null, 2);
2762
- var assembleRevertError = (receipts, logs, metadata) => {
2760
+ }, "assemblePanicError");
2761
+ var stringify = /* @__PURE__ */ __name((obj) => JSON.stringify(obj, null, 2), "stringify");
2762
+ var assembleRevertError = /* @__PURE__ */ __name((receipts, logs, metadata) => {
2763
2763
  let errorMessage = "The transaction reverted with an unknown reason.";
2764
2764
  const revertReceipt = receipts.find(({ type }) => type === ReceiptType4.Revert);
2765
2765
  let reason = "";
@@ -2808,8 +2808,8 @@ var assembleRevertError = (receipts, logs, metadata) => {
2808
2808
  ...metadata,
2809
2809
  reason
2810
2810
  });
2811
- };
2812
- var extractTxError = (params) => {
2811
+ }, "assembleRevertError");
2812
+ var extractTxError = /* @__PURE__ */ __name((params) => {
2813
2813
  const { receipts, statusReason, logs } = params;
2814
2814
  const isPanic = receipts.some(({ type }) => type === ReceiptType4.Panic);
2815
2815
  const isRevert = receipts.some(({ type }) => type === ReceiptType4.Revert);
@@ -2824,10 +2824,13 @@ var extractTxError = (params) => {
2824
2824
  return assemblePanicError(statusReason, metadata);
2825
2825
  }
2826
2826
  return assembleRevertError(receipts, logs, metadata);
2827
- };
2827
+ }, "extractTxError");
2828
2828
 
2829
2829
  // src/providers/transaction-request/errors.ts
2830
2830
  var ChangeOutputCollisionError = class extends Error {
2831
+ static {
2832
+ __name(this, "ChangeOutputCollisionError");
2833
+ }
2831
2834
  name = "ChangeOutputCollisionError";
2832
2835
  message = 'A ChangeOutput with the same "assetId" already exists for a different "to" address';
2833
2836
  };
@@ -2837,6 +2840,9 @@ var NoWitnessAtIndexError = class extends Error {
2837
2840
  this.index = index;
2838
2841
  this.message = `Witness at index "${index}" was not found`;
2839
2842
  }
2843
+ static {
2844
+ __name(this, "NoWitnessAtIndexError");
2845
+ }
2840
2846
  name = "NoWitnessAtIndexError";
2841
2847
  };
2842
2848
  var NoWitnessByOwnerError = class extends Error {
@@ -2845,6 +2851,9 @@ var NoWitnessByOwnerError = class extends Error {
2845
2851
  this.owner = owner;
2846
2852
  this.message = `A witness for the given owner "${owner}" was not found`;
2847
2853
  }
2854
+ static {
2855
+ __name(this, "NoWitnessByOwnerError");
2856
+ }
2848
2857
  name = "NoWitnessByOwnerError";
2849
2858
  };
2850
2859
 
@@ -2853,15 +2862,15 @@ import { ErrorCode as ErrorCode8, FuelError as FuelError9 } from "@fuel-ts/error
2853
2862
  import { bn as bn7 } from "@fuel-ts/math";
2854
2863
  import { InputType as InputType2, OutputType as OutputType2 } from "@fuel-ts/transactions";
2855
2864
  import { hexlify as hexlify6 } from "@fuel-ts/utils";
2856
- var isRequestInputCoin = (input) => input.type === InputType2.Coin;
2857
- var isRequestInputMessage = (input) => input.type === InputType2.Message;
2858
- var isRequestInputMessageWithoutData = (input) => input.type === InputType2.Message && bn7(input.data).isZero();
2859
- var isRequestInputCoinOrMessage = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
2860
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessageWithoutData(input);
2861
- var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
2862
- var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
2863
- var isPredicate = (input) => isRequestInputCoinOrMessage(input) && !!input.predicate && hexlify6(input.predicate) !== "0x";
2864
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
2865
+ var isRequestInputCoin = /* @__PURE__ */ __name((input) => input.type === InputType2.Coin, "isRequestInputCoin");
2866
+ var isRequestInputMessage = /* @__PURE__ */ __name((input) => input.type === InputType2.Message, "isRequestInputMessage");
2867
+ var isRequestInputMessageWithoutData = /* @__PURE__ */ __name((input) => input.type === InputType2.Message && bn7(input.data).isZero(), "isRequestInputMessageWithoutData");
2868
+ var isRequestInputCoinOrMessage = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) || isRequestInputMessage(input), "isRequestInputCoinOrMessage");
2869
+ var isRequestInputResource = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) || isRequestInputMessageWithoutData(input), "isRequestInputResource");
2870
+ var getRequestInputResourceOwner = /* @__PURE__ */ __name((input) => isRequestInputCoin(input) ? input.owner : input.recipient, "getRequestInputResourceOwner");
2871
+ var isRequestInputResourceFromOwner = /* @__PURE__ */ __name((input, owner) => getRequestInputResourceOwner(input) === owner.toB256(), "isRequestInputResourceFromOwner");
2872
+ var isPredicate = /* @__PURE__ */ __name((input) => isRequestInputCoinOrMessage(input) && !!input.predicate && hexlify6(input.predicate) !== "0x", "isPredicate");
2873
+ var getAssetAmountInRequestInputs = /* @__PURE__ */ __name((inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
2865
2874
  if (isRequestInputCoin(input) && input.assetId === assetId) {
2866
2875
  return acc.add(input.amount);
2867
2876
  }
@@ -2869,8 +2878,8 @@ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filte
2869
2878
  return acc.add(input.amount);
2870
2879
  }
2871
2880
  return acc;
2872
- }, bn7(0));
2873
- var cacheRequestInputsResources = (inputs) => inputs.filter(isRequestInputResource).reduce(
2881
+ }, bn7(0)), "getAssetAmountInRequestInputs");
2882
+ var cacheRequestInputsResources = /* @__PURE__ */ __name((inputs) => inputs.filter(isRequestInputResource).reduce(
2874
2883
  (cache2, input) => {
2875
2884
  if (isRequestInputCoin(input)) {
2876
2885
  cache2.utxos.push(input.id);
@@ -2883,8 +2892,8 @@ var cacheRequestInputsResources = (inputs) => inputs.filter(isRequestInputResour
2883
2892
  utxos: [],
2884
2893
  messages: []
2885
2894
  }
2886
- );
2887
- var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2895
+ ), "cacheRequestInputsResources");
2896
+ var cacheRequestInputsResourcesFromOwner = /* @__PURE__ */ __name((inputs, owner) => inputs.reduce(
2888
2897
  (acc, input) => {
2889
2898
  if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
2890
2899
  acc.utxos.push(input.id);
@@ -2897,8 +2906,8 @@ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2897
2906
  utxos: [],
2898
2907
  messages: []
2899
2908
  }
2900
- );
2901
- var getBurnableAssetCount = (baseAssetId, transactionRequest) => {
2909
+ ), "cacheRequestInputsResourcesFromOwner");
2910
+ var getBurnableAssetCount = /* @__PURE__ */ __name((baseAssetId, transactionRequest) => {
2902
2911
  const { inputs, outputs } = transactionRequest;
2903
2912
  const coinInputs = new Set(inputs.filter(isRequestInputCoin).map((input) => input.assetId));
2904
2913
  if (inputs.some((i) => isRequestInputMessage(i) && bn7(i.amount).gt(0))) {
@@ -2909,8 +2918,8 @@ var getBurnableAssetCount = (baseAssetId, transactionRequest) => {
2909
2918
  );
2910
2919
  const difference = new Set([...coinInputs].filter((x) => !changeOutputs.has(x)));
2911
2920
  return difference.size;
2912
- };
2913
- var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAssetBurn = false) => {
2921
+ }, "getBurnableAssetCount");
2922
+ var validateTransactionForAssetBurn = /* @__PURE__ */ __name((baseAssetId, transactionRequest, enableAssetBurn = false) => {
2914
2923
  if (enableAssetBurn === true) {
2915
2924
  return;
2916
2925
  }
@@ -2923,20 +2932,23 @@ var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAs
2923
2932
  "Or enable asset burn, upon sending the transaction."
2924
2933
  ].join("\n");
2925
2934
  throw new FuelError9(ErrorCode8.ASSET_BURN_DETECTED, message);
2926
- };
2935
+ }, "validateTransactionForAssetBurn");
2927
2936
 
2928
2937
  // src/providers/transaction-request/witness.ts
2929
2938
  import { arrayify as arrayify4, hexlify as hexlify7 } from "@fuel-ts/utils";
2930
- var witnessify = (value) => {
2939
+ var witnessify = /* @__PURE__ */ __name((value) => {
2931
2940
  const data = arrayify4(value);
2932
2941
  return {
2933
2942
  data: hexlify7(data),
2934
2943
  dataLength: data.length
2935
2944
  };
2936
- };
2945
+ }, "witnessify");
2937
2946
 
2938
2947
  // src/providers/transaction-request/transaction-request.ts
2939
- var BaseTransactionRequest = class {
2948
+ var BaseTransactionRequest = class _BaseTransactionRequest {
2949
+ static {
2950
+ __name(this, "BaseTransactionRequest");
2951
+ }
2940
2952
  /** Gas price for transaction */
2941
2953
  tip;
2942
2954
  /** Block until which tx cannot be included */
@@ -3019,7 +3031,7 @@ var BaseTransactionRequest = class {
3019
3031
  const inputs = this.inputs?.map(inputify) ?? [];
3020
3032
  const outputs = this.outputs?.map(outputify) ?? [];
3021
3033
  const witnesses = this.witnesses?.map(witnessify) ?? [];
3022
- const { policyTypes, policies } = BaseTransactionRequest.getPolicyMeta(this);
3034
+ const { policyTypes, policies } = _BaseTransactionRequest.getPolicyMeta(this);
3023
3035
  return {
3024
3036
  policyTypes,
3025
3037
  inputs,
@@ -3367,13 +3379,13 @@ var BaseTransactionRequest = class {
3367
3379
  * Please use `Account.generateFakeResources` along with `this.addResources` instead.
3368
3380
  */
3369
3381
  fundWithFakeUtxos(quantities, baseAssetId, resourcesOwner) {
3370
- const findAssetInput = (assetId) => this.inputs.find((input) => {
3382
+ const findAssetInput = /* @__PURE__ */ __name((assetId) => this.inputs.find((input) => {
3371
3383
  if ("assetId" in input) {
3372
3384
  return input.assetId === assetId;
3373
3385
  }
3374
3386
  return false;
3375
- });
3376
- const updateAssetInput = (assetId, quantity) => {
3387
+ }), "findAssetInput");
3388
+ const updateAssetInput = /* @__PURE__ */ __name((assetId, quantity) => {
3377
3389
  const assetInput = findAssetInput(assetId);
3378
3390
  let usedQuantity = quantity;
3379
3391
  if (assetId === baseAssetId) {
@@ -3394,7 +3406,7 @@ var BaseTransactionRequest = class {
3394
3406
  }
3395
3407
  ]);
3396
3408
  }
3397
- };
3409
+ }, "updateAssetInput");
3398
3410
  updateAssetInput(baseAssetId, bn8(1e11));
3399
3411
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
3400
3412
  return this;
@@ -3482,6 +3494,7 @@ function hashTransaction(transactionRequest, chainId) {
3482
3494
  transaction.inputs = transaction.inputs.map((input) => {
3483
3495
  const inputClone = clone2(input);
3484
3496
  switch (inputClone.type) {
3497
+ // Zero out on signing: txPointer, predicateGasUsed
3485
3498
  case InputType4.Coin: {
3486
3499
  inputClone.txPointer = {
3487
3500
  blockHeight: 0,
@@ -3490,10 +3503,12 @@ function hashTransaction(transactionRequest, chainId) {
3490
3503
  inputClone.predicateGasUsed = bn9(0);
3491
3504
  return inputClone;
3492
3505
  }
3506
+ // Zero out on signing: predicateGasUsed
3493
3507
  case InputType4.Message: {
3494
3508
  inputClone.predicateGasUsed = bn9(0);
3495
3509
  return inputClone;
3496
3510
  }
3511
+ // Zero out on signing: txID, outputIndex, balanceRoot, stateRoot, and txPointer
3497
3512
  case InputType4.Contract: {
3498
3513
  inputClone.txPointer = {
3499
3514
  blockHeight: 0,
@@ -3512,15 +3527,18 @@ function hashTransaction(transactionRequest, chainId) {
3512
3527
  transaction.outputs = transaction.outputs.map((output) => {
3513
3528
  const outputClone = clone2(output);
3514
3529
  switch (outputClone.type) {
3530
+ // Zero out on signing: balanceRoot, stateRoot
3515
3531
  case OutputType4.Contract: {
3516
3532
  outputClone.balanceRoot = ZeroBytes325;
3517
3533
  outputClone.stateRoot = ZeroBytes325;
3518
3534
  return outputClone;
3519
3535
  }
3536
+ // Zero out on signing: amount
3520
3537
  case OutputType4.Change: {
3521
3538
  outputClone.amount = bn9(0);
3522
3539
  return outputClone;
3523
3540
  }
3541
+ // Zero out on signing: amount, to and assetId
3524
3542
  case OutputType4.Variable: {
3525
3543
  outputClone.to = ZeroBytes325;
3526
3544
  outputClone.amount = bn9(0);
@@ -3537,9 +3555,13 @@ function hashTransaction(transactionRequest, chainId) {
3537
3555
  const concatenatedData = concat2([chainIdBytes, new TransactionCoder2().encode(transaction)]);
3538
3556
  return sha256(concatenatedData);
3539
3557
  }
3558
+ __name(hashTransaction, "hashTransaction");
3540
3559
 
3541
3560
  // src/providers/transaction-request/blob-transaction-request.ts
3542
3561
  var BlobTransactionRequest = class extends BaseTransactionRequest {
3562
+ static {
3563
+ __name(this, "BlobTransactionRequest");
3564
+ }
3543
3565
  static from(obj) {
3544
3566
  return new this(clone3(obj));
3545
3567
  }
@@ -3608,12 +3630,12 @@ import { clone as clone4 } from "ramda";
3608
3630
 
3609
3631
  // src/providers/transaction-request/storage-slot.ts
3610
3632
  import { arrayify as arrayify5, hexlify as hexlify9 } from "@fuel-ts/utils";
3611
- var getStorageValue = (value) => {
3633
+ var getStorageValue = /* @__PURE__ */ __name((value) => {
3612
3634
  const v = new Uint8Array(32);
3613
3635
  v.set(arrayify5(value));
3614
3636
  return v;
3615
- };
3616
- var storageSlotify = (storageSlot) => {
3637
+ }, "getStorageValue");
3638
+ var storageSlotify = /* @__PURE__ */ __name((storageSlot) => {
3617
3639
  let key;
3618
3640
  let value;
3619
3641
  if (Array.isArray(storageSlot)) {
@@ -3627,10 +3649,13 @@ var storageSlotify = (storageSlot) => {
3627
3649
  key: hexlify9(key),
3628
3650
  value: hexlify9(getStorageValue(value))
3629
3651
  };
3630
- };
3652
+ }, "storageSlotify");
3631
3653
 
3632
3654
  // src/providers/transaction-request/create-transaction-request.ts
3633
3655
  var CreateTransactionRequest = class extends BaseTransactionRequest {
3656
+ static {
3657
+ __name(this, "CreateTransactionRequest");
3658
+ }
3634
3659
  static from(obj) {
3635
3660
  return new this(clone4(obj));
3636
3661
  }
@@ -3732,7 +3757,7 @@ var returnZeroScript = {
3732
3757
  */
3733
3758
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
3734
3759
  bytes: arrayify7("0x24000000"),
3735
- encodeScriptData: () => new Uint8Array(0)
3760
+ encodeScriptData: /* @__PURE__ */ __name(() => new Uint8Array(0), "encodeScriptData")
3736
3761
  };
3737
3762
  var withdrawScript = {
3738
3763
  /*
@@ -3746,11 +3771,14 @@ var withdrawScript = {
3746
3771
  */
3747
3772
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
3748
3773
  bytes: arrayify7("0x5040C0105D44C0064C40001124000000"),
3749
- encodeScriptData: () => new Uint8Array(0)
3774
+ encodeScriptData: /* @__PURE__ */ __name(() => new Uint8Array(0), "encodeScriptData")
3750
3775
  };
3751
3776
 
3752
3777
  // src/providers/transaction-request/script-transaction-request.ts
3753
3778
  var ScriptTransactionRequest = class extends BaseTransactionRequest {
3779
+ static {
3780
+ __name(this, "ScriptTransactionRequest");
3781
+ }
3754
3782
  static from(obj) {
3755
3783
  return new this(clone5(obj));
3756
3784
  }
@@ -3951,9 +3979,12 @@ import {
3951
3979
  } from "@fuel-ts/transactions";
3952
3980
  import { hexlify as hexlify12 } from "@fuel-ts/utils";
3953
3981
  import { clone as clone6 } from "ramda";
3954
- var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3982
+ var UpgradeTransactionRequest = class _UpgradeTransactionRequest extends BaseTransactionRequest {
3983
+ static {
3984
+ __name(this, "UpgradeTransactionRequest");
3985
+ }
3955
3986
  static from(obj) {
3956
- if (obj instanceof UpgradeTransactionRequest) {
3987
+ if (obj instanceof _UpgradeTransactionRequest) {
3957
3988
  return obj;
3958
3989
  }
3959
3990
  return new this(clone6(obj));
@@ -4101,9 +4132,12 @@ import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
4101
4132
  import { TransactionType as TransactionType6 } from "@fuel-ts/transactions";
4102
4133
  import { arrayify as arrayify9, hexlify as hexlify13 } from "@fuel-ts/utils";
4103
4134
  import { clone as clone7 } from "ramda";
4104
- var UploadTransactionRequest = class extends BaseTransactionRequest {
4135
+ var UploadTransactionRequest = class _UploadTransactionRequest extends BaseTransactionRequest {
4136
+ static {
4137
+ __name(this, "UploadTransactionRequest");
4138
+ }
4105
4139
  static from(obj) {
4106
- if (obj instanceof UploadTransactionRequest) {
4140
+ if (obj instanceof _UploadTransactionRequest) {
4107
4141
  return obj;
4108
4142
  }
4109
4143
  return new this(clone7(obj));
@@ -4204,12 +4238,15 @@ var UploadTransactionRequest = class extends BaseTransactionRequest {
4204
4238
 
4205
4239
  // src/providers/transaction-request/types.ts
4206
4240
  var AbstractScriptRequest = class {
4241
+ static {
4242
+ __name(this, "AbstractScriptRequest");
4243
+ }
4207
4244
  };
4208
4245
 
4209
4246
  // src/providers/transaction-request/utils.ts
4210
4247
  import { ErrorCode as ErrorCode9, FuelError as FuelError12 } from "@fuel-ts/errors";
4211
4248
  import { TransactionType as TransactionType7 } from "@fuel-ts/transactions";
4212
- var transactionRequestify = (obj) => {
4249
+ var transactionRequestify = /* @__PURE__ */ __name((obj) => {
4213
4250
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
4214
4251
  return obj;
4215
4252
  }
@@ -4237,16 +4274,19 @@ var transactionRequestify = (obj) => {
4237
4274
  );
4238
4275
  }
4239
4276
  }
4240
- };
4241
- var isTransactionTypeScript = (request2) => request2.type === TransactionType7.Script;
4242
- var isTransactionTypeCreate = (request2) => request2.type === TransactionType7.Create;
4243
- var isTransactionTypeBlob = (request2) => request2.type === TransactionType7.Blob;
4244
- var isTransactionTypeUpgrade = (request2) => request2.type === TransactionType7.Upgrade;
4245
- var isTransactionTypeUpload = (request2) => request2.type === TransactionType7.Upload;
4277
+ }, "transactionRequestify");
4278
+ var isTransactionTypeScript = /* @__PURE__ */ __name((request2) => request2.type === TransactionType7.Script, "isTransactionTypeScript");
4279
+ var isTransactionTypeCreate = /* @__PURE__ */ __name((request2) => request2.type === TransactionType7.Create, "isTransactionTypeCreate");
4280
+ var isTransactionTypeBlob = /* @__PURE__ */ __name((request2) => request2.type === TransactionType7.Blob, "isTransactionTypeBlob");
4281
+ var isTransactionTypeUpgrade = /* @__PURE__ */ __name((request2) => request2.type === TransactionType7.Upgrade, "isTransactionTypeUpgrade");
4282
+ var isTransactionTypeUpload = /* @__PURE__ */ __name((request2) => request2.type === TransactionType7.Upload, "isTransactionTypeUpload");
4246
4283
 
4247
4284
  // src/providers/resource-cache.ts
4248
4285
  var cache = /* @__PURE__ */ new Map();
4249
4286
  var ResourceCache = class {
4287
+ static {
4288
+ __name(this, "ResourceCache");
4289
+ }
4250
4290
  ttl;
4251
4291
  constructor(ttl) {
4252
4292
  this.ttl = ttl;
@@ -4350,7 +4390,7 @@ import { DateTime, hexlify as hexlify15 } from "@fuel-ts/utils";
4350
4390
  import { bn as bn12 } from "@fuel-ts/math";
4351
4391
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType8 } from "@fuel-ts/transactions";
4352
4392
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
4353
- var calculateTXFeeForSummary = (params) => {
4393
+ var calculateTXFeeForSummary = /* @__PURE__ */ __name((params) => {
4354
4394
  const {
4355
4395
  gasPrice,
4356
4396
  rawPayload,
@@ -4410,7 +4450,7 @@ var calculateTXFeeForSummary = (params) => {
4410
4450
  tip
4411
4451
  });
4412
4452
  return maxFee;
4413
- };
4453
+ }, "calculateTXFeeForSummary");
4414
4454
 
4415
4455
  // src/providers/transaction-summary/operations.ts
4416
4456
  import { ZeroBytes32 as ZeroBytes329 } from "@fuel-ts/address/configs";
@@ -4425,28 +4465,36 @@ import { InputType as InputType6 } from "@fuel-ts/transactions";
4425
4465
  function getInputsByTypes(inputs, types) {
4426
4466
  return inputs.filter((i) => types.includes(i.type));
4427
4467
  }
4468
+ __name(getInputsByTypes, "getInputsByTypes");
4428
4469
  function getInputsByType(inputs, type) {
4429
4470
  return inputs.filter((i) => i.type === type);
4430
4471
  }
4472
+ __name(getInputsByType, "getInputsByType");
4431
4473
  function getInputsCoin(inputs) {
4432
4474
  return getInputsByType(inputs, InputType6.Coin);
4433
4475
  }
4476
+ __name(getInputsCoin, "getInputsCoin");
4434
4477
  function getInputsMessage(inputs) {
4435
4478
  return getInputsByType(inputs, InputType6.Message);
4436
4479
  }
4480
+ __name(getInputsMessage, "getInputsMessage");
4437
4481
  function getInputsCoinAndMessage(inputs) {
4438
4482
  return getInputsByTypes(inputs, [InputType6.Coin, InputType6.Message]);
4439
4483
  }
4484
+ __name(getInputsCoinAndMessage, "getInputsCoinAndMessage");
4440
4485
  function isInputCoin(input) {
4441
4486
  return input.type === InputType6.Coin;
4442
4487
  }
4488
+ __name(isInputCoin, "isInputCoin");
4443
4489
  function getInputsContract(inputs) {
4444
4490
  return getInputsByType(inputs, InputType6.Contract);
4445
4491
  }
4492
+ __name(getInputsContract, "getInputsContract");
4446
4493
  function findCoinInput(inputs, assetId) {
4447
4494
  const coinInputs = getInputsCoin(inputs);
4448
4495
  return coinInputs.find((i) => i.assetId === assetId);
4449
4496
  }
4497
+ __name(findCoinInput, "findCoinInput");
4450
4498
  function aggregateInputsAmountsByAssetAndOwner(inputs, baseAssetId) {
4451
4499
  const aggregated = /* @__PURE__ */ new Map();
4452
4500
  getInputsCoinAndMessage(inputs).forEach((input) => {
@@ -4466,9 +4514,11 @@ function aggregateInputsAmountsByAssetAndOwner(inputs, baseAssetId) {
4466
4514
  });
4467
4515
  return aggregated;
4468
4516
  }
4517
+ __name(aggregateInputsAmountsByAssetAndOwner, "aggregateInputsAmountsByAssetAndOwner");
4469
4518
  function findMessageInput(inputs) {
4470
4519
  return getInputsMessage(inputs)?.[0];
4471
4520
  }
4521
+ __name(findMessageInput, "findMessageInput");
4472
4522
  function getInputFromAssetId(inputs, assetId, isBaseAsset = false) {
4473
4523
  const coinInput = findCoinInput(inputs, assetId);
4474
4524
  if (coinInput) {
@@ -4479,6 +4529,7 @@ function getInputFromAssetId(inputs, assetId, isBaseAsset = false) {
4479
4529
  }
4480
4530
  return void 0;
4481
4531
  }
4532
+ __name(getInputFromAssetId, "getInputFromAssetId");
4482
4533
  function getInputContractFromIndex(inputs, inputIndex) {
4483
4534
  if (inputIndex == null) {
4484
4535
  return void 0;
@@ -4495,6 +4546,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
4495
4546
  }
4496
4547
  return contractInput;
4497
4548
  }
4549
+ __name(getInputContractFromIndex, "getInputContractFromIndex");
4498
4550
  function getInputAccountAddress(input) {
4499
4551
  if (input.type === InputType6.Coin) {
4500
4552
  return input.owner.toString();
@@ -4504,27 +4556,34 @@ function getInputAccountAddress(input) {
4504
4556
  }
4505
4557
  return "";
4506
4558
  }
4559
+ __name(getInputAccountAddress, "getInputAccountAddress");
4507
4560
 
4508
4561
  // src/providers/transaction-summary/output.ts
4509
4562
  import { OutputType as OutputType7 } from "@fuel-ts/transactions";
4510
4563
  function getOutputsByType(outputs, type) {
4511
4564
  return outputs.filter((o) => o.type === type);
4512
4565
  }
4566
+ __name(getOutputsByType, "getOutputsByType");
4513
4567
  function getOutputsContractCreated(outputs) {
4514
4568
  return getOutputsByType(outputs, OutputType7.ContractCreated);
4515
4569
  }
4570
+ __name(getOutputsContractCreated, "getOutputsContractCreated");
4516
4571
  function getOutputsCoin(outputs) {
4517
4572
  return getOutputsByType(outputs, OutputType7.Coin);
4518
4573
  }
4574
+ __name(getOutputsCoin, "getOutputsCoin");
4519
4575
  function getOutputsChange(outputs) {
4520
4576
  return getOutputsByType(outputs, OutputType7.Change);
4521
4577
  }
4578
+ __name(getOutputsChange, "getOutputsChange");
4522
4579
  function getOutputsContract(outputs) {
4523
4580
  return getOutputsByType(outputs, OutputType7.Contract);
4524
4581
  }
4582
+ __name(getOutputsContract, "getOutputsContract");
4525
4583
  function getOutputsVariable(outputs) {
4526
4584
  return getOutputsByType(outputs, OutputType7.Variable);
4527
4585
  }
4586
+ __name(getOutputsVariable, "getOutputsVariable");
4528
4587
 
4529
4588
  // src/providers/transaction-summary/types.ts
4530
4589
  var TransactionTypeName = /* @__PURE__ */ ((TransactionTypeName2) => {
@@ -4567,6 +4626,7 @@ var ChainName = /* @__PURE__ */ ((ChainName2) => {
4567
4626
  function getReceiptsByType(receipts, type) {
4568
4627
  return (receipts ?? []).filter((r) => r.type === type);
4569
4628
  }
4629
+ __name(getReceiptsByType, "getReceiptsByType");
4570
4630
  function getTransactionTypeName(transactionType) {
4571
4631
  switch (transactionType) {
4572
4632
  case TransactionType9.Mint:
@@ -4588,37 +4648,48 @@ function getTransactionTypeName(transactionType) {
4588
4648
  );
4589
4649
  }
4590
4650
  }
4651
+ __name(getTransactionTypeName, "getTransactionTypeName");
4591
4652
  function isType(transactionType, type) {
4592
4653
  const txType = getTransactionTypeName(transactionType);
4593
4654
  return txType === type;
4594
4655
  }
4656
+ __name(isType, "isType");
4595
4657
  function isTypeMint(transactionType) {
4596
4658
  return isType(transactionType, "Mint" /* Mint */);
4597
4659
  }
4660
+ __name(isTypeMint, "isTypeMint");
4598
4661
  function isTypeCreate(transactionType) {
4599
4662
  return isType(transactionType, "Create" /* Create */);
4600
4663
  }
4664
+ __name(isTypeCreate, "isTypeCreate");
4601
4665
  function isTypeScript(transactionType) {
4602
4666
  return isType(transactionType, "Script" /* Script */);
4603
4667
  }
4668
+ __name(isTypeScript, "isTypeScript");
4604
4669
  function isTypeUpgrade(transactionType) {
4605
4670
  return isType(transactionType, "Upgrade" /* Upgrade */);
4606
4671
  }
4672
+ __name(isTypeUpgrade, "isTypeUpgrade");
4607
4673
  function isTypeUpload(transactionType) {
4608
4674
  return isType(transactionType, "Upload" /* Upload */);
4609
4675
  }
4676
+ __name(isTypeUpload, "isTypeUpload");
4610
4677
  function isTypeBlob(transactionType) {
4611
4678
  return isType(transactionType, "Blob" /* Blob */);
4612
4679
  }
4680
+ __name(isTypeBlob, "isTypeBlob");
4613
4681
  function hasSameAssetId(a) {
4614
4682
  return (b) => a.assetId === b.assetId;
4615
4683
  }
4684
+ __name(hasSameAssetId, "hasSameAssetId");
4616
4685
  function getReceiptsCall(receipts) {
4617
4686
  return getReceiptsByType(receipts, ReceiptType5.Call);
4618
4687
  }
4688
+ __name(getReceiptsCall, "getReceiptsCall");
4619
4689
  function getReceiptsMessageOut(receipts) {
4620
4690
  return getReceiptsByType(receipts, ReceiptType5.MessageOut);
4621
4691
  }
4692
+ __name(getReceiptsMessageOut, "getReceiptsMessageOut");
4622
4693
  function mergeAssets(op1, op2) {
4623
4694
  const assets1 = op1.assetsSent || [];
4624
4695
  const assets2 = op2.assetsSent || [];
@@ -4636,21 +4707,25 @@ function mergeAssets(op1, op2) {
4636
4707
  });
4637
4708
  return Array.from(assetMap.values());
4638
4709
  }
4710
+ __name(mergeAssets, "mergeAssets");
4639
4711
  function isSameOperation(a, b) {
4640
4712
  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;
4641
4713
  }
4714
+ __name(isSameOperation, "isSameOperation");
4642
4715
  function mergeAssetsSent(existing, toAdd) {
4643
4716
  if (!toAdd.assetsSent?.length) {
4644
4717
  return existing.assetsSent;
4645
4718
  }
4646
4719
  return existing.assetsSent?.length ? mergeAssets(existing, toAdd) : toAdd.assetsSent;
4647
4720
  }
4721
+ __name(mergeAssetsSent, "mergeAssetsSent");
4648
4722
  function mergeCalls(existing, toAdd) {
4649
4723
  if (!toAdd.calls?.length) {
4650
4724
  return existing.calls;
4651
4725
  }
4652
4726
  return [...existing.calls || [], ...toAdd.calls];
4653
4727
  }
4728
+ __name(mergeCalls, "mergeCalls");
4654
4729
  function mergeOperations(existing, toAdd) {
4655
4730
  return {
4656
4731
  ...existing,
@@ -4662,6 +4737,7 @@ function mergeOperations(existing, toAdd) {
4662
4737
  ]
4663
4738
  };
4664
4739
  }
4740
+ __name(mergeOperations, "mergeOperations");
4665
4741
  function addOperation(operations, toAdd) {
4666
4742
  const existingIndex = operations.findIndex((op) => isSameOperation(op, toAdd));
4667
4743
  if (existingIndex === -1) {
@@ -4669,9 +4745,11 @@ function addOperation(operations, toAdd) {
4669
4745
  }
4670
4746
  return operations.map((op, index) => index === existingIndex ? mergeOperations(op, toAdd) : op);
4671
4747
  }
4748
+ __name(addOperation, "addOperation");
4672
4749
  function getReceiptsTransferOut(receipts) {
4673
4750
  return getReceiptsByType(receipts, ReceiptType5.TransferOut);
4674
4751
  }
4752
+ __name(getReceiptsTransferOut, "getReceiptsTransferOut");
4675
4753
  function getWithdrawFromFuelOperations({
4676
4754
  inputs,
4677
4755
  receipts,
@@ -4710,6 +4788,7 @@ function getWithdrawFromFuelOperations({
4710
4788
  );
4711
4789
  return withdrawFromFuelOperations;
4712
4790
  }
4791
+ __name(getWithdrawFromFuelOperations, "getWithdrawFromFuelOperations");
4713
4792
  function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInputs) {
4714
4793
  const abi = abiMap?.[contractInput.contractID];
4715
4794
  if (!abi) {
@@ -4717,6 +4796,7 @@ function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInpu
4717
4796
  }
4718
4797
  return [];
4719
4798
  }
4799
+ __name(getContractCalls, "getContractCalls");
4720
4800
  function getAssetsSent(receipt) {
4721
4801
  return receipt.amount?.isZero() ? void 0 : [
4722
4802
  {
@@ -4725,6 +4805,7 @@ function getAssetsSent(receipt) {
4725
4805
  }
4726
4806
  ];
4727
4807
  }
4808
+ __name(getAssetsSent, "getAssetsSent");
4728
4809
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
4729
4810
  const assetId = receipt.assetId === ZeroBytes329 ? baseAssetId : receipt.assetId;
4730
4811
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
@@ -4750,6 +4831,7 @@ function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload,
4750
4831
  }
4751
4832
  ];
4752
4833
  }
4834
+ __name(processCallReceipt, "processCallReceipt");
4753
4835
  function getContractCallOperations({
4754
4836
  inputs,
4755
4837
  outputs,
@@ -4779,6 +4861,7 @@ function getContractCallOperations({
4779
4861
  );
4780
4862
  });
4781
4863
  }
4864
+ __name(getContractCallOperations, "getContractCallOperations");
4782
4865
  function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs) {
4783
4866
  const { to: toAddress, assetId, amount } = receipt;
4784
4867
  let { id: fromAddress } = receipt;
@@ -4807,6 +4890,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
4807
4890
  receipts: [receipt]
4808
4891
  };
4809
4892
  }
4893
+ __name(extractTransferOperationFromReceipt, "extractTransferOperationFromReceipt");
4810
4894
  function getTransferOperations({
4811
4895
  inputs,
4812
4896
  outputs,
@@ -4861,6 +4945,7 @@ function getTransferOperations({
4861
4945
  });
4862
4946
  return operations;
4863
4947
  }
4948
+ __name(getTransferOperations, "getTransferOperations");
4864
4949
  function getPayProducerOperations(outputs) {
4865
4950
  const coinOutputs = getOutputsCoin(outputs);
4866
4951
  const payProducerOperations = coinOutputs.reduce((prev, output) => {
@@ -4885,6 +4970,7 @@ function getPayProducerOperations(outputs) {
4885
4970
  }, []);
4886
4971
  return payProducerOperations;
4887
4972
  }
4973
+ __name(getPayProducerOperations, "getPayProducerOperations");
4888
4974
  function getContractCreatedOperations({ inputs, outputs }) {
4889
4975
  const contractCreatedOutputs = getOutputsContractCreated(outputs);
4890
4976
  const input = getInputsCoinAndMessage(inputs)[0];
@@ -4905,6 +4991,7 @@ function getContractCreatedOperations({ inputs, outputs }) {
4905
4991
  }, []);
4906
4992
  return contractCreatedOperations;
4907
4993
  }
4994
+ __name(getContractCreatedOperations, "getContractCreatedOperations");
4908
4995
  function getOperations({
4909
4996
  transactionType,
4910
4997
  inputs,
@@ -4935,11 +5022,12 @@ function getOperations({
4935
5022
  }
4936
5023
  return [...getPayProducerOperations(outputs)];
4937
5024
  }
5025
+ __name(getOperations, "getOperations");
4938
5026
 
4939
5027
  // src/providers/transaction-summary/receipt.ts
4940
5028
  import { ReceiptType as ReceiptType6 } from "@fuel-ts/transactions";
4941
- var processGqlReceipt = (gqlReceipt) => deserializeReceipt(gqlReceipt);
4942
- var extractMintedAssetsFromReceipts = (receipts) => {
5029
+ var processGqlReceipt = /* @__PURE__ */ __name((gqlReceipt) => deserializeReceipt(gqlReceipt), "processGqlReceipt");
5030
+ var extractMintedAssetsFromReceipts = /* @__PURE__ */ __name((receipts) => {
4943
5031
  const mintedAssets = [];
4944
5032
  receipts.forEach((receipt) => {
4945
5033
  if (receipt.type === ReceiptType6.Mint) {
@@ -4952,8 +5040,8 @@ var extractMintedAssetsFromReceipts = (receipts) => {
4952
5040
  }
4953
5041
  });
4954
5042
  return mintedAssets;
4955
- };
4956
- var extractBurnedAssetsFromReceipts = (receipts) => {
5043
+ }, "extractMintedAssetsFromReceipts");
5044
+ var extractBurnedAssetsFromReceipts = /* @__PURE__ */ __name((receipts) => {
4957
5045
  const burnedAssets = [];
4958
5046
  receipts.forEach((receipt) => {
4959
5047
  if (receipt.type === ReceiptType6.Burn) {
@@ -4966,12 +5054,12 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
4966
5054
  }
4967
5055
  });
4968
5056
  return burnedAssets;
4969
- };
5057
+ }, "extractBurnedAssetsFromReceipts");
4970
5058
 
4971
5059
  // src/providers/transaction-summary/status.ts
4972
5060
  import { ErrorCode as ErrorCode13, FuelError as FuelError16 } from "@fuel-ts/errors";
4973
5061
  import { bn as bn14 } from "@fuel-ts/math";
4974
- var getTransactionStatusName = (gqlStatus) => {
5062
+ var getTransactionStatusName = /* @__PURE__ */ __name((gqlStatus) => {
4975
5063
  switch (gqlStatus) {
4976
5064
  case "FailureStatus":
4977
5065
  return "failure" /* failure */;
@@ -4987,8 +5075,8 @@ var getTransactionStatusName = (gqlStatus) => {
4987
5075
  `Invalid transaction status: ${gqlStatus}.`
4988
5076
  );
4989
5077
  }
4990
- };
4991
- var processGraphqlStatus = (gqlTransactionStatus) => {
5078
+ }, "getTransactionStatusName");
5079
+ var processGraphqlStatus = /* @__PURE__ */ __name((gqlTransactionStatus) => {
4992
5080
  let time;
4993
5081
  let blockId;
4994
5082
  let status;
@@ -5032,8 +5120,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
5032
5120
  isStatusPending
5033
5121
  };
5034
5122
  return processedGraphqlStatus;
5035
- };
5036
- var getTotalFeeFromStatus = (status) => status && "totalFee" in status ? bn14(status.totalFee) : void 0;
5123
+ }, "processGraphqlStatus");
5124
+ var getTotalFeeFromStatus = /* @__PURE__ */ __name((status) => status && "totalFee" in status ? bn14(status.totalFee) : void 0, "getTotalFeeFromStatus");
5037
5125
 
5038
5126
  // src/providers/transaction-summary/assemble-transaction-summary.ts
5039
5127
  function assembleTransactionSummary(params) {
@@ -5113,6 +5201,7 @@ function assembleTransactionSummary(params) {
5113
5201
  };
5114
5202
  return transactionSummary;
5115
5203
  }
5204
+ __name(assembleTransactionSummary, "assembleTransactionSummary");
5116
5205
 
5117
5206
  // src/providers/transaction-response/getDecodedLogs.ts
5118
5207
  import { Interface as Interface2, BigNumberCoder } from "@fuel-ts/abi-coder";
@@ -5140,6 +5229,7 @@ function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
5140
5229
  return logs;
5141
5230
  }, []);
5142
5231
  }
5232
+ __name(getDecodedLogs, "getDecodedLogs");
5143
5233
 
5144
5234
  // src/providers/transaction-response/transaction-response.ts
5145
5235
  function mapGqlOutputsToTxOutputs(outputs) {
@@ -5172,7 +5262,8 @@ function mapGqlOutputsToTxOutputs(outputs) {
5172
5262
  }
5173
5263
  });
5174
5264
  }
5175
- var TransactionResponse = class {
5265
+ __name(mapGqlOutputsToTxOutputs, "mapGqlOutputsToTxOutputs");
5266
+ var TransactionResponse = class _TransactionResponse {
5176
5267
  /**
5177
5268
  * Constructor for `TransactionResponse`.
5178
5269
  *
@@ -5187,6 +5278,9 @@ var TransactionResponse = class {
5187
5278
  this.request = typeof tx === "string" ? void 0 : tx;
5188
5279
  this.waitForResult = this.waitForResult.bind(this);
5189
5280
  }
5281
+ static {
5282
+ __name(this, "TransactionResponse");
5283
+ }
5190
5284
  /** Transaction ID */
5191
5285
  id;
5192
5286
  /** Current provider */
@@ -5208,7 +5302,7 @@ var TransactionResponse = class {
5208
5302
  */
5209
5303
  static async create(id, provider, abis) {
5210
5304
  const chainId = await provider.getChainId();
5211
- const response = new TransactionResponse(id, provider, chainId, abis);
5305
+ const response = new _TransactionResponse(id, provider, chainId, abis);
5212
5306
  await response.fetch();
5213
5307
  return response;
5214
5308
  }
@@ -5425,6 +5519,7 @@ function getWaitDelay(options, retryAttemptNum) {
5425
5519
  return 2 ** (retryAttemptNum - 1) * duration;
5426
5520
  }
5427
5521
  }
5522
+ __name(getWaitDelay, "getWaitDelay");
5428
5523
  function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
5429
5524
  if (options === void 0) {
5430
5525
  return fetchFn;
@@ -5447,9 +5542,10 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
5447
5542
  }
5448
5543
  };
5449
5544
  }
5545
+ __name(autoRetryFetch, "autoRetryFetch");
5450
5546
 
5451
5547
  // src/providers/utils/helpers.ts
5452
- var adjustResourcesToExclude = (params) => {
5548
+ var adjustResourcesToExclude = /* @__PURE__ */ __name((params) => {
5453
5549
  const { userInput, cached, maxInputs } = params;
5454
5550
  const final = { ...userInput };
5455
5551
  let total = final.utxos.length + final.messages.length;
@@ -5462,11 +5558,11 @@ var adjustResourcesToExclude = (params) => {
5462
5558
  final.messages = [...final.messages, ...cached.messages.slice(0, maxInputs - total)];
5463
5559
  }
5464
5560
  return final;
5465
- };
5561
+ }, "adjustResourcesToExclude");
5466
5562
 
5467
5563
  // src/providers/utils/validate-pagination-args.ts
5468
5564
  import { FuelError as FuelError18, ErrorCode as ErrorCode15 } from "@fuel-ts/errors";
5469
- var validatePaginationArgs = (params) => {
5565
+ var validatePaginationArgs = /* @__PURE__ */ __name((params) => {
5470
5566
  const { paginationLimit, inputArgs = {} } = params;
5471
5567
  const { first, last, after, before } = inputArgs;
5472
5568
  if (after && before) {
@@ -5497,18 +5593,71 @@ var validatePaginationArgs = (params) => {
5497
5593
  inputArgs.first = paginationLimit;
5498
5594
  }
5499
5595
  return inputArgs;
5500
- };
5596
+ }, "validatePaginationArgs");
5501
5597
 
5502
5598
  // src/providers/provider.ts
5503
5599
  var MAX_RETRIES = 10;
5504
5600
  var RESOURCES_PAGE_SIZE_LIMIT = 512;
5505
5601
  var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
5506
5602
  var BALANCES_PAGE_SIZE_LIMIT = 100;
5603
+ var NON_PAGINATED_BALANCES_SIZE = 1e4;
5507
5604
  var BLOCKS_PAGE_SIZE_LIMIT = 5;
5508
5605
  var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
5509
5606
  var GAS_USED_MODIFIER = 1.2;
5510
- var _cacheInputs, cacheInputs_fn;
5511
- var _Provider = class {
5607
+ var Provider = class _Provider {
5608
+ static {
5609
+ __name(this, "Provider");
5610
+ }
5611
+ operations;
5612
+ cache;
5613
+ /** @hidden */
5614
+ static clearChainAndNodeCaches() {
5615
+ _Provider.inflightFetchChainAndNodeInfoRequests = {};
5616
+ _Provider.nodeInfoCache = {};
5617
+ _Provider.chainInfoCache = {};
5618
+ }
5619
+ /** @hidden */
5620
+ url;
5621
+ /** @hidden */
5622
+ urlWithoutAuth;
5623
+ /** @hidden */
5624
+ static inflightFetchChainAndNodeInfoRequests = {};
5625
+ /** @hidden */
5626
+ static chainInfoCache = {};
5627
+ /** @hidden */
5628
+ static nodeInfoCache = {};
5629
+ /** @hidden */
5630
+ static incompatibleNodeVersionMessage = "";
5631
+ /** @hidden */
5632
+ consensusParametersTimestamp;
5633
+ options = {
5634
+ timeout: void 0,
5635
+ resourceCacheTTL: void 0,
5636
+ fetch: void 0,
5637
+ retryOptions: void 0,
5638
+ headers: void 0,
5639
+ cache: void 0
5640
+ };
5641
+ /**
5642
+ * @hidden
5643
+ */
5644
+ static getFetchFn(options) {
5645
+ const { retryOptions, timeout, headers } = options;
5646
+ return autoRetryFetch(async (...args) => {
5647
+ const url = args[0];
5648
+ const request2 = args[1];
5649
+ const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
5650
+ let fullRequest = {
5651
+ ...request2,
5652
+ signal,
5653
+ headers: { ...request2?.headers, ...headers }
5654
+ };
5655
+ if (options.requestMiddleware) {
5656
+ fullRequest = await options.requestMiddleware(fullRequest);
5657
+ }
5658
+ return options.fetch ? options.fetch(url, fullRequest, options) : fetch(url, fullRequest);
5659
+ }, retryOptions);
5660
+ }
5512
5661
  /**
5513
5662
  * Constructor to initialize a Provider.
5514
5663
  *
@@ -5517,31 +5666,6 @@ var _Provider = class {
5517
5666
  * @hidden
5518
5667
  */
5519
5668
  constructor(url, options = {}) {
5520
- /**
5521
- * @hidden
5522
- */
5523
- __privateAdd(this, _cacheInputs);
5524
- __publicField(this, "operations");
5525
- __publicField(this, "cache");
5526
- /** @hidden */
5527
- __publicField(this, "url");
5528
- /** @hidden */
5529
- __publicField(this, "urlWithoutAuth");
5530
- /** @hidden */
5531
- __publicField(this, "features", {
5532
- balancePagination: false,
5533
- amount128: false
5534
- });
5535
- /** @hidden */
5536
- __publicField(this, "consensusParametersTimestamp");
5537
- __publicField(this, "options", {
5538
- timeout: void 0,
5539
- resourceCacheTTL: void 0,
5540
- fetch: void 0,
5541
- retryOptions: void 0,
5542
- headers: void 0,
5543
- cache: void 0
5544
- });
5545
5669
  const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
5546
5670
  this.url = rawUrl;
5547
5671
  this.urlWithoutAuth = urlWithoutAuth;
@@ -5571,32 +5695,6 @@ var _Provider = class {
5571
5695
  this.cache = new ResourceCache(DEFAULT_RESOURCE_CACHE_TTL);
5572
5696
  }
5573
5697
  }
5574
- /** @hidden */
5575
- static clearChainAndNodeCaches() {
5576
- _Provider.inflightFetchChainAndNodeInfoRequests = {};
5577
- _Provider.nodeInfoCache = {};
5578
- _Provider.chainInfoCache = {};
5579
- }
5580
- /**
5581
- * @hidden
5582
- */
5583
- static getFetchFn(options) {
5584
- const { retryOptions, timeout, headers } = options;
5585
- return autoRetryFetch(async (...args) => {
5586
- const url = args[0];
5587
- const request2 = args[1];
5588
- const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
5589
- let fullRequest = {
5590
- ...request2,
5591
- signal,
5592
- headers: { ...request2?.headers, ...headers }
5593
- };
5594
- if (options.requestMiddleware) {
5595
- fullRequest = await options.requestMiddleware(fullRequest);
5596
- }
5597
- return options.fetch ? options.fetch(url, fullRequest, options) : fetch(url, fullRequest);
5598
- }, retryOptions);
5599
- }
5600
5698
  static extractBasicAuth(url) {
5601
5699
  let parsedUrl;
5602
5700
  try {
@@ -5620,8 +5718,7 @@ var _Provider = class {
5620
5718
  * Initialize Provider async stuff
5621
5719
  */
5622
5720
  async init() {
5623
- const { nodeInfo } = await this.fetchChainAndNodeInfo();
5624
- this.setupFeatures(nodeInfo.nodeVersion);
5721
+ await this.fetchChainAndNodeInfo();
5625
5722
  return this;
5626
5723
  }
5627
5724
  /**
@@ -5738,8 +5835,8 @@ var _Provider = class {
5738
5835
  createOperations() {
5739
5836
  const fetchFn = _Provider.getFetchFn(this.options);
5740
5837
  const gqlClient = new GraphQLClient(this.urlWithoutAuth, {
5741
- fetch: (input, requestInit) => fetchFn(input.toString(), requestInit || {}, this.options),
5742
- responseMiddleware: (response) => {
5838
+ fetch: /* @__PURE__ */ __name((input, requestInit) => fetchFn(input.toString(), requestInit || {}, this.options), "fetch"),
5839
+ responseMiddleware: /* @__PURE__ */ __name((response) => {
5743
5840
  if ("response" in response) {
5744
5841
  const graphQlResponse = response.response;
5745
5842
  assertGqlResponseHasNoErrors(
@@ -5747,22 +5844,22 @@ var _Provider = class {
5747
5844
  _Provider.incompatibleNodeVersionMessage
5748
5845
  );
5749
5846
  }
5750
- }
5847
+ }, "responseMiddleware")
5751
5848
  });
5752
- const executeQuery = (query, vars) => {
5849
+ const executeQuery = /* @__PURE__ */ __name((query, vars) => {
5753
5850
  const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
5754
5851
  const isSubscription = opDefinition?.operation === "subscription";
5755
5852
  if (isSubscription) {
5756
5853
  return FuelGraphqlSubscriber.create({
5757
5854
  url: this.urlWithoutAuth,
5758
5855
  query,
5759
- fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
5856
+ fetchFn: /* @__PURE__ */ __name((url, requestInit) => fetchFn(url, requestInit, this.options), "fetchFn"),
5760
5857
  variables: vars
5761
5858
  });
5762
5859
  }
5763
5860
  return gqlClient.request(query, vars);
5764
- };
5765
- const customOperations = (requester) => ({
5861
+ }, "executeQuery");
5862
+ const customOperations = /* @__PURE__ */ __name((requester) => ({
5766
5863
  getBlobs(variables) {
5767
5864
  const queryParams = variables.blobIds.map((_, i) => `$blobId${i}: BlobId!`).join(", ");
5768
5865
  const blobParams = variables.blobIds.map((_, i) => `blob${i}: blob(id: $blobId${i}) { id }`).join("\n");
@@ -5780,18 +5877,9 @@ var _Provider = class {
5780
5877
  `;
5781
5878
  return requester(document2, updatedVariables);
5782
5879
  }
5783
- });
5880
+ }), "customOperations");
5784
5881
  return { ...getSdk(executeQuery), ...customOperations(executeQuery) };
5785
5882
  }
5786
- /**
5787
- * @hidden
5788
- */
5789
- setupFeatures(nodeVersion) {
5790
- if (gte(nodeVersion, "0.41.0")) {
5791
- this.features.balancePagination = true;
5792
- this.features.amount128 = true;
5793
- }
5794
- }
5795
5883
  /**
5796
5884
  * Returns the version of the connected node.
5797
5885
  *
@@ -5868,6 +5956,13 @@ var _Provider = class {
5868
5956
  * @returns A promise that resolves to an object containing the asset details.
5869
5957
  */
5870
5958
  async getAssetDetails(assetId) {
5959
+ const { assetMetadata } = await this.getNodeFeatures();
5960
+ if (!assetMetadata) {
5961
+ throw new FuelError19(
5962
+ ErrorCode16.UNSUPPORTED_FEATURE,
5963
+ "The current node does not supports fetching asset details"
5964
+ );
5965
+ }
5871
5966
  const { assetDetails } = await this.operations.getAssetDetails({ assetId });
5872
5967
  const { contractId, subId, totalSupply } = assetDetails;
5873
5968
  return {
@@ -5876,6 +5971,15 @@ var _Provider = class {
5876
5971
  totalSupply: bn17(totalSupply)
5877
5972
  };
5878
5973
  }
5974
+ /**
5975
+ * @hidden
5976
+ */
5977
+ #cacheInputs(inputs, transactionId) {
5978
+ if (!this.cache) {
5979
+ return;
5980
+ }
5981
+ this.cache.set(transactionId, inputs);
5982
+ }
5879
5983
  /**
5880
5984
  * @hidden
5881
5985
  */
@@ -5925,7 +6029,10 @@ var _Provider = class {
5925
6029
  abis = transactionRequest.abis;
5926
6030
  }
5927
6031
  const subscription = await this.operations.submitAndAwaitStatus({ encodedTransaction });
5928
- __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionRequest.getTransactionId(await this.getChainId()));
6032
+ this.#cacheInputs(
6033
+ transactionRequest.inputs,
6034
+ transactionRequest.getTransactionId(await this.getChainId())
6035
+ );
5929
6036
  const chainId = await this.getChainId();
5930
6037
  return new TransactionResponse(transactionRequest, this, chainId, abis, subscription);
5931
6038
  }
@@ -6677,18 +6784,9 @@ var _Provider = class {
6677
6784
  * @returns A promise that resolves to the balance.
6678
6785
  */
6679
6786
  async getBalance(owner, assetId) {
6680
- const ownerStr = new Address2(owner).toB256();
6681
- const assetIdStr = hexlify16(assetId);
6682
- if (!this.features.amount128) {
6683
- const { balance: balance2 } = await this.operations.getBalance({
6684
- owner: ownerStr,
6685
- assetId: assetIdStr
6686
- });
6687
- return bn17(balance2.amount, 10);
6688
- }
6689
6787
  const { balance } = await this.operations.getBalanceV2({
6690
- owner: ownerStr,
6691
- assetId: assetIdStr
6788
+ owner: new Address2(owner).toB256(),
6789
+ assetId: hexlify16(assetId)
6692
6790
  });
6693
6791
  return bn17(balance.amountU128, 10);
6694
6792
  }
@@ -6700,49 +6798,29 @@ var _Provider = class {
6700
6798
  * @returns A promise that resolves to the balances.
6701
6799
  */
6702
6800
  async getBalances(owner, paginationArgs) {
6703
- if (!this.features.balancePagination) {
6704
- return this.getBalancesV1(owner, paginationArgs);
6801
+ let args = { first: NON_PAGINATED_BALANCES_SIZE };
6802
+ const { balancesPagination: supportsPagination } = await this.getNodeFeatures();
6803
+ if (supportsPagination) {
6804
+ args = validatePaginationArgs({
6805
+ inputArgs: paginationArgs,
6806
+ paginationLimit: BALANCES_PAGE_SIZE_LIMIT
6807
+ });
6705
6808
  }
6706
- return this.getBalancesV2(owner, paginationArgs);
6707
- }
6708
- /**
6709
- * @hidden
6710
- */
6711
- async getBalancesV1(owner, _paginationArgs) {
6712
- const {
6713
- balances: { edges }
6714
- } = await this.operations.getBalances({
6715
- /**
6716
- * The query parameters for this method were designed to support pagination,
6717
- * but the current Fuel-Core implementation does not support pagination yet.
6718
- */
6719
- first: 1e4,
6720
- filter: { owner: new Address2(owner).toB256() }
6721
- });
6722
- const balances = edges.map(({ node }) => ({
6723
- assetId: node.assetId,
6724
- amount: bn17(node.amount)
6725
- }));
6726
- return { balances };
6727
- }
6728
- /**
6729
- * @hidden
6730
- */
6731
- async getBalancesV2(owner, paginationArgs) {
6732
6809
  const {
6733
6810
  balances: { edges, pageInfo }
6734
6811
  } = await this.operations.getBalancesV2({
6735
- ...validatePaginationArgs({
6736
- inputArgs: paginationArgs,
6737
- paginationLimit: BALANCES_PAGE_SIZE_LIMIT
6738
- }),
6739
- filter: { owner: new Address2(owner).toB256() }
6812
+ ...args,
6813
+ filter: { owner: new Address2(owner).toB256() },
6814
+ supportsPagination
6740
6815
  });
6741
6816
  const balances = edges.map(({ node }) => ({
6742
6817
  assetId: node.assetId,
6743
6818
  amount: bn17(node.amountU128)
6744
6819
  }));
6745
- return { balances, pageInfo };
6820
+ return {
6821
+ balances,
6822
+ ...supportsPagination ? { pageInfo } : {}
6823
+ };
6746
6824
  }
6747
6825
  /**
6748
6826
  * Returns message for the given address.
@@ -7029,6 +7107,17 @@ var _Provider = class {
7029
7107
  statusReason: status.reason
7030
7108
  });
7031
7109
  }
7110
+ /**
7111
+ * @hidden
7112
+ */
7113
+ async getNodeFeatures() {
7114
+ const { indexation } = await this.getNode();
7115
+ return {
7116
+ assetMetadata: Boolean(indexation?.assetMetadata),
7117
+ balancesPagination: Boolean(indexation?.balances),
7118
+ coinsToSpend: Boolean(indexation?.coinsToSpend)
7119
+ };
7120
+ }
7032
7121
  /**
7033
7122
  * @hidden
7034
7123
  */
@@ -7043,22 +7132,6 @@ var _Provider = class {
7043
7132
  return transactionRequest;
7044
7133
  }
7045
7134
  };
7046
- var Provider = _Provider;
7047
- _cacheInputs = new WeakSet();
7048
- cacheInputs_fn = function(inputs, transactionId) {
7049
- if (!this.cache) {
7050
- return;
7051
- }
7052
- this.cache.set(transactionId, inputs);
7053
- };
7054
- /** @hidden */
7055
- __publicField(Provider, "inflightFetchChainAndNodeInfoRequests", {});
7056
- /** @hidden */
7057
- __publicField(Provider, "chainInfoCache", {});
7058
- /** @hidden */
7059
- __publicField(Provider, "nodeInfoCache", {});
7060
- /** @hidden */
7061
- __publicField(Provider, "incompatibleNodeVersionMessage", "");
7062
7135
 
7063
7136
  // src/providers/transaction-summary/get-transaction-summary.ts
7064
7137
  import { ErrorCode as ErrorCode17, FuelError as FuelError20 } from "@fuel-ts/errors";
@@ -7114,6 +7187,7 @@ async function getTransactionSummary(params) {
7114
7187
  ...transactionInfo
7115
7188
  };
7116
7189
  }
7190
+ __name(getTransactionSummary, "getTransactionSummary");
7117
7191
  async function getTransactionSummaryFromRequest(params) {
7118
7192
  const { provider, transactionRequest, abiMap } = params;
7119
7193
  const { receipts } = await provider.dryRun(transactionRequest);
@@ -7139,6 +7213,7 @@ async function getTransactionSummaryFromRequest(params) {
7139
7213
  });
7140
7214
  return transactionSummary;
7141
7215
  }
7216
+ __name(getTransactionSummaryFromRequest, "getTransactionSummaryFromRequest");
7142
7217
  async function getTransactionsSummaries(params) {
7143
7218
  const { filters, provider, abiMap } = params;
7144
7219
  const { owner, ...inputArgs } = filters;
@@ -7194,12 +7269,13 @@ async function getTransactionsSummaries(params) {
7194
7269
  pageInfo
7195
7270
  };
7196
7271
  }
7272
+ __name(getTransactionsSummaries, "getTransactionsSummaries");
7197
7273
 
7198
7274
  // src/providers/transaction-summary/assemble-transaction-summary-from-serialized.ts
7199
7275
  import { bn as bn19 } from "@fuel-ts/math";
7200
7276
  import { TransactionCoder as TransactionCoder7 } from "@fuel-ts/transactions";
7201
7277
  import { arrayify as arrayify14 } from "@fuel-ts/utils";
7202
- var assembleTransactionSummaryFromJson = async (opts) => {
7278
+ var assembleTransactionSummaryFromJson = /* @__PURE__ */ __name(async (opts) => {
7203
7279
  const { provider, transactionSummary } = opts;
7204
7280
  const { id, transactionBytes, gasPrice, receipts } = transactionSummary;
7205
7281
  const {
@@ -7226,10 +7302,10 @@ var assembleTransactionSummaryFromJson = async (opts) => {
7226
7302
  gasPerByte,
7227
7303
  gasPriceFactor
7228
7304
  });
7229
- };
7305
+ }, "assembleTransactionSummaryFromJson");
7230
7306
 
7231
7307
  // src/providers/utils/merge-quantities.ts
7232
- var mergeQuantities = (...coinQuantities) => {
7308
+ var mergeQuantities = /* @__PURE__ */ __name((...coinQuantities) => {
7233
7309
  const resultMap = {};
7234
7310
  function addToMap({ amount, assetId }) {
7235
7311
  if (resultMap[assetId]) {
@@ -7238,12 +7314,16 @@ var mergeQuantities = (...coinQuantities) => {
7238
7314
  resultMap[assetId] = amount;
7239
7315
  }
7240
7316
  }
7317
+ __name(addToMap, "addToMap");
7241
7318
  coinQuantities.forEach((arr) => arr.forEach(addToMap));
7242
7319
  return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
7243
- };
7320
+ }, "mergeQuantities");
7244
7321
 
7245
7322
  // src/types.ts
7246
7323
  var AbstractAccount = class {
7324
+ static {
7325
+ __name(this, "AbstractAccount");
7326
+ }
7247
7327
  };
7248
7328
 
7249
7329
  // src/utils/formatTransferToContractScriptData.ts
@@ -7251,7 +7331,7 @@ import { ASSET_ID_LEN, BigNumberCoder as BigNumberCoder2, CONTRACT_ID_LEN, WORD_
7251
7331
  import { Address as Address3 } from "@fuel-ts/address";
7252
7332
  import { arrayify as arrayify15, concat as concat3 } from "@fuel-ts/utils";
7253
7333
  import * as asm from "@fuels/vm-asm";
7254
- var formatTransferToContractScriptData = (transferParams) => {
7334
+ var formatTransferToContractScriptData = /* @__PURE__ */ __name((transferParams) => {
7255
7335
  const numberCoder = new BigNumberCoder2("u64");
7256
7336
  return transferParams.reduce((acc, transferParam) => {
7257
7337
  const { assetId, amount, contractId } = transferParam;
@@ -7259,8 +7339,8 @@ var formatTransferToContractScriptData = (transferParams) => {
7259
7339
  const scriptData = concat3([new Address3(contractId).toBytes(), encoded, arrayify15(assetId)]);
7260
7340
  return concat3([acc, scriptData]);
7261
7341
  }, new Uint8Array());
7262
- };
7263
- var assembleTransferToContractScript = async (transferParams) => {
7342
+ }, "formatTransferToContractScriptData");
7343
+ var assembleTransferToContractScript = /* @__PURE__ */ __name(async (transferParams) => {
7264
7344
  const scriptData = formatTransferToContractScriptData(transferParams);
7265
7345
  await asm.initWasm();
7266
7346
  let script = new Uint8Array();
@@ -7284,11 +7364,14 @@ var assembleTransferToContractScript = async (transferParams) => {
7284
7364
  });
7285
7365
  script = concat3([script, asm.ret(1).to_bytes()]);
7286
7366
  return { script, scriptData };
7287
- };
7367
+ }, "assembleTransferToContractScript");
7288
7368
 
7289
7369
  // src/account.ts
7290
7370
  var MAX_FUNDING_ATTEMPTS = 5;
7291
7371
  var Account = class extends AbstractAccount {
7372
+ static {
7373
+ __name(this, "Account");
7374
+ }
7292
7375
  /**
7293
7376
  * The address associated with the account.
7294
7377
  */
@@ -7672,7 +7755,7 @@ var Account = class extends AbstractAccount {
7672
7755
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
7673
7756
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
7674
7757
  const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: bn20("100000000000000000") }];
7675
- const findAssetInput = (assetId) => txRequestClone.inputs.find((input) => {
7758
+ const findAssetInput = /* @__PURE__ */ __name((assetId) => txRequestClone.inputs.find((input) => {
7676
7759
  if (input.type === InputType7.Coin) {
7677
7760
  return input.assetId === assetId;
7678
7761
  }
@@ -7680,8 +7763,8 @@ var Account = class extends AbstractAccount {
7680
7763
  return baseAssetId === assetId;
7681
7764
  }
7682
7765
  return false;
7683
- });
7684
- const updateAssetInput = (assetId, quantity) => {
7766
+ }), "findAssetInput");
7767
+ const updateAssetInput = /* @__PURE__ */ __name((assetId, quantity) => {
7685
7768
  const assetInput = findAssetInput(assetId);
7686
7769
  const usedQuantity = quantity;
7687
7770
  if (assetInput && "amount" in assetInput) {
@@ -7696,7 +7779,7 @@ var Account = class extends AbstractAccount {
7696
7779
  ])
7697
7780
  );
7698
7781
  }
7699
- };
7782
+ }, "updateAssetInput");
7700
7783
  mergeQuantities(requiredQuantities, transactionFeeForDryRun).forEach(
7701
7784
  ({ amount, assetId }) => updateAssetInput(assetId, amount)
7702
7785
  );
@@ -7886,7 +7969,10 @@ import { hash as hash2 } from "@fuel-ts/hasher";
7886
7969
  import { toBytes } from "@fuel-ts/math";
7887
7970
  import { hexlify as hexlify18, concat as concat4, arrayify as arrayify17 } from "@fuel-ts/utils";
7888
7971
  import { secp256k1 } from "@noble/curves/secp256k1";
7889
- var Signer = class {
7972
+ var Signer = class _Signer {
7973
+ static {
7974
+ __name(this, "Signer");
7975
+ }
7890
7976
  address;
7891
7977
  publicKey;
7892
7978
  compressedPublicKey;
@@ -7965,7 +8051,7 @@ var Signer = class {
7965
8051
  * @returns Address from signature
7966
8052
  */
7967
8053
  static recoverAddress(data, signature) {
7968
- return new Address5(Signer.recoverPublicKey(data, signature));
8054
+ return new Address5(_Signer.recoverPublicKey(data, signature));
7969
8055
  }
7970
8056
  /**
7971
8057
  * Generate a random privateKey
@@ -8007,12 +8093,12 @@ var DEFAULT_KDF_PARAMS_R = 8;
8007
8093
  var DEFAULT_KDF_PARAMS_P = 1;
8008
8094
  var DEFAULT_KEY_SIZE = 32;
8009
8095
  var DEFAULT_IV_SIZE = 16;
8010
- var removeHexPrefix = (hexString) => {
8096
+ var removeHexPrefix = /* @__PURE__ */ __name((hexString) => {
8011
8097
  if (/^0x/.test(hexString)) {
8012
8098
  return hexString.slice(2);
8013
8099
  }
8014
8100
  return hexString;
8015
- };
8101
+ }, "removeHexPrefix");
8016
8102
  async function encryptKeystoreWallet(privateKey, address, password) {
8017
8103
  const privateKeyBuffer = bufferFromString(removeHexPrefix(privateKey), "hex");
8018
8104
  const ownerAddress = new Address6(address);
@@ -8051,6 +8137,7 @@ async function encryptKeystoreWallet(privateKey, address, password) {
8051
8137
  };
8052
8138
  return JSON.stringify(keystore);
8053
8139
  }
8140
+ __name(encryptKeystoreWallet, "encryptKeystoreWallet");
8054
8141
  async function decryptKeystoreWallet(jsonWallet, password) {
8055
8142
  const keystoreWallet = JSON.parse(jsonWallet);
8056
8143
  const {
@@ -8086,9 +8173,17 @@ async function decryptKeystoreWallet(jsonWallet, password) {
8086
8173
  const privateKey = hexlify19(buffer);
8087
8174
  return privateKey;
8088
8175
  }
8176
+ __name(decryptKeystoreWallet, "decryptKeystoreWallet");
8089
8177
 
8090
8178
  // src/wallet/base-wallet-unlocked.ts
8091
8179
  var BaseWalletUnlocked = class extends Account {
8180
+ static {
8181
+ __name(this, "BaseWalletUnlocked");
8182
+ }
8183
+ /**
8184
+ * Default HDWallet path.
8185
+ */
8186
+ static defaultPath = "m/44'/1179993420'/0'/0/0";
8092
8187
  /**
8093
8188
  * A function that returns the wallet's signer.
8094
8189
  */
@@ -8206,10 +8301,6 @@ var BaseWalletUnlocked = class extends Account {
8206
8301
  return encryptKeystoreWallet(this.privateKey, this.address, password);
8207
8302
  }
8208
8303
  };
8209
- /**
8210
- * Default HDWallet path.
8211
- */
8212
- __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
8213
8304
 
8214
8305
  // src/hdwallet/hdwallet.ts
8215
8306
  import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
@@ -10289,21 +10380,25 @@ import { arrayify as arrayify18 } from "@fuel-ts/utils";
10289
10380
  function getLowerMask(bits) {
10290
10381
  return (1 << bits) - 1;
10291
10382
  }
10383
+ __name(getLowerMask, "getLowerMask");
10292
10384
  function getUpperMask(bits) {
10293
10385
  return (1 << bits) - 1 << 8 - bits;
10294
10386
  }
10387
+ __name(getUpperMask, "getUpperMask");
10295
10388
  function getWords(mnemonic) {
10296
10389
  if (!Array.isArray(mnemonic)) {
10297
10390
  return mnemonic.split(/\s+/);
10298
10391
  }
10299
10392
  return mnemonic;
10300
10393
  }
10394
+ __name(getWords, "getWords");
10301
10395
  function getPhrase(mnemonic) {
10302
10396
  if (Array.isArray(mnemonic)) {
10303
10397
  return mnemonic.join(" ");
10304
10398
  }
10305
10399
  return mnemonic;
10306
10400
  }
10401
+ __name(getPhrase, "getPhrase");
10307
10402
  function entropyToMnemonicIndices(entropy) {
10308
10403
  const indices = [0];
10309
10404
  let remainingBits = 11;
@@ -10325,6 +10420,7 @@ function entropyToMnemonicIndices(entropy) {
10325
10420
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
10326
10421
  return indices;
10327
10422
  }
10423
+ __name(entropyToMnemonicIndices, "entropyToMnemonicIndices");
10328
10424
  function mnemonicWordsToEntropy(words, wordlist) {
10329
10425
  const size = Math.ceil(11 * words.length / 8);
10330
10426
  const entropy = arrayify18(new Uint8Array(size));
@@ -10356,6 +10452,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
10356
10452
  }
10357
10453
  return entropy.slice(0, entropyBits / 8);
10358
10454
  }
10455
+ __name(mnemonicWordsToEntropy, "mnemonicWordsToEntropy");
10359
10456
 
10360
10457
  // src/mnemonic/mnemonic.ts
10361
10458
  var MasterSecret = toUtf8Bytes("Bitcoin seed");
@@ -10370,6 +10467,7 @@ function assertWordList(wordlist) {
10370
10467
  );
10371
10468
  }
10372
10469
  }
10470
+ __name(assertWordList, "assertWordList");
10373
10471
  function assertEntropy(entropy) {
10374
10472
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
10375
10473
  throw new FuelError24(
@@ -10378,6 +10476,7 @@ function assertEntropy(entropy) {
10378
10476
  );
10379
10477
  }
10380
10478
  }
10479
+ __name(assertEntropy, "assertEntropy");
10381
10480
  function assertMnemonic(words) {
10382
10481
  if (!MNEMONIC_SIZES.includes(words.length)) {
10383
10482
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
@@ -10386,7 +10485,11 @@ function assertMnemonic(words) {
10386
10485
  throw new FuelError24(ErrorCode21.INVALID_MNEMONIC, errorMsg);
10387
10486
  }
10388
10487
  }
10389
- var Mnemonic = class {
10488
+ __name(assertMnemonic, "assertMnemonic");
10489
+ var Mnemonic = class _Mnemonic {
10490
+ static {
10491
+ __name(this, "Mnemonic");
10492
+ }
10390
10493
  wordlist;
10391
10494
  /**
10392
10495
  *
@@ -10403,7 +10506,7 @@ var Mnemonic = class {
10403
10506
  * @returns Entropy hash
10404
10507
  */
10405
10508
  mnemonicToEntropy(phrase) {
10406
- return Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
10509
+ return _Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
10407
10510
  }
10408
10511
  /**
10409
10512
  *
@@ -10411,7 +10514,7 @@ var Mnemonic = class {
10411
10514
  * @returns Mnemonic phrase
10412
10515
  */
10413
10516
  entropyToMnemonic(entropy) {
10414
- return Mnemonic.entropyToMnemonic(entropy, this.wordlist);
10517
+ return _Mnemonic.entropyToMnemonic(entropy, this.wordlist);
10415
10518
  }
10416
10519
  /**
10417
10520
  *
@@ -10452,8 +10555,8 @@ var Mnemonic = class {
10452
10555
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
10453
10556
  */
10454
10557
  static mnemonicToMasterKeys(phrase, passphrase = "") {
10455
- const seed = Mnemonic.mnemonicToSeed(phrase, passphrase);
10456
- return Mnemonic.masterKeysFromSeed(seed);
10558
+ const seed = _Mnemonic.mnemonicToSeed(phrase, passphrase);
10559
+ return _Mnemonic.masterKeysFromSeed(seed);
10457
10560
  }
10458
10561
  /**
10459
10562
  * Validates if given mnemonic is valid
@@ -10469,7 +10572,7 @@ var Mnemonic = class {
10469
10572
  return false;
10470
10573
  }
10471
10574
  while (i < words.length) {
10472
- if (Mnemonic.binarySearch(words[i]) === false) {
10575
+ if (_Mnemonic.binarySearch(words[i]) === false) {
10473
10576
  return false;
10474
10577
  }
10475
10578
  i += 1;
@@ -10516,7 +10619,7 @@ var Mnemonic = class {
10516
10619
  * @returns BIP-32 extended private key
10517
10620
  */
10518
10621
  static seedToExtendedKey(seed, testnet = false) {
10519
- const masterKey = Mnemonic.masterKeysFromSeed(seed);
10622
+ const masterKey = _Mnemonic.masterKeysFromSeed(seed);
10520
10623
  const prefix = arrayify19(testnet ? TestnetPRV : MainnetPRV);
10521
10624
  const depth = "0x00";
10522
10625
  const fingerprint = "0x00000000";
@@ -10548,7 +10651,7 @@ var Mnemonic = class {
10548
10651
  */
10549
10652
  static generate(size = 32, extraEntropy = "") {
10550
10653
  const entropy = extraEntropy ? sha2563(concat5([randomBytes5(size), arrayify19(extraEntropy)])) : randomBytes5(size);
10551
- return Mnemonic.entropyToMnemonic(entropy);
10654
+ return _Mnemonic.entropyToMnemonic(entropy);
10552
10655
  }
10553
10656
  };
10554
10657
  var mnemonic_default = Mnemonic;
@@ -10562,20 +10665,24 @@ var TestnetPUB = hexlify22("0x043587cf");
10562
10665
  function base58check(data) {
10563
10666
  return encodeBase582(concat6([data, dataSlice2(sha2564(sha2564(data)), 0, 4)]));
10564
10667
  }
10668
+ __name(base58check, "base58check");
10565
10669
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
10566
10670
  if (isPublic) {
10567
10671
  return testnet ? TestnetPUB : MainnetPUB;
10568
10672
  }
10569
10673
  return testnet ? TestnetPRV2 : MainnetPRV2;
10570
10674
  }
10675
+ __name(getExtendedKeyPrefix, "getExtendedKeyPrefix");
10571
10676
  function isPublicExtendedKey(extendedKey) {
10572
10677
  return [MainnetPUB, TestnetPUB].includes(hexlify22(extendedKey.slice(0, 4)));
10573
10678
  }
10679
+ __name(isPublicExtendedKey, "isPublicExtendedKey");
10574
10680
  function isValidExtendedKey(extendedKey) {
10575
10681
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
10576
10682
  hexlify22(extendedKey.slice(0, 4))
10577
10683
  );
10578
10684
  }
10685
+ __name(isValidExtendedKey, "isValidExtendedKey");
10579
10686
  function parsePath(path, depth = 0) {
10580
10687
  const components = path.split("/");
10581
10688
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
@@ -10588,7 +10695,11 @@ function parsePath(path, depth = 0) {
10588
10695
  (p) => ~p.indexOf(`'`) ? parseInt(p, 10) + HARDENED_INDEX : parseInt(p, 10)
10589
10696
  );
10590
10697
  }
10591
- var HDWallet = class {
10698
+ __name(parsePath, "parsePath");
10699
+ var HDWallet = class _HDWallet {
10700
+ static {
10701
+ __name(this, "HDWallet");
10702
+ }
10592
10703
  depth = 0;
10593
10704
  index = 0;
10594
10705
  fingerprint = hexlify22("0x00000000");
@@ -10654,7 +10765,7 @@ var HDWallet = class {
10654
10765
  if (privateKey) {
10655
10766
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
10656
10767
  const ki = bn21(IL).add(privateKey).mod(N).toBytes(32);
10657
- return new HDWallet({
10768
+ return new _HDWallet({
10658
10769
  privateKey: ki,
10659
10770
  chainCode: IR,
10660
10771
  index,
@@ -10664,7 +10775,7 @@ var HDWallet = class {
10664
10775
  }
10665
10776
  const signer = new Signer(hexlify22(IL));
10666
10777
  const Ki = signer.addPoint(publicKey);
10667
- return new HDWallet({
10778
+ return new _HDWallet({
10668
10779
  publicKey: Ki,
10669
10780
  chainCode: IR,
10670
10781
  index,
@@ -10713,7 +10824,7 @@ var HDWallet = class {
10713
10824
  */
10714
10825
  static fromSeed(seed) {
10715
10826
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
10716
- return new HDWallet({
10827
+ return new _HDWallet({
10717
10828
  chainCode: arrayify20(masterKey.slice(32)),
10718
10829
  privateKey: arrayify20(masterKey.slice(0, 32))
10719
10830
  });
@@ -10743,7 +10854,7 @@ var HDWallet = class {
10743
10854
  if (key[0] !== 3) {
10744
10855
  throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, "Invalid public extended key.");
10745
10856
  }
10746
- return new HDWallet({
10857
+ return new _HDWallet({
10747
10858
  publicKey: key,
10748
10859
  chainCode,
10749
10860
  index,
@@ -10754,7 +10865,7 @@ var HDWallet = class {
10754
10865
  if (key[0] !== 0) {
10755
10866
  throw new FuelError25(ErrorCode22.HD_WALLET_ERROR, "Invalid private extended key.");
10756
10867
  }
10757
- return new HDWallet({
10868
+ return new _HDWallet({
10758
10869
  privateKey: key.slice(1),
10759
10870
  chainCode,
10760
10871
  index,
@@ -10767,6 +10878,9 @@ var hdwallet_default = HDWallet;
10767
10878
 
10768
10879
  // src/wallet/wallets.ts
10769
10880
  var WalletLocked = class extends Account {
10881
+ static {
10882
+ __name(this, "WalletLocked");
10883
+ }
10770
10884
  /**
10771
10885
  * Unlocks the wallet using the provided private key and returns an instance of WalletUnlocked.
10772
10886
  *
@@ -10777,7 +10891,10 @@ var WalletLocked = class extends Account {
10777
10891
  return new WalletUnlocked(privateKey, this._provider);
10778
10892
  }
10779
10893
  };
10780
- var WalletUnlocked = class extends BaseWalletUnlocked {
10894
+ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
10895
+ static {
10896
+ __name(this, "WalletUnlocked");
10897
+ }
10781
10898
  /**
10782
10899
  * Locks the wallet and returns an instance of WalletLocked.
10783
10900
  *
@@ -10795,7 +10912,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10795
10912
  */
10796
10913
  static generate(generateOptions) {
10797
10914
  const privateKey = Signer.generatePrivateKey(generateOptions?.entropy);
10798
- return new WalletUnlocked(privateKey, generateOptions?.provider);
10915
+ return new _WalletUnlocked(privateKey, generateOptions?.provider);
10799
10916
  }
10800
10917
  /**
10801
10918
  * Create a Wallet Unlocked from a seed.
@@ -10807,8 +10924,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10807
10924
  */
10808
10925
  static fromSeed(seed, path, provider) {
10809
10926
  const hdWallet = hdwallet_default.fromSeed(seed);
10810
- const childWallet = hdWallet.derivePath(path || WalletUnlocked.defaultPath);
10811
- return new WalletUnlocked(childWallet.privateKey, provider);
10927
+ const childWallet = hdWallet.derivePath(path || _WalletUnlocked.defaultPath);
10928
+ return new _WalletUnlocked(childWallet.privateKey, provider);
10812
10929
  }
10813
10930
  /**
10814
10931
  * Create a Wallet Unlocked from a mnemonic phrase.
@@ -10822,8 +10939,8 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10822
10939
  static fromMnemonic(mnemonic, path, passphrase, provider) {
10823
10940
  const seed = mnemonic_default.mnemonicToSeed(mnemonic, passphrase);
10824
10941
  const hdWallet = hdwallet_default.fromSeed(seed);
10825
- const childWallet = hdWallet.derivePath(path || WalletUnlocked.defaultPath);
10826
- return new WalletUnlocked(childWallet.privateKey, provider);
10942
+ const childWallet = hdWallet.derivePath(path || _WalletUnlocked.defaultPath);
10943
+ return new _WalletUnlocked(childWallet.privateKey, provider);
10827
10944
  }
10828
10945
  /**
10829
10946
  * Create a Wallet Unlocked from an extended key.
@@ -10834,7 +10951,7 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10834
10951
  */
10835
10952
  static fromExtendedKey(extendedKey, provider) {
10836
10953
  const hdWallet = hdwallet_default.fromExtendedKey(extendedKey);
10837
- return new WalletUnlocked(hdWallet.privateKey, provider);
10954
+ return new _WalletUnlocked(hdWallet.privateKey, provider);
10838
10955
  }
10839
10956
  /**
10840
10957
  * Create a Wallet Unlocked from an encrypted JSON.
@@ -10846,12 +10963,15 @@ var WalletUnlocked = class extends BaseWalletUnlocked {
10846
10963
  */
10847
10964
  static async fromEncryptedJson(jsonWallet, password, provider) {
10848
10965
  const privateKey = await decryptKeystoreWallet(jsonWallet, password);
10849
- return new WalletUnlocked(privateKey, provider);
10966
+ return new _WalletUnlocked(privateKey, provider);
10850
10967
  }
10851
10968
  };
10852
10969
 
10853
10970
  // src/wallet/wallet.ts
10854
10971
  var Wallet = class {
10972
+ static {
10973
+ __name(this, "Wallet");
10974
+ }
10855
10975
  /**
10856
10976
  * Creates a locked wallet instance from an address and a provider.
10857
10977
  *
@@ -10872,50 +10992,50 @@ var Wallet = class {
10872
10992
  static fromPrivateKey(privateKey, provider) {
10873
10993
  return new WalletUnlocked(privateKey, provider);
10874
10994
  }
10995
+ /**
10996
+ * Generate a new Wallet Unlocked with a random key pair.
10997
+ *
10998
+ * @param generateOptions - Options to customize the generation process (optional).
10999
+ * @returns An unlocked wallet instance.
11000
+ */
11001
+ static generate = WalletUnlocked.generate;
11002
+ /**
11003
+ * Create a Wallet Unlocked from a seed.
11004
+ *
11005
+ * @param seed - The seed phrase.
11006
+ * @param provider - A Provider instance (optional).
11007
+ * @param path - The derivation path (optional).
11008
+ * @returns An unlocked wallet instance.
11009
+ */
11010
+ static fromSeed = WalletUnlocked.fromSeed;
11011
+ /**
11012
+ * Create a Wallet Unlocked from a mnemonic phrase.
11013
+ *
11014
+ * @param mnemonic - The mnemonic phrase.
11015
+ * @param provider - A Provider instance (optional).
11016
+ * @param path - The derivation path (optional).
11017
+ * @param passphrase - The passphrase for the mnemonic (optional).
11018
+ * @returns An unlocked wallet instance.
11019
+ */
11020
+ static fromMnemonic = WalletUnlocked.fromMnemonic;
11021
+ /**
11022
+ * Create a Wallet Unlocked from an extended key.
11023
+ *
11024
+ * @param extendedKey - The extended key.
11025
+ * @param provider - A Provider instance (optional).
11026
+ * @returns An unlocked wallet instance.
11027
+ */
11028
+ static fromExtendedKey = WalletUnlocked.fromExtendedKey;
11029
+ /**
11030
+ * Create a Wallet Unlocked from an encrypted JSON.
11031
+ *
11032
+ * @param jsonWallet - The encrypted JSON keystore.
11033
+ * @param password - The password to decrypt the JSON.
11034
+ * @param provider - A Provider instance (optional).
11035
+ * @returns An unlocked wallet instance.
11036
+ */
11037
+ static fromEncryptedJson = WalletUnlocked.fromEncryptedJson;
10875
11038
  };
10876
- /**
10877
- * Generate a new Wallet Unlocked with a random key pair.
10878
- *
10879
- * @param generateOptions - Options to customize the generation process (optional).
10880
- * @returns An unlocked wallet instance.
10881
- */
10882
- __publicField(Wallet, "generate", WalletUnlocked.generate);
10883
- /**
10884
- * Create a Wallet Unlocked from a seed.
10885
- *
10886
- * @param seed - The seed phrase.
10887
- * @param provider - A Provider instance (optional).
10888
- * @param path - The derivation path (optional).
10889
- * @returns An unlocked wallet instance.
10890
- */
10891
- __publicField(Wallet, "fromSeed", WalletUnlocked.fromSeed);
10892
- /**
10893
- * Create a Wallet Unlocked from a mnemonic phrase.
10894
- *
10895
- * @param mnemonic - The mnemonic phrase.
10896
- * @param provider - A Provider instance (optional).
10897
- * @param path - The derivation path (optional).
10898
- * @param passphrase - The passphrase for the mnemonic (optional).
10899
- * @returns An unlocked wallet instance.
10900
- */
10901
- __publicField(Wallet, "fromMnemonic", WalletUnlocked.fromMnemonic);
10902
- /**
10903
- * Create a Wallet Unlocked from an extended key.
10904
- *
10905
- * @param extendedKey - The extended key.
10906
- * @param provider - A Provider instance (optional).
10907
- * @returns An unlocked wallet instance.
10908
- */
10909
- __publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
10910
- /**
10911
- * Create a Wallet Unlocked from an encrypted JSON.
10912
- *
10913
- * @param jsonWallet - The encrypted JSON keystore.
10914
- * @param password - The password to decrypt the JSON.
10915
- * @param provider - A Provider instance (optional).
10916
- * @returns An unlocked wallet instance.
10917
- */
10918
- __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
10919
11039
 
10920
11040
  // src/wallet-manager/wallet-manager.ts
10921
11041
  import { Address as Address9 } from "@fuel-ts/address";
@@ -10925,6 +11045,9 @@ import { EventEmitter } from "events";
10925
11045
 
10926
11046
  // src/wallet-manager/storages/memory-storage.ts
10927
11047
  var MemoryStorage = class {
11048
+ static {
11049
+ __name(this, "MemoryStorage");
11050
+ }
10928
11051
  storage = /* @__PURE__ */ new Map();
10929
11052
  async getItem(key) {
10930
11053
  const item = await this.storage.get(key);
@@ -10944,14 +11067,17 @@ var MemoryStorage = class {
10944
11067
  // src/wallet-manager/vaults/mnemonic-vault.ts
10945
11068
  import { Address as Address7 } from "@fuel-ts/address";
10946
11069
  import { ErrorCode as ErrorCode23, FuelError as FuelError26 } from "@fuel-ts/errors";
10947
- var _secret;
10948
11070
  var MnemonicVault = class {
11071
+ static {
11072
+ __name(this, "MnemonicVault");
11073
+ }
11074
+ static type = "mnemonic";
11075
+ #secret;
11076
+ pathKey = "{}";
11077
+ rootPath = `m/44'/1179993420'/${this.pathKey}'/0/0`;
11078
+ numberOfAccounts = 0;
10949
11079
  constructor(options) {
10950
- __privateAdd(this, _secret, void 0);
10951
- __publicField(this, "pathKey", "{}");
10952
- __publicField(this, "rootPath", `m/44'/1179993420'/${this.pathKey}'/0/0`);
10953
- __publicField(this, "numberOfAccounts", 0);
10954
- __privateSet(this, _secret, options.secret || mnemonic_default.generate());
11080
+ this.#secret = options.secret || mnemonic_default.generate();
10955
11081
  this.rootPath = options.rootPath || this.rootPath;
10956
11082
  this.numberOfAccounts = options.numberOfAccounts || 1;
10957
11083
  }
@@ -10963,7 +11089,7 @@ var MnemonicVault = class {
10963
11089
  }
10964
11090
  serialize() {
10965
11091
  return {
10966
- secret: __privateGet(this, _secret),
11092
+ secret: this.#secret,
10967
11093
  rootPath: this.rootPath,
10968
11094
  numberOfAccounts: this.numberOfAccounts
10969
11095
  };
@@ -10972,7 +11098,7 @@ var MnemonicVault = class {
10972
11098
  const accounts = [];
10973
11099
  let numberOfAccounts = 0;
10974
11100
  do {
10975
- const wallet = Wallet.fromMnemonic(__privateGet(this, _secret), this.getDerivePath(numberOfAccounts));
11101
+ const wallet = Wallet.fromMnemonic(this.#secret, this.getDerivePath(numberOfAccounts));
10976
11102
  accounts.push({
10977
11103
  publicKey: wallet.publicKey,
10978
11104
  address: wallet.address
@@ -10983,7 +11109,7 @@ var MnemonicVault = class {
10983
11109
  }
10984
11110
  addAccount() {
10985
11111
  this.numberOfAccounts += 1;
10986
- const wallet = Wallet.fromMnemonic(__privateGet(this, _secret), this.getDerivePath(this.numberOfAccounts - 1));
11112
+ const wallet = Wallet.fromMnemonic(this.#secret, this.getDerivePath(this.numberOfAccounts - 1));
10987
11113
  return {
10988
11114
  publicKey: wallet.publicKey,
10989
11115
  address: wallet.address
@@ -10993,7 +11119,7 @@ var MnemonicVault = class {
10993
11119
  let numberOfAccounts = 0;
10994
11120
  const ownerAddress = new Address7(address);
10995
11121
  do {
10996
- const wallet = Wallet.fromMnemonic(__privateGet(this, _secret), this.getDerivePath(numberOfAccounts));
11122
+ const wallet = Wallet.fromMnemonic(this.#secret, this.getDerivePath(numberOfAccounts));
10997
11123
  if (wallet.address.equals(ownerAddress)) {
10998
11124
  return wallet.privateKey;
10999
11125
  }
@@ -11009,29 +11135,30 @@ var MnemonicVault = class {
11009
11135
  return Wallet.fromPrivateKey(privateKey);
11010
11136
  }
11011
11137
  };
11012
- _secret = new WeakMap();
11013
- __publicField(MnemonicVault, "type", "mnemonic");
11014
11138
 
11015
11139
  // src/wallet-manager/vaults/privatekey-vault.ts
11016
11140
  import { Address as Address8 } from "@fuel-ts/address";
11017
11141
  import { ErrorCode as ErrorCode24, FuelError as FuelError27 } from "@fuel-ts/errors";
11018
- var _privateKeys;
11019
11142
  var PrivateKeyVault = class {
11143
+ static {
11144
+ __name(this, "PrivateKeyVault");
11145
+ }
11146
+ static type = "privateKey";
11147
+ #privateKeys = [];
11020
11148
  /**
11021
11149
  * If privateKey vault is initialized with a secretKey, it creates
11022
11150
  * one account with the fallowing secret
11023
11151
  */
11024
11152
  constructor(options = {}) {
11025
- __privateAdd(this, _privateKeys, []);
11026
11153
  if (options.secret) {
11027
- __privateSet(this, _privateKeys, [options.secret]);
11154
+ this.#privateKeys = [options.secret];
11028
11155
  } else {
11029
- __privateSet(this, _privateKeys, options.accounts || [Wallet.generate().privateKey]);
11156
+ this.#privateKeys = options.accounts || [Wallet.generate().privateKey];
11030
11157
  }
11031
11158
  }
11032
11159
  serialize() {
11033
11160
  return {
11034
- accounts: __privateGet(this, _privateKeys)
11161
+ accounts: this.#privateKeys
11035
11162
  };
11036
11163
  }
11037
11164
  getPublicAccount(privateKey) {
@@ -11042,16 +11169,16 @@ var PrivateKeyVault = class {
11042
11169
  };
11043
11170
  }
11044
11171
  getAccounts() {
11045
- return __privateGet(this, _privateKeys).map((pk) => this.getPublicAccount(pk));
11172
+ return this.#privateKeys.map((pk) => this.getPublicAccount(pk));
11046
11173
  }
11047
11174
  addAccount() {
11048
11175
  const wallet = Wallet.generate();
11049
- __privateGet(this, _privateKeys).push(wallet.privateKey);
11176
+ this.#privateKeys.push(wallet.privateKey);
11050
11177
  return this.getPublicAccount(wallet.privateKey);
11051
11178
  }
11052
11179
  exportAccount(address) {
11053
11180
  const ownerAddress = new Address8(address);
11054
- const privateKey = __privateGet(this, _privateKeys).find(
11181
+ const privateKey = this.#privateKeys.find(
11055
11182
  (pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
11056
11183
  );
11057
11184
  if (!privateKey) {
@@ -11067,8 +11194,6 @@ var PrivateKeyVault = class {
11067
11194
  return Wallet.fromPrivateKey(privateKey);
11068
11195
  }
11069
11196
  };
11070
- _privateKeys = new WeakMap();
11071
- __publicField(PrivateKeyVault, "type", "privateKey");
11072
11197
 
11073
11198
  // src/wallet-manager/wallet-manager.ts
11074
11199
  var ERROR_MESSAGES = {
@@ -11083,46 +11208,47 @@ function assert(condition, message) {
11083
11208
  throw new FuelError28(ErrorCode25.WALLET_MANAGER_ERROR, message);
11084
11209
  }
11085
11210
  }
11086
- var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
11087
- var _WalletManager = class extends EventEmitter {
11211
+ __name(assert, "assert");
11212
+ var WalletManager = class _WalletManager extends EventEmitter {
11213
+ static {
11214
+ __name(this, "WalletManager");
11215
+ }
11216
+ /**
11217
+ * Vaults
11218
+ *
11219
+ * Vaults are responsible to store secret keys and return an `Wallet` instance,
11220
+ * to interact with the network.
11221
+ *
11222
+ * Each vault has access to its own state
11223
+ *
11224
+ */
11225
+ static Vaults = [MnemonicVault, PrivateKeyVault];
11226
+ /**
11227
+ * Storage
11228
+ *
11229
+ * Persistent encrypted data. `The default storage works only on memory`.
11230
+ */
11231
+ storage = new MemoryStorage();
11232
+ /* Key name passed to the storage */
11233
+ STORAGE_KEY = "WalletManager";
11234
+ // `This variables are only accessible from inside the class`
11235
+ #vaults = [];
11236
+ #passphrase = "";
11237
+ #isLocked = true;
11088
11238
  constructor(options) {
11089
11239
  super();
11090
- /**
11091
- * Serialize all vaults to store
11092
- *
11093
- * `This is only accessible from inside the class`
11094
- */
11095
- __privateAdd(this, _serializeVaults);
11096
- /**
11097
- * Deserialize all vaults to state
11098
- *
11099
- * `This is only accessible from inside the class`
11100
- */
11101
- __privateAdd(this, _deserializeVaults);
11102
- /**
11103
- * Storage
11104
- *
11105
- * Persistent encrypted data. `The default storage works only on memory`.
11106
- */
11107
- __publicField(this, "storage", new MemoryStorage());
11108
- /* Key name passed to the storage */
11109
- __publicField(this, "STORAGE_KEY", "WalletManager");
11110
- // `This variables are only accessible from inside the class`
11111
- __privateAdd(this, _vaults, []);
11112
- __privateAdd(this, _passphrase, "");
11113
- __privateAdd(this, _isLocked, true);
11114
11240
  this.storage = options?.storage || this.storage;
11115
11241
  }
11116
11242
  get isLocked() {
11117
- return __privateGet(this, _isLocked);
11243
+ return this.#isLocked;
11118
11244
  }
11119
11245
  /**
11120
11246
  * Return the vault serialized object containing all the privateKeys,
11121
11247
  * the format of the return depends on the Vault type.
11122
11248
  */
11123
11249
  exportVault(vaultId) {
11124
- assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
11125
- const vaultState = __privateGet(this, _vaults).find((_, idx) => idx === vaultId);
11250
+ assert(!this.#isLocked, ERROR_MESSAGES.wallet_not_unlocked);
11251
+ const vaultState = this.#vaults.find((_, idx) => idx === vaultId);
11126
11252
  assert(vaultState, ERROR_MESSAGES.vault_not_found);
11127
11253
  return vaultState.vault.serialize();
11128
11254
  }
@@ -11130,7 +11256,7 @@ var _WalletManager = class extends EventEmitter {
11130
11256
  * List all vaults on the Wallet Manager, this function not return secret's
11131
11257
  */
11132
11258
  getVaults() {
11133
- return __privateGet(this, _vaults).map((v, idx) => ({
11259
+ return this.#vaults.map((v, idx) => ({
11134
11260
  title: v.title,
11135
11261
  type: v.type,
11136
11262
  vaultId: idx
@@ -11140,7 +11266,7 @@ var _WalletManager = class extends EventEmitter {
11140
11266
  * List all accounts on the Wallet Manager not vault information is revealed
11141
11267
  */
11142
11268
  getAccounts() {
11143
- return __privateGet(this, _vaults).flatMap(
11269
+ return this.#vaults.flatMap(
11144
11270
  (vaultState, vaultId) => vaultState.vault.getAccounts().map((account) => ({ ...account, vaultId }))
11145
11271
  );
11146
11272
  }
@@ -11149,7 +11275,7 @@ var _WalletManager = class extends EventEmitter {
11149
11275
  */
11150
11276
  getWallet(address) {
11151
11277
  const ownerAddress = new Address9(address);
11152
- const vaultState = __privateGet(this, _vaults).find(
11278
+ const vaultState = this.#vaults.find(
11153
11279
  (vs) => vs.vault.getAccounts().find((a) => a.address.equals(ownerAddress))
11154
11280
  );
11155
11281
  assert(vaultState, ERROR_MESSAGES.address_not_found);
@@ -11160,8 +11286,8 @@ var _WalletManager = class extends EventEmitter {
11160
11286
  */
11161
11287
  exportPrivateKey(address) {
11162
11288
  const ownerAddress = new Address9(address);
11163
- assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
11164
- const vaultState = __privateGet(this, _vaults).find(
11289
+ assert(!this.#isLocked, ERROR_MESSAGES.wallet_not_unlocked);
11290
+ const vaultState = this.#vaults.find(
11165
11291
  (vs) => vs.vault.getAccounts().find((a) => a.address.equals(ownerAddress))
11166
11292
  );
11167
11293
  assert(vaultState, ERROR_MESSAGES.address_not_found);
@@ -11173,7 +11299,7 @@ var _WalletManager = class extends EventEmitter {
11173
11299
  */
11174
11300
  async addAccount(options) {
11175
11301
  await this.loadState();
11176
- const vaultState = __privateGet(this, _vaults)[options?.vaultId || 0];
11302
+ const vaultState = this.#vaults[options?.vaultId || 0];
11177
11303
  await assert(vaultState, ERROR_MESSAGES.vault_not_found);
11178
11304
  const account = vaultState.vault.addAccount();
11179
11305
  await this.saveState();
@@ -11184,7 +11310,7 @@ var _WalletManager = class extends EventEmitter {
11184
11310
  * created by the vault.
11185
11311
  */
11186
11312
  async removeVault(index) {
11187
- __privateGet(this, _vaults).splice(index, 1);
11313
+ this.#vaults.splice(index, 1);
11188
11314
  await this.saveState();
11189
11315
  }
11190
11316
  /**
@@ -11195,11 +11321,11 @@ var _WalletManager = class extends EventEmitter {
11195
11321
  await this.loadState();
11196
11322
  const Vault2 = this.getVaultClass(vaultConfig.type);
11197
11323
  const vault = new Vault2(vaultConfig);
11198
- __privateSet(this, _vaults, __privateGet(this, _vaults).concat({
11324
+ this.#vaults = this.#vaults.concat({
11199
11325
  title: vaultConfig.title,
11200
11326
  type: vaultConfig.type,
11201
11327
  vault
11202
- }));
11328
+ });
11203
11329
  await this.saveState();
11204
11330
  }
11205
11331
  /**
@@ -11207,9 +11333,9 @@ var _WalletManager = class extends EventEmitter {
11207
11333
  * secrets.
11208
11334
  */
11209
11335
  lock() {
11210
- __privateSet(this, _isLocked, true);
11211
- __privateSet(this, _vaults, []);
11212
- __privateSet(this, _passphrase, "");
11336
+ this.#isLocked = true;
11337
+ this.#vaults = [];
11338
+ this.#passphrase = "";
11213
11339
  this.emit("lock");
11214
11340
  }
11215
11341
  /**
@@ -11217,8 +11343,8 @@ var _WalletManager = class extends EventEmitter {
11217
11343
  * Vaults with secrets are not unlocked or instantiated on this moment.
11218
11344
  */
11219
11345
  async unlock(passphrase) {
11220
- __privateSet(this, _passphrase, passphrase);
11221
- __privateSet(this, _isLocked, false);
11346
+ this.#passphrase = passphrase;
11347
+ this.#isLocked = false;
11222
11348
  try {
11223
11349
  await this.loadState();
11224
11350
  this.emit("unlock");
@@ -11231,9 +11357,9 @@ var _WalletManager = class extends EventEmitter {
11231
11357
  * Update WalletManager encryption passphrase
11232
11358
  */
11233
11359
  async updatePassphrase(oldpass, newpass) {
11234
- const isLocked = __privateGet(this, _isLocked);
11360
+ const isLocked = this.#isLocked;
11235
11361
  await this.unlock(oldpass);
11236
- __privateSet(this, _passphrase, newpass);
11362
+ this.#passphrase = newpass;
11237
11363
  await this.saveState();
11238
11364
  await this.loadState();
11239
11365
  if (isLocked) {
@@ -11244,24 +11370,51 @@ var _WalletManager = class extends EventEmitter {
11244
11370
  * Retrieve and decrypt WalletManager state from storage
11245
11371
  */
11246
11372
  async loadState() {
11247
- await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
11373
+ await assert(!this.#isLocked, ERROR_MESSAGES.wallet_not_unlocked);
11248
11374
  const data = await this.storage.getItem(this.STORAGE_KEY);
11249
11375
  if (data) {
11250
- const state = await decrypt(__privateGet(this, _passphrase), JSON.parse(data));
11251
- __privateSet(this, _vaults, __privateMethod(this, _deserializeVaults, deserializeVaults_fn).call(this, state.vaults));
11376
+ const state = await decrypt(this.#passphrase, JSON.parse(data));
11377
+ this.#vaults = this.#deserializeVaults(state.vaults);
11252
11378
  }
11253
11379
  }
11254
11380
  /**
11255
11381
  * Store encrypted WalletManager state on storage
11256
11382
  */
11257
11383
  async saveState() {
11258
- await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
11259
- const encryptedData = await encrypt(__privateGet(this, _passphrase), {
11260
- vaults: __privateMethod(this, _serializeVaults, serializeVaults_fn).call(this, __privateGet(this, _vaults))
11384
+ await assert(!this.#isLocked, ERROR_MESSAGES.wallet_not_unlocked);
11385
+ const encryptedData = await encrypt(this.#passphrase, {
11386
+ vaults: this.#serializeVaults(this.#vaults)
11261
11387
  });
11262
11388
  await this.storage.setItem(this.STORAGE_KEY, JSON.stringify(encryptedData));
11263
11389
  this.emit("update");
11264
11390
  }
11391
+ /**
11392
+ * Serialize all vaults to store
11393
+ *
11394
+ * `This is only accessible from inside the class`
11395
+ */
11396
+ #serializeVaults(vaults) {
11397
+ return vaults.map(({ title, type, vault }) => ({
11398
+ title,
11399
+ type,
11400
+ data: vault.serialize()
11401
+ }));
11402
+ }
11403
+ /**
11404
+ * Deserialize all vaults to state
11405
+ *
11406
+ * `This is only accessible from inside the class`
11407
+ */
11408
+ #deserializeVaults(vaults) {
11409
+ return vaults.map(({ title, type, data: vaultConfig }) => {
11410
+ const VaultClass = this.getVaultClass(type);
11411
+ return {
11412
+ title,
11413
+ type,
11414
+ vault: new VaultClass(vaultConfig)
11415
+ };
11416
+ });
11417
+ }
11265
11418
  /**
11266
11419
  * Return a instantiable Class reference from `WalletManager.Vaults` supported list.
11267
11420
  */
@@ -11271,43 +11424,14 @@ var _WalletManager = class extends EventEmitter {
11271
11424
  return VaultClass;
11272
11425
  }
11273
11426
  };
11274
- var WalletManager = _WalletManager;
11275
- _vaults = new WeakMap();
11276
- _passphrase = new WeakMap();
11277
- _isLocked = new WeakMap();
11278
- _serializeVaults = new WeakSet();
11279
- serializeVaults_fn = function(vaults) {
11280
- return vaults.map(({ title, type, vault }) => ({
11281
- title,
11282
- type,
11283
- data: vault.serialize()
11284
- }));
11285
- };
11286
- _deserializeVaults = new WeakSet();
11287
- deserializeVaults_fn = function(vaults) {
11288
- return vaults.map(({ title, type, data: vaultConfig }) => {
11289
- const VaultClass = this.getVaultClass(type);
11290
- return {
11291
- title,
11292
- type,
11293
- vault: new VaultClass(vaultConfig)
11294
- };
11295
- });
11296
- };
11297
- /**
11298
- * Vaults
11299
- *
11300
- * Vaults are responsible to store secret keys and return an `Wallet` instance,
11301
- * to interact with the network.
11302
- *
11303
- * Each vault has access to its own state
11304
- *
11305
- */
11306
- __publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
11307
11427
 
11308
11428
  // src/wallet-manager/types.ts
11309
11429
  import { ErrorCode as ErrorCode26, FuelError as FuelError29 } from "@fuel-ts/errors";
11310
11430
  var Vault = class {
11431
+ static {
11432
+ __name(this, "Vault");
11433
+ }
11434
+ static type;
11311
11435
  constructor(_options) {
11312
11436
  throw new FuelError29(ErrorCode26.NOT_IMPLEMENTED, "Not implemented.");
11313
11437
  }
@@ -11327,8 +11451,10 @@ var Vault = class {
11327
11451
  throw new FuelError29(ErrorCode26.NOT_IMPLEMENTED, "Not implemented.");
11328
11452
  }
11329
11453
  };
11330
- __publicField(Vault, "type");
11331
11454
  var StorageAbstract = class {
11455
+ static {
11456
+ __name(this, "StorageAbstract");
11457
+ }
11332
11458
  };
11333
11459
 
11334
11460
  // src/predicate/predicate.ts
@@ -11358,26 +11484,30 @@ function getBytecodeDataOffset(bytecode) {
11358
11484
  const [offset] = new BigNumberCoder3("u64").decode(bytecode, DATA_OFFSET_INDEX);
11359
11485
  return offset.toNumber();
11360
11486
  }
11487
+ __name(getBytecodeDataOffset, "getBytecodeDataOffset");
11361
11488
  function getBytecodeConfigurableOffset(bytecode) {
11362
11489
  const [offset] = new BigNumberCoder3("u64").decode(bytecode, CONFIGURABLE_OFFSET_INDEX);
11363
11490
  return offset.toNumber();
11364
11491
  }
11492
+ __name(getBytecodeConfigurableOffset, "getBytecodeConfigurableOffset");
11365
11493
  function getBytecodeId(bytecode) {
11366
11494
  const configurableOffset = getBytecodeConfigurableOffset(bytecode);
11367
11495
  const byteCodeWithoutConfigurableSection = bytecode.slice(0, configurableOffset);
11368
11496
  return sha2565(byteCodeWithoutConfigurableSection);
11369
11497
  }
11498
+ __name(getBytecodeId, "getBytecodeId");
11370
11499
  function getLegacyBlobId(bytecode) {
11371
11500
  const dataOffset = getBytecodeDataOffset(bytecode);
11372
11501
  const byteCodeWithoutDataSection = bytecode.slice(0, dataOffset);
11373
11502
  return sha2565(byteCodeWithoutDataSection);
11374
11503
  }
11504
+ __name(getLegacyBlobId, "getLegacyBlobId");
11375
11505
  function getPredicateScriptLoaderInstructions(originalBinary, blobId) {
11376
11506
  const { RegId, Instruction } = asm2;
11377
11507
  const REG_PC = RegId.pc().to_u8();
11378
11508
  const REG_SP = RegId.sp().to_u8();
11379
11509
  const REG_IS = RegId.is().to_u8();
11380
- const getInstructions = (numOfInstructions2) => [
11510
+ const getInstructions = /* @__PURE__ */ __name((numOfInstructions2) => [
11381
11511
  // 1. Load the blob content into memory
11382
11512
  // Find the start of the hardcoded blob ID, which is located after the loader code ends.
11383
11513
  asm2.move_(REG_ADDRESS_OF_DATA_AFTER_CODE, REG_PC),
@@ -11411,8 +11541,8 @@ function getPredicateScriptLoaderInstructions(originalBinary, blobId) {
11411
11541
  asm2.divi(REG_START_OF_LOADED_CODE, REG_START_OF_LOADED_CODE, 4),
11412
11542
  // Jump to the start of the contract we loaded.
11413
11543
  asm2.jmp(REG_START_OF_LOADED_CODE)
11414
- ];
11415
- const getInstructionsNoDataSection = (numOfInstructions2) => [
11544
+ ], "getInstructions");
11545
+ const getInstructionsNoDataSection = /* @__PURE__ */ __name((numOfInstructions2) => [
11416
11546
  // 1. Load the blob content into memory
11417
11547
  // Find the start of the hardcoded blob ID, which is located after the loader code ends.
11418
11548
  // 1. Load the blob content into memory
@@ -11439,7 +11569,7 @@ function getPredicateScriptLoaderInstructions(originalBinary, blobId) {
11439
11569
  asm2.divi(REG_START_OF_LOADED_CODE, REG_START_OF_LOADED_CODE, 4),
11440
11570
  // Jump to the start of the contract we loaded.
11441
11571
  asm2.jmp(REG_START_OF_LOADED_CODE)
11442
- ];
11572
+ ], "getInstructionsNoDataSection");
11443
11573
  const offset = getBytecodeConfigurableOffset(originalBinary);
11444
11574
  if (originalBinary.length < offset) {
11445
11575
  throw new Error(
@@ -11484,6 +11614,7 @@ function getPredicateScriptLoaderInstructions(originalBinary, blobId) {
11484
11614
  const loaderBytecode = new Uint8Array([...instructionBytes, ...blobBytes]);
11485
11615
  return { loaderBytecode };
11486
11616
  }
11617
+ __name(getPredicateScriptLoaderInstructions, "getPredicateScriptLoaderInstructions");
11487
11618
 
11488
11619
  // src/utils/deployScriptOrPredicate.ts
11489
11620
  async function fundBlobTx(deployer, blobTxRequest) {
@@ -11506,6 +11637,7 @@ async function fundBlobTx(deployer, blobTxRequest) {
11506
11637
  blobTxRequest.maxFee = txCost.maxFee;
11507
11638
  return deployer.fund(blobTxRequest, txCost);
11508
11639
  }
11640
+ __name(fundBlobTx, "fundBlobTx");
11509
11641
  function adjustConfigurableOffsets(jsonAbi, configurableOffsetDiff) {
11510
11642
  const { configurables: readOnlyConfigurables } = jsonAbi;
11511
11643
  const configurables = [];
@@ -11514,6 +11646,7 @@ function adjustConfigurableOffsets(jsonAbi, configurableOffsetDiff) {
11514
11646
  });
11515
11647
  return { ...jsonAbi, configurables };
11516
11648
  }
11649
+ __name(adjustConfigurableOffsets, "adjustConfigurableOffsets");
11517
11650
  async function deployScriptOrPredicate({
11518
11651
  deployer,
11519
11652
  bytecode,
@@ -11538,12 +11671,12 @@ async function deployScriptOrPredicate({
11538
11671
  const loaderInstance = loaderInstanceCallback(loaderBytecode, newAbi);
11539
11672
  if (blobExists) {
11540
11673
  return {
11541
- waitForResult: () => Promise.resolve(loaderInstance),
11674
+ waitForResult: /* @__PURE__ */ __name(() => Promise.resolve(loaderInstance), "waitForResult"),
11542
11675
  blobId
11543
11676
  };
11544
11677
  }
11545
11678
  const fundedBlobRequest = await fundBlobTx(deployer, blobTxRequest);
11546
- const waitForResult = async () => {
11679
+ const waitForResult = /* @__PURE__ */ __name(async () => {
11547
11680
  try {
11548
11681
  const blobTx = await deployer.sendTransaction(fundedBlobRequest);
11549
11682
  const result = await blobTx.waitForResult();
@@ -11554,28 +11687,32 @@ async function deployScriptOrPredicate({
11554
11687
  throw new FuelError30(ErrorCode27.TRANSACTION_FAILED, "Failed to deploy predicate chunk");
11555
11688
  }
11556
11689
  return loaderInstance;
11557
- };
11690
+ }, "waitForResult");
11558
11691
  return {
11559
11692
  waitForResult,
11560
11693
  blobId
11561
11694
  };
11562
11695
  }
11696
+ __name(deployScriptOrPredicate, "deployScriptOrPredicate");
11563
11697
 
11564
11698
  // src/predicate/utils/getPredicateRoot.ts
11565
11699
  import { hash as hash3 } from "@fuel-ts/hasher";
11566
11700
  import { calcRoot } from "@fuel-ts/merkle";
11567
11701
  import { chunkAndPadBytes, hexlify as hexlify23, concat as concat8, arrayify as arrayify22 } from "@fuel-ts/utils";
11568
- var getPredicateRoot = (bytecode) => {
11702
+ var getPredicateRoot = /* @__PURE__ */ __name((bytecode) => {
11569
11703
  const chunkSize = 16 * 1024;
11570
11704
  const bytes = arrayify22(bytecode);
11571
11705
  const chunks = chunkAndPadBytes(bytes, chunkSize);
11572
11706
  const codeRoot = calcRoot(chunks.map((c) => hexlify23(c)));
11573
11707
  const predicateRoot = hash3(concat8(["0x4655454C", codeRoot]));
11574
11708
  return predicateRoot;
11575
- };
11709
+ }, "getPredicateRoot");
11576
11710
 
11577
11711
  // src/predicate/predicate.ts
11578
- var Predicate = class extends Account {
11712
+ var Predicate = class _Predicate extends Account {
11713
+ static {
11714
+ __name(this, "Predicate");
11715
+ }
11579
11716
  bytes;
11580
11717
  predicateData = [];
11581
11718
  interface;
@@ -11597,7 +11734,7 @@ var Predicate = class extends Account {
11597
11734
  data,
11598
11735
  configurableConstants
11599
11736
  }) {
11600
- const { predicateBytes, predicateInterface } = Predicate.processPredicateData(
11737
+ const { predicateBytes, predicateInterface } = _Predicate.processPredicateData(
11601
11738
  bytecode,
11602
11739
  abi,
11603
11740
  configurableConstants
@@ -11666,7 +11803,7 @@ var Predicate = class extends Account {
11666
11803
  * @returns A new Predicate instance with the same bytecode, ABI and provider but with the ability to set the data and configurable constants.
11667
11804
  */
11668
11805
  toNewInstance(overrides = {}) {
11669
- return new Predicate({
11806
+ return new _Predicate({
11670
11807
  bytecode: this.initialBytecode,
11671
11808
  abi: this.interface.jsonAbi,
11672
11809
  provider: this.provider,
@@ -11692,7 +11829,7 @@ var Predicate = class extends Account {
11692
11829
  );
11693
11830
  }
11694
11831
  if (configurableConstants && Object.keys(configurableConstants).length) {
11695
- predicateBytes = Predicate.setConfigurableConstants(
11832
+ predicateBytes = _Predicate.setConfigurableConstants(
11696
11833
  predicateBytes,
11697
11834
  configurableConstants,
11698
11835
  abiInterface
@@ -11807,12 +11944,12 @@ var Predicate = class extends Account {
11807
11944
  deployer: account,
11808
11945
  abi: this.interface.jsonAbi,
11809
11946
  bytecode: this.bytes,
11810
- loaderInstanceCallback: (loaderBytecode, newAbi) => new Predicate({
11947
+ loaderInstanceCallback: /* @__PURE__ */ __name((loaderBytecode, newAbi) => new _Predicate({
11811
11948
  bytecode: loaderBytecode,
11812
11949
  abi: newAbi,
11813
11950
  provider: this.provider,
11814
11951
  data: this.predicateData
11815
- })
11952
+ }), "loaderInstanceCallback")
11816
11953
  });
11817
11954
  }
11818
11955
  };
@@ -11863,6 +12000,9 @@ var FuelConnectorEventType = "FuelConnector";
11863
12000
 
11864
12001
  // src/connectors/types/local-storage.ts
11865
12002
  var LocalStorage = class {
12003
+ static {
12004
+ __name(this, "LocalStorage");
12005
+ }
11866
12006
  storage;
11867
12007
  constructor(localStorage) {
11868
12008
  this.storage = localStorage;
@@ -11883,6 +12023,9 @@ var LocalStorage = class {
11883
12023
 
11884
12024
  // src/connectors/fuel-connector.ts
11885
12025
  var FuelConnector = class extends EventEmitter2 {
12026
+ static {
12027
+ __name(this, "FuelConnector");
12028
+ }
11886
12029
  name = "";
11887
12030
  metadata = {};
11888
12031
  connected = false;
@@ -12131,6 +12274,7 @@ function cacheFor(fn, { cache: cache2, cacheTime, key }) {
12131
12274
  return result;
12132
12275
  };
12133
12276
  }
12277
+ __name(cacheFor, "cacheFor");
12134
12278
 
12135
12279
  // src/connectors/utils/dispatch-fuel-connector-event.ts
12136
12280
  function dispatchFuelConnectorEvent(connector) {
@@ -12140,18 +12284,24 @@ function dispatchFuelConnectorEvent(connector) {
12140
12284
  })
12141
12285
  );
12142
12286
  }
12287
+ __name(dispatchFuelConnectorEvent, "dispatchFuelConnectorEvent");
12143
12288
 
12144
12289
  // src/connectors/fuel.ts
12145
12290
  var HAS_CONNECTOR_TIMEOUT = 2e3;
12146
12291
  var PING_CACHE_TIME = 5e3;
12147
12292
  var { warn } = console;
12148
- var _Fuel = class extends FuelConnector {
12293
+ var Fuel = class _Fuel extends FuelConnector {
12294
+ static {
12295
+ __name(this, "Fuel");
12296
+ }
12297
+ static STORAGE_KEY = "fuel-current-connector";
12298
+ static defaultConfig = {};
12149
12299
  _storage = null;
12150
12300
  _connectors = [];
12151
12301
  _targetObject = null;
12152
12302
  _unsubscribes = [];
12153
- _targetUnsubscribe = () => {
12154
- };
12303
+ _targetUnsubscribe = /* @__PURE__ */ __name(() => {
12304
+ }, "_targetUnsubscribe");
12155
12305
  _pingCache = {};
12156
12306
  _currentConnector;
12157
12307
  _initializationPromise = null;
@@ -12224,7 +12374,7 @@ var _Fuel = class extends FuelConnector {
12224
12374
  const currentConnector = this._currentConnector;
12225
12375
  this._unsubscribes.map((unSub) => unSub());
12226
12376
  this._unsubscribes = events.map((event) => {
12227
- const handler = (...args) => this.emit(event, ...args);
12377
+ const handler = /* @__PURE__ */ __name((...args) => this.emit(event, ...args), "handler");
12228
12378
  currentConnector.on(event, handler);
12229
12379
  return () => currentConnector.off(event, handler);
12230
12380
  });
@@ -12308,7 +12458,7 @@ var _Fuel = class extends FuelConnector {
12308
12458
  * Setup a listener for the FuelConnector event and add the connector
12309
12459
  * to the list of new connectors.
12310
12460
  */
12311
- setupConnectorListener = () => {
12461
+ setupConnectorListener = /* @__PURE__ */ __name(() => {
12312
12462
  const { _targetObject: targetObject } = this;
12313
12463
  const eventName = FuelConnectorEventType;
12314
12464
  if (targetObject?.on) {
@@ -12318,9 +12468,9 @@ var _Fuel = class extends FuelConnector {
12318
12468
  };
12319
12469
  }
12320
12470
  if (targetObject?.addEventListener) {
12321
- const handler = (e) => {
12471
+ const handler = /* @__PURE__ */ __name((e) => {
12322
12472
  this.addConnector(e.detail);
12323
- };
12473
+ }, "handler");
12324
12474
  targetObject.addEventListener(eventName, handler);
12325
12475
  return () => {
12326
12476
  targetObject.removeEventListener?.(eventName, handler);
@@ -12328,11 +12478,11 @@ var _Fuel = class extends FuelConnector {
12328
12478
  }
12329
12479
  return () => {
12330
12480
  };
12331
- };
12481
+ }, "setupConnectorListener");
12332
12482
  /**
12333
12483
  * Add a new connector to the list of connectors.
12334
12484
  */
12335
- addConnector = async (connector) => {
12485
+ addConnector = /* @__PURE__ */ __name(async (connector) => {
12336
12486
  if (!this.getConnector(connector)) {
12337
12487
  this._connectors.push(connector);
12338
12488
  }
@@ -12343,8 +12493,8 @@ var _Fuel = class extends FuelConnector {
12343
12493
  emitEvents: false
12344
12494
  });
12345
12495
  }
12346
- };
12347
- triggerConnectorEvents = async () => {
12496
+ }, "addConnector");
12497
+ triggerConnectorEvents = /* @__PURE__ */ __name(async () => {
12348
12498
  const [isConnected, networks2, currentNetwork] = await Promise.all([
12349
12499
  this.isConnected(),
12350
12500
  this.networks(),
@@ -12361,14 +12511,14 @@ var _Fuel = class extends FuelConnector {
12361
12511
  this.emit(this.events.accounts, accounts);
12362
12512
  this.emit(this.events.currentAccount, currentAccount);
12363
12513
  }
12364
- };
12514
+ }, "triggerConnectorEvents");
12365
12515
  /**
12366
12516
  * Get a connector from the list of connectors.
12367
12517
  */
12368
- getConnector = (connector) => this._connectors.find((c) => {
12518
+ getConnector = /* @__PURE__ */ __name((connector) => this._connectors.find((c) => {
12369
12519
  const connectorName = typeof connector === "string" ? connector : connector.name;
12370
12520
  return c.name === connectorName || c === connector;
12371
- }) || null;
12521
+ }) || null, "getConnector");
12372
12522
  /**
12373
12523
  * Return the list of connectors with the status of installed and connected.
12374
12524
  */
@@ -12485,9 +12635,6 @@ var _Fuel = class extends FuelConnector {
12485
12635
  await this.clean();
12486
12636
  }
12487
12637
  };
12488
- var Fuel = _Fuel;
12489
- __publicField(Fuel, "STORAGE_KEY", "fuel-current-connector");
12490
- __publicField(Fuel, "defaultConfig", {});
12491
12638
  export {
12492
12639
  AbstractAccount,
12493
12640
  AbstractScriptRequest,
@@ -12516,6 +12663,7 @@ export {
12516
12663
  MemoryStorage,
12517
12664
  mnemonic_default as Mnemonic,
12518
12665
  MnemonicVault,
12666
+ NON_PAGINATED_BALANCES_SIZE,
12519
12667
  NoWitnessAtIndexError,
12520
12668
  NoWitnessByOwnerError,
12521
12669
  OperationName,