@wuwei-labs/srsly
Version:
[](https://www.npmjs.com/package/ts-sdk-example)
56 lines • 2 kB
TypeScript
import { Address, TransactionSigner } from '@solana/kit';
import { CloseContractInstruction, getCloseContractInstructionAsync } from '../codama';
/**
* Simplified parameters for closing a rental contract
*/
export interface CloseContractParams {
/**
* The owner wallet that will sign the transaction
*/
owner: TransactionSigner<string>;
/**
* The fleet account address associated with the contract
*/
fleet: Address<string>;
/**
* The rental contract account address to close
*/
contract: Address<string>;
/**
* Optional faction (1 = mud, 2 = oni, 3 = ustur)
* Or as string: 'mud', 'oni', 'ustur'
*/
faction: number | string;
/**
* The game ID account address
* Defaults to 'GAMEzqJehF8yAnKiTARUuhZMvLvkZVAsCVri5vSfemLr' if not provided
*/
gameId?: Address<string>;
}
/**
* Asynchronously creates an instruction to close a rental contract with minimal required parameters.
* Derives rentalAuthority automatically and handles optional parameters.
*
* @example
* ```typescript
* // Create the instruction with automatic account derivation
* const ix = await closeContract({
* owner: wallet,
* fleet: fleetAddress,
* contract: contractAddress,
* faction: 'mud', // Only needed if starbase and starbasePlayer not provided
* // Optional: provide explicit starbase and starbasePlayer if you have them
* // Optional: provide rentalState and rentalTokenAccount if active rental exists
* });
*
* // Add to transaction and sign
* const tx = new Transaction().add(ix);
* await sendAndConfirmTransaction(connection, tx, [wallet]);
* ```
*
* @param params The simplified parameters for closing a rental contract
* @returns A promise that resolves to the instruction to close a contract
*/
export declare function closeContract(params: CloseContractParams): Promise<CloseContractInstruction>;
export { getCloseContractInstructionAsync };
//# sourceMappingURL=close.d.ts.map