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

feat(schema): json schema index #22

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/schema/blockNumber.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Block number",
"schema": {
"title": "hex encoded unsigned integer",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
}
}
8 changes: 8 additions & 0 deletions src/schema/gasPrice.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Gas price",
"schema": {
"title": "Gas price",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
}
}
8 changes: 8 additions & 0 deletions src/schema/gasUsed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Gas used",
"schema": {
"title": "hex encoded unsigned integer",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
}
}
67 changes: 67 additions & 0 deletions src/schema/txprice.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"system": {
"type": "string"
},
"network": {
"type": "string"
},
"unit": {
"type": "string"
},
"maxPrice": {
"type": "number"
},
"currentBlockNumber": {
"type": "number"
},
"msSinceLastBlock": {
"type": "number"
},
"blockPrices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"blockNumber": {
"type": "number"
},
"baseFeePerGas": {
"type": "number"
},
"estimatedTransactionCount": {
"type": "number"
},
"estimatedPrices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"confidence": {
"type": "number"
},
"price": {
"type": "number"
},
"maxPriorityFeePerGas": {
"type": "number"
},
"maxFeePerGas": {
"type": "number"
}
},
"required": [
"confidence",
"price",
"maxPriorityFeePerGas",
"maxFeePerGas"
]
}
}
}
}
}
}
}
8 changes: 8 additions & 0 deletions src/schema/typeChainId.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Chain ID",
"schema": {
"title": "hex encoded unsigned integer",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
}
}
8 changes: 8 additions & 0 deletions src/schema/typeHydratedTransaction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Hydrated transactions",
"required": true,
"schema": {
"title": "hydrated",
"type": "boolean"
}
}
275 changes: 275 additions & 0 deletions src/schema/typeTransaction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
[
{
"name": "Transaction",
"required": true,
"schema": {
"title": "Transaction object with sender",
"type": "object",
"required": [
"from"
],
"oneOf": [
{
"type": "object",
"title": "EIP-1559 transaction.",
"required": [
"type",
"nonce",
"gas",
"value",
"input",
"maxFeePerGas",
"maxPriorityFeePerGas",
"chainId",
"accessList"
],
"properties": {
"type": {
"title": "type",
"type": "string",
"pattern": "^0x([0-9,a-f,A-F]?){1,2}$"
},
"nonce": {
"title": "nonce",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
},
"to": {
"title": "to address",
"type": "string",
"pattern": "^0x[0-9,a-f,A-F]{40}$"
},
"gas": {
"title": "gas limit",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
},
"value": {
"title": "value",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
},
"input": {
"title": "input data",
"type": "string",
"pattern": "^0x[0-9a-f]*$"
},
"maxPriorityFeePerGas": {
"title": "max priority fee per gas",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$",
"description": "Maximum fee per gas the sender is willing to pay to miners in wei"
},
"maxFeePerGas": {
"title": "max fee per gas",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$",
"description": "The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei"
},
"accessList": {
"title": "accessList",
"type": "array",
"description": "EIP-2930 access list",
"items": {
"title": "Access list entry",
"type": "object",
"properties": {
"address": {
"title": "hex encoded address",
"type": "string",
"pattern": "^0x[0-9,a-f,A-F]{40}$"
},
"storageKeys": {
"type": "array",
"items": {
"title": "32 byte hex value",
"type": "string",
"pattern": "^0x[0-9a-f]{64}$"
}
}
}
}
},
"chainId": {
"title": "chainId",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$",
"description": "Chain ID that this transaction is valid on."
}
}
},
{
"type": "object",
"title": "EIP-2930 transaction.",
"required": [
"type",
"nonce",
"gas",
"value",
"input",
"gasPrice",
"chainId",
"accessList"
],
"properties": {
"type": {
"title": "type",
"type": "string",
"pattern": "^0x([0-9,a-f,A-F]?){1,2}$"
},
"nonce": {
"title": "nonce",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
},
"to": {
"title": "to address",
"type": "string",
"pattern": "^0x[0-9,a-f,A-F]{40}$"
},
"gas": {
"title": "gas limit",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
},
"value": {
"title": "value",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
},
"input": {
"title": "input data",
"type": "string",
"pattern": "^0x[0-9a-f]*$"
},
"gasPrice": {
"title": "gas price",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$",
"description": "The gas price willing to be paid by the sender in wei"
},
"accessList": {
"title": "accessList",
"type": "array",
"description": "EIP-2930 access list",
"items": {
"title": "Access list entry",
"type": "object",
"properties": {
"address": {
"title": "hex encoded address",
"type": "string",
"pattern": "^0x[0-9,a-f,A-F]{40}$"
},
"storageKeys": {
"type": "array",
"items": {
"title": "32 byte hex value",
"type": "string",
"pattern": "^0x[0-9a-f]{64}$"
}
}
}
}
},
"chainId": {
"title": "chainId",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$",
"description": "Chain ID that this transaction is valid on."
}
}
},
{
"type": "object",
"title": "Legacy transaction.",
"required": [
"type",
"nonce",
"gas",
"value",
"input",
"gasPrice"
],
"properties": {
"type": {
"title": "type",
"type": "string",
"pattern": "^0x([0-9,a-f,A-F]?){1,2}$"
},
"nonce": {
"title": "nonce",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
},
"to": {
"title": "to address",
"type": "string",
"pattern": "^0x[0-9,a-f,A-F]{40}$"
},
"gas": {
"title": "gas limit",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
},
"value": {
"title": "value",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
},
"input": {
"title": "input data",
"type": "string",
"pattern": "^0x[0-9a-f]*$"
},
"gasPrice": {
"title": "gas price",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$",
"description": "The gas price willing to be paid by the sender in wei"
},
"chainId": {
"title": "chainId",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$",
"description": "Chain ID that this transaction is valid on."
}
}
}
],
"properties": {
"from": {
"title": "from",
"type": "string",
"pattern": "^0x[0-9,a-f,A-F]{40}$"
}
}
}
},
{
"name": "Block",
"required": false,
"schema": {
"title": "Block number or tag",
"oneOf": [
{
"title": "Block number",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
},
{
"title": "Block tag",
"type": "string",
"enum": [
"earliest",
"finalized",
"safe",
"latest",
"pending"
],
"description": "`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; `pending`: A sample next block built by the client on top of `latest` and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error"
}
]
}
}
]