feat(wallet): Refactor wallet service for enhanced modularity and clarity
- Abstracted RPC interface to allow dynamic input for connection flexibility. - Added `signSession` function to retrieve `authSig` efficiently. - Improved logging and error handling to provide clearer feedback. - Centralized `authSig` retrieval for better code maintainability. This refactor ensures the wallet service is more adaptable to varying use cases and improves overall code readability.
This commit is contained in:
@ -1,21 +1,22 @@
|
||||
<script>
|
||||
import AuthSig from '$lib/components/AuthSig.svelte';
|
||||
import Wallet from '$lib/Wallet.svelte';
|
||||
import Send from '$lib/Send.svelte';
|
||||
import WalletConnect from '$lib/WalletConnect.svelte';
|
||||
import Balance from '$lib/components/Balance.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { connectWallet } from '$lib/services/wallet/wallet';
|
||||
|
||||
let pkpWallet;
|
||||
let authSig;
|
||||
let pkpPubKey =
|
||||
let pkpWallet = null;
|
||||
|
||||
const pkpPubKey =
|
||||
'046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571';
|
||||
|
||||
// Specify your RPC URL here
|
||||
const rpcURL = 'https://rpc.gnosischain.com/';
|
||||
|
||||
onMount(async () => {
|
||||
pkpWallet = await connectWallet(pkpPubKey, rpcURL);
|
||||
});
|
||||
</script>
|
||||
|
||||
<AuthSig />
|
||||
<div class="flex flex-col items-center justify-center p-4 bg-gray-200">
|
||||
<Wallet bind:pkpWallet bind:authSig />
|
||||
<Send bind:pkpWallet />
|
||||
<Balance />
|
||||
|
||||
<WalletConnect bind:pkpWallet bind:authSig bind:pkpPubKey />
|
||||
</div>
|
||||
{#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