Browse Source

important bugfix on ETH + integrate more currencies unit

master
Gaëtan Renaudeau 7 years ago
parent
commit
4b823efa7e
  1. 2
      package.json
  2. 22
      src/api/Ethereum.js
  3. 1
      src/bridge/EthereumJSBridge.js
  4. 2
      src/components/FeesField/EthereumKind.js
  5. 1
      src/components/modals/Send/SendModalBody.js
  6. 6
      yarn.lock

2
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",

22
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
},

1
src/bridge/EthereumJSBridge.js

@ -174,7 +174,6 @@ const EthereumBridge: WalletBridge<Transaction> = {
}
txs.reverse()
account.operations = mergeOps([], flatMap(txs, txToOps(account)))
console.log(account)
return { account }
}

2
src/components/FeesField/EthereumKind.js

@ -34,7 +34,7 @@ class FeesField extends Component<Props & { fees?: Fees, error?: Error }, *> {
return (
<GenericContainer error={error} help="Gas">
<InputCurrency
defaultUnit={units[1]}
defaultUnit={units.length > 1 ? units[1] : units[0]}
units={units}
containerProps={{ grow: true }}
value={gasPrice}

1
src/components/modals/Send/SendModalBody.js

@ -127,6 +127,7 @@ class SendModalBody extends PureComponent<Props, State<*>> {
this.setState({
appStatus: null,
deviceSelected: null,
error: null,
stepIndex: step.prevStep,
})
}

6
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"

Loading…
Cancel
Save