[beta] Fix Geth account import (#4643)

* Fix Geth import - actually pass addresses through

* Fix geth accounts not displayed

* Port saving of returned addresses (master MobX, beta state)

* log result -> importGethAccounts
This commit is contained in:
Jaco Greeff 2017-02-23 15:05:03 +01:00 committed by Arkadiy Paronyan
parent 7fc3f4eda0
commit e4e25b771e
3 changed files with 10 additions and 6 deletions

View File

@ -174,7 +174,7 @@ export default class Parity {
importGethAccounts (accounts) { importGethAccounts (accounts) {
return this._transport return this._transport
.execute('parity_importGethAccounts', inAddresses) .execute('parity_importGethAccounts', inAddresses(accounts))
.then(outAddresses); .then(outAddresses);
} }

View File

@ -106,7 +106,7 @@ export default class NewGeth extends Component {
api.parity api.parity
.listGethAccounts() .listGethAccounts()
.then((_addresses) => { .then((_addresses) => {
const addresses = (addresses || []).filter((address) => !accounts[address]); const addresses = (_addresses || []).filter((address) => !accounts[address]);
return Promise return Promise
.all(addresses.map((address) => api.eth.getBalance(address))) .all(addresses.map((address) => api.eth.getBalance(address)))

View File

@ -139,7 +139,7 @@ export default class CreateAccount extends Component {
case 2: case 2:
if (createType === 'fromGeth') { if (createType === 'fromGeth') {
return ( return (
<AccountDetailsGeth addresses={ this.state.gethAddresses } /> <AccountDetailsGeth addresses={ this.state.gethImported } />
); );
} }
@ -310,10 +310,14 @@ export default class CreateAccount extends Component {
if (createType === 'fromGeth') { if (createType === 'fromGeth') {
return api.parity return api.parity
.importGethAccounts(this.state.gethAddresses) .importGethAccounts(this.state.gethAddresses)
.then((result) => { .then((gethImported) => {
console.log('result', result); console.log('importGethAccounts', gethImported);
return Promise.all(this.state.gethAddresses.map((address) => { this.setState({
gethImported
});
return Promise.all(gethImported.map((address) => {
return api.parity.setAccountName(address, 'Geth Import'); return api.parity.setAccountName(address, 'Geth Import');
})); }));
}) })