Skip to main content

Try it now in Val Town

Interactive playground to test Nansen API calls
Click “Remix” to fork the playground, add your PAYER_KEYPAIR as an environment secret, and run live API calls.

Setup

Set up your payment handler in just 3 lines:
import { payer } from "@faremeter/rides";

const { PAYER_KEYPAIR } = process.env;
if (!PAYER_KEYPAIR) throw new Error("PAYER_KEYPAIR must be set");

await payer.addLocalWallet(PAYER_KEYPAIR);
@faremeter/rides automatically detects your network, looks up USDC, and sets up payments using your existing wallet. All examples below use payer.fetch().

Example: Smart Money Net Flow

Query net flow data for smart money across multiple chains:
const url = "https://nansen.api.corbits.dev/api/v1/smart-money/netflow";

const payload = {
  chains: [
    "ethereum",
    "solana"
  ],
  filters: {
    exclude_smart_money_labels: [
      "30D Smart Trader"
    ],
    include_native_tokens: false,
    include_smart_money_labels: [
      "Fund",
      "Smart Trader"
    ],
    include_stablecoins: false
  },
  pagination: {
    page: 1,
    per_page: 10
  },
  order_by: [
    {
      field: "chain",
      direction: "ASC"
    }
  ]
};

const response = await payer.fetch(url, {
  method: "POST",
  headers: {
    Accept: "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify(payload),
});

if (!response.ok) {
  const text = await response.text().catch(() => "");
  throw new Error(`HTTP ${response.status} ${response.statusText} ${text}`);
}

const data = await response.json();
console.log("Smart Money Net Flow:", JSON.stringify(data, null, 2));
Request Body Structure:
{
  "chains": ["ethereum", "solana"],
  "filters": {
    "exclude_smart_money_labels": ["30D Smart Trader"],
    "include_native_tokens": false,
    "include_smart_money_labels": ["Fund", "Smart Trader"],
    "include_stablecoins": false
  },
  "pagination": {
    "page": 1,
    "per_page": 10
  },
  "order_by": [
    {
      "field": "chain",
      "direction": "ASC"
    }
  ]
}
Response:
{
  "data": [
    {
      "token_address": "0x292fcdd1b104de5a00250febba9bc6a5092a0076",
      "token_symbol": "HASHAI",
      "net_flow_24h_usd": 0,
      "net_flow_7d_usd": 0,
      "net_flow_30d_usd": -664.0769939241275,
      "chain": "ethereum",
      "token_sectors": [
        "Artificial Intelligence"
      ],
      "trader_count": 1,
      "token_age_days": 546,
      "market_cap_usd": 25066236
    },
    {
      "token_address": "0x02e7f808990638e9e67e1f00313037ede2362361",
      "token_symbol": "KIBSHI",
      "net_flow_24h_usd": -1138.9147379448946,
      "net_flow_7d_usd": -1138.9147379448946,
      "net_flow_30d_usd": -5756.819664832803,
      "chain": "ethereum",
      "token_sectors": [
        "Memecoins",
        "AI Meme"
      ],
      "trader_count": 3,
      "token_age_days": 1027,
      "market_cap_usd": 7866435
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 10,
    "is_last_page": false
  }
}

Available Filters

Smart Money Labels

Common labels you can include/exclude:
  • "Fund" - Institutional investors
  • "Smart Trader" - Successful traders
  • "30D Smart Trader" - Recently active traders
  • And more…

Filter Options

  • include_smart_money_labels - Only show these labels
  • exclude_smart_money_labels - Hide these labels
  • include_native_tokens - Include native chain tokens (ETH, SOL)
  • include_stablecoins - Include stablecoin data

Pagination

Control response size:
{
  "pagination": {
    "page": 1,
    "per_page": 10
  }
}

Sorting

Order results by field:
{
  "order_by": [
    {
      "field": "chain",
      "direction": "ASC"
    }
  ]
}

Payment Flow

When you make a request:
  1. Initial Request: Client sends API request
  2. 402 Response: Proxy returns payment requirements
{
  "accepts": [{
    "network": "solana-mainnet-beta",
    "maxAmountRequired": 1000,
    "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "payTo": "corzHctjX9Wtcrkfxz3Se8zdXqJYCaamWcQA7vwKF7Q"
  }]
}
  1. Payment: Payment handler transfers 0.001 USDC on Solana
  2. Success: Proxy forwards request to Nansen with API key
All handled automatically by payer.fetch() or fetchWithPayer!

External Resources