Skip to content

crafting

Defined in: packages/sage/src/crafting/index.ts:69

A registry-resolved nested crafting CargoPod.

declare const inventory: CraftingCargoInventory;
console.log(inventory.items);

readonly items: readonly CraftingCargoItem[];

Defined in: packages/sage/src/crafting/index.ts:72

readonly sequenceId: number;

Defined in: packages/sage/src/crafting/index.ts:70

readonly usedStorageUnitsRaw: bigint;

Defined in: packages/sage/src/crafting/index.ts:71


Defined in: packages/sage/src/crafting/index.ts:58

A registry-resolved cargo amount used by a Recipe or Crafting Process.

declare const item: CraftingCargoItem;
console.log(item.name, item.quantityRaw);

readonly categoryId: number;

Defined in: packages/sage/src/registry/index.ts:69

CargoDefinitionSummary.categoryId

readonly id: number;

Defined in: packages/sage/src/registry/index.ts:70

CargoDefinitionSummary.id

readonly mint: Address;

Defined in: packages/sage/src/registry/index.ts:71

CargoDefinitionSummary.mint

readonly name: string;

Defined in: packages/sage/src/registry/index.ts:72

CargoDefinitionSummary.name

readonly quantityRaw: bigint;

Defined in: packages/sage/src/crafting/index.ts:59

readonly storageCost: number;

Defined in: packages/sage/src/registry/index.ts:73

CargoDefinitionSummary.storageCost


Defined in: packages/sage/src/crafting/index.ts:127

One resolved cargo quantity used by a Hab building definition.

declare const item: CraftingDefinitionCargoItem;
console.log(item.quantityRaw);

readonly categoryId: number;

Defined in: packages/sage/src/registry/index.ts:69

CargoDefinitionSummary.categoryId

readonly id: number;

Defined in: packages/sage/src/registry/index.ts:70

CargoDefinitionSummary.id

readonly mint: Address;

Defined in: packages/sage/src/registry/index.ts:71

CargoDefinitionSummary.mint

readonly name: string;

Defined in: packages/sage/src/registry/index.ts:72

CargoDefinitionSummary.name

readonly quantityRaw: bigint;

Defined in: packages/sage/src/crafting/index.ts:128

readonly storageCost: number;

Defined in: packages/sage/src/registry/index.ts:73

CargoDefinitionSummary.storageCost


Defined in: packages/sage/src/crafting/index.ts:138

A resolved Crafting Hab building definition and placed quantity.

declare const building: CraftingHabBuilding;
console.log(building.definition.name, building.quantity);

readonly definition: {
constructionCost: readonly CraftingDefinitionCargoItem[];
constructionDurationSeconds: bigint;
crewSlots: number;
hubValue: number;
id: number;
jobCapacity: number;
minimumTier: "one" | "two" | "three" | "four" | "five";
modifiers: CraftingModifierData;
name: string;
neededCrew: number;
netRates: readonly CargoDefinitionSummary & {
unitsPerSecond: number;
unitsPerSecondRaw: bigint;
}[];
providedTagIds: readonly number[];
refunds: readonly CraftingDefinitionCargoItem[];
requiredTagIds: readonly number[];
researchRequirementIds: readonly number[];
resourceCapacityRaw: bigint;
slots: number;
unlockedRecipes: readonly EntityRef<"recipe">[];
xpValue: {
raw: bigint;
value: number;
};
};

Defined in: packages/sage/src/crafting/index.ts:140

readonly constructionCost: readonly CraftingDefinitionCargoItem[];
readonly constructionDurationSeconds: bigint;
readonly crewSlots: number;
readonly hubValue: number;
readonly id: number;
readonly jobCapacity: number;
readonly minimumTier: "one" | "two" | "three" | "four" | "five";
readonly modifiers: CraftingModifierData;
readonly name: string;
readonly neededCrew: number;
readonly netRates: readonly CargoDefinitionSummary & {
unitsPerSecond: number;
unitsPerSecondRaw: bigint;
}[];
readonly providedTagIds: readonly number[];
readonly refunds: readonly CraftingDefinitionCargoItem[];
readonly requiredTagIds: readonly number[];
readonly researchRequirementIds: readonly number[];
readonly resourceCapacityRaw: bigint;
readonly slots: number;
readonly unlockedRecipes: readonly EntityRef<"recipe">[];
readonly xpValue: {
raw: bigint;
value: number;
};
readonly raw: bigint;
readonly value: number;

readonly quantity: number;

