Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] minor type and syntactic changes #4

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The entire spec is contained in the [schema.json](src/schema.json) file.

```
methods: {
<method name : [ input(s), output(s), minimum required outputs, 'latest' tag default position (if any) ] >,
<method name : [ Array Input(s), Array Output(s), Integer - Minimum required parameters, Boolean - Requires default block parameter]>,
}
```

Expand All @@ -65,7 +65,7 @@ The entire spec is contained in the [schema.json](src/schema.json) file.
```
{
methods: {
"eth_getBalance": [["D20", "Q|T"], "Q", 1, 2],
"eth_getBalance": [["D20", "Q|T"], "Q", 1, true],
...
},
...
Expand All @@ -75,13 +75,22 @@ The entire spec is contained in the [schema.json](src/schema.json) file.
### Primitives:

- "D" : bytes data
- "D8" : bytes data, length 8
- "D20" : bytes data, length 20
- "D32" : bytes data, length 32
- "D60" : bytes data, length 60
- "D256" : bytes data, length 256
- "B" : boolean true or false
- "S" : string data
- "Array|DATA" : either an array of DATA or a single bytes DATA
- "Q" : a number quantity
- "Q|T" : a number quantity or a tag (e.g. 'latest', 'earliest' ...)
- "T" : a block tag (e.g. 'latest', 'earliest' ...)
- "Array|DATA" : either an array of DATA or a single bytes DATA

### Combinations:

- "B|EthSyncing" : boolean or EthSyncing object
- "D32|Transaction" : 32-byte transaction hash or Transaction object
- "Q|T" : number quantity or block tag

Note, post version 0.1.1 value primitives have been compressed.

Expand Down
15 changes: 15 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "digitaldonkey/ethjs-schema",
"description": "Schema file for Ethereum JSON RPC API. See: https://github.com/ethereum/wiki/wiki/JSON-RPC",
"license": "MIT",
"authors": [
{
"name": "Nick Dodson",
"email": "[email protected]"
},
{
"name": "Thorsten Krug",
"email": "[email protected]"
}
]
}
167 changes: 85 additions & 82 deletions src/schema.json
Original file line number Diff line number Diff line change
@@ -1,71 +1,74 @@
{
"primitives": ["D", "D8", "D20", "D32", "D60", "D256", "B", "S", "Q", "T", "Array|D"],
"combinations": ["B|EthSyncing", "D32|Transaction", "Q|T"],
"tags": ["latest", "earliest", "pending"],
"methods": {
"web3_clientVersion": [[], "S"],
"web3_sha3": [["S"], "D", 1],
"net_version": [[], "S"],
"net_peerCount": [[], "Q"],
"net_listening": [[], "B"],
"personal_sign": [["D20", "D", "S"], "D", 2],
"personal_ecRecover": [["D", "D"], "D20", 2],
"eth_protocolVersion": [[], "S"],
"eth_syncing": [[], "Boolean|EthSyncing"],
"eth_coinbase": [[], "D20"],
"eth_mining": [[], "B"],
"eth_hashrate": [[], "Q"],
"eth_gasPrice": [[], "Q"],
"eth_accounts": [[], ["D20"]],
"eth_blockNumber": [[], "Q"],
"eth_getBalance": [["D20", "Q|T"], "Q", 1, 2],
"eth_getStorageAt": [["D20", "Q", "Q|T"], "D", 2, 2],
"eth_getTransactionCount": [["D20", "Q|T"], "Q", 1, 2],
"eth_getBlockTransactionCountByHash": [["D32"], "Q", 1],
"eth_getBlockTransactionCountByNumber": [["Q|T"], "Q", 1],
"eth_getUncleCountByBlockHash": [["D32"], "Q", 1],
"eth_getUncleCountByBlockNumber": [["Q"], "Q", 1],
"eth_getCode": [["D20", "Q|T"], "D", 1, 2],
"eth_sign": [["D20", "D32"], "D", 2],
"eth_sendTransaction": [["SendTransaction"], "D", 1],
"eth_sendRawTransaction": [["D"], "D32", 1],
"eth_call": [["CallTransaction", "Q|T"], "D", 1, 2],
"eth_estimateGas": [["EstimateTransaction", "Q|T"], "Q", 1],
"eth_getBlockByHash": [["D32", "B"], "Block", 2],
"eth_getBlockByNumber": [["Q|T", "B"], "Block", 2],
"eth_getTransactionByHash": [["D32"], "Transaction", 1],
"eth_getTransactionByBlockHashAndIndex": [["D32", "Q"], "Transaction", 2],
"eth_getTransactionByBlockNumberAndIndex": [["Q|T", "Q"], "Transaction", 2],
"eth_getTransactionReceipt": [["D32"], "Receipt", 1],
"eth_getUncleByBlockHashAndIndex": [["D32", "Q"], "Block", 1],
"eth_getUncleByBlockNumberAndIndex": [["Q|T", "Q"], "Block", 2],
"eth_getCompilers": [[], ["S"]],
"eth_compileLLL": [["S"], "D", 1],
"eth_compileSolidity": [["S"], "D", 1],
"eth_compileSerpent": [["S"], "D", 1],
"eth_newFilter": [["Filter"], "Q", 1],
"eth_newBlockFilter": [[], "Q"],
"eth_newPendingTransactionFilter": [[], "Q"],
"eth_uninstallFilter": [["Q"], "B", 1],
"eth_getFilterChanges": [["Q"], ["FilterChange"], 1],
"eth_getFilterLogs": [["Q"], ["FilterChange"], 1],
"eth_getLogs": [["Filter"], ["FilterChange"], 1],
"eth_getWork": [[], ["D"]],
"eth_submitWork": [["D", "D32", "D32"], "B", 3],
"eth_submitHashrate": [["D", "D"], "B", 2],
"db_putString": [["S", "S", "S"], "B", 2],
"db_getString": [["S", "S"], "S", 2],
"db_putHex": [["S", "S", "D"], "B", 2],
"db_getHex": [["S", "S"], "D", 2],
"shh_post": [["SHHPost"], "B", 1],
"shh_version": [[], "S"],
"shh_newIdentity": [[], "D"],
"shh_hasIdentity": [["D"], "B"],
"shh_newGroup": [[], "D"],
"shh_addToGroup": [["D"], "B", 1],
"shh_newFilter": [["SHHFilter"], "Q", 1],
"shh_uninstallFilter": [["Q"], "B", 1],
"shh_getFilterChanges": [["Q"], ["SHHFilterChange"], 1],
"shh_getMessages": [["Q"], ["SHHFilterChange"], 1]
"web3_clientVersion": [[], "S"],
"web3_sha3": [["S"], "D", 1],
"ecrecover": [["D32", "Q", "D32", "D32"], "D20", 4],
"net_version": [[], "S"],
"net_peerCount": [[], "Q"],
"net_listening": [[], "B"],
"personal_sign": [["D", "D20", "S"], "D", 2],
"personal_ecRecover": [["D", "D"], "D20", 2],
"eth_protocolVersion": [[], "S"],
"eth_syncing": [[], "B|EthSyncing"],
"eth_coinbase": [[], "D20"],
"eth_mining": [[], "B"],
"eth_hashrate": [[], "Q"],
"eth_gasPrice": [[], "Q"],
"eth_accounts": [[], ["D20"]],
"eth_blockNumber": [[], "Q"],
"eth_getBalance": [["D20", "Q|T"], "Q", 1, true],
"eth_getStorageAt": [["D20", "Q", "Q|T"], "D", 2, true],
"eth_getTransactionCount": [["D20", "Q|T"], "Q", 1, true],
"eth_getBlockTransactionCountByHash": [["D32"], "Q", 1],
"eth_getBlockTransactionCountByNumber": [["Q|T"], "Q", 1],
"eth_getUncleCountByBlockHash": [["D32"], "Q", 1],
"eth_getUncleCountByBlockNumber": [["Q"], "Q", 1],
"eth_getCode": [["D20", "Q|T"], "D", 1, true],
"eth_sign": [["D20", "D32"], "D", 2],
"eth_sendTransaction": [["SendTransaction"], "D", 1],
"eth_sendRawTransaction": [["D"], "D32", 1],
"eth_call": [["CallTransaction", "Q|T"], "D", 1, true],
"eth_estimateGas": [["EstimateTransaction", "Q|T"], "Q", 1],
"eth_getBlockByHash": [["D32", "B"], "Block", 2],
"eth_getBlockByNumber": [["Q|T", "B"], "Block", 2],
"eth_getTransactionByHash": [["D32"], "Transaction", 1],
"eth_getTransactionByBlockHashAndIndex": [["D32", "Q"], "Transaction", 2],
"eth_getTransactionByBlockNumberAndIndex": [["Q|T", "Q"], "Transaction", 2],
"eth_getTransactionReceipt": [["D32"], "Receipt", 1],
"eth_getUncleByBlockHashAndIndex": [["D32", "Q"], "Block", 1],
"eth_getUncleByBlockNumberAndIndex": [["Q|T", "Q"], "Block", 2],
"eth_getCompilers": [[], ["S"]],
"eth_compileLLL": [["S"], "D", 1],
"eth_compileSolidity": [["S"], "D", 1],
"eth_compileSerpent": [["S"], "D", 1],
"eth_newFilter": [["Filter"], "Q", 1],
"eth_newBlockFilter": [[], "Q"],
"eth_newPendingTransactionFilter": [[], "Q"],
"eth_uninstallFilter": [["Q"], "B", 1],
"eth_getFilterChanges": [["Q"], ["FilterChange"], 1],
"eth_getFilterLogs": [["Q"], ["FilterChange"], 1],
"eth_getLogs": [["Filter"], ["FilterChange"], 1],
"eth_getWork": [[], ["D"]],
"eth_submitWork": [["D", "D32", "D32"], "B", 3],
"eth_submitHashrate": [["D", "D"], "B", 2],
"db_putString": [["S", "S", "S"], "B", 2],
"db_getString": [["S", "S"], "S", 2],
"db_putHex": [["S", "S", "D"], "B", 2],
"db_getHex": [["S", "S"], "D", 2],
"shh_post": [["SHHPost"], "B", 1],
"shh_version": [[], "S"],
"shh_newIdentity": [[], "D60"],
"shh_hasIdentity": [["D60"], "B", 1],
"shh_newGroup": [[], "D60"],
"shh_addToGroup": [["D60"], "B", 1],
"shh_newFilter": [["SHHFilter"], "Q", 1],
"shh_uninstallFilter": [["Q"], "B", 1],
"shh_getFilterChanges": [["Q"], ["SHHFilterChange"], 1],
"shh_getMessages": [["Q"], ["SHHFilterChange"], 1]
},
"tags": ["latest", "earliest", "pending"],
"objects": {
"EthSyncing": {
"__required": [],
Expand Down Expand Up @@ -108,21 +111,21 @@
"number": "Q",
"hash": "D32",
"parentHash": "D32",
"nonce": "D",
"sha3Uncles": "D",
"logsBloom": "D",
"transactionsRoot": "D",
"stateRoot": "D",
"receiptsRoot": "D",
"miner": "D",
"nonce": "D8",
"sha3Uncles": "D32",
"logsBloom": "D256",
"transactionsRoot": "D32",
"stateRoot": "D32",
"receiptsRoot": "D32",
"miner": "D32",
"difficulty": "Q",
"totalDifficulty": "Q",
"extraData": "D",
"size": "Q",
"gasLimit": "Q",
"gasUsed": "Q",
"timestamp": "Q",
"transactions": ["DATA|Transaction"],
"transactions": ["D32|Transaction"],
"uncles": ["D"]
},
"Transaction": {
Expand Down Expand Up @@ -154,7 +157,7 @@
"__required": [],
"fromBlock": "Q|T",
"toBlock": "Q|T",
"address": "Array|Data",
"address": "Array|D",
"topics": ["D"]
},
"FilterChange": {
Expand All @@ -166,28 +169,28 @@
"blockHash": "D32",
"blockNumber": "Q",
"address": "D20",
"data": "Array|DATA",
"topics": ["D"]
"data": "Array|D",
"topics": ["D32"]
},
"SHHPost": {
"__required": ["topics", "payload", "priority", "ttl"],
"from": "D",
"to": "D",
"from": "D60",
"to": "D60",
"topics": ["D"],
"payload": "D",
"priority": "Q",
"ttl": "Q"
},
"SHHFilter": {
"__required": ["topics"],
"to": "D",
"topics": ["D"]
"to": "D60",
"topics": ["Array|D"]
},
"SHHFilterChange": {
"__required": [],
"hash": "D",
"from": "D",
"to": "D",
"from": "D60",
"to": "D60",
"expiry": "Q",
"ttl": "Q",
"sent": "Q",
Expand Down