Skip to content

Commit

Permalink
fix(molecules/decoded-tx): fetching error
Browse files Browse the repository at this point in the history
  • Loading branch information
jagnani73 committed Jan 30, 2024
1 parent bc910ab commit 85e9a36
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export const DecodedTransactionView: React.FC<DecodedTransactionProps> = ({
return chains?.find((o) => o.name === chain_name) ?? null;
}, [chains, chain_name]);

useEffect(() => {
setResult(None);
}, [chain_name, tx_hash]);

useEffect(() => {
(async () => {
try {
Expand All @@ -52,10 +56,15 @@ export const DecodedTransactionView: React.FC<DecodedTransactionProps> = ({
method: "POST",
}
);
const { events } = (await response.json()) as {
events: DecodedEventType[];
const data = (await response.json()) as {
success: boolean;
message?: string;
events?: DecodedEventType[];
};
setResult(new Some(events));
if (!data.success) {
throw Error(data.message);
}
setResult(new Some(data.events!));
} catch (exception) {
console.error(exception);
setResult(new Some([]));
Expand Down

0 comments on commit 85e9a36

Please sign in to comment.