@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/dist/indexer/contract.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import { unknown } from "./decode.js";
|
|
4
4
|
import * as B from "./bodies.js";
|
|
5
5
|
import * as P from "./partners.js";
|
|
6
|
-
import { FIRSTS_MAX, IDS_MAX, LAUNCHES_PAGE_MAX, LAUNCH_SORTS, STREAM_STATE_MAX } from "./paths.js";
|
|
6
|
+
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.js";
|
|
7
|
+
import { SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX, SEARCH_Q_MAX } from "./search.js";
|
|
7
8
|
|
|
8
9
|
export const UNITS = {
|
|
9
10
|
site: "raw quote base units, token math units (6 dp), Q64.64 prices, unix s; bigint as decimal strings; USD as decimal strings",
|
|
@@ -64,6 +65,15 @@ const limit = (dflt , max ) => ({ kind: "limit", limit: { default:
|
|
|
64
65
|
const cursor = (dflt , max ) => ({ kind: "cursor", limit: { default: dflt, max }, cursor: "before", next: "next" }) ;
|
|
65
66
|
const LIMIT = (dflt , max ) => ({ kind: "int", doc: "rows", min: 1, max, default: dflt });
|
|
66
67
|
const BEFORE = { kind: "cursor", doc: "a block, or a row id <block>:<txnIndex>:<eventIndex> (a page's next): rows strictly before it" };
|
|
68
|
+
const keyset = (dflt , max ) => ({ kind: "keyset", limit: { default: dflt, max }, cursor: "cursor", next: "next" }) ;
|
|
69
|
+
const PRESETS = { kind: "list", doc: "only launches of these presets (ids 0..255)", max: PRESET_FILTER_MAX, item: { kind: "int", min: 0, max: 255 } } ;
|
|
70
|
+
|
|
71
|
+
const WALLET_PAGE = { kind: "keyset", limit: { default: WALLET_PAGE_DEFAULT, max: WALLET_PAGE_MAX }, cursor: "cursor", next: "next", optIn: true } ;
|
|
72
|
+
const WALLET_PAGE_KEYS = (cursorDoc ) => ({
|
|
73
|
+
limit: { kind: "int", doc: "rows (asks a page)", min: 1, max: WALLET_PAGE_MAX, default: WALLET_PAGE_DEFAULT },
|
|
74
|
+
cursor: { kind: "string", doc: `a page's next (asks a page): ${cursorDoc}`, max: WALLET_CURSOR_MAX },
|
|
75
|
+
});
|
|
76
|
+
const KEYSET_CURSOR = (without ) => ({ kind: "string", doc: "a page's next: the rows after its last one (opaque)", max: LAUNCH_CURSOR_MAX, ...(without.length > 0 ? { without } : {}) });
|
|
67
77
|
const WINDOW = { kind: "enum", doc: "the volume window", values: B.TRADER_WINDOWS, default: "24h" };
|
|
68
78
|
|
|
69
79
|
const GATED = ["not_ready", "upstream"] ;
|
|
@@ -71,7 +81,7 @@ const LAUNCH_ERR = [...GATED, "unknown_launch"] ;
|
|
|
71
81
|
const WALLET_ERR = [...GATED, "bad_query"] ;
|
|
72
82
|
|
|
73
83
|
function site (s ) {
|
|
74
|
-
const params = [...s.pattern.matchAll(/<(launch|wallet|token)>/g)].map((m) => m[1] );
|
|
84
|
+
const params = [...s.pattern.matchAll(/<(launch|wallet|token|handle)>/g)].map((m) => m[1] );
|
|
75
85
|
const { v2, ...rest } = s;
|
|
76
86
|
const aliases = s.aliases ?? (v2 ? [s.pattern.replace(/^\/floor-amm\//, "/floor-amm/v2/")] : []);
|
|
77
87
|
return { mount: "chain", query: {}, page: NONE, errors: GATED, gated: true, units: "site", audience: "site", ...rest, params, aliases };
|
|
@@ -97,7 +107,16 @@ export const INDEXER_CONTRACT = {
|
|
|
97
107
|
}),
|
|
98
108
|
quotes: site({ pattern: "/floor-amm/quotes", body: B.QUOTES }),
|
|
99
109
|
summary: site({ pattern: "/floor-amm/summary", aliases: ["/floor-amm/v2/summary"], body: B.SUMMARY }),
|
|
100
|
-
floorRouted: site({
|
|
110
|
+
floorRouted: site({
|
|
111
|
+
pattern: "/floor-amm/floor-routed",
|
|
112
|
+
aliases: ["/floor-amm/v2/floor-routed"],
|
|
113
|
+
query: {
|
|
114
|
+
limit: LIMIT(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
|
|
115
|
+
cursor: { kind: "string", doc: "a page's next: the launches after this launch id, in create order", max: LAUNCH_CURSOR_MAX },
|
|
116
|
+
},
|
|
117
|
+
page: keyset(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
|
|
118
|
+
body: B.FLOOR_ROUTED,
|
|
119
|
+
}),
|
|
101
120
|
events: site({
|
|
102
121
|
pattern: "/floor-amm/events",
|
|
103
122
|
aliases: ["/events", "/v2/dex/events"],
|
|
@@ -113,19 +132,38 @@ export const INDEXER_CONTRACT = {
|
|
|
113
132
|
query: {
|
|
114
133
|
sort: { kind: "enum", doc: "the order (larger first with order=desc)", values: LAUNCH_SORTS, default: "created" },
|
|
115
134
|
order: { kind: "enum", doc: "asc or desc", values: ["asc", "desc"], default: "desc" },
|
|
116
|
-
q: { kind: "string", doc: "name or symbol contains, or an id, token or creator equals" },
|
|
135
|
+
q: { kind: "string", doc: "name or symbol contains, or an id, token or creator equals", max: SEARCH_Q_MAX },
|
|
117
136
|
ids: { kind: "list", doc: "these launches (ids or tokens), in the order asked without sort", max: IDS_MAX },
|
|
118
137
|
quote: { kind: "string", doc: "launches quoted in this coin" },
|
|
119
138
|
creator: { kind: "string", doc: "launches by this creator" },
|
|
120
139
|
rankable: { kind: "bool", doc: "true (or 1) listed only, false (or 0) unlisted only" },
|
|
121
140
|
graduated: { kind: "bool", doc: "graduated or not (true / false, or 1 / 0)" },
|
|
122
|
-
|
|
123
|
-
|
|
141
|
+
preset: PRESETS,
|
|
142
|
+
limit: LIMIT(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
|
|
143
|
+
cursor: KEYSET_CURSOR(["offset", "ids"]),
|
|
144
|
+
offset: { kind: "int", doc: "rows skipped (with total: an offset page)", min: 0, default: 0 },
|
|
124
145
|
},
|
|
125
|
-
|
|
146
|
+
|
|
147
|
+
page: keyset(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
|
|
126
148
|
errors: [...GATED, "bad_query"],
|
|
127
149
|
body: B.LAUNCHES,
|
|
128
150
|
}),
|
|
151
|
+
search: site({
|
|
152
|
+
pattern: "/floor-amm/search",
|
|
153
|
+
v2: true,
|
|
154
|
+
query: {
|
|
155
|
+
q: { kind: "string", doc: "the search: symbol, name or token (tiers 0-4, search.ts)", required: true, max: SEARCH_Q_MAX },
|
|
156
|
+
limit: LIMIT(SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX),
|
|
157
|
+
cursor: KEYSET_CURSOR([]),
|
|
158
|
+
rankable: { kind: "bool", doc: "true (or 1) listed only, false (or 0) unlisted only" },
|
|
159
|
+
graduated: { kind: "bool", doc: "graduated or not (true / false, or 1 / 0)" },
|
|
160
|
+
quote: { kind: "string", doc: "launches quoted in this coin" },
|
|
161
|
+
preset: PRESETS,
|
|
162
|
+
},
|
|
163
|
+
page: keyset(SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX),
|
|
164
|
+
errors: [...GATED, "bad_query"],
|
|
165
|
+
body: B.LAUNCH_SEARCH,
|
|
166
|
+
}),
|
|
129
167
|
launch: site({ pattern: "/floor-amm/launches/<launch>", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_ONE }),
|
|
130
168
|
launchState: site({ pattern: "/floor-amm/launches/<launch>/state", v2: true, errors: ["not_ready", "unknown_launch"], body: B.LAUNCH_STATE }),
|
|
131
169
|
milestones: site({ pattern: "/floor-amm/launches/<launch>/milestones", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_MILESTONES }),
|
|
@@ -138,12 +176,16 @@ export const INDEXER_CONTRACT = {
|
|
|
138
176
|
errors: [...LAUNCH_ERR, "bad_query"],
|
|
139
177
|
body: B.TRADES,
|
|
140
178
|
}),
|
|
141
|
-
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 }),
|
|
142
|
-
devBuys: site({ pattern: "/floor-amm/launches/<launch>/dev-buys", v2: true, errors: LAUNCH_ERR, body: B.DEV_BUYS }),
|
|
179
|
+
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 }),
|
|
180
|
+
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 }),
|
|
181
|
+
|
|
182
|
+
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 }),
|
|
183
|
+
|
|
184
|
+
launchAccount: site({ pattern: "/floor-amm/launches/<launch>/account", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_ACCOUNT }),
|
|
143
185
|
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 }),
|
|
144
186
|
quoteChain: site({ pattern: "/floor-amm/launches/<launch>/chain", v2: true, errors: LAUNCH_ERR, body: B.QUOTE_CHAIN }),
|
|
145
187
|
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 }),
|
|
146
|
-
burns: site({ pattern: "/floor-amm/launches/<launch>/burns", v2: true, errors: LAUNCH_ERR, body: B.BURNS }),
|
|
188
|
+
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 }),
|
|
147
189
|
launchLocks: site({ pattern: "/floor-amm/launches/<launch>/locks", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_LOCKS }),
|
|
148
190
|
marks: site({
|
|
149
191
|
pattern: "/floor-amm/launches/<launch>/marks",
|
|
@@ -197,15 +239,44 @@ export const INDEXER_CONTRACT = {
|
|
|
197
239
|
errors: [...WALLET_ERR, "unknown_launch"],
|
|
198
240
|
body: B.WALLET_TRADES,
|
|
199
241
|
}),
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
242
|
+
|
|
243
|
+
tonActivity: site({
|
|
244
|
+
pattern: "/floor-amm/wallets/<wallet>/ton-activity",
|
|
245
|
+
query: { limit: LIMIT(100, 200), before: BEFORE },
|
|
246
|
+
page: cursor(100, 200),
|
|
247
|
+
errors: WALLET_ERR,
|
|
248
|
+
body: B.TON_ACTIVITY,
|
|
249
|
+
}),
|
|
250
|
+
tonOutcome: site({
|
|
251
|
+
pattern: "/floor-amm/wallets/<wallet>/ton-outcome",
|
|
252
|
+
query: { queryId: { kind: "string", doc: "the query id (uint64, decimal) the SDK message carried", required: true } },
|
|
253
|
+
errors: WALLET_ERR,
|
|
254
|
+
body: B.TON_OUTCOME,
|
|
255
|
+
}),
|
|
256
|
+
|
|
257
|
+
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 }),
|
|
258
|
+
|
|
259
|
+
inbox: site({
|
|
260
|
+
pattern: "/floor-amm/wallets/<wallet>/inbox",
|
|
261
|
+
v2: true,
|
|
262
|
+
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" } },
|
|
263
|
+
page: { kind: "cursor", limit: { default: 1_000, max: 1_000 }, cursor: "before", next: "next", optIn: { default: INBOX_PAGE_DEFAULT, max: INBOX_PAGE_MAX } },
|
|
264
|
+
errors: WALLET_ERR,
|
|
265
|
+
body: B.INBOX,
|
|
266
|
+
}),
|
|
267
|
+
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 }),
|
|
268
|
+
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 }),
|
|
204
269
|
firsts: site({ pattern: "/floor-amm/wallets/<wallet>/firsts", errors: WALLET_ERR, body: B.FIRSTS }),
|
|
205
270
|
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 }),
|
|
206
|
-
claimView: site({ pattern: "/floor-amm/claims/<wallet>", errors: [...WALLET_ERR, "no_reader"], body: B.CLAIM_VIEW }),
|
|
207
|
-
people: site({ pattern: "/floor-amm/referrals/<wallet>/people", errors: WALLET_ERR, body: B.PEOPLE }),
|
|
208
|
-
roles: site({ pattern: "/floor-amm/roles/<wallet>", errors: WALLET_ERR, body: B.ROLES }),
|
|
271
|
+
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 }),
|
|
272
|
+
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 }),
|
|
273
|
+
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 }),
|
|
274
|
+
|
|
275
|
+
handlePlaces: site({
|
|
276
|
+
pattern: "/floor-amm/handles/<handle>/places",
|
|
277
|
+
query: { limit: LIMIT(100, 500), cursor: { kind: "string", doc: "a page's next: <launch>:<place>, rows strictly after it", max: WALLET_CURSOR_MAX } },
|
|
278
|
+
page: keyset(100, 500),
|
|
279
|
+
errors: WALLET_ERR, body: B.HANDLE_PLACES }),
|
|
209
280
|
|
|
210
281
|
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 }),
|
|
211
282
|
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 }),
|
|
@@ -230,12 +301,14 @@ export const INDEXER_CONTRACT = {
|
|
|
230
301
|
query: {
|
|
231
302
|
ticker_id: { kind: "string", doc: "<token>_<quote>", required: true },
|
|
232
303
|
type: { kind: "enum", doc: "one side only", values: ["buy", "sell"] },
|
|
233
|
-
limit: { kind: "int", doc: "rows per side (0: all)", min: 0 },
|
|
304
|
+
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 },
|
|
305
|
+
before: BEFORE,
|
|
234
306
|
start_time: { kind: "unix", doc: "from (10^11 and over: milliseconds)" },
|
|
235
307
|
end_time: { kind: "unix", doc: "to (10^11 and over: milliseconds)" },
|
|
236
308
|
},
|
|
237
|
-
|
|
238
|
-
|
|
309
|
+
|
|
310
|
+
page: cursor(500, 5000),
|
|
311
|
+
errors: [...GATED, "bad_query", "not_found", "too_many"],
|
|
239
312
|
body: P.CG_HISTORICAL,
|
|
240
313
|
}),
|
|
241
314
|
llamaTvl: partner({ pattern: "/v2/defillama/tvl", errors: GATED, body: P.LLAMA_TVL }),
|
|
@@ -257,7 +330,7 @@ export function matchRoute(path )
|
|
|
257
330
|
const c = INDEXER_CONTRACT[name];
|
|
258
331
|
for (const pat of [c.pattern, ...c.aliases]) {
|
|
259
332
|
const keys = [];
|
|
260
|
-
const re = new RegExp(`^${pat.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/<(launch|wallet|token)>/g, (_, k ) => (keys.push(k), "([^/]+)"))}$`);
|
|
333
|
+
const re = new RegExp(`^${pat.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/<(launch|wallet|token|handle)>/g, (_, k ) => (keys.push(k), "([^/]+)"))}$`);
|
|
261
334
|
const m = re.exec(p);
|
|
262
335
|
if (m === null) continue;
|
|
263
336
|
const params = {};
|
|
@@ -277,7 +350,7 @@ export const OPEN_ROUTES = {
|
|
|
277
350
|
|
|
278
351
|
export function routeLimit(name ) {
|
|
279
352
|
const p = INDEXER_CONTRACT[name].page;
|
|
280
|
-
return p.kind === "limit" || p.kind === "offset" || p.kind === "cursor" ? p.limit : null;
|
|
353
|
+
return p.kind === "limit" || p.kind === "offset" || p.kind === "cursor" || p.kind === "keyset" ? p.limit : null;
|
|
281
354
|
}
|
|
282
355
|
|
|
283
356
|
export const LIMITS = Object.fromEntries(ROUTE_NAMES.flatMap((n) => {
|
|
@@ -285,9 +358,29 @@ export const LIMITS = Object.fromEntries(ROUTE_NAMES.flatMap((n) => {
|
|
|
285
358
|
return l === null ? [] : [[n, l]];
|
|
286
359
|
})) ;
|
|
287
360
|
|
|
288
|
-
export function clampLimit(name , n ) {
|
|
289
|
-
const
|
|
290
|
-
|
|
361
|
+
export function clampLimit(name , n , paged = false) {
|
|
362
|
+
const p = INDEXER_CONTRACT[name].page;
|
|
363
|
+
const l = paged && p.kind === "cursor" && p.optIn !== undefined ? p.optIn : routeLimit(name);
|
|
364
|
+
|
|
365
|
+
const lo = (INDEXER_CONTRACT[name].query ).limit?.min ?? 1;
|
|
366
|
+
return l === null ? n : Math.min(Math.max(lo, Math.trunc(n)), l.max);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export function pageAsked(name , _q ) {
|
|
370
|
+
const p = INDEXER_CONTRACT[name].page;
|
|
371
|
+
|
|
372
|
+
if (p.kind === "cursor" && p.optIn !== undefined) return true;
|
|
373
|
+
if (p.kind === "keyset" && p.optIn === true) return true;
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export function pageLimit(name , q ) {
|
|
378
|
+
const p = INDEXER_CONTRACT[name].page;
|
|
379
|
+
if (p.kind === "cursor" && p.optIn !== undefined) {
|
|
380
|
+
const raw = q.get("limit");
|
|
381
|
+
return raw === null || raw === "" || !DIGITS.test(raw) ? p.optIn.default : Math.min(Math.max(1, Number(raw)), p.optIn.max);
|
|
382
|
+
}
|
|
383
|
+
return queryLimit(name, q);
|
|
291
384
|
}
|
|
292
385
|
|
|
293
386
|
const DIGITS = /^\d+$/;
|
|
@@ -303,7 +396,11 @@ export function queryRefusal(name , q )
|
|
|
303
396
|
const spec = INDEXER_CONTRACT[name].query;
|
|
304
397
|
for (const [key, k] of Object.entries(spec)) {
|
|
305
398
|
const raw = q.get(key);
|
|
306
|
-
if (raw === null || raw === "")
|
|
399
|
+
if (raw === null || raw === "") {
|
|
400
|
+
if (k.required === true && TABLE_REQUIRED.has(name)) return `${key} is required`;
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
for (const w of k.without ?? []) if ((q.get(w) ?? "") !== "") return `${key} cannot be given with ${w}`;
|
|
307
404
|
switch (k.kind) {
|
|
308
405
|
case "int": {
|
|
309
406
|
const lo = k.min ?? 0;
|
|
@@ -312,10 +409,15 @@ export function queryRefusal(name , q )
|
|
|
312
409
|
break;
|
|
313
410
|
}
|
|
314
411
|
case "list": {
|
|
315
|
-
const
|
|
316
|
-
if (k.max !== undefined &&
|
|
412
|
+
const parts = raw.split(",").filter((s) => s !== "");
|
|
413
|
+
if (k.max !== undefined && parts.length > k.max) return `at most ${k.max} ${key}`;
|
|
414
|
+
const it = k.item;
|
|
415
|
+
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}`;
|
|
317
416
|
break;
|
|
318
417
|
}
|
|
418
|
+
case "string":
|
|
419
|
+
if (k.max !== undefined && raw.length > k.max) return `${key} must be at most ${k.max} characters`;
|
|
420
|
+
break;
|
|
319
421
|
case "enum":
|
|
320
422
|
if (k.values !== undefined && !k.values.includes(raw)) return `${key} must be one of ${k.values.join(", ")}`;
|
|
321
423
|
break;
|
|
@@ -326,9 +428,17 @@ export function queryRefusal(name , q )
|
|
|
326
428
|
break;
|
|
327
429
|
}
|
|
328
430
|
}
|
|
431
|
+
|
|
432
|
+
const pg = INDEXER_CONTRACT[name].page;
|
|
433
|
+
if (pg.kind === "cursor" && pg.optIn !== undefined && q.get(pg.cursor) !== null) {
|
|
434
|
+
const raw = q.get("limit");
|
|
435
|
+
if (raw !== null && raw !== "" && Number(raw) > pg.optIn.max) return `limit must be 1..${pg.optIn.max} with ${pg.cursor}`;
|
|
436
|
+
}
|
|
329
437
|
return spanRefusal(name, q);
|
|
330
438
|
}
|
|
331
439
|
|
|
440
|
+
const TABLE_REQUIRED = new Set (["search"]);
|
|
441
|
+
|
|
332
442
|
const BOOLS = { true: true, false: false, 1: true, 0: false };
|
|
333
443
|
|
|
334
444
|
export function queryArg(name , q , key ) {
|
package/dist/indexer/partners.js
CHANGED
|
@@ -47,7 +47,8 @@ export const DEX_SUMMARY = object({
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
export const DEX_PAIR = object({
|
|
50
|
-
pair: object({ id: str, asset0Id: str, asset1Id: str, createdAtBlockNumber: int, createdAtBlockTimestamp: int, feeBps: nullable(num) }),
|
|
50
|
+
pair: object({ id: str, asset0Id: str, asset1Id: str, createdAtBlockNumber: int, createdAtBlockTimestamp: int, feeBps: nullable(num), dexKey: str, createdAtTxnId: optional(str), creator: str }),
|
|
51
|
+
launch: optional(object({ id: str, token: str })),
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
export const CG_PAIRS = array(object({ ticker_id: str, base: str, target: str, pool_id: str }));
|
|
@@ -74,7 +75,7 @@ export const CG_TICKERS = array(object({
|
|
|
74
75
|
|
|
75
76
|
export const CG_TRADE = object({ trade_id: int, price: decimal, base_volume: decimal, target_volume: decimal, trade_timestamp: int, type: oneOf("buy", "sell") });
|
|
76
77
|
|
|
77
|
-
export const CG_HISTORICAL = object({ buy: optional(array(CG_TRADE)), sell: optional(array(CG_TRADE)) });
|
|
78
|
+
export const CG_HISTORICAL = object({ buy: optional(array(CG_TRADE)), sell: optional(array(CG_TRADE)), next: optional(nullable(str)) });
|
|
78
79
|
|
|
79
80
|
export const LLAMA_TVL = object({ mode: LIQUIDITY_MODE, tvl: record(big), launchTokens: array(str) });
|
|
80
81
|
|
package/dist/indexer/paths.js
CHANGED
|
@@ -6,20 +6,23 @@ export const INDEXER_ROUTES = {
|
|
|
6
6
|
stream: { pattern: "/floor-amm/stream", keys: ["launch", "state", "lastEventId"] },
|
|
7
7
|
quotes: { pattern: "/floor-amm/quotes", keys: [] },
|
|
8
8
|
summary: { pattern: "/floor-amm/summary", keys: [] },
|
|
9
|
-
floorRouted: { pattern: "/floor-amm/floor-routed", keys: [] },
|
|
9
|
+
floorRouted: { pattern: "/floor-amm/floor-routed", keys: ["limit", "cursor"] },
|
|
10
10
|
events: { pattern: "/floor-amm/events", keys: ["fromBlock", "toBlock"] },
|
|
11
|
-
launches: { pattern: "/floor-amm/launches", keys: ["sort", "order", "q", "ids", "quote", "creator", "rankable", "graduated", "limit", "offset"] },
|
|
11
|
+
launches: { pattern: "/floor-amm/launches", keys: ["sort", "order", "q", "ids", "quote", "creator", "rankable", "graduated", "preset", "limit", "cursor", "offset"] },
|
|
12
|
+
search: { pattern: "/floor-amm/search", keys: ["q", "limit", "cursor", "rankable", "graduated", "quote", "preset"] },
|
|
12
13
|
launch: { pattern: "/floor-amm/launches/<launch>", keys: [] },
|
|
13
14
|
launchState: { pattern: "/floor-amm/launches/<launch>/state", keys: [] },
|
|
14
15
|
milestones: { pattern: "/floor-amm/launches/<launch>/milestones", keys: [] },
|
|
15
16
|
holders: { pattern: "/floor-amm/launches/<launch>/holders", keys: ["limit"] },
|
|
16
17
|
trades: { pattern: "/floor-amm/launches/<launch>/trades", keys: ["limit", "before", "traders"] },
|
|
17
|
-
launchClaims: { pattern: "/floor-amm/launches/<launch>/claims", keys: ["claimer"] },
|
|
18
|
-
devBuys: { pattern: "/floor-amm/launches/<launch>/dev-buys", keys: [] },
|
|
18
|
+
launchClaims: { pattern: "/floor-amm/launches/<launch>/claims", keys: ["limit", "before", "claimer"] },
|
|
19
|
+
devBuys: { pattern: "/floor-amm/launches/<launch>/dev-buys", keys: ["limit", "before"] },
|
|
20
|
+
memberSold: { pattern: "/floor-amm/launches/<launch>/member-sold", keys: ["limit", "before"] },
|
|
21
|
+
launchAccount: { pattern: "/floor-amm/launches/<launch>/account", keys: [] },
|
|
19
22
|
traders: { pattern: "/floor-amm/launches/<launch>/traders", keys: ["window", "limit"] },
|
|
20
23
|
quoteChain: { pattern: "/floor-amm/launches/<launch>/chain", keys: [] },
|
|
21
24
|
devTrades: { pattern: "/floor-amm/launches/<launch>/dev", keys: ["limit"] },
|
|
22
|
-
burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: [] },
|
|
25
|
+
burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: ["limit", "before"] },
|
|
23
26
|
launchLocks: { pattern: "/floor-amm/launches/<launch>/locks", keys: [] },
|
|
24
27
|
marks: { pattern: "/floor-amm/launches/<launch>/marks", keys: ["limit", "before"] },
|
|
25
28
|
price: { pattern: "/floor-amm/launches/<launch>/price", keys: [] },
|
|
@@ -27,25 +30,41 @@ export const INDEXER_ROUTES = {
|
|
|
27
30
|
candleBundle: { pattern: "/floor-amm/launches/<launch>/candle-bundle", keys: ["intervals", "limit"] },
|
|
28
31
|
candles: { pattern: "/floor-amm/candles", keys: ["launch", "interval", "from", "to", "before", "limit"] },
|
|
29
32
|
walletTrades: { pattern: "/floor-amm/wallets/<wallet>/trades", keys: ["limit", "before", "launch"] },
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
tonActivity: { pattern: "/floor-amm/wallets/<wallet>/ton-activity", keys: ["limit", "before"] },
|
|
34
|
+
tonOutcome: { pattern: "/floor-amm/wallets/<wallet>/ton-outcome", keys: ["queryId"] },
|
|
35
|
+
positions: { pattern: "/floor-amm/wallets/<wallet>/positions", keys: ["limit", "cursor"] },
|
|
36
|
+
inbox: { pattern: "/floor-amm/wallets/<wallet>/inbox", keys: ["limit", "before"] },
|
|
37
|
+
walletLocks: { pattern: "/floor-amm/wallets/<wallet>/locks", keys: ["limit", "cursor"] },
|
|
38
|
+
claimHistory: { pattern: "/floor-amm/wallets/<wallet>/claims", keys: ["limit", "cursor"] },
|
|
34
39
|
firsts: { pattern: "/floor-amm/wallets/<wallet>/firsts", keys: [] },
|
|
35
40
|
firstsMany: { pattern: "/floor-amm/wallets/firsts", keys: ["wallets"] },
|
|
36
|
-
claimView: { pattern: "/floor-amm/claims/<wallet>", keys: [] },
|
|
37
|
-
people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: [] },
|
|
38
|
-
roles: { pattern: "/floor-amm/roles/<wallet>", keys: [] },
|
|
41
|
+
claimView: { pattern: "/floor-amm/claims/<wallet>", keys: ["limit", "cursor"] },
|
|
42
|
+
people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor"] },
|
|
43
|
+
roles: { pattern: "/floor-amm/roles/<wallet>", keys: ["limit", "cursor"] },
|
|
44
|
+
handlePlaces: { pattern: "/floor-amm/handles/<handle>/places", keys: ["limit", "cursor"] },
|
|
39
45
|
traderBoard: { pattern: "/floor-amm/leaderboards/traders", keys: ["window", "limit"] },
|
|
40
46
|
launcherBoard: { pattern: "/floor-amm/leaderboards/launchers", keys: ["limit"] },
|
|
41
47
|
} ;
|
|
42
48
|
|
|
43
|
-
export const LAUNCH_SORTS = ["created", "newest", "volume1h", "volume24h", "volume7d", "volume", "marketCap", "liquidity", "backed", "trades24h", "holders", "change1h", "change24h", "lastTrade", "nearFloor", "trending", "newHolders24h"] ;
|
|
49
|
+
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"] ;
|
|
44
50
|
|
|
45
51
|
export const IDS_MAX = 100;
|
|
46
52
|
|
|
47
53
|
export const LAUNCHES_PAGE_MAX = 1_000;
|
|
48
54
|
|
|
55
|
+
export const LAUNCHES_PAGE_DEFAULT = 100;
|
|
56
|
+
|
|
57
|
+
export const LAUNCH_CURSOR_MAX = 512;
|
|
58
|
+
|
|
59
|
+
export const WALLET_PAGE_DEFAULT = 100;
|
|
60
|
+
export const WALLET_PAGE_MAX = 500;
|
|
61
|
+
|
|
62
|
+
export const WALLET_CURSOR_MAX = 256;
|
|
63
|
+
export const INBOX_PAGE_DEFAULT = 100;
|
|
64
|
+
export const INBOX_PAGE_MAX = 500;
|
|
65
|
+
|
|
66
|
+
export const PRESET_FILTER_MAX = 16;
|
|
67
|
+
|
|
49
68
|
export const FIRSTS_MAX = 100;
|
|
50
69
|
|
|
51
70
|
export const STREAM_STATE_MAX = 16;
|
|
@@ -66,6 +85,8 @@ const need = (s ) => {
|
|
|
66
85
|
};
|
|
67
86
|
const seg = (s ) => encodeURIComponent(need(s));
|
|
68
87
|
|
|
88
|
+
const presets = (p ) => (p === undefined || p.length === 0 ? undefined : p.map(String));
|
|
89
|
+
|
|
69
90
|
const launchPath = (id , tail = "") => `/floor-amm/launches/${seg(id)}${tail}`;
|
|
70
91
|
const walletPath = (w , tail ) => `/floor-amm/wallets/${seg(w)}${tail}`;
|
|
71
92
|
|
|
@@ -78,25 +99,33 @@ export const indexerPath = {
|
|
|
78
99
|
},
|
|
79
100
|
quotes: () => "/floor-amm/quotes",
|
|
80
101
|
summary: () => "/floor-amm/summary",
|
|
81
|
-
floorRouted: () =>
|
|
102
|
+
floorRouted: (q = {}) => `/floor-amm/floor-routed${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
82
103
|
events: (fromBlock , toBlock ) => `/floor-amm/events${query({ fromBlock, toBlock })}`,
|
|
83
104
|
|
|
84
105
|
launches: (q = {}) => {
|
|
85
106
|
if (q.ids !== undefined && q.ids.length > IDS_MAX) throw new RangeError(`at most ${IDS_MAX} ids`);
|
|
86
107
|
const sort = q.sort ?? (q.ids === undefined ? "created" : undefined);
|
|
87
|
-
|
|
108
|
+
if (q.preset !== undefined && q.preset.length > PRESET_FILTER_MAX) throw new RangeError(`at most ${PRESET_FILTER_MAX} presets`);
|
|
109
|
+
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 })}`;
|
|
110
|
+
},
|
|
111
|
+
search: (q ) => {
|
|
112
|
+
if (q.q.trim() === "") throw new RangeError("an empty search");
|
|
113
|
+
if (q.preset !== undefined && q.preset.length > PRESET_FILTER_MAX) throw new RangeError(`at most ${PRESET_FILTER_MAX} presets`);
|
|
114
|
+
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) })}`;
|
|
88
115
|
},
|
|
89
116
|
launch: (id ) => launchPath(id),
|
|
90
117
|
launchState: (id ) => launchPath(id, "/state"),
|
|
91
118
|
milestones: (id ) => launchPath(id, "/milestones"),
|
|
92
119
|
holders: (id , q = {}) => launchPath(id, `/holders${query({ limit: q.limit })}`),
|
|
93
120
|
trades: (id , q = {}) => launchPath(id, `/trades${query({ limit: q.limit, before: q.before, traders: q.traders?.length ? q.traders : undefined })}`),
|
|
94
|
-
launchClaims: (id , q
|
|
95
|
-
devBuys: (id ) => launchPath(id,
|
|
121
|
+
launchClaims: (id , q = {}) => launchPath(id, `/claims${query({ limit: q.limit, before: q.before, claimer: q.claimer })}`),
|
|
122
|
+
devBuys: (id , q = {}) => launchPath(id, `/dev-buys${query({ limit: q.limit, before: q.before })}`),
|
|
123
|
+
memberSold: (id , q = {}) => launchPath(id, `/member-sold${query({ limit: q.limit, before: q.before })}`),
|
|
124
|
+
launchAccount: (id ) => launchPath(id, "/account"),
|
|
96
125
|
traders: (id , q = {}) => launchPath(id, `/traders${query({ window: q.window, limit: q.limit })}`),
|
|
97
126
|
quoteChain: (id ) => launchPath(id, "/chain"),
|
|
98
127
|
devTrades: (id , q = {}) => launchPath(id, `/dev${query({ limit: q.limit })}`),
|
|
99
|
-
burns: (id ) => launchPath(id,
|
|
128
|
+
burns: (id , q = {}) => launchPath(id, `/burns${query({ limit: q.limit, before: q.before })}`),
|
|
100
129
|
launchLocks: (id ) => launchPath(id, "/locks"),
|
|
101
130
|
marks: (id , q = {}) => launchPath(id, `/marks${query({ limit: q.limit, before: q.before })}`),
|
|
102
131
|
price: (id ) => launchPath(id, "/price"),
|
|
@@ -110,18 +139,27 @@ export const indexerPath = {
|
|
|
110
139
|
return `/floor-amm/candles${query({ launch: need(q.launch), interval: q.interval, from: q.from, to: q.to, before: q.before, limit: q.limit })}`;
|
|
111
140
|
},
|
|
112
141
|
walletTrades: (w , q = {}) => walletPath(w, `/trades${query({ limit: q.limit, before: q.before, launch: q.launch })}`),
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
142
|
+
|
|
143
|
+
tonActivity: (w , q = {}) => walletPath(w, `/ton-activity${query({ limit: q.limit, before: q.before })}`),
|
|
144
|
+
tonOutcome: (w , queryId ) => walletPath(w, `/ton-outcome${query({ queryId: String(queryId) })}`),
|
|
145
|
+
|
|
146
|
+
positions: (w , q = {}) => walletPath(w, `/positions${query({ limit: q.limit, cursor: q.cursor })}`),
|
|
147
|
+
|
|
148
|
+
inbox: (w , q = {}) => walletPath(w, `/inbox${query({ limit: q.limit, before: q.before })}`),
|
|
149
|
+
walletLocks: (w , q = {}) => walletPath(w, `/locks${query({ limit: q.limit, cursor: q.cursor })}`),
|
|
150
|
+
|
|
151
|
+
claimHistory: (w , q = {}) => walletPath(w, `/claims${query({ limit: q.limit, cursor: q.cursor })}`),
|
|
117
152
|
firsts: (w ) => walletPath(w, "/firsts"),
|
|
118
153
|
firstsMany: (wallets ) => {
|
|
119
154
|
if (wallets.length === 0 || wallets.length > FIRSTS_MAX) throw new RangeError(`1..${FIRSTS_MAX} wallets`);
|
|
120
155
|
return `/floor-amm/wallets/firsts${query({ wallets })}`;
|
|
121
156
|
},
|
|
122
|
-
claimView: (w ) => `/floor-amm/claims/${seg(w)}`,
|
|
123
|
-
|
|
124
|
-
|
|
157
|
+
claimView: (w , q = {}) => `/floor-amm/claims/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
158
|
+
|
|
159
|
+
people: (w , q = {}) => `/floor-amm/referrals/${seg(w)}/people${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
160
|
+
|
|
161
|
+
roles: (w , q = {}) => `/floor-amm/roles/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
162
|
+
handlePlaces: (handle , q = {}) => `/floor-amm/handles/${seg(handle)}/places${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
125
163
|
traderBoard: (q = {}) => `/floor-amm/leaderboards/traders${query({ window: q.window, limit: q.limit })}`,
|
|
126
164
|
launcherBoard: (q = {}) => `/floor-amm/leaderboards/launchers${query({ limit: q.limit })}`,
|
|
127
165
|
} ;
|
package/dist/indexer/read.js
CHANGED
|
@@ -9,11 +9,14 @@ import { errorCode } from "./contract.js";
|
|
|
9
9
|
export * from "./bodies.js";
|
|
10
10
|
export { ShapeError, decode } from "./decode.js";
|
|
11
11
|
|
|
12
|
-
export { FIRSTS_MAX, IDS_MAX, INDEXER_ROUTES, LAUNCHES_PAGE_MAX, LAUNCH_SORTS, STREAM_STATE_MAX, indexerPath, query } from "./paths.js";
|
|
12
|
+
export { FIRSTS_MAX, IDS_MAX, INDEXER_ROUTES, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PRESET_FILTER_MAX, STREAM_STATE_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX, indexerPath, query } from "./paths.js";
|
|
13
|
+
export { ADDRESS_PREFIX_MIN, SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX, SEARCH_PARITY_CORPUS, SEARCH_Q_MAX, SEARCH_SUBSTRING_MIN, searchFold, searchNeedle, searchNeedles, searchServed, searchServedTier, searchTier, searchTierFolded } from "./search.js";
|
|
14
|
+
|
|
13
15
|
export * from "./partners.js";
|
|
14
|
-
export
|
|
16
|
+
export * from "./stack-edge.js";
|
|
17
|
+
export { INDEXER_CONTRACT, INDEXER_ERROR_CODES, LIMITS, OPEN_ROUTES, ROUTE_NAMES, UNITS, clampLimit, errorCode, matchRoute, pageAsked, pageLimit, queryArg, queryBool, queryLimit, queryRefusal, routeLimit, spanRefusal } from "./contract.js";
|
|
15
18
|
|
|
16
|
-
export { createIndexerClient, routePath } from "./client.js";
|
|
19
|
+
export { DRAIN_NAMES, createIndexerClient, routePath } from "./client.js";
|
|
17
20
|
|
|
18
21
|
export class IndexerError extends Error {
|
|
19
22
|
status ;
|
|
@@ -55,6 +58,8 @@ export const readEvents = (get , fromBlock , toBlock )
|
|
|
55
58
|
|
|
56
59
|
export const readLaunches = (get , q = {}) => readRoute(get, indexerPath.launches(q), B.LAUNCHES);
|
|
57
60
|
|
|
61
|
+
export const readLaunchSearch = (get , q ) => readRoute(get, indexerPath.search(q), B.LAUNCH_SEARCH);
|
|
62
|
+
|
|
58
63
|
export const readLaunch = (get , id ) => readRoute(get, indexerPath.launch(id), B.LAUNCH_ONE);
|
|
59
64
|
|
|
60
65
|
export const readLaunchState = (get , id ) => readRoute(get, indexerPath.launchState(id), B.LAUNCH_STATE);
|
|
@@ -63,14 +68,25 @@ export const readMilestones = (get , id )
|
|
|
63
68
|
export const readHolders = (get , id , q = {}) => readRoute(get, indexerPath.holders(id, q), B.HOLDERS);
|
|
64
69
|
|
|
65
70
|
export const readTrades = (get , id , q = {}) => readRoute(get, indexerPath.trades(id, q), B.TRADES);
|
|
66
|
-
export const readLaunchClaims = (get , id , q
|
|
67
|
-
export const readDevBuys = (get , id ) => readRoute(get, indexerPath.devBuys(id), B.DEV_BUYS);
|
|
71
|
+
export const readLaunchClaims = (get , id , q = {}) => readRoute(get, indexerPath.launchClaims(id, q), B.LAUNCH_CLAIMS);
|
|
72
|
+
export const readDevBuys = (get , id , q = {}) => readRoute(get, indexerPath.devBuys(id, q), B.DEV_BUYS);
|
|
73
|
+
|
|
74
|
+
export const readMemberSold = (get , id , q = {}) => readRoute(get, indexerPath.memberSold(id, q), B.MEMBER_SOLD);
|
|
75
|
+
|
|
76
|
+
export const readLaunchAccount = (get , id ) => readRoute(get, indexerPath.launchAccount(id), B.LAUNCH_ACCOUNT);
|
|
77
|
+
|
|
78
|
+
export function launchAccountBytes(body ) {
|
|
79
|
+
const bin = atob(body.data);
|
|
80
|
+
const out = new Uint8Array(bin.length);
|
|
81
|
+
for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
68
84
|
|
|
69
85
|
export const readTraders = (get , id , q = {}) => readRoute(get, indexerPath.traders(id, q), B.LAUNCH_TRADERS);
|
|
70
86
|
export const readQuoteChain = (get , id ) => readRoute(get, indexerPath.quoteChain(id), B.QUOTE_CHAIN);
|
|
71
87
|
|
|
72
88
|
export const readDevTrades = (get , id , q = {}) => readRoute(get, indexerPath.devTrades(id, q), B.DEV_TRADES);
|
|
73
|
-
export const readBurns = (get , id ) => readRoute(get, indexerPath.burns(id), B.BURNS);
|
|
89
|
+
export const readBurns = (get , id , q = {}) => readRoute(get, indexerPath.burns(id, q), B.BURNS);
|
|
74
90
|
export const readLaunchLocks = (get , id ) => readRoute(get, indexerPath.launchLocks(id), B.LAUNCH_LOCKS);
|
|
75
91
|
|
|
76
92
|
export const readMarks = (get , id , q = {}) => readRoute(get, indexerPath.marks(id, q), B.MARKS);
|
|
@@ -81,18 +97,22 @@ export const readCandleBundle = (get , id , q
|
|
|
81
97
|
export const readHighs = (get , id , q = {}) => readRoute(get, indexerPath.highs(id, q), B.HIGHS);
|
|
82
98
|
|
|
83
99
|
export const readWalletTrades = (get , wallet , q = {}) => readRoute(get, indexerPath.walletTrades(wallet, q), B.WALLET_TRADES);
|
|
84
|
-
export const
|
|
100
|
+
export const readTonActivity = (get , wallet , q = {}) => readRoute(get, indexerPath.tonActivity(wallet, q), B.TON_ACTIVITY);
|
|
101
|
+
export const readTonOutcome = (get , wallet , queryId ) => readRoute(get, indexerPath.tonOutcome(wallet, queryId), B.TON_OUTCOME);
|
|
102
|
+
export const readPositions = (get , wallet , q = {}) => readRoute(get, indexerPath.positions(wallet, q), B.POSITIONS);
|
|
85
103
|
|
|
86
|
-
export const readInbox = (get , wallet , q
|
|
87
|
-
export const readWalletLocks = (get , wallet ) => readRoute(get, indexerPath.walletLocks(wallet), B.WALLET_LOCKS);
|
|
88
|
-
export const readClaimHistory = (get , wallet ) => readRoute(get, indexerPath.claimHistory(wallet), B.CLAIM_HISTORY);
|
|
104
|
+
export const readInbox = (get , wallet , q = {}) => readRoute(get, indexerPath.inbox(wallet, q), B.INBOX);
|
|
105
|
+
export const readWalletLocks = (get , wallet , q = {}) => readRoute(get, indexerPath.walletLocks(wallet, q), B.WALLET_LOCKS);
|
|
106
|
+
export const readClaimHistory = (get , wallet , q = {}) => readRoute(get, indexerPath.claimHistory(wallet, q), B.CLAIM_HISTORY);
|
|
89
107
|
|
|
90
|
-
export const readClaimView = (get , wallet ) => readRoute(get, indexerPath.claimView(wallet), B.CLAIM_VIEW);
|
|
108
|
+
export const readClaimView = (get , wallet , q = {}) => readRoute(get, indexerPath.claimView(wallet, q), B.CLAIM_VIEW);
|
|
91
109
|
export const readFirsts = (get , wallet ) => readRoute(get, indexerPath.firsts(wallet), B.FIRSTS);
|
|
92
110
|
|
|
93
111
|
export const readFirstsMany = (get , wallets ) => readRoute(get, indexerPath.firstsMany(wallets), B.FIRSTS_MANY);
|
|
94
|
-
export const readPeople = (get , wallet ) => readRoute(get, indexerPath.people(wallet), B.PEOPLE);
|
|
95
|
-
export const readRoles = (get , wallet ) => readRoute(get, indexerPath.roles(wallet), B.ROLES);
|
|
112
|
+
export const readPeople = (get , wallet , q = {}) => readRoute(get, indexerPath.people(wallet, q), B.PEOPLE);
|
|
113
|
+
export const readRoles = (get , wallet , q = {}) => readRoute(get, indexerPath.roles(wallet, q), B.ROLES);
|
|
114
|
+
|
|
115
|
+
export const readHandlePlaces = (get , handle , q = {}) => readRoute(get, indexerPath.handlePlaces(handle, q), B.HANDLE_PLACES);
|
|
96
116
|
|
|
97
117
|
export const readTraderBoard = (get , q = {}) => readRoute(get, indexerPath.traderBoard(q), B.TRADER_BOARD);
|
|
98
118
|
export const readLauncherBoard = (get , q = {}) => readRoute(get, indexerPath.launcherBoard(q), B.LAUNCHER_BOARD);
|
|
@@ -107,3 +127,8 @@ export function offPriceBps(price , quotedX64
|
|
|
107
127
|
if (p === 0n) return null;
|
|
108
128
|
return Number(((quotedX64 - p) * 10_000n) / p);
|
|
109
129
|
}
|
|
130
|
+
|
|
131
|
+
export function cursorPage (body , rows ) {
|
|
132
|
+
if (body.next === undefined) throw new Error(`not a page: the body has no next (rows ${rows})`);
|
|
133
|
+
return { rows: body[rows], next: body.next };
|
|
134
|
+
}
|