UNPKG

@wuwei-labs/srsly

Version:
114 lines 5.7 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.CONFIG_STATE_DISCRIMINATOR = void 0; exports.getConfigStateDiscriminatorBytes = getConfigStateDiscriminatorBytes; exports.getConfigStateEncoder = getConfigStateEncoder; exports.getConfigStateDecoder = getConfigStateDecoder; exports.getConfigStateCodec = getConfigStateCodec; exports.decodeConfigState = decodeConfigState; exports.fetchConfigState = fetchConfigState; exports.fetchMaybeConfigState = fetchMaybeConfigState; exports.fetchAllConfigState = fetchAllConfigState; exports.fetchAllMaybeConfigState = fetchAllMaybeConfigState; exports.getConfigStateSize = getConfigStateSize; const kit_1 = require("@solana/kit"); exports.CONFIG_STATE_DISCRIMINATOR = new Uint8Array([193, 77, 160, 128, 208, 254, 180, 135]); function getConfigStateDiscriminatorBytes() { return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.CONFIG_STATE_DISCRIMINATOR); } /** Gets the encoder for {@link ConfigStateArgs} account data. */ function getConfigStateEncoder() { return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([ ['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)], ['version', (0, kit_1.getU32Encoder)()], ['bump', (0, kit_1.getU8Encoder)()], ['admin', (0, kit_1.getAddressEncoder)()], ['stardustToAtlas', (0, kit_1.getU64Encoder)()], ['serviceFeeBps', (0, kit_1.getU64Encoder)()], ['baseBps', (0, kit_1.getU16Encoder)()], ['rentalDurationMinSeconds', (0, kit_1.getI64Encoder)()], ['rentalDurationMaxSeconds', (0, kit_1.getI64Encoder)()], ['atlasMint', (0, kit_1.getAddressEncoder)()], ['slyvault', (0, kit_1.getAddressEncoder)()], ['reservationsEnabled', (0, kit_1.getBooleanEncoder)()], ['pointsPerDay', (0, kit_1.getU64Encoder)()], ['cancellationPenalty', (0, kit_1.getU64Encoder)()], ['minCaptureThreshold', (0, kit_1.getU64Encoder)()], ['weightBase', (0, kit_1.getU32Encoder)()], ['weightMultiplier', (0, kit_1.getF32Encoder)()], ['maxWeight', (0, kit_1.getU8Encoder)()], ['captureRateBps', (0, kit_1.getU64Encoder)()], ['atlasPerPoint', (0, kit_1.getU64Encoder)()], ['contestedMultiplierMaxBps', (0, kit_1.getU16Encoder)()], ['rentalsCompleted', (0, kit_1.getU64Encoder)()], ['lookupTable', (0, kit_1.getAddressEncoder)()], ['createdAt', (0, kit_1.getI64Encoder)()], ['updatedAt', (0, kit_1.getI64Encoder)()], ]), value => ({ ...value, discriminator: exports.CONFIG_STATE_DISCRIMINATOR })); } /** Gets the decoder for {@link ConfigState} account data. */ function getConfigStateDecoder() { return (0, kit_1.getStructDecoder)([ ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)], ['version', (0, kit_1.getU32Decoder)()], ['bump', (0, kit_1.getU8Decoder)()], ['admin', (0, kit_1.getAddressDecoder)()], ['stardustToAtlas', (0, kit_1.getU64Decoder)()], ['serviceFeeBps', (0, kit_1.getU64Decoder)()], ['baseBps', (0, kit_1.getU16Decoder)()], ['rentalDurationMinSeconds', (0, kit_1.getI64Decoder)()], ['rentalDurationMaxSeconds', (0, kit_1.getI64Decoder)()], ['atlasMint', (0, kit_1.getAddressDecoder)()], ['slyvault', (0, kit_1.getAddressDecoder)()], ['reservationsEnabled', (0, kit_1.getBooleanDecoder)()], ['pointsPerDay', (0, kit_1.getU64Decoder)()], ['cancellationPenalty', (0, kit_1.getU64Decoder)()], ['minCaptureThreshold', (0, kit_1.getU64Decoder)()], ['weightBase', (0, kit_1.getU32Decoder)()], ['weightMultiplier', (0, kit_1.getF32Decoder)()], ['maxWeight', (0, kit_1.getU8Decoder)()], ['captureRateBps', (0, kit_1.getU64Decoder)()], ['atlasPerPoint', (0, kit_1.getU64Decoder)()], ['contestedMultiplierMaxBps', (0, kit_1.getU16Decoder)()], ['rentalsCompleted', (0, kit_1.getU64Decoder)()], ['lookupTable', (0, kit_1.getAddressDecoder)()], ['createdAt', (0, kit_1.getI64Decoder)()], ['updatedAt', (0, kit_1.getI64Decoder)()], ]); } /** Gets the codec for {@link ConfigState} account data. */ function getConfigStateCodec() { return (0, kit_1.combineCodec)(getConfigStateEncoder(), getConfigStateDecoder()); } function decodeConfigState(encodedAccount) { return (0, kit_1.decodeAccount)(encodedAccount, getConfigStateDecoder()); } async function fetchConfigState(rpc, address, config) { const maybeAccount = await fetchMaybeConfigState(rpc, address, config); (0, kit_1.assertAccountExists)(maybeAccount); return maybeAccount; } async function fetchMaybeConfigState(rpc, address, config) { const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config); return decodeConfigState(maybeAccount); } async function fetchAllConfigState(rpc, addresses, config) { const maybeAccounts = await fetchAllMaybeConfigState(rpc, addresses, config); (0, kit_1.assertAccountsExist)(maybeAccounts); return maybeAccounts; } async function fetchAllMaybeConfigState(rpc, addresses, config) { const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config); return maybeAccounts.map(maybeAccount => decodeConfigState(maybeAccount)); } function getConfigStateSize() { return 251; } //# sourceMappingURL=configState.js.map