/** * This code was GENERATED using the solita package. * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. * * See: https://github.com/metaplex-foundation/solita */ import * as beet from '@metaplex-foundation/beet' import * as web3 from '@solana/web3.js' import { BookRentalArgs, bookRentalArgsBeet } from '../types/BookRentalArgs' /** * @category Instructions * @category BookRental * @category generated */ export type BookRentalInstructionArgs = { bookRentalArgs: BookRentalArgs } /** * @category Instructions * @category BookRental * @category generated */ export const BookRentalStruct = new beet.FixableBeetArgsStruct< BookRentalInstructionArgs & { instructionDiscriminator: number } >( [ ['instructionDiscriminator', beet.u8], ['bookRentalArgs', bookRentalArgsBeet], ], 'BookRentalInstructionArgs' ) /** * Accounts required by the _BookRental_ instruction * * @property [_writable_] rentalAccount The account that will represent the actual order for the rental * @property [] carAccount The account representing the Car being rented in this order * @property [_writable_] payer Fee payer * @category Instructions * @category BookRental * @category generated */ export type BookRentalInstructionAccounts = { rentalAccount: web3.PublicKey carAccount: web3.PublicKey payer: web3.PublicKey systemProgram?: web3.PublicKey } export const bookRentalInstructionDiscriminator = 1 /** * Creates a _BookRental_ instruction. * * @param accounts that will be accessed while the instruction is processed * @param args to provide as instruction data to the program * * @category Instructions * @category BookRental * @category generated */ export function createBookRentalInstruction( accounts: BookRentalInstructionAccounts, args: BookRentalInstructionArgs, programId = new web3.PublicKey('8avNGHVXDwsELJaWMSoUZ44CirQd4zyU9Ez4ZmP4jNjZ') ) { const [data] = BookRentalStruct.serialize({ instructionDiscriminator: bookRentalInstructionDiscriminator, ...args, }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.rentalAccount, isWritable: true, isSigner: false, }, { pubkey: accounts.carAccount, isWritable: false, isSigner: false, }, { pubkey: accounts.payer, isWritable: true, isSigner: false, }, { pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, isWritable: false, isSigner: false, }, ] const ix = new web3.TransactionInstruction({ programId, keys, data, }) return ix }