Class GameState

Hierarchy

  • GameState

Implements

  • Account

Constructors

  • Parameters

    • _data: AnchorTypeDef<Object, AnchorDefined<SageIDL, Record<string, never>>>
    • _key: PublicKey

    Returns GameState

Properties

ACCOUNT_NAME: "craftingInstance" | "disbandedFleet" | "fleet" | "fleetShips" | "game" | "gameState" | "mineItem" | "planet" | "resource" | "sagePlayerProfile" | "sector" | "ship" | "star" | "starbase" | "starbasePlayer" | "surveyDataUnitTracker" = 'gameState'
MIN_DATA_SIZE: number = ...

Accessors

  • get data(): Readonly<AnchorTypeDef<Object, AnchorDefined<SageIDL, Record<string, never>>>>
  • Returns Readonly<AnchorTypeDef<Object, AnchorDefined<SageIDL, Record<string, never>>>>

  • get key(): PublicKey
  • Returns PublicKey

Methods

  • Sets a new GameState for a Game & increments the update_id

    Returns

    InstructionReturn

    Parameters

    • program: SageIDLProgram

      SAGE program

    • key: AsyncSigner<unknown>

      the key authorized to run this instruction

    • profile: PublicKey

      the profile with the required permissions for the instruction

    • gameId: PublicKey

      the SAGE game id

    • gameState: PublicKey

      the game state

    • input: AnchorTypeDef<Object, Record<string, never>>

      input params

    Returns 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

    Returns

    InstructionReturn

    Parameters

    • program: SageIDLProgram

      SAGE program

    • key: AsyncSigner<unknown>

      the key authorized to run this instruction

    • profile: PublicKey

      the profile with the required permissions for the instruction

    • gameId: PublicKey

      the SAGE game id

    • oldGameState: PublicKey

      the old game state account

    • newGameState: PublicKey

      the new game state account

    • input: AnchorTypeDef<Object, Record<string, never>>

      input params

    Returns InstructionReturn

  • Find the address of a GameState account

    Returns

    The PDA and bump respectively

    Parameters

    • program: SageIDLProgram

      SAGE program

    • gameId: PublicKey

      the SAGE game id

    • updateId: BN

      the game update id

    Returns [PublicKey, number]

  • Create a new GameState account

    Returns

    InstructionReturn

    Parameters

    • program: SageIDLProgram

      SAGE program

    • key: AsyncSigner<unknown>

      the key authorized to run this instruction

    • profile: PublicKey

      the profile with the required permissions for the instruction

    • gameId: PublicKey

      the SAGE game id

    • gameState: PublicKey

      the game state

    • input: AnchorTypeDef<Object, Record<string, never>>

      input params

    Returns InstructionReturn

  • Update GameState account

    Returns

    InstructionReturn

    Parameters

    • program: SageIDLProgram

      SAGE program

    • key: AsyncSigner<unknown>

      the key authorized to run this instruction

    • profile: PublicKey

      the profile with the required permissions for the instruction

    • gameId: PublicKey

      the SAGE game id

    • gameState: PublicKey

      the game state

    • keyIndex: number

      the index of the key in the profile permissions

    • Optional fleet: UpdateFleetDataInput

      the fleet

    • Optional levers: AnchorTypeDef<Object, Record<string, never>>

      the econ levers

    • Optional miscVariables: AnchorTypeDef<Object, Record<string, never>>

      miscellaneous variables

    Returns InstructionReturn

Generated using TypeDoc