cargo
Interfaces
Section titled “Interfaces”CargoCapacity
Section titled “CargoCapacity”Defined in: packages/sage/src/internal/cargo.ts:43
Exact used, total, remaining, and excess values for one capacity axis.
Example
Section titled “Example”declare const capacity: CargoCapacity;console.log(capacity.remainingRaw);Properties
Section titled “Properties”overCapacityRaw
Section titled “overCapacityRaw”readonly overCapacityRaw: bigint;Defined in: packages/sage/src/internal/cargo.ts:47
remainingRaw
Section titled “remainingRaw”readonly remainingRaw: bigint;Defined in: packages/sage/src/internal/cargo.ts:46
totalRaw
Section titled “totalRaw”readonly totalRaw: bigint;Defined in: packages/sage/src/internal/cargo.ts:45
usedRaw
Section titled “usedRaw”readonly usedRaw: bigint;Defined in: packages/sage/src/internal/cargo.ts:44
CargoInventoryItem
Section titled “CargoInventoryItem”Defined in: packages/sage/src/internal/cargo.ts:17
Exact cargo quantity joined to its lazily loaded definition.
Example
Section titled “Example”declare const item: CargoInventoryItem;console.log(item.name, item.quantityRaw);Extends
Section titled “Extends”Properties
Section titled “Properties”categoryId
Section titled “categoryId”readonly categoryId: number;Defined in: packages/sage/src/registry/index.ts:69
Inherited from
Section titled “Inherited from”CargoDefinitionSummary.categoryId
readonly id: number;Defined in: packages/sage/src/registry/index.ts:70
Inherited from
Section titled “Inherited from”readonly mint: Address;Defined in: packages/sage/src/registry/index.ts:71
Inherited from
Section titled “Inherited from”readonly name: string;Defined in: packages/sage/src/registry/index.ts:72
Inherited from
Section titled “Inherited from”quantityRaw
Section titled “quantityRaw”readonly quantityRaw: bigint;Defined in: packages/sage/src/internal/cargo.ts:19
Exact on-chain cargo quantity in the cargo type’s raw units.
storageCost
Section titled “storageCost”readonly storageCost: number;Defined in: packages/sage/src/registry/index.ts:73
Inherited from
Section titled “Inherited from”CargoDefinitionSummary.storageCost
CargoPodInventory
Section titled “CargoPodInventory”Defined in: packages/sage/src/internal/cargo.ts:29
One nested C4 CargoPod translated into an immutable inventory value.
Example
Section titled “Example”declare const pod: CargoPodInventory;console.log(pod.usedStorageUnitsRaw, pod.items);Properties
Section titled “Properties”readonly items: readonly CargoInventoryItem[];Defined in: packages/sage/src/internal/cargo.ts:33
sequenceId
Section titled “sequenceId”readonly sequenceId: number;Defined in: packages/sage/src/internal/cargo.ts:30
usedStorageUnitsRaw
Section titled “usedStorageUnitsRaw”readonly usedStorageUnitsRaw: bigint;Defined in: packages/sage/src/internal/cargo.ts:32
Exact aggregate storage use reported by the parent account.
FleetCargoInventorySnapshot
Section titled “FleetCargoInventorySnapshot”Defined in: packages/sage/src/cargo/index.ts:73
Immutable cargo inventory projected from the CargoPods nested in a Fleet.
Example
Section titled “Example”declare const inventory: FleetCargoInventorySnapshot;console.log(inventory.cargoHold.items);Extends
Section titled “Extends”Omit<ResolvedFleetCargoInventory,"ownerProfile">
Extended by
Section titled “Extended by”Properties
Section titled “Properties”address
Section titled “address”readonly address: Address;Defined in: packages/sage/src/cargo/index.ts:79
Parent Fleet address; CargoPods are nested values and have no own address.
readonly ammo: CargoInventoryItem;Defined in: packages/sage/src/internal/cargo.ts:63
Inherited from
Section titled “Inherited from”Omit.ammocapacities
Section titled “capacities”readonly capacities: { ammoUnits: CargoCapacity; cargoStorageUnits: CargoCapacity; fuelUnits: CargoCapacity;};Defined in: packages/sage/src/internal/cargo.ts:64
ammoUnits
Section titled “ammoUnits”readonly ammoUnits: CargoCapacity;cargoStorageUnits
Section titled “cargoStorageUnits”readonly cargoStorageUnits: CargoCapacity;fuelUnits
Section titled “fuelUnits”readonly fuelUnits: CargoCapacity;Inherited from
Section titled “Inherited from”Omit.capacitiescargoHold
Section titled “cargoHold”readonly cargoHold: CargoPodInventory;Defined in: packages/sage/src/internal/cargo.ts:59
Inherited from
Section titled “Inherited from”Omit.cargoHoldcomponents
Section titled “components”readonly components: CargoPodInventory;Defined in: packages/sage/src/internal/cargo.ts:60
Inherited from
Section titled “Inherited from”Omit.componentsreadonly fleet: EntityRef<"fleet">;Defined in: packages/sage/src/cargo/index.ts:80
readonly fuel: CargoInventoryItem;Defined in: packages/sage/src/internal/cargo.ts:62
Inherited from
Section titled “Inherited from”Omit.fuelreadonly kind: "fleetCargoInventory";Defined in: packages/sage/src/cargo/index.ts:77
ownerProfile
Section titled “ownerProfile”readonly ownerProfile: EntityRef<"profile">;Defined in: packages/sage/src/cargo/index.ts:81
respawningCargo
Section titled “respawningCargo”readonly respawningCargo: CargoPodInventory;Defined in: packages/sage/src/internal/cargo.ts:61
Inherited from
Section titled “Inherited from”Omit.respawningCargoMethods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): unknown;Defined in: packages/sage/src/cargo/index.ts:82
Returns
Section titled “Returns”unknown
Type Aliases
Section titled “Type Aliases”CargoDefinition
Section titled “CargoDefinition”type CargoDefinition = CargoDefinitionSummary;Defined in: packages/sage/src/cargo/index.ts:45
Stable cargo definition resolved lazily from the configured Game registry.
Example
Section titled “Example”declare const definition: CargoDefinition;console.log(definition.name, definition.storageCost);CargoDefinitionLookupOptions
Section titled “CargoDefinitionLookupOptions”type CargoDefinitionLookupOptions = DefinitionLookupOptions;Defined in: packages/sage/src/cargo/index.ts:53
Sequence expectation used when resolving a cargo definition.
Example
Section titled “Example”const options: CargoDefinitionLookupOptions = { expectedSequenceId: 4 };CargoDiscoveryOptions
Section titled “CargoDiscoveryOptions”type CargoDiscoveryOptions = Omit<DiscoveryRequest, "filters" | "strategy">;Defined in: packages/sage/src/cargo/index.ts:61
Options supported by targeted Fleet cargo inventory discovery.
Example
Section titled “Example”const options: CargoDiscoveryOptions = { commitment: 'confirmed' };Functions
Section titled “Functions”getCargoDefinition()
Section titled “getCargoDefinition()”function getCargoDefinition( context, cargoId,options?): Promise<CargoDefinitionSummary>;Defined in: packages/sage/src/cargo/index.ts:162
Resolves one cargo definition without loading the Game registry eagerly.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
cargoId | number |
options? | DefinitionLookupOptions |
Returns
Section titled “Returns”Promise<CargoDefinitionSummary>
Example
Section titled “Example”declare const ctx: SageContext;const fuel = await getCargoDefinition(ctx, 1);getFleetCargoInventoriesByOwner()
Section titled “getFleetCargoInventoriesByOwner()”function getFleetCargoInventoriesByOwner( context, profileAddress,options?): Promise<readonly FleetCargoInventorySnapshot[]>;Defined in: packages/sage/src/cargo/index.ts:227
Discovers CargoPod inventories for Fleets owned by a Player Profile.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
profileAddress | Address |
options? | CargoDiscoveryOptions |
Returns
Section titled “Returns”Promise<readonly FleetCargoInventorySnapshot[]>
Example
Section titled “Example”declare const ctx: SageContext;declare const profileAddress: Address;const inventories = await getFleetCargoInventoriesByOwner(ctx, profileAddress);getFleetCargoInventory()
Section titled “getFleetCargoInventory()”function getFleetCargoInventory( context, fleetAddress,options?): Promise<FleetCargoInventorySnapshot>;Defined in: packages/sage/src/cargo/index.ts:178
Reads the required CargoPods nested in a Fleet account.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
fleetAddress | Address |
options? | ReadOptions |
Returns
Section titled “Returns”Promise<FleetCargoInventorySnapshot>
Example
Section titled “Example”declare const ctx: SageContext;declare const fleetAddress: Address;const inventory = await getFleetCargoInventory(ctx, fleetAddress);maybeGetFleetCargoInventory()
Section titled “maybeGetFleetCargoInventory()”function maybeGetFleetCargoInventory( context, fleetAddress, options?): Promise< | FleetCargoInventorySnapshot| undefined>;Defined in: packages/sage/src/cargo/index.ts:202
Reads optional CargoPods nested in a Fleet account.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context | SageContext |
fleetAddress | Address |
options? | ReadOptions |
Returns
Section titled “Returns”Promise<
| FleetCargoInventorySnapshot
| undefined>
Example
Section titled “Example”declare const ctx: SageContext;declare const fleetAddress: Address;const inventory = await maybeGetFleetCargoInventory(ctx, fleetAddress);