@fuel-ts/account 0.89.2 → 0.91.0

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.

Potentially problematic release.


This version of @fuel-ts/account might be problematic. Click here for more details.

Files changed (53) hide show
  1. package/dist/account.d.ts +8 -0
  2. package/dist/account.d.ts.map +1 -1
  3. package/dist/configs.d.ts +3 -1
  4. package/dist/configs.d.ts.map +1 -1
  5. package/dist/configs.global.js +4 -2
  6. package/dist/configs.global.js.map +1 -1
  7. package/dist/configs.js +10 -4
  8. package/dist/configs.js.map +1 -1
  9. package/dist/configs.mjs +7 -3
  10. package/dist/configs.mjs.map +1 -1
  11. package/dist/index.global.js +3228 -2762
  12. package/dist/index.global.js.map +1 -1
  13. package/dist/index.js +246 -178
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +150 -81
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/predicate/predicate.d.ts +8 -0
  18. package/dist/predicate/predicate.d.ts.map +1 -1
  19. package/dist/providers/__generated__/operations.d.ts +711 -505
  20. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  21. package/dist/providers/assets/utils/network.d.ts.map +1 -1
  22. package/dist/providers/chains.d.ts +1 -1
  23. package/dist/providers/provider.d.ts +12 -2
  24. package/dist/providers/provider.d.ts.map +1 -1
  25. package/dist/providers/utils/auto-retry-fetch.d.ts.map +1 -1
  26. package/dist/providers/utils/extract-tx-error.d.ts +2 -8
  27. package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
  28. package/dist/providers/utils/index.d.ts +0 -1
  29. package/dist/providers/utils/index.d.ts.map +1 -1
  30. package/dist/test-utils/asset-id.d.ts +8 -0
  31. package/dist/test-utils/asset-id.d.ts.map +1 -0
  32. package/dist/test-utils/launchNode.d.ts +10 -5
  33. package/dist/test-utils/launchNode.d.ts.map +1 -1
  34. package/dist/test-utils/setup-test-provider-and-wallets.d.ts +34 -0
  35. package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +1 -0
  36. package/dist/test-utils/test-message.d.ts +29 -0
  37. package/dist/test-utils/test-message.d.ts.map +1 -0
  38. package/dist/test-utils/wallet-config.d.ts +55 -0
  39. package/dist/test-utils/wallet-config.d.ts.map +1 -0
  40. package/dist/test-utils.d.ts +8 -0
  41. package/dist/test-utils.d.ts.map +1 -0
  42. package/dist/test-utils.global.js +2277 -1467
  43. package/dist/test-utils.global.js.map +1 -1
  44. package/dist/test-utils.js +546 -234
  45. package/dist/test-utils.js.map +1 -1
  46. package/dist/test-utils.mjs +452 -144
  47. package/dist/test-utils.mjs.map +1 -1
  48. package/dist/wallet/base-wallet-unlocked.d.ts +1 -1
  49. package/package.json +26 -25
  50. package/dist/providers/utils/sleep.d.ts +0 -3
  51. package/dist/providers/utils/sleep.d.ts.map +0 -1
  52. package/dist/test-utils/index.d.ts +0 -4
  53. package/dist/test-utils/index.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -186,7 +186,6 @@ __export(src_exports, {
186
186
  resolveGasDependentCosts: () => resolveGasDependentCosts,
187
187
  resolveIconPaths: () => resolveIconPaths,
188
188
  returnZeroScript: () => returnZeroScript,
189
- sleep: () => sleep,
190
189
  transactionRequestify: () => transactionRequestify,
191
190
  urlJoin: () => urlJoin,
192
191
  withTimeout: () => withTimeout,
@@ -195,11 +194,13 @@ __export(src_exports, {
195
194
  module.exports = __toCommonJS(src_exports);
196
195
 
197
196
  // src/account.ts
197
+ var import_abi_coder7 = require("@fuel-ts/abi-coder");
198
198
  var import_address4 = require("@fuel-ts/address");
199
+ var import_crypto2 = require("@fuel-ts/crypto");
199
200
  var import_errors16 = require("@fuel-ts/errors");
200
201
  var import_interfaces = require("@fuel-ts/interfaces");
201
202
  var import_math20 = require("@fuel-ts/math");
202
- var import_utils28 = require("@fuel-ts/utils");
203
+ var import_utils29 = require("@fuel-ts/utils");
203
204
  var import_ramda4 = require("ramda");
204
205
 
205
206
  // src/providers/coin-quantity.ts
@@ -242,9 +243,9 @@ var import_address3 = require("@fuel-ts/address");
242
243
  var import_errors14 = require("@fuel-ts/errors");
243
244
  var import_math17 = require("@fuel-ts/math");
244
245
  var import_transactions20 = require("@fuel-ts/transactions");
245
- var import_utils22 = require("@fuel-ts/utils");
246
+ var import_utils23 = require("@fuel-ts/utils");
246
247
  var import_versions = require("@fuel-ts/versions");
247
- var import_utils23 = require("@noble/curves/abstract/utils");
248
+ var import_utils24 = require("@noble/curves/abstract/utils");
248
249
  var import_graphql_request = require("graphql-request");
249
250
  var import_ramda3 = require("ramda");
250
251
 
@@ -469,6 +470,7 @@ var MessageProofFragmentDoc = import_graphql_tag.default`
469
470
  proofIndex
470
471
  }
471
472
  messageBlockHeader {
473
+ version
472
474
  id
473
475
  daHeight
474
476
  consensusParametersVersion
@@ -484,6 +486,7 @@ var MessageProofFragmentDoc = import_graphql_tag.default`
484
486
  applicationHash
485
487
  }
486
488
  commitBlockHeader {
489
+ version
487
490
  id
488
491
  daHeight
489
492
  consensusParametersVersion
@@ -670,6 +673,15 @@ var GasCostsFragmentDoc = import_graphql_tag.default`
670
673
  wqmm
671
674
  xor
672
675
  xori
676
+ alocDependentCost {
677
+ ...DependentCostFragment
678
+ }
679
+ cfe {
680
+ ...DependentCostFragment
681
+ }
682
+ cfeiDependentCost {
683
+ ...DependentCostFragment
684
+ }
673
685
  call {
674
686
  ...DependentCostFragment
675
687
  }
@@ -854,9 +866,13 @@ var GetTransactionsDocument = import_graphql_tag.default`
854
866
  ...transactionFragment
855
867
  }
856
868
  }
869
+ pageInfo {
870
+ ...pageInfoFragment
871
+ }
857
872
  }
858
873
  }
859
- ${TransactionFragmentDoc}`;
874
+ ${TransactionFragmentDoc}
875
+ ${PageInfoFragmentDoc}`;
860
876
  var GetTransactionsByOwnerDocument = import_graphql_tag.default`
861
877
  query getTransactionsByOwner($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
862
878
  transactionsByOwner(
@@ -1048,8 +1064,12 @@ var GetRelayedTransactionStatusDocument = import_graphql_tag.default`
1048
1064
  }
1049
1065
  ${RelayedTransactionStatusFragmentDoc}`;
1050
1066
  var DryRunDocument = import_graphql_tag.default`
1051
- mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
1052
- dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
1067
+ mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean, $gasPrice: U64) {
1068
+ dryRun(
1069
+ txs: $encodedTransactions
1070
+ utxoValidation: $utxoValidation
1071
+ gasPrice: $gasPrice
1072
+ ) {
1053
1073
  ...dryRunTransactionExecutionStatusFragment
1054
1074
  }
1055
1075
  }
@@ -1865,21 +1885,12 @@ function normalizeJSON(root) {
1865
1885
  return normalize((0, import_ramda.clone)(root));
1866
1886
  }
1867
1887
 
1868
- // src/providers/utils/sleep.ts
1869
- function sleep(time) {
1870
- return new Promise((resolve) => {
1871
- setTimeout(() => {
1872
- resolve(true);
1873
- }, time);
1874
- });
1875
- }
1876
-
1877
1888
  // src/providers/utils/extract-tx-error.ts
1878
1889
  var import_errors7 = require("@fuel-ts/errors");
1879
1890
  var import_math6 = require("@fuel-ts/math");
1880
1891
  var import_transactions5 = require("@fuel-ts/transactions");
1881
1892
  var import_configs5 = require("@fuel-ts/transactions/configs");
1882
- var assemblePanicError = (statusReason) => {
1893
+ var assemblePanicError = (statusReason, metadata) => {
1883
1894
  let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
1884
1895
  if (import_configs5.PANIC_REASONS.includes(statusReason)) {
1885
1896
  errorMessage = `${errorMessage}
@@ -1888,10 +1899,13 @@ You can read more about this error at:
1888
1899
 
1889
1900
  ${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
1890
1901
  }
1891
- return { errorMessage, reason: statusReason };
1902
+ return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, {
1903
+ ...metadata,
1904
+ reason: statusReason
1905
+ });
1892
1906
  };
1893
1907
  var stringify = (obj) => JSON.stringify(obj, null, 2);
1894
- var assembleRevertError = (receipts, logs) => {
1908
+ var assembleRevertError = (receipts, logs, metadata) => {
1895
1909
  let errorMessage = "The transaction reverted with an unknown reason.";
1896
1910
  const revertReceipt = receipts.find(({ type }) => type === import_transactions5.ReceiptType.Revert);
1897
1911
  let reason = "";
@@ -1924,25 +1938,36 @@ var assembleRevertError = (receipts, logs) => {
1924
1938
  errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1925
1939
  break;
1926
1940
  default:
1927
- reason = "unknown";
1928
- errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
1941
+ throw new import_errors7.FuelError(
1942
+ import_errors7.ErrorCode.UNKNOWN,
1943
+ `The transaction reverted with an unknown reason: ${revertReceipt.val}`,
1944
+ {
1945
+ ...metadata,
1946
+ reason: "unknown"
1947
+ }
1948
+ );
1929
1949
  }
1930
1950
  }
1931
- return { errorMessage, reason };
1951
+ return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, {
1952
+ ...metadata,
1953
+ reason
1954
+ });
1932
1955
  };
1933
1956
  var extractTxError = (params) => {
1934
1957
  const { receipts, statusReason, logs } = params;
1935
1958
  const isPanic = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Panic);
1936
1959
  const isRevert = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Revert);
1937
- const { errorMessage, reason } = isPanic ? assemblePanicError(statusReason) : assembleRevertError(receipts, logs);
1938
1960
  const metadata = {
1939
1961
  logs,
1940
1962
  receipts,
1941
1963
  panic: isPanic,
1942
1964
  revert: isRevert,
1943
- reason
1965
+ reason: ""
1944
1966
  };
1945
- return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
1967
+ if (isPanic) {
1968
+ return assemblePanicError(statusReason, metadata);
1969
+ }
1970
+ return assembleRevertError(receipts, logs, metadata);
1946
1971
  };
1947
1972
 
1948
1973
  // src/providers/transaction-request/errors.ts
@@ -3895,6 +3920,7 @@ var TransactionResponse = class {
3895
3920
  };
3896
3921
 
3897
3922
  // src/providers/utils/auto-retry-fetch.ts
3923
+ var import_utils22 = require("@fuel-ts/utils");
3898
3924
  function getWaitDelay(options, retryAttemptNum) {
3899
3925
  const duration = options.baseDelay ?? 150;
3900
3926
  switch (options.backoff) {
@@ -3924,7 +3950,7 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
3924
3950
  throw error;
3925
3951
  }
3926
3952
  const delay = getWaitDelay(options, retryNum);
3927
- await sleep(delay);
3953
+ await (0, import_utils22.sleep)(delay);
3928
3954
  return autoRetryFetch(fetchFn, options, retryNum)(...args);
3929
3955
  }
3930
3956
  };
@@ -4283,7 +4309,7 @@ Supported fuel-core version: ${supportedVersion}.`
4283
4309
  if (estimateTxDependencies) {
4284
4310
  await this.estimateTxDependencies(transactionRequest);
4285
4311
  }
4286
- const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4312
+ const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
4287
4313
  let abis;
4288
4314
  if (transactionRequest.type === import_transactions20.TransactionType.Script) {
4289
4315
  abis = transactionRequest.abis;
@@ -4321,12 +4347,12 @@ Supported fuel-core version: ${supportedVersion}.`
4321
4347
  * @param sendTransactionParams - The provider call parameters (optional).
4322
4348
  * @returns A promise that resolves to the call result object.
4323
4349
  */
4324
- async call(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
4350
+ async dryRun(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
4325
4351
  const transactionRequest = transactionRequestify(transactionRequestLike);
4326
4352
  if (estimateTxDependencies) {
4327
4353
  return this.estimateTxDependencies(transactionRequest);
4328
4354
  }
4329
- const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4355
+ const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
4330
4356
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4331
4357
  encodedTransactions: encodedTransaction,
4332
4358
  utxoValidation: utxoValidation || false
@@ -4346,13 +4372,13 @@ Supported fuel-core version: ${supportedVersion}.`
4346
4372
  async estimatePredicates(transactionRequest) {
4347
4373
  const shouldEstimatePredicates = Boolean(
4348
4374
  transactionRequest.inputs.find(
4349
- (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math17.BN(input.predicateGasUsed).isZero()
4375
+ (input) => "predicate" in input && input.predicate && !(0, import_utils24.equalBytes)((0, import_utils23.arrayify)(input.predicate), (0, import_utils23.arrayify)("0x")) && new import_math17.BN(input.predicateGasUsed).isZero()
4350
4376
  )
4351
4377
  );
4352
4378
  if (!shouldEstimatePredicates) {
4353
4379
  return transactionRequest;
4354
4380
  }
4355
- const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4381
+ const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
4356
4382
  const response = await this.operations.estimatePredicates({
4357
4383
  encodedTransaction
4358
4384
  });
@@ -4393,7 +4419,7 @@ Supported fuel-core version: ${supportedVersion}.`
4393
4419
  const {
4394
4420
  dryRun: [{ receipts: rawReceipts, status }]
4395
4421
  } = await this.operations.dryRun({
4396
- encodedTransactions: [(0, import_utils22.hexlify)(transactionRequest.toTransactionBytes())],
4422
+ encodedTransactions: [(0, import_utils23.hexlify)(transactionRequest.toTransactionBytes())],
4397
4423
  utxoValidation: false
4398
4424
  });
4399
4425
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4443,7 +4469,7 @@ Supported fuel-core version: ${supportedVersion}.`
4443
4469
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4444
4470
  allRequests.forEach((req, index) => {
4445
4471
  if (req.type === import_transactions20.TransactionType.Script) {
4446
- serializedTransactionsMap.set(index, (0, import_utils22.hexlify)(req.toTransactionBytes()));
4472
+ serializedTransactionsMap.set(index, (0, import_utils23.hexlify)(req.toTransactionBytes()));
4447
4473
  }
4448
4474
  });
4449
4475
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4479,7 +4505,7 @@ Supported fuel-core version: ${supportedVersion}.`
4479
4505
  transactionRequest: request
4480
4506
  });
4481
4507
  request.maxFee = maxFee;
4482
- serializedTransactionsMap.set(requestIdx, (0, import_utils22.hexlify)(request.toTransactionBytes()));
4508
+ serializedTransactionsMap.set(requestIdx, (0, import_utils23.hexlify)(request.toTransactionBytes()));
4483
4509
  nextRoundTransactions.push(requestIdx);
4484
4510
  }
4485
4511
  }
@@ -4500,7 +4526,7 @@ Supported fuel-core version: ${supportedVersion}.`
4500
4526
  if (estimateTxDependencies) {
4501
4527
  return this.estimateMultipleTxDependencies(transactionRequests);
4502
4528
  }
4503
- const encodedTransactions = transactionRequests.map((tx) => (0, import_utils22.hexlify)(tx.toTransactionBytes()));
4529
+ const encodedTransactions = transactionRequests.map((tx) => (0, import_utils23.hexlify)(tx.toTransactionBytes()));
4504
4530
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4505
4531
  encodedTransactions,
4506
4532
  utxoValidation: utxoValidation || false
@@ -4574,7 +4600,7 @@ Supported fuel-core version: ${supportedVersion}.`
4574
4600
  if (estimateTxDependencies) {
4575
4601
  return this.estimateTxDependencies(transactionRequest);
4576
4602
  }
4577
- const encodedTransactions = [(0, import_utils22.hexlify)(transactionRequest.toTransactionBytes())];
4603
+ const encodedTransactions = [(0, import_utils23.hexlify)(transactionRequest.toTransactionBytes())];
4578
4604
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4579
4605
  encodedTransactions,
4580
4606
  utxoValidation: true
@@ -4703,7 +4729,7 @@ Supported fuel-core version: ${supportedVersion}.`
4703
4729
  const result = await this.operations.getCoins({
4704
4730
  first: 10,
4705
4731
  ...paginationArgs,
4706
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils22.hexlify)(assetId) }
4732
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils23.hexlify)(assetId) }
4707
4733
  });
4708
4734
  const coins = result.coins.edges.map((edge) => edge.node);
4709
4735
  return coins.map((coin) => ({
@@ -4726,19 +4752,19 @@ Supported fuel-core version: ${supportedVersion}.`
4726
4752
  async getResourcesToSpend(owner, quantities, excludedIds) {
4727
4753
  const ownerAddress = import_address3.Address.fromAddressOrString(owner);
4728
4754
  const excludeInput = {
4729
- messages: excludedIds?.messages?.map((nonce) => (0, import_utils22.hexlify)(nonce)) || [],
4730
- utxos: excludedIds?.utxos?.map((id) => (0, import_utils22.hexlify)(id)) || []
4755
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils23.hexlify)(nonce)) || [],
4756
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils23.hexlify)(id)) || []
4731
4757
  };
4732
4758
  if (this.cache) {
4733
4759
  const uniqueUtxos = new Set(
4734
- excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils22.hexlify)(id)))
4760
+ excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils23.hexlify)(id)))
4735
4761
  );
4736
4762
  excludeInput.utxos = Array.from(uniqueUtxos);
4737
4763
  }
4738
4764
  const coinsQuery = {
4739
4765
  owner: ownerAddress.toB256(),
4740
4766
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
4741
- assetId: (0, import_utils22.hexlify)(assetId),
4767
+ assetId: (0, import_utils23.hexlify)(assetId),
4742
4768
  amount: amount.toString(10),
4743
4769
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
4744
4770
  })),
@@ -4840,7 +4866,7 @@ Supported fuel-core version: ${supportedVersion}.`
4840
4866
  time: block.header.time,
4841
4867
  transactionIds: block.transactions.map((tx) => tx.id),
4842
4868
  transactions: block.transactions.map(
4843
- (tx) => new import_transactions20.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4869
+ (tx) => new import_transactions20.TransactionCoder().decode((0, import_utils23.arrayify)(tx.rawPayload), 0)?.[0]
4844
4870
  )
4845
4871
  };
4846
4872
  }
@@ -4856,10 +4882,25 @@ Supported fuel-core version: ${supportedVersion}.`
4856
4882
  return null;
4857
4883
  }
4858
4884
  return new import_transactions20.TransactionCoder().decode(
4859
- (0, import_utils22.arrayify)(transaction.rawPayload),
4885
+ (0, import_utils23.arrayify)(transaction.rawPayload),
4860
4886
  0
4861
4887
  )?.[0];
4862
4888
  }
4889
+ /**
4890
+ * Retrieves transactions based on the provided pagination arguments.
4891
+ * @param paginationArgs - The pagination arguments for retrieving transactions.
4892
+ * @returns A promise that resolves to an object containing the retrieved transactions and pagination information.
4893
+ */
4894
+ async getTransactions(paginationArgs) {
4895
+ const {
4896
+ transactions: { edges, pageInfo }
4897
+ } = await this.operations.getTransactions(paginationArgs);
4898
+ const coder = new import_transactions20.TransactionCoder();
4899
+ const transactions = edges.map(
4900
+ ({ node: { rawPayload } }) => coder.decode((0, import_utils23.arrayify)(rawPayload), 0)[0]
4901
+ );
4902
+ return { transactions, pageInfo };
4903
+ }
4863
4904
  /**
4864
4905
  * Get deployed contract with the given ID.
4865
4906
  *
@@ -4883,7 +4924,7 @@ Supported fuel-core version: ${supportedVersion}.`
4883
4924
  async getContractBalance(contractId, assetId) {
4884
4925
  const { contractBalance } = await this.operations.getContractBalance({
4885
4926
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4886
- asset: (0, import_utils22.hexlify)(assetId)
4927
+ asset: (0, import_utils23.hexlify)(assetId)
4887
4928
  });
4888
4929
  return (0, import_math17.bn)(contractBalance.amount, 10);
4889
4930
  }
@@ -4897,7 +4938,7 @@ Supported fuel-core version: ${supportedVersion}.`
4897
4938
  async getBalance(owner, assetId) {
4898
4939
  const { balance } = await this.operations.getBalance({
4899
4940
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4900
- assetId: (0, import_utils22.hexlify)(assetId)
4941
+ assetId: (0, import_utils23.hexlify)(assetId)
4901
4942
  });
4902
4943
  return (0, import_math17.bn)(balance.amount, 10);
4903
4944
  }
@@ -5085,7 +5126,7 @@ Supported fuel-core version: ${supportedVersion}.`
5085
5126
  async produceBlocks(amount, startTime) {
5086
5127
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
5087
5128
  blocksToProduce: (0, import_math17.bn)(amount).toString(10),
5088
- startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5129
+ startTimestamp: startTime ? import_utils23.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5089
5130
  });
5090
5131
  return (0, import_math17.bn)(latestBlockHeight);
5091
5132
  }
@@ -5168,7 +5209,7 @@ __publicField(Provider, "nodeInfoCache", {});
5168
5209
  var import_errors15 = require("@fuel-ts/errors");
5169
5210
  var import_math18 = require("@fuel-ts/math");
5170
5211
  var import_transactions21 = require("@fuel-ts/transactions");
5171
- var import_utils25 = require("@fuel-ts/utils");
5212
+ var import_utils26 = require("@fuel-ts/utils");
5172
5213
  async function getTransactionSummary(params) {
5173
5214
  const { id, provider, abiMap } = params;
5174
5215
  const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
@@ -5181,7 +5222,7 @@ async function getTransactionSummary(params) {
5181
5222
  );
5182
5223
  }
5183
5224
  const [decodedTransaction] = new import_transactions21.TransactionCoder().decode(
5184
- (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
5225
+ (0, import_utils26.arrayify)(gqlTransaction.rawPayload),
5185
5226
  0
5186
5227
  );
5187
5228
  let txReceipts = [];
@@ -5202,7 +5243,7 @@ async function getTransactionSummary(params) {
5202
5243
  id: gqlTransaction.id,
5203
5244
  receipts,
5204
5245
  transaction: decodedTransaction,
5205
- transactionBytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
5246
+ transactionBytes: (0, import_utils26.arrayify)(gqlTransaction.rawPayload),
5206
5247
  gqlTransactionStatus: gqlTransaction.status,
5207
5248
  gasPerByte: (0, import_math18.bn)(gasPerByte),
5208
5249
  gasPriceFactor: (0, import_math18.bn)(gasPriceFactor),
@@ -5220,7 +5261,7 @@ async function getTransactionSummary(params) {
5220
5261
  }
5221
5262
  async function getTransactionSummaryFromRequest(params) {
5222
5263
  const { provider, transactionRequest, abiMap } = params;
5223
- const { receipts } = await provider.call(transactionRequest);
5264
+ const { receipts } = await provider.dryRun(transactionRequest);
5224
5265
  const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
5225
5266
  const maxInputs = provider.getChain().consensusParameters.txParameters.maxInputs;
5226
5267
  const transaction = transactionRequest.toTransaction();
@@ -5258,7 +5299,7 @@ async function getTransactionsSummaries(params) {
5258
5299
  const transactions = edges.map((edge) => {
5259
5300
  const { node: gqlTransaction } = edge;
5260
5301
  const { id, rawPayload, status } = gqlTransaction;
5261
- const [decodedTransaction] = new import_transactions21.TransactionCoder().decode((0, import_utils25.arrayify)(rawPayload), 0);
5302
+ const [decodedTransaction] = new import_transactions21.TransactionCoder().decode((0, import_utils26.arrayify)(rawPayload), 0);
5262
5303
  let txReceipts = [];
5263
5304
  if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
5264
5305
  txReceipts = gqlTransaction.status.receipts;
@@ -5268,7 +5309,7 @@ async function getTransactionsSummaries(params) {
5268
5309
  id,
5269
5310
  receipts,
5270
5311
  transaction: decodedTransaction,
5271
- transactionBytes: (0, import_utils25.arrayify)(rawPayload),
5312
+ transactionBytes: (0, import_utils26.arrayify)(rawPayload),
5272
5313
  gqlTransactionStatus: status,
5273
5314
  abiMap,
5274
5315
  gasPerByte,
@@ -5298,8 +5339,8 @@ var CHAIN_IDS = {
5298
5339
  foundry: 31337
5299
5340
  },
5300
5341
  fuel: {
5301
- beta5: 0,
5302
- devnet: 10
5342
+ devnet: 0,
5343
+ testnet: 0
5303
5344
  }
5304
5345
  };
5305
5346
 
@@ -5309,7 +5350,7 @@ var getDefaultChainId = (networkType) => {
5309
5350
  return CHAIN_IDS.eth.sepolia;
5310
5351
  }
5311
5352
  if (networkType === "fuel") {
5312
- return CHAIN_IDS.fuel.devnet;
5353
+ return CHAIN_IDS.fuel.testnet;
5313
5354
  }
5314
5355
  return void 0;
5315
5356
  };
@@ -5401,15 +5442,15 @@ var rawAssets = [
5401
5442
  },
5402
5443
  {
5403
5444
  type: "fuel",
5404
- chainId: CHAIN_IDS.fuel.beta5,
5445
+ chainId: CHAIN_IDS.fuel.devnet,
5405
5446
  decimals: 9,
5406
- assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
5447
+ assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
5407
5448
  },
5408
5449
  {
5409
5450
  type: "fuel",
5410
- chainId: CHAIN_IDS.fuel.devnet,
5451
+ chainId: CHAIN_IDS.fuel.testnet,
5411
5452
  decimals: 9,
5412
- assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
5453
+ assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
5413
5454
  }
5414
5455
  ]
5415
5456
  }
@@ -5419,16 +5460,16 @@ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5419
5460
  // src/utils/formatTransferToContractScriptData.ts
5420
5461
  var import_abi_coder6 = require("@fuel-ts/abi-coder");
5421
5462
  var import_math19 = require("@fuel-ts/math");
5422
- var import_utils27 = require("@fuel-ts/utils");
5463
+ var import_utils28 = require("@fuel-ts/utils");
5423
5464
  var asm = __toESM(require("@fuels/vm-asm"));
5424
5465
  var formatTransferToContractScriptData = (params) => {
5425
5466
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
5426
5467
  const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
5427
5468
  const encoded = numberCoder.encode(new import_math19.BN(amountToTransfer).toNumber());
5428
5469
  const scriptData = Uint8Array.from([
5429
- ...(0, import_utils27.arrayify)(hexlifiedContractId),
5470
+ ...(0, import_utils28.arrayify)(hexlifiedContractId),
5430
5471
  ...encoded,
5431
- ...(0, import_utils27.arrayify)(assetId)
5472
+ ...(0, import_utils28.arrayify)(assetId)
5432
5473
  ]);
5433
5474
  return scriptData;
5434
5475
  };
@@ -5833,14 +5874,14 @@ var Account = class extends import_interfaces.AbstractAccount {
5833
5874
  */
5834
5875
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
5835
5876
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
5836
- const recipientDataArray = (0, import_utils28.arrayify)(
5877
+ const recipientDataArray = (0, import_utils29.arrayify)(
5837
5878
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5838
5879
  );
5839
- const amountDataArray = (0, import_utils28.arrayify)(
5880
+ const amountDataArray = (0, import_utils29.arrayify)(
5840
5881
  "0x".concat((0, import_math20.bn)(amount).toHex().substring(2).padStart(16, "0"))
5841
5882
  );
5842
5883
  const script = new Uint8Array([
5843
- ...(0, import_utils28.arrayify)(withdrawScript.bytes),
5884
+ ...(0, import_utils29.arrayify)(withdrawScript.bytes),
5844
5885
  ...recipientDataArray,
5845
5886
  ...amountDataArray
5846
5887
  ]);
@@ -5923,6 +5964,21 @@ var Account = class extends import_interfaces.AbstractAccount {
5923
5964
  }
5924
5965
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
5925
5966
  }
5967
+ /**
5968
+ * Generates an array of fake resources based on the provided coins.
5969
+ *
5970
+ * @param coins - An array of `FakeResources` objects representing the coins.
5971
+ * @returns An array of `Resource` objects with generated properties.
5972
+ */
5973
+ generateFakeResources(coins) {
5974
+ return coins.map((coin) => ({
5975
+ id: (0, import_utils29.hexlify)((0, import_crypto2.randomBytes)(import_abi_coder7.UTXO_ID_LEN)),
5976
+ owner: this.address,
5977
+ blockCreated: (0, import_math20.bn)(1),
5978
+ txCreatedIdx: (0, import_math20.bn)(1),
5979
+ ...coin
5980
+ }));
5981
+ }
5926
5982
  /** @hidden * */
5927
5983
  validateTransferAmount(amount) {
5928
5984
  if ((0, import_math20.bn)(amount).lte(0)) {
@@ -5955,7 +6011,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5955
6011
  txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
5956
6012
  }) {
5957
6013
  const request = transactionRequestify(transactionRequest);
5958
- if (!(0, import_utils28.isDefined)(setGasLimit)) {
6014
+ if (!(0, import_utils29.isDefined)(setGasLimit)) {
5959
6015
  request.gasLimit = gasUsed;
5960
6016
  } else if (gasUsed.gt(setGasLimit)) {
5961
6017
  throw new import_errors16.FuelError(
@@ -5963,7 +6019,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5963
6019
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
5964
6020
  );
5965
6021
  }
5966
- if (!(0, import_utils28.isDefined)(setMaxFee)) {
6022
+ if (!(0, import_utils29.isDefined)(setMaxFee)) {
5967
6023
  request.maxFee = maxFee;
5968
6024
  } else if (maxFee.gt(setMaxFee)) {
5969
6025
  throw new import_errors16.FuelError(
@@ -5977,14 +6033,14 @@ var Account = class extends import_interfaces.AbstractAccount {
5977
6033
 
5978
6034
  // src/wallet/base-wallet-unlocked.ts
5979
6035
  var import_hasher3 = require("@fuel-ts/hasher");
5980
- var import_utils31 = require("@fuel-ts/utils");
6036
+ var import_utils32 = require("@fuel-ts/utils");
5981
6037
 
5982
6038
  // src/signer/signer.ts
5983
6039
  var import_address5 = require("@fuel-ts/address");
5984
- var import_crypto2 = require("@fuel-ts/crypto");
6040
+ var import_crypto3 = require("@fuel-ts/crypto");
5985
6041
  var import_hasher2 = require("@fuel-ts/hasher");
5986
6042
  var import_math21 = require("@fuel-ts/math");
5987
- var import_utils29 = require("@fuel-ts/utils");
6043
+ var import_utils30 = require("@fuel-ts/utils");
5988
6044
  var import_secp256k1 = require("@noble/curves/secp256k1");
5989
6045
  var Signer = class {
5990
6046
  address;
@@ -6004,9 +6060,9 @@ var Signer = class {
6004
6060
  }
6005
6061
  }
6006
6062
  const privateKeyBytes = (0, import_math21.toBytes)(privateKey, 32);
6007
- this.privateKey = (0, import_utils29.hexlify)(privateKeyBytes);
6008
- this.publicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
6009
- this.compressedPublicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
6063
+ this.privateKey = (0, import_utils30.hexlify)(privateKeyBytes);
6064
+ this.publicKey = (0, import_utils30.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
6065
+ this.compressedPublicKey = (0, import_utils30.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
6010
6066
  this.address = import_address5.Address.fromPublicKey(this.publicKey);
6011
6067
  }
6012
6068
  /**
@@ -6020,11 +6076,11 @@ var Signer = class {
6020
6076
  * @returns hashed signature
6021
6077
  */
6022
6078
  sign(data) {
6023
- const signature = import_secp256k1.secp256k1.sign((0, import_utils29.arrayify)(data), (0, import_utils29.arrayify)(this.privateKey));
6079
+ const signature = import_secp256k1.secp256k1.sign((0, import_utils30.arrayify)(data), (0, import_utils30.arrayify)(this.privateKey));
6024
6080
  const r = (0, import_math21.toBytes)(`0x${signature.r.toString(16)}`, 32);
6025
6081
  const s = (0, import_math21.toBytes)(`0x${signature.s.toString(16)}`, 32);
6026
6082
  s[0] |= (signature.recovery || 0) << 7;
6027
- return (0, import_utils29.hexlify)((0, import_utils29.concat)([r, s]));
6083
+ return (0, import_utils30.hexlify)((0, import_utils30.concat)([r, s]));
6028
6084
  }
6029
6085
  /**
6030
6086
  * Add point on the current elliptic curve
@@ -6033,8 +6089,8 @@ var Signer = class {
6033
6089
  * @returns compressed point on the curve
6034
6090
  */
6035
6091
  addPoint(point) {
6036
- const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(this.compressedPublicKey));
6037
- const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(point));
6092
+ const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(this.compressedPublicKey));
6093
+ const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(point));
6038
6094
  const result = p0.add(p1);
6039
6095
  return `0x${result.toHex(true)}`;
6040
6096
  }
@@ -6046,16 +6102,16 @@ var Signer = class {
6046
6102
  * @returns public key from signature from the
6047
6103
  */
6048
6104
  static recoverPublicKey(data, signature) {
6049
- const signedMessageBytes = (0, import_utils29.arrayify)(signature);
6105
+ const signedMessageBytes = (0, import_utils30.arrayify)(signature);
6050
6106
  const r = signedMessageBytes.slice(0, 32);
6051
6107
  const s = signedMessageBytes.slice(32, 64);
6052
6108
  const recoveryParam = (s[0] & 128) >> 7;
6053
6109
  s[0] &= 127;
6054
- const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils29.hexlify)(r)), BigInt((0, import_utils29.hexlify)(s))).addRecoveryBit(
6110
+ const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils30.hexlify)(r)), BigInt((0, import_utils30.hexlify)(s))).addRecoveryBit(
6055
6111
  recoveryParam
6056
6112
  );
6057
- const publicKey = sig.recoverPublicKey((0, import_utils29.arrayify)(data)).toRawBytes(false).slice(1);
6058
- return (0, import_utils29.hexlify)(publicKey);
6113
+ const publicKey = sig.recoverPublicKey((0, import_utils30.arrayify)(data)).toRawBytes(false).slice(1);
6114
+ return (0, import_utils30.hexlify)(publicKey);
6059
6115
  }
6060
6116
  /**
6061
6117
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -6074,7 +6130,7 @@ var Signer = class {
6074
6130
  * @returns random 32-byte hashed
6075
6131
  */
6076
6132
  static generatePrivateKey(entropy) {
6077
- return entropy ? (0, import_hasher2.hash)((0, import_utils29.concat)([(0, import_crypto2.randomBytes)(32), (0, import_utils29.arrayify)(entropy)])) : (0, import_crypto2.randomBytes)(32);
6133
+ return entropy ? (0, import_hasher2.hash)((0, import_utils30.concat)([(0, import_crypto3.randomBytes)(32), (0, import_utils30.arrayify)(entropy)])) : (0, import_crypto3.randomBytes)(32);
6078
6134
  }
6079
6135
  /**
6080
6136
  * Extended publicKey from a compact publicKey
@@ -6083,16 +6139,16 @@ var Signer = class {
6083
6139
  * @returns extended publicKey
6084
6140
  */
6085
6141
  static extendPublicKey(publicKey) {
6086
- const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(publicKey));
6087
- return (0, import_utils29.hexlify)(point.toRawBytes(false).slice(1));
6142
+ const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(publicKey));
6143
+ return (0, import_utils30.hexlify)(point.toRawBytes(false).slice(1));
6088
6144
  }
6089
6145
  };
6090
6146
 
6091
6147
  // src/wallet/keystore-wallet.ts
6092
6148
  var import_address6 = require("@fuel-ts/address");
6093
- var import_crypto3 = require("@fuel-ts/crypto");
6149
+ var import_crypto4 = require("@fuel-ts/crypto");
6094
6150
  var import_errors17 = require("@fuel-ts/errors");
6095
- var import_utils30 = require("@fuel-ts/utils");
6151
+ var import_utils31 = require("@fuel-ts/utils");
6096
6152
  var import_uuid = require("uuid");
6097
6153
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
6098
6154
  var DEFAULT_KDF_PARAMS_R = 8;
@@ -6106,22 +6162,22 @@ var removeHexPrefix = (hexString) => {
6106
6162
  return hexString;
6107
6163
  };
6108
6164
  async function encryptKeystoreWallet(privateKey, address, password) {
6109
- const privateKeyBuffer = (0, import_crypto3.bufferFromString)(removeHexPrefix(privateKey), "hex");
6165
+ const privateKeyBuffer = (0, import_crypto4.bufferFromString)(removeHexPrefix(privateKey), "hex");
6110
6166
  const ownerAddress = import_address6.Address.fromAddressOrString(address);
6111
- const salt = (0, import_crypto3.randomBytes)(DEFAULT_KEY_SIZE);
6112
- const key = (0, import_crypto3.scrypt)({
6113
- password: (0, import_crypto3.bufferFromString)(password),
6167
+ const salt = (0, import_crypto4.randomBytes)(DEFAULT_KEY_SIZE);
6168
+ const key = (0, import_crypto4.scrypt)({
6169
+ password: (0, import_crypto4.bufferFromString)(password),
6114
6170
  salt,
6115
6171
  dklen: DEFAULT_KEY_SIZE,
6116
6172
  n: 2 ** DEFAULT_KDF_PARAMS_LOG_N,
6117
6173
  r: DEFAULT_KDF_PARAMS_R,
6118
6174
  p: DEFAULT_KDF_PARAMS_P
6119
6175
  });
6120
- const iv = (0, import_crypto3.randomBytes)(DEFAULT_IV_SIZE);
6121
- const ciphertext = await (0, import_crypto3.encryptJsonWalletData)(privateKeyBuffer, key, iv);
6176
+ const iv = (0, import_crypto4.randomBytes)(DEFAULT_IV_SIZE);
6177
+ const ciphertext = await (0, import_crypto4.encryptJsonWalletData)(privateKeyBuffer, key, iv);
6122
6178
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
6123
- const macHashUint8Array = (0, import_crypto3.keccak256)(data);
6124
- const mac = (0, import_crypto3.stringFromBuffer)(macHashUint8Array, "hex");
6179
+ const macHashUint8Array = (0, import_crypto4.keccak256)(data);
6180
+ const mac = (0, import_crypto4.stringFromBuffer)(macHashUint8Array, "hex");
6125
6181
  const keystore = {
6126
6182
  id: (0, import_uuid.v4)(),
6127
6183
  version: 3,
@@ -6129,15 +6185,15 @@ async function encryptKeystoreWallet(privateKey, address, password) {
6129
6185
  crypto: {
6130
6186
  cipher: "aes-128-ctr",
6131
6187
  mac,
6132
- cipherparams: { iv: (0, import_crypto3.stringFromBuffer)(iv, "hex") },
6133
- ciphertext: (0, import_crypto3.stringFromBuffer)(ciphertext, "hex"),
6188
+ cipherparams: { iv: (0, import_crypto4.stringFromBuffer)(iv, "hex") },
6189
+ ciphertext: (0, import_crypto4.stringFromBuffer)(ciphertext, "hex"),
6134
6190
  kdf: "scrypt",
6135
6191
  kdfparams: {
6136
6192
  dklen: DEFAULT_KEY_SIZE,
6137
6193
  n: 2 ** DEFAULT_KDF_PARAMS_LOG_N,
6138
6194
  p: DEFAULT_KDF_PARAMS_P,
6139
6195
  r: DEFAULT_KDF_PARAMS_R,
6140
- salt: (0, import_crypto3.stringFromBuffer)(salt, "hex")
6196
+ salt: (0, import_crypto4.stringFromBuffer)(salt, "hex")
6141
6197
  }
6142
6198
  }
6143
6199
  };
@@ -6153,11 +6209,11 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6153
6209
  kdfparams: { dklen, n, r, p, salt }
6154
6210
  }
6155
6211
  } = keystoreWallet;
6156
- const ciphertextBuffer = (0, import_crypto3.bufferFromString)(ciphertext, "hex");
6157
- const ivBuffer = (0, import_crypto3.bufferFromString)(iv, "hex");
6158
- const saltBuffer = (0, import_crypto3.bufferFromString)(salt, "hex");
6159
- const passwordBuffer = (0, import_crypto3.bufferFromString)(password);
6160
- const key = (0, import_crypto3.scrypt)({
6212
+ const ciphertextBuffer = (0, import_crypto4.bufferFromString)(ciphertext, "hex");
6213
+ const ivBuffer = (0, import_crypto4.bufferFromString)(iv, "hex");
6214
+ const saltBuffer = (0, import_crypto4.bufferFromString)(salt, "hex");
6215
+ const passwordBuffer = (0, import_crypto4.bufferFromString)(password);
6216
+ const key = (0, import_crypto4.scrypt)({
6161
6217
  password: passwordBuffer,
6162
6218
  salt: saltBuffer,
6163
6219
  n,
@@ -6166,16 +6222,16 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6166
6222
  dklen
6167
6223
  });
6168
6224
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertextBuffer]);
6169
- const macHashUint8Array = (0, import_crypto3.keccak256)(data);
6170
- const macHash = (0, import_crypto3.stringFromBuffer)(macHashUint8Array, "hex");
6225
+ const macHashUint8Array = (0, import_crypto4.keccak256)(data);
6226
+ const macHash = (0, import_crypto4.stringFromBuffer)(macHashUint8Array, "hex");
6171
6227
  if (mac !== macHash) {
6172
6228
  throw new import_errors17.FuelError(
6173
6229
  import_errors17.ErrorCode.INVALID_PASSWORD,
6174
6230
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
6175
6231
  );
6176
6232
  }
6177
- const buffer = await (0, import_crypto3.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
6178
- const privateKey = (0, import_utils30.hexlify)(buffer);
6233
+ const buffer = await (0, import_crypto4.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
6234
+ const privateKey = (0, import_utils31.hexlify)(buffer);
6179
6235
  return privateKey;
6180
6236
  }
6181
6237
 
@@ -6220,7 +6276,7 @@ var BaseWalletUnlocked = class extends Account {
6220
6276
  */
6221
6277
  async signMessage(message) {
6222
6278
  const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
6223
- return (0, import_utils31.hexlify)(signedMessage);
6279
+ return (0, import_utils32.hexlify)(signedMessage);
6224
6280
  }
6225
6281
  /**
6226
6282
  * Signs a transaction with the wallet's private key.
@@ -6233,7 +6289,7 @@ var BaseWalletUnlocked = class extends Account {
6233
6289
  const chainId = this.provider.getChainId();
6234
6290
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
6235
6291
  const signature = await this.signer().sign(hashedTransaction);
6236
- return (0, import_utils31.hexlify)(signature);
6292
+ return (0, import_utils32.hexlify)(signature);
6237
6293
  }
6238
6294
  /**
6239
6295
  * Populates a transaction with the witnesses signature.
@@ -6266,7 +6322,7 @@ var BaseWalletUnlocked = class extends Account {
6266
6322
  );
6267
6323
  }
6268
6324
  /**
6269
- * Populates the witness signature for a transaction and sends a call to the network using `provider.call`.
6325
+ * Populates the witness signature for a transaction and sends a call to the network using `provider.dryRun`.
6270
6326
  *
6271
6327
  * @param transactionRequestLike - The transaction request to simulate.
6272
6328
  * @returns A promise that resolves to the CallResult object.
@@ -6276,7 +6332,7 @@ var BaseWalletUnlocked = class extends Account {
6276
6332
  if (estimateTxDependencies) {
6277
6333
  await this.provider.estimateTxDependencies(transactionRequest);
6278
6334
  }
6279
- return this.provider.call(
6335
+ return this.provider.dryRun(
6280
6336
  await this.populateTransactionWitnessesSignature(transactionRequest),
6281
6337
  {
6282
6338
  utxoValidation: true,
@@ -6300,17 +6356,17 @@ var BaseWalletUnlocked = class extends Account {
6300
6356
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6301
6357
 
6302
6358
  // src/hdwallet/hdwallet.ts
6303
- var import_crypto5 = require("@fuel-ts/crypto");
6359
+ var import_crypto6 = require("@fuel-ts/crypto");
6304
6360
  var import_errors20 = require("@fuel-ts/errors");
6305
6361
  var import_hasher6 = require("@fuel-ts/hasher");
6306
6362
  var import_math22 = require("@fuel-ts/math");
6307
- var import_utils35 = require("@fuel-ts/utils");
6363
+ var import_utils36 = require("@fuel-ts/utils");
6308
6364
 
6309
6365
  // src/mnemonic/mnemonic.ts
6310
- var import_crypto4 = require("@fuel-ts/crypto");
6366
+ var import_crypto5 = require("@fuel-ts/crypto");
6311
6367
  var import_errors19 = require("@fuel-ts/errors");
6312
6368
  var import_hasher5 = require("@fuel-ts/hasher");
6313
- var import_utils33 = require("@fuel-ts/utils");
6369
+ var import_utils34 = require("@fuel-ts/utils");
6314
6370
 
6315
6371
  // src/wordlists/words/english.ts
6316
6372
  var english = [
@@ -8373,7 +8429,7 @@ var Language = /* @__PURE__ */ ((Language2) => {
8373
8429
  // src/mnemonic/utils.ts
8374
8430
  var import_errors18 = require("@fuel-ts/errors");
8375
8431
  var import_hasher4 = require("@fuel-ts/hasher");
8376
- var import_utils32 = require("@fuel-ts/utils");
8432
+ var import_utils33 = require("@fuel-ts/utils");
8377
8433
  function getLowerMask(bits) {
8378
8434
  return (1 << bits) - 1;
8379
8435
  }
@@ -8408,14 +8464,14 @@ function entropyToMnemonicIndices(entropy) {
8408
8464
  }
8409
8465
  }
8410
8466
  const checksumBits = entropy.length / 4;
8411
- const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
8467
+ const checksum = (0, import_utils33.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
8412
8468
  indices[indices.length - 1] <<= checksumBits;
8413
8469
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
8414
8470
  return indices;
8415
8471
  }
8416
8472
  function mnemonicWordsToEntropy(words, wordlist) {
8417
8473
  const size = Math.ceil(11 * words.length / 8);
8418
- const entropy = (0, import_utils32.arrayify)(new Uint8Array(size));
8474
+ const entropy = (0, import_utils33.arrayify)(new Uint8Array(size));
8419
8475
  let offset = 0;
8420
8476
  for (let i = 0; i < words.length; i += 1) {
8421
8477
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
@@ -8435,7 +8491,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
8435
8491
  const entropyBits = 32 * words.length / 3;
8436
8492
  const checksumBits = words.length / 3;
8437
8493
  const checksumMask = getUpperMask(checksumBits);
8438
- const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
8494
+ const checksum = (0, import_utils33.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
8439
8495
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
8440
8496
  throw new import_errors18.FuelError(
8441
8497
  import_errors18.ErrorCode.INVALID_CHECKSUM,
@@ -8446,7 +8502,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
8446
8502
  }
8447
8503
 
8448
8504
  // src/mnemonic/mnemonic.ts
8449
- var MasterSecret = (0, import_utils33.toUtf8Bytes)("Bitcoin seed");
8505
+ var MasterSecret = (0, import_utils34.toUtf8Bytes)("Bitcoin seed");
8450
8506
  var MainnetPRV = "0x0488ade4";
8451
8507
  var TestnetPRV = "0x04358394";
8452
8508
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
@@ -8510,7 +8566,7 @@ var Mnemonic = class {
8510
8566
  static mnemonicToEntropy(phrase, wordlist = english) {
8511
8567
  const words = getWords(phrase);
8512
8568
  assertMnemonic(words);
8513
- return (0, import_utils33.hexlify)(mnemonicWordsToEntropy(words, wordlist));
8569
+ return (0, import_utils34.hexlify)(mnemonicWordsToEntropy(words, wordlist));
8514
8570
  }
8515
8571
  /**
8516
8572
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -8518,7 +8574,7 @@ var Mnemonic = class {
8518
8574
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8519
8575
  */
8520
8576
  static entropyToMnemonic(entropy, wordlist = english) {
8521
- const entropyBytes = (0, import_utils33.arrayify)(entropy);
8577
+ const entropyBytes = (0, import_utils34.arrayify)(entropy);
8522
8578
  assertWordList(wordlist);
8523
8579
  assertEntropy(entropyBytes);
8524
8580
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -8530,9 +8586,9 @@ var Mnemonic = class {
8530
8586
  */
8531
8587
  static mnemonicToSeed(phrase, passphrase = "") {
8532
8588
  assertMnemonic(getWords(phrase));
8533
- const phraseBytes = (0, import_utils33.toUtf8Bytes)(getPhrase(phrase));
8534
- const salt = (0, import_utils33.toUtf8Bytes)(`mnemonic${passphrase}`);
8535
- return (0, import_crypto4.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
8589
+ const phraseBytes = (0, import_utils34.toUtf8Bytes)(getPhrase(phrase));
8590
+ const salt = (0, import_utils34.toUtf8Bytes)(`mnemonic${passphrase}`);
8591
+ return (0, import_crypto5.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
8536
8592
  }
8537
8593
  /**
8538
8594
  * @param phrase - Mnemonic phrase composed by words from the provided wordlist
@@ -8587,14 +8643,14 @@ var Mnemonic = class {
8587
8643
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8588
8644
  */
8589
8645
  static masterKeysFromSeed(seed) {
8590
- const seedArray = (0, import_utils33.arrayify)(seed);
8646
+ const seedArray = (0, import_utils34.arrayify)(seed);
8591
8647
  if (seedArray.length < 16 || seedArray.length > 64) {
8592
8648
  throw new import_errors19.FuelError(
8593
8649
  import_errors19.ErrorCode.INVALID_SEED,
8594
8650
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
8595
8651
  );
8596
8652
  }
8597
- return (0, import_utils33.arrayify)((0, import_crypto4.computeHmac)("sha512", MasterSecret, seedArray));
8653
+ return (0, import_utils34.arrayify)((0, import_crypto5.computeHmac)("sha512", MasterSecret, seedArray));
8598
8654
  }
8599
8655
  /**
8600
8656
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -8605,22 +8661,22 @@ var Mnemonic = class {
8605
8661
  */
8606
8662
  static seedToExtendedKey(seed, testnet = false) {
8607
8663
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
8608
- const prefix = (0, import_utils33.arrayify)(testnet ? TestnetPRV : MainnetPRV);
8664
+ const prefix = (0, import_utils34.arrayify)(testnet ? TestnetPRV : MainnetPRV);
8609
8665
  const depth = "0x00";
8610
8666
  const fingerprint = "0x00000000";
8611
8667
  const index = "0x00000000";
8612
8668
  const chainCode = masterKey.slice(32);
8613
8669
  const privateKey = masterKey.slice(0, 32);
8614
- const extendedKey = (0, import_utils33.concat)([
8670
+ const extendedKey = (0, import_utils34.concat)([
8615
8671
  prefix,
8616
8672
  depth,
8617
8673
  fingerprint,
8618
8674
  index,
8619
8675
  chainCode,
8620
- (0, import_utils33.concat)(["0x00", privateKey])
8676
+ (0, import_utils34.concat)(["0x00", privateKey])
8621
8677
  ]);
8622
- const checksum = (0, import_utils33.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
8623
- return (0, import_utils33.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
8678
+ const checksum = (0, import_utils34.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
8679
+ return (0, import_utils34.encodeBase58)((0, import_utils34.concat)([extendedKey, checksum]));
8624
8680
  }
8625
8681
  /**
8626
8682
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -8635,7 +8691,7 @@ var Mnemonic = class {
8635
8691
  * @returns A randomly generated mnemonic
8636
8692
  */
8637
8693
  static generate(size = 32, extraEntropy = "") {
8638
- const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils33.concat)([(0, import_crypto4.randomBytes)(size), (0, import_utils33.arrayify)(extraEntropy)])) : (0, import_crypto4.randomBytes)(size);
8694
+ const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils34.concat)([(0, import_crypto5.randomBytes)(size), (0, import_utils34.arrayify)(extraEntropy)])) : (0, import_crypto5.randomBytes)(size);
8639
8695
  return Mnemonic.entropyToMnemonic(entropy);
8640
8696
  }
8641
8697
  };
@@ -8643,12 +8699,12 @@ var mnemonic_default = Mnemonic;
8643
8699
 
8644
8700
  // src/hdwallet/hdwallet.ts
8645
8701
  var HARDENED_INDEX = 2147483648;
8646
- var MainnetPRV2 = (0, import_utils35.hexlify)("0x0488ade4");
8647
- var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
8648
- var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
8649
- var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
8702
+ var MainnetPRV2 = (0, import_utils36.hexlify)("0x0488ade4");
8703
+ var MainnetPUB = (0, import_utils36.hexlify)("0x0488b21e");
8704
+ var TestnetPRV2 = (0, import_utils36.hexlify)("0x04358394");
8705
+ var TestnetPUB = (0, import_utils36.hexlify)("0x043587cf");
8650
8706
  function base58check(data) {
8651
- return (0, import_utils35.encodeBase58)((0, import_utils35.concat)([data, (0, import_utils35.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
8707
+ return (0, import_utils36.encodeBase58)((0, import_utils36.concat)([data, (0, import_utils36.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
8652
8708
  }
8653
8709
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
8654
8710
  if (isPublic) {
@@ -8657,11 +8713,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
8657
8713
  return testnet ? TestnetPRV2 : MainnetPRV2;
8658
8714
  }
8659
8715
  function isPublicExtendedKey(extendedKey) {
8660
- return [MainnetPUB, TestnetPUB].includes((0, import_utils35.hexlify)(extendedKey.slice(0, 4)));
8716
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils36.hexlify)(extendedKey.slice(0, 4)));
8661
8717
  }
8662
8718
  function isValidExtendedKey(extendedKey) {
8663
8719
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
8664
- (0, import_utils35.hexlify)(extendedKey.slice(0, 4))
8720
+ (0, import_utils36.hexlify)(extendedKey.slice(0, 4))
8665
8721
  );
8666
8722
  }
8667
8723
  function parsePath(path, depth = 0) {
@@ -8679,8 +8735,8 @@ function parsePath(path, depth = 0) {
8679
8735
  var HDWallet = class {
8680
8736
  depth = 0;
8681
8737
  index = 0;
8682
- fingerprint = (0, import_utils35.hexlify)("0x00000000");
8683
- parentFingerprint = (0, import_utils35.hexlify)("0x00000000");
8738
+ fingerprint = (0, import_utils36.hexlify)("0x00000000");
8739
+ parentFingerprint = (0, import_utils36.hexlify)("0x00000000");
8684
8740
  privateKey;
8685
8741
  publicKey;
8686
8742
  chainCode;
@@ -8692,8 +8748,8 @@ var HDWallet = class {
8692
8748
  constructor(config) {
8693
8749
  if (config.privateKey) {
8694
8750
  const signer = new Signer(config.privateKey);
8695
- this.publicKey = (0, import_utils35.hexlify)(signer.compressedPublicKey);
8696
- this.privateKey = (0, import_utils35.hexlify)(config.privateKey);
8751
+ this.publicKey = (0, import_utils36.hexlify)(signer.compressedPublicKey);
8752
+ this.privateKey = (0, import_utils36.hexlify)(config.privateKey);
8697
8753
  } else {
8698
8754
  if (!config.publicKey) {
8699
8755
  throw new import_errors20.FuelError(
@@ -8701,10 +8757,10 @@ var HDWallet = class {
8701
8757
  "Both public and private Key cannot be missing. At least one should be provided."
8702
8758
  );
8703
8759
  }
8704
- this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
8760
+ this.publicKey = (0, import_utils36.hexlify)(config.publicKey);
8705
8761
  }
8706
8762
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
8707
- this.fingerprint = (0, import_utils35.dataSlice)((0, import_crypto5.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
8763
+ this.fingerprint = (0, import_utils36.dataSlice)((0, import_crypto6.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
8708
8764
  this.depth = config.depth || this.depth;
8709
8765
  this.index = config.index || this.index;
8710
8766
  this.chainCode = config.chainCode;
@@ -8720,9 +8776,9 @@ var HDWallet = class {
8720
8776
  * @returns A new instance of HDWallet on the derived index
8721
8777
  */
8722
8778
  deriveIndex(index) {
8723
- const privateKey = this.privateKey && (0, import_utils35.arrayify)(this.privateKey);
8724
- const publicKey = (0, import_utils35.arrayify)(this.publicKey);
8725
- const chainCode = (0, import_utils35.arrayify)(this.chainCode);
8779
+ const privateKey = this.privateKey && (0, import_utils36.arrayify)(this.privateKey);
8780
+ const publicKey = (0, import_utils36.arrayify)(this.publicKey);
8781
+ const chainCode = (0, import_utils36.arrayify)(this.chainCode);
8726
8782
  const data = new Uint8Array(37);
8727
8783
  if (index & HARDENED_INDEX) {
8728
8784
  if (!privateKey) {
@@ -8733,10 +8789,10 @@ var HDWallet = class {
8733
8789
  }
8734
8790
  data.set(privateKey, 1);
8735
8791
  } else {
8736
- data.set((0, import_utils35.arrayify)(this.publicKey));
8792
+ data.set((0, import_utils36.arrayify)(this.publicKey));
8737
8793
  }
8738
8794
  data.set((0, import_math22.toBytes)(index, 4), 33);
8739
- const bytes = (0, import_utils35.arrayify)((0, import_crypto5.computeHmac)("sha512", chainCode, data));
8795
+ const bytes = (0, import_utils36.arrayify)((0, import_crypto6.computeHmac)("sha512", chainCode, data));
8740
8796
  const IL = bytes.slice(0, 32);
8741
8797
  const IR = bytes.slice(32);
8742
8798
  if (privateKey) {
@@ -8750,7 +8806,7 @@ var HDWallet = class {
8750
8806
  parentFingerprint: this.fingerprint
8751
8807
  });
8752
8808
  }
8753
- const signer = new Signer((0, import_utils35.hexlify)(IL));
8809
+ const signer = new Signer((0, import_utils36.hexlify)(IL));
8754
8810
  const Ki = signer.addPoint(publicKey);
8755
8811
  return new HDWallet({
8756
8812
  publicKey: Ki,
@@ -8785,12 +8841,12 @@ var HDWallet = class {
8785
8841
  );
8786
8842
  }
8787
8843
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
8788
- const depth = (0, import_utils35.hexlify)(Uint8Array.from([this.depth]));
8844
+ const depth = (0, import_utils36.hexlify)(Uint8Array.from([this.depth]));
8789
8845
  const parentFingerprint = this.parentFingerprint;
8790
8846
  const index = (0, import_math22.toHex)(this.index, 4);
8791
8847
  const chainCode = this.chainCode;
8792
- const key = this.privateKey != null && !isPublic ? (0, import_utils35.concat)(["0x00", this.privateKey]) : this.publicKey;
8793
- const extendedKey = (0, import_utils35.arrayify)((0, import_utils35.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
8848
+ const key = this.privateKey != null && !isPublic ? (0, import_utils36.concat)(["0x00", this.privateKey]) : this.publicKey;
8849
+ const extendedKey = (0, import_utils36.arrayify)((0, import_utils36.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
8794
8850
  return base58check(extendedKey);
8795
8851
  }
8796
8852
  /**
@@ -8802,13 +8858,13 @@ var HDWallet = class {
8802
8858
  static fromSeed(seed) {
8803
8859
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
8804
8860
  return new HDWallet({
8805
- chainCode: (0, import_utils35.arrayify)(masterKey.slice(32)),
8806
- privateKey: (0, import_utils35.arrayify)(masterKey.slice(0, 32))
8861
+ chainCode: (0, import_utils36.arrayify)(masterKey.slice(32)),
8862
+ privateKey: (0, import_utils36.arrayify)(masterKey.slice(0, 32))
8807
8863
  });
8808
8864
  }
8809
8865
  static fromExtendedKey(extendedKey) {
8810
- const decoded = (0, import_utils35.hexlify)((0, import_math22.toBytes)((0, import_utils35.decodeBase58)(extendedKey)));
8811
- const bytes = (0, import_utils35.arrayify)(decoded);
8866
+ const decoded = (0, import_utils36.hexlify)((0, import_math22.toBytes)((0, import_utils36.decodeBase58)(extendedKey)));
8867
+ const bytes = (0, import_utils36.arrayify)(decoded);
8812
8868
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8813
8869
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
8814
8870
  throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
@@ -8817,9 +8873,9 @@ var HDWallet = class {
8817
8873
  throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
8818
8874
  }
8819
8875
  const depth = bytes[4];
8820
- const parentFingerprint = (0, import_utils35.hexlify)(bytes.slice(5, 9));
8821
- const index = parseInt((0, import_utils35.hexlify)(bytes.slice(9, 13)).substring(2), 16);
8822
- const chainCode = (0, import_utils35.hexlify)(bytes.slice(13, 45));
8876
+ const parentFingerprint = (0, import_utils36.hexlify)(bytes.slice(5, 9));
8877
+ const index = parseInt((0, import_utils36.hexlify)(bytes.slice(9, 13)).substring(2), 16);
8878
+ const chainCode = (0, import_utils36.hexlify)(bytes.slice(13, 45));
8823
8879
  const key = bytes.slice(45, 78);
8824
8880
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
8825
8881
  throw new import_errors20.FuelError(
@@ -9007,7 +9063,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
9007
9063
 
9008
9064
  // src/wallet-manager/wallet-manager.ts
9009
9065
  var import_address9 = require("@fuel-ts/address");
9010
- var import_crypto6 = require("@fuel-ts/crypto");
9066
+ var import_crypto7 = require("@fuel-ts/crypto");
9011
9067
  var import_errors23 = require("@fuel-ts/errors");
9012
9068
  var import_events = require("events");
9013
9069
 
@@ -9335,7 +9391,7 @@ var _WalletManager = class extends import_events.EventEmitter {
9335
9391
  await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
9336
9392
  const data = await this.storage.getItem(this.STORAGE_KEY);
9337
9393
  if (data) {
9338
- const state = await (0, import_crypto6.decrypt)(__privateGet(this, _passphrase), JSON.parse(data));
9394
+ const state = await (0, import_crypto7.decrypt)(__privateGet(this, _passphrase), JSON.parse(data));
9339
9395
  __privateSet(this, _vaults, __privateMethod(this, _deserializeVaults, deserializeVaults_fn).call(this, state.vaults));
9340
9396
  }
9341
9397
  }
@@ -9344,7 +9400,7 @@ var _WalletManager = class extends import_events.EventEmitter {
9344
9400
  */
9345
9401
  async saveState() {
9346
9402
  await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
9347
- const encryptedData = await (0, import_crypto6.encrypt)(__privateGet(this, _passphrase), {
9403
+ const encryptedData = await (0, import_crypto7.encrypt)(__privateGet(this, _passphrase), {
9348
9404
  vaults: __privateMethod(this, _serializeVaults, serializeVaults_fn).call(this, __privateGet(this, _vaults))
9349
9405
  });
9350
9406
  await this.storage.setItem(this.STORAGE_KEY, JSON.stringify(encryptedData));
@@ -9420,21 +9476,21 @@ var StorageAbstract = class {
9420
9476
  };
9421
9477
 
9422
9478
  // src/predicate/predicate.ts
9423
- var import_abi_coder7 = require("@fuel-ts/abi-coder");
9479
+ var import_abi_coder8 = require("@fuel-ts/abi-coder");
9424
9480
  var import_address10 = require("@fuel-ts/address");
9425
9481
  var import_errors25 = require("@fuel-ts/errors");
9426
- var import_utils37 = require("@fuel-ts/utils");
9482
+ var import_utils38 = require("@fuel-ts/utils");
9427
9483
 
9428
9484
  // src/predicate/utils/getPredicateRoot.ts
9429
9485
  var import_hasher7 = require("@fuel-ts/hasher");
9430
9486
  var import_merkle = require("@fuel-ts/merkle");
9431
- var import_utils36 = require("@fuel-ts/utils");
9487
+ var import_utils37 = require("@fuel-ts/utils");
9432
9488
  var getPredicateRoot = (bytecode) => {
9433
9489
  const chunkSize = 16 * 1024;
9434
- const bytes = (0, import_utils36.arrayify)(bytecode);
9435
- const chunks = (0, import_utils36.chunkAndPadBytes)(bytes, chunkSize);
9436
- const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils36.hexlify)(c)));
9437
- const predicateRoot = (0, import_hasher7.hash)((0, import_utils36.concat)(["0x4655454C", codeRoot]));
9490
+ const bytes = (0, import_utils37.arrayify)(bytecode);
9491
+ const chunks = (0, import_utils37.chunkAndPadBytes)(bytes, chunkSize);
9492
+ const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils37.hexlify)(c)));
9493
+ const predicateRoot = (0, import_hasher7.hash)((0, import_utils37.concat)(["0x4655454C", codeRoot]));
9438
9494
  return predicateRoot;
9439
9495
  };
9440
9496
 
@@ -9486,8 +9542,8 @@ var Predicate = class extends Account {
9486
9542
  }
9487
9543
  request.inputs.filter(isRequestInputResource).forEach((input) => {
9488
9544
  if (isRequestInputResourceFromOwner(input, this.address)) {
9489
- input.predicate = (0, import_utils37.hexlify)(this.bytes);
9490
- input.predicateData = (0, import_utils37.hexlify)(this.getPredicateData());
9545
+ input.predicate = (0, import_utils38.hexlify)(this.bytes);
9546
+ input.predicateData = (0, import_utils38.hexlify)(this.getPredicateData());
9491
9547
  input.witnessIndex = 0;
9492
9548
  }
9493
9549
  });
@@ -9529,10 +9585,10 @@ var Predicate = class extends Account {
9529
9585
  * @returns An object containing the new predicate bytes and interface.
9530
9586
  */
9531
9587
  static processPredicateData(bytes, jsonAbi, configurableConstants) {
9532
- let predicateBytes = (0, import_utils37.arrayify)(bytes);
9588
+ let predicateBytes = (0, import_utils38.arrayify)(bytes);
9533
9589
  let abiInterface;
9534
9590
  if (jsonAbi) {
9535
- abiInterface = new import_abi_coder7.Interface(jsonAbi);
9591
+ abiInterface = new import_abi_coder8.Interface(jsonAbi);
9536
9592
  if (abiInterface.functions.main === void 0) {
9537
9593
  throw new import_errors25.FuelError(
9538
9594
  import_errors25.ErrorCode.ABI_MAIN_METHOD_MISSING,
@@ -9567,8 +9623,21 @@ var Predicate = class extends Account {
9567
9623
  );
9568
9624
  return resources.map((resource) => ({
9569
9625
  ...resource,
9570
- predicate: (0, import_utils37.hexlify)(this.bytes),
9571
- predicateData: (0, import_utils37.hexlify)(this.getPredicateData())
9626
+ predicate: (0, import_utils38.hexlify)(this.bytes),
9627
+ predicateData: (0, import_utils38.hexlify)(this.getPredicateData())
9628
+ }));
9629
+ }
9630
+ /**
9631
+ * Generates an array of fake resources based on the provided coins.
9632
+ *
9633
+ * @param coins - An array of `FakeResources` objects representing the coins.
9634
+ * @returns An array of `Resource` objects with generated properties.
9635
+ */
9636
+ generateFakeResources(coins) {
9637
+ return super.generateFakeResources(coins).map((coin) => ({
9638
+ ...coin,
9639
+ predicate: (0, import_utils38.hexlify)(this.bytes),
9640
+ predicateData: (0, import_utils38.hexlify)(this.getPredicateData())
9572
9641
  }));
9573
9642
  }
9574
9643
  /**
@@ -10433,7 +10502,6 @@ __publicField(Fuel, "defaultConfig", {});
10433
10502
  resolveGasDependentCosts,
10434
10503
  resolveIconPaths,
10435
10504
  returnZeroScript,
10436
- sleep,
10437
10505
  transactionRequestify,
10438
10506
  urlJoin,
10439
10507
  withTimeout,