@wuwei-labs/srsly
Version:
[](https://www.npmjs.com/package/ts-sdk-example)
37 lines • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCancelRentalInstructionAsync = void 0;
exports.cancelRental = cancelRental;
const codama_1 = require("../codama");
Object.defineProperty(exports, "getCancelRentalInstructionAsync", { enumerable: true, get: function () { return codama_1.getCancelRentalInstructionAsync; } });
/**
* 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
*/
async function cancelRental(params) {
const { borrower, contract, } = params;
// Let codama derive all the optional accounts
const input = {
borrower,
contract,
};
return (0, codama_1.getCancelRentalInstructionAsync)(input, { programAddress: codama_1.SRSLY_PROGRAM_ADDRESS });
}
//# sourceMappingURL=cancel.js.map