problem: can't use multiple bitcoin addresses for a single pubkey

This commit is contained in:
gsovereignty
2024-08-10 17:46:35 +08:00
parent f81f175c1e
commit bfbd88ea05
3 changed files with 55 additions and 41 deletions

View File

@@ -21,17 +21,24 @@
_associationRequests?.unsubscribe();
});
let addresses = new Map<string, BitcoinAssociation>()
let addresses = new Map<string, BitcoinAssociation>();
onMount(()=>{
addresses = rocket.BitcoinAssociations()
addresses.forEach(a => {
onMount(() => {
addresses = rocket.BitcoinAssociations();
addresses.forEach((a) => {
if (a.Address) {
getBalance(a.Address).then(v=>{a.Balance = v; addresses.set(a.Pubkey, a); addresses = addresses}).catch(err=>{console.log(err)})
getBalance(a.Address)
.then((v) => {
a.Balance = v;
addresses.set(a.Address!, a);
addresses = addresses;
})
.catch((err) => {
console.log(err);
});
}
})
})
});
});
</script>
<Card.Root class="sm:col-span-3">
@@ -51,18 +58,18 @@
</Table.Row>
</Table.Header>
<Table.Body>
{#each addresses as [pubkey, ba], _ (pubkey)}
{#each addresses as [address, ba], _ (address)}
<Table.Row>
<Table.Cell>
<div class="flex flex-nowrap">
<Avatar
ndk={$ndk}
pubkey={pubkey}
pubkey={ba.Pubkey}
class="h-10 w-10 flex-none rounded-full object-cover"
/>
<Name
ndk={$ndk}
pubkey={pubkey}
pubkey={ba.Pubkey}
class="hidden max-w-32 truncate p-2 md:inline-block"
/>
</div>
@@ -71,7 +78,6 @@
{ba.Balance.toLocaleString()}
</Table.Cell>
<Table.Cell class="table-cell">{ba.Address}</Table.Cell>
</Table.Row>
{/each}
</Table.Body>

View File

@@ -91,15 +91,18 @@
<Dialog.Header>
<Dialog.Title>Subscribe for Updates</Dialog.Title>
<Dialog.Description>
Subscribe via DM or email and we'll ping you when there are new releases/features
Subscribe now and we'll ping you when there are new releases/features
</Dialog.Description>
<div class="flex flex-col gap-4 py-4">
{#if $currentUser}
<Button on:click={Subscribe}>I use nostr, please DM me with updates</Button>
<Button on:click={Subscribe}>DM me with updates</Button>
{:else}
<Login />
{/if}
<Separator />
<span class="ml-auto mr-auto flex"
>If you don't use nostr, you can subscribe to updates with an email address instead</span
>
<div class="grid grid-cols-4 items-center gap-4">
<Label for="email" class="text-right">Email</Label>
<Input bind:value={email} id="email" placeholder="Your email" class="col-span-3" />
@@ -109,7 +112,7 @@
{/if}
</div>
<Button disabled={emailInValid} on:click={SubmitEmailAndSubscribe}
>I don't use nostr yet, please email me with updates</Button
>Please email me with updates</Button
>
</Dialog.Header>
</Dialog.Content>