Kit
Functions

blockhash

blockhash(putativeBlockhash): Blockhash

Combines asserting that a string is a blockhash with coercing it to the Blockhash type. It's most useful with untrusted input.

Parameters

ParameterType
putativeBlockhashstring

Returns

Blockhash

Example

import { blockhash } from '@solana/rpc-types';
 
const { value: isValid } = await rpc.isBlockhashValid(blockhash(blockhashFromUserInput)).send();

[!TIP] When starting from a known-good blockhash as a string, it's more efficient to typecast it rather than to use the blockhash helper, because the helper unconditionally performs validation on its input.

import { Blockhash } from '@solana/rpc-types';
 
const blockhash = 'ABmPH5KDXX99u6woqFS5vfBGSNyKG42SzpvBMWWqAy48' as Blockhash;

On this page