> ## Documentation Index
> Fetch the complete documentation index at: https://shield.fi/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Types and parsing

> Parse the current contract and API wire types without losing integer precision.

## Wide values

`sqrt_price` and every `*_x_128` fee-growth field use `u256::U256`:

```text theme={"languages":{"custom":["/languages/leo.tmLanguage.json"]}}
{ hi: u128, lo: u128 }
```

Pack it as `(hi << 128) | lo`. Do not parse either limb through a JavaScript `number`.

## Native token amounts

The contract uses token program base units directly. `PoolState` contains only `token0`, `token1`, `fee`, and `enabled`. It has no `scale0` or `scale1` fields.

The API can add display metadata such as symbol and decimals. Keep that metadata separate from the contract mapping value.

## Records

`PositionNFT` includes both `owner` and immutable `withdrawal`. `MintComplianceRecord` includes nonce, recipient, and withdrawal. Token inputs and outputs are dynamic records, so resolve their concrete program through the deployment registry.

## Deadlines

Contract swap deadlines are `u32` Aleo block heights. Do not encode Unix seconds in that field, even if a stale API description or client label calls it a timestamp.

## Source of truth

Use this precedence when types disagree:

1. The deployed program for the selected environment.
2. The matching contract registry and pinned contract source.
3. The API OpenAPI document and transaction schema endpoint.
4. Client-side TypeScript types.

The last two can lag a contract change. Validate transaction inputs against the first two before signing.
