Browse Source

fix(dynamic-showTransaction): add isTestnet param to function and update function calls

renovate/lint-staged-8.x
Jack Mallers 6 years ago
parent
commit
5ab19cd19b
  1. 2
      app/components/Activity/ActivityModal.js
  2. 5
      app/components/Activity/TransactionModal.js
  3. 6
      app/components/Contacts/Network.js
  4. 3
      app/components/ModalRoot/ModalRoot.js
  5. 4
      app/components/ModalRoot/SuccessfulSendCoins.js
  6. 5
      app/components/Wallet/Wallet.js
  7. 1
      app/routes/activity/containers/ActivityContainer.js
  8. 2
      app/routes/app/components/App.js
  9. 2
      app/routes/app/containers/AppContainer.js
  10. 10
      app/utils/blockExplorer.js

2
app/components/Activity/ActivityModal.js

@ -14,6 +14,7 @@ const ActivityModal = ({
modalProps,
ticker,
currentTicker,
isTestnet,
hideActivityModal,
toggleCurrencyProps
@ -36,6 +37,7 @@ const ActivityModal = ({
</div>
<SpecificModal
{...modalProps}
isTestnet={isTestnet}
ticker={ticker}
currentTicker={currentTicker}
toggleCurrencyProps={toggleCurrencyProps}

5
app/components/Activity/TransactionModal.js

@ -19,6 +19,7 @@ const TransactionModal = ({
transaction,
ticker,
currentTicker,
isTestnet,
toggleCurrencyProps: {
setActivityModalCurrencyFilters,
@ -37,7 +38,7 @@ const TransactionModal = ({
<section className={styles.details}>
<div>
<Isvg src={link} />
<span className={styles.link} onClick={() => blockExplorer.showTransaction(transaction.tx_hash)}>On-Chain</span>
<span className={styles.link} onClick={() => blockExplorer.showTransaction(isTestnet, transaction.tx_hash)}>On-Chain</span>
</div>
<div>
<Value value={transaction.total_fees} currency={ticker.currency} currentTicker={currentTicker} />
@ -75,7 +76,7 @@ const TransactionModal = ({
</div>
<footer className={styles.footer}>
<p onClick={() => blockExplorer.showTransaction(transaction.tx_hash)}>{transaction.tx_hash}</p>
<p onClick={() => blockExplorer.showTransaction(isTestnet, transaction.tx_hash)}>{transaction.tx_hash}</p>
</footer>
</div>
)

6
app/components/Contacts/Network.js

@ -51,7 +51,9 @@ class Network extends Component {
closeChannel,
suggestedNodesProps
suggestedNodesProps,
isTestnet
} = this.props
const refreshClicked = () => {
@ -224,7 +226,7 @@ class Network extends Component {
<span>{displayNodeName(channel)}</span>
{
selectedChannel === channel &&
<span onClick={() => blockExplorer.showTransaction(channel.channel_point.split(':')[0])}>
<span onClick={() => blockExplorer.showTransaction(isTestnet, channel.channel_point.split(':')[0])}>
<FaExternalLink />
</span>
}

3
app/components/ModalRoot/ModalRoot.js

@ -14,7 +14,7 @@ const MODAL_COMPONENTS = {
}
const ModalRoot = ({
modalType, modalProps, hideModal, currentTicker, currency
modalType, modalProps, hideModal, currentTicker, currency, isTestnet
}) => {
if (!modalType) { return null }
@ -31,6 +31,7 @@ const ModalRoot = ({
hideModal={hideModal}
currentTicker={currentTicker}
currency={currency}
isTestnet={isTestnet}
/>
</div>
</div>

4
app/components/ModalRoot/SuccessfulSendCoins.js

@ -5,7 +5,7 @@ import { btc, blockExplorer } from 'utils'
import styles from './SuccessfulSendCoins.scss'
const SuccessfulSendCoins = ({
amount, addr, txid, hideModal, currentTicker, currency
amount, addr, txid, hideModal, currentTicker, currency, isTestnet
}) => {
const calculatedAmount = currency === 'usd' ? btc.satoshisToUsd(amount, currentTicker.price_usd) : btc.satoshisToBtc(amount)
@ -14,7 +14,7 @@ const SuccessfulSendCoins = ({
<AnimatedCheckmark />
<h1>
You&nbsp;
<span className={styles.link} onClick={() => blockExplorer.showTransaction(txid)}>sent</span>&nbsp;
<span className={styles.link} onClick={() => blockExplorer.showTransaction(isTestnet, txid)}>sent</span>&nbsp;
<span className={styles.amount}>{calculatedAmount} {currency.toUpperCase()}</span>&nbsp;
to&nbsp;
<span className={styles.addr}>{addr}</span>

5
app/components/Wallet/Wallet.js

@ -26,7 +26,8 @@ const Wallet = ({
currentCurrencyFilters,
currencyName,
setCurrency,
setWalletCurrencyFilters
setWalletCurrencyFilters,
isTestnet
}) => {
const usdAmount = btc.satoshisToUsd((parseInt(balance.walletBalance, 10) + parseInt(balance.channelBalance, 10)), currentTicker.price_usd)
@ -112,7 +113,7 @@ const Wallet = ({
{
// TODO(jimmymow): remove this
// eslint-disable-next-line
}Successfully <span className={styles.txLink} onClick={() => blockExplorer.showTransaction(successTransactionScreen.txid)}>sent</span> transaction
}Successfully <span className={styles.txLink} onClick={() => blockExplorer.showTransaction(isTestnet, successTransactionScreen.txid)}>sent</span> transaction
</section>
</span>
}

1
app/routes/activity/containers/ActivityContainer.js

@ -93,6 +93,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
successTransactionScreen: stateProps.transaction.successTransactionScreen,
currentCurrencyFilters: stateProps.currentCurrencyFilters,
currencyName: stateProps.currencyName,
isTestnet: stateProps.info.data.testnet,
setCurrency: dispatchProps.setCurrency,
setWalletCurrencyFilters: dispatchProps.setWalletCurrencyFilters,

2
app/routes/app/components/App.js

@ -52,6 +52,7 @@ class App extends Component {
ticker,
currentTicker,
form,
info: { data },
formProps,
closeForm,
@ -81,6 +82,7 @@ class App extends Component {
hideModal={hideModal}
currentTicker={currentTicker}
currency={ticker.currency}
isTestnet={data.testnet}
/>
<ContactModal {...contactModalProps} />

2
app/routes/app/containers/AppContainer.js

@ -305,6 +305,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
nodes: stateProps.network.nodes,
nonActiveFilters: stateProps.nonActiveFilters,
ticker: stateProps.ticker,
isTestnet: stateProps.info.data.testnet,
fetchChannels: dispatchProps.fetchChannels,
openContactsForm: dispatchProps.openContactsForm,
@ -361,6 +362,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
modalProps: stateProps.activity.modal.modalProps,
ticker: stateProps.ticker,
currentTicker: stateProps.currentTicker,
isTestnet: stateProps.info.data.testnet,
hideActivityModal: dispatchProps.hideActivityModal,

10
app/utils/blockExplorer.js

@ -3,11 +3,13 @@ import { shell } from 'electron'
const testnetUrl = 'https://testnet.smartbit.com.au'
const mainnetUrl = 'https://smartbit.com.au'
const showTransaction = txid =>
shell.openExternal(`${testnetUrl}/tx/${txid}`)
const showTransaction = (isTestnet, txid) => {
console.log('isTestnet: ', isTestnet)
console.log('txid: ', txid)
isTestnet ? shell.openExternal(`${testnetUrl}/tx/${txid}`) : shell.openExternal(`${mainnetUrl}/tx/${txid}`)
}
const showBlock = blockHash =>
shell.openExternal(`${testnetUrl}/block/${blockHash}`)
const showBlock = (isTestnet, blockHash) => isTestnet ? shell.openExternal(`${testnetUrl}/block/${blockHash}`) : shell.openExternal(`${mainnetUrl}/block/${blockHash}`)
const showChannelClosing = channel =>
showTransaction(channel.closing_txid)

Loading…
Cancel
Save