split wallet state into evm-wallet and monero-wallet

- Move EVM state/methods to evm-wallet.svelte.ts with its own init/login/logout/accountType
- Move Monero state/methods to monero-wallet.svelte.ts with its own init/login/logout/accountType
- Each wallet is fully self-contained and pages import only their wallet's state
- evm-wallet imports monero-wallet internally for full app init (no circular dep)
- Welcome/settings/tx pages import evmWallet
- Monero pages import moneroWallet
- Delete old wallet.svelte.ts orchestrator
This commit is contained in:
2026-05-20 20:09:45 +08:00
parent 805d103785
commit c55a33e9ab
9 changed files with 646 additions and 635 deletions
+4 -15
View File
@@ -1,18 +1,7 @@
<script lang="ts">
import { wallet } from '$lib/states/wallet.svelte.js'
import { Button } from '$lib/components/ui/button/index.js'
import { Input } from '$lib/components/ui/input/index.js'
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from '$lib/components/ui/card/index.js'
import { navigate } from 'sv-router/generated'
import Loader from '$lib/components/loader.svelte'
import { moneroWallet } from '$lib/states/monero-wallet.svelte.js'
const w = wallet
const w = moneroWallet
let moneroSettingsPw = $state('')
@@ -35,7 +24,7 @@
<Button
variant="outline"
size="sm"
onclick={async () => { await w.moneroStop(); await w.moneroStart() }}
onclick={async () => { await w.stop(); await w.start() }}
disabled={w.loading}>
{#if w.loading}
<Loader />
@@ -50,7 +39,7 @@
<div class="flex gap-2 items-end">
<Input type="password" placeholder="Wallet password" bind:value={moneroSettingsPw} />
<Button size="sm" onclick={async () => {
await w.moneroStorePassword(w.moneroWalletName, moneroSettingsPw)
await w.moneroStorePassword(w.walletName, moneroSettingsPw)
moneroSettingsPw = ''
w.error = ''
}} disabled={!moneroSettingsPw || w.loading}>Save</Button>