diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eebcbfb3..738fda45 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -160,23 +160,23 @@ delete review: tags: - deploy -integration tests: - image: docker:latest - services: - - docker:dind - stage: integration tests - script: - - 'export SHARED_PATH="$(dirname ${CI_PROJECT_DIR})/shared"' - - rm -r ${SHARED_PATH} || true - - docker build -f Dockerfile.test -t wallet-emulator-bridge-tests . - - mkdir -p ${SHARED_PATH}/trezor-wallet/screenshots - - mkdir -p ${SHARED_PATH}/trezor-wallet/videos - - docker run --volume ${SHARED_PATH}/trezor-wallet/screenshots:/trezor-wallet/test/screenshots --volume ${SHARED_PATH}/trezor-wallet/videos:/trezor-wallet/test/videos --rm wallet-emulator-bridge-tests - - find ${SHARED_PATH} - - mkdir trezor-wallet - - cp -r ${SHARED_PATH}/ trezor-wallet/ - artifacts: - when: always - expire_in: 1 week - paths: - - trezor-wallet/ +# integration tests: +# image: docker:latest +# services: +# - docker:dind +# stage: integration tests +# script: +# - 'export SHARED_PATH="$(dirname ${CI_PROJECT_DIR})/shared"' +# - rm -r ${SHARED_PATH} || true +# - docker build -f Dockerfile.test -t wallet-emulator-bridge-tests . +# - mkdir -p ${SHARED_PATH}/trezor-wallet/screenshots +# - mkdir -p ${SHARED_PATH}/trezor-wallet/videos +# - docker run --volume ${SHARED_PATH}/trezor-wallet/screenshots:/trezor-wallet/test/screenshots --volume ${SHARED_PATH}/trezor-wallet/videos:/trezor-wallet/test/videos --rm wallet-emulator-bridge-tests +# - find ${SHARED_PATH} +# - mkdir trezor-wallet +# - cp -r ${SHARED_PATH}/ trezor-wallet/ +# artifacts: +# when: always +# expire_in: 1 week +# paths: +# - trezor-wallet/ diff --git a/public/data/appConfig.json b/public/data/appConfig.json index d8c88919..2520b4cb 100644 --- a/public/data/appConfig.json +++ b/public/data/appConfig.json @@ -1,5 +1,14 @@ { "networks": [ + { + "order": 1, + "isHidden": true, + "type": "bitcoin", + "name": "Bitcoin", + "symbol": "BTC", + "shortcut": "btc", + "hasSignVerify": true + }, { "order": 2, "type": "ethereum", @@ -19,7 +28,8 @@ "explorer": { "tx": "https://etherscan.io/tx/", "address": "https://etherscan.io/address/" - } + }, + "hasSignVerify": true }, { "order": 18, @@ -40,7 +50,8 @@ "explorer": { "tx": "https://gastracker.io/tx/", "address": "https://gastracker.io/addr/" - } + }, + "hasSignVerify": true }, { "order": 2, @@ -74,7 +85,8 @@ "explorer": { "tx": "https://ropsten.etherscan.io/tx/", "address": "https://ropsten.etherscan.io/address/" - } + }, + "hasSignVerify": true }, { "order": 3, @@ -95,7 +107,8 @@ "explorer": { "tx": "https://xrpscan.com/tx/", "address": "https://xrpscan.com/account/" - } + }, + "hasSignVerify": false }, { "order": 3, @@ -117,7 +130,8 @@ "explorer": { "tx": "https://sisyfos.trezor.io/ripple-testnet-explorer/tx/", "address": "https://sisyfos.trezor.io/ripple-testnet-explorer/address/" - } + }, + "hasSignVerify": false } ], diff --git a/src/actions/ripple/BlockchainActions.js b/src/actions/ripple/BlockchainActions.js index cdf15610..06f4b18b 100644 --- a/src/actions/ripple/BlockchainActions.js +++ b/src/actions/ripple/BlockchainActions.js @@ -138,6 +138,7 @@ export const onNotification = ( }, coin: account.network, }); + if (!updatedAccount.success) return; dispatch( diff --git a/src/reducers/LocalStorageReducer.js b/src/reducers/LocalStorageReducer.js index 4c1c81bf..97e2e51c 100644 --- a/src/reducers/LocalStorageReducer.js +++ b/src/reducers/LocalStorageReducer.js @@ -14,6 +14,7 @@ type NetworkFeeLevel = { export type Network = { order: number, + isHidden: ?boolean, type: string, name: string, testnet?: boolean, diff --git a/src/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js b/src/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js index 1c041b9c..f3ee7fda 100644 --- a/src/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js +++ b/src/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js @@ -80,6 +80,7 @@ class CoinMenu extends PureComponent { return ( {config.networks + .filter(item => !item.isHidden) .sort((a, b) => a.order - b.order) .map(item => ( , selectedAccount: $ElementType, + localStorage: $ElementType, |}; type Props = {| ...OwnProps, ...StateProps |}; @@ -93,12 +94,13 @@ class TopNavigationAccount extends React.PureComponent { wrapper: ?HTMLElement; render() { + const { config } = this.props.localStorage; const { state, pathname } = this.props.router.location; if (!state) return null; - const { network, account } = this.props.selectedAccount; + const { network } = this.props.selectedAccount; if (!network) return null; - - const isAccountImported = account && account.imported; + const networkConfig = config.networks.find(c => c.shortcut === network.shortcut); + if (!networkConfig) return null; const basePath = `/device/${state.device}/network/${state.network}/account/${ state.account @@ -115,7 +117,7 @@ class TopNavigationAccount extends React.PureComponent { - {network.type === 'ethereum' && !isAccountImported && ( + {networkConfig.hasSignVerify && ( @@ -130,5 +132,7 @@ export default connect( (state: State): StateProps => ({ router: state.router, selectedAccount: state.selectedAccount, - }) + localStorage: state.localStorage, + }), + null )(TopNavigationAccount); diff --git a/src/views/Wallet/views/Account/Receive/bitcoin/Container.js b/src/views/Wallet/views/Account/Receive/bitcoin/Container.js new file mode 100644 index 00000000..0b782e1e --- /dev/null +++ b/src/views/Wallet/views/Account/Receive/bitcoin/Container.js @@ -0,0 +1,43 @@ +/* @flow */ +import { bindActionCreators } from 'redux'; +import { connect } from 'react-redux'; +import { injectIntl } from 'react-intl'; + +import { showAddress } from 'actions/ReceiveActions'; +import type { State, Dispatch } from 'flowtype'; +import Receive from './index'; + +type OwnProps = {| + intl: any, +|}; + +type StateProps = {| + selectedAccount: $ElementType, + receive: $ElementType, + modal: $ElementType, + wallet: $ElementType, +|}; + +type DispatchProps = {| + showAddress: typeof showAddress, +|}; + +export type Props = {| ...OwnProps, ...StateProps, ...DispatchProps |}; + +const mapStateToProps = (state: State): StateProps => ({ + selectedAccount: state.selectedAccount, + receive: state.receive, + modal: state.modal, + wallet: state.wallet, +}); + +const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({ + showAddress: bindActionCreators(showAddress, dispatch), +}); + +export default injectIntl( + connect( + mapStateToProps, + mapDispatchToProps + )(Receive) +); diff --git a/src/views/Wallet/views/Account/Receive/bitcoin/index.js b/src/views/Wallet/views/Account/Receive/bitcoin/index.js new file mode 100644 index 00000000..2646c8ce --- /dev/null +++ b/src/views/Wallet/views/Account/Receive/bitcoin/index.js @@ -0,0 +1,13 @@ +import React from 'react'; +import Title from 'views/Wallet/components/Title'; +import Content from 'views/Wallet/components/Content'; + +const BitcoinReceive = () => { + return ( + + Receive bitcoin + + ); +}; + +export default BitcoinReceive; diff --git a/src/views/Wallet/views/Account/Receive/index.js b/src/views/Wallet/views/Account/Receive/index.js index e3763b5b..b4d32ee0 100644 --- a/src/views/Wallet/views/Account/Receive/index.js +++ b/src/views/Wallet/views/Account/Receive/index.js @@ -3,8 +3,10 @@ import React from 'react'; import { connect } from 'react-redux'; import type { State } from 'flowtype'; + import EthereumTypeReceiveForm from './ethereum/Container'; import RippleTypeReceiveForm from './ripple/Container'; +import BitcoinTypeReceiveForm from './bitcoin/Container'; export type BaseProps = {| selectedAccount: $ElementType, @@ -25,6 +27,8 @@ export default connect( return ; case 'ripple': return ; + case 'bitcoin': + return ; default: return null; } diff --git a/src/views/Wallet/views/Account/Send/bitcoin/Container.js b/src/views/Wallet/views/Account/Send/bitcoin/Container.js new file mode 100644 index 00000000..fd7a1b1d --- /dev/null +++ b/src/views/Wallet/views/Account/Send/bitcoin/Container.js @@ -0,0 +1,49 @@ +/* @flow */ + +import { bindActionCreators } from 'redux'; +import { connect } from 'react-redux'; +import { injectIntl } from 'react-intl'; + +import SendFormActions from 'actions/ripple/SendFormActions'; +import { openQrModal } from 'actions/ModalActions'; +import type { State, Dispatch } from 'flowtype'; +import AccountSend from './index'; + +type OwnProps = {| + intl: any, +|}; + +export type StateProps = {| + selectedAccount: $ElementType, + sendForm: $ElementType, + wallet: $ElementType, + fiat: $ElementType, + localStorage: $ElementType, +|}; + +export type DispatchProps = {| + sendFormActions: typeof SendFormActions, + openQrModal: typeof openQrModal, +|}; + +export type Props = OwnProps & StateProps & DispatchProps; + +const mapStateToProps = (state: State): StateProps => ({ + selectedAccount: state.selectedAccount, + sendForm: state.sendFormRipple, + wallet: state.wallet, + fiat: state.fiat, + localStorage: state.localStorage, +}); + +const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({ + sendFormActions: bindActionCreators(SendFormActions, dispatch), + openQrModal: bindActionCreators(openQrModal, dispatch), +}); + +export default injectIntl( + connect( + mapStateToProps, + mapDispatchToProps + )(AccountSend) +); diff --git a/src/views/Wallet/views/Account/Send/bitcoin/index.js b/src/views/Wallet/views/Account/Send/bitcoin/index.js new file mode 100644 index 00000000..a724d67c --- /dev/null +++ b/src/views/Wallet/views/Account/Send/bitcoin/index.js @@ -0,0 +1,13 @@ +import React from 'react'; +import Content from 'views/Wallet/components/Content'; +import Title from 'views/Wallet/components/Title'; + +const BitcoinSend = () => { + return ( + + Send bitcoin + + ); +}; + +export default BitcoinSend; diff --git a/src/views/Wallet/views/Account/Send/index.js b/src/views/Wallet/views/Account/Send/index.js index 35dee5ad..4607d60c 100644 --- a/src/views/Wallet/views/Account/Send/index.js +++ b/src/views/Wallet/views/Account/Send/index.js @@ -5,6 +5,7 @@ import { connect } from 'react-redux'; import type { State } from 'flowtype'; import EthereumTypeSendForm from './ethereum/Container'; import RippleTypeSendForm from './ripple/Container'; +import BitcoinTypeSendForm from './bitcoin/Container'; export type BaseProps = {| selectedAccount: $ElementType, @@ -25,6 +26,8 @@ export default connect( return ; case 'ripple': return ; + case 'bitcoin': + return ; default: return null; } diff --git a/src/views/Wallet/views/Account/Summary/bitcoin/Container.js b/src/views/Wallet/views/Account/Summary/bitcoin/Container.js new file mode 100644 index 00000000..09d1840a --- /dev/null +++ b/src/views/Wallet/views/Account/Summary/bitcoin/Container.js @@ -0,0 +1,50 @@ +/* @flow */ +import { bindActionCreators } from 'redux'; +import { connect } from 'react-redux'; +import { injectIntl } from 'react-intl'; +import * as TokenActions from 'actions/TokenActions'; +import type { State, Dispatch } from 'flowtype'; +import Summary from './index'; + +type OwnProps = {| + intl: any, +|}; + +type StateProps = {| + selectedAccount: $ElementType, + summary: $ElementType, + wallet: $ElementType, + tokens: $ElementType, + fiat: $ElementType, + localStorage: $ElementType, +|}; + +type DispatchProps = {| + addToken: typeof TokenActions.add, + loadTokens: typeof TokenActions.load, + removeToken: typeof TokenActions.remove, +|}; + +export type Props = OwnProps & StateProps & DispatchProps; + +const mapStateToProps = (state: State): StateProps => ({ + selectedAccount: state.selectedAccount, + summary: state.summary, + wallet: state.wallet, + tokens: state.tokens, + fiat: state.fiat, + localStorage: state.localStorage, +}); + +const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({ + addToken: bindActionCreators(TokenActions.add, dispatch), + loadTokens: bindActionCreators(TokenActions.load, dispatch), + removeToken: bindActionCreators(TokenActions.remove, dispatch), +}); + +export default injectIntl( + connect( + mapStateToProps, + mapDispatchToProps + )(Summary) +); diff --git a/src/views/Wallet/views/Account/Summary/bitcoin/index.js b/src/views/Wallet/views/Account/Summary/bitcoin/index.js new file mode 100644 index 00000000..fc0b9e9f --- /dev/null +++ b/src/views/Wallet/views/Account/Summary/bitcoin/index.js @@ -0,0 +1,14 @@ +/* @flow */ +import React from 'react'; +import Content from 'views/Wallet/components/Content'; +import Title from 'views/Wallet/components/Title'; + +const BitcoinSummary = () => { + return ( + + Summary Bitcoin + + ); +}; + +export default BitcoinSummary; diff --git a/src/views/Wallet/views/Account/Summary/index.js b/src/views/Wallet/views/Account/Summary/index.js index 2b0cf867..4ce7357a 100644 --- a/src/views/Wallet/views/Account/Summary/index.js +++ b/src/views/Wallet/views/Account/Summary/index.js @@ -5,6 +5,7 @@ import { connect } from 'react-redux'; import type { State } from 'flowtype'; import EthereumTypeSummary from './ethereum/Container'; import RippleTypeSummary from './ripple/Container'; +import BitcoinTypeSummary from './bitcoin/Container'; type WrapperProps = {| selectedAccount: $ElementType, @@ -24,6 +25,8 @@ export default connect( return ; case 'ripple': return ; + case 'bitcoin': + return ; default: return null; } diff --git a/src/views/Wallet/views/Dashboard/index.js b/src/views/Wallet/views/Dashboard/index.js index 4d1a9579..cbc38daa 100644 --- a/src/views/Wallet/views/Dashboard/index.js +++ b/src/views/Wallet/views/Dashboard/index.js @@ -74,16 +74,18 @@ const Dashboard = (props: Props) => ( - {props.localStorage.config.networks.map(network => ( - - - - ))} + {props.localStorage.config.networks + .filter(item => !item.isHidden) + .map(network => ( + + + + ))}