mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
use 'const' over 'let' and simply forward opts
This commit is contained in:
@@ -212,22 +212,19 @@ class Wallet {
|
|||||||
secretNumbers: string[] | string,
|
secretNumbers: string[] | string,
|
||||||
opts: { masterAddress?: string; algorithm?: ECDSA } = {},
|
opts: { masterAddress?: string; algorithm?: ECDSA } = {},
|
||||||
): Wallet {
|
): Wallet {
|
||||||
let numbersArray: string[] = []
|
const numbersArray: string[] = []
|
||||||
|
|
||||||
if (typeof secretNumbers === 'string') {
|
if (typeof secretNumbers === 'string') {
|
||||||
numbersArray = Utils.parseSecretString(secretNumbers)
|
numbersArray.concat(Utils.parseSecretString(secretNumbers))
|
||||||
} else if (Array.isArray(secretNumbers)) {
|
} else if (Array.isArray(secretNumbers)) {
|
||||||
numbersArray = secretNumbers
|
numbersArray.concat(secretNumbers)
|
||||||
} else {
|
} else {
|
||||||
throw new ValidationError('Unable to parse the given secret numbers.')
|
throw new ValidationError('Unable to parse the given secret numbers.')
|
||||||
}
|
}
|
||||||
|
|
||||||
const entropy = Utils.secretToEntropy(numbersArray)
|
const entropy = Utils.secretToEntropy(numbersArray)
|
||||||
|
|
||||||
return Wallet.fromEntropy(entropy, {
|
return Wallet.fromEntropy(entropy, opts)
|
||||||
algorithm: opts.algorithm ?? ECDSA.secp256k1,
|
|
||||||
masterAddress: opts.masterAddress,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user