getOffchainMessageV0Decoder

function getOffchainMessageV0Decoder(): VariableSizeDecoder<OffchainMessageV0>;

Returns a decoder that you can use to convert a byte array (eg. one that conforms to the OffchainMessageBytes type) to an OffchainMessageV0 object.

Returns

VariableSizeDecoder<OffchainMessageV0>

Example

import { getOffchainMessageV0Decoder } from '@solana/offchain-messages';
 
const offchainMessageDecoder = getOffchainMessageV0Decoder();
const offchainMessage = offchainMessageDecoder.decode(
    offchainMessageEnvelope.content,
);
console.log(`Decoded a v0 offchain message`);

Throws in the event that the message bytes represent a message of a version other than 0.

On this page