@floorlaunchpad/sdk 0.6.0 → 0.7.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 +136 -0
- package/dist/abi/evm-event-names.js +7 -0
- package/dist/abi/evm.gen.js +6 -0
- package/dist/abi/functions.gen.js +48 -0
- package/dist/abi/solana.gen.js +5 -0
- package/dist/errors.js +2 -2
- package/dist/events/types.gen.js +1 -1
- package/dist/evm/chains.js +31 -0
- package/dist/evm/floor/calls.js +5 -0
- package/dist/evm/squid.js +1 -1
- package/dist/generated/interface.gen.js +48 -43
- package/dist/indexer/bodies.js +135 -4
- package/dist/indexer/client.js +10 -1
- package/dist/indexer/contract.js +65 -6
- package/dist/indexer/paths.js +34 -7
- package/dist/indexer/read.js +12 -3
- package/dist/indexer/stream.js +2 -2
- package/dist/math/v2/fees.js +30 -4
- package/dist/math/v2/milestones.js +1 -1
- package/dist/math/v2/receipt.js +3 -3
- package/dist/math/v2/rows.js +17 -0
- package/dist/math/v2/team.js +14 -1
- package/dist/solana/floor/accounts.js +30 -3
- package/dist/solana/floor/events.js +6 -0
- package/dist/solana/floor/instructions.js +23 -1
- package/dist/solana/floor/program.js +3 -0
- package/dist/ton/gas.js +2 -2
- package/dist/v2/events.js +2 -0
- package/dist/v2/evm.js +5 -0
- package/dist/v2/layouts.js +3 -1
- package/dist/v2/solana.js +1 -1
- package/dist/v2/tx/evm.js +15 -1
- package/docs/cursor-pages.md +9 -3
- package/docs/ton.md +1 -1
- package/package.json +1 -1
- package/src/abi/evm-event-names.ts +7 -0
- package/src/abi/evm.gen.ts +6 -0
- package/src/abi/functions.gen.ts +48 -0
- package/src/abi/solana.gen.ts +5 -0
- package/src/errors.ts +2 -2
- package/src/events/types.gen.ts +57 -1
- package/src/evm/chains.ts +31 -0
- package/src/evm/floor/calls.ts +5 -0
- package/src/evm/squid.ts +1 -1
- package/src/generated/interface.gen.ts +48 -43
- package/src/indexer/bodies.ts +142 -4
- package/src/indexer/client.ts +17 -4
- package/src/indexer/contract.ts +66 -7
- package/src/indexer/paths.ts +62 -7
- package/src/indexer/read.ts +14 -5
- package/src/indexer/stream.ts +4 -4
- package/src/math/v2/fees.ts +30 -4
- package/src/math/v2/milestones.ts +1 -1
- package/src/math/v2/receipt.ts +7 -3
- package/src/math/v2/rows.ts +17 -0
- package/src/math/v2/team.ts +14 -1
- package/src/solana/floor/accounts.ts +30 -3
- package/src/solana/floor/events.ts +6 -0
- package/src/solana/floor/instructions.ts +23 -1
- package/src/solana/floor/program.ts +3 -0
- package/src/ton/gas.ts +2 -2
- package/src/v2/events.ts +3 -1
- package/src/v2/evm.ts +5 -0
- package/src/v2/layouts.ts +3 -1
- package/src/v2/solana.ts +1 -1
- package/src/v2/tx/evm.ts +15 -1
- package/src/v2/types.ts +11 -1
package/dist/indexer/bodies.js
CHANGED
|
@@ -123,16 +123,27 @@ const LISTED_FIELDS = {
|
|
|
123
123
|
volume24hGross: nullable(big),
|
|
124
124
|
holders: int,
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
holdersChange1h: nullable(int),
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
holdersChange24h: nullable(int),
|
|
129
|
+
|
|
130
|
+
volume1h: nullable(big),
|
|
131
|
+
|
|
132
|
+
volumePrev1h: nullable(big),
|
|
129
133
|
|
|
130
134
|
maxLossPpm: optional(nullable(int)),
|
|
131
135
|
|
|
132
136
|
backedPpm: nullable(int),
|
|
133
137
|
volume24hUsd: nullable(decimal),
|
|
138
|
+
|
|
139
|
+
volume1hUsd: nullable(decimal),
|
|
140
|
+
volumePrev1hUsd: nullable(decimal),
|
|
134
141
|
marketCapUsd: nullable(decimal),
|
|
135
142
|
|
|
143
|
+
athPrice: nullable(big),
|
|
144
|
+
|
|
145
|
+
athPriceUsd: nullable(decimal),
|
|
146
|
+
|
|
136
147
|
trendingScore: nullable(big),
|
|
137
148
|
|
|
138
149
|
change24hBps: optional(nullable(int)),
|
|
@@ -176,6 +187,10 @@ const TRADE_FIELDS = {
|
|
|
176
187
|
};
|
|
177
188
|
export const TRADE = object(TRADE_FIELDS);
|
|
178
189
|
|
|
190
|
+
export const TRADE_REFS = object({ tp: optional(str), t: optional(array(str)), cp: optional(str), c: optional(array(str)) });
|
|
191
|
+
|
|
192
|
+
export const STREAM_TRADE = object({ ...TRADE_FIELDS, refs: optional(TRADE_REFS) });
|
|
193
|
+
|
|
179
194
|
export const PAGED_TRADE = object({ id: str, ...TRADE_FIELDS });
|
|
180
195
|
|
|
181
196
|
export const HEAD = object({
|
|
@@ -280,7 +295,7 @@ export const LAUNCH_CLAIM = object({ launch: str, claimer: str, types: int, quot
|
|
|
280
295
|
|
|
281
296
|
export const LAUNCH_CLAIMS = object({ indexed, claims: array(LAUNCH_CLAIM), next: optional(nullable(str)) });
|
|
282
297
|
|
|
283
|
-
export const DEV_BUYS = object({ indexed, teamBuyUnlocked: bool, teamBuyUnlockedTs: nullable(int), devBuys: array(DEV_BUY), next: optional(nullable(str)) });
|
|
298
|
+
export const DEV_BUYS = object({ indexed, teamBuyUnlocked: bool, teamBuyUnlockedTs: nullable(int), devBuys: array(DEV_BUY), next: optional(nullable(str)), totals: object({ count: int, tokens: big, quote: big }), asOf: nullable(str) });
|
|
284
299
|
|
|
285
300
|
export const MEMBER_SOLD_ROW = object({ launch: str, member: str, place: int, amount: big, quoteOut: big, block: int, timestamp: int, tx: str, id: str });
|
|
286
301
|
|
|
@@ -369,6 +384,115 @@ export const DEV_TRADES = object({ indexed, launch: str, creator: str, trades: a
|
|
|
369
384
|
|
|
370
385
|
export const BURNS = object({ indexed, launch: str, burns: array(object({ id: optional(str), amount: big, block: int, timestamp: int })), program: array(object({ ...BURN_FIELDS, id: optional(str) })), wallet: array(object({ ...BURN_FIELDS, id: optional(str) })), next: optional(nullable(str)) });
|
|
371
386
|
|
|
387
|
+
export const RT_POINTS_MAX = 720;
|
|
388
|
+
|
|
389
|
+
export const RAISE_STEPS = [60, 300, 900, 3_600, 14_400, 86_400] ;
|
|
390
|
+
|
|
391
|
+
function checked (d , ok ) {
|
|
392
|
+
return (v, p) => {
|
|
393
|
+
const x = d(v, p);
|
|
394
|
+
const why = ok(x);
|
|
395
|
+
if (why !== null) throw new ShapeError(p, why, v);
|
|
396
|
+
return x;
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
const ascending = (xs , strict ) => xs.every((x, i) => i === 0 || (strict ? x.time > xs[i - 1] .time : x.time >= xs[i - 1] .time));
|
|
400
|
+
|
|
401
|
+
export const RAISE_COUNTS = object({
|
|
402
|
+
buys: int,
|
|
403
|
+
sells: int,
|
|
404
|
+
|
|
405
|
+
last: nullable(int),
|
|
406
|
+
|
|
407
|
+
largest: nullable(object({ time: int, amount: big, id: str })),
|
|
408
|
+
|
|
409
|
+
raised: big,
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
export const RAISE_SERIES = checked(
|
|
413
|
+
object({
|
|
414
|
+
indexed,
|
|
415
|
+
launch: str,
|
|
416
|
+
from: int,
|
|
417
|
+
to: int,
|
|
418
|
+
step: int,
|
|
419
|
+
points: array(object({ time: int, liveTotal: big })),
|
|
420
|
+
pace: array(object({ time: int, bought: big, sold: big })),
|
|
421
|
+
counts: RAISE_COUNTS,
|
|
422
|
+
total: int,
|
|
423
|
+
first: nullable(str),
|
|
424
|
+
asOf: nullable(str),
|
|
425
|
+
}),
|
|
426
|
+
(b) => (b.points.length > RT_POINTS_MAX ? `at most ${RT_POINTS_MAX} points` : !b.points.every((x, i) => i === 0 || x.time === b.points[i - 1] .time + b.step) ? "points on the grid, oldest first" : !ascending(b.pace, true) ? "pace oldest first" : null),
|
|
427
|
+
);
|
|
428
|
+
|
|
429
|
+
export const FLOOR_STEP = object({ id: str, block: int, timestamp: int, floorX64: big, floorMoney: nullable(big) });
|
|
430
|
+
|
|
431
|
+
export const FLOOR_STEPS = checked(
|
|
432
|
+
object({
|
|
433
|
+
indexed,
|
|
434
|
+
launch: str,
|
|
435
|
+
from: int,
|
|
436
|
+
to: int,
|
|
437
|
+
points: int,
|
|
438
|
+
steps: array(FLOOR_STEP),
|
|
439
|
+
totals: object({ steps: int, first: nullable(str), last: nullable(str), firstFloorX64: nullable(big), lastFloorX64: nullable(big) }),
|
|
440
|
+
asOf: nullable(str),
|
|
441
|
+
}),
|
|
442
|
+
(b) => (b.points > RT_POINTS_MAX || b.steps.length > b.points ? `at most ${Math.min(b.points, RT_POINTS_MAX)} steps` : !b.steps.every((x, i) => i === 0 || x.timestamp > b.steps[i - 1] .timestamp) ? "steps oldest first" : b.steps.length > b.totals.steps ? "no more steps than the totals count" : null),
|
|
443
|
+
);
|
|
444
|
+
|
|
445
|
+
export const roundTrip = (v, p) => {
|
|
446
|
+
if (typeof v !== "string") throw new ShapeError(p, "a round-trip number string", v);
|
|
447
|
+
const n = Number(v);
|
|
448
|
+
if (!Number.isFinite(n) || String(n) !== v) throw new ShapeError(p, "a round-trip number string", v);
|
|
449
|
+
return n;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
export const POSITION_FOLD = object({
|
|
453
|
+
|
|
454
|
+
held: roundTrip,
|
|
455
|
+
|
|
456
|
+
cost: roundTrip,
|
|
457
|
+
|
|
458
|
+
realised: roundTrip,
|
|
459
|
+
|
|
460
|
+
costSold: roundTrip,
|
|
461
|
+
|
|
462
|
+
uncoveredSold: roundTrip,
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
export const POSITION_TOTALS_ROW = object({
|
|
466
|
+
wallet: str,
|
|
467
|
+
launch: str,
|
|
468
|
+
token: str,
|
|
469
|
+
quote: str,
|
|
470
|
+
fills: int,
|
|
471
|
+
buys: int,
|
|
472
|
+
sells: int,
|
|
473
|
+
bought: big,
|
|
474
|
+
sold: big,
|
|
475
|
+
spent: big,
|
|
476
|
+
received: big,
|
|
477
|
+
teamBuy: big,
|
|
478
|
+
firstTs: nullable(int),
|
|
479
|
+
lastTs: nullable(int),
|
|
480
|
+
asOf: nullable(str),
|
|
481
|
+
quoteDecimals: nullable(int),
|
|
482
|
+
fold: nullable(POSITION_FOLD),
|
|
483
|
+
foldReason: nullable(str),
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
export const POSITION_TOTALS = checked(
|
|
487
|
+
object({ indexed, wallet: str, positions: array(POSITION_TOTALS_ROW), next: nullable(str) }),
|
|
488
|
+
(b) => (b.positions.some((r) => (r.fold === null) === (r.foldReason === null)) ? "fold or its reason, one of them" : b.positions.some((r) => r.fills !== r.buys + r.sells) ? "fills = buys + sells" : null),
|
|
489
|
+
);
|
|
490
|
+
|
|
491
|
+
export const LAUNCH_TRADED = checked(
|
|
492
|
+
object({ indexed, launch: str, traded: array(object({ wallet: str, traded: bool, firstTs: nullable(int) })), asOf: nullable(str) }),
|
|
493
|
+
(b) => (b.traded.some((r) => r.traded === (r.firstTs === null)) ? "firstTs exactly where traded" : null),
|
|
494
|
+
);
|
|
495
|
+
|
|
372
496
|
const LOCK_HOLDER = object({ wallet: str, place: nullable(int) });
|
|
373
497
|
|
|
374
498
|
export const TEAM_BUY_LOCK = object({ kind: oneOf("teamBuy"), tokens: big, createdAt: int, unlocked: bool, unlockedAt: nullable(int), unlockAt: nullable(int), locked: big, claimed: big, holders: array(LOCK_HOLDER) });
|
|
@@ -518,10 +642,17 @@ export const FIRSTS_MANY = object({ indexed, wallets: record(FIRSTS_ROW) });
|
|
|
518
642
|
|
|
519
643
|
const PER_QUOTE = array(object({ quote: str, amount: big }));
|
|
520
644
|
|
|
645
|
+
export const PEOPLE_ROLE = object({ kind: oneOf("trader", "creator"), tier: int, via: nullable(str) });
|
|
646
|
+
|
|
521
647
|
export const PEOPLE = object({
|
|
522
648
|
indexed,
|
|
523
649
|
wallet: str,
|
|
524
|
-
people: array(object({ wallet: str, chain: str, roles: array(
|
|
650
|
+
people: array(object({ wallet: str, chain: str, roles: array(PEOPLE_ROLE), earned: PER_QUOTE, teamMilestone: PER_QUOTE, unclaimed: PER_QUOTE })),
|
|
651
|
+
pooled: PER_QUOTE,
|
|
652
|
+
|
|
653
|
+
accountsAt: optional(nullable(int)),
|
|
654
|
+
|
|
655
|
+
og: optional(nullable(object({ from: int, until: int, revoked: bool }))),
|
|
525
656
|
|
|
526
657
|
next: optional(nullable(str)),
|
|
527
658
|
});
|
package/dist/indexer/client.js
CHANGED
|
@@ -39,6 +39,9 @@ export const routePath = {
|
|
|
39
39
|
launchLocks: (a) => indexerPath.launchLocks(a.launch),
|
|
40
40
|
marks: ({ launch, ...q }) => indexerPath.marks(launch, q),
|
|
41
41
|
price: (a) => indexerPath.price(a.launch),
|
|
42
|
+
raiseSeries: ({ launch, ...q }) => indexerPath.raiseSeries(launch, q),
|
|
43
|
+
floorSteps: ({ launch, ...q }) => indexerPath.floorSteps(launch, q),
|
|
44
|
+
launchTraded: (a) => indexerPath.launchTraded(a.launch, a.wallets),
|
|
42
45
|
highs: ({ launch, ...q }) => indexerPath.highs(launch, q),
|
|
43
46
|
candles: (a) => indexerPath.candles(a),
|
|
44
47
|
candlesMany: (a) => indexerPath.candlesMany(a),
|
|
@@ -47,6 +50,7 @@ export const routePath = {
|
|
|
47
50
|
tonActivity: ({ wallet, ...q }) => indexerPath.tonActivity(wallet, q),
|
|
48
51
|
tonOutcome: (a) => indexerPath.tonOutcome(a.wallet, a.queryId),
|
|
49
52
|
positions: ({ wallet, ...q }) => indexerPath.positions(wallet, q),
|
|
53
|
+
positionTotals: ({ wallet, ...q }) => indexerPath.positionTotals(wallet, q),
|
|
50
54
|
inbox: ({ wallet, ...q }) => indexerPath.inbox(wallet, q),
|
|
51
55
|
walletLocks: ({ wallet, ...q }) => indexerPath.walletLocks(wallet, q),
|
|
52
56
|
claimHistory: ({ wallet, ...q }) => indexerPath.claimHistory(wallet, q),
|
|
@@ -73,7 +77,7 @@ export const routePath = {
|
|
|
73
77
|
health: () => "/health",
|
|
74
78
|
};
|
|
75
79
|
|
|
76
|
-
export const DRAIN_NAMES = ["trades", "launchClaims", "memberSold", "burns", "walletTrades", "launches", "search", "marks", "inbox", "positions", "walletLocks", "claimHistory", "people", "roles", "tokenHolders", "tonActivity", "cgHistoricalTrades", "floorRouted", "devBuys", "claimView", "handlePlaces"] ;
|
|
80
|
+
export const DRAIN_NAMES = ["trades", "launchClaims", "memberSold", "burns", "walletTrades", "launches", "search", "marks", "inbox", "positions", "walletLocks", "claimHistory", "people", "roles", "tokenHolders", "tonActivity", "cgHistoricalTrades", "floorRouted", "devBuys", "claimView", "handlePlaces", "positionTotals"] ;
|
|
77
81
|
|
|
78
82
|
export function createIndexerClient(opts ) {
|
|
79
83
|
|
|
@@ -96,6 +100,11 @@ export function createIndexerClient(opts ) {
|
|
|
96
100
|
const lim = routeLimit(name) ;
|
|
97
101
|
let args = { ...a };
|
|
98
102
|
|
|
103
|
+
if (args.person !== undefined) {
|
|
104
|
+
yield await read(name, args);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
99
108
|
if (page.kind === "cursor" && page.optIn !== undefined && args.before === undefined) args = { ...args, before: "" };
|
|
100
109
|
if (page.kind === "keyset" && page.optIn === true && args.limit === undefined && args.cursor === undefined) args = { ...args, limit: lim.default };
|
|
101
110
|
for (let i = 0; i < max; i++) {
|
package/dist/indexer/contract.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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 { CANDLES_MANY_IDS_MAX, CANDLES_MANY_LIMIT_DEFAULT, CANDLES_MANY_ROWS_MAX, FIRSTS_MAX, IDS_MAX, LAUNCH_LISTS_QUOTES_MAX, LAUNCH_LISTS_ROWS_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";
|
|
6
|
+
import { CANDLES_MANY_IDS_MAX, CANDLES_MANY_LIMIT_DEFAULT, CANDLES_MANY_ROWS_MAX, FIRSTS_MAX, POSITION_TOTALS_PAGE_MAX, TRADED_WALLETS_MAX, IDS_MAX, LAUNCH_LISTS_QUOTES_MAX, LAUNCH_LISTS_ROWS_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PEOPLE_PERSON_MAX, PRESET_FILTER_MAX, STREAM_STATE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX } from "./paths.js";
|
|
7
7
|
import { SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX, SEARCH_Q_MAX } from "./search.js";
|
|
8
8
|
|
|
9
9
|
export const UNITS = {
|
|
@@ -102,6 +102,9 @@ export const INDEXER_CONTRACT = {
|
|
|
102
102
|
launch: { kind: "list", doc: "only these launches' frames (and their quote chains' relatives)" },
|
|
103
103
|
state: { kind: "list", doc: "state frames (the launch whole on each change) for these", max: STREAM_STATE_MAX },
|
|
104
104
|
lastEventId: { kind: "string", doc: "resume after this frame id (EventSource sends Last-Event-ID itself)" },
|
|
105
|
+
seat: { kind: "enum", doc: "relay: the site relay's seat (pipes are refused first)", values: ["relay"] },
|
|
106
|
+
compress: { kind: "bool", doc: "1: compress the stream (zstd, br or gzip as Accept-Encoding allows; relay seats by default)" },
|
|
107
|
+
refs: { kind: "bool", doc: "1: the trade frames carry `refs` (who a trade credited) when a referrer was credited" },
|
|
105
108
|
},
|
|
106
109
|
body: unknown,
|
|
107
110
|
}),
|
|
@@ -204,7 +207,8 @@ export const INDEXER_CONTRACT = {
|
|
|
204
207
|
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 }),
|
|
205
208
|
quoteChain: site({ pattern: "/floor-amm/launches/<launch>/chain", v2: true, errors: LAUNCH_ERR, body: B.QUOTE_CHAIN }),
|
|
206
209
|
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 }),
|
|
207
|
-
|
|
210
|
+
|
|
211
|
+
burns: site({ pattern: "/floor-amm/launches/<launch>/burns", v2: true, query: { limit: LIMIT(100, 500), before: BEFORE, wallet: { kind: "string", doc: "only this wallet's burns (EVM case-blind; not a wallet on the chain: 400)" } }, page: cursor(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.BURNS }),
|
|
208
212
|
launchLocks: site({ pattern: "/floor-amm/launches/<launch>/locks", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_LOCKS }),
|
|
209
213
|
marks: site({
|
|
210
214
|
pattern: "/floor-amm/launches/<launch>/marks",
|
|
@@ -215,6 +219,39 @@ export const INDEXER_CONTRACT = {
|
|
|
215
219
|
body: B.MARKS,
|
|
216
220
|
}),
|
|
217
221
|
price: site({ pattern: "/floor-amm/launches/<launch>/price", v2: true, errors: LAUNCH_ERR, body: B.PRICE }),
|
|
222
|
+
|
|
223
|
+
raiseSeries: site({
|
|
224
|
+
pattern: "/floor-amm/launches/<launch>/raise-series",
|
|
225
|
+
v2: true,
|
|
226
|
+
query: {
|
|
227
|
+
step: { kind: "enum", doc: "the grid in seconds", values: B.RAISE_STEPS.map(String), required: true },
|
|
228
|
+
from: { kind: "unix", doc: "the grid's left edge (absent: the launch's open)" },
|
|
229
|
+
to: { kind: "unix", doc: "the right edge (absent: the indexed head's time; never before the last fill)" },
|
|
230
|
+
},
|
|
231
|
+
page: { kind: "range", from: "from", to: "to", span: { interval: "step", max: B.RT_POINTS_MAX, seconds: true } },
|
|
232
|
+
errors: [...LAUNCH_ERR, "bad_query"],
|
|
233
|
+
body: B.RAISE_SERIES,
|
|
234
|
+
}),
|
|
235
|
+
floorSteps: site({
|
|
236
|
+
pattern: "/floor-amm/launches/<launch>/floor-steps",
|
|
237
|
+
v2: true,
|
|
238
|
+
query: {
|
|
239
|
+
from: { kind: "unix", doc: "the window's start (absent: the graduation, else the open)" },
|
|
240
|
+
to: { kind: "unix", doc: "the slices' right edge (absent: the indexed head's time; never before the last step)" },
|
|
241
|
+
points: { kind: "int", doc: "the slices (the last step of each is kept)", min: 1, max: B.RT_POINTS_MAX, default: B.RT_POINTS_MAX },
|
|
242
|
+
},
|
|
243
|
+
page: { kind: "range", from: "from", to: "to" },
|
|
244
|
+
errors: [...LAUNCH_ERR, "bad_query"],
|
|
245
|
+
body: B.FLOOR_STEPS,
|
|
246
|
+
}),
|
|
247
|
+
|
|
248
|
+
launchTraded: site({
|
|
249
|
+
pattern: "/floor-amm/launches/<launch>/traded",
|
|
250
|
+
v2: true,
|
|
251
|
+
query: { wallets: { kind: "list", doc: "the wallets asked, answered in this order", required: true, min: 1, max: TRADED_WALLETS_MAX } },
|
|
252
|
+
errors: [...LAUNCH_ERR, "bad_query"],
|
|
253
|
+
body: B.LAUNCH_TRADED,
|
|
254
|
+
}),
|
|
218
255
|
highs: site({
|
|
219
256
|
pattern: "/floor-amm/launches/<launch>/highs",
|
|
220
257
|
v2: true,
|
|
@@ -289,6 +326,19 @@ export const INDEXER_CONTRACT = {
|
|
|
289
326
|
|
|
290
327
|
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 }),
|
|
291
328
|
|
|
329
|
+
positionTotals: site({
|
|
330
|
+
pattern: "/floor-amm/wallets/<wallet>/position-totals",
|
|
331
|
+
v2: true,
|
|
332
|
+
query: {
|
|
333
|
+
launch: { kind: "string", doc: "only this launch's row (an id or its token)" },
|
|
334
|
+
limit: { kind: "int", doc: "launches a page (without launch)", min: 1, max: POSITION_TOTALS_PAGE_MAX, default: POSITION_TOTALS_PAGE_MAX },
|
|
335
|
+
cursor: { kind: "string", doc: "a page's next (opaque, launch create order)", max: WALLET_CURSOR_MAX, without: ["launch"] },
|
|
336
|
+
},
|
|
337
|
+
page: { kind: "keyset", limit: { default: POSITION_TOTALS_PAGE_MAX, max: POSITION_TOTALS_PAGE_MAX }, cursor: "cursor", next: "next", optIn: true },
|
|
338
|
+
errors: [...WALLET_ERR, "unknown_launch"],
|
|
339
|
+
body: B.POSITION_TOTALS,
|
|
340
|
+
}),
|
|
341
|
+
|
|
292
342
|
inbox: site({
|
|
293
343
|
pattern: "/floor-amm/wallets/<wallet>/inbox",
|
|
294
344
|
v2: true,
|
|
@@ -302,7 +352,14 @@ export const INDEXER_CONTRACT = {
|
|
|
302
352
|
firsts: site({ pattern: "/floor-amm/wallets/<wallet>/firsts", errors: WALLET_ERR, body: B.FIRSTS }),
|
|
303
353
|
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 }),
|
|
304
354
|
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 }),
|
|
305
|
-
|
|
355
|
+
|
|
356
|
+
people: site({
|
|
357
|
+
pattern: "/floor-amm/referrals/<wallet>/people",
|
|
358
|
+
query: { ...WALLET_PAGE_KEYS("opaque, referred wallet order"), person: { kind: "list", doc: "only these referred wallets' rows (distinct; no next)", min: 1, max: PEOPLE_PERSON_MAX, without: ["limit", "cursor"] } },
|
|
359
|
+
page: WALLET_PAGE,
|
|
360
|
+
errors: WALLET_ERR,
|
|
361
|
+
body: B.PEOPLE,
|
|
362
|
+
}),
|
|
306
363
|
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 }),
|
|
307
364
|
|
|
308
365
|
handlePlaces: site({
|
|
@@ -443,6 +500,7 @@ export function queryRefusal(name , q )
|
|
|
443
500
|
}
|
|
444
501
|
case "list": {
|
|
445
502
|
const parts = raw.split(",").filter((s) => s !== "");
|
|
503
|
+
if (k.min !== undefined && parts.length < k.min) return `at least ${k.min} ${key}`;
|
|
446
504
|
if (k.max !== undefined && parts.length > k.max) return `at most ${k.max} ${key}`;
|
|
447
505
|
const it = k.item;
|
|
448
506
|
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}`;
|
|
@@ -483,7 +541,7 @@ const ROWS_PRODUCT =
|
|
|
483
541
|
candlesMany: { list: "ids", max: CANDLES_MANY_ROWS_MAX },
|
|
484
542
|
};
|
|
485
543
|
|
|
486
|
-
const TABLE_REQUIRED = new Set (["search", "launchLists", "candlesMany"]);
|
|
544
|
+
const TABLE_REQUIRED = new Set (["search", "launchLists", "candlesMany", "raiseSeries", "launchTraded"]);
|
|
487
545
|
|
|
488
546
|
const BOOLS = { true: true, false: false, 1: true, 0: false };
|
|
489
547
|
|
|
@@ -502,7 +560,8 @@ export function queryBool(name , q , key )
|
|
|
502
560
|
export function spanRefusal(name , q , toDefault ) {
|
|
503
561
|
const p = INDEXER_CONTRACT[name].page;
|
|
504
562
|
if (p.kind !== "range" || p.span === undefined) return null;
|
|
505
|
-
const
|
|
563
|
+
const key = queryArg(name, q, p.span.interval) ?? "";
|
|
564
|
+
const sec = p.span.seconds === true ? (DIGITS.test(key) && Number(key) > 0 ? Number(key) : undefined) : (B.CANDLE_INTERVAL_SECS )[key];
|
|
506
565
|
const fromRaw = q.get(p.from), toRaw = q.get(p.to);
|
|
507
566
|
if (sec === undefined || fromRaw === null || !DIGITS.test(fromRaw)) return null;
|
|
508
567
|
const to = toRaw === null ? toDefault : DIGITS.test(toRaw) ? Number(toRaw) : undefined;
|
|
@@ -510,5 +569,5 @@ export function spanRefusal(name , q , toDefault
|
|
|
510
569
|
const from = Number(fromRaw);
|
|
511
570
|
if (from > to) return null;
|
|
512
571
|
const bucket = (t ) => Math.floor(t / sec) * sec;
|
|
513
|
-
return (bucket(to) - bucket(from)) / sec + 1 > p.span.max ? `the range spans more than ${p.span.max} candles` : null;
|
|
572
|
+
return (bucket(to) - bucket(from)) / sec + 1 > p.span.max ? `the range spans more than ${p.span.max} ${p.span.seconds === true ? "points" : "candles"}` : null;
|
|
514
573
|
}
|
package/dist/indexer/paths.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
export const INDEXER_ROUTES = {
|
|
4
4
|
head: { pattern: "/floor-amm/head", keys: [] },
|
|
5
5
|
latestBlock: { pattern: "/floor-amm/latest-block", keys: [] },
|
|
6
|
-
stream: { pattern: "/floor-amm/stream", keys: ["launch", "state", "lastEventId"] },
|
|
6
|
+
stream: { pattern: "/floor-amm/stream", keys: ["launch", "state", "lastEventId", "seat", "compress", "refs"] },
|
|
7
7
|
quotes: { pattern: "/floor-amm/quotes", keys: [] },
|
|
8
8
|
summary: { pattern: "/floor-amm/summary", keys: [] },
|
|
9
9
|
floorRouted: { pattern: "/floor-amm/floor-routed", keys: ["limit", "cursor"] },
|
|
@@ -23,10 +23,13 @@ export const INDEXER_ROUTES = {
|
|
|
23
23
|
traders: { pattern: "/floor-amm/launches/<launch>/traders", keys: ["window", "limit"] },
|
|
24
24
|
quoteChain: { pattern: "/floor-amm/launches/<launch>/chain", keys: [] },
|
|
25
25
|
devTrades: { pattern: "/floor-amm/launches/<launch>/dev", keys: ["limit"] },
|
|
26
|
-
burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: ["limit", "before"] },
|
|
26
|
+
burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: ["limit", "before", "wallet"] },
|
|
27
27
|
launchLocks: { pattern: "/floor-amm/launches/<launch>/locks", keys: [] },
|
|
28
28
|
marks: { pattern: "/floor-amm/launches/<launch>/marks", keys: ["limit", "before"] },
|
|
29
29
|
price: { pattern: "/floor-amm/launches/<launch>/price", keys: [] },
|
|
30
|
+
raiseSeries: { pattern: "/floor-amm/launches/<launch>/raise-series", keys: ["step", "from", "to"] },
|
|
31
|
+
floorSteps: { pattern: "/floor-amm/launches/<launch>/floor-steps", keys: ["from", "to", "points"] },
|
|
32
|
+
launchTraded: { pattern: "/floor-amm/launches/<launch>/traded", keys: ["wallets"] },
|
|
30
33
|
highs: { pattern: "/floor-amm/launches/<launch>/highs", keys: ["atLeast", "limit"] },
|
|
31
34
|
candleBundle: { pattern: "/floor-amm/launches/<launch>/candle-bundle", keys: ["intervals", "limit"] },
|
|
32
35
|
candles: { pattern: "/floor-amm/candles", keys: ["launch", "interval", "from", "to", "before", "limit"] },
|
|
@@ -35,20 +38,21 @@ export const INDEXER_ROUTES = {
|
|
|
35
38
|
tonActivity: { pattern: "/floor-amm/wallets/<wallet>/ton-activity", keys: ["limit", "before"] },
|
|
36
39
|
tonOutcome: { pattern: "/floor-amm/wallets/<wallet>/ton-outcome", keys: ["queryId"] },
|
|
37
40
|
positions: { pattern: "/floor-amm/wallets/<wallet>/positions", keys: ["limit", "cursor"] },
|
|
41
|
+
positionTotals: { pattern: "/floor-amm/wallets/<wallet>/position-totals", keys: ["launch", "limit", "cursor"] },
|
|
38
42
|
inbox: { pattern: "/floor-amm/wallets/<wallet>/inbox", keys: ["limit", "before"] },
|
|
39
43
|
walletLocks: { pattern: "/floor-amm/wallets/<wallet>/locks", keys: ["limit", "cursor"] },
|
|
40
44
|
claimHistory: { pattern: "/floor-amm/wallets/<wallet>/claims", keys: ["limit", "cursor"] },
|
|
41
45
|
firsts: { pattern: "/floor-amm/wallets/<wallet>/firsts", keys: [] },
|
|
42
46
|
firstsMany: { pattern: "/floor-amm/wallets/firsts", keys: ["wallets"] },
|
|
43
47
|
claimView: { pattern: "/floor-amm/claims/<wallet>", keys: ["limit", "cursor"] },
|
|
44
|
-
people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor"] },
|
|
48
|
+
people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor", "person"] },
|
|
45
49
|
roles: { pattern: "/floor-amm/roles/<wallet>", keys: ["limit", "cursor"] },
|
|
46
50
|
handlePlaces: { pattern: "/floor-amm/handles/<handle>/places", keys: ["limit", "cursor"] },
|
|
47
51
|
traderBoard: { pattern: "/floor-amm/leaderboards/traders", keys: ["window", "limit"] },
|
|
48
52
|
launcherBoard: { pattern: "/floor-amm/leaderboards/launchers", keys: ["limit"] },
|
|
49
53
|
} ;
|
|
50
54
|
|
|
51
|
-
export const LAUNCH_SORTS = ["created", "newest", "volume1h", "volume24h", "volume7d", "volume", "marketCap", "liquidity", "backed", "trades24h", "holders", "change1h", "change24h", "lastTrade", "nearFloor", "trending", "
|
|
55
|
+
export const LAUNCH_SORTS = ["created", "newest", "volume1h", "volume24h", "volume7d", "volume", "marketCap", "liquidity", "backed", "trades24h", "holders", "change1h", "change24h", "lastTrade", "nearFloor", "trending", "holdersChange24h", "standingVolume", "standingMarketCap", "standingBacked", "maxloss"] ;
|
|
52
56
|
|
|
53
57
|
export const IDS_MAX = 100;
|
|
54
58
|
|
|
@@ -78,8 +82,14 @@ export const PRESET_FILTER_MAX = 16;
|
|
|
78
82
|
|
|
79
83
|
export const FIRSTS_MAX = 100;
|
|
80
84
|
|
|
85
|
+
export const TRADED_WALLETS_MAX = 100;
|
|
86
|
+
|
|
87
|
+
export const POSITION_TOTALS_PAGE_MAX = 100;
|
|
88
|
+
|
|
81
89
|
export const STREAM_STATE_MAX = 16;
|
|
82
90
|
|
|
91
|
+
export const PEOPLE_PERSON_MAX = 8;
|
|
92
|
+
|
|
83
93
|
export function query(q ) {
|
|
84
94
|
const p = new URLSearchParams();
|
|
85
95
|
for (const [k, v] of Object.entries(q)) {
|
|
@@ -110,7 +120,7 @@ export const indexerPath = {
|
|
|
110
120
|
latestBlock: () => "/floor-amm/latest-block",
|
|
111
121
|
stream: (q = {}) => {
|
|
112
122
|
if ((q.state?.length ?? 0) > STREAM_STATE_MAX) throw new RangeError(`at most ${STREAM_STATE_MAX} state ids`);
|
|
113
|
-
return `/floor-amm/stream${query({ launch: q.launch?.length ? q.launch : undefined, state: q.state?.length ? q.state : undefined, lastEventId: q.lastEventId })}`;
|
|
123
|
+
return `/floor-amm/stream${query({ launch: q.launch?.length ? q.launch : undefined, state: q.state?.length ? q.state : undefined, lastEventId: q.lastEventId, seat: q.seat, compress: q.compress === true ? 1 : undefined, refs: q.refs === true ? 1 : undefined })}`;
|
|
114
124
|
},
|
|
115
125
|
quotes: () => "/floor-amm/quotes",
|
|
116
126
|
summary: () => "/floor-amm/summary",
|
|
@@ -147,10 +157,18 @@ export const indexerPath = {
|
|
|
147
157
|
traders: (id , q = {}) => launchPath(id, `/traders${query({ window: q.window, limit: q.limit })}`),
|
|
148
158
|
quoteChain: (id ) => launchPath(id, "/chain"),
|
|
149
159
|
devTrades: (id , q = {}) => launchPath(id, `/dev${query({ limit: q.limit })}`),
|
|
150
|
-
|
|
160
|
+
|
|
161
|
+
burns: (id , q = {}) => launchPath(id, `/burns${query({ limit: q.limit, before: q.before, wallet: q.wallet })}`),
|
|
151
162
|
launchLocks: (id ) => launchPath(id, "/locks"),
|
|
152
163
|
marks: (id , q = {}) => launchPath(id, `/marks${query({ limit: q.limit, before: q.before })}`),
|
|
153
164
|
price: (id ) => launchPath(id, "/price"),
|
|
165
|
+
raiseSeries: (id , q ) => launchPath(id, `/raise-series${query({ step: q.step, from: q.from, to: q.to })}`),
|
|
166
|
+
floorSteps: (id , q = {}) => launchPath(id, `/floor-steps${query({ from: q.from, to: q.to, points: q.points })}`),
|
|
167
|
+
|
|
168
|
+
launchTraded: (id , wallets ) => {
|
|
169
|
+
if (wallets.length === 0 || wallets.length > TRADED_WALLETS_MAX) throw new RangeError(`1..${TRADED_WALLETS_MAX} wallets`);
|
|
170
|
+
return launchPath(id, `/traded${query({ wallets })}`);
|
|
171
|
+
},
|
|
154
172
|
|
|
155
173
|
highs: (id , q = {}) => launchPath(id, `/highs${query({ atLeast: q.atLeast === undefined ? undefined : String(q.atLeast), limit: q.limit })}`),
|
|
156
174
|
|
|
@@ -170,6 +188,7 @@ export const indexerPath = {
|
|
|
170
188
|
tonOutcome: (w , queryId ) => walletPath(w, `/ton-outcome${query({ queryId: String(queryId) })}`),
|
|
171
189
|
|
|
172
190
|
positions: (w , q = {}) => walletPath(w, `/positions${query({ limit: q.limit, cursor: q.cursor })}`),
|
|
191
|
+
positionTotals: (w , q = {}) => walletPath(w, `/position-totals${query({ launch: q.launch, limit: q.limit, cursor: q.cursor })}`),
|
|
173
192
|
|
|
174
193
|
inbox: (w , q = {}) => walletPath(w, `/inbox${query({ limit: q.limit, before: q.before })}`),
|
|
175
194
|
walletLocks: (w , q = {}) => walletPath(w, `/locks${query({ limit: q.limit, cursor: q.cursor })}`),
|
|
@@ -182,7 +201,15 @@ export const indexerPath = {
|
|
|
182
201
|
},
|
|
183
202
|
claimView: (w , q = {}) => `/floor-amm/claims/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
184
203
|
|
|
185
|
-
people: (w , q
|
|
204
|
+
people: (w , q = {}) => {
|
|
205
|
+
if (q.person !== undefined) {
|
|
206
|
+
|
|
207
|
+
const canon = q.person.map((w) => (/^0x[0-9a-fA-F]{40}$/.test(w) ? w.toLowerCase() : w));
|
|
208
|
+
if (q.person.length < 1 || q.person.length > PEOPLE_PERSON_MAX || new Set(canon).size !== canon.length) throw new RangeError(`1..${PEOPLE_PERSON_MAX} distinct person wallets`);
|
|
209
|
+
if (q.limit !== undefined || q.cursor !== undefined) throw new RangeError("person cannot be given with limit / cursor");
|
|
210
|
+
}
|
|
211
|
+
return `/floor-amm/referrals/${seg(w)}/people${query({ limit: q.limit, cursor: q.cursor, person: q.person })}`;
|
|
212
|
+
},
|
|
186
213
|
|
|
187
214
|
roles: (w , q = {}) => `/floor-amm/roles/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
188
215
|
handlePlaces: (handle , q = {}) => `/floor-amm/handles/${seg(handle)}/places${query({ limit: q.limit, cursor: q.cursor })}`,
|
package/dist/indexer/read.js
CHANGED
|
@@ -9,7 +9,7 @@ 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_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";
|
|
12
|
+
export { FIRSTS_MAX, POSITION_TOTALS_PAGE_MAX, TRADED_WALLETS_MAX, IDS_MAX, INDEXER_ROUTES, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PEOPLE_PERSON_MAX, 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
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
14
|
|
|
15
15
|
export * from "./partners.js";
|
|
@@ -87,12 +87,21 @@ export const readTraders = (get , id , q
|
|
|
87
87
|
export const readQuoteChain = (get , id ) => readRoute(get, indexerPath.quoteChain(id), B.QUOTE_CHAIN);
|
|
88
88
|
|
|
89
89
|
export const readDevTrades = (get , id , q = {}) => readRoute(get, indexerPath.devTrades(id, q), B.DEV_TRADES);
|
|
90
|
-
|
|
90
|
+
|
|
91
|
+
export const readBurns = (get , id , q = {}) => readRoute(get, indexerPath.burns(id, q), B.BURNS);
|
|
91
92
|
export const readLaunchLocks = (get , id ) => readRoute(get, indexerPath.launchLocks(id), B.LAUNCH_LOCKS);
|
|
92
93
|
|
|
93
94
|
export const readMarks = (get , id , q = {}) => readRoute(get, indexerPath.marks(id, q), B.MARKS);
|
|
94
95
|
export const readPrice = (get , id ) => readRoute(get, indexerPath.price(id), B.PRICE);
|
|
95
96
|
|
|
97
|
+
export const readRaiseSeries = (get , id , q ) => readRoute(get, indexerPath.raiseSeries(id, q), B.RAISE_SERIES);
|
|
98
|
+
|
|
99
|
+
export const readFloorSteps = (get , id , q = {}) => readRoute(get, indexerPath.floorSteps(id, q), B.FLOOR_STEPS);
|
|
100
|
+
|
|
101
|
+
export const readLaunchTraded = (get , id , wallets ) => readRoute(get, indexerPath.launchTraded(id, wallets), B.LAUNCH_TRADED);
|
|
102
|
+
|
|
103
|
+
export const readPositionTotals = (get , wallet , q = {}) => readRoute(get, indexerPath.positionTotals(wallet, q), B.POSITION_TOTALS);
|
|
104
|
+
|
|
96
105
|
export const readCandles = (get , q ) => readRoute(get, indexerPath.candles(q), B.CANDLES);
|
|
97
106
|
|
|
98
107
|
export const readCandlesMany = (get , q ) => readRoute(get, indexerPath.candlesMany(q), B.CANDLES_MANY);
|
|
@@ -112,7 +121,7 @@ export const readClaimView = (get , wallet , q = {})
|
|
|
112
121
|
export const readFirsts = (get , wallet ) => readRoute(get, indexerPath.firsts(wallet), B.FIRSTS);
|
|
113
122
|
|
|
114
123
|
export const readFirstsMany = (get , wallets ) => readRoute(get, indexerPath.firstsMany(wallets), B.FIRSTS_MANY);
|
|
115
|
-
export const readPeople = (get , wallet , q
|
|
124
|
+
export const readPeople = (get , wallet , q = {}) => readRoute(get, indexerPath.people(wallet, q), B.PEOPLE);
|
|
116
125
|
export const readRoles = (get , wallet , q = {}) => readRoute(get, indexerPath.roles(wallet, q), B.ROLES);
|
|
117
126
|
|
|
118
127
|
export const readHandlePlaces = (get , handle , q = {}) => readRoute(get, indexerPath.handlePlaces(handle, q), B.HANDLE_PLACES);
|
package/dist/indexer/stream.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
import { decode, int, nullable, object, optional, str, unknown } from "./decode.js";
|
|
4
|
-
import { HEAD, LIVE_LAUNCH,
|
|
4
|
+
import { HEAD, LIVE_LAUNCH, STREAM_TRADE } from "./bodies.js";
|
|
5
5
|
|
|
6
6
|
import { indexerPath } from "./paths.js";
|
|
7
7
|
|
|
@@ -24,7 +24,7 @@ export function decodeStreamFrame(event , data , id )
|
|
|
24
24
|
return { event, data: decode(HEAD_SEEN, data) };
|
|
25
25
|
case "trade":
|
|
26
26
|
if (id === undefined) return null;
|
|
27
|
-
return { event, id, data: decode(
|
|
27
|
+
return { event, id, data: decode(STREAM_TRADE, data) };
|
|
28
28
|
case "launch": {
|
|
29
29
|
const d = data ;
|
|
30
30
|
if (d !== null && typeof d === "object" && d.gone === true) return { event: "launchGone", data: { launch: str(d.launch, "launch"), gone: true } };
|
package/dist/math/v2/fees.js
CHANGED
|
@@ -101,9 +101,28 @@ export function netFromGross(gross , ppm ) {
|
|
|
101
101
|
return net;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
export const TRADER_REF_BPS = [
|
|
104
|
+
export const TRADER_REF_BPS = [2_400, 420, 180];
|
|
105
105
|
|
|
106
|
-
export const CREATOR_REF_BPS = [
|
|
106
|
+
export const CREATOR_REF_BPS = [800, 140, 60];
|
|
107
|
+
|
|
108
|
+
export const TRADER_REF_OG_BPS = [4_000, 700, 300];
|
|
109
|
+
|
|
110
|
+
export const CREATOR_REF_OG_BPS = [2_400, 420, 180];
|
|
111
|
+
|
|
112
|
+
export const OG_WINDOW_SECS = 15_811_200n;
|
|
113
|
+
|
|
114
|
+
export const OG_MAX = 100;
|
|
115
|
+
const OG_U64_MAX = (1n << 64n) - 1n;
|
|
116
|
+
|
|
117
|
+
export const ogUntil = (from ) => (from === 0n ? 0n : from + OG_WINDOW_SECS > OG_U64_MAX ? OG_U64_MAX : from + OG_WINDOW_SECS);
|
|
118
|
+
|
|
119
|
+
export const ogLive = (until , now ) => now < until;
|
|
120
|
+
|
|
121
|
+
export const ogLaunch = (from , until , createdAt , now ) =>
|
|
122
|
+
from !== 0n && from <= createdAt && createdAt < until && now < until;
|
|
123
|
+
|
|
124
|
+
export const tierBps = (bps , ogBps , og ) =>
|
|
125
|
+
[0, 1, 2].map((i) => (og[i] ? ogBps[i] : bps[i] ));
|
|
107
126
|
|
|
108
127
|
export function slices(fee , present , bps ) {
|
|
109
128
|
const out = [0n, 0n, 0n];
|
|
@@ -117,5 +136,12 @@ export function slices(fee , present , bps
|
|
|
117
136
|
}
|
|
118
137
|
return [out, left];
|
|
119
138
|
}
|
|
120
|
-
|
|
121
|
-
|
|
139
|
+
const NO_OG = [false, false, false];
|
|
140
|
+
|
|
141
|
+
export const platformLegsOg = (platform , traderPresent , og ) =>
|
|
142
|
+
slices(platform, traderPresent, tierBps(TRADER_REF_BPS, TRADER_REF_OG_BPS, og));
|
|
143
|
+
|
|
144
|
+
export const creatorLegsOg = (creator , creatorPresent , og ) =>
|
|
145
|
+
slices(creator, creatorPresent, tierBps(CREATOR_REF_BPS, CREATOR_REF_OG_BPS, og));
|
|
146
|
+
export const platformLegs = (platform , traderPresent ) => platformLegsOg(platform, traderPresent, NO_OG);
|
|
147
|
+
export const creatorLegs = (creator , creatorPresent ) => creatorLegsOg(creator, creatorPresent, NO_OG);
|
|
@@ -21,7 +21,7 @@ export function splitByRow(amount , platformBps , floorBps
|
|
|
21
21
|
|
|
22
22
|
export function teamSplit(amount , levelsPresent ) {
|
|
23
23
|
const tenth = amount / 10n;
|
|
24
|
-
const w = [
|
|
24
|
+
const w = [80n, 14n, 6n];
|
|
25
25
|
const referrers = [0n, 0n, 0n];
|
|
26
26
|
let paid = 0n;
|
|
27
27
|
for (let i = 0; i < 3; i++) {
|
package/dist/math/v2/receipt.js
CHANGED
|
@@ -5,7 +5,7 @@ import { MAX_WALK_STEPS, ckMoney, cloneBook } from "./book.js";
|
|
|
5
5
|
import { bestBidPriceX64V2, dexLiquidityV2, nextBuyPriceX64, stackViewV2 } from "./display.js";
|
|
6
6
|
|
|
7
7
|
import { FEE_LEGS, LEG_BACKING, LEG_FLOOR, LEG_HOLDER, LEG_PLATFORM, LEG_TEAM, feeTotal } from "./fees.js";
|
|
8
|
-
import {
|
|
8
|
+
import { creatorLegsOgV2, platformLegsOgV2, splitMembersV2 } from "./team.js";
|
|
9
9
|
import { bookBuy, bookSell } from "./trade.js";
|
|
10
10
|
|
|
11
11
|
import { U64_MAX, U128_MAX } from "./wide.js";
|
|
@@ -71,8 +71,8 @@ export function feePartsV2(fees , opts = {})
|
|
|
71
71
|
const none = [false, false, false];
|
|
72
72
|
const team = fees[LEG_TEAM];
|
|
73
73
|
const platform = fees[LEG_PLATFORM];
|
|
74
|
-
const [teamCreatorRefs, teamRest] =
|
|
75
|
-
const [platformTraderRefs, platformBucket] =
|
|
74
|
+
const [teamCreatorRefs, teamRest] = creatorLegsOgV2(team, opts.creatorRefs ?? none, opts.creatorOg ?? none);
|
|
75
|
+
const [platformTraderRefs, platformBucket] = platformLegsOgV2(platform, opts.traderRefs ?? none, opts.traderOg ?? none);
|
|
76
76
|
const w = opts.slotWeights;
|
|
77
77
|
const split = w !== undefined && w.some((x) => x !== 0);
|
|
78
78
|
const [teamMembers, teamDust] = split ? splitMembersV2(teamRest, w) : [Array(w?.length ?? 10).fill(0n) , 0n];
|
package/dist/math/v2/rows.js
CHANGED
|
@@ -236,6 +236,23 @@ export function wagmi() {
|
|
|
236
236
|
return wagmiAt(WAGMI_THETA_BPS) ;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
export const WAGMI70_ID = 7;
|
|
240
|
+
export const WAGMI70_PHI_BPS = 7_000;
|
|
241
|
+
export const STEP_WAGMI70_X100 = 111;
|
|
242
|
+
export const WAGMI70_THETA_BPS = 6_092;
|
|
243
|
+
export const WAGMI70_END_USD = 413_510_000n;
|
|
244
|
+
export function wagmi70() {
|
|
245
|
+
return {
|
|
246
|
+
...wagmiBase(),
|
|
247
|
+
id: WAGMI70_ID,
|
|
248
|
+
name: "wagmi-70",
|
|
249
|
+
phiBps: WAGMI70_PHI_BPS,
|
|
250
|
+
climbStepX100: STEP_WAGMI70_X100,
|
|
251
|
+
thetaBps: WAGMI70_THETA_BPS,
|
|
252
|
+
stacks: [st(WAGMI70_END_USD, WAGMI_SPEC_MILESTONES[0])],
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
239
256
|
export const FLOOR_GENESIS_PHI_BPS = 5_000;
|
|
240
257
|
|
|
241
258
|
export function floorGenesis() {
|