-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from lightclient/various-fixes
Various fixes
- Loading branch information
Showing
12 changed files
with
144 additions
and
17 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Spellcheck | ||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
build: | ||
name: Spellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- uses: rojopolis/spellcheck-github-actions@0.16.0 | ||
name: Spellcheck |
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,2 +1,5 @@ | ||
node_modules/ | ||
openrpc.json | ||
data.json | ||
schema.json | ||
*.dic |
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,11 +1,60 @@ | ||
# Ethereum JSON-RPC Specification | ||
|
||
[View the spec](https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema[appBar][ui:splitView]=false&uiSchema[appBar][ui:input]=false&uiSchema[appBar][ui:examplesDropdown]=false) | ||
[View the spec][playground] | ||
|
||
The Ethereum JSON-RPC is a collection of methods that all clients implement. | ||
This interface allows downstream tooling and infrastructure to treat different | ||
Ethereum clients as swappable modules. | ||
Ethereum clients as modules that can be swapped at will. | ||
|
||
## Building | ||
|
||
The specification is split into multiple files to improve readability. It | ||
can be compiled the spec into a single document as follows: | ||
|
||
```console | ||
$ npm install | ||
$ npm run build | ||
Build successful. | ||
``` | ||
|
||
This will output the file `openrpc.json` in the root of the project. This file | ||
will have all schema `#ref`s resolved. | ||
|
||
## Contributing | ||
|
||
The specification is written in [OpenRPC](https://open-rpc.org/). | ||
The specification is written in [OpenRPC][openrpc]. Refer to the | ||
OpenRPC specification and the JSON schema specification to get started. | ||
|
||
### Testing | ||
|
||
There are currently three tools for testing contributions. The main two that | ||
run as GitHub actions are an [OpenRPC validator][validator] and a | ||
[spellchecker][spellchecker]: | ||
|
||
```console | ||
$ npm install | ||
$ npm run lint | ||
OpenRPC spec validated successfully. | ||
|
||
$ pip install pyspelling | ||
$ pyspelling -c spellcheck.yaml | ||
Spelling check passed :) | ||
``` | ||
|
||
The third tool can validate a live JSON-RPC provider hosted at | ||
`http://localhost:8545` against the specification: | ||
|
||
```console | ||
$ ./scripts/debug.sh eth_getBlockByNumber \"0xc7d772\",false | ||
data.json valid | ||
``` | ||
|
||
## License | ||
|
||
This repository is licensed under [CC0](LICENSE). | ||
|
||
|
||
[playground]: https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema[appBar][ui:splitView]=false&uiSchema[appBar][ui:input]=false&uiSchema[appBar][ui:examplesDropdown]=false | ||
[openrpc]: https://open-rpc.org | ||
[validator]: https://open-rpc.github.io/schema-utils-js/globals.html#validateopenrpcdocument | ||
[spellchecker]: https://facelessuser.github.io/pyspelling/ |
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,7 @@ | ||
#!/bin/bash | ||
|
||
set -o xtrace | ||
curl -s http://localhost:8545 -H 'Content-Type: application/json' -d '{"method":"'$1'","id":1,"jsonrpc":"2.0", "params":['$2']}' | jq '.["result"]' > data.json 2>&1 | ||
cat openrpc.json | jq '.["methods"][] | select(.name == "'$1'") | .["result"]["schema"]' > schema.json | ||
ajv validate -s schema.json -d data.json | ||
# rm schema.json data.json |
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,33 @@ | ||
matrix: | ||
- name: markdown | ||
sources: | ||
- '**/*.md|!node_modules/**' | ||
aspell: | ||
lang: en | ||
d: en_US | ||
ignore-case: true | ||
dictionary: | ||
wordlists: | ||
- wordlist.txt | ||
encoding: utf-8 | ||
pipeline: | ||
- pyspelling.filters.markdown: | ||
- pyspelling.filters.html: | ||
comments: false | ||
ignores: | ||
- code | ||
- pre | ||
- name: json schemas | ||
sources: | ||
- 'src/**/*.json' | ||
aspell: | ||
lang: en | ||
d: en_US | ||
run-together: true | ||
run-together-min: 2 | ||
run-together-limit: 256 | ||
dictionary: | ||
wordlists: | ||
- wordlist.txt | ||
encoding: utf-8 | ||
pipeline: null |
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apis | ||
bytecode | ||
eip | ||
enum | ||
eth | ||
ethereum | ||
json | ||
npm | ||
ommers | ||
openrpc | ||
params | ||
pre | ||
pyspelling | ||
rlp | ||
rpc | ||
schemas | ||
secp | ||
sha | ||
uint | ||
url | ||
validator | ||
wei | ||
yaml | ||
yParity |