From 73b90fcd250fc19568ad29e16a5f86f024756c6f Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Fri, 24 Feb 2023 09:44:15 -0500 Subject: [PATCH 1/5] Add skeleton for blocks-bulk endpoint --- .../src/app/docs/api-docs/api-docs-data.ts | 48 +++++++++++++++++++ 1 file changed, 48 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 a6e8e418f..2c3bbc06b 100644 --- a/frontend/src/app/docs/api-docs/api-docs-data.ts +++ b/frontend/src/app/docs/api-docs/api-docs-data.ts @@ -2907,6 +2907,54 @@ export const restApiDocsData = [ } }, ... +]` + }, + codeSampleLiquid: emptyCodeSample, + codeSampleLiquidTestnet: emptyCodeSample, + codeSampleBisq: emptyCodeSample, + } + } + }, + { + type: "endpoint", + category: "blocks", + httpRequestMethod: "GET", + fragment: "get-blocks-bulk", + title: "GET Blocks (Bulk)", + description: { + default: "Returns details on the range of blocks between :minHeight and :maxHeight, inclusive, up to 100 blocks. If :maxHeight is not specified, :maxHeight defaults to the current tip." + }, + urlString: "/v1/blocks-bulk/:minHeight[/:maxHeight]", + showConditions: bitcoinNetworks, + showJsExamples: showJsExamplesDefaultFalse, + codeExample: { + default: { + codeTemplate: { + curl: `/api/v1/blocks-bulk/%{1}/%{2}`, + commonJS: ``, + }, + codeSampleMainnet: { + esModule: [], + commonJS: [], + curl: [730000, 730100], + response: `[ + +]`, + }, + codeSampleTestnet: { + esModule: ['2091187'], + commonJS: ['2091187'], + curl: ['2091187'], + response: `[ + +]` + }, + codeSampleSignet: { + esModule: ['53783'], + commonJS: ['53783'], + curl: ['53783'], + response: `[ + ]` }, codeSampleLiquid: emptyCodeSample, From f057b07021ef7e678dbf929d2b1ee2275adb5afe Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Sat, 25 Feb 2023 02:26:06 -0500 Subject: [PATCH 2/5] Add note for special availability Indicating that api endpoint is only available for enterprise sponsors. --- .../src/app/docs/api-docs/api-docs-data.ts | 1 + .../app/docs/api-docs/api-docs.component.html | 2 ++ .../app/docs/api-docs/api-docs.component.scss | 22 +++++++++++++++++++ frontend/src/app/shared/shared.module.ts | 3 ++- 4 files changed, 27 insertions(+), 1 deletion(-) 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 2c3bbc06b..525e19320 100644 --- a/frontend/src/app/docs/api-docs/api-docs-data.ts +++ b/frontend/src/app/docs/api-docs/api-docs-data.ts @@ -2927,6 +2927,7 @@ export const restApiDocsData = [ urlString: "/v1/blocks-bulk/:minHeight[/:maxHeight]", showConditions: bitcoinNetworks, showJsExamples: showJsExamplesDefaultFalse, + specialAvailability: { enterprise: true }, codeExample: { default: { codeTemplate: { diff --git a/frontend/src/app/docs/api-docs/api-docs.component.html b/frontend/src/app/docs/api-docs/api-docs.component.html index 47332abc3..4687fe0b2 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.html +++ b/frontend/src/app/docs/api-docs/api-docs.component.html @@ -46,6 +46,8 @@
{{ item.title }} {{ item.category }}
+

This endpoint is available to enterprise sponsors.

+

This endpoint is only supported on official mempool.space instances.

Endpoint
diff --git a/frontend/src/app/docs/api-docs/api-docs.component.scss b/frontend/src/app/docs/api-docs/api-docs.component.scss index 92e78bc55..231871db6 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.scss +++ b/frontend/src/app/docs/api-docs/api-docs.component.scss @@ -284,6 +284,28 @@ h3 { margin-bottom: 0; } +.special-availability { + padding: 16px; + margin-bottom: 15px; + background-color: #1d1f31; +} + +.special-availability table tr td:first-child { + padding-right: 10px; +} + +.special-availability.enterprise fa-icon { + color: #ffc107; +} + +.special-availability.mempoolspace fa-icon { + color: #1bd8f4; +} + +.special-availability p { + margin: 0; +} + @media (max-width: 992px) { h3 { diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.ts index fd257db85..46d831309 100644 --- a/frontend/src/app/shared/shared.module.ts +++ b/frontend/src/app/shared/shared.module.ts @@ -4,7 +4,7 @@ import { NgbCollapseModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstra import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome'; import { faFilter, faAngleDown, faAngleUp, faAngleRight, faAngleLeft, faBolt, faChartArea, faCogs, faCubes, faHammer, faDatabase, faExchangeAlt, faInfoCircle, faLink, faList, faSearch, faCaretUp, faCaretDown, faTachometerAlt, faThList, faTint, faTv, faAngleDoubleDown, faSortUp, faAngleDoubleUp, faChevronDown, - faFileAlt, faRedoAlt, faArrowAltCircleRight, faExternalLinkAlt, faBook, faListUl, faDownload, faQrcode, faArrowRightArrowLeft, faArrowsRotate, faCircleLeft } from '@fortawesome/free-solid-svg-icons'; + faFileAlt, faRedoAlt, faArrowAltCircleRight, faExternalLinkAlt, faBook, faListUl, faDownload, faQrcode, faArrowRightArrowLeft, faArrowsRotate, faCircleLeft, faStar } from '@fortawesome/free-solid-svg-icons'; import { InfiniteScrollModule } from 'ngx-infinite-scroll'; import { MasterPageComponent } from '../components/master-page/master-page.component'; import { PreviewTitleComponent } from '../components/master-page-preview/preview-title.component'; @@ -309,5 +309,6 @@ export class SharedModule { library.addIcons(faQrcode); library.addIcons(faArrowRightArrowLeft); library.addIcons(faExchangeAlt); + library.addIcons(faStar); } } From 852513500af5b5fd94415fe6bc842982acf53c3d Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Sun, 26 Feb 2023 03:12:41 -0500 Subject: [PATCH 3/5] Add example responses for blocks-bulk --- .../src/app/docs/api-docs/api-docs-data.ts | 185 +++++++++++++++++- 1 file changed, 175 insertions(+), 10 deletions(-) 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 525e19320..d3d50fe79 100644 --- a/frontend/src/app/docs/api-docs/api-docs-data.ts +++ b/frontend/src/app/docs/api-docs/api-docs-data.ts @@ -2937,25 +2937,190 @@ export const restApiDocsData = [ codeSampleMainnet: { esModule: [], commonJS: [], - curl: [730000, 730100], + curl: [100000,100000], response: `[ - + { + "height": 100000, + "hash": "000000000003ba27aa200b1cecaad478d2b00432346c3f1f3986da1afd33e506", + "timestamp": 1293623863, + "median_timestamp": 1293622620, + "previous_block_hash": "000000000002d01c1fccc21636b607dfd930d31d01c3a62104612a1719011250", + "difficulty": 14484.1623612254, + "header": "0100000050120119172a610421a6c3011dd330d9df07b63616c2cc1f1cd00200000000006657a9252aacd5c0b2940996ecff952228c3067cc38d4885efb5a4ac4247e9f337221b4d4c86041b0f2b5710", + "version": 1, + "bits": 453281356, + "nonce": 274148111, + "size": 957, + "weight": 3828, + "tx_count": 4, + "merkle_root": "f3e94742aca4b5ef85488dc37c06c3282295ffec960994b2c0d5ac2a25a95766", + "reward": 5000000000, + "total_fee_amt": 0, + "avg_fee_amt": 0, + "median_fee_amt": 0, + "fee_amt_percentiles": { + "min": 0, + "perc_10": 0, + "perc_25": 0, + "perc_50": 0, + "perc_75": 0, + "perc_90": 0, + "max": 0 + }, + "avg_fee_rate": 0, + "median_fee_rate": 0, + "fee_rate_percentiles": { + "min": 0, + "perc_10": 0, + "perc_25": 0, + "perc_50": 0, + "perc_75": 0, + "perc_90": 0, + "max": 0 + }, + "total_inputs": 3, + "total_input_amt": 5301000000, + "total_outputs": 6, + "total_output_amt": 5301000000, + "segwit_total_txs": 0, + "segwit_total_size": 0, + "segwit_total_weight": 0, + "avg_tx_size": 185.25, + "utxoset_change": 3, + "utxoset_size": 71888, + "coinbase_raw": "044c86041b020602", + "coinbase_address": null, + "coinbase_signature": "OP_PUSHBYTES_65 041b0e8c2567c12536aa13357b79a073dc4444acb83c4ec7a0e2f99dd7457516c5817242da796924ca4e99947d087fedf9ce467cb9f7c6287078f801df276fdf84 OP_CHECKSIG", + "coinbase_signature_ascii": "\u0004L�\u0004\u001b\u0002\u0006\u0002", + "pool_slug": "unknown", + "orphans": [] + } ]`, }, codeSampleTestnet: { - esModule: ['2091187'], - commonJS: ['2091187'], - curl: ['2091187'], + esModule: [], + commonJS: [], + curl: [100000,100000], response: `[ - + { + "height": 100000, + "hash": "00000000009e2958c15ff9290d571bf9459e93b19765c6801ddeccadbb160a1e", + "timestamp": 1376123972, + "median_timestamp": 1677396660, + "previous_block_hash": "000000004956cc2edd1a8caa05eacfa3c69f4c490bfc9ace820257834115ab35", + "difficulty": 271.7576739288896, + "header": "0200000035ab154183570282ce9afc0b494c9fc6a3cfea05aa8c1add2ecc56490000000038ba3d78e4500a5a7570dbe61960398add4410d278b21cd9708e6d9743f374d544fc055227f1001c29c1ea3b", + "version": 2, + "bits": 469823783, + "nonce": 1005240617, + "size": 221, + "weight": 884, + "tx_count": 1, + "merkle_root": "d574f343976d8e70d91cb278d21044dd8a396019e6db70755a0a50e4783dba38", + "reward": 5000000000, + "total_fee_amt": 0, + "avg_fee_amt": 0, + "median_fee_amt": 0, + "fee_amt_percentiles": { + "min": 0, + "perc_10": 0, + "perc_25": 0, + "perc_50": 0, + "perc_75": 0, + "perc_90": 0, + "max": 0 + }, + "avg_fee_rate": 0, + "median_fee_rate": 0, + "fee_rate_percentiles": { + "min": 0, + "perc_10": 0, + "perc_25": 0, + "perc_50": 0, + "perc_75": 0, + "perc_90": 0, + "max": 0 + }, + "total_inputs": 0, + "total_input_amt": null, + "total_outputs": 1, + "total_output_amt": 0, + "segwit_total_txs": 0, + "segwit_total_size": 0, + "segwit_total_weight": 0, + "avg_tx_size": 0, + "utxoset_change": 1, + "utxoset_size": null, + "coinbase_raw": "03a08601000427f1001c046a510100522cfabe6d6d0000000000000000000068692066726f6d20706f6f6c7365727665726aac1eeeed88", + "coinbase_address": "mtkbaiLiUH3fvGJeSzuN3kUgmJzqinLejJ", + "coinbase_signature": "OP_DUP OP_HASH160 OP_PUSHBYTES_20 912e2b234f941f30b18afbb4fa46171214bf66c8 OP_EQUALVERIFY OP_CHECKSIG", + "coinbase_signature_ascii": "\u0003 �\u0001\u0000\u0004'ñ\u0000\u001c\u0004jQ\u0001\u0000R,ú¾mm\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000hi from poolserverj¬\u001eîí�", + "pool_slug": "unknown", + "orphans": [] + } ]` }, codeSampleSignet: { - esModule: ['53783'], - commonJS: ['53783'], - curl: ['53783'], + esModule: [], + commonJS: [], + curl: [100000,100000], response: `[ - + { + "height": 100000, + "hash": "0000008753108390007b3f5c26e5d924191567e147876b84489b0c0cf133a0bf", + "timestamp": 1658421183, + "median_timestamp": 1658418056, + "previous_block_hash": "000000b962a13c3dd3f81917bc8646a0c98224adcd5124026d4fdfcb76a76d30", + "difficulty": 0.002781447610743506, + "header": "00000020306da776cbdf4f6d022451cdad2482c9a04686bc1719f8d33d3ca162b90000001367fb15320ebb1932fd589f8f38866b692ca8a4ad6100a4bc732d212916d0efbf7fd9628567011e47662d00", + "version": 536870912, + "bits": 503408517, + "nonce": 2975303, + "size": 343, + "weight": 1264, + "tx_count": 1, + "merkle_root": "efd01629212d73bca40061ada4a82c696b86388f9f58fd3219bb0e3215fb6713", + "reward": 5000000000, + "total_fee_amt": 0, + "avg_fee_amt": 0, + "median_fee_amt": 0, + "fee_amt_percentiles": { + "min": 0, + "perc_10": 0, + "perc_25": 0, + "perc_50": 0, + "perc_75": 0, + "perc_90": 0, + "max": 0 + }, + "avg_fee_rate": 0, + "median_fee_rate": 0, + "fee_rate_percentiles": { + "min": 0, + "perc_10": 0, + "perc_25": 0, + "perc_50": 0, + "perc_75": 0, + "perc_90": 0, + "max": 0 + }, + "total_inputs": 0, + "total_input_amt": null, + "total_outputs": 2, + "total_output_amt": 0, + "segwit_total_txs": 0, + "segwit_total_size": 0, + "segwit_total_weight": 0, + "avg_tx_size": 0, + "utxoset_change": 2, + "utxoset_size": null, + "coinbase_raw": "03a08601", + "coinbase_address": "tb1psfjl80vk0yp3agcq6ylueas29rau00mfq90mhejerpgccg33xhasd9gjyd", + "coinbase_signature": "OP_PUSHNUM_1 OP_PUSHBYTES_32 8265f3bd9679031ea300d13fccf60a28fbc7bf69015fbbe65918518c223135fb", + "coinbase_signature_ascii": "\u0003 �\u0001", + "pool_slug": "unknown", + "orphans": [] + } ]` }, codeSampleLiquid: emptyCodeSample, From 54f7e59978bd839baae9490ddd26a13a1f9cabf0 Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Tue, 28 Feb 2023 04:15:45 -0500 Subject: [PATCH 4/5] Correct number of blocks returned for bulk-blocks --- frontend/src/app/docs/api-docs/api-docs-data.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 d3d50fe79..62d031613 100644 --- a/frontend/src/app/docs/api-docs/api-docs-data.ts +++ b/frontend/src/app/docs/api-docs/api-docs-data.ts @@ -2922,12 +2922,11 @@ export const restApiDocsData = [ fragment: "get-blocks-bulk", title: "GET Blocks (Bulk)", description: { - default: "Returns details on the range of blocks between :minHeight and :maxHeight, inclusive, up to 100 blocks. If :maxHeight is not specified, :maxHeight defaults to the current tip." + default: "

Returns details on the range of blocks between :minHeight and :maxHeight, inclusive, up to 10 blocks. If :maxHeight is not specified, it defaults to the current tip.

To return data for more than 10 blocks, consider becoming an enterprise sponsor.

" }, urlString: "/v1/blocks-bulk/:minHeight[/:maxHeight]", showConditions: bitcoinNetworks, showJsExamples: showJsExamplesDefaultFalse, - specialAvailability: { enterprise: true }, codeExample: { default: { codeTemplate: { From 7e093d912b8422595eff2bbf8c54ee40f04d01d1 Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Tue, 28 Feb 2023 04:39:32 -0500 Subject: [PATCH 5/5] Remove special availability note mechanism --- .../app/docs/api-docs/api-docs.component.html | 2 -- .../app/docs/api-docs/api-docs.component.scss | 22 ------------------- frontend/src/app/shared/shared.module.ts | 3 +-- 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/frontend/src/app/docs/api-docs/api-docs.component.html b/frontend/src/app/docs/api-docs/api-docs.component.html index 4687fe0b2..47332abc3 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.html +++ b/frontend/src/app/docs/api-docs/api-docs.component.html @@ -46,8 +46,6 @@
{{ item.title }} {{ item.category }}
-

This endpoint is available to enterprise sponsors.

-

This endpoint is only supported on official mempool.space instances.

Endpoint
diff --git a/frontend/src/app/docs/api-docs/api-docs.component.scss b/frontend/src/app/docs/api-docs/api-docs.component.scss index 231871db6..92e78bc55 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.scss +++ b/frontend/src/app/docs/api-docs/api-docs.component.scss @@ -284,28 +284,6 @@ h3 { margin-bottom: 0; } -.special-availability { - padding: 16px; - margin-bottom: 15px; - background-color: #1d1f31; -} - -.special-availability table tr td:first-child { - padding-right: 10px; -} - -.special-availability.enterprise fa-icon { - color: #ffc107; -} - -.special-availability.mempoolspace fa-icon { - color: #1bd8f4; -} - -.special-availability p { - margin: 0; -} - @media (max-width: 992px) { h3 { diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.ts index 46d831309..fd257db85 100644 --- a/frontend/src/app/shared/shared.module.ts +++ b/frontend/src/app/shared/shared.module.ts @@ -4,7 +4,7 @@ import { NgbCollapseModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstra import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome'; import { faFilter, faAngleDown, faAngleUp, faAngleRight, faAngleLeft, faBolt, faChartArea, faCogs, faCubes, faHammer, faDatabase, faExchangeAlt, faInfoCircle, faLink, faList, faSearch, faCaretUp, faCaretDown, faTachometerAlt, faThList, faTint, faTv, faAngleDoubleDown, faSortUp, faAngleDoubleUp, faChevronDown, - faFileAlt, faRedoAlt, faArrowAltCircleRight, faExternalLinkAlt, faBook, faListUl, faDownload, faQrcode, faArrowRightArrowLeft, faArrowsRotate, faCircleLeft, faStar } from '@fortawesome/free-solid-svg-icons'; + faFileAlt, faRedoAlt, faArrowAltCircleRight, faExternalLinkAlt, faBook, faListUl, faDownload, faQrcode, faArrowRightArrowLeft, faArrowsRotate, faCircleLeft } from '@fortawesome/free-solid-svg-icons'; import { InfiniteScrollModule } from 'ngx-infinite-scroll'; import { MasterPageComponent } from '../components/master-page/master-page.component'; import { PreviewTitleComponent } from '../components/master-page-preview/preview-title.component'; @@ -309,6 +309,5 @@ export class SharedModule { library.addIcons(faQrcode); library.addIcons(faArrowRightArrowLeft); library.addIcons(faExchangeAlt); - library.addIcons(faStar); } }