prepopulate fields with values when avaliable
This commit is contained in:
parent
516ea30fe6
commit
30359be72f
|
@ -1,6 +1,5 @@
|
||||||
import web3 from "Embark/web3"
|
import web3 from "Embark/web3"
|
||||||
import ENSSubdomainRegistry from 'Embark/contracts/ENSSubdomainRegistry';
|
import ENSSubdomainRegistry from 'Embark/contracts/ENSSubdomainRegistry';
|
||||||
import TestToken from 'Embark/contracts/TestToken';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import Hidden from '@material-ui/core/Hidden';
|
import Hidden from '@material-ui/core/Hidden';
|
||||||
|
@ -13,8 +12,6 @@ import FieldGroup from '../standard/FieldGroup';
|
||||||
import LinearProgress from '@material-ui/core/LinearProgress';
|
import LinearProgress from '@material-ui/core/LinearProgress';
|
||||||
import { generateXY } from '../../utils/ecdsa';
|
import { generateXY } from '../../utils/ecdsa';
|
||||||
|
|
||||||
console.log(TestToken)
|
|
||||||
|
|
||||||
const { soliditySha3, fromWei } = web3.utils;
|
const { soliditySha3, fromWei } = web3.utils;
|
||||||
|
|
||||||
const InnerForm = ({
|
const InnerForm = ({
|
||||||
|
@ -29,7 +26,7 @@ const InnerForm = ({
|
||||||
subDomain,
|
subDomain,
|
||||||
domainName,
|
domainName,
|
||||||
domainPrice,
|
domainPrice,
|
||||||
statusContactCode
|
statusContactCode,
|
||||||
}) => (
|
}) => (
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<div style={{ margin: '10px' }}>
|
<div style={{ margin: '10px' }}>
|
||||||
|
@ -107,7 +104,7 @@ const InnerForm = ({
|
||||||
placeholder="Status Messenger Address"
|
placeholder="Status Messenger Address"
|
||||||
value={values.statusAddress}
|
value={values.statusAddress}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
paste={() => setFieldValue('statusAddress', statusContactCode)}
|
onClick={() => setFieldValue('statusAddress', '')}
|
||||||
wide />
|
wide />
|
||||||
</Field>
|
</Field>
|
||||||
<Field label="Your Wallet Address">
|
<Field label="Your Wallet Address">
|
||||||
|
@ -117,7 +114,7 @@ const InnerForm = ({
|
||||||
placeholder="Ethereum Address"
|
placeholder="Ethereum Address"
|
||||||
value={values.address}
|
value={values.address}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
paste={() => setFieldValue('address', web3.eth.defaultAccount)}
|
onClick={() => setFieldValue('address', '')}
|
||||||
required
|
required
|
||||||
wide />
|
wide />
|
||||||
</Field>
|
</Field>
|
||||||
|
@ -130,7 +127,7 @@ const InnerForm = ({
|
||||||
);
|
);
|
||||||
|
|
||||||
const RegisterSubDomain = withFormik({
|
const RegisterSubDomain = withFormik({
|
||||||
mapPropsToValues: props => ({ subDomain: '', domainName: '', price: '' }),
|
mapPropsToValues: props => ({ subDomain: '', domainName: '', price: '', statusAddress: props.statusContactCode, address: web3.eth.defaultAccount }),
|
||||||
validate(values, props) {
|
validate(values, props) {
|
||||||
const errors = {};
|
const errors = {};
|
||||||
const { address } = values;
|
const { address } = values;
|
||||||
|
|
Loading…
Reference in New Issue