|
|
@ -25,6 +25,8 @@ export default class MobileSyncPage extends Component { |
|
|
|
fetchInfoToSync: PropTypes.func.isRequired, |
|
|
|
fetchInfoToSync: PropTypes.func.isRequired, |
|
|
|
mostRecentOverviewPage: PropTypes.string.isRequired, |
|
|
|
mostRecentOverviewPage: PropTypes.string.isRequired, |
|
|
|
requestRevealSeedWords: PropTypes.func.isRequired, |
|
|
|
requestRevealSeedWords: PropTypes.func.isRequired, |
|
|
|
|
|
|
|
exportAccounts: PropTypes.func.isRequired, |
|
|
|
|
|
|
|
keyrings: PropTypes.array, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -32,6 +34,7 @@ export default class MobileSyncPage extends Component { |
|
|
|
screen: PASSWORD_PROMPT_SCREEN, |
|
|
|
screen: PASSWORD_PROMPT_SCREEN, |
|
|
|
password: '', |
|
|
|
password: '', |
|
|
|
seedWords: null, |
|
|
|
seedWords: null, |
|
|
|
|
|
|
|
importedAccounts: [], |
|
|
|
error: null, |
|
|
|
error: null, |
|
|
|
syncing: false, |
|
|
|
syncing: false, |
|
|
|
completed: false, |
|
|
|
completed: false, |
|
|
@ -62,11 +65,25 @@ export default class MobileSyncPage extends Component { |
|
|
|
.then((seedWords) => { |
|
|
|
.then((seedWords) => { |
|
|
|
this.startKeysGeneration() |
|
|
|
this.startKeysGeneration() |
|
|
|
this.startIdleTimeout() |
|
|
|
this.startIdleTimeout() |
|
|
|
this.setState({ seedWords, screen: REVEAL_SEED_SCREEN }) |
|
|
|
this.exportAccounts() |
|
|
|
|
|
|
|
.then((importedAccounts) => { |
|
|
|
|
|
|
|
this.setState({ seedWords, importedAccounts, screen: REVEAL_SEED_SCREEN }) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((error) => this.setState({ error: error.message })) |
|
|
|
.catch((error) => this.setState({ error: error.message })) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async exportAccounts () { |
|
|
|
|
|
|
|
const addresses = [] |
|
|
|
|
|
|
|
this.props.keyrings.forEach((keyring) => { |
|
|
|
|
|
|
|
if (keyring.type === 'Simple Key Pair') { |
|
|
|
|
|
|
|
addresses.push(keyring.accounts[0]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
const importedAccounts = await this.props.exportAccounts(this.state.password, addresses) |
|
|
|
|
|
|
|
return importedAccounts |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
startKeysGeneration () { |
|
|
|
startKeysGeneration () { |
|
|
|
this.keysGenerationTimeout && clearTimeout(this.keysGenerationTimeout) |
|
|
|
this.keysGenerationTimeout && clearTimeout(this.keysGenerationTimeout) |
|
|
|
this.disconnectWebsockets() |
|
|
|
this.disconnectWebsockets() |
|
|
@ -201,6 +218,7 @@ export default class MobileSyncPage extends Component { |
|
|
|
udata: { |
|
|
|
udata: { |
|
|
|
pwd: this.state.password, |
|
|
|
pwd: this.state.password, |
|
|
|
seed: this.state.seedWords, |
|
|
|
seed: this.state.seedWords, |
|
|
|
|
|
|
|
importedAccounts: this.state.importedAccounts, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|