Cargo
Cargo is what a fleet carries: ore it has mined, fuel it burns, components for crafting, ammunition. Reading it is one relationship step from the fleet.
const inventory = await fleet.inventory.get();
for (const item of inventory.cargoHold.items) { console.log(item.mint, item.quantityRaw);}Quantities are bigint
Section titled “Quantities are bigint”Every quantity is a bigint, never a number:
item.quantityRaw; // 713nThis is not pedantry. Game amounts routinely exceed what a JavaScript number
holds exactly, and once a value passes that threshold, arithmetic silently
produces the wrong answer with no error anywhere. Rounding somebody’s ore count
by a few units because the value crossed 2^53 is worse than making you type
n.
If you need to display a quantity, convert at the edge:
const display = item.quantityRaw.toString();Do the arithmetic in bigint and convert only when rendering.
Raw amounts and definitions
Section titled “Raw amounts and definitions”quantityRaw is exactly what the chain stores. Turning it into something
human-facing — a resource name, a decimal amount — needs the cargo definitions
from the Game account, which the SDK loads and caches for you.
The mint on each item is the resource’s identity. Match it against the
registry’s cargo definitions to get the name and its properties.
Gotchas
Section titled “Gotchas”A fleet has more than one hold. cargoHold is the general one; fuel and
ammunition are tracked separately, because the game treats them separately.
Reading only cargoHold will miss them.
Capacity is not a single number. What a fleet can carry depends on its ships and their cargo pods, which come from the Game definitions rather than from the fleet account itself.
An empty items array is normal. A fleet that has just unloaded carries
nothing. That is not an error and not a missing read.