This repository has been archived by the owner on Feb 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: get stable erpc fetching for pages
- Loading branch information
1 parent
e8f21cf
commit a855187
Showing
13 changed files
with
2,265 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
# dependencies | ||
/node_modules | ||
/services | ||
|
||
# testing | ||
/coverage | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
{ | ||
"$schema": "./lib/service-runner-schema.json", | ||
"services": [ | ||
{ | ||
"name": "multi-geth", | ||
"rpcPort": "${DYNAMIC_TCP_PORT_1}", | ||
"version": "1.9.2", | ||
"environments": [{ | ||
"name": "mainnet", | ||
"args": { | ||
"start": [ | ||
"--classic", | ||
"--datadir", | ||
"${SERVICE_DIR}/multi-geth/1.9.0/classic", | ||
"--rpc", | ||
"--rpcport", | ||
"${DYNAMIC_TCP_PORT_1}", | ||
"--rpccorsdomain", | ||
"*" | ||
], | ||
"stop": [], | ||
"teardown": [] | ||
}, | ||
"health": { | ||
"interval": 20000, | ||
"retries": 5, | ||
"port": "${DYNAMIC_TCP_PORT_1}", | ||
"protocol": "tcp" | ||
} | ||
}, | ||
{ | ||
"name": "kotti", | ||
"args": { | ||
"start": [ | ||
"--kotti", | ||
"--datadir", | ||
"${SERVICE_DIR}/multi-geth/1.9.0/kotti", | ||
"--rpc", | ||
"--rpcport", | ||
"${DYNAMIC_TCP_PORT_1}", | ||
"--rpcaddr", | ||
"localhost", | ||
"--rpccorsdomain", | ||
"*" | ||
], | ||
"stop": [], | ||
"teardown": [] | ||
}, | ||
"health": { | ||
"interval": 20000, | ||
"retries": 5, | ||
"port": "${DYNAMIC_TCP_PORT_1}", | ||
"protocol": "tcp" | ||
} | ||
}, | ||
{ | ||
"name": "dev", | ||
"args": { | ||
"start": [ | ||
"--dev", | ||
"--datadir", | ||
"${SERVICE_DIR}/multi-geth/1.9.0/dev", | ||
"--rpc", | ||
"--rpcport", | ||
"${DYNAMIC_TCP_PORT_1}", | ||
"--rpccorsdomain", | ||
"*" | ||
], | ||
"stop": [], | ||
"teardown": [] | ||
}, | ||
"health": { | ||
"interval": 20000, | ||
"retries": 5, | ||
"port": "${DYNAMIC_TCP_PORT_1}", | ||
"protocol": "tcp" | ||
} | ||
}, | ||
{ | ||
"name": "ethereum", | ||
"args": { | ||
"start": [ | ||
"--datadir", | ||
"${SERVICE_DIR}/multi-geth/1.9.0/ethereum", | ||
"--rpc", | ||
"--rpcport", | ||
"${DYNAMIC_TCP_PORT_1}", | ||
"--rpccorsdomain", | ||
"*" | ||
], | ||
"stop": [], | ||
"teardown": [] | ||
}, | ||
"health": { | ||
"interval": 20000, | ||
"retries": 5, | ||
"port": "${DYNAMIC_TCP_PORT_1}", | ||
"protocol": "tcp" | ||
} | ||
}, | ||
{ | ||
"name": "goerli", | ||
"args": { | ||
"start": [ | ||
"--goerli", | ||
"--datadir", | ||
"${SERVICE_DIR}/multi-geth/1.9.0/goerli", | ||
"--rpc", | ||
"--rpcport", | ||
"${DYNAMIC_TCP_PORT_1}", | ||
"--rpccorsdomain", | ||
"*" | ||
], | ||
"stop": [], | ||
"teardown": [] | ||
}, | ||
"health": { | ||
"interval": 20000, | ||
"retries": 5, | ||
"port": "${DYNAMIC_TCP_PORT_1}", | ||
"protocol": "tcp" | ||
} | ||
}, | ||
{ | ||
"name": "rinkeby", | ||
"args": { | ||
"start": [ | ||
"--rinkeby", | ||
"--datadir", | ||
"${SERVICE_DIR}/multi-geth/1.9.0/rinkeby", | ||
"--rpc", | ||
"--rpcport", | ||
"${DYNAMIC_TCP_PORT_1}", | ||
"--rpccorsdomain", | ||
"*" | ||
], | ||
"stop": [], | ||
"teardown": [] | ||
}, | ||
"health": { | ||
"interval": 20000, | ||
"retries": 5, | ||
"port": "${DYNAMIC_TCP_PORT_1}", | ||
"protocol": "tcp" | ||
} | ||
} | ||
], | ||
"os": { | ||
"osx": { | ||
"commands": { | ||
"setup": [ | ||
{ | ||
"cmd": "chmod", | ||
"args": [ | ||
"+x", | ||
"${SERVICE_DIR}/geth" | ||
] | ||
} | ||
], | ||
"start": "${SERVICE_DIR}/geth", | ||
"stop": "", | ||
"teardown": "" | ||
}, | ||
"assets": [ | ||
"https://github.com/multi-geth/multi-geth/releases/download/v1.9.2/multi-geth-osx.zip" | ||
] | ||
}, | ||
"linux": { | ||
"commands": { | ||
"setup": [], | ||
"start": "geth", | ||
"stop": "", | ||
"teardown": "" | ||
}, | ||
"assets": [ | ||
"https://github.com/multi-geth/multi-geth/releases/download/v1.9.2/multi-geth-linux.zip" | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import { CircularProgress } from "@material-ui/core"; | ||
import * as React from "react"; | ||
import usePromise from "react-use-promise"; | ||
import BlockView from "../components/BlockView"; | ||
import erpc from "../erpc"; | ||
|
||
export default function Block(props: any) { | ||
const { match: { params: { hash } } } = props; | ||
const [block, error, state] = usePromise(() => erpc.eth_getBlockByHash(hash, true), [hash]); | ||
const { erpc, match: { params: { hash } } } = props; | ||
const [block, error, state] = usePromise(() => { | ||
if (!erpc) { return; } | ||
return erpc.eth_getBlockByHash(hash, true); | ||
}, [hash]); | ||
if (error) { return (<div> Error: {error} </div>); } | ||
if (!block) { return; } | ||
if (!block) { return (<CircularProgress />); } | ||
return (<BlockView block={block} />); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import ERPC from "@etclabscore/ethereum-json-rpc"; | ||
import { CircularProgress } from "@material-ui/core"; | ||
import * as React from "react"; | ||
import { useBlockNumber } from "../helpers"; | ||
import BlockList from "./BlockList"; | ||
|
||
import usePromise from "react-use-promise"; | ||
import erpc from "../erpc"; | ||
|
||
export default function NodeView(props: any) { | ||
const [blockNumber, error, state] = usePromise(() => erpc.eth_blockNumber(), []); | ||
export default function NodeView({erpc}: {erpc: ERPC}) { | ||
const [blockNumber] = useBlockNumber(erpc); | ||
if (!blockNumber) { | ||
return (<CircularProgress />); | ||
} | ||
return ( | ||
<BlockList from={Math.max(parseInt(blockNumber, 16) - 15, 0)} to={parseInt(blockNumber, 16)} /> | ||
<BlockList from={Math.max(blockNumber - 15, 0)} to={blockNumber} erpc={erpc}/> | ||
); | ||
} |
Oops, something went wrong.