From 16738780a914a77d1ecea20678f8cc36ab0b159f Mon Sep 17 00:00:00 2001 From: Benjamin A Date: Thu, 23 Nov 2023 23:11:55 +0100 Subject: [PATCH] fix: use correct state for sending user ops --- front/src/components/SendTxModal/index.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/front/src/components/SendTxModal/index.tsx b/front/src/components/SendTxModal/index.tsx index 206de61..62f1306 100644 --- a/front/src/components/SendTxModal/index.tsx +++ b/front/src/components/SendTxModal/index.tsx @@ -107,9 +107,6 @@ export default function SendTxModal() { e.preventDefault(); try { - const formData = new FormData(e.target as HTMLFormElement); - const address = formData?.get("address") as Hex; - const usdAmount = formData?.get("amount") as `${number}`; const price: { ethereum: { usd: number } } = await ( await fetch("/api/price?ids=ethereum¤cies=usd") ).json(); @@ -118,9 +115,10 @@ export default function SendTxModal() { const userOp = await builder.buildUserOp({ calls: [ { - dest: address.toLowerCase() as Hex, + dest: destination.toLowerCase() as Hex, value: - (BigInt(usdAmount) * BigInt(1e18)) / (BigInt(price.ethereum.usd * 100) / BigInt(100)), // 100 is the price precision + (BigInt(userInputAmount) * BigInt(1e18)) / + (BigInt(price.ethereum.usd * 100) / BigInt(100)), // 100 is the price precision data: emptyHex, }, ], @@ -156,7 +154,7 @@ export default function SendTxModal() { <> @@ -170,7 +168,7 @@ export default function SendTxModal() { <>