Remove addProperties helper (#318)
This commit is contained in:
parent
4a842ff31b
commit
9095fc0986
|
@ -5,7 +5,6 @@ import { deployHOC } from './components/DeployHoc';
|
||||||
import { TTxCompare } from '../TxCompare';
|
import { TTxCompare } from '../TxCompare';
|
||||||
import { TTxModal } from '../TxModal';
|
import { TTxModal } from '../TxModal';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { addProperties } from 'utils/helpers';
|
|
||||||
import { isValidGasPrice, isValidByteCode } from 'libs/validators';
|
import { isValidGasPrice, isValidByteCode } from 'libs/validators';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
@ -72,7 +71,7 @@ const Deploy = (props: Props) => {
|
||||||
<button
|
<button
|
||||||
className="Sign-submit btn btn-primary"
|
className="Sign-submit btn btn-primary"
|
||||||
disabled={!showSignTxButton}
|
disabled={!showSignTxButton}
|
||||||
{...addProperties(showSignTxButton, { onClick: handleSignTx })}
|
onClick={handleSignTx}
|
||||||
>
|
>
|
||||||
{translate('DEP_signtx')}
|
{translate('DEP_signtx')}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -8,7 +8,6 @@ import WalletDecrypt from 'components/WalletDecrypt';
|
||||||
import { TShowNotification } from 'actions/notifications';
|
import { TShowNotification } from 'actions/notifications';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { isValidGasPrice, isValidValue } from 'libs/validators';
|
import { isValidGasPrice, isValidValue } from 'libs/validators';
|
||||||
import { addProperties } from 'utils/helpers';
|
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
contractFunctions: any;
|
contractFunctions: any;
|
||||||
|
@ -157,7 +156,9 @@ export default class InteractExplorer extends Component<Props, State> {
|
||||||
className={classnames(
|
className={classnames(
|
||||||
'InteractExplorer-field-input',
|
'InteractExplorer-field-input',
|
||||||
'form-control',
|
'form-control',
|
||||||
{ 'is-invalid': !validGasLimit }
|
{
|
||||||
|
'is-invalid': !validGasLimit
|
||||||
|
}
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
@ -171,16 +172,16 @@ export default class InteractExplorer extends Component<Props, State> {
|
||||||
className={classnames(
|
className={classnames(
|
||||||
'InteractExplorer-field-input',
|
'InteractExplorer-field-input',
|
||||||
'form-control',
|
'form-control',
|
||||||
{ 'is-invalid': !validValue }
|
{
|
||||||
|
'is-invalid': !validValue
|
||||||
|
}
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<button
|
<button
|
||||||
className="InteractExplorer-func-submit btn btn-primary"
|
className="InteractExplorer-func-submit btn btn-primary"
|
||||||
disabled={!showContractWrite}
|
disabled={!showContractWrite}
|
||||||
{...addProperties(showContractWrite, {
|
onClick={handleFunctionSend(selectedFunction, inputs)}
|
||||||
onClick: handleFunctionSend(selectedFunction, inputs)
|
|
||||||
})}
|
|
||||||
>
|
>
|
||||||
{translate('CONTRACT_Write')}
|
{translate('CONTRACT_Write')}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { getNetworkContracts } from 'selectors/config';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { AppState } from 'reducers';
|
import { AppState } from 'reducers';
|
||||||
import { isValidETHAddress, isValidAbiJson } from 'libs/validators';
|
import { isValidETHAddress, isValidAbiJson } from 'libs/validators';
|
||||||
import { addProperties } from 'utils/helpers';
|
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -77,7 +76,9 @@ e":"a", "type":"uint256"}], "name":"foo", "outputs": [] }]';
|
||||||
className={classnames(
|
className={classnames(
|
||||||
'InteractForm-address-field-input',
|
'InteractForm-address-field-input',
|
||||||
'form-control',
|
'form-control',
|
||||||
{ 'is-invalid': !validEthAddress }
|
{
|
||||||
|
'is-invalid': !validEthAddress
|
||||||
|
}
|
||||||
)}
|
)}
|
||||||
onChange={this.handleInput('address')}
|
onChange={this.handleInput('address')}
|
||||||
/>
|
/>
|
||||||
|
@ -110,7 +111,9 @@ e":"a", "type":"uint256"}], "name":"foo", "outputs": [] }]';
|
||||||
className={classnames(
|
className={classnames(
|
||||||
'InteractForm-interface-field-input',
|
'InteractForm-interface-field-input',
|
||||||
'form-control',
|
'form-control',
|
||||||
{ 'is-invalid': !validAbiJson }
|
{
|
||||||
|
'is-invalid': !validAbiJson
|
||||||
|
}
|
||||||
)}
|
)}
|
||||||
onChange={this.handleInput('abiJson')}
|
onChange={this.handleInput('abiJson')}
|
||||||
value={abiJson}
|
value={abiJson}
|
||||||
|
@ -122,9 +125,7 @@ e":"a", "type":"uint256"}], "name":"foo", "outputs": [] }]';
|
||||||
<button
|
<button
|
||||||
className="InteractForm-submit btn btn-primary"
|
className="InteractForm-submit btn btn-primary"
|
||||||
disabled={!showContractAccessButton}
|
disabled={!showContractAccessButton}
|
||||||
{...addProperties(showContractAccessButton, {
|
onClick={accessContract(abiJson, address)}
|
||||||
onClick: accessContract(abiJson, address)
|
|
||||||
})}
|
|
||||||
>
|
>
|
||||||
{translate('x_Access')}
|
{translate('x_Access')}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -2,13 +2,6 @@ export function getKeyByValue(object, value) {
|
||||||
return Object.keys(object).find(key => object[key] === value);
|
return Object.keys(object).find(key => object[key] === value);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IKeyedObj {
|
|
||||||
[key: string]: any;
|
|
||||||
}
|
|
||||||
export const addProperties = (
|
|
||||||
truthy,
|
|
||||||
propertiesToAdd: IKeyedObj
|
|
||||||
): {} | IKeyedObj => (truthy ? propertiesToAdd : {});
|
|
||||||
export function getParam(query: { [key: string]: string }, key: string) {
|
export function getParam(query: { [key: string]: string }, key: string) {
|
||||||
const keys = Object.keys(query);
|
const keys = Object.keys(query);
|
||||||
const index = keys.findIndex(k => k.toLowerCase() === key.toLowerCase());
|
const index = keys.findIndex(k => k.toLowerCase() === key.toLowerCase());
|
||||||
|
|
Loading…
Reference in New Issue