From a757d2b1dca84c6f6be30a2f005e1fd87effe47b Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 16 Sep 2024 16:07:43 -0700 Subject: nwc --- .env.production | 1 + .env.sample | 3 +- .gitignore | 1 + bun.lockb | Bin 158491 -> 158882 bytes package.json | 11 ++--- src/lib/nostr.ts | 6 --- src/locales/en.json | 1 + .../(app)/[username]/(profile)/+layout.svelte | 51 +++++++++++++++++---- 8 files changed, 52 insertions(+), 22 deletions(-) diff --git a/.env.production b/.env.production index b61d218e..1ae57c17 100644 --- a/.env.production +++ b/.env.production @@ -5,3 +5,4 @@ PUBLIC_EXPLORER=https://mempool.space PUBLIC_LIQUID_EXPLORER=https://liquid.network PUBLIC_DOMAIN=coinos.io PUBLIC_COINOS_PUBKEY=ba80990666ef0b6f4ba5059347beb13242921e54669e680064ca755256a1e3a6 +PUBLIC_COINOS_RELAY=wss://relay.coinos.io diff --git a/.env.sample b/.env.sample index 20f5fb31..c1a75688 100644 --- a/.env.sample +++ b/.env.sample @@ -5,4 +5,5 @@ PUBLIC_LIQUID_EXPLORER=http://localhost:5005 PUBLIC_SOCKET=ws://localhost:3119/ws ORIGIN=http://localhost:5173 PUBLIC_DOMAIN=localhost:5173 -PUBLIC_ONRAMPER=******** +PUBLIC_COINOS_PUBKEY=ba80990666ef0b6f4ba5059347beb13242921e54669e680064ca755256a1e3a6 +PUBLIC_COINOS_RELAY=wss://relay.coinos.io diff --git a/.gitignore b/.gitignore index 3cf23d42..10d98957 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules /package .env android +ios diff --git a/bun.lockb b/bun.lockb index f6a11093..df7d1899 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 4aa2740b..848db710 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,10 @@ "version": "0.0.1", "devDependencies": { "@asoltys/nostr-tools": "^2.1.7", + "@capacitor/android": "^6.0.0", + "@capacitor/cli": "^6.0.0", + "@capacitor/core": "^6.0.0", + "@capacitor/ios": "^6.1.2", "@scure/base": "^1.1.1", "@scure/bip39": "^1.2.1", "@sveltejs/adapter-node": "^2.0.0", @@ -53,10 +57,5 @@ "lint": "prettier --check --plugin-search-dir=. .", "format": "prettier --write --plugin-search-dir=. ." }, - "type": "module", - "dependencies": { - "@capacitor/android": "^6.0.0", - "@capacitor/cli": "^6.0.0", - "@capacitor/core": "^6.0.0" - } + "type": "module" } diff --git a/src/lib/nostr.ts b/src/lib/nostr.ts index fce09d30..1a02114d 100644 --- a/src/lib/nostr.ts +++ b/src/lib/nostr.ts @@ -22,9 +22,6 @@ import wordlist from "$lib/english"; import { bech32m } from "@scure/base"; import { generateSeedWords, privateKeyFromSeedWords } from "nostr-tools/nip06"; -import { PUBLIC_COINOS_PUBKEY } from "$env/static/public"; - -let damus = "wss://relay.damus.io"; type User = { [key: string]: any; @@ -178,6 +175,3 @@ export let reEncryptEntropy = async (user: User, newPassword: string) => { return encode("en", toWords(bytes), 180); }; - -export let nwc = (user: User) => - `nostr+walletconnect://${PUBLIC_COINOS_PUBKEY}?relay=${damus}&secret=${user.nwc}`; diff --git a/src/locales/en.json b/src/locales/en.json index f1d96157..29929c6b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -159,6 +159,7 @@ "moreDetails": "Profile details", "noMessages": "You have not sent or received any messages", "profilePage": "Profile page", + "nwc": "Nostr wallet connect", "nostrPubkey": "Nostr pubkey", "requestPayment": "Request Payment", "welcome": "Welcome! Your account balance is empty. You can start by making a deposit or by asking someone to pay you.", diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte index 3a1dee56..c4750581 100644 --- a/src/routes/(app)/[username]/(profile)/+layout.svelte +++ b/src/routes/(app)/[username]/(profile)/+layout.svelte @@ -6,6 +6,10 @@ import { sign, send } from "$lib/nostr"; import { bech32m } from "@scure/base"; import { page } from "$app/stores"; + import { + PUBLIC_COINOS_PUBKEY as pk, + PUBLIC_COINOS_RELAY as relay, + } from "$env/static/public"; export let data; @@ -15,7 +19,7 @@ $: ({ events, user, subject, src, rates, text } = data); $: ({ currency, username: n, display } = subject); - $: stripped = n.replace(/\s/g, "") + $: stripped = n.replace(/\s/g, ""); $: username = n.length > 60 ? n.substr(0, 6) : display || stripped; $: npub = subject.pubkey && @@ -23,13 +27,12 @@ $: lnaddr = `${stripped}@${$page.url.host}`; $: profile = `${$page.url.host}/${stripped}`; + $: nwc = `nostr+walletconnect://${pk}?relay=${encodeURIComponent( + relay + )}&secret=${user.nwc}`; + let follow = async () => { - user.follows.push([ - "p", - subject.pubkey, - "wss://nostr.coinos.io", - stripped, - ]); + user.follows.push(["p", subject.pubkey, "wss://nostr.coinos.io", stripped]); update(); }; @@ -118,7 +121,11 @@
{$t("user.moreDetails")}
-
+
@@ -136,7 +143,12 @@ - +
@@ -174,6 +186,27 @@ + {#if user.id === subject.id} +
+
{$t("user.nwc")}
+
+
+ {nwc} +
+
+ + + + +
+
+
+ {/if} {/if} -- cgit v1.2.3