Skip to content

Commit 70c5668

Browse files
authored
Merge pull request #246 from lightclient/convert-to-yaml
Convert spec to yaml
2 parents 1f3d315 + c052895 commit 70c5668

36 files changed

+17956
-11760
lines changed

package-lock.json

Lines changed: 16853 additions & 10118 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"gh-pages": "^4.0.0",
3232
"graphql": "^16.3.0",
3333
"graphql-request": "^4.1.0",
34+
"js-yaml": "^4.1.0",
3435
"json-schema-merge-allof": "^0.8.1"
3536
}
3637
}

scripts/build.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from "fs";
2+
import yaml from "js-yaml";
23
import merger from "json-schema-merge-allof";
34
import { dereferenceDocument } from "@open-rpc/schema-utils-js";
45

@@ -10,7 +11,7 @@ let methodFiles = fs.readdirSync(methodsBase);
1011
methodFiles.forEach(file => {
1112
console.log(file);
1213
let raw = fs.readFileSync(methodsBase + file);
13-
let parsed = JSON.parse(raw);
14+
let parsed = yaml.load(raw);
1415
methods = [
1516
...methods,
1617
...parsed,
@@ -23,7 +24,7 @@ let schemaFiles = fs.readdirSync(schemasBase);
2324
schemaFiles.forEach(file => {
2425
console.log(file);
2526
let raw = fs.readFileSync(schemasBase + file);
26-
let parsed = JSON.parse(raw);
27+
let parsed = yaml.load(raw);
2728
schemas = {
2829
...schemas,
2930
...parsed,

spellcheck.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ matrix:
2222
- pre
2323
- name: json schemas
2424
sources:
25-
- 'src/**/*.json'
25+
- 'src/**/*.yaml'
2626
aspell:
2727
lang: en
2828
d: en_US

src/eth/block.json

Lines changed: 0 additions & 144 deletions
This file was deleted.

src/eth/block.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
- name: eth_getBlockByHash
2+
summary: Returns information about a block by hash.
3+
params:
4+
- name: Block hash
5+
required: true
6+
schema:
7+
$ref: '#/components/schemas/hash32'
8+
- name: Hydrated transactions
9+
required: true
10+
schema:
11+
title: hydrated
12+
type: boolean
13+
result:
14+
name: Block information
15+
schema:
16+
$ref: '#/components/schemas/Block'
17+
- name: eth_getBlockByNumber
18+
summary: Returns information about a block by number.
19+
params:
20+
- name: Block
21+
required: true
22+
schema:
23+
$ref: '#/components/schemas/BlockNumberOrTag'
24+
- name: Hydrated transactions
25+
required: true
26+
schema:
27+
title: hydrated
28+
type: boolean
29+
result:
30+
name: Block information
31+
schema:
32+
$ref: '#/components/schemas/Block'
33+
- name: eth_getBlockTransactionCountByHash
34+
summary: Returns the number of transactions in a block from a block matching the given block hash.
35+
params:
36+
- name: Block hash
37+
schema:
38+
$ref: '#/components/schemas/hash32'
39+
result:
40+
name: Transaction count
41+
schema:
42+
title: Transaction count
43+
type: array
44+
items:
45+
$ref: '#/components/schemas/uint'
46+
- name: eth_getBlockTransactionCountByNumber
47+
summary: Returns the number of transactions in a block matching the given block number.
48+
params:
49+
- name: Block
50+
schema:
51+
$ref: '#/components/schemas/BlockNumberOrTag'
52+
result:
53+
name: Transaction count
54+
schema:
55+
title: Transaction count
56+
type: array
57+
items:
58+
$ref: '#/components/schemas/uint'
59+
- name: eth_getUncleCountByBlockHash
60+
summary: Returns the number of uncles in a block from a block matching the given block hash.
61+
params:
62+
- name: Block hash
63+
schema:
64+
$ref: '#/components/schemas/hash32'
65+
result:
66+
name: Uncle count
67+
schema:
68+
title: Uncle count
69+
type: array
70+
items:
71+
$ref: '#/components/schemas/uint'
72+
- name: eth_getUncleCountByBlockNumber
73+
summary: Returns the number of transactions in a block matching the given block number.
74+
params:
75+
- name: Block
76+
schema:
77+
$ref: '#/components/schemas/BlockNumberOrTag'
78+
result:
79+
name: Uncle count
80+
schema:
81+
title: Uncle count
82+
type: array
83+
items:
84+
$ref: '#/components/schemas/uint'

src/eth/client.json

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/eth/client.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
- name: eth_protocolVersion
2+
summary: Returns the current Ethereum protocol version.
3+
params: []
4+
result:
5+
name: Protocol version
6+
schema:
7+
title: version
8+
type: string
9+
- name: eth_chainId
10+
summary: Returns the chain ID of the current network.
11+
params: []
12+
result:
13+
name: Chain ID
14+
schema:
15+
$ref: '#/components/schemas/uint'
16+
- name: eth_syncing
17+
summary: Returns an object with data about the sync status or false.
18+
params: []
19+
result:
20+
name: Syncing status
21+
schema:
22+
$ref: '#/components/schemas/SyncingStatus'
23+
- name: eth_coinbase
24+
summary: Returns the client coinbase address.
25+
params: []
26+
result:
27+
name: Coinbase address
28+
schema:
29+
$ref: '#/components/schemas/address'
30+
- name: eth_accounts
31+
summary: Returns a list of addresses owned by client.
32+
params: []
33+
result:
34+
name: Accounts
35+
schema:
36+
title: Accounts
37+
type: array
38+
items:
39+
$ref: '#/components/schemas/address'
40+
- name: eth_blockNumber
41+
summary: Returns the number of most recent block.
42+
params: []
43+
result:
44+
name: Block number
45+
schema:
46+
$ref: '#/components/schemas/uint'

0 commit comments

Comments
 (0)