UNPKG

@kamino-finance/kliquidity-sdk

Version:

Typescript SDK for interacting with the Kamino Liquidity (kliquidity) protocol

53 lines 3.11 kB
"use strict"; /** * This code was AUTOGENERATED using the Codama library. * Please DO NOT EDIT THIS FILE, instead use visitors * to add features, then rerun Codama to update it. * * @see https://github.com/codama-idl/codama */ Object.defineProperty(exports, "__esModule", { value: true }); exports.UPDATE_REWARD_INFOS_DISCRIMINATOR = void 0; exports.getUpdateRewardInfosDiscriminatorBytes = getUpdateRewardInfosDiscriminatorBytes; exports.getUpdateRewardInfosInstructionDataEncoder = getUpdateRewardInfosInstructionDataEncoder; exports.getUpdateRewardInfosInstructionDataDecoder = getUpdateRewardInfosInstructionDataDecoder; exports.getUpdateRewardInfosInstructionDataCodec = getUpdateRewardInfosInstructionDataCodec; exports.getUpdateRewardInfosInstruction = getUpdateRewardInfosInstruction; exports.parseUpdateRewardInfosInstruction = parseUpdateRewardInfosInstruction; const kit_1 = require("@solana/kit"); const programs_1 = require("../programs"); const shared_1 = require("../shared"); exports.UPDATE_REWARD_INFOS_DISCRIMINATOR = new Uint8Array([163, 172, 224, 52, 11, 154, 106, 223]); function getUpdateRewardInfosDiscriminatorBytes() { return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.UPDATE_REWARD_INFOS_DISCRIMINATOR); } function getUpdateRewardInfosInstructionDataEncoder() { return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.UPDATE_REWARD_INFOS_DISCRIMINATOR })); } function getUpdateRewardInfosInstructionDataDecoder() { return (0, kit_1.getStructDecoder)([['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)]]); } function getUpdateRewardInfosInstructionDataCodec() { return (0, kit_1.combineCodec)(getUpdateRewardInfosInstructionDataEncoder(), getUpdateRewardInfosInstructionDataDecoder()); } function getUpdateRewardInfosInstruction(input, config) { // Program address. const programAddress = config?.programAddress ?? programs_1.AMM_V3_PROGRAM_ADDRESS; // Original accounts. const originalAccounts = { poolState: { value: input.poolState ?? null, isWritable: true } }; const accounts = originalAccounts; const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId'); return Object.freeze({ accounts: [getAccountMeta(accounts.poolState)], data: getUpdateRewardInfosInstructionDataEncoder().encode({}), programAddress }); } function parseUpdateRewardInfosInstruction(instruction) { if (instruction.accounts.length < 1) { // TODO: Coded error. throw new Error('Not enough accounts'); } let accountIndex = 0; const getNextAccount = () => { const accountMeta = instruction.accounts[accountIndex]; accountIndex += 1; return accountMeta; }; return { programAddress: instruction.programAddress, accounts: { poolState: getNextAccount() }, data: getUpdateRewardInfosInstructionDataDecoder().decode(instruction.data) }; } //# sourceMappingURL=updateRewardInfos.js.map