Kit
Functions

getBlockhashEncoder

getBlockhashEncoder(): FixedSizeEncoder<Blockhash, 32>

Returns an encoder that you can use to encode a base58-encoded blockhash to a byte array.

Returns

FixedSizeEncoder<Blockhash, 32>

Example

import { getBlockhashEncoder } from '@solana/rpc-types';
 
const blockhash = 'ABmPH5KDXX99u6woqFS5vfBGSNyKG42SzpvBMWWqAy48' as Blockhash;
const blockhashEncoder = getBlockhashEncoder();
const blockhashBytes = blockhashEncoder.encode(blockhash);
// Uint8Array(32) [
//   136, 123,  44, 249,  43,  19,  60,  14,
//   144,  16, 168, 241, 121, 111,  70, 232,
//   186,  26, 140, 202, 213,  64, 231,  82,
//   179,  66, 103, 237,  52, 117, 217,  93
// ]

On this page