1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00
This commit is contained in:
Szymon Lesisz 2018-09-23 08:19:38 +02:00
parent 590e0ca642
commit 957e02f313
3 changed files with 6 additions and 7 deletions

View File

@ -1,10 +1,8 @@
/* @flow */ /* @flow */
import EthereumjsUtil from 'ethereumjs-util';
import TrezorConnect from 'trezor-connect'; import TrezorConnect from 'trezor-connect';
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
import * as BLOCKCHAIN from 'actions/constants/blockchain'; import * as BLOCKCHAIN from 'actions/constants/blockchain';
import * as PENDING from 'actions/constants/pendingTx';
import type { import type {
TrezorDevice, TrezorDevice,
@ -128,6 +126,7 @@ export const onBlockMined = (coinInfo: any): PromiseAction<void> => async (dispa
// not used for now, waiting for fix in blockbook // not used for now, waiting for fix in blockbook
/*
export const onNotification = (payload: any): PromiseAction<void> => async (dispatch: Dispatch, getState: GetState): Promise<void> => { export const onNotification = (payload: any): PromiseAction<void> => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
// this event can be triggered multiple times // this event can be triggered multiple times
// 1. check if pair [txid + address] is already in reducer // 1. check if pair [txid + address] is already in reducer
@ -166,6 +165,7 @@ export const onNotification = (payload: any): PromiseAction<void> => async (disp
} }
} }
}; };
*/
export const subscribe = (network: string): PromiseAction<void> => async (dispatch: Dispatch, getState: GetState): Promise<void> => { export const subscribe = (network: string): PromiseAction<void> => async (dispatch: Dispatch, getState: GetState): Promise<void> => {

View File

@ -135,7 +135,7 @@ export const discoverAccount = (address: string, network: string): PromiseAction
export const resolvePendingTransactions = (network: string): PromiseAction<void> => async (dispatch: Dispatch, getState: GetState): Promise<void> => { export const resolvePendingTransactions = (network: string): PromiseAction<void> => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
const instance: Web3Instance = await dispatch(initWeb3(network)); const instance: Web3Instance = await dispatch(initWeb3(network));
const pending = getState().pending.filter(p => p.network === network); const pending = getState().pending.filter(p => p.network === network);
for (const tx of pending) { pending.forEach(async (tx) => {
const status = await instance.web3.eth.getTransaction(tx.id); const status = await instance.web3.eth.getTransaction(tx.id);
if (!status) { if (!status) {
dispatch({ dispatch({
@ -158,7 +158,7 @@ export const resolvePendingTransactions = (network: string): PromiseAction<void>
}); });
} }
} }
} });
}; };
/* /*
@ -205,7 +205,7 @@ export const updateAccount = (account: Account, newAccount: EthereumAccount, net
export const updateAccountTokens = (account: Account): PromiseAction<void> => async (dispatch: Dispatch, getState: GetState): Promise<void> => { export const updateAccountTokens = (account: Account): PromiseAction<void> => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
const tokens = getState().tokens.filter(t => t.network === account.network && t.ethAddress === account.address); const tokens = getState().tokens.filter(t => t.network === account.network && t.ethAddress === account.address);
for (const token of tokens) { tokens.forEach(async (token) => {
const balance = await dispatch(getTokenBalance(token)); const balance = await dispatch(getTokenBalance(token));
// const newBalance: string = balance.dividedBy(Math.pow(10, token.decimals)).toString(10); // const newBalance: string = balance.dividedBy(Math.pow(10, token.decimals)).toString(10);
if (balance !== token.balance) { if (balance !== token.balance) {
@ -215,7 +215,7 @@ export const updateAccountTokens = (account: Account): PromiseAction<void> => as
balance, balance,
)); ));
} }
} });
}; };
export const getTokenInfo = (address: string, network: string): PromiseAction<NetworkToken> => async (dispatch: Dispatch): Promise<NetworkToken> => { export const getTokenInfo = (address: string, network: string): PromiseAction<NetworkToken> => async (dispatch: Dispatch): Promise<NetworkToken> => {

View File

@ -195,7 +195,6 @@ const AccountSend = (props: Props) => {
errors, errors,
warnings, warnings,
infos, infos,
data,
sending, sending,
advanced, advanced,
} = props.sendForm; } = props.sendForm;