mirror of
https://github.com/trezor/trezor-wallet
synced 2025-02-21 12:32:03 +00:00
Merge branch 'develop' into dependabot/npm_and_yarn/sshpk-1.16.1
This commit is contained in:
commit
13d3acfbb9
@ -13,7 +13,18 @@ cache:
|
|||||||
- node_modules
|
- node_modules
|
||||||
- ${CYPRESS_CACHE_FOLDER}
|
- ${CYPRESS_CACHE_FOLDER}
|
||||||
|
|
||||||
|
install and build:
|
||||||
|
stage: install
|
||||||
|
script:
|
||||||
|
- yarn install
|
||||||
|
artifacts:
|
||||||
|
expire_in: 2 hours
|
||||||
|
when: always
|
||||||
|
paths:
|
||||||
|
- node_modules
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- install
|
||||||
- test
|
- test
|
||||||
- build
|
- build
|
||||||
- deploy
|
- deploy
|
||||||
@ -22,25 +33,21 @@ stages:
|
|||||||
lint:
|
lint:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- yarn install
|
|
||||||
- yarn run lint
|
- yarn run lint
|
||||||
|
|
||||||
flow:
|
flow:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- yarn install
|
|
||||||
- yarn run flow
|
- yarn run flow
|
||||||
|
|
||||||
unit:
|
unit:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- yarn install
|
|
||||||
- yarn run test
|
- yarn run test
|
||||||
|
|
||||||
build development:
|
build development:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- yarn install
|
|
||||||
- yarn run build:dev
|
- yarn run build:dev
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
@ -50,7 +57,6 @@ build development:
|
|||||||
build beta:
|
build beta:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- yarn install
|
|
||||||
- yarn run build:beta
|
- yarn run build:beta
|
||||||
only:
|
only:
|
||||||
- beta
|
- beta
|
||||||
@ -63,7 +69,6 @@ build beta:
|
|||||||
build stable:
|
build stable:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- yarn install
|
|
||||||
- yarn run build:stable
|
- yarn run build:stable
|
||||||
only:
|
only:
|
||||||
- stable
|
- stable
|
||||||
@ -73,22 +78,6 @@ build stable:
|
|||||||
- build/stable
|
- build/stable
|
||||||
- scripts/s3sync.sh
|
- scripts/s3sync.sh
|
||||||
|
|
||||||
# build emulator and bridge image:
|
|
||||||
# variables:
|
|
||||||
# CONTAINER_NAME: "$CI_REGISTRY/emulator-bridge-tests"
|
|
||||||
# image: docker:latest
|
|
||||||
# services:
|
|
||||||
# - docker:dind
|
|
||||||
# before_script:
|
|
||||||
# - docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
|
|
||||||
# stage: build
|
|
||||||
# when: manual
|
|
||||||
# script:
|
|
||||||
# - docker pull $CONTAINER_NAME:latest || true
|
|
||||||
# - docker build --cache-from $CONTAINER_NAME:latest --tag $CONTAINER_NAME:$CI_COMMIT_SHA --tag $CONTAINER_NAME:latest .
|
|
||||||
# - docker push $CONTAINER_NAME:$CI_COMMIT_SHA
|
|
||||||
# - docker push $CONTAINER_NAME:latest
|
|
||||||
|
|
||||||
deploy review:
|
deploy review:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
variables:
|
variables:
|
||||||
@ -167,24 +156,3 @@ delete review:
|
|||||||
- branches
|
- branches
|
||||||
tags:
|
tags:
|
||||||
- deploy
|
- 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/
|
|
||||||
|
96
CHANGELOG.md
96
CHANGELOG.md
@ -1,35 +1,58 @@
|
|||||||
|
## 1.3.4-beta
|
||||||
|
|
||||||
|
**changed**
|
||||||
|
|
||||||
|
- Explorer for ETC changed to etc1.trezor.io
|
||||||
|
|
||||||
|
## 1.3.3-beta
|
||||||
|
|
||||||
|
**fixed**
|
||||||
|
|
||||||
|
- backend reconnection
|
||||||
|
|
||||||
## 1.3.2-beta
|
## 1.3.2-beta
|
||||||
|
|
||||||
__changed__
|
**updated**
|
||||||
- Message size for Sign&Verify, thanks to [brianddk](https://github.com/brianddk)
|
|
||||||
|
- web3 dependency
|
||||||
|
|
||||||
|
**changed**
|
||||||
|
|
||||||
- Ripple -> XRP
|
- Ripple -> XRP
|
||||||
|
|
||||||
## 1.3.1-beta
|
## 1.3.1-beta
|
||||||
|
|
||||||
__fixed__
|
**fixed**
|
||||||
|
|
||||||
- download bridge url
|
- download bridge url
|
||||||
|
|
||||||
## 1.3.0-beta
|
## 1.3.0-beta
|
||||||
__added__
|
|
||||||
|
**added**
|
||||||
|
|
||||||
- Coin visibility settings
|
- Coin visibility settings
|
||||||
- Almost complete russian, ukrainian and spanish localization
|
- Almost complete russian, ukrainian and spanish localization
|
||||||
- Auto reconnect to a backend after losing connection
|
- Auto reconnect to a backend after losing connection
|
||||||
|
|
||||||
__changed__
|
**changed**
|
||||||
|
|
||||||
- static (without animation) active tab indicator
|
- static (without animation) active tab indicator
|
||||||
- input validation - mandatory leading 0 for float numbers
|
- input validation - mandatory leading 0 for float numbers
|
||||||
- regexps refactored to functions, added unit tests
|
- regexps refactored to functions, added unit tests
|
||||||
- limit passphrase length to 50 bytes
|
- limit passphrase length to 50 bytes
|
||||||
- upgrade react-router and connected-react-router
|
- upgrade react-router and connected-react-router
|
||||||
|
|
||||||
__fixed__
|
**fixed**
|
||||||
|
|
||||||
- xrp accounts not updating in case of remembered device
|
- xrp accounts not updating in case of remembered device
|
||||||
- rounding in calculating total balance in local currency
|
- rounding in calculating total balance in local currency
|
||||||
- react hot loader
|
- react hot loader
|
||||||
- minor l10n fixes
|
- minor l10n fixes
|
||||||
|
|
||||||
## 1.2.0-beta
|
## 1.2.0-beta
|
||||||
__added__
|
|
||||||
|
**added**
|
||||||
|
|
||||||
- Localization
|
- Localization
|
||||||
- Ability to hide balances
|
- Ability to hide balances
|
||||||
- Fiat currency switcher
|
- Fiat currency switcher
|
||||||
@ -38,10 +61,12 @@ __added__
|
|||||||
- Import tool (for support)
|
- Import tool (for support)
|
||||||
- Prettier
|
- Prettier
|
||||||
|
|
||||||
__updated__
|
**updated**
|
||||||
|
|
||||||
- flow-bin 0.9.0
|
- flow-bin 0.9.0
|
||||||
|
|
||||||
__changed__
|
**changed**
|
||||||
|
|
||||||
- Ripple explorer to xrpscan
|
- Ripple explorer to xrpscan
|
||||||
- Coins sorted by market cap
|
- Coins sorted by market cap
|
||||||
- Link to "Bitcoin wallet" opens in the same tab
|
- Link to "Bitcoin wallet" opens in the same tab
|
||||||
@ -49,10 +74,12 @@ __changed__
|
|||||||
- Limit max number of accounts to 10
|
- Limit max number of accounts to 10
|
||||||
- Debounced validation in send forms
|
- Debounced validation in send forms
|
||||||
|
|
||||||
__removed__
|
**removed**
|
||||||
|
|
||||||
- Text "you will be redirected" from coins menu
|
- Text "you will be redirected" from coins menu
|
||||||
|
|
||||||
__fixed__
|
**fixed**
|
||||||
|
|
||||||
- Arrow animation in Send tab
|
- Arrow animation in Send tab
|
||||||
- Sign and Verify columns size
|
- Sign and Verify columns size
|
||||||
- Sign and Verify validation for disabling submit buttons
|
- Sign and Verify validation for disabling submit buttons
|
||||||
@ -65,77 +92,94 @@ __fixed__
|
|||||||
- Ripple destination tag validation
|
- Ripple destination tag validation
|
||||||
|
|
||||||
## 1.1.1-beta
|
## 1.1.1-beta
|
||||||
__added__
|
|
||||||
|
**added**
|
||||||
|
|
||||||
- Ripple destination tag option
|
- Ripple destination tag option
|
||||||
- Tezos external wallet
|
- Tezos external wallet
|
||||||
|
|
||||||
## 1.1.0-beta
|
## 1.1.0-beta
|
||||||
__added__
|
|
||||||
|
**added**
|
||||||
|
|
||||||
- Ripple support
|
- Ripple support
|
||||||
- responsive sidebar
|
- responsive sidebar
|
||||||
- QR code scanner in send form
|
- QR code scanner in send form
|
||||||
- clear send form button
|
- clear send form button
|
||||||
- backup notification modal
|
- backup notification modal
|
||||||
|
|
||||||
__updated__
|
**updated**
|
||||||
|
|
||||||
- connect v7
|
- connect v7
|
||||||
- babel v7
|
- babel v7
|
||||||
- ethereum tokens list
|
- ethereum tokens list
|
||||||
- most of dependencies
|
- most of dependencies
|
||||||
|
|
||||||
__changed__
|
**changed**
|
||||||
|
|
||||||
- icons for T1 and TT
|
- icons for T1 and TT
|
||||||
- device header styles
|
- device header styles
|
||||||
- input styles
|
- input styles
|
||||||
- sign and verify title
|
- sign and verify title
|
||||||
|
|
||||||
__fixed__
|
**fixed**
|
||||||
|
|
||||||
- beta disclaimer wrapper position
|
- beta disclaimer wrapper position
|
||||||
- sidebar scrollbar
|
- sidebar scrollbar
|
||||||
|
|
||||||
## 1.0.3-beta
|
## 1.0.3-beta
|
||||||
__added__
|
|
||||||
|
**added**
|
||||||
|
|
||||||
- Ethereum: sign & verify tab
|
- Ethereum: sign & verify tab
|
||||||
- Stellar and Cardano external wallets
|
- Stellar and Cardano external wallets
|
||||||
- UI: modal background fade in/ fade out
|
- UI: modal background fade in/ fade out
|
||||||
- UI: fonts refactoring
|
- UI: fonts refactoring
|
||||||
- Experimental Ripple support (disabled by default)
|
- Experimental Ripple support (disabled by default)
|
||||||
|
|
||||||
__changed__
|
**changed**
|
||||||
|
|
||||||
- Split code to coin specific types for components, actions and reducers (ripple/ethereum/...)
|
- Split code to coin specific types for components, actions and reducers (ripple/ethereum/...)
|
||||||
- Update
|
- Update
|
||||||
- Use TrezorConnect to communicate with trezor-blockchain-link
|
- Use TrezorConnect to communicate with trezor-blockchain-link
|
||||||
|
|
||||||
__fixed__
|
**fixed**
|
||||||
|
|
||||||
- validation of token existence in send tx draft (https://github.com/trezor/trezor-wallet/pull/252)
|
- validation of token existence in send tx draft (https://github.com/trezor/trezor-wallet/pull/252)
|
||||||
|
|
||||||
## 1.0.2-beta
|
## 1.0.2-beta
|
||||||
__changed__
|
|
||||||
|
**changed**
|
||||||
|
|
||||||
- Fiat rates from coingecko (https://github.com/trezor/trezor-wallet/pull/242)
|
- Fiat rates from coingecko (https://github.com/trezor/trezor-wallet/pull/242)
|
||||||
- firmware update link to beta-wallet (https://github.com/trezor/trezor-wallet/commit/b9b7d2d076f2d4c59ae2e055dc140cda6aaa5512)
|
- firmware update link to beta-wallet (https://github.com/trezor/trezor-wallet/commit/b9b7d2d076f2d4c59ae2e055dc140cda6aaa5512)
|
||||||
- update list of ETH and ETC tokens
|
- update list of ETH and ETC tokens
|
||||||
|
|
||||||
__added__
|
**added**
|
||||||
|
|
||||||
- set default gas limit button (https://github.com/trezor/trezor-wallet/issues/184)
|
- set default gas limit button (https://github.com/trezor/trezor-wallet/issues/184)
|
||||||
- added 1 click to select value in input (https://github.com/trezor/trezor-wallet/issues/251)
|
- added 1 click to select value in input (https://github.com/trezor/trezor-wallet/issues/251)
|
||||||
- added account loader (https://github.com/trezor/trezor-wallet/pull/225)
|
- added account loader (https://github.com/trezor/trezor-wallet/pull/225)
|
||||||
- added message how to add ERC20 tokens (https://github.com/trezor/trezor-wallet/issues/238)
|
- added message how to add ERC20 tokens (https://github.com/trezor/trezor-wallet/issues/238)
|
||||||
|
|
||||||
__fixed__
|
**fixed**
|
||||||
|
|
||||||
- validation of token existence in send tx draft (https://github.com/trezor/trezor-wallet/pull/252)
|
- validation of token existence in send tx draft (https://github.com/trezor/trezor-wallet/pull/252)
|
||||||
|
|
||||||
|
|
||||||
## 1.0.1-beta
|
## 1.0.1-beta
|
||||||
__added__
|
|
||||||
|
**added**
|
||||||
|
|
||||||
- DigiByte in coin menu
|
- DigiByte in coin menu
|
||||||
- blocking device with seedless setup
|
- blocking device with seedless setup
|
||||||
|
|
||||||
__fixed__
|
**fixed**
|
||||||
|
|
||||||
- token input in "Account/Summary" (https://github.com/trezor/trezor-wallet/issues/235)
|
- token input in "Account/Summary" (https://github.com/trezor/trezor-wallet/issues/235)
|
||||||
- "Go to your standard wallet" button in passphrase modal (https://github.com/trezor/trezor-wallet/issues/222)
|
- "Go to your standard wallet" button in passphrase modal (https://github.com/trezor/trezor-wallet/issues/222)
|
||||||
- Double click on "show passphrase" (https://github.com/trezor/trezor-wallet/issues/221)
|
- Double click on "show passphrase" (https://github.com/trezor/trezor-wallet/issues/221)
|
||||||
- images preloader for offline status (https://github.com/trezor/trezor-wallet/issues/218)
|
- images preloader for offline status (https://github.com/trezor/trezor-wallet/issues/218)
|
||||||
|
|
||||||
|
|
||||||
## 1.0.0-beta
|
## 1.0.0-beta
|
||||||
|
|
||||||
- first release
|
- first release
|
||||||
|
16
package.json
16
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "trezor-wallet",
|
"name": "trezor-wallet",
|
||||||
"version": "1.3.2-beta",
|
"version": "1.3.3-beta",
|
||||||
"author": "TREZOR <info@trezor.io>",
|
"author": "TREZOR <info@trezor.io>",
|
||||||
"description": "",
|
"description": "",
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -57,8 +57,8 @@
|
|||||||
"raf": "^3.4.1",
|
"raf": "^3.4.1",
|
||||||
"raven-js": "^3.27.0",
|
"raven-js": "^3.27.0",
|
||||||
"rc-tooltip": "^3.7.3",
|
"rc-tooltip": "^3.7.3",
|
||||||
"react": "16.8.6",
|
"react": "16.9.0",
|
||||||
"react-dom": "16.8.6",
|
"react-dom": "16.9.0",
|
||||||
"react-hot-loader": "^4.8.4",
|
"react-hot-loader": "^4.8.4",
|
||||||
"react-intl": "^2.8.0",
|
"react-intl": "^2.8.0",
|
||||||
"react-json-view": "^1.19.1",
|
"react-json-view": "^1.19.1",
|
||||||
@ -84,7 +84,7 @@
|
|||||||
"trezor-connect": "7.0.2",
|
"trezor-connect": "7.0.2",
|
||||||
"trezor-ui-components": "^1.0.0-beta.20",
|
"trezor-ui-components": "^1.0.0-beta.20",
|
||||||
"wallet-address-validator": "^0.2.4",
|
"wallet-address-validator": "^0.2.4",
|
||||||
"web3": "1.0.0-beta.35",
|
"web3": "1.0.0-beta.36",
|
||||||
"webpack": "^4.29.3",
|
"webpack": "^4.29.3",
|
||||||
"webpack-build-notifier": "^0.1.30",
|
"webpack-build-notifier": "^0.1.30",
|
||||||
"webpack-bundle-analyzer": "^3.3.2",
|
"webpack-bundle-analyzer": "^3.3.2",
|
||||||
@ -110,7 +110,7 @@
|
|||||||
"babel-plugin-styled-components": "^1.10.0",
|
"babel-plugin-styled-components": "^1.10.0",
|
||||||
"cypress": "^3.1.5",
|
"cypress": "^3.1.5",
|
||||||
"cypress-image-snapshot": "^3.0.0",
|
"cypress-image-snapshot": "^3.0.0",
|
||||||
"eslint": "^5.13.0",
|
"eslint": "^5.16.0",
|
||||||
"eslint-config-airbnb": "^17.1.0",
|
"eslint-config-airbnb": "^17.1.0",
|
||||||
"eslint-config-prettier": "^4.0.0",
|
"eslint-config-prettier": "^4.0.0",
|
||||||
"eslint-import-resolver-babel-module": "^5.0.1",
|
"eslint-import-resolver-babel-module": "^5.0.1",
|
||||||
@ -125,11 +125,11 @@
|
|||||||
"eslint-plugin-react": "^7.12.4",
|
"eslint-plugin-react": "^7.12.4",
|
||||||
"file-loader": "3.0.1",
|
"file-loader": "3.0.1",
|
||||||
"flow-bin": "0.90",
|
"flow-bin": "0.90",
|
||||||
"jest": "^24.1.0",
|
"jest": "^24.9.0",
|
||||||
"prettier": "^1.16.4",
|
"prettier": "^1.16.4",
|
||||||
"prettier-eslint": "^8.8.2",
|
"prettier-eslint": "^9.0.0",
|
||||||
"prettylint": "^1.0.0",
|
"prettylint": "^1.0.0",
|
||||||
"stylelint": "^9.10.1",
|
"stylelint": "^10.0.0",
|
||||||
"stylelint-config-standard": "^18.2.0",
|
"stylelint-config-standard": "^18.2.0",
|
||||||
"stylelint-config-styled-components": "^0.1.1",
|
"stylelint-config-styled-components": "^0.1.1",
|
||||||
"stylelint-custom-processor-loader": "^0.6.0",
|
"stylelint-custom-processor-loader": "^0.6.0",
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
"wss://etc2.trezor.io/geth"
|
"wss://etc2.trezor.io/geth"
|
||||||
],
|
],
|
||||||
"explorer": {
|
"explorer": {
|
||||||
"tx": "https://gastracker.io/tx/",
|
"tx": "https://etc1.trezor.io/tx/",
|
||||||
"address": "https://gastracker.io/addr/"
|
"address": "https://etc1.trezor.io/address/"
|
||||||
},
|
},
|
||||||
"hasSignVerify": true
|
"hasSignVerify": true
|
||||||
},
|
},
|
||||||
@ -128,8 +128,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"explorer": {
|
"explorer": {
|
||||||
"tx": "https://sisyfos.trezor.io/ripple-testnet-explorer/tx/",
|
"tx": "https://test.bithomp.com/explorer/",
|
||||||
"address": "https://sisyfos.trezor.io/ripple-testnet-explorer/address/"
|
"address": "https://test.bithomp.com/explorer/"
|
||||||
},
|
},
|
||||||
"hasSignVerify": false
|
"hasSignVerify": false
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
|
|
||||||
import * as BLOCKCHAIN from 'actions/constants/blockchain';
|
import * as BLOCKCHAIN from 'actions/constants/blockchain';
|
||||||
import * as DiscoveryActions from 'actions/DiscoveryActions';
|
|
||||||
import * as EthereumBlockchainActions from 'actions/ethereum/BlockchainActions';
|
import * as EthereumBlockchainActions from 'actions/ethereum/BlockchainActions';
|
||||||
import * as RippleBlockchainActions from 'actions/ripple/BlockchainActions';
|
import * as RippleBlockchainActions from 'actions/ripple/BlockchainActions';
|
||||||
|
import { resolveAfter } from 'utils/promiseUtils';
|
||||||
|
|
||||||
import type { Dispatch, GetState, PromiseAction, BlockchainFeeLevel } from 'flowtype';
|
import type { Dispatch, GetState, PromiseAction, BlockchainFeeLevel } from 'flowtype';
|
||||||
import type { BlockchainBlock, BlockchainNotification, BlockchainError } from 'trezor-connect';
|
import type { BlockchainBlock, BlockchainNotification, BlockchainError } from 'trezor-connect';
|
||||||
@ -20,10 +20,6 @@ export type BlockchainAction =
|
|||||||
| {
|
| {
|
||||||
type: typeof BLOCKCHAIN.START_SUBSCRIBE,
|
type: typeof BLOCKCHAIN.START_SUBSCRIBE,
|
||||||
shortcut: string,
|
shortcut: string,
|
||||||
}
|
|
||||||
| {
|
|
||||||
type: typeof BLOCKCHAIN.FAIL_SUBSCRIBE,
|
|
||||||
shortcut: string,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Conditionally subscribe to blockchain backend
|
// Conditionally subscribe to blockchain backend
|
||||||
@ -153,23 +149,13 @@ const autoReconnect = (shortcut: string): PromiseAction<void> => async (
|
|||||||
dispatch: Dispatch,
|
dispatch: Dispatch,
|
||||||
getState: GetState
|
getState: GetState
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
const MAX_ATTEMPTS = 4;
|
|
||||||
let blockchain = getState().blockchain.find(b => b.shortcut === shortcut);
|
let blockchain = getState().blockchain.find(b => b.shortcut === shortcut);
|
||||||
// try to automatically reconnect and wait after each attemp (5s * #attempt) untill max number of attemps is reached
|
if (!blockchain || blockchain.reconnectionAttempts >= 5) return;
|
||||||
for (let i = 0; i < MAX_ATTEMPTS; i++) {
|
|
||||||
const waitTime = 5000 * (i + 1); /// 5s * #attempt
|
await resolveAfter(5000 * (blockchain.reconnectionAttempts + 1));
|
||||||
if (!blockchain || blockchain.connected) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
blockchain = getState().blockchain.find(b => b.shortcut === shortcut);
|
blockchain = getState().blockchain.find(b => b.shortcut === shortcut);
|
||||||
|
if (!blockchain || blockchain.connected || blockchain.connecting) return;
|
||||||
|
|
||||||
// reconnect with 7s timeout
|
await dispatch(subscribe(shortcut));
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
await dispatch(DiscoveryActions.reconnect(shortcut, 7000));
|
|
||||||
|
|
||||||
// wait before next try
|
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
await new Promise(resolve => setTimeout(resolve, waitTime));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import TrezorConnect, { UI } from 'trezor-connect';
|
import TrezorConnect, { UI } from 'trezor-connect';
|
||||||
import * as BLOCKCHAIN_ACTION from 'actions/constants/blockchain';
|
|
||||||
import * as DISCOVERY from 'actions/constants/discovery';
|
import * as DISCOVERY from 'actions/constants/discovery';
|
||||||
import * as ACCOUNT from 'actions/constants/account';
|
import * as ACCOUNT from 'actions/constants/account';
|
||||||
import * as NOTIFICATION from 'actions/constants/notification';
|
import * as NOTIFICATION from 'actions/constants/notification';
|
||||||
@ -10,7 +9,6 @@ import * as NOTIFICATION from 'actions/constants/notification';
|
|||||||
import type {
|
import type {
|
||||||
ThunkAction,
|
ThunkAction,
|
||||||
AsyncAction,
|
AsyncAction,
|
||||||
PromiseAction,
|
|
||||||
PayloadAction,
|
PayloadAction,
|
||||||
GetState,
|
GetState,
|
||||||
Dispatch,
|
Dispatch,
|
||||||
@ -331,30 +329,7 @@ const finish = (device: TrezorDevice, discoveryProcess: Discovery): AsyncAction
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const reconnect = (network: string, timeout: number = 30): PromiseAction<void> => async (
|
// Called after DEVICE.CONNECT ('trezor-connect') or CONNECT.AUTH_DEVICE or BLOCKCHAIN.CONNECT actions in WalletService
|
||||||
dispatch: Dispatch
|
|
||||||
): Promise<void> => {
|
|
||||||
// Runs two promises.
|
|
||||||
// First promise is a subscribe action which will never resolve in case of completely lost connection to the backend
|
|
||||||
// That's why there is a second promise that rejects after the specified timeout.
|
|
||||||
return Promise.race([
|
|
||||||
dispatch(BlockchainActions.subscribe(network)),
|
|
||||||
new Promise((_, reject) => setTimeout(() => reject(new Error('timeout')), timeout)),
|
|
||||||
])
|
|
||||||
.catch(() => {
|
|
||||||
// catch error from first promises that rejects (most likely timeout)
|
|
||||||
dispatch({
|
|
||||||
type: BLOCKCHAIN_ACTION.FAIL_SUBSCRIBE,
|
|
||||||
shortcut: network,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
// dispatch restore when subscribe promise resolves
|
|
||||||
dispatch(restore());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Called after DEVICE.CONNECT ('trezor-connect') or CONNECT.AUTH_DEVICE actions in WalletService
|
|
||||||
// OR after BlockchainSubscribe in this.reconnect
|
// OR after BlockchainSubscribe in this.reconnect
|
||||||
export const restore = (): ThunkAction => (dispatch: Dispatch, getState: GetState): void => {
|
export const restore = (): ThunkAction => (dispatch: Dispatch, getState: GetState): void => {
|
||||||
// check if current url has "network" parameter
|
// check if current url has "network" parameter
|
||||||
|
@ -160,7 +160,9 @@ export const init = (): AsyncAction => async (
|
|||||||
if (buildUtils.isDev()) {
|
if (buildUtils.isDev()) {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
window.__TREZOR_CONNECT_SRC =
|
window.__TREZOR_CONNECT_SRC =
|
||||||
typeof LOCAL === 'string' ? LOCAL : 'https://sisyfos.sldev.cz/connect/'; // eslint-disable-line no-underscore-dangle
|
typeof LOCAL === 'string'
|
||||||
|
? LOCAL
|
||||||
|
: 'https://connect.corp.sldev.cz/fix/v7-ripple-lib-error/'; // eslint-disable-line no-underscore-dangle
|
||||||
// window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://localhost:8088/'; // eslint-disable-line no-underscore-dangle
|
// window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://localhost:8088/'; // eslint-disable-line no-underscore-dangle
|
||||||
window.TrezorConnect = TrezorConnect;
|
window.TrezorConnect = TrezorConnect;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
|
|
||||||
export const START_SUBSCRIBE: 'blockchain__start_subscribe' = 'blockchain__start_subscribe';
|
export const START_SUBSCRIBE: 'blockchain__start_subscribe' = 'blockchain__start_subscribe';
|
||||||
export const FAIL_SUBSCRIBE: 'blockchain__fail_subscribe' = 'blockchain__fail_subscribe';
|
|
||||||
export const READY: 'blockchain__ready' = 'blockchain__ready';
|
export const READY: 'blockchain__ready' = 'blockchain__ready';
|
||||||
export const UPDATE_FEE: 'blockchain__update_fee' = 'blockchain__update_fee';
|
export const UPDATE_FEE: 'blockchain__update_fee' = 'blockchain__update_fee';
|
||||||
|
@ -161,31 +161,47 @@ export const onNotification = (
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const updatedAccount = await TrezorConnect.rippleGetAccountInfo({
|
// In case of tx sent between two Trezor accounts there is a possibility that only 1 notification will be received
|
||||||
|
// therefore we need to find target account and update data for it as well
|
||||||
|
const accountsToUpdate = [account];
|
||||||
|
const targetAddress =
|
||||||
|
notification.type === 'send'
|
||||||
|
? notification.outputs[0].addresses[0]
|
||||||
|
: notification.inputs[0].addresses[0];
|
||||||
|
|
||||||
|
const targetAccount = getState().accounts.find(a => a.descriptor === targetAddress);
|
||||||
|
if (targetAccount) {
|
||||||
|
accountsToUpdate.push(targetAccount);
|
||||||
|
}
|
||||||
|
|
||||||
|
accountsToUpdate.forEach(async a => {
|
||||||
|
const response = await TrezorConnect.rippleGetAccountInfo({
|
||||||
account: {
|
account: {
|
||||||
descriptor: account.descriptor,
|
descriptor: a.descriptor,
|
||||||
from: account.block,
|
from: a.block,
|
||||||
history: false,
|
history: false,
|
||||||
},
|
},
|
||||||
coin: account.network,
|
coin: a.network,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!updatedAccount.success) return;
|
if (response.success) {
|
||||||
|
const updatedAccount = response.payload;
|
||||||
const empty = updatedAccount.payload.sequence <= 0 && updatedAccount.payload.balance === '0';
|
const empty = updatedAccount.sequence <= 0 && updatedAccount.balance === '0';
|
||||||
dispatch(
|
dispatch(
|
||||||
AccountsActions.update({
|
AccountsActions.update({
|
||||||
networkType: 'ripple',
|
networkType: 'ripple',
|
||||||
...account,
|
...a,
|
||||||
balance: toDecimalAmount(updatedAccount.payload.balance, network.decimals),
|
balance: toDecimalAmount(updatedAccount.balance, network.decimals),
|
||||||
availableBalance: toDecimalAmount(
|
availableBalance: toDecimalAmount(
|
||||||
updatedAccount.payload.availableBalance,
|
updatedAccount.availableBalance,
|
||||||
network.decimals
|
network.decimals
|
||||||
),
|
),
|
||||||
block: updatedAccount.payload.block,
|
block: updatedAccount.block,
|
||||||
sequence: updatedAccount.payload.sequence,
|
sequence: updatedAccount.sequence,
|
||||||
reserve: '0',
|
reserve: toDecimalAmount(updatedAccount.reserve, network.decimals),
|
||||||
empty,
|
empty,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
@ -14,17 +14,21 @@ export default (props: Props) => {
|
|||||||
if (notification.type === 'backend') {
|
if (notification.type === 'backend') {
|
||||||
// special case: backend is down
|
// special case: backend is down
|
||||||
// TODO: this is a different component with "auto resolve" button
|
// TODO: this is a different component with "auto resolve" button
|
||||||
|
const inProgress = blockchain && blockchain.connecting;
|
||||||
|
const status = inProgress
|
||||||
|
? l10nMessages.TR_RECONNECTING
|
||||||
|
: l10nMessages.TR_CONNECT_TO_BACKEND;
|
||||||
return (
|
return (
|
||||||
<Notification
|
<Notification
|
||||||
variant="error"
|
variant="error"
|
||||||
title={notification.title}
|
title={notification.title}
|
||||||
message={notification.message}
|
message={notification.message}
|
||||||
isActionInProgress={blockchain && blockchain.connecting}
|
isActionInProgress={inProgress}
|
||||||
actions={[
|
actions={[
|
||||||
{
|
{
|
||||||
label: props.intl.formatMessage(l10nMessages.TR_CONNECT_TO_BACKEND),
|
label: props.intl.formatMessage(status),
|
||||||
callback: async () => {
|
callback: async () => {
|
||||||
await props.blockchainReconnect(network.shortcut);
|
if (!inProgress) props.blockchainReconnect(network.shortcut);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
@ -7,6 +7,10 @@ const definedMessages: Messages = defineMessages({
|
|||||||
id: 'TR_CONNECT_TO_BACKEND',
|
id: 'TR_CONNECT_TO_BACKEND',
|
||||||
defaultMessage: 'Connect',
|
defaultMessage: 'Connect',
|
||||||
},
|
},
|
||||||
|
TR_RECONNECTING: {
|
||||||
|
id: 'TR_RECONNECTING',
|
||||||
|
defaultMessage: 'Reconnecting...',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default definedMessages;
|
export default definedMessages;
|
||||||
|
@ -7,7 +7,7 @@ import type { IntlShape } from 'react-intl';
|
|||||||
|
|
||||||
import type { State, Dispatch } from 'flowtype';
|
import type { State, Dispatch } from 'flowtype';
|
||||||
|
|
||||||
import { reconnect } from 'actions/DiscoveryActions';
|
import { subscribe } from 'actions/BlockchainActions';
|
||||||
import * as NotificationActions from 'actions/NotificationActions';
|
import * as NotificationActions from 'actions/NotificationActions';
|
||||||
|
|
||||||
import StaticNotifications from './components/Static';
|
import StaticNotifications from './components/Static';
|
||||||
@ -29,7 +29,7 @@ export type StateProps = {|
|
|||||||
|
|
||||||
export type DispatchProps = {|
|
export type DispatchProps = {|
|
||||||
close: typeof NotificationActions.close,
|
close: typeof NotificationActions.close,
|
||||||
blockchainReconnect: typeof reconnect,
|
blockchainReconnect: typeof subscribe,
|
||||||
|};
|
|};
|
||||||
|
|
||||||
export type Props = {| ...OwnProps, ...StateProps, ...DispatchProps |};
|
export type Props = {| ...OwnProps, ...StateProps, ...DispatchProps |};
|
||||||
@ -52,7 +52,7 @@ const mapStateToProps = (state: State): StateProps => ({
|
|||||||
|
|
||||||
const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({
|
const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({
|
||||||
close: bindActionCreators(NotificationActions.close, dispatch),
|
close: bindActionCreators(NotificationActions.close, dispatch),
|
||||||
blockchainReconnect: bindActionCreators(reconnect, dispatch),
|
blockchainReconnect: bindActionCreators(subscribe, dispatch),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default injectIntl<OwnProps>(
|
export default injectIntl<OwnProps>(
|
||||||
|
@ -17,6 +17,7 @@ export type BlockchainNetwork = {
|
|||||||
feeLevels: Array<BlockchainFeeLevel>,
|
feeLevels: Array<BlockchainFeeLevel>,
|
||||||
connected: boolean,
|
connected: boolean,
|
||||||
connecting: boolean,
|
connecting: boolean,
|
||||||
|
reconnectionAttempts: number,
|
||||||
block: number,
|
block: number,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -41,30 +42,7 @@ const onStartSubscribe = (state: State, shortcut: string): State => {
|
|||||||
shortcut,
|
shortcut,
|
||||||
connected: false,
|
connected: false,
|
||||||
connecting: true,
|
connecting: true,
|
||||||
block: 0,
|
reconnectionAttempts: 0,
|
||||||
feeTimestamp: 0,
|
|
||||||
feeLevels: [],
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onFailSubscribe = (state: State, shortcut: string): State => {
|
|
||||||
const network = state.find(b => b.shortcut === shortcut);
|
|
||||||
if (network) {
|
|
||||||
const others = state.filter(b => b !== network);
|
|
||||||
return others.concat([
|
|
||||||
{
|
|
||||||
...network,
|
|
||||||
connecting: false,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return state.concat([
|
|
||||||
{
|
|
||||||
shortcut,
|
|
||||||
connected: false,
|
|
||||||
connecting: false,
|
|
||||||
block: 0,
|
block: 0,
|
||||||
feeTimestamp: 0,
|
feeTimestamp: 0,
|
||||||
feeLevels: [],
|
feeLevels: [],
|
||||||
@ -84,6 +62,7 @@ const onConnect = (state: State, action: BlockchainConnect): State => {
|
|||||||
block: info.block,
|
block: info.block,
|
||||||
connected: true,
|
connected: true,
|
||||||
connecting: false,
|
connecting: false,
|
||||||
|
reconnectionAttempts: 0,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -93,6 +72,7 @@ const onConnect = (state: State, action: BlockchainConnect): State => {
|
|||||||
shortcut,
|
shortcut,
|
||||||
connected: true,
|
connected: true,
|
||||||
connecting: false,
|
connecting: false,
|
||||||
|
reconnectionAttempts: 0,
|
||||||
block: info.block,
|
block: info.block,
|
||||||
feeTimestamp: 0,
|
feeTimestamp: 0,
|
||||||
feeLevels: [],
|
feeLevels: [],
|
||||||
@ -110,6 +90,7 @@ const onError = (state: State, action: BlockchainError): State => {
|
|||||||
...network,
|
...network,
|
||||||
connected: false,
|
connected: false,
|
||||||
connecting: false,
|
connecting: false,
|
||||||
|
reconnectionAttempts: network.reconnectionAttempts + 1,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -119,6 +100,7 @@ const onError = (state: State, action: BlockchainError): State => {
|
|||||||
shortcut,
|
shortcut,
|
||||||
connected: false,
|
connected: false,
|
||||||
connecting: false,
|
connecting: false,
|
||||||
|
reconnectionAttempts: 0,
|
||||||
block: 0,
|
block: 0,
|
||||||
feeTimestamp: 0,
|
feeTimestamp: 0,
|
||||||
feeLevels: [],
|
feeLevels: [],
|
||||||
@ -160,8 +142,6 @@ export default (state: State = initialState, action: Action): State => {
|
|||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case BLOCKCHAIN_ACTION.START_SUBSCRIBE:
|
case BLOCKCHAIN_ACTION.START_SUBSCRIBE:
|
||||||
return onStartSubscribe(state, action.shortcut);
|
return onStartSubscribe(state, action.shortcut);
|
||||||
case BLOCKCHAIN_ACTION.FAIL_SUBSCRIBE:
|
|
||||||
return onFailSubscribe(state, action.shortcut);
|
|
||||||
case BLOCKCHAIN_EVENT.CONNECT:
|
case BLOCKCHAIN_EVENT.CONNECT:
|
||||||
return onConnect(state, action);
|
return onConnect(state, action);
|
||||||
case BLOCKCHAIN_EVENT.ERROR:
|
case BLOCKCHAIN_EVENT.ERROR:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
import { DEVICE } from 'trezor-connect';
|
import { DEVICE, BLOCKCHAIN } from 'trezor-connect';
|
||||||
import { LOCATION_CHANGE } from 'connected-react-router';
|
import { LOCATION_CHANGE } from 'connected-react-router';
|
||||||
import * as WALLET from 'actions/constants/wallet';
|
import * as WALLET from 'actions/constants/wallet';
|
||||||
import * as CONNECT from 'actions/constants/TrezorConnect';
|
import * as CONNECT from 'actions/constants/TrezorConnect';
|
||||||
@ -132,6 +132,12 @@ const WalletService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
|||||||
api.dispatch(DiscoveryActions.stop());
|
api.dispatch(DiscoveryActions.stop());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try to restore discovery on BLOCKCHAIN.CONNECT event
|
||||||
|
// edge case when backend throws error during discovery
|
||||||
|
if (action.type === BLOCKCHAIN.CONNECT) {
|
||||||
|
api.dispatch(DiscoveryActions.restore());
|
||||||
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -489,14 +489,13 @@ const AccountSend = (props: Props) => {
|
|||||||
</AdvancedForm>
|
</AdvancedForm>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{props.selectedAccount.pending.length > 0 ||
|
{props.selectedAccount.pending.length > 0 && (
|
||||||
(account.imported && (
|
|
||||||
<PendingTransactions
|
<PendingTransactions
|
||||||
pending={props.selectedAccount.pending}
|
pending={props.selectedAccount.pending}
|
||||||
tokens={props.selectedAccount.tokens}
|
tokens={props.selectedAccount.tokens}
|
||||||
network={network}
|
network={network}
|
||||||
/>
|
/>
|
||||||
))}
|
)}
|
||||||
</Content>
|
</Content>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -119,7 +119,7 @@ class SignVerify extends Component<Props> {
|
|||||||
onChange={this.handleInputChange}
|
onChange={this.handleInputChange}
|
||||||
rows={4}
|
rows={4}
|
||||||
maxRows={4}
|
maxRows={4}
|
||||||
maxLength={1024}
|
maxLength={255}
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
@ -172,7 +172,7 @@ class SignVerify extends Component<Props> {
|
|||||||
onChange={this.handleInputChange}
|
onChange={this.handleInputChange}
|
||||||
rows={4}
|
rows={4}
|
||||||
maxRows={4}
|
maxRows={4}
|
||||||
maxLength={1024}
|
maxLength={255}
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
|
Loading…
Reference in New Issue
Block a user