import { KeyedAccountInfo, PublicKey } from '@solana/web3.js'; import { BN } from '@staratlas/anchor'; import { CargoIDLProgram } from '@staratlas/cargo'; import { CraftingIDLProgram } from '@staratlas/crafting'; import { Account, AsyncSigner, DecodedAccountData, InstructionReturn } from '@staratlas/data-source'; import { PointsIDLProgram } from '@staratlas/points'; import { CraftingInstanceAccount, SageIDL, SageIDLProgram, StarbaseCancelCraftingProcessInput, StarbaseClaimCraftingNonConsumablesInput, StarbaseClaimCraftingOutputsInput, StarbaseCloseCraftingProcessInput, StarbaseCreateCraftingProcessInput, StarbaseDepositCraftingIngredientInput, StarbaseStartCraftingProcessInput } from './constants'; export declare enum CraftingInstanceType { StarbaseCrafting = 1, StarbaseUpgradeMaterial = 2 } /** * Check if two `CraftingInstanceAccount` instances are equal * @param data1 - first CraftingInstanceAccount * @param data2 - second CraftingInstanceAccount * @returns boolean */ export declare function craftingInstanceDataEquals(data1: CraftingInstanceAccount, data2: CraftingInstanceAccount): boolean; export declare class CraftingInstance implements Account { private _data; private _key; static readonly ACCOUNT_NAME: NonNullable[number]['name']; static readonly MIN_DATA_SIZE: number; constructor(_data: CraftingInstanceAccount, _key: PublicKey); get data(): Readonly; get key(): PublicKey; /** * Calculate the crafting duration * @param durationPerUnit - the duration per unit of the crafting recipe * @param quantity - the quantity being crafted * @param numCrew - the number of crew taking part in the crafting * @param timeUntilExhaustion - time in seconds until food exhaustion will occur * @param exhaustedCraftingSpeed - the crafting speed when exhausted for the given starbase * @returns the crafting duration in seconds */ static calculateCraftingDuration(durationPerUnit: BN, quantity: BN, numCrew: BN, timeUntilExhaustion?: number, exhaustedCraftingSpeed?: number): BN; /** * Calculate the starbase upgrade duration * @param durationPerUnit - the duration per unit of the crafting recipe * @param quantity - the quantity being crafted * @param numCrew - the number of crew taking part in the crafting * @returns the upgrade duration in seconds */ static calculateUpgradeDuration(durationPerUnit: BN, quantity: BN, numCrew: BN): BN; /** * Find the CraftingInstance account address * @param program - SAGE program * @param authority - the crafting instance authority * @param craftingProcess - the crafting process * @returns The PDA and bump respectively */ static findAddress(program: SageIDLProgram, authority: PublicKey, craftingProcess: PublicKey): [PublicKey, number]; /** * Create Crafting Process * @param program - SAGE program * @param craftingProgram - crafting program * @param key - the key authorized to run this instruction * @param playerProfile - the player's profile with the required permissions for the instruction * @param profileFaction - the profile's faction * @param starbasePlayer - the Starbase player * @param starbase - the Starbase * @param gameId - the SAGE game id * @param gameState - the game state account * @param craftingFacility - the crafting facility * @param craftingRecipe - the crafting recipe * @param craftingDomain - the crafting domain * @param input - the instruction input params * @returns InstructionReturn */ static createCraftingProcess(program: SageIDLProgram, craftingProgram: CraftingIDLProgram, key: AsyncSigner, playerProfile: PublicKey, profileFaction: PublicKey, starbasePlayer: PublicKey, starbase: PublicKey, gameId: PublicKey, gameState: PublicKey, craftingFacility: PublicKey, craftingRecipe: PublicKey, craftingDomain: PublicKey, input: StarbaseCreateCraftingProcessInput): InstructionReturn; /** * Deposit Crafting Recipe Ingredient * @param program - SAGE program * @param cargoProgram - cargo program * @param craftingProgram - crafting program * @param key - the key authorized to run this instruction * @param playerProfile - the player's profile with the required permissions for the instruction * @param profileFaction - the profile's faction * @param starbasePlayer - the Starbase player * @param starbase - the Starbase * @param craftingInstance - the crafting instance * @param craftingProcess - the crafting process * @param craftingFacility - the crafting facility * @param craftingRecipe - the crafting recipe * @param cargoPodFrom - the source cargo pod * @param cargoType - the cargo type * @param cargoStatsDefinition - the cargo stats definition * @param tokenFrom - the source account of the tokens - owner should be `cargoPodFrom` * @param tokenTo - the destination account of the tokens - owner should be `craftingProcess` * @param gameId - the SAGE game id * @param gameState - the game state account * @param input - the instruction input params * @returns InstructionReturn */ static depositCraftingIngredient(program: SageIDLProgram, cargoProgram: CargoIDLProgram, craftingProgram: CraftingIDLProgram, key: AsyncSigner, playerProfile: PublicKey, profileFaction: PublicKey, starbasePlayer: PublicKey, starbase: PublicKey, craftingInstance: PublicKey, craftingProcess: PublicKey, craftingFacility: PublicKey, craftingRecipe: PublicKey, cargoPodFrom: PublicKey, cargoType: PublicKey, cargoStatsDefinition: PublicKey, tokenFrom: PublicKey, tokenTo: PublicKey, gameId: PublicKey, gameState: PublicKey, input: StarbaseDepositCraftingIngredientInput): InstructionReturn; /** * Withdraw Crafting Recipe Ingredient * @param program - SAGE program * @param cargoProgram - cargo program * @param craftingProgram - crafting program * @param key - the key authorized to run this instruction * @param playerProfile - the player's profile with the required permissions for the instruction * @param profileFaction - the profile's faction * @param starbasePlayer - the Starbase player * @param starbase - the Starbase * @param craftingInstance - the crafting instance * @param craftingProcess - the crafting process * @param craftingFacility - the crafting facility * @param craftingRecipe - the crafting recipe * @param cargoPodTo - the destination cargo pod * @param cargoType - the cargo type * @param cargoStatsDefinition - the cargo stats definition * @param tokenFrom - the source token account - owner should be `craftingProcess` * @param tokenTo - the destination token account - owner should be `cargoPodTo` * @param tokenMint - the token mint * @param gameId - the SAGE game id * @param gameState - the game state account * @param input - the instruction input params * @returns InstructionReturn */ static withdrawCraftingIngredient(program: SageIDLProgram, cargoProgram: CargoIDLProgram, craftingProgram: CraftingIDLProgram, key: AsyncSigner, playerProfile: PublicKey, profileFaction: PublicKey, starbasePlayer: PublicKey, starbase: PublicKey, craftingInstance: PublicKey, craftingProcess: PublicKey, craftingFacility: PublicKey, craftingRecipe: PublicKey, cargoPodTo: PublicKey, cargoType: PublicKey, cargoStatsDefinition: PublicKey, tokenFrom: PublicKey, tokenTo: PublicKey, tokenMint: PublicKey, gameId: PublicKey, gameState: PublicKey, input: StarbaseDepositCraftingIngredientInput): InstructionReturn; /** * Start Crafting Process * @param program - SAGE program * @param craftingProgram - crafting program * @param key - the key authorized to run this instruction * @param playerProfile - the player's profile with the required permissions for the instruction * @param profileFaction - the profile's faction * @param starbasePlayer - the Starbase player * @param starbase - the Starbase * @param craftingInstance - the crafting instance * @param craftingProcess - the crafting process * @param craftingFacility - the crafting facility * @param craftingRecipe - the crafting recipe * @param gameId - the SAGE game id * @param gameState - the game state account * @param input - the instruction input params * @param recipeFeeRecipient - the recipe fee recipient`, should be as defined in `craftingRecipe` account * @param tokenFromAuthority - the transfer authority of `tokenFrom` * @param tokenFrom - the source token account for crafting fees * @param tokenTo - the destination token account (ATA) for crafting fees, owned by crafting process * @returns InstructionReturn */ static startCraftingProcess(program: SageIDLProgram, craftingProgram: CraftingIDLProgram, key: AsyncSigner, playerProfile: PublicKey, profileFaction: PublicKey, starbasePlayer: PublicKey, starbase: PublicKey, craftingInstance: PublicKey, craftingProcess: PublicKey, craftingFacility: PublicKey, craftingRecipe: PublicKey, gameId: PublicKey, gameState: PublicKey, input: StarbaseStartCraftingProcessInput, recipeFeeRecipient?: PublicKey, tokenFromAuthority?: AsyncSigner, tokenFrom?: PublicKey, tokenTo?: PublicKey): InstructionReturn; /** * Stop Crafting Process * * Meant to be used for processes already started but not yet complete. * @param program - SAGE program * @param craftingProgram - crafting program * @param key - the key authorized to run this instruction * @param playerProfile - the player's profile with the required permissions for the instruction * @param profileFaction - the profile's faction * @param starbasePlayer - the Starbase player * @param starbase - the Starbase * @param craftingInstance - the crafting instance * @param craftingProcess - the crafting process * @param craftingFacility - the crafting facility * @param craftingRecipe - the crafting recipe * @param gameId - the SAGE game id * @param gameState - the game state account * @param input - the instruction input params * @param tokenFrom - the source token account for crafting fees, ATA owned by crafting process * @param tokenTo - the token account that the refund of crafting fees should be sent to * @returns InstructionReturn */ static stopCraftingProcess(program: SageIDLProgram, craftingProgram: CraftingIDLProgram, key: AsyncSigner, playerProfile: PublicKey, profileFaction: PublicKey, starbasePlayer: PublicKey, starbase: PublicKey, craftingInstance: PublicKey, craftingProcess: PublicKey, craftingFacility: PublicKey, craftingRecipe: PublicKey, gameId: PublicKey, gameState: PublicKey, input: StarbaseStartCraftingProcessInput, tokenFrom?: PublicKey, tokenTo?: PublicKey): InstructionReturn; /** * Cancel Crafting Process * @param program - SAGE program * @param craftingProgram - crafting program * @param key - the key authorized to run this instruction * @param playerProfile - the player's profile with the required permissions for the instruction * @param profileFaction - the profile's faction * @param fundsTo - recipient of the rent refund * @param starbasePlayer - the Starbase player * @param starbase - the Starbase * @param craftingInstance - the crafting instance * @param craftingProcess - the crafting process * @param craftingFacility - the crafting facility * @param gameId - the SAGE game id * @param gameState - the game state account * @param input - the instruction input params * @returns InstructionReturn */ static cancelCraftingProcess(program: SageIDLProgram, craftingProgram: CraftingIDLProgram, key: AsyncSigner, playerProfile: PublicKey, profileFaction: PublicKey, fundsTo: PublicKey | 'funder', starbasePlayer: PublicKey, starbase: PublicKey, craftingInstance: PublicKey, craftingProcess: PublicKey, craftingFacility: PublicKey, gameId: PublicKey, gameState: PublicKey, input: StarbaseCancelCraftingProcessInput): InstructionReturn; /** * Claim Crafting Process Non-consumable inputs * @param program - SAGE program * @param cargoProgram - cargo program * @param craftingProgram - crafting program * @param starbasePlayer - the Starbase player * @param starbase - the Starbase * @param craftingInstance - the crafting instance * @param craftingProcess - the crafting process * @param craftingFacility - the crafting facility * @param craftingRecipe - the crafting recipe * @param cargoPodTo - the destination cargo pod * @param cargoType - the cargo type * @param cargoStatsDefinition - the cargo stats definition * @param gameId - the SAGE game id * @param gameState - the game state account * @param tokenFrom - the source token account - owner should be `craftingProcess` * @param tokenTo - the destination token account - owner should be `cargoPodTo` * @param tokenMint - the token mint * @param input - the instruction input params * @returns InstructionReturn */ static claimCraftingNonConsumables(program: SageIDLProgram, cargoProgram: CargoIDLProgram, craftingProgram: CraftingIDLProgram, starbasePlayer: PublicKey, starbase: PublicKey, craftingInstance: PublicKey, craftingProcess: PublicKey, craftingFacility: PublicKey, craftingRecipe: PublicKey, cargoPodTo: PublicKey, cargoType: PublicKey, cargoStatsDefinition: PublicKey, gameId: PublicKey, gameState: PublicKey, tokenFrom: PublicKey, tokenTo: PublicKey, tokenMint: PublicKey, input: StarbaseClaimCraftingNonConsumablesInput): InstructionReturn; /** * Claim Crafting Process Output * @param program - SAGE program * @param craftingProgram - crafting program * @param starbasePlayer - the Starbase player * @param starbase - the Starbase * @param craftingInstance - the crafting instance * @param craftingProcess - the crafting process * @param craftingFacility - the crafting facility * @param craftingRecipe - the crafting recipe * @param gameId - the SAGE game id * @param gameState - the game state account * @param tokenFrom - the source token account - owner should be `craftingProcess` * @param tokenMint - the token mint * @param input - the instruction input params * @returns InstructionReturn */ static burnCraftingConsumables(program: SageIDLProgram, craftingProgram: CraftingIDLProgram, starbasePlayer: PublicKey, starbase: PublicKey, craftingInstance: PublicKey, craftingProcess: PublicKey, craftingFacility: PublicKey, craftingRecipe: PublicKey, gameId: PublicKey, gameState: PublicKey, tokenFrom: PublicKey, tokenMint: PublicKey, input: StarbaseClaimCraftingOutputsInput): InstructionReturn; /** * Claim Crafting Process Output * @param program - SAGE program * @param cargoProgram - cargo program * @param craftingProgram - crafting program * @param starbasePlayer - the Starbase player * @param starbase - the Starbase * @param craftingInstance - the crafting instance * @param craftingProcess - the crafting process * @param craftingFacility - the crafting facility * @param craftingRecipe - the crafting recipe * @param craftableItem - the craftable item for the output * @param cargoPodTo - the destination cargo pod * @param cargoType - the cargo type * @param cargoStatsDefinition - the cargo stats definition * @param gameId - the SAGE game id * @param gameState - the game state account * @param tokenFrom - the source token account - owner should be `craftableItem` * @param tokenTo - the destination token account - owner should be `cargoPodTo` * @param input - the instruction input params * @returns InstructionReturn */ static claimCraftingOutputs(program: SageIDLProgram, cargoProgram: CargoIDLProgram, craftingProgram: CraftingIDLProgram, starbasePlayer: PublicKey, starbase: PublicKey, craftingInstance: PublicKey, craftingProcess: PublicKey, craftingFacility: PublicKey, craftingRecipe: PublicKey, craftableItem: PublicKey, cargoPodTo: PublicKey, cargoType: PublicKey, cargoStatsDefinition: PublicKey, gameId: PublicKey, gameState: PublicKey, tokenFrom: PublicKey, tokenTo: PublicKey, input: StarbaseClaimCraftingOutputsInput): InstructionReturn; /** * Close Crafting Process * @param program - SAGE program * @param craftingProgram - crafting program * @param pointsProgram - points program * @param key - the key authorized to run this instruction * @param playerProfile - the player's profile with the required permissions for the instruction * @param profileFaction - the profile's faction * @param fundsTo - recipient of the rent refund * @param starbasePlayer - the Starbase player * @param starbase - the Starbase * @param craftingInstance - the crafting instance * @param craftingProcess - the crafting process * @param craftingFacility - the crafting facility * @param craftingRecipe - the crafting recipe * @param craftingXpUserAccount - the user account for Crafting XP * @param craftingXpCategory - the Crafting XP Points Category Account * @param craftingXpModifier - the Crafting XP modifier * @param councilRankXpUserAccount - the user account for Council Rank XP * @param councilRankXpCategory - the Council Rank XP Points Category Account * @param councilRankXpModifier - the Council Rank XP modifier * @param gameId - the SAGE game id * @param gameState - the game state account * @param input - the instruction input params * @param tokenFrom - the source token account for crafting fees, ATA owned by crafting process * @param tokenTo - the recipe fee recipient`, should be as defined in `craftingRecipe` account * @returns InstructionReturn */ static closeCraftingProcess(program: SageIDLProgram, craftingProgram: CraftingIDLProgram, pointsProgram: PointsIDLProgram, key: AsyncSigner, playerProfile: PublicKey, profileFaction: PublicKey, fundsTo: PublicKey | 'funder', starbasePlayer: PublicKey, starbase: PublicKey, craftingInstance: PublicKey, craftingProcess: PublicKey, craftingFacility: PublicKey, craftingRecipe: PublicKey, craftingXpUserAccount: PublicKey, craftingXpCategory: PublicKey, craftingXpModifier: PublicKey, councilRankXpUserAccount: PublicKey, councilRankXpCategory: PublicKey, councilRankXpModifier: PublicKey, gameId: PublicKey, gameState: PublicKey, input: StarbaseCloseCraftingProcessInput, tokenFrom?: PublicKey, tokenTo?: PublicKey): InstructionReturn; static decodeData(account: KeyedAccountInfo, program: SageIDLProgram): DecodedAccountData; } //# sourceMappingURL=craftingInstance.d.ts.map