aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/account/import
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-20 10:03:22 -0700
committerAdam Soltys <[email protected]>2024-09-20 10:03:22 -0700
commit5c86d9eadaa0021928ea39c7d0e875d0c446280f (patch)
tree9d8465f37573f0efa1e84ce64d7d2336798cc319 /src/routes/(app)/account/import
parentd4c3d52fdde5fef8f72c1f572f1ce7c70da86b23 (diff)
downloadcoinos-ui-5c86d9eadaa0021928ea39c7d0e875d0c446280f.tar.gz
coinos-ui-5c86d9eadaa0021928ea39c7d0e875d0c446280f.zip
import key
Diffstat (limited to 'src/routes/(app)/account/import')
-rw-r--r--src/routes/(app)/account/import/+page.svelte15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/routes/(app)/account/import/+page.svelte b/src/routes/(app)/account/import/+page.svelte
index 1e28f9df..866c1b1a 100644
--- a/src/routes/(app)/account/import/+page.svelte
+++ b/src/routes/(app)/account/import/+page.svelte
@@ -1,11 +1,12 @@
<script>
+ import { goto } from "$app/navigation";
+ import { mnemonic } from "$lib/store";
import { versions } from "$lib/utils";
import { t } from "$lib/translations";
import { browser } from "$app/environment";
import Icon from "$comp/Icon.svelte";
import { validateMnemonic } from "@scure/bip39";
import { wordlist } from "@scure/bip39/wordlists/english";
- import { HDKey } from "@scure/bip32";
let el, pasted, text;
@@ -16,10 +17,12 @@
let submit = () => {
let valid = validateMnemonic(text, wordlist);
- let v2 = HDKey.fromExtendedKey(text, versions);
-
- console.log(valid);
- console.log(v2);
+ if (valid) {
+ $mnemonic = text;
+ goto("/account/pass");
+ } else {
+ fail("Failed to validate seed phrase");
+ }
};
$: if (browser && pasted && text) form.submit() && (pasted = false);
@@ -34,7 +37,7 @@
<textarea
use:focus
name="text"
- placeholder="Enter a seed phrase or extended key"
+ placeholder="Enter a seed phrase"
class="w-full p-4 border rounded-xl h-48 text-xl"
bind:value={text}
autocapitalize="none"