Fix error per invalid bip39 word
This commit is contained in:
parent
8a36bffb85
commit
9af8e63355
|
@ -657,9 +657,18 @@ export const lncSchema = object({
|
|||
if (this.isType(value) && value !== null) {
|
||||
return value
|
||||
}
|
||||
return originalValue ? originalValue.split(/[\s]+/) : []
|
||||
return originalValue ? originalValue.trim().split(/[\s]+/) : []
|
||||
})
|
||||
.test(async (words, context) => {
|
||||
for (const w of words) {
|
||||
try {
|
||||
await string().oneOf(bip39Words).validate(w)
|
||||
} catch {
|
||||
return context.createError({ message: `'${w}' is not a valid pairing phrase word` })
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
.of(string().trim().oneOf(bip39Words, ({ value }) => `'${value}' is not a valid pairing phrase word`))
|
||||
.min(2, 'needs at least two words')
|
||||
.max(10, 'max 10 words')
|
||||
.required('required'),
|
||||
|
|
Loading…
Reference in New Issue