feat(wallet.svelte): integrate pkpWallet into state store

- Initialize pkpWallet with null value inside the component store.
- Update store's pkpWallet upon successful wallet connection.
- Reflect pkpWallet value reactively in the UI.

BREAKING CHANGE: The pkpWallet now resides in the component's store and should be accessed as $store.pkpWallet.
This commit is contained in:
Samuel Andert
2023-07-26 06:14:33 +02:00
parent a2fe8b136b
commit 858d21e7db
4 changed files with 19 additions and 18 deletions

View File

@ -5,14 +5,13 @@
import { onMount } from 'svelte';
const store = getComponentStore(id);
$: console.log('store:', $store);
export let helloEarthAlert;
onMount(async () => {
helloEarthAlert.alertMe();
console.log('hello Earth');
console.log('should alerted by now');
});
</script>
<div class="p-12 bg-blue-400">Hello Earth {JSON.stringify($store)}</div>
<div class="p-12 bg-blue-400">Hello Earth {JSON.stringify($store.pkpWallet.address)}</div>