Commit c3676134 authored by Igor Stuev's avatar Igor Stuev Committed by GitHub

Merge pull request #1148 from blockscout/tx-revert-reason-hex-no-hex

support no-hex revert reason
parents 24d14e88 9390eb79
export const URL_PREFIX = /^https?:\/\//i;
export const IPFS_PREFIX = /^ipfs:\/\//i;
export const HEX_REGEXP = /^(?:0x)?[\da-fA-F]+$/;
import { Grid, GridItem, useColorModeValue } from '@chakra-ui/react';
import { Grid, GridItem, Text, useColorModeValue } from '@chakra-ui/react';
import React from 'react';
import type { TransactionRevertReason } from 'types/api/transaction';
import hexToUtf8 from 'lib/hexToUtf8';
import { HEX_REGEXP } from 'lib/regexp';
import LogDecodedInputData from 'ui/shared/logs/LogDecodedInputData';
type Props = TransactionRevertReason;
......@@ -12,7 +13,12 @@ const TxRevertReason = (props: Props) => {
const bgColor = useColorModeValue('blackAlpha.50', 'whiteAlpha.50');
if ('raw' in props) {
if (!HEX_REGEXP.test(props.raw)) {
return <Text>{ props.raw }</Text>;
}
const decoded = hexToUtf8(props.raw);
return (
<Grid
bgColor={ bgColor }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment