Fix contract interact (#1233)
* reduce unintended side effects from empty units * Fix contract interaction "to" address being empty * Fix tsc errors
This commit is contained in:
parent
86992e8198
commit
4dd0fc9785
|
@ -10,7 +10,8 @@ import {
|
||||||
getNonceRequested,
|
getNonceRequested,
|
||||||
TGetNonceRequested,
|
TGetNonceRequested,
|
||||||
reset,
|
reset,
|
||||||
TReset
|
TReset,
|
||||||
|
ResetAction
|
||||||
} from 'actions/transaction';
|
} from 'actions/transaction';
|
||||||
import { fetchCCRatesRequested, TFetchCCRatesRequested } from 'actions/rates';
|
import { fetchCCRatesRequested, TFetchCCRatesRequested } from 'actions/rates';
|
||||||
import { getNetworkConfig, getOffline } from 'selectors/config';
|
import { getNetworkConfig, getOffline } from 'selectors/config';
|
||||||
|
@ -44,6 +45,7 @@ interface DefaultProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OwnProps {
|
interface OwnProps {
|
||||||
|
resetIncludeExcludeProperties?: ResetAction['payload'];
|
||||||
initialState?: SliderStates;
|
initialState?: SliderStates;
|
||||||
disableToggle?: boolean;
|
disableToggle?: boolean;
|
||||||
advancedGasOptions?: AdvancedOptions;
|
advancedGasOptions?: AdvancedOptions;
|
||||||
|
@ -69,7 +71,7 @@ class TXMetaDataPanel extends React.Component<Props, State> {
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
if (!this.props.offline) {
|
if (!this.props.offline) {
|
||||||
this.props.reset();
|
this.props.reset(this.props.resetIncludeExcludeProperties);
|
||||||
this.props.fetchCCRates([this.props.network.unit]);
|
this.props.fetchCCRates([this.props.network.unit]);
|
||||||
this.props.getNonceRequested();
|
this.props.getNonceRequested();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {
|
||||||
resetWallet,
|
resetWallet,
|
||||||
TResetWallet
|
TResetWallet
|
||||||
} from 'actions/wallet';
|
} from 'actions/wallet';
|
||||||
import { reset, TReset } from 'actions/transaction';
|
import { reset, TReset, ResetAction } from 'actions/transaction';
|
||||||
import translate from 'translations';
|
import translate from 'translations';
|
||||||
import {
|
import {
|
||||||
KeystoreDecrypt,
|
KeystoreDecrypt,
|
||||||
|
@ -55,6 +55,7 @@ interface OwnProps {
|
||||||
hidden?: boolean;
|
hidden?: boolean;
|
||||||
disabledWallets?: DisabledWallets;
|
disabledWallets?: DisabledWallets;
|
||||||
showGenerateLink?: boolean;
|
showGenerateLink?: boolean;
|
||||||
|
resetIncludeExcludeProperties?: ResetAction['payload'];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DispatchProps {
|
interface DispatchProps {
|
||||||
|
@ -430,7 +431,7 @@ export class WalletDecrypt extends Component<Props, State> {
|
||||||
// the payload to contain the unlocked wallet info.
|
// the payload to contain the unlocked wallet info.
|
||||||
const unlockValue = value && !isEmpty(value) ? value : payload;
|
const unlockValue = value && !isEmpty(value) ? value : payload;
|
||||||
this.WALLETS[selectedWalletKey].unlock(unlockValue);
|
this.WALLETS[selectedWalletKey].unlock(unlockValue);
|
||||||
this.props.resetTransactionState();
|
this.props.resetTransactionState(this.props.resetIncludeExcludeProperties);
|
||||||
};
|
};
|
||||||
|
|
||||||
private isWalletDisabled = (walletKey: WalletName) => {
|
private isWalletDisabled = (walletKey: WalletName) => {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { FullWalletOnly } from 'components/renderCbs';
|
||||||
interface OwnProps {
|
interface OwnProps {
|
||||||
button: React.ReactElement<any>;
|
button: React.ReactElement<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Fields extends Component<OwnProps> {
|
export class Fields extends Component<OwnProps> {
|
||||||
public render() {
|
public render() {
|
||||||
const makeContent = () => (
|
const makeContent = () => (
|
||||||
|
@ -17,6 +18,7 @@ export class Fields extends Component<OwnProps> {
|
||||||
initialState="advanced"
|
initialState="advanced"
|
||||||
disableToggle={true}
|
disableToggle={true}
|
||||||
advancedGasOptions={{ dataField: false }}
|
advancedGasOptions={{ dataField: false }}
|
||||||
|
resetIncludeExcludeProperties={{ exclude: { fields: ['to'] }, include: {} }}
|
||||||
/>
|
/>
|
||||||
{this.props.button}
|
{this.props.button}
|
||||||
<SigningStatus />
|
<SigningStatus />
|
||||||
|
@ -24,7 +26,12 @@ export class Fields extends Component<OwnProps> {
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
|
||||||
const makeDecrypt = () => <WalletDecrypt disabledWallets={DISABLE_WALLETS.READ_ONLY} />;
|
const makeDecrypt = () => (
|
||||||
|
<WalletDecrypt
|
||||||
|
disabledWallets={DISABLE_WALLETS.READ_ONLY}
|
||||||
|
resetIncludeExcludeProperties={{ exclude: { fields: ['to'] }, include: {} }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
return <FullWalletOnly withFullWallet={makeContent} withoutFullWallet={makeDecrypt} />;
|
return <FullWalletOnly withFullWallet={makeContent} withoutFullWallet={makeDecrypt} />;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ export function* handleSetUnitMeta({ payload: currentUnit }: SetUnitMetaAction):
|
||||||
const tokenToToken = !currUnit && !prevUnit;
|
const tokenToToken = !currUnit && !prevUnit;
|
||||||
const decimal: number = yield select(getDecimalFromUnit, currentUnit);
|
const decimal: number = yield select(getDecimalFromUnit, currentUnit);
|
||||||
|
|
||||||
if (etherToEther) {
|
if (etherToEther || previousUnit === '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue