Add mnemonic download setup requirement (#269)

This commit is contained in:
skynetcapital 2021-05-23 21:28:34 -07:00 committed by GitHub
parent 63dc54eaf4
commit 958cf5df7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 1 deletions

View File

@ -99,9 +99,19 @@ function CreateWalletForm() {
function SeedWordsForm({ mnemonicAndSeed, goForward }) {
const [confirmed, setConfirmed] = useState(false);
const [downloaded, setDownloaded] = useState(false);
const [showDialog, setShowDialog] = useState(false);
const [seedCheck, setSeedCheck] = useState('');
const downloadMnemonic = (mnemonic) => {
const url = window.URL.createObjectURL(new Blob([mnemonic]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'sollet.bak');
document.body.appendChild(link);
link.click();
}
return (
<>
<Card>
@ -149,9 +159,17 @@ function SeedWordsForm({ mnemonicAndSeed, goForward }) {
}
label="I have saved these words in a safe place."
/>
<Typography paragraph>
<Button variant="contained" color="primary" onClick={() => {
downloadMnemonic(mnemonicAndSeed?.mnemonic);
setDownloaded(true);
}}>
Download Backup Mnemonic File (Required)
</Button>
</Typography>
</CardContent>
<CardActions style={{ justifyContent: 'flex-end' }}>
<Button color="primary" disabled={!confirmed} onClick={() => setShowDialog(true)}>
<Button color="primary" disabled={!confirmed || !downloaded} onClick={() => setShowDialog(true)}>
Continue
</Button>
</CardActions>