@floorlaunchpad/sdk 0.1.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +114 -0
- package/LICENSE +201 -60
- package/README.md +54 -24
- package/dist/abi/evm-event-names.js +12 -0
- package/dist/abi/evm.gen.js +130 -0
- package/dist/abi/functions.gen.js +144 -0
- package/dist/abi/index.js +17 -0
- package/dist/abi/solana.gen.js +130 -0
- package/dist/burn.js +21 -0
- package/dist/client/evm/index.js +191 -0
- package/dist/client/index.js +19 -0
- package/dist/client/solana/index.js +259 -0
- package/dist/client/types.js +5 -0
- package/dist/codec.js +77 -0
- package/dist/config/codeHash.js +9 -0
- package/dist/config/generated.js +803 -0
- package/dist/config/index.js +49 -0
- package/dist/config/registry.gen.js +118 -0
- package/dist/config/solana-genesis.js +7 -0
- package/dist/ed25519.js +31 -0
- package/dist/errors.js +249 -0
- package/dist/events/index.js +40 -0
- package/dist/events/types.gen.js +3 -0
- package/dist/evm/abi.js +283 -0
- package/dist/evm/balances.js +26 -0
- package/dist/evm/chains.js +148 -0
- package/dist/evm/floor/abi.gen.js +195 -0
- package/dist/evm/floor/calls.js +230 -0
- package/dist/evm/floor/create.js +49 -0
- package/dist/evm/floor/events.js +41 -0
- package/dist/evm/floor/iface.js +44 -0
- package/dist/evm/items.js +209 -0
- package/dist/evm/keccak.js +118 -0
- package/dist/evm/multicall.js +30 -0
- package/dist/evm/router.js +184 -0
- package/dist/evm/squid.js +107 -0
- package/dist/evm/zap.js +128 -0
- package/dist/fixtures.js +53 -0
- package/dist/generated/index.js +28 -0
- package/dist/generated/interface.gen.js +146 -0
- package/dist/handle.js +22 -0
- package/dist/index.js +93 -7
- package/dist/indexer/bodies.js +473 -0
- package/dist/indexer/client.js +105 -0
- package/dist/indexer/contract.js +358 -0
- package/dist/indexer/decode.js +97 -0
- package/dist/indexer/partners.js +105 -0
- package/dist/indexer/paths.js +127 -0
- package/dist/indexer/read.js +109 -0
- package/dist/indexer/stream.js +71 -0
- package/dist/lock.js +16 -0
- package/dist/math/fixed.js +154 -0
- package/dist/math/genesis.js +39 -0
- package/dist/math/index.js +20 -0
- package/dist/math/u256.js +49 -0
- package/dist/math/v2/ask.js +162 -0
- package/dist/math/v2/book.js +607 -0
- package/dist/math/v2/circulating.js +62 -0
- package/dist/math/v2/create.js +122 -0
- package/dist/math/v2/display.js +208 -0
- package/dist/math/v2/error.js +17 -0
- package/dist/math/v2/feasibility.js +174 -0
- package/dist/math/v2/fees.js +121 -0
- package/dist/math/v2/holders.js +105 -0
- package/dist/math/v2/milestones.js +40 -0
- package/dist/math/v2/pow.js +69 -0
- package/dist/math/v2/preset.js +151 -0
- package/dist/math/v2/receipt.js +108 -0
- package/dist/math/v2/relay.js +217 -0
- package/dist/math/v2/rows.js +365 -0
- package/dist/math/v2/split.js +111 -0
- package/dist/math/v2/sqrt.js +84 -0
- package/dist/math/v2/supply.js +21 -0
- package/dist/math/v2/team.js +75 -0
- package/dist/math/v2/trade.js +126 -0
- package/dist/math/v2/wide.js +51 -0
- package/dist/quote.js +6 -0
- package/dist/registryPrice.js +23 -0
- package/dist/route/edge-jupiter.js +42 -0
- package/dist/route/edge.js +11 -0
- package/dist/route/graph.js +51 -0
- package/dist/route/path.js +75 -0
- package/dist/route/quote.js +15 -0
- package/dist/route-jupiter.js +35 -0
- package/dist/route.js +8 -0
- package/dist/sha256.js +61 -0
- package/dist/solana/alt.js +18 -0
- package/dist/solana/floor/accounts.js +392 -0
- package/dist/solana/floor/borsh.js +66 -0
- package/dist/solana/floor/create.js +65 -0
- package/dist/solana/floor/events.js +144 -0
- package/dist/solana/floor/genesis.js +91 -0
- package/dist/solana/floor/genesisList.js +68 -0
- package/dist/solana/floor/instructions.js +448 -0
- package/dist/solana/floor/metadata.js +198 -0
- package/dist/solana/floor/mint.js +206 -0
- package/dist/solana/floor/program.js +64 -0
- package/dist/solana/floor/registry.js +83 -0
- package/dist/solana/instruction.js +49 -0
- package/dist/solana/pda.js +88 -0
- package/dist/solana/tx.js +138 -0
- package/dist/v2/burnPreview.js +35 -0
- package/dist/v2/circulating.js +11 -0
- package/dist/v2/claimAllEvm.js +70 -0
- package/dist/v2/claims-evm.js +120 -0
- package/dist/v2/claims.js +218 -0
- package/dist/v2/dead.js +21 -0
- package/dist/v2/devbuy.js +37 -0
- package/dist/v2/events.js +115 -0
- package/dist/v2/evm.js +299 -0
- package/dist/v2/evmReads.js +76 -0
- package/dist/v2/genesis.js +76 -0
- package/dist/v2/layouts.js +217 -0
- package/dist/v2/market-evm.js +74 -0
- package/dist/v2/presetRowEvm.js +45 -0
- package/dist/v2/press.js +106 -0
- package/dist/v2/quoteMint.js +52 -0
- package/dist/v2/receipt-tx.js +149 -0
- package/dist/v2/route-alt.js +114 -0
- package/dist/v2/route.js +389 -0
- package/dist/v2/router.js +22 -0
- package/dist/v2/solana.js +391 -0
- package/dist/v2/solanaSettle.js +97 -0
- package/dist/v2/tx/evm.js +126 -0
- package/dist/v2/tx/genesis.js +47 -0
- package/dist/v2/tx/index.js +5 -0
- package/dist/v2/tx/solana.js +118 -0
- package/dist/v2/types.js +13 -0
- package/docs/aggregator.md +61 -0
- package/docs/bot.md +50 -0
- package/docs/floor-line.md +66 -0
- package/docs/frontend.md +29 -0
- package/docs/wallet.md +54 -0
- package/examples/floor-line.html +104 -0
- package/package.json +429 -32
- package/src/abi/evm-event-names.ts +12 -0
- package/src/abi/evm.gen.ts +139 -0
- package/src/abi/functions.gen.ts +154 -0
- package/src/abi/index.ts +30 -0
- package/src/abi/solana.gen.ts +140 -0
- package/src/burn.ts +37 -0
- package/src/client/evm/index.ts +199 -0
- package/src/client/index.ts +23 -0
- package/src/client/solana/index.ts +260 -0
- package/src/client/types.ts +162 -0
- package/src/codec.ts +77 -0
- package/src/config/codeHash.ts +9 -0
- package/src/config/generated.ts +803 -0
- package/src/config/index.ts +93 -0
- package/src/config/registry.gen.ts +118 -0
- package/src/config/solana-genesis.ts +7 -0
- package/src/ed25519.ts +31 -0
- package/src/errors.ts +270 -0
- package/src/events/index.ts +44 -0
- package/src/events/types.gen.ts +842 -0
- package/src/evm/abi.ts +292 -0
- package/src/evm/balances.ts +26 -0
- package/src/evm/chains.ts +171 -0
- package/src/evm/floor/abi.gen.ts +195 -0
- package/src/evm/floor/calls.ts +247 -0
- package/src/evm/floor/create.ts +68 -0
- package/src/evm/floor/events.ts +51 -0
- package/src/evm/floor/iface.ts +45 -0
- package/src/evm/items.ts +252 -0
- package/src/evm/keccak.ts +118 -0
- package/src/evm/multicall.ts +43 -0
- package/src/evm/router.ts +209 -0
- package/src/evm/squid.ts +138 -0
- package/src/evm/zap.ts +152 -0
- package/src/fixtures.ts +53 -0
- package/src/generated/index.ts +29 -0
- package/src/generated/interface.gen.ts +153 -0
- package/src/handle.ts +22 -0
- package/src/index.ts +93 -6
- package/src/indexer/bodies.ts +528 -0
- package/src/indexer/client.ts +180 -0
- package/src/indexer/contract.ts +419 -0
- package/src/indexer/decode.ts +109 -0
- package/src/indexer/partners.ts +115 -0
- package/src/indexer/paths.ts +190 -0
- package/src/indexer/read.ts +119 -0
- package/src/indexer/stream.ts +83 -0
- package/src/lock.ts +16 -0
- package/src/math/fixed.ts +154 -0
- package/src/math/genesis.ts +39 -0
- package/src/math/index.ts +24 -0
- package/src/math/u256.ts +49 -0
- package/src/math/v2/ask.ts +218 -0
- package/src/math/v2/book.ts +660 -0
- package/src/math/v2/circulating.ts +69 -0
- package/src/math/v2/create.ts +139 -0
- package/src/math/v2/display.ts +250 -0
- package/src/math/v2/error.ts +19 -0
- package/src/math/v2/feasibility.ts +200 -0
- package/src/math/v2/fees.ts +121 -0
- package/src/math/v2/holders.ts +124 -0
- package/src/math/v2/milestones.ts +51 -0
- package/src/math/v2/pow.ts +71 -0
- package/src/math/v2/preset.ts +189 -0
- package/src/math/v2/receipt.ts +162 -0
- package/src/math/v2/relay.ts +235 -0
- package/src/math/v2/rows.ts +412 -0
- package/src/math/v2/split.ts +160 -0
- package/src/math/v2/sqrt.ts +86 -0
- package/src/math/v2/supply.ts +27 -0
- package/src/math/v2/team.ts +75 -0
- package/src/math/v2/trade.ts +145 -0
- package/src/math/v2/wide.ts +52 -0
- package/src/quote.ts +6 -0
- package/src/registryPrice.ts +28 -0
- package/src/route/edge-jupiter.ts +71 -0
- package/src/route/edge.ts +22 -0
- package/src/route/graph.ts +77 -0
- package/src/route/path.ts +84 -0
- package/src/route/quote.ts +46 -0
- package/src/route-jupiter.ts +36 -0
- package/src/route.ts +8 -0
- package/src/sha256.ts +61 -0
- package/src/solana/alt.ts +25 -0
- package/src/solana/floor/accounts.ts +395 -0
- package/src/solana/floor/borsh.ts +66 -0
- package/src/solana/floor/create.ts +89 -0
- package/src/solana/floor/events.ts +151 -0
- package/src/solana/floor/genesis.ts +111 -0
- package/src/solana/floor/genesisList.ts +75 -0
- package/src/solana/floor/instructions.ts +504 -0
- package/src/solana/floor/metadata.ts +246 -0
- package/src/solana/floor/mint.ts +242 -0
- package/src/solana/floor/program.ts +64 -0
- package/src/solana/floor/registry.ts +96 -0
- package/src/solana/instruction.ts +61 -0
- package/src/solana/pda.ts +91 -0
- package/src/solana/tx.ts +143 -0
- package/src/v2/burnPreview.ts +52 -0
- package/src/v2/circulating.ts +22 -0
- package/src/v2/claimAllEvm.ts +97 -0
- package/src/v2/claims-evm.ts +179 -0
- package/src/v2/claims.ts +288 -0
- package/src/v2/dead.ts +21 -0
- package/src/v2/devbuy.ts +55 -0
- package/src/v2/events.ts +131 -0
- package/src/v2/evm.ts +349 -0
- package/src/v2/evmReads.ts +121 -0
- package/src/v2/genesis.ts +80 -0
- package/src/v2/layouts.ts +219 -0
- package/src/v2/market-evm.ts +95 -0
- package/src/v2/presetRowEvm.ts +54 -0
- package/src/v2/press.ts +124 -0
- package/src/v2/quoteMint.ts +63 -0
- package/src/v2/receipt-tx.ts +251 -0
- package/src/v2/route-alt.ts +114 -0
- package/src/v2/route.ts +494 -0
- package/src/v2/router.ts +22 -0
- package/src/v2/solana.ts +439 -0
- package/src/v2/solanaSettle.ts +117 -0
- package/src/v2/tx/evm.ts +152 -0
- package/src/v2/tx/genesis.ts +66 -0
- package/src/v2/tx/index.ts +5 -0
- package/src/v2/tx/solana.ts +140 -0
- package/src/v2/types.ts +284 -0
- package/dist/adapter.d.ts +0 -28
- package/dist/adapter.d.ts.map +0 -1
- package/dist/adapter.js +0 -2
- package/dist/adapter.js.map +0 -1
- package/dist/chain.d.ts +0 -23
- package/dist/chain.d.ts.map +0 -1
- package/dist/chain.js +0 -25
- package/dist/chain.js.map +0 -1
- package/dist/client.d.ts +0 -26
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -43
- package/dist/client.js.map +0 -1
- package/dist/dex-adapter.d.ts +0 -228
- package/dist/dex-adapter.d.ts.map +0 -1
- package/dist/dex-adapter.js +0 -407
- package/dist/dex-adapter.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/quotes.d.ts +0 -12
- package/dist/quotes.d.ts.map +0 -1
- package/dist/quotes.gen.d.ts +0 -8
- package/dist/quotes.gen.d.ts.map +0 -1
- package/dist/quotes.gen.js +0 -2170
- package/dist/quotes.gen.js.map +0 -1
- package/dist/quotes.js +0 -24
- package/dist/quotes.js.map +0 -1
- package/dist/types.d.ts +0 -111
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/src/adapter.ts +0 -20
- package/src/chain.ts +0 -39
- package/src/client.ts +0 -41
- package/src/dex-adapter.ts +0 -477
- package/src/quotes.gen.ts +0 -2170
- package/src/quotes.ts +0 -29
- package/src/types.ts +0 -115
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { unknown } from "./decode.js";
|
|
4
|
+
import * as B from "./bodies.js";
|
|
5
|
+
import * as P from "./partners.js";
|
|
6
|
+
import { FIRSTS_MAX, IDS_MAX, LAUNCHES_PAGE_MAX, LAUNCH_SORTS, STREAM_STATE_MAX } from "./paths.js";
|
|
7
|
+
|
|
8
|
+
export const UNITS = {
|
|
9
|
+
site: "raw quote base units, token math units (6 dp), Q64.64 prices, unix s; bigint as decimal strings; USD as decimal strings",
|
|
10
|
+
partner: "the partner's format: whole-unit decimal strings unless a field says raw base units; unix s",
|
|
11
|
+
} ;
|
|
12
|
+
|
|
13
|
+
export const INDEXER_ERROR_CODES = [
|
|
14
|
+
|
|
15
|
+
"not_ready",
|
|
16
|
+
|
|
17
|
+
"unknown_route",
|
|
18
|
+
|
|
19
|
+
"unknown_launch",
|
|
20
|
+
|
|
21
|
+
"not_found",
|
|
22
|
+
|
|
23
|
+
"bad_query",
|
|
24
|
+
|
|
25
|
+
"too_many",
|
|
26
|
+
|
|
27
|
+
"no_reader",
|
|
28
|
+
|
|
29
|
+
"not_indexed",
|
|
30
|
+
|
|
31
|
+
"upstream",
|
|
32
|
+
|
|
33
|
+
"method",
|
|
34
|
+
|
|
35
|
+
"unknown",
|
|
36
|
+
] ;
|
|
37
|
+
|
|
38
|
+
const errorWord = (body ) => (typeof body === "object" && body !== null && "error" in body ? String((body ).error) : null);
|
|
39
|
+
|
|
40
|
+
export function errorCode(status , body ) {
|
|
41
|
+
const w = errorWord(body);
|
|
42
|
+
switch (status) {
|
|
43
|
+
case 400:
|
|
44
|
+
return "bad_query";
|
|
45
|
+
case 404:
|
|
46
|
+
return w === "unknown route" ? "unknown_route" : w === "unknown launch" ? "unknown_launch" : "not_found";
|
|
47
|
+
case 405:
|
|
48
|
+
return "method";
|
|
49
|
+
case 413:
|
|
50
|
+
return "too_many";
|
|
51
|
+
case 501:
|
|
52
|
+
return "no_reader";
|
|
53
|
+
case 502:
|
|
54
|
+
return "upstream";
|
|
55
|
+
case 503:
|
|
56
|
+
return w === "not ready" ? "not_ready" : "not_indexed";
|
|
57
|
+
default:
|
|
58
|
+
return "unknown";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const NONE = { kind: "none" } ;
|
|
63
|
+
const limit = (dflt , max ) => ({ kind: "limit", limit: { default: dflt, max } }) ;
|
|
64
|
+
const cursor = (dflt , max ) => ({ kind: "cursor", limit: { default: dflt, max }, cursor: "before", next: "next" }) ;
|
|
65
|
+
const LIMIT = (dflt , max ) => ({ kind: "int", doc: "rows", min: 1, max, default: dflt });
|
|
66
|
+
const BEFORE = { kind: "cursor", doc: "a block, or a row id <block>:<txnIndex>:<eventIndex> (a page's next): rows strictly before it" };
|
|
67
|
+
const WINDOW = { kind: "enum", doc: "the volume window", values: B.TRADER_WINDOWS, default: "24h" };
|
|
68
|
+
|
|
69
|
+
const GATED = ["not_ready", "upstream"] ;
|
|
70
|
+
const LAUNCH_ERR = [...GATED, "unknown_launch"] ;
|
|
71
|
+
const WALLET_ERR = [...GATED, "bad_query"] ;
|
|
72
|
+
|
|
73
|
+
function site (s ) {
|
|
74
|
+
const params = [...s.pattern.matchAll(/<(launch|wallet|token)>/g)].map((m) => m[1] );
|
|
75
|
+
const { v2, ...rest } = s;
|
|
76
|
+
const aliases = s.aliases ?? (v2 ? [s.pattern.replace(/^\/floor-amm\//, "/floor-amm/v2/")] : []);
|
|
77
|
+
return { mount: "chain", query: {}, page: NONE, errors: GATED, gated: true, units: "site", audience: "site", ...rest, params, aliases };
|
|
78
|
+
}
|
|
79
|
+
function partner (s ) {
|
|
80
|
+
return { mount: "chain", params: [], query: {}, page: NONE, errors: [...GATED, "bad_query"], gated: true, units: "partner", audience: "partner", aliases: [], ...s };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const INDEXER_CONTRACT = {
|
|
84
|
+
|
|
85
|
+
head: site({ pattern: "/floor-amm/head", aliases: ["/head"], gated: false, errors: [], body: B.HEAD }),
|
|
86
|
+
latestBlock: site({ pattern: "/floor-amm/latest-block", aliases: ["/latest-block"], errors: [...GATED, "not_found"], body: B.LATEST_BLOCK }),
|
|
87
|
+
stream: site({
|
|
88
|
+
pattern: "/floor-amm/stream",
|
|
89
|
+
aliases: ["/stream"],
|
|
90
|
+
sse: true,
|
|
91
|
+
query: {
|
|
92
|
+
launch: { kind: "list", doc: "only these launches' frames (and their quote chains' relatives)" },
|
|
93
|
+
state: { kind: "list", doc: "state frames (the launch whole on each change) for these", max: STREAM_STATE_MAX },
|
|
94
|
+
lastEventId: { kind: "string", doc: "resume after this frame id (EventSource sends Last-Event-ID itself)" },
|
|
95
|
+
},
|
|
96
|
+
body: unknown,
|
|
97
|
+
}),
|
|
98
|
+
quotes: site({ pattern: "/floor-amm/quotes", body: B.QUOTES }),
|
|
99
|
+
summary: site({ pattern: "/floor-amm/summary", aliases: ["/floor-amm/v2/summary"], body: B.SUMMARY }),
|
|
100
|
+
floorRouted: site({ pattern: "/floor-amm/floor-routed", aliases: ["/floor-amm/v2/floor-routed"], body: B.FLOOR_ROUTED }),
|
|
101
|
+
events: site({
|
|
102
|
+
pattern: "/floor-amm/events",
|
|
103
|
+
aliases: ["/events", "/v2/dex/events"],
|
|
104
|
+
query: { fromBlock: { kind: "block", doc: "first block, inclusive", required: true }, toBlock: { kind: "block", doc: "last block, inclusive", required: true } },
|
|
105
|
+
page: { kind: "range", from: "fromBlock", to: "toBlock" },
|
|
106
|
+
errors: [...GATED, "bad_query", "too_many"],
|
|
107
|
+
body: B.EVENTS,
|
|
108
|
+
}),
|
|
109
|
+
|
|
110
|
+
launches: site({
|
|
111
|
+
pattern: "/floor-amm/launches",
|
|
112
|
+
v2: true,
|
|
113
|
+
query: {
|
|
114
|
+
sort: { kind: "enum", doc: "the order (larger first with order=desc)", values: LAUNCH_SORTS, default: "created" },
|
|
115
|
+
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" },
|
|
117
|
+
ids: { kind: "list", doc: "these launches (ids or tokens), in the order asked without sort", max: IDS_MAX },
|
|
118
|
+
quote: { kind: "string", doc: "launches quoted in this coin" },
|
|
119
|
+
creator: { kind: "string", doc: "launches by this creator" },
|
|
120
|
+
rankable: { kind: "bool", doc: "true (or 1) listed only, false (or 0) unlisted only" },
|
|
121
|
+
graduated: { kind: "bool", doc: "graduated or not (true / false, or 1 / 0)" },
|
|
122
|
+
limit: LIMIT(LAUNCHES_PAGE_MAX, LAUNCHES_PAGE_MAX),
|
|
123
|
+
offset: { kind: "int", doc: "rows skipped", min: 0, default: 0 },
|
|
124
|
+
},
|
|
125
|
+
page: { kind: "offset", limit: { default: LAUNCHES_PAGE_MAX, max: LAUNCHES_PAGE_MAX }, total: "total" },
|
|
126
|
+
errors: [...GATED, "bad_query"],
|
|
127
|
+
body: B.LAUNCHES,
|
|
128
|
+
}),
|
|
129
|
+
launch: site({ pattern: "/floor-amm/launches/<launch>", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_ONE }),
|
|
130
|
+
launchState: site({ pattern: "/floor-amm/launches/<launch>/state", v2: true, errors: ["not_ready", "unknown_launch"], body: B.LAUNCH_STATE }),
|
|
131
|
+
milestones: site({ pattern: "/floor-amm/launches/<launch>/milestones", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_MILESTONES }),
|
|
132
|
+
holders: site({ pattern: "/floor-amm/launches/<launch>/holders", v2: true, query: { limit: LIMIT(100, 500) }, page: limit(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.HOLDERS }),
|
|
133
|
+
trades: site({
|
|
134
|
+
pattern: "/floor-amm/launches/<launch>/trades",
|
|
135
|
+
v2: true,
|
|
136
|
+
query: { limit: LIMIT(100, 500), before: BEFORE, traders: { kind: "list", doc: "only these wallets' trades (EVM case-blind)" } },
|
|
137
|
+
page: cursor(100, 500),
|
|
138
|
+
errors: [...LAUNCH_ERR, "bad_query"],
|
|
139
|
+
body: B.TRADES,
|
|
140
|
+
}),
|
|
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 }),
|
|
143
|
+
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
|
+
quoteChain: site({ pattern: "/floor-amm/launches/<launch>/chain", v2: true, errors: LAUNCH_ERR, body: B.QUOTE_CHAIN }),
|
|
145
|
+
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 }),
|
|
147
|
+
launchLocks: site({ pattern: "/floor-amm/launches/<launch>/locks", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_LOCKS }),
|
|
148
|
+
marks: site({
|
|
149
|
+
pattern: "/floor-amm/launches/<launch>/marks",
|
|
150
|
+
v2: true,
|
|
151
|
+
query: { limit: LIMIT(100, 1_000), before: BEFORE },
|
|
152
|
+
page: cursor(100, 1_000),
|
|
153
|
+
errors: [...LAUNCH_ERR, "bad_query"],
|
|
154
|
+
body: B.MARKS,
|
|
155
|
+
}),
|
|
156
|
+
price: site({ pattern: "/floor-amm/launches/<launch>/price", v2: true, errors: LAUNCH_ERR, body: B.PRICE }),
|
|
157
|
+
highs: site({
|
|
158
|
+
pattern: "/floor-amm/launches/<launch>/highs",
|
|
159
|
+
v2: true,
|
|
160
|
+
query: { atLeast: { kind: "int", doc: "only the highs whose market cap reaches this (quote base units)", min: 0 }, limit: LIMIT(100, 1_000) },
|
|
161
|
+
page: limit(100, 1_000),
|
|
162
|
+
errors: [...LAUNCH_ERR, "bad_query"],
|
|
163
|
+
body: B.HIGHS,
|
|
164
|
+
}),
|
|
165
|
+
candles: site({
|
|
166
|
+
pattern: "/floor-amm/candles",
|
|
167
|
+
aliases: ["/candles", "/floor-amm/v2/candles", "/floor-amm/v2/launches/<launch>/candles"],
|
|
168
|
+
query: {
|
|
169
|
+
launch: { kind: "string", doc: "a launch id or its token", required: true },
|
|
170
|
+
interval: { kind: "enum", doc: "the bucket", values: B.CANDLE_INTERVALS, default: "1h" },
|
|
171
|
+
from: { kind: "unix", doc: "range start (absent: the most candles one read spans, back from to)" },
|
|
172
|
+
to: { kind: "unix", doc: "range end (absent: the indexed head's time)" },
|
|
173
|
+
before: { kind: "unix", doc: "instead of from / to: the newest limit traded buckets starting before it" },
|
|
174
|
+
limit: { kind: "int", doc: "with before only", min: 1, max: B.CANDLES_MAX, default: B.CANDLES_MAX },
|
|
175
|
+
},
|
|
176
|
+
page: { kind: "range", from: "from", to: "to", span: { interval: "interval", max: B.CANDLES_MAX } },
|
|
177
|
+
errors: [...GATED, "bad_query", "unknown_launch", "not_found"],
|
|
178
|
+
body: B.CANDLES,
|
|
179
|
+
}),
|
|
180
|
+
candleBundle: site({
|
|
181
|
+
pattern: "/floor-amm/launches/<launch>/candle-bundle",
|
|
182
|
+
v2: true,
|
|
183
|
+
query: {
|
|
184
|
+
intervals: { kind: "list", doc: "these buckets' pages (absent: every one, in CANDLE_INTERVALS order)", max: B.CANDLE_INTERVALS.length },
|
|
185
|
+
limit: LIMIT(B.CANDLE_BUNDLE_LIMIT, B.CANDLES_MAX),
|
|
186
|
+
},
|
|
187
|
+
page: limit(B.CANDLE_BUNDLE_LIMIT, B.CANDLES_MAX),
|
|
188
|
+
errors: [...LAUNCH_ERR, "bad_query", "not_found"],
|
|
189
|
+
body: B.CANDLE_BUNDLE,
|
|
190
|
+
}),
|
|
191
|
+
|
|
192
|
+
walletTrades: site({
|
|
193
|
+
pattern: "/floor-amm/wallets/<wallet>/trades",
|
|
194
|
+
v2: true,
|
|
195
|
+
query: { limit: LIMIT(100, 500), before: BEFORE, launch: { kind: "string", doc: "only this launch (an id or its token)" } },
|
|
196
|
+
page: cursor(100, 500),
|
|
197
|
+
errors: [...WALLET_ERR, "unknown_launch"],
|
|
198
|
+
body: B.WALLET_TRADES,
|
|
199
|
+
}),
|
|
200
|
+
positions: site({ pattern: "/floor-amm/wallets/<wallet>/positions", v2: true, errors: WALLET_ERR, body: B.POSITIONS }),
|
|
201
|
+
inbox: site({ pattern: "/floor-amm/wallets/<wallet>/inbox", v2: true, query: { limit: LIMIT(1_000, 1_000) }, page: limit(1_000, 1_000), errors: WALLET_ERR, body: B.INBOX }),
|
|
202
|
+
walletLocks: site({ pattern: "/floor-amm/wallets/<wallet>/locks", v2: true, errors: WALLET_ERR, body: B.WALLET_LOCKS }),
|
|
203
|
+
claimHistory: site({ pattern: "/floor-amm/wallets/<wallet>/claims", errors: WALLET_ERR, body: B.CLAIM_HISTORY }),
|
|
204
|
+
firsts: site({ pattern: "/floor-amm/wallets/<wallet>/firsts", errors: WALLET_ERR, body: B.FIRSTS }),
|
|
205
|
+
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 }),
|
|
209
|
+
|
|
210
|
+
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
|
+
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 }),
|
|
212
|
+
|
|
213
|
+
tokenHolders: partner({
|
|
214
|
+
pattern: "/floor-amm/holders/<token>",
|
|
215
|
+
aliases: ["/holders/<token>"],
|
|
216
|
+
params: ["token"],
|
|
217
|
+
query: { limit: LIMIT(100, 500), offset: { kind: "int", doc: "rows skipped", min: 0, default: 0 } },
|
|
218
|
+
page: { kind: "offset", limit: { default: 100, max: 500 }, total: "total" },
|
|
219
|
+
errors: [...GATED, "bad_query", "not_found"],
|
|
220
|
+
body: P.TOKEN_HOLDERS,
|
|
221
|
+
}),
|
|
222
|
+
dexAsset: partner({ pattern: "/v2/dex/asset", aliases: ["/asset"], query: { id: { kind: "string", doc: "a launch's token, or a quote", required: true } }, errors: [...GATED, "bad_query", "not_found", "not_indexed"], body: P.DEX_ASSET }),
|
|
223
|
+
dexSummary: partner({ pattern: "/v2/dex/summary", aliases: ["/summary"], query: { id: { kind: "string", doc: "the pair id", required: true } }, errors: [...GATED, "bad_query", "not_found"], body: P.DEX_SUMMARY }),
|
|
224
|
+
dexPair: partner({ pattern: "/v2/dex/pair", aliases: ["/pair"], query: { id: { kind: "string", doc: "the pair id", required: true } }, errors: [...GATED, "unknown_launch"], body: P.DEX_PAIR }),
|
|
225
|
+
cgPairs: partner({ pattern: "/v2/coingecko/pairs", aliases: ["/coingecko/pairs"], errors: GATED, body: P.CG_PAIRS }),
|
|
226
|
+
cgTickers: partner({ pattern: "/v2/coingecko/tickers", aliases: ["/coingecko/tickers"], errors: GATED, body: P.CG_TICKERS }),
|
|
227
|
+
cgHistoricalTrades: partner({
|
|
228
|
+
pattern: "/v2/coingecko/historical_trades",
|
|
229
|
+
aliases: ["/coingecko/historical_trades", "/historical_trades"],
|
|
230
|
+
query: {
|
|
231
|
+
ticker_id: { kind: "string", doc: "<token>_<quote>", required: true },
|
|
232
|
+
type: { kind: "enum", doc: "one side only", values: ["buy", "sell"] },
|
|
233
|
+
limit: { kind: "int", doc: "rows per side (0: all)", min: 0 },
|
|
234
|
+
start_time: { kind: "unix", doc: "from (10^11 and over: milliseconds)" },
|
|
235
|
+
end_time: { kind: "unix", doc: "to (10^11 and over: milliseconds)" },
|
|
236
|
+
},
|
|
237
|
+
page: { kind: "range", from: "start_time", to: "end_time" },
|
|
238
|
+
errors: [...GATED, "bad_query", "not_found"],
|
|
239
|
+
body: P.CG_HISTORICAL,
|
|
240
|
+
}),
|
|
241
|
+
llamaTvl: partner({ pattern: "/v2/defillama/tvl", errors: GATED, body: P.LLAMA_TVL }),
|
|
242
|
+
llamaFees: partner({
|
|
243
|
+
pattern: "/v2/defillama/fees",
|
|
244
|
+
query: { from: { kind: "unix", doc: "window start, inclusive (with to)" }, to: { kind: "unix", doc: "window end, exclusive (with from)" } },
|
|
245
|
+
page: { kind: "range", from: "from", to: "to" },
|
|
246
|
+
body: P.LLAMA_FEES,
|
|
247
|
+
}),
|
|
248
|
+
|
|
249
|
+
health: { pattern: "/health", aliases: [], mount: "root", params: [], query: {}, page: NONE, errors: [], gated: false, units: "site", audience: "ops", body: P.HEALTH },
|
|
250
|
+
} ;
|
|
251
|
+
|
|
252
|
+
export const ROUTE_NAMES = Object.keys(INDEXER_CONTRACT) ;
|
|
253
|
+
|
|
254
|
+
export function matchRoute(path ) {
|
|
255
|
+
const p = path.replace(/\/+$/, "") || "/";
|
|
256
|
+
for (const name of ROUTE_NAMES) {
|
|
257
|
+
const c = INDEXER_CONTRACT[name];
|
|
258
|
+
for (const pat of [c.pattern, ...c.aliases]) {
|
|
259
|
+
const keys = [];
|
|
260
|
+
const re = new RegExp(`^${pat.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/<(launch|wallet|token)>/g, (_, k ) => (keys.push(k), "([^/]+)"))}$`);
|
|
261
|
+
const m = re.exec(p);
|
|
262
|
+
if (m === null) continue;
|
|
263
|
+
const params = {};
|
|
264
|
+
keys.forEach((k, i) => (params[k] = decodeURIComponent(m[i + 1])));
|
|
265
|
+
return { name, params };
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export const OPEN_ROUTES = {
|
|
272
|
+
|
|
273
|
+
genesisSeries: { pattern: "/floor-amm/genesis/series", served: false, open: "undecided: kept or dropped with the site's row" },
|
|
274
|
+
|
|
275
|
+
points: { pattern: null, served: false, open: "undecided: a points route, or the trades drain as now" },
|
|
276
|
+
} ;
|
|
277
|
+
|
|
278
|
+
export function routeLimit(name ) {
|
|
279
|
+
const p = INDEXER_CONTRACT[name].page;
|
|
280
|
+
return p.kind === "limit" || p.kind === "offset" || p.kind === "cursor" ? p.limit : null;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export const LIMITS = Object.fromEntries(ROUTE_NAMES.flatMap((n) => {
|
|
284
|
+
const l = routeLimit(n);
|
|
285
|
+
return l === null ? [] : [[n, l]];
|
|
286
|
+
})) ;
|
|
287
|
+
|
|
288
|
+
export function clampLimit(name , n ) {
|
|
289
|
+
const l = routeLimit(name);
|
|
290
|
+
return l === null ? n : Math.min(Math.max(1, Math.trunc(n)), l.max);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const DIGITS = /^\d+$/;
|
|
294
|
+
|
|
295
|
+
export function queryLimit(name , q ) {
|
|
296
|
+
const l = routeLimit(name);
|
|
297
|
+
if (l === null) throw new TypeError(`${name} takes no limit`);
|
|
298
|
+
const raw = q.get("limit");
|
|
299
|
+
return raw === null || raw === "" || !DIGITS.test(raw) ? l.default : clampLimit(name, Number(raw));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export function queryRefusal(name , q ) {
|
|
303
|
+
const spec = INDEXER_CONTRACT[name].query;
|
|
304
|
+
for (const [key, k] of Object.entries(spec)) {
|
|
305
|
+
const raw = q.get(key);
|
|
306
|
+
if (raw === null || raw === "") continue;
|
|
307
|
+
switch (k.kind) {
|
|
308
|
+
case "int": {
|
|
309
|
+
const lo = k.min ?? 0;
|
|
310
|
+
const n = DIGITS.test(raw) ? Number(raw) : NaN;
|
|
311
|
+
if (!(n >= lo) || (k.max !== undefined && n > k.max)) return k.max === undefined ? `${key} must be an integer ≥ ${lo}` : `${key} must be ${lo}..${k.max}`;
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
case "list": {
|
|
315
|
+
const n = raw.split(",").filter((s) => s !== "").length;
|
|
316
|
+
if (k.max !== undefined && n > k.max) return `at most ${k.max} ${key}`;
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
case "enum":
|
|
320
|
+
if (k.values !== undefined && !k.values.includes(raw)) return `${key} must be one of ${k.values.join(", ")}`;
|
|
321
|
+
break;
|
|
322
|
+
case "bool":
|
|
323
|
+
if (!(raw in BOOLS)) return `${key} must be true or false`;
|
|
324
|
+
break;
|
|
325
|
+
default:
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return spanRefusal(name, q);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
const BOOLS = { true: true, false: false, 1: true, 0: false };
|
|
333
|
+
|
|
334
|
+
export function queryArg(name , q , key ) {
|
|
335
|
+
const k = (INDEXER_CONTRACT[name].query )[key];
|
|
336
|
+
if (k === undefined) throw new TypeError(`${name} reads no ${key}`);
|
|
337
|
+
const raw = q.get(key);
|
|
338
|
+
return raw !== null && raw !== "" ? raw : k.default === undefined ? undefined : String(k.default);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export function queryBool(name , q , key ) {
|
|
342
|
+
const raw = queryArg(name, q, key);
|
|
343
|
+
return raw === undefined ? null : (BOOLS[raw] ?? null);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export function spanRefusal(name , q , toDefault ) {
|
|
347
|
+
const p = INDEXER_CONTRACT[name].page;
|
|
348
|
+
if (p.kind !== "range" || p.span === undefined) return null;
|
|
349
|
+
const sec = (B.CANDLE_INTERVAL_SECS )[queryArg(name, q, p.span.interval) ?? ""];
|
|
350
|
+
const fromRaw = q.get(p.from), toRaw = q.get(p.to);
|
|
351
|
+
if (sec === undefined || fromRaw === null || !DIGITS.test(fromRaw)) return null;
|
|
352
|
+
const to = toRaw === null ? toDefault : DIGITS.test(toRaw) ? Number(toRaw) : undefined;
|
|
353
|
+
if (to === undefined) return null;
|
|
354
|
+
const from = Number(fromRaw);
|
|
355
|
+
if (from > to) return null;
|
|
356
|
+
const bucket = (t ) => Math.floor(t / sec) * sec;
|
|
357
|
+
return (bucket(to) - bucket(from)) / sec + 1 > p.span.max ? `the range spans more than ${p.span.max} candles` : null;
|
|
358
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export class ShapeError extends TypeError {
|
|
4
|
+
path ;
|
|
5
|
+
constructor(path , want , got ) {
|
|
6
|
+
super(`${path || "body"}: want ${want}, got ${preview(got)}`);
|
|
7
|
+
this.path = path;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const preview = (v ) => {
|
|
12
|
+
if (v === undefined) return "nothing";
|
|
13
|
+
const s = JSON.stringify(v) ?? String(v);
|
|
14
|
+
return s.length > 60 ? `${s.slice(0, 57)}...` : s;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const str = (v, p) => {
|
|
18
|
+
if (typeof v !== "string") throw new ShapeError(p, "a string", v);
|
|
19
|
+
return v;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const num = (v, p) => {
|
|
23
|
+
if (typeof v !== "number" || !Number.isFinite(v)) throw new ShapeError(p, "a number", v);
|
|
24
|
+
return v;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const int = (v, p) => {
|
|
28
|
+
const n = typeof v === "string" && /^-?\d+$/.test(v) ? Number(v) : v;
|
|
29
|
+
if (typeof n !== "number" || !Number.isSafeInteger(n)) throw new ShapeError(p, "a safe integer", v);
|
|
30
|
+
return n;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const bool = (v, p) => {
|
|
34
|
+
if (typeof v !== "boolean") throw new ShapeError(p, "a boolean", v);
|
|
35
|
+
return v;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const big = (v, p) => {
|
|
39
|
+
if (typeof v === "string" && /^-?\d+$/.test(v)) return BigInt(v);
|
|
40
|
+
if (typeof v === "number" && Number.isSafeInteger(v)) return BigInt(v);
|
|
41
|
+
throw new ShapeError(p, "an integer string", v);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const decimal = (v, p) => {
|
|
45
|
+
if (typeof v !== "string" || !/^-?\d+(\.\d+)?$/.test(v)) throw new ShapeError(p, "a decimal string", v);
|
|
46
|
+
return v;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const unknown = (v) => v;
|
|
50
|
+
|
|
51
|
+
export function oneOf (...values ) {
|
|
52
|
+
return (v, p) => {
|
|
53
|
+
if (typeof v !== "string" || !values.includes(v)) throw new ShapeError(p, values.map((x) => JSON.stringify(x)).join(" | "), v);
|
|
54
|
+
return v ;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function nullable (d ) {
|
|
59
|
+
return (v, p) => (v === null ? null : d(v, p));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function optional (d ) {
|
|
63
|
+
return Object.assign((v , p ) => (v === undefined ? undefined : d(v, p)), { optional: true });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function array (d ) {
|
|
67
|
+
return (v, p) => {
|
|
68
|
+
if (!Array.isArray(v)) throw new ShapeError(p, "an array", v);
|
|
69
|
+
return v.map((x, i) => d(x, `${p}[${i}]`));
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function record (d ) {
|
|
74
|
+
return (v, p) => {
|
|
75
|
+
if (typeof v !== "object" || v === null || Array.isArray(v)) throw new ShapeError(p, "an object", v);
|
|
76
|
+
const out = {};
|
|
77
|
+
for (const [k, x] of Object.entries(v)) out[k] = d(x, `${p}.${k}`);
|
|
78
|
+
return out;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function object (shape ) {
|
|
83
|
+
return (v, p) => {
|
|
84
|
+
if (typeof v !== "object" || v === null || Array.isArray(v)) throw new ShapeError(p, "an object", v);
|
|
85
|
+
const o = v ;
|
|
86
|
+
const out = {};
|
|
87
|
+
for (const [k, d] of Object.entries(shape)) {
|
|
88
|
+
const x = d(o[k], p === "" ? k : `${p}.${k}`);
|
|
89
|
+
if (x !== undefined || !("optional" in d)) out[k] = x;
|
|
90
|
+
}
|
|
91
|
+
return out ;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function decode (d , body ) {
|
|
96
|
+
return d(body, "");
|
|
97
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { array, big, bool, decimal, int, nullable, num, object, oneOf, optional, record, str, unknown } from "./decode.js";
|
|
4
|
+
|
|
5
|
+
import { FEES, MILESTONES } from "./bodies.js";
|
|
6
|
+
|
|
7
|
+
const LIQUIDITY_MODE = oneOf("all", "bid");
|
|
8
|
+
|
|
9
|
+
export const DEX_ASSET = object({
|
|
10
|
+
asset: object({
|
|
11
|
+
id: str,
|
|
12
|
+
name: str,
|
|
13
|
+
symbol: str,
|
|
14
|
+
|
|
15
|
+
decimals: int,
|
|
16
|
+
totalSupply: optional(decimal),
|
|
17
|
+
circulatingSupply: optional(decimal),
|
|
18
|
+
|
|
19
|
+
coinGeckoId: optional(str),
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const TOKEN_HOLDERS = object({ total: int, holders: array(object({ address: str, balance: big })) });
|
|
24
|
+
|
|
25
|
+
export const DEX_SUMMARY = object({
|
|
26
|
+
pair: str,
|
|
27
|
+
base: str,
|
|
28
|
+
quote: str,
|
|
29
|
+
priceNative: decimal,
|
|
30
|
+
|
|
31
|
+
floorPriceNative: decimal,
|
|
32
|
+
liquidityQuote: decimal,
|
|
33
|
+
liquidityMode: LIQUIDITY_MODE,
|
|
34
|
+
|
|
35
|
+
vault: decimal,
|
|
36
|
+
|
|
37
|
+
bidMoney: decimal,
|
|
38
|
+
floor: decimal,
|
|
39
|
+
cushion: decimal,
|
|
40
|
+
totalSupply: decimal,
|
|
41
|
+
circulatingSupply: decimal,
|
|
42
|
+
marketCapQuote: decimal,
|
|
43
|
+
volumeQuote: decimal,
|
|
44
|
+
trades: int,
|
|
45
|
+
graduated: bool,
|
|
46
|
+
unlisted: bool,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const DEX_PAIR = object({
|
|
50
|
+
pair: object({ id: str, asset0Id: str, asset1Id: str, createdAtBlockNumber: int, createdAtBlockTimestamp: int, feeBps: nullable(num) }),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const CG_PAIRS = array(object({ ticker_id: str, base: str, target: str, pool_id: str }));
|
|
54
|
+
|
|
55
|
+
export const CG_TICKERS = array(object({
|
|
56
|
+
ticker_id: str,
|
|
57
|
+
base_currency: str,
|
|
58
|
+
target_currency: str,
|
|
59
|
+
pool_id: str,
|
|
60
|
+
last_price: decimal,
|
|
61
|
+
ask: decimal,
|
|
62
|
+
|
|
63
|
+
bid: decimal,
|
|
64
|
+
base_volume: decimal,
|
|
65
|
+
target_volume: decimal,
|
|
66
|
+
high: nullable(decimal),
|
|
67
|
+
low: nullable(decimal),
|
|
68
|
+
liquidity_in_usd: nullable(decimal),
|
|
69
|
+
liquidity_in_quote: big,
|
|
70
|
+
|
|
71
|
+
depthUp2: nullable(decimal),
|
|
72
|
+
depthDown2: nullable(decimal),
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
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
|
+
export const CG_HISTORICAL = object({ buy: optional(array(CG_TRADE)), sell: optional(array(CG_TRADE)) });
|
|
78
|
+
|
|
79
|
+
export const LLAMA_TVL = object({ mode: LIQUIDITY_MODE, tvl: record(big), launchTokens: array(str) });
|
|
80
|
+
|
|
81
|
+
const LLAMA_SUMS = {
|
|
82
|
+
volume: big,
|
|
83
|
+
fees: FEES,
|
|
84
|
+
createFees: big,
|
|
85
|
+
|
|
86
|
+
milestonesPaid: MILESTONES,
|
|
87
|
+
protocolRevenue: big,
|
|
88
|
+
holdersRevenue: big,
|
|
89
|
+
|
|
90
|
+
traderRef: optional(big),
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const LLAMA_FEES = object({ ...LLAMA_SUMS, from: optional(int), to: optional(int), byQuote: record(object(LLAMA_SUMS)) });
|
|
94
|
+
|
|
95
|
+
export const HEALTH = object({
|
|
96
|
+
ok: bool,
|
|
97
|
+
head: nullable(int),
|
|
98
|
+
launches: int,
|
|
99
|
+
ready: bool,
|
|
100
|
+
lag: nullable(int),
|
|
101
|
+
stalled: nullable(object({ slot: int, signature: str, cycles: int, error: str, ok: bool })),
|
|
102
|
+
|
|
103
|
+
metrics: optional(unknown),
|
|
104
|
+
});
|
|
105
|
+
|