Skip to main content
This page is for the public REST API. For direct contract calls, use the Protocol Examples page.

Protocol Contract Examples

V5 Ethers, Viem, Web3.js, and Python Web3.py examples for estimates, buys, sells, borrowing, borrowMore, and repayment.

Contract Reference

V5 addresses and readable ABI string arrays.

Public API Reference

Endpoint overview for token lists, token details, config, trades, candles, portfolio, and user data.

Base URL

All examples assume this response shape:
When success is false, inspect error.

Fetch latest tokens

Fetch top volume, active, or gainers

Search tokens

Search matches token name, symbol, or token address.

Fetch only verified tokens

Each token includes is_verified when the backend joins the token with the verified-token table.

Fetch a token detail

The pool_id field is important for V5. Use it for Hook reads and estimates. If it is missing in an external integration, resolve it with hook.tokenToPoolId(tokenAddress).

Fetch a token and its trades

Trades can include:

Fetch candles

Common intervals used by the site:

Refresh token data after a trade

The app triggers a backend sync after a wallet action, then fetches the token, trades, and candles again.

Fetch protocol contract config

This route returns human-readable ABI string arrays.

Fetch JSON ABI config

Use this only when your tool requires canonical JSON ABI objects.

Fetch native BNB price

Fetch creator tokens

Fetch portfolio holdings

The portfolio endpoint reads current token balances and combines them with trade history to calculate holding stats.

Fetch portfolio borrow positions

Fetch user token and BNB balances

Fetch user borrow data for a token

Fetch token roles for a wallet

Fetch owner data

API + contract example: quote from API token data

This is useful for bots and dashboards that use the API for discovery, then use contracts for exact quote data.

Defensive fetch helper