From 9ff006e61ef1f7b822e4580b1af89b307c05172b Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Thu, 2 Jun 2022 18:08:09 -0400 Subject: [PATCH] Update /api/blocks in docs (bisq) --- .../src/app/docs/api-docs/api-docs-data.ts | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/frontend/src/app/docs/api-docs/api-docs-data.ts b/frontend/src/app/docs/api-docs/api-docs-data.ts index d05dbd4c7..eb98c6596 100644 --- a/frontend/src/app/docs/api-docs/api-docs-data.ts +++ b/frontend/src/app/docs/api-docs/api-docs-data.ts @@ -2946,6 +2946,86 @@ export const restApiDocsData = [ } } }, + { + type: "endpoint", + category: "blocks", + httpRequestMethod: "GET", + fragment: "get-blocks", + title: "GET Blocks", + description: { + default: "

Returns the past n blocks with BSQ transactions starting m blocks ago.

Assume a block height of 700,000. Query /blocks/0/10 for the past 10 blocks before 700,000 with BSQ transactions. Query /blocks/1000/10 for the past 10 blocks before 699,000 with BSQ transactions." + }, + urlString: "/blocks/:m/:n", + showConditions: ["bisq"], + showJsExamples: showJsExamplesDefault, + codeExample: { + default: { + codeTemplate: { + curl: `/api/blocks/%{1}/%{2}`, + commonJS: ` + const { %{0}: { blocks } } = mempoolJS(); + + const getBlocks = await blocks.getBlocks({ index: %{1}, length: %{2} }); + + document.getElementById("result").textContent = JSON.stringify(getBlocks, undefined, 2); + `, + esModule: ` + const { %{0}: { blocks } } = mempoolJS(); + + const getBlocks = await blocks.getBlocks({ index: %{1}, length: %{2} }); + console.log(getBlocks); + `, + }, + codeSampleMainnet: emptyCodeSample, + codeSampleTestnet: emptyCodeSample, + codeSampleSignet: emptyCodeSample, + codeSampleLiquid: emptyCodeSample, + codeSampleLiquidTestnet: emptyCodeSample, + codeSampleBisq: { + esModule: ['0', '5'], + commonJS: ['0', '5'], + curl: ['0', '5'], + response: `[ + { + "height": 739030, + "time": 1654203258000, + "hash": "000000000000000000036bc04416ddeec264cbb977a9cd9e454897acb547b601", + "previousBlockHash": "00000000000000000000f49261617b589d76e5e70529ea1d4c16f3e19ddcb8ef", + "txs": [ ... ], + }, + { + "height": 739029, + "time": 1654203236000, + "hash": "00000000000000000000f49261617b589d76e5e70529ea1d4c16f3e19ddcb8ef", + "previousBlockHash": "00000000000000000008dd87e9486cd0d71c5d84e452432bab33c2a0cbaa31ce", + "txs": [ ... ], + }, + { + "height": 739025, + "time": 1654199569000, + "hash": "000000000000000000021e9ce82dec208af75807f92a9b1d9dae91f2b4d40e24", + "previousBlockHash": "00000000000000000002db644c025a76464b466d25900402452b07213b30c40b", + "txs": [ ... ] + }, + { + "height": 739023, + "time": 1654198597000, + "hash": "0000000000000000000702ce10250a46bea4155ca7acb869f3ea92c1e3a68bc5", + "previousBlockHash": "00000000000000000002b3d6c1adc5676262ded84181982f88dbd357b9f9d1ec", + "txs": [ ... ] + }, + { + "height": 739020, + "time": 1654197263000, + "hash": "000000000000000000046eb46ad941028381d3534c35658f9c80de0641dbbb31", + "previousBlockHash": "000000000000000000073f1c49b4c4895f3fa6b866d1e21ab8b22f3f9318b42f", + "txs": [ ... ] + } +]` + }, + } + } + }, { type: "category", category: "mining",