mirror of
https://github.com/fullstack-cash/fullstack-gatsby-theme-bch-wallet.git
synced 2026-09-21 16:52:06 -07:00
Merge pull request #111 from Permissionless-Software-Foundation/dh-bcha-explorer
feat(explorer): Link to correct block explorer
This commit is contained in:
@@ -23,7 +23,8 @@ class Send extends React.Component {
|
|||||||
showScan: false,
|
showScan: false,
|
||||||
inFetch: false,
|
inFetch: false,
|
||||||
sendCurrency: 'USD',
|
sendCurrency: 'USD',
|
||||||
sendMax: false
|
sendMax: false,
|
||||||
|
explorerURL: ''
|
||||||
}
|
}
|
||||||
_this.BchWallet = BchWallet
|
_this.BchWallet = BchWallet
|
||||||
}
|
}
|
||||||
@@ -118,7 +119,7 @@ class Send extends React.Component {
|
|||||||
<a
|
<a
|
||||||
target='_blank'
|
target='_blank'
|
||||||
rel='noopener noreferrer'
|
rel='noopener noreferrer'
|
||||||
href={`https://explorer.bitcoin.com/bch/tx/${_this.state.txId}`}
|
href={`${_this.state.explorerURL}/${_this.state.txId}`}
|
||||||
>
|
>
|
||||||
Transaction ID: {_this.state.txId}
|
Transaction ID: {_this.state.txId}
|
||||||
</a>
|
</a>
|
||||||
@@ -139,6 +140,28 @@ class Send extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount () {
|
||||||
|
_this.defineExplorer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define the explorer to use
|
||||||
|
// depending on the selected chain
|
||||||
|
defineExplorer () {
|
||||||
|
const bchWalletLib = _this.props.bchWallet
|
||||||
|
const bchjs = bchWalletLib.bchjs
|
||||||
|
|
||||||
|
let explorerURL
|
||||||
|
|
||||||
|
if (bchjs.restURL.includes('abc.fullstack')) {
|
||||||
|
explorerURL = 'https://explorer.bitcoinabc.org/tx'
|
||||||
|
} else {
|
||||||
|
explorerURL = 'https://explorer.bitcoin.com/bch/tx'
|
||||||
|
}
|
||||||
|
_this.setState({
|
||||||
|
explorerURL
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
handleChangeCurrency () {
|
handleChangeCurrency () {
|
||||||
if (_this.state.sendCurrency === 'USD') {
|
if (_this.state.sendCurrency === 'USD') {
|
||||||
_this.setState({
|
_this.setState({
|
||||||
|
|||||||
Reference in New Issue
Block a user