From 4b823efa7edf23d16800935288b9ce0a287ef577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Fri, 1 Jun 2018 22:03:03 +0200 Subject: [PATCH] important bugfix on ETH + integrate more currencies unit --- package.json | 2 +- src/api/Ethereum.js | 22 ++++++++++++--------- src/bridge/EthereumJSBridge.js | 1 - src/components/FeesField/EthereumKind.js | 2 +- src/components/modals/Send/SendModalBody.js | 1 + yarn.lock | 6 +++--- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 3384d2fd..c5e620f1 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@ledgerhq/hw-transport": "^4.12.0", "@ledgerhq/hw-transport-node-hid": "^4.12.0", "@ledgerhq/ledger-core": "1.4.1", - "@ledgerhq/live-common": "2.22.0", + "@ledgerhq/live-common": "2.23.0", "axios": "^0.18.0", "babel-runtime": "^6.26.0", "bcryptjs": "^2.4.3", diff --git a/src/api/Ethereum.js b/src/api/Ethereum.js index 9b3d4c9b..a182b681 100644 --- a/src/api/Ethereum.js +++ b/src/api/Ethereum.js @@ -46,31 +46,35 @@ export const apiForCurrency = (currency: CryptoCurrency): API => { return { async getTransactions(address, blockHash) { const { data } = await userFriendlyError( - axios.get(`${baseURL}/addresses/${address}/transactions`, { - params: { blockHash, noToken: 1 }, - }), + retry( + () => + axios.get(`${baseURL}/addresses/${address}/transactions`, { + params: { blockHash, noToken: 1 }, + }), + { maxRetry: 3 }, + ), ) return data }, async getCurrentBlock() { - const { data } = await userFriendlyError(retry(() => axios.get(`${baseURL}/blocks/current`))) + const { data } = await userFriendlyError( + retry(() => axios.get(`${baseURL}/blocks/current`), { maxRetry: 3 }), + ) return data }, async getAccountNonce(address) { const { data } = await userFriendlyError( - retry(() => axios.get(`${baseURL}/addresses/${address}/nonce`)), + retry(() => axios.get(`${baseURL}/addresses/${address}/nonce`), { maxRetry: 3 }), ) return data[0].nonce }, async broadcastTransaction(tx) { - const { data } = await userFriendlyError( - retry(() => axios.post(`${baseURL}/transactions/send`, { tx })), - ) + const { data } = await userFriendlyError(axios.post(`${baseURL}/transactions/send`, { tx })) return data.result }, async getAccountBalance(address) { const { data } = await userFriendlyError( - retry(() => axios.get(`${baseURL}/addresses/${address}/balance`)), + retry(() => axios.get(`${baseURL}/addresses/${address}/balance`), { maxRetry: 3 }), ) return data[0].balance }, diff --git a/src/bridge/EthereumJSBridge.js b/src/bridge/EthereumJSBridge.js index 89549f63..073ce264 100644 --- a/src/bridge/EthereumJSBridge.js +++ b/src/bridge/EthereumJSBridge.js @@ -174,7 +174,6 @@ const EthereumBridge: WalletBridge = { } txs.reverse() account.operations = mergeOps([], flatMap(txs, txToOps(account))) - console.log(account) return { account } } diff --git a/src/components/FeesField/EthereumKind.js b/src/components/FeesField/EthereumKind.js index 0ac63bbc..82313ad2 100644 --- a/src/components/FeesField/EthereumKind.js +++ b/src/components/FeesField/EthereumKind.js @@ -34,7 +34,7 @@ class FeesField extends Component { return ( 1 ? units[1] : units[0]} units={units} containerProps={{ grow: true }} value={gasPrice} diff --git a/src/components/modals/Send/SendModalBody.js b/src/components/modals/Send/SendModalBody.js index 00f64486..567a207f 100644 --- a/src/components/modals/Send/SendModalBody.js +++ b/src/components/modals/Send/SendModalBody.js @@ -127,6 +127,7 @@ class SendModalBody extends PureComponent> { this.setState({ appStatus: null, deviceSelected: null, + error: null, stepIndex: step.prevStep, }) } diff --git a/yarn.lock b/yarn.lock index 799f056e..39061848 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1495,9 +1495,9 @@ npm "^5.7.1" prebuild-install "^2.2.2" -"@ledgerhq/live-common@2.22.0": - version "2.22.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-2.22.0.tgz#f958ee28cc09af40a6bed484e73204f01b54d709" +"@ledgerhq/live-common@2.23.0": + version "2.23.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-2.23.0.tgz#c039bbb444ceb909fa9c7f17645c39d9c3ce125e" dependencies: axios "^0.18.0" invariant "^2.2.2"