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)

70 lines 2.23 kB
import { Address, TransactionSigner } from '@solana/kit'; import { AcceptRentalInstruction, getAcceptRentalInstructionAsync } from '../codama'; /** * Simplified parameters for accepting a rental */ export interface AcceptRentalParams { /** * The borrower wallet that will sign the transaction */ borrower: TransactionSigner<string>; /** * The borrower's profile account address */ borrowerProfile: Address<string>; /** * The borrower's faction (1 = mud, 2 = oni, 3 = ustur) * Or as string: 'mud', 'oni', 'ustur' */ borrowerFaction: number | string; /** * The fleet account address that will be rented */ fleet: Address<string>; /** * The rental contract account address */ contract: Address<string>; /** * The game ID account address * Defaults to 'GAMEzqJehF8yAnKiTARUuhZMvLvkZVAsCVri5vSfemLr' if not provided */ gameId?: Address<string>; /** * The rental amount (in ATLAS tokens) */ amount: number | bigint; /** * The rental duration (in seconds) */ duration: number | bigint; } /** * Asynchronously creates an instruction to accept a rental with minimal required parameters. * Derives borrowerProfileFaction, starbase, and starbasePlayer automatically. * * @example * ```typescript * // Create the instruction with automatic account derivation * const ix = await acceptRental({ * borrower: wallet, * borrowerProfile: profileAddress, * borrowerFaction: 1, // 1 = mud, 2 = oni, 3 = ustur * fleet: fleetAddress, * contract: contractAddress, * amount: 1000, * duration: 86400 // 1 day in seconds * // gameId is optional and will default to the standard game ID * }); * * // Add to transaction and sign * const tx = new Transaction().add(ix); * await sendAndConfirmTransaction(connection, tx, [wallet]); * ``` * * @param params The simplified parameters for accepting a rental * @returns A promise that resolves to the instruction to accept a rental */ export declare function acceptRental(params: AcceptRentalParams): Promise<AcceptRentalInstruction>; export { getAcceptRentalInstructionAsync }; //# sourceMappingURL=accept.d.ts.map