@tickwise/sdk 0.0.0-stage → 0.1.0
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/LICENSE +661 -0
- package/README.md +185 -2
- package/dist/cjs/api-promise.d.ts +22 -0
- package/dist/cjs/api-promise.js +43 -0
- package/dist/cjs/client.d.ts +64 -0
- package/dist/cjs/client.js +118 -0
- package/dist/cjs/csv.d.ts +37 -0
- package/dist/cjs/csv.js +69 -0
- package/dist/cjs/errors.d.ts +85 -0
- package/dist/cjs/errors.js +181 -0
- package/dist/cjs/generated/openapi.d.ts +1821 -0
- package/dist/cjs/generated/openapi.js +6 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.js +30 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/resources/base.d.ts +21 -0
- package/dist/cjs/resources/base.js +81 -0
- package/dist/cjs/resources/hooks.d.ts +26 -0
- package/dist/cjs/resources/hooks.js +46 -0
- package/dist/cjs/resources/meta.d.ts +23 -0
- package/dist/cjs/resources/meta.js +35 -0
- package/dist/cjs/resources/pools.d.ts +21 -0
- package/dist/cjs/resources/pools.js +40 -0
- package/dist/cjs/resources/positions.d.ts +45 -0
- package/dist/cjs/resources/positions.js +133 -0
- package/dist/cjs/resources/tokens.d.ts +13 -0
- package/dist/cjs/resources/tokens.js +20 -0
- package/dist/cjs/resources/wallets.d.ts +11 -0
- package/dist/cjs/resources/wallets.js +14 -0
- package/dist/cjs/routes.d.ts +80 -0
- package/dist/cjs/routes.js +40 -0
- package/dist/cjs/transport.d.ts +91 -0
- package/dist/cjs/transport.js +310 -0
- package/dist/cjs/types.d.ts +99 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/version.d.ts +2 -0
- package/dist/cjs/version.js +5 -0
- package/dist/esm/api-promise.d.ts +22 -0
- package/dist/esm/api-promise.js +39 -0
- package/dist/esm/client.d.ts +64 -0
- package/dist/esm/client.js +114 -0
- package/dist/esm/csv.d.ts +37 -0
- package/dist/esm/csv.js +64 -0
- package/dist/esm/errors.d.ts +85 -0
- package/dist/esm/errors.js +163 -0
- package/dist/esm/generated/openapi.d.ts +1821 -0
- package/dist/esm/generated/openapi.js +5 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/resources/base.d.ts +21 -0
- package/dist/esm/resources/base.js +73 -0
- package/dist/esm/resources/hooks.d.ts +26 -0
- package/dist/esm/resources/hooks.js +42 -0
- package/dist/esm/resources/meta.d.ts +23 -0
- package/dist/esm/resources/meta.js +30 -0
- package/dist/esm/resources/pools.d.ts +21 -0
- package/dist/esm/resources/pools.js +36 -0
- package/dist/esm/resources/positions.d.ts +45 -0
- package/dist/esm/resources/positions.js +129 -0
- package/dist/esm/resources/tokens.d.ts +13 -0
- package/dist/esm/resources/tokens.js +16 -0
- package/dist/esm/resources/wallets.d.ts +11 -0
- package/dist/esm/resources/wallets.js +10 -0
- package/dist/esm/routes.d.ts +80 -0
- package/dist/esm/routes.js +36 -0
- package/dist/esm/transport.d.ts +91 -0
- package/dist/esm/transport.js +299 -0
- package/dist/esm/types.d.ts +99 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/version.d.ts +2 -0
- package/dist/esm/version.js +2 -0
- package/package.json +64 -4
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { Tickwise, type TickwiseOptions } from './client.js';
|
|
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';
|
|
4
|
+
export type { CsvPage, CsvPagination } from './csv.js';
|
|
5
|
+
export { DEFAULT_BASE_URL, type LimitInfo, type RequestOptions, type ResponseMeta } from './transport.js';
|
|
6
|
+
export { POSITION_BATCH_MAX } from './resources/positions.js';
|
|
7
|
+
export { HOOKS_ALL_CHAINS_MAX_ROWS } from './resources/hooks.js';
|
|
8
|
+
export { ROUTES, type OperationId } from './routes.js';
|
|
9
|
+
export { VERSION } from './version.js';
|
|
10
|
+
export type * from './types.js';
|
|
11
|
+
export type { components, operations, paths } from './generated/openapi.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Tickwise } from './client.js';
|
|
2
|
+
export { APIPromise } from './api-promise.js';
|
|
3
|
+
export { APIError, AuthenticationError, BadRequestError, ConnectionError, NotFoundError, PermissionDeniedError, QuotaExceededError, RateLimitError, ServiceUnavailableError, TickwiseError, TimeoutError, TooManyRequestsError, } from './errors.js';
|
|
4
|
+
export { DEFAULT_BASE_URL } from './transport.js';
|
|
5
|
+
export { POSITION_BATCH_MAX } from './resources/positions.js';
|
|
6
|
+
export { HOOKS_ALL_CHAINS_MAX_ROWS } from './resources/hooks.js';
|
|
7
|
+
export { ROUTES } from './routes.js';
|
|
8
|
+
export { VERSION } from './version.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { APIPromise } from '../api-promise.js';
|
|
2
|
+
import { type CsvPage } from '../csv.js';
|
|
3
|
+
import { type OperationId } from '../routes.js';
|
|
4
|
+
import type { Query, RequestOptions, Transport } from '../transport.js';
|
|
5
|
+
import type { PagingOptions } from '../types.js';
|
|
6
|
+
/** A query object from the caller, as sent: `format` is the SDK's to set, never the caller's. */
|
|
7
|
+
export declare function toQuery(q: object | undefined, extra?: Record<string, unknown>): Query;
|
|
8
|
+
export declare class Resource {
|
|
9
|
+
protected readonly transport: Transport;
|
|
10
|
+
constructor(transport: Transport);
|
|
11
|
+
protected call<T>(op: OperationId, pathParams: Record<string, string | number | bigint> | undefined, query: Query | undefined, options: RequestOptions | undefined): APIPromise<T>;
|
|
12
|
+
protected callCsv(op: OperationId, query: Query, options: RequestOptions | undefined): APIPromise<CsvPage>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Pages of a `page` / `limit` list, fetched one at a time and only when asked for. Stops when the page says there
|
|
16
|
+
* is no more, when a page comes back empty (a guard against a server bug looping forever), or at `maxPages`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function pageIterator<P>(query: object | undefined, fetchPage: (page: number) => Promise<P>, hasMore: (p: P) => boolean, size: (p: P) => number, opts?: PagingOptions): AsyncGenerator<P, void, undefined>;
|
|
19
|
+
/** The rows of a page iterator, up to `maxItems`. */
|
|
20
|
+
export declare function rowIterator<P, R>(pages: AsyncGenerator<P, void, undefined>, rows: (p: P) => readonly R[], opts?: PagingOptions): AsyncGenerator<R, void, undefined>;
|
|
21
|
+
export declare function splitOptions<O extends RequestOptions & PagingOptions>(o: O | undefined): [RequestOptions, PagingOptions];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { APIPromise } from '../api-promise.js';
|
|
2
|
+
import { csvPageOf } from '../csv.js';
|
|
3
|
+
import { fillPath, ROUTES } from '../routes.js';
|
|
4
|
+
/** A query object from the caller, as sent: `format` is the SDK's to set, never the caller's. */
|
|
5
|
+
export function toQuery(q, extra = {}) {
|
|
6
|
+
const out = { ...(q ?? {}) };
|
|
7
|
+
delete out.format;
|
|
8
|
+
return { ...out, ...extra };
|
|
9
|
+
}
|
|
10
|
+
export class Resource {
|
|
11
|
+
transport;
|
|
12
|
+
constructor(transport) {
|
|
13
|
+
this.transport = transport;
|
|
14
|
+
}
|
|
15
|
+
call(op, pathParams, query, options) {
|
|
16
|
+
let raw;
|
|
17
|
+
try {
|
|
18
|
+
raw = this.transport.request({ path: fillPath(op, pathParams), query, metered: ROUTES[op].metered, accept: 'json' }, options);
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
raw = Promise.reject(e);
|
|
22
|
+
}
|
|
23
|
+
return new APIPromise(raw.then((r) => ({ data: r.body, meta: r.meta })));
|
|
24
|
+
}
|
|
25
|
+
callCsv(op, query, options) {
|
|
26
|
+
const raw = this.transport.request({ path: fillPath(op), query: { ...query, format: 'csv' }, metered: ROUTES[op].metered, accept: 'csv' }, options);
|
|
27
|
+
return new APIPromise(raw.then((r) => ({ data: csvPageOf(r.body, r.meta.headers, r.meta.url), meta: r.meta })));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function startPage(q) {
|
|
31
|
+
const p = q?.page;
|
|
32
|
+
return typeof p === 'number' && Number.isInteger(p) && p >= 1 ? p : 1;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Pages of a `page` / `limit` list, fetched one at a time and only when asked for. Stops when the page says there
|
|
36
|
+
* is no more, when a page comes back empty (a guard against a server bug looping forever), or at `maxPages`.
|
|
37
|
+
*/
|
|
38
|
+
export async function* pageIterator(query, fetchPage, hasMore, size, opts = {}) {
|
|
39
|
+
let page = startPage(query);
|
|
40
|
+
for (let n = 0; opts.maxPages === undefined || n < opts.maxPages; n++, page++) {
|
|
41
|
+
const p = await fetchPage(page);
|
|
42
|
+
yield p;
|
|
43
|
+
if (!hasMore(p) || size(p) === 0)
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** The rows of a page iterator, up to `maxItems`. */
|
|
48
|
+
export async function* rowIterator(pages, rows, opts = {}) {
|
|
49
|
+
if (opts.maxItems !== undefined && opts.maxItems <= 0)
|
|
50
|
+
return;
|
|
51
|
+
let n = 0;
|
|
52
|
+
try {
|
|
53
|
+
for await (const p of pages) {
|
|
54
|
+
for (const r of rows(p)) {
|
|
55
|
+
yield r;
|
|
56
|
+
if (opts.maxItems !== undefined && ++n >= opts.maxItems)
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
await pages.return(undefined);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export function splitOptions(o) {
|
|
66
|
+
const { maxPages, maxItems, ...rest } = o ?? {};
|
|
67
|
+
const paging = {};
|
|
68
|
+
if (maxPages !== undefined)
|
|
69
|
+
paging.maxPages = maxPages;
|
|
70
|
+
if (maxItems !== undefined)
|
|
71
|
+
paging.maxItems = maxItems;
|
|
72
|
+
return [rest, paging];
|
|
73
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { APIPromise } from '../api-promise.js';
|
|
2
|
+
import { type CsvPage } from '../csv.js';
|
|
3
|
+
import type { RequestOptions } from '../transport.js';
|
|
4
|
+
import type { Hook, HookList, HooksListQuery, PagingOptions } from '../types.js';
|
|
5
|
+
import { Resource } from './base.js';
|
|
6
|
+
/**
|
|
7
|
+
* Deepest row an all-chains hooks page may reach (`page` × `limit`). The API refuses a deeper page with a 400 and
|
|
8
|
+
* still says `hasMore: true` on the last page it allows, so the iterators stop at the cap. Pass `chainId` to page
|
|
9
|
+
* one chain further.
|
|
10
|
+
*/
|
|
11
|
+
export declare const HOOKS_ALL_CHAINS_MAX_ROWS = 1000;
|
|
12
|
+
export declare class Hooks extends Resource {
|
|
13
|
+
/** `GET /v1/hooks`: Uniswap v4 hooks with the TVL, volume and fees of their pools. */
|
|
14
|
+
list(query?: HooksListQuery, options?: RequestOptions): APIPromise<HookList>;
|
|
15
|
+
/**
|
|
16
|
+
* Every page of `list`, fetched as you iterate. Without `chainId` it stops at `HOOKS_ALL_CHAINS_MAX_ROWS` (1,000
|
|
17
|
+
* rows deep), the most the API serves across all chains; pass `chainId` to page further.
|
|
18
|
+
*/
|
|
19
|
+
pages(query?: HooksListQuery, options?: RequestOptions & PagingOptions): AsyncGenerator<HookList, void, undefined>;
|
|
20
|
+
/** Every row of `list`, across pages (at most 1,000 without `chainId`). Each page is a metered request; `break` stops fetching. */
|
|
21
|
+
iterate(query?: HooksListQuery, options?: RequestOptions & PagingOptions): AsyncGenerator<Hook, void, undefined>;
|
|
22
|
+
/** One page of `list` as CSV (`format=csv`): same filters, paging and unit cost as JSON. */
|
|
23
|
+
exportCsv(query?: HooksListQuery, options?: RequestOptions): APIPromise<CsvPage>;
|
|
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 & PagingOptions): AsyncGenerator<CsvPage, void, undefined>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { csvHasRows } from '../csv.js';
|
|
2
|
+
import { pageIterator, Resource, rowIterator, splitOptions, toQuery } from './base.js';
|
|
3
|
+
/**
|
|
4
|
+
* Deepest row an all-chains hooks page may reach (`page` × `limit`). The API refuses a deeper page with a 400 and
|
|
5
|
+
* still says `hasMore: true` on the last page it allows, so the iterators stop at the cap. Pass `chainId` to page
|
|
6
|
+
* one chain further.
|
|
7
|
+
*/
|
|
8
|
+
export const HOOKS_ALL_CHAINS_MAX_ROWS = 1_000;
|
|
9
|
+
/** More pages to fetch: the API says so and, across all chains, the next page stays within the cap. */
|
|
10
|
+
function hasMore(query) {
|
|
11
|
+
const allChains = query?.chainId === undefined || query?.chainId === null;
|
|
12
|
+
return (p) => p.pagination.hasMore && (!allChains || (p.pagination.page + 1) * p.pagination.limit <= HOOKS_ALL_CHAINS_MAX_ROWS);
|
|
13
|
+
}
|
|
14
|
+
export class Hooks extends Resource {
|
|
15
|
+
/** `GET /v1/hooks`: Uniswap v4 hooks with the TVL, volume and fees of their pools. */
|
|
16
|
+
list(query, options) {
|
|
17
|
+
return this.call('hooks.list', undefined, toQuery(query), options);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Every page of `list`, fetched as you iterate. Without `chainId` it stops at `HOOKS_ALL_CHAINS_MAX_ROWS` (1,000
|
|
21
|
+
* rows deep), the most the API serves across all chains; pass `chainId` to page further.
|
|
22
|
+
*/
|
|
23
|
+
pages(query, options) {
|
|
24
|
+
const [req, paging] = splitOptions(options);
|
|
25
|
+
return pageIterator(query, (page) => this.list({ ...query, page }, req), hasMore(query), (p) => p.hooks.length, paging);
|
|
26
|
+
}
|
|
27
|
+
/** Every row of `list`, across pages (at most 1,000 without `chainId`). Each page is a metered request; `break` stops fetching. */
|
|
28
|
+
iterate(query, options) {
|
|
29
|
+
const [req, paging] = splitOptions(options);
|
|
30
|
+
const pages = this.pages(query, { ...req, ...(paging.maxPages === undefined ? {} : { maxPages: paging.maxPages }) });
|
|
31
|
+
return rowIterator(pages, (p) => p.hooks, paging);
|
|
32
|
+
}
|
|
33
|
+
/** One page of `list` as CSV (`format=csv`): same filters, paging and unit cost as JSON. */
|
|
34
|
+
exportCsv(query, options) {
|
|
35
|
+
return this.callCsv('hooks.list', toQuery(query), options);
|
|
36
|
+
}
|
|
37
|
+
/** 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. */
|
|
38
|
+
exportCsvPages(query, options) {
|
|
39
|
+
const [req, paging] = splitOptions(options);
|
|
40
|
+
return pageIterator(query, (page) => this.exportCsv({ ...query, page }, req), hasMore(query), (p) => (csvHasRows(p.csv) ? 1 : 0), paging);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { APIPromise } from '../api-promise.js';
|
|
2
|
+
import type { RequestOptions } from '../transport.js';
|
|
3
|
+
import type { Chain, PlanList, Protocol, Stats, UnitCostList } from '../types.js';
|
|
4
|
+
import { Resource } from './base.js';
|
|
5
|
+
/** The free, keyless routes. The key is never sent on them, even when the client has one. */
|
|
6
|
+
export declare class Meta extends Resource {
|
|
7
|
+
/** `GET /v1/chains`: the chains served right now, each with its protocols. The live list of valid `chainId`s. */
|
|
8
|
+
chains(options?: RequestOptions): APIPromise<Chain[]>;
|
|
9
|
+
/** `GET /v1/protocols`: the protocols served and the chains each is live on. */
|
|
10
|
+
protocols(options?: RequestOptions): APIPromise<Protocol[]>;
|
|
11
|
+
/** `GET /v1/plans`: the plans on sale, with monthly units, burst limit and prices. */
|
|
12
|
+
plans(options?: RequestOptions): APIPromise<PlanList>;
|
|
13
|
+
/** `GET /v1/stats`: headline counts of everything indexed. */
|
|
14
|
+
stats(options?: RequestOptions): APIPromise<Stats>;
|
|
15
|
+
}
|
|
16
|
+
/** `tw.pricing`: free, keyless. */
|
|
17
|
+
export declare class Pricing extends Resource {
|
|
18
|
+
/**
|
|
19
|
+
* `GET /v1/pricing/units`: what each metered route costs in units, live. Read prices from here; they can change,
|
|
20
|
+
* so the SDK never hard-codes them.
|
|
21
|
+
*/
|
|
22
|
+
units(options?: RequestOptions): APIPromise<UnitCostList>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Resource } from './base.js';
|
|
2
|
+
/** The free, keyless routes. The key is never sent on them, even when the client has one. */
|
|
3
|
+
export class Meta extends Resource {
|
|
4
|
+
/** `GET /v1/chains`: the chains served right now, each with its protocols. The live list of valid `chainId`s. */
|
|
5
|
+
chains(options) {
|
|
6
|
+
return this.call('chains', undefined, undefined, options);
|
|
7
|
+
}
|
|
8
|
+
/** `GET /v1/protocols`: the protocols served and the chains each is live on. */
|
|
9
|
+
protocols(options) {
|
|
10
|
+
return this.call('protocols', undefined, undefined, options);
|
|
11
|
+
}
|
|
12
|
+
/** `GET /v1/plans`: the plans on sale, with monthly units, burst limit and prices. */
|
|
13
|
+
plans(options) {
|
|
14
|
+
return this.call('plans', undefined, undefined, options);
|
|
15
|
+
}
|
|
16
|
+
/** `GET /v1/stats`: headline counts of everything indexed. */
|
|
17
|
+
stats(options) {
|
|
18
|
+
return this.call('stats', undefined, undefined, options);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** `tw.pricing`: free, keyless. */
|
|
22
|
+
export class Pricing extends Resource {
|
|
23
|
+
/**
|
|
24
|
+
* `GET /v1/pricing/units`: what each metered route costs in units, live. Read prices from here; they can change,
|
|
25
|
+
* so the SDK never hard-codes them.
|
|
26
|
+
*/
|
|
27
|
+
units(options) {
|
|
28
|
+
return this.call('pricing.units', undefined, undefined, options);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { APIPromise } from '../api-promise.js';
|
|
2
|
+
import { type CsvPage } from '../csv.js';
|
|
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';
|
|
5
|
+
import { Resource } from './base.js';
|
|
6
|
+
export declare class Pools extends Resource {
|
|
7
|
+
/** `GET /v1/pools`: a ranked, filtered page of pools. */
|
|
8
|
+
list<Q extends PoolsListQuery = PoolsListQuery>(query?: Q, options?: RequestOptions): APIPromise<WithRows<PoolList, 'pools', Q>>;
|
|
9
|
+
/** Every page of `list`, fetched as you iterate. Starts at `query.page` (default 1). */
|
|
10
|
+
pages<Q extends PoolsListQuery = PoolsListQuery>(query?: Q, options?: RequestOptions & PagingOptions): AsyncGenerator<WithRows<PoolList, 'pools', Q>, void, undefined>;
|
|
11
|
+
/** Every row of `list`, across pages. Each page is a metered request; `break` stops fetching. */
|
|
12
|
+
iterate<Q extends PoolsListQuery = PoolsListQuery>(query?: Q, options?: RequestOptions & PagingOptions): AsyncGenerator<RowOf<Pool, Q>, void, undefined>;
|
|
13
|
+
/** `GET /v1/pools/{chainId}/{protocol}/{poolId}`: one pool. */
|
|
14
|
+
get<Q extends PoolDetailQuery = PoolDetailQuery>(chainId: number, protocol: ProtocolKey, poolId: string, query?: Q, options?: RequestOptions): APIPromise<Shaped<PoolDetail, Q>>;
|
|
15
|
+
/** `GET .../charts`: the pool's time series (`range`: 30d, 60d, 90d, 180d, all). */
|
|
16
|
+
charts<Q extends PoolChartsQuery = PoolChartsQuery>(chainId: number, protocol: ProtocolKey, poolId: string, query?: Q, options?: RequestOptions): APIPromise<Shaped<Charts, Q>>;
|
|
17
|
+
/** One page of `list` as CSV (`format=csv`): same filters, paging and unit cost as JSON. */
|
|
18
|
+
exportCsv(query?: PoolsListQuery, options?: RequestOptions): APIPromise<CsvPage>;
|
|
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 & PagingOptions): AsyncGenerator<CsvPage, void, undefined>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { csvHasRows } from '../csv.js';
|
|
2
|
+
import { pageIterator, Resource, rowIterator, splitOptions, toQuery } from './base.js';
|
|
3
|
+
export class Pools extends Resource {
|
|
4
|
+
/** `GET /v1/pools`: a ranked, filtered page of pools. */
|
|
5
|
+
list(query, options) {
|
|
6
|
+
return this.call('pools.list', undefined, toQuery(query), options);
|
|
7
|
+
}
|
|
8
|
+
/** Every page of `list`, fetched as you iterate. Starts at `query.page` (default 1). */
|
|
9
|
+
pages(query, options) {
|
|
10
|
+
const [req, paging] = splitOptions(options);
|
|
11
|
+
return pageIterator(query, (page) => this.list({ ...query, page }, req), (p) => p.pagination.hasMore, (p) => p.pools.length, paging);
|
|
12
|
+
}
|
|
13
|
+
/** Every row of `list`, across pages. Each page is a metered request; `break` stops fetching. */
|
|
14
|
+
iterate(query, options) {
|
|
15
|
+
const [req, paging] = splitOptions(options);
|
|
16
|
+
const pages = this.pages(query, { ...req, ...(paging.maxPages === undefined ? {} : { maxPages: paging.maxPages }) });
|
|
17
|
+
return rowIterator(pages, (p) => p.pools, paging);
|
|
18
|
+
}
|
|
19
|
+
/** `GET /v1/pools/{chainId}/{protocol}/{poolId}`: one pool. */
|
|
20
|
+
get(chainId, protocol, poolId, query, options) {
|
|
21
|
+
return this.call('pools.detail', { chainId, protocol, poolId }, toQuery(query), options);
|
|
22
|
+
}
|
|
23
|
+
/** `GET .../charts`: the pool's time series (`range`: 30d, 60d, 90d, 180d, all). */
|
|
24
|
+
charts(chainId, protocol, poolId, query, options) {
|
|
25
|
+
return this.call('pools.charts', { chainId, protocol, poolId }, toQuery(query), options);
|
|
26
|
+
}
|
|
27
|
+
/** One page of `list` as CSV (`format=csv`): same filters, paging and unit cost as JSON. */
|
|
28
|
+
exportCsv(query, options) {
|
|
29
|
+
return this.callCsv('pools.list', toQuery(query), options);
|
|
30
|
+
}
|
|
31
|
+
/** Every page of `list` as CSV, each with its own header row. Each page is a metered request. */
|
|
32
|
+
exportCsvPages(query, options) {
|
|
33
|
+
const [req, paging] = splitOptions(options);
|
|
34
|
+
return pageIterator(query, (page) => this.exportCsv({ ...query, page }, req), (p) => p.pagination.hasMore, (p) => (csvHasRows(p.csv) ? 1 : 0), paging);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { APIPromise } from '../api-promise.js';
|
|
2
|
+
import { type CsvPage } from '../csv.js';
|
|
3
|
+
import type { RequestOptions } from '../transport.js';
|
|
4
|
+
import type { PagingOptions, Position, PositionBatch, PositionChartsQuery, PositionDetail, PositionDetailQuery, PositionId, PositionList, PositionsBatchQuery, PositionsListQuery, PositionTransactionsQuery, ProtocolKey, RowOf, Shaped, Charts, Transaction, TransactionsPage, WithRows } from '../types.js';
|
|
5
|
+
import { Resource } from './base.js';
|
|
6
|
+
/** Most ids one `GET /v1/positions/batch` call takes. */
|
|
7
|
+
export declare const POSITION_BATCH_MAX = 100;
|
|
8
|
+
export declare class Positions extends Resource {
|
|
9
|
+
/**
|
|
10
|
+
* `GET /v1/positions`: a ranked, filtered page of positions. The defaults hide closed, risky and small-pool
|
|
11
|
+
* positions; for everything a wallet holds pass `{ owner, status: 'all', minValueUsd: 0, minPoolTvl: 0, includeRisky: true }`.
|
|
12
|
+
*/
|
|
13
|
+
list<Q extends PositionsListQuery = PositionsListQuery>(query?: Q, options?: RequestOptions): APIPromise<WithRows<PositionList, 'positions', Q>>;
|
|
14
|
+
/** Every page of `list`, one request per page, fetched as you iterate. Starts at `query.page` (default 1). */
|
|
15
|
+
pages<Q extends PositionsListQuery = PositionsListQuery>(query?: Q, options?: RequestOptions & PagingOptions): AsyncGenerator<WithRows<PositionList, 'positions', Q>, void, undefined>;
|
|
16
|
+
/** Every row of `list`, across pages. Each page is a metered request; `break` stops fetching. */
|
|
17
|
+
iterate<Q extends PositionsListQuery = PositionsListQuery>(query?: Q, options?: RequestOptions & PagingOptions): AsyncGenerator<RowOf<Position, Q>, void, undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* `GET /v1/positions/batch`: up to 100 positions of one chain and protocol in one call, in the order of `ids`
|
|
20
|
+
* (duplicates dropped); ids not found are listed in `missing`. Priced per position returned
|
|
21
|
+
* (`.withMeta()` → `meta.unitsCharged`).
|
|
22
|
+
*/
|
|
23
|
+
batch<Q extends PositionsBatchQuery>(query: Q, options?: RequestOptions): APIPromise<WithRows<PositionBatch, 'positions', Q>>;
|
|
24
|
+
/**
|
|
25
|
+
* Any number of ids: `batch` calls of 100, one after another, merged in order. Costs exactly what the separate
|
|
26
|
+
* calls cost (the batch is priced per position). `.withMeta()` gives the last call's metadata with
|
|
27
|
+
* `unitsCharged` and `retries` summed over all calls.
|
|
28
|
+
*/
|
|
29
|
+
batchAll<Q extends PositionsBatchQuery>(query: Q, options?: RequestOptions): APIPromise<WithRows<PositionBatch, 'positions', Q>>;
|
|
30
|
+
/** `GET /v1/positions/{chainId}/{protocol}/{positionId}`: one position, with its transactions. */
|
|
31
|
+
get<Q extends PositionDetailQuery = PositionDetailQuery>(chainId: number, protocol: ProtocolKey, positionId: PositionId, query?: Q, options?: RequestOptions): APIPromise<Shaped<PositionDetail, Q>>;
|
|
32
|
+
/** `GET .../transactions`: one page of a position's transactions, newest first. */
|
|
33
|
+
transactions<Q extends PositionTransactionsQuery = PositionTransactionsQuery>(chainId: number, protocol: ProtocolKey, positionId: PositionId, query?: Q, options?: RequestOptions): APIPromise<WithRows<TransactionsPage, 'transactions', Q>>;
|
|
34
|
+
/**
|
|
35
|
+
* Every transaction of a position, newest first, following the cursor (`transactionsNextCursor` → `before`).
|
|
36
|
+
* Each page is a metered request.
|
|
37
|
+
*/
|
|
38
|
+
iterateTransactions<Q extends PositionTransactionsQuery = PositionTransactionsQuery>(chainId: number, protocol: ProtocolKey, positionId: PositionId, query?: Q, options?: RequestOptions & PagingOptions): AsyncGenerator<RowOf<Transaction, Q>, void, undefined>;
|
|
39
|
+
/** `GET .../charts`: the position's and its pool's time series (`range`: 30d, 60d, 90d, 180d, all). */
|
|
40
|
+
charts<Q extends PositionChartsQuery = PositionChartsQuery>(chainId: number, protocol: ProtocolKey, positionId: PositionId, query?: Q, options?: RequestOptions): APIPromise<Shaped<Charts, Q>>;
|
|
41
|
+
/** One page of `list` as CSV (`format=csv`): same filters, paging and unit cost as JSON. */
|
|
42
|
+
exportCsv(query?: PositionsListQuery, options?: RequestOptions): APIPromise<CsvPage>;
|
|
43
|
+
/** Every page of `list` as CSV, each with its own header row. Each page is a metered request. */
|
|
44
|
+
exportCsvPages(query?: PositionsListQuery, options?: RequestOptions & PagingOptions): AsyncGenerator<CsvPage, void, undefined>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { APIPromise } from '../api-promise.js';
|
|
2
|
+
import { csvHasRows } from '../csv.js';
|
|
3
|
+
import { pageIterator, Resource, rowIterator, splitOptions, toQuery } from './base.js';
|
|
4
|
+
/** Most ids one `GET /v1/positions/batch` call takes. */
|
|
5
|
+
export const POSITION_BATCH_MAX = 100;
|
|
6
|
+
function idList(ids) {
|
|
7
|
+
const raw = typeof ids === 'string' ? ids.split(',') : ids.map(String);
|
|
8
|
+
const seen = new Set();
|
|
9
|
+
const out = [];
|
|
10
|
+
for (const id of raw.map((s) => s.trim()).filter(Boolean)) {
|
|
11
|
+
if (!seen.has(id)) {
|
|
12
|
+
seen.add(id);
|
|
13
|
+
out.push(id);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
export class Positions extends Resource {
|
|
19
|
+
/**
|
|
20
|
+
* `GET /v1/positions`: a ranked, filtered page of positions. The defaults hide closed, risky and small-pool
|
|
21
|
+
* positions; for everything a wallet holds pass `{ owner, status: 'all', minValueUsd: 0, minPoolTvl: 0, includeRisky: true }`.
|
|
22
|
+
*/
|
|
23
|
+
list(query, options) {
|
|
24
|
+
return this.call('positions.list', undefined, toQuery(query), options);
|
|
25
|
+
}
|
|
26
|
+
/** Every page of `list`, one request per page, fetched as you iterate. Starts at `query.page` (default 1). */
|
|
27
|
+
pages(query, options) {
|
|
28
|
+
const [req, paging] = splitOptions(options);
|
|
29
|
+
return pageIterator(query, (page) => this.list({ ...query, page }, req), (p) => p.pagination.hasMore, (p) => p.positions.length, paging);
|
|
30
|
+
}
|
|
31
|
+
/** Every row of `list`, across pages. Each page is a metered request; `break` stops fetching. */
|
|
32
|
+
iterate(query, options) {
|
|
33
|
+
const [req, paging] = splitOptions(options);
|
|
34
|
+
const pages = this.pages(query, { ...req, ...(paging.maxPages === undefined ? {} : { maxPages: paging.maxPages }) });
|
|
35
|
+
return rowIterator(pages, (p) => p.positions, paging);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* `GET /v1/positions/batch`: up to 100 positions of one chain and protocol in one call, in the order of `ids`
|
|
39
|
+
* (duplicates dropped); ids not found are listed in `missing`. Priced per position returned
|
|
40
|
+
* (`.withMeta()` → `meta.unitsCharged`).
|
|
41
|
+
*/
|
|
42
|
+
batch(query, options) {
|
|
43
|
+
const ids = idList(query.ids);
|
|
44
|
+
if (ids.length === 0)
|
|
45
|
+
return new APIPromise(Promise.reject(new TypeError('positions.batch: `ids` is empty')));
|
|
46
|
+
return this.call('positions.batch', undefined, toQuery(query, { ids: ids.join(',') }), options);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Any number of ids: `batch` calls of 100, one after another, merged in order. Costs exactly what the separate
|
|
50
|
+
* calls cost (the batch is priced per position). `.withMeta()` gives the last call's metadata with
|
|
51
|
+
* `unitsCharged` and `retries` summed over all calls.
|
|
52
|
+
*/
|
|
53
|
+
batchAll(query, options) {
|
|
54
|
+
const ids = idList(query.ids);
|
|
55
|
+
if (ids.length === 0)
|
|
56
|
+
return new APIPromise(Promise.reject(new TypeError('positions.batchAll: `ids` is empty')));
|
|
57
|
+
const run = async () => {
|
|
58
|
+
let merged;
|
|
59
|
+
let meta;
|
|
60
|
+
let units = 0;
|
|
61
|
+
let unitsKnown = true;
|
|
62
|
+
let retries = 0;
|
|
63
|
+
for (let i = 0; i < ids.length; i += POSITION_BATCH_MAX) {
|
|
64
|
+
const chunk = ids.slice(i, i + POSITION_BATCH_MAX);
|
|
65
|
+
const r = await this.batch({ ...query, ids: chunk }, options).withMeta();
|
|
66
|
+
const data = r.data;
|
|
67
|
+
if (merged === undefined) {
|
|
68
|
+
merged = { ...data, positions: [...data.positions], missing: [...data.missing] };
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
merged.positions.push(...data.positions);
|
|
72
|
+
merged.missing.push(...data.missing);
|
|
73
|
+
}
|
|
74
|
+
if (r.meta.unitsCharged === undefined)
|
|
75
|
+
unitsKnown = false;
|
|
76
|
+
else
|
|
77
|
+
units += r.meta.unitsCharged;
|
|
78
|
+
retries += r.meta.retries;
|
|
79
|
+
meta = r.meta;
|
|
80
|
+
}
|
|
81
|
+
return { data: merged, meta: { ...meta, unitsCharged: unitsKnown ? units : undefined, retries } };
|
|
82
|
+
};
|
|
83
|
+
return new APIPromise(run());
|
|
84
|
+
}
|
|
85
|
+
/** `GET /v1/positions/{chainId}/{protocol}/{positionId}`: one position, with its transactions. */
|
|
86
|
+
get(chainId, protocol, positionId, query, options) {
|
|
87
|
+
return this.call('positions.detail', { chainId, protocol, positionId }, toQuery(query), options);
|
|
88
|
+
}
|
|
89
|
+
/** `GET .../transactions`: one page of a position's transactions, newest first. */
|
|
90
|
+
transactions(chainId, protocol, positionId, query, options) {
|
|
91
|
+
return this.call('positions.transactions', { chainId, protocol, positionId }, toQuery(query), options);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Every transaction of a position, newest first, following the cursor (`transactionsNextCursor` → `before`).
|
|
95
|
+
* Each page is a metered request.
|
|
96
|
+
*/
|
|
97
|
+
async *iterateTransactions(chainId, protocol, positionId, query, options) {
|
|
98
|
+
const [req, paging] = splitOptions(options);
|
|
99
|
+
if (paging.maxItems !== undefined && paging.maxItems <= 0)
|
|
100
|
+
return;
|
|
101
|
+
let before = query?.before;
|
|
102
|
+
let items = 0;
|
|
103
|
+
for (let n = 0; paging.maxPages === undefined || n < paging.maxPages; n++) {
|
|
104
|
+
const page = (await this.transactions(chainId, protocol, positionId, { ...query, before }, req));
|
|
105
|
+
for (const t of page.transactions) {
|
|
106
|
+
yield t;
|
|
107
|
+
if (paging.maxItems !== undefined && ++items >= paging.maxItems)
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const next = page.transactionsNextCursor;
|
|
111
|
+
if (!next || page.transactions.length === 0 || next === before)
|
|
112
|
+
return;
|
|
113
|
+
before = next;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** `GET .../charts`: the position's and its pool's time series (`range`: 30d, 60d, 90d, 180d, all). */
|
|
117
|
+
charts(chainId, protocol, positionId, query, options) {
|
|
118
|
+
return this.call('positions.charts', { chainId, protocol, positionId }, toQuery(query), options);
|
|
119
|
+
}
|
|
120
|
+
/** One page of `list` as CSV (`format=csv`): same filters, paging and unit cost as JSON. */
|
|
121
|
+
exportCsv(query, options) {
|
|
122
|
+
return this.callCsv('positions.list', toQuery(query), options);
|
|
123
|
+
}
|
|
124
|
+
/** Every page of `list` as CSV, each with its own header row. Each page is a metered request. */
|
|
125
|
+
exportCsvPages(query, options) {
|
|
126
|
+
const [req, paging] = splitOptions(options);
|
|
127
|
+
return pageIterator(query, (page) => this.exportCsv({ ...query, page }, req), (p) => p.pagination.hasMore, (p) => (csvHasRows(p.csv) ? 1 : 0), paging);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { APIPromise } from '../api-promise.js';
|
|
2
|
+
import type { RequestOptions } from '../transport.js';
|
|
3
|
+
import type { PagingOptions, Pool, RowOf, TokenLookup, TokenQuery, WithRows } from '../types.js';
|
|
4
|
+
import { Resource } from './base.js';
|
|
5
|
+
export declare class Tokens extends Resource {
|
|
6
|
+
/**
|
|
7
|
+
* `GET /v1/tokens/{chainId}/{address}`: one token's USD price and where it came from, what the API knows about
|
|
8
|
+
* it, its risk flags, and a page of the pools holding it. The chain's native token is the zero address.
|
|
9
|
+
*/
|
|
10
|
+
get<Q extends TokenQuery = TokenQuery>(chainId: number, address: string, query?: Q, options?: RequestOptions): APIPromise<WithRows<TokenLookup, 'pools', Q>>;
|
|
11
|
+
/** Every pool holding the token, across pages. Each page is a metered request; `break` stops fetching. */
|
|
12
|
+
iteratePools<Q extends TokenQuery = TokenQuery>(chainId: number, address: string, query?: Q, options?: RequestOptions & PagingOptions): AsyncGenerator<RowOf<Pool, Q>, void, undefined>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { pageIterator, Resource, rowIterator, splitOptions, toQuery } from './base.js';
|
|
2
|
+
export class Tokens extends Resource {
|
|
3
|
+
/**
|
|
4
|
+
* `GET /v1/tokens/{chainId}/{address}`: one token's USD price and where it came from, what the API knows about
|
|
5
|
+
* it, its risk flags, and a page of the pools holding it. The chain's native token is the zero address.
|
|
6
|
+
*/
|
|
7
|
+
get(chainId, address, query, options) {
|
|
8
|
+
return this.call('tokens.detail', { chainId, address }, toQuery(query), options);
|
|
9
|
+
}
|
|
10
|
+
/** Every pool holding the token, across pages. Each page is a metered request; `break` stops fetching. */
|
|
11
|
+
iteratePools(chainId, address, query, options) {
|
|
12
|
+
const [req, paging] = splitOptions(options);
|
|
13
|
+
const pages = pageIterator(query, (page) => this.get(chainId, address, { ...query, page }, req), (p) => p.pagination.hasMore, (p) => p.pools.length, paging.maxPages === undefined ? {} : { maxPages: paging.maxPages });
|
|
14
|
+
return rowIterator(pages, (p) => p.pools, paging);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { APIPromise } from '../api-promise.js';
|
|
2
|
+
import type { RequestOptions } from '../transport.js';
|
|
3
|
+
import type { WalletSummary, WalletSummaryQuery } from '../types.js';
|
|
4
|
+
import { Resource } from './base.js';
|
|
5
|
+
export declare class Wallets extends Resource {
|
|
6
|
+
/**
|
|
7
|
+
* `GET /v1/wallets/{address}`: one wallet's positions summed across every chain (or one `chainId`): value,
|
|
8
|
+
* uncollected fees, PnL and counts, in total and per chain. A wallet with no positions is zeros, not a 404.
|
|
9
|
+
*/
|
|
10
|
+
summary(address: string, query?: WalletSummaryQuery, options?: RequestOptions): APIPromise<WalletSummary>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Resource, toQuery } from './base.js';
|
|
2
|
+
export class Wallets extends Resource {
|
|
3
|
+
/**
|
|
4
|
+
* `GET /v1/wallets/{address}`: one wallet's positions summed across every chain (or one `chainId`): value,
|
|
5
|
+
* uncollected fees, PnL and counts, in total and per chain. A wallet with no positions is zeros, not a 404.
|
|
6
|
+
*/
|
|
7
|
+
summary(address, query, options) {
|
|
8
|
+
return this.call('wallets.summary', { address }, toQuery(query), options);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { paths } from './generated/openapi.js';
|
|
2
|
+
export interface Route {
|
|
3
|
+
/** The OpenAPI path template. */
|
|
4
|
+
readonly path: keyof paths;
|
|
5
|
+
/** Metered routes need the key and cost units; free routes never send it. */
|
|
6
|
+
readonly metered: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Every `/v1` operation the SDK calls, keyed by the spec's `operationId`. `test/route-coverage.spec.ts` holds this
|
|
10
|
+
* to `openapi.json` both ways, so a route added to the API without an SDK method fails the build.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ROUTES: {
|
|
13
|
+
readonly 'positions.list': {
|
|
14
|
+
readonly path: "/v1/positions";
|
|
15
|
+
readonly metered: true;
|
|
16
|
+
};
|
|
17
|
+
readonly 'positions.batch': {
|
|
18
|
+
readonly path: "/v1/positions/batch";
|
|
19
|
+
readonly metered: true;
|
|
20
|
+
};
|
|
21
|
+
readonly 'positions.detail': {
|
|
22
|
+
readonly path: "/v1/positions/{chainId}/{protocol}/{positionId}";
|
|
23
|
+
readonly metered: true;
|
|
24
|
+
};
|
|
25
|
+
readonly 'positions.transactions': {
|
|
26
|
+
readonly path: "/v1/positions/{chainId}/{protocol}/{positionId}/transactions";
|
|
27
|
+
readonly metered: true;
|
|
28
|
+
};
|
|
29
|
+
readonly 'positions.charts': {
|
|
30
|
+
readonly path: "/v1/positions/{chainId}/{protocol}/{positionId}/charts";
|
|
31
|
+
readonly metered: true;
|
|
32
|
+
};
|
|
33
|
+
readonly 'pools.list': {
|
|
34
|
+
readonly path: "/v1/pools";
|
|
35
|
+
readonly metered: true;
|
|
36
|
+
};
|
|
37
|
+
readonly 'pools.detail': {
|
|
38
|
+
readonly path: "/v1/pools/{chainId}/{protocol}/{poolId}";
|
|
39
|
+
readonly metered: true;
|
|
40
|
+
};
|
|
41
|
+
readonly 'pools.charts': {
|
|
42
|
+
readonly path: "/v1/pools/{chainId}/{protocol}/{poolId}/charts";
|
|
43
|
+
readonly metered: true;
|
|
44
|
+
};
|
|
45
|
+
readonly 'tokens.detail': {
|
|
46
|
+
readonly path: "/v1/tokens/{chainId}/{address}";
|
|
47
|
+
readonly metered: true;
|
|
48
|
+
};
|
|
49
|
+
readonly 'wallets.summary': {
|
|
50
|
+
readonly path: "/v1/wallets/{address}";
|
|
51
|
+
readonly metered: true;
|
|
52
|
+
};
|
|
53
|
+
readonly 'hooks.list': {
|
|
54
|
+
readonly path: "/v1/hooks";
|
|
55
|
+
readonly metered: true;
|
|
56
|
+
};
|
|
57
|
+
readonly chains: {
|
|
58
|
+
readonly path: "/v1/chains";
|
|
59
|
+
readonly metered: false;
|
|
60
|
+
};
|
|
61
|
+
readonly protocols: {
|
|
62
|
+
readonly path: "/v1/protocols";
|
|
63
|
+
readonly metered: false;
|
|
64
|
+
};
|
|
65
|
+
readonly plans: {
|
|
66
|
+
readonly path: "/v1/plans";
|
|
67
|
+
readonly metered: false;
|
|
68
|
+
};
|
|
69
|
+
readonly 'pricing.units': {
|
|
70
|
+
readonly path: "/v1/pricing/units";
|
|
71
|
+
readonly metered: false;
|
|
72
|
+
};
|
|
73
|
+
readonly stats: {
|
|
74
|
+
readonly path: "/v1/stats";
|
|
75
|
+
readonly metered: false;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export type OperationId = keyof typeof ROUTES;
|
|
79
|
+
/** Fills a path template: `{name}` → the encoded value. */
|
|
80
|
+
export declare function fillPath(op: OperationId, params?: Readonly<Record<string, string | number | bigint>>): string;
|