fix(bchjs): Allowing bchjs to be configured for web2 restURL

This commit is contained in:
Chris Troutner
2024-08-19 19:10:25 -07:00
parent 8b04a54fe1
commit 57f49ff31f
3 changed files with 9 additions and 2 deletions
+7 -1
View File
@@ -31,7 +31,13 @@ class Adapters {
this.jsonFiles = new JSONFiles()
this.bchjs = new BCHJS()
this.config = config
this.wallet = new Wallet(localConfig)
const walletConfig = {}
if (config.walletInterface === 'web2') {
walletConfig.restURL = config.apiServer
walletConfig.interface = 'rest-api'
}
this.wallet = new Wallet(walletConfig)
// Get a valid JWT API key and instance bch-js.
this.fullStackJwt = new FullStackJWT(config)
+1
View File
@@ -71,6 +71,7 @@ class Wallet {
console.log('BCH wallet initialized.')
console.log(`Wallet address: ${this.bchWallet.walletInfo.cashAddress}`)
console.log(`Wallet mnemonic: ${this.bchWallet.walletInfo.mnemonic}`)
console.log(`Wallet backend: ${this.bchWallet.bchjs.restURL}`)
return this.bchWallet
} catch (err) {
+1 -1
View File
@@ -17,7 +17,7 @@ import config from '../../config/index.js'
class Controllers {
constructor (localConfig = {}) {
// Encapsulate dependencies
this.adapters = new Adapters()
this.adapters = new Adapters(localConfig)
this.useCases = new UseCases({ adapters: this.adapters })
this.timerControllers = new TimerControllers({ adapters: this.adapters, useCases: this.useCases })
this.config = config