Replace blocks-extras with blocks in docs (bitcoin)

This commit is contained in:
hunicus 2022-06-02 11:47:03 -04:00
parent 11f5056871
commit 538a1b1666
No known key found for this signature in database
GPG Key ID: 24837C51B6D81FD9

View File

@ -2672,51 +2672,15 @@ export const restApiDocsData = [
fragment: "get-blocks", fragment: "get-blocks",
title: "GET Blocks", title: "GET Blocks",
description: { description: {
default: "Returns details on the past 10 blocks. If <code>:startHeight</code> is specified, the past 10 blocks before (and including) <code>:startHeight</code> are returned." default: "Returns details on the past 15 blocks with fee and mining details in an <code>extras</code> field. If <code>:startHeight</code> is specified, the past 15 blocks before (and including) <code>:startHeight</code> are returned."
}, },
urlString: "/blocks[/:startHeight]", urlString: "/v1/blocks[/:startHeight]",
showConditions: bitcoinNetworks.concat(liquidNetworks).concat(["bisq"]), showConditions: bitcoinNetworks,
showJsExamples: showJsExamplesDefault, showJsExamples: showJsExamplesDefault,
codeExample: { codeExample: {
bisq: {
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,
codeSampleBisq: {
esModule: ['0', '1'],
commonJS: ['0', '1'],
curl: ['0', '1'],
response: `[
{
height: 698771,
time: 1630636953000,
hash: "0000000000000000000a33c6ac863eee8c76ca72435f25d679609c0949ac9374",
previousBlockHash: "00000000000000000001e4184639e5600d3fb4c4e06c2a625e76804c4bc93cb1",
txs: []
}
]`
},
},
default: { default: {
codeTemplate: { codeTemplate: {
curl: `/api/blocks/%{1}`, curl: `/api/v1/blocks/%{1}`,
commonJS: ` commonJS: `
const { %{0}: { blocks } } = mempoolJS(); const { %{0}: { blocks } } = mempoolJS();
@ -2732,27 +2696,84 @@ export const restApiDocsData = [
`, `,
}, },
codeSampleMainnet: { codeSampleMainnet: {
esModule: ['698777'], esModule: ['730000'],
commonJS: ['698777'], commonJS: ['730000'],
curl: ['698777'], curl: ['730000'],
response: `[ response: `[
{ {
id: "00000000000000000003002915e015c47610c55b6f0228ad62bfcc59b65e67b7", "id": "0000000000000000000384f28cb3b9cf4377a39cfd6c29ae9466951de38c0529",
height: 698777, "timestamp": 1648829449,
version: 536870916, "height": 730000,
timestamp: 1630641711, "version": 536870912,
tx_count: 2327, "bits": 386521239,
size: 1466537, "nonce": 3580664066,
weight: 3999653, "difficulty": 28587155782195.14,
merkle_root: "023e27dde144eedc65ff3b27c535ebc7dced6c49fe78f94cdf85cf2000608d2f", "merkle_root": "efa344bcd6c0607f93b709515dd6dc5496178112d680338ebea459e3de7b4fbc",
previousblockhash: "0000000000000000000701a7f14e362d3f10aa524200db1710ce3bbf0c0f8b75", "tx_count": 1627,
mediantime: 1630636986, "size": 1210916,
nonce: 1926094388, "weight": 3993515,
bits: 386923168, "previousblockhash": "00000000000000000008b6f6fb83f8d74512ef1e0af29e642dd20daddd7d318f",
difficulty: 17615033039278 "extras": {
"coinbaseRaw": "0390230b1362696e616e63652f383038e0006f02cd583765fabe6d6d686355577affaad03015e732428a927a5d2d842471b350394139616bcb4401d804000000000000001a750000c9ad0000",
"medianFee": 11,
"feeRange": [
1,
11,
11,
11,
18,
21,
660
],
"reward": 641321983,
"totalFees": 16321983,
"avgFee": 10038,
"avgFeeRate": 16,
"pool": {
"id": 105,
"name": "Binance Pool",
"slug": "binancepool"
}
}
},
{
"id": "00000000000000000008b6f6fb83f8d74512ef1e0af29e642dd20daddd7d318f",
"timestamp": 1648828946,
"height": 729999,
"version": 793796608,
"bits": 386521239,
"nonce": 3477019455,
"difficulty": 28587155782195.14,
"merkle_root": "d84f9cc1823bd069c505061b1f6faabd809d67ab5354e9f6234312dc4bdb1ecf",
"tx_count": 2574,
"size": 1481957,
"weight": 3993485,
"previousblockhash": "000000000000000000071e6c86c2175aa86817cae2a77acd95372b55c1103d89",
"extras": {
"coinbaseRaw": "038f230b1362696e616e63652f373739d8002900ca5de7a9fabe6d6dda31112c36c10a523154eae76847579755cd4ae558ee2e6f9f200b05dd32a0bf04000000000000006372000000020000",
"medianFee": 17,
"feeRange": [
2,
11,
14,
17,
19,
28,
502
],
"reward": 649090210,
"totalFees": 24090210,
"avgFee": 9362,
"avgFeeRate": 24,
"pool": {
"id": 105,
"name": "Binance Pool",
"slug": "binancepool"
}
}
}, },
... ...
]` ]`,
}, },
codeSampleTestnet: { codeSampleTestnet: {
esModule: ['2091187'], esModule: ['2091187'],
@ -2760,19 +2781,40 @@ export const restApiDocsData = [
curl: ['2091187'], curl: ['2091187'],
response: `[ response: `[
{ {
id: "00000000000000533f63df886281a9fd74da163e84a21445153ff480e5f57970", "id": "00000000000000533f63df886281a9fd74da163e84a21445153ff480e5f57970",
height: 2091187, "timestamp": 1630641890,
version: 545259520, "height": 2091187,
timestamp: 1630641890, "version": 545259520,
tx_count: 26, "bits": 436273151,
size: 8390, "nonce": 309403673,
weight: 22985, "difficulty": 16777216,
merkle_root: "4d6df12a4af11bb928c7b2930e0a4d2c3e268c6dc6a07462943ad1c4b6b96468", "merkle_root": "4d6df12a4af11bb928c7b2930e0a4d2c3e268c6dc6a07462943ad1c4b6b96468",
previousblockhash: "0000000000000079103da7d296e1480295df795b7379e7dffd27743e214b0b32", "tx_count": 26,
mediantime: 1630639627, "size": 8390,
nonce: 309403673, "weight": 22985,
bits: 436273151, "previousblockhash": "0000000000000079103da7d296e1480295df795b7379e7dffd27743e214b0b32",
difficulty: 16777216 "extras": {
"coinbaseRaw": "03b3e81f3a205468697320626c6f636b20776173206d696e65642077697468206120636172626f6e206e6567617469766520706f77657220736f75726365201209687a2009092009020de601d7986a040000",
"medianFee": 1,
"feeRange": [
1,
1,
1,
1,
5,
56,
5053
],
"reward": 10547567,
"totalFees": 781942,
"avgFee": 31277,
"avgFeeRate": 143,
"pool": {
"id": 137,
"name": "Unknown",
"slug": "unknown"
}
}
}, },
... ...
]` ]`
@ -2783,63 +2825,46 @@ export const restApiDocsData = [
curl: ['53783'], curl: ['53783'],
response: `[ response: `[
{ {
id: "0000010eeacb878340bae34af4e13551413d76a172ec302f7e50b62cb45374f2", "id": "0000010eeacb878340bae34af4e13551413d76a172ec302f7e50b62cb45374f2",
height: 53783, "timestamp": 1630641504,
version: 536870912, "height": 53783,
timestamp: 1630641504, "version": 536870912,
tx_count: 1, "bits": 503404179,
size: 343, "nonce": 11753379,
weight: 1264, "difficulty": 0.002919030932507782,
merkle_root: "3063ff3802c920eea68bdc9303957f3e7bfd0a03c93547fd7dad14b77a07d4e8", "merkle_root": "3063ff3802c920eea68bdc9303957f3e7bfd0a03c93547fd7dad14b77a07d4e8",
previousblockhash: "00000109a7ea774fcc2d173f9a1da9595a47ff401dac67ca9edea149954210fa", "tx_count": 1,
mediantime: 1630638966, "size": 343,
nonce: 11753379, "weight": 1264,
bits: 503404179, "previousblockhash": "00000109a7ea774fcc2d173f9a1da9595a47ff401dac67ca9edea149954210fa",
difficulty: 0 "extras": {
}, "coinbaseRaw": "0317d200",
... "medianFee": 0,
]` "feeRange": [
}, 0,
codeSampleLiquid: { 0,
esModule: ['1472246'], 0,
commonJS: ['1472246'], 0,
curl: ['1472246'], 0,
response: `[ 0,
{ 0
id: "0bd348c08101fef863b7263b2b44b2f6575f707f1e397da95cfe2afdd5e9ccdb", ],
height: 1472246, "reward": 5000000000,
version: 570425344, "totalFees": 0,
timestamp: 1630642018, "avgFee": 0,
tx_count: 2, "avgFeeRate": 0,
size: 10838, "pool": {
weight: 16901, "id": 137,
merkle_root: "a8cdc1ba96d1f862ca7c9aec4133a6efd14138f54c17efdbc968632a6b9cb8c8", "name": "Unknown",
previousblockhash: "a06c327cdd76301de57ba0cf86c5ae8b1fd8a785945065ac9e2128322bd01f31", "slug": "unknown"
mediantime: 1630641718 }
}, }
...
]`
},
codeSampleLiquidTestnet: {
esModule: ['150000'],
commonJS: ['150000'],
curl: ['150000'],
response: `[
{
id: "67d5eb1aee63c6c2058a088985503ff0626fd3f7f8022bdc74fab36a359164db",
height: 150000,
version: 536870912,
timestamp: 1640871913,
tx_count: 2,
size: 3527,
weight: 7430,
merkle_root: "40538ff1fcac07c65e36fcc230fc60f58e3a885ce9898e41bc27bcf28227e5ff",
previousblockhash: "2d8c28042b03219e7e9bc6853cc3ae536e36be5639869c545a0f3dbd1309e2a5",
mediantime: 1640871614
}, },
... ...
]` ]`
}, },
codeSampleLiquid: emptyCodeSample,
codeSampleLiquidTestnet: emptyCodeSample,
codeSampleBisq: emptyCodeSample, codeSampleBisq: emptyCodeSample,
} }
} }
@ -2848,140 +2873,199 @@ export const restApiDocsData = [
type: "endpoint", type: "endpoint",
category: "blocks", category: "blocks",
httpRequestMethod: "GET", httpRequestMethod: "GET",
fragment: "get-blocks-extras", fragment: "get-blocks",
title: "GET Blocks Extras", title: "GET Blocks",
description: { description: {
default: "Returns details on the past 15 blocks with fee and mining details in an <code>extras</code> field. If <code>:startHeight</code> is specified, the past 15 blocks before (and including) <code>:startHeight</code> are returned." default: "Returns details on the past 15 blocks with fee and mining details in an <code>extras</code> field. If <code>:startHeight</code> is specified, the past 15 blocks before (and including) <code>:startHeight</code> are returned."
}, },
urlString: "/blocks-extras[/:startHeight]", urlString: "/v1/blocks[/:startHeight]",
showConditions: bitcoinNetworks, showConditions: bitcoinNetworks,
showJsExamples: showJsExamplesDefaultFalse, showJsExamples: showJsExamplesDefault,
codeExample: { codeExample: {
default: { default: {
codeTemplate: { codeTemplate: {
curl: `/api/blocks-extras/%{1}`, curl: `/api/v1/blocks/%{1}`,
commonJS: ``, commonJS: `
esModule: `` const { %{0}: { blocks } } = mempoolJS();
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({ startHeight: %{1} });
console.log(getBlocks);
`,
}, },
codeSampleMainnet: { codeSampleMainnet: {
esModule: [], esModule: ['730000'],
commonJS: [], commonJS: ['730000'],
curl: ['736915'], curl: ['730000'],
response: `[ response: `[
{ {
"id": "0000000000000000000384f28cb3b9cf4377a39cfd6c29ae9466951de38c0529",
"timestamp": 1648829449,
"height": 730000,
"version": 536870912,
"bits": 386521239,
"nonce": 3580664066,
"difficulty": 28587155782195.14,
"merkle_root": "efa344bcd6c0607f93b709515dd6dc5496178112d680338ebea459e3de7b4fbc",
"tx_count": 1627,
"size": 1210916,
"weight": 3993515,
"previousblockhash": "00000000000000000008b6f6fb83f8d74512ef1e0af29e642dd20daddd7d318f",
"extras": { "extras": {
"reward": 629766074, "coinbaseRaw": "0390230b1362696e616e63652f383038e0006f02cd583765fabe6d6d686355577affaad03015e732428a927a5d2d842471b350394139616bcb4401d804000000000000001a750000c9ad0000",
"coinbaseTx": { "medianFee": 11,
"vin": [
{
"scriptsig": "03933e0b215c204d41524120506f6f6c205c00000000be82a250e5ef942790d2542ca87d0000"
}
],
"vout": [
{
"scriptpubkey_address": "1A32KFEX7JNPmU1PVjrtiXRrTQcesT3Nf1",
"value": 629766074
}
]
},
"coinbaseRaw": "03933e0b215c204d41524120506f6f6c205c00000000be82a250e5ef942790d2542ca87d0000",
"medianFee": 14,
"feeRange": [ "feeRange": [
1, 1,
1, 11,
4, 11,
14, 11,
15, 18,
20, 21,
364 660
], ],
"totalFees": 4766074, "reward": 641321983,
"avgFee": 5043, "totalFees": 16321983,
"avgFeeRate": 14, "avgFee": 10038,
"avgFeeRate": 16,
"pool": { "pool": {
"id": 115, "id": 105,
"name": "MARA Pool", "name": "Binance Pool",
"slug": "marapool" "slug": "binancepool"
}, }
"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"
}, },
{ {
"id": "00000000000000000008b6f6fb83f8d74512ef1e0af29e642dd20daddd7d318f",
"timestamp": 1648828946,
"height": 729999,
"version": 793796608,
"bits": 386521239,
"nonce": 3477019455,
"difficulty": 28587155782195.14,
"merkle_root": "d84f9cc1823bd069c505061b1f6faabd809d67ab5354e9f6234312dc4bdb1ecf",
"tx_count": 2574,
"size": 1481957,
"weight": 3993485,
"previousblockhash": "000000000000000000071e6c86c2175aa86817cae2a77acd95372b55c1103d89",
"extras": { "extras": {
"reward": 638804415, "coinbaseRaw": "038f230b1362696e616e63652f373739d8002900ca5de7a9fabe6d6dda31112c36c10a523154eae76847579755cd4ae558ee2e6f9f200b05dd32a0bf04000000000000006372000000020000",
"coinbaseTx": { "medianFee": 17,
"vin": [
{
"scriptsig": "03923e0bfabe6d6dc3e96cee3cb68ee52bd31fde8e1f4983a780ea836115788d81a559e03791071f01000000000000001065040008d708c7010000000000007a6d4683012f736c7573682f"
}
],
"vout": [
{
"scriptpubkey_address": "1CK6KHY6MHgYvmRQ4PAafKYDrg1ejbH1cE",
"value": 638804415
}
]
},
"coinbaseRaw": "03923e0bfabe6d6dc3e96cee3cb68ee52bd31fde8e1f4983a780ea836115788d81a559e03791071f01000000000000001065040008d708c7010000000000007a6d4683012f736c7573682f",
"medianFee": 14,
"feeRange": [ "feeRange": [
1,
1,
2, 2,
11,
14, 14,
15, 17,
20, 19,
347 28,
502
], ],
"totalFees": 13804415, "reward": 649090210,
"avgFee": 5287, "totalFees": 24090210,
"avgFeeRate": 14, "avgFee": 9362,
"avgFeeRate": 24,
"pool": { "pool": {
"id": 43, "id": 105,
"name": "SlushPool", "name": "Binance Pool",
"slug": "slushpool" "slug": "binancepool"
}, }
"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: { codeSampleTestnet: {
esModule: [], esModule: ['2091187'],
commonJS: [], commonJS: ['2091187'],
curl: ['2226118'], curl: ['2091187'],
response: `[]` response: `[
{
"id": "00000000000000533f63df886281a9fd74da163e84a21445153ff480e5f57970",
"timestamp": 1630641890,
"height": 2091187,
"version": 545259520,
"bits": 436273151,
"nonce": 309403673,
"difficulty": 16777216,
"merkle_root": "4d6df12a4af11bb928c7b2930e0a4d2c3e268c6dc6a07462943ad1c4b6b96468",
"tx_count": 26,
"size": 8390,
"weight": 22985,
"previousblockhash": "0000000000000079103da7d296e1480295df795b7379e7dffd27743e214b0b32",
"extras": {
"coinbaseRaw": "03b3e81f3a205468697320626c6f636b20776173206d696e65642077697468206120636172626f6e206e6567617469766520706f77657220736f75726365201209687a2009092009020de601d7986a040000",
"medianFee": 1,
"feeRange": [
1,
1,
1,
1,
5,
56,
5053
],
"reward": 10547567,
"totalFees": 781942,
"avgFee": 31277,
"avgFeeRate": 143,
"pool": {
"id": 137,
"name": "Unknown",
"slug": "unknown"
}
}
},
...
]`
}, },
codeSampleSignet: { codeSampleSignet: {
esModule: [], esModule: ['53783'],
commonJS: [], commonJS: ['53783'],
curl: ['88832'], curl: ['53783'],
response: `[]` response: `[
{
"id": "0000010eeacb878340bae34af4e13551413d76a172ec302f7e50b62cb45374f2",
"timestamp": 1630641504,
"height": 53783,
"version": 536870912,
"bits": 503404179,
"nonce": 11753379,
"difficulty": 0.002919030932507782,
"merkle_root": "3063ff3802c920eea68bdc9303957f3e7bfd0a03c93547fd7dad14b77a07d4e8",
"tx_count": 1,
"size": 343,
"weight": 1264,
"previousblockhash": "00000109a7ea774fcc2d173f9a1da9595a47ff401dac67ca9edea149954210fa",
"extras": {
"coinbaseRaw": "0317d200",
"medianFee": 0,
"feeRange": [
0,
0,
0,
0,
0,
0,
0
],
"reward": 5000000000,
"totalFees": 0,
"avgFee": 0,
"avgFeeRate": 0,
"pool": {
"id": 137,
"name": "Unknown",
"slug": "unknown"
}
}
},
...
]`
}, },
codeSampleLiquid: emptyCodeSample, codeSampleLiquid: emptyCodeSample,
codeSampleLiquidTestnet: emptyCodeSample, codeSampleLiquidTestnet: emptyCodeSample,