mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-14 04:19:09 +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
|
||||
- ${CYPRESS_CACHE_FOLDER}
|
||||
|
||||
install and build:
|
||||
stage: install
|
||||
script:
|
||||
- yarn install
|
||||
artifacts:
|
||||
expire_in: 2 hours
|
||||
when: always
|
||||
paths:
|
||||
- node_modules
|
||||
|
||||
stages:
|
||||
- install
|
||||
- test
|
||||
- build
|
||||
- deploy
|
||||
@ -22,25 +33,21 @@ stages:
|
||||
lint:
|
||||
stage: test
|
||||
script:
|
||||
- yarn install
|
||||
- yarn run lint
|
||||
|
||||
flow:
|
||||
stage: test
|
||||
script:
|
||||
- yarn install
|
||||
- yarn run flow
|
||||
|
||||
unit:
|
||||
stage: test
|
||||
script:
|
||||
- yarn install
|
||||
- yarn run test
|
||||
|
||||
build development:
|
||||
stage: build
|
||||
script:
|
||||
- yarn install
|
||||
- yarn run build:dev
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
@ -50,7 +57,6 @@ build development:
|
||||
build beta:
|
||||
stage: build
|
||||
script:
|
||||
- yarn install
|
||||
- yarn run build:beta
|
||||
only:
|
||||
- beta
|
||||
@ -63,7 +69,6 @@ build beta:
|
||||
build stable:
|
||||
stage: build
|
||||
script:
|
||||
- yarn install
|
||||
- yarn run build:stable
|
||||
only:
|
||||
- stable
|
||||
@ -73,22 +78,6 @@ build stable:
|
||||
- build/stable
|
||||
- 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:
|
||||
stage: deploy
|
||||
variables:
|
||||
@ -166,25 +155,4 @@ delete review:
|
||||
only:
|
||||
- branches
|
||||
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/
|
||||
- deploy
|
252
CHANGELOG.md
252
CHANGELOG.md
@ -1,141 +1,185 @@
|
||||
## 1.3.4-beta
|
||||
|
||||
**changed**
|
||||
|
||||
- Explorer for ETC changed to etc1.trezor.io
|
||||
|
||||
## 1.3.3-beta
|
||||
|
||||
**fixed**
|
||||
|
||||
- backend reconnection
|
||||
|
||||
## 1.3.2-beta
|
||||
|
||||
__changed__
|
||||
- Message size for Sign&Verify, thanks to [brianddk](https://github.com/brianddk)
|
||||
- Ripple -> XRP
|
||||
**updated**
|
||||
|
||||
- web3 dependency
|
||||
|
||||
**changed**
|
||||
|
||||
- Ripple -> XRP
|
||||
|
||||
## 1.3.1-beta
|
||||
|
||||
__fixed__
|
||||
- download bridge url
|
||||
**fixed**
|
||||
|
||||
- download bridge url
|
||||
|
||||
## 1.3.0-beta
|
||||
__added__
|
||||
- Coin visibility settings
|
||||
- Almost complete russian, ukrainian and spanish localization
|
||||
- Auto reconnect to a backend after losing connection
|
||||
|
||||
__changed__
|
||||
- static (without animation) active tab indicator
|
||||
- input validation - mandatory leading 0 for float numbers
|
||||
- regexps refactored to functions, added unit tests
|
||||
- limit passphrase length to 50 bytes
|
||||
- upgrade react-router and connected-react-router
|
||||
**added**
|
||||
|
||||
__fixed__
|
||||
- xrp accounts not updating in case of remembered device
|
||||
- rounding in calculating total balance in local currency
|
||||
- react hot loader
|
||||
- minor l10n fixes
|
||||
- Coin visibility settings
|
||||
- Almost complete russian, ukrainian and spanish localization
|
||||
- Auto reconnect to a backend after losing connection
|
||||
|
||||
**changed**
|
||||
|
||||
- static (without animation) active tab indicator
|
||||
- input validation - mandatory leading 0 for float numbers
|
||||
- regexps refactored to functions, added unit tests
|
||||
- limit passphrase length to 50 bytes
|
||||
- upgrade react-router and connected-react-router
|
||||
|
||||
**fixed**
|
||||
|
||||
- xrp accounts not updating in case of remembered device
|
||||
- rounding in calculating total balance in local currency
|
||||
- react hot loader
|
||||
- minor l10n fixes
|
||||
|
||||
## 1.2.0-beta
|
||||
__added__
|
||||
- Localization
|
||||
- Ability to hide balances
|
||||
- Fiat currency switcher
|
||||
- Application settings
|
||||
- Button to copy log to clipboard
|
||||
- Import tool (for support)
|
||||
- Prettier
|
||||
|
||||
__updated__
|
||||
- flow-bin 0.9.0
|
||||
**added**
|
||||
|
||||
__changed__
|
||||
- Ripple explorer to xrpscan
|
||||
- Coins sorted by market cap
|
||||
- Link to "Bitcoin wallet" opens in the same tab
|
||||
- Most components are now from trezor-ui-components
|
||||
- Limit max number of accounts to 10
|
||||
- Debounced validation in send forms
|
||||
- Localization
|
||||
- Ability to hide balances
|
||||
- Fiat currency switcher
|
||||
- Application settings
|
||||
- Button to copy log to clipboard
|
||||
- Import tool (for support)
|
||||
- Prettier
|
||||
|
||||
__removed__
|
||||
- Text "you will be redirected" from coins menu
|
||||
**updated**
|
||||
|
||||
__fixed__
|
||||
- Arrow animation in Send tab
|
||||
- Sign and Verify columns size
|
||||
- Sign and Verify validation for disabling submit buttons
|
||||
- Token select shows all tokens options
|
||||
- "Check for devices" button in device menu
|
||||
- Close xlm, xem modals when opening external wallet
|
||||
- Peding tx overflow
|
||||
- Update account empty flag after receiving tx
|
||||
- Width of inputs in xrp send form advanced settings
|
||||
- Ripple destination tag validation
|
||||
- flow-bin 0.9.0
|
||||
|
||||
**changed**
|
||||
|
||||
- Ripple explorer to xrpscan
|
||||
- Coins sorted by market cap
|
||||
- Link to "Bitcoin wallet" opens in the same tab
|
||||
- Most components are now from trezor-ui-components
|
||||
- Limit max number of accounts to 10
|
||||
- Debounced validation in send forms
|
||||
|
||||
**removed**
|
||||
|
||||
- Text "you will be redirected" from coins menu
|
||||
|
||||
**fixed**
|
||||
|
||||
- Arrow animation in Send tab
|
||||
- Sign and Verify columns size
|
||||
- Sign and Verify validation for disabling submit buttons
|
||||
- Token select shows all tokens options
|
||||
- "Check for devices" button in device menu
|
||||
- Close xlm, xem modals when opening external wallet
|
||||
- Peding tx overflow
|
||||
- Update account empty flag after receiving tx
|
||||
- Width of inputs in xrp send form advanced settings
|
||||
- Ripple destination tag validation
|
||||
|
||||
## 1.1.1-beta
|
||||
__added__
|
||||
- Ripple destination tag option
|
||||
- Tezos external wallet
|
||||
|
||||
**added**
|
||||
|
||||
- Ripple destination tag option
|
||||
- Tezos external wallet
|
||||
|
||||
## 1.1.0-beta
|
||||
__added__
|
||||
- Ripple support
|
||||
- responsive sidebar
|
||||
- QR code scanner in send form
|
||||
- clear send form button
|
||||
- backup notification modal
|
||||
|
||||
__updated__
|
||||
- connect v7
|
||||
- babel v7
|
||||
- ethereum tokens list
|
||||
- most of dependencies
|
||||
**added**
|
||||
|
||||
__changed__
|
||||
- icons for T1 and TT
|
||||
- device header styles
|
||||
- input styles
|
||||
- sign and verify title
|
||||
- Ripple support
|
||||
- responsive sidebar
|
||||
- QR code scanner in send form
|
||||
- clear send form button
|
||||
- backup notification modal
|
||||
|
||||
__fixed__
|
||||
- beta disclaimer wrapper position
|
||||
- sidebar scrollbar
|
||||
**updated**
|
||||
|
||||
- connect v7
|
||||
- babel v7
|
||||
- ethereum tokens list
|
||||
- most of dependencies
|
||||
|
||||
**changed**
|
||||
|
||||
- icons for T1 and TT
|
||||
- device header styles
|
||||
- input styles
|
||||
- sign and verify title
|
||||
|
||||
**fixed**
|
||||
|
||||
- beta disclaimer wrapper position
|
||||
- sidebar scrollbar
|
||||
|
||||
## 1.0.3-beta
|
||||
__added__
|
||||
- Ethereum: sign & verify tab
|
||||
- Stellar and Cardano external wallets
|
||||
- UI: modal background fade in/ fade out
|
||||
- UI: fonts refactoring
|
||||
- Experimental Ripple support (disabled by default)
|
||||
|
||||
__changed__
|
||||
- Split code to coin specific types for components, actions and reducers (ripple/ethereum/...)
|
||||
- Update
|
||||
- Use TrezorConnect to communicate with trezor-blockchain-link
|
||||
**added**
|
||||
|
||||
__fixed__
|
||||
- validation of token existence in send tx draft (https://github.com/trezor/trezor-wallet/pull/252)
|
||||
- Ethereum: sign & verify tab
|
||||
- Stellar and Cardano external wallets
|
||||
- UI: modal background fade in/ fade out
|
||||
- UI: fonts refactoring
|
||||
- Experimental Ripple support (disabled by default)
|
||||
|
||||
**changed**
|
||||
|
||||
- Split code to coin specific types for components, actions and reducers (ripple/ethereum/...)
|
||||
- Update
|
||||
- Use TrezorConnect to communicate with trezor-blockchain-link
|
||||
|
||||
**fixed**
|
||||
|
||||
- validation of token existence in send tx draft (https://github.com/trezor/trezor-wallet/pull/252)
|
||||
|
||||
## 1.0.2-beta
|
||||
__changed__
|
||||
- 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)
|
||||
- update list of ETH and ETC tokens
|
||||
|
||||
__added__
|
||||
- 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 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)
|
||||
**changed**
|
||||
|
||||
__fixed__
|
||||
- validation of token existence in send tx draft (https://github.com/trezor/trezor-wallet/pull/252)
|
||||
- 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)
|
||||
- update list of ETH and ETC tokens
|
||||
|
||||
**added**
|
||||
|
||||
- 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 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)
|
||||
|
||||
**fixed**
|
||||
|
||||
- validation of token existence in send tx draft (https://github.com/trezor/trezor-wallet/pull/252)
|
||||
|
||||
## 1.0.1-beta
|
||||
__added__
|
||||
- DigiByte in coin menu
|
||||
- blocking device with seedless setup
|
||||
|
||||
__fixed__
|
||||
- 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)
|
||||
- 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)
|
||||
**added**
|
||||
|
||||
- DigiByte in coin menu
|
||||
- blocking device with seedless setup
|
||||
|
||||
**fixed**
|
||||
|
||||
- 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)
|
||||
- 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)
|
||||
|
||||
## 1.0.0-beta
|
||||
- first release
|
||||
|
||||
- first release
|
||||
|
18
package.json
18
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "trezor-wallet",
|
||||
"version": "1.3.2-beta",
|
||||
"version": "1.3.3-beta",
|
||||
"author": "TREZOR <info@trezor.io>",
|
||||
"description": "",
|
||||
"bin": {
|
||||
@ -57,8 +57,8 @@
|
||||
"raf": "^3.4.1",
|
||||
"raven-js": "^3.27.0",
|
||||
"rc-tooltip": "^3.7.3",
|
||||
"react": "16.8.6",
|
||||
"react-dom": "16.8.6",
|
||||
"react": "16.9.0",
|
||||
"react-dom": "16.9.0",
|
||||
"react-hot-loader": "^4.8.4",
|
||||
"react-intl": "^2.8.0",
|
||||
"react-json-view": "^1.19.1",
|
||||
@ -84,7 +84,7 @@
|
||||
"trezor-connect": "7.0.2",
|
||||
"trezor-ui-components": "^1.0.0-beta.20",
|
||||
"wallet-address-validator": "^0.2.4",
|
||||
"web3": "1.0.0-beta.35",
|
||||
"web3": "1.0.0-beta.36",
|
||||
"webpack": "^4.29.3",
|
||||
"webpack-build-notifier": "^0.1.30",
|
||||
"webpack-bundle-analyzer": "^3.3.2",
|
||||
@ -110,7 +110,7 @@
|
||||
"babel-plugin-styled-components": "^1.10.0",
|
||||
"cypress": "^3.1.5",
|
||||
"cypress-image-snapshot": "^3.0.0",
|
||||
"eslint": "^5.13.0",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-config-airbnb": "^17.1.0",
|
||||
"eslint-config-prettier": "^4.0.0",
|
||||
"eslint-import-resolver-babel-module": "^5.0.1",
|
||||
@ -125,11 +125,11 @@
|
||||
"eslint-plugin-react": "^7.12.4",
|
||||
"file-loader": "3.0.1",
|
||||
"flow-bin": "0.90",
|
||||
"jest": "^24.1.0",
|
||||
"jest": "^24.9.0",
|
||||
"prettier": "^1.16.4",
|
||||
"prettier-eslint": "^8.8.2",
|
||||
"prettier-eslint": "^9.0.0",
|
||||
"prettylint": "^1.0.0",
|
||||
"stylelint": "^9.10.1",
|
||||
"stylelint": "^10.0.0",
|
||||
"stylelint-config-standard": "^18.2.0",
|
||||
"stylelint-config-styled-components": "^0.1.1",
|
||||
"stylelint-custom-processor-loader": "^0.6.0",
|
||||
@ -142,4 +142,4 @@
|
||||
"optionalDependencies": {
|
||||
"fsevents": "1.2.7"
|
||||
}
|
||||
}
|
||||
}
|
@ -48,8 +48,8 @@
|
||||
"wss://etc2.trezor.io/geth"
|
||||
],
|
||||
"explorer": {
|
||||
"tx": "https://gastracker.io/tx/",
|
||||
"address": "https://gastracker.io/addr/"
|
||||
"tx": "https://etc1.trezor.io/tx/",
|
||||
"address": "https://etc1.trezor.io/address/"
|
||||
},
|
||||
"hasSignVerify": true
|
||||
},
|
||||
@ -128,8 +128,8 @@
|
||||
]
|
||||
},
|
||||
"explorer": {
|
||||
"tx": "https://sisyfos.trezor.io/ripple-testnet-explorer/tx/",
|
||||
"address": "https://sisyfos.trezor.io/ripple-testnet-explorer/address/"
|
||||
"tx": "https://test.bithomp.com/explorer/",
|
||||
"address": "https://test.bithomp.com/explorer/"
|
||||
},
|
||||
"hasSignVerify": false
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* @flow */
|
||||
|
||||
import * as BLOCKCHAIN from 'actions/constants/blockchain';
|
||||
import * as DiscoveryActions from 'actions/DiscoveryActions';
|
||||
import * as EthereumBlockchainActions from 'actions/ethereum/BlockchainActions';
|
||||
import * as RippleBlockchainActions from 'actions/ripple/BlockchainActions';
|
||||
import { resolveAfter } from 'utils/promiseUtils';
|
||||
|
||||
import type { Dispatch, GetState, PromiseAction, BlockchainFeeLevel } from 'flowtype';
|
||||
import type { BlockchainBlock, BlockchainNotification, BlockchainError } from 'trezor-connect';
|
||||
@ -20,10 +20,6 @@ export type BlockchainAction =
|
||||
| {
|
||||
type: typeof BLOCKCHAIN.START_SUBSCRIBE,
|
||||
shortcut: string,
|
||||
}
|
||||
| {
|
||||
type: typeof BLOCKCHAIN.FAIL_SUBSCRIBE,
|
||||
shortcut: string,
|
||||
};
|
||||
|
||||
// Conditionally subscribe to blockchain backend
|
||||
@ -153,23 +149,13 @@ const autoReconnect = (shortcut: string): PromiseAction<void> => async (
|
||||
dispatch: Dispatch,
|
||||
getState: GetState
|
||||
): Promise<void> => {
|
||||
const MAX_ATTEMPTS = 4;
|
||||
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
|
||||
for (let i = 0; i < MAX_ATTEMPTS; i++) {
|
||||
const waitTime = 5000 * (i + 1); /// 5s * #attempt
|
||||
if (!blockchain || blockchain.connected) {
|
||||
break;
|
||||
}
|
||||
if (!blockchain || blockchain.reconnectionAttempts >= 5) return;
|
||||
|
||||
blockchain = getState().blockchain.find(b => b.shortcut === shortcut);
|
||||
await resolveAfter(5000 * (blockchain.reconnectionAttempts + 1));
|
||||
|
||||
// reconnect with 7s timeout
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await dispatch(DiscoveryActions.reconnect(shortcut, 7000));
|
||||
blockchain = getState().blockchain.find(b => b.shortcut === shortcut);
|
||||
if (!blockchain || blockchain.connected || blockchain.connecting) return;
|
||||
|
||||
// wait before next try
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await new Promise(resolve => setTimeout(resolve, waitTime));
|
||||
}
|
||||
await dispatch(subscribe(shortcut));
|
||||
};
|
||||
|
@ -2,7 +2,6 @@
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import TrezorConnect, { UI } from 'trezor-connect';
|
||||
import * as BLOCKCHAIN_ACTION from 'actions/constants/blockchain';
|
||||
import * as DISCOVERY from 'actions/constants/discovery';
|
||||
import * as ACCOUNT from 'actions/constants/account';
|
||||
import * as NOTIFICATION from 'actions/constants/notification';
|
||||
@ -10,7 +9,6 @@ import * as NOTIFICATION from 'actions/constants/notification';
|
||||
import type {
|
||||
ThunkAction,
|
||||
AsyncAction,
|
||||
PromiseAction,
|
||||
PayloadAction,
|
||||
GetState,
|
||||
Dispatch,
|
||||
@ -331,30 +329,7 @@ const finish = (device: TrezorDevice, discoveryProcess: Discovery): AsyncAction
|
||||
});
|
||||
};
|
||||
|
||||
export const reconnect = (network: string, timeout: number = 30): PromiseAction<void> => async (
|
||||
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
|
||||
// Called after DEVICE.CONNECT ('trezor-connect') or CONNECT.AUTH_DEVICE or BLOCKCHAIN.CONNECT actions in WalletService
|
||||
// OR after BlockchainSubscribe in this.reconnect
|
||||
export const restore = (): ThunkAction => (dispatch: Dispatch, getState: GetState): void => {
|
||||
// check if current url has "network" parameter
|
||||
|
@ -160,7 +160,9 @@ export const init = (): AsyncAction => async (
|
||||
if (buildUtils.isDev()) {
|
||||
// eslint-disable-next-line
|
||||
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.TrezorConnect = TrezorConnect;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* @flow */
|
||||
|
||||
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 UPDATE_FEE: 'blockchain__update_fee' = 'blockchain__update_fee';
|
||||
|
@ -161,31 +161,47 @@ export const onNotification = (
|
||||
});
|
||||
}
|
||||
|
||||
const updatedAccount = await TrezorConnect.rippleGetAccountInfo({
|
||||
account: {
|
||||
descriptor: account.descriptor,
|
||||
from: account.block,
|
||||
history: false,
|
||||
},
|
||||
coin: account.network,
|
||||
// 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: {
|
||||
descriptor: a.descriptor,
|
||||
from: a.block,
|
||||
history: false,
|
||||
},
|
||||
coin: a.network,
|
||||
});
|
||||
|
||||
if (response.success) {
|
||||
const updatedAccount = response.payload;
|
||||
const empty = updatedAccount.sequence <= 0 && updatedAccount.balance === '0';
|
||||
dispatch(
|
||||
AccountsActions.update({
|
||||
networkType: 'ripple',
|
||||
...a,
|
||||
balance: toDecimalAmount(updatedAccount.balance, network.decimals),
|
||||
availableBalance: toDecimalAmount(
|
||||
updatedAccount.availableBalance,
|
||||
network.decimals
|
||||
),
|
||||
block: updatedAccount.block,
|
||||
sequence: updatedAccount.sequence,
|
||||
reserve: toDecimalAmount(updatedAccount.reserve, network.decimals),
|
||||
empty,
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
if (!updatedAccount.success) return;
|
||||
|
||||
const empty = updatedAccount.payload.sequence <= 0 && updatedAccount.payload.balance === '0';
|
||||
dispatch(
|
||||
AccountsActions.update({
|
||||
networkType: 'ripple',
|
||||
...account,
|
||||
balance: toDecimalAmount(updatedAccount.payload.balance, network.decimals),
|
||||
availableBalance: toDecimalAmount(
|
||||
updatedAccount.payload.availableBalance,
|
||||
network.decimals
|
||||
),
|
||||
block: updatedAccount.payload.block,
|
||||
sequence: updatedAccount.payload.sequence,
|
||||
reserve: '0',
|
||||
empty,
|
||||
})
|
||||
);
|
||||
};
|
||||
|
@ -14,17 +14,21 @@ export default (props: Props) => {
|
||||
if (notification.type === 'backend') {
|
||||
// special case: backend is down
|
||||
// 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 (
|
||||
<Notification
|
||||
variant="error"
|
||||
title={notification.title}
|
||||
message={notification.message}
|
||||
isActionInProgress={blockchain && blockchain.connecting}
|
||||
isActionInProgress={inProgress}
|
||||
actions={[
|
||||
{
|
||||
label: props.intl.formatMessage(l10nMessages.TR_CONNECT_TO_BACKEND),
|
||||
label: props.intl.formatMessage(status),
|
||||
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',
|
||||
defaultMessage: 'Connect',
|
||||
},
|
||||
TR_RECONNECTING: {
|
||||
id: 'TR_RECONNECTING',
|
||||
defaultMessage: 'Reconnecting...',
|
||||
},
|
||||
});
|
||||
|
||||
export default definedMessages;
|
||||
|
@ -7,7 +7,7 @@ import type { IntlShape } from 'react-intl';
|
||||
|
||||
import type { State, Dispatch } from 'flowtype';
|
||||
|
||||
import { reconnect } from 'actions/DiscoveryActions';
|
||||
import { subscribe } from 'actions/BlockchainActions';
|
||||
import * as NotificationActions from 'actions/NotificationActions';
|
||||
|
||||
import StaticNotifications from './components/Static';
|
||||
@ -29,7 +29,7 @@ export type StateProps = {|
|
||||
|
||||
export type DispatchProps = {|
|
||||
close: typeof NotificationActions.close,
|
||||
blockchainReconnect: typeof reconnect,
|
||||
blockchainReconnect: typeof subscribe,
|
||||
|};
|
||||
|
||||
export type Props = {| ...OwnProps, ...StateProps, ...DispatchProps |};
|
||||
@ -52,7 +52,7 @@ const mapStateToProps = (state: State): StateProps => ({
|
||||
|
||||
const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({
|
||||
close: bindActionCreators(NotificationActions.close, dispatch),
|
||||
blockchainReconnect: bindActionCreators(reconnect, dispatch),
|
||||
blockchainReconnect: bindActionCreators(subscribe, dispatch),
|
||||
});
|
||||
|
||||
export default injectIntl<OwnProps>(
|
||||
|
@ -17,6 +17,7 @@ export type BlockchainNetwork = {
|
||||
feeLevels: Array<BlockchainFeeLevel>,
|
||||
connected: boolean,
|
||||
connecting: boolean,
|
||||
reconnectionAttempts: number,
|
||||
block: number,
|
||||
};
|
||||
|
||||
@ -41,30 +42,7 @@ const onStartSubscribe = (state: State, shortcut: string): State => {
|
||||
shortcut,
|
||||
connected: false,
|
||||
connecting: true,
|
||||
block: 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,
|
||||
reconnectionAttempts: 0,
|
||||
block: 0,
|
||||
feeTimestamp: 0,
|
||||
feeLevels: [],
|
||||
@ -84,6 +62,7 @@ const onConnect = (state: State, action: BlockchainConnect): State => {
|
||||
block: info.block,
|
||||
connected: true,
|
||||
connecting: false,
|
||||
reconnectionAttempts: 0,
|
||||
},
|
||||
]);
|
||||
}
|
||||
@ -93,6 +72,7 @@ const onConnect = (state: State, action: BlockchainConnect): State => {
|
||||
shortcut,
|
||||
connected: true,
|
||||
connecting: false,
|
||||
reconnectionAttempts: 0,
|
||||
block: info.block,
|
||||
feeTimestamp: 0,
|
||||
feeLevels: [],
|
||||
@ -110,6 +90,7 @@ const onError = (state: State, action: BlockchainError): State => {
|
||||
...network,
|
||||
connected: false,
|
||||
connecting: false,
|
||||
reconnectionAttempts: network.reconnectionAttempts + 1,
|
||||
},
|
||||
]);
|
||||
}
|
||||
@ -119,6 +100,7 @@ const onError = (state: State, action: BlockchainError): State => {
|
||||
shortcut,
|
||||
connected: false,
|
||||
connecting: false,
|
||||
reconnectionAttempts: 0,
|
||||
block: 0,
|
||||
feeTimestamp: 0,
|
||||
feeLevels: [],
|
||||
@ -160,8 +142,6 @@ export default (state: State = initialState, action: Action): State => {
|
||||
switch (action.type) {
|
||||
case BLOCKCHAIN_ACTION.START_SUBSCRIBE:
|
||||
return onStartSubscribe(state, action.shortcut);
|
||||
case BLOCKCHAIN_ACTION.FAIL_SUBSCRIBE:
|
||||
return onFailSubscribe(state, action.shortcut);
|
||||
case BLOCKCHAIN_EVENT.CONNECT:
|
||||
return onConnect(state, action);
|
||||
case BLOCKCHAIN_EVENT.ERROR:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* @flow */
|
||||
import { DEVICE } from 'trezor-connect';
|
||||
import { DEVICE, BLOCKCHAIN } from 'trezor-connect';
|
||||
import { LOCATION_CHANGE } from 'connected-react-router';
|
||||
import * as WALLET from 'actions/constants/wallet';
|
||||
import * as CONNECT from 'actions/constants/TrezorConnect';
|
||||
@ -132,6 +132,12 @@ const WalletService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
||||
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;
|
||||
};
|
||||
|
||||
|
@ -489,14 +489,13 @@ const AccountSend = (props: Props) => {
|
||||
</AdvancedForm>
|
||||
)}
|
||||
|
||||
{props.selectedAccount.pending.length > 0 ||
|
||||
(account.imported && (
|
||||
<PendingTransactions
|
||||
pending={props.selectedAccount.pending}
|
||||
tokens={props.selectedAccount.tokens}
|
||||
network={network}
|
||||
/>
|
||||
))}
|
||||
{props.selectedAccount.pending.length > 0 && (
|
||||
<PendingTransactions
|
||||
pending={props.selectedAccount.pending}
|
||||
tokens={props.selectedAccount.tokens}
|
||||
network={network}
|
||||
/>
|
||||
)}
|
||||
</Content>
|
||||
);
|
||||
};
|
||||
|
@ -119,7 +119,7 @@ class SignVerify extends Component<Props> {
|
||||
onChange={this.handleInputChange}
|
||||
rows={4}
|
||||
maxRows={4}
|
||||
maxLength={1024}
|
||||
maxLength={255}
|
||||
/>
|
||||
</Row>
|
||||
<Row>
|
||||
@ -172,7 +172,7 @@ class SignVerify extends Component<Props> {
|
||||
onChange={this.handleInputChange}
|
||||
rows={4}
|
||||
maxRows={4}
|
||||
maxLength={1024}
|
||||
maxLength={255}
|
||||
/>
|
||||
</Row>
|
||||
<Row>
|
||||
|
Loading…
Reference in New Issue
Block a user