mining
Interfaces
Section titled “Interfaces”FleetMiningOutput
Section titled “FleetMiningOutput”Defined in: packages/sage/src/mining/index.ts:107
One selected and registry-resolved output of an active mining Fleet.
Example
Section titled “Example”declare const output: FleetMiningOutput;console.log(output.cargo.name, output.unitsPerSecond);Extends
Section titled “Extends”Properties
Section titled “Properties”activeMinerCountRaw
Section titled “activeMinerCountRaw”readonly activeMinerCountRaw: bigint;Defined in: packages/sage/src/mining/index.ts:55
Inherited from
Section titled “Inherited from”ResourceDepositItem.activeMinerCountRaw
amountMinedUnitsRaw
Section titled “amountMinedUnitsRaw”readonly amountMinedUnitsRaw: bigint;Defined in: packages/sage/src/mining/index.ts:54
Inherited from
Section titled “Inherited from”ResourceDepositItem.amountMinedUnitsRaw
readonly cargo: CargoDefinitionSummary;Defined in: packages/sage/src/mining/index.ts:52
Inherited from
Section titled “Inherited from”richness
Section titled “richness”readonly richness: WorldFixedValue;Defined in: packages/sage/src/mining/index.ts:53
Inherited from
Section titled “Inherited from”unitsPerSecond
Section titled “unitsPerSecond”readonly unitsPerSecond: number;Defined in: packages/sage/src/mining/index.ts:108
FleetMiningSnapshot
Section titled “FleetMiningSnapshot”Defined in: packages/sage/src/mining/index.ts:118
Immutable current extraction relationship for one active mining Fleet.
Example
Section titled “Example”declare const mining: FleetMiningSnapshot;console.log(mining.outputs);Properties
Section titled “Properties”asteroid
Section titled “asteroid”readonly asteroid: EntityRef<"celestialBody">;Defined in: packages/sage/src/mining/index.ts:122
readonly fleet: EntityRef<"fleet">;Defined in: packages/sage/src/mining/index.ts:120
readonly kind: "fleetMining";Defined in: packages/sage/src/mining/index.ts:119
lastUpdatedAtUnixSeconds
Section titled “lastUpdatedAtUnixSeconds”readonly lastUpdatedAtUnixSeconds: bigint;Defined in: packages/sage/src/mining/index.ts:123
miningRate
Section titled “miningRate”readonly miningRate: { raw: bigint; unitsPerSecond: number;};Defined in: packages/sage/src/mining/index.ts:125
readonly raw: bigint;unitsPerSecond
Section titled “unitsPerSecond”readonly unitsPerSecond: number;outputs
Section titled “outputs”readonly outputs: readonly FleetMiningOutput[];Defined in: packages/sage/src/mining/index.ts:129
ownerProfile
Section titled “ownerProfile”readonly ownerProfile: EntityRef<"profile">;Defined in: packages/sage/src/mining/index.ts:121
regionXpModifier
Section titled “regionXpModifier”readonly regionXpModifier: WorldFixedValue;Defined in: packages/sage/src/mining/index.ts:124
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): unknown;Defined in: packages/sage/src/mining/index.ts:130
Returns
Section titled “Returns”unknown
MiningOutputRate
Section titled “MiningOutputRate”Defined in: packages/sage/src/mining/index.ts:95
One richness-adjusted resource output in cargo units per second.
Example
Section titled “Example”const rate: MiningOutputRate = { cargoId: 8, unitsPerSecond: 4.5 };Properties
Section titled “Properties”cargoId
Section titled “cargoId”readonly cargoId: number;Defined in: packages/sage/src/mining/index.ts:96
unitsPerSecond
Section titled “unitsPerSecond”readonly unitsPerSecond: number;Defined in: packages/sage/src/mining/index.ts:97
MiningOutputRateInput
Section titled “MiningOutputRateInput”Defined in: packages/sage/src/mining/index.ts:84
A pure rate input pairing one cargo id with Asteroid richness.
Example
Section titled “Example”const input: MiningOutputRateInput = { cargoId: 8, richness: 1.5 };Properties
Section titled “Properties”cargoId
Section titled “cargoId”readonly cargoId: number;Defined in: packages/sage/src/mining/index.ts:85
richness
Section titled “richness”readonly richness: number;Defined in: packages/sage/src/mining/index.ts:86
ResourceDepositItem
Section titled “ResourceDepositItem”Defined in: packages/sage/src/mining/index.ts:51
One registry-resolved resource row nested in an Asteroid deposit.
Example
Section titled “Example”declare const resource: ResourceDepositItem;console.log(resource.cargo.name, resource.richness.value);Extended by
Section titled “Extended by”Properties
Section titled “Properties”activeMinerCountRaw
Section titled “activeMinerCountRaw”readonly activeMinerCountRaw: bigint;Defined in: packages/sage/src/mining/index.ts:55
amountMinedUnitsRaw
Section titled “amountMinedUnitsRaw”readonly amountMinedUnitsRaw: bigint;Defined in: packages/sage/src/mining/index.ts:54
readonly cargo: CargoDefinitionSummary;Defined in: packages/sage/src/mining/index.ts:52
richness
Section titled “richness”readonly richness: WorldFixedValue;Defined in: packages/sage/src/mining/index.ts:53
ResourceDepositSnapshot
Section titled “ResourceDepositSnapshot”Defined in: packages/sage/src/mining/index.ts:65
Immutable, translated Asteroid resource-deposit snapshot.
Example
Section titled “Example”declare const deposit: ResourceDepositSnapshot;console.log(deposit.resources);Properties
Section titled “Properties”address
Section titled “address”readonly address: Address;Defined in: packages/sage/src/mining/index.ts:67
bodyId
Section titled “bodyId”readonly bodyId: number;Defined in: packages/sage/src/mining/index.ts:68
readonly game: Address;Defined in: packages/sage/src/mining/index.ts:70
readonly kind: "resourceDeposit";Defined in: packages/sage/src/mining/index.ts:66
lastSyncedAtUnixSeconds
Section titled “lastSyncedAtUnixSeconds”readonly lastSyncedAtUnixSeconds: bigint;Defined in: packages/sage/src/mining/index.ts:73
readonly name: string;Defined in: packages/sage/src/mining/index.ts:69
resources
Section titled “resources”readonly resources: readonly ResourceDepositItem[];Defined in: packages/sage/src/mining/index.ts:74
system
Section titled “system”readonly system: EntityRef<"starSystem">;Defined in: packages/sage/src/mining/index.ts:71
systemSequenceId
Section titled “systemSequenceId”readonly systemSequenceId: bigint;Defined in: packages/sage/src/mining/index.ts:72
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): unknown;Defined in: packages/sage/src/mining/index.ts:75
Returns
Section titled “Returns”unknown
Type Aliases
Section titled “Type Aliases”MiningDiscoveryOptions
Section titled “MiningDiscoveryOptions”type MiningDiscoveryOptions = Omit<DiscoveryRequest, "filters" | "strategy">;Defined in: packages/sage/src/mining/index.ts:139
Options supported by owner-scoped active-mining discovery.
Example
Section titled “Example”const options: MiningDiscoveryOptions = { commitment: 'confirmed' };Functions
Section titled “Functions”deriveMiningOutputRates()
Section titled “deriveMiningOutputRates()”function deriveMiningOutputRates(fleetUnitsPerSecond, outputs): readonly MiningOutputRate[];Defined in: packages/sage/src/mining/index.ts:317
Derives each selected output rate as Fleet units/second times deposit richness.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fleetUnitsPerSecond | number |
outputs | readonly MiningOutputRateInput[] |
Returns
Section titled “Returns”readonly MiningOutputRate[]
Example
Section titled “Example”const rates = deriveMiningOutputRates(2, [{ cargoId: 8, richness: 1.5 }]);deriveMiningStateAgeSeconds()
Section titled “deriveMiningStateAgeSeconds()”function deriveMiningStateAgeSeconds(lastUpdatedAtUnixSeconds, atUnixSeconds): number;Defined in: packages/sage/src/mining/index.ts:300
Derives mining-state age in whole seconds and clamps future timestamps.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
lastUpdatedAtUnixSeconds | bigint |
atUnixSeconds | bigint |
Returns
Section titled “Returns”number
Example
Section titled “Example”const age = deriveMiningStateAgeSeconds(100n, 112n); // 12getFleetMiningState()
Section titled “getFleetMiningState()”function getFleetMiningState( context, fleet, options?): Promise< | FleetMiningSnapshot| undefined>;Defined in: packages/sage/src/mining/index.ts:481
Reads a Fleet and returns its active extraction relationship, if mining.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
fleet | Address |
options? | ReadOptions |
Returns
Section titled “Returns”Promise<
| FleetMiningSnapshot
| undefined>
Example
Section titled “Example”declare const ctx: SageContext;declare const fleet: Address;const mining = await getFleetMiningState(ctx, fleet);getFleetMiningStatesByOwner()
Section titled “getFleetMiningStatesByOwner()”function getFleetMiningStatesByOwner( context, owner,options?): Promise<readonly FleetMiningSnapshot[]>;Defined in: packages/sage/src/mining/index.ts:505
Finds active mining Fleets for one owner through stable Fleet filters.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
owner | Address |
options? | MiningDiscoveryOptions |
Returns
Section titled “Returns”Promise<readonly FleetMiningSnapshot[]>
Example
Section titled “Example”declare const ctx: SageContext;declare const owner: Address;const mining = await getFleetMiningStatesByOwner(ctx, owner);getResourceDeposit()
Section titled “getResourceDeposit()”function getResourceDeposit( context, asteroid,options?): Promise<ResourceDepositSnapshot>;Defined in: packages/sage/src/mining/index.ts:253
Reads a required Asteroid resource deposit by CelestialBody address.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
asteroid | Address |
options? | ReadOptions |
Returns
Section titled “Returns”Promise<ResourceDepositSnapshot>
Example
Section titled “Example”declare const ctx: SageContext;declare const asteroid: Address;const deposit = await getResourceDeposit(ctx, asteroid);maybeGetResourceDeposit()
Section titled “maybeGetResourceDeposit()”function maybeGetResourceDeposit( context, asteroid, options?): Promise< | ResourceDepositSnapshot| undefined>;Defined in: packages/sage/src/mining/index.ts:278
Reads an optional Asteroid resource deposit by CelestialBody address.
Returns undefined only when the account does not exist. A present
non-Asteroid CelestialBody throws AccountDecodeError because it is
not a resource deposit.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
asteroid | Address |
options? | ReadOptions |
Returns
Section titled “Returns”Promise<
| ResourceDepositSnapshot
| undefined>
Example
Section titled “Example”declare const ctx: SageContext;declare const asteroid: Address;const deposit = await maybeGetResourceDeposit(ctx, asteroid);projectMiningOutputUnits()
Section titled “projectMiningOutputUnits()”function projectMiningOutputUnits(unitsPerSecond, elapsedSeconds): number;Defined in: packages/sage/src/mining/index.ts:351
Projects nominal output units from a rate and elapsed seconds.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
unitsPerSecond | number |
elapsedSeconds | number |
Returns
Section titled “Returns”number
Example
Section titled “Example”const units = projectMiningOutputUnits(4.5, 20); // 90