"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.TRANSFER_LIABILITY_DISCRIMINATOR = void 0;
exports.getTransferLiabilityDiscriminatorBytes = getTransferLiabilityDiscriminatorBytes;
exports.getTransferLiabilityEncoder = getTransferLiabilityEncoder;
exports.getTransferLiabilityDecoder = getTransferLiabilityDecoder;
exports.getTransferLiabilityCodec = getTransferLiabilityCodec;
exports.decodeTransferLiability = decodeTransferLiability;
exports.fetchTransferLiability = fetchTransferLiability;
exports.fetchMaybeTransferLiability = fetchMaybeTransferLiability;
exports.fetchAllTransferLiability = fetchAllTransferLiability;
exports.fetchAllMaybeTransferLiability = fetchAllMaybeTransferLiability;
exports.getTransferLiabilitySize = getTransferLiabilitySize;
const web3_v2_js_1 = require("@solana/web3-v2.js");
exports.TRANSFER_LIABILITY_DISCRIMINATOR = new Uint8Array([
    157, 137, 86, 109, 206, 241, 183, 79,
]);
function getTransferLiabilityDiscriminatorBytes() {
    return (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8).encode(exports.TRANSFER_LIABILITY_DISCRIMINATOR);
}
function getTransferLiabilityEncoder() {
    return (0, web3_v2_js_1.transformEncoder)((0, web3_v2_js_1.getStructEncoder)([
        ['discriminator', (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8)],
        ['pendingToHubPool', (0, web3_v2_js_1.getU64Encoder)()],
    ]), (value) => ({ ...value, discriminator: exports.TRANSFER_LIABILITY_DISCRIMINATOR }));
}
function getTransferLiabilityDecoder() {
    return (0, web3_v2_js_1.getStructDecoder)([
        ['discriminator', (0, web3_v2_js_1.fixDecoderSize)((0, web3_v2_js_1.getBytesDecoder)(), 8)],
        ['pendingToHubPool', (0, web3_v2_js_1.getU64Decoder)()],
    ]);
}
function getTransferLiabilityCodec() {
    return (0, web3_v2_js_1.combineCodec)(getTransferLiabilityEncoder(), getTransferLiabilityDecoder());
}
function decodeTransferLiability(encodedAccount) {
    return (0, web3_v2_js_1.decodeAccount)(encodedAccount, getTransferLiabilityDecoder());
}
async function fetchTransferLiability(rpc, address, config) {
    const maybeAccount = await fetchMaybeTransferLiability(rpc, address, config);
    (0, web3_v2_js_1.assertAccountExists)(maybeAccount);
    return maybeAccount;
}
async function fetchMaybeTransferLiability(rpc, address, config) {
    const maybeAccount = await (0, web3_v2_js_1.fetchEncodedAccount)(rpc, address, config);
    return decodeTransferLiability(maybeAccount);
}
async function fetchAllTransferLiability(rpc, addresses, config) {
    const maybeAccounts = await fetchAllMaybeTransferLiability(rpc, addresses, config);
    (0, web3_v2_js_1.assertAccountsExist)(maybeAccounts);
    return maybeAccounts;
}
async function fetchAllMaybeTransferLiability(rpc, addresses, config) {
    const maybeAccounts = await (0, web3_v2_js_1.fetchEncodedAccounts)(rpc, addresses, config);
    return maybeAccounts.map((maybeAccount) => decodeTransferLiability(maybeAccount));
}
function getTransferLiabilitySize() {
    return 16;
}
