From d38573608539e0bfe3c6aa275bbba7da5eb1ef63 Mon Sep 17 00:00:00 2001 From: Daniel Gonzalez Date: Tue, 24 Nov 2020 18:39:39 -0400 Subject: [PATCH] feat(explorer): Link to correct block explorer --- src/components/admin-lte/send-receive/send.js | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/components/admin-lte/send-receive/send.js b/src/components/admin-lte/send-receive/send.js index 2fbd8da..b93fe26 100644 --- a/src/components/admin-lte/send-receive/send.js +++ b/src/components/admin-lte/send-receive/send.js @@ -23,7 +23,8 @@ class Send extends React.Component { showScan: false, inFetch: false, sendCurrency: 'USD', - sendMax: false + sendMax: false, + explorerURL: '' } _this.BchWallet = BchWallet } @@ -118,7 +119,7 @@ class Send extends React.Component { Transaction ID: {_this.state.txId} @@ -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 () { if (_this.state.sendCurrency === 'USD') { _this.setState({