"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.GET_UNSAFE_DEPOSIT_ID_DISCRIMINATOR = void 0;
exports.getGetUnsafeDepositIdDiscriminatorBytes = getGetUnsafeDepositIdDiscriminatorBytes;
exports.getGetUnsafeDepositIdInstructionDataEncoder = getGetUnsafeDepositIdInstructionDataEncoder;
exports.getGetUnsafeDepositIdInstructionDataDecoder = getGetUnsafeDepositIdInstructionDataDecoder;
exports.getGetUnsafeDepositIdInstructionDataCodec = getGetUnsafeDepositIdInstructionDataCodec;
exports.getGetUnsafeDepositIdInstruction = getGetUnsafeDepositIdInstruction;
exports.parseGetUnsafeDepositIdInstruction = parseGetUnsafeDepositIdInstruction;
const web3_v2_js_1 = require("@solana/web3-v2.js");
const programs_1 = require("../programs");
exports.GET_UNSAFE_DEPOSIT_ID_DISCRIMINATOR = new Uint8Array([
    118, 10, 135, 0, 168, 243, 223, 117,
]);
function getGetUnsafeDepositIdDiscriminatorBytes() {
    return (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8).encode(exports.GET_UNSAFE_DEPOSIT_ID_DISCRIMINATOR);
}
function getGetUnsafeDepositIdInstructionDataEncoder() {
    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)],
        ['signer', (0, web3_v2_js_1.getAddressEncoder)()],
        ['depositor', (0, web3_v2_js_1.getAddressEncoder)()],
        ['depositNonce', (0, web3_v2_js_1.getU64Encoder)()],
    ]), (value) => ({
        ...value,
        discriminator: exports.GET_UNSAFE_DEPOSIT_ID_DISCRIMINATOR,
    }));
}
function getGetUnsafeDepositIdInstructionDataDecoder() {
    return (0, web3_v2_js_1.getStructDecoder)([
        ['discriminator', (0, web3_v2_js_1.fixDecoderSize)((0, web3_v2_js_1.getBytesDecoder)(), 8)],
        ['signer', (0, web3_v2_js_1.getAddressDecoder)()],
        ['depositor', (0, web3_v2_js_1.getAddressDecoder)()],
        ['depositNonce', (0, web3_v2_js_1.getU64Decoder)()],
    ]);
}
function getGetUnsafeDepositIdInstructionDataCodec() {
    return (0, web3_v2_js_1.combineCodec)(getGetUnsafeDepositIdInstructionDataEncoder(), getGetUnsafeDepositIdInstructionDataDecoder());
}
function getGetUnsafeDepositIdInstruction(input, config) {
    // Program address.
    const programAddress = config?.programAddress ?? programs_1.SVM_SPOKE_PROGRAM_ADDRESS;
    // Original args.
    const args = { ...input };
    const instruction = {
        programAddress,
        data: getGetUnsafeDepositIdInstructionDataEncoder().encode(args),
    };
    return instruction;
}
function parseGetUnsafeDepositIdInstruction(instruction) {
    return {
        programAddress: instruction.programAddress,
        data: getGetUnsafeDepositIdInstructionDataDecoder().decode(instruction.data),
    };
}
