"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DISCRIMINATOR = void 0;
exports.rolloverFixedTermBorrow = rolloverFixedTermBorrow;
/* eslint-disable @typescript-eslint/no-unused-vars */
const kit_1 = require("@solana/kit");
const programId_1 = require("../programId");
exports.DISCRIMINATOR = Buffer.from([85, 30, 155, 225, 224, 186, 141, 148]);
function rolloverFixedTermBorrow(accounts, remainingAccounts = [], programAddress = programId_1.PROGRAM_ID) {
    const keys = [
        {
            address: accounts.rolloverAccounts.payer.address,
            role: 2,
            signer: accounts.rolloverAccounts.payer,
        },
        { address: accounts.rolloverAccounts.obligation, role: 1 },
        { address: accounts.rolloverAccounts.lendingMarket, role: 0 },
        { address: accounts.rolloverAccounts.lendingMarketAuthority, role: 0 },
        { address: accounts.rolloverAccounts.sourceBorrowReserve, role: 1 },
        { address: accounts.rolloverAccounts.targetBorrowReserve, role: 1 },
        { address: accounts.rolloverAccounts.liquidityMint, role: 0 },
        {
            address: accounts.rolloverAccounts.sourceBorrowReserveLiquidity,
            role: 1,
        },
        {
            address: accounts.rolloverAccounts.targetBorrowReserveLiquidity,
            role: 1,
        },
        { address: accounts.rolloverAccounts.tokenProgram, role: 0 },
        (0, kit_1.isSome)(accounts.sourceFarmsAccounts.obligationFarmUserState)
            ? {
                address: accounts.sourceFarmsAccounts.obligationFarmUserState.value,
                role: 1,
            }
            : { address: programAddress, role: 0 },
        (0, kit_1.isSome)(accounts.sourceFarmsAccounts.reserveFarmState)
            ? {
                address: accounts.sourceFarmsAccounts.reserveFarmState.value,
                role: 1,
            }
            : { address: programAddress, role: 0 },
        (0, kit_1.isSome)(accounts.targetFarmsAccounts.obligationFarmUserState)
            ? {
                address: accounts.targetFarmsAccounts.obligationFarmUserState.value,
                role: 1,
            }
            : { address: programAddress, role: 0 },
        (0, kit_1.isSome)(accounts.targetFarmsAccounts.reserveFarmState)
            ? {
                address: accounts.targetFarmsAccounts.reserveFarmState.value,
                role: 1,
            }
            : { address: programAddress, role: 0 },
        { address: accounts.farmsProgram, role: 0 },
        ...remainingAccounts,
    ];
    const data = exports.DISCRIMINATOR;
    const ix = { accounts: keys, programAddress, data };
    return ix;
}
//# sourceMappingURL=rolloverFixedTermBorrow.js.map