Added missing block header API (#630)

* header API frontend

* Block Header API endpoint added to Node.js backend

* updated package-lock.json

Co-authored-by: Rishabh <rishabh@Rajeshs-MacBook-Pro.local>
This commit is contained in:
Rishabh
2021-07-19 04:56:16 +05:30
committed by GitHub
parent 853e2fcb8f
commit 2e54f4ca94
8 changed files with 54 additions and 1 deletions

View File

@@ -190,6 +190,26 @@
</ng-template>
</ngb-panel>
<ngb-panel id="blockHeader">
<ng-template ngbPanelTitle>
<span>GET Block Header</span>
</ng-template>
<ng-template ngbPanelContent>
<div class="endpoint">
<div class="subtitle" i18n="Api docs endpoint">Endpoint</div>
<a href="{{ network.val === '' ? '' : '/' + network.val }}/api/block/0000000000000000000065bda8f8a88f2e1e00d9a6887a43d640e52a4c7660f2/header" target="_blank">GET {{ network.val === '' ? '' : '/' + network.val }}/api/block/:hash/header</a>
</div>
<div class="description">
<div class="subtitle" i18n>Description</div>
<div i18n>Returns the hex-encoded block header.</div>
</div>
<app-code-template [code]="code.blockHeader" [network]="network.val" ></app-code-template>
</ng-template>
</ngb-panel>
<ngb-panel id="blockHeight">
<ng-template ngbPanelTitle>
<span>GET Block Height</span>

View File

@@ -175,7 +175,15 @@ export class ApiDocsComponent implements OnInit {
bits: 404111758,
difficulty: 49402014931
}`,
},
},
blockHeader: {
codeSample: {
esModule: `//to be added`,
commonJS: `//to be added`,
curl: `curl -X GET "https://mempool.space/api/block/:hash/header"`,
},
responseSample: `040000202c04d4c450187d1da9b1bc23ba47d67fe028d22486fd0c00000000000000000059a3a33d4642c799af9f54a4dd351fff9130e6a89d4e251130c60064878616e906b5ea60ce9813173a25caf3`,
},
blockHeight: {
codeSample: {
esModule: `const { %{1}: { blocks } } = mempoolJS();

View File

@@ -114,6 +114,11 @@
<td i18n="block.nonce">Nonce</td>
<td>{{ block.nonce | decimal2hex }}</td>
</tr>
<tr>
<td i18n="block.header">Block Header Hex</td>
<td><a target="_blank" href="/api/block/{{block.id}}/header" title="click to view">view</a> </td>
</tr>
</tbody>
</table>
</div>