Documentation: 0.5.0 (source: v0.5.0).
# Cargo

> Reading what a fleet is carrying, and why quantities are bigint.

Markdown source of https://docs-v0-5-0.atlas-kit-docs.pages.dev/guides/cargo/ — see https://docs-v0-5-0.atlas-kit-docs.pages.dev/ai/ for the full machine-readable surface.

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.

```ts
const inventory = await fleet.inventory.get();

for (const item of inventory.cargoHold.items) {
  console.log(item.mint, item.quantityRaw);
}
```

> **Runnable example — Read a fleet's cargo.** Follow a relationship one step further: from a fleet to what it is carrying. Run it in the browser at https://docs-v0-5-0.atlas-kit-docs.pages.dev/guides/cargo/.

:::game[Cargo space comes from the fleet]
A fleet can only carry what its ships have room for. General cargo, fuel, and
ammunition use separate storage limits, so empty fuel space cannot
automatically hold more ore. The game calls each of these storage records a
**CargoPod**; that name describes a container in the game data, not necessarily
a physical pod hanging from a ship. Adding more or different ships can increase
the fleet's storage, but it may also make the fleet slower or more expensive to
move.
:::

## Quantities are `bigint`

Every quantity is a `bigint`, never a `number`:

```ts
item.quantityRaw; // 713n
```

This 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:

```ts
const display = item.quantityRaw.toString();
```

Do the arithmetic in `bigint` and convert only when rendering.

## 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

**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.

## Reference

- [`cargo`](/reference/cargo/) — every export in this entry
- [`fleets`](/guides/fleets/) — where inventory hangs from
- [`mining`](/reference/mining/) — how cargo gets filled
