Before you start
You need:- Node.js with built-in
fetch - an invited wallet
- an
ss_...API token stored outside source control - exact-integer handling for token amounts and field identifiers
1. Create an API client
2. Discover tokens and pools
data is empty or pagination shows that all rows have been returned. Keep the exact pool key, token IDs, fee, and scale values.
3. Load the data your strategy uses
Do not fetch every endpoint for every pool. Request only the resources needed by the strategy:GET /pools/{key}for public pool metadataGET /pools/{key}/statsfor current indexed statisticsGET /pools/{key}/tradesfor trade historyGET /pools/{key}/ohlcvfor candlesGET /swapsfor indexed swap history
number.
4. Request a route
5. Refresh state safely
Use request timeouts, bounded exponential backoff, jitter, and a maximum retry count.
If the bot uses a browser wallet session, it can request a short-lived WebSocket ticket and follow the WebSocket feed. After any disconnect, reload REST state before acting on new events.
Transaction boundary
The API supplies indexed data, routes, and current input schemas. Your wallet or proving client still owns:- token-record selection and reservation
- transaction construction and signing
- proof generation and submission
- swap-output claim handling
- accepted, rejected, and unknown transaction states
- final public-state and record reconciliation