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 #120 from Permissionless-Software-Foundation/dh-abc-txid
fix(txid): Fixed token txid link on ABC
This commit is contained in:
@@ -20,7 +20,8 @@ class Tokens extends React.Component {
|
||||
errMsg: '',
|
||||
selectedTokenToSend: '',
|
||||
showForm: false,
|
||||
txId: null
|
||||
txId: null,
|
||||
explorerURL: ''
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ class Tokens extends React.Component {
|
||||
<a
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
href={`https://explorer.bitcoin.com/bch/tx/${_this.state.txId}`}
|
||||
href={`${_this.state.explorerURL}/${_this.state.txId}`}
|
||||
>
|
||||
{_this.state.txId}
|
||||
</a>
|
||||
@@ -179,6 +180,7 @@ class Tokens extends React.Component {
|
||||
}
|
||||
|
||||
async componentDidMount () {
|
||||
_this.defineExplorer()
|
||||
await _this.handleGetTokens()
|
||||
}
|
||||
|
||||
@@ -238,6 +240,24 @@ class Tokens extends React.Component {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 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
|
||||
})
|
||||
}
|
||||
}
|
||||
Tokens.propTypes = {
|
||||
walletInfo: PropTypes.object.isRequired, // wallet info
|
||||
|
||||
Reference in New Issue
Block a user