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)

33 lines 1.2 kB
import { getCancelRentalInstructionAsync, SRSLY_PROGRAM_ADDRESS, } from '../codama'; /** * Asynchronously creates an instruction to cancel a rental with minimal required parameters. * Derives rentalState, rentalThread, borrowerTokenAccount, rentalTokenAccount and * rentalAuthority automatically if not provided. * * @example * ```typescript * // Create the instruction with minimal parameters - just borrower and contract * const ix = await cancelRental({ * borrower: wallet, * contract: contractAddress * }); * * // Add to transaction and sign * const tx = new Transaction().add(ix); * await sendAndConfirmTransaction(connection, tx, [wallet]); * ``` * * @param params The simplified parameters for canceling a rental * @returns A promise that resolves to the instruction to cancel a rental */ export async function cancelRental(params) { const { borrower, contract, } = params; // Let codama derive all the optional accounts const input = { borrower, contract, }; return getCancelRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS }); } export { getCancelRentalInstructionAsync }; //# sourceMappingURL=cancel.js.map