Skip to content

Commit

Permalink
REST API: Add GetBlockHash API to algod v2 (#4580)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Warehime <[email protected]>
  • Loading branch information
winder and Eric-Warehime authored Sep 26, 2022
1 parent 099392a commit d3c10f4
Show file tree
Hide file tree
Showing 8 changed files with 671 additions and 362 deletions.
69 changes: 69 additions & 0 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,60 @@
}
]
},
"/v2/blocks/{round}/hash": {
"get": {
"produces": [
"application/json"
],
"schemes": [
"http"
],
"summary": "Get the block hash for the block on the given round.",
"operationId": "GetBlockHash",
"parameters": [
{
"minimum": 0,
"type": "integer",
"description": "The round from which to fetch block hash information.",
"name": "round",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/BlockHashResponse"
},
"400": {
"description": "Bad Request - Non integer number",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"401": {
"description": "Invalid API Token",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"404": {
"description": "None existing block ",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "Internal Error",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"default": {
"description": "Unknown Error"
}
}
}
},
"/v2/blocks/{round}/transactions/{txid}/proof": {
"get": {
"produces": [
Expand Down Expand Up @@ -3024,6 +3078,21 @@
}
}
},
"BlockHashResponse": {
"description": "Hash of a block header.",
"schema": {
"type": "object",
"required": [
"blockHash"
],
"properties": {
"blockHash": {
"description": "Block header hash.",
"type": "string"
}
}
}
},
"TransactionProofResponse": {
"description": "Proof of transaction in a block.",
"schema": {
Expand Down
102 changes: 102 additions & 0 deletions daemon/algod/api/algod.oas3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,25 @@
},
"description": "Asset information"
},
"BlockHashResponse": {
"content": {
"application/json": {
"schema": {
"properties": {
"blockHash": {
"description": "Block header hash.",
"type": "string"
}
},
"required": [
"blockHash"
],
"type": "object"
}
}
},
"description": "Hash of a block header."
},
"BlockResponse": {
"content": {
"application/json": {
Expand Down Expand Up @@ -2701,6 +2720,89 @@
"summary": "Get the block for the given round."
}
},
"/v2/blocks/{round}/hash": {
"get": {
"operationId": "GetBlockHash",
"parameters": [
{
"description": "The round from which to fetch block hash information.",
"in": "path",
"name": "round",
"required": true,
"schema": {
"minimum": 0,
"type": "integer"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"blockHash": {
"description": "Block header hash.",
"type": "string"
}
},
"required": [
"blockHash"
],
"type": "object"
}
}
},
"description": "Hash of a block header."
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Bad Request - Non integer number"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Invalid API Token"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "None existing block "
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Error"
},
"default": {
"content": {},
"description": "Unknown Error"
}
},
"summary": "Get the block hash for the block on the given round."
}
},
"/v2/blocks/{round}/lightheader/proof": {
"get": {
"operationId": "GetLightBlockHeaderProof",
Expand Down
Loading

0 comments on commit d3c10f4

Please sign in to comment.