Prettier formatting

pull/58/head
Neeraj Kashyap 2021-08-03 10:47:31 -07:00
rodzic b20a95b0ac
commit a6069b6c11
5 zmienionych plików z 73 dodań i 62 usunięć

Wyświetl plik

@ -30,12 +30,11 @@ const StreamEntry = ({ entry, filterCallback, filterConstants }) => {
} else if (copyString) { } else if (copyString) {
onCopy(); onCopy();
} }
}, [copyString, onCopy, hasCopied, toast]); }, [copyString, onCopy, hasCopied, toast]);
const handleViewClicked = (entryId) => { const handleViewClicked = (entryId) => {
ui.setEntryId(entryId); ui.setEntryId(entryId);
ui.setEntriesViewMode("entry"); ui.setEntriesViewMode("entry");
useTxCashe.setCurrentTransaction(entry) useTxCashe.setCurrentTransaction(entry);
router.push({ router.push({
pathname: `/stream/${entry.hash}`, pathname: `/stream/${entry.hash}`,
query: router.query, query: router.query,

Wyświetl plik

@ -51,8 +51,8 @@ const TxABI = (props) => {
const TxInfo = (props) => { const TxInfo = (props) => {
const transaction = props.transaction; const transaction = props.transaction;
const dont_display = (key) => { const dont_display = (key) => {
return !["input"].includes(key) return !["input"].includes(key);
} };
return ( return (
<Box boxShadow="xs" p="6" rounded="md"> <Box boxShadow="xs" p="6" rounded="md">
<StatGroup> <StatGroup>
@ -73,25 +73,25 @@ const TxInfo = (props) => {
</Stat> </Stat>
</StatGroup> </StatGroup>
<Table variant="simple" > <Table variant="simple">
<Tbody> <Tbody>
{Object.keys(transaction.tx).filter(dont_display).map((key) => ( {Object.keys(transaction.tx)
(transaction.tx[key] != undefined && <Tr key = {key}> .filter(dont_display)
.map(
(key) =>
transaction.tx[key] != undefined && (
<Tr key={key}>
<Td>{key}</Td> <Td>{key}</Td>
<Td>{transaction.tx[key]}</Td> <Td>{transaction.tx[key]}</Td>
</Tr>) </Tr>
))} )
)}
</Tbody> </Tbody>
</Table> </Table>
{transaction.tx.input && transaction.tx.input !== "0x" && {transaction.tx.input && transaction.tx.input !== "0x" && (
<TxABI <TxABI byteCode={transaction.tx.input} abi={transaction.abi} />
byteCode={transaction.tx.input} )}
abi={transaction.abi}
/>
}
</Box> </Box>
);
};
)
}
export default TxInfo; export default TxInfo;

Wyświetl plik

@ -20,5 +20,5 @@ export { default as useStripe } from "./useStripe";
export { default as useSubscriptions } from "./useSubscriptions"; export { default as useSubscriptions } from "./useSubscriptions";
export { default as useToast } from "./useToast"; export { default as useToast } from "./useToast";
export { default as useTxInfo } from "./useTxInfo"; export { default as useTxInfo } from "./useTxInfo";
export { default as useTxCashe } from "./useTxCache" export { default as useTxCashe } from "./useTxCache";
export { default as useUser } from "./useUser"; export { default as useUser } from "./useUser";

Wyświetl plik

@ -1,7 +1,11 @@
class TxCashe { class TxCashe {
currentTransaction = undefined currentTransaction = undefined;
getCurrentTransaction(){return this.currentTransaction} getCurrentTransaction() {
setCurrentTransaction(transaction){ this.currentTransaction = transaction} return this.currentTransaction;
}
setCurrentTransaction(transaction) {
this.currentTransaction = transaction;
}
} }
const useTxCashe = new TxCashe(); const useTxCashe = new TxCashe();
export default useTxCashe; export default useTxCashe;

Wyświetl plik

@ -4,14 +4,22 @@ import { queryCacheProps } from "./hookCommon";
import { useToast } from "."; import { useToast } from ".";
const useTxInfo = (transaction) => { const useTxInfo = (transaction) => {
if (!transaction.tx) return {data: "undefined", isLoading: false, isFetchedAfterMount: true, refetch: false, isError: true, error: "undefined"} if (!transaction.tx)
return {
data: "undefined",
isLoading: false,
isFetchedAfterMount: true,
refetch: false,
isError: true,
error: "undefined",
};
const toast = useToast(); const toast = useToast();
const getTxInfo = async () => { const getTxInfo = async () => {
const response = await TxInfoService.getTxInfo(transaction); const response = await TxInfoService.getTxInfo(transaction);
return response.data; return response.data;
} };
const { data, isLoading, isFetchedAfterMount, refetch, isError, error } = const { data, isLoading, isFetchedAfterMount, refetch, isError, error } =
useQuery(["txinfo", transaction.tx.hash ], getTxInfo, { useQuery(["txinfo", transaction.tx.hash], getTxInfo, {
...queryCacheProps, ...queryCacheProps,
onError: (error) => toast(error, "error"), onError: (error) => toast(error, "error"),
}); });