From 9a299d316b853e9f11492440df8fa1ea1b8b9357 Mon Sep 17 00:00:00 2001 From: Laurin Weger Date: Wed, 3 Jul 2024 19:20:30 +0200 Subject: [PATCH] Revert "rm example wallet" This reverts commit 2d0b8d5614d931b15279abd7f4ad6ae7ea1da1d2. --- ng-app/src/routes/WalletCreate.svelte | 72 +++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/ng-app/src/routes/WalletCreate.svelte b/ng-app/src/routes/WalletCreate.svelte index ad2bf4a..87ca62d 100644 --- a/ng-app/src/routes/WalletCreate.svelte +++ b/ng-app/src/routes/WalletCreate.svelte @@ -428,6 +428,78 @@ load_pazzle_emojis(ready.pazzle); } + // Loads an example wallet. + const loadWallet = async () => { + options = { + trusted: true, + cloud: false, + bootstrap: false, + pdf: false, + }; + creating = true; + let local_invitation = await ng.get_local_bootstrap(location.href); + let additional_bootstrap; + if (local_invitation) { + additional_bootstrap = local_invitation.V0.bootstrap; + } + let core_registration; + if (invitation?.V0.code) { + core_registration = invitation.V0.code.ChaCha20Key; + } + let params = { + security_img: security_img, + security_txt, + pin, + pazzle_length: 9, + send_bootstrap: false, //options.cloud || options.bootstrap ? : undefined, + send_wallet: options.cloud, + local_save: options.trusted, + result_with_wallet_file: false, // this will be automatically changed to true for browser app + core_bootstrap: invitation?.V0.bootstrap, + core_registration, + additional_bootstrap, + }; + try { + ready = await import("./wallet.json"); + wallets.set(await ng.get_wallets()); + if (!options.trusted && !tauri_platform) { + let lws = $wallets[ready.wallet_name]; + if (lws.in_memory) { + let new_in_mem = { + lws, + name: ready.wallet_name, + opened: false, + cmd: "new_in_mem", + }; + window.wallet_channel.postMessage(new_in_mem, location.href); + } + } + console.log("pazzle ids", ready.pazzle); + console.log("pazzle emojis", emojis_from_pazzle_ids(ready.pazzle)); + + download_name = "wallet-" + ready.wallet_name + ".ngw"; + if (options.cloud) { + cloud_link = "https://nextgraph.one/#/w/" + ready.wallet_name; + } + if (ready.wallet_file.length) { + const blob = new Blob([ready.wallet_file], { + type: "application/octet-stream", + }); + download_link = URL.createObjectURL(blob); + } + } catch (e) { + console.error(e); + error = e; + } + wait = false; + registration_error = false; + intro = false; + pin = [0, 8, 1, 5]; + pin_confirm = [0, 8, 1, 5]; + invitation = true; + }; + loadWallet(); + let width: number; let height: number; const breakPointWidth: number = 450;