Defined in: packages/sage/src/crafting/index.ts:139


Defined in: packages/sage/src/crafting/index.ts:102

A resolved Crafting Hab definition from the Game registry.

declare const definition: CraftingHabDefinitionSummary;
console.log(definition.name, definition.placementCargo.name);

readonly evictionGracePeriodSeconds: bigint;

Defined in: packages/sage/src/crafting/index.ts:115

readonly hubValue: number;

Defined in: packages/sage/src/crafting/index.ts:112

readonly id: number;

Defined in: packages/sage/src/crafting/index.ts:103

readonly name: string;

Defined in: packages/sage/src/crafting/index.ts:104

readonly placementCargo: CargoDefinitionSummary;

Defined in: packages/sage/src/crafting/index.ts:117

readonly placementFeeMultiplier: {
raw: bigint;
value: number;
};

Defined in: packages/sage/src/crafting/index.ts:108

readonly raw: bigint;
readonly value: number;

readonly providedTagIds: readonly number[];

Defined in: packages/sage/src/crafting/index.ts:114

readonly rentMultiplier: {
raw: bigint;
value: number;
};

Defined in: packages/sage/src/crafting/index.ts:107

readonly raw: bigint;
readonly value: number;

readonly requiredTagIds: readonly number[];

Defined in: packages/sage/src/crafting/index.ts:113

readonly respawnDurationSeconds: bigint;

Defined in: packages/sage/src/crafting/index.ts:116

readonly slots: number;

Defined in: packages/sage/src/crafting/index.ts:106

readonly tier: "one" | "two" | "three" | "four" | "five";

Defined in: packages/sage/src/crafting/index.ts:105


Defined in: packages/sage/src/crafting/index.ts:173

Immutable translated Crafting Hab infrastructure and production state.

declare const hab: CraftingHabSnapshot;
console.log(hab.definition.name, hab.production.inventory.items);
  • Omit<CraftingHabAccountData, | "buildings" | "game" | "ownerProfile" | "production" | "system" | "unlockedRecipeIds">

readonly address: Address;

Defined in: packages/sage/src/crafting/index.ts:183

readonly availableJobSlots: number;

Defined in: packages/sage/src/crafting/index.ts:189

readonly buildingDefinitionSequenceId: number;

Defined in: packages/sage/src/internal/c4/crafting.ts:207

Omit.buildingDefinitionSequenceId

readonly buildings: readonly CraftingHabBuilding[];

Defined in: packages/sage/src/crafting/index.ts:188

readonly constructionProgressAtUnixSeconds: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:211

Omit.constructionProgressAtUnixSeconds

readonly constructionRemainingSeconds: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:210

Omit.constructionRemainingSeconds

readonly definition: CraftingHabDefinitionSummary;

Defined in: packages/sage/src/crafting/index.ts:187

readonly definitionId: number;

Defined in: packages/sage/src/internal/c4/crafting.ts:205

Omit.definitionId

readonly definitionSequenceId: number;

Defined in: packages/sage/src/internal/c4/crafting.ts:206

Omit.definitionSequenceId

readonly game: EntityRef<"game">;

Defined in: packages/sage/src/crafting/index.ts:184

readonly jobCapacity: number;

Defined in: packages/sage/src/internal/c4/crafting.ts:214

Omit.jobCapacity

readonly jobsRunning: number;

Defined in: packages/sage/src/internal/c4/crafting.ts:215

Omit.jobsRunning

readonly kind: "craftingHabInstance";

Defined in: packages/sage/src/crafting/index.ts:182

readonly lastRentAtUnixSeconds: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:209

Omit.lastRentAtUnixSeconds

readonly modifiers: CraftingModifierData;

Defined in: packages/sage/src/internal/c4/crafting.ts:216

Omit.modifiers

readonly neededCrew: number;

Defined in: packages/sage/src/internal/c4/crafting.ts:213

Omit.neededCrew

readonly ownerProfile: EntityRef<"profile">;

Defined in: packages/sage/src/crafting/index.ts:185

readonly production: {
inventory: CraftingCargoInventory;
lastTickAtUnixSeconds: bigint;
netRates: readonly CargoDefinitionSummary & {
unitsPerSecond: number;
unitsPerSecondRaw: bigint;
}[];
resourceCapacityRaw: bigint;
};

Defined in: packages/sage/src/crafting/index.ts:191

