]> zoso.dev Git - nemo-wallet.git/commitdiff
Save proof-of-concept HTML page to repo as a reference.
authorChris Duncan <chris@zoso.dev>
Sat, 12 Oct 2024 07:28:46 +0000 (00:28 -0700)
committerChris Duncan <chris@zoso.dev>
Sat, 12 Oct 2024 07:28:46 +0000 (00:28 -0700)
app/pages/nemo-wallet.html [new file with mode: 0644]

diff --git a/app/pages/nemo-wallet.html b/app/pages/nemo-wallet.html
new file mode 100644 (file)
index 0000000..4130fc1
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+
+<head>
+  <meta lang="en">
+  <script>
+    let Bip44Wallet
+    let Xel
+    async function load () {
+      console.log('loading')
+      const libnemo = await import('https://unpkg.com/libnemo@latest')
+      Bip44Wallet = libnemo.Bip44Wallet
+      console.log('libnemo loaded')
+      Xel = await import('https://unpkg.com/xel@latest')
+      // await Xel.whenThemeReady
+      setTimeout(() => {
+        document.getElementById('main').style.visibility = 'visible'
+        console.log('xel loaded')
+      }, 100)
+    }
+    async function wallet () {
+      const wallet = await Bip44Wallet.create('password')
+      await wallet.unlock('password')
+      return wallet
+    }
+    function showWallet (wallet) {
+      const card = document.getElementById('wallet')
+      const walletElement = document.createElement('x-label')
+      walletElement.innerText = wallet.mnemonic
+      card.appendChild(walletElement)
+    }
+  </script>
+  <script src="" type="module"></script>
+  <meta name="xel-theme" content="https://unpkg.com/xel@latest/themes/adwaita-dark.css">
+  <meta name="xel-accent-color" content="blue">
+  <meta name="xel-icons" content="https://unpkg.com/xel@latest/icons/fluent-outlined.svg">
+</head>
+
+<body onload="load().then(() => {console.log('loaded')})">
+  <x-box id="main" style="visibility:hidden;">
+    <x-button onclick="wallet().then(w => {console.log(w);showWallet(w)})">
+      <x-label>Create</x-label>
+    </x-button>
+    <x-card id="wallet">
+    </x-card>
+  </x-box>
+</body>