Skip to content

Commit

Permalink
fix: use correct state for sending user ops
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbulma authored and yum0e committed Nov 23, 2023
1 parent 14fd5ac commit 1673878
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions front/src/components/SendTxModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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&currencies=usd")
).json();
Expand All @@ -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,
},
],
Expand Down Expand Up @@ -156,7 +154,7 @@ export default function SendTxModal() {
<>
<CheckCircledIcon height="32" width="100%" color="var(--teal-11)" />
<Link
href={`https://sepolia.etherscan.org/tx/${txReceipt?.receipt?.transactionHash}`}
href={`https://sepolia.etherscan.io/tx/${txReceipt?.receipt?.transactionHash}`}
target="_blank"
style={{ textDecoration: "none" }}
>
Expand All @@ -170,7 +168,7 @@ export default function SendTxModal() {
<>
<CrossCircledIcon height="32" width="100%" />
<Link
href={`https://sepolia.etherscan.org/tx/${txReceipt?.receipt?.transactionHash}`}
href={`https://sepolia.etherscan.io/tx/${txReceipt?.receipt?.transactionHash}`}
target="_blank"
style={{ textDecoration: "none" }}
>
Expand Down

0 comments on commit 1673878

Please sign in to comment.