mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-22 17:08:55 +00:00
12d29e5b94
* Fix #1569 * Use common component for handling "to" address * If to address becomes invalid, hide contract interact explorer * Add IS_CONTRACT_INTERACTION mode - fix bugs related to contract interact * Bump shepherd version to fix bugs related to metamask + network switches * Update mycrypto link downloads * Update facebook link * Remove console log from checktx * Fix dollar sign on contract address in conf modal * Fix unchecksummed address for metamask signing * Cleanup unused classname * Update generate keystore file description to be correct * Add space to create new wallet banner * Remove extra variable * Do checksumming in library function instead of component * Clear state on address change
69 lines
2.0 KiB
TypeScript
69 lines
2.0 KiB
TypeScript
import translate from 'translations';
|
|
import { Interact } from './components/Interact';
|
|
import { Deploy } from './components/Deploy';
|
|
import {
|
|
setAsContractInteraction,
|
|
TSetAsContractInteraction,
|
|
setAsViewAndSend,
|
|
TSetAsViewAndSend
|
|
} from 'actions/transaction';
|
|
|
|
import TabSection from 'containers/TabSection';
|
|
import React, { Component } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { Switch, Route, Redirect, RouteComponentProps } from 'react-router';
|
|
import SubTabs from 'components/SubTabs';
|
|
import { RouteNotFound } from 'components/RouteNotFound';
|
|
|
|
interface DispatchProps {
|
|
setAsContractInteraction: TSetAsContractInteraction;
|
|
setAsViewAndSend: TSetAsViewAndSend;
|
|
}
|
|
|
|
const tabs = [
|
|
{
|
|
path: 'interact',
|
|
name: translate('CONTRACTS_INTERACT')
|
|
},
|
|
{
|
|
path: 'deploy',
|
|
name: translate('CONTRACTS_DEPLOY')
|
|
}
|
|
];
|
|
|
|
class Contracts extends Component<DispatchProps & RouteComponentProps<{}>> {
|
|
public componentDidMount() {
|
|
this.props.setAsContractInteraction();
|
|
}
|
|
public componentWillUnmount() {
|
|
this.props.setAsViewAndSend();
|
|
}
|
|
|
|
public render() {
|
|
const { match, location, history } = this.props;
|
|
const currentPath = match.url;
|
|
|
|
return (
|
|
<TabSection isUnavailableOffline={true}>
|
|
<SubTabs tabs={tabs} match={match} location={location} history={history} />
|
|
<section className="Tab-content Contracts">
|
|
<div className="Contracts-content">
|
|
<Switch>
|
|
<Route
|
|
exact={true}
|
|
path={currentPath}
|
|
render={() => <Redirect from={`${currentPath}`} to={`${currentPath}/interact`} />}
|
|
/>
|
|
<Route exact={true} path={`${currentPath}/interact`} component={Interact} />
|
|
<Route exact={true} path={`${currentPath}/deploy`} component={Deploy} />
|
|
<RouteNotFound />
|
|
</Switch>
|
|
</div>
|
|
</section>
|
|
</TabSection>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default connect(null, { setAsContractInteraction, setAsViewAndSend })(Contracts);
|