import { KeyedAccountInfo, PublicKey } from '@solana/web3.js'; import { BN } from '@staratlas/anchor'; import { Account, AsyncSigner, DecodedAccountData, InstructionReturn } from '@staratlas/data-source'; import { GameStateAccount, InitGameStateInput, ManageGameInput, MiscVariables, MiscVariablesInput, SageIDL, SageIDLProgram } from './constants'; import { StarbaseLevelInfoArrayInput, StarbaseUpkeepInfoArrayInput } from './game'; export interface UpdateFleetDataInput { starbaseLevels?: StarbaseLevelInfoArrayInput[]; starbaseUpkeep?: StarbaseUpkeepInfoArrayInput[]; maxFleetSize?: number; } export interface StarbaseLevelInfoItem { level: number; faction: number; recipeCategoryForLevel: PublicKey; recipeForUpgrade: PublicKey; hp: BN; sp: BN; sectorRingAvailable: number; warpLaneMovementFee: BN; repairFee: BN; repairEfficiency: number; shieldRechargeRate: number; shieldBreakDelay: number; } /** * Check if two `MiscVariables` instances are equal * @param data1 - first MiscVariables * @param data2 - second MiscVariables * @returns boolean */ export declare function miscVariablesEquals(data1: MiscVariables, data2: MiscVariables): boolean; /** * Check if two `GameStateAccount` instances are equal * @param data1 - first GameStateAccount * @param data2 - second GameStateAccount * @returns boolean */ export declare function gameStateDataEquals(data1: GameStateAccount, data2: GameStateAccount): boolean; export declare const SCALE_DECIMALS_4 = 10000; export declare class GameState implements Account { private _data; private _key; static readonly ACCOUNT_NAME: NonNullable[number]['name']; static readonly MIN_DATA_SIZE: number; constructor(_data: GameStateAccount, _key: PublicKey); get data(): Readonly; get key(): PublicKey; /** * Find the address of a `GameState` account * @param program - SAGE program * @param gameId - the SAGE game id * @param updateId - the game update id * @returns The PDA and bump respectively */ static findAddress(program: SageIDLProgram, gameId: PublicKey, updateId: BN): [PublicKey, number]; /** * Create a new GameState account * @param program - SAGE program * @param key - the key authorized to run this instruction * @param profile - the profile with the required permissions for the instruction * @param gameId - the SAGE game id * @param gameState - the game state * @param input - input params * @returns InstructionReturn */ static initGameState(program: SageIDLProgram, key: AsyncSigner, profile: PublicKey, gameId: PublicKey, gameState: PublicKey, input: InitGameStateInput): InstructionReturn; /** * Update `GameState` account * @param program - SAGE program * @param key - the key authorized to run this instruction * @param profile - the profile with the required permissions for the instruction * @param gameId - the SAGE game id * @param gameState - the game state * @param keyIndex - the index of the `key` in the profile permissions * @param fleet - the fleet * @param miscVariables - miscellaneous variables * @returns InstructionReturn */ static updateGameState(program: SageIDLProgram, key: AsyncSigner, profile: PublicKey, gameId: PublicKey, gameState: PublicKey, keyIndex: number, fleet?: UpdateFleetDataInput, miscVariables?: MiscVariablesInput): InstructionReturn; /** * Sets a new `GameState` for a `Game` & increments the `update_id` * @param program - SAGE program * @param key - the key authorized to run this instruction * @param profile - the profile with the required permissions for the instruction * @param gameId - the SAGE game id * @param gameState - the game state * @param input - input params * @returns InstructionReturn */ static activateGameState(program: SageIDLProgram, key: AsyncSigner, profile: PublicKey, gameId: PublicKey, gameState: PublicKey, input: ManageGameInput): InstructionReturn; /** * Create a new `GameState` account from an older one and activates it * This is meant to be used when all we want to do is update the `update_id`, * without changing game variables. If game variables are to be changed, then we * need to use other instructions to create and activate a new `GameState` account * @param program - SAGE program * @param key - the key authorized to run this instruction * @param profile - the profile with the required permissions for the instruction * @param gameId - the SAGE game id * @param oldGameState - the old game state account * @param newGameState - the new game state account * @param input - input params * @returns InstructionReturn */ static copyGameState(program: SageIDLProgram, key: AsyncSigner, profile: PublicKey, gameId: PublicKey, oldGameState: PublicKey, newGameState: PublicKey, input: ManageGameInput): InstructionReturn; static decodeData(account: KeyedAccountInfo, program: SageIDLProgram): DecodedAccountData; } //# sourceMappingURL=gameState.d.ts.map