diff --git a/src/components/AssociatedBitcoinAddresses.svelte b/src/components/AssociatedBitcoinAddresses.svelte new file mode 100644 index 0000000..c3f68ee --- /dev/null +++ b/src/components/AssociatedBitcoinAddresses.svelte @@ -0,0 +1,122 @@ + + + + + Sponsors + These people want to sponsor Contributors working on {rocket.Name()}. + + + + + + Sponsor + + + + + + {#each $amounts as [npub, amount], _ (npub)} + + +
+ +
+
+ + +
+ {/each} + {#if $total > 0} + + TOTAL + + + + {/if} +
+
+
+
diff --git a/src/components/BitcoinAssociations.svelte b/src/components/BitcoinAssociations.svelte deleted file mode 100644 index b457444..0000000 --- a/src/components/BitcoinAssociations.svelte +++ /dev/null @@ -1,86 +0,0 @@ - - - - - Registered Bitcoin Addresses - These people have registered a Bitcoin address and want to sponsor Contributors working on {rocket.Name()} - - - - - - Sponsor - - Address - - - - {#each addresses as [address, ba], _ (address)} - - -
- -
-
- - {ba.Address} -
- {/each} -
-
-
-
diff --git a/src/components/RocketDashboard.svelte b/src/components/RocketDashboard.svelte index bf08076..89c380f 100644 --- a/src/components/RocketDashboard.svelte +++ b/src/components/RocketDashboard.svelte @@ -12,12 +12,11 @@ import Todo from './Todo.svelte'; import UpdateMission from './UpdateMission.svelte'; import { Rocket } from '@/event_helpers/rockets'; - import BitcoinAssociations from './BitcoinAssociations.svelte'; + import BitcoinAssociations from './AssociatedBitcoinAddresses.svelte'; export let rocket: NDKEvent; - $: unratifiedZaps = new Map() - + $: unratifiedZaps = new Map();
@@ -44,7 +43,7 @@ - + Actions @@ -62,10 +61,6 @@ - +
diff --git a/src/lib/helpers.ts b/src/lib/helpers.ts index 1a7efc0..08be4ca 100644 --- a/src/lib/helpers.ts +++ b/src/lib/helpers.ts @@ -82,17 +82,24 @@ export function formatSats(sats: number): string { } } -export async function getCuckPrice(): Promise { - try { +export async function getCuckPrice(): Promise { + return new Promise((resolve, reject) => { var url = 'https://api.coindesk.com/v1/bpi/currentprice.json'; var symbol = 'USD'; - const data = await fetch(url); - const json = await data.json(); - const cuckPrice = parseFloat(json.bpi[symbol].rate.replace(/,/g, '')); - return cuckPrice; - } catch (e) { - return e as Error; - } + fetch(url) + .then((r) => { + r.json() + .then((j) => { + resolve(parseFloat(j.bpi[symbol].rate.replace(/,/g, ''))); + }) + .catch((e) => { + reject(e as Error); + }); + }) + .catch((e) => { + reject(e as Error); + }); + }); } export async function parseProblem(problem: string) { diff --git a/src/lib/ndk.ts b/src/lib/ndk.ts index 250f1da..b1649ac 100644 --- a/src/lib/ndk.ts +++ b/src/lib/ndk.ts @@ -7,20 +7,19 @@ import { browser } from '$app/environment'; const _ndk = new NDKSvelte({ explicitRelayUrls: [ 'wss://purplepag.es', - 'wss://relay.higlighter.com', 'wss://relay.nostr.band', 'wss://nos.lol', 'wss://relay.nostrocket.org', 'wss://nostr.mutinywallet.com', 'wss://relay.damus.io' ], - enableOutboxModel: false, + enableOutboxModel: false //clientNip89: "31990:fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52:1716498133442", }); //we need to check for browser environment before calling window because svelte is slightly retarded when used client side only -// if (browser && window.indexedDB) { -// _ndk.cacheAdapter = new NDKCacheAdapterDexie({ dbName: 'gulag' }); -// } +if (browser && window.indexedDB) { + _ndk.cacheAdapter = new NDKCacheAdapterDexie({ dbName: 'gulag' }); +} export const ndk = writable(_ndk);