mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-27 18:58:08 +00:00
remove unnecessary SEND.TX_COMPLETE action
This commit is contained in:
parent
215fab48eb
commit
695ae17176
@ -6,7 +6,6 @@ import * as ACCOUNT from 'actions/constants/account';
|
||||
import * as DISCOVERY from 'actions/constants/discovery';
|
||||
import * as TOKEN from 'actions/constants/token';
|
||||
import * as PENDING from 'actions/constants/pendingTx';
|
||||
import * as SEND from 'actions/constants/send';
|
||||
|
||||
import * as reducerUtils from 'reducers/utils';
|
||||
|
||||
@ -184,7 +183,6 @@ const getAccountNotification = (state: State, selectedAccount: SelectedAccountSt
|
||||
const actions = [
|
||||
LOCATION_CHANGE,
|
||||
...Object.values(BLOCKCHAIN).filter(v => typeof v === 'string'),
|
||||
SEND.TX_COMPLETE,
|
||||
WALLET.SET_SELECTED_DEVICE,
|
||||
WALLET.UPDATE_SELECTED_DEVICE,
|
||||
...Object.values(ACCOUNT).filter(v => typeof v === 'string' && v !== ACCOUNT.UPDATE_SELECTED_ACCOUNT && v !== ACCOUNT.DISPOSE), // exported values got unwanted "__esModule: true" as first element
|
||||
|
@ -12,24 +12,10 @@ import type {
|
||||
} from 'flowtype';
|
||||
import type { State as EthereumState } from 'reducers/SendFormEthereumReducer';
|
||||
import type { State as RippleState } from 'reducers/SendFormRippleReducer';
|
||||
import type { Account } from 'reducers/AccountsReducer';
|
||||
|
||||
import * as EthereumSendFormActions from './ethereum/SendFormActions';
|
||||
import * as RippleSendFormActions from './ripple/SendFormActions';
|
||||
|
||||
export type SendTxAction = {
|
||||
type: typeof SEND.TX_COMPLETE,
|
||||
//networkType: 'ethereum',
|
||||
account: Account,
|
||||
selectedCurrency: string,
|
||||
amount: string,
|
||||
total: string,
|
||||
tx: any,
|
||||
nonce: number,
|
||||
txid: string,
|
||||
txData: any,
|
||||
}
|
||||
|
||||
export type SendFormAction = {
|
||||
type: typeof SEND.INIT | typeof SEND.VALIDATION | typeof SEND.CHANGE,
|
||||
networkType: 'ethereum',
|
||||
@ -40,7 +26,9 @@ export type SendFormAction = {
|
||||
state: RippleState,
|
||||
} | {
|
||||
type: typeof SEND.TOGGLE_ADVANCED | typeof SEND.TX_SENDING | typeof SEND.TX_ERROR,
|
||||
} | SendTxAction;
|
||||
} | {
|
||||
type: typeof SEND.TX_COMPLETE,
|
||||
};
|
||||
|
||||
|
||||
// list of all actions which has influence on "sendForm" reducer
|
||||
|
@ -23,32 +23,12 @@ import type {
|
||||
TrezorDevice,
|
||||
} from 'flowtype';
|
||||
import type { State, FeeLevel } from 'reducers/SendFormEthereumReducer';
|
||||
import type { Account } from 'reducers/AccountsReducer';
|
||||
import * as SessionStorageActions from '../SessionStorageActions';
|
||||
import { prepareEthereumTx, serializeEthereumTx } from '../TxActions';
|
||||
import * as BlockchainActions from './BlockchainActions';
|
||||
|
||||
import * as ValidationActions from './SendFormValidationActions';
|
||||
|
||||
export type SendTxAction = {
|
||||
type: typeof SEND.TX_COMPLETE,
|
||||
account: Account,
|
||||
selectedCurrency: string,
|
||||
amount: string,
|
||||
total: string,
|
||||
tx: any,
|
||||
nonce: number,
|
||||
txid: string,
|
||||
txData: any,
|
||||
};
|
||||
|
||||
export type sendFormEthereumAction = {
|
||||
type: typeof SEND.INIT | typeof SEND.VALIDATION | typeof SEND.CHANGE,
|
||||
state: State,
|
||||
} | {
|
||||
type: typeof SEND.TOGGLE_ADVANCED | typeof SEND.TX_SENDING | typeof SEND.TX_ERROR,
|
||||
} | SendTxAction;
|
||||
|
||||
// list of all actions which has influence on "sendFormEthereum" reducer
|
||||
// other actions will be ignored
|
||||
const actions = [
|
||||
@ -542,17 +522,7 @@ export const onSend = (): AsyncAction => async (dispatch: Dispatch, getState: Ge
|
||||
|
||||
const { txid } = push.payload;
|
||||
|
||||
dispatch({
|
||||
type: SEND.TX_COMPLETE,
|
||||
account,
|
||||
selectedCurrency: currentState.currency,
|
||||
amount: currentState.amount,
|
||||
total: currentState.total,
|
||||
tx: txData,
|
||||
nonce,
|
||||
txid,
|
||||
txData,
|
||||
});
|
||||
dispatch({ type: SEND.TX_COMPLETE });
|
||||
|
||||
dispatch({
|
||||
type: PENDING.ADD,
|
||||
|
@ -19,23 +19,10 @@ import type {
|
||||
TrezorDevice,
|
||||
} from 'flowtype';
|
||||
import type { State } from 'reducers/SendFormRippleReducer';
|
||||
import type { Account } from 'reducers/AccountsReducer';
|
||||
import * as SessionStorageActions from '../SessionStorageActions';
|
||||
|
||||
import * as ValidationActions from './SendFormValidationActions';
|
||||
|
||||
export type SendTxAction = {
|
||||
type: typeof SEND.TX_COMPLETE,
|
||||
account: Account,
|
||||
selectedCurrency: string,
|
||||
amount: string,
|
||||
total: string,
|
||||
tx: any,
|
||||
nonce: number,
|
||||
txid: string,
|
||||
txData: any,
|
||||
};
|
||||
|
||||
/*
|
||||
* Called from WalletService
|
||||
*/
|
||||
@ -251,17 +238,7 @@ export const onSend = (): AsyncAction => async (dispatch: Dispatch, getState: Ge
|
||||
|
||||
const { txid } = push.payload;
|
||||
|
||||
dispatch({
|
||||
type: SEND.TX_COMPLETE,
|
||||
account,
|
||||
selectedCurrency: currentState.networkSymbol,
|
||||
amount: currentState.amount,
|
||||
total: currentState.total,
|
||||
tx: {},
|
||||
nonce: account.nonce,
|
||||
txid,
|
||||
txData: {},
|
||||
});
|
||||
dispatch({ type: SEND.TX_COMPLETE });
|
||||
|
||||
// clear session storage
|
||||
dispatch(SessionStorageActions.clear());
|
||||
|
@ -6,7 +6,6 @@ import * as CONNECT from 'actions/constants/TrezorConnect';
|
||||
import * as TOKEN from 'actions/constants/token';
|
||||
import * as ACCOUNT from 'actions/constants/account';
|
||||
import * as DISCOVERY from 'actions/constants/discovery';
|
||||
import * as SEND from 'actions/constants/send';
|
||||
import * as PENDING from 'actions/constants/pendingTx';
|
||||
import * as WALLET from 'actions/constants/wallet';
|
||||
|
||||
@ -59,7 +58,7 @@ const LocalStorageService: Middleware = (api: MiddlewareAPI) => (next: Middlewar
|
||||
api.dispatch(LocalStorageActions.save());
|
||||
break;
|
||||
|
||||
case SEND.TX_COMPLETE:
|
||||
case PENDING.ADD:
|
||||
case PENDING.TX_RESOLVED:
|
||||
case PENDING.TX_REJECTED:
|
||||
api.dispatch(LocalStorageActions.save());
|
||||
|
Loading…
Reference in New Issue
Block a user