Skip to content

Commit

Permalink
a tool to parse tx raw data
Browse files Browse the repository at this point in the history
  • Loading branch information
Eason Smith committed Nov 28, 2024
1 parent cba3ae8 commit 99790d7
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions pages/ethers/parse-tx.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Transaction } from "ethers";
import { TextField, Box, Text, Button } from "@interchain-ui/react";
import { useState } from "react";

export default function ParseTx() {
const [rawTx, setRawTx] = useState("");
const [decodedTx, setDecodedTx] = useState<Transaction | null>(null);

return (
<Box display='flex' padding='20px' flexDirection='column' alignItems='center' justifyContent='center' minHeight='100vh'>
<textarea
value={rawTx}
onChange={(e) => setRawTx(e.target.value)}
placeholder="eth_sendRawTransaction param"
style={{width: '70vw', height: '20vh'}}
/>
<Button onClick={() => {
const decodedTx = Transaction.from(rawTx);
setDecodedTx(decodedTx);
}}
attributes={{
marginTop: '1rem'
}}
>Parse</Button>
{decodedTx&&<Text attributes={{whiteSpace: 'pre-line', padding: '2rem'}} as="div">
{JSON.stringify(decodedTx, null, 2)}
</Text>}
</Box>
)
}

0 comments on commit 99790d7

Please sign in to comment.