UNPKG

@kamino-finance/kliquidity-sdk

Version:

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

60 lines 3.39 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.POSITION_BUNDLE_DISCRIMINATOR = void 0; exports.getPositionBundleDiscriminatorBytes = getPositionBundleDiscriminatorBytes; exports.getPositionBundleEncoder = getPositionBundleEncoder; exports.getPositionBundleDecoder = getPositionBundleDecoder; exports.getPositionBundleCodec = getPositionBundleCodec; exports.decodePositionBundle = decodePositionBundle; exports.fetchPositionBundle = fetchPositionBundle; exports.fetchMaybePositionBundle = fetchMaybePositionBundle; exports.fetchAllPositionBundle = fetchAllPositionBundle; exports.fetchAllMaybePositionBundle = fetchAllMaybePositionBundle; exports.getPositionBundleSize = getPositionBundleSize; const kit_1 = require("@solana/kit"); exports.POSITION_BUNDLE_DISCRIMINATOR = new Uint8Array([129, 169, 175, 65, 185, 95, 32, 100]); function getPositionBundleDiscriminatorBytes() { return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.POSITION_BUNDLE_DISCRIMINATOR); } /** Gets the encoder for {@link PositionBundleArgs} account data. */ function getPositionBundleEncoder() { return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)], ['positionBundleMint', (0, kit_1.getAddressEncoder)()], ['positionBitmap', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)]]), (value) => ({ ...value, discriminator: exports.POSITION_BUNDLE_DISCRIMINATOR })); } /** Gets the decoder for {@link PositionBundle} account data. */ function getPositionBundleDecoder() { return (0, kit_1.getStructDecoder)([['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)], ['positionBundleMint', (0, kit_1.getAddressDecoder)()], ['positionBitmap', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)]]); } /** Gets the codec for {@link PositionBundle} account data. */ function getPositionBundleCodec() { return (0, kit_1.combineCodec)(getPositionBundleEncoder(), getPositionBundleDecoder()); } function decodePositionBundle(encodedAccount) { return (0, kit_1.decodeAccount)(encodedAccount, getPositionBundleDecoder()); } async function fetchPositionBundle(rpc, address, config) { const maybeAccount = await fetchMaybePositionBundle(rpc, address, config); (0, kit_1.assertAccountExists)(maybeAccount); return maybeAccount; } async function fetchMaybePositionBundle(rpc, address, config) { const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config); return decodePositionBundle(maybeAccount); } async function fetchAllPositionBundle(rpc, addresses, config) { const maybeAccounts = await fetchAllMaybePositionBundle(rpc, addresses, config); (0, kit_1.assertAccountsExist)(maybeAccounts); return maybeAccounts; } async function fetchAllMaybePositionBundle(rpc, addresses, config) { const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config); return maybeAccounts.map((maybeAccount) => decodePositionBundle(maybeAccount)); } function getPositionBundleSize() { return 72; } //# sourceMappingURL=positionBundle.js.map