Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 10x 10x 1x 1x 10x 2x 2x 10x 1x 1x | import {
MicroblockListResponse,
Microblock,
UnanchoredTransactionListResponse,
} from '@stacks/stacks-blockchain-api-types';
import { BaseListParams } from '../types';
import { fetchJson, generateUrl, microblockEndpoint } from '../utils';
/**
* Get recent microblocks
*
* @see https://docs.micro-stacks.dev/modules/core/api/microblocks#fetchmicroblocks
*/
export async function fetchMicroblocks({ url, limit, offset }: BaseListParams) {
const path = generateUrl(microblockEndpoint(url), {
limit,
offset,
});
return fetchJson<MicroblockListResponse>(path);
}
/**
* Get microblock
*
* @see https://docs.micro-stacks.dev/modules/core/api/microblocks#fetchmicroblock
*/
export async function fetchMicroblock({ url, hash }: BaseListParams & { hash: string }) {
const path = generateUrl(`${microblockEndpoint(url)}/${hash}`, {});
return fetchJson<Microblock>(path);
}
/**
* Get the list of current transactions that belong to unanchored microblocks
*
* @see https://docs.micro-stacks.dev/modules/core/api/microblocks#fetchmicroblocksunanchoredtransactions
*/
export async function fetchMicroblocksUnanchoredTransactions({ url }: BaseListParams) {
const path = generateUrl(`${microblockEndpoint(url)}/unanchored/txs`, {});
return fetchJson<UnanchoredTransactionListResponse>(path);
}
|