Commit 30d65273 authored by Thibaut Sardan's avatar Thibaut Sardan
Browse files

Revert "fix(): init"

This reverts commit b62b983d.
parent d273f796
......@@ -56,12 +56,11 @@ export default class AccountIconChooser extends React.PureComponent<{
.split(' ')
.map(async () => {
const seed = await words();
const { address, bip39 } = await brainWalletAddress(seed);
const { address } = await brainWalletAddress(seed);
return {
address,
seed,
bip39
address
};
})
);
......@@ -76,7 +75,6 @@ export default class AccountIconChooser extends React.PureComponent<{
renderIcon = ({ item, index }) => {
const { value, onChange } = this.props;
const { address, seed, bip39} = item;
const iSelected = item.address.toLowerCase() === value.toLowerCase();
const style = [styles.icon];
......@@ -86,9 +84,8 @@ export default class AccountIconChooser extends React.PureComponent<{
style={[styles.iconBorder, iSelected ? styles.selected : {}]}
onPress={() =>
onChange({
address,
seed,
bip39
address: item.address,
seed: item.seed
})
}
>
......
......@@ -73,8 +73,8 @@ class AccountNewView extends React.Component {
</Text>
<AccountIconChooser
value={selected && selected.seed && selected.address}
onChange={({ address, seed, bip39 }) => {
accounts.updateNew({ address, seed, validBip39Seed: bip39 }, false);
onChange={({ address, seed }) => {
accounts.updateNew({ address, seed });
}}
/>
<Text style={styles.title}>ACCOUNT NAME</Text>
......
......@@ -65,35 +65,18 @@ export default class AccountsStore extends Container<AccountsState> {
});
}
updateNew(accountUpdate: Object, recalculateAddress: boolean = true) {
// Object.assign(this.state.newAccount, accountUpdate);
// const { seed } = this.state.newAccount;
// if (typeof seed === 'string') {
// debounce(async () => {
// const { bip39, address } = await brainWalletAddress(seed);
// Object.assign(this.state.newAccount, { address, validBip39Seed: bip39 });
// this.setState({});
// }, 200)();
// }
// this.setState({});
const { newAccount } = this.state;
const { seed } = accountUpdate;
console.log('hop',accountUpdate)
if ( seed && recalculateAddress ){
this.setState({newAccount :{...newAccount, seed}});
updateNew(accountUpdate: Object) {
Object.assign(this.state.newAccount, accountUpdate);
const { seed } = this.state.newAccount;
if (typeof seed === 'string') {
debounce(async () => {
const { bip39, address } = await brainWalletAddress(seed);
console.log('back',{ newAccount : {...newAccount, ...accountUpdate, address, validBip39Seed: bip39} })
this.setState({ newAccount : {...newAccount, ...accountUpdate, address, validBip39Seed: bip39} })
console.log('we update to',{ newAccount : {...newAccount, ...accountUpdate, address, validBip39Seed: bip39} })
}, 200)()
} else {
this.setState({ newAccount : {...newAccount, ...accountUpdate} })
console.log('without calculation',{ newAccount : {...newAccount, ...accountUpdate} })
Object.assign(this.state.newAccount, { address, validBip39Seed: bip39 });
this.setState({});
}, 200)();
}
this.setState({});
}
getNew(): Account {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment