mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-10 02:55:41 +00:00
db6b737cad
* Save transactions to local storage. * Checksum more things + reset hash on network change. * Fix IHexTransaction type, grab from from tx object directly. * Refactor storage of recent transactions to use redux storage and loading. * Refactor types to a transactions types file. * Initial crack at recent transactions tab on account * Punctuation. * Transaction Status responsive behavior. * Refactor transaction helper function out to remove circular dependency. * Fix typings * Collapse subtabs to select list when too small. * s/wallet/address * Type select onChange * Get fields from current state if web3 tx
31 lines
978 B
TypeScript
31 lines
978 B
TypeScript
import { AppState } from 'reducers';
|
|
import { SavedTransaction } from 'types/transactions';
|
|
import { getNetworkConfig } from './config';
|
|
import { getWalletInst } from './wallet';
|
|
|
|
export function getTransactionDatas(state: AppState) {
|
|
return state.transactions.txData;
|
|
}
|
|
|
|
export function getRecentTransactions(state: AppState): SavedTransaction[] {
|
|
return state.transactions.recent;
|
|
}
|
|
|
|
export function getRecentNetworkTransactions(state: AppState): SavedTransaction[] {
|
|
const txs = getRecentTransactions(state);
|
|
const network = getNetworkConfig(state);
|
|
return txs.filter(tx => tx.chainId === network.chainId);
|
|
}
|
|
|
|
export function getRecentWalletTransactions(state: AppState): SavedTransaction[] {
|
|
const networkTxs = getRecentNetworkTransactions(state);
|
|
const wallet = getWalletInst(state);
|
|
|
|
if (wallet) {
|
|
const addr = wallet.getAddressString().toLowerCase();
|
|
return networkTxs.filter(tx => tx.from.toLowerCase() === addr);
|
|
} else {
|
|
return [];
|
|
}
|
|
}
|