@solana/spl-type-length-value
v0.2.0
Published
SPL Type Length Value Library
Downloads
410,100
Readme
Type-Length-Value-js
Library with utilities for working with Type-Length-Value structures in js.
Example usage
import { TlvState, SplDiscriminator } from '@solana/spl-type-length-value';
const tlv = new TlvState(tlvData, discriminatorSize, lengthSize);
const discriminator = await splDiscriminate("<discriminator-hash-input>", discriminatorSize);
const firstValue = tlv.firstBytes(discriminator);
const allValues = tlv.bytesRepeating(discriminator);
const firstThreeValues = tlv.bytesRepeating(discriminator, 3);