@tickwise/sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -12
- package/dist/cjs/client.d.ts +10 -10
- package/dist/cjs/client.js +6 -1
- package/dist/cjs/errors.d.ts +56 -8
- package/dist/cjs/errors.js +65 -4
- package/dist/cjs/generated/openapi.d.ts +129 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/resources/hooks.d.ts +2 -2
- package/dist/cjs/resources/pools.d.ts +7 -7
- package/dist/cjs/resources/positions.d.ts +27 -13
- package/dist/cjs/resources/positions.js +66 -12
- package/dist/cjs/resources/tokens.d.ts +9 -3
- package/dist/cjs/resources/tokens.js +8 -0
- package/dist/cjs/routes.d.ts +4 -0
- package/dist/cjs/routes.js +5 -0
- package/dist/cjs/transport.d.ts +8 -7
- package/dist/cjs/transport.js +8 -4
- package/dist/cjs/types.d.ts +26 -13
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client.d.ts +10 -10
- package/dist/esm/client.js +6 -1
- package/dist/esm/errors.d.ts +56 -8
- package/dist/esm/errors.js +61 -3
- package/dist/esm/generated/openapi.d.ts +129 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/resources/hooks.d.ts +2 -2
- package/dist/esm/resources/pools.d.ts +7 -7
- package/dist/esm/resources/positions.d.ts +27 -13
- package/dist/esm/resources/positions.js +66 -12
- package/dist/esm/resources/tokens.d.ts +9 -3
- package/dist/esm/resources/tokens.js +8 -0
- package/dist/esm/routes.d.ts +4 -0
- package/dist/esm/routes.js +5 -0
- package/dist/esm/transport.d.ts +8 -7
- package/dist/esm/transport.js +8 -4
- package/dist/esm/types.d.ts +26 -13
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The typed TypeScript client for the [Tickwise API](https://tickwise.xyz/docs). It indexes Uniswap v4 positions, pools, tokens, wallets and hooks across chains.
|
|
4
4
|
|
|
5
|
-
- One method for each of the
|
|
5
|
+
- One method for each of the 17 `/v1` routes. Request and response types are generated from the API's OpenAPI description.
|
|
6
6
|
- Paging iterators, a batch helper for any number of ids, and CSV export.
|
|
7
7
|
- Retries for the failures that cannot have been charged, honouring `Retry-After`. Typed errors you can tell apart.
|
|
8
8
|
- No dependencies. Runs on Node 20.3 or later, Bun, Deno and edge runtimes (anything with `fetch`). ESM and CommonJS.
|
|
@@ -58,6 +58,7 @@ export async function GET() {
|
|
|
58
58
|
| `pools.get(chainId, protocol, poolId, query?)` | `GET /v1/pools/{chainId}/{protocol}/{poolId}` |
|
|
59
59
|
| `pools.charts(chainId, protocol, poolId, query?)` | `GET …/charts` |
|
|
60
60
|
| `tokens.get(chainId, address, query?)` | `GET /v1/tokens/{chainId}/{address}` |
|
|
61
|
+
| `tokens.search({ q, chainId?, limit? })` | `GET /v1/tokens/search` |
|
|
61
62
|
| `wallets.summary(address, query?)` | `GET /v1/wallets/{address}` |
|
|
62
63
|
| `hooks.list(query?)` | `GET /v1/hooks` |
|
|
63
64
|
| `chains()`, `protocols()`, `plans()`, `stats()` | the free metadata routes |
|
|
@@ -67,8 +68,10 @@ Path parameters come first, in URL order. Then comes one object with the route's
|
|
|
67
68
|
|
|
68
69
|
- `chainId` is any number. `tw.chains()` lists the chains served right now.
|
|
69
70
|
- `fields` takes an array or a comma-separated string.
|
|
70
|
-
- With `fields` or `view: 'compact'`, the rows are typed as partial, because the API sends only what you asked for.
|
|
71
|
+
- With `fields` or `view: 'compact'`, the rows are typed as partial, because the API sends only what you asked for. They are also typed as partial when that is only known at run time: a `fields` that may be `undefined`, a `view` typed `'compact' | 'full'`, or a whole `PositionsListQuery` passed through a function of yours. A query with no `fields` and no `view`, or with `view: 'full'`, gets full rows.
|
|
72
|
+
- A position id is a string, a `bigint` or a `number`. A `number` above 2^53 − 1 has already lost digits, so it is a `TypeError`: pass large ids as strings or bigints.
|
|
71
73
|
- Every route except the five free ones is metered in units. `tw.pricing.units()` returns the current prices; this package never hard-codes them.
|
|
74
|
+
- Every position a wallet holds, open and closed: `tw.positions.iterate({ owner, status: 'all', minValueUsd: 0, minPoolTvl: 0, includeRisky: true, sort: 'underlying_value' })`. Keep the `sort`: the default sort ranks by rate, and a rate sort leaves closed positions out. `tw.wallets.summary(owner)` gives the totals of the same rows.
|
|
72
75
|
|
|
73
76
|
## Paging
|
|
74
77
|
|
|
@@ -81,14 +84,16 @@ for await (const pool of tw.pools.iterate({ chainId: 1, limit: 100 }, { maxPages
|
|
|
81
84
|
// Whole pages
|
|
82
85
|
for await (const page of tw.hooks.pages({ limit: 100 })) console.log(page.pagination.page, page.hooks.length);
|
|
83
86
|
|
|
84
|
-
// A position's transactions, following the cursor
|
|
87
|
+
// A position's transactions, newest first, following the cursor
|
|
85
88
|
for await (const tx of tw.positions.iterateTransactions(1, 'uniswap-v4', '123456')) console.log(tx.type);
|
|
86
89
|
```
|
|
87
90
|
|
|
91
|
+
`positions.transactions` returns one page as the API sends it: pages run from newest to oldest, and the rows inside a page are oldest to newest. `iterateTransactions` yields every row newest first. When its last page says the API's list is not the position's whole history (`transactionsPartial`: only the newest were ready, ask again in a few seconds; `transactionsTruncated`: the history is longer than the API reads; `transactionsDegraded`), it throws `TransactionsIncompleteError` after yielding every row it got. `reasons` names the flags.
|
|
92
|
+
|
|
88
93
|
- `iterate` and `pages` exist on positions, pools and hooks. `tokens.iteratePools` pages through a token's pools.
|
|
89
94
|
- Hooks across all chains stop 1,000 rows deep (`HOOKS_ALL_CHAINS_MAX_ROWS`), the most the API serves without a `chainId`. Pass `chainId` to page one chain further.
|
|
90
|
-
- **Every page is a metered request.** `break` stops the spending; `maxPages` and `maxItems` set a hard stop.
|
|
91
|
-
- `positions.batchAll` takes any number of ids and sends calls of 100 one after another. The batch is priced per position returned, so it costs the same as the separate calls.
|
|
95
|
+
- **Every page is a metered request.** `break` stops the spending; `maxPages` and `maxItems` set a hard stop. `exportCsvPages` takes `maxPages` only, because a CSV page is counted whole.
|
|
96
|
+
- `positions.batchAll` takes any number of ids and sends calls of 100 one after another. The batch is priced per position returned, so it costs the same as the separate calls. If a call fails after earlier ones were served (and charged), it throws `BatchAllIncompleteError`: the served rows are in `data`, the ids still to fetch in `remainingIds`, and the call's own error in `cause`. Pass `remainingIds` to `batchAll` again to finish without paying twice.
|
|
92
97
|
|
|
93
98
|
## CSV export
|
|
94
99
|
|
|
@@ -111,11 +116,20 @@ for await (const page of tw.pools.exportCsvPages({ chainId: 1, limit: 100 }, { m
|
|
|
111
116
|
await writeFile('pools.csv', parts.join(''));
|
|
112
117
|
```
|
|
113
118
|
|
|
114
|
-
The SDK does not parse CSV. Excel rounds big integers such as `liquidity` unless that column is imported as Text.
|
|
119
|
+
The SDK does not parse CSV. A cell that holds a list joins its items with `|`. Excel rounds big integers such as `liquidity` unless that column is imported as Text.
|
|
115
120
|
|
|
116
121
|
## Errors
|
|
117
122
|
|
|
118
|
-
Every error is a `TickwiseError`. Each has a stable `kind`, the `status`, the parsed `body`, the `headers` and, on a 429 or 503, `retryAfterSec`. Branch on the class or on `kind`, never on the message.
|
|
123
|
+
Every error from the API or the network is a `TickwiseError`. Each has a stable `kind`, the `status`, the parsed `body`, the `headers` and, on a 429 or 503, `retryAfterSec`. Branch on the class or on `kind`, never on the message.
|
|
124
|
+
|
|
125
|
+
Two kinds of error are not a `TickwiseError`:
|
|
126
|
+
|
|
127
|
+
- A call you cancel with `signal` rejects with the signal's reason, as `fetch` does (an `AbortError` `DOMException` unless you passed your own reason). The one exception is `batchAll` after a served chunk: the abort is the `cause` of a `BatchAllIncompleteError`.
|
|
128
|
+
- A bad argument, such as a malformed option, a `baseUrl` that ends in `/v1` or a `number` id past 2^53, throws a `TypeError` (or rejects with one) before any request is sent.
|
|
129
|
+
|
|
130
|
+
On a `QuotaExceededError`, `retryAfterSec` is the time until the quota resets (00:00 UTC on the 1st of the month), so it can be weeks. A `ConnectionError` keeps the network error (for example `ECONNREFUSED`) in `cause`.
|
|
131
|
+
|
|
132
|
+
The ESM and CommonJS builds each have their own error classes. If one program loads the package both ways, `instanceof` across the two fails; compare `kind` there instead.
|
|
119
133
|
|
|
120
134
|
| Class | Status | Retried |
|
|
121
135
|
| --- | --- | --- |
|
|
@@ -126,9 +140,11 @@ Every error is a `TickwiseError`. Each has a stable `kind`, the `status`, the pa
|
|
|
126
140
|
| `RateLimitError` (a `TooManyRequestsError`) | 429, the 60-second burst limit | yes |
|
|
127
141
|
| `QuotaExceededError` (a `TooManyRequestsError`) | 429, the monthly quota | no |
|
|
128
142
|
| `ServiceUnavailableError` | 503 | yes |
|
|
129
|
-
| `APIError` | any other status | 502
|
|
143
|
+
| `APIError` | any other status | 502 and 504 on free routes only |
|
|
130
144
|
| `ConnectionError` | no answer | when the connection was never opened (`connectFailed`); any on free routes |
|
|
131
145
|
| `TimeoutError` | an attempt passed `timeoutMs` | free routes only |
|
|
146
|
+
| `BatchAllIncompleteError` (an `IncompleteError`) | `batchAll` stopped after served chunks | no |
|
|
147
|
+
| `TransactionsIncompleteError` (an `IncompleteError`) | `iterateTransactions` reached the end of an incomplete list | no |
|
|
132
148
|
|
|
133
149
|
```ts
|
|
134
150
|
import { NotFoundError, QuotaExceededError } from '@tickwise/sdk';
|
|
@@ -146,22 +162,24 @@ try {
|
|
|
146
162
|
|
|
147
163
|
| Option | Default | |
|
|
148
164
|
| --- | --- | --- |
|
|
165
|
+
| `apiKey` | `TICKWISE_API_KEY` from the environment | sent only on metered routes |
|
|
149
166
|
| `maxRetries` | `2` | retries after the first attempt |
|
|
150
167
|
| `timeoutMs` | `30000` | per attempt |
|
|
151
168
|
| `maxRetryAfterSec` | `60` | a longer `Retry-After` is thrown at once, not waited out |
|
|
152
|
-
| `baseUrl` | `https://api.tickwise.xyz` | |
|
|
169
|
+
| `baseUrl` | `https://api.tickwise.xyz` | the API origin, without `/v1`; an empty value means the default |
|
|
170
|
+
| `keyHeader` | `KC-APIKey` | the header the key is sent in |
|
|
171
|
+
| `maxBodyBytes` | off | refuse a response body larger than this |
|
|
153
172
|
| `fetch` | `globalThis.fetch` | your own `fetch`, e.g. for a proxy or tests |
|
|
154
173
|
|
|
155
|
-
The client waits for `Retry-After` when the API sends one. Otherwise it
|
|
174
|
+
The client waits for `Retry-After` when the API (or a gateway, in seconds or as a date) sends one. Otherwise it waits a random time up to 0.5 s, then up to 1 s, then up to 2 s and so on, capped at 8 s. Pass an `AbortSignal` as `signal` to cancel a call, including a wait between retries.
|
|
156
175
|
|
|
157
176
|
**A retry never costs extra units.** On a metered route the client retries only failures the API did not charge:
|
|
158
177
|
|
|
159
178
|
- the burst rate limit;
|
|
160
179
|
- a 503, which is credited back;
|
|
161
|
-
- a 502;
|
|
162
180
|
- a connection that was never opened (the name did not resolve, or the connection was refused).
|
|
163
181
|
|
|
164
|
-
A timeout, a connection lost mid-request and a 504 are thrown, not retried. The API may already have served that request, and charged it. Retry those yourself if a second charge is acceptable. Free routes retry all of them.
|
|
182
|
+
A timeout, a connection lost mid-request, a 502 and a 504 are thrown, not retried. The API may already have served that request, and charged it: a 502 or 504 comes from the gateway in front of the API, so the API never got to credit it back. Retry those yourself if a second charge is acceptable. Free routes retry all of them.
|
|
165
183
|
|
|
166
184
|
## Usage and limits on each answer
|
|
167
185
|
|
package/dist/cjs/client.d.ts
CHANGED
|
@@ -12,24 +12,24 @@ export interface TickwiseOptions {
|
|
|
12
12
|
* Your API key from the Tickwise portal. When omitted, `TICKWISE_API_KEY` is read from the environment (on
|
|
13
13
|
* runtimes that have `process.env`). Only metered routes send it; the free routes never do.
|
|
14
14
|
*/
|
|
15
|
-
apiKey?: string;
|
|
15
|
+
apiKey?: string | undefined;
|
|
16
16
|
/** Default `https://api.tickwise.xyz`. */
|
|
17
|
-
baseUrl?: string;
|
|
17
|
+
baseUrl?: string | undefined;
|
|
18
18
|
/** The header the key goes in. Default `KC-APIKey`; change it only for an API run with another `API_KEY_HEADER`. */
|
|
19
|
-
keyHeader?: string;
|
|
19
|
+
keyHeader?: string | undefined;
|
|
20
20
|
/** Per attempt, in milliseconds. Default 30000. */
|
|
21
|
-
timeoutMs?: number;
|
|
21
|
+
timeoutMs?: number | undefined;
|
|
22
22
|
/**
|
|
23
|
-
* Retries of failures the API did not charge: a 429 rate-limit, 503,
|
|
24
|
-
* route also retries a timeout, a dropped connection and a 504). Default 2; 0 turns them off.
|
|
23
|
+
* Retries of failures the API did not charge: a 429 rate-limit, 503, or a connection that never opened (a free
|
|
24
|
+
* route also retries a timeout, a dropped connection, a 502 and a 504). Default 2; 0 turns them off.
|
|
25
25
|
*/
|
|
26
|
-
maxRetries?: number;
|
|
26
|
+
maxRetries?: number | undefined;
|
|
27
27
|
/** A `Retry-After` longer than this (seconds) is thrown as the error instead of waited out. Default 60. */
|
|
28
|
-
maxRetryAfterSec?: number;
|
|
28
|
+
maxRetryAfterSec?: number | undefined;
|
|
29
29
|
/** Refuse a response body larger than this many bytes. Off by default. */
|
|
30
|
-
maxBodyBytes?: number;
|
|
30
|
+
maxBodyBytes?: number | undefined;
|
|
31
31
|
/** A `fetch` to use instead of the global one (tests, proxies, instrumentation). */
|
|
32
|
-
fetch?: typeof fetch;
|
|
32
|
+
fetch?: typeof fetch | undefined;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* The Tickwise API client.
|
package/dist/cjs/client.js
CHANGED
|
@@ -42,7 +42,8 @@ class Tickwise {
|
|
|
42
42
|
#meta;
|
|
43
43
|
#baseUrl;
|
|
44
44
|
constructor(options = {}) {
|
|
45
|
-
|
|
45
|
+
// An empty value (an environment variable set to nothing) means the default, as for `apiKey` and `keyHeader`.
|
|
46
|
+
const baseUrl = (options.baseUrl?.trim() || transport_js_1.DEFAULT_BASE_URL).replace(/\/+$/, '');
|
|
46
47
|
let parsed;
|
|
47
48
|
try {
|
|
48
49
|
parsed = new URL(baseUrl);
|
|
@@ -56,6 +57,10 @@ class Tickwise {
|
|
|
56
57
|
if (parsed.search || parsed.hash || parsed.username || parsed.password) {
|
|
57
58
|
throw new TypeError('Tickwise: `baseUrl` must not carry a query, fragment or credentials');
|
|
58
59
|
}
|
|
60
|
+
// Every route path starts with /v1, so a base URL that already ends in it would send every call to /v1/v1/....
|
|
61
|
+
if (/\/v1$/i.test(parsed.pathname.replace(/\/+$/, ''))) {
|
|
62
|
+
throw new TypeError('Tickwise: `baseUrl` is the API origin without `/v1` (for example https://api.tickwise.xyz)');
|
|
63
|
+
}
|
|
59
64
|
const f = options.fetch ?? globalThis.fetch;
|
|
60
65
|
if (typeof f !== 'function') {
|
|
61
66
|
throw new TypeError('Tickwise: no global `fetch` on this runtime; pass one as `fetch` (Node 20.3+ has it built in)');
|
package/dist/cjs/errors.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Every error the
|
|
2
|
+
* Every error from the API or the network is a `TickwiseError`. The exceptions: a bad option or argument is a
|
|
3
|
+
* `TypeError` (thrown, or as the rejection of the call), and a call cancelled through `signal` rejects with the
|
|
4
|
+
* signal's reason (the platform's `AbortError` by default). Branch on `instanceof` or on `kind`, never on `message`: the API's
|
|
3
5
|
* error bodies are `{ error: string }` with no machine code, and their text can change. `kind` is derived from the
|
|
4
6
|
* status code and, for a 429, from the `X-RateLimit-Reason` header.
|
|
5
7
|
*/
|
|
6
|
-
export type TickwiseErrorKind = 'bad_request' | 'authentication' | 'permission_denied' | 'not_found' | 'rate_limited' | 'quota_exceeded' | 'unavailable' | 'api_error' | 'redirect' | 'connection' | 'timeout';
|
|
8
|
+
export type TickwiseErrorKind = 'bad_request' | 'authentication' | 'permission_denied' | 'not_found' | 'rate_limited' | 'quota_exceeded' | 'unavailable' | 'api_error' | 'redirect' | 'connection' | 'timeout' | 'incomplete';
|
|
7
9
|
export interface TickwiseErrorInit {
|
|
8
|
-
status?: number;
|
|
10
|
+
status?: number | undefined;
|
|
9
11
|
body?: unknown;
|
|
10
|
-
headers?: Headers;
|
|
11
|
-
retryAfterSec?: number;
|
|
12
|
-
url?: string;
|
|
12
|
+
headers?: Headers | undefined;
|
|
13
|
+
retryAfterSec?: number | undefined;
|
|
14
|
+
url?: string | undefined;
|
|
13
15
|
cause?: unknown;
|
|
14
16
|
}
|
|
15
17
|
export declare class TickwiseError extends Error {
|
|
@@ -77,9 +79,55 @@ export declare class ConnectionError extends TickwiseError {
|
|
|
77
79
|
export declare class TimeoutError extends TickwiseError {
|
|
78
80
|
constructor(message: string, init?: TickwiseErrorInit);
|
|
79
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* A helper that makes several requests (`positions.batchAll`, `positions.iterateTransactions`) could not get
|
|
84
|
+
* everything. What it did get is on the error; `cause` is the failure that stopped it, when one did.
|
|
85
|
+
*/
|
|
86
|
+
export declare class IncompleteError extends TickwiseError {
|
|
87
|
+
constructor(message: string, init?: TickwiseErrorInit);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* `positions.batchAll` stopped on a failed chunk after earlier chunks were served, and charged. The served rows are
|
|
91
|
+
* in `data`; pass `remainingIds` to `batchAll` again to finish without paying for the served ones twice. `cause` is
|
|
92
|
+
* the chunk's error (a `QuotaExceededError`, a `TimeoutError`, the signal's reason after an abort, ...).
|
|
93
|
+
*/
|
|
94
|
+
export declare class BatchAllIncompleteError<T = unknown> extends IncompleteError {
|
|
95
|
+
/** The chunks served before the failure, merged as `batchAll` returns them. */
|
|
96
|
+
readonly data: T;
|
|
97
|
+
/** Units the served chunks were charged; undefined when a chunk's answer did not say. */
|
|
98
|
+
readonly unitsCharged: number | undefined;
|
|
99
|
+
/** The ids not served: the failed chunk's and every later one, in order. */
|
|
100
|
+
readonly remainingIds: string[];
|
|
101
|
+
constructor(message: string, init: TickwiseErrorInit & {
|
|
102
|
+
data: T;
|
|
103
|
+
unitsCharged: number | undefined;
|
|
104
|
+
remainingIds: string[];
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/** Why the API said a position's transaction list is not complete (the flags on its last page). */
|
|
108
|
+
export type TransactionsIncompleteReason = 'transactionsPartial' | 'transactionsTruncated' | 'transactionsDegraded';
|
|
109
|
+
/**
|
|
110
|
+
* `positions.iterateTransactions` reached the oldest transaction the API had, but the last page said the list is not
|
|
111
|
+
* complete: `transactionsPartial` (only the newest transactions were ready; ask again in a few seconds),
|
|
112
|
+
* `transactionsTruncated` (the history is longer than the API reads; the oldest are missing) or
|
|
113
|
+
* `transactionsDegraded` (the list could not be read in full). Every row the API had was yielded before this is
|
|
114
|
+
* thrown.
|
|
115
|
+
*/
|
|
116
|
+
export declare class TransactionsIncompleteError extends IncompleteError {
|
|
117
|
+
readonly reasons: TransactionsIncompleteReason[];
|
|
118
|
+
/** How many transactions were yielded. */
|
|
119
|
+
readonly yielded: number;
|
|
120
|
+
constructor(message: string, init: TickwiseErrorInit & {
|
|
121
|
+
reasons: TransactionsIncompleteReason[];
|
|
122
|
+
yielded: number;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
80
125
|
/** The most useful text an error body carries: Nest validation detail first, then `error`. */
|
|
81
126
|
export declare function errorMessage(body: unknown, status: number): string;
|
|
82
|
-
/**
|
|
83
|
-
|
|
127
|
+
/**
|
|
128
|
+
* `Retry-After` in whole seconds: the API sends seconds; a gateway may send an HTTP date, read as the seconds from
|
|
129
|
+
* now (0 when it has passed). Else the 429 body's `retryAfterSec`.
|
|
130
|
+
*/
|
|
131
|
+
export declare function retryAfterOf(headers: Headers, body: unknown, now?: number): number | undefined;
|
|
84
132
|
/** The error for a non-2xx answer. */
|
|
85
133
|
export declare function errorFromResponse(status: number, headers: Headers, body: unknown, url: string): APIError;
|
package/dist/cjs/errors.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Every error the
|
|
3
|
+
* Every error from the API or the network is a `TickwiseError`. The exceptions: a bad option or argument is a
|
|
4
|
+
* `TypeError` (thrown, or as the rejection of the call), and a call cancelled through `signal` rejects with the
|
|
5
|
+
* signal's reason (the platform's `AbortError` by default). Branch on `instanceof` or on `kind`, never on `message`: the API's
|
|
4
6
|
* error bodies are `{ error: string }` with no machine code, and their text can change. `kind` is derived from the
|
|
5
7
|
* status code and, for a 429, from the `X-RateLimit-Reason` header.
|
|
6
8
|
*/
|
|
7
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.TimeoutError = exports.ConnectionError = exports.ServiceUnavailableError = exports.QuotaExceededError = exports.RateLimitError = exports.TooManyRequestsError = exports.NotFoundError = exports.PermissionDeniedError = exports.AuthenticationError = exports.BadRequestError = exports.APIError = exports.TickwiseError = void 0;
|
|
10
|
+
exports.TransactionsIncompleteError = exports.BatchAllIncompleteError = exports.IncompleteError = exports.TimeoutError = exports.ConnectionError = exports.ServiceUnavailableError = exports.QuotaExceededError = exports.RateLimitError = exports.TooManyRequestsError = exports.NotFoundError = exports.PermissionDeniedError = exports.AuthenticationError = exports.BadRequestError = exports.APIError = exports.TickwiseError = void 0;
|
|
9
11
|
exports.errorMessage = errorMessage;
|
|
10
12
|
exports.retryAfterOf = retryAfterOf;
|
|
11
13
|
exports.errorFromResponse = errorFromResponse;
|
|
@@ -127,6 +129,57 @@ class TimeoutError extends TickwiseError {
|
|
|
127
129
|
}
|
|
128
130
|
}
|
|
129
131
|
exports.TimeoutError = TimeoutError;
|
|
132
|
+
/**
|
|
133
|
+
* A helper that makes several requests (`positions.batchAll`, `positions.iterateTransactions`) could not get
|
|
134
|
+
* everything. What it did get is on the error; `cause` is the failure that stopped it, when one did.
|
|
135
|
+
*/
|
|
136
|
+
class IncompleteError extends TickwiseError {
|
|
137
|
+
constructor(message, init = {}) {
|
|
138
|
+
super('incomplete', message, init);
|
|
139
|
+
this.name = 'IncompleteError';
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.IncompleteError = IncompleteError;
|
|
143
|
+
/**
|
|
144
|
+
* `positions.batchAll` stopped on a failed chunk after earlier chunks were served, and charged. The served rows are
|
|
145
|
+
* in `data`; pass `remainingIds` to `batchAll` again to finish without paying for the served ones twice. `cause` is
|
|
146
|
+
* the chunk's error (a `QuotaExceededError`, a `TimeoutError`, the signal's reason after an abort, ...).
|
|
147
|
+
*/
|
|
148
|
+
class BatchAllIncompleteError extends IncompleteError {
|
|
149
|
+
/** The chunks served before the failure, merged as `batchAll` returns them. */
|
|
150
|
+
data;
|
|
151
|
+
/** Units the served chunks were charged; undefined when a chunk's answer did not say. */
|
|
152
|
+
unitsCharged;
|
|
153
|
+
/** The ids not served: the failed chunk's and every later one, in order. */
|
|
154
|
+
remainingIds;
|
|
155
|
+
constructor(message, init) {
|
|
156
|
+
super(message, init);
|
|
157
|
+
this.name = 'BatchAllIncompleteError';
|
|
158
|
+
this.data = init.data;
|
|
159
|
+
this.unitsCharged = init.unitsCharged;
|
|
160
|
+
this.remainingIds = init.remainingIds;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.BatchAllIncompleteError = BatchAllIncompleteError;
|
|
164
|
+
/**
|
|
165
|
+
* `positions.iterateTransactions` reached the oldest transaction the API had, but the last page said the list is not
|
|
166
|
+
* complete: `transactionsPartial` (only the newest transactions were ready; ask again in a few seconds),
|
|
167
|
+
* `transactionsTruncated` (the history is longer than the API reads; the oldest are missing) or
|
|
168
|
+
* `transactionsDegraded` (the list could not be read in full). Every row the API had was yielded before this is
|
|
169
|
+
* thrown.
|
|
170
|
+
*/
|
|
171
|
+
class TransactionsIncompleteError extends IncompleteError {
|
|
172
|
+
reasons;
|
|
173
|
+
/** How many transactions were yielded. */
|
|
174
|
+
yielded;
|
|
175
|
+
constructor(message, init) {
|
|
176
|
+
super(message, init);
|
|
177
|
+
this.name = 'TransactionsIncompleteError';
|
|
178
|
+
this.reasons = init.reasons;
|
|
179
|
+
this.yielded = init.yielded;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.TransactionsIncompleteError = TransactionsIncompleteError;
|
|
130
183
|
/** The most useful text an error body carries: Nest validation detail first, then `error`. */
|
|
131
184
|
function errorMessage(body, status) {
|
|
132
185
|
if (typeof body === 'string' && body.trim())
|
|
@@ -146,11 +199,19 @@ function errorMessage(body, status) {
|
|
|
146
199
|
}
|
|
147
200
|
return `HTTP ${status}`;
|
|
148
201
|
}
|
|
149
|
-
/**
|
|
150
|
-
|
|
202
|
+
/**
|
|
203
|
+
* `Retry-After` in whole seconds: the API sends seconds; a gateway may send an HTTP date, read as the seconds from
|
|
204
|
+
* now (0 when it has passed). Else the 429 body's `retryAfterSec`.
|
|
205
|
+
*/
|
|
206
|
+
function retryAfterOf(headers, body, now = Date.now()) {
|
|
151
207
|
const h = headers.get('retry-after')?.trim();
|
|
152
208
|
if (h && /^\d+$/.test(h))
|
|
153
209
|
return Number(h);
|
|
210
|
+
if (h && /[a-z]/i.test(h)) {
|
|
211
|
+
const at = Date.parse(h);
|
|
212
|
+
if (Number.isFinite(at))
|
|
213
|
+
return Math.max(0, Math.ceil((at - now) / 1000));
|
|
214
|
+
}
|
|
154
215
|
const b = body && typeof body === 'object' ? body.retryAfterSec : undefined;
|
|
155
216
|
return typeof b === 'number' && Number.isFinite(b) && b >= 0 ? b : undefined;
|
|
156
217
|
}
|
|
@@ -156,6 +156,23 @@ export interface paths {
|
|
|
156
156
|
patch?: never;
|
|
157
157
|
trace?: never;
|
|
158
158
|
};
|
|
159
|
+
"/v1/tokens/search": {
|
|
160
|
+
parameters: {
|
|
161
|
+
query?: never;
|
|
162
|
+
header?: never;
|
|
163
|
+
path?: never;
|
|
164
|
+
cookie?: never;
|
|
165
|
+
};
|
|
166
|
+
/** Search tokens */
|
|
167
|
+
get: operations["tokens.search"];
|
|
168
|
+
put?: never;
|
|
169
|
+
post?: never;
|
|
170
|
+
delete?: never;
|
|
171
|
+
options?: never;
|
|
172
|
+
head?: never;
|
|
173
|
+
patch?: never;
|
|
174
|
+
trace?: never;
|
|
175
|
+
};
|
|
159
176
|
"/v1/wallets/{address}": {
|
|
160
177
|
parameters: {
|
|
161
178
|
query?: never;
|
|
@@ -571,7 +588,14 @@ export interface components {
|
|
|
571
588
|
} & {
|
|
572
589
|
[key: string]: unknown;
|
|
573
590
|
});
|
|
574
|
-
PoolDetail: components["schemas"]["Pool"]
|
|
591
|
+
PoolDetail: components["schemas"]["Pool"] & ({
|
|
592
|
+
/** @description Share of the pool's open-position USD value held by its 5 largest wallets, in percent (0 to 100). Recomputed about every 10 minutes, off the request. `null` while it is being computed (ask again in a few seconds) or when it cannot be given: no priced open position, or a pool with more than 50,000 open positions. */
|
|
593
|
+
top5HoldersShare?: number | null;
|
|
594
|
+
/** @description Share of the pool's open-position USD value in positions that are in range now, in percent (0 to 100). Computed with `top5HoldersShare`, and `null` in the same cases. */
|
|
595
|
+
inRangeShare?: number | null;
|
|
596
|
+
} & {
|
|
597
|
+
[key: string]: unknown;
|
|
598
|
+
});
|
|
575
599
|
TokenPrice: {
|
|
576
600
|
/** @description USD price, or `null` when the API has no price it would value the token with (see `unavailableReason`). */
|
|
577
601
|
usd: number | null;
|
|
@@ -668,6 +692,67 @@ export interface components {
|
|
|
668
692
|
} & {
|
|
669
693
|
[key: string]: unknown;
|
|
670
694
|
});
|
|
695
|
+
TokenSearchPool: {
|
|
696
|
+
poolId: string;
|
|
697
|
+
/** @description The two symbols, token0 first, e.g. `USDC/WETH`. */
|
|
698
|
+
pair: string;
|
|
699
|
+
/** @description The pool fee in hundredths of a basis point (500 = 0.05%); `null` when not stored. */
|
|
700
|
+
fee: number | null;
|
|
701
|
+
tvlUsd: number;
|
|
702
|
+
/** @description The pool page on the Tickwise website, `/pool/{chainId}/{poolId}`. */
|
|
703
|
+
path: string;
|
|
704
|
+
/** @description `path` as an absolute link. */
|
|
705
|
+
url: string;
|
|
706
|
+
} & {
|
|
707
|
+
[key: string]: unknown;
|
|
708
|
+
};
|
|
709
|
+
TokenSearchMatch: {
|
|
710
|
+
chainId: number;
|
|
711
|
+
/** @description The chain's name. */
|
|
712
|
+
chain: string;
|
|
713
|
+
protocol: string;
|
|
714
|
+
/** @description The token contract, lower case. Pass it to `GET /v1/tokens/{chainId}/{address}`. */
|
|
715
|
+
address: string;
|
|
716
|
+
symbol: string;
|
|
717
|
+
/** @description The token's stored name; `null` when none is stored (most major tokens). */
|
|
718
|
+
name: string | null;
|
|
719
|
+
/**
|
|
720
|
+
* @description How `q` matched: the contract `address`, the exact `symbol`, a common name for a major token (`alias`), the exact stored `name`, the start of the symbol or name (`symbol-prefix`, `name-prefix`), or text inside the name (`name-contains`).
|
|
721
|
+
* @enum {string}
|
|
722
|
+
*/
|
|
723
|
+
match: "address" | "symbol" | "alias" | "name" | "symbol-prefix" | "name-prefix" | "name-contains";
|
|
724
|
+
/** @description Summed TVL of the listed pools holding the token on this chain. */
|
|
725
|
+
tvlUsd: number;
|
|
726
|
+
/** @description How many listed pools hold the token on this chain. */
|
|
727
|
+
pools: number;
|
|
728
|
+
/** @description The token page on the Tickwise website, `/token/{chainId}/{address}`. */
|
|
729
|
+
path: string;
|
|
730
|
+
/** @description `path` as an absolute link. */
|
|
731
|
+
url: string;
|
|
732
|
+
/** @description Its biggest pools by TVL, at most 3. */
|
|
733
|
+
topPools: components["schemas"]["TokenSearchPool"][];
|
|
734
|
+
} & {
|
|
735
|
+
[key: string]: unknown;
|
|
736
|
+
};
|
|
737
|
+
TokenSearch: {
|
|
738
|
+
/** @description `q` as it was searched (trimmed). */
|
|
739
|
+
query: string;
|
|
740
|
+
/** @description Best match first; empty when nothing matched. */
|
|
741
|
+
matches: components["schemas"]["TokenSearchMatch"][];
|
|
742
|
+
/** @description Chains that could not be searched yet. Empty on a complete answer. */
|
|
743
|
+
pendingChains: number[];
|
|
744
|
+
/** @description Chains with more listed pools than the index holds; their smallest pools were not searched. */
|
|
745
|
+
truncatedChains: number[];
|
|
746
|
+
/**
|
|
747
|
+
* Format: date-time
|
|
748
|
+
* @description When the oldest index used was built; `null` when no chain could be searched.
|
|
749
|
+
*/
|
|
750
|
+
asOf: string | null;
|
|
751
|
+
/** @description Present and true only when `pendingChains` is not empty. The request is not charged. */
|
|
752
|
+
partial?: boolean;
|
|
753
|
+
} & {
|
|
754
|
+
[key: string]: unknown;
|
|
755
|
+
};
|
|
671
756
|
Hook: {
|
|
672
757
|
rank: number;
|
|
673
758
|
chainId: number;
|
|
@@ -1604,6 +1689,49 @@ export interface operations {
|
|
|
1604
1689
|
503: components["responses"]["Unavailable"];
|
|
1605
1690
|
};
|
|
1606
1691
|
};
|
|
1692
|
+
"tokens.search": {
|
|
1693
|
+
parameters: {
|
|
1694
|
+
query: {
|
|
1695
|
+
/**
|
|
1696
|
+
* @description A symbol (`USDC`), a name (`pepe`, `ethereum`) or a token contract (`0x` plus 40 hex), 1 to 100 characters, any case. Missing, blank or with no letter or digit in it is a 400.
|
|
1697
|
+
* @example usdc
|
|
1698
|
+
*/
|
|
1699
|
+
q: string;
|
|
1700
|
+
/** @description Search one chain. Omit to search every enabled chain. */
|
|
1701
|
+
chainId?: number;
|
|
1702
|
+
/** @description How many tokens to return, 1–20. A larger value is a 400, not a silent clamp. */
|
|
1703
|
+
limit?: number;
|
|
1704
|
+
};
|
|
1705
|
+
header?: never;
|
|
1706
|
+
path?: never;
|
|
1707
|
+
cookie?: never;
|
|
1708
|
+
};
|
|
1709
|
+
requestBody?: never;
|
|
1710
|
+
responses: {
|
|
1711
|
+
/** @description The matching tokens, best match first. */
|
|
1712
|
+
200: {
|
|
1713
|
+
headers: {
|
|
1714
|
+
"X-RateLimit-Limit": components["headers"]["XRateLimitLimit"];
|
|
1715
|
+
"X-RateLimit-Remaining": components["headers"]["XRateLimitRemaining"];
|
|
1716
|
+
"X-RateLimit-Reset": components["headers"]["XRateLimitReset"];
|
|
1717
|
+
"X-Quota-Limit": components["headers"]["XQuotaLimit"];
|
|
1718
|
+
"X-Quota-Remaining": components["headers"]["XQuotaRemaining"];
|
|
1719
|
+
"X-Quota-Reset": components["headers"]["XQuotaReset"];
|
|
1720
|
+
"Cache-Control": components["headers"]["CacheControl"];
|
|
1721
|
+
Vary: components["headers"]["Vary"];
|
|
1722
|
+
[name: string]: unknown;
|
|
1723
|
+
};
|
|
1724
|
+
content: {
|
|
1725
|
+
"application/json": components["schemas"]["TokenSearch"];
|
|
1726
|
+
};
|
|
1727
|
+
};
|
|
1728
|
+
400: components["responses"]["BadRequest"];
|
|
1729
|
+
401: components["responses"]["Unauthorized"];
|
|
1730
|
+
403: components["responses"]["Forbidden"];
|
|
1731
|
+
429: components["responses"]["TooManyRequests"];
|
|
1732
|
+
503: components["responses"]["Unavailable"];
|
|
1733
|
+
};
|
|
1734
|
+
};
|
|
1607
1735
|
"wallets.summary": {
|
|
1608
1736
|
parameters: {
|
|
1609
1737
|
query?: {
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Tickwise, type TickwiseOptions } from './client.js';
|
|
2
2
|
export { APIPromise, type WithMeta } from './api-promise.js';
|
|
3
|
-
export { APIError, AuthenticationError, BadRequestError, ConnectionError, NotFoundError, PermissionDeniedError, QuotaExceededError, RateLimitError, ServiceUnavailableError, TickwiseError, type TickwiseErrorKind, TimeoutError, TooManyRequestsError, } from './errors.js';
|
|
3
|
+
export { APIError, AuthenticationError, BadRequestError, BatchAllIncompleteError, ConnectionError, IncompleteError, NotFoundError, PermissionDeniedError, QuotaExceededError, RateLimitError, ServiceUnavailableError, TickwiseError, type TickwiseErrorKind, TimeoutError, TooManyRequestsError, TransactionsIncompleteError, type TransactionsIncompleteReason, } from './errors.js';
|
|
4
4
|
export type { CsvPage, CsvPagination } from './csv.js';
|
|
5
5
|
export { DEFAULT_BASE_URL, type LimitInfo, type RequestOptions, type ResponseMeta } from './transport.js';
|
|
6
6
|
export { POSITION_BATCH_MAX } from './resources/positions.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VERSION = exports.ROUTES = exports.HOOKS_ALL_CHAINS_MAX_ROWS = exports.POSITION_BATCH_MAX = exports.DEFAULT_BASE_URL = exports.TooManyRequestsError = exports.TimeoutError = exports.TickwiseError = exports.ServiceUnavailableError = exports.RateLimitError = exports.QuotaExceededError = exports.PermissionDeniedError = exports.NotFoundError = exports.ConnectionError = exports.BadRequestError = exports.AuthenticationError = exports.APIError = exports.APIPromise = exports.Tickwise = void 0;
|
|
3
|
+
exports.VERSION = exports.ROUTES = exports.HOOKS_ALL_CHAINS_MAX_ROWS = exports.POSITION_BATCH_MAX = exports.DEFAULT_BASE_URL = exports.TransactionsIncompleteError = exports.TooManyRequestsError = exports.TimeoutError = exports.TickwiseError = exports.ServiceUnavailableError = exports.RateLimitError = exports.QuotaExceededError = exports.PermissionDeniedError = exports.NotFoundError = exports.IncompleteError = exports.ConnectionError = exports.BatchAllIncompleteError = exports.BadRequestError = exports.AuthenticationError = exports.APIError = exports.APIPromise = exports.Tickwise = void 0;
|
|
4
4
|
var client_js_1 = require("./client.js");
|
|
5
5
|
Object.defineProperty(exports, "Tickwise", { enumerable: true, get: function () { return client_js_1.Tickwise; } });
|
|
6
6
|
var api_promise_js_1 = require("./api-promise.js");
|
|
@@ -9,7 +9,9 @@ var errors_js_1 = require("./errors.js");
|
|
|
9
9
|
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return errors_js_1.APIError; } });
|
|
10
10
|
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_js_1.AuthenticationError; } });
|
|
11
11
|
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return errors_js_1.BadRequestError; } });
|
|
12
|
+
Object.defineProperty(exports, "BatchAllIncompleteError", { enumerable: true, get: function () { return errors_js_1.BatchAllIncompleteError; } });
|
|
12
13
|
Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return errors_js_1.ConnectionError; } });
|
|
14
|
+
Object.defineProperty(exports, "IncompleteError", { enumerable: true, get: function () { return errors_js_1.IncompleteError; } });
|
|
13
15
|
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return errors_js_1.NotFoundError; } });
|
|
14
16
|
Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return errors_js_1.PermissionDeniedError; } });
|
|
15
17
|
Object.defineProperty(exports, "QuotaExceededError", { enumerable: true, get: function () { return errors_js_1.QuotaExceededError; } });
|
|
@@ -18,6 +20,7 @@ Object.defineProperty(exports, "ServiceUnavailableError", { enumerable: true, ge
|
|
|
18
20
|
Object.defineProperty(exports, "TickwiseError", { enumerable: true, get: function () { return errors_js_1.TickwiseError; } });
|
|
19
21
|
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return errors_js_1.TimeoutError; } });
|
|
20
22
|
Object.defineProperty(exports, "TooManyRequestsError", { enumerable: true, get: function () { return errors_js_1.TooManyRequestsError; } });
|
|
23
|
+
Object.defineProperty(exports, "TransactionsIncompleteError", { enumerable: true, get: function () { return errors_js_1.TransactionsIncompleteError; } });
|
|
21
24
|
var transport_js_1 = require("./transport.js");
|
|
22
25
|
Object.defineProperty(exports, "DEFAULT_BASE_URL", { enumerable: true, get: function () { return transport_js_1.DEFAULT_BASE_URL; } });
|
|
23
26
|
var positions_js_1 = require("./resources/positions.js");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { APIPromise } from '../api-promise.js';
|
|
2
2
|
import { type CsvPage } from '../csv.js';
|
|
3
3
|
import type { RequestOptions } from '../transport.js';
|
|
4
|
-
import type { Hook, HookList, HooksListQuery, PagingOptions } from '../types.js';
|
|
4
|
+
import type { Hook, HookList, HooksListQuery, CsvPagingOptions, PagingOptions } from '../types.js';
|
|
5
5
|
import { Resource } from './base.js';
|
|
6
6
|
/**
|
|
7
7
|
* Deepest row an all-chains hooks page may reach (`page` × `limit`). The API refuses a deeper page with a 400 and
|
|
@@ -22,5 +22,5 @@ export declare class Hooks extends Resource {
|
|
|
22
22
|
/** One page of `list` as CSV (`format=csv`): same filters, paging and unit cost as JSON. */
|
|
23
23
|
exportCsv(query?: HooksListQuery, options?: RequestOptions): APIPromise<CsvPage>;
|
|
24
24
|
/** Every page of `list` as CSV, each with its own header row (at most 1,000 rows without `chainId`). Each page is a metered request. */
|
|
25
|
-
exportCsvPages(query?: HooksListQuery, options?: RequestOptions &
|
|
25
|
+
exportCsvPages(query?: HooksListQuery, options?: RequestOptions & CsvPagingOptions): AsyncGenerator<CsvPage, void, undefined>;
|
|
26
26
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { APIPromise } from '../api-promise.js';
|
|
2
2
|
import { type CsvPage } from '../csv.js';
|
|
3
3
|
import type { RequestOptions } from '../transport.js';
|
|
4
|
-
import type { Charts, PagingOptions, Pool, PoolChartsQuery, PoolDetail, PoolDetailQuery, PoolList, PoolsListQuery, ProtocolKey, RowOf, Shaped, WithRows } from '../types.js';
|
|
4
|
+
import type { Charts, CsvPagingOptions, PagingOptions, Pool, PoolChartsQuery, PoolDetail, PoolDetailQuery, PoolList, PoolsListQuery, ProtocolKey, RowOf, Shaped, WithRows } from '../types.js';
|
|
5
5
|
import { Resource } from './base.js';
|
|
6
6
|
export declare class Pools extends Resource {
|
|
7
7
|
/** `GET /v1/pools`: a ranked, filtered page of pools. */
|
|
8
|
-
list<Q extends PoolsListQuery =
|
|
8
|
+
list<Q extends PoolsListQuery = {}>(query?: Q, options?: RequestOptions): APIPromise<WithRows<PoolList, 'pools', Q>>;
|
|
9
9
|
/** Every page of `list`, fetched as you iterate. Starts at `query.page` (default 1). */
|
|
10
|
-
pages<Q extends PoolsListQuery =
|
|
10
|
+
pages<Q extends PoolsListQuery = {}>(query?: Q, options?: RequestOptions & PagingOptions): AsyncGenerator<WithRows<PoolList, 'pools', Q>, void, undefined>;
|
|
11
11
|
/** Every row of `list`, across pages. Each page is a metered request; `break` stops fetching. */
|
|
12
|
-
iterate<Q extends PoolsListQuery =
|
|
12
|
+
iterate<Q extends PoolsListQuery = {}>(query?: Q, options?: RequestOptions & PagingOptions): AsyncGenerator<RowOf<Pool, Q>, void, undefined>;
|
|
13
13
|
/** `GET /v1/pools/{chainId}/{protocol}/{poolId}`: one pool. */
|
|
14
|
-
get<Q extends PoolDetailQuery =
|
|
14
|
+
get<Q extends PoolDetailQuery = {}>(chainId: number, protocol: ProtocolKey, poolId: string, query?: Q, options?: RequestOptions): APIPromise<Shaped<PoolDetail, Q>>;
|
|
15
15
|
/** `GET .../charts`: the pool's time series (`range`: 30d, 60d, 90d, 180d, all). */
|
|
16
|
-
charts<Q extends PoolChartsQuery =
|
|
16
|
+
charts<Q extends PoolChartsQuery = {}>(chainId: number, protocol: ProtocolKey, poolId: string, query?: Q, options?: RequestOptions): APIPromise<Shaped<Charts, Q>>;
|
|
17
17
|
/** One page of `list` as CSV (`format=csv`): same filters, paging and unit cost as JSON. */
|
|
18
18
|
exportCsv(query?: PoolsListQuery, options?: RequestOptions): APIPromise<CsvPage>;
|
|
19
19
|
/** Every page of `list` as CSV, each with its own header row. Each page is a metered request. */
|
|
20
|
-
exportCsvPages(query?: PoolsListQuery, options?: RequestOptions &
|
|
20
|
+
exportCsvPages(query?: PoolsListQuery, options?: RequestOptions & CsvPagingOptions): AsyncGenerator<CsvPage, void, undefined>;
|
|
21
21
|
}
|