@fipulse/fipulse-sdk
v0.1.0
Published
HTTP client for Fipulse Edge APIs (/v1/tokens, /v1/ohlc, addresses, transfers)
Downloads
40
Readme
@fipulse/fipulse-sdk
Typed HTTP client for fipulse-edge chart and address APIs:
GET /v1/tokens— paginated token list (Postgres / Hyperdrive)GET /v1/ohlc— OHLCV candles from Timescale (1m,5m,30m,3h,1d)- Public addresses, FT balances, FT/NFT transfers — see
FipulseClientin the source
Install
npm install @fipulse/fipulse-sdkFor a sibling clone during development (example: Fipulse/fipulse-pages-react next to this repo):
"dependencies": {
"@fipulse/fipulse-sdk": "file:../fipulse-sdk"
}Run npm run build in this repo (or npm install in the consumer, which will run prepack when the package is packed) so dist/ exists.
Usage
import { createFipulseClient, ohlcToNumeric } from '@fipulse/fipulse-sdk';
const client = createFipulseClient({
baseUrl: 'https://your-worker.example.com', // or http://localhost:8787
});
const { tokens, nextCursor } = await client.listTokens({
chainId: 1,
limit: 20,
q: '0xa0b8',
});
const ohlc = await client.getOhlc({
chainId: 1,
token: '0x0000000000000000000000000000000000000000',
interval: '1d',
// endTs: optional unix seconds — latest page of candles with bucket ≤ endTs
// debug: true — adds debug=1 (server logs SQL / row counts)
});
for (const c of ohlc.candles) {
const n = ohlcToNumeric(c);
// feed n into your chart library (e.g. lightweight-charts)
}Errors
Non-2xx responses throw FipulseHttpError with status and body (text). 503 often means the worker’s database bindings are not configured.
Live 1m candles
The Edge worker also exposes GET /v1/ws?chainId=&tokenAddr=&interval=1m for unclosed 1m candle updates; that is WebSocket-based and not wrapped by this SDK.
License
Add a LICENSE file in this repository to match your project policy.
