"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.RENT_CLAIM_DISCRIMINATOR = void 0;
exports.getRentClaimDiscriminatorBytes = getRentClaimDiscriminatorBytes;
exports.getRentClaimEncoder = getRentClaimEncoder;
exports.getRentClaimDecoder = getRentClaimDecoder;
exports.getRentClaimCodec = getRentClaimCodec;
exports.decodeRentClaim = decodeRentClaim;
exports.fetchRentClaim = fetchRentClaim;
exports.fetchMaybeRentClaim = fetchMaybeRentClaim;
exports.fetchAllRentClaim = fetchAllRentClaim;
exports.fetchAllMaybeRentClaim = fetchAllMaybeRentClaim;
exports.getRentClaimSize = getRentClaimSize;
const kit_1 = require("@solana/kit");
exports.RENT_CLAIM_DISCRIMINATOR = new Uint8Array([
    13, 5, 183, 82, 60, 122, 72, 11,
]);
function getRentClaimDiscriminatorBytes() {
    return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.RENT_CLAIM_DISCRIMINATOR);
}
function getRentClaimEncoder() {
    return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
        ['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
        ['amount', (0, kit_1.getU64Encoder)()],
    ]), (value) => ({ ...value, discriminator: exports.RENT_CLAIM_DISCRIMINATOR }));
}
function getRentClaimDecoder() {
    return (0, kit_1.getStructDecoder)([
        ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
        ['amount', (0, kit_1.getU64Decoder)()],
    ]);
}
function getRentClaimCodec() {
    return (0, kit_1.combineCodec)(getRentClaimEncoder(), getRentClaimDecoder());
}
function decodeRentClaim(encodedAccount) {
    return (0, kit_1.decodeAccount)(encodedAccount, getRentClaimDecoder());
}
async function fetchRentClaim(rpc, address, config) {
    const maybeAccount = await fetchMaybeRentClaim(rpc, address, config);
    (0, kit_1.assertAccountExists)(maybeAccount);
    return maybeAccount;
}
async function fetchMaybeRentClaim(rpc, address, config) {
    const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
    return decodeRentClaim(maybeAccount);
}
async function fetchAllRentClaim(rpc, addresses, config) {
    const maybeAccounts = await fetchAllMaybeRentClaim(rpc, addresses, config);
    (0, kit_1.assertAccountsExist)(maybeAccounts);
    return maybeAccounts;
}
async function fetchAllMaybeRentClaim(rpc, addresses, config) {
    const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
    return maybeAccounts.map((maybeAccount) => decodeRentClaim(maybeAccount));
}
function getRentClaimSize() {
    return 16;
}
