"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAcrossPlusMessageEncoder = getAcrossPlusMessageEncoder;
exports.getAcrossPlusMessageDecoder = getAcrossPlusMessageDecoder;
exports.getHandlerMessageEncoder = getHandlerMessageEncoder;
exports.getHandlerMessageDecoder = getHandlerMessageDecoder;
exports.getCompiledIxEncoder = getCompiledIxEncoder;
exports.getCompiledIxDecoder = getCompiledIxDecoder;
exports.getAccountMeta = getAccountMeta;
const kit_1 = require("@solana/kit");
function getAcrossPlusMessageEncoder() {
    return (0, kit_1.getStructEncoder)([
        ["handler", (0, kit_1.getAddressEncoder)()],
        ["read_only_len", (0, kit_1.getU8Encoder)()],
        ["value_amount", (0, kit_1.getU64Encoder)()],
        ["accounts", (0, kit_1.getArrayEncoder)((0, kit_1.getAddressEncoder)())],
        ["handler_message", (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
    ]);
}
function getAcrossPlusMessageDecoder() {
    return (0, kit_1.getStructDecoder)([
        ["handler", (0, kit_1.getAddressDecoder)()],
        ["read_only_len", (0, kit_1.getU8Decoder)()],
        ["value_amount", (0, kit_1.getU64Decoder)()],
        ["accounts", (0, kit_1.getArrayDecoder)((0, kit_1.getAddressDecoder)())],
        ["handler_message", (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
    ]);
}
function getHandlerMessageEncoder() {
    return (0, kit_1.getArrayEncoder)(getCompiledIxEncoder());
}
function getHandlerMessageDecoder() {
    return (0, kit_1.getArrayDecoder)(getCompiledIxDecoder());
}
function getCompiledIxEncoder() {
    return (0, kit_1.getStructEncoder)([
        ["program_id_index", (0, kit_1.getU8Encoder)()],
        ["account_key_indexes", (0, kit_1.getArrayEncoder)((0, kit_1.getU8Encoder)())],
        ["data", (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
    ]);
}
function getCompiledIxDecoder() {
    return (0, kit_1.getStructDecoder)([
        ["program_id_index", (0, kit_1.getU8Decoder)()],
        ["account_key_indexes", (0, kit_1.getArrayDecoder)((0, kit_1.getU8Decoder)())],
        ["data", (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
    ]);
}
function getAccountMeta(value, isWritable) {
    return Object.freeze({
        address: value,
        role: isWritable ? kit_1.AccountRole.WRITABLE : kit_1.AccountRole.READONLY,
    });
}
//# sourceMappingURL=encoders.js.map