MCPcopy Create free account
hub / github.com/subquery/subql / getHeaderForHash

Function getHeaderForHash

packages/node/src/utils/substrate.ts:101–113  ·  view source on GitHub ↗
(
  api: ApiPromise,
  blockHash: string,
)

Source from the content-addressed store, hash-verified

99}
100
101export async function getHeaderForHash(
102 api: ApiPromise,
103 blockHash: string,
104): Promise<Header> {
105 const block = await api.rpc.chain.getBlock(blockHash).catch((e) => {
106 logger.error(
107 `failed to fetch Block hash="${blockHash}" ${getApiDecodeErrMsg(e.message)}`,
108 );
109 throw ApiPromiseConnection.handleError(e);
110 });
111
112 return substrateBlockToHeader(block);
113}
114
115export function wrapExtrinsics(
116 wrappedBlock: SubstrateBlock,

Callers 2

getHeaderForHashMethod · 0.90
substrate.test.tsFile · 0.90

Calls 4

getApiDecodeErrMsgFunction · 0.85
substrateBlockToHeaderFunction · 0.85
handleErrorMethod · 0.65
errorMethod · 0.45

Tested by

no test coverage detected