///
///
import { KeyedAccountInfo, PublicKey } from '@solana/web3.js';
import { BN } from '@staratlas/anchor';
import { Account, AsyncSigner, DecodedAccountData, InstructionReturn } from '@staratlas/data-source';
import { CraftingIDL, CraftingIDLProgram, CraftingProcessAccount, CreateCraftingProcessInput } from './constants';
export declare enum CraftingProcessStatus {
Initialized = 0,
Started = 1,
Completed = 2
}
/**
* Checks equality between 2 Crafting Process Accounts
* @param data1 - First Crafting Process Account
* @param data2 - Second Crafting Process Account
* @returns boolean
*/
export declare function craftingProcessDataEquals(data1: CraftingProcessAccount, data2: CraftingProcessAccount): boolean;
export interface IngredientInput {
/** the index of the consumable recipe ingredient in the recipe input/outputs array */
ingredientIndex: number;
}
export interface LocalTimeInput {
/** the current time as supplied by the location; required if `useLocalTime` is set on the `CraftingProcess` */
localTime?: BN;
}
type IngredientAndTimeInput = IngredientInput & LocalTimeInput;
export interface RecipeIngredientInput extends IngredientInput {
/** the amount */
amount: BN;
}
export interface StartCraftingProcessInput extends LocalTimeInput {
/** the recipe duration (overrides the duration set on the recipe account) */
recipeDurationOverride?: BN;
}
export declare class CraftingProcess implements Account {
private _data;
private _key;
static readonly ACCOUNT_NAME: NonNullable[number]['name'];
static readonly MIN_DATA_SIZE: number;
constructor(_data: CraftingProcessAccount, _key: PublicKey);
get data(): Readonly;
get key(): PublicKey;
static getCargoPodSeeds(): Buffer;
/**
* Find the `CraftingProcess` address
* @param program - Crafting program
* @param craftingFacility - the crafting facility
* @param recipe - the crafting recipe
* @param craftingId - the crafting process id
* @returns PDA and bump
*/
static findAddress(program: CraftingIDLProgram, craftingFacility: PublicKey, recipe: PublicKey, craftingId: BN): [PublicKey, number];
/**
* Create or Initialize a `CraftingProcess` Account
* @param program - Crafting program
* @param location - the crafting facility's location
* @param authority - the authority for the crafting process account
* @param craftingFacility - the crafting facility
* @param recipe - the crafting recipe
* @param input - the input parameters
* @returns InstructionReturn
*/
static createCraftingProcess(program: CraftingIDLProgram, location: AsyncSigner, authority: AsyncSigner, craftingFacility: PublicKey, recipe: PublicKey, input: CreateCraftingProcessInput): InstructionReturn;
/**
* Add an ingredient to a crafting process account
* @param program - Crafting program
* @param location - the crafting facility's location
* @param authority - the authority for the crafting process account
* @param craftingProcess - the crafting process
* @param recipe - the crafting recipe
* @param craftingFacility - the crafting facility
* @param tokenFrom - the source token account
* @param tokenTo - the destination token account (must be owned by the crafting process account)
* @param input - the input parameters
* @returns InstructionReturn
*/
static addRecipeIngredient(program: CraftingIDLProgram, location: AsyncSigner, authority: AsyncSigner, craftingProcess: PublicKey, recipe: PublicKey, craftingFacility: PublicKey, tokenFrom: PublicKey, tokenTo: PublicKey, input: RecipeIngredientInput): InstructionReturn;
/**
* Legitimize an ingredient
* The token accounts that hold ingredients can receive tokens from anyone. However, only tokens received through the crafting
* program are recognized as valid ingredients. This instruction can be used in cases where one wants to "legitimize" such token account balances
* @param program - Crafting program
* @param location - the crafting facility's location
* @param authority - the authority for the crafting process account
* @param craftingProcess - the crafting process
* @param recipe - the crafting recipe
* @param craftingFacility - the crafting facility
* @param craftingTokenAccount - the token account owned by the crafting process which holds the ingredient in escrow
* @param input - the input parameters
* @returns InstructionReturn
*/
static legitimizeRecipeIngredient(program: CraftingIDLProgram, location: AsyncSigner, authority: AsyncSigner, craftingProcess: PublicKey, recipe: PublicKey, craftingFacility: PublicKey, craftingTokenAccount: PublicKey, input: RecipeIngredientInput): InstructionReturn;
/**
* Remove an ingredient from a crafting process account
* @param program - Crafting program
* @param location - the crafting facility's location
* @param authority - the authority for the crafting process account
* @param craftingProcess - the crafting process
* @param recipe - the crafting recipe
* @param craftingFacility - the crafting facility
* @param tokenFrom - the source token account (must be owned by the crafting process)
* @param tokenTo - the destination token account
* @param mint - the token mint
* @param input - the input parameters
* @returns InstructionReturn
*/
static removeRecipeIngredient(program: CraftingIDLProgram, location: AsyncSigner, authority: AsyncSigner, craftingProcess: PublicKey, recipe: PublicKey, craftingFacility: PublicKey, tokenFrom: PublicKey, tokenTo: PublicKey, mint: PublicKey, input: RecipeIngredientInput): InstructionReturn;
/**
* Start the crafting process
* @param program - Crafting program
* @param location - the crafting facility's location
* @param craftingProcess - the crafting process
* @param recipe - the crafting recipe
* @param craftingFacility - the crafting facility
* @param input - the input parameters
* @param recipeFeeRecipient - the recipient of crafting fees as defined in the Recipe account
* @param tokenFromAuthority - the transfer authority of `tokenFrom`
* @param tokenFrom - the source token account for crafting fees
* @param tokenTo - the destination token account for crafting fees, should be ATA owned by `craftingProcess`
* @returns InstructionReturn
*/
static startCraftingProcess(program: CraftingIDLProgram, location: AsyncSigner, craftingProcess: PublicKey, recipe: PublicKey, craftingFacility: PublicKey, input?: StartCraftingProcessInput, recipeFeeRecipient?: PublicKey, tokenFromAuthority?: AsyncSigner, tokenFrom?: PublicKey, tokenTo?: PublicKey): InstructionReturn;
/**
* Stop the crafting process
*
* Meant to be used to stop already started process which are not yet complete
* @param program - Crafting program
* @param location - the crafting facility's location
* @param craftingProcess - the crafting process
* @param recipe - the crafting recipe
* @param craftingFacility - the crafting facility
* @param input - the input parameters
* @param tokenFrom - the source token account for crafting fees, should be ATA owned by `craftingProcess`
* @param tokenTo - the token account that the refund of crafting fees should be sent to
* @returns InstructionReturn
*/
static stopCraftingProcess(program: CraftingIDLProgram, location: AsyncSigner, craftingProcess: PublicKey, recipe: PublicKey, craftingFacility: PublicKey, input?: LocalTimeInput, tokenFrom?: PublicKey, tokenTo?: PublicKey): InstructionReturn;
/**
* Cancel the crafting process and close the crafting process account
* can only be done if the crafting process was not started
* @param program - Crafting program
* @param location - the crafting facility's location
* @param authority - the authority for the crafting process account
* @param fundsTo - receives rent refund
* @param craftingProcess - the crafting process
* @param craftingFacility - the crafting facility
* @returns InstructionReturn
*/
static cancelCraftingProcess(program: CraftingIDLProgram, location: AsyncSigner, authority: AsyncSigner, fundsTo: PublicKey | 'funder', craftingProcess: PublicKey, craftingFacility: PublicKey): InstructionReturn;
/**
* Burn a consumable ingredient from a crafting process account
* @param program - Crafting program
* @param craftingProcess - the crafting process
* @param recipe - the crafting recipe
* @param tokenFrom - the source token account (owned by crafting process)
* @param mint - the token mint
* @param input - the input parameters
* @returns InstructionReturn
*/
static burnConsumableIngredient(program: CraftingIDLProgram, craftingProcess: PublicKey, recipe: PublicKey, tokenFrom: PublicKey, mint: PublicKey, input: IngredientAndTimeInput): InstructionReturn;
/**
* Claim a non-consumable ingredient from a crafting process account
* @param program - Crafting program
* @param craftingProcess - the crafting process
* @param authority - the authority for the crafting process account
* @param recipe - the crafting recipe
* @param tokenFrom - the source token account (owned by crafting process)
* @param tokenTo - the destination token account
* @param mint - the token mint
* @param input - the input parameters
* @returns InstructionReturn
*/
static claimNonConsumableIngredient(program: CraftingIDLProgram, craftingProcess: PublicKey, authority: PublicKey, recipe: PublicKey, tokenFrom: PublicKey, tokenTo: PublicKey, mint: PublicKey, input: IngredientAndTimeInput): InstructionReturn;
/**
* Claim an output from a crafting process account
* @param program - Crafting program
* @param craftingProcess - the crafting process
* @param authority - the authority for the crafting process account
* @param recipe - the crafting recipe
* @param tokenFrom - the source token account (owned by the `craftableItem`)
* @param tokenTo - the destination token account
* @param craftableItem - the craftable item
* @param input - the input parameters
* @returns InstructionReturn
*/
static claimRecipeOutput(program: CraftingIDLProgram, craftingProcess: PublicKey, authority: PublicKey, recipe: PublicKey, tokenFrom: PublicKey, tokenTo: PublicKey, craftableItem: PublicKey, input: IngredientAndTimeInput): InstructionReturn;
/**
* Close the crafting process account
* @param program - Crafting program
* @param authority - the authority for the crafting process account
* @param fundsTo - receives rent refund
* @param craftingProcess - the crafting process
* @param recipe - the crafting recipe
* @param craftingFacility - the crafting facility
* @param tokenFrom - the source token account for crafting fees, should be ATA owned by `craftingProcess`
* @param tokenTo - the recipient of crafting fees as defined in the Recipe account
* @returns InstructionReturn
*/
static closeCraftingProcess(program: CraftingIDLProgram, authority: AsyncSigner, fundsTo: PublicKey | 'funder', craftingProcess: PublicKey, recipe: PublicKey, craftingFacility: PublicKey, tokenFrom?: PublicKey, tokenTo?: PublicKey): InstructionReturn;
static decodeData(account: KeyedAccountInfo, program: CraftingIDLProgram): DecodedAccountData;
}
export {};
//# sourceMappingURL=craftingProcess.d.ts.map