= (props) => {
+ const history = useHistory();
+ const darkMode = useDarkMode();
+ const { block } = props;
+
+ return (
+
+
+
+
+ );
+};
+
+export default BlockRaw;
diff --git a/src/components/BlockRaw/index.ts b/src/components/BlockRaw/index.ts
new file mode 100644
index 00000000..d6fcc924
--- /dev/null
+++ b/src/components/BlockRaw/index.ts
@@ -0,0 +1,2 @@
+import BlockRaw from "./BlockRaw";
+export default BlockRaw;
diff --git a/src/components/BlockView/BlockView.tsx b/src/components/BlockView/BlockView.tsx
index 661008e4..9724c1c3 100644
--- a/src/components/BlockView/BlockView.tsx
+++ b/src/components/BlockView/BlockView.tsx
@@ -4,11 +4,13 @@ import Link from "@material-ui/core/Link";
import TxList from "../TxList";
import { hexToDate, hexToString, hexToNumber } from "@etclabscore/eserialize";
import { useTranslation } from "react-i18next";
+import { useHistory } from "react-router-dom";
-import { Table, TableBody, TableCell, TableRow } from "@material-ui/core";
+import { Table, TableBody, TableCell, TableRow, Button } from "@material-ui/core";
function BlockView(props: any) {
const { block } = props;
+ const history = useHistory();
const { t } = useTranslation();
if (!block) {
@@ -22,6 +24,12 @@ function BlockView(props: any) {
return (
+
@@ -31,7 +39,7 @@ function BlockView(props: any) {
{t("Timestamp")}
- {t("Timestamp Date", { date: hexToDate(timestamp)})}
+ {t("Timestamp Date", { date: hexToDate(timestamp) })}
@@ -100,7 +108,7 @@ function BlockView(props: any) {
-
+ div >
);
}
diff --git a/src/components/TxRaw/TxRaw.tsx b/src/components/TxRaw/TxRaw.tsx
new file mode 100644
index 00000000..4ac601fd
--- /dev/null
+++ b/src/components/TxRaw/TxRaw.tsx
@@ -0,0 +1,70 @@
+import React from "react";
+import { useHistory } from "react-router-dom";
+import { Button, Typography } from "@material-ui/core";
+import Editor from "@monaco-editor/react";
+import useDarkMode from "use-dark-mode";
+import { ObjectUAh7GW7V as ITransaction} from "@etclabscore/ethereum-json-rpc";
+
+interface IProps {
+ tx: ITransaction;
+ receipt: any;
+}
+
+const TxRaw: React.FC = (props) => {
+ const history = useHistory();
+ const darkMode = useDarkMode();
+ const { tx, receipt } = props;
+
+ return (
+
+
+
+ Transaction
+
+
+
+ Receipt
+
+
+
+ );
+};
+
+export default TxRaw;
diff --git a/src/components/TxView/TxView.tsx b/src/components/TxView/TxView.tsx
index 612efa15..fbdac209 100644
--- a/src/components/TxView/TxView.tsx
+++ b/src/components/TxView/TxView.tsx
@@ -1,10 +1,10 @@
import * as React from "react";
import { Link as RouterLink } from "react-router-dom";
import Link from "@material-ui/core/Link";
-import { Table, TableBody, TableCell, TableRow } from "@material-ui/core";
+import { Table, TableBody, TableCell, TableRow, Typography, Button } from "@material-ui/core";
import { hexToNumber } from "@etclabscore/eserialize";
import { useTranslation } from "react-i18next";
-import i18next from "i18next";
+import { useHistory } from "react-router-dom";
const unit = require("ethjs-unit"); //tslint:disable-line
@@ -13,10 +13,23 @@ export interface ITxViewProps {
receipt: any | null;
}
-function renderTxTable(tx: any, receipt: any | null, t: i18next.TFunction) {
+function TxView(props: ITxViewProps) {
+ const { tx, receipt } = props;
+ const { t } = useTranslation();
+ const history = useHistory();
+ if (!tx) {
+ return null;
+ }
+
return (
-
General
+
+
Transaction
@@ -121,7 +134,8 @@ function renderTxTable(tx: any, receipt: any | null, t: i18next.TFunction) {
-
Receipt
+
+
Receipt
{receipt &&
@@ -220,14 +234,4 @@ function renderTxTable(tx: any, receipt: any | null, t: i18next.TFunction) {
);
}
-function TxView(props: ITxViewProps) {
- const { tx, receipt } = props;
- const { t } = useTranslation();
- if (!tx) {
- return null;
- }
-
- return renderTxTable(tx, receipt, t);
-}
-
export default TxView;
diff --git a/src/containers/BlockRawContainer.tsx b/src/containers/BlockRawContainer.tsx
new file mode 100644
index 00000000..d5e82b0c
--- /dev/null
+++ b/src/containers/BlockRawContainer.tsx
@@ -0,0 +1,17 @@
+import { CircularProgress } from "@material-ui/core";
+import useMultiGethStore from "../stores/useMultiGethStore";
+import * as React from "react";
+import EthereumJSONRPC from "@etclabscore/ethereum-json-rpc";
+import BlockRaw from "../components/BlockRaw";
+
+export default function BlockRawContainer(props: any) {
+ const { match: { params: { hash } } } = props;
+ const [erpc]: [EthereumJSONRPC] = useMultiGethStore();
+ const [block, setBlock] = React.useState();
+ React.useEffect(() => {
+ if (!erpc) { return; }
+ erpc.eth_getBlockByHash(hash, true).then(setBlock);
+ }, [hash, erpc]);
+ if (!block) { return (); }
+ return ();
+}
diff --git a/src/containers/TransactionRawContainer.tsx b/src/containers/TransactionRawContainer.tsx
new file mode 100644
index 00000000..914c8f7e
--- /dev/null
+++ b/src/containers/TransactionRawContainer.tsx
@@ -0,0 +1,28 @@
+import { CircularProgress } from "@material-ui/core";
+import * as React from "react";
+import useMultiGethStore from "../stores/useMultiGethStore";
+import EthereumJSONRPC from "@etclabscore/ethereum-json-rpc";
+import TxRaw from "../components/TxRaw/TxRaw";
+
+export default function TransactionRawContainer(props: any) {
+ const hash = props.match.params.hash;
+ const [erpc]: [EthereumJSONRPC] = useMultiGethStore();
+ const [transaction, setTransaction] = React.useState();
+ const [receipt, setReceipt] = React.useState();
+
+ React.useEffect(() => {
+ if (!erpc) { return; }
+ erpc.eth_getTransactionByHash(hash).then(setTransaction);
+ }, [hash, erpc]);
+
+ React.useEffect(() => {
+ if (!erpc) { return; }
+ erpc.eth_getTransactionReceipt(hash).then(setReceipt);
+ }, [hash, erpc]);
+
+ if (!transaction || !receipt) {
+ return ();
+ }
+
+ return ();
+}