mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-12 19:17:30 +00:00
* Start splitting networks into their own reducers * Split out nodes and networks into their own reducers * Cleanup file structure * Make selectors for new state * Change custom network typing * re-type repo * Fix up components to use selectors, work on fixing sagas * Provide consistency in naming, fix more sagas * Get non web3 node switching working * Split config rehydration off into a different file for store * Inline auth for custom nodes * Include typing for app state * moar selectors * Get web3 working + cleanup sagas * Cleanup tsc errors * Use forof loop instead of foreach for clearing pruning custom networks * Add reducer tests for new redux state * Export needed variables * Add console error * Remove old comment * Work on saga tests * Get passing existing saga tests * Fix more tests * Remove irrlevant tests * add console error * Get rest of tests passing * Fix merge errors * Remove random text * Fix store saving * Fix selector lib only grabbing from static nodes * Fix custom node removal crashing app * Infer selected network via node * Prune custom networks properly on node removal * Infer network name from chainid from selecting state * Cleanup tsc errors * Remove MEW nodes for main and testnet
63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
import React, { Component } from 'react';
|
|
import WalletDecrypt, { DISABLE_WALLETS } from 'components/WalletDecrypt';
|
|
import { OnlyUnlocked } from 'components/renderCbs';
|
|
import { Fields } from './Fields';
|
|
import { isUnlocked as isUnlockedSelector } from 'selectors/wallet';
|
|
import { getNetworkConfig } from 'selectors/config';
|
|
import { configureLiteSend, TConfigureLiteSend } from 'actions/swap';
|
|
import { connect } from 'react-redux';
|
|
import { AppState } from 'reducers';
|
|
import { shouldDisplayLiteSend } from 'selectors/swap';
|
|
import { NetworkConfig } from 'types/network';
|
|
|
|
interface DispatchProps {
|
|
configureLiteSend: TConfigureLiteSend;
|
|
}
|
|
|
|
interface StateProps {
|
|
shouldDisplay: boolean;
|
|
isUnlocked: boolean;
|
|
network: NetworkConfig;
|
|
}
|
|
|
|
type Props = StateProps & DispatchProps;
|
|
class LiteSendClass extends Component<Props> {
|
|
public componentDidMount() {
|
|
this.props.configureLiteSend();
|
|
}
|
|
|
|
public render() {
|
|
if (!this.props.shouldDisplay) {
|
|
return null;
|
|
}
|
|
const { network, isUnlocked } = this.props;
|
|
let renderMe;
|
|
if (network.chainId !== 1) {
|
|
renderMe = (
|
|
<div className="row">
|
|
<div className="col-xs-8 col-xs-push-2 text-center">
|
|
<h5>Note: Send is only supported on Ethereum Mainnet.</h5>
|
|
</div>
|
|
</div>
|
|
);
|
|
} else {
|
|
renderMe = isUnlocked ? (
|
|
<OnlyUnlocked whenUnlocked={<Fields />} />
|
|
) : (
|
|
<WalletDecrypt disabledWallets={DISABLE_WALLETS.READ_ONLY} />
|
|
);
|
|
}
|
|
|
|
return <React.Fragment>{renderMe}</React.Fragment>;
|
|
}
|
|
}
|
|
|
|
export const LiteSend = connect(
|
|
(state: AppState) => ({
|
|
shouldDisplay: shouldDisplayLiteSend(state),
|
|
isUnlocked: isUnlockedSelector(state),
|
|
network: getNetworkConfig(state)
|
|
}),
|
|
{ configureLiteSend }
|
|
)(LiteSendClass);
|