Skip to content
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
58 changes: 58 additions & 0 deletions rpc-specs-tests/schemas/eth_getBalance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "eth_getBalance",
"title": "eth_getBalance",
"description": "eth_getBalance JSON-RPC method request and response schema.",

"request": {
"id": "#request",
"allOf": [
{ "$ref": "jsonrpc-request.json" },
{ "$ref": "#/definitions/request-obj" }
],
"definitions": {
"request-obj": {
"id": "#request-obj",
"properties": {
"method": {
"type": "string",
"enum": ["eth_getBalance"]
},
"params": {
"type": "array",
"items": [
{
"type": "string",
"description": "DATA, 32 Bytes - Account."
},
{
"type": "string",
"description": "QUANTITY|TAG - integer block number, or the string \"latest\", \"earliest\" or \"pending\""
}
],
"minItems": 2,
"maxItems": 2
}
}
}
}
},
"response": {
"id": "#response",
"allOf": [
{ "$ref": "jsonrpc-response.json" },
{ "$ref": "#/definitions/response-obj" }
],
"definitions": {
"response-obj": {
"id": "#response-obj",
"properties": {
"result": {
"description": "QUANTITY",
"type": "string"
}
}
}
}
}
}
64 changes: 64 additions & 0 deletions rpc-specs-tests/schemas/eth_getStorageAt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "eth_getStorageAt",
"title": "eth_getStorageAt",
"description": "eth_getStorageAt JSON-RPC method request and response schema.",

"request": {
"id": "#request",
"allOf": [
{ "$ref": "jsonrpc-request.json" },
{ "$ref": "#/definitions/request-obj" }
],
"definitions": {
"request-obj": {
"id": "#request-obj",
"properties": {
"method": {
"type": "string",
"enum": ["eth_getStorageAt"]
},
"params": {
"type": "array",
"items": [
{
"type": "string",
"description": "DATA, 32 Bytes - Hash of a block."
},
{
"type": "string",
"description": "QUANTITY- Integer position in the storage."
},
{
"type": "string",
"description": "QUANTITY|TAG - integer block number, or the string \"latest\", \"earliest\" or \"pending\""
}
],
"minItems": 3,
"maxItems": 3
}
}
}
}
},


"response": {
"id": "#response",
"allOf": [
{ "$ref": "jsonrpc-response.json" },
{ "$ref": "#/definitions/response-obj" }
],
"definitions": {
"response-obj": {
"id": "#response-obj",
"properties": {
"result": {
"type": "string"
}
}
}
}
}

}
29 changes: 29 additions & 0 deletions rpc-specs-tests/tests/eth_getBalance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"title" : "eth_getBalance",
"schema": {
"$ref": "../schemas/eth_getBalance.json"
},

"chainConfig" : {
"$ref": "../configs/bcRPC_API_Test.json"
},

"tests": [
{
"title": "eth_getBalance earliest block",
"request" : {
"method" : "eth_getBalance",
"params" : ["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "earliest"]
},
"expectedResponse" : {
"result": "09184e72a000"
},
"asserts": [
{
"description": "response valid",
"program": ".receivedResponse.result != null"
}
]
}
]
}
45 changes: 45 additions & 0 deletions rpc-specs-tests/tests/eth_getStorageAt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"title" : "eth_getStorageAt",
"schema": {
"$ref": "../schemas/eth_getStorageAt.json"
},

"chainConfig" : {
"$ref": "../configs/bcRPC_API_Test.json"
},

"tests": [
{
"title": "eth_getStorageAt latest block with non-zero storage key",
"request" : {
"method" : "eth_getStorageAt",
"params" : ["0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", "0x01", "latest"]
},
"expectedResponse" : {
"result": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee"
},
"asserts": [
{
"description": "response has blockHeader hash",
"program": ".receivedResponse.result != null"
}
]
},
{
"title": "eth_getStorageAt earliest block with zero storage key",
"request" : {
"method" : "eth_getStorageAt",
"params" : ["0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", "0x01", "earliest"]
},
"expectedResponse" : {
"result": "0000000000000000000000000000000000000000000000000000000000000000"
},
"asserts": [
{
"description": "response has blockHeader hash",
"program": ".receivedResponse.result != null"
}
]
}
]
}