import { KeyedAccountInfo, PublicKey } from '@solana/web3.js'; import { Account, AsyncSigner, DecodedAccountData, FixedSizeArray, InstructionReturn } from '@staratlas/data-source'; import { BaseShipStats, CargoStats, CombatStats, MiscStats, MovementStats, SageIDL, SageIDLProgram, ShipAccount } from './constants'; export declare enum SizeClass { XxSmall = 1, XSmall = 2, Small = 3, Medium = 4, Large = 5, Capital = 6, Commander = 7, Titan = 9 } /** Ship sizes */ export interface ShipSizes { xxSmall: number; xSmall: number; small: number; medium: number; large: number; capital: number; commander: number; titan: number; } export declare const SHIP_SIZES: ShipSizes; export declare const SHIP_STATS_MIN_DATA_SIZE: number; export interface ShipStats extends Omit { movementStats: MovementStats; cargoStats: CargoStats; combatStats: CombatStats; miscStats: MiscStats; } /** * Convert the `SizeClass` Typescript Enum to an Anchor enum * @param sizeClassInput - the `SizeClass` value that needs to be converted * @returns the `SizeClass` as an anchor enum */ export declare const getSizeClassAnchorEnum: (sizeClassInput: SizeClass) => never; /** * Get default fleet stats * @returns the default fleet stats */ export declare function shipStatsDefault(): ShipStats; export interface UpdateShipInput { name: FixedSizeArray; sizeClass: SizeClass; stats: ShipStats; keyIndex: number; } export interface RegisterShipInput extends UpdateShipInput { isActive: boolean; } export declare const SHIP_MIN_DATA_SIZE: number; /** * Check if two `MovementStats` instances are equal * @param stats1 - first MovementStats * @param stats2 - second MovementStats * @returns a boolean */ export declare function movementStatsEquals(stats1: MovementStats, stats2: MovementStats): boolean; /** * Check if two `CargoStats` instances are equal * @param stats1 - first CargoStats * @param stats2 - second CargoStats * @returns a boolean */ export declare function cargoStatsEquals(stats1: CargoStats, stats2: CargoStats): boolean; /** * Check if two `MiscStats` instances are equal * @param stats1 - first MiscStats * @param stats2 - second MiscStats * @returns a boolean */ export declare function miscStatsEquals(stats1: MiscStats, stats2: MiscStats): boolean; /** * Check if two `ShipStats` instances are equal * @param stats1 - first ShipStats * @param stats2 - second ShipStats * @returns a boolean */ export declare function shipStatsEquals(stats1: ShipStats, stats2: ShipStats): boolean; /** * Check if two `ShipAccount` instances are equal * @param ship1 - first ShipAccount * @param ship2 - second ShipAccount * @returns a boolean */ export declare function shipDataEquals(ship1: ShipAccount, ship2: ShipAccount): boolean; export declare class Ship implements Account { private _data; private _key; static readonly ACCOUNT_NAME: NonNullable[number]['name']; static readonly MIN_DATA_SIZE: number; constructor(_data: ShipAccount, _key: PublicKey); get data(): Readonly; get key(): PublicKey; /** * Register a new `Ship` * @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 ship - the ship * @param mint - the ship's mint * @param gameId - the SAGE game id * @param input - input params * @returns InstructionReturn */ static registerShip(program: SageIDLProgram, key: AsyncSigner, profile: PublicKey, ship: AsyncSigner, mint: PublicKey, gameId: PublicKey, input: RegisterShipInput): InstructionReturn; /** * Update a `Ship` * @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 ship - the ship * @param gameId - the SAGE game id * @param input - input params * @returns InstructionReturn */ static updateShip(program: SageIDLProgram, key: AsyncSigner, profile: PublicKey, ship: PublicKey, gameId: PublicKey, input: UpdateShipInput): InstructionReturn; /** * Makes a `Ship` unusable; effectively removes it from use * @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 ship - the ship * @param gameId - the SAGE game id * @param keyIndex - the index of the key in the profile permissions * @returns InstructionReturn */ static invalidateShip(program: SageIDLProgram, key: AsyncSigner, profile: PublicKey, ship: PublicKey, gameId: PublicKey, keyIndex: number): InstructionReturn; /** * Set the next `Ship` * Essentially this invalidates the current `Ship` account and updates it to the next `Ship` * @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 ship - the current ship * @param nextShip - the ship that will be replacing the current ship * @param gameId - the SAGE game id * @param keyIndex - the index of the key in the profile permissions * @returns InstructionReturn */ static setNextShip(program: SageIDLProgram, key: AsyncSigner, profile: PublicKey, ship: PublicKey, nextShip: PublicKey, gameId: PublicKey, keyIndex: number): InstructionReturn; static decodeData(account: KeyedAccountInfo, program: SageIDLProgram): DecodedAccountData; } //# sourceMappingURL=ship.d.ts.map