Merge pull request #1229 from chaotixkilla/fix-remove-xmr-wallet-password

Allow for password-unprotected XMR wallets
This commit is contained in:
Rafael Taranto 2022-05-23 09:41:58 +01:00 committed by GitHub
commit d5ddf5f74f

View file

@ -63,6 +63,12 @@ function handleError (error, method) {
}
case -21:
throw new Error('Wallet already exists!')
case -22:
try {
return openWalletWithPassword()
} catch {
throw new Error('Invalid wallet password!')
}
case -17:
throw new E.InsufficientFundsError()
case -37:
@ -79,11 +85,16 @@ function handleError (error, method) {
}
function openWallet () {
return fetch('open_wallet', { filename: 'Wallet' })
.catch(err => handleError(err, 'openWallet'))
}
function openWalletWithPassword () {
return fetch('open_wallet', { filename: 'Wallet', password: rpcConfig().password })
}
function createWallet () {
return fetch('create_wallet', { filename: 'Wallet', password: rpcConfig().password, language: 'English' })
return fetch('create_wallet', { filename: 'Wallet', language: 'English' })
.then(() => new Promise(() => setTimeout(() => openWallet(), 3000)))
.then(() => fetch('auto_refresh'))
}