readonly inventory: CraftingCargoInventory;
readonly lastTickAtUnixSeconds: bigint;
readonly netRates: readonly CargoDefinitionSummary & {
unitsPerSecond: number;
unitsPerSecondRaw: bigint;
}[];
readonly resourceCapacityRaw: bigint;

readonly rentBalanceRaw: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:212

Omit.rentBalanceRaw

readonly state: CraftingHabStateData;

Defined in: packages/sage/src/internal/c4/crafting.ts:219

Omit.state

readonly system: EntityRef<"starSystem">;

Defined in: packages/sage/src/crafting/index.ts:186

readonly systemSequenceId: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:208

Omit.systemSequenceId

readonly unlockedRecipes: readonly EntityRef<"recipe">[];

Defined in: packages/sage/src/crafting/index.ts:190

readonly version: number;

Defined in: packages/sage/src/internal/c4/crafting.ts:201

Omit.version

toJSON(): unknown;

Defined in: packages/sage/src/crafting/index.ts:200

unknown


Defined in: packages/sage/src/crafting/index.ts:210

Immutable translated Crafting Process with resolved Recipe and inputs.

declare const process: CraftingProcessSnapshot;
console.log(process.recipe.name, process.numCrew);
  • Omit<CraftingProcessAccountData, | "craftingHab" | "inputs" | "profile" | "recipe" | "starbasePlayer" | "system">

readonly address: Address;

Defined in: packages/sage/src/crafting/index.ts:215

readonly craftingHab: EntityRef<"craftingHabInstance">;

Defined in: packages/sage/src/crafting/index.ts:220

readonly endsAtUnixSeconds: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:239

Omit.endsAtUnixSeconds

readonly feeEscrowAtlas: number;

Defined in: packages/sage/src/crafting/index.ts:222

readonly feeEscrowRaw: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:240

Omit.feeEscrowRaw

readonly inputs: CraftingCargoInventory;

Defined in: packages/sage/src/crafting/index.ts:221

readonly kind: "craftingProcess";

Defined in: packages/sage/src/crafting/index.ts:214

readonly numCrew: number;

Defined in: packages/sage/src/internal/c4/crafting.ts:237

Omit.numCrew

readonly profile: EntityRef<"profile">;

Defined in: packages/sage/src/crafting/index.ts:217

readonly quantityRaw: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:236

Omit.quantityRaw

readonly recipe: RecipeSnapshot;

Defined in: packages/sage/src/crafting/index.ts:216

readonly starbasePlayer: EntityRef<"starbasePlayer">;

Defined in: packages/sage/src/crafting/index.ts:219

readonly starbaseSequenceId: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:234

Omit.starbaseSequenceId

readonly startsAtUnixSeconds: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:238

Omit.startsAtUnixSeconds

readonly system: EntityRef<"starSystem">;

Defined in: packages/sage/src/crafting/index.ts:218

readonly version: number;

Defined in: packages/sage/src/internal/c4/crafting.ts:229

Omit.version

toJSON(): unknown;

Defined in: packages/sage/src/crafting/index.ts:223

unknown


Defined in: packages/sage/src/crafting/index.ts:82

Immutable translated Recipe definition.

declare const recipe: RecipeSnapshot;
console.log(recipe.ingredients, recipe.outputs);
  • Omit<RecipeAccountData, "game" | "id" | "inputs" | "outputs">

readonly address: Address;

Defined in: packages/sage/src/crafting/index.ts:87

readonly craftingDurationSeconds: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:145

Omit.craftingDurationSeconds

readonly fee: {
amountAtlas: number;
amountRaw: bigint;
recipient: "atlas" | "dao-atlas";
};

Defined in: packages/sage/src/internal/c4/crafting.ts:149

readonly amountAtlas: number;
readonly amountRaw: bigint;
readonly recipient: "atlas" | "dao-atlas";
Omit.fee

readonly game: EntityRef<"game">;

Defined in: packages/sage/src/crafting/index.ts:88

readonly habRequired: boolean;

Defined in: packages/sage/src/internal/c4/crafting.ts:154

Omit.habRequired

readonly id: number;

Defined in: packages/sage/src/crafting/index.ts:89

readonly ingredients: readonly CraftingCargoItem[];

Defined in: packages/sage/src/crafting/index.ts:90

readonly kind: "recipe";

Defined in: packages/sage/src/crafting/index.ts:86

readonly minimumDurationSeconds: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:146

Omit.minimumDurationSeconds

readonly minimumStarbaseLevel:
| "level-0"
| "level-1"
| "level-2"
| "level-3"
| "level-4"
| "level-5"
| "css";

Defined in: packages/sage/src/internal/c4/crafting.ts:158

Omit.minimumStarbaseLevel

readonly modifierBounds: {
crewCount: CraftingModifierBoundsData;
efficiency: CraftingModifierBoundsData;
fee: CraftingModifierBoundsData;
speed: CraftingModifierBoundsData;
};

Defined in: packages/sage/src/internal/c4/crafting.ts:166

readonly crewCount: CraftingModifierBoundsData;
readonly efficiency: CraftingModifierBoundsData;
readonly fee: CraftingModifierBoundsData;
readonly speed: CraftingModifierBoundsData;
Omit.modifierBounds

readonly name: string;

Defined in: packages/sage/src/internal/c4/crafting.ts:147

Omit.name

readonly outputs: readonly CraftingCargoItem[];

Defined in: packages/sage/src/crafting/index.ts:91

readonly researchRequirementIds: readonly number[];

Defined in: packages/sage/src/internal/c4/crafting.ts:172

Omit.researchRequirementIds

readonly status: "active" | "deactivated";

Defined in: packages/sage/src/internal/c4/crafting.ts:148

Omit.status

readonly usageCountRaw: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:155

Omit.usageCountRaw

readonly usageLimitRaw: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:156

Omit.usageLimitRaw

readonly version: number;

Defined in: packages/sage/src/internal/c4/crafting.ts:142

Omit.version

readonly xpValueRaw: bigint;

Defined in: packages/sage/src/internal/c4/crafting.ts:157

Omit.xpValueRaw

toJSON(): unknown;

Defined in: packages/sage/src/crafting/index.ts:92

unknown

type CraftingDiscoveryOptions = Omit<DiscoveryRequest, "filters" | "strategy">;

Defined in: packages/sage/src/crafting/index.ts:46

Options supported by targeted crafting discovery.

const options: CraftingDiscoveryOptions = { commitment: 'confirmed' };

type CraftingProcessState =
| {
kind: "scheduled";
}
| {
kind: "in-progress";
remainingSeconds: bigint;
}
| {
kind: "complete";
};

Defined in: packages/sage/src/crafting/index.ts:232

Pure lifecycle projection for one Crafting Process at a given Unix time.

const state: CraftingProcessState = { kind: 'scheduled' };

function deriveCraftingProcessState(process, atUnixSeconds): CraftingProcessState;

Defined in: packages/sage/src/crafting/index.ts:913

Derives the scheduled, active, or complete state at a Unix timestamp.

ParameterType
processPick<CraftingProcessSnapshot, "startsAtUnixSeconds" | "endsAtUnixSeconds">
atUnixSecondsbigint

CraftingProcessState

declare const process: CraftingProcessSnapshot;
const state = deriveCraftingProcessState(process, 1_700_000_000n);

function getCraftingHab(
context,
address,
options?): Promise<CraftingHabSnapshot>;

Defined in: packages/sage/src/crafting/index.ts:664

Reads a required Crafting Hab by its signer-created account address.

ParameterType
contextSageContext
addressAddress
options?ReadOptions

Promise<CraftingHabSnapshot>

declare const ctx: SageContext;
declare const address: Address;
const hab = await getCraftingHab(ctx, address);

function getCraftingHabsByCharacter(
context,
character,
options?): Promise<readonly CraftingHabSnapshot[]>;

Defined in: packages/sage/src/crafting/index.ts:852

Discovers Crafting Habs for the Profile stored by one Character.

ParameterType
contextSageContext
characterAddress
options?CraftingDiscoveryOptions

Promise<readonly CraftingHabSnapshot[]>

declare const ctx: SageContext;
declare const character: Address;
const habs = await getCraftingHabsByCharacter(ctx, character);

function getCraftingHabsByProfile(
context,
profile,
options?): Promise<readonly CraftingHabSnapshot[]>;

Defined in: packages/sage/src/crafting/index.ts:751

Discovers Crafting Habs owned by one Player Profile.

ParameterType
contextSageContext
profileAddress
options?CraftingDiscoveryOptions

Promise<readonly CraftingHabSnapshot[]>

declare const ctx: SageContext;
declare const profile: Address;
const habs = await getCraftingHabsByProfile(ctx, profile);

function getCraftingHabsByStarbasePlayer(
context,
player,
options?): Promise<readonly CraftingHabSnapshot[]>;

Defined in: packages/sage/src/crafting/index.ts:801

Discovers Crafting Habs for the Profile and System stored by a StarbasePlayer.

ParameterType
contextSageContext
playerAddress
options?CraftingDiscoveryOptions

Promise<readonly CraftingHabSnapshot[]>

declare const ctx: SageContext;
declare const player: Address;
const habs = await getCraftingHabsByStarbasePlayer(ctx, player);

function getCraftingProcess(
context,
address,
options?): Promise<CraftingProcessSnapshot>;

Defined in: packages/sage/src/crafting/index.ts:706

Reads a required Crafting Process by its signer-created account address.

ParameterType
contextSageContext
addressAddress
options?ReadOptions

Promise<CraftingProcessSnapshot>

declare const ctx: SageContext;
declare const address: Address;
const process = await getCraftingProcess(ctx, address);

function getCraftingProcessesByCharacter(
context,
character,
options?): Promise<readonly CraftingProcessSnapshot[]>;

Defined in: packages/sage/src/crafting/index.ts:881

Discovers Crafting Processes for the Profile stored by one Character.

ParameterType
contextSageContext
characterAddress
options?CraftingDiscoveryOptions

Promise<readonly CraftingProcessSnapshot[]>

declare const ctx: SageContext;
declare const character: Address;
const processes = await getCraftingProcessesByCharacter(ctx, character);

function getCraftingProcessesByProfile(
context,
profile,
options?): Promise<readonly CraftingProcessSnapshot[]>;

Defined in: packages/sage/src/crafting/index.ts:777

Discovers Crafting Processes belonging to one Player Profile.

ParameterType
contextSageContext
profileAddress
options?CraftingDiscoveryOptions

Promise<readonly CraftingProcessSnapshot[]>

declare const ctx: SageContext;
declare const profile: Address;
const processes = await getCraftingProcessesByProfile(ctx, profile);

function getCraftingProcessesByStarbasePlayer(
context,
player,
options?): Promise<readonly CraftingProcessSnapshot[]>;

Defined in: packages/sage/src/crafting/index.ts:828

Discovers Crafting Processes linked to one StarbasePlayer.

ParameterType
contextSageContext
playerAddress
options?CraftingDiscoveryOptions

Promise<readonly CraftingProcessSnapshot[]>

declare const ctx: SageContext;
declare const player: Address;
const processes = await getCraftingProcessesByStarbasePlayer(ctx, player);

function getRecipe(
context,
address,
options?): Promise<RecipeSnapshot>;

Defined in: packages/sage/src/crafting/index.ts:600

Reads a required Recipe by its derived account address.

ParameterType
contextSageContext
addressAddress
options?ReadOptions

Promise<RecipeSnapshot>

declare const ctx: SageContext;
declare const address: Address;
const recipe = await getRecipe(ctx, address);

function getRecipeById(
context,
recipeId,
options?): Promise<RecipeSnapshot>;

Defined in: packages/sage/src/crafting/index.ts:643

Derives and reads one Recipe from the configured Game and recipe id.

ParameterType
contextSageContext
recipeIdnumber
options?ReadOptions

Promise<RecipeSnapshot>

declare const ctx: SageContext;
const recipe = await getRecipeById(ctx, 7);

function maybeGetCraftingHab(
context,
address,
options?): Promise<
| CraftingHabSnapshot
| undefined>;

Defined in: packages/sage/src/crafting/index.ts:684

Reads an optional Crafting Hab by address.

ParameterType
contextSageContext
addressAddress
options?ReadOptions

Promise< | CraftingHabSnapshot | undefined>

declare const ctx: SageContext;
declare const address: Address;
const hab = await maybeGetCraftingHab(ctx, address);

function maybeGetCraftingProcess(
context,
address,
options?): Promise<
| CraftingProcessSnapshot
| undefined>;

Defined in: packages/sage/src/crafting/index.ts:727

Reads an optional Crafting Process by address.

ParameterType
contextSageContext
addressAddress
options?ReadOptions

Promise< | CraftingProcessSnapshot | undefined>

declare const ctx: SageContext;
declare const address: Address;
const process = await maybeGetCraftingProcess(ctx, address);

function maybeGetRecipe(
context,
address,
options?): Promise<RecipeSnapshot | undefined>;

Defined in: packages/sage/src/crafting/index.ts:620

Reads an optional Recipe by address.

ParameterType
contextSageContext
addressAddress
options?ReadOptions

Promise<RecipeSnapshot | undefined>

declare const ctx: SageContext;
declare const address: Address;
const recipe = await maybeGetRecipe(ctx, address);