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