diff --git a/src/lib/components/HelloEarth/HelloEarth.svelte b/src/lib/components/HelloEarth/HelloEarth.svelte
index 1bb08dd..f9ef1e3 100644
--- a/src/lib/components/HelloEarth/HelloEarth.svelte
+++ b/src/lib/components/HelloEarth/HelloEarth.svelte
@@ -1 +1,10 @@
-
Hello Earth
+
+
+
Hello Earth {JSON.stringify($store)}
diff --git a/src/lib/components/Wallet.svelte b/src/lib/components/Wallet/Wallet.svelte
similarity index 52%
rename from src/lib/components/Wallet.svelte
rename to src/lib/components/Wallet/Wallet.svelte
index ded63eb..60b03cb 100644
--- a/src/lib/components/Wallet.svelte
+++ b/src/lib/components/Wallet/Wallet.svelte
@@ -2,16 +2,16 @@
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;
- const pkpPubKey =
- '046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571';
-
- // Specify your RPC URL here
- const rpcURL = 'https://rpc.gnosischain.com/';
-
onMount(async () => {
- pkpWallet = await connectWallet(pkpPubKey, rpcURL);
+ pkpWallet = await connectWallet($store.pkpPubKey, $store.rpcURL);
});
diff --git a/src/lib/services/authWithGoogle.ts b/src/lib/services/authWithGoogle.ts
new file mode 100644
index 0000000..e69de29
diff --git a/src/lib/stores/componentStores.ts b/src/lib/stores/componentStores.ts
new file mode 100644
index 0000000..3c3e44d
--- /dev/null
+++ b/src/lib/stores/componentStores.ts
@@ -0,0 +1,16 @@
+import { writable } from 'svelte/store';
+
+const componentStores = new Map();
+
+// Create or retrieve a component store
+export function createComponentStore(componentId, initialState = {}) {
+ if (!componentStores.has(componentId)) {
+ componentStores.set(componentId, writable(initialState));
+ }
+ return componentStores.get(componentId);
+}
+
+// Get component store or create a default empty one if not exists
+export function getComponentStore(componentId) {
+ return componentStores.get(componentId) || createComponentStore(componentId);
+}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index b4f8df5..7ccb60f 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -11,14 +11,24 @@
`,
children: [
{
- id: 1,
+ id: 'login1',
componentName: 'Login',
- props: {},
- slot: 'login',
children: [
{
- id: 5,
- componentName: 'Wallet'
+ id: 'wallet1',
+ componentName: 'Wallet',
+ state: {
+ rpcURL: 'https://rpc.gnosischain.com/',
+ pkpPubKey:
+ '046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571'
+ },
+ children: [
+ {
+ id: 'HelloEarth1',
+ componentName: 'HelloEarth',
+ map: { pkp: 'wallet1.pkpPubKey', rpcURL: 'wallet1.rpcURL' }
+ }
+ ]
}
]
},