diff --git a/tests/gui/vuejs/noogle/package.json b/tests/gui/vuejs/noogle/package.json index e9e543e..9d5804a 100644 --- a/tests/gui/vuejs/noogle/package.json +++ b/tests/gui/vuejs/noogle/package.json @@ -9,7 +9,7 @@ "preview": "vite preview" }, "dependencies": { - "@rust-nostr/nostr-sdk": "^0.8.0", + "@rust-nostr/nostr-sdk": "^0.9.0", "bootstrap": "^5.3.2", "daisyui": "^4.6.0", "mini-toastr": "^0.8.1", diff --git a/tests/gui/vuejs/noogle/src/App.vue b/tests/gui/vuejs/noogle/src/App.vue index fbbcd6f..f6a4bb2 100644 --- a/tests/gui/vuejs/noogle/src/App.vue +++ b/tests/gui/vuejs/noogle/src/App.vue @@ -14,6 +14,7 @@ import Nip07 from "@/components/Nip07.vue"; + @@ -22,10 +23,7 @@ header { line-height: 1.5; } -.logo { - display: block; - margin: 0 auto 2rem; -} + @media (min-width: 768px) { header { diff --git a/tests/gui/vuejs/noogle/src/components/Donate.vue b/tests/gui/vuejs/noogle/src/components/Donate.vue index 38d25d8..b61caa4 100644 --- a/tests/gui/vuejs/noogle/src/components/Donate.vue +++ b/tests/gui/vuejs/noogle/src/components/Donate.vue @@ -2,21 +2,60 @@ import { requestProvider } from "webln"; import miniToastr from "mini-toastr"; import VueNotifications from "vue-notifications"; +import {PublicKey, ZapDetails, ZapEntity, ZapType} from "@rust-nostr/nostr-sdk"; +import store from "@/store.js"; +import {data} from "autoprefixer"; + + export default { + data() { + return { + dvmlnaddress: "hype@bitcoinfixesthis.org", + dvmpaymentaddr: "", + dvminvoice: "", + nostrsdklnaddress: "yuki@getalby.com", + nostrsdkpaymentaddr: "", + nostrsdkinvoice: "", + amount: 1000 + }}, + methods: { - async zap() { + async handleZap(){ + try { + let pk = PublicKey.fromBech32("npub1nxa4tywfz9nqp7z9zp7nr7d4nchhclsf58lcqt5y782rmf2hefjquaa6q8"); + let entity = ZapEntity.publicKey(pk); + let details = new ZapDetails(ZapType.Private).message("Zap for Rust Nostr!"); + await store.state.client.zap(entity, 1000, details); + } catch (error) { + console.log(error) + } + }, + + async copyinvoice(invoice){ + await navigator.clipboard.writeText(invoice) + miniToastr.showMessage("", "Copied Invoice to clipboard", VueNotifications.types.info) + }, + + async zap(lnaddress, amount) { let webln; - let invoice = await this.createBolt11Lud16("hype@bitcoinfixesthis.org", 1000) + let invoice = await this.createBolt11Lud16(lnaddress, amount) + if (lnaddress === this.nostrsdklnaddress){ + this.nostrsdkpaymentaddr = `https://chart.googleapis.com/chart?cht=qr&chl=${invoice}&chs=250x250&chld=M|0`; + this.nostrsdkinvoice = invoice + } + else{ + this.dvmpaymentaddr = `https://chart.googleapis.com/chart?cht=qr&chl=${invoice}&chs=250x250&chld=M|0`; + this.dvminvoice = invoice + } + try { webln = await requestProvider(); } catch (err) { - await navigator.clipboard.writeText(invoice) - miniToastr.showMessage("", "Copied Invoice to clipboard", VueNotifications.types.info) + await this.copyinvoice(invoice) } if (webln) { - console.log(invoice) let response = await webln.sendPayment(invoice) console.log(response) @@ -41,35 +80,52 @@ export default { const callbackResponse = await fetch(`${callback}?amount=${amountInSats}`); const obCallback = await callbackResponse.json(); return obCallback.pr; - } catch (e) { - console.log(`LUD16: ${e}`); - return null; + } + catch (e) { + console.log(`LUD16: ${e}`); + return null; } } - } } - \ No newline at end of file diff --git a/tests/gui/vuejs/noogle/src/components/Home.vue b/tests/gui/vuejs/noogle/src/components/Home.vue index 07bcb5e..cb8cc39 100644 --- a/tests/gui/vuejs/noogle/src/components/Home.vue +++ b/tests/gui/vuejs/noogle/src/components/Home.vue @@ -11,15 +11,11 @@ export default { @@ -27,11 +23,6 @@ export default { .center { text-align: center; - - justify-content: center; -} -.containertwo { - display: flex; justify-content: center; } diff --git a/tests/gui/vuejs/noogle/src/components/Nip07.vue b/tests/gui/vuejs/noogle/src/components/Nip07.vue index b8aefeb..f887ffe 100644 --- a/tests/gui/vuejs/noogle/src/components/Nip07.vue +++ b/tests/gui/vuejs/noogle/src/components/Nip07.vue @@ -4,11 +4,9 @@

{{ this.current_user }}

- + - @@ -34,7 +29,7 @@ import { Filter, initLogger, LogLevel, - Timestamp, Keys, NostrDatabase, ClientBuilder + Timestamp, Keys, NostrDatabase, ClientBuilder, ClientZapper } from "@rust-nostr/nostr-sdk"; import VueNotifications from "vue-notifications"; import store from '../store'; @@ -51,45 +46,33 @@ export default { }, async mounted() { try{ - //let testsginer = new Nip07Signer() - - if (localStorage.getItem('nostr-key-method') === 'nip07') - { - await this.sign_in_nip07() - } - else { - await this.sign_in_anon() - } - + if (localStorage.getItem('nostr-key-method') === 'nip07') + { + await this.sign_in_nip07() + } + else { + await this.sign_in_anon() + } } catch (error){ console.log(error); - console.log("nah"); } }, methods: { async sign_in_anon() { - try { - - await loadWasmAsync(); - - try { - initLogger(LogLevel.debug()); - } catch (error) { - console.log(error); - } + await loadWasmAsync(); + try { + initLogger(LogLevel.debug()); + } catch (error) { + console.log(error); + } let keys = Keys.fromSkStr("ece3c0aa759c3e895ecb3c13ab3813c0f98430c6d4bd22160b9c2219efc9cf0e") this.signer = ClientSigner.keys(keys) //TODO store keys - - - - - let database = await NostrDatabase.open("test.db") - let client = new ClientBuilder().database(database).signer(this.signer).build() + let client = new ClientBuilder().signer(this.signer).build() for (const relay of store.state.relays){ await client.addRelay(relay); @@ -118,14 +101,6 @@ export default { console.log("Client connected") - - //await this.get_user_info(pubkey) - //miniToastr.showMessage("Login successful!", "Logged in as " + this.current_user, VueNotifications.types.success) - - - - - } catch (error) { console.log(error); } @@ -152,10 +127,8 @@ export default { this.signer = ClientSigner.keys(Keys.generate()) } - - - let database = await NostrDatabase.open("test.db") - let client = new ClientBuilder().database(database).signer(this.signer).build() + let zapper = ClientZapper.webln() + let client = new ClientBuilder().signer(this.signer).zapper(zapper).build(); for (const relay of store.state.relays){ await client.addRelay(relay); @@ -173,25 +146,15 @@ export default { console.log(ev.asJson()) }*/ - - - store.commit('set_client', client) store.commit('set_pubkey', pubkey) store.commit('set_hasEventListener', false) localStorage.setItem('nostr-key-method', "nip07") localStorage.setItem('nostr-key', "") console.log("Client connected") - - - await this.get_user_info(pubkey) //miniToastr.showMessage("Login successful!", "Logged in as " + this.current_user, VueNotifications.types.success) - - - - } catch (error) { console.log(error); } @@ -221,6 +184,7 @@ export default { async sign_out(){ this.current_user = "" + await this.state.client.shutdown(); localStorage.setItem('nostr-key-method', "") localStorage.setItem('nostr-key', "") await this.sign_in_anon() @@ -250,12 +214,6 @@ export default { box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 10%); } -.b-Button { - height: 30px; - color: white; - background: purple; - -} .v-Button { @apply bg-black text-center hover:bg-nostr focus:ring-nostr mb-2 inline-flex flex-none items-center rounded-lg border border-nostr px-3 py-1.5 text-sm leading-4 text-white transition-colors duration-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-gray-900; margin-right: 14px; @@ -263,9 +221,4 @@ export default { width: 70px } -.c-Button { - height: 30px; - color: white; - background: #8e30eb; -} \ No newline at end of file diff --git a/tests/gui/vuejs/noogle/src/components/Nip89.vue b/tests/gui/vuejs/noogle/src/components/Nip89.vue index fee0060..8692185 100644 --- a/tests/gui/vuejs/noogle/src/components/Nip89.vue +++ b/tests/gui/vuejs/noogle/src/components/Nip89.vue @@ -21,11 +21,8 @@
- - - - + @@ -45,8 +42,7 @@ async function getnip89s(){ let keys = Keys.fromSkStr("ece3c0aa759c3e895ecb3c13ab3813c0f98430c6d4bd22160b9c2219efc9cf0e") let signer = ClientSigner.keys(keys) //TODO store keys - let database = await NostrDatabase.open("nip89.db") - let client = new ClientBuilder().database(database).signer(signer).build() + let client = new ClientBuilder().signer(signer).build() //await client.addRelay("wss://nos.lol"); await client.addRelay("wss://relay.f7z.io") await client.addRelay("wss://pablof7z.nostr1.com") @@ -112,9 +108,6 @@ export default { async mounted(){ await getnip89s() - - - }, setup() { diff --git a/tests/gui/vuejs/noogle/src/components/Search.vue b/tests/gui/vuejs/noogle/src/components/Search.vue index 6b9e39f..49c8062 100644 --- a/tests/gui/vuejs/noogle/src/components/Search.vue +++ b/tests/gui/vuejs/noogle/src/components/Search.vue @@ -129,11 +129,6 @@ async function listen() { try { console.log("7000:", event.content); miniToastr.showMessage("DVM replied", event.content, VueNotifications.types.info) - - - //if (content === "stop") { - // return true - //} } catch (error) { console.log("Error: ", error); } @@ -194,21 +189,12 @@ function nextInput(e) { } } -function prevInput(e) { - const prev = e.currentTarget.previousElementSibling; - if (prev) { - prev.focus(); - } -} - defineProps({ msg: { type: String, required: false }, - - }) @@ -218,25 +204,14 @@ defineProps({
-
-

Noogle

-

- Search the Nostr with Data Vending Machines -

- +
+

Noogle

+

+ Search the Nostr with Data Vending Machines

- -
- - - - - - - +
+ +

@@ -253,15 +228,12 @@ defineProps({ .c-Input { @apply bg-black hover:bg-gray-900 focus:ring-white mb-2 inline-flex flex-none items-center rounded-lg border border-transparent px-3 py-1.5 text-sm leading-4 text-white transition-colors duration-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-gray-900; - width: 350px; height: 48px; - color: white; + color: white; background: black; } - - .logo { display: flex; width:100%; @@ -285,7 +257,6 @@ h3 { .greetings h1, .greetings h3 { text-align: center; - } } diff --git a/tests/gui/vuejs/noogle/src/components/SearchResultTable.vue b/tests/gui/vuejs/noogle/src/components/SearchResultTable.vue index 8066cb4..42c5925 100644 --- a/tests/gui/vuejs/noogle/src/components/SearchResultTable.vue +++ b/tests/gui/vuejs/noogle/src/components/SearchResultTable.vue @@ -1,5 +1,5 @@