<script>
	import { onMount } from 'svelte';
	import { connectWallet } from '$lib/services/wallet/wallet';
	import WalletConnect from '$lib/WalletConnect.svelte';
	import Send from '$lib/Send.svelte';

	// export let id;
	export let store;
	export let services;

	onMount(async () => {
		$store.pkpWallet = await connectWallet($store.pkpPubKey, $store.rpcURL);
		services.core.updateStore({
			'@wallet:pkpWallet': $store.pkpWallet
		});
	});
</script>

<div>
	PkpWallet
	{#if $store.pkpWallet}
		<div class="mb-4 text-lg font-medium">
			PKP Wallet: <span class="text-blue-600">{$store.pkpWallet.address}</span>
		</div>
		<Send pkpWallet={$store.pkpWallet} />
	{/if}
	<WalletConnect />
</div>
