UNPKG

@kamino-finance/farms-sdk

Version:
80 lines 3.89 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.GLOBAL_CONFIG_DISCRIMINATOR = void 0; exports.getGlobalConfigDiscriminatorBytes = getGlobalConfigDiscriminatorBytes; exports.getGlobalConfigEncoder = getGlobalConfigEncoder; exports.getGlobalConfigDecoder = getGlobalConfigDecoder; exports.getGlobalConfigCodec = getGlobalConfigCodec; exports.decodeGlobalConfig = decodeGlobalConfig; exports.fetchGlobalConfig = fetchGlobalConfig; exports.fetchMaybeGlobalConfig = fetchMaybeGlobalConfig; exports.fetchAllGlobalConfig = fetchAllGlobalConfig; exports.fetchAllMaybeGlobalConfig = fetchAllMaybeGlobalConfig; exports.getGlobalConfigSize = getGlobalConfigSize; const kit_1 = require("@solana/kit"); exports.GLOBAL_CONFIG_DISCRIMINATOR = new Uint8Array([ 149, 8, 156, 202, 160, 252, 176, 217, ]); function getGlobalConfigDiscriminatorBytes() { return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.GLOBAL_CONFIG_DISCRIMINATOR); } /** Gets the encoder for {@link GlobalConfigArgs} account data. */ function getGlobalConfigEncoder() { return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([ ["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)], ["globalAdmin", (0, kit_1.getAddressEncoder)()], ["treasuryFeeBps", (0, kit_1.getU64Encoder)()], ["treasuryVaultsAuthority", (0, kit_1.getAddressEncoder)()], ["treasuryVaultsAuthorityBump", (0, kit_1.getU64Encoder)()], ["pendingGlobalAdmin", (0, kit_1.getAddressEncoder)()], ["padding1", (0, kit_1.getArrayEncoder)((0, kit_1.getU128Encoder)(), { size: 126 })], ]), (value) => ({ ...value, discriminator: exports.GLOBAL_CONFIG_DISCRIMINATOR })); } /** Gets the decoder for {@link GlobalConfig} account data. */ function getGlobalConfigDecoder() { return (0, kit_1.getStructDecoder)([ ["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)], ["globalAdmin", (0, kit_1.getAddressDecoder)()], ["treasuryFeeBps", (0, kit_1.getU64Decoder)()], ["treasuryVaultsAuthority", (0, kit_1.getAddressDecoder)()], ["treasuryVaultsAuthorityBump", (0, kit_1.getU64Decoder)()], ["pendingGlobalAdmin", (0, kit_1.getAddressDecoder)()], ["padding1", (0, kit_1.getArrayDecoder)((0, kit_1.getU128Decoder)(), { size: 126 })], ]); } /** Gets the codec for {@link GlobalConfig} account data. */ function getGlobalConfigCodec() { return (0, kit_1.combineCodec)(getGlobalConfigEncoder(), getGlobalConfigDecoder()); } function decodeGlobalConfig(encodedAccount) { return (0, kit_1.decodeAccount)(encodedAccount, getGlobalConfigDecoder()); } async function fetchGlobalConfig(rpc, address, config) { const maybeAccount = await fetchMaybeGlobalConfig(rpc, address, config); (0, kit_1.assertAccountExists)(maybeAccount); return maybeAccount; } async function fetchMaybeGlobalConfig(rpc, address, config) { const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config); return decodeGlobalConfig(maybeAccount); } async function fetchAllGlobalConfig(rpc, addresses, config) { const maybeAccounts = await fetchAllMaybeGlobalConfig(rpc, addresses, config); (0, kit_1.assertAccountsExist)(maybeAccounts); return maybeAccounts; } async function fetchAllMaybeGlobalConfig(rpc, addresses, config) { const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config); return maybeAccounts.map((maybeAccount) => decodeGlobalConfig(maybeAccount)); } function getGlobalConfigSize() { return 2136; } //# sourceMappingURL=globalConfig.js.map