@wuwei-labs/srsly
Version:
TypeScript SDK for SRSLY
89 lines • 3.18 kB
TypeScript
/**
* @purpose Simplified reserveRental instruction wrapper
*
* Thin convenience wrapper around Codama-generated reserveRental instruction.
* Reserves a rental contract using ATLAS for a GBM-style auction.
*/
import { type Address } from '@solana/kit';
import { type SdkConfig } from '../utils/config';
import { type UniversalSigner } from '../utils/signer';
import { type AmountParam } from '../params/amount';
import { type DurationParam } from '../params/duration';
import { prepareInstructions } from '../utils/instructions';
/**
* Parameters for reserving a rental contract
*/
export interface ReserveRentalParams {
/**
* Challenger who is reserving the contract
* Accepts string address, web3.js Keypair, or @solana/kit signer
*/
challenger: UniversalSigner;
/**
* Challenger's SAGE profile address (required — challenger isn't on fleet yet)
*/
challengerProfile: Address | string;
/**
* Rental contract address to reserve
*/
contract: Address | string;
/**
* Points bid for reservation (burned from capture_points).
* Mutually exclusive with bidAtlas — set one to 0.
* @example 100 // bid 100 points
*/
bidPoints?: number;
/**
* ATLAS premium bid for reservation (in stardust, transferred to contract).
* Mutually exclusive with bidPoints — set one to 0.
* @example { atlas: 5 } // 5 ATLAS premium
* @example { stardust: 500_000_000 } // 5 ATLAS in stardust
*/
bidAtlas?: AmountParam;
/**
* Requested rental duration for when the reservation activates
* @example { hours: 12 } // 12 hours
* @example { days: 7 } // 7 days
*/
duration: DurationParam;
/**
* Affiliate member state address (optional)
* If provided, the affiliate receives a portion of fees
*/
referrer?: Address | string;
/**
* When true (default) and neither `bidAtlas` nor `bidPoints` is set,
* the wrapper fetches the contract's current minimum bid via
* `getMinimumBid` and submits exactly that as `bidAtlas`. Set to `false`
* to opt out — the instruction will then go through with bid = 0 and
* the program will reject if a defender already exists.
*/
autoMinBid?: boolean;
/**
* Sets compute units to allocate for the transaction.
* @example 200000
*/
computeUnits?: number;
}
/**
* Bid on a contract via the GBM-style reservation auction. The winner
* gets an exclusive window to accept once the current rental ends.
*
* @param params - Reservation parameters
* @param config - Optional SDK configuration overrides
* @returns Array of instructions (Kit format or web3.js if PublicKey in config)
*
* @example
* ```typescript
* // Reserve with 5 ATLAS for a 7-day rental
* const ixs = await reserveRental({
* challenger: wallet,
* contract: "CONTRACT_ADDRESS",
* amount: 5,
* duration: { days: 7 },
* computeUnits: 200_000
* });
* ```
*/
export declare function reserveRental(params: ReserveRentalParams, config?: Partial<SdkConfig>): Promise<ReturnType<typeof prepareInstructions>>;
//# sourceMappingURL=reserveRental.d.ts.map