@floorlaunchpad/sdk 0.4.1 → 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 +219 -18
- package/README.md +0 -2
- package/dist/abi/evm-event-names.js +7 -0
- package/dist/abi/evm.gen.js +6 -0
- package/dist/abi/functions.gen.js +49 -1
- package/dist/abi/solana.gen.js +5 -0
- package/dist/config/generated.js +77 -0
- package/dist/errors.js +2 -2
- package/dist/events/types.gen.js +1 -1
- package/dist/evm/chains.js +32 -24
- package/dist/evm/floor/calls.js +5 -0
- package/dist/evm/router.js +1 -25
- package/dist/evm/squid.js +3 -3
- package/dist/generated/interface.gen.js +48 -43
- package/dist/index.js +1 -0
- package/dist/indexer/bodies.js +137 -2
- 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/book.js +40 -7
- package/dist/math/v2/create.js +1 -1
- 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/relay.js +201 -1
- package/dist/math/v2/rows.js +17 -0
- package/dist/math/v2/split.js +60 -15
- package/dist/math/v2/team.js +14 -1
- package/dist/math/v2/trade.js +16 -8
- 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/addresses.js +36 -0
- package/dist/ton/book-check.js +23 -0
- package/dist/ton/book.js +119 -0
- package/dist/ton/cell.js +542 -0
- package/dist/ton/consts.generated.js +17 -0
- package/dist/ton/content.js +83 -0
- package/dist/ton/gas.js +198 -0
- package/dist/ton/governance.js +401 -0
- package/dist/ton/index.js +18 -0
- package/dist/ton/messages.js +340 -0
- package/dist/ton/ops.js +37 -0
- package/dist/ton/price.js +51 -0
- package/dist/ton/quote-entry.js +116 -0
- package/dist/ton/quote.js +25 -0
- package/dist/ton/reader.js +378 -0
- package/dist/ton/types.js +43 -0
- package/dist/ton/wallet.js +26 -0
- package/dist/v2/events.js +2 -0
- package/dist/v2/evm.js +8 -1
- package/dist/v2/layouts.js +7 -1
- package/dist/v2/router.js +2 -2
- package/dist/v2/solana.js +1 -1
- package/dist/v2/solanaSettle.js +2 -0
- package/dist/v2/tx/evm.js +15 -1
- package/docs/aggregator.md +0 -22
- package/docs/bot.md +0 -8
- package/docs/cursor-pages.md +9 -5
- package/docs/frontend.md +0 -2
- package/docs/ton.md +107 -0
- package/docs/wallet.md +0 -2
- package/examples/floor-line.html +1 -1
- package/package.json +6 -1
- package/src/abi/evm-event-names.ts +7 -0
- package/src/abi/evm.gen.ts +6 -0
- package/src/abi/functions.gen.ts +49 -1
- package/src/abi/solana.gen.ts +5 -0
- package/src/config/generated.ts +77 -0
- package/src/errors.ts +2 -2
- package/src/events/types.gen.ts +57 -1
- package/src/evm/chains.ts +34 -28
- package/src/evm/floor/calls.ts +5 -0
- package/src/evm/router.ts +1 -26
- package/src/evm/squid.ts +3 -3
- package/src/generated/interface.gen.ts +48 -43
- package/src/index.ts +1 -0
- package/src/indexer/bodies.ts +144 -2
- 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/book.ts +42 -7
- package/src/math/v2/create.ts +1 -1
- 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/relay.ts +208 -1
- package/src/math/v2/rows.ts +17 -0
- package/src/math/v2/split.ts +70 -16
- package/src/math/v2/team.ts +14 -1
- package/src/math/v2/trade.ts +16 -8
- 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/addresses.ts +38 -0
- package/src/ton/book-check.ts +24 -0
- package/src/ton/book.ts +136 -0
- package/src/ton/cell.ts +547 -0
- package/src/ton/consts.generated.ts +17 -0
- package/src/ton/content.ts +97 -0
- package/src/ton/gas.ts +209 -0
- package/src/ton/governance.ts +452 -0
- package/src/ton/index.ts +18 -0
- package/src/ton/messages.ts +343 -0
- package/src/ton/ops.ts +37 -0
- package/src/ton/price.ts +54 -0
- package/src/ton/quote-entry.ts +138 -0
- package/src/ton/quote.ts +67 -0
- package/src/ton/reader.ts +420 -0
- package/src/ton/types.ts +201 -0
- package/src/ton/wallet.ts +30 -0
- package/src/v2/events.ts +3 -1
- package/src/v2/evm.ts +10 -1
- package/src/v2/layouts.ts +7 -1
- package/src/v2/router.ts +2 -2
- package/src/v2/solana.ts +1 -1
- package/src/v2/solanaSettle.ts +2 -0
- package/src/v2/tx/evm.ts +15 -1
- package/src/v2/types.ts +14 -1
package/dist/evm/chains.js
CHANGED
|
@@ -60,28 +60,9 @@ export const FLOOR_ZAP_ADDRESSES
|
|
|
60
60
|
elysium: { "uniswap-ur": strict("0x56F22be922Ffc9e955169E0673D3Ae42B1151995") },
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
export const FLOOR_ROUTER_DEPLOYER = strict("0x3e70158e54E91d2984c0F3B66ce2cE730d1E0e11");
|
|
64
|
-
|
|
65
|
-
const ROUTER_PROXY_INITCODE = "0x67363d3d37363d34f03d5260086018f3";
|
|
66
|
-
|
|
67
|
-
function slotWord(slot ) {
|
|
68
|
-
const b = new TextEncoder().encode(slot);
|
|
69
|
-
if (b.length === 0 || b.length > 32) throw new RangeError(`a router slot is 1..32 bytes: ${JSON.stringify(slot)}`);
|
|
70
|
-
const w = new Uint8Array(32);
|
|
71
|
-
w.set(b);
|
|
72
|
-
return w;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function floorRouterAddress(slot , deployer = FLOOR_ROUTER_DEPLOYER) {
|
|
76
|
-
const s = keccak256(encodeAbi(["string", "bytes32"], ["floor-router.v1.FloorRouter", bytesToHex(slotWord(slot))]));
|
|
77
|
-
const proxy = create2Address({ deployer, salt: s, initCode: ROUTER_PROXY_INITCODE });
|
|
78
|
-
|
|
79
|
-
return checksumAddress(bytesToHex(keccak256(hexToBytes("0xd694" + proxy.slice(2) + "01")).slice(12)));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
63
|
function withBookedZaps(key , rows ) {
|
|
83
64
|
const book = FLOOR_ZAP_ADDRESSES[key];
|
|
84
|
-
return rows.map((row) => ({ ...row, zap: book[row.slot] ?? null
|
|
65
|
+
return rows.map((row) => ({ ...row, zap: book[row.slot] ?? null }));
|
|
85
66
|
}
|
|
86
67
|
|
|
87
68
|
const UNISWAP_UR = "uniswap-ur";
|
|
@@ -157,10 +138,6 @@ export const EVM_CHAINS = Object.fromEntries(
|
|
|
157
138
|
CHAIN_REGISTRY.flatMap((c) => (c.family === "evm" ? [[c.slug, { key: c.slug, chainId: c.chainId, name: c.label, nativeSymbol: c.native.symbol, ...ROUTES[c.slug], ...((c.v2DayOne ) === false ? { v2DayOne: false } : {}) }]] : [])),
|
|
158
139
|
) ;
|
|
159
140
|
|
|
160
|
-
export const FLOOR_ROUTER_ADDRESSES = Object.freeze(
|
|
161
|
-
Object.fromEntries(Object.values(EVM_CHAINS).map((c) => [c.key, Object.freeze(Object.fromEntries(c.zapRouters.map((r) => [r.slot, r.floorRouter])))])),
|
|
162
|
-
) ;
|
|
163
|
-
|
|
164
141
|
export const v2DayOneChains = () => Object.values(EVM_CHAINS).filter((c) => c.v2DayOne !== false);
|
|
165
142
|
export const chainById = (chainId ) => Object.values(EVM_CHAINS).find((c) => c.chainId === chainId) ?? null;
|
|
166
143
|
|
|
@@ -193,6 +170,37 @@ export function floorAmmAddressV2(p
|
|
|
193
170
|
|
|
194
171
|
export const tokenImplAddressV2 = (p ) => at(p.salt, p.code);
|
|
195
172
|
|
|
173
|
+
export const LAUNCH_TOKEN_IMPLS = {
|
|
174
|
+
live: "0xF1009235c447fcA25e8792784772EDA720e2b822",
|
|
175
|
+
holderMoved: "0x91E2311c9c77a56945c082dd8d9ff7bF0eC2B79B",
|
|
176
|
+
} ;
|
|
177
|
+
|
|
178
|
+
export const HOLDER_MOVED_FIRST_LAUNCH_ID = {
|
|
179
|
+
ethereum: 1, base: 1, bsc: 1, arbitrum: 1, arc: 1, robinhood: 1, hyperevm: 1, elysium: 1,
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export function tokenImplForLaunch(p ) {
|
|
183
|
+
const first = p.firstId !== undefined ? p.firstId : HOLDER_MOVED_FIRST_LAUNCH_ID[p.chain];
|
|
184
|
+
return first !== null && BigInt(p.id) >= BigInt(first) ? LAUNCH_TOKEN_IMPLS.holderMoved : LAUNCH_TOKEN_IMPLS.live;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function tokenImplOfCode(code ) {
|
|
188
|
+
const c = code.toLowerCase().replace(/^0x/, "");
|
|
189
|
+
const m = /^363d3d373d3d3d363d73([0-9a-f]{40})5af43d82803e903d91602b57fd5bf3$/.exec(c);
|
|
190
|
+
return m ? "0x" + m[1] : null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export const isLaunchTokenImpl = (impl ) =>
|
|
194
|
+
impl !== null && Object.values(LAUNCH_TOKEN_IMPLS).some((a) => a.toLowerCase() === impl.toLowerCase());
|
|
195
|
+
|
|
196
|
+
export function launchTokenCodeKind(code ) {
|
|
197
|
+
const i = tokenImplOfCode(code);
|
|
198
|
+
if (i === null) return null;
|
|
199
|
+
if (i === LAUNCH_TOKEN_IMPLS.live.toLowerCase()) return "live";
|
|
200
|
+
if (i === LAUNCH_TOKEN_IMPLS.holderMoved.toLowerCase()) return "holderMoved";
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
|
|
196
204
|
export function zapDeployerAddressV2(p ) {
|
|
197
205
|
return at(FLOOR_SALTS.zapDeployer, cat(p.code, bytesToHex(encodeAbi(["address", "address"], [p.floorAmm, p.authority]))));
|
|
198
206
|
}
|
package/dist/evm/floor/calls.js
CHANGED
|
@@ -183,6 +183,11 @@ export function traderRefAuthDigest(p
|
|
|
183
183
|
return { digest: bytesToHex(d), message: eip191(d) };
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
export function ogUserAuthDigest(p ) {
|
|
187
|
+
const d = keccak256(encodeAbi(["string", "uint256", "address", "address", "uint256"], ["floor.amm.ogUser.auth.v1", p.chainId, p.floorAmm, p.referrer, p.deadline]));
|
|
188
|
+
return { digest: bytesToHex(d), message: eip191(d) };
|
|
189
|
+
}
|
|
190
|
+
|
|
186
191
|
export function bindHandleAuthDigest(p ) {
|
|
187
192
|
const d = keccak256(
|
|
188
193
|
encodeAbi(
|
package/dist/evm/router.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { encodeFunctionData } from "./items.js";
|
|
4
4
|
import { deadlineArg } from "./floor/calls.js";
|
|
5
5
|
import { EVM_NATIVE, NoRouteError, coinKey } from "../route/graph.js";
|
|
6
|
-
import {
|
|
6
|
+
import { chainById } from "./chains.js";
|
|
7
7
|
|
|
8
8
|
const BUY = [
|
|
9
9
|
{ name: "path", type: "uint256[]" },
|
|
@@ -182,27 +182,3 @@ export function evmRouteCall(q , p
|
|
|
182
182
|
const b = { path: ids(buys), tokenIn: s.tokenOut, amountIn: 0n, swapData: "0x", minQuoteIn: 0n, minTokensOut: mins(buys), to: p.to, deadline: p.deadline };
|
|
183
183
|
return call(encodeRouterSwap(s, b, p.chainId), 0n);
|
|
184
184
|
}
|
|
185
|
-
|
|
186
|
-
export async function floorRouterLive(rpc , at ) {
|
|
187
|
-
const address = floorRouterAt(at);
|
|
188
|
-
const code = await rpc.getCode(address);
|
|
189
|
-
if (code === undefined) return false;
|
|
190
|
-
if (typeof code !== "string" || !/^0x([0-9a-fA-F]{2})*$/.test(code)) throw new TypeError(`getCode(${address}) returned ${String(code)}, not hex bytes`);
|
|
191
|
-
return code.length > 2;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export async function assertFloorRouterLive(rpc , at ) {
|
|
195
|
-
const address = floorRouterAt(at);
|
|
196
|
-
if (!(await floorRouterLive(rpc, address))) throw new RangeError(`FloorRouter ${address} has no code on this chain yet: it is derived ahead of its deploy; do not send to it (a native coin sent to it is lost)`);
|
|
197
|
-
return address;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function floorRouterAt(at ) {
|
|
201
|
-
if (typeof at === "string") {
|
|
202
|
-
if (!/^0x[0-9a-fA-F]{40}$/.test(at)) throw new RangeError(`a FloorRouter is a 20-byte address: ${at}`);
|
|
203
|
-
return at;
|
|
204
|
-
}
|
|
205
|
-
const row = EVM_CHAINS[at.chain]?.zapRouters.find((r) => r.slot === at.slot);
|
|
206
|
-
if (row === undefined) throw new RangeError(`no FloorRouter slot ${at.slot} on ${at.chain}`);
|
|
207
|
-
return row.floorRouter;
|
|
208
|
-
}
|
package/dist/evm/squid.js
CHANGED
|
@@ -19,7 +19,7 @@ export class SquidHookError extends Error {
|
|
|
19
19
|
|
|
20
20
|
export const SQUID_TOKEN_SCALE = 10n ** 12n;
|
|
21
21
|
|
|
22
|
-
export const SQUID_GAS = { transfer:
|
|
22
|
+
export const SQUID_GAS = { transfer: 100_000, buy: 1_100_000, sell: 850_000, zapBuy: 1_300_000, passOn: 30_000 } ;
|
|
23
23
|
|
|
24
24
|
const ZERO = "0x" + "0".repeat(40);
|
|
25
25
|
const lc = (a , what ) => {
|
|
@@ -65,12 +65,12 @@ export function buyHookErc20(p
|
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export function buyHookNative(p
|
|
68
|
+
export function buyHookNative(p ) {
|
|
69
69
|
checkCommon(p);
|
|
70
70
|
const user = checkUser(p);
|
|
71
71
|
if (p.minQuoteIn <= 0n || p.minTokensOut <= 0n) throw new SquidHookError("NO_MINIMUM", "minQuoteIn and minTokensOut must be > 0");
|
|
72
72
|
const zap = lc(p.zap, "zap");
|
|
73
|
-
const quote = lc(p.quote
|
|
73
|
+
const quote = lc(p.quote, "quote");
|
|
74
74
|
const calls = [
|
|
75
75
|
call(SQUID_CALL.FullNativeBalance, zap, 0n, bytesToHex(encodeCall("buyWithEth(uint256,bytes,uint256,uint256,address,uint256)", [p.launchId, p.swapData, p.minQuoteIn, p.minTokensOut, user, p.deadline])), "0x", SQUID_GAS.zapBuy),
|
|
76
76
|
call(SQUID_CALL.FullNativeBalance, user, 0n, "0x", "0x", SQUID_GAS.passOn),
|
|
@@ -11,17 +11,17 @@ export const CLAIM_KNOWN_MASKS = {"solana":{"claim":143,"claimWideV1":399,"v2":9
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
export const EVM_FUNCTION_SELECTORS = [
|
|
14
|
-
{ name: "acceptAuthority", signature: "acceptAuthority()", selector: "0x1580798f", sources: ["floorAmm"] },
|
|
15
|
-
{ name: "accounted", signature: "accounted(address)", selector: "0xee1a56ce", sources: ["floorAmm"] },
|
|
14
|
+
{ name: "acceptAuthority", signature: "acceptAuthority()", selector: "0x1580798f", sources: ["floorAmm","floorAmmGovV2"] },
|
|
15
|
+
{ name: "accounted", signature: "accounted(address)", selector: "0xee1a56ce", sources: ["floorAmm","floorAmmGovV2"] },
|
|
16
16
|
{ name: "addPreset", signature: "addPreset(uint8,bytes)", selector: "0xb88257b1", sources: ["floorAmm"] },
|
|
17
|
-
{ name: "addQuote", signature: "addQuote(address,uint256,uint256)", selector: "0x488c664b", sources: ["floorAmm"] },
|
|
17
|
+
{ name: "addQuote", signature: "addQuote(address,uint256,uint256)", selector: "0x488c664b", sources: ["floorAmm","floorAmmGovV2"] },
|
|
18
18
|
{ name: "addReward", signature: "addReward(uint256)", selector: "0x74de4ec4", sources: ["floorTokenIndexed"] },
|
|
19
19
|
{ name: "allowance", signature: "allowance(address,address)", selector: "0xdd62ed3e", sources: ["floorToken","floorTokenIndexed"] },
|
|
20
20
|
{ name: "approve", signature: "approve(address,uint256)", selector: "0x095ea7b3", sources: ["floorToken","floorTokenIndexed"] },
|
|
21
|
-
{ name: "authority", signature: "authority()", selector: "0xbf7e214f", sources: ["floorAmm"] },
|
|
21
|
+
{ name: "authority", signature: "authority()", selector: "0xbf7e214f", sources: ["floorAmm","floorAmmGovV2"] },
|
|
22
22
|
{ name: "balanceOf", signature: "balanceOf(address)", selector: "0x70a08231", sources: ["floorToken","floorTokenIndexed"] },
|
|
23
23
|
{ name: "bidMoney", signature: "bidMoney(uint256)", selector: "0x8e403c51", sources: ["floorAmmViewsV2"] },
|
|
24
|
-
{ name: "bindHandle", signature: "bindHandle(bytes32,address,address[],uint256,bytes,bytes)", selector: "0xcea3463e", sources: ["floorAmm"] },
|
|
24
|
+
{ name: "bindHandle", signature: "bindHandle(bytes32,address,address[],uint256,bytes,bytes)", selector: "0xcea3463e", sources: ["floorAmm","floorAmmGovV2"] },
|
|
25
25
|
{ name: "bookEngine", signature: "bookEngine()", selector: "0x72148c77", sources: ["floorAmmV2"] },
|
|
26
26
|
{ name: "bookState", signature: "bookState()", selector: "0x2c14e3f2", sources: ["floorTokenIndexed"] },
|
|
27
27
|
{ name: "bookTotals", signature: "bookTotals()", selector: "0xbffc2073", sources: ["floorTokenIndexed"] },
|
|
@@ -35,11 +35,11 @@ export const EVM_FUNCTION_SELECTORS = [
|
|
|
35
35
|
{ name: "checkPreset", signature: "checkPreset(bytes)", selector: "0x6337513e", sources: ["floorAmm"] },
|
|
36
36
|
{ name: "circulatingOf", signature: "circulatingOf(uint256)", selector: "0x72812fcf", sources: ["floorAmmViewsV2"] },
|
|
37
37
|
{ name: "claim", signature: "claim(address,uint256,uint256[],address[])", selector: "0xa461a90d", sources: ["floorAmm","floorAmmClaimsV2"] },
|
|
38
|
-
{ name: "claimPayoutTo", signature: "claimPayoutTo(address,address)", selector: "0xc14ab75d", sources: ["floorAmm"] },
|
|
39
|
-
{ name: "clearTraderRef", signature: "clearTraderRef(address)", selector: "0x53550430", sources: ["floorAmm"] },
|
|
38
|
+
{ name: "claimPayoutTo", signature: "claimPayoutTo(address,address)", selector: "0xc14ab75d", sources: ["floorAmm","floorAmmGovV2"] },
|
|
39
|
+
{ name: "clearTraderRef", signature: "clearTraderRef(address)", selector: "0x53550430", sources: ["floorAmm","floorAmmGovV2"] },
|
|
40
40
|
{ name: "createBookEngine", signature: "createBookEngine()", selector: "0x0fdf26a7", sources: ["floorAmmCreateV2"] },
|
|
41
41
|
{ name: "createLaunch", signature: "createLaunch((uint8,address,string,string,uint256,uint256,bool,bytes32,uint256,uint16))", selector: "0x25b62f18", sources: ["floorAmm","floorAmmCreateV2"] },
|
|
42
|
-
{ name: "createPaused", signature: "createPaused()", selector: "0xbac7b497", sources: ["floorAmm"] },
|
|
42
|
+
{ name: "createPaused", signature: "createPaused()", selector: "0xbac7b497", sources: ["floorAmm","floorAmmGovV2"] },
|
|
43
43
|
{ name: "creditBacking", signature: "creditBacking(uint256,uint256)", selector: "0x1f341504", sources: ["floorAmmV2"] },
|
|
44
44
|
{ name: "DEAD", signature: "DEAD()", selector: "0x03fd2a45", sources: ["floorTokenIndexed"] },
|
|
45
45
|
{ name: "decimals", signature: "decimals()", selector: "0x313ce567", sources: ["floorToken","floorTokenIndexed"] },
|
|
@@ -48,13 +48,13 @@ export const EVM_FUNCTION_SELECTORS = [
|
|
|
48
48
|
{ name: "DOMAIN_SEPARATOR", signature: "DOMAIN_SEPARATOR()", selector: "0x3644e515", sources: ["floorToken","floorTokenIndexed"] },
|
|
49
49
|
{ name: "eip712Domain", signature: "eip712Domain()", selector: "0x84b0196e", sources: ["floorTokenIndexed"] },
|
|
50
50
|
{ name: "floorAmm", signature: "floorAmm()", selector: "0x78164d52", sources: ["floorZap"] },
|
|
51
|
-
{ name: "floorTokenAccrued", signature: "floorTokenAccrued(address)", selector: "0xf3a261f9", sources: ["floorAmm"] },
|
|
52
|
-
{ name: "handleOwed", signature: "handleOwed(bytes32,address)", selector: "0xaad2ed5c", sources: ["floorAmm"] },
|
|
53
|
-
{ name: "handleWallet", signature: "handleWallet(bytes32)", selector: "0xc6da686d", sources: ["floorAmm"] },
|
|
51
|
+
{ name: "floorTokenAccrued", signature: "floorTokenAccrued(address)", selector: "0xf3a261f9", sources: ["floorAmm","floorAmmGovV2"] },
|
|
52
|
+
{ name: "handleOwed", signature: "handleOwed(bytes32,address)", selector: "0xaad2ed5c", sources: ["floorAmm","floorAmmGovV2"] },
|
|
53
|
+
{ name: "handleWallet", signature: "handleWallet(bytes32)", selector: "0xc6da686d", sources: ["floorAmm","floorAmmGovV2"] },
|
|
54
54
|
{ name: "holderBook", signature: "holderBook(uint256)", selector: "0xf5d23b14", sources: ["floorAmmViewsV2"] },
|
|
55
|
-
{ name: "holderBucket", signature: "holderBucket(address)", selector: "0x088806d0", sources: ["floorAmm"] },
|
|
56
|
-
{ name: "holderDest", signature: "holderDest()", selector: "0x84a6263a", sources: ["floorAmm"] },
|
|
57
|
-
{ name: "initialize", signature: "initialize(address,address,address,address)", selector: "0xf8c8765e", sources: ["floorAmm"] },
|
|
55
|
+
{ name: "holderBucket", signature: "holderBucket(address)", selector: "0x088806d0", sources: ["floorAmm","floorAmmGovV2"] },
|
|
56
|
+
{ name: "holderDest", signature: "holderDest()", selector: "0x84a6263a", sources: ["floorAmm","floorAmmGovV2"] },
|
|
57
|
+
{ name: "initialize", signature: "initialize(address,address,address,address)", selector: "0xf8c8765e", sources: ["floorAmm","floorAmmGovV2"] },
|
|
58
58
|
{ name: "initialize", signature: "initialize(string,string,uint256)", selector: "0xb119490e", sources: ["floorTokenIndexed"] },
|
|
59
59
|
{ name: "launchBook", signature: "launchBook(uint256)", selector: "0x926310f1", sources: ["floorAmmViewsV2"] },
|
|
60
60
|
{ name: "launchCount", signature: "launchCount()", selector: "0x27cca59f", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
@@ -66,56 +66,61 @@ export const EVM_FUNCTION_SELECTORS = [
|
|
|
66
66
|
{ name: "launchQuote", signature: "launchQuote(uint256)", selector: "0x98032919", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
67
67
|
{ name: "launchState", signature: "launchState(uint256)", selector: "0xac3307e8", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
68
68
|
{ name: "launchToken", signature: "launchToken(uint256)", selector: "0x6a19197b", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
69
|
-
{ name: "metadataBase", signature: "metadataBase()", selector: "0x65b973c3", sources: ["floorAmm"] },
|
|
69
|
+
{ name: "metadataBase", signature: "metadataBase()", selector: "0x65b973c3", sources: ["floorAmm","floorAmmGovV2"] },
|
|
70
70
|
{ name: "metadataURI", signature: "metadataURI()", selector: "0x03ee438c", sources: ["floorToken","floorTokenIndexed"] },
|
|
71
|
-
{ name: "moveHandleOwed", signature: "moveHandleOwed(bytes32,address[])", selector: "0xc43594a1", sources: ["floorAmm"] },
|
|
71
|
+
{ name: "moveHandleOwed", signature: "moveHandleOwed(bytes32,address[])", selector: "0xc43594a1", sources: ["floorAmm","floorAmmGovV2"] },
|
|
72
72
|
{ name: "name", signature: "name()", selector: "0x06fdde03", sources: ["floorToken","floorTokenIndexed"] },
|
|
73
|
-
{ name: "NATIVE", signature: "NATIVE()", selector: "0xa0cf0aea", sources: ["floorAmm"] },
|
|
74
|
-
{ name: "nativeCreateFee", signature: "nativeCreateFee()", selector: "0x10b51e45", sources: ["floorAmm"] },
|
|
73
|
+
{ name: "NATIVE", signature: "NATIVE()", selector: "0xa0cf0aea", sources: ["floorAmm","floorAmmGovV2"] },
|
|
74
|
+
{ name: "nativeCreateFee", signature: "nativeCreateFee()", selector: "0x10b51e45", sources: ["floorAmm","floorAmmGovV2"] },
|
|
75
75
|
{ name: "nextModule", signature: "nextModule()", selector: "0xf85abfc7", sources: ["floorAmmV2","floorAmmViewsV2","floorAmmCreateV2","floorAmmClaimsV2"] },
|
|
76
76
|
{ name: "nextPresetId", signature: "nextPresetId()", selector: "0xc8a768e6", sources: ["floorAmm"] },
|
|
77
77
|
{ name: "nonces", signature: "nonces(address)", selector: "0x7ecebe00", sources: ["floorToken","floorTokenIndexed"] },
|
|
78
78
|
{ name: "noteBurn", signature: "noteBurn(uint256)", selector: "0x6db7cd01", sources: ["floorAmmCreateV2"] },
|
|
79
79
|
{ name: "noteDead", signature: "noteDead(uint256)", selector: "0xbdf3b0de", sources: ["floorAmmCreateV2"] },
|
|
80
|
+
{ name: "noteMove", signature: "noteMove(address,address,uint256,uint256,uint256)", selector: "0xe6b761ea", sources: ["floorAmmV2"] },
|
|
81
|
+
{ name: "ogCount", signature: "ogCount()", selector: "0x9457990a", sources: ["floorAmmGovV2"] },
|
|
82
|
+
{ name: "ogUserOf", signature: "ogUserOf(address)", selector: "0x6df29e2f", sources: ["floorAmmGovV2"] },
|
|
80
83
|
{ name: "optedIn", signature: "optedIn(address)", selector: "0x4824b8fd", sources: ["floorTokenIndexed"] },
|
|
81
84
|
{ name: "optIn", signature: "optIn()", selector: "0x5b48684e", sources: ["floorTokenIndexed"] },
|
|
82
|
-
{ name: "owedOf", signature: "owedOf(address,address)", selector: "0xfacba08d", sources: ["floorAmm"] },
|
|
83
|
-
{ name: "owedOfMany", signature: "owedOfMany(address,address[])", selector: "0xa1efa4ba", sources: ["floorAmm"] },
|
|
85
|
+
{ name: "owedOf", signature: "owedOf(address,address)", selector: "0xfacba08d", sources: ["floorAmm","floorAmmGovV2"] },
|
|
86
|
+
{ name: "owedOfMany", signature: "owedOfMany(address,address[])", selector: "0xa1efa4ba", sources: ["floorAmm","floorAmmGovV2"] },
|
|
84
87
|
{ name: "owedV2", signature: "owedV2(address,uint256[],address[])", selector: "0xdd3ee1ef", sources: ["floorAmmViewsV2"] },
|
|
85
88
|
{ name: "pairIdOf", signature: "pairIdOf(uint256)", selector: "0x83a74ea3", sources: ["floorAmmViewsV2"] },
|
|
86
|
-
{ name: "payoutOwed", signature: "payoutOwed(address,address)", selector: "0xae3f9120", sources: ["floorAmm"] },
|
|
87
|
-
{ name: "pendingAuthority", signature: "pendingAuthority()", selector: "0xfabb94bb", sources: ["floorAmm"] },
|
|
89
|
+
{ name: "payoutOwed", signature: "payoutOwed(address,address)", selector: "0xae3f9120", sources: ["floorAmm","floorAmmGovV2"] },
|
|
90
|
+
{ name: "pendingAuthority", signature: "pendingAuthority()", selector: "0xfabb94bb", sources: ["floorAmm","floorAmmGovV2"] },
|
|
88
91
|
{ name: "permit", signature: "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", selector: "0xd505accf", sources: ["floorToken","floorTokenIndexed"] },
|
|
89
|
-
{ name: "platformOwed", signature: "platformOwed(address)", selector: "0x240b9586", sources: ["floorAmm"] },
|
|
92
|
+
{ name: "platformOwed", signature: "platformOwed(address)", selector: "0x240b9586", sources: ["floorAmm","floorAmmGovV2"] },
|
|
90
93
|
{ name: "positionOf", signature: "positionOf(address)", selector: "0xfd2d39c5", sources: ["floorTokenIndexed"] },
|
|
91
94
|
{ name: "predictToken", signature: "predictToken(address,bytes32)", selector: "0x486e36c8", sources: ["floorAmm","floorAmmCreateV2"] },
|
|
92
95
|
{ name: "presetRow", signature: "presetRow(uint8)", selector: "0xa0c15861", sources: ["floorAmm"] },
|
|
93
|
-
{ name: "priceUpdater", signature: "priceUpdater()", selector: "0xfc612a8d", sources: ["floorAmm"] },
|
|
96
|
+
{ name: "priceUpdater", signature: "priceUpdater()", selector: "0xfc612a8d", sources: ["floorAmm","floorAmmGovV2"] },
|
|
94
97
|
{ name: "program", signature: "program()", selector: "0xc860ebc6", sources: ["floorToken","floorTokenIndexed"] },
|
|
95
98
|
{ name: "proxiableUUID", signature: "proxiableUUID()", selector: "0x52d1902d", sources: ["floorAmmV2"] },
|
|
96
99
|
{ name: "quoteBuy", signature: "quoteBuy(uint256,uint256,address)", selector: "0xec7a34c9", sources: ["floorAmm","floorAmmV2"] },
|
|
97
|
-
{ name: "quoteEntry", signature: "quoteEntry(address)", selector: "0x77665076", sources: ["floorAmm"] },
|
|
98
|
-
{ name: "quoteRisk", signature: "quoteRisk(address)", selector: "0x1461d14e", sources: ["floorAmm"] },
|
|
99
|
-
{ name: "quotes", signature: "quotes()", selector: "0xd6a5d7db", sources: ["floorAmm"] },
|
|
100
|
+
{ name: "quoteEntry", signature: "quoteEntry(address)", selector: "0x77665076", sources: ["floorAmm","floorAmmGovV2"] },
|
|
101
|
+
{ name: "quoteRisk", signature: "quoteRisk(address)", selector: "0x1461d14e", sources: ["floorAmm","floorAmmGovV2"] },
|
|
102
|
+
{ name: "quotes", signature: "quotes()", selector: "0xd6a5d7db", sources: ["floorAmm","floorAmmGovV2"] },
|
|
100
103
|
{ name: "quoteSell", signature: "quoteSell(uint256,uint256,address)", selector: "0x0cff08d1", sources: ["floorAmm","floorAmmV2"] },
|
|
101
|
-
{ name: "referralAuthority", signature: "referralAuthority()", selector: "0x2fe0a99a", sources: ["floorAmm"] },
|
|
104
|
+
{ name: "referralAuthority", signature: "referralAuthority()", selector: "0x2fe0a99a", sources: ["floorAmm","floorAmmGovV2"] },
|
|
102
105
|
{ name: "releaseSkipped", signature: "releaseSkipped(address)", selector: "0x215fa9eb", sources: ["floorTokenIndexed"] },
|
|
106
|
+
{ name: "revokeOgUser", signature: "revokeOgUser(address)", selector: "0x52e52ecc", sources: ["floorAmmGovV2"] },
|
|
103
107
|
{ name: "router", signature: "router()", selector: "0xf887ea40", sources: ["floorZap"] },
|
|
104
108
|
{ name: "sell", signature: "sell(uint256,uint256,uint256,address,uint256)", selector: "0xbadb999b", sources: ["floorAmm","floorAmmV2"] },
|
|
105
109
|
{ name: "sellFromBalance", signature: "sellFromBalance(uint256,uint256,address,uint256)", selector: "0x611b00a8", sources: ["floorAmm","floorAmmV2"] },
|
|
106
110
|
{ name: "sellWithPermit", signature: "sellWithPermit(uint256,uint256,uint256,address,uint256,uint256,uint8,bytes32,bytes32)", selector: "0x2ab030d3", sources: ["floorAmm","floorAmmV2"] },
|
|
107
|
-
{ name: "setCreatePaused", signature: "setCreatePaused(bool)", selector: "0x83bcec85", sources: ["floorAmm"] },
|
|
108
|
-
{ name: "setHolderDest", signature: "setHolderDest(address)", selector: "0x6ad3e66d", sources: ["floorAmm"] },
|
|
109
|
-
{ name: "setMetadataBase", signature: "setMetadataBase(string)", selector: "0xd3811c0f", sources: ["floorAmm"] },
|
|
110
|
-
{ name: "setNativeCreateFee", signature: "setNativeCreateFee(uint256)", selector: "0xa4433667", sources: ["floorAmm"] },
|
|
111
|
+
{ name: "setCreatePaused", signature: "setCreatePaused(bool)", selector: "0x83bcec85", sources: ["floorAmm","floorAmmGovV2"] },
|
|
112
|
+
{ name: "setHolderDest", signature: "setHolderDest(address)", selector: "0x6ad3e66d", sources: ["floorAmm","floorAmmGovV2"] },
|
|
113
|
+
{ name: "setMetadataBase", signature: "setMetadataBase(string)", selector: "0xd3811c0f", sources: ["floorAmm","floorAmmGovV2"] },
|
|
114
|
+
{ name: "setNativeCreateFee", signature: "setNativeCreateFee(uint256)", selector: "0xa4433667", sources: ["floorAmm","floorAmmGovV2"] },
|
|
115
|
+
{ name: "setOgUser", signature: "setOgUser(address,uint256,bytes)", selector: "0x02cb4469", sources: ["floorAmmGovV2"] },
|
|
111
116
|
{ name: "setPresetEnabled", signature: "setPresetEnabled(uint8,bool)", selector: "0x673fb9a9", sources: ["floorAmm"] },
|
|
112
|
-
{ name: "setPriceUpdater", signature: "setPriceUpdater(address)", selector: "0x97c4a5f3", sources: ["floorAmm"] },
|
|
113
|
-
{ name: "setQuoteCap", signature: "setQuoteCap(address,uint128)", selector: "0x42adf398", sources: ["floorAmm"] },
|
|
114
|
-
{ name: "setQuotePrice", signature: "setQuotePrice(address,uint256)", selector: "0x3857ed9e", sources: ["floorAmm"] },
|
|
115
|
-
{ name: "setReferralAuthority", signature: "setReferralAuthority(address)", selector: "0x46325d7a", sources: ["floorAmm"] },
|
|
116
|
-
{ name: "setTimelock", signature: "setTimelock(address)", selector: "0xbdacb303", sources: ["floorAmm"] },
|
|
117
|
-
{ name: "setTraderRef", signature: "setTraderRef(address,address[3],uint256,bytes,bytes)", selector: "0xd7426758", sources: ["floorAmm"] },
|
|
118
|
-
{ name: "setTreasury", signature: "setTreasury(address)", selector: "0xf0f44260", sources: ["floorAmm"] },
|
|
117
|
+
{ name: "setPriceUpdater", signature: "setPriceUpdater(address)", selector: "0x97c4a5f3", sources: ["floorAmm","floorAmmGovV2"] },
|
|
118
|
+
{ name: "setQuoteCap", signature: "setQuoteCap(address,uint128)", selector: "0x42adf398", sources: ["floorAmm","floorAmmGovV2"] },
|
|
119
|
+
{ name: "setQuotePrice", signature: "setQuotePrice(address,uint256)", selector: "0x3857ed9e", sources: ["floorAmm","floorAmmGovV2"] },
|
|
120
|
+
{ name: "setReferralAuthority", signature: "setReferralAuthority(address)", selector: "0x46325d7a", sources: ["floorAmm","floorAmmGovV2"] },
|
|
121
|
+
{ name: "setTimelock", signature: "setTimelock(address)", selector: "0xbdacb303", sources: ["floorAmm","floorAmmGovV2"] },
|
|
122
|
+
{ name: "setTraderRef", signature: "setTraderRef(address,address[3],uint256,bytes,bytes)", selector: "0xd7426758", sources: ["floorAmm","floorAmmGovV2"] },
|
|
123
|
+
{ name: "setTreasury", signature: "setTreasury(address)", selector: "0xf0f44260", sources: ["floorAmm","floorAmmGovV2"] },
|
|
119
124
|
{ name: "simBuy", signature: "simBuy(uint256,uint256,address)", selector: "0xf69acbed", sources: ["floorAmmV2"] },
|
|
120
125
|
{ name: "simSell", signature: "simSell(uint256,uint256,address)", selector: "0xd3536ecd", sources: ["floorAmmV2"] },
|
|
121
126
|
{ name: "symbol", signature: "symbol()", selector: "0x95d89b41", sources: ["floorToken","floorTokenIndexed"] },
|
|
@@ -125,19 +130,19 @@ export const EVM_FUNCTION_SELECTORS = [
|
|
|
125
130
|
{ name: "teamShareOf", signature: "teamShareOf(uint256,address)", selector: "0xb2280af2", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
126
131
|
{ name: "teamSlotAdd", signature: "teamSlotAdd(uint256,bytes32,uint8,uint256,bool)", selector: "0xd5402e81", sources: ["floorAmm","floorAmmClaimsV2"] },
|
|
127
132
|
{ name: "teamSlotOf", signature: "teamSlotOf(uint256)", selector: "0x8744aded", sources: ["floorAmmViewsV2"] },
|
|
128
|
-
{ name: "timelock", signature: "timelock()", selector: "0xd33219b4", sources: ["floorAmm"] },
|
|
133
|
+
{ name: "timelock", signature: "timelock()", selector: "0xd33219b4", sources: ["floorAmm","floorAmmGovV2"] },
|
|
129
134
|
{ name: "TOKEN_SCALE", signature: "TOKEN_SCALE()", selector: "0xcae07d2a", sources: ["floorTokenIndexed"] },
|
|
130
135
|
{ name: "tokenImplV2", signature: "tokenImplV2()", selector: "0x01b9b386", sources: ["floorAmmCreateV2"] },
|
|
131
136
|
{ name: "TOTAL_SUPPLY", signature: "TOTAL_SUPPLY()", selector: "0x902d55a5", sources: ["floorTokenIndexed"] },
|
|
132
137
|
{ name: "totalSupply", signature: "totalSupply()", selector: "0x18160ddd", sources: ["floorToken","floorTokenIndexed"] },
|
|
133
138
|
{ name: "traderRef", signature: "traderRef(address)", selector: "0xcfc18291", sources: ["floorAmm","floorAmmViewsV2"] },
|
|
134
139
|
{ name: "transfer", signature: "transfer(address,uint256)", selector: "0xa9059cbb", sources: ["floorToken","floorTokenIndexed"] },
|
|
135
|
-
{ name: "transferAuthority", signature: "transferAuthority(address)", selector: "0x3078db6c", sources: ["floorAmm"] },
|
|
140
|
+
{ name: "transferAuthority", signature: "transferAuthority(address)", selector: "0x3078db6c", sources: ["floorAmm","floorAmmGovV2"] },
|
|
136
141
|
{ name: "transferFrom", signature: "transferFrom(address,address,uint256)", selector: "0x23b872dd", sources: ["floorToken","floorTokenIndexed"] },
|
|
137
|
-
{ name: "treasury", signature: "treasury()", selector: "0x61d027b3", sources: ["floorAmm"] },
|
|
142
|
+
{ name: "treasury", signature: "treasury()", selector: "0x61d027b3", sources: ["floorAmm","floorAmmGovV2"] },
|
|
138
143
|
{ name: "unlockCreatorBuy", signature: "unlockCreatorBuy(uint256)", selector: "0xf03d6d5e", sources: ["floorAmm","floorAmmClaimsV2"] },
|
|
139
144
|
{ name: "updatePreset", signature: "updatePreset(uint8,bytes)", selector: "0x005d9e72", sources: ["floorAmm"] },
|
|
140
|
-
{ name: "updateQuote", signature: "updateQuote(address,bool,uint256,uint256)", selector: "0x21593d6e", sources: ["floorAmm"] },
|
|
145
|
+
{ name: "updateQuote", signature: "updateQuote(address,bool,uint256,uint256)", selector: "0x21593d6e", sources: ["floorAmm","floorAmmGovV2"] },
|
|
141
146
|
{ name: "UPGRADE_INTERFACE_VERSION", signature: "UPGRADE_INTERFACE_VERSION()", selector: "0xad3cb1cc", sources: ["floorAmmV2"] },
|
|
142
147
|
{ name: "upgradeToAndCall", signature: "upgradeToAndCall(address,bytes)", selector: "0x4f1ef286", sources: ["floorAmmV2"] },
|
|
143
148
|
{ name: "withdrawHolder", signature: "withdrawHolder(address,uint256)", selector: "0xfb90c8bf", sources: ["floorAmm","floorAmmCreateV2"] },
|
package/dist/index.js
CHANGED
|
@@ -87,6 +87,7 @@ export * as abi from "./abi/index.js";
|
|
|
87
87
|
export * as v2Press from "./v2/press.js";
|
|
88
88
|
export * as v2ReceiptTx from "./v2/receipt-tx.js";
|
|
89
89
|
export * as config from "./config/index.js";
|
|
90
|
+
export * as ton from "./ton/index.js";
|
|
90
91
|
export * as fixtures from "./fixtures.js";
|
|
91
92
|
export * as client from "./client/index.js";
|
|
92
93
|
export * as errors from "./errors.js";
|
package/dist/indexer/bodies.js
CHANGED
|
@@ -123,12 +123,27 @@ const LISTED_FIELDS = {
|
|
|
123
123
|
volume24hGross: nullable(big),
|
|
124
124
|
holders: int,
|
|
125
125
|
|
|
126
|
+
holdersChange1h: nullable(int),
|
|
127
|
+
|
|
128
|
+
holdersChange24h: nullable(int),
|
|
129
|
+
|
|
130
|
+
volume1h: nullable(big),
|
|
131
|
+
|
|
132
|
+
volumePrev1h: nullable(big),
|
|
133
|
+
|
|
126
134
|
maxLossPpm: optional(nullable(int)),
|
|
127
135
|
|
|
128
136
|
backedPpm: nullable(int),
|
|
129
137
|
volume24hUsd: nullable(decimal),
|
|
138
|
+
|
|
139
|
+
volume1hUsd: nullable(decimal),
|
|
140
|
+
volumePrev1hUsd: nullable(decimal),
|
|
130
141
|
marketCapUsd: nullable(decimal),
|
|
131
142
|
|
|
143
|
+
athPrice: nullable(big),
|
|
144
|
+
|
|
145
|
+
athPriceUsd: nullable(decimal),
|
|
146
|
+
|
|
132
147
|
trendingScore: nullable(big),
|
|
133
148
|
|
|
134
149
|
change24hBps: optional(nullable(int)),
|
|
@@ -172,6 +187,10 @@ const TRADE_FIELDS = {
|
|
|
172
187
|
};
|
|
173
188
|
export const TRADE = object(TRADE_FIELDS);
|
|
174
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
|
+
|
|
175
194
|
export const PAGED_TRADE = object({ id: str, ...TRADE_FIELDS });
|
|
176
195
|
|
|
177
196
|
export const HEAD = object({
|
|
@@ -276,7 +295,7 @@ export const LAUNCH_CLAIM = object({ launch: str, claimer: str, types: int, quot
|
|
|
276
295
|
|
|
277
296
|
export const LAUNCH_CLAIMS = object({ indexed, claims: array(LAUNCH_CLAIM), next: optional(nullable(str)) });
|
|
278
297
|
|
|
279
|
-
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) });
|
|
280
299
|
|
|
281
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 });
|
|
282
301
|
|
|
@@ -365,6 +384,115 @@ export const DEV_TRADES = object({ indexed, launch: str, creator: str, trades: a
|
|
|
365
384
|
|
|
366
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)) });
|
|
367
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
|
+
|
|
368
496
|
const LOCK_HOLDER = object({ wallet: str, place: nullable(int) });
|
|
369
497
|
|
|
370
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) });
|
|
@@ -514,10 +642,17 @@ export const FIRSTS_MANY = object({ indexed, wallets: record(FIRSTS_ROW) });
|
|
|
514
642
|
|
|
515
643
|
const PER_QUOTE = array(object({ quote: str, amount: big }));
|
|
516
644
|
|
|
645
|
+
export const PEOPLE_ROLE = object({ kind: oneOf("trader", "creator"), tier: int, via: nullable(str) });
|
|
646
|
+
|
|
517
647
|
export const PEOPLE = object({
|
|
518
648
|
indexed,
|
|
519
649
|
wallet: str,
|
|
520
|
-
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 }))),
|
|
521
656
|
|
|
522
657
|
next: optional(nullable(str)),
|
|
523
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++) {
|