Browse Source

Merge pull request #404 from gre/add-all-coins

add all remaining coins hook for getAddress & explorers
master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
e84347e308
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      src/helpers/explorers.js
  2. 47
      src/helpers/getAddressForCurrency/index.js

33
src/helpers/explorers.js

@ -3,33 +3,30 @@ import type { Account, Operation, CryptoCurrencyConfig } from '@ledgerhq/live-co
type Explorer = Operation => ?string
const fallback = () => null
const txExplorers: CryptoCurrencyConfig<Explorer> = {
bitcoin_cash: op => `https://bitcoincash.blockexplorer.com/tx/${op.hash}`,
bitcoin_gold: op => `https://btgexplorer.com/tx/${op.hash}`,
bitcoin_testnet: op => `https://testnet.blockchain.info/tx/${op.hash}`,
bitcoin: op => `https://blockchain.info/tx/${op.hash}`,
litecoin: op => `http://explorer.litecoin.net/tx/${op.hash}`,
dash: op => `https://explorer.dash.org/tx/${op.hash}`,
digibyte: op => `https://digiexplorer.info/tx/${op.hash}`,
dogecoin: op => `https://dogechain.info/tx/${op.hash}`,
ethereum_classic: op => `https://gastracker.io/tx/${op.hash}`,
ethereum_testnet: op => `https://ropsten.etherscan.io/tx/${op.hash}`,
ethereum: op => `https://etherscan.io/tx/${op.hash}`,
hcash: op => `http://explorer.h.cash/tx/${op.hash}`,
komodo: op => `https://kmd.explorer.supernet.org/tx/${op.hash}`,
litecoin: op => `http://explorer.litecoin.net/tx/${op.hash}`,
peercoin: op => `https://explorer.peercoin.net/tx/${op.hash}`,
pivx: () => null, // FIXME can't find a reliable/official explorer
qtum: op => `https://explorer.qtum.org/tx/${op.hash}`,
ripple: op => `https://bithomp.com/explorer/${op.hash}`,
stealthcoin: () => null, // FIXME can't find a reliable/official explorer
stratis: () => null, // FIXME can't find a reliable/official explorer
vertcoin: op => `http://explorer.vertcoin.info/tx/${op.hash}`,
viacoin: op => `https://explorer.viacoin.org/tx/${op.hash}`,
zcash: op => `https://explorer.zcha.in/transactions/${op.hash}`,
viacoin: fallback,
vertcoin: fallback,
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,
zencash: op => `https://explorer.zensystem.io/tx/${op.hash}`,
}
export const getTxURL = (account: Account, operation: Operation): ?string =>

47
src/helpers/getAddressForCurrency/index.js

@ -18,39 +18,30 @@ type Resolver = (
type Module = (currencyId: string) => Resolver
const fallback: string => Resolver = currencyId => () =>
Promise.reject(new Error(`${currencyId} device support not implemented`))
const all: CryptoCurrencyConfig<Resolver> = {
bitcoin: btc,
bitcoin_testnet: btc,
litecoin: btc,
zcash: btc,
bitcoin_cash: btc,
bitcoin_gold: btc,
zencash: btc,
ethereum,
ethereum_testnet: ethereum,
bitcoin_testnet: btc,
bitcoin: btc,
dash: btc,
digibyte: btc,
dogecoin: btc,
ethereum_classic: ethereum,
ethereum_testnet: ethereum,
ethereum,
hcash: btc,
komodo: btc,
litecoin: btc,
peercoin: btc,
pivx: btc,
qtum: btc,
ripple,
// TODO port of all these
viacoin: fallback('viacoin'),
vertcoin: fallback('vertcoin'),
stratis: fallback('stratis'),
stealthcoin: fallback('stealthcoin'),
qtum: fallback('qtum'),
pivx: fallback('pivx'),
peercoin: fallback('peercoin'),
komodo: fallback('komodo'),
hcash: fallback('hcash'),
dogecoin: fallback('dogecoin'),
digibyte: fallback('digibyte'),
dash: fallback('dash'),
stealthcoin: btc,
stratis: btc,
vertcoin: btc,
viacoin: btc,
zcash: btc,
zencash: btc,
}
const getAddressForCurrency: Module = (currencyId: string) => all[currencyId]

Loading…
Cancel
Save