"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.DENYLISTED_ACCOUNT_DISCRIMINATOR = void 0;
exports.getDenylistedAccountDiscriminatorBytes = getDenylistedAccountDiscriminatorBytes;
exports.getDenylistedAccountEncoder = getDenylistedAccountEncoder;
exports.getDenylistedAccountDecoder = getDenylistedAccountDecoder;
exports.getDenylistedAccountCodec = getDenylistedAccountCodec;
exports.decodeDenylistedAccount = decodeDenylistedAccount;
exports.fetchDenylistedAccount = fetchDenylistedAccount;
exports.fetchMaybeDenylistedAccount = fetchMaybeDenylistedAccount;
exports.fetchAllDenylistedAccount = fetchAllDenylistedAccount;
exports.fetchAllMaybeDenylistedAccount = fetchAllMaybeDenylistedAccount;
exports.getDenylistedAccountSize = getDenylistedAccountSize;
const kit_1 = require("@solana/kit");
exports.DENYLISTED_ACCOUNT_DISCRIMINATOR = new Uint8Array([
    186, 58, 212, 239, 102, 131, 157, 146,
]);
function getDenylistedAccountDiscriminatorBytes() {
    return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.DENYLISTED_ACCOUNT_DISCRIMINATOR);
}
function getDenylistedAccountEncoder() {
    return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
        ['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
        ['account', (0, kit_1.getAddressEncoder)()],
    ]), (value) => ({ ...value, discriminator: exports.DENYLISTED_ACCOUNT_DISCRIMINATOR }));
}
function getDenylistedAccountDecoder() {
    return (0, kit_1.getStructDecoder)([
        ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
        ['account', (0, kit_1.getAddressDecoder)()],
    ]);
}
function getDenylistedAccountCodec() {
    return (0, kit_1.combineCodec)(getDenylistedAccountEncoder(), getDenylistedAccountDecoder());
}
function decodeDenylistedAccount(encodedAccount) {
    return (0, kit_1.decodeAccount)(encodedAccount, getDenylistedAccountDecoder());
}
async function fetchDenylistedAccount(rpc, address, config) {
    const maybeAccount = await fetchMaybeDenylistedAccount(rpc, address, config);
    (0, kit_1.assertAccountExists)(maybeAccount);
    return maybeAccount;
}
async function fetchMaybeDenylistedAccount(rpc, address, config) {
    const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
    return decodeDenylistedAccount(maybeAccount);
}
async function fetchAllDenylistedAccount(rpc, addresses, config) {
    const maybeAccounts = await fetchAllMaybeDenylistedAccount(rpc, addresses, config);
    (0, kit_1.assertAccountsExist)(maybeAccounts);
    return maybeAccounts;
}
async function fetchAllMaybeDenylistedAccount(rpc, addresses, config) {
    const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
    return maybeAccounts.map((maybeAccount) => decodeDenylistedAccount(maybeAccount));
}
function getDenylistedAccountSize() {
    return 40;
}
