diff --git a/apps/desktop/src/bun/rpc/evm/index.ts b/apps/desktop/src/bun/rpc/evm/index.ts
index edd7f0a..ebbad09 100644
--- a/apps/desktop/src/bun/rpc/evm/index.ts
+++ b/apps/desktop/src/bun/rpc/evm/index.ts
@@ -10,7 +10,13 @@ import { syncTransactionHistory } from '../../lib/sync'
import { eq, and } from 'drizzle-orm'
import { db } from '../../lib/db'
import { getClient } from '../../lib/viem'
-import { formatGwei, parseEther, parseUnits, encodeFunctionData, createWalletClient } from 'viem'
+import {
+ formatGwei,
+ parseEther,
+ parseUnits,
+ encodeFunctionData,
+ createWalletClient,
+} from 'viem'
import { mnemonicToAccount } from 'viem/accounts'
import { getChain } from '../../lib/viem/getChain'
import { getChainID } from '../../lib/alchemy/network'
@@ -517,15 +523,13 @@ export function createEvmHandlers(
name: vaultKey,
value: phrase,
})
- await db
- .insert(evmWallets)
- .values({
- id,
- name,
- passwordHash: passwordHash ?? null,
- vaultKey,
- createdAt: new Date().toISOString(),
- })
+ await db.insert(evmWallets).values({
+ id,
+ name,
+ passwordHash: passwordHash ?? null,
+ vaultKey,
+ createdAt: new Date().toISOString(),
+ })
console.log('[rpc] evmCreateWallet complete:', id)
return { id, name, createdAt: new Date().toISOString() }
},
@@ -590,6 +594,7 @@ export function createEvmHandlers(
name: 'alchemy_key',
})
if (!key) throw new Error('API key not set')
+ const _amount = String(amount)
const account = mnemonicToAccount(seed)
const id = getChainID(chainid)
if (!id) throw new Error('Unsupported chain')
@@ -614,7 +619,10 @@ export function createEvmHandlers(
const data = encodeFunctionData({
abi: erc20Abi,
functionName: 'transfer',
- args: [to as `0x${string}`, parseUnits(amount, tokenDecimals)],
+ args: [
+ to as `0x${string}`,
+ parseUnits(_amount, tokenDecimals),
+ ],
})
const hash = await walletClient.sendTransaction({
to: contractAddress as `0x${string}`,
@@ -625,7 +633,7 @@ export function createEvmHandlers(
}
const hash = await walletClient.sendTransaction({
to: to as `0x${string}`,
- value: parseEther(amount),
+ value: parseEther(_amount),
})
return hash
},
diff --git a/apps/desktop/src/lib/components/EvmDashboard.svelte b/apps/desktop/src/lib/components/EvmDashboard.svelte
index d995632..aec68e4 100644
--- a/apps/desktop/src/lib/components/EvmDashboard.svelte
+++ b/apps/desktop/src/lib/components/EvmDashboard.svelte
@@ -6,7 +6,9 @@
} from '$lib/states/evm-wallet.svelte.js'
import { Button } from '$lib/components/ui/button/index.js'
import { Textarea } from '$lib/components/ui/textarea/index.js'
- import { navigate } from 'sv-router/generated'
+import { generateMnemonic } from 'viem/accounts'
+import { english } from 'viem/accounts'
+import { navigate } from 'sv-router/generated'
import {
Card,
CardContent,
@@ -172,14 +174,14 @@
{#if showCreateForm}
{@const cur = w.currentWallet}
- {cur ? `Add Another Wallet` : `Import Wallet`}
+ {cur ? `Add Another Wallet` : `Import / Create Wallet`}
{:else}
- Import Wallet
+ Import / Create Wallet
{/if}
Name your wallet and enter your seed phrase to save it
- securely
+ securely, or generate a new wallet
@@ -192,6 +194,14 @@
+