UNPKG

@kamino-finance/kliquidity-sdk

Version:

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

60 lines 3.69 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.WHIRLPOOLS_CONFIG_DISCRIMINATOR = void 0; exports.getWhirlpoolsConfigDiscriminatorBytes = getWhirlpoolsConfigDiscriminatorBytes; exports.getWhirlpoolsConfigEncoder = getWhirlpoolsConfigEncoder; exports.getWhirlpoolsConfigDecoder = getWhirlpoolsConfigDecoder; exports.getWhirlpoolsConfigCodec = getWhirlpoolsConfigCodec; exports.decodeWhirlpoolsConfig = decodeWhirlpoolsConfig; exports.fetchWhirlpoolsConfig = fetchWhirlpoolsConfig; exports.fetchMaybeWhirlpoolsConfig = fetchMaybeWhirlpoolsConfig; exports.fetchAllWhirlpoolsConfig = fetchAllWhirlpoolsConfig; exports.fetchAllMaybeWhirlpoolsConfig = fetchAllMaybeWhirlpoolsConfig; exports.getWhirlpoolsConfigSize = getWhirlpoolsConfigSize; const kit_1 = require("@solana/kit"); exports.WHIRLPOOLS_CONFIG_DISCRIMINATOR = new Uint8Array([157, 20, 49, 224, 217, 87, 193, 254]); function getWhirlpoolsConfigDiscriminatorBytes() { return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.WHIRLPOOLS_CONFIG_DISCRIMINATOR); } /** Gets the encoder for {@link WhirlpoolsConfigArgs} account data. */ function getWhirlpoolsConfigEncoder() { return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)], ['feeAuthority', (0, kit_1.getAddressEncoder)()], ['collectProtocolFeesAuthority', (0, kit_1.getAddressEncoder)()], ['rewardEmissionsSuperAuthority', (0, kit_1.getAddressEncoder)()], ['defaultProtocolFeeRate', (0, kit_1.getU16Encoder)()]]), (value) => ({ ...value, discriminator: exports.WHIRLPOOLS_CONFIG_DISCRIMINATOR })); } /** Gets the decoder for {@link WhirlpoolsConfig} account data. */ function getWhirlpoolsConfigDecoder() { return (0, kit_1.getStructDecoder)([['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)], ['feeAuthority', (0, kit_1.getAddressDecoder)()], ['collectProtocolFeesAuthority', (0, kit_1.getAddressDecoder)()], ['rewardEmissionsSuperAuthority', (0, kit_1.getAddressDecoder)()], ['defaultProtocolFeeRate', (0, kit_1.getU16Decoder)()]]); } /** Gets the codec for {@link WhirlpoolsConfig} account data. */ function getWhirlpoolsConfigCodec() { return (0, kit_1.combineCodec)(getWhirlpoolsConfigEncoder(), getWhirlpoolsConfigDecoder()); } function decodeWhirlpoolsConfig(encodedAccount) { return (0, kit_1.decodeAccount)(encodedAccount, getWhirlpoolsConfigDecoder()); } async function fetchWhirlpoolsConfig(rpc, address, config) { const maybeAccount = await fetchMaybeWhirlpoolsConfig(rpc, address, config); (0, kit_1.assertAccountExists)(maybeAccount); return maybeAccount; } async function fetchMaybeWhirlpoolsConfig(rpc, address, config) { const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config); return decodeWhirlpoolsConfig(maybeAccount); } async function fetchAllWhirlpoolsConfig(rpc, addresses, config) { const maybeAccounts = await fetchAllMaybeWhirlpoolsConfig(rpc, addresses, config); (0, kit_1.assertAccountsExist)(maybeAccounts); return maybeAccounts; } async function fetchAllMaybeWhirlpoolsConfig(rpc, addresses, config) { const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config); return maybeAccounts.map((maybeAccount) => decodeWhirlpoolsConfig(maybeAccount)); } function getWhirlpoolsConfigSize() { return 106; } //# sourceMappingURL=whirlpoolsConfig.js.map