diff --git a/src/components/AssociateBitcoinAddress.svelte b/src/components/AssociateBitcoinAddress.svelte index 0850d4c..77a402f 100644 --- a/src/components/AssociateBitcoinAddress.svelte +++ b/src/components/AssociateBitcoinAddress.svelte @@ -76,22 +76,23 @@ Contributors who need Sats are able to list their Merits for sale, to sponsor them simply buy some of their Merits. - + Your Bitcoin Addresses
Merit purchases must be conducted with a Bitcoin address that is associated with your pubkey, otherwise you will not recieve the Merits upon payment.
- {#if ($associatedAddresses.size == 0 && !associations) || (associations && $associations.length == 0)}You - do not have any registered addresses{:else if associations && $associations && $associations.length > 0} + {#if ($associatedAddresses.size == 0 && !associations) || ($associatedAddresses.size == 0 && associations && $associations.length == 0)} + You do not have any registered addresses + {:else if $associatedAddresses.size == 0 && associations && $associations && $associations.length > 0}

Pending Additions

    {#each $associations as event}
  • {event.getMatchingTags('onchain')[0][1]}
  • {/each}
- {:else} + {:else if $associatedAddresses.size > 0}

Your registered addresses

    diff --git a/src/components/Heading.svelte b/src/components/Heading.svelte index a795978..744b69a 100644 --- a/src/components/Heading.svelte +++ b/src/components/Heading.svelte @@ -1,11 +1,17 @@ {#if title}
    -

    +

    {title}

    +{:else} +
    +

    + +

    +
    {/if} diff --git a/src/lib/event_helpers/rockets.ts b/src/lib/event_helpers/rockets.ts index e37138b..03a83b2 100644 --- a/src/lib/event_helpers/rockets.ts +++ b/src/lib/event_helpers/rockets.ts @@ -9,6 +9,9 @@ import { BloomFilter } from 'bloomfilter'; export class Rocket { Event: NDKEvent; + Testnet(): boolean { + return this.Name().toLowerCase().includes('test'); + } ATag(): NDKTag { return ['a', `31108:${this.Event.pubkey}:${this.Event.dTag}`]; } diff --git a/src/routes/buymerits/+page.svelte b/src/routes/buymerits/+page.svelte index b1b1c47..9de9f50 100644 --- a/src/routes/buymerits/+page.svelte +++ b/src/routes/buymerits/+page.svelte @@ -15,11 +15,15 @@ import BuyAmr from '../../components/BuyAMR.svelte'; import { goto } from '$app/navigation'; import { base } from '$app/paths'; + import * as Card from '@/components/ui/card'; + import { Badge } from '@/components/ui/badge'; let rocketEvents = $ndk.storeSubscribe([{ kinds: [31108 as number] }], { subId: 'all_rockets' }); onDestroy(() => { rocketEvents?.unsubscribe(); }); + let dev = false; + let rockets = derived(rocketEvents, ($rocketEvents) => { let m = new Map(); for (let e of $rocketEvents) { @@ -134,6 +138,10 @@ }); transactions.subscribe((t) => {}); + + function getRocketClass(rocket: Rocket): string { + return rocket.Testnet() ? 'dark:border-red-600' : ''; + } {#if $nostrocket} @@ -142,51 +150,77 @@ {#if $currentUser} {#each $pendingSales as [rocket, amr] (rocket.Event.id)} {#if amr.length > 0} - - - - - Seller - AMR - Merits - Current Price (sats) - Status - Receiving Address - - - - - {#each amr as p (p.AMRIDs)} - - + +
    +

    + {`ROCKET: ${rocket.Name().toUpperCase()}`} +

    + {#if rocket.Testnet()} - {p.AMRIDs.length > 1 ? 'multiple' : p.AMRIDs[0].substring(0, 12)} - {p.Merits} - {p.Merits} - {p.Status(rocket, $bitcoinTip.height, $transactions.get(p.RxAddress))} - { - console.log($transactions.get(p.RxAddress)?.From()); - }}>{p.RxAddress} - {#if p.Status(rocket, $bitcoinTip.height, $transactions.get(p.RxAddress)) == 'OPEN'}{/if} - - {/each} - - + { + dev = true; + alert( + 'dev mode enabled, refresh page if this was unintentional or you may lose sats' + ); + }}>TESTNET + {/if} +
    + + + + + Seller + AMR + Merits + Current Price (sats) + Status + Receiving Address + + + + + {#each amr as p (p.AMRIDs)} + + + {p.AMRIDs.length > 1 ? 'multiple' : p.AMRIDs[0].substring(0, 12)} + {p.Merits} + {p.Merits} + {p.Status( + rocket, + $bitcoinTip.height, + $transactions.get(p.RxAddress) + )} + { + console.log($transactions.get(p.RxAddress)?.From()); + }}>{p.RxAddress} + {#if p.Status(rocket, $bitcoinTip.height, $transactions.get(p.RxAddress)) == 'OPEN' && (!rocket.Testnet() || dev)}{/if} + + {/each} + + +
    + {/if} {/each} {:else}{/if}