add evm send with native and erc-20 token support

This commit is contained in:
2026-05-29 00:33:56 +08:00
parent 9e579f957d
commit 44a91428fc
7 changed files with 285 additions and 9 deletions
@@ -487,6 +487,11 @@
{/if}
<div class="flex gap-2 flex-wrap">
<Button
variant="outline"
onclick={() => navigate('/multicoin/send')}>
Send
</Button>
<Button
variant="outline"
onclick={() => navigate('/settings')}>
+2
View File
@@ -117,6 +117,7 @@ export type TransactionDetails = {
export type TokenBalanceResult = {
symbol: string
decimals: number
balance: string
contractAddress: string
logo?: string
@@ -163,6 +164,7 @@ export type EvmRpcRequests = {
evmListWallets: { params: {}; response: EvmWalletInfo[] }
evmGetSeed: { params: { vaultKey: string }; response: string }
evmDeleteWallet: { params: { id: string }; response: void }
evmSendTransfer: { params: { seed: string; to: string; amount: string; chainid: string; contractAddress?: string; tokenDecimals?: number }; response: string }
}
export type MoneroRpcRequests = {
@@ -39,6 +39,7 @@ export type NetworkId = (typeof networks)[number]['id']
export type TokenBalance = {
symbol: string
decimals: number
balance: string
contractAddress: string
logo?: string
@@ -406,6 +407,25 @@ export const EvmWallet = () => {
transactions = txs ?? []
}
const send = async (
to: string,
amount: string,
contractAddress?: string,
tokenDecimals?: number,
) => {
if (!electrobun.rpc || !seed) throw new Error('Wallet not unlocked')
const hash = await electrobun.rpc.request.evmSendTransfer({
seed,
to,
amount,
chainid: net().chainid,
contractAddress,
tokenDecimals,
})
await refresh()
return hash
}
const lock = () => {
clearWallet()
}
@@ -531,6 +551,7 @@ export const EvmWallet = () => {
unlockWallet,
deleteWallet,
clearSelection,
send,
syncTxHistory,
setAutoSync,
flushTxCache,