'use client'
import { withdraw } from 'privacycash-evm'
import { useAccount } from 'wagmi'
export function WithdrawButton() {
const { address } = useAccount()
const handleWithdraw = async () => {
if (!address) return
const signature = localStorage.getItem(`evm_sign_${address}`)
if (!signature) {
alert('Please sign in first.')
return
}
const recipient = '0xRECIPIENT_ADDRESS'
const txHash = await withdraw({
withdrawAmountInput: 0.05, // Total including fees
recipient,
keyBasePath: '/circuit',
signature,
address,
})
console.log('Withdraw tx:', txHash)
}
return <button onClick={handleWithdraw}>Withdraw 0.05 ETH</button>
}