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:
22
src/lib/components/Wallet/Wallet.svelte
Normal file
22
src/lib/components/Wallet/Wallet.svelte
Normal 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}
|
Reference in New Issue
Block a user