Skip to content
This repository has been archived by the owner on Feb 27, 2021. It is now read-only.

Commit

Permalink
fix: remove old context + fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejonas committed Jun 27, 2019
1 parent 0fe973d commit dbca39b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/containers/Address.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ERPC from "@etclabscore/ethereum-json-rpc";
import { CircularProgress } from "@material-ui/core";
import * as React from "react";
import AddressView from "../components/AddressView";
Expand Down
3 changes: 1 addition & 2 deletions src/containers/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ERPC from "@etclabscore/ethereum-json-rpc";
import { Button, Grid, Typography, CircularProgress } from "@material-ui/core";
import BigNumber from "bignumber.js";
import * as React from "react";
Expand Down Expand Up @@ -87,7 +86,7 @@ export default (props: any) => {
).then((bl) => {
setBlocks(bl);
});
}, [blockNumber, config.blockHistoryLength, erpc]);
}, [blockNumber, erpc]);

React.useEffect(() => {
if (!erpc) { return; }
Expand Down
1 change: 0 additions & 1 deletion src/containers/NodeView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ERPC from "@etclabscore/ethereum-json-rpc";
import { CircularProgress } from "@material-ui/core";
import * as React from "react";
import useMultiGeth from "../erpc";
Expand Down
3 changes: 0 additions & 3 deletions src/containers/Transaction.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import ERPC from "@etclabscore/ethereum-json-rpc";
import { CircularProgress } from "@material-ui/core";
import * as React from "react";
import TxView from "../components/TxView";
import useMultiGeth from "../erpc";
import { useBlockNumber } from "../helpers";

export default function TransactionContainer(props: any) {
const hash = props.match.params.hash;
const [erpc] = useMultiGeth("1.9.1", "mainnet");
const [blockNumber] = useBlockNumber(erpc);
const [transaction, setTransaction] = React.useState();
const [receipt, setReceipt] = React.useState();

Expand Down
23 changes: 12 additions & 11 deletions src/erpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ const serviceName = "multi-geth";

function useMultiGeth(version: string, env: string): [ERPC] {
const [erpc, setErpc] = React.useState();
const runAsync = async () => {
const installed = await serviceRunner.installService(serviceName, version);
const service = await serviceRunner.startService(serviceName, version, env);
setErpc(new ERPC({
transport: {
type: "http",
host: "localhost",
port: parseInt(service.rpcPort, 10),
},
}));
};
React.useEffect(() => {
const runAsync = async () => {
const installed = await serviceRunner.installService(serviceName, version);
if (!installed ) { return; }
const service = await serviceRunner.startService(serviceName, version, env);
setErpc(new ERPC({
transport: {
type: "http",
host: "localhost",
port: parseInt(service.rpcPort, 10),
},
}));
};
runAsync();
}, [version, env]);
return [erpc];
Expand Down

0 comments on commit dbca39b

Please sign in to comment.