@floorlaunchpad/sdk 0.3.1 → 0.4.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/CHANGELOG.md +97 -0
- package/README.md +20 -5
- package/dist/abi/evm.gen.js +1 -1
- package/dist/abi/solana.gen.js +1 -1
- package/dist/client/evm/index.js +16 -2
- package/dist/client/solana/index.js +19 -7
- package/dist/config/generated.js +26864 -402
- package/dist/config/registry.gen.js +33 -2
- package/dist/evm/chains.js +9 -1
- package/dist/evm/floor/abi.gen.js +1 -1
- package/dist/evm/floor/events.js +9 -1
- package/dist/evm/floor/legacy-events.js +25 -0
- package/dist/indexer/bodies.js +106 -16
- package/dist/indexer/client.js +35 -12
- package/dist/indexer/contract.js +138 -28
- package/dist/indexer/partners.js +3 -2
- package/dist/indexer/paths.js +63 -25
- package/dist/indexer/read.js +38 -13
- package/dist/indexer/search.js +130 -0
- package/dist/indexer/stack-edge.js +35 -0
- package/dist/indexer/stream.js +70 -23
- package/dist/math/v2/split.js +11 -3
- package/dist/solana/floor/events.js +1 -1
- package/dist/solana/floor/genesis.js +9 -3
- package/dist/solana/floor/instructions.js +14 -5
- package/dist/solana/floor/registry.js +4 -0
- package/dist/v2/devbuy.js +15 -0
- package/dist/v2/solana.js +17 -2
- package/dist/v2/tx/solana.js +1 -1
- package/docs/bot.md +36 -1
- package/docs/cursor-pages.md +56 -0
- package/docs/floor-line.md +208 -34
- package/examples/floor-line.html +373 -76
- package/package.json +1 -1
- package/src/abi/evm.gen.ts +1 -1
- package/src/abi/solana.gen.ts +1 -1
- package/src/client/evm/index.ts +16 -2
- package/src/client/solana/index.ts +19 -7
- package/src/client/types.ts +1 -1
- package/src/config/generated.ts +26864 -402
- package/src/config/index.ts +9 -2
- package/src/config/registry.gen.ts +33 -2
- package/src/events/types.gen.ts +2 -1
- package/src/evm/chains.ts +9 -1
- package/src/evm/floor/abi.gen.ts +1 -1
- package/src/evm/floor/events.ts +11 -1
- package/src/evm/floor/legacy-events.ts +27 -0
- package/src/indexer/bodies.ts +117 -16
- package/src/indexer/client.ts +54 -26
- package/src/indexer/contract.ts +158 -30
- package/src/indexer/partners.ts +3 -2
- package/src/indexer/paths.ts +86 -25
- package/src/indexer/read.ts +44 -15
- package/src/indexer/search.ts +138 -0
- package/src/indexer/stack-edge.ts +46 -0
- package/src/indexer/stream.ts +78 -24
- package/src/math/v2/split.ts +11 -3
- package/src/solana/floor/events.ts +1 -1
- package/src/solana/floor/genesis.ts +8 -2
- package/src/solana/floor/instructions.ts +13 -5
- package/src/solana/floor/registry.ts +4 -0
- package/src/v2/devbuy.ts +33 -0
- package/src/v2/solana.ts +20 -3
- package/src/v2/tx/solana.ts +1 -1
package/src/indexer/contract.ts
CHANGED
|
@@ -4,7 +4,8 @@ import type { Decoder } from "./decode.ts";
|
|
|
4
4
|
import { unknown } from "./decode.ts";
|
|
5
5
|
import * as B from "./bodies.ts";
|
|
6
6
|
import * as P from "./partners.ts";
|
|
7
|
-
import { FIRSTS_MAX, IDS_MAX, LAUNCHES_PAGE_MAX, LAUNCH_SORTS, STREAM_STATE_MAX } from "./paths.ts";
|
|
7
|
+
import { FIRSTS_MAX, IDS_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PRESET_FILTER_MAX, STREAM_STATE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX } from "./paths.ts";
|
|
8
|
+
import { SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX, SEARCH_Q_MAX } from "./search.ts";
|
|
8
9
|
|
|
9
10
|
export const UNITS = {
|
|
10
11
|
site: "raw quote base units, token math units (6 dp), Q64.64 prices, unix s; bigint as decimal strings; USD as decimal strings",
|
|
@@ -68,6 +69,8 @@ export interface QueryKey {
|
|
|
68
69
|
readonly values?: readonly string[];
|
|
69
70
|
readonly min?: number;
|
|
70
71
|
readonly max?: number;
|
|
72
|
+
readonly item?: { readonly kind: "int"; readonly min: number; readonly max: number };
|
|
73
|
+
readonly without?: readonly string[];
|
|
71
74
|
readonly default?: string | number;
|
|
72
75
|
readonly required?: boolean;
|
|
73
76
|
}
|
|
@@ -79,11 +82,27 @@ export type Pagination =
|
|
|
79
82
|
|
|
80
83
|
| { readonly kind: "offset"; readonly limit: { readonly default: number; readonly max: number }; readonly total: "total" }
|
|
81
84
|
|
|
82
|
-
| {
|
|
85
|
+
| {
|
|
86
|
+
readonly kind: "cursor";
|
|
87
|
+
readonly limit: { readonly default: number; readonly max: number };
|
|
88
|
+
readonly cursor: "before";
|
|
89
|
+
readonly next: "next";
|
|
90
|
+
|
|
91
|
+
readonly optIn?: { readonly default: number; readonly max: number };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
| {
|
|
95
|
+
readonly kind: "keyset";
|
|
96
|
+
readonly limit: { readonly default: number; readonly max: number };
|
|
97
|
+
readonly cursor: "cursor";
|
|
98
|
+
readonly next: "next";
|
|
99
|
+
|
|
100
|
+
readonly optIn?: true;
|
|
101
|
+
}
|
|
83
102
|
|
|
84
103
|
| { readonly kind: "range"; readonly from: string; readonly to: string; readonly span?: { readonly interval: string; readonly max: number } };
|
|
85
104
|
|
|
86
|
-
export type PathParam = "launch" | "wallet" | "token";
|
|
105
|
+
export type PathParam = "launch" | "wallet" | "token" | "handle";
|
|
87
106
|
|
|
88
107
|
export interface RouteContract<T = unknown> {
|
|
89
108
|
readonly pattern: string;
|
|
@@ -107,6 +126,15 @@ const limit = (dflt: number, max: number) => ({ kind: "limit", limit: { default:
|
|
|
107
126
|
const cursor = (dflt: number, max: number) => ({ kind: "cursor", limit: { default: dflt, max }, cursor: "before", next: "next" }) as const;
|
|
108
127
|
const LIMIT = (dflt: number, max: number): QueryKey => ({ kind: "int", doc: "rows", min: 1, max, default: dflt });
|
|
109
128
|
const BEFORE: QueryKey = { kind: "cursor", doc: "a block, or a row id <block>:<txnIndex>:<eventIndex> (a page's next): rows strictly before it" };
|
|
129
|
+
const keyset = (dflt: number, max: number) => ({ kind: "keyset", limit: { default: dflt, max }, cursor: "cursor", next: "next" }) as const;
|
|
130
|
+
const PRESETS: QueryKey = { kind: "list", doc: "only launches of these presets (ids 0..255)", max: PRESET_FILTER_MAX, item: { kind: "int", min: 0, max: 255 } } as const;
|
|
131
|
+
|
|
132
|
+
const WALLET_PAGE = { kind: "keyset", limit: { default: WALLET_PAGE_DEFAULT, max: WALLET_PAGE_MAX }, cursor: "cursor", next: "next", optIn: true } as const;
|
|
133
|
+
const WALLET_PAGE_KEYS = (cursorDoc: string): Record<string, QueryKey> => ({
|
|
134
|
+
limit: { kind: "int", doc: "rows (asks a page)", min: 1, max: WALLET_PAGE_MAX, default: WALLET_PAGE_DEFAULT },
|
|
135
|
+
cursor: { kind: "string", doc: `a page's next (asks a page): ${cursorDoc}`, max: WALLET_CURSOR_MAX },
|
|
136
|
+
});
|
|
137
|
+
const KEYSET_CURSOR = (without: readonly string[]): QueryKey => ({ kind: "string", doc: "a page's next: the rows after its last one (opaque)", max: LAUNCH_CURSOR_MAX, ...(without.length > 0 ? { without } : {}) });
|
|
110
138
|
const WINDOW: QueryKey = { kind: "enum", doc: "the volume window", values: B.TRADER_WINDOWS, default: "24h" };
|
|
111
139
|
|
|
112
140
|
const GATED = ["not_ready", "upstream"] as const;
|
|
@@ -116,7 +144,7 @@ const WALLET_ERR = [...GATED, "bad_query"] as const;
|
|
|
116
144
|
type Spec<T> = Omit<RouteContract<T>, "aliases" | "mount" | "params" | "query" | "page" | "errors" | "gated" | "units" | "audience"> & Partial<RouteContract<T>>;
|
|
117
145
|
|
|
118
146
|
function site<T>(s: Spec<T> & { v2?: boolean }): RouteContract<T> {
|
|
119
|
-
const params = [...s.pattern.matchAll(/<(launch|wallet|token)>/g)].map((m) => m[1] as PathParam);
|
|
147
|
+
const params = [...s.pattern.matchAll(/<(launch|wallet|token|handle)>/g)].map((m) => m[1] as PathParam);
|
|
120
148
|
const { v2, ...rest } = s;
|
|
121
149
|
const aliases = s.aliases ?? (v2 ? [s.pattern.replace(/^\/floor-amm\//, "/floor-amm/v2/")] : []);
|
|
122
150
|
return { mount: "chain", query: {}, page: NONE, errors: GATED, gated: true, units: "site", audience: "site", ...rest, params, aliases };
|
|
@@ -142,7 +170,16 @@ export const INDEXER_CONTRACT = {
|
|
|
142
170
|
}),
|
|
143
171
|
quotes: site({ pattern: "/floor-amm/quotes", body: B.QUOTES }),
|
|
144
172
|
summary: site({ pattern: "/floor-amm/summary", aliases: ["/floor-amm/v2/summary"], body: B.SUMMARY }),
|
|
145
|
-
floorRouted: site({
|
|
173
|
+
floorRouted: site({
|
|
174
|
+
pattern: "/floor-amm/floor-routed",
|
|
175
|
+
aliases: ["/floor-amm/v2/floor-routed"],
|
|
176
|
+
query: {
|
|
177
|
+
limit: LIMIT(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
|
|
178
|
+
cursor: { kind: "string", doc: "a page's next: the launches after this launch id, in create order", max: LAUNCH_CURSOR_MAX },
|
|
179
|
+
},
|
|
180
|
+
page: keyset(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
|
|
181
|
+
body: B.FLOOR_ROUTED,
|
|
182
|
+
}),
|
|
146
183
|
events: site({
|
|
147
184
|
pattern: "/floor-amm/events",
|
|
148
185
|
aliases: ["/events", "/v2/dex/events"],
|
|
@@ -158,19 +195,38 @@ export const INDEXER_CONTRACT = {
|
|
|
158
195
|
query: {
|
|
159
196
|
sort: { kind: "enum", doc: "the order (larger first with order=desc)", values: LAUNCH_SORTS, default: "created" },
|
|
160
197
|
order: { kind: "enum", doc: "asc or desc", values: ["asc", "desc"], default: "desc" },
|
|
161
|
-
q: { kind: "string", doc: "name or symbol contains, or an id, token or creator equals" },
|
|
198
|
+
q: { kind: "string", doc: "name or symbol contains, or an id, token or creator equals", max: SEARCH_Q_MAX },
|
|
162
199
|
ids: { kind: "list", doc: "these launches (ids or tokens), in the order asked without sort", max: IDS_MAX },
|
|
163
200
|
quote: { kind: "string", doc: "launches quoted in this coin" },
|
|
164
201
|
creator: { kind: "string", doc: "launches by this creator" },
|
|
165
202
|
rankable: { kind: "bool", doc: "true (or 1) listed only, false (or 0) unlisted only" },
|
|
166
203
|
graduated: { kind: "bool", doc: "graduated or not (true / false, or 1 / 0)" },
|
|
167
|
-
|
|
168
|
-
|
|
204
|
+
preset: PRESETS,
|
|
205
|
+
limit: LIMIT(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
|
|
206
|
+
cursor: KEYSET_CURSOR(["offset", "ids"]),
|
|
207
|
+
offset: { kind: "int", doc: "rows skipped (with total: an offset page)", min: 0, default: 0 },
|
|
169
208
|
},
|
|
170
|
-
|
|
209
|
+
|
|
210
|
+
page: keyset(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
|
|
171
211
|
errors: [...GATED, "bad_query"],
|
|
172
212
|
body: B.LAUNCHES,
|
|
173
213
|
}),
|
|
214
|
+
search: site({
|
|
215
|
+
pattern: "/floor-amm/search",
|
|
216
|
+
v2: true,
|
|
217
|
+
query: {
|
|
218
|
+
q: { kind: "string", doc: "the search: symbol, name or token (tiers 0-4, search.ts)", required: true, max: SEARCH_Q_MAX },
|
|
219
|
+
limit: LIMIT(SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX),
|
|
220
|
+
cursor: KEYSET_CURSOR([]),
|
|
221
|
+
rankable: { kind: "bool", doc: "true (or 1) listed only, false (or 0) unlisted only" },
|
|
222
|
+
graduated: { kind: "bool", doc: "graduated or not (true / false, or 1 / 0)" },
|
|
223
|
+
quote: { kind: "string", doc: "launches quoted in this coin" },
|
|
224
|
+
preset: PRESETS,
|
|
225
|
+
},
|
|
226
|
+
page: keyset(SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX),
|
|
227
|
+
errors: [...GATED, "bad_query"],
|
|
228
|
+
body: B.LAUNCH_SEARCH,
|
|
229
|
+
}),
|
|
174
230
|
launch: site({ pattern: "/floor-amm/launches/<launch>", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_ONE }),
|
|
175
231
|
launchState: site({ pattern: "/floor-amm/launches/<launch>/state", v2: true, errors: ["not_ready", "unknown_launch"], body: B.LAUNCH_STATE }),
|
|
176
232
|
milestones: site({ pattern: "/floor-amm/launches/<launch>/milestones", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_MILESTONES }),
|
|
@@ -183,12 +239,16 @@ export const INDEXER_CONTRACT = {
|
|
|
183
239
|
errors: [...LAUNCH_ERR, "bad_query"],
|
|
184
240
|
body: B.TRADES,
|
|
185
241
|
}),
|
|
186
|
-
launchClaims: site({ pattern: "/floor-amm/launches/<launch>/claims", v2: true, query: { claimer: { kind: "string", doc: "only this claimer's rows" } }, errors: LAUNCH_ERR, body: B.LAUNCH_CLAIMS }),
|
|
187
|
-
devBuys: site({ pattern: "/floor-amm/launches/<launch>/dev-buys", v2: true, errors: LAUNCH_ERR, body: B.DEV_BUYS }),
|
|
242
|
+
launchClaims: site({ pattern: "/floor-amm/launches/<launch>/claims", v2: true, query: { limit: LIMIT(100, 500), before: BEFORE, claimer: { kind: "string", doc: "only this claimer's rows" } }, page: cursor(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.LAUNCH_CLAIMS }),
|
|
243
|
+
devBuys: site({ pattern: "/floor-amm/launches/<launch>/dev-buys", v2: true, query: { limit: LIMIT(100, 500), before: BEFORE }, page: cursor(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.DEV_BUYS }),
|
|
244
|
+
|
|
245
|
+
memberSold: site({ pattern: "/floor-amm/launches/<launch>/member-sold", v2: true, query: { limit: LIMIT(100, 500), before: BEFORE }, page: cursor(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.MEMBER_SOLD }),
|
|
246
|
+
|
|
247
|
+
launchAccount: site({ pattern: "/floor-amm/launches/<launch>/account", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_ACCOUNT }),
|
|
188
248
|
traders: site({ pattern: "/floor-amm/launches/<launch>/traders", v2: true, query: { window: WINDOW, limit: LIMIT(100, 500) }, page: limit(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.LAUNCH_TRADERS }),
|
|
189
249
|
quoteChain: site({ pattern: "/floor-amm/launches/<launch>/chain", v2: true, errors: LAUNCH_ERR, body: B.QUOTE_CHAIN }),
|
|
190
250
|
devTrades: site({ pattern: "/floor-amm/launches/<launch>/dev", v2: true, query: { limit: LIMIT(100, 500) }, page: limit(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.DEV_TRADES }),
|
|
191
|
-
burns: site({ pattern: "/floor-amm/launches/<launch>/burns", v2: true, errors: LAUNCH_ERR, body: B.BURNS }),
|
|
251
|
+
burns: site({ pattern: "/floor-amm/launches/<launch>/burns", v2: true, query: { limit: LIMIT(100, 500), before: BEFORE }, page: cursor(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.BURNS }),
|
|
192
252
|
launchLocks: site({ pattern: "/floor-amm/launches/<launch>/locks", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_LOCKS }),
|
|
193
253
|
marks: site({
|
|
194
254
|
pattern: "/floor-amm/launches/<launch>/marks",
|
|
@@ -242,15 +302,44 @@ export const INDEXER_CONTRACT = {
|
|
|
242
302
|
errors: [...WALLET_ERR, "unknown_launch"],
|
|
243
303
|
body: B.WALLET_TRADES,
|
|
244
304
|
}),
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
305
|
+
|
|
306
|
+
tonActivity: site({
|
|
307
|
+
pattern: "/floor-amm/wallets/<wallet>/ton-activity",
|
|
308
|
+
query: { limit: LIMIT(100, 200), before: BEFORE },
|
|
309
|
+
page: cursor(100, 200),
|
|
310
|
+
errors: WALLET_ERR,
|
|
311
|
+
body: B.TON_ACTIVITY,
|
|
312
|
+
}),
|
|
313
|
+
tonOutcome: site({
|
|
314
|
+
pattern: "/floor-amm/wallets/<wallet>/ton-outcome",
|
|
315
|
+
query: { queryId: { kind: "string", doc: "the query id (uint64, decimal) the SDK message carried", required: true } },
|
|
316
|
+
errors: WALLET_ERR,
|
|
317
|
+
body: B.TON_OUTCOME,
|
|
318
|
+
}),
|
|
319
|
+
|
|
320
|
+
positions: site({ pattern: "/floor-amm/wallets/<wallet>/positions", v2: true, query: WALLET_PAGE_KEYS("opaque, launch create order"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.POSITIONS }),
|
|
321
|
+
|
|
322
|
+
inbox: site({
|
|
323
|
+
pattern: "/floor-amm/wallets/<wallet>/inbox",
|
|
324
|
+
v2: true,
|
|
325
|
+
query: { limit: LIMIT(1_000, 1_000), before: { kind: "cursor", doc: "asks a page: empty = the newest; a page's next (opaque): items strictly before it" } },
|
|
326
|
+
page: { kind: "cursor", limit: { default: 1_000, max: 1_000 }, cursor: "before", next: "next", optIn: { default: INBOX_PAGE_DEFAULT, max: INBOX_PAGE_MAX } },
|
|
327
|
+
errors: WALLET_ERR,
|
|
328
|
+
body: B.INBOX,
|
|
329
|
+
}),
|
|
330
|
+
walletLocks: site({ pattern: "/floor-amm/wallets/<wallet>/locks", v2: true, query: WALLET_PAGE_KEYS("opaque, launch create order"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.WALLET_LOCKS }),
|
|
331
|
+
claimHistory: site({ pattern: "/floor-amm/wallets/<wallet>/claims", query: WALLET_PAGE_KEYS("opaque, newest first"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.CLAIM_HISTORY }),
|
|
249
332
|
firsts: site({ pattern: "/floor-amm/wallets/<wallet>/firsts", errors: WALLET_ERR, body: B.FIRSTS }),
|
|
250
333
|
firstsMany: site({ pattern: "/floor-amm/wallets/firsts", query: { wallets: { kind: "list", doc: "the wallets", required: true, min: 1, max: FIRSTS_MAX } }, errors: WALLET_ERR, body: B.FIRSTS_MANY }),
|
|
251
|
-
claimView: site({ pattern: "/floor-amm/claims/<wallet>", errors: [...WALLET_ERR, "no_reader"], body: B.CLAIM_VIEW }),
|
|
252
|
-
people: site({ pattern: "/floor-amm/referrals/<wallet>/people", errors: WALLET_ERR, body: B.PEOPLE }),
|
|
253
|
-
roles: site({ pattern: "/floor-amm/roles/<wallet>", errors: WALLET_ERR, body: B.ROLES }),
|
|
334
|
+
claimView: site({ pattern: "/floor-amm/claims/<wallet>", query: WALLET_PAGE_KEYS("a page's next: the last row key (l:<launch>, r:<account>, p:<traderRef>, o:<quote>), string order"), page: WALLET_PAGE, errors: [...WALLET_ERR, "bad_query", "no_reader"], body: B.CLAIM_VIEW }),
|
|
335
|
+
people: site({ pattern: "/floor-amm/referrals/<wallet>/people", query: WALLET_PAGE_KEYS("opaque, referred wallet order"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.PEOPLE }),
|
|
336
|
+
roles: site({ pattern: "/floor-amm/roles/<wallet>", query: WALLET_PAGE_KEYS("opaque, a page of launches in create order"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.ROLES }),
|
|
337
|
+
|
|
338
|
+
handlePlaces: site({
|
|
339
|
+
pattern: "/floor-amm/handles/<handle>/places",
|
|
340
|
+
query: { limit: LIMIT(100, 500), cursor: { kind: "string", doc: "a page's next: <launch>:<place>, rows strictly after it", max: WALLET_CURSOR_MAX } },
|
|
341
|
+
page: keyset(100, 500),
|
|
342
|
+
errors: WALLET_ERR, body: B.HANDLE_PLACES }),
|
|
254
343
|
|
|
255
344
|
traderBoard: site({ pattern: "/floor-amm/leaderboards/traders", v2: true, query: { window: WINDOW, limit: LIMIT(100, 500) }, page: limit(100, 500), errors: [...GATED, "bad_query"], body: B.TRADER_BOARD }),
|
|
256
345
|
launcherBoard: site({ pattern: "/floor-amm/leaderboards/launchers", v2: true, query: { limit: LIMIT(100, 500) }, page: limit(100, 500), errors: [...GATED, "bad_query"], body: B.LAUNCHER_BOARD }),
|
|
@@ -275,12 +364,14 @@ export const INDEXER_CONTRACT = {
|
|
|
275
364
|
query: {
|
|
276
365
|
ticker_id: { kind: "string", doc: "<token>_<quote>", required: true },
|
|
277
366
|
type: { kind: "enum", doc: "one side only", values: ["buy", "sell"] },
|
|
278
|
-
limit: { kind: "int", doc: "rows per side (0: all)", min: 0 },
|
|
367
|
+
limit: { kind: "int", doc: "rows per side (absent: 500; 0: all, refused past 5000 rows in all: 413, page with before)", min: 0, max: 5000, default: 500 },
|
|
368
|
+
before: BEFORE,
|
|
279
369
|
start_time: { kind: "unix", doc: "from (10^11 and over: milliseconds)" },
|
|
280
370
|
end_time: { kind: "unix", doc: "to (10^11 and over: milliseconds)" },
|
|
281
371
|
},
|
|
282
|
-
|
|
283
|
-
|
|
372
|
+
|
|
373
|
+
page: cursor(500, 5000),
|
|
374
|
+
errors: [...GATED, "bad_query", "not_found", "too_many"],
|
|
284
375
|
body: P.CG_HISTORICAL,
|
|
285
376
|
}),
|
|
286
377
|
llamaTvl: partner({ pattern: "/v2/defillama/tvl", errors: GATED, body: P.LLAMA_TVL }),
|
|
@@ -306,7 +397,7 @@ export function matchRoute(path: string): { name: RouteName; params: Partial<Rec
|
|
|
306
397
|
const c: RouteContract = INDEXER_CONTRACT[name];
|
|
307
398
|
for (const pat of [c.pattern, ...c.aliases]) {
|
|
308
399
|
const keys: PathParam[] = [];
|
|
309
|
-
const re = new RegExp(`^${pat.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/<(launch|wallet|token)>/g, (_, k: PathParam) => (keys.push(k), "([^/]+)"))}$`);
|
|
400
|
+
const re = new RegExp(`^${pat.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/<(launch|wallet|token|handle)>/g, (_, k: PathParam) => (keys.push(k), "([^/]+)"))}$`);
|
|
310
401
|
const m = re.exec(p);
|
|
311
402
|
if (m === null) continue;
|
|
312
403
|
const params: Partial<Record<PathParam, string>> = {};
|
|
@@ -338,7 +429,7 @@ export const OPEN_ROUTES = {
|
|
|
338
429
|
|
|
339
430
|
export function routeLimit(name: RouteName): { readonly default: number; readonly max: number } | null {
|
|
340
431
|
const p: Pagination = INDEXER_CONTRACT[name].page;
|
|
341
|
-
return p.kind === "limit" || p.kind === "offset" || p.kind === "cursor" ? p.limit : null;
|
|
432
|
+
return p.kind === "limit" || p.kind === "offset" || p.kind === "cursor" || p.kind === "keyset" ? p.limit : null;
|
|
342
433
|
}
|
|
343
434
|
|
|
344
435
|
export const LIMITS = Object.fromEntries(ROUTE_NAMES.flatMap((n) => {
|
|
@@ -346,9 +437,29 @@ export const LIMITS = Object.fromEntries(ROUTE_NAMES.flatMap((n) => {
|
|
|
346
437
|
return l === null ? [] : [[n, l]];
|
|
347
438
|
})) as Readonly<Partial<Record<RouteName, { readonly default: number; readonly max: number }>>>;
|
|
348
439
|
|
|
349
|
-
export function clampLimit(name: RouteName, n: number): number {
|
|
350
|
-
const
|
|
351
|
-
|
|
440
|
+
export function clampLimit(name: RouteName, n: number, paged = false): number {
|
|
441
|
+
const p: Pagination = INDEXER_CONTRACT[name].page;
|
|
442
|
+
const l = paged && p.kind === "cursor" && p.optIn !== undefined ? p.optIn : routeLimit(name);
|
|
443
|
+
|
|
444
|
+
const lo = (INDEXER_CONTRACT[name].query as Record<string, QueryKey>).limit?.min ?? 1;
|
|
445
|
+
return l === null ? n : Math.min(Math.max(lo, Math.trunc(n)), l.max);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export function pageAsked(name: RouteName, _q?: URLSearchParams | Record<string, unknown>): boolean {
|
|
449
|
+
const p: Pagination = INDEXER_CONTRACT[name].page;
|
|
450
|
+
|
|
451
|
+
if (p.kind === "cursor" && p.optIn !== undefined) return true;
|
|
452
|
+
if (p.kind === "keyset" && p.optIn === true) return true;
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export function pageLimit(name: RouteName, q: URLSearchParams): number {
|
|
457
|
+
const p: Pagination = INDEXER_CONTRACT[name].page;
|
|
458
|
+
if (p.kind === "cursor" && p.optIn !== undefined) {
|
|
459
|
+
const raw = q.get("limit");
|
|
460
|
+
return raw === null || raw === "" || !DIGITS.test(raw) ? p.optIn.default : Math.min(Math.max(1, Number(raw)), p.optIn.max);
|
|
461
|
+
}
|
|
462
|
+
return queryLimit(name, q);
|
|
352
463
|
}
|
|
353
464
|
|
|
354
465
|
const DIGITS = /^\d+$/;
|
|
@@ -364,7 +475,11 @@ export function queryRefusal(name: RouteName, q: URLSearchParams): string | null
|
|
|
364
475
|
const spec: Readonly<Record<string, QueryKey>> = INDEXER_CONTRACT[name].query;
|
|
365
476
|
for (const [key, k] of Object.entries(spec)) {
|
|
366
477
|
const raw = q.get(key);
|
|
367
|
-
if (raw === null || raw === "")
|
|
478
|
+
if (raw === null || raw === "") {
|
|
479
|
+
if (k.required === true && TABLE_REQUIRED.has(name)) return `${key} is required`;
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
for (const w of k.without ?? []) if ((q.get(w) ?? "") !== "") return `${key} cannot be given with ${w}`;
|
|
368
483
|
switch (k.kind) {
|
|
369
484
|
case "int": {
|
|
370
485
|
const lo = k.min ?? 0;
|
|
@@ -373,10 +488,15 @@ export function queryRefusal(name: RouteName, q: URLSearchParams): string | null
|
|
|
373
488
|
break;
|
|
374
489
|
}
|
|
375
490
|
case "list": {
|
|
376
|
-
const
|
|
377
|
-
if (k.max !== undefined &&
|
|
491
|
+
const parts = raw.split(",").filter((s) => s !== "");
|
|
492
|
+
if (k.max !== undefined && parts.length > k.max) return `at most ${k.max} ${key}`;
|
|
493
|
+
const it = k.item;
|
|
494
|
+
if (it !== undefined && parts.some((x) => !DIGITS.test(x) || Number(x) < it.min || Number(x) > it.max)) return `each ${key} must be an integer ${it.min}..${it.max}`;
|
|
378
495
|
break;
|
|
379
496
|
}
|
|
497
|
+
case "string":
|
|
498
|
+
if (k.max !== undefined && raw.length > k.max) return `${key} must be at most ${k.max} characters`;
|
|
499
|
+
break;
|
|
380
500
|
case "enum":
|
|
381
501
|
if (k.values !== undefined && !k.values.includes(raw)) return `${key} must be one of ${k.values.join(", ")}`;
|
|
382
502
|
break;
|
|
@@ -387,9 +507,17 @@ export function queryRefusal(name: RouteName, q: URLSearchParams): string | null
|
|
|
387
507
|
break;
|
|
388
508
|
}
|
|
389
509
|
}
|
|
510
|
+
|
|
511
|
+
const pg: Pagination = INDEXER_CONTRACT[name].page;
|
|
512
|
+
if (pg.kind === "cursor" && pg.optIn !== undefined && q.get(pg.cursor) !== null) {
|
|
513
|
+
const raw = q.get("limit");
|
|
514
|
+
if (raw !== null && raw !== "" && Number(raw) > pg.optIn.max) return `limit must be 1..${pg.optIn.max} with ${pg.cursor}`;
|
|
515
|
+
}
|
|
390
516
|
return spanRefusal(name, q);
|
|
391
517
|
}
|
|
392
518
|
|
|
519
|
+
const TABLE_REQUIRED: ReadonlySet<RouteName> = new Set<RouteName>(["search"]);
|
|
520
|
+
|
|
393
521
|
const BOOLS: Readonly<Record<string, boolean>> = { true: true, false: false, 1: true, 0: false };
|
|
394
522
|
|
|
395
523
|
export function queryArg(name: RouteName, q: URLSearchParams, key: string): string | undefined {
|
package/src/indexer/partners.ts
CHANGED
|
@@ -50,7 +50,8 @@ export const DEX_SUMMARY = object({
|
|
|
50
50
|
export type DexSummary = Infer<typeof DEX_SUMMARY>;
|
|
51
51
|
|
|
52
52
|
export const DEX_PAIR = object({
|
|
53
|
-
pair: object({ id: str, asset0Id: str, asset1Id: str, createdAtBlockNumber: int, createdAtBlockTimestamp: int, feeBps: nullable(num) }),
|
|
53
|
+
pair: object({ id: str, asset0Id: str, asset1Id: str, createdAtBlockNumber: int, createdAtBlockTimestamp: int, feeBps: nullable(num), dexKey: str, createdAtTxnId: optional(str), creator: str }),
|
|
54
|
+
launch: optional(object({ id: str, token: str })),
|
|
54
55
|
});
|
|
55
56
|
export type DexPair = Infer<typeof DEX_PAIR>;
|
|
56
57
|
|
|
@@ -81,7 +82,7 @@ export type CgTickers = Infer<typeof CG_TICKERS>;
|
|
|
81
82
|
export const CG_TRADE = object({ trade_id: int, price: decimal, base_volume: decimal, target_volume: decimal, trade_timestamp: int, type: oneOf("buy", "sell") });
|
|
82
83
|
export type CgTrade = Infer<typeof CG_TRADE>;
|
|
83
84
|
|
|
84
|
-
export const CG_HISTORICAL = object({ buy: optional(array(CG_TRADE)), sell: optional(array(CG_TRADE)) });
|
|
85
|
+
export const CG_HISTORICAL = object({ buy: optional(array(CG_TRADE)), sell: optional(array(CG_TRADE)), next: optional(nullable(str)) });
|
|
85
86
|
export type CgHistorical = Infer<typeof CG_HISTORICAL>;
|
|
86
87
|
|
|
87
88
|
export const LLAMA_TVL = object({ mode: LIQUIDITY_MODE, tvl: record(big), launchTokens: array(str) });
|
package/src/indexer/paths.ts
CHANGED
|
@@ -11,20 +11,23 @@ export const INDEXER_ROUTES = {
|
|
|
11
11
|
stream: { pattern: "/floor-amm/stream", keys: ["launch", "state", "lastEventId"] },
|
|
12
12
|
quotes: { pattern: "/floor-amm/quotes", keys: [] },
|
|
13
13
|
summary: { pattern: "/floor-amm/summary", keys: [] },
|
|
14
|
-
floorRouted: { pattern: "/floor-amm/floor-routed", keys: [] },
|
|
14
|
+
floorRouted: { pattern: "/floor-amm/floor-routed", keys: ["limit", "cursor"] },
|
|
15
15
|
events: { pattern: "/floor-amm/events", keys: ["fromBlock", "toBlock"] },
|
|
16
|
-
launches: { pattern: "/floor-amm/launches", keys: ["sort", "order", "q", "ids", "quote", "creator", "rankable", "graduated", "limit", "offset"] },
|
|
16
|
+
launches: { pattern: "/floor-amm/launches", keys: ["sort", "order", "q", "ids", "quote", "creator", "rankable", "graduated", "preset", "limit", "cursor", "offset"] },
|
|
17
|
+
search: { pattern: "/floor-amm/search", keys: ["q", "limit", "cursor", "rankable", "graduated", "quote", "preset"] },
|
|
17
18
|
launch: { pattern: "/floor-amm/launches/<launch>", keys: [] },
|
|
18
19
|
launchState: { pattern: "/floor-amm/launches/<launch>/state", keys: [] },
|
|
19
20
|
milestones: { pattern: "/floor-amm/launches/<launch>/milestones", keys: [] },
|
|
20
21
|
holders: { pattern: "/floor-amm/launches/<launch>/holders", keys: ["limit"] },
|
|
21
22
|
trades: { pattern: "/floor-amm/launches/<launch>/trades", keys: ["limit", "before", "traders"] },
|
|
22
|
-
launchClaims: { pattern: "/floor-amm/launches/<launch>/claims", keys: ["claimer"] },
|
|
23
|
-
devBuys: { pattern: "/floor-amm/launches/<launch>/dev-buys", keys: [] },
|
|
23
|
+
launchClaims: { pattern: "/floor-amm/launches/<launch>/claims", keys: ["limit", "before", "claimer"] },
|
|
24
|
+
devBuys: { pattern: "/floor-amm/launches/<launch>/dev-buys", keys: ["limit", "before"] },
|
|
25
|
+
memberSold: { pattern: "/floor-amm/launches/<launch>/member-sold", keys: ["limit", "before"] },
|
|
26
|
+
launchAccount: { pattern: "/floor-amm/launches/<launch>/account", keys: [] },
|
|
24
27
|
traders: { pattern: "/floor-amm/launches/<launch>/traders", keys: ["window", "limit"] },
|
|
25
28
|
quoteChain: { pattern: "/floor-amm/launches/<launch>/chain", keys: [] },
|
|
26
29
|
devTrades: { pattern: "/floor-amm/launches/<launch>/dev", keys: ["limit"] },
|
|
27
|
-
burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: [] },
|
|
30
|
+
burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: ["limit", "before"] },
|
|
28
31
|
launchLocks: { pattern: "/floor-amm/launches/<launch>/locks", keys: [] },
|
|
29
32
|
marks: { pattern: "/floor-amm/launches/<launch>/marks", keys: ["limit", "before"] },
|
|
30
33
|
price: { pattern: "/floor-amm/launches/<launch>/price", keys: [] },
|
|
@@ -32,28 +35,44 @@ export const INDEXER_ROUTES = {
|
|
|
32
35
|
candleBundle: { pattern: "/floor-amm/launches/<launch>/candle-bundle", keys: ["intervals", "limit"] },
|
|
33
36
|
candles: { pattern: "/floor-amm/candles", keys: ["launch", "interval", "from", "to", "before", "limit"] },
|
|
34
37
|
walletTrades: { pattern: "/floor-amm/wallets/<wallet>/trades", keys: ["limit", "before", "launch"] },
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
tonActivity: { pattern: "/floor-amm/wallets/<wallet>/ton-activity", keys: ["limit", "before"] },
|
|
39
|
+
tonOutcome: { pattern: "/floor-amm/wallets/<wallet>/ton-outcome", keys: ["queryId"] },
|
|
40
|
+
positions: { pattern: "/floor-amm/wallets/<wallet>/positions", keys: ["limit", "cursor"] },
|
|
41
|
+
inbox: { pattern: "/floor-amm/wallets/<wallet>/inbox", keys: ["limit", "before"] },
|
|
42
|
+
walletLocks: { pattern: "/floor-amm/wallets/<wallet>/locks", keys: ["limit", "cursor"] },
|
|
43
|
+
claimHistory: { pattern: "/floor-amm/wallets/<wallet>/claims", keys: ["limit", "cursor"] },
|
|
39
44
|
firsts: { pattern: "/floor-amm/wallets/<wallet>/firsts", keys: [] },
|
|
40
45
|
firstsMany: { pattern: "/floor-amm/wallets/firsts", keys: ["wallets"] },
|
|
41
|
-
claimView: { pattern: "/floor-amm/claims/<wallet>", keys: [] },
|
|
42
|
-
people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: [] },
|
|
43
|
-
roles: { pattern: "/floor-amm/roles/<wallet>", keys: [] },
|
|
46
|
+
claimView: { pattern: "/floor-amm/claims/<wallet>", keys: ["limit", "cursor"] },
|
|
47
|
+
people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor"] },
|
|
48
|
+
roles: { pattern: "/floor-amm/roles/<wallet>", keys: ["limit", "cursor"] },
|
|
49
|
+
handlePlaces: { pattern: "/floor-amm/handles/<handle>/places", keys: ["limit", "cursor"] },
|
|
44
50
|
traderBoard: { pattern: "/floor-amm/leaderboards/traders", keys: ["window", "limit"] },
|
|
45
51
|
launcherBoard: { pattern: "/floor-amm/leaderboards/launchers", keys: ["limit"] },
|
|
46
52
|
} as const satisfies Record<string, IndexerRoute>;
|
|
47
53
|
|
|
48
54
|
export type IndexerRouteName = keyof typeof INDEXER_ROUTES;
|
|
49
55
|
|
|
50
|
-
export const LAUNCH_SORTS = ["created", "newest", "volume1h", "volume24h", "volume7d", "volume", "marketCap", "liquidity", "backed", "trades24h", "holders", "change1h", "change24h", "lastTrade", "nearFloor", "trending", "newHolders24h"] as const;
|
|
56
|
+
export const LAUNCH_SORTS = ["created", "newest", "volume1h", "volume24h", "volume7d", "volume", "marketCap", "liquidity", "backed", "trades24h", "holders", "change1h", "change24h", "lastTrade", "nearFloor", "trending", "newHolders24h", "standingVolume", "standingMarketCap", "standingBacked", "maxloss"] as const;
|
|
51
57
|
export type LaunchSort = (typeof LAUNCH_SORTS)[number];
|
|
52
58
|
|
|
53
59
|
export const IDS_MAX = 100;
|
|
54
60
|
|
|
55
61
|
export const LAUNCHES_PAGE_MAX = 1_000;
|
|
56
62
|
|
|
63
|
+
export const LAUNCHES_PAGE_DEFAULT = 100;
|
|
64
|
+
|
|
65
|
+
export const LAUNCH_CURSOR_MAX = 512;
|
|
66
|
+
|
|
67
|
+
export const WALLET_PAGE_DEFAULT = 100;
|
|
68
|
+
export const WALLET_PAGE_MAX = 500;
|
|
69
|
+
|
|
70
|
+
export const WALLET_CURSOR_MAX = 256;
|
|
71
|
+
export const INBOX_PAGE_DEFAULT = 100;
|
|
72
|
+
export const INBOX_PAGE_MAX = 500;
|
|
73
|
+
|
|
74
|
+
export const PRESET_FILTER_MAX = 16;
|
|
75
|
+
|
|
57
76
|
export const FIRSTS_MAX = 100;
|
|
58
77
|
|
|
59
78
|
export const STREAM_STATE_MAX = 16;
|
|
@@ -76,6 +95,8 @@ const need = (s: string): string => {
|
|
|
76
95
|
};
|
|
77
96
|
const seg = (s: string): string => encodeURIComponent(need(s));
|
|
78
97
|
|
|
98
|
+
const presets = (p: readonly number[] | undefined): readonly string[] | undefined => (p === undefined || p.length === 0 ? undefined : p.map(String));
|
|
99
|
+
|
|
79
100
|
const launchPath = (id: string, tail = ""): string => `/floor-amm/launches/${seg(id)}${tail}`;
|
|
80
101
|
const walletPath = (w: string, tail: string): string => `/floor-amm/wallets/${seg(w)}${tail}`;
|
|
81
102
|
|
|
@@ -91,10 +112,33 @@ export interface LaunchesQuery {
|
|
|
91
112
|
|
|
92
113
|
rankable?: boolean;
|
|
93
114
|
graduated?: boolean;
|
|
115
|
+
|
|
116
|
+
preset?: readonly number[];
|
|
117
|
+
|
|
94
118
|
limit?: number;
|
|
119
|
+
|
|
120
|
+
cursor?: string;
|
|
95
121
|
offset?: number;
|
|
96
122
|
}
|
|
97
123
|
|
|
124
|
+
export interface LaunchSearchQuery {
|
|
125
|
+
|
|
126
|
+
q: string;
|
|
127
|
+
|
|
128
|
+
limit?: number;
|
|
129
|
+
|
|
130
|
+
cursor?: string;
|
|
131
|
+
rankable?: boolean;
|
|
132
|
+
graduated?: boolean;
|
|
133
|
+
quote?: string;
|
|
134
|
+
preset?: readonly number[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface WalletPage {
|
|
138
|
+
limit?: number;
|
|
139
|
+
cursor?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
98
142
|
export interface Page {
|
|
99
143
|
limit?: number;
|
|
100
144
|
|
|
@@ -141,25 +185,33 @@ export const indexerPath = {
|
|
|
141
185
|
},
|
|
142
186
|
quotes: (): string => "/floor-amm/quotes",
|
|
143
187
|
summary: (): string => "/floor-amm/summary",
|
|
144
|
-
floorRouted: (): string =>
|
|
188
|
+
floorRouted: (q: { limit?: number; cursor?: string } = {}): string => `/floor-amm/floor-routed${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
145
189
|
events: (fromBlock: number, toBlock: number): string => `/floor-amm/events${query({ fromBlock, toBlock })}`,
|
|
146
190
|
|
|
147
191
|
launches: (q: LaunchesQuery = {}): string => {
|
|
148
192
|
if (q.ids !== undefined && q.ids.length > IDS_MAX) throw new RangeError(`at most ${IDS_MAX} ids`);
|
|
149
193
|
const sort = q.sort ?? (q.ids === undefined ? "created" : undefined);
|
|
150
|
-
|
|
194
|
+
if (q.preset !== undefined && q.preset.length > PRESET_FILTER_MAX) throw new RangeError(`at most ${PRESET_FILTER_MAX} presets`);
|
|
195
|
+
return `/floor-amm/launches${query({ sort, order: q.order, q: q.q, ids: q.ids, quote: q.quote, creator: q.creator, rankable: q.rankable, graduated: q.graduated, preset: presets(q.preset), limit: q.limit, cursor: q.cursor, offset: q.offset })}`;
|
|
196
|
+
},
|
|
197
|
+
search: (q: LaunchSearchQuery): string => {
|
|
198
|
+
if (q.q.trim() === "") throw new RangeError("an empty search");
|
|
199
|
+
if (q.preset !== undefined && q.preset.length > PRESET_FILTER_MAX) throw new RangeError(`at most ${PRESET_FILTER_MAX} presets`);
|
|
200
|
+
return `/floor-amm/search${query({ q: q.q, limit: q.limit, cursor: q.cursor, rankable: q.rankable, graduated: q.graduated, quote: q.quote, preset: presets(q.preset) })}`;
|
|
151
201
|
},
|
|
152
202
|
launch: (id: string): string => launchPath(id),
|
|
153
203
|
launchState: (id: string): string => launchPath(id, "/state"),
|
|
154
204
|
milestones: (id: string): string => launchPath(id, "/milestones"),
|
|
155
205
|
holders: (id: string, q: { limit?: number } = {}): string => launchPath(id, `/holders${query({ limit: q.limit })}`),
|
|
156
206
|
trades: (id: string, q: TradesQuery = {}): string => launchPath(id, `/trades${query({ limit: q.limit, before: q.before, traders: q.traders?.length ? q.traders : undefined })}`),
|
|
157
|
-
launchClaims: (id: string, q: { claimer?: string } = {}): string => launchPath(id, `/claims${query({ claimer: q.claimer })}`),
|
|
158
|
-
devBuys: (id: string): string => launchPath(id,
|
|
207
|
+
launchClaims: (id: string, q: Page & { claimer?: string } = {}): string => launchPath(id, `/claims${query({ limit: q.limit, before: q.before, claimer: q.claimer })}`),
|
|
208
|
+
devBuys: (id: string, q: Page = {}): string => launchPath(id, `/dev-buys${query({ limit: q.limit, before: q.before })}`),
|
|
209
|
+
memberSold: (id: string, q: Page = {}): string => launchPath(id, `/member-sold${query({ limit: q.limit, before: q.before })}`),
|
|
210
|
+
launchAccount: (id: string): string => launchPath(id, "/account"),
|
|
159
211
|
traders: (id: string, q: { window?: "1h" | "24h" | "7d" | "all"; limit?: number } = {}): string => launchPath(id, `/traders${query({ window: q.window, limit: q.limit })}`),
|
|
160
212
|
quoteChain: (id: string): string => launchPath(id, "/chain"),
|
|
161
213
|
devTrades: (id: string, q: { limit?: number } = {}): string => launchPath(id, `/dev${query({ limit: q.limit })}`),
|
|
162
|
-
burns: (id: string): string => launchPath(id,
|
|
214
|
+
burns: (id: string, q: Page = {}): string => launchPath(id, `/burns${query({ limit: q.limit, before: q.before })}`),
|
|
163
215
|
launchLocks: (id: string): string => launchPath(id, "/locks"),
|
|
164
216
|
marks: (id: string, q: Page = {}): string => launchPath(id, `/marks${query({ limit: q.limit, before: q.before })}`),
|
|
165
217
|
price: (id: string): string => launchPath(id, "/price"),
|
|
@@ -173,18 +225,27 @@ export const indexerPath = {
|
|
|
173
225
|
return `/floor-amm/candles${query({ launch: need(q.launch), interval: q.interval, from: q.from, to: q.to, before: q.before, limit: q.limit })}`;
|
|
174
226
|
},
|
|
175
227
|
walletTrades: (w: string, q: WalletTradesQuery = {}): string => walletPath(w, `/trades${query({ limit: q.limit, before: q.before, launch: q.launch })}`),
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
228
|
+
|
|
229
|
+
tonActivity: (w: string, q: Page = {}): string => walletPath(w, `/ton-activity${query({ limit: q.limit, before: q.before })}`),
|
|
230
|
+
tonOutcome: (w: string, queryId: bigint | string): string => walletPath(w, `/ton-outcome${query({ queryId: String(queryId) })}`),
|
|
231
|
+
|
|
232
|
+
positions: (w: string, q: WalletPage = {}): string => walletPath(w, `/positions${query({ limit: q.limit, cursor: q.cursor })}`),
|
|
233
|
+
|
|
234
|
+
inbox: (w: string, q: { limit?: number; before?: string } = {}): string => walletPath(w, `/inbox${query({ limit: q.limit, before: q.before })}`),
|
|
235
|
+
walletLocks: (w: string, q: WalletPage = {}): string => walletPath(w, `/locks${query({ limit: q.limit, cursor: q.cursor })}`),
|
|
236
|
+
|
|
237
|
+
claimHistory: (w: string, q: WalletPage = {}): string => walletPath(w, `/claims${query({ limit: q.limit, cursor: q.cursor })}`),
|
|
180
238
|
firsts: (w: string): string => walletPath(w, "/firsts"),
|
|
181
239
|
firstsMany: (wallets: readonly string[]): string => {
|
|
182
240
|
if (wallets.length === 0 || wallets.length > FIRSTS_MAX) throw new RangeError(`1..${FIRSTS_MAX} wallets`);
|
|
183
241
|
return `/floor-amm/wallets/firsts${query({ wallets })}`;
|
|
184
242
|
},
|
|
185
|
-
claimView: (w: string): string => `/floor-amm/claims/${seg(w)}`,
|
|
186
|
-
|
|
187
|
-
|
|
243
|
+
claimView: (w: string, q: WalletPage = {}): string => `/floor-amm/claims/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
244
|
+
|
|
245
|
+
people: (w: string, q: WalletPage = {}): string => `/floor-amm/referrals/${seg(w)}/people${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
246
|
+
|
|
247
|
+
roles: (w: string, q: WalletPage = {}): string => `/floor-amm/roles/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
248
|
+
handlePlaces: (handle: string, q: WalletPage = {}): string => `/floor-amm/handles/${seg(handle)}/places${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
188
249
|
traderBoard: (q: { window?: "1h" | "24h" | "7d" | "all"; limit?: number } = {}): string => `/floor-amm/leaderboards/traders${query({ window: q.window, limit: q.limit })}`,
|
|
189
250
|
launcherBoard: (q: { limit?: number } = {}): string => `/floor-amm/leaderboards/launchers${query({ limit: q.limit })}`,
|
|
190
251
|
} as const satisfies Record<IndexerRouteName, (...a: never[]) => string>;
|