@wuwei-labs/srsly
Version:
[](https://www.npmjs.com/package/ts-sdk-example)
71 lines • 2.26 kB
TypeScript
import { Address } from '@solana/kit';
import { ResetRentalInstruction, getResetRentalInstructionAsync } from '../codama';
/**
* Simplified parameters for resetting a rental
*/
export interface ResetRentalParams {
/**
* The fleet account address
*/
fleet: Address<string>;
/**
* The rental contract account address
*/
contract: Address<string>;
/**
* The rental state account address
*/
rentalState: Address<string>;
/**
* The game ID account address
* Defaults to the standard game ID if not provided
*/
gameId?: Address<string>;
/**
* Optional faction (1 = mud, 2 = oni, 3 = ustur)
* Or as string: 'mud', 'oni', 'ustur'
* Only needed if starbase and starbasePlayer are not provided
*/
faction: number | string;
/**
* The owner's profile address
* Needed only if faction is provided to derive starbasePlayer
*/
ownerProfile: Address<string>;
}
/**
* Asynchronously creates an instruction to reset a rental with minimal required parameters.
* This is used to reset a fleet's rental state after a rental has ended.
* Can derive starbase, starbasePlayer, and rentalAuthority automatically.
*
* @example
* ```typescript
* // Create the instruction with minimum required parameters and faction
* const ix = await resetRental({
* fleet: fleetAddress,
* contract: contractAddress,
* rentalState: rentalStateAddress,
* faction: 'mud',
* ownerProfile: ownerProfileAddress
* });
*
* // Or with explicit starbase and starbasePlayer
* const ix = await resetRental({
* fleet: fleetAddress,
* contract: contractAddress,
* rentalState: rentalStateAddress,
* starbase: starbaseAddress,
* starbasePlayer: starbasePlayerAddress
* });
*
* // Add to transaction and sign
* const tx = new Transaction().add(ix);
* await sendAndConfirmTransaction(connection, tx, [owner]);
* ```
*
* @param params The simplified parameters for resetting a rental
* @returns A promise that resolves to the instruction to reset a rental
*/
export declare function resetRental(params: ResetRentalParams): Promise<ResetRentalInstruction>;
export { getResetRentalInstructionAsync };
//# sourceMappingURL=reset.d.ts.map