From dfbf62f4f87072d163aa0090560e89ed389a5d92 Mon Sep 17 00:00:00 2001 From: "lightclient@protonmail.com" Date: Fri, 30 Jul 2021 16:55:58 +0200 Subject: [PATCH 1/6] add full tx param to block getters --- src/methods/block.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/methods/block.json b/src/methods/block.json index 2ca1443b699..bc98386a241 100644 --- a/src/methods/block.json +++ b/src/methods/block.json @@ -9,6 +9,11 @@ "schema": { "$ref": "#/components/schemas/hash32" } + }, + { + "name": "Full transactions", + "required": true, + "type": "boolean" } ], "result": { @@ -28,6 +33,11 @@ "schema": { "$ref": "#/components/schemas/uint" } + }, + { + "name": "Full transactions", + "required": true, + "type": "boolean" } ], "result": { From 27b113b1bd20d5405c4c69f70fbbd8a5d5a0d685 Mon Sep 17 00:00:00 2001 From: "lightclient@protonmail.com" Date: Fri, 30 Jul 2021 17:46:17 +0200 Subject: [PATCH 2/6] add hydrated tx option for blocks --- scripts/build.js | 2 +- src/methods/block.json | 10 ++++++++-- src/schemas/block.json | 21 ++++++++++++++++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/scripts/build.js b/scripts/build.js index da7cceb4a49..d7a9116dfc7 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,6 +1,6 @@ import fs from "fs"; -console.log("Loading files..."); +console.log("Loading files...\n"); let methods = []; let methodsBase = "src/methods/"; diff --git a/src/methods/block.json b/src/methods/block.json index bc98386a241..58e1e903bc3 100644 --- a/src/methods/block.json +++ b/src/methods/block.json @@ -13,7 +13,10 @@ { "name": "Full transactions", "required": true, - "type": "boolean" + "schema": { + "title": "fullTx", + "type": "boolean" + } } ], "result": { @@ -37,7 +40,10 @@ { "name": "Full transactions", "required": true, - "type": "boolean" + "schema": { + "title": "fullTx", + "type": "boolean" + } } ], "result": { diff --git a/src/schemas/block.json b/src/schemas/block.json index a4de59d46ee..dfe886a374f 100644 --- a/src/schemas/block.json +++ b/src/schemas/block.json @@ -93,11 +93,22 @@ "allOf": [ { "$ref": "#/components/schemas/Header" }, { - "title": "transactions", - "type": "array", - "items": { - "$ref": "#/components/schemas/hash32" - } + "oneOf": [ + { + "title": "transactions", + "type": "array", + "items": { + "$ref": "#/components/schemas/hash32" + } + }, + { + "title": "transactions", + "type": "array", + "items": { + "$ref": "#/components/schemas/SignedTransaction" + } + } + ] }, { "title": "uncles", From df094331c16f35a73affaec1466268379e021a03 Mon Sep 17 00:00:00 2001 From: "lightclient@protonmail.com" Date: Fri, 30 Jul 2021 19:01:12 +0200 Subject: [PATCH 3/6] inner elements should be objects --- src/schemas/block.json | 45 ++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/schemas/block.json b/src/schemas/block.json index dfe886a374f..03fb155af4a 100644 --- a/src/schemas/block.json +++ b/src/schemas/block.json @@ -93,28 +93,39 @@ "allOf": [ { "$ref": "#/components/schemas/Header" }, { - "oneOf": [ - { - "title": "transactions", + "title": "Transactions", + "type": "object", + "properties": { + "transactions": { + "oneOf": [ + { + "title": "transactions", + "type": "array", + "items": { + "$ref": "#/components/schemas/hash32" + } + }, + { + "title": "transactions", + "type": "array", + "items": { + "$ref": "#/components/schemas/SignedTransaction" + } + } + ] + } + } + }, + { + "type": "object", + "properties": { + "uncles": { + "title": "uncles", "type": "array", "items": { "$ref": "#/components/schemas/hash32" } - }, - { - "title": "transactions", - "type": "array", - "items": { - "$ref": "#/components/schemas/SignedTransaction" - } } - ] - }, - { - "title": "uncles", - "type": "array", - "items": { - "$ref": "#/components/schemas/hash32" } } ] From 10758d9011f5e8103393769ea566577dc0213119 Mon Sep 17 00:00:00 2001 From: "lightclient@protonmail.com" Date: Fri, 30 Jul 2021 19:14:41 +0200 Subject: [PATCH 4/6] consolidate header and block schemas; add missing fields size and difficulty --- src/schemas/block.json | 83 +++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 45 deletions(-) diff --git a/src/schemas/block.json b/src/schemas/block.json index 03fb155af4a..ec4c35f271d 100644 --- a/src/schemas/block.json +++ b/src/schemas/block.json @@ -1,6 +1,6 @@ { - "Header": { - "title": "Header object", + "Block": { + "title": "Block object", "type": "object", "required": [ "parentHash", @@ -17,7 +17,10 @@ "timestamp", "extraData", "mixHash", - "nonce" + "nonce", + "size", + "transactions", + "uncles" ], "properties": { "parentHash": { @@ -40,15 +43,15 @@ "title": "Transactions root", "$ref": "#/components/schemas/hash32" }, - "receiptRoot": { + "receiptsRoot": { "title": "Receipts root", "$ref": "#/components/schemas/hash32" }, - "bloom": { + "logsBloom": { "title": "Bloom filter", "$ref": "#/components/schemas/bytes256" }, - "totalDifficulty": { + "difficulty": { "title": "Difficulty", "$ref": "#/components/schemas/bytes" }, @@ -77,58 +80,48 @@ "$ref": "#/components/schemas/hash32" }, "nonce": { - "title": "nonce", + "title": "Nonce", "$ref": "#/components/schemas/bytes" }, + "totalDifficulty": { + "title": "Total difficult", + "$ref": "#/components/schemas/uint" + }, "baseFeePerGas": { "title": "Base fee per gas", "$ref": "#/components/schemas/uint" - } - } - }, - "Block": { - "title": "Block object", - "type": "object", - "required": ["transactions", "uncles"], - "allOf": [ - { "$ref": "#/components/schemas/Header" }, - { - "title": "Transactions", - "type": "object", - "properties": { - "transactions": { - "oneOf": [ - { - "title": "transactions", - "type": "array", - "items": { - "$ref": "#/components/schemas/hash32" - } - }, - { - "title": "transactions", - "type": "array", - "items": { - "$ref": "#/components/schemas/SignedTransaction" - } - } - ] - } - } }, - { - "type": "object", - "properties": { - "uncles": { - "title": "uncles", + "size": { + "title": "Block size", + "$ref": "#/components/schemas/uint" + }, + "transactions": { + "oneOf": [ + { + "title": "transactions", "type": "array", "items": { "$ref": "#/components/schemas/hash32" } + }, + { + "title": "transactions", + "type": "array", + "items": { + "$ref": "#/components/schemas/SignedTransaction" + } } + ] + }, + "uncles": { + "title": "Uncles", + "type": "array", + "items": { + "$ref": "#/components/schemas/hash32" } } - ] + + } }, "BlockTag": { "title": "Block tag", From 31f90225944916e93d9c1377e73d38744c84ac89 Mon Sep 17 00:00:00 2001 From: "lightclient@protonmail.com" Date: Fri, 30 Jul 2021 19:16:46 +0200 Subject: [PATCH 5/6] fix titles --- src/schemas/block.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/schemas/block.json b/src/schemas/block.json index ec4c35f271d..7ab76dad989 100644 --- a/src/schemas/block.json +++ b/src/schemas/block.json @@ -98,14 +98,14 @@ "transactions": { "oneOf": [ { - "title": "transactions", + "title": "Transaction hashes", "type": "array", "items": { "$ref": "#/components/schemas/hash32" } }, { - "title": "transactions", + "title": "Full transactions", "type": "array", "items": { "$ref": "#/components/schemas/SignedTransaction" From 09e8e1d7b499abad1f841e2bec832827e86ecddc Mon Sep 17 00:00:00 2001 From: "lightclient@protonmail.com" Date: Fri, 30 Jul 2021 19:19:09 +0200 Subject: [PATCH 6/6] remove extra newline --- src/schemas/block.json | 1 - 1 file changed, 1 deletion(-) diff --git a/src/schemas/block.json b/src/schemas/block.json index 7ab76dad989..d9ee1225858 100644 --- a/src/schemas/block.json +++ b/src/schemas/block.json @@ -120,7 +120,6 @@ "$ref": "#/components/schemas/hash32" } } - } }, "BlockTag": {