UNPKG

@wuwei-labs/srsly

Version:

[![npm version](https://img.shields.io/npm/v/ts-sdk-example.svg)](https://www.npmjs.com/package/ts-sdk-example)

35 lines 1.32 kB
import { getCloseRentalInstructionAsync, SRSLY_PROGRAM_ADDRESS, } from '../codama'; /** * Asynchronously creates an instruction to close a rental with minimal required parameters. * This is called by an owner to close a rental that was previously accepted by a borrower. * Derives rentalState, rentalThread, rentalTokenAccount and rentalAuthority automatically if not provided. * * @example * ```typescript * // Create the instruction with minimal parameters * const ix = await closeRental({ * borrower: borrowerAddress, * ownerTokenAccount: ownerTokenAccountAddress, * contract: contractAddress * }); * * // Add to transaction and sign * const tx = new Transaction().add(ix); * await sendAndConfirmTransaction(connection, tx, [owner]); * ``` * * @param params The simplified parameters for closing a rental * @returns A promise that resolves to the instruction to close a rental */ export async function closeRental(params) { const { borrower, ownerTokenAccount, contract, } = params; // Let codama derive the optional accounts const input = { borrower, ownerTokenAccount, contract, }; return getCloseRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS }); } export { getCloseRentalInstructionAsync }; //# sourceMappingURL=close.js.map