@kamino-finance/api-utils
v0.1.1
Published
Browser-safe protobuf codecs for Kamino Solana APIs
Maintainers
Keywords
Readme
@kamino-finance/api-utils
Protobuf codecs for Solana instructions and address lookup tables, encoding to
and from @solana/kit types.
import {
encodeInstruction,
decodeInstruction,
encodeAddressLookupTable,
decodeAddressLookupTable,
} from '@kamino-finance/api-utils';
const bytes = encodeInstruction(instruction); // kit Instruction -> Uint8Array
const same = decodeInstruction(bytes); // Uint8Array -> kit InstructionEach message is encoded on its own, so an API groups and orders instructions in its own JSON, typically as arrays of base64 strings.
Errors throw as InstructionCodecError with a code of MISSING_PUBKEY,
INVALID_PUBKEY_LENGTH or INVALID_WIRE_BYTES. Discriminate on code rather
than instanceof, which is not stable across the ESM and CommonJS builds.
Requires @solana/kit ^5 or ^6 as a peer dependency.
