Add getBlockHeader method.
This commit is contained in:
@@ -44,6 +44,11 @@ export const useBlocks = (api: AxiosInstance): BlockInstance => {
|
||||
return data;
|
||||
};
|
||||
|
||||
const getBlockHeader = async (params: { hash: string }) => {
|
||||
const { data } = await api.get<string>(`/block/${params.hash}/header`);
|
||||
return data;
|
||||
};
|
||||
|
||||
const getBlockHeight = async (params: { height: number }) => {
|
||||
const { data } = await api.get<string>(`/block-height/${params.height}`);
|
||||
return data;
|
||||
@@ -72,6 +77,7 @@ export const useBlocks = (api: AxiosInstance): BlockInstance => {
|
||||
getBlockTxid,
|
||||
getBlockTxids,
|
||||
getBlockRaw,
|
||||
getBlockHeader,
|
||||
getBlockHeight,
|
||||
getBlocksTipHash,
|
||||
getBlocksTipHeight,
|
||||
|
||||
@@ -2,11 +2,11 @@ import { AxiosInstance } from 'axios';
|
||||
import {
|
||||
Block,
|
||||
BlockStatus,
|
||||
BlockInstance,
|
||||
} from '../../interfaces/bitcoin/blocks';
|
||||
BlockLiquidInstance,
|
||||
} from '../../interfaces/liquid/block';
|
||||
import { Tx } from '../../interfaces/bitcoin/transactions';
|
||||
|
||||
export const useBlocks = (api: AxiosInstance): BlockInstance => {
|
||||
export const useBlocks = (api: AxiosInstance): BlockLiquidInstance => {
|
||||
const getBlock = async (params: { hash: string }) => {
|
||||
const { data } = await api.get<Block>(`/block/${params.hash}`);
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user