UNPKG

@wuwei-labs/srsly

Version:
70 lines 3.21 kB
/** * PDA derivation functions for SAGE and Profile Faction programs * @module pda/sage */ import { Address } from '@solana/kit'; import { type UniversalSigner } from '../utils/signer'; /** * Derive the profile faction PDA from a profile address * @param profile - The player profile public key * @param programAddress - Optional Profile Faction program address (defaults to network-specific address) * @returns The derived profile faction PDA */ export declare function deriveProfileFaction(profile: UniversalSigner, programAddress?: UniversalSigner): Promise<Address>; /** * Derive the SAGE player profile PDA * @param profile - The player profile public key * @param gameId - The game ID public key * @param programAddress - Optional SAGE program address (defaults to network-specific address) * @returns The derived SAGE player profile PDA */ export declare function deriveSagePlayerProfile(profile: UniversalSigner, gameId: UniversalSigner, programAddress?: UniversalSigner): Promise<Address>; /** * Derive the starbase PDA from faction and game ID * @param faction - Faction name ('mud', 'oni', 'ustur') or faction ID (1, 2, 3) * @param gameId - The game ID public key * @param programAddress - Optional SAGE program address (defaults to network-specific address) * @returns The derived starbase PDA */ export declare function deriveStarbase(faction: string | number, gameId: UniversalSigner, programAddress?: UniversalSigner): Promise<Address>; /** * Derive the starbase player PDA * @param sagePlayerProfile - The SAGE player profile public key * @param starbase - The starbase public key * @param starbaseSeqId - Optional starbase sequence ID (defaults to 0) * @param programAddress - Optional SAGE program address (defaults to network-specific address) * @returns The derived starbase player PDA */ export declare function deriveStarbasePlayer(sagePlayerProfile: UniversalSigner, starbase: UniversalSigner, starbaseSeqId?: number, programAddress?: UniversalSigner): Promise<Address>; /** * Derive all SAGE game accounts at once (convenience function) * * This is a helper that derives all three SAGE-related accounts needed for most operations: * - Profile faction (from Profile Faction program) * - SAGE player profile (from SAGE program) * - Starbase (from SAGE program using faction coordinates) * - Starbase player (from SAGE program) * * @param profile - The player profile public key * @param faction - Faction name ('mud', 'oni', 'ustur') or faction ID (1, 2, 3) * @param gameId - The game ID public key * @param starbaseSeqId - Optional starbase sequence ID (defaults to 0) * @returns Object containing all derived SAGE accounts * * @example * ```typescript * const accounts = await deriveGameAccounts( * playerProfile, * 'mud', * gameId * ); * // Returns: { profileFaction, sagePlayerProfile, starbase, starbasePlayer } * ``` */ export declare function deriveGameAccounts(profile: UniversalSigner, faction: string | number, gameId: UniversalSigner, starbaseSeqId?: number): Promise<{ profileFaction: Address; sagePlayerProfile: Address; starbase: Address; starbasePlayer: Address; }>; //# sourceMappingURL=sage.d.ts.map