committed by
GitHub
8 changed files with 74 additions and 22 deletions
@ -1,18 +1,36 @@ |
|||||
// @flow
|
// @flow
|
||||
import type { Account, Operation } from '@ledgerhq/live-common/lib/types' |
import type { Account, Operation, CryptoCurrencyConfig } from '@ledgerhq/live-common/lib/types' |
||||
|
|
||||
const txExplorers: { [_: string]: (Operation) => string } = { |
type Explorer = Operation => ?string |
||||
|
|
||||
|
const fallback = () => null |
||||
|
|
||||
|
const txExplorers: CryptoCurrencyConfig<Explorer> = { |
||||
bitcoin_cash: op => `https://bitcoincash.blockexplorer.com/tx/${op.hash}`, |
bitcoin_cash: op => `https://bitcoincash.blockexplorer.com/tx/${op.hash}`, |
||||
bitcoin_gold: op => `https://btgexplorer.com/tx/${op.hash}`, |
bitcoin_gold: op => `https://btgexplorer.com/tx/${op.hash}`, |
||||
bitcoin_testnet: op => `https://testnet.blockchain.info/tx/${op.hash}`, |
bitcoin_testnet: op => `https://testnet.blockchain.info/tx/${op.hash}`, |
||||
bitcoin: op => `https://blockchain.info/tx/${op.hash}`, |
bitcoin: op => `https://blockchain.info/tx/${op.hash}`, |
||||
|
litecoin: op => `http://explorer.litecoin.net/tx/${op.hash}`, |
||||
ethereum_testnet: op => `https://ropsten.etherscan.io/tx/${op.hash}`, |
ethereum_testnet: op => `https://ropsten.etherscan.io/tx/${op.hash}`, |
||||
ethereum: op => `https://etherscan.io/tx/${op.hash}`, |
ethereum: op => `https://etherscan.io/tx/${op.hash}`, |
||||
ripple: op => `https://bithomp.com/explorer/${op.hash}`, |
ripple: op => `https://bithomp.com/explorer/${op.hash}`, |
||||
zcash: op => `https://explorer.zcha.in/transactions/${op.hash}`, |
zcash: op => `https://explorer.zcha.in/transactions/${op.hash}`, |
||||
} |
|
||||
|
|
||||
export const getTxURL = (account: Account, operation: Operation): ?string => { |
viacoin: fallback, |
||||
const f = txExplorers[account.currency.id] |
vertcoin: fallback, |
||||
return f ? f(operation) : null |
stratis: fallback, |
||||
|
stealthcoin: fallback, |
||||
|
qtum: fallback, |
||||
|
pivx: fallback, |
||||
|
peercoin: fallback, |
||||
|
komodo: fallback, |
||||
|
hcash: fallback, |
||||
|
dogecoin: fallback, |
||||
|
digibyte: fallback, |
||||
|
dash: fallback, |
||||
|
zencash: fallback, |
||||
|
ethereum_classic: fallback, |
||||
} |
} |
||||
|
|
||||
|
export const getTxURL = (account: Account, operation: Operation): ?string => |
||||
|
txExplorers[account.currency.id](operation) |
||||
|
Loading…
Reference in new issue