@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/src/evm/chains.ts
CHANGED
|
@@ -201,6 +201,37 @@ export function floorAmmAddressV2(p: { deployer: string; proxySalt: string; code
|
|
|
201
201
|
|
|
202
202
|
export const tokenImplAddressV2 = (p: { salt: string; code: string }): string => at(p.salt, p.code);
|
|
203
203
|
|
|
204
|
+
export const LAUNCH_TOKEN_IMPLS = {
|
|
205
|
+
live: "0xF1009235c447fcA25e8792784772EDA720e2b822",
|
|
206
|
+
holderMoved: "0x91E2311c9c77a56945c082dd8d9ff7bF0eC2B79B",
|
|
207
|
+
} as const;
|
|
208
|
+
|
|
209
|
+
export const HOLDER_MOVED_FIRST_LAUNCH_ID: Readonly<Record<ChainKey, number | null>> = {
|
|
210
|
+
ethereum: 1, base: 1, bsc: 1, arbitrum: 1, arc: 1, robinhood: 1, hyperevm: 1, elysium: 1,
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export function tokenImplForLaunch(p: { chain: ChainKey; id: bigint | number; firstId?: number | null }): string {
|
|
214
|
+
const first = p.firstId !== undefined ? p.firstId : HOLDER_MOVED_FIRST_LAUNCH_ID[p.chain];
|
|
215
|
+
return first !== null && BigInt(p.id) >= BigInt(first) ? LAUNCH_TOKEN_IMPLS.holderMoved : LAUNCH_TOKEN_IMPLS.live;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export function tokenImplOfCode(code: string): string | null {
|
|
219
|
+
const c = code.toLowerCase().replace(/^0x/, "");
|
|
220
|
+
const m = /^363d3d373d3d3d363d73([0-9a-f]{40})5af43d82803e903d91602b57fd5bf3$/.exec(c);
|
|
221
|
+
return m ? "0x" + m[1] : null;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export const isLaunchTokenImpl = (impl: string | null): boolean =>
|
|
225
|
+
impl !== null && Object.values(LAUNCH_TOKEN_IMPLS).some((a) => a.toLowerCase() === impl.toLowerCase());
|
|
226
|
+
|
|
227
|
+
export function launchTokenCodeKind(code: string): "live" | "holderMoved" | null {
|
|
228
|
+
const i = tokenImplOfCode(code);
|
|
229
|
+
if (i === null) return null;
|
|
230
|
+
if (i === LAUNCH_TOKEN_IMPLS.live.toLowerCase()) return "live";
|
|
231
|
+
if (i === LAUNCH_TOKEN_IMPLS.holderMoved.toLowerCase()) return "holderMoved";
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
|
|
204
235
|
export function zapDeployerAddressV2(p: { floorAmm: string; authority: string; code: string }): string {
|
|
205
236
|
return at(FLOOR_SALTS.zapDeployer, cat(p.code, bytesToHex(encodeAbi(["address", "address"], [p.floorAmm, p.authority]))));
|
|
206
237
|
}
|
package/src/evm/floor/calls.ts
CHANGED
|
@@ -200,6 +200,11 @@ export function traderRefAuthDigest(p: { chainId: bigint; floorAmm: string; trad
|
|
|
200
200
|
return { digest: bytesToHex(d), message: eip191(d) };
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
export function ogUserAuthDigest(p: { chainId: bigint; floorAmm: string; referrer: string; deadline: bigint }): { digest: string; message: string } {
|
|
204
|
+
const d = keccak256(encodeAbi(["string", "uint256", "address", "address", "uint256"], ["floor.amm.ogUser.auth.v1", p.chainId, p.floorAmm, p.referrer, p.deadline]));
|
|
205
|
+
return { digest: bytesToHex(d), message: eip191(d) };
|
|
206
|
+
}
|
|
207
|
+
|
|
203
208
|
export function bindHandleAuthDigest(p: { chainId: bigint; floorAmm: string; handleId: string; wallet: string; quotes: readonly string[]; deadline: bigint }): { digest: string; message: string } {
|
|
204
209
|
const d = keccak256(
|
|
205
210
|
encodeAbi(
|
package/src/evm/squid.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type SquidHook = {
|
|
|
39
39
|
|
|
40
40
|
export const SQUID_TOKEN_SCALE = 10n ** 12n;
|
|
41
41
|
|
|
42
|
-
export const SQUID_GAS = { transfer:
|
|
42
|
+
export const SQUID_GAS = { transfer: 100_000, buy: 1_100_000, sell: 850_000, zapBuy: 1_300_000, passOn: 30_000 } as const;
|
|
43
43
|
|
|
44
44
|
type Common = {
|
|
45
45
|
chainId: number | string;
|
|
@@ -18,17 +18,17 @@ export interface EvmFunctionSelectorRow {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export const EVM_FUNCTION_SELECTORS: readonly EvmFunctionSelectorRow[] = [
|
|
21
|
-
{ name: "acceptAuthority", signature: "acceptAuthority()", selector: "0x1580798f", sources: ["floorAmm"] },
|
|
22
|
-
{ name: "accounted", signature: "accounted(address)", selector: "0xee1a56ce", sources: ["floorAmm"] },
|
|
21
|
+
{ name: "acceptAuthority", signature: "acceptAuthority()", selector: "0x1580798f", sources: ["floorAmm","floorAmmGovV2"] },
|
|
22
|
+
{ name: "accounted", signature: "accounted(address)", selector: "0xee1a56ce", sources: ["floorAmm","floorAmmGovV2"] },
|
|
23
23
|
{ name: "addPreset", signature: "addPreset(uint8,bytes)", selector: "0xb88257b1", sources: ["floorAmm"] },
|
|
24
|
-
{ name: "addQuote", signature: "addQuote(address,uint256,uint256)", selector: "0x488c664b", sources: ["floorAmm"] },
|
|
24
|
+
{ name: "addQuote", signature: "addQuote(address,uint256,uint256)", selector: "0x488c664b", sources: ["floorAmm","floorAmmGovV2"] },
|
|
25
25
|
{ name: "addReward", signature: "addReward(uint256)", selector: "0x74de4ec4", sources: ["floorTokenIndexed"] },
|
|
26
26
|
{ name: "allowance", signature: "allowance(address,address)", selector: "0xdd62ed3e", sources: ["floorToken","floorTokenIndexed"] },
|
|
27
27
|
{ name: "approve", signature: "approve(address,uint256)", selector: "0x095ea7b3", sources: ["floorToken","floorTokenIndexed"] },
|
|
28
|
-
{ name: "authority", signature: "authority()", selector: "0xbf7e214f", sources: ["floorAmm"] },
|
|
28
|
+
{ name: "authority", signature: "authority()", selector: "0xbf7e214f", sources: ["floorAmm","floorAmmGovV2"] },
|
|
29
29
|
{ name: "balanceOf", signature: "balanceOf(address)", selector: "0x70a08231", sources: ["floorToken","floorTokenIndexed"] },
|
|
30
30
|
{ name: "bidMoney", signature: "bidMoney(uint256)", selector: "0x8e403c51", sources: ["floorAmmViewsV2"] },
|
|
31
|
-
{ name: "bindHandle", signature: "bindHandle(bytes32,address,address[],uint256,bytes,bytes)", selector: "0xcea3463e", sources: ["floorAmm"] },
|
|
31
|
+
{ name: "bindHandle", signature: "bindHandle(bytes32,address,address[],uint256,bytes,bytes)", selector: "0xcea3463e", sources: ["floorAmm","floorAmmGovV2"] },
|
|
32
32
|
{ name: "bookEngine", signature: "bookEngine()", selector: "0x72148c77", sources: ["floorAmmV2"] },
|
|
33
33
|
{ name: "bookState", signature: "bookState()", selector: "0x2c14e3f2", sources: ["floorTokenIndexed"] },
|
|
34
34
|
{ name: "bookTotals", signature: "bookTotals()", selector: "0xbffc2073", sources: ["floorTokenIndexed"] },
|
|
@@ -42,11 +42,11 @@ export const EVM_FUNCTION_SELECTORS: readonly EvmFunctionSelectorRow[] = [
|
|
|
42
42
|
{ name: "checkPreset", signature: "checkPreset(bytes)", selector: "0x6337513e", sources: ["floorAmm"] },
|
|
43
43
|
{ name: "circulatingOf", signature: "circulatingOf(uint256)", selector: "0x72812fcf", sources: ["floorAmmViewsV2"] },
|
|
44
44
|
{ name: "claim", signature: "claim(address,uint256,uint256[],address[])", selector: "0xa461a90d", sources: ["floorAmm","floorAmmClaimsV2"] },
|
|
45
|
-
{ name: "claimPayoutTo", signature: "claimPayoutTo(address,address)", selector: "0xc14ab75d", sources: ["floorAmm"] },
|
|
46
|
-
{ name: "clearTraderRef", signature: "clearTraderRef(address)", selector: "0x53550430", sources: ["floorAmm"] },
|
|
45
|
+
{ name: "claimPayoutTo", signature: "claimPayoutTo(address,address)", selector: "0xc14ab75d", sources: ["floorAmm","floorAmmGovV2"] },
|
|
46
|
+
{ name: "clearTraderRef", signature: "clearTraderRef(address)", selector: "0x53550430", sources: ["floorAmm","floorAmmGovV2"] },
|
|
47
47
|
{ name: "createBookEngine", signature: "createBookEngine()", selector: "0x0fdf26a7", sources: ["floorAmmCreateV2"] },
|
|
48
48
|
{ name: "createLaunch", signature: "createLaunch((uint8,address,string,string,uint256,uint256,bool,bytes32,uint256,uint16))", selector: "0x25b62f18", sources: ["floorAmm","floorAmmCreateV2"] },
|
|
49
|
-
{ name: "createPaused", signature: "createPaused()", selector: "0xbac7b497", sources: ["floorAmm"] },
|
|
49
|
+
{ name: "createPaused", signature: "createPaused()", selector: "0xbac7b497", sources: ["floorAmm","floorAmmGovV2"] },
|
|
50
50
|
{ name: "creditBacking", signature: "creditBacking(uint256,uint256)", selector: "0x1f341504", sources: ["floorAmmV2"] },
|
|
51
51
|
{ name: "DEAD", signature: "DEAD()", selector: "0x03fd2a45", sources: ["floorTokenIndexed"] },
|
|
52
52
|
{ name: "decimals", signature: "decimals()", selector: "0x313ce567", sources: ["floorToken","floorTokenIndexed"] },
|
|
@@ -55,13 +55,13 @@ export const EVM_FUNCTION_SELECTORS: readonly EvmFunctionSelectorRow[] = [
|
|
|
55
55
|
{ name: "DOMAIN_SEPARATOR", signature: "DOMAIN_SEPARATOR()", selector: "0x3644e515", sources: ["floorToken","floorTokenIndexed"] },
|
|
56
56
|
{ name: "eip712Domain", signature: "eip712Domain()", selector: "0x84b0196e", sources: ["floorTokenIndexed"] },
|
|
57
57
|
{ name: "floorAmm", signature: "floorAmm()", selector: "0x78164d52", sources: ["floorZap"] },
|
|
58
|
-
{ name: "floorTokenAccrued", signature: "floorTokenAccrued(address)", selector: "0xf3a261f9", sources: ["floorAmm"] },
|
|
59
|
-
{ name: "handleOwed", signature: "handleOwed(bytes32,address)", selector: "0xaad2ed5c", sources: ["floorAmm"] },
|
|
60
|
-
{ name: "handleWallet", signature: "handleWallet(bytes32)", selector: "0xc6da686d", sources: ["floorAmm"] },
|
|
58
|
+
{ name: "floorTokenAccrued", signature: "floorTokenAccrued(address)", selector: "0xf3a261f9", sources: ["floorAmm","floorAmmGovV2"] },
|
|
59
|
+
{ name: "handleOwed", signature: "handleOwed(bytes32,address)", selector: "0xaad2ed5c", sources: ["floorAmm","floorAmmGovV2"] },
|
|
60
|
+
{ name: "handleWallet", signature: "handleWallet(bytes32)", selector: "0xc6da686d", sources: ["floorAmm","floorAmmGovV2"] },
|
|
61
61
|
{ name: "holderBook", signature: "holderBook(uint256)", selector: "0xf5d23b14", sources: ["floorAmmViewsV2"] },
|
|
62
|
-
{ name: "holderBucket", signature: "holderBucket(address)", selector: "0x088806d0", sources: ["floorAmm"] },
|
|
63
|
-
{ name: "holderDest", signature: "holderDest()", selector: "0x84a6263a", sources: ["floorAmm"] },
|
|
64
|
-
{ name: "initialize", signature: "initialize(address,address,address,address)", selector: "0xf8c8765e", sources: ["floorAmm"] },
|
|
62
|
+
{ name: "holderBucket", signature: "holderBucket(address)", selector: "0x088806d0", sources: ["floorAmm","floorAmmGovV2"] },
|
|
63
|
+
{ name: "holderDest", signature: "holderDest()", selector: "0x84a6263a", sources: ["floorAmm","floorAmmGovV2"] },
|
|
64
|
+
{ name: "initialize", signature: "initialize(address,address,address,address)", selector: "0xf8c8765e", sources: ["floorAmm","floorAmmGovV2"] },
|
|
65
65
|
{ name: "initialize", signature: "initialize(string,string,uint256)", selector: "0xb119490e", sources: ["floorTokenIndexed"] },
|
|
66
66
|
{ name: "launchBook", signature: "launchBook(uint256)", selector: "0x926310f1", sources: ["floorAmmViewsV2"] },
|
|
67
67
|
{ name: "launchCount", signature: "launchCount()", selector: "0x27cca59f", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
@@ -73,56 +73,61 @@ export const EVM_FUNCTION_SELECTORS: readonly EvmFunctionSelectorRow[] = [
|
|
|
73
73
|
{ name: "launchQuote", signature: "launchQuote(uint256)", selector: "0x98032919", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
74
74
|
{ name: "launchState", signature: "launchState(uint256)", selector: "0xac3307e8", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
75
75
|
{ name: "launchToken", signature: "launchToken(uint256)", selector: "0x6a19197b", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
76
|
-
{ name: "metadataBase", signature: "metadataBase()", selector: "0x65b973c3", sources: ["floorAmm"] },
|
|
76
|
+
{ name: "metadataBase", signature: "metadataBase()", selector: "0x65b973c3", sources: ["floorAmm","floorAmmGovV2"] },
|
|
77
77
|
{ name: "metadataURI", signature: "metadataURI()", selector: "0x03ee438c", sources: ["floorToken","floorTokenIndexed"] },
|
|
78
|
-
{ name: "moveHandleOwed", signature: "moveHandleOwed(bytes32,address[])", selector: "0xc43594a1", sources: ["floorAmm"] },
|
|
78
|
+
{ name: "moveHandleOwed", signature: "moveHandleOwed(bytes32,address[])", selector: "0xc43594a1", sources: ["floorAmm","floorAmmGovV2"] },
|
|
79
79
|
{ name: "name", signature: "name()", selector: "0x06fdde03", sources: ["floorToken","floorTokenIndexed"] },
|
|
80
|
-
{ name: "NATIVE", signature: "NATIVE()", selector: "0xa0cf0aea", sources: ["floorAmm"] },
|
|
81
|
-
{ name: "nativeCreateFee", signature: "nativeCreateFee()", selector: "0x10b51e45", sources: ["floorAmm"] },
|
|
80
|
+
{ name: "NATIVE", signature: "NATIVE()", selector: "0xa0cf0aea", sources: ["floorAmm","floorAmmGovV2"] },
|
|
81
|
+
{ name: "nativeCreateFee", signature: "nativeCreateFee()", selector: "0x10b51e45", sources: ["floorAmm","floorAmmGovV2"] },
|
|
82
82
|
{ name: "nextModule", signature: "nextModule()", selector: "0xf85abfc7", sources: ["floorAmmV2","floorAmmViewsV2","floorAmmCreateV2","floorAmmClaimsV2"] },
|
|
83
83
|
{ name: "nextPresetId", signature: "nextPresetId()", selector: "0xc8a768e6", sources: ["floorAmm"] },
|
|
84
84
|
{ name: "nonces", signature: "nonces(address)", selector: "0x7ecebe00", sources: ["floorToken","floorTokenIndexed"] },
|
|
85
85
|
{ name: "noteBurn", signature: "noteBurn(uint256)", selector: "0x6db7cd01", sources: ["floorAmmCreateV2"] },
|
|
86
86
|
{ name: "noteDead", signature: "noteDead(uint256)", selector: "0xbdf3b0de", sources: ["floorAmmCreateV2"] },
|
|
87
|
+
{ name: "noteMove", signature: "noteMove(address,address,uint256,uint256,uint256)", selector: "0xe6b761ea", sources: ["floorAmmV2"] },
|
|
88
|
+
{ name: "ogCount", signature: "ogCount()", selector: "0x9457990a", sources: ["floorAmmGovV2"] },
|
|
89
|
+
{ name: "ogUserOf", signature: "ogUserOf(address)", selector: "0x6df29e2f", sources: ["floorAmmGovV2"] },
|
|
87
90
|
{ name: "optedIn", signature: "optedIn(address)", selector: "0x4824b8fd", sources: ["floorTokenIndexed"] },
|
|
88
91
|
{ name: "optIn", signature: "optIn()", selector: "0x5b48684e", sources: ["floorTokenIndexed"] },
|
|
89
|
-
{ name: "owedOf", signature: "owedOf(address,address)", selector: "0xfacba08d", sources: ["floorAmm"] },
|
|
90
|
-
{ name: "owedOfMany", signature: "owedOfMany(address,address[])", selector: "0xa1efa4ba", sources: ["floorAmm"] },
|
|
92
|
+
{ name: "owedOf", signature: "owedOf(address,address)", selector: "0xfacba08d", sources: ["floorAmm","floorAmmGovV2"] },
|
|
93
|
+
{ name: "owedOfMany", signature: "owedOfMany(address,address[])", selector: "0xa1efa4ba", sources: ["floorAmm","floorAmmGovV2"] },
|
|
91
94
|
{ name: "owedV2", signature: "owedV2(address,uint256[],address[])", selector: "0xdd3ee1ef", sources: ["floorAmmViewsV2"] },
|
|
92
95
|
{ name: "pairIdOf", signature: "pairIdOf(uint256)", selector: "0x83a74ea3", sources: ["floorAmmViewsV2"] },
|
|
93
|
-
{ name: "payoutOwed", signature: "payoutOwed(address,address)", selector: "0xae3f9120", sources: ["floorAmm"] },
|
|
94
|
-
{ name: "pendingAuthority", signature: "pendingAuthority()", selector: "0xfabb94bb", sources: ["floorAmm"] },
|
|
96
|
+
{ name: "payoutOwed", signature: "payoutOwed(address,address)", selector: "0xae3f9120", sources: ["floorAmm","floorAmmGovV2"] },
|
|
97
|
+
{ name: "pendingAuthority", signature: "pendingAuthority()", selector: "0xfabb94bb", sources: ["floorAmm","floorAmmGovV2"] },
|
|
95
98
|
{ name: "permit", signature: "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", selector: "0xd505accf", sources: ["floorToken","floorTokenIndexed"] },
|
|
96
|
-
{ name: "platformOwed", signature: "platformOwed(address)", selector: "0x240b9586", sources: ["floorAmm"] },
|
|
99
|
+
{ name: "platformOwed", signature: "platformOwed(address)", selector: "0x240b9586", sources: ["floorAmm","floorAmmGovV2"] },
|
|
97
100
|
{ name: "positionOf", signature: "positionOf(address)", selector: "0xfd2d39c5", sources: ["floorTokenIndexed"] },
|
|
98
101
|
{ name: "predictToken", signature: "predictToken(address,bytes32)", selector: "0x486e36c8", sources: ["floorAmm","floorAmmCreateV2"] },
|
|
99
102
|
{ name: "presetRow", signature: "presetRow(uint8)", selector: "0xa0c15861", sources: ["floorAmm"] },
|
|
100
|
-
{ name: "priceUpdater", signature: "priceUpdater()", selector: "0xfc612a8d", sources: ["floorAmm"] },
|
|
103
|
+
{ name: "priceUpdater", signature: "priceUpdater()", selector: "0xfc612a8d", sources: ["floorAmm","floorAmmGovV2"] },
|
|
101
104
|
{ name: "program", signature: "program()", selector: "0xc860ebc6", sources: ["floorToken","floorTokenIndexed"] },
|
|
102
105
|
{ name: "proxiableUUID", signature: "proxiableUUID()", selector: "0x52d1902d", sources: ["floorAmmV2"] },
|
|
103
106
|
{ name: "quoteBuy", signature: "quoteBuy(uint256,uint256,address)", selector: "0xec7a34c9", sources: ["floorAmm","floorAmmV2"] },
|
|
104
|
-
{ name: "quoteEntry", signature: "quoteEntry(address)", selector: "0x77665076", sources: ["floorAmm"] },
|
|
105
|
-
{ name: "quoteRisk", signature: "quoteRisk(address)", selector: "0x1461d14e", sources: ["floorAmm"] },
|
|
106
|
-
{ name: "quotes", signature: "quotes()", selector: "0xd6a5d7db", sources: ["floorAmm"] },
|
|
107
|
+
{ name: "quoteEntry", signature: "quoteEntry(address)", selector: "0x77665076", sources: ["floorAmm","floorAmmGovV2"] },
|
|
108
|
+
{ name: "quoteRisk", signature: "quoteRisk(address)", selector: "0x1461d14e", sources: ["floorAmm","floorAmmGovV2"] },
|
|
109
|
+
{ name: "quotes", signature: "quotes()", selector: "0xd6a5d7db", sources: ["floorAmm","floorAmmGovV2"] },
|
|
107
110
|
{ name: "quoteSell", signature: "quoteSell(uint256,uint256,address)", selector: "0x0cff08d1", sources: ["floorAmm","floorAmmV2"] },
|
|
108
|
-
{ name: "referralAuthority", signature: "referralAuthority()", selector: "0x2fe0a99a", sources: ["floorAmm"] },
|
|
111
|
+
{ name: "referralAuthority", signature: "referralAuthority()", selector: "0x2fe0a99a", sources: ["floorAmm","floorAmmGovV2"] },
|
|
109
112
|
{ name: "releaseSkipped", signature: "releaseSkipped(address)", selector: "0x215fa9eb", sources: ["floorTokenIndexed"] },
|
|
113
|
+
{ name: "revokeOgUser", signature: "revokeOgUser(address)", selector: "0x52e52ecc", sources: ["floorAmmGovV2"] },
|
|
110
114
|
{ name: "router", signature: "router()", selector: "0xf887ea40", sources: ["floorZap"] },
|
|
111
115
|
{ name: "sell", signature: "sell(uint256,uint256,uint256,address,uint256)", selector: "0xbadb999b", sources: ["floorAmm","floorAmmV2"] },
|
|
112
116
|
{ name: "sellFromBalance", signature: "sellFromBalance(uint256,uint256,address,uint256)", selector: "0x611b00a8", sources: ["floorAmm","floorAmmV2"] },
|
|
113
117
|
{ name: "sellWithPermit", signature: "sellWithPermit(uint256,uint256,uint256,address,uint256,uint256,uint8,bytes32,bytes32)", selector: "0x2ab030d3", sources: ["floorAmm","floorAmmV2"] },
|
|
114
|
-
{ name: "setCreatePaused", signature: "setCreatePaused(bool)", selector: "0x83bcec85", sources: ["floorAmm"] },
|
|
115
|
-
{ name: "setHolderDest", signature: "setHolderDest(address)", selector: "0x6ad3e66d", sources: ["floorAmm"] },
|
|
116
|
-
{ name: "setMetadataBase", signature: "setMetadataBase(string)", selector: "0xd3811c0f", sources: ["floorAmm"] },
|
|
117
|
-
{ name: "setNativeCreateFee", signature: "setNativeCreateFee(uint256)", selector: "0xa4433667", sources: ["floorAmm"] },
|
|
118
|
+
{ name: "setCreatePaused", signature: "setCreatePaused(bool)", selector: "0x83bcec85", sources: ["floorAmm","floorAmmGovV2"] },
|
|
119
|
+
{ name: "setHolderDest", signature: "setHolderDest(address)", selector: "0x6ad3e66d", sources: ["floorAmm","floorAmmGovV2"] },
|
|
120
|
+
{ name: "setMetadataBase", signature: "setMetadataBase(string)", selector: "0xd3811c0f", sources: ["floorAmm","floorAmmGovV2"] },
|
|
121
|
+
{ name: "setNativeCreateFee", signature: "setNativeCreateFee(uint256)", selector: "0xa4433667", sources: ["floorAmm","floorAmmGovV2"] },
|
|
122
|
+
{ name: "setOgUser", signature: "setOgUser(address,uint256,bytes)", selector: "0x02cb4469", sources: ["floorAmmGovV2"] },
|
|
118
123
|
{ name: "setPresetEnabled", signature: "setPresetEnabled(uint8,bool)", selector: "0x673fb9a9", sources: ["floorAmm"] },
|
|
119
|
-
{ name: "setPriceUpdater", signature: "setPriceUpdater(address)", selector: "0x97c4a5f3", sources: ["floorAmm"] },
|
|
120
|
-
{ name: "setQuoteCap", signature: "setQuoteCap(address,uint128)", selector: "0x42adf398", sources: ["floorAmm"] },
|
|
121
|
-
{ name: "setQuotePrice", signature: "setQuotePrice(address,uint256)", selector: "0x3857ed9e", sources: ["floorAmm"] },
|
|
122
|
-
{ name: "setReferralAuthority", signature: "setReferralAuthority(address)", selector: "0x46325d7a", sources: ["floorAmm"] },
|
|
123
|
-
{ name: "setTimelock", signature: "setTimelock(address)", selector: "0xbdacb303", sources: ["floorAmm"] },
|
|
124
|
-
{ name: "setTraderRef", signature: "setTraderRef(address,address[3],uint256,bytes,bytes)", selector: "0xd7426758", sources: ["floorAmm"] },
|
|
125
|
-
{ name: "setTreasury", signature: "setTreasury(address)", selector: "0xf0f44260", sources: ["floorAmm"] },
|
|
124
|
+
{ name: "setPriceUpdater", signature: "setPriceUpdater(address)", selector: "0x97c4a5f3", sources: ["floorAmm","floorAmmGovV2"] },
|
|
125
|
+
{ name: "setQuoteCap", signature: "setQuoteCap(address,uint128)", selector: "0x42adf398", sources: ["floorAmm","floorAmmGovV2"] },
|
|
126
|
+
{ name: "setQuotePrice", signature: "setQuotePrice(address,uint256)", selector: "0x3857ed9e", sources: ["floorAmm","floorAmmGovV2"] },
|
|
127
|
+
{ name: "setReferralAuthority", signature: "setReferralAuthority(address)", selector: "0x46325d7a", sources: ["floorAmm","floorAmmGovV2"] },
|
|
128
|
+
{ name: "setTimelock", signature: "setTimelock(address)", selector: "0xbdacb303", sources: ["floorAmm","floorAmmGovV2"] },
|
|
129
|
+
{ name: "setTraderRef", signature: "setTraderRef(address,address[3],uint256,bytes,bytes)", selector: "0xd7426758", sources: ["floorAmm","floorAmmGovV2"] },
|
|
130
|
+
{ name: "setTreasury", signature: "setTreasury(address)", selector: "0xf0f44260", sources: ["floorAmm","floorAmmGovV2"] },
|
|
126
131
|
{ name: "simBuy", signature: "simBuy(uint256,uint256,address)", selector: "0xf69acbed", sources: ["floorAmmV2"] },
|
|
127
132
|
{ name: "simSell", signature: "simSell(uint256,uint256,address)", selector: "0xd3536ecd", sources: ["floorAmmV2"] },
|
|
128
133
|
{ name: "symbol", signature: "symbol()", selector: "0x95d89b41", sources: ["floorToken","floorTokenIndexed"] },
|
|
@@ -132,19 +137,19 @@ export const EVM_FUNCTION_SELECTORS: readonly EvmFunctionSelectorRow[] = [
|
|
|
132
137
|
{ name: "teamShareOf", signature: "teamShareOf(uint256,address)", selector: "0xb2280af2", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
133
138
|
{ name: "teamSlotAdd", signature: "teamSlotAdd(uint256,bytes32,uint8,uint256,bool)", selector: "0xd5402e81", sources: ["floorAmm","floorAmmClaimsV2"] },
|
|
134
139
|
{ name: "teamSlotOf", signature: "teamSlotOf(uint256)", selector: "0x8744aded", sources: ["floorAmmViewsV2"] },
|
|
135
|
-
{ name: "timelock", signature: "timelock()", selector: "0xd33219b4", sources: ["floorAmm"] },
|
|
140
|
+
{ name: "timelock", signature: "timelock()", selector: "0xd33219b4", sources: ["floorAmm","floorAmmGovV2"] },
|
|
136
141
|
{ name: "TOKEN_SCALE", signature: "TOKEN_SCALE()", selector: "0xcae07d2a", sources: ["floorTokenIndexed"] },
|
|
137
142
|
{ name: "tokenImplV2", signature: "tokenImplV2()", selector: "0x01b9b386", sources: ["floorAmmCreateV2"] },
|
|
138
143
|
{ name: "TOTAL_SUPPLY", signature: "TOTAL_SUPPLY()", selector: "0x902d55a5", sources: ["floorTokenIndexed"] },
|
|
139
144
|
{ name: "totalSupply", signature: "totalSupply()", selector: "0x18160ddd", sources: ["floorToken","floorTokenIndexed"] },
|
|
140
145
|
{ name: "traderRef", signature: "traderRef(address)", selector: "0xcfc18291", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
141
146
|
{ name: "transfer", signature: "transfer(address,uint256)", selector: "0xa9059cbb", sources: ["floorToken","floorTokenIndexed"] },
|
|
142
|
-
{ name: "transferAuthority", signature: "transferAuthority(address)", selector: "0x3078db6c", sources: ["floorAmm"] },
|
|
147
|
+
{ name: "transferAuthority", signature: "transferAuthority(address)", selector: "0x3078db6c", sources: ["floorAmm","floorAmmGovV2"] },
|
|
143
148
|
{ name: "transferFrom", signature: "transferFrom(address,address,uint256)", selector: "0x23b872dd", sources: ["floorToken","floorTokenIndexed"] },
|
|
144
|
-
{ name: "treasury", signature: "treasury()", selector: "0x61d027b3", sources: ["floorAmm"] },
|
|
149
|
+
{ name: "treasury", signature: "treasury()", selector: "0x61d027b3", sources: ["floorAmm","floorAmmGovV2"] },
|
|
145
150
|
{ name: "unlockCreatorBuy", signature: "unlockCreatorBuy(uint256)", selector: "0xf03d6d5e", sources: ["floorAmm","floorAmmClaimsV2"] },
|
|
146
151
|
{ name: "updatePreset", signature: "updatePreset(uint8,bytes)", selector: "0x005d9e72", sources: ["floorAmm"] },
|
|
147
|
-
{ name: "updateQuote", signature: "updateQuote(address,bool,uint256,uint256)", selector: "0x21593d6e", sources: ["floorAmm"] },
|
|
152
|
+
{ name: "updateQuote", signature: "updateQuote(address,bool,uint256,uint256)", selector: "0x21593d6e", sources: ["floorAmm","floorAmmGovV2"] },
|
|
148
153
|
{ name: "UPGRADE_INTERFACE_VERSION", signature: "UPGRADE_INTERFACE_VERSION()", selector: "0xad3cb1cc", sources: ["floorAmmV2"] },
|
|
149
154
|
{ name: "upgradeToAndCall", signature: "upgradeToAndCall(address,bytes)", selector: "0x4f1ef286", sources: ["floorAmmV2"] },
|
|
150
155
|
{ name: "withdrawHolder", signature: "withdrawHolder(address,uint256)", selector: "0xfb90c8bf", sources: ["floorAmm","floorAmmCreateV2"] },
|
package/src/indexer/bodies.ts
CHANGED
|
@@ -135,16 +135,27 @@ const LISTED_FIELDS = {
|
|
|
135
135
|
volume24hGross: nullable(big),
|
|
136
136
|
holders: int,
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
holdersChange1h: nullable(int),
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
holdersChange24h: nullable(int),
|
|
141
|
+
|
|
142
|
+
volume1h: nullable(big),
|
|
143
|
+
|
|
144
|
+
volumePrev1h: nullable(big),
|
|
141
145
|
|
|
142
146
|
maxLossPpm: optional(nullable(int)),
|
|
143
147
|
|
|
144
148
|
backedPpm: nullable(int),
|
|
145
149
|
volume24hUsd: nullable(decimal),
|
|
150
|
+
|
|
151
|
+
volume1hUsd: nullable(decimal),
|
|
152
|
+
volumePrev1hUsd: nullable(decimal),
|
|
146
153
|
marketCapUsd: nullable(decimal),
|
|
147
154
|
|
|
155
|
+
athPrice: nullable(big),
|
|
156
|
+
|
|
157
|
+
athPriceUsd: nullable(decimal),
|
|
158
|
+
|
|
148
159
|
trendingScore: nullable(big),
|
|
149
160
|
|
|
150
161
|
change24hBps: optional(nullable(int)),
|
|
@@ -191,6 +202,12 @@ const TRADE_FIELDS = {
|
|
|
191
202
|
export const TRADE = object(TRADE_FIELDS);
|
|
192
203
|
export type Trade = Infer<typeof TRADE>;
|
|
193
204
|
|
|
205
|
+
export const TRADE_REFS = object({ tp: optional(str), t: optional(array(str)), cp: optional(str), c: optional(array(str)) });
|
|
206
|
+
export type TradeRefs = Infer<typeof TRADE_REFS>;
|
|
207
|
+
|
|
208
|
+
export const STREAM_TRADE = object({ ...TRADE_FIELDS, refs: optional(TRADE_REFS) });
|
|
209
|
+
export type StreamTrade = Infer<typeof STREAM_TRADE>;
|
|
210
|
+
|
|
194
211
|
export const PAGED_TRADE = object({ id: str, ...TRADE_FIELDS });
|
|
195
212
|
export type PagedTrade = Infer<typeof PAGED_TRADE>;
|
|
196
213
|
|
|
@@ -310,7 +327,7 @@ export type LaunchClaim = Infer<typeof LAUNCH_CLAIM>;
|
|
|
310
327
|
export const LAUNCH_CLAIMS = object({ indexed, claims: array(LAUNCH_CLAIM), next: optional(nullable(str)) });
|
|
311
328
|
export type LaunchClaims = Infer<typeof LAUNCH_CLAIMS>;
|
|
312
329
|
|
|
313
|
-
export const DEV_BUYS = object({ indexed, teamBuyUnlocked: bool, teamBuyUnlockedTs: nullable(int), devBuys: array(DEV_BUY), next: optional(nullable(str)) });
|
|
330
|
+
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) });
|
|
314
331
|
export type DevBuys = Infer<typeof DEV_BUYS>;
|
|
315
332
|
|
|
316
333
|
export const MEMBER_SOLD_ROW = object({ launch: str, member: str, place: int, amount: big, quoteOut: big, block: int, timestamp: int, tx: str, id: str });
|
|
@@ -414,6 +431,120 @@ export type DevTrades = Infer<typeof DEV_TRADES>;
|
|
|
414
431
|
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)) });
|
|
415
432
|
export type Burns = Infer<typeof BURNS>;
|
|
416
433
|
|
|
434
|
+
export const RT_POINTS_MAX = 720;
|
|
435
|
+
|
|
436
|
+
export const RAISE_STEPS = [60, 300, 900, 3_600, 14_400, 86_400] as const;
|
|
437
|
+
|
|
438
|
+
function checked<T>(d: Decoder<T>, ok: (v: T) => string | null): Decoder<T> {
|
|
439
|
+
return (v, p) => {
|
|
440
|
+
const x = d(v, p);
|
|
441
|
+
const why = ok(x);
|
|
442
|
+
if (why !== null) throw new ShapeError(p, why, v);
|
|
443
|
+
return x;
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
const ascending = (xs: readonly { time: number }[], strict: boolean): boolean => xs.every((x, i) => i === 0 || (strict ? x.time > xs[i - 1]!.time : x.time >= xs[i - 1]!.time));
|
|
447
|
+
|
|
448
|
+
export const RAISE_COUNTS = object({
|
|
449
|
+
buys: int,
|
|
450
|
+
sells: int,
|
|
451
|
+
|
|
452
|
+
last: nullable(int),
|
|
453
|
+
|
|
454
|
+
largest: nullable(object({ time: int, amount: big, id: str })),
|
|
455
|
+
|
|
456
|
+
raised: big,
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
export const RAISE_SERIES = checked(
|
|
460
|
+
object({
|
|
461
|
+
indexed,
|
|
462
|
+
launch: str,
|
|
463
|
+
from: int,
|
|
464
|
+
to: int,
|
|
465
|
+
step: int,
|
|
466
|
+
points: array(object({ time: int, liveTotal: big })),
|
|
467
|
+
pace: array(object({ time: int, bought: big, sold: big })),
|
|
468
|
+
counts: RAISE_COUNTS,
|
|
469
|
+
total: int,
|
|
470
|
+
first: nullable(str),
|
|
471
|
+
asOf: nullable(str),
|
|
472
|
+
}),
|
|
473
|
+
(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),
|
|
474
|
+
);
|
|
475
|
+
export type RaiseSeries = Infer<typeof RAISE_SERIES>;
|
|
476
|
+
|
|
477
|
+
export const FLOOR_STEP = object({ id: str, block: int, timestamp: int, floorX64: big, floorMoney: nullable(big) });
|
|
478
|
+
|
|
479
|
+
export const FLOOR_STEPS = checked(
|
|
480
|
+
object({
|
|
481
|
+
indexed,
|
|
482
|
+
launch: str,
|
|
483
|
+
from: int,
|
|
484
|
+
to: int,
|
|
485
|
+
points: int,
|
|
486
|
+
steps: array(FLOOR_STEP),
|
|
487
|
+
totals: object({ steps: int, first: nullable(str), last: nullable(str), firstFloorX64: nullable(big), lastFloorX64: nullable(big) }),
|
|
488
|
+
asOf: nullable(str),
|
|
489
|
+
}),
|
|
490
|
+
(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),
|
|
491
|
+
);
|
|
492
|
+
export type FloorSteps = Infer<typeof FLOOR_STEPS>;
|
|
493
|
+
|
|
494
|
+
export const roundTrip: Decoder<number> = (v, p) => {
|
|
495
|
+
if (typeof v !== "string") throw new ShapeError(p, "a round-trip number string", v);
|
|
496
|
+
const n = Number(v);
|
|
497
|
+
if (!Number.isFinite(n) || String(n) !== v) throw new ShapeError(p, "a round-trip number string", v);
|
|
498
|
+
return n;
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
export const POSITION_FOLD = object({
|
|
502
|
+
|
|
503
|
+
held: roundTrip,
|
|
504
|
+
|
|
505
|
+
cost: roundTrip,
|
|
506
|
+
|
|
507
|
+
realised: roundTrip,
|
|
508
|
+
|
|
509
|
+
costSold: roundTrip,
|
|
510
|
+
|
|
511
|
+
uncoveredSold: roundTrip,
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
export const POSITION_TOTALS_ROW = object({
|
|
515
|
+
wallet: str,
|
|
516
|
+
launch: str,
|
|
517
|
+
token: str,
|
|
518
|
+
quote: str,
|
|
519
|
+
fills: int,
|
|
520
|
+
buys: int,
|
|
521
|
+
sells: int,
|
|
522
|
+
bought: big,
|
|
523
|
+
sold: big,
|
|
524
|
+
spent: big,
|
|
525
|
+
received: big,
|
|
526
|
+
teamBuy: big,
|
|
527
|
+
firstTs: nullable(int),
|
|
528
|
+
lastTs: nullable(int),
|
|
529
|
+
asOf: nullable(str),
|
|
530
|
+
quoteDecimals: nullable(int),
|
|
531
|
+
fold: nullable(POSITION_FOLD),
|
|
532
|
+
foldReason: nullable(str),
|
|
533
|
+
});
|
|
534
|
+
export type PositionTotalsRow = Infer<typeof POSITION_TOTALS_ROW>;
|
|
535
|
+
|
|
536
|
+
export const POSITION_TOTALS = checked(
|
|
537
|
+
object({ indexed, wallet: str, positions: array(POSITION_TOTALS_ROW), next: nullable(str) }),
|
|
538
|
+
(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),
|
|
539
|
+
);
|
|
540
|
+
export type PositionTotals = Infer<typeof POSITION_TOTALS>;
|
|
541
|
+
|
|
542
|
+
export const LAUNCH_TRADED = checked(
|
|
543
|
+
object({ indexed, launch: str, traded: array(object({ wallet: str, traded: bool, firstTs: nullable(int) })), asOf: nullable(str) }),
|
|
544
|
+
(b) => (b.traded.some((r) => r.traded === (r.firstTs === null)) ? "firstTs exactly where traded" : null),
|
|
545
|
+
);
|
|
546
|
+
export type LaunchTraded = Infer<typeof LAUNCH_TRADED>;
|
|
547
|
+
|
|
417
548
|
const LOCK_HOLDER = object({ wallet: str, place: nullable(int) });
|
|
418
549
|
|
|
419
550
|
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) });
|
|
@@ -581,10 +712,17 @@ export const FIRSTS_MANY = object({ indexed, wallets: record(FIRSTS_ROW) });
|
|
|
581
712
|
|
|
582
713
|
const PER_QUOTE = array(object({ quote: str, amount: big }));
|
|
583
714
|
|
|
715
|
+
export const PEOPLE_ROLE = object({ kind: oneOf("trader", "creator"), tier: int, via: nullable(str) });
|
|
716
|
+
|
|
584
717
|
export const PEOPLE = object({
|
|
585
718
|
indexed,
|
|
586
719
|
wallet: str,
|
|
587
|
-
people: array(object({ wallet: str, chain: str, roles: array(
|
|
720
|
+
people: array(object({ wallet: str, chain: str, roles: array(PEOPLE_ROLE), earned: PER_QUOTE, teamMilestone: PER_QUOTE, unclaimed: PER_QUOTE })),
|
|
721
|
+
pooled: PER_QUOTE,
|
|
722
|
+
|
|
723
|
+
accountsAt: optional(nullable(int)),
|
|
724
|
+
|
|
725
|
+
og: optional(nullable(object({ from: int, until: int, revoked: bool }))),
|
|
588
726
|
|
|
589
727
|
next: optional(nullable(str)),
|
|
590
728
|
});
|
package/src/indexer/client.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { decode } from "./decode.ts";
|
|
|
4
4
|
import { INDEXER_CONTRACT, clampLimit, pageAsked, routeLimit } from "./contract.ts";
|
|
5
5
|
import type { RouteBody, RouteName } from "./contract.ts";
|
|
6
6
|
import { indexerPath, query } from "./paths.ts";
|
|
7
|
-
import type { CandlesManyQuery, CandlesQuery, LaunchListsQuery, LaunchSearchQuery, LaunchesQuery, Page, StreamQuery, TradesQuery, WalletPage, WalletTradesQuery } from "./paths.ts";
|
|
7
|
+
import type { CandlesManyQuery, CandlesQuery, FloorStepsQuery, PositionTotalsQuery, RaiseSeriesQuery, LaunchListsQuery, LaunchSearchQuery, LaunchesQuery, Page, PeopleQuery, StreamQuery, TradesQuery, WalletPage, WalletTradesQuery } from "./paths.ts";
|
|
8
8
|
import { IndexerError } from "./read.ts";
|
|
9
9
|
import type { Get } from "./read.ts";
|
|
10
10
|
import type { TraderWindow } from "./bodies.ts";
|
|
@@ -35,10 +35,13 @@ export interface RouteArgs {
|
|
|
35
35
|
traders: L & { window?: TraderWindow; limit?: number };
|
|
36
36
|
quoteChain: L;
|
|
37
37
|
devTrades: L & { limit?: number };
|
|
38
|
-
burns: L & Page;
|
|
38
|
+
burns: L & Page & { wallet?: string };
|
|
39
39
|
launchLocks: L;
|
|
40
40
|
marks: L & Page;
|
|
41
41
|
price: L;
|
|
42
|
+
raiseSeries: L & RaiseSeriesQuery;
|
|
43
|
+
floorSteps: L & FloorStepsQuery;
|
|
44
|
+
launchTraded: L & { wallets: readonly string[] };
|
|
42
45
|
highs: L & { atLeast?: bigint | string; limit?: number };
|
|
43
46
|
candles: CandlesQuery;
|
|
44
47
|
candlesMany: CandlesManyQuery;
|
|
@@ -47,13 +50,14 @@ export interface RouteArgs {
|
|
|
47
50
|
tonActivity: W & Page;
|
|
48
51
|
tonOutcome: W & { queryId: bigint | string };
|
|
49
52
|
positions: W & WalletPage;
|
|
53
|
+
positionTotals: W & PositionTotalsQuery;
|
|
50
54
|
inbox: W & { limit?: number; before?: string };
|
|
51
55
|
walletLocks: W & WalletPage;
|
|
52
56
|
claimHistory: W & WalletPage;
|
|
53
57
|
firsts: W;
|
|
54
58
|
firstsMany: { wallets: readonly string[] };
|
|
55
59
|
claimView: W & WalletPage;
|
|
56
|
-
people: W &
|
|
60
|
+
people: W & PeopleQuery;
|
|
57
61
|
roles: W & WalletPage;
|
|
58
62
|
handlePlaces: { handle: string } & WalletPage;
|
|
59
63
|
traderBoard: { window?: TraderWindow; limit?: number } | void;
|
|
@@ -102,6 +106,9 @@ export const routePath: { [N in RouteName]: (a: RouteArgs[N]) => string } = {
|
|
|
102
106
|
launchLocks: (a) => indexerPath.launchLocks(a.launch),
|
|
103
107
|
marks: ({ launch, ...q }) => indexerPath.marks(launch, q),
|
|
104
108
|
price: (a) => indexerPath.price(a.launch),
|
|
109
|
+
raiseSeries: ({ launch, ...q }) => indexerPath.raiseSeries(launch, q),
|
|
110
|
+
floorSteps: ({ launch, ...q }) => indexerPath.floorSteps(launch, q),
|
|
111
|
+
launchTraded: (a) => indexerPath.launchTraded(a.launch, a.wallets),
|
|
105
112
|
highs: ({ launch, ...q }) => indexerPath.highs(launch, q),
|
|
106
113
|
candles: (a) => indexerPath.candles(a),
|
|
107
114
|
candlesMany: (a) => indexerPath.candlesMany(a),
|
|
@@ -110,6 +117,7 @@ export const routePath: { [N in RouteName]: (a: RouteArgs[N]) => string } = {
|
|
|
110
117
|
tonActivity: ({ wallet, ...q }) => indexerPath.tonActivity(wallet, q),
|
|
111
118
|
tonOutcome: (a) => indexerPath.tonOutcome(a.wallet, a.queryId),
|
|
112
119
|
positions: ({ wallet, ...q }) => indexerPath.positions(wallet, q),
|
|
120
|
+
positionTotals: ({ wallet, ...q }) => indexerPath.positionTotals(wallet, q),
|
|
113
121
|
inbox: ({ wallet, ...q }) => indexerPath.inbox(wallet, q),
|
|
114
122
|
walletLocks: ({ wallet, ...q }) => indexerPath.walletLocks(wallet, q),
|
|
115
123
|
claimHistory: ({ wallet, ...q }) => indexerPath.claimHistory(wallet, q),
|
|
@@ -136,7 +144,7 @@ export const routePath: { [N in RouteName]: (a: RouteArgs[N]) => string } = {
|
|
|
136
144
|
health: () => "/health",
|
|
137
145
|
};
|
|
138
146
|
|
|
139
|
-
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"] as const;
|
|
147
|
+
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"] as const;
|
|
140
148
|
export type DrainName = (typeof DRAIN_NAMES)[number];
|
|
141
149
|
|
|
142
150
|
export type ReadName = Exclude<RouteName, "stream">;
|
|
@@ -178,6 +186,11 @@ export function createIndexerClient(opts: IndexerClientOptions): IndexerClient {
|
|
|
178
186
|
const lim = routeLimit(name)!;
|
|
179
187
|
let args: Record<string, unknown> = { ...a };
|
|
180
188
|
|
|
189
|
+
if (args.person !== undefined) {
|
|
190
|
+
yield await read(name, args);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
181
194
|
if (page.kind === "cursor" && page.optIn !== undefined && args.before === undefined) args = { ...args, before: "" };
|
|
182
195
|
if (page.kind === "keyset" && page.optIn === true && args.limit === undefined && args.cursor === undefined) args = { ...args, limit: lim.default };
|
|
183
196
|
for (let i = 0; i < max; i++) {
|