mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-21 16:52:00 -07:00
fix(wallet): Throwing error when wallet file not passed in correctly
This commit is contained in:
@@ -34,7 +34,7 @@ class WalletAdapter {
|
||||
|
||||
// Try to open the wallet.json file.
|
||||
try {
|
||||
console.log('this.WALLET_FILE: ', this.WALLET_FILE)
|
||||
// console.log('this.WALLET_FILE: ', this.WALLET_FILE)
|
||||
walletData = await this.jsonFiles.readJSON(this.WALLET_FILE)
|
||||
} catch (err) {
|
||||
// Create a new wallet file if one does not already exist.
|
||||
@@ -69,9 +69,12 @@ class WalletAdapter {
|
||||
// and pass the bch-js information to the minimal-slp-wallet library.
|
||||
async instanceWallet (walletData) {
|
||||
try {
|
||||
console.log(`instanceWallet() walletData: ${JSON.stringify(walletData, null, 2)}`)
|
||||
// console.log(`instanceWallet() walletData: ${JSON.stringify(walletData, null, 2)}`)
|
||||
|
||||
// TODO: throw error if wallet data is not passed in.
|
||||
if (!walletData.mnemonic) {
|
||||
throw new Error('Wallet data is not formatted correctly. Can not read mnemonic in wallet file!')
|
||||
}
|
||||
|
||||
const advancedConfig = {}
|
||||
if (this.config.useFullStackCash) {
|
||||
@@ -89,7 +92,7 @@ class WalletAdapter {
|
||||
// Wait for wallet to initialize.
|
||||
await this.bchWallet.walletInfoPromise
|
||||
console.log(`BCH wallet initialized. Wallet address: ${this.bchWallet.walletInfo.cashAddress}`)
|
||||
console.log(`this.bchWallet.walletInfo: ${JSON.stringify(this.bchWallet.walletInfo, null, 2)}`)
|
||||
// console.log(`this.bchWallet.walletInfo: ${JSON.stringify(this.bchWallet.walletInfo, null, 2)}`)
|
||||
|
||||
return this.bchWallet
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user