@fuel-ts/account 0.0.0-rc-1832-20240415161726 → 0.0.0-rc-2034-20240415163000

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,6 +1051,7 @@ 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");
1054
1055
  var import_configs2 = require("@fuel-ts/address/configs");
1055
1056
  var import_errors3 = require("@fuel-ts/errors");
1056
1057
  var import_math2 = require("@fuel-ts/math");
@@ -1064,8 +1065,8 @@ var inputify = (value) => {
1064
1065
  const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
1065
1066
  return {
1066
1067
  type: import_transactions.InputType.Coin,
1067
- txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, 32)),
1068
- outputIndex: (0, import_utils3.arrayify)(value.id)[32],
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)),
1069
1070
  owner: (0, import_utils3.hexlify)(value.owner),
1070
1071
  amount: (0, import_math2.bn)(value.amount),
1071
1072
  assetId: (0, import_utils3.hexlify)(value.assetId),
@@ -1183,8 +1184,10 @@ var outputify = (value) => {
1183
1184
  };
1184
1185
 
1185
1186
  // src/providers/transaction-request/transaction-request.ts
1187
+ var import_abi_coder2 = require("@fuel-ts/abi-coder");
1186
1188
  var import_address = require("@fuel-ts/address");
1187
1189
  var import_configs7 = require("@fuel-ts/address/configs");
1190
+ var import_crypto = require("@fuel-ts/crypto");
1188
1191
  var import_math7 = require("@fuel-ts/math");
1189
1192
  var import_transactions6 = require("@fuel-ts/transactions");
1190
1193
  var import_utils9 = require("@fuel-ts/utils");
@@ -1858,8 +1861,7 @@ var BaseTransactionRequest = class {
1858
1861
  assetId,
1859
1862
  txPointer: "0x00000000000000000000000000000000",
1860
1863
  witnessIndex,
1861
- predicate: predicate?.bytes,
1862
- predicateData: predicate?.predicateDataBytes
1864
+ predicate: predicate?.bytes
1863
1865
  };
1864
1866
  this.pushInput(input);
1865
1867
  this.addChangeOutput(owner, assetId);
@@ -1891,8 +1893,7 @@ var BaseTransactionRequest = class {
1891
1893
  recipient: recipient.toB256(),
1892
1894
  amount,
1893
1895
  witnessIndex,
1894
- predicate: predicate?.bytes,
1895
- predicateData: predicate?.predicateDataBytes
1896
+ predicate: predicate?.bytes
1896
1897
  };
1897
1898
  this.pushInput(input);
1898
1899
  this.addChangeOutput(recipient, assetId);
@@ -2047,12 +2048,6 @@ var BaseTransactionRequest = class {
2047
2048
  * @param quantities - CoinQuantity Array.
2048
2049
  */
2049
2050
  fundWithFakeUtxos(quantities, resourcesOwner) {
2050
- let idCounter = 0;
2051
- const generateId = () => {
2052
- const counterString = String(idCounter++);
2053
- const id = import_configs7.ZeroBytes32.slice(0, -counterString.length).concat(counterString);
2054
- return id;
2055
- };
2056
2051
  const findAssetInput = (assetId) => this.inputs.find((input) => {
2057
2052
  if ("assetId" in input) {
2058
2053
  return input.assetId === assetId;
@@ -2062,12 +2057,12 @@ var BaseTransactionRequest = class {
2062
2057
  const updateAssetInput = (assetId, quantity) => {
2063
2058
  const assetInput = findAssetInput(assetId);
2064
2059
  if (assetInput && "assetId" in assetInput) {
2065
- assetInput.id = generateId();
2060
+ assetInput.id = (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN));
2066
2061
  assetInput.amount = quantity;
2067
2062
  } else {
2068
2063
  this.addResources([
2069
2064
  {
2070
- id: generateId(),
2065
+ id: (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN)),
2071
2066
  amount: quantity,
2072
2067
  assetId,
2073
2068
  owner: resourcesOwner || import_address.Address.fromRandom(),
@@ -2322,7 +2317,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2322
2317
  };
2323
2318
 
2324
2319
  // src/providers/transaction-request/script-transaction-request.ts
2325
- var import_abi_coder = require("@fuel-ts/abi-coder");
2320
+ var import_abi_coder3 = require("@fuel-ts/abi-coder");
2326
2321
  var import_address2 = require("@fuel-ts/address");
2327
2322
  var import_configs10 = require("@fuel-ts/address/configs");
2328
2323
  var import_math10 = require("@fuel-ts/math");
@@ -2514,7 +2509,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2514
2509
  * @returns The current instance of the `ScriptTransactionRequest`.
2515
2510
  */
2516
2511
  setData(abi, args) {
2517
- const abiInterface = new import_abi_coder.Interface(abi);
2512
+ const abiInterface = new import_abi_coder3.Interface(abi);
2518
2513
  this.scriptData = abiInterface.functions.main.encodeArguments(args);
2519
2514
  return this;
2520
2515
  }
@@ -2636,17 +2631,17 @@ var import_math13 = require("@fuel-ts/math");
2636
2631
  var import_transactions14 = require("@fuel-ts/transactions");
2637
2632
 
2638
2633
  // src/providers/transaction-summary/call.ts
2639
- var import_abi_coder2 = require("@fuel-ts/abi-coder");
2634
+ var import_abi_coder4 = require("@fuel-ts/abi-coder");
2640
2635
  var import_math12 = require("@fuel-ts/math");
2641
2636
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2642
- const abiInterface = new import_abi_coder2.Interface(abi);
2637
+ const abiInterface = new import_abi_coder4.Interface(abi);
2643
2638
  const callFunctionSelector = receipt.param1.toHex(8);
2644
2639
  const functionFragment = abiInterface.getFunction(callFunctionSelector);
2645
2640
  const inputs = functionFragment.jsonFn.inputs;
2646
2641
  let encodedArgs;
2647
2642
  if (functionFragment.isInputDataPointer) {
2648
2643
  if (rawPayload) {
2649
- const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder2.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2644
+ const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2650
2645
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2651
2646
  }
2652
2647
  } else {
@@ -3249,13 +3244,13 @@ function assembleTransactionSummary(params) {
3249
3244
  }
3250
3245
 
3251
3246
  // src/providers/transaction-response/getDecodedLogs.ts
3252
- var import_abi_coder3 = require("@fuel-ts/abi-coder");
3247
+ var import_abi_coder5 = require("@fuel-ts/abi-coder");
3253
3248
  var import_transactions16 = require("@fuel-ts/transactions");
3254
3249
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3255
3250
  return receipts.reduce((logs, receipt) => {
3256
3251
  if (receipt.type === import_transactions16.ReceiptType.LogData || receipt.type === import_transactions16.ReceiptType.Log) {
3257
- const interfaceToUse = new import_abi_coder3.Interface(externalAbis[receipt.id] || mainAbi);
3258
- const data = receipt.type === import_transactions16.ReceiptType.Log ? new import_abi_coder3.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
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;
3259
3254
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3260
3255
  logs.push(decodedLog);
3261
3256
  }
@@ -3897,6 +3892,36 @@ var _Provider = class {
3897
3892
  missingContractIds
3898
3893
  };
3899
3894
  }
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
+ }
3900
3925
  /**
3901
3926
  * Executes a signed transaction without applying the states changes
3902
3927
  * on the chain.
@@ -3944,17 +3969,16 @@ var _Provider = class {
3944
3969
  signatureCallback
3945
3970
  } = {}) {
3946
3971
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
3947
- const chainInfo = this.getChain();
3948
- const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
3949
- const gasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
3972
+ const { minGasPrice } = this.getGasConfig();
3973
+ const setGasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
3950
3974
  const isScriptTransaction = txRequestClone.type === import_transactions18.TransactionType.Script;
3951
3975
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
3952
3976
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3953
3977
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3978
+ if (isScriptTransaction) {
3979
+ txRequestClone.gasLimit = (0, import_math15.bn)(0);
3980
+ }
3954
3981
  if (estimatePredicates) {
3955
- if (isScriptTransaction) {
3956
- txRequestClone.gasLimit = (0, import_math15.bn)(0);
3957
- }
3958
3982
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3959
3983
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
3960
3984
  }
@@ -3963,36 +3987,34 @@ var _Provider = class {
3963
3987
  if (signatureCallback && isScriptTransaction) {
3964
3988
  await signatureCallback(txRequestClone);
3965
3989
  }
3966
- const minGas = txRequestClone.calculateMinGas(chainInfo);
3967
- const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
3990
+ let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
3991
+ transactionRequest: txRequestClone
3992
+ });
3968
3993
  let receipts = [];
3969
3994
  let missingContractIds = [];
3970
3995
  let outputVariables = 0;
3996
+ let gasUsed = (0, import_math15.bn)(0);
3971
3997
  if (isScriptTransaction && estimateTxDependencies) {
3972
3998
  txRequestClone.gasPrice = (0, import_math15.bn)(0);
3973
- txRequestClone.gasLimit = (0, import_math15.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3974
3999
  const result = await this.estimateTxDependencies(txRequestClone);
3975
4000
  receipts = result.receipts;
3976
4001
  outputVariables = result.outputVariables;
3977
4002
  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
+ }));
3978
4009
  }
3979
- const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
3980
- const usedFee = calculatePriceWithFactor(
3981
- gasUsed,
3982
- gasPrice,
3983
- gasPriceFactor
3984
- ).normalizeZeroToOne();
3985
- const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
3986
- const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
3987
4010
  return {
3988
4011
  requiredQuantities: allQuantities,
3989
4012
  receipts,
3990
4013
  gasUsed,
3991
4014
  minGasPrice,
3992
- gasPrice,
4015
+ gasPrice: setGasPrice,
3993
4016
  minGas,
3994
4017
  maxGas,
3995
- usedFee,
3996
4018
  minFee,
3997
4019
  maxFee,
3998
4020
  estimatedInputs: txRequestClone.inputs,
@@ -4459,13 +4481,13 @@ var assets = [
4459
4481
  ];
4460
4482
 
4461
4483
  // src/utils/formatTransferToContractScriptData.ts
4462
- var import_abi_coder4 = require("@fuel-ts/abi-coder");
4484
+ var import_abi_coder6 = require("@fuel-ts/abi-coder");
4463
4485
  var import_math17 = require("@fuel-ts/math");
4464
4486
  var import_utils27 = require("@fuel-ts/utils");
4465
4487
  var asm = __toESM(require("@fuels/vm-asm"));
4466
4488
  var formatTransferToContractScriptData = (params) => {
4467
4489
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4468
- const numberCoder = new import_abi_coder4.BigNumberCoder("u64");
4490
+ const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
4469
4491
  const encoded = numberCoder.encode(new import_math17.BN(amountToTransfer).toNumber());
4470
4492
  const scriptData = Uint8Array.from([
4471
4493
  ...(0, import_utils27.arrayify)(hexlifiedContractId),
@@ -4916,7 +4938,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4916
4938
 
4917
4939
  // src/signer/signer.ts
4918
4940
  var import_address5 = require("@fuel-ts/address");
4919
- var import_crypto = require("@fuel-ts/crypto");
4941
+ var import_crypto2 = require("@fuel-ts/crypto");
4920
4942
  var import_hasher2 = require("@fuel-ts/hasher");
4921
4943
  var import_math19 = require("@fuel-ts/math");
4922
4944
  var import_utils29 = require("@fuel-ts/utils");
@@ -5009,7 +5031,7 @@ var Signer = class {
5009
5031
  * @returns random 32-byte hashed
5010
5032
  */
5011
5033
  static generatePrivateKey(entropy) {
5012
- 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);
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);
5013
5035
  }
5014
5036
  /**
5015
5037
  * Extended publicKey from a compact publicKey
@@ -5025,7 +5047,7 @@ var Signer = class {
5025
5047
 
5026
5048
  // src/wallet/keystore-wallet.ts
5027
5049
  var import_address6 = require("@fuel-ts/address");
5028
- var import_crypto2 = require("@fuel-ts/crypto");
5050
+ var import_crypto3 = require("@fuel-ts/crypto");
5029
5051
  var import_errors17 = require("@fuel-ts/errors");
5030
5052
  var import_utils30 = require("@fuel-ts/utils");
5031
5053
  var import_uuid = require("uuid");
@@ -5041,22 +5063,22 @@ var removeHexPrefix = (hexString) => {
5041
5063
  return hexString;
5042
5064
  };
5043
5065
  async function encryptKeystoreWallet(privateKey, address, password) {
5044
- const privateKeyBuffer = (0, import_crypto2.bufferFromString)(removeHexPrefix(privateKey), "hex");
5066
+ const privateKeyBuffer = (0, import_crypto3.bufferFromString)(removeHexPrefix(privateKey), "hex");
5045
5067
  const ownerAddress = import_address6.Address.fromAddressOrString(address);
5046
- const salt = (0, import_crypto2.randomBytes)(DEFAULT_KEY_SIZE);
5047
- const key = (0, import_crypto2.scrypt)({
5048
- password: (0, import_crypto2.bufferFromString)(password),
5068
+ const salt = (0, import_crypto3.randomBytes)(DEFAULT_KEY_SIZE);
5069
+ const key = (0, import_crypto3.scrypt)({
5070
+ password: (0, import_crypto3.bufferFromString)(password),
5049
5071
  salt,
5050
5072
  dklen: DEFAULT_KEY_SIZE,
5051
5073
  n: 2 ** DEFAULT_KDF_PARAMS_LOG_N,
5052
5074
  r: DEFAULT_KDF_PARAMS_R,
5053
5075
  p: DEFAULT_KDF_PARAMS_P
5054
5076
  });
5055
- const iv = (0, import_crypto2.randomBytes)(DEFAULT_IV_SIZE);
5056
- const ciphertext = await (0, import_crypto2.encryptJsonWalletData)(privateKeyBuffer, key, iv);
5077
+ const iv = (0, import_crypto3.randomBytes)(DEFAULT_IV_SIZE);
5078
+ const ciphertext = await (0, import_crypto3.encryptJsonWalletData)(privateKeyBuffer, key, iv);
5057
5079
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
5058
- const macHashUint8Array = (0, import_crypto2.keccak256)(data);
5059
- const mac = (0, import_crypto2.stringFromBuffer)(macHashUint8Array, "hex");
5080
+ const macHashUint8Array = (0, import_crypto3.keccak256)(data);
5081
+ const mac = (0, import_crypto3.stringFromBuffer)(macHashUint8Array, "hex");
5060
5082
  const keystore = {
5061
5083
  id: (0, import_uuid.v4)(),
5062
5084
  version: 3,
@@ -5064,15 +5086,15 @@ async function encryptKeystoreWallet(privateKey, address, password) {
5064
5086
  crypto: {
5065
5087
  cipher: "aes-128-ctr",
5066
5088
  mac,
5067
- cipherparams: { iv: (0, import_crypto2.stringFromBuffer)(iv, "hex") },
5068
- ciphertext: (0, import_crypto2.stringFromBuffer)(ciphertext, "hex"),
5089
+ cipherparams: { iv: (0, import_crypto3.stringFromBuffer)(iv, "hex") },
5090
+ ciphertext: (0, import_crypto3.stringFromBuffer)(ciphertext, "hex"),
5069
5091
  kdf: "scrypt",
5070
5092
  kdfparams: {
5071
5093
  dklen: DEFAULT_KEY_SIZE,
5072
5094
  n: 2 ** DEFAULT_KDF_PARAMS_LOG_N,
5073
5095
  p: DEFAULT_KDF_PARAMS_P,
5074
5096
  r: DEFAULT_KDF_PARAMS_R,
5075
- salt: (0, import_crypto2.stringFromBuffer)(salt, "hex")
5097
+ salt: (0, import_crypto3.stringFromBuffer)(salt, "hex")
5076
5098
  }
5077
5099
  }
5078
5100
  };
@@ -5088,11 +5110,11 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5088
5110
  kdfparams: { dklen, n, r, p, salt }
5089
5111
  }
5090
5112
  } = keystoreWallet;
5091
- const ciphertextBuffer = (0, import_crypto2.bufferFromString)(ciphertext, "hex");
5092
- const ivBuffer = (0, import_crypto2.bufferFromString)(iv, "hex");
5093
- const saltBuffer = (0, import_crypto2.bufferFromString)(salt, "hex");
5094
- const passwordBuffer = (0, import_crypto2.bufferFromString)(password);
5095
- const key = (0, import_crypto2.scrypt)({
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)({
5096
5118
  password: passwordBuffer,
5097
5119
  salt: saltBuffer,
5098
5120
  n,
@@ -5101,15 +5123,15 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5101
5123
  dklen
5102
5124
  });
5103
5125
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertextBuffer]);
5104
- const macHashUint8Array = (0, import_crypto2.keccak256)(data);
5105
- const macHash = (0, import_crypto2.stringFromBuffer)(macHashUint8Array, "hex");
5126
+ const macHashUint8Array = (0, import_crypto3.keccak256)(data);
5127
+ const macHash = (0, import_crypto3.stringFromBuffer)(macHashUint8Array, "hex");
5106
5128
  if (mac !== macHash) {
5107
5129
  throw new import_errors17.FuelError(
5108
5130
  import_errors17.ErrorCode.INVALID_PASSWORD,
5109
5131
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
5110
5132
  );
5111
5133
  }
5112
- const buffer = await (0, import_crypto2.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5134
+ const buffer = await (0, import_crypto3.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5113
5135
  const privateKey = (0, import_utils30.hexlify)(buffer);
5114
5136
  return privateKey;
5115
5137
  }
@@ -5234,7 +5256,7 @@ var import_utils35 = require("@fuel-ts/utils");
5234
5256
  var import_ethers3 = require("ethers");
5235
5257
 
5236
5258
  // src/mnemonic/mnemonic.ts
5237
- var import_crypto3 = require("@fuel-ts/crypto");
5259
+ var import_crypto4 = require("@fuel-ts/crypto");
5238
5260
  var import_errors19 = require("@fuel-ts/errors");
5239
5261
  var import_hasher5 = require("@fuel-ts/hasher");
5240
5262
  var import_utils33 = require("@fuel-ts/utils");
@@ -7589,7 +7611,7 @@ var Mnemonic = class {
7589
7611
  * @returns A randomly generated mnemonic
7590
7612
  */
7591
7613
  static generate(size = 32, extraEntropy = "") {
7592
- 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);
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);
7593
7615
  return Mnemonic.entropyToMnemonic(entropy);
7594
7616
  }
7595
7617
  };
@@ -7960,10 +7982,10 @@ __publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
7960
7982
  __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
7961
7983
 
7962
7984
  // src/test-utils/seedTestWallet.ts
7963
- var import_crypto4 = require("@fuel-ts/crypto");
7985
+ var import_crypto5 = require("@fuel-ts/crypto");
7964
7986
  var seedTestWallet = async (wallet, quantities) => {
7965
7987
  const genesisWallet = new WalletUnlocked(
7966
- process.env.GENESIS_SECRET || (0, import_crypto4.randomBytes)(32),
7988
+ process.env.GENESIS_SECRET || (0, import_crypto5.randomBytes)(32),
7967
7989
  wallet.provider
7968
7990
  );
7969
7991
  const resources = await genesisWallet.getResourcesToSpend(quantities);
@@ -7992,7 +8014,7 @@ var import_math21 = require("@fuel-ts/math");
7992
8014
  var import_utils36 = require("@fuel-ts/utils");
7993
8015
  var import_cli_utils = require("@fuel-ts/utils/cli-utils");
7994
8016
  var import_child_process = require("child_process");
7995
- var import_crypto5 = require("crypto");
8017
+ var import_crypto6 = require("crypto");
7996
8018
  var import_fs = require("fs");
7997
8019
  var import_os = __toESM(require("os"));
7998
8020
  var import_path = __toESM(require("path"));
@@ -8064,7 +8086,7 @@ var launchNode = async ({
8064
8086
  })).toString();
8065
8087
  let chainConfigPathToUse;
8066
8088
  const prefix = basePath || import_os.default.tmpdir();
8067
- const suffix = basePath ? "" : (0, import_crypto5.randomUUID)();
8089
+ const suffix = basePath ? "" : (0, import_crypto6.randomUUID)();
8068
8090
  const tempDirPath = import_path.default.join(prefix, ".fuels", suffix);
8069
8091
  if (chainConfigPath) {
8070
8092
  chainConfigPathToUse = chainConfigPath;