Browse Source

polish

master
Gaëtan Renaudeau 7 years ago
parent
commit
3b8661f6f7
  1. 7
      src/api/Ledger.js
  2. 4
      src/bridge/EthereumJSBridge.js
  3. 2
      src/commands/getAddress.js
  4. 2
      src/commands/signTransaction.js
  5. 2
      src/components/DeviceCheckAddress.js
  6. 2
      src/components/EnsureDeviceApp/index.js
  7. 7
      src/components/modals/AddAccount/index.js
  8. 0
      src/helpers/getAddressForCurrency/btc.js
  9. 0
      src/helpers/getAddressForCurrency/ethereum.js
  10. 0
      src/helpers/getAddressForCurrency/index.js
  11. 0
      src/helpers/signTransactionForCurrency/ethereum.js
  12. 0
      src/helpers/signTransactionForCurrency/index.js
  13. 4
      src/internals/devices/index.js

7
src/api/Ledger.js

@ -4,13 +4,14 @@ import type { Currency } from '@ledgerhq/live-common/lib/types'
const BASE_URL = process.env.LEDGER_REST_API_BASE || 'https://api.ledgerwallet.com/'
const mapping = {
bch: 'abc',
etc: 'ethc',
bitcoin_cash: 'abc',
ethereum_classic: 'ethc',
ethereum_testnet: 'eth_testnet',
}
export const currencyToFeeTicker = (currency: Currency) => {
const tickerLowerCase = currency.ticker.toLowerCase()
return mapping[tickerLowerCase] || tickerLowerCase
return mapping[currency.id] || tickerLowerCase
}
export const blockchainBaseURL = (currency: Currency) =>

4
src/bridge/EthereumJSBridge.js

@ -5,8 +5,8 @@ import type { Account, Operation } from '@ledgerhq/live-common/lib/types'
import { apiForCurrency } from 'api/Ethereum'
import type { Tx } from 'api/Ethereum'
import { makeBip44Path } from 'helpers/bip32path'
import getAddressCommand from 'internals/devices/getAddress'
import signTransactionCommand from 'internals/devices/signTransaction'
import getAddressCommand from 'commands/getAddress'
import signTransactionCommand from 'commands/signTransaction'
import type { EditProps, WalletBridge } from './types'
// TODO in future it would be neat to support eip55

2
src/internals/devices/getAddress.js → src/commands/getAddress.js

@ -3,7 +3,7 @@
import { createCommand, Command } from 'helpers/ipc'
import { fromPromise } from 'rxjs/observable/fromPromise'
import CommNodeHid from '@ledgerhq/hw-transport-node-hid'
import getAddressForCurrency from './getAddressForCurrency'
import getAddressForCurrency from 'helpers/getAddressForCurrency'
type Input = {
currencyId: string,

2
src/internals/devices/signTransaction.js → src/commands/signTransaction.js

@ -3,7 +3,7 @@
import { createCommand, Command } from 'helpers/ipc'
import { fromPromise } from 'rxjs/observable/fromPromise'
import CommNodeHid from '@ledgerhq/hw-transport-node-hid'
import signTransactionForCurrency from './signTransactionForCurrency'
import signTransactionForCurrency from 'helpers/signTransactionForCurrency'
type Input = {
currencyId: string,

2
src/components/DeviceCheckAddress.js

@ -4,7 +4,7 @@ import { PureComponent } from 'react'
import type { Account } from '@ledgerhq/live-common/lib/types'
import type { Device } from 'types/common'
import getAddress from 'internals/devices/getAddress'
import getAddress from 'commands/getAddress'
type Props = {
onCheck: boolean => void,

2
src/components/EnsureDeviceApp/index.js

@ -9,7 +9,7 @@ import type { Device } from 'types/common'
import { getDevices } from 'reducers/devices'
import type { State as StoreState } from 'reducers/index'
import getAddress from 'internals/devices/getAddress'
import getAddress from 'commands/getAddress'
type OwnProps = {
currency: ?CryptoCurrency,

7
src/components/modals/AddAccount/index.js

@ -101,7 +101,7 @@ class AddAccountModal extends PureComponent<Props, State> {
scanSubscription: *
startScanAccountsDevice() {
const { visibleAccounts, addAccount } = this.props
const { visibleAccounts } = this.props
const { deviceSelected, currency } = this.state
if (!deviceSelected || !currency) {
@ -111,7 +111,6 @@ class AddAccountModal extends PureComponent<Props, State> {
this.scanSubscription = bridge.scanAccountsOnDevice(currency, deviceSelected.path, {
next: account => {
if (!visibleAccounts.some(a => a.id === account.id)) {
addAccount(account)
this.setState(state => ({
scannedAccounts: [...state.scannedAccounts, account],
}))
@ -169,9 +168,9 @@ class AddAccountModal extends PureComponent<Props, State> {
handleChangeStatus = (deviceStatus, appStatus) => this.setState({ appStatus })
handleImportAccount = () => {
const { updateAccount } = this.props
const { addAccount } = this.props
const { selectedAccounts } = this.state
selectedAccounts.forEach(a => updateAccount({ ...a, archived: false }))
selectedAccounts.forEach(a => addAccount({ ...a, archived: false }))
this.setState({ selectedAccounts: [] })
closeModal(MODAL_ADD_ACCOUNT)
this.props.counterValuesPolling.poll()

0
src/internals/devices/getAddressForCurrency/btc.js → src/helpers/getAddressForCurrency/btc.js

0
src/internals/devices/getAddressForCurrency/ethereum.js → src/helpers/getAddressForCurrency/ethereum.js

0
src/internals/devices/getAddressForCurrency/index.js → src/helpers/getAddressForCurrency/index.js

0
src/internals/devices/signTransactionForCurrency/ethereum.js → src/helpers/signTransactionForCurrency/ethereum.js

0
src/internals/devices/signTransactionForCurrency/index.js → src/helpers/signTransactionForCurrency/index.js

4
src/internals/devices/index.js

@ -1,9 +1,9 @@
// @flow
import type { Command } from 'helpers/ipc'
import getAddress from './getAddress'
import getAddress from 'commands/getAddress'
import signTransaction from 'commands/signTransaction'
import listen from './listen'
import signTransaction from './signTransaction'
// TODO port these to commands
export { listen }

Loading…
Cancel
Save