@fuel-ts/account 0.0.0-rc-2034-20240411123358 → 0.0.0-rc-2037-20240411135757

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.

@@ -1051,7 +1051,6 @@ var MemoryCache = class {
1051
1051
  };
1052
1052
 
1053
1053
  // src/providers/transaction-request/input.ts
1054
- var import_abi_coder = require("@fuel-ts/abi-coder");
1055
1054
  var import_configs2 = require("@fuel-ts/address/configs");
1056
1055
  var import_errors3 = require("@fuel-ts/errors");
1057
1056
  var import_math2 = require("@fuel-ts/math");
@@ -1065,8 +1064,8 @@ var inputify = (value) => {
1065
1064
  const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
1066
1065
  return {
1067
1066
  type: import_transactions.InputType.Coin,
1068
- txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, import_abi_coder.BYTES_32)),
1069
- outputIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.id).slice(import_abi_coder.BYTES_32, import_abi_coder.UTXO_ID_LEN)),
1067
+ txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, 32)),
1068
+ outputIndex: (0, import_utils3.arrayify)(value.id)[32],
1070
1069
  owner: (0, import_utils3.hexlify)(value.owner),
1071
1070
  amount: (0, import_math2.bn)(value.amount),
1072
1071
  assetId: (0, import_utils3.hexlify)(value.assetId),
@@ -1184,10 +1183,8 @@ var outputify = (value) => {
1184
1183
  };
1185
1184
 
1186
1185
  // src/providers/transaction-request/transaction-request.ts
1187
- var import_abi_coder2 = require("@fuel-ts/abi-coder");
1188
1186
  var import_address = require("@fuel-ts/address");
1189
1187
  var import_configs7 = require("@fuel-ts/address/configs");
1190
- var import_crypto = require("@fuel-ts/crypto");
1191
1188
  var import_math7 = require("@fuel-ts/math");
1192
1189
  var import_transactions6 = require("@fuel-ts/transactions");
1193
1190
  var import_utils9 = require("@fuel-ts/utils");
@@ -1842,8 +1839,8 @@ var BaseTransactionRequest = class {
1842
1839
  * @param predicate - Predicate bytes.
1843
1840
  * @param predicateData - Predicate data bytes.
1844
1841
  */
1845
- addCoinInput(coin, predicate) {
1846
- const { assetId, owner, amount } = coin;
1842
+ addCoinInput(coin) {
1843
+ const { assetId, owner, amount, id, predicate } = coin;
1847
1844
  let witnessIndex;
1848
1845
  if (predicate) {
1849
1846
  witnessIndex = 0;
@@ -1854,14 +1851,14 @@ var BaseTransactionRequest = class {
1854
1851
  }
1855
1852
  }
1856
1853
  const input = {
1857
- ...coin,
1854
+ id,
1858
1855
  type: import_transactions6.InputType.Coin,
1859
1856
  owner: owner.toB256(),
1860
1857
  amount,
1861
1858
  assetId,
1862
1859
  txPointer: "0x00000000000000000000000000000000",
1863
1860
  witnessIndex,
1864
- predicate: predicate?.bytes
1861
+ predicate
1865
1862
  };
1866
1863
  this.pushInput(input);
1867
1864
  this.addChangeOutput(owner, assetId);
@@ -1874,8 +1871,8 @@ var BaseTransactionRequest = class {
1874
1871
  * @param predicate - Predicate bytes.
1875
1872
  * @param predicateData - Predicate data bytes.
1876
1873
  */
1877
- addMessageInput(message, predicate) {
1878
- const { recipient, sender, amount } = message;
1874
+ addMessageInput(message) {
1875
+ const { recipient, sender, amount, predicate, nonce } = message;
1879
1876
  const assetId = import_configs7.BaseAssetId;
1880
1877
  let witnessIndex;
1881
1878
  if (predicate) {
@@ -1887,13 +1884,13 @@ var BaseTransactionRequest = class {
1887
1884
  }
1888
1885
  }
1889
1886
  const input = {
1890
- ...message,
1887
+ nonce,
1891
1888
  type: import_transactions6.InputType.Message,
1892
1889
  sender: sender.toB256(),
1893
1890
  recipient: recipient.toB256(),
1894
1891
  amount,
1895
1892
  witnessIndex,
1896
- predicate: predicate?.bytes
1893
+ predicate
1897
1894
  };
1898
1895
  this.pushInput(input);
1899
1896
  this.addChangeOutput(recipient, assetId);
@@ -1924,32 +1921,6 @@ var BaseTransactionRequest = class {
1924
1921
  resources.forEach((resource) => this.addResource(resource));
1925
1922
  return this;
1926
1923
  }
1927
- /**
1928
- * Adds multiple resources to the transaction by adding coin/message inputs and change
1929
- * outputs from the related assetIds.
1930
- *
1931
- * @param resources - The resources to add.
1932
- * @returns This transaction.
1933
- */
1934
- addPredicateResource(resource, predicate) {
1935
- if (isCoin(resource)) {
1936
- this.addCoinInput(resource, predicate);
1937
- } else {
1938
- this.addMessageInput(resource, predicate);
1939
- }
1940
- return this;
1941
- }
1942
- /**
1943
- * Adds multiple predicate coin/message inputs to the transaction and change outputs
1944
- * from the related assetIds.
1945
- *
1946
- * @param resources - The resources to add.
1947
- * @returns This transaction.
1948
- */
1949
- addPredicateResources(resources, predicate) {
1950
- resources.forEach((resource) => this.addPredicateResource(resource, predicate));
1951
- return this;
1952
- }
1953
1924
  /**
1954
1925
  * Adds a coin output to the transaction.
1955
1926
  *
@@ -2048,6 +2019,12 @@ var BaseTransactionRequest = class {
2048
2019
  * @param quantities - CoinQuantity Array.
2049
2020
  */
2050
2021
  fundWithFakeUtxos(quantities, resourcesOwner) {
2022
+ let idCounter = 0;
2023
+ const generateId = () => {
2024
+ const counterString = String(idCounter++);
2025
+ const id = import_configs7.ZeroBytes32.slice(0, -counterString.length).concat(counterString);
2026
+ return id;
2027
+ };
2051
2028
  const findAssetInput = (assetId) => this.inputs.find((input) => {
2052
2029
  if ("assetId" in input) {
2053
2030
  return input.assetId === assetId;
@@ -2057,12 +2034,12 @@ var BaseTransactionRequest = class {
2057
2034
  const updateAssetInput = (assetId, quantity) => {
2058
2035
  const assetInput = findAssetInput(assetId);
2059
2036
  if (assetInput && "assetId" in assetInput) {
2060
- assetInput.id = (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN));
2037
+ assetInput.id = generateId();
2061
2038
  assetInput.amount = quantity;
2062
2039
  } else {
2063
2040
  this.addResources([
2064
2041
  {
2065
- id: (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN)),
2042
+ id: generateId(),
2066
2043
  amount: quantity,
2067
2044
  assetId,
2068
2045
  owner: resourcesOwner || import_address.Address.fromRandom(),
@@ -2317,7 +2294,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2317
2294
  };
2318
2295
 
2319
2296
  // src/providers/transaction-request/script-transaction-request.ts
2320
- var import_abi_coder3 = require("@fuel-ts/abi-coder");
2297
+ var import_abi_coder = require("@fuel-ts/abi-coder");
2321
2298
  var import_address2 = require("@fuel-ts/address");
2322
2299
  var import_configs10 = require("@fuel-ts/address/configs");
2323
2300
  var import_math10 = require("@fuel-ts/math");
@@ -2509,7 +2486,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2509
2486
  * @returns The current instance of the `ScriptTransactionRequest`.
2510
2487
  */
2511
2488
  setData(abi, args) {
2512
- const abiInterface = new import_abi_coder3.Interface(abi);
2489
+ const abiInterface = new import_abi_coder.Interface(abi);
2513
2490
  this.scriptData = abiInterface.functions.main.encodeArguments(args);
2514
2491
  return this;
2515
2492
  }
@@ -2631,17 +2608,17 @@ var import_math13 = require("@fuel-ts/math");
2631
2608
  var import_transactions14 = require("@fuel-ts/transactions");
2632
2609
 
2633
2610
  // src/providers/transaction-summary/call.ts
2634
- var import_abi_coder4 = require("@fuel-ts/abi-coder");
2611
+ var import_abi_coder2 = require("@fuel-ts/abi-coder");
2635
2612
  var import_math12 = require("@fuel-ts/math");
2636
2613
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2637
- const abiInterface = new import_abi_coder4.Interface(abi);
2614
+ const abiInterface = new import_abi_coder2.Interface(abi);
2638
2615
  const callFunctionSelector = receipt.param1.toHex(8);
2639
2616
  const functionFragment = abiInterface.getFunction(callFunctionSelector);
2640
2617
  const inputs = functionFragment.jsonFn.inputs;
2641
2618
  let encodedArgs;
2642
2619
  if (functionFragment.isInputDataPointer) {
2643
2620
  if (rawPayload) {
2644
- const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2621
+ const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder2.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2645
2622
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2646
2623
  }
2647
2624
  } else {
@@ -3244,13 +3221,13 @@ function assembleTransactionSummary(params) {
3244
3221
  }
3245
3222
 
3246
3223
  // src/providers/transaction-response/getDecodedLogs.ts
3247
- var import_abi_coder5 = require("@fuel-ts/abi-coder");
3224
+ var import_abi_coder3 = require("@fuel-ts/abi-coder");
3248
3225
  var import_transactions16 = require("@fuel-ts/transactions");
3249
3226
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3250
3227
  return receipts.reduce((logs, receipt) => {
3251
3228
  if (receipt.type === import_transactions16.ReceiptType.LogData || receipt.type === import_transactions16.ReceiptType.Log) {
3252
- const interfaceToUse = new import_abi_coder5.Interface(externalAbis[receipt.id] || mainAbi);
3253
- const data = receipt.type === import_transactions16.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3229
+ const interfaceToUse = new import_abi_coder3.Interface(externalAbis[receipt.id] || mainAbi);
3230
+ const data = receipt.type === import_transactions16.ReceiptType.Log ? new import_abi_coder3.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3254
3231
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3255
3232
  logs.push(decodedLog);
3256
3233
  }
@@ -3892,36 +3869,6 @@ var _Provider = class {
3892
3869
  missingContractIds
3893
3870
  };
3894
3871
  }
3895
- /**
3896
- * Estimates the transaction gas and fee based on the provided transaction request.
3897
- * @param transactionRequest - The transaction request object.
3898
- * @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
3899
- */
3900
- estimateTxGasAndFee(params) {
3901
- const { transactionRequest } = params;
3902
- const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
3903
- const chainInfo = this.getChain();
3904
- const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
3905
- transactionRequest.gasPrice = gasPrice;
3906
- const minGas = transactionRequest.calculateMinGas(chainInfo);
3907
- const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
3908
- if (transactionRequest.type === import_transactions18.TransactionType.Script) {
3909
- if (transactionRequest.gasLimit.eq(0)) {
3910
- transactionRequest.gasLimit = minGas;
3911
- transactionRequest.gasLimit = maxGasPerTx.sub(
3912
- transactionRequest.calculateMaxGas(chainInfo, minGas)
3913
- );
3914
- }
3915
- }
3916
- const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
3917
- const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
3918
- return {
3919
- minGas,
3920
- minFee,
3921
- maxGas,
3922
- maxFee
3923
- };
3924
- }
3925
3872
  /**
3926
3873
  * Executes a signed transaction without applying the states changes
3927
3874
  * on the chain.
@@ -3969,16 +3916,17 @@ var _Provider = class {
3969
3916
  signatureCallback
3970
3917
  } = {}) {
3971
3918
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
3972
- const { minGasPrice } = this.getGasConfig();
3973
- const setGasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
3919
+ const chainInfo = this.getChain();
3920
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
3921
+ const gasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
3974
3922
  const isScriptTransaction = txRequestClone.type === import_transactions18.TransactionType.Script;
3975
3923
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
3976
3924
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3977
3925
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3978
- if (isScriptTransaction) {
3979
- txRequestClone.gasLimit = (0, import_math15.bn)(0);
3980
- }
3981
3926
  if (estimatePredicates) {
3927
+ if (isScriptTransaction) {
3928
+ txRequestClone.gasLimit = (0, import_math15.bn)(0);
3929
+ }
3982
3930
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3983
3931
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
3984
3932
  }
@@ -3987,34 +3935,36 @@ var _Provider = class {
3987
3935
  if (signatureCallback && isScriptTransaction) {
3988
3936
  await signatureCallback(txRequestClone);
3989
3937
  }
3990
- let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
3991
- transactionRequest: txRequestClone
3992
- });
3938
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
3939
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
3993
3940
  let receipts = [];
3994
3941
  let missingContractIds = [];
3995
3942
  let outputVariables = 0;
3996
- let gasUsed = (0, import_math15.bn)(0);
3997
3943
  if (isScriptTransaction && estimateTxDependencies) {
3998
3944
  txRequestClone.gasPrice = (0, import_math15.bn)(0);
3945
+ txRequestClone.gasLimit = (0, import_math15.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3999
3946
  const result = await this.estimateTxDependencies(txRequestClone);
4000
3947
  receipts = result.receipts;
4001
3948
  outputVariables = result.outputVariables;
4002
3949
  missingContractIds = result.missingContractIds;
4003
- gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4004
- txRequestClone.gasLimit = gasUsed;
4005
- txRequestClone.gasPrice = setGasPrice;
4006
- ({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4007
- transactionRequest: txRequestClone
4008
- }));
4009
3950
  }
3951
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
3952
+ const usedFee = calculatePriceWithFactor(
3953
+ gasUsed,
3954
+ gasPrice,
3955
+ gasPriceFactor
3956
+ ).normalizeZeroToOne();
3957
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
3958
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4010
3959
  return {
4011
3960
  requiredQuantities: allQuantities,
4012
3961
  receipts,
4013
3962
  gasUsed,
4014
3963
  minGasPrice,
4015
- gasPrice: setGasPrice,
3964
+ gasPrice,
4016
3965
  minGas,
4017
3966
  maxGas,
3967
+ usedFee,
4018
3968
  minFee,
4019
3969
  maxFee,
4020
3970
  estimatedInputs: txRequestClone.inputs,
@@ -4481,13 +4431,13 @@ var assets = [
4481
4431
  ];
4482
4432
 
4483
4433
  // src/utils/formatTransferToContractScriptData.ts
4484
- var import_abi_coder6 = require("@fuel-ts/abi-coder");
4434
+ var import_abi_coder4 = require("@fuel-ts/abi-coder");
4485
4435
  var import_math17 = require("@fuel-ts/math");
4486
4436
  var import_utils27 = require("@fuel-ts/utils");
4487
4437
  var asm = __toESM(require("@fuels/vm-asm"));
4488
4438
  var formatTransferToContractScriptData = (params) => {
4489
4439
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4490
- const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
4440
+ const numberCoder = new import_abi_coder4.BigNumberCoder("u64");
4491
4441
  const encoded = numberCoder.encode(new import_math17.BN(amountToTransfer).toNumber());
4492
4442
  const scriptData = Uint8Array.from([
4493
4443
  ...(0, import_utils27.arrayify)(hexlifiedContractId),
@@ -4938,7 +4888,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4938
4888
 
4939
4889
  // src/signer/signer.ts
4940
4890
  var import_address5 = require("@fuel-ts/address");
4941
- var import_crypto2 = require("@fuel-ts/crypto");
4891
+ var import_crypto = require("@fuel-ts/crypto");
4942
4892
  var import_hasher2 = require("@fuel-ts/hasher");
4943
4893
  var import_math19 = require("@fuel-ts/math");
4944
4894
  var import_utils29 = require("@fuel-ts/utils");
@@ -5031,7 +4981,7 @@ var Signer = class {
5031
4981
  * @returns random 32-byte hashed
5032
4982
  */
5033
4983
  static generatePrivateKey(entropy) {
5034
- 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);
4984
+ return entropy ? (0, import_hasher2.hash)((0, import_utils29.concat)([(0, import_crypto.randomBytes)(32), (0, import_utils29.arrayify)(entropy)])) : (0, import_crypto.randomBytes)(32);
5035
4985
  }
5036
4986
  /**
5037
4987
  * Extended publicKey from a compact publicKey
@@ -5047,7 +4997,7 @@ var Signer = class {
5047
4997
 
5048
4998
  // src/wallet/keystore-wallet.ts
5049
4999
  var import_address6 = require("@fuel-ts/address");
5050
- var import_crypto3 = require("@fuel-ts/crypto");
5000
+ var import_crypto2 = require("@fuel-ts/crypto");
5051
5001
  var import_errors17 = require("@fuel-ts/errors");
5052
5002
  var import_utils30 = require("@fuel-ts/utils");
5053
5003
  var import_uuid = require("uuid");
@@ -5063,22 +5013,22 @@ var removeHexPrefix = (hexString) => {
5063
5013
  return hexString;
5064
5014
  };
5065
5015
  async function encryptKeystoreWallet(privateKey, address, password) {
5066
- const privateKeyBuffer = (0, import_crypto3.bufferFromString)(removeHexPrefix(privateKey), "hex");
5016
+ const privateKeyBuffer = (0, import_crypto2.bufferFromString)(removeHexPrefix(privateKey), "hex");
5067
5017
  const ownerAddress = import_address6.Address.fromAddressOrString(address);
5068
- const salt = (0, import_crypto3.randomBytes)(DEFAULT_KEY_SIZE);
5069
- const key = (0, import_crypto3.scrypt)({
5070
- password: (0, import_crypto3.bufferFromString)(password),
5018
+ const salt = (0, import_crypto2.randomBytes)(DEFAULT_KEY_SIZE);
5019
+ const key = (0, import_crypto2.scrypt)({
5020
+ password: (0, import_crypto2.bufferFromString)(password),
5071
5021
  salt,
5072
5022
  dklen: DEFAULT_KEY_SIZE,
5073
5023
  n: 2 ** DEFAULT_KDF_PARAMS_LOG_N,
5074
5024
  r: DEFAULT_KDF_PARAMS_R,
5075
5025
  p: DEFAULT_KDF_PARAMS_P
5076
5026
  });
5077
- const iv = (0, import_crypto3.randomBytes)(DEFAULT_IV_SIZE);
5078
- const ciphertext = await (0, import_crypto3.encryptJsonWalletData)(privateKeyBuffer, key, iv);
5027
+ const iv = (0, import_crypto2.randomBytes)(DEFAULT_IV_SIZE);
5028
+ const ciphertext = await (0, import_crypto2.encryptJsonWalletData)(privateKeyBuffer, key, iv);
5079
5029
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
5080
- const macHashUint8Array = (0, import_crypto3.keccak256)(data);
5081
- const mac = (0, import_crypto3.stringFromBuffer)(macHashUint8Array, "hex");
5030
+ const macHashUint8Array = (0, import_crypto2.keccak256)(data);
5031
+ const mac = (0, import_crypto2.stringFromBuffer)(macHashUint8Array, "hex");
5082
5032
  const keystore = {
5083
5033
  id: (0, import_uuid.v4)(),
5084
5034
  version: 3,
@@ -5086,15 +5036,15 @@ async function encryptKeystoreWallet(privateKey, address, password) {
5086
5036
  crypto: {
5087
5037
  cipher: "aes-128-ctr",
5088
5038
  mac,
5089
- cipherparams: { iv: (0, import_crypto3.stringFromBuffer)(iv, "hex") },
5090
- ciphertext: (0, import_crypto3.stringFromBuffer)(ciphertext, "hex"),
5039
+ cipherparams: { iv: (0, import_crypto2.stringFromBuffer)(iv, "hex") },
5040
+ ciphertext: (0, import_crypto2.stringFromBuffer)(ciphertext, "hex"),
5091
5041
  kdf: "scrypt",
5092
5042
  kdfparams: {
5093
5043
  dklen: DEFAULT_KEY_SIZE,
5094
5044
  n: 2 ** DEFAULT_KDF_PARAMS_LOG_N,
5095
5045
  p: DEFAULT_KDF_PARAMS_P,
5096
5046
  r: DEFAULT_KDF_PARAMS_R,
5097
- salt: (0, import_crypto3.stringFromBuffer)(salt, "hex")
5047
+ salt: (0, import_crypto2.stringFromBuffer)(salt, "hex")
5098
5048
  }
5099
5049
  }
5100
5050
  };
@@ -5110,11 +5060,11 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5110
5060
  kdfparams: { dklen, n, r, p, salt }
5111
5061
  }
5112
5062
  } = keystoreWallet;
5113
- const ciphertextBuffer = (0, import_crypto3.bufferFromString)(ciphertext, "hex");
5114
- const ivBuffer = (0, import_crypto3.bufferFromString)(iv, "hex");
5115
- const saltBuffer = (0, import_crypto3.bufferFromString)(salt, "hex");
5116
- const passwordBuffer = (0, import_crypto3.bufferFromString)(password);
5117
- const key = (0, import_crypto3.scrypt)({
5063
+ const ciphertextBuffer = (0, import_crypto2.bufferFromString)(ciphertext, "hex");
5064
+ const ivBuffer = (0, import_crypto2.bufferFromString)(iv, "hex");
5065
+ const saltBuffer = (0, import_crypto2.bufferFromString)(salt, "hex");
5066
+ const passwordBuffer = (0, import_crypto2.bufferFromString)(password);
5067
+ const key = (0, import_crypto2.scrypt)({
5118
5068
  password: passwordBuffer,
5119
5069
  salt: saltBuffer,
5120
5070
  n,
@@ -5123,15 +5073,15 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5123
5073
  dklen
5124
5074
  });
5125
5075
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertextBuffer]);
5126
- const macHashUint8Array = (0, import_crypto3.keccak256)(data);
5127
- const macHash = (0, import_crypto3.stringFromBuffer)(macHashUint8Array, "hex");
5076
+ const macHashUint8Array = (0, import_crypto2.keccak256)(data);
5077
+ const macHash = (0, import_crypto2.stringFromBuffer)(macHashUint8Array, "hex");
5128
5078
  if (mac !== macHash) {
5129
5079
  throw new import_errors17.FuelError(
5130
5080
  import_errors17.ErrorCode.INVALID_PASSWORD,
5131
5081
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
5132
5082
  );
5133
5083
  }
5134
- const buffer = await (0, import_crypto3.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5084
+ const buffer = await (0, import_crypto2.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5135
5085
  const privateKey = (0, import_utils30.hexlify)(buffer);
5136
5086
  return privateKey;
5137
5087
  }
@@ -5256,7 +5206,7 @@ var import_utils35 = require("@fuel-ts/utils");
5256
5206
  var import_ethers3 = require("ethers");
5257
5207
 
5258
5208
  // src/mnemonic/mnemonic.ts
5259
- var import_crypto4 = require("@fuel-ts/crypto");
5209
+ var import_crypto3 = require("@fuel-ts/crypto");
5260
5210
  var import_errors19 = require("@fuel-ts/errors");
5261
5211
  var import_hasher5 = require("@fuel-ts/hasher");
5262
5212
  var import_utils33 = require("@fuel-ts/utils");
@@ -7611,7 +7561,7 @@ var Mnemonic = class {
7611
7561
  * @returns A randomly generated mnemonic
7612
7562
  */
7613
7563
  static generate(size = 32, extraEntropy = "") {
7614
- 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);
7564
+ const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils33.concat)([(0, import_crypto3.randomBytes)(size), (0, import_utils33.arrayify)(extraEntropy)])) : (0, import_crypto3.randomBytes)(size);
7615
7565
  return Mnemonic.entropyToMnemonic(entropy);
7616
7566
  }
7617
7567
  };
@@ -7982,10 +7932,10 @@ __publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
7982
7932
  __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
7983
7933
 
7984
7934
  // src/test-utils/seedTestWallet.ts
7985
- var import_crypto5 = require("@fuel-ts/crypto");
7935
+ var import_crypto4 = require("@fuel-ts/crypto");
7986
7936
  var seedTestWallet = async (wallet, quantities) => {
7987
7937
  const genesisWallet = new WalletUnlocked(
7988
- process.env.GENESIS_SECRET || (0, import_crypto5.randomBytes)(32),
7938
+ process.env.GENESIS_SECRET || (0, import_crypto4.randomBytes)(32),
7989
7939
  wallet.provider
7990
7940
  );
7991
7941
  const resources = await genesisWallet.getResourcesToSpend(quantities);
@@ -8014,7 +7964,7 @@ var import_math21 = require("@fuel-ts/math");
8014
7964
  var import_utils36 = require("@fuel-ts/utils");
8015
7965
  var import_cli_utils = require("@fuel-ts/utils/cli-utils");
8016
7966
  var import_child_process = require("child_process");
8017
- var import_crypto6 = require("crypto");
7967
+ var import_crypto5 = require("crypto");
8018
7968
  var import_fs = require("fs");
8019
7969
  var import_os = __toESM(require("os"));
8020
7970
  var import_path = __toESM(require("path"));
@@ -8086,7 +8036,7 @@ var launchNode = async ({
8086
8036
  })).toString();
8087
8037
  let chainConfigPathToUse;
8088
8038
  const prefix = basePath || import_os.default.tmpdir();
8089
- const suffix = basePath ? "" : (0, import_crypto6.randomUUID)();
8039
+ const suffix = basePath ? "" : (0, import_crypto5.randomUUID)();
8090
8040
  const tempDirPath = import_path.default.join(prefix, ".fuels", suffix);
8091
8041
  if (chainConfigPath) {
8092
8042
  chainConfigPathToUse = chainConfigPath;