Skip to content

Models & Pointers

Igor Sazonov edited this page Jul 14, 2026 · 1 revision

This page documents the shared types, constants, and pointer helpers used across all services.

Pointer Helpers

Optional request fields are represented as pointers so that zero values (false, 0, "") are never silently sent to the API. To avoid the boilerplate of taking the address of a literal, the package provides four helper functions:

Function Signature
StringPtr func StringPtr(s string) *string
IntPtr func IntPtr(i int) *int
BoolPtr func BoolPtr(b bool) *bool
Float64Ptr func Float64Ptr(f float64) *float64

Example:

req := &nansen.TokenScreenerRequest{
    Chains: []nansen.Chain{nansen.ChainSolana},
    Filters: &nansen.TokenScreenerFilters{
        IncludeStablecoins: nansen.BoolPtr(false),
        MarketCapUSD: &nansen.NumericRangeFilter{
            Min: nansen.Float64Ptr(1_000_000),
            Max: nansen.Float64Ptr(50_000_000),
        },
    },
}

Supported Chains

The Chain type is a typed string constant. All supported blockchains are listed below:

Constant Value
ChainAll "all"
ChainArbitrum "arbitrum"
ChainAvalanche "avalanche"
ChainBase "base"
ChainBitcoin "bitcoin"
ChainBNB "bnb"
ChainCitrea "citrea"
ChainEthereum "ethereum"
ChainHyperEVM "hyperevm"
ChainHyperliquid "hyperliquid"
ChainInjective "injective"
ChainIotaEVM "iotaevm"
ChainLinea "linea"
ChainMantle "mantle"
ChainMantra "mantra"
ChainMonad "monad"
ChainNear "near"
ChainOptimism "optimism"
ChainPlasma "plasma"
ChainPolygon "polygon"
ChainRonin "ronin"
ChainScroll "scroll"
ChainSei "sei"
ChainSolana "solana"
ChainSonic "sonic"
ChainStarknet "starknet"
ChainSui "sui"
ChainTon "ton"
ChainTron "tron"

Smart Money Labels

The SmartMoneyLabel type is used to include or exclude specific smart money cohorts in requests.

Constant Value
LabelFund "Fund"
LabelSmartTrader "Smart Trader"
Label30DSmartTrader "30D Smart Trader"
Label90DSmartTrader "90D Smart Trader"
Label180DSmartTrader "180D Smart Trader"
LabelSmartHLPerpsTrader "Smart HL Perps Trader"

Trader Types

The TraderType type filters the cohort of traders for the token screener.

Constant Value
TraderAll "all"
TraderSmartMoney "sm"
TraderWhale "whale"
TraderPublicFigure "public_figure"
TraderTrending "trending"
TraderConsistentPerpsWinner "consistent_perps_winner"
TraderHighWinrateHLPerps "high_winrate_hl_perps_trader"
TraderPredictedWinner "predicted_winner"

Sorting

All paginated endpoints accept an OrderBy []SortOrder field. SortOrder is a struct with a Field string and a Direction:

Constant Value
SortAsc "ASC"
SortDesc "DESC"

Example:

OrderBy: []nansen.SortOrder{
    {Field: string(nansen.ScreenerSortVolume), Direction: nansen.SortDesc},
},

Pagination

All paginated requests accept a *PaginationRequest:

Pagination: &nansen.PaginationRequest{
    Page:    nansen.IntPtr(1),
    PerPage: nansen.IntPtr(20),
},

Paginated responses include a PaginationInfo struct:

type PaginationInfo struct {
    Page       int  `json:"page"`
    PerPage    int  `json:"per_page"`
    IsLastPage bool `json:"is_last_page"`
}

Range Filters

Two range filter types are available for numeric filtering:

NumericRangeFilter — for float64 values:

type NumericRangeFilter struct {
    Min *float64 `json:"min,omitempty"`
    Max *float64 `json:"max,omitempty"`
}

IntegerRangeFilter — for int values:

type IntegerRangeFilter struct {
    Min *int `json:"min,omitempty"`
    Max *int `json:"max,omitempty"`
}

Date Range

DateRange accepts ISO-8601 formatted strings:

type DateRange struct {
    From string `json:"from"`
    To   string `json:"to"`
}

Example:

Date: nansen.DateRange{
    From: "2023-01-01T00:00:00Z",
    To:   "2023-01-07T00:00:00Z",
},

Clone this wiki locally