/**
 * 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
 */
import { __assign, __awaiter, __generator } from "tslib";
import { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getArrayDecoder, getArrayEncoder, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, transformEncoder, } from "@solana/kit";
import { getSlowFillDecoder, getSlowFillEncoder, } from "../types";
export var EXECUTE_SLOW_RELAY_LEAF_PARAMS_DISCRIMINATOR = new Uint8Array([
    135, 208, 119, 251, 14, 222, 66, 155,
]);
export function getExecuteSlowRelayLeafParamsDiscriminatorBytes() {
    return fixEncoderSize(getBytesEncoder(), 8).encode(EXECUTE_SLOW_RELAY_LEAF_PARAMS_DISCRIMINATOR);
}
/** Gets the encoder for {@link ExecuteSlowRelayLeafParamsArgs} account data. */
export function getExecuteSlowRelayLeafParamsEncoder() {
    return transformEncoder(getStructEncoder([
        ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
        ["slowFillLeaf", getSlowFillEncoder()],
        ["rootBundleId", getU32Encoder()],
        ["proof", getArrayEncoder(fixEncoderSize(getBytesEncoder(), 32))],
    ]), function (value) { return (__assign(__assign({}, value), { discriminator: EXECUTE_SLOW_RELAY_LEAF_PARAMS_DISCRIMINATOR })); });
}
/** Gets the decoder for {@link ExecuteSlowRelayLeafParams} account data. */
export function getExecuteSlowRelayLeafParamsDecoder() {
    return getStructDecoder([
        ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
        ["slowFillLeaf", getSlowFillDecoder()],
        ["rootBundleId", getU32Decoder()],
        ["proof", getArrayDecoder(fixDecoderSize(getBytesDecoder(), 32))],
    ]);
}
/** Gets the codec for {@link ExecuteSlowRelayLeafParams} account data. */
export function getExecuteSlowRelayLeafParamsCodec() {
    return combineCodec(getExecuteSlowRelayLeafParamsEncoder(), getExecuteSlowRelayLeafParamsDecoder());
}
export function decodeExecuteSlowRelayLeafParams(encodedAccount) {
    return decodeAccount(encodedAccount, getExecuteSlowRelayLeafParamsDecoder());
}
export function fetchExecuteSlowRelayLeafParams(rpc, address, config) {
    return __awaiter(this, void 0, void 0, function () {
        var maybeAccount;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0: return [4 /*yield*/, fetchMaybeExecuteSlowRelayLeafParams(rpc, address, config)];
                case 1:
                    maybeAccount = _a.sent();
                    assertAccountExists(maybeAccount);
                    return [2 /*return*/, maybeAccount];
            }
        });
    });
}
export function fetchMaybeExecuteSlowRelayLeafParams(rpc, address, config) {
    return __awaiter(this, void 0, void 0, function () {
        var maybeAccount;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0: return [4 /*yield*/, fetchEncodedAccount(rpc, address, config)];
                case 1:
                    maybeAccount = _a.sent();
                    return [2 /*return*/, decodeExecuteSlowRelayLeafParams(maybeAccount)];
            }
        });
    });
}
export function fetchAllExecuteSlowRelayLeafParams(rpc, addresses, config) {
    return __awaiter(this, void 0, void 0, function () {
        var maybeAccounts;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0: return [4 /*yield*/, fetchAllMaybeExecuteSlowRelayLeafParams(rpc, addresses, config)];
                case 1:
                    maybeAccounts = _a.sent();
                    assertAccountsExist(maybeAccounts);
                    return [2 /*return*/, maybeAccounts];
            }
        });
    });
}
export function fetchAllMaybeExecuteSlowRelayLeafParams(rpc, addresses, config) {
    return __awaiter(this, void 0, void 0, function () {
        var maybeAccounts;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0: return [4 /*yield*/, fetchEncodedAccounts(rpc, addresses, config)];
                case 1:
                    maybeAccounts = _a.sent();
                    return [2 /*return*/, maybeAccounts.map(function (maybeAccount) {
                            return decodeExecuteSlowRelayLeafParams(maybeAccount);
                        })];
            }
        });
    });
}
//# sourceMappingURL=executeSlowRelayLeafParams.js.map