UNPKG

@kamino-finance/kliquidity-sdk

Version:

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

60 lines 3.51 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.SCOPE_CHAIN_ACCOUNT_DISCRIMINATOR = void 0; exports.getScopeChainAccountDiscriminatorBytes = getScopeChainAccountDiscriminatorBytes; exports.getScopeChainAccountEncoder = getScopeChainAccountEncoder; exports.getScopeChainAccountDecoder = getScopeChainAccountDecoder; exports.getScopeChainAccountCodec = getScopeChainAccountCodec; exports.decodeScopeChainAccount = decodeScopeChainAccount; exports.fetchScopeChainAccount = fetchScopeChainAccount; exports.fetchMaybeScopeChainAccount = fetchMaybeScopeChainAccount; exports.fetchAllScopeChainAccount = fetchAllScopeChainAccount; exports.fetchAllMaybeScopeChainAccount = fetchAllMaybeScopeChainAccount; exports.getScopeChainAccountSize = getScopeChainAccountSize; const kit_1 = require("@solana/kit"); exports.SCOPE_CHAIN_ACCOUNT_DISCRIMINATOR = new Uint8Array([180, 51, 138, 247, 240, 173, 119, 79]); function getScopeChainAccountDiscriminatorBytes() { return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.SCOPE_CHAIN_ACCOUNT_DISCRIMINATOR); } /** Gets the encoder for {@link ScopeChainAccountArgs} account data. */ function getScopeChainAccountEncoder() { return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)], ['chainArray', (0, kit_1.getArrayEncoder)((0, kit_1.getArrayEncoder)((0, kit_1.getU16Encoder)(), { size: 4 }), { size: 512 })]]), (value) => ({ ...value, discriminator: exports.SCOPE_CHAIN_ACCOUNT_DISCRIMINATOR })); } /** Gets the decoder for {@link ScopeChainAccount} account data. */ function getScopeChainAccountDecoder() { return (0, kit_1.getStructDecoder)([['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)], ['chainArray', (0, kit_1.getArrayDecoder)((0, kit_1.getArrayDecoder)((0, kit_1.getU16Decoder)(), { size: 4 }), { size: 512 })]]); } /** Gets the codec for {@link ScopeChainAccount} account data. */ function getScopeChainAccountCodec() { return (0, kit_1.combineCodec)(getScopeChainAccountEncoder(), getScopeChainAccountDecoder()); } function decodeScopeChainAccount(encodedAccount) { return (0, kit_1.decodeAccount)(encodedAccount, getScopeChainAccountDecoder()); } async function fetchScopeChainAccount(rpc, address, config) { const maybeAccount = await fetchMaybeScopeChainAccount(rpc, address, config); (0, kit_1.assertAccountExists)(maybeAccount); return maybeAccount; } async function fetchMaybeScopeChainAccount(rpc, address, config) { const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config); return decodeScopeChainAccount(maybeAccount); } async function fetchAllScopeChainAccount(rpc, addresses, config) { const maybeAccounts = await fetchAllMaybeScopeChainAccount(rpc, addresses, config); (0, kit_1.assertAccountsExist)(maybeAccounts); return maybeAccounts; } async function fetchAllMaybeScopeChainAccount(rpc, addresses, config) { const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config); return maybeAccounts.map((maybeAccount) => decodeScopeChainAccount(maybeAccount)); } function getScopeChainAccountSize() { return 4104; } //# sourceMappingURL=scopeChainAccount.js.map