feat(components): Initialize component state and enable property mapping

- Ensure every component has an initialized state, defaulting to empty.
- Implement property mapping to synchronize states between parent and child components.
This commit is contained in:
Samuel Andert
2023-07-24 15:00:05 +02:00
parent 5b7c49fd58
commit e12f6bcf05
6 changed files with 106 additions and 19 deletions

View File

@ -0,0 +1,22 @@
<script>
import { onMount } from 'svelte';
import { connectWallet } from '$lib/services/wallet/wallet';
import { getComponentStore } from '$lib/stores/componentStores.ts';
// please abstract this.
export let id;
const store = getComponentStore(id);
let pkpWallet = null;
onMount(async () => {
pkpWallet = await connectWallet($store.pkpPubKey, $store.rpcURL);
});
</script>
{#if pkpWallet}
<div class="mb-4 text-lg font-medium">
PKP Wallet: <span class="text-blue-600">{pkpWallet.address}</span>
</div>
{/if}