mirror of
https://github.com/fullstack-cash/fullstack-gatsby-theme-bch-wallet.git
synced 2026-09-22 17:22:05 -07:00
Merge branch 'master' into dh-wallet-view
This commit is contained in:
@@ -146,8 +146,12 @@ class Configure extends React.Component {
|
||||
}
|
||||
|
||||
console.log('bchjs options : ', bchjsOptions)
|
||||
const bchWalletLib = new _this.BchWallet(mnemonic)
|
||||
bchWalletLib.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
const bchWalletLib = new _this.BchWallet(mnemonic, bchjsOptions)
|
||||
|
||||
// Update bchjs instances of minimal-slp-wallet libraries
|
||||
bchWalletLib.tokens.sendBch.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
bchWalletLib.tokens.utxos.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
|
||||
_this.props.setBchWallet(bchWalletLib)
|
||||
}
|
||||
|
||||
|
||||
@@ -212,9 +212,12 @@ class Servers extends React.Component {
|
||||
|
||||
bchjsOptions.restURL = restURL
|
||||
|
||||
console.log('bchjs options : ', bchjsOptions)
|
||||
const bchWalletLib = new _this.BchWallet(mnemonic)
|
||||
bchWalletLib.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
const bchWalletLib = new _this.BchWallet(mnemonic, bchjsOptions)
|
||||
|
||||
// Update bchjs instances of minimal-slp-wallet libraries
|
||||
bchWalletLib.tokens.sendBch.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
bchWalletLib.tokens.utxos.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
|
||||
_this.props.setBchWallet(bchWalletLib)
|
||||
}
|
||||
_this.saveServer()
|
||||
|
||||
@@ -323,7 +323,7 @@ class AdminLTEPage extends React.Component {
|
||||
if (walletInfo.selectedServer) return null
|
||||
|
||||
const server1 = 'https://api.fullstack.cash/v3/'
|
||||
const server2 = 'https://free-api.fullstack.cash/v3/'
|
||||
const server2 = 'https://free-main.fullstack.cash/v3/'
|
||||
|
||||
const servers = [server1, server2]
|
||||
|
||||
|
||||
@@ -133,7 +133,12 @@ class Tokens extends React.Component {
|
||||
tokens = await bchWallet.listTokens()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
if (error.error.match('rate limits')) onEmptyTokensMsg = error.error
|
||||
if (error.error) {
|
||||
if (error.error.match('rate limits')) onEmptyTokensMsg = error.error
|
||||
}
|
||||
if (error.message) {
|
||||
onEmptyTokensMsg = error.message
|
||||
}
|
||||
}
|
||||
} else {
|
||||
onEmptyTokensMsg =
|
||||
|
||||
@@ -10,7 +10,8 @@ class NewWallet extends React.Component {
|
||||
super(props)
|
||||
_this = this
|
||||
this.state = {
|
||||
inFetch: false
|
||||
inFetch: false,
|
||||
errMsg: ''
|
||||
}
|
||||
|
||||
_this.BchWallet = BchWallet
|
||||
@@ -37,6 +38,11 @@ class NewWallet extends React.Component {
|
||||
<span>New Wallet</span>
|
||||
</h1>
|
||||
</Col>
|
||||
<Col sm={12} className='text-center '>
|
||||
{_this.state.errMsg && (
|
||||
<p className='error-color mt-2'>{_this.state.errMsg}</p>
|
||||
)}
|
||||
</Col>
|
||||
<Col sm={12} className='text-center mt-2 mb-2'>
|
||||
<Button
|
||||
text='Create Wallet'
|
||||
@@ -68,12 +74,11 @@ class NewWallet extends React.Component {
|
||||
_this.setState({
|
||||
inFetch: true
|
||||
})
|
||||
const bchWalletLib = new _this.BchWallet()
|
||||
const apiToken = currentWallet.JWT
|
||||
const restURL = currentWallet.selectedServer
|
||||
const bchjsOptions = {}
|
||||
|
||||
if (apiToken || restURL) {
|
||||
const bchjsOptions = {}
|
||||
if (apiToken) {
|
||||
bchjsOptions.apiToken = apiToken
|
||||
}
|
||||
@@ -81,9 +86,14 @@ class NewWallet extends React.Component {
|
||||
bchjsOptions.restURL = restURL
|
||||
}
|
||||
console.log('bchjs options : ', bchjsOptions)
|
||||
bchWalletLib.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
}
|
||||
|
||||
const bchWalletLib = new _this.BchWallet(null, bchjsOptions)
|
||||
|
||||
// Update bchjs instances of minimal-slp-wallet libraries
|
||||
bchWalletLib.tokens.sendBch.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
bchWalletLib.tokens.utxos.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
|
||||
await bchWalletLib.walletInfoPromise // Wait for wallet to be created.
|
||||
|
||||
const walletInfo = bchWalletLib.walletInfo
|
||||
@@ -99,12 +109,14 @@ class NewWallet extends React.Component {
|
||||
_this.props.setBchWallet(bchWalletLib)
|
||||
|
||||
_this.setState({
|
||||
inFetch: false
|
||||
inFetch: false,
|
||||
errMsg: ''
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
_this.setState({
|
||||
inFetch: false
|
||||
inFetch: false,
|
||||
errMsg: error.message
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,21 +112,29 @@ class ImportWallet extends React.Component {
|
||||
inFetch: true
|
||||
})
|
||||
|
||||
const bchWalletLib = new _this.BchWallet(_this.state.mnemonic)
|
||||
const apiToken = currentWallet.JWT
|
||||
const restURL = currentWallet.selectedServer
|
||||
|
||||
const bchjsOptions = {}
|
||||
|
||||
if (apiToken || restURL) {
|
||||
const bchjsOptions = {}
|
||||
if (apiToken) {
|
||||
bchjsOptions.apiToken = apiToken
|
||||
}
|
||||
if (restURL) {
|
||||
bchjsOptions.restURL = restURL
|
||||
}
|
||||
console.log('bchjs options : ', bchjsOptions)
|
||||
bchWalletLib.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
}
|
||||
|
||||
const bchWalletLib = new _this.BchWallet(
|
||||
_this.state.mnemonic,
|
||||
bchjsOptions
|
||||
)
|
||||
// Update bchjs instances of minimal-slp-wallet libraries
|
||||
|
||||
bchWalletLib.tokens.sendBch.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
bchWalletLib.tokens.utxos.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
|
||||
await bchWalletLib.walletInfoPromise // Wait for wallet to be created.
|
||||
|
||||
const walletInfo = bchWalletLib.walletInfo
|
||||
@@ -164,9 +172,6 @@ class ImportWallet extends React.Component {
|
||||
})
|
||||
const mnemonicEle = document.getElementById('import-mnemonic')
|
||||
mnemonicEle.value = ''
|
||||
|
||||
const privateKeyEle = document.getElementById('privateKey')
|
||||
privateKeyEle.value = ''
|
||||
}
|
||||
|
||||
validateInputs () {
|
||||
|
||||
@@ -49,8 +49,6 @@ const instanceWallet = () => {
|
||||
try {
|
||||
if (!localStorageInfo.mnemonic) return null
|
||||
|
||||
const bchWalletLib = new BchWallet(localStorageInfo.mnemonic)
|
||||
|
||||
const jwtToken = localStorageInfo.JWT
|
||||
const restURL = localStorageInfo.selectedServer
|
||||
const bchjsOptions = {}
|
||||
@@ -61,7 +59,11 @@ const instanceWallet = () => {
|
||||
if (restURL) {
|
||||
bchjsOptions.restURL = restURL
|
||||
}
|
||||
bchWalletLib.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
const bchWalletLib = new BchWallet(localStorageInfo.mnemonic, bchjsOptions)
|
||||
|
||||
// Update bchjs instances of minimal-slp-wallet libraries
|
||||
bchWalletLib.tokens.sendBch.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
bchWalletLib.tokens.utxos.bchjs = new bchWalletLib.BCHJS(bchjsOptions)
|
||||
|
||||
return bchWalletLib
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user