/**
 * 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 } from "tslib";
import { addDecoderSizePrefix, addEncoderSizePrefix, combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, transformEncoder, } from "@solana/kit";
import { MULTICALL_HANDLER_PROGRAM_ADDRESS } from "../programs";
export var HANDLE_V3_ACROSS_MESSAGE_DISCRIMINATOR = new Uint8Array([
    131, 141, 52, 71, 16, 59, 196, 92,
]);
export function getHandleV3AcrossMessageDiscriminatorBytes() {
    return fixEncoderSize(getBytesEncoder(), 8).encode(HANDLE_V3_ACROSS_MESSAGE_DISCRIMINATOR);
}
export function getHandleV3AcrossMessageInstructionDataEncoder() {
    return transformEncoder(getStructEncoder([
        ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
        ["message", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
    ]), function (value) { return (__assign(__assign({}, value), { discriminator: HANDLE_V3_ACROSS_MESSAGE_DISCRIMINATOR })); });
}
export function getHandleV3AcrossMessageInstructionDataDecoder() {
    return getStructDecoder([
        ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
        ["message", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
    ]);
}
export function getHandleV3AcrossMessageInstructionDataCodec() {
    return combineCodec(getHandleV3AcrossMessageInstructionDataEncoder(), getHandleV3AcrossMessageInstructionDataDecoder());
}
export function getHandleV3AcrossMessageInstruction(input, config) {
    var _a;
    // Program address.
    var programAddress = (_a = config === null || config === void 0 ? void 0 : config.programAddress) !== null && _a !== void 0 ? _a : MULTICALL_HANDLER_PROGRAM_ADDRESS;
    // Original args.
    var args = __assign({}, input);
    return Object.freeze({
        data: getHandleV3AcrossMessageInstructionDataEncoder().encode(args),
        programAddress: programAddress,
    });
}
export function parseHandleV3AcrossMessageInstruction(instruction) {
    return {
        programAddress: instruction.programAddress,
        data: getHandleV3AcrossMessageInstructionDataDecoder().decode(instruction.data),
    };
}
//# sourceMappingURL=handleV3AcrossMessage.js.map