From 568db6d8256cad51b85b690410406780259f394c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 30 May 2018 13:51:16 +0200 Subject: [PATCH] add all remaining coins hook for getAddress & explorers --- src/helpers/explorers.js | 33 +++++++-------- src/helpers/getAddressForCurrency/index.js | 47 +++++++++------------- 2 files changed, 34 insertions(+), 46 deletions(-) diff --git a/src/helpers/explorers.js b/src/helpers/explorers.js index e6899541..812702f9 100644 --- a/src/helpers/explorers.js +++ b/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 = { 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 => diff --git a/src/helpers/getAddressForCurrency/index.js b/src/helpers/getAddressForCurrency/index.js index 9763b577..b8150036 100644 --- a/src/helpers/getAddressForCurrency/index.js +++ b/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 = { - 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]