From 455412d2a0fc0688c7fb983e66ae5d05b3402d2a Mon Sep 17 00:00:00 2001
From: hunicus <93150691+hunicus@users.noreply.github.com>
Date: Mon, 16 May 2022 16:14:03 -0400
Subject: [PATCH 1/4] Add mining api docs
---
.../src/app/docs/api-docs/api-docs-data.ts | 1148 ++++++++++++++++-
1 file changed, 1130 insertions(+), 18 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 b0d4d1c4f..4f916fc06 100644
--- a/frontend/src/app/docs/api-docs/api-docs-data.ts
+++ b/frontend/src/app/docs/api-docs/api-docs-data.ts
@@ -1,5 +1,6 @@
const bitcoinNetworks = ["", "testnet", "signet"];
const liquidNetworks = ["liquid", "liquidtestnet"];
+const miningTimeIntervals = "24h
, 3d
, 1w
, 1m
, 3m
, 6m
, 1y
, 2y
, 3y
";
const emptyCodeSample = {
esModule: [],
@@ -1734,7 +1735,7 @@ export const restApiDocsData = [
fragment: "get-block",
title: "GET Block",
description: {
- default: "Returns details about a block. Available fields: id
, height
, version
, timestamp
, bits
, nonce
, merkle_root
, tx_count
, size
, weight
, and previousblockhash
.",
+ default: "Returns details about a block.",
liquid: "Returns details about a block. Available fields: id
, height
, version
, timestamp
, bits
, nonce
, merkle_root
, tx_count
, size
, weight
,proof
, and previousblockhash
."
},
urlString: "/block/:hash",
@@ -1764,19 +1765,54 @@ export const restApiDocsData = [
commonJS: ['000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce'],
curl: ['000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce'],
response: `{
- id: "000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce",
- height: 363366,
- version: 2,
- timestamp: 1435766771,
- tx_count: 494,
- size: 286494,
- weight: 1145976,
- merkle_root: "9d3cb87bf05ebae366b4262ed5f768ce8c62fc385c3886c9cb097647b04b686c",
- previousblockhash: "000000000000000010c545b6fa3ef1f7cf45a2a8760b1ee9f2e89673218207ce",
- mediantime: 1435763435,
- nonce: 2892644888,
- bits: 404111758,
- difficulty: 49402014931
+ "extras": {
+ "reward": 638307429,
+ "coinbaseTx": {
+ "vin": [
+ {
+ "scriptsig": "03ad3e0b2cfabe6d6df8fb5429a5de5fc2bd1bafffbc90d33c77eb73307d51931d247f21d7bccde51710000000f09f909f092f4632506f6f6c2f6b0000000000000000000000000000000000000000000000000000000000000000000000050086411100"
+ }
+ ],
+ "vout": [
+ {
+ "scriptpubkey_address": "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY",
+ "value": 638307429
+ }
+ ]
+ },
+ "coinbaseRaw": "03ad3e0b2cfabe6d6df8fb5429a5de5fc2bd1bafffbc90d33c77eb73307d51931d247f21d7bccde51710000000f09f909f092f4632506f6f6c2f6b0000000000000000000000000000000000000000000000000000000000000000000000050086411100",
+ "medianFee": 10,
+ "feeRange": [
+ 1,
+ 8,
+ 9,
+ 10,
+ 15,
+ 21,
+ 348
+ ],
+ "totalFees": 13307429,
+ "avgFee": 5591,
+ "avgFeeRate": 13,
+ "pool": {
+ "id": 36,
+ "name": "F2Pool",
+ "slug": "f2pool"
+ },
+ "matchRate": 93
+ },
+ "id": "00000000000000000007566f8f035a1dc38b351e6f54778b311fe6dbabd79b46",
+ "height": 736941,
+ "version": 536870916,
+ "timestamp": 1652891466,
+ "bits": 386466234,
+ "nonce": 3514220842,
+ "difficulty": 31251101365711.12,
+ "merkle_root": "4a3072f98f60cbb639bb7f46180b8843d17c7502627ffb633db0ed86610cdd71",
+ "tx_count": 2381,
+ "size": 1709571,
+ "weight": 3997770,
+ "previousblockhash": "00000000000000000005ef14db0b4befcbbe1e9b8676eec67fcf810a899c4d5e"
}`
},
codeSampleTestnet: {
@@ -2602,9 +2638,9 @@ export const restApiDocsData = [
fragment: "get-blocks",
title: "GET Blocks",
description: {
- default: "Returns the 10 newest blocks starting at the tip or at :start_height
if specified."
+ default: "Returns details on the past 10 blocks. If :startHeight
is specified, the past 10 blocks before (and including) :startHeight
are returned."
},
- urlString: "/blocks[/:start_height]",
+ urlString: "/blocks[/:startHeight]",
showConditions: bitcoinNetworks.concat(liquidNetworks).concat(["bisq"]),
codeExample: {
bisq: {
@@ -2649,14 +2685,14 @@ export const restApiDocsData = [
commonJS: `
const { %{0}: { blocks } } = mempoolJS();
- const getBlocks = await blocks.getBlocks({ start_height: %{1} });
+ const getBlocks = await blocks.getBlocks({ startHeight: %{1} });
document.getElementById("result").textContent = JSON.stringify(getBlocks, undefined, 2);
`,
esModule: `
const { %{0}: { blocks } } = mempoolJS();
- const getBlocks = await blocks.getBlocks({ start_height: %{1} });
+ const getBlocks = await blocks.getBlocks({ startHeight: %{1} });
console.log(getBlocks);
`,
},
@@ -2773,6 +2809,1082 @@ export const restApiDocsData = [
}
}
},
+ {
+ type: "endpoint",
+ category: "blocks",
+ httpRequestMethod: "GET",
+ fragment: "get-blocks-extras",
+ title: "GET Blocks Extras",
+ description: {
+ default: "Returns details on the past 15 blocks with fee and mining details in an extras
field. If :startHeight
is specified, the past 15 blocks before (and including) :startHeight
are returned."
+ },
+ urlString: "/blocks[/:startHeight]",
+ showConditions: bitcoinNetworks,
+ codeExample: {
+ default: {
+ codeTemplate: {
+ curl: `/api/blocks-extras/%{1}`,
+ commonJS: ``,
+ esModule: ``
+ },
+ codeSampleMainnet: {
+ esModule: [],
+ commonJS: [],
+ curl: ['736915'],
+ response: `[
+ {
+ "extras": {
+ "reward": 629766074,
+ "coinbaseTx": {
+ "vin": [
+ {
+ "scriptsig": "03933e0b215c204d41524120506f6f6c205c00000000be82a250e5ef942790d2542ca87d0000"
+ }
+ ],
+ "vout": [
+ {
+ "scriptpubkey_address": "1A32KFEX7JNPmU1PVjrtiXRrTQcesT3Nf1",
+ "value": 629766074
+ }
+ ]
+ },
+ "coinbaseRaw": "03933e0b215c204d41524120506f6f6c205c00000000be82a250e5ef942790d2542ca87d0000",
+ "medianFee": 14,
+ "feeRange": [
+ 1,
+ 1,
+ 4,
+ 14,
+ 15,
+ 20,
+ 364
+ ],
+ "totalFees": 4766074,
+ "avgFee": 5043,
+ "avgFeeRate": 14,
+ "pool": {
+ "id": 115,
+ "name": "MARA Pool",
+ "slug": "marapool"
+ },
+ "matchRate": 100
+ },
+ "id": "00000000000000000000a742ae476dbe2a58c48b193484945c52b05967f2d74c",
+ "height": 736915,
+ "version": 541065216,
+ "timestamp": 1652877171,
+ "bits": 386466234,
+ "nonce": 4069175824,
+ "difficulty": 31251101365711.12,
+ "merkle_root": "de54fd1adee9f010534e8efbf1244a01528e20dd283c8927026f5442c3e03459",
+ "tx_count": 946,
+ "size": 524907,
+ "weight": 1362339,
+ "previousblockhash": "000000000000000000070760a253405ca69498464d9f8e9fab2452cbbfc10cbe"
+ },
+ {
+ "extras": {
+ "reward": 638804415,
+ "coinbaseTx": {
+ "vin": [
+ {
+ "scriptsig": "03923e0bfabe6d6dc3e96cee3cb68ee52bd31fde8e1f4983a780ea836115788d81a559e03791071f01000000000000001065040008d708c7010000000000007a6d4683012f736c7573682f"
+ }
+ ],
+ "vout": [
+ {
+ "scriptpubkey_address": "1CK6KHY6MHgYvmRQ4PAafKYDrg1ejbH1cE",
+ "value": 638804415
+ }
+ ]
+ },
+ "coinbaseRaw": "03923e0bfabe6d6dc3e96cee3cb68ee52bd31fde8e1f4983a780ea836115788d81a559e03791071f01000000000000001065040008d708c7010000000000007a6d4683012f736c7573682f",
+ "medianFee": 14,
+ "feeRange": [
+ 1,
+ 1,
+ 2,
+ 14,
+ 15,
+ 20,
+ 347
+ ],
+ "totalFees": 13804415,
+ "avgFee": 5287,
+ "avgFeeRate": 14,
+ "pool": {
+ "id": 43,
+ "name": "SlushPool",
+ "slug": "slushpool"
+ },
+ "matchRate": 100
+ },
+ "id": "000000000000000000070760a253405ca69498464d9f8e9fab2452cbbfc10cbe",
+ "height": 736914,
+ "version": 555696132,
+ "timestamp": 1652876939,
+ "bits": 386466234,
+ "nonce": 3839610443,
+ "difficulty": 31251101365711.12,
+ "merkle_root": "dc6d15f641e7af26dbaf3ee37203155f8053a8755e85f4955d11ea0c54008b16",
+ "tx_count": 2612,
+ "size": 1450209,
+ "weight": 3931749,
+ "previousblockhash": "00000000000000000002b5b2afc1c62e61e53f966b965a9a8ce99112e24066ae"
+ },
+ ...
+]`,
+ codeSampleTestnet: emptyCodeSample,
+ codeSampleSignet: emptyCodeSample,
+ codeSampleLiquid: emptyCodeSample,
+ codeSampleLiquidTestnet: emptyCodeSample,
+ codeSampleBisq: emptyCodeSample,
+ }
+ }
+ }
+ },
+ {
+ type: "category",
+ category: "mining",
+ fragment: "mining",
+ title: "Mining",
+ showConditions: bitcoinNetworks
+ },
+ {
+ type: "endpoint",
+ category: "mining",
+ httpRequestMethod: "GET",
+ fragment: "get-mining-pools",
+ title: "GET Mining Pools",
+ description: {
+ default: "Returns a list of all known mining pools ordered by blocks found over the specified trailing :timePeriod
.
Leave :timePeriod
unspecified to get all available data, or specify one of the following values: " + miningTimeIntervals + "."
+ },
+ urlString: "/v1/mining/pools/[:timePeriod]",
+ showConditions: bitcoinNetworks,
+ codeExample: {
+ default: {
+ codeTemplate: {
+ curl: `/api/v1/mining/pools/1w`,
+ commonJS: ``,
+ esModule: ``
+ },
+ codeSampleMainnet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `{
+ "pools": [
+ {
+ "poolId": 111,
+ "name": "Foundry USA",
+ "link": "https://foundrydigital.com/",
+ "blockCount": 194,
+ "rank": 1,
+ "emptyBlocks": 0,
+ "slug": "foundryusa"
+ },
+ {
+ "poolId": 36,
+ "name": "F2Pool",
+ "link": "https://www.f2pool.com/",
+ "blockCount": 154,
+ "rank": 2,
+ "emptyBlocks": 0,
+ "slug": "f2pool"
+ },
+ {
+ "poolId": 44,
+ "name": "AntPool",
+ "link": "https://www.antpool.com/",
+ "blockCount": 138,
+ "rank": 3,
+ "emptyBlocks": 0,
+ "slug": "antpool"
+ },
+ ...
+ "oldestIndexedBlockTimestamp": 1231006505,
+ "blockCount": 1005,
+ "lastEstimatedHashrate": 230086716765559200000
+}`
+ },
+ codeSampleTestnet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `[
+ {
+
+ }
+]`
+ },
+ codeSampleSignet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `[
+ {
+
+ }
+]`
+ },
+ codeSampleLiquid: emptyCodeSample,
+ codeSampleLiquidTestnet: emptyCodeSample,
+ codeSampleBisq: emptyCodeSample,
+ }
+ }
+ },
+ {
+ type: "endpoint",
+ category: "mining",
+ httpRequestMethod: "GET",
+ fragment: "get-mining-pool",
+ title: "GET Mining Pool",
+ description: {
+ default: "
Returns details about the specified mining pool.
" + }, + urlString: "/v1/mining/pool/:slug", + showConditions: bitcoinNetworks, + codeExample: { + default: { + codeTemplate: { + curl: `/api/v1/mining/pool/slushpool`, + commonJS: ``, + esModule: `` + }, + codeSampleMainnet: { + esModule: [], + commonJS: [], + curl: [], + response: `{ + "pool": { + "id": 43, + "name": "SlushPool", + "link": "https://slushpool.com/", + "addresses": [ + "1CK6KHY6MHgYvmRQ4PAafKYDrg1ejbH1cE", + "1AqTMY7kmHZxBuLUR5wJjPFUvqGs23sesr" + ], + "regexes": [ + "/slush/" + ], + "slug": "slushpool" + }, + "blockCount": { + "all": 679, + "24h": 8, + "1w": 56 + }, + "blockShare": { + "all": 0.06015770355275981, + "24h": 0.05333333333333334, + "1w": 0.055666003976143144 + }, + "estimatedHashrate": 12448077385930390000, + "reportedHashrate": null +}` + }, + codeSampleTestnet: { + esModule: [], + commonJS: [], + curl: [], + response: `[ + { + + } +]` + }, + codeSampleSignet: { + esModule: [], + commonJS: [], + curl: [], + response: `[ + { + + } +]` + }, + codeSampleLiquid: emptyCodeSample, + codeSampleLiquidTestnet: emptyCodeSample, + codeSampleBisq: emptyCodeSample, + } + } + }, + { + type: "endpoint", + category: "mining", + httpRequestMethod: "GET", + fragment: "get-mining-pool-hashrates", + title: "GET Mining Pool Hashrates", + description: { + default: "Returns average hashrates (and share of total hashrate) of mining pools active in the specified trailing :timePeriod
, in descending order of hashrate.
Leave :timePeriod
unspecified to get all available data, or specify any of the following time periods: " + miningTimeIntervals + ".
:blockHeight
. If no :blockHeight
is specified, the mining pool's 10 most recent blocks are returned."
+ },
+ urlString: "/v1/mining/pool/:slug/blocks/[:blockHeight]",
+ showConditions: bitcoinNetworks,
+ codeExample: {
+ default: {
+ codeTemplate: {
+ curl: `/api/v1/mining/pool/luxor/blocks/730000`,
+ commonJS: ``,
+ esModule: ``
+ },
+ codeSampleMainnet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `[
+ {
+ "id": "0000000000000000000572c6eb693c51b728593139079c613c8ea0bc6384e362",
+ "timestamp": 1648778242,
+ "height": 729910,
+ "version": 536895488,
+ "bits": 386521239,
+ "nonce": 1708647181,
+ "difficulty": 28587155782195.14,
+ "merkle_root": "729be37fb4b1bff0ca2e4b572e5dc3fb57e5aa57a8a400f8c89d4993d05c204f",
+ "tx_count": 1808,
+ "size": 1595444,
+ "weight": 3992846,
+ "previousblockhash": "00000000000000000000034e117bb9922da36adc6393fabfe9ed97c7bb38998c",
+ "extras": {
+ "coinbaseRaw": "0336230b315c20506f7765726564206279204c75786f722054656368205c000000002103a960b06341e200000e744596150000000000",
+ "medianFee": 1,
+ "reward": 628988802,
+ "totalFees": 3988802,
+ "pool": {
+ "id": 4
+ }
+ }
+ },
+ {
+ "id": "00000000000000000009b6d122d9e2299d2f9cda13274a9f024bebe52ef96a59",
+ "timestamp": 1648717740,
+ "height": 729820,
+ "version": 536870912,
+ "bits": 386521239,
+ "nonce": 1608169168,
+ "difficulty": 28587155782195.14,
+ "merkle_root": "4f67e65e8e5e554cd4a8d0f91aa63b5e8686817984eb8188af5fb39958263f5d",
+ "tx_count": 1425,
+ "size": 729585,
+ "weight": 1954155,
+ "previousblockhash": "000000000000000000006441657fa1eea37d68784ebd86dc1cd7f89251130f56",
+ "extras": {
+ "coinbaseRaw": "03dc220b315c20506f7765726564206279204c75786f722054656368205c00000000e5ae4908ac1f20df00000410c830000000000000",
+ "medianFee": 8,
+ "reward": 630138805,
+ "totalFees": 5138805,
+ "pool": {
+ "id": 4
+ }
+ }
+ },
+ {
+ "id": "0000000000000000000796834c03bd3be474bfa895146a58015f5ff325ef50c0",
+ "timestamp": 1648653948,
+ "height": 729714,
+ "version": 549453824,
+ "bits": 386547904,
+ "nonce": 883606929,
+ "difficulty": 27452707696466.39,
+ "merkle_root": "45593907e5fa0dee743d2f9194b0923a800cb6313e66221a86bf51df388e012c",
+ "tx_count": 1709,
+ "size": 1434271,
+ "weight": 3993013,
+ "previousblockhash": "000000000000000000000fbfac1a91cdeaf64d689f7673d02613da9d10bfb284",
+ "extras": {
+ "coinbaseRaw": "0372220b315c20506f7765726564206279204c75786f722054656368205c0000000063349a9b3d185fed000007e7092a000000000000",
+ "medianFee": 3,
+ "reward": 632350743,
+ "totalFees": 7350743,
+ "pool": {
+ "id": 4
+ }
+ }
+ },
+ ...
+]`
+ },
+ codeSampleTestnet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `[
+ {
+
+ }
+]`
+ },
+ codeSampleSignet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `[
+ {
+
+ }
+]`
+ },
+ codeSampleLiquid: emptyCodeSample,
+ codeSampleLiquidTestnet: emptyCodeSample,
+ codeSampleBisq: emptyCodeSample,
+ }
+ }
+ },
+ {
+ type: "endpoint",
+ category: "mining",
+ httpRequestMethod: "GET",
+ fragment: "get-hashrate",
+ title: "GET Hashrate",
+ description: {
+ default: "Returns network-wide hashrate and difficulty figures over the specified trailing :timePeriod
:
Valid values for :timePeriod
are " + miningTimeIntervals + ". If no time interval is specified, all available data is returned.
Be sure that INDEXING_BLOCKS_AMOUNT
is set properly in your backend config so that enough blocks are indexed to properly serve your request.
blockCount
blocks."
+ },
+ urlString: "/v1/mining/reward-stats/:blockCount",
+ showConditions: bitcoinNetworks,
+ codeExample: {
+ default: {
+ codeTemplate: {
+ curl: `/api/v1/mining/reward-stats/100`,
+ commonJS: ``,
+ esModule: ``
+ },
+ codeSampleMainnet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `{
+ "startBlock": 736556,
+ "endBlock": 736655,
+ "totalReward": "63811748254",
+ "totalFee": "1311748254",
+ "totalTx": "164216"
+}`
+ },
+ codeSampleTestnet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `[
+ {
+
+ }
+]`
+ },
+ codeSampleSignet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `[
+ {
+
+ }
+]`
+ },
+ codeSampleLiquid: emptyCodeSample,
+ codeSampleLiquidTestnet: emptyCodeSample,
+ codeSampleBisq: emptyCodeSample,
+ }
+ }
+ },
+ {
+ type: "endpoint",
+ category: "mining",
+ httpRequestMethod: "GET",
+ fragment: "get-block-fees",
+ title: "GET Block Fees",
+ description: {
+ default: "Returns average total fees for blocks in the specified :timePeriod
, ordered oldest to newest. :timePeriod
can be any of the following: " + miningTimeIntervals + ".
For 24h
and 3d
time periods, every block is included and fee amounts are exact (not averages). For the 1w
time period, fees may be averages depending on how fast blocks were found around a particular timestamp. For other time periods, fees are averages.
Returns average block rewards for blocks in the specified :timePeriod
, ordered oldest to newest. :timePeriod
can be any of the following: " + miningTimeIntervals + ".
For 24h
and 3d
time periods, every block is included and block rewards are exact (not averages). For the 1w
time period, block rewards may be averages depending on how fast blocks were found around a particular timestamp. For other time periods, block rewards are averages.
:timePeriod
, ordered oldest to newest. :timePeriod
can be any of the following: " + miningTimeIntervals + ".For 24h
and 3d
time periods, every block is included and percentiles are exact (not averages). For the 1w
time period, percentiles may be averages depending on how fast blocks were found around a particular timestamp. For other time periods, percentiles are averages."
+ },
+ urlString: "/v1/mining/blocks/fee-rates/:timePeriod",
+ showConditions: bitcoinNetworks,
+ codeExample: {
+ default: {
+ codeTemplate: {
+ curl: `/api/v1/mining/blocks/fee-rates/1m`,
+ commonJS: ``,
+ esModule: ``
+ },
+ codeSampleMainnet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `{
+ "oldestIndexedBlockTimestamp": 1571434851,
+ "blockFeeRates": [
+ {
+ "avg_height": 732152,
+ "timestamp": 1650132959,
+ "avg_fee_0": 1,
+ "avg_fee_10": 2,
+ "avg_fee_25": 2,
+ "avg_fee_50": 3,
+ "avg_fee_75": 4,
+ "avg_fee_90": 8,
+ "avg_fee_100": 393
+ },
+ {
+ "avg_height": 732158,
+ "timestamp": 1650134432,
+ "avg_fee_0": 1,
+ "avg_fee_10": 1,
+ "avg_fee_25": 2,
+ "avg_fee_50": 4,
+ "avg_fee_75": 6,
+ "avg_fee_90": 10,
+ "avg_fee_100": 240
+ },
+ {
+ "avg_height": 732161,
+ "timestamp": 1650135818,
+ "avg_fee_0": 1,
+ "avg_fee_10": 1,
+ "avg_fee_25": 1,
+ "avg_fee_50": 2,
+ "avg_fee_75": 5,
+ "avg_fee_90": 8,
+ "avg_fee_100": 251
+ },
+ ...
+}`
+ },
+ codeSampleTestnet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `[
+ {
+
+ }
+]`
+ },
+ codeSampleSignet: {
+ esModule: [],
+ commonJS: [],
+ curl: [],
+ response: `[
+ {
+
+ }
+]`
+ },
+ codeSampleLiquid: emptyCodeSample,
+ codeSampleLiquidTestnet: emptyCodeSample,
+ codeSampleBisq: emptyCodeSample,
+ }
+ }
+ },
+ {
+ type: "endpoint",
+ category: "mining",
+ httpRequestMethod: "GET",
+ fragment: "get-sizes-weights",
+ title: "GET Block Sizes and Weights",
+ description: {
+ default: "
Returns average size (bytes) and average weight (weight units) for blocks in the specified :timePeriod
, ordered oldest to newest. :timePeriod
can be any of the following: " + miningTimeIntervals + ".
For 24h
and 3d
time periods, every block is included and figures are exact (not averages). For the 1w
time period, figures may be averages depending on how fast blocks were found around a particular timestamp. For other time periods, figures are averages.
-
extras
field. If :startHeight
is specified, the past 15 blocks before (and including) :startHeight
are returned."
},
- urlString: "/blocks[/:startHeight]",
+ urlString: "/blocks-extras[/:startHeight]",
showConditions: bitcoinNetworks,
- showJsExamples: showJsExamplesDefault,
+ showJsExamples: showJsExamplesDefaultFalse,
codeExample: {
default: {
codeTemplate: {
@@ -2969,12 +2969,22 @@ export const restApiDocsData = [
},
...
]`,
- codeSampleTestnet: emptyCodeSample,
- codeSampleSignet: emptyCodeSample,
- codeSampleLiquid: emptyCodeSample,
- codeSampleLiquidTestnet: emptyCodeSample,
- codeSampleBisq: emptyCodeSample,
- }
+ },
+ codeSampleTestnet: {
+ esModule: [],
+ commonJS: [],
+ curl: ['2226118'],
+ response: `[]`
+ },
+ codeSampleSignet: {
+ esModule: [],
+ commonJS: [],
+ curl: ['88832'],
+ response: `[]`
+ },
+ codeSampleLiquid: emptyCodeSample,
+ codeSampleLiquidTestnet: emptyCodeSample,
+ codeSampleBisq: emptyCodeSample,
}
}
},
@@ -2985,7 +2995,7 @@ export const restApiDocsData = [
title: "Mining",
showConditions: bitcoinNetworks
},
- {
+ {
type: "endpoint",
category: "mining",
httpRequestMethod: "GET",
@@ -2994,20 +3004,20 @@ export const restApiDocsData = [
description: {
default: "Returns a list of all known mining pools ordered by blocks found over the specified trailing :timePeriod
.Leave :timePeriod
unspecified to get all available data, or specify one of the following values: " + miningTimeIntervals + "."
},
- urlString: "/v1/mining/pools/[:timePeriod]",
+ urlString: "/v1/mining/pools[/:timePeriod]",
showConditions: bitcoinNetworks,
showJsExamples: showJsExamplesDefaultFalse,
codeExample: {
default: {
codeTemplate: {
- curl: `/api/v1/mining/pools/1w`,
+ curl: `/api/v1/mining/pools/%{1}`,
commonJS: ``,
esModule: ``
},
codeSampleMainnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`1w`],
response: `{
"pools": [
{
@@ -3046,22 +3056,39 @@ export const restApiDocsData = [
codeSampleTestnet: {
esModule: [],
commonJS: [],
- curl: [],
- response: `[
- {
-
- }
-]`
+ curl: [`3y`],
+ response: `{
+ "pools": [
+ {
+ "poolId": 112,
+ "name": "SBI Crypto",
+ "link": "https://sbicrypto.com",
+ "blockCount": 26243,
+ "rank": 2,
+ "emptyBlocks": 11272,
+ "slug": "sbicrypto"
+ },
+ {
+ "poolId": 8,
+ "name": "Huobi.pool",
+ "link": "https://www.hpt.com/",
+ "blockCount": 12134,
+ "rank": 3,
+ "emptyBlocks": 6096,
+ "slug": "huobipool"
+ },
+ ...
+ ],
+ "oldestIndexedBlockTimestamp": 1296688602,
+ "blockCount": 2226180,
+ "lastEstimatedHashrate": 602244182177430.8
+}`
},
codeSampleSignet: {
esModule: [],
commonJS: [],
- curl: [],
- response: `[
- {
-
- }
-]`
+ curl: [`3y`],
+ response: `{}`
},
codeSampleLiquid: emptyCodeSample,
codeSampleLiquidTestnet: emptyCodeSample,
@@ -3076,7 +3103,7 @@ export const restApiDocsData = [
fragment: "get-mining-pool",
title: "GET Mining Pool",
description: {
- default: "
Returns details about the specified mining pool.
" + default: "Returns details about the mining pool specified by :slug
.
:slug
. Hashrate values are weekly averages."
},
urlString: "/v1/mining/pool/:slug/hashrate",
showConditions: bitcoinNetworks,
@@ -3256,14 +3311,14 @@ export const restApiDocsData = [
codeExample: {
default: {
codeTemplate: {
- curl: `/api/v1/mining/pool/foundryusa/hashrate`,
+ curl: `/api/v1/mining/pool/%{1}/hashrate`,
commonJS: ``,
esModule: ``
},
codeSampleMainnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`foundryusa`],
response: `[
{
"timestamp": 1647216000,
@@ -3307,21 +3362,53 @@ export const restApiDocsData = [
codeSampleTestnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`kncminer`],
response: `[
{
-
- }
+ "timestamp": 1400457600,
+ "avgHashrate": 23504290056.20675,
+ "share": 0.21875,
+ "poolName": "KnCMiner"
+ },
+ {
+ "timestamp": 1401062400,
+ "avgHashrate": 22880315827.385838,
+ "share": 0.301661,
+ "poolName": "KnCMiner"
+ },
+ {
+ "timestamp": 1401667200,
+ "avgHashrate": 65314000516.18979,
+ "share": 0.774853,
+ "poolName": "KnCMiner"
+ },
+ ...
]`
},
codeSampleSignet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`unknown`],
response: `[
{
-
- }
+ "timestamp": 1600041600,
+ "avgHashrate": 21621.70283633912,
+ "share": 1,
+ "poolName": "Unknown"
+ },
+ {
+ "timestamp": 1600646400,
+ "avgHashrate": 23490.65374463165,
+ "share": 1,
+ "poolName": "Unknown"
+ },
+ {
+ "timestamp": 1601251200,
+ "avgHashrate": 22660.62333333333,
+ "share": 1,
+ "poolName": "Unknown"
+ },
+ ...
]`
},
codeSampleLiquid: emptyCodeSample,
@@ -3337,7 +3424,7 @@ export const restApiDocsData = [
fragment: "get-mining-pool-blocks",
title: "GET Mining Pool Blocks",
description: {
- default: "Returns past 10 blocks mined by the specified mining pool before the specified :blockHeight
. If no :blockHeight
is specified, the mining pool's 10 most recent blocks are returned."
+ default: "Returns past 10 blocks mined by the specified mining pool (:slug
) before the specified :blockHeight
. If no :blockHeight
is specified, the mining pool's 10 most recent blocks are returned."
},
urlString: "/v1/mining/pool/:slug/blocks/[:blockHeight]",
showConditions: bitcoinNetworks,
@@ -3345,14 +3432,14 @@ export const restApiDocsData = [
codeExample: {
default: {
codeTemplate: {
- curl: `/api/v1/mining/pool/luxor/blocks/730000`,
+ curl: `/api/v1/mining/pool/%{1}/blocks/%{2}`,
commonJS: ``,
esModule: ``
},
codeSampleMainnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`luxor`,`730000`],
response: `[
{
"id": "0000000000000000000572c6eb693c51b728593139079c613c8ea0bc6384e362",
@@ -3429,21 +3516,109 @@ export const restApiDocsData = [
codeSampleTestnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`bitcoincom`,`2226000`],
response: `[
{
-
- }
+ "id": "00000000000000ed428cdb70dfdeb0f3927912131cb96e7b1fe274b1bb1181b2",
+ "timestamp": 1582018014,
+ "height": 1666150,
+ "version": 541065216,
+ "bits": 436312585,
+ "nonce": 21973352,
+ "difficulty": 10474471.99230249,
+ "merkle_root": "541456efe41e5730a563475e0c5e2007ee660f1d86d9778bfc164d73c59fd605",
+ "tx_count": 382,
+ "size": 126201,
+ "weight": 331851,
+ "previousblockhash": "00000000005a0843cc88b09cf6def15e4dc8fe38ab5cf3ad890f34a2df497004",
+ "extras": {
+ "coinbaseRaw": "03666c19706f6f6c2e626974636f696e2e636f6d010000022583010000000000",
+ "medianFee": 1,
+ "reward": 39726335,
+ "totalFees": 663835,
+ "pool": {
+ "id": 12
+ }
+ }
+ },
+ {
+ "id": "00000000000000af90f51e48cb29fdecc62e9961c5e27aca1a4ae8213aae1954",
+ "timestamp": 1579793108,
+ "height": 1663620,
+ "version": 541065216,
+ "bits": 436295134,
+ "nonce": 1762790676,
+ "difficulty": 12563071.03178775,
+ "merkle_root": "02d02afea666f08bab5851de541d0570c71a6cd8be358c28952c52d57b7afad4",
+ "tx_count": 24,
+ "size": 9562,
+ "weight": 23848,
+ "previousblockhash": "000000000000013bbdbc0fef53a5b4b2af02880a6f56f7945de071b71d51123a",
+ "extras": {
+ "coinbaseRaw": "03846219706f6f6c2e626974636f696e2e636f6d01000065f224020000000000",
+ "medianFee": 1,
+ "reward": 39547121,
+ "totalFees": 484621,
+ "pool": {
+ "id": 12
+ }
+ }
+ },
+ ...
]`
},
codeSampleSignet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`unknown`,`45000`],
response: `[
{
-
- }
+ "id": "00000002440c34e403b2b4e10f390ab105c825dd6285cd6f4050db23cf7e3e46",
+ "timestamp": 1625317548,
+ "height": 44999,
+ "version": 536870912,
+ "bits": 503405326,
+ "nonce": 14354169,
+ "difficulty": 0.002881346304279315,
+ "merkle_root": "3324dc134dec1b57cfea574ce2db6e40e51469417b6381a1389e7969386ab42e",
+ "tx_count": 14,
+ "size": 2971,
+ "weight": 8149,
+ "previousblockhash": "000000d7998f5cf0fb144a400566221574f5f35ebd5d7d9fa803460b6942e237",
+ "extras": {
+ "coinbaseRaw": "03c7af00",
+ "medianFee": 1,
+ "reward": 5000002252,
+ "totalFees": 2252,
+ "pool": {
+ "id": 137
+ }
+ }
+ },
+ {
+ "id": "000000d7998f5cf0fb144a400566221574f5f35ebd5d7d9fa803460b6942e237",
+ "timestamp": 1625317223,
+ "height": 44998,
+ "version": 536870912,
+ "bits": 503405326,
+ "nonce": 4729165,
+ "difficulty": 0.002881346304279315,
+ "merkle_root": "55869f5a52d7709fb2c6df91d64841f4551d659948b7537b6cd8f19c68d27115",
+ "tx_count": 32,
+ "size": 6967,
+ "weight": 18247,
+ "previousblockhash": "000000d6de5b925642a7afed41994947db8612955fbdfd9d1b48f99fc0187385",
+ "extras": {
+ "coinbaseRaw": "03c6af00",
+ "medianFee": 1,
+ "reward": 5000005528,
+ "totalFees": 5528,
+ "pool": {
+ "id": 137
+ }
+ }
+ },
+ ...
]`
},
codeSampleLiquid: emptyCodeSample,
@@ -3504,22 +3679,67 @@ export const restApiDocsData = [
codeSampleTestnet: {
esModule: [],
commonJS: [],
- curl: [],
- response: `[
- {
-
- }
-]`
+ curl: [`3d`],
+ response: `{
+ "hashrates": [
+ {
+ "timestamp": 1652745600,
+ "avgHashrate": 385829751259101.6
+ },
+ {
+ "timestamp": 1652832000,
+ "avgHashrate": 657984995406460.8
+ },
+ {
+ "timestamp": 1652918400,
+ "avgHashrate": 510731129917436.6
+ }
+ ],
+ "difficulty": [
+ {
+ "timestamp": 1652691434,
+ "difficulty": 26119369.29706616,
+ "height": 2225402
+ }
+ ],
+ "currentHashrate": 781149965464814.4,
+ "currentDifficulty": 55580658.55098472
+}`
},
codeSampleSignet: {
esModule: [],
commonJS: [],
- curl: [],
- response: `[
- {
-
- }
-]`
+ curl: [`3d`],
+ response: `{
+ "hashrates": [
+ {
+ "timestamp": 1652745600,
+ "avgHashrate": 21304.18163251096
+ },
+ {
+ "timestamp": 1652832000,
+ "avgHashrate": 22034.51091213679
+ },
+ {
+ "timestamp": 1652918400,
+ "avgHashrate": 20312.75493978447
+ }
+ ],
+ "difficulty": [
+ {
+ "timestamp": 1652692199,
+ "difficulty": 0.002868721424409158,
+ "height": 90533
+ },
+ {
+ "timestamp": 1652796655,
+ "difficulty": 0.00286032350920122,
+ "height": 90720
+ }
+ ],
+ "currentHashrate": 23490.95654668005,
+ "currentDifficulty": 0.00286032350920122
+}`
},
codeSampleLiquid: emptyCodeSample,
codeSampleLiquidTestnet: emptyCodeSample,
@@ -3534,7 +3754,7 @@ export const restApiDocsData = [
fragment: "get-reward-stats",
title: "GET Reward Stats",
description: {
- default: "Returns block reward and total transactions confirmed for each of the past blockCount
blocks."
+ default: "Returns block reward and total transactions confirmed for each of the past :blockCount
blocks."
},
urlString: "/v1/mining/reward-stats/:blockCount",
showConditions: bitcoinNetworks,
@@ -3542,14 +3762,14 @@ export const restApiDocsData = [
codeExample: {
default: {
codeTemplate: {
- curl: `/api/v1/mining/reward-stats/100`,
+ curl: `/api/v1/mining/reward-stats/%{1}`,
commonJS: ``,
esModule: ``
},
codeSampleMainnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`100`],
response: `{
"startBlock": 736556,
"endBlock": 736655,
@@ -3561,22 +3781,26 @@ export const restApiDocsData = [
codeSampleTestnet: {
esModule: [],
commonJS: [],
- curl: [],
- response: `[
- {
-
- }
-]`
+ curl: [`100`],
+ response: `{
+ "startBlock": 2226086,
+ "endBlock": 2226185,
+ "totalReward": "513462793",
+ "totalFee": "25181593",
+ "totalTx": "2366"
+}`
},
codeSampleSignet: {
esModule: [],
commonJS: [],
- curl: [],
- response: `[
- {
-
- }
-]`
+ curl: [`100`],
+ response: `{
+ "startBlock": 90899,
+ "endBlock": 90998,
+ "totalReward": "500001245259",
+ "totalFee": "1245259",
+ "totalTx": "1112"
+}`
},
codeSampleLiquid: emptyCodeSample,
codeSampleLiquidTestnet: emptyCodeSample,
@@ -3599,14 +3823,14 @@ export const restApiDocsData = [
codeExample: {
default: {
codeTemplate: {
- curl: `/api/v1/mining/blocks/fees/1w`,
+ curl: `/api/v1/mining/blocks/fees/%{1}`,
commonJS: ``,
esModule: ``
},
codeSampleMainnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`1w`],
response: `[
{
"avg_height": 735644,
@@ -3644,21 +3868,37 @@ export const restApiDocsData = [
codeSampleTestnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`1w`],
response: `[
{
-
- }
+ "avg_height": 2224253,
+ "timestamp": 1652346420,
+ "avg_fees": 211686
+ },
+ {
+ "avg_height": 2224254,
+ "timestamp": 1652346850,
+ "avg_fees": 2565952
+ },
+ ...
]`
},
codeSampleSignet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`1w`],
response: `[
{
-
- }
+ "avg_height": 89978,
+ "timestamp": 1652346573,
+ "avg_fees": 1071
+ },
+ {
+ "avg_height": 89979,
+ "timestamp": 1652346970,
+ "avg_fees": 1224
+ },
+ ...
]`
},
codeSampleLiquid: emptyCodeSample,
@@ -3682,14 +3922,14 @@ export const restApiDocsData = [
codeExample: {
default: {
codeTemplate: {
- curl: `/api/v1/mining/blocks/rewards/1d`,
+ curl: `/api/v1/mining/blocks/rewards/%{1}`,
commonJS: ``,
esModule: ``
},
codeSampleMainnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`1d`],
response: `[
{
"avg_height": 599992,
@@ -3722,21 +3962,37 @@ export const restApiDocsData = [
codeSampleTestnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`1d`],
response: `[
{
-
- }
+ "avg_height": 12,
+ "timestamp": 1296689648,
+ "avg_rewards": 5000000000
+ },
+ {
+ "avg_height": 269,
+ "timestamp": 1296717674,
+ "avg_rewards": 5000091820
+ },
+ ...
]`
},
codeSampleSignet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`1d`],
response: `[
{
-
- }
+ "avg_height": 183,
+ "timestamp": 1598962247,
+ "avg_rewards": 5000000000
+ },
+ {
+ "avg_height": 576,
+ "timestamp": 1599047892,
+ "avg_rewards": 5000000000
+ },
+ ...
]`
},
codeSampleLiquid: emptyCodeSample,
@@ -3760,14 +4016,14 @@ export const restApiDocsData = [
codeExample: {
default: {
codeTemplate: {
- curl: `/api/v1/mining/blocks/fee-rates/1m`,
+ curl: `/api/v1/mining/blocks/fee-rates/%{1}`,
commonJS: ``,
esModule: ``
},
codeSampleMainnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`1m`],
response: `{
"oldestIndexedBlockTimestamp": 1571434851,
"blockFeeRates": [
@@ -3805,27 +4061,74 @@ export const restApiDocsData = [
"avg_fee_100": 251
},
...
+ ]
}`
},
codeSampleTestnet: {
esModule: [],
commonJS: [],
- curl: [],
- response: `[
- {
-
- }
-]`
+ curl: [`1m`],
+ response: `{
+ "oldestIndexedBlockTimestamp": 1296688602,
+ "blockFeeRates": [
+ {
+ "avg_height": 2196306,
+ "timestamp": 1650360168,
+ "avg_fee_0": 1,
+ "avg_fee_10": 1,
+ "avg_fee_25": 1,
+ "avg_fee_50": 1,
+ "avg_fee_75": 2,
+ "avg_fee_90": 28,
+ "avg_fee_100": 2644
+ },
+ {
+ "avg_height": 2196308,
+ "timestamp": 1650361209,
+ "avg_fee_0": 1,
+ "avg_fee_10": 1,
+ "avg_fee_25": 1,
+ "avg_fee_50": 4,
+ "avg_fee_75": 12,
+ "avg_fee_90": 65,
+ "avg_fee_100": 102
+ },
+ ...
+ ]
+}`
},
codeSampleSignet: {
esModule: [],
commonJS: [],
- curl: [],
- response: `[
- {
-
- }
-]`
+ curl: [`1m`],
+ response: `{
+ "oldestIndexedBlockTimestamp": 1598918400,
+ "blockFeeRates": [
+ {
+ "avg_height": 86620,
+ "timestamp": 1650360010,
+ "avg_fee_0": 1,
+ "avg_fee_10": 1,
+ "avg_fee_25": 1,
+ "avg_fee_50": 1,
+ "avg_fee_75": 1,
+ "avg_fee_90": 1,
+ "avg_fee_100": 1
+ },
+ {
+ "avg_height": 86623,
+ "timestamp": 1650361330,
+ "avg_fee_0": 1,
+ "avg_fee_10": 1,
+ "avg_fee_25": 1,
+ "avg_fee_50": 1,
+ "avg_fee_75": 1,
+ "avg_fee_90": 1,
+ "avg_fee_100": 1
+ },
+ ...
+ ]
+}`
},
codeSampleLiquid: emptyCodeSample,
codeSampleLiquidTestnet: emptyCodeSample,
@@ -3848,14 +4151,14 @@ export const restApiDocsData = [
codeExample: {
default: {
codeTemplate: {
- curl: `/api/v1/mining/blocks/sizes-weights/3y`,
+ curl: `/api/v1/mining/blocks/sizes-weights/%{1}`,
commonJS: ``,
esModule: ``
},
codeSampleMainnet: {
esModule: [],
commonJS: [],
- curl: [],
+ curl: [`3y`],
response: `{
"sizes": [
{
@@ -3908,22 +4211,68 @@ export const restApiDocsData = [
codeSampleTestnet: {
esModule: [],
commonJS: [],
- curl: [],
- response: `[
- {
-
- }
-]`
+ curl: [`3y`],
+ response: `{
+ "sizes": [
+ {
+ "avg_height": 1517188,
+ "timestamp": 1558262730,
+ "avg_size": 25089
+ },
+ {
+ "avg_height": 1517275,
+ "timestamp": 1558290933,
+ "avg_size": 21679
+ },
+ ...
+ ],
+ "weights": [
+ {
+ "avg_height": 1517188,
+ "timestamp": 1558262730,
+ "avg_weight": 74921
+ },
+ {
+ "avg_height": 1517275,
+ "timestamp": 1558290933,
+ "avg_weight": 65164
+ },
+ ...
+ ]
+}`
},
codeSampleSignet: {
esModule: [],
commonJS: [],
- curl: [],
- response: `[
- {
-
- }
-]`
+ curl: [`3y`],
+ response: `{
+ "sizes": [
+ {
+ "avg_height": 83,
+ "timestamp": 1598937527,
+ "avg_size": 329
+ },
+ {
+ "avg_height": 266,
+ "timestamp": 1598982991,
+ "avg_size": 330
+ },
+ ...
+ ],
+ "weights": [
+ {
+ "avg_height": 83,
+ "timestamp": 1598937527,
+ "avg_weight": 1209
+ },
+ {
+ "avg_height": 266,
+ "timestamp": 1598982991,
+ "avg_weight": 1212
+ },
+ ...
+ ]
+}`
},
codeSampleLiquid: emptyCodeSample,
codeSampleLiquidTestnet: emptyCodeSample,
From 5e5ff91280bcc39e1988d2215dddc04c07109299 Mon Sep 17 00:00:00 2001
From: hunicus <93150691+hunicus@users.noreply.github.com>
Date: Thu, 19 May 2022 12:21:41 -0400
Subject: [PATCH 4/4] Make small wording change for reward-stats
---
frontend/src/app/docs/api-docs/api-docs-data.ts | 2 +-
1 file changed, 1 insertion(+), 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 f3c24b7f5..ff57aeb82 100644
--- a/frontend/src/app/docs/api-docs/api-docs-data.ts
+++ b/frontend/src/app/docs/api-docs/api-docs-data.ts
@@ -3754,7 +3754,7 @@ export const restApiDocsData = [
fragment: "get-reward-stats",
title: "GET Reward Stats",
description: {
- default: "Returns block reward and total transactions confirmed for each of the past :blockCount
blocks."
+ default: "Returns block reward and total transactions confirmed for the past :blockCount
blocks."
},
urlString: "/v1/mining/reward-stats/:blockCount",
showConditions: bitcoinNetworks,