Types
This page is a dictionary of shapes — look up a type when an operations page links here. You do not need to read it top to bottom.
Nutrimatic models ledgers, instruments, and venues for market data, plus execution types for writes. Read operations and Write operations use these shapes.
Field presence. Types on this page define the shape Nutrimatic returns. Fields without ? are always included on a successful response. Fields with ? may be absent when that value is not yet available — treat absence as unknown, not as zero or empty unless stated otherwise. Method parameters follow a separate rule (Required in operation docs); config types use ? for fields you may omit at SDK init.
Shared: Ledger, IDs, WalletAdapter, ExecutionHandle, Path
Market: Instrument, Venue, candles, feeds, pool views
Execution: Quote, QuoteCost, Swap/Liquidity/Stake/Farm requests, SettlementStatus
Product DeFi: Balance, Position, StakePosition, FarmAt a glance
Shared
| Type | What it is | Used in |
|---|---|---|
| LedgerRef | A blockchain declared in SDK config | Config, DeploymentManifest |
| LedgerScope | Ledger ID or alias on inputs | Method ledgers filters |
| WalletAdapter | Bring-your-own signing | Config wallet, write path |
| SignRequest / SignedPayload | Sign in / out for the adapter | Wallet adapter |
| ExecutionHandle | Status of a write | easy.swap, liquidity.*, stake/farm/approve |
| Path | Ordered multi-step plan | Quotes, settlement |
Market (DeFi)
| Type | What it is | Used in |
|---|---|---|
| Instrument | A tradable token with product identity | Catalog, pair legs, prices |
| AmmVenueRef | An AMM pool | Catalog, venue-scoped reads |
| InstrumentProfile | Editorial metadata (description, logo, links) | getInstrumentProfile |
| PairListing | One listable market row | listPairs, getPair |
| Rate | Price between base and quote | Pool views, live state |
| CandleSeries | OHLCV chart data | getChart, getCandles |
| FeedSeries | Discrete event feed page | getVenueFeed, getTrades, getTradeFeed |
| TradeFeed | Trade-only feed alias | getTrades, getTradeFeed |
| VenueFeed | Multi-kind venue feed alias | getVenueFeed |
| InstrumentTelemetryView | Token price, market aggregate, optional supply | getTokenPrice, getInstrumentView |
| InstrumentMarketView | Aggregated venue volume / liquidity | Nested under instrument telemetry |
| InstrumentSupplyView | Total supply, issuance, treasury, holders | Nested under instrument telemetry |
| InstrumentTreasuryView | Treasury balances + vesting schedule | Nested under supply.treasury |
| AmmTelemetryView | Pool summary metrics | getPoolView, getAmmView |
| AmmVenueState | Live reserves and spot | getAmmState |
| TradeView | One executed trade event | getTrades, getTradeFeed |
| LiquidityEventView | LP add/remove event | getVenueFeed |
| DeploymentManifest | Deployed contracts for a ledger | getDeployment |
Execution
| Type | What it is | Used in |
|---|---|---|
| Quote / QuoteLeg / QuoteRequest / QuoteCost | Swap quote and cost lines | routing.quote, easy.swap |
| SwapRequest | Execute a swap | easy.swap |
| LiquidityAddRequest / LiquidityRemoveRequest | LP ops | liquidity.add / remove |
| Balance / Allowance / ApproveRequest | Wallet balances | balances.* |
| Position / PositionKind | Unified portfolio row | positions.* |
| StakePosition / stake requests | Product staking | staking.* |
| Farm / FarmPosition / farm requests | Liquidity mining | farming.* |
| ExecutionStatus | Shared status enum | Handle, settlement, steps |
| SettlementStatus | Async / multi-step progress | settlement.track |
Network-specific ledger IDs and aliases: Ledgers.
Identifiers
Nutrimatic uses stable string IDs. Pass them back into SDK calls as documented — you do not need raw contract addresses in user-facing layers.
ID formats
| ID | Pattern | Example |
|---|---|---|
LedgerId | {kind}:{chainRef} | evm:421018 |
InstrumentId | {ledgerId}:instrument:{symbol} | evm:421018:instrument:42 |
VenueId | {ledgerId}:amm:{protocol}:{address} | evm:421018:amm:v2:0xabc123 |
pairLabel
Human-readable pair string used by easy.read (e.g. 42-USDT). The SDK resolves it to venue and instrument IDs.
LedgerScope
type LedgerScope = LedgerId | string // ID or alias from config
Input only. Used in optional ledgers filters and similar method arguments — you may pass the ledger id or its alias. Responses always return the canonical LedgerId (never an alias). Resolution rules: Read operations — Filtering with ledgers. Supported networks: Ledgers.
Catalog entities
Metadata and discovery — stable descriptions of what exists on a ledger.
LedgerRef
A blockchain entry in SDK config. Declare the full shape once at init.
interface LedgerRef {
readonly id: LedgerId
readonly kind: 'evm' | 'bitcoin' | 'cosmos'
readonly chainId?: number | string
readonly alias?: string
}| Field | Type | Description |
|---|---|---|
id | LedgerId | Canonical ledger ID, e.g. evm:421018. Responses always echo this — never an alias. |
kind | 'evm' | 'bitcoin' | 'cosmos' | Network family. Determines how addresses and signing are interpreted for this ledger. |
chainId | number | string | Optional. Chain identifier for EVM and similar networks, e.g. 421018. Omit for ledger kinds that don’t use one. |
alias | string | Optional. Short name you can pass instead of id in method filters, e.g. infinite-mainnet. |
Example:
{
"id": "evm:421018",
"kind": "evm",
"chainId": 421018,
"alias": "infinite-mainnet"
}See also: Configuration — ledgers · Ledgers · catalog.listLedgers()
Instrument
A token or asset Nutrimatic tracks with a product identity — not a raw contract address in the UI layer.
interface Instrument {
readonly id: InstrumentId
readonly symbol: string
readonly ledgerId: LedgerId
readonly lineage?: string
readonly displayName?: string
readonly decimals?: number
readonly onChainAddress?: string
}| Field | Type | Description |
|---|---|---|
id | InstrumentId | Stable Nutrimatic instrument ID — use this in the UI layer instead of the raw contract address. |
symbol | string | Ticker shown to users, e.g. 42. |
ledgerId | LedgerId | Ledger this instrument lives on. |
lineage | string | Optional. Tag describing where the instrument comes from, e.g. native for a chain’s gas token. |
displayName | string | Optional. Human-readable name, when different from symbol. |
decimals | number | Optional. Decimal places used to convert raw on-chain amounts into display amounts. |
onChainAddress | string | Optional. On-chain token address for explorers. Omit for native gas assets. |
Example:
{
"id": "evm:421018:instrument:42",
"symbol": "42",
"ledgerId": "evm:421018",
"lineage": "native",
"displayName": "42",
"decimals": 18
}See also: catalog.listInstruments() · catalog.getInstrument() · Read operations
InstrumentProfile
Editorial presentation metadata for an instrument — separate from Instrument identity and from market telemetry. Commercial name lives on Instrument.displayName, not here.
interface InstrumentProfileLink {
readonly label: string
readonly url: string
}
interface InstrumentProfile {
readonly instrumentId: InstrumentId
readonly tagline?: string
readonly description?: string
readonly logoUrl?: string
readonly headerUrl?: string
readonly links?: readonly InstrumentProfileLink[]
readonly tags?: readonly string[]
readonly listedAt?: string
readonly updatedAt?: string
}| Field | Type | Description |
|---|---|---|
instrumentId | InstrumentId | Instrument this profile describes. |
tagline | string | Optional. One-line product blurb for headers. |
description | string | Optional. Longer copy for token detail pages. |
logoUrl | string | Optional. HTTPS URL to a logo image. |
headerUrl | string | Optional. Banner / header image URL. |
links | InstrumentProfileLink[] | Optional. Links with open label strings (convention: website, x, telegram, discord, docs, manifesto) and url. |
tags | string[] | Optional. Classification tags (kebab-case; e.g. stablecoin, native). |
listedAt | string | Optional. ISO time when the instrument was listed in the catalog. |
updatedAt | string | Optional. ISO timestamp of the last profile edit. |
Example:
{
"instrumentId": "evm:421018:instrument:42",
"tagline": "The native asset of Infinite.",
"description": "Native token of Infinite Mainnet.",
"logoUrl": "https://cdn.nutrimatic.xyz/instruments/42.png",
"links": [
{ "label": "website", "url": "https://example.com" },
{ "label": "x", "url": "https://x.com/example" }
],
"tags": ["native"],
"listedAt": "2026-01-01T00:00:00Z",
"updatedAt": "2026-07-01T00:00:00Z"
}See also: catalog.getInstrumentProfile() · Read operations
AmmVenueRef
An AMM venue — a pool available for quotes, charts, and live state.
interface VenueRef {
readonly id: VenueId
readonly ledgerId: LedgerId
readonly kind: 'amm'
}
interface AmmVenueRef extends VenueRef {
readonly protocol: 'v2' | 'v3' | 'v4'
readonly poolAddress?: string
}| Field | Type | Description |
|---|---|---|
id | VenueId | Stable Nutrimatic venue ID for this pool. |
ledgerId | LedgerId | Ledger the pool lives on. |
kind | 'amm' | Venue kind discriminator — always 'amm' for this type. |
protocol | 'v2' | 'v3' | 'v4' | Which AMM protocol version powers the pool. |
poolAddress | string | Optional. On-chain pool contract address, when Nutrimatic has resolved one. |
Example:
{
"id": "evm:421018:amm:v2:0xabc123",
"ledgerId": "evm:421018",
"kind": "amm",
"protocol": "v2",
"poolAddress": "0xabc123"
}See also: catalog.listVenues() · catalog.getVenue() · Read operations
DeploymentManifest
Contract deployment metadata for a ledger — packages, names, and addresses for read-only integration.
interface DeploymentManifest {
readonly ledger: LedgerRef
readonly version: string
readonly updatedAt?: string
readonly contracts: readonly {
package: string
contract: string
address: string
access?: string
}[]
}| Field | Type | Description |
|---|---|---|
ledger | LedgerRef | Ledger this deployment manifest describes. |
version | string | Manifest version string — bumps when the deployed contract set changes. |
updatedAt | string | Optional. ISO timestamp of the last manifest update. |
contracts | object[] | Deployed contracts for this ledger: package, contract name, on-chain address, and optional access level. |
Example:
{
"ledger": {
"id": "evm:421018",
"kind": "evm",
"chainId": 421018,
"alias": "infinite-mainnet"
},
"version": "1.0.0",
"updatedAt": "2026-07-01T00:00:00Z",
"contracts": [
{ "package": "dex", "contract": "Router", "address": "0xrouter", "access": "public" }
]
}See also: catalog.getDeployment() · Read operations
Market primitives
Building blocks reused inside views and live state.
Rate
A spot price between a base and quote instrument.
interface Rate {
readonly value: number | string
readonly baseInstrumentId: InstrumentId
readonly quoteInstrumentId: InstrumentId
readonly asOf?: number
}| Field | Type | Description |
|---|---|---|
value | number | string | Price of one unit of baseInstrumentId in terms of quoteInstrumentId, as a display value (not raw/smallest-unit). |
baseInstrumentId | InstrumentId | The instrument being priced. |
quoteInstrumentId | InstrumentId | The instrument the price is denominated in. |
asOf | number | Optional. Unix time in seconds this rate was observed. |
Example:
{
"value": 1.04,
"baseInstrumentId": "evm:421018:instrument:42",
"quoteInstrumentId": "evm:421018:instrument:usdt",
"asOf": 1719795600
}See also: AmmTelemetryView · AmmVenueState · venues.getSpotRate()
Percent
A percentage change — typically 24h delta.
interface Percent {
readonly value: number
}Example: { "value": 2.3 } — 2.3% change.
Quantity
An on-chain amount with decimals — used for pool reserves and other read views. Swap quote legs use display amounts instead — see QuoteLeg.
interface Quantity {
readonly raw: bigint | string
readonly decimals: number
}| Field | Type | Description |
|---|---|---|
raw | bigint | string | Integer amount in the token’s smallest on-chain unit (e.g. wei) — not a display value. |
decimals | number | Decimal places to divide raw by to get a display amount. |
Example:
{ "raw": "1000000000000000000", "decimals": 18 }CandleInterval
OHLCV bucket size. Smallest supported interval is 15 minutes (1m / 5m are not in the product).
type CandleInterval = '15m' | '1h' | '4h' | '1d' | '1w'Candle
One OHLCV bucket from Nutrimatic. time is the bucket start in Unix seconds.
interface Candle {
readonly time: number
readonly open: number
readonly high: number
readonly low: number
readonly close: number
}Example:
{
"time": 1719792000,
"open": 1.02,
"high": 1.05,
"low": 1.01,
"close": 1.04
}CandleQuery
Optional window controls on getChart and getCandles. Full guide for beginners: Chart windows.
type CandleReadScope = 'default' | 'partialOnly'
interface CandleQuery {
readonly limit?: number
readonly after?: number
readonly before?: number
readonly scope?: CandleReadScope
}| Field | Type | Description |
|---|---|---|
limit | number | Optional. Max closed candles to return (most recent within the window). Default 300 if omitted; responses cap at 1000. See Chart windows. |
after | number | Optional. Only candles newer than this Unix time in seconds (tail refresh). Pass lastClosedCandleTime(series.candles). |
before | number | Optional. Only candles older than this Unix time in seconds (scroll back). Use with limit; pass firstClosedCandleTime(series.candles). |
scope | 'default' | 'partialOnly' | Optional. 'partialOnly' = only the live open bar (candles is always []). See Chart windows — scope. |
Example request:
{
"limit": 300,
"after": 1719792000
}Views
Objects returned by read operations — ready for charts, tables, and tickers.
PairListing
One tradable pair row for market lists and selectors.
interface PairListing {
readonly pairLabel: string
readonly venueId: VenueId
readonly baseInstrumentId: InstrumentId
readonly quoteInstrumentId: InstrumentId
}| Field | Type | Description |
|---|---|---|
pairLabel | string | Display label for the market (e.g. 42-USDT). Use as-is in selectors; pass to getPair, getChart, or getTradeFeed. |
venueId | VenueId | Pool that prices and provides liquidity for this pair. Pass to getPoolView, getAmmView, or getAmmState. |
baseInstrumentId | InstrumentId | Base leg — the asset being priced (e.g. 42 in 42-USDT). |
quoteInstrumentId | InstrumentId | Quote leg — the pricing denominator (e.g. USDT in 42-USDT). |
Example:
{
"pairLabel": "42-USDT",
"venueId": "evm:421018:amm:v2:0xabc123",
"baseInstrumentId": "evm:421018:instrument:42",
"quoteInstrumentId": "evm:421018:instrument:usdt"
}See also: Read operations — listPairs · getPair
CandleSeries
OHLCV candle data for charts. Responses are display-ready — price axis and base/quote convention are normalized for UI.
candles holds closed buckets only (ascending by time). The in-progress bucket may appear separately as partialCandle. Window parameters: Chart windows.
interface CandleSeries {
readonly venueId: VenueId
readonly interval: CandleInterval
readonly priceAxisLabel: string
readonly candles: readonly Candle[]
readonly asOf?: number
readonly partialCandle?: Candle
}| Field | Type | Description |
|---|---|---|
venueId | VenueId | Pool the candles were built from. Keep the same when merging tail responses. |
interval | CandleInterval | Bucket size for each candle (e.g. '1h'). Must match across merges. |
priceAxisLabel | string | Ready-to-display label for the chart’s price axis (e.g. 42/USDT). |
candles | Candle[] | Closed OHLCV points, oldest → newest (time in Unix seconds). Draw the main chart from this array. |
asOf | number | Optional. Unix time in seconds when Nutrimatic built this snapshot. |
partialCandle | Candle | Optional. Current in-progress bucket — not listed in candles. Draw as the live rightmost bar. |
Example:
{
"venueId": "evm:421018:amm:v2:0xabc123",
"interval": "1h",
"priceAxisLabel": "42/USDT",
"asOf": 1719795600,
"candles": [
{ "time": 1719792000, "open": 1.02, "high": 1.05, "low": 1.01, "close": 1.04 }
],
"partialCandle": {
"time": 1719795600,
"open": 1.04,
"high": 1.06,
"low": 1.03,
"close": 1.05
}
}See also: Chart windows · Read operations — getChart · getCandles
InstrumentTelemetryView
Token-level snapshot: USD price, 24h change, optional market totals across listed venues, and optional supply when Nutrimatic offers it for that instrument.
interface InstrumentTelemetryView {
readonly instrumentId: InstrumentId
readonly priceUsd?: number
readonly change24h?: Percent
readonly market?: InstrumentMarketView
readonly supply?: InstrumentSupplyView
}| Field | Type | Description |
|---|---|---|
instrumentId | InstrumentId | Instrument this snapshot describes — resolved from your input. |
priceUsd | number | Optional. Latest price in USD when Nutrimatic can anchor the instrument via listed markets (directly against a USD stable, or through another listed instrument that already has a USD price). Omit when no usable USD anchor exists. Display as-is; re-fetch for updates. |
change24h | Percent | Optional. Percent change of this instrument’s USD price over ~24 hours (e.g. 2.3 means +2.3%). Positive is up, negative is down. Omit or zero when there is no usable then/now USD price. |
market | InstrumentMarketView | Optional. Volume and liquidity aggregated across listed venues for this instrument. |
supply | InstrumentSupplyView | Optional. Total supply, issuance, treasury/vesting, holders count, and derived figures when available. Omit when not offered for this instrument. |
Example (with market and supply):
{
"instrumentId": "evm:421018:instrument:42",
"priceUsd": 1.04,
"change24h": { "value": 2.3 },
"market": {
"volume24hUsd": 125000,
"liquidityUsd": 890000
},
"supply": {
"asOf": 1753072800,
"total": { "raw": "100451001124521553982862588", "decimals": 18 },
"issuance": {
"inflation": 0.1,
"annualProvisions": { "raw": "10045100112452155398286258", "decimals": 18 }
},
"holders": { "count": 176 },
"treasury": {
"address": "infinite10fhk6nsvuw4mhfdtv6zux754n8mz2z39ynqqf7",
"balance": { "raw": "100154418839999999999459207", "decimals": 18 },
"locked": { "raw": "98872808363384891700000000", "decimals": 18 },
"unlocked": { "raw": "1281610476615108299459207", "decimals": 18 },
"vesting": {
"kind": "continuous",
"startAt": 1769666400,
"endAt": 3095388000,
"durationSec": 1325721600,
"elapsedSec": 14947200,
"remainingSec": 1310774400,
"lockedPercent": 98.87,
"unlockedPercent": 1.13,
"original": { "raw": "100000000000000000000000000", "decimals": 18 }
}
},
"derived": {
"circulating": { "raw": "15781927611436622828862588", "decimals": 18 },
"mcapCirculating": 16413204.72,
"fdv": 104469041.17
}
}
}Example (market only — no supply block):
{
"instrumentId": "evm:421018:instrument:usdt",
"priceUsd": 1,
"change24h": { "value": 0 },
"market": {
"volume24hUsd": 98000,
"liquidityUsd": 1200000
}
}Nested shapes: InstrumentMarketView · InstrumentSupplyView
See also: Read operations — getTokenPrice · getInstrumentView
InstrumentMarketView
Aggregated stats across listed venues where the instrument is base or quote (not a single pool).
interface InstrumentMarketView {
readonly volume24hUsd?: number
readonly liquidityUsd?: number
}| Field | Type | Description |
|---|---|---|
volume24hUsd | number | Optional. Sum of 24h USD volume across those venues (each venue’s volume is counted once per instrument that is base or quote). |
liquidityUsd | number | Optional. Sum of half the USD TVL of each listed venue where this instrument is base or quote (so one pool is not double-counted when comparing legs). |
Example:
{
"volume24hUsd": 125000,
"liquidityUsd": 890000
}InstrumentSupplyView
Supply and related figures when Nutrimatic materializes them. Nested blocks are optional — use what is present.
interface InstrumentSupplyView {
readonly asOf: number
readonly total: Quantity
readonly issuance?: InstrumentIssuanceView
readonly holders?: { count: number }
readonly treasury?: InstrumentTreasuryView
readonly derived?: InstrumentSupplyDerivedView
}| Field | Type | Description |
|---|---|---|
asOf | number | Unix time in seconds when this supply snapshot was taken. |
total | Quantity | Total supply on-chain (raw + decimals). |
issuance | object | Optional. Inflation rate and annual provisions. |
holders | { count } | Optional. Count of addresses with non-zero balance — not a wallet list. |
treasury | InstrumentTreasuryView | Optional. Curated treasury / DAO balances and vesting schedule. |
derived | object | Optional. Circulating supply and market caps derived from policy + price. |
Issuance
| Field | Type | Description |
|---|---|---|
inflation | number | Optional. Annual inflation as a fraction (0.1 = 10%/year). |
annualProvisions | Quantity | Optional. Approximate new tokens per year. |
Derived
| Field | Type | Description |
|---|---|---|
circulating | Quantity | Circulating supply per product policy (e.g. total minus treasury locked). |
mcapCirculating | number | Optional. Circulating × priceUsd when price is available. |
fdv | number | Optional. Total supply × priceUsd when price is available. |
Example: see the full supply object under InstrumentTelemetryView.
InstrumentTreasuryView
Curated treasury account for an instrument — balances and optional vesting schedule.
interface InstrumentTreasuryView {
readonly address: string
readonly balance: Quantity
readonly locked: Quantity
readonly unlocked: Quantity
readonly vesting?: InstrumentVestingView
}| Field | Type | Description |
|---|---|---|
address | string | On-chain address of the curated treasury account. |
balance | Quantity | Total balance in that account. |
locked | Quantity | Amount still locked (e.g. unvested). |
unlocked | Quantity | Amount unlocked / spendable in that account. |
vesting | InstrumentVestingView | Optional. Schedule metadata (start/end, remaining time, percents). |
Vesting (InstrumentVestingView): times are Unix seconds. lockedPercent / unlockedPercent use original as the base when present.
| Field | Type | Description |
|---|---|---|
kind | string | Schedule kind (e.g. continuous). |
startAt / endAt | number | Vesting window start and end (Unix seconds). |
durationSec | number | Full schedule length in seconds. |
elapsedSec / remainingSec | number | Elapsed and remaining time at supply.asOf. |
lockedPercent / unlockedPercent | number | Share of original still locked / already unlocked. |
original | Quantity | Optional. Original vesting amount at schedule start. |
Example:
{
"address": "infinite10fhk6nsvuw4mhfdtv6zux754n8mz2z39ynqqf7",
"balance": { "raw": "100154418839999999999459207", "decimals": 18 },
"locked": { "raw": "98872808363384891700000000", "decimals": 18 },
"unlocked": { "raw": "1281610476615108299459207", "decimals": 18 },
"vesting": {
"kind": "continuous",
"startAt": 1769666400,
"endAt": 3095388000,
"durationSec": 1325721600,
"elapsedSec": 14947200,
"remainingSec": 1310774400,
"lockedPercent": 98.87,
"unlockedPercent": 1.13,
"original": { "raw": "100000000000000000000000000", "decimals": 18 }
}
}AmmTelemetryView
Pool-level summary — spot, change, TVL, and volume.
interface AmmTelemetryView {
readonly venueId: VenueId
readonly spot?: Rate
readonly change24h?: Percent
readonly tvlUsd?: number
readonly volume24hUsd?: number
}| Field | Type | Description |
|---|---|---|
venueId | VenueId | Pool this summary describes — echoes the venue you queried. |
spot | Rate | Optional. Current spot price (base in terms of quote). Display value as-is. |
change24h | Percent | Optional. Percent price change over the trailing 24 hours. Positive is up, negative is down. |
tvlUsd | number | Optional. Total value locked in the pool, in USD. |
volume24hUsd | number | Optional. Trading volume over the trailing 24 hours, in USD. |
Example:
{
"venueId": "evm:421018:amm:v2:0xabc123",
"spot": {
"value": 1.04,
"baseInstrumentId": "evm:421018:instrument:42",
"quoteInstrumentId": "evm:421018:instrument:usdt",
"asOf": 1719795600
},
"change24h": { "value": 0.8 },
"tvlUsd": 1250000,
"volume24hUsd": 84000
}See also: Read operations — getPoolView · getAmmView
AmmVenueState
Live on-chain pool state — reserves and spot. Complements telemetry views when you need raw pool data.
interface AmmVenueState {
readonly venueId: VenueId
readonly reserves: readonly Quantity[]
readonly spot: Rate
}| Field | Type | Description |
|---|---|---|
venueId | VenueId | Pool this state describes — echoes the venue you queried. |
reserves | Quantity[] | Current on-chain reserves for each pool leg, in raw (smallest-unit) integers. Convert with each Quantity.decimals before showing in the UI. |
spot | Rate | Spot price implied by the current reserves. Display value as-is; re-fetch for updates. |
Example:
{
"venueId": "evm:421018:amm:v2:0xabc123",
"reserves": [
{ "raw": "1000000000000000000", "decimals": 18 },
{ "raw": "1040000000", "decimals": 6 }
],
"spot": {
"value": 1.04,
"baseInstrumentId": "evm:421018:instrument:42",
"quoteInstrumentId": "evm:421018:instrument:usdt",
"asOf": 1719795600
}
}See also: Read operations — getAmmState
TradeView
One executed trade on a venue — a FeedEventRef with kind: 'trade'. Full feed patterns: Activity feeds.
interface TradeView {
readonly eventId: string
readonly time: number
readonly kind: 'trade'
readonly ledgerId: string
readonly txHash: string
readonly actor: string
readonly venueId: VenueId
readonly price: number
readonly baseAmount: number
readonly quoteAmount: number
readonly side: 'buy' | 'sell'
}| Field | Type | Description |
|---|---|---|
eventId | string | Opaque, stable event ID — use it for ordering and de-duplication; do not parse its contents. |
time | number | Unix time in seconds the trade occurred. |
kind | 'trade' | Event kind discriminator — always 'trade' for this view. |
ledgerId | string | Ledger the trade happened on. |
txHash | string | Transaction hash — build your own explorer URL; Nutrimatic does not return explorer links. |
actor | string | Flow-relevant address for this trade (Swap to) — not the router. |
venueId | VenueId | Pool where the trade executed. |
price | number | Execution price, as a display value in the pair’s quote instrument (quote per 1 base). |
baseAmount | number | Display amount of the pair base instrument moved. |
quoteAmount | number | Display amount of the pair quote instrument moved. |
side | 'buy' | 'sell' | Aggressor side — which direction initiated the trade. |
Example:
{
"eventId": "evm:421018:swap:0xabc…:12",
"time": 1719795600,
"kind": "trade",
"ledgerId": "evm:421018",
"txHash": "0xabc123def456",
"actor": "0xuser000000000000000000000000000000000001",
"venueId": "evm:421018:amm:v2:0xabc123",
"price": 1.04,
"baseAmount": 250,
"quoteAmount": 260,
"side": "buy"
}See also: Activity feeds · Read operations — getTrades
LiquidityEventView
Liquidity add or remove at a venue. Same feed window model as trades; kinds 'liquidity_add' and 'liquidity_remove'.
interface LiquidityEventView {
readonly eventId: string
readonly time: number
readonly kind: 'liquidity_add' | 'liquidity_remove'
readonly ledgerId: string
readonly txHash: string
readonly actor: string
readonly venueId: VenueId
readonly amount: number
readonly baseAmount: number
readonly quoteAmount: number
}| Field | Type | Description |
|---|---|---|
eventId | string | Opaque, stable event ID — use it for ordering and de-duplication; do not parse its contents. |
time | number | Unix time in seconds the event occurred. |
kind | 'liquidity_add' | 'liquidity_remove' | Whether liquidity was added to or removed from the pool. |
ledgerId | string | Ledger the event happened on. |
txHash | string | Transaction hash — build your own explorer URL; Nutrimatic does not return explorer links. |
actor | string | Flow-relevant address — mint: LP Transfer recipient; remove: Burn to. Not the router. |
venueId | VenueId | Pool the liquidity change affected. |
amount | number | LP-token amount as a display value (pool LP decimals) — not raw/smallest-unit. |
baseAmount | number | Display amount of the pair base instrument added or removed. |
quoteAmount | number | Display amount of the pair quote instrument added or removed. |
Example:
{
"eventId": "evm:421018:lp:0xdef…:3",
"time": 1719795550,
"kind": "liquidity_add",
"ledgerId": "evm:421018",
"txHash": "0xdef789abc012",
"actor": "0xuser000000000000000000000000000000000001",
"venueId": "evm:421018:amm:v2:0xabc123",
"amount": 1000,
"baseAmount": 50,
"quoteAmount": 52
}See also: Activity feeds — Liquidity events · getVenueFeed
FeedEventRef
Common fields on every discrete feed event. Total order: time ASC, eventId ASC.
type FeedEventKind =
| 'trade'
| 'liquidity_add'
| 'liquidity_remove'
interface FeedEventRef {
readonly eventId: string
readonly time: number
readonly kind: FeedEventKind
readonly ledgerId: string
readonly txHash: string
readonly actor: string
}| Field | Type | Description |
|---|---|---|
eventId | string | Opaque, stable event ID. |
time | number | Unix seconds. |
kind | FeedEventKind | Event kind. |
ledgerId | string | Ledger of the event. |
txHash | string | Transaction hash — compose explorer URLs in your app. |
actor | string | Flow-relevant address (not the router). See TradeView / LiquidityEventView. |
Example:
{
"eventId": "evt_trade_01",
"time": 1719795500,
"kind": "trade",
"ledgerId": "evm:421018",
"txHash": "0xabc123def456",
"actor": "0xuser000000000000000000000000000000000001"
}FeedCursor
Cursor for incremental feed windows. Use with after and before on FeedQuery.
interface FeedCursor {
readonly time: number
readonly eventId: string
}Example:
{
"time": 1719795500,
"eventId": "evt_trade_01"
}Obtain cursors from your feed with lastFeedCursor and firstFeedCursor.
FeedQuery
Optional window controls on getVenueFeed, getTrades, and getTradeFeed. Full guide: Activity feeds.
type FeedReadScope = 'default' | 'headOnly'
interface FeedQuery {
readonly limit?: number
readonly after?: FeedCursor
readonly before?: FeedCursor
readonly scope?: FeedReadScope
readonly kinds?: readonly FeedEventKind[]
}| Field | Type | Description |
|---|---|---|
limit | number | Optional. Max events to return (most recent within the window; the returned array is still ascending). Default 50 if omitted; responses cap at 200. See Activity feeds. |
after | FeedCursor | Optional. Only events newer than this cursor (tail refresh). Pass lastFeedCursor(feed.events). |
before | FeedCursor | Optional. Only events older than this cursor (scroll up). Use with limit; pass firstFeedCursor(feed.events). |
scope | 'default' | 'headOnly' | Optional. 'headOnly' = live edge only; events is always []. See Activity feeds — scope. |
kinds | FeedEventKind[] | Optional. Restrict to specific event kinds (e.g. ['trade']). Omit to get every kind the venue supports (method defaults may differ — see each read op). |
Example request:
{
"limit": 50,
"after": { "time": 1719795500, "eventId": "evt_trade_01" },
"kinds": ["trade"]
}FeedSeries
A page of feed events for one scope.
interface FeedSeries<T extends FeedEventRef = FeedEventRef> {
readonly scopeId: VenueId
readonly scopeKind: 'venue'
readonly events: readonly T[]
readonly asOf?: number
readonly ordering: 'asc'
}events holds discrete events only, ascending by total order (time, then eventId). Merge tail responses with mergeFeedSeries.
Example:
{
"scopeId": "evm:421018:amm:v2:0xabc123",
"scopeKind": "venue",
"ordering": "asc",
"asOf": 1719795600,
"events": [
{
"eventId": "evt_trade_01",
"time": 1719795500,
"kind": "trade",
"ledgerId": "evm:421018",
"txHash": "0xabc123def456",
"actor": "0xuser000000000000000000000000000000000001",
"venueId": "evm:421018:amm:v2:0xabc123",
"price": 2.48,
"baseAmount": 1.5,
"quoteAmount": 3.72,
"side": "sell"
}
]
}TradeFeed
Type alias for a trade-only feed:
type TradeFeed = FeedSeries<TradeView>Returned by getTrades and getTradeFeed.
VenueFeed
Type alias for a feed that may include multiple event kinds:
type VenueFeed = FeedSeries<TradeView | LiquidityEventView>Returned by getVenueFeed.
See also: Activity feeds · Chart windows (OHLCV — separate domain)
Execution
Types for writes. Full flows: Write operations · Swaps · Liquidity · Balances · Staking · Farming · Settlement.
WalletAdapter
interface WalletAdapter {
getAddress(): Promise<string>
getLedger(): Promise<LedgerId>
sign(request: SignRequest): Promise<SignedPayload>
}Bring-your-own signing — see Wallet adapter. getLedger() returns the canonical ledger ID, not an alias.
SignRequest
interface SignRequest {
readonly ledger: LedgerId
readonly kind: 'evm' | 'bitcoin' | 'cosmos' | string
readonly purpose:
| 'swap'
| 'liquidity_add'
| 'liquidity_remove'
| 'settlement'
| 'approve'
| 'stake'
| 'unstake'
| 'stake_claim'
| 'farm_deposit'
| 'farm_withdraw'
| 'farm_harvest'
| string
readonly payload: unknown
readonly expiresAt?: number
}Example: see Wallet adapter — SignRequest.
SignedPayload
interface SignedPayload {
readonly ledger: LedgerId
readonly kind: string
readonly payload: unknown
}Example: see Wallet adapter — SignedPayload.
QuoteRequest
Provide exactly one of pair or venue. intent / side cover the four swap-UI cases — Swaps — Choosing intent and side.
amount is always a display decimal string. slippageBps optional — default 50. deadline / times are Unix milliseconds.
interface QuoteRequest {
readonly pair?: string
readonly venue?: VenueId | string
readonly intent: 'buy' | 'sell'
readonly side: 'exactIn' | 'exactOut'
readonly amount: string
readonly ledgers?: readonly LedgerScope[]
readonly slippageBps?: number
readonly deadline?: number
}Example request (spend fixed USDT to buy 42):
{
"pair": "42-USDT",
"intent": "buy",
"side": "exactIn",
"amount": "100",
"ledgers": ["infinite-mainnet"],
"slippageBps": 50
}QuoteLeg
One side of a quoted trade. amountIn is what you spend; amountOut is what you receive (trade direction, not pair order).
amount is always a display decimal string for that instrument (human units already scaled by the instrument’s decimals). Nutrimatic handles on-chain raw conversion. If you need decimals for input masks or your own checks, read them from the instrument in the catalog — they are not repeated on the leg.
interface QuoteLeg {
readonly instrumentId: InstrumentId
readonly amount: string
}| Field | Type | Description |
|---|---|---|
instrumentId | InstrumentId | Which asset this leg is (canonical instrument ID). |
amount | string | How much of that asset, as a display decimal string (e.g. "1.5") — not raw/smallest-unit. |
Example:
{
"instrumentId": "evm:421018:instrument:42",
"amount": "1.5"
}QuoteCost
One cost line on a swap Quote.costs. Only swap quotes return a costs list before execute — Fees and costs.
type QuoteCostKind = 'gas' | 'trade' | 'bridge' | 'service'
interface QuoteCost {
readonly kind: QuoteCostKind
readonly amount: string
readonly instrumentId: InstrumentId
readonly estimated?: boolean
}Example:
{
"kind": "service",
"amount": "0.0001",
"instrumentId": "evm:421018:instrument:42"
}Quote
interface Quote {
readonly id: string
readonly pairLabel: string
readonly intent: 'buy' | 'sell'
readonly amountIn: QuoteLeg
readonly amountOut: QuoteLeg
readonly slippageBps: number
readonly expiresAt: number
readonly ledger: LedgerId
/** Always present on a successful swap quote (`gas`, `trade`, `service`; `bridge` when needed). */
readonly costs: readonly QuoteCost[]
readonly path?: Path
}Example: see Swaps — routing.quote.
SwapRequest
Provide exactly one of quoteId or request. Prefer quoteId after routing.quote. slippageBps optional — default the quote’s bound; if set, must be ≤ that bound.
interface SwapRequest {
readonly quoteId?: string
readonly request?: QuoteRequest
readonly slippageBps?: number
readonly deadline?: number
}Example request:
{
"quoteId": "quote_01HZX…"
}LiquidityAddRequest
Both amount0 and amount1 are required (balanced deposit). token0 = pair base, token1 = pair quote — Liquidity. slippageBps optional — default 50.
interface LiquidityAddRequest {
readonly venue: VenueId | string
readonly amount0: string
readonly amount1: string
readonly slippageBps?: number
readonly deadline?: number
readonly ledgers?: readonly LedgerScope[]
}Example request:
{
"venue": "evm:421018:amm:v2:0xabc123",
"amount0": "10",
"amount1": "25",
"slippageBps": 50
}LiquidityRemoveRequest
liquidity, amount0Min, and amount1Min are display decimal strings. slippageBps is optional — default 50 if omitted. Full field guide: Liquidity — liquidity.remove.
interface LiquidityRemoveRequest {
readonly venue: VenueId | string
readonly liquidity: string
readonly amount0Min?: string
readonly amount1Min?: string
readonly slippageBps?: number
readonly deadline?: number
readonly ledgers?: readonly LedgerScope[]
}Example request:
{
"venue": "evm:421018:amm:v2:0xabc123",
"liquidity": "1000",
"amount0Min": "9.5",
"amount1Min": "24",
"slippageBps": 50
}Balance
Instrument balance as a display decimal. Field guide: Balances.
interface Balance {
readonly instrumentId: InstrumentId
readonly amount: string
readonly owner: string
readonly ledger: LedgerId
}Example:
{
"instrumentId": "evm:421018:instrument:42",
"amount": "12.5",
"owner": "0xabc…",
"ledger": "evm:421018"
}Allowance
interface Allowance {
readonly instrumentId: InstrumentId
readonly owner: string
readonly spender: string
readonly amount: string
readonly ledger: LedgerId
}Example:
{
"instrumentId": "evm:421018:instrument:42",
"owner": "0xabc…",
"spender": "0xspender…",
"amount": "100",
"ledger": "evm:421018"
}ApproveRequest
interface ApproveRequest {
readonly instrumentId: InstrumentId
readonly spender: string
readonly amount: string
readonly deadline?: number
}Example request:
{
"instrumentId": "evm:421018:instrument:42",
"spender": "0xspender…",
"amount": "100"
}PositionKind
type PositionKind = 'lp' | 'stake' | 'farm'Product DeFi only — not native chain / consensus stake. See Positions.
Position
interface Position {
readonly id: PositionId
readonly kind: PositionKind
readonly ledger: LedgerId
readonly instrumentId?: InstrumentId
readonly venueId?: VenueId
readonly farmId?: FarmId
readonly amount: string
readonly claimableReward?: {
readonly instrumentId: InstrumentId
readonly amount: string
}
readonly owner: string
}Example:
{
"id": "pos_stake_01…",
"kind": "stake",
"ledger": "evm:421018",
"owner": "0xabc…",
"amount": "250",
"instrumentId": "evm:421018:instrument:42",
"claimableReward": {
"instrumentId": "evm:421018:instrument:42",
"amount": "1.25"
}
}StakePosition
Product-token stake row. Ops: Staking.
interface StakePosition {
readonly id: PositionId
readonly instrumentId: InstrumentId
readonly ledger: LedgerId
readonly owner: string
readonly amount: string
readonly claimableReward?: {
readonly instrumentId: InstrumentId
readonly amount: string
}
}Example:
{
"id": "pos_stake_01…",
"instrumentId": "evm:421018:instrument:42",
"ledger": "evm:421018",
"owner": "0xabc…",
"amount": "250",
"claimableReward": {
"instrumentId": "evm:421018:instrument:42",
"amount": "1.25"
}
}StakeRequest / UnstakeRequest / StakeClaimRequest
interface StakeRequest {
readonly instrumentId: InstrumentId
readonly amount: string
readonly deadline?: number
readonly ledgers?: readonly LedgerScope[]
}
interface UnstakeRequest {
readonly instrumentId: InstrumentId
readonly amount: string
readonly deadline?: number
readonly ledgers?: readonly LedgerScope[]
}
interface StakeClaimRequest {
readonly instrumentId: InstrumentId
readonly deadline?: number
readonly ledgers?: readonly LedgerScope[]
}Example request (StakeRequest):
{
"instrumentId": "evm:421018:instrument:42",
"amount": "100"
}Farm
interface Farm {
readonly id: FarmId
readonly ledger: LedgerId
readonly stakeInstrumentId: InstrumentId
readonly rewardInstrumentId: InstrumentId
readonly venueId?: VenueId
}Example:
{
"id": "farm_01H…",
"ledger": "evm:421018",
"stakeInstrumentId": "evm:421018:instrument:lp-42-usdt",
"rewardInstrumentId": "evm:421018:instrument:42",
"venueId": "evm:421018:amm:v2:0xabc123"
}FarmPosition
interface FarmPosition {
readonly id: PositionId
readonly farmId: FarmId
readonly ledger: LedgerId
readonly owner: string
readonly amount: string
readonly claimableReward?: {
readonly instrumentId: InstrumentId
readonly amount: string
}
}Example:
{
"id": "pos_farm_01…",
"farmId": "farm_01H…",
"ledger": "evm:421018",
"owner": "0xabc…",
"amount": "10",
"claimableReward": {
"instrumentId": "evm:421018:instrument:42",
"amount": "0.4"
}
}FarmDepositRequest / FarmWithdrawRequest / FarmHarvestRequest
Ops: Farming.
interface FarmDepositRequest {
readonly farmId: FarmId
readonly amount: string
readonly deadline?: number
}
interface FarmWithdrawRequest {
readonly farmId: FarmId
readonly amount: string
readonly deadline?: number
}
interface FarmHarvestRequest {
readonly farmId: FarmId
readonly deadline?: number
}Example request (FarmDepositRequest):
{
"farmId": "farm_01H…",
"amount": "10"
}ExecutionStatus
Closed status vocabulary for ExecutionHandle, SettlementStatus, and each settlement step. Full guide: Settlement — Status vocabulary.
type ExecutionStatus =
| 'pending'
| 'submitted'
| 'in_progress'
| 'confirmed'
| 'failed'| Status | Terminal |
|---|---|
pending, submitted, in_progress | No — keep polling when tracking |
confirmed, failed | Yes — stop polling |
ExecutionHandle
Returned by easy.swap and liquidity.*. Use id with settlement.track while status is still running. Field meanings: Swaps — easy.swap.
interface ExecutionReceipt {
readonly txRef?: string
readonly raw?: unknown
}
interface ExecutionHandle {
readonly id: string
readonly status: ExecutionStatus
readonly ledger: LedgerId
readonly txRef?: string
readonly receipt?: ExecutionReceipt
}Example:
{
"id": "exec_01HZY…",
"status": "confirmed",
"ledger": "evm:421018",
"txRef": "0xabc…",
"receipt": { "txRef": "0xabc…" }
}Path
Ordered plan when a quote or execution is more than one hop. Field meanings and integrator rules: Settlement — Path.
interface PathStep {
readonly instrumentId: InstrumentId
readonly venueId?: VenueId
readonly ledger?: LedgerId
}
interface Path {
readonly steps: readonly PathStep[]
}Example: see Settlement — Path.
SettlementStatus
Progress after settlement.track. Same status vocabulary as the handle. Field meanings: Settlement — settlement.track.
interface SettlementStepStatus {
readonly index: number
readonly status: ExecutionStatus
readonly ledger?: LedgerId
readonly txRef?: string
}
interface SettlementStatus {
readonly id: string
readonly status: ExecutionStatus
readonly path?: Path
readonly steps?: readonly SettlementStepStatus[]
readonly updatedAt?: number
}Example: see Settlement — settlement.track.
Errors
NutrimaticError
Thrown by the SDK when a call cannot complete. Branch on code — full list: Errors.
class NutrimaticError extends Error {
readonly name: 'NutrimaticError'
readonly code: NutrimaticErrorCode
readonly message: string
}Example:
{
"name": "NutrimaticError",
"code": "PAIR_NOT_FOUND",
"message": "Pair not found: 42-USDT"
}NutrimaticErrorCode
Stable string union used as NutrimaticError.code. See Errors — Common codes for meanings. Do not branch on MODULE_NOT_IMPLEMENTED.
Config types
Types you pass when creating the SDK — not returned by read operations.
type IntegrationContext = 'client' | 'backend'
interface NutrimaticSdkConfig {
readonly apiBaseUrl?: string
readonly ledgers: readonly LedgerRef[]
readonly mode: 'read' | 'full'
readonly integrationContext: IntegrationContext
readonly wallet?: WalletAdapter
}| Field | Role |
|---|---|
apiBaseUrl | Optional HTTPS host — default canonical Telemetry; override for test or your own Telemetry — Configuration |
ledgers | Required LedgerRef[] — validated at init |
mode | 'read' | 'full' — Modes |
integrationContext | 'client' | 'backend' |
wallet | Optional WalletAdapter — writes + default owner when omitted |
Full field docs: Configuration.
Related
| Goal | Start here |
|---|---|
| Fetch market views | Read operations |
| Charts / activity composition | Chart windows · Activity feeds |
| Quotes, swaps, LP, settlement | Write operations |
| Balances, positions, stake, farm | Balances · Positions · Staking · Farming |
| Cost breakdown on a swap quote | Fees and costs |
| BYO signing | Wallet adapter |
| Ledgers and IDs | Ledgers |
| Failure codes | Errors |