> For the complete documentation index, see [llms.txt](https://bubblegum-reality.gitbook.io/bubblegum-reality-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bubblegum-reality.gitbook.io/bubblegum-reality-docs/reference/data-types.md).

# Data Types

Client-safe DTOs from `src/lib/market-types.ts`. These are the only shapes that cross the server boundary — upstream payloads are normalized first.

## `AssetStatus`

```ts
type AssetStatus = "active" | "inactive" | "unknown";
```

`"unknown"` is deliberate: an asset whose status could not be determined must not default to `"active"`.

## `StockTokenAsset`

```ts
interface StockTokenAsset {
  symbol: string;
  name: string;
  address: string;              // checksummed
  decimals: number;             // read onchain, never assumed
  status: AssetStatus;
  logoUrl: string | null;
  currentMultiplier: string;    // decimal string, never a float
  pendingMultiplier: string | null;
  pendingEffectiveAt: string | null;  // ISO
  tradable: boolean;
  extendedHours: boolean;
  assetClass: string | null;
}
```

## `AssetsPayload`

```ts
interface AssetsPayload {
  assets: StockTokenAsset[];
  fetchedAt: string;
  totalOnChain: number;   // deployments on 4663 before the active filter
  inactiveCount: number;
}
```

## `ReferencePrice`

```ts
interface ReferencePrice {
  symbol: string;
  underlyingBid: string;   // raw underlying equity
  underlyingAsk: string;
  adjustedBid: string;     // underlyingBid × currentMultiplier
  adjustedAsk: string;
  multiplier: string;
  halted: boolean;
  underlyingDailyVolume: string | null;
  generatedAt: string;     // upstream generation time
  fetchedAt: string;       // our fetch time
}
```

Both timestamps exist because upstream staleness and transport staleness are different problems and the UI must distinguish them.

## `CorporateAction`

```ts
interface CorporateAction {
  symbol: string;
  kind: string;
  multiplier: string | null;
  effectiveAt: string | null;
  description: string | null;
}
```

## `ZeroExPriceResult`

```ts
interface ZeroExPriceResult {
  liquidityAvailable: boolean;
  sellToken: string;
  buyToken: string;
  sellAmount: string;            // base units
  buyAmount: string;             // base units
  minBuyAmount: string | null;
  totalNetworkFee: string | null;
  sources: string[];             // route diversity input
  fees: ZeroExFee[];             // every returned fee, displayed
  allowanceSpender: string | null;   // approve THIS address
  allowanceRequired: string | null;
  simulationComplete: boolean;
  fetchedAt: string;
}

interface ZeroExFee {
  type: string;
  token: string | null;
  amount: string | null;
}
```

## `ZeroExQuoteResult`

```ts
interface ZeroExQuoteResult extends ZeroExPriceResult {
  transaction: {
    to: string;
    data: string;
    value: string;
    gas: string | null;
    gasPrice: string | null;
  } | null;
}
```

`transaction: null` with `liquidityAvailable: false` is a valid, expected response — not an error.

## `ChainStatus`

```ts
interface ChainStatus {
  chainId: number;
  blockNumber: string | null;
  latencyMs: number | null;
  rpcSource: "configured" | "public";
  ok: boolean;
  checkedAt: string;
}
```

## `Degraded`

```ts
interface Degraded { degraded: true; reason: string }

function isDegraded(v: unknown): v is Degraded;
```

Any live cell may resolve to `Degraded`. The guard lets the UI render the reason instead of a fabricated value.

## Amount convention

All token amounts cross the boundary as **base-unit decimal strings**, not numbers. JSON numbers lose precision above 2^53; a `bigint` does not serialize. Strings preserve both.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bubblegum-reality.gitbook.io/bubblegum-reality-docs/reference/data-types.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
