Merge branch 'master' into dh-wallet-view

This commit is contained in:
Chris Troutner
2020-07-14 10:53:50 -07:00
9 changed files with 80 additions and 28 deletions
+25 -4
View File
@@ -4910,7 +4910,7 @@
"bip39": "^3.0.2",
"bip66": "^1.1.5",
"bitcoincash-ops": "github:christroutner/bitcoincash-ops",
"bitcoincashjs-lib": "github:christroutner/bitcoincashjs-lib#master",
"bitcoincashjs-lib": "github:christroutner/bitcoincashjs-lib",
"bitcoinjs-message": "^2.0.0",
"bs58": "^4.0.1",
"buffer": "^5.1.0",
@@ -4973,6 +4973,27 @@
"util": "^0.12.0"
}
},
"bitcoincashjs-lib": {
"version": "github:christroutner/bitcoincashjs-lib#715823b5d6eb3e2961e715605ad1464f3223da0b",
"from": "github:christroutner/bitcoincashjs-lib",
"requires": {
"bech32": "^1.1.2",
"bigi": "^1.4.0",
"bip66": "^1.1.0",
"bitcoincash-ops": "github:christroutner/bitcoincash-ops",
"bs58check": "^2.0.0",
"create-hash": "^1.1.0",
"create-hmac": "^1.1.3",
"ecurve": "^1.0.0",
"merkle-lib": "^2.0.10",
"pushdata-bitcoin": "github:Bitcoin-com/pushdata-bitcoin#1.2.1",
"randombytes": "^2.0.1",
"safe-buffer": "^5.0.1",
"typeforce": "^1.18.0",
"varuint-bitcoin": "^1.0.4",
"wif": "^2.0.1"
}
},
"commander": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz",
@@ -27313,9 +27334,9 @@
"integrity": "sha512-zd6KCAyXgmq6FV1mR10oKXYtvmA9vRoB6xPSTUJTbFApCtkefDnYueVR1gkof3KcdLZo1Y8mjF2DFmQMIxsHNQ=="
},
"minimal-slp-wallet": {
"version": "1.3.9",
"resolved": "https://registry.npmjs.org/minimal-slp-wallet/-/minimal-slp-wallet-1.3.9.tgz",
"integrity": "sha512-PixaM7h81XBXgzkxfWAg//feaTAa64kKVADw6PNKaKvdd+EUq64UDDAUxXjDLXaTjX6SiQBzzxiZthy/ZZV6cQ==",
"version": "1.3.10",
"resolved": "https://registry.npmjs.org/minimal-slp-wallet/-/minimal-slp-wallet-1.3.10.tgz",
"integrity": "sha512-wIfL3BBachEVA50YRoxhl2vlgKrmnoB8za4AxEtW3hsnJltOTFP/bCrLTbwyPpSs6qdMsnbc0Qv/qwLYexXV8w==",
"requires": {
"@chris.troutner/bch-js": "3.3.3",
"apidoc": "^0.23.0",
+1 -1
View File
@@ -31,7 +31,7 @@
"gatsby-source-filesystem": "^2.3.8",
"gatsby-transformer-sharp": "2.5.3",
"memo-get-gatsby": "^1.0.2",
"minimal-slp-wallet": "1.3.9",
"minimal-slp-wallet": "1.3.10",
"prop-types": "^15.7.2",
"qrcode.react": "^1.0.0",
"react": "^16.12.0",
+6 -2
View File
@@ -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()
+1 -1
View File
@@ -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]
+6 -1
View File
@@ -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 =
+18 -6
View File
@@ -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
})
}
}
+12 -7
View File
@@ -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 () {
+5 -3
View File
@@ -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) {