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