Meriadec Pillet
7 years ago
committed by
GitHub
17 changed files with 192 additions and 86 deletions
@ -1,32 +1,38 @@ |
|||||
### requirements |
# Ledger Wallet Desktop |
||||
|
|
||||
#### Linux |
## Requirements |
||||
|
|
||||
``` |
* nodejs v8.x (https://nodejs.org/en/) |
||||
libicns |
* yarn latest (https://yarnpkg.com/fr/docs/install) |
||||
graphicsmagick |
|
||||
``` |
|
||||
|
|
||||
install dependencies |
## Installation |
||||
|
|
||||
``` |
``` |
||||
yarn |
yarn |
||||
``` |
``` |
||||
|
|
||||
launch development version |
## Development |
||||
|
|
||||
``` |
``` |
||||
yarn start |
yarn start |
||||
``` |
``` |
||||
|
|
||||
build, but not package for distribution |
## Build |
||||
|
|
||||
|
> Not package for distribution |
||||
|
|
||||
``` |
``` |
||||
yarn dist:dir |
yarn dist:dir |
||||
``` |
``` |
||||
|
|
||||
build and package everything |
> Package everything |
||||
|
|
||||
``` |
``` |
||||
yarn dist |
yarn dist |
||||
``` |
``` |
||||
|
|
||||
|
## Release |
||||
|
|
||||
|
``` |
||||
|
yarn release |
||||
|
``` |
||||
|
@ -1,29 +1,29 @@ |
|||||
// @flow
|
// @flow
|
||||
|
|
||||
// eslint-disable import/prefer-default-export
|
/* eslint-disable import/prefer-default-export */ |
||||
|
|
||||
import type { Device, Devices } from 'types/common' |
import type { Device, Devices } from 'types/common' |
||||
|
|
||||
export type deviceChooseType = (Device | null) => { type: string, payload: Device | null } |
export type SetCurrentDevice = (Device | null) => { type: string, payload: Device | null } |
||||
export const deviceChoose: deviceChooseType = payload => ({ |
export const setCurrentDevice: SetCurrentDevice = payload => ({ |
||||
type: 'DEVICE_CHOOSE', |
type: 'SET_CURRENT_DEVICE', |
||||
payload, |
payload, |
||||
}) |
}) |
||||
|
|
||||
type devicesAddType = Device => { type: string, payload: Device } |
type AddDevice = Device => { type: string, payload: Device } |
||||
export const deviceAdd: devicesAddType = payload => ({ |
export const addDevice: AddDevice = payload => ({ |
||||
type: 'DEVICE_ADD', |
type: 'ADD_DEVICE', |
||||
payload, |
payload, |
||||
}) |
}) |
||||
|
|
||||
type devicesRemoveType = Device => { type: string, payload: Device } |
type RemoveDevice = Device => { type: string, payload: Device } |
||||
export const deviceRemove: devicesRemoveType = payload => ({ |
export const removeDevice: RemoveDevice = payload => ({ |
||||
type: 'DEVICE_REMOVE', |
type: 'REMOVE_DEVICE', |
||||
payload, |
payload, |
||||
}) |
}) |
||||
|
|
||||
type devicesUpdateType = Devices => { type: string, payload: Devices } |
type UpdateDevices = Devices => { type: string, payload: Devices } |
||||
export const devicesUpdate: devicesUpdateType = payload => ({ |
export const updateDevices: UpdateDevices = payload => ({ |
||||
type: 'DEVICES_UPDATE', |
type: 'UPDATE_DEVICES', |
||||
payload, |
payload, |
||||
}) |
}) |
||||
|
@ -0,0 +1,9 @@ |
|||||
|
// @flow
|
||||
|
|
||||
|
/* eslint-disable import/prefer-default-export */ |
||||
|
|
||||
|
export type SetCurrentWalletType = (Object | null) => { type: string, payload: Object | null } |
||||
|
export const setCurrentWallet: SetCurrentWalletType = payload => ({ |
||||
|
type: 'SET_CURRENT_WALLET', |
||||
|
payload, |
||||
|
}) |
@ -1,15 +1,73 @@ |
|||||
// @flow
|
// @flow
|
||||
|
|
||||
import React, { PureComponent } from 'react' |
import React, { PureComponent } from 'react' |
||||
|
import { connect } from 'react-redux' |
||||
|
|
||||
|
import type { MapStateToProps } from 'react-redux' |
||||
|
import type { Device } from 'types/common' |
||||
|
|
||||
|
import { getCurrentDevice } from 'reducers/devices' |
||||
|
|
||||
|
import { sendEvent } from 'renderer/events' |
||||
|
|
||||
import Box from 'components/base/Box' |
import Box from 'components/base/Box' |
||||
|
|
||||
type Props = {} |
const mapStateToProps: MapStateToProps<*, *, *> = state => ({ |
||||
|
currentDevice: getCurrentDevice(state), |
||||
|
currentWallet: state.wallets.currentWallet, |
||||
|
}) |
||||
|
|
||||
|
type Props = { |
||||
|
currentDevice: Device | null, |
||||
|
currentWallet: Object | null, |
||||
|
} |
||||
|
type State = { |
||||
|
address: Object | null, |
||||
|
} |
||||
|
|
||||
|
class AccountPage extends PureComponent<Props, State> { |
||||
|
state = { |
||||
|
address: null, |
||||
|
} |
||||
|
|
||||
|
componentDidMount() { |
||||
|
this.getWalletInfos() |
||||
|
} |
||||
|
|
||||
|
componentWillReceiveProps(nextProps) { |
||||
|
const { currentWallet } = nextProps |
||||
|
|
||||
|
if (currentWallet !== null && !currentWallet.err) { |
||||
|
this.setState({ |
||||
|
address: currentWallet.data.bitcoinAddress, |
||||
|
}) |
||||
|
} else { |
||||
|
this._timeout = setTimeout(() => this.getWalletInfos(), 2e3) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
componentWillUnmount() { |
||||
|
clearTimeout(this._timeout) |
||||
|
} |
||||
|
|
||||
|
getWalletInfos() { |
||||
|
const { currentDevice } = this.props |
||||
|
|
||||
|
if (currentDevice !== null) { |
||||
|
sendEvent('usb', 'wallet.infos.request', { |
||||
|
path: currentDevice.path, |
||||
|
wallet: 'btc', |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
_timeout = undefined |
||||
|
|
||||
class AccountPage extends PureComponent<Props> { |
|
||||
render() { |
render() { |
||||
return <Box>{'account'}</Box> |
const { address } = this.state |
||||
|
|
||||
|
return <Box>{address === null ? 'Select Bitcoin App on your Ledger' : address}</Box> |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
export default AccountPage |
export default connect(mapStateToProps)(AccountPage) |
||||
|
@ -0,0 +1,12 @@ |
|||||
|
// @flow
|
||||
|
|
||||
|
import styled from 'styled-components' |
||||
|
|
||||
|
export default styled.div` |
||||
|
-webkit-app-region: drag; |
||||
|
height: 40px; |
||||
|
left: 0; |
||||
|
position: absolute; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
` |
@ -0,0 +1,20 @@ |
|||||
|
// @flow
|
||||
|
|
||||
|
import { handleActions } from 'redux-actions' |
||||
|
|
||||
|
export type WalletsState = { |
||||
|
currentWallet: Object | null, |
||||
|
} |
||||
|
|
||||
|
const state: WalletsState = { |
||||
|
currentWallet: null, |
||||
|
} |
||||
|
|
||||
|
const handlers: Object = { |
||||
|
SET_CURRENT_WALLET: (state: Object, { payload: currentWallet }: { payload: WalletsState }) => ({ |
||||
|
...state, |
||||
|
currentWallet, |
||||
|
}), |
||||
|
} |
||||
|
|
||||
|
export default handleActions(handlers, state) |
Loading…
Reference in new issue