"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.REQUEST_SLOW_FILL_PARAMS_DISCRIMINATOR = void 0;
exports.getRequestSlowFillParamsDiscriminatorBytes = getRequestSlowFillParamsDiscriminatorBytes;
exports.getRequestSlowFillParamsEncoder = getRequestSlowFillParamsEncoder;
exports.getRequestSlowFillParamsDecoder = getRequestSlowFillParamsDecoder;
exports.getRequestSlowFillParamsCodec = getRequestSlowFillParamsCodec;
exports.decodeRequestSlowFillParams = decodeRequestSlowFillParams;
exports.fetchRequestSlowFillParams = fetchRequestSlowFillParams;
exports.fetchMaybeRequestSlowFillParams = fetchMaybeRequestSlowFillParams;
exports.fetchAllRequestSlowFillParams = fetchAllRequestSlowFillParams;
exports.fetchAllMaybeRequestSlowFillParams = fetchAllMaybeRequestSlowFillParams;
const web3_v2_js_1 = require("@solana/web3-v2.js");
const types_1 = require("../types");
exports.REQUEST_SLOW_FILL_PARAMS_DISCRIMINATOR = new Uint8Array([
    5, 54, 214, 89, 197, 37, 118, 28,
]);
function getRequestSlowFillParamsDiscriminatorBytes() {
    return (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8).encode(exports.REQUEST_SLOW_FILL_PARAMS_DISCRIMINATOR);
}
function getRequestSlowFillParamsEncoder() {
    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)],
        ['relayData', (0, types_1.getRelayDataEncoder)()],
    ]), (value) => ({
        ...value,
        discriminator: exports.REQUEST_SLOW_FILL_PARAMS_DISCRIMINATOR,
    }));
}
function getRequestSlowFillParamsDecoder() {
    return (0, web3_v2_js_1.getStructDecoder)([
        ['discriminator', (0, web3_v2_js_1.fixDecoderSize)((0, web3_v2_js_1.getBytesDecoder)(), 8)],
        ['relayData', (0, types_1.getRelayDataDecoder)()],
    ]);
}
function getRequestSlowFillParamsCodec() {
    return (0, web3_v2_js_1.combineCodec)(getRequestSlowFillParamsEncoder(), getRequestSlowFillParamsDecoder());
}
function decodeRequestSlowFillParams(encodedAccount) {
    return (0, web3_v2_js_1.decodeAccount)(encodedAccount, getRequestSlowFillParamsDecoder());
}
async function fetchRequestSlowFillParams(rpc, address, config) {
    const maybeAccount = await fetchMaybeRequestSlowFillParams(rpc, address, config);
    (0, web3_v2_js_1.assertAccountExists)(maybeAccount);
    return maybeAccount;
}
async function fetchMaybeRequestSlowFillParams(rpc, address, config) {
    const maybeAccount = await (0, web3_v2_js_1.fetchEncodedAccount)(rpc, address, config);
    return decodeRequestSlowFillParams(maybeAccount);
}
async function fetchAllRequestSlowFillParams(rpc, addresses, config) {
    const maybeAccounts = await fetchAllMaybeRequestSlowFillParams(rpc, addresses, config);
    (0, web3_v2_js_1.assertAccountsExist)(maybeAccounts);
    return maybeAccounts;
}
async function fetchAllMaybeRequestSlowFillParams(rpc, addresses, config) {
    const maybeAccounts = await (0, web3_v2_js_1.fetchEncodedAccounts)(rpc, addresses, config);
    return maybeAccounts.map((maybeAccount) => decodeRequestSlowFillParams(maybeAccount));
}
