"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.MINIMUM_DEPOSIT_DISCRIMINATOR = void 0;
exports.getMinimumDepositDiscriminatorBytes = getMinimumDepositDiscriminatorBytes;
exports.getMinimumDepositEncoder = getMinimumDepositEncoder;
exports.getMinimumDepositDecoder = getMinimumDepositDecoder;
exports.getMinimumDepositCodec = getMinimumDepositCodec;
exports.decodeMinimumDeposit = decodeMinimumDeposit;
exports.fetchMinimumDeposit = fetchMinimumDeposit;
exports.fetchMaybeMinimumDeposit = fetchMaybeMinimumDeposit;
exports.fetchAllMinimumDeposit = fetchAllMinimumDeposit;
exports.fetchAllMaybeMinimumDeposit = fetchAllMaybeMinimumDeposit;
exports.getMinimumDepositSize = getMinimumDepositSize;
const kit_1 = require("@solana/kit");
exports.MINIMUM_DEPOSIT_DISCRIMINATOR = new Uint8Array([
    218, 139, 120, 202, 3, 12, 233, 65,
]);
function getMinimumDepositDiscriminatorBytes() {
    return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.MINIMUM_DEPOSIT_DISCRIMINATOR);
}
function getMinimumDepositEncoder() {
    return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
        ['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
        ['amount', (0, kit_1.getU64Encoder)()],
        ['bump', (0, kit_1.getU8Encoder)()],
    ]), (value) => ({ ...value, discriminator: exports.MINIMUM_DEPOSIT_DISCRIMINATOR }));
}
function getMinimumDepositDecoder() {
    return (0, kit_1.getStructDecoder)([
        ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
        ['amount', (0, kit_1.getU64Decoder)()],
        ['bump', (0, kit_1.getU8Decoder)()],
    ]);
}
function getMinimumDepositCodec() {
    return (0, kit_1.combineCodec)(getMinimumDepositEncoder(), getMinimumDepositDecoder());
}
function decodeMinimumDeposit(encodedAccount) {
    return (0, kit_1.decodeAccount)(encodedAccount, getMinimumDepositDecoder());
}
async function fetchMinimumDeposit(rpc, address, config) {
    const maybeAccount = await fetchMaybeMinimumDeposit(rpc, address, config);
    (0, kit_1.assertAccountExists)(maybeAccount);
    return maybeAccount;
}
async function fetchMaybeMinimumDeposit(rpc, address, config) {
    const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
    return decodeMinimumDeposit(maybeAccount);
}
async function fetchAllMinimumDeposit(rpc, addresses, config) {
    const maybeAccounts = await fetchAllMaybeMinimumDeposit(rpc, addresses, config);
    (0, kit_1.assertAccountsExist)(maybeAccounts);
    return maybeAccounts;
}
async function fetchAllMaybeMinimumDeposit(rpc, addresses, config) {
    const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
    return maybeAccounts.map((maybeAccount) => decodeMinimumDeposit(maybeAccount));
}
function getMinimumDepositSize() {
    return 17;
}
