diff options
Diffstat (limited to 'src/routes/(app)')
| -rw-r--r-- | src/routes/(app)/ark/+page.svelte | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/routes/(app)/ark/+page.svelte b/src/routes/(app)/ark/+page.svelte new file mode 100644 index 00000000..81ef9354 --- /dev/null +++ b/src/routes/(app)/ark/+page.svelte @@ -0,0 +1,53 @@ +<script> + import { SingleKey, Wallet } from "@arkade-os/sdk"; + import { onMount, tick } from "svelte"; + import { HDKey } from "@scure/bip32"; + + const identity = SingleKey.fromHex( + "ce66c68f8875c0c98a502c666303dc183a21600130013c06f9d1edf60207abf2", + ); + + let loading = $state(); + let balance = $state(); + + onMount(async () => { + setTimeout(checkBalance, 1000); + }); + + let checkBalance = async (e) => { + e?.preventDefault(); + loading = true; + + const wallet = await Wallet.create({ + identity, + arkServerUrl: "https://arkade.computer", + }); + + balance = await wallet.getBalance(); + + loading = false; + }; +</script> + +<div class="space-y-5"> + <h1 class="text-center text-3xl font-semibold">Ark</h1> + + <div class="container w-full mx-auto text-lg px-4 max-w-xl space-y-5"> + {#if loading} + <div> + <div class="loading loading-spinner"></div> + </div> + {:else if typeof balance !== "undefined"} + <div class="flex items-center gap-2"> + <div> + {balance.available} sats + </div> + </div> + {/if} + + <div class="flex gap-2 justify-center w-full"> + <a href="/receive" class="btn grow">Receive</a> + <a href="/send" class="btn grow">Send</a> + </div> + </div> +</div> |
