@floorlaunchpad/sdk 0.1.0 → 0.3.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 +84 -0
- package/LICENSE +201 -60
- package/README.md +45 -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 +128 -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 +746 -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 +144 -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/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 +91 -7
- package/dist/indexer/bodies.js +473 -0
- package/dist/indexer/client.js +104 -0
- package/dist/indexer/contract.js +349 -0
- package/dist/indexer/decode.js +97 -0
- package/dist/indexer/partners.js +100 -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 +390 -0
- package/dist/solana/floor/borsh.js +66 -0
- package/dist/solana/floor/create.js +65 -0
- package/dist/solana/floor/events.js +140 -0
- package/dist/solana/floor/genesis.js +91 -0
- package/dist/solana/floor/genesisList.js +68 -0
- package/dist/solana/floor/instructions.js +435 -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/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/frontend.md +29 -0
- package/docs/wallet.md +54 -0
- package/package.json +428 -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 +138 -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 +746 -0
- package/src/config/index.ts +91 -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 +831 -0
- package/src/evm/abi.ts +292 -0
- package/src/evm/balances.ts +26 -0
- package/src/evm/chains.ts +167 -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/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 +91 -6
- package/src/indexer/bodies.ts +528 -0
- package/src/indexer/client.ts +178 -0
- package/src/indexer/contract.ts +410 -0
- package/src/indexer/decode.ts +109 -0
- package/src/indexer/partners.ts +109 -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 +393 -0
- package/src/solana/floor/borsh.ts +66 -0
- package/src/solana/floor/create.ts +89 -0
- package/src/solana/floor/events.ts +147 -0
- package/src/solana/floor/genesis.ts +111 -0
- package/src/solana/floor/genesisList.ts +75 -0
- package/src/solana/floor/instructions.ts +491 -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/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
package/src/v2/tx/evm.ts
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { bytesToHex, checksumAddress, decodeAbi, encodeCall, hexToBytes } from "../../evm/abi.ts";
|
|
4
|
+
import type { AbiValue } from "../../evm/abi.ts";
|
|
5
|
+
import { teamSlotHandleId } from "../../handle.ts";
|
|
6
|
+
import { freshRegistryPrice } from "../../registryPrice.ts";
|
|
7
|
+
import type { RegistryPrice } from "../../registryPrice.ts";
|
|
8
|
+
import type { EvmCall } from "../evm.ts";
|
|
9
|
+
import { evmSignature } from "../../generated/index.ts";
|
|
10
|
+
|
|
11
|
+
export { claimV2Call, CLAIM_HOLDER_EVM, CLAIM_KNOWN_V2_EVM, creditBackingCall, optInCall, viewCall, decodeTeamShareOf } from "../evm.ts";
|
|
12
|
+
export type { EvmCall } from "../evm.ts";
|
|
13
|
+
export { traderRefDigest, traderRefAuthDigest, bindHandleDigest, bindHandleAuthDigest } from "../../evm/floor/calls.ts";
|
|
14
|
+
export { CLAIM_CREATOR, CLAIM_CREATOR_REF, CLAIM_TEAM_SLOT, CLAIM_TRADER_REF, CLAIM_PAYOUT, CLAIM_TEAM_BUY, CLAIM_SHARE_BOUGHT, MEMBER_WALLET, MEMBER_HANDLE, NATIVE_QUOTE } from "../../evm/floor/iface.ts";
|
|
15
|
+
|
|
16
|
+
export const EVM_V2_TX = {
|
|
17
|
+
|
|
18
|
+
createLaunch: evmSignature("createLaunch"),
|
|
19
|
+
|
|
20
|
+
teamSlotAdd: evmSignature("teamSlotAdd"),
|
|
21
|
+
unlockCreatorBuy: evmSignature("unlockCreatorBuy"),
|
|
22
|
+
claim: evmSignature("claim"),
|
|
23
|
+
|
|
24
|
+
teamShareBuy: evmSignature("teamShareBuy"),
|
|
25
|
+
|
|
26
|
+
setTraderRef: evmSignature("setTraderRef"),
|
|
27
|
+
bindHandle: evmSignature("bindHandle"),
|
|
28
|
+
claimPayoutTo: evmSignature("claimPayoutTo"),
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
export const EVM_V2_TX_VIEWS = {
|
|
32
|
+
traderRef: { sig: evmSignature("traderRef"), ret: ["address[3]"] },
|
|
33
|
+
launchCount: { sig: evmSignature("launchCount"), ret: ["uint256"] },
|
|
34
|
+
predictToken: { sig: evmSignature("predictToken"), ret: ["address"] },
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
const NATIVE = "0x0000000000000000000000000000000000000000";
|
|
38
|
+
const MAX_NAME = 32;
|
|
39
|
+
const MAX_SYMBOL = 10;
|
|
40
|
+
const U128 = (1n << 128n) - 1n;
|
|
41
|
+
const call = (to: string, sig: string, args: AbiValue[], value = 0n): EvmCall => ({ to: checksumAddress(to), data: bytesToHex(encodeCall(sig, args)), value });
|
|
42
|
+
const deadlineOf = (d: bigint | undefined): bigint => d ?? (1n << 256n) - 1n;
|
|
43
|
+
|
|
44
|
+
export interface CreateParamsV2 {
|
|
45
|
+
presetId: number;
|
|
46
|
+
|
|
47
|
+
quote: string;
|
|
48
|
+
name: string;
|
|
49
|
+
symbol: string;
|
|
50
|
+
|
|
51
|
+
creatorBuy?: bigint;
|
|
52
|
+
creatorBuyMinTokens?: bigint;
|
|
53
|
+
sameAddressEverywhere?: boolean;
|
|
54
|
+
|
|
55
|
+
creatorSalt?: string;
|
|
56
|
+
|
|
57
|
+
quoteUsdCentsX64?: bigint;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function createLaunchCallV2(p: {
|
|
61
|
+
floorAmm: string;
|
|
62
|
+
params: CreateParamsV2;
|
|
63
|
+
teamSlotMaxBps: number;
|
|
64
|
+
|
|
65
|
+
createFee: bigint;
|
|
66
|
+
listed: boolean;
|
|
67
|
+
|
|
68
|
+
teamBuyMax?: bigint;
|
|
69
|
+
|
|
70
|
+
registry?: { entry: RegistryPrice; now: bigint };
|
|
71
|
+
}): EvmCall {
|
|
72
|
+
const q = p.params;
|
|
73
|
+
if ("uri" in (q as object)) throw new RangeError("no uri: the token's uri is derived (metadataBase/<token>.json)");
|
|
74
|
+
const enc = new TextEncoder();
|
|
75
|
+
const nl = enc.encode(q.name).length;
|
|
76
|
+
const sl = enc.encode(q.symbol).length;
|
|
77
|
+
if (nl === 0 || sl === 0 || nl > MAX_NAME || sl > MAX_SYMBOL) throw new RangeError("name 1..32, symbol 1..10 bytes (BadArgument)");
|
|
78
|
+
if (!Number.isInteger(q.presetId) || q.presetId <= 0 || q.presetId > 255) throw new RangeError("presetId is a u8 > 0 (id 0 reserved)");
|
|
79
|
+
if (q.presetId === 2) throw new RangeError("preset id 2 is retired");
|
|
80
|
+
const rate = p.teamSlotMaxBps;
|
|
81
|
+
if (!Number.isInteger(rate) || rate < 0 || rate > 0xffff) throw new RangeError("teamSlotMaxBps is a u16");
|
|
82
|
+
const buy = q.creatorBuy ?? 0n;
|
|
83
|
+
const minTok = q.creatorBuyMinTokens ?? 0n;
|
|
84
|
+
if (buy < 0n || minTok < 0n) throw new RangeError("the Team Buy and its minimum are ≥ 0");
|
|
85
|
+
if (buy === 0n && minTok > 0n) throw new RangeError("a minimum without a Team Buy (SlippageExceeded)");
|
|
86
|
+
if (p.teamBuyMax !== undefined && buy > p.teamBuyMax) throw new RangeError(`the Team Buy ${buy} is over the row's share ${p.teamBuyMax} (CreatorBuyTooLarge)`);
|
|
87
|
+
const usd = q.quoteUsdCentsX64 ?? 0n;
|
|
88
|
+
if (p.listed && usd !== 0n) throw new RangeError("a listed quote declares no price (BadArgument)");
|
|
89
|
+
if (!p.listed && (usd === 0n || usd > U128)) throw new RangeError("an unlisted quote declares 0 < price ≤ 2^128 − 1 (BadArgument)");
|
|
90
|
+
if (p.listed && p.registry) freshRegistryPrice(p.registry.entry, p.registry.now);
|
|
91
|
+
const native = q.quote.toLowerCase() === NATIVE;
|
|
92
|
+
const value = !p.listed ? p.createFee : native ? p.createFee + buy : 0n;
|
|
93
|
+
const salt = hexToBytes(q.creatorSalt ?? "0x" + "00".repeat(32));
|
|
94
|
+
if (salt.length !== 32) throw new RangeError("creatorSalt is bytes32");
|
|
95
|
+
return call(
|
|
96
|
+
p.floorAmm,
|
|
97
|
+
EVM_V2_TX.createLaunch,
|
|
98
|
+
[[BigInt(q.presetId), q.quote, q.name, q.symbol, buy, minTok, q.sameAddressEverywhere ?? false, salt, usd, BigInt(rate)]],
|
|
99
|
+
value,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function createApprovalV2(p: { listed: boolean; quote: string; createFee: bigint; creatorBuy?: bigint }): bigint {
|
|
104
|
+
if (p.quote.toLowerCase() === NATIVE) return 0n;
|
|
105
|
+
return (p.listed ? p.createFee : 0n) + (p.creatorBuy ?? 0n);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type SlotMemberEvm = { wallet: string } | { platform: string; handle: string };
|
|
109
|
+
|
|
110
|
+
export function slotMemberKeyEvm(m: SlotMemberEvm): { key: string; kind: number } {
|
|
111
|
+
if ("wallet" in m) return { key: "0x" + "00".repeat(12) + checksumAddress(m.wallet).slice(2).toLowerCase(), kind: 0 };
|
|
112
|
+
return { key: teamSlotHandleId(m.platform, m.handle), kind: 1 };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function teamSlotAddCallV2(p: { floorAmm: string; launchId: bigint; member: SlotMemberEvm; shares: bigint }): EvmCall {
|
|
116
|
+
if (p.shares <= 0n) throw new RangeError("teamSlotAdd: shares > 0 (NothingToDo)");
|
|
117
|
+
const { key, kind } = slotMemberKeyEvm(p.member);
|
|
118
|
+
return call(p.floorAmm, EVM_V2_TX.teamSlotAdd, [p.launchId, hexToBytes(key), BigInt(kind), p.shares, false]);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const unlockCreatorBuyCallV2 = (p: { floorAmm: string; launchId: bigint }): EvmCall => call(p.floorAmm, EVM_V2_TX.unlockCreatorBuy, [p.launchId]);
|
|
122
|
+
|
|
123
|
+
export const EVM_V2_TX_ONE_PRESS = {
|
|
124
|
+
teamShareBuyAndClaim: evmSignature("teamShareBuyAndClaim"),
|
|
125
|
+
} as const;
|
|
126
|
+
|
|
127
|
+
export function teamShareBuyAndClaimCallV2(p: { floorAmm: string; launchId: bigint; deadline?: bigint; amountIn: bigint; minOut: bigint }): EvmCall {
|
|
128
|
+
const amount = p.amountIn;
|
|
129
|
+
if (amount < 0n) throw new RangeError("teamShareBuyAndClaim: amount ≥ 0 (0 = everything owed)");
|
|
130
|
+
return call(p.floorAmm, EVM_V2_TX_ONE_PRESS.teamShareBuyAndClaim, [p.launchId, amount, p.minOut, deadlineOf(p.deadline)]);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function teamShareBuyCallV2(p: { floorAmm: string; launchId: bigint; deadline?: bigint; amountIn: bigint; minOut: bigint }): EvmCall {
|
|
134
|
+
const amount = p.amountIn;
|
|
135
|
+
if (amount <= 0n) throw new RangeError("teamShareBuy: amount > 0");
|
|
136
|
+
return call(p.floorAmm, EVM_V2_TX.teamShareBuy, [p.launchId, amount, p.minOut, deadlineOf(p.deadline)]);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function setTraderRefCallV2(p: { floorAmm: string; trader: string; tiers: readonly [string, string, string]; deadline: bigint; authSig: string; traderSig?: string }): EvmCall {
|
|
140
|
+
return call(p.floorAmm, EVM_V2_TX.setTraderRef, [p.trader, [...p.tiers], p.deadline, hexToBytes(p.authSig), hexToBytes(p.traderSig ?? "0x")]);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function bindHandleCallV2(p: { floorAmm: string; handleId: string; wallet: string; quotes: readonly string[]; deadline: bigint; authSig: string; walletSig?: string }): EvmCall {
|
|
144
|
+
return call(p.floorAmm, EVM_V2_TX.bindHandle, [hexToBytes(p.handleId), p.wallet, [...p.quotes], p.deadline, hexToBytes(p.authSig), hexToBytes(p.walletSig ?? "0x")]);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export const claimPayoutToCallV2 = (p: { floorAmm: string; quote: string; to: string }): EvmCall => call(p.floorAmm, EVM_V2_TX.claimPayoutTo, [p.quote, p.to]);
|
|
148
|
+
|
|
149
|
+
export const traderRefDataV2 = (trader: string): string => bytesToHex(encodeCall(EVM_V2_TX_VIEWS.traderRef.sig, [trader]));
|
|
150
|
+
export const decodeTraderRefV2 = (data: string | Uint8Array): string[] => (decodeAbi(EVM_V2_TX_VIEWS.traderRef.ret, data)[0] as string[]).map((a) => checksumAddress(a));
|
|
151
|
+
|
|
152
|
+
export const predictTokenDataV2 = (creator: string, salt: string): string => bytesToHex(encodeCall(EVM_V2_TX_VIEWS.predictToken.sig, [creator, hexToBytes(salt)]));
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { accountDiscriminator } from "../../solana/instruction.ts";
|
|
4
|
+
import { Reader } from "../../solana/floor/borsh.ts";
|
|
5
|
+
import { decodeGenesisAllocation, decodeGenesisRaise } from "../../solana/floor/accounts.ts";
|
|
6
|
+
import { FLOOR_AMM_PROGRAM_ID, configPda, genesisAllocPda, genesisConvertBandPda, genesisRaisePda } from "../../solana/floor/program.ts";
|
|
7
|
+
import { genesisWalletClaim } from "../../solana/floor/genesis.ts";
|
|
8
|
+
import type { GenesisWalletClaim } from "../../solana/floor/genesis.ts";
|
|
9
|
+
|
|
10
|
+
export { openGenesisLaunchInstructionV2, openGenesisWagmiInstructionV2, claimGenesisInstructionV2, claimGenesisWagmiInstructionV2, sweepGenesisWagmiDustInstructionV2 } from "../genesis.ts";
|
|
11
|
+
export { setGenesisConvertBandInstruction } from "../solana.ts";
|
|
12
|
+
export { contributeGenesisInstruction, contributeGenesisListedInstruction, refundGenesisMigratedInstruction, claimGenesisRefundInstruction, convertGenesisSolInstruction } from "../../solana/floor/instructions.ts";
|
|
13
|
+
export { decodeGenesisRaise, decodeGenesisAllocation } from "../../solana/floor/accounts.ts";
|
|
14
|
+
export { genesisWalletClaim } from "../../solana/floor/genesis.ts";
|
|
15
|
+
export type { GenesisWalletClaim } from "../../solana/floor/genesis.ts";
|
|
16
|
+
|
|
17
|
+
export const GENESIS_CONVERT_BAND_SIZE = 8 + 1 + 16 * 4 + 8;
|
|
18
|
+
|
|
19
|
+
export interface GenesisConvertBand {
|
|
20
|
+
bump: number;
|
|
21
|
+
solPxMin: bigint;
|
|
22
|
+
solPxMax: bigint;
|
|
23
|
+
usdcPxMin: bigint;
|
|
24
|
+
usdcPxMax: bigint;
|
|
25
|
+
updatedAt: bigint;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function decodeGenesisConvertBand(data: Uint8Array): GenesisConvertBand {
|
|
29
|
+
if (data.length !== GENESIS_CONVERT_BAND_SIZE) throw new RangeError(`GenesisConvertBand is ${GENESIS_CONVERT_BAND_SIZE} bytes, got ${data.length}`);
|
|
30
|
+
const d = accountDiscriminator("GenesisConvertBand");
|
|
31
|
+
for (let i = 0; i < 8; i++) if (data[i] !== d[i]) throw new RangeError("not a GenesisConvertBand account");
|
|
32
|
+
const r = new Reader(data.subarray(8));
|
|
33
|
+
return { bump: r.u8(), solPxMin: r.u128(), solPxMax: r.u128(), usdcPxMin: r.u128(), usdcPxMax: r.u128(), updatedAt: r.i64() };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const genesisBandHolds = (b: GenesisConvertBand, solPx: bigint, usdcPx: bigint): boolean =>
|
|
37
|
+
b.solPxMin > 0n && b.usdcPxMin > 0n && solPx >= b.solPxMin && solPx <= b.solPxMax && usdcPx >= b.usdcPxMin && usdcPx <= b.usdcPxMax;
|
|
38
|
+
|
|
39
|
+
export function genesisAccountsV2(p: { wallet?: string; programId?: string }): {
|
|
40
|
+
config: string; genesisRaise: string; convertBand: string; allocation: string | null;
|
|
41
|
+
} {
|
|
42
|
+
const g = p.programId ?? FLOOR_AMM_PROGRAM_ID;
|
|
43
|
+
return {
|
|
44
|
+
config: configPda(g)[0],
|
|
45
|
+
genesisRaise: genesisRaisePda(g)[0],
|
|
46
|
+
convertBand: genesisConvertBandPda(g)[0],
|
|
47
|
+
allocation: p.wallet ? genesisAllocPda(p.wallet, g)[0] : null,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface GenesisReadV2 {
|
|
52
|
+
raise: Record<string, any>;
|
|
53
|
+
allocation: Record<string, any> | null;
|
|
54
|
+
|
|
55
|
+
claim: GenesisWalletClaim | null;
|
|
56
|
+
band: GenesisConvertBand | null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function readGenesisV2(p: { raise: Uint8Array; allocation?: Uint8Array | null; band?: Uint8Array | null; now: bigint }): GenesisReadV2 {
|
|
60
|
+
const raise = decodeGenesisRaise(p.raise);
|
|
61
|
+
const allocation = p.allocation ? decodeGenesisAllocation(p.allocation) : null;
|
|
62
|
+
let claim: GenesisWalletClaim | null = null;
|
|
63
|
+
if (allocation && BigInt(raise.raised_final ?? 0n) > 0n) claim = genesisWalletClaim(raise, allocation);
|
|
64
|
+
const band = p.band ? decodeGenesisConvertBand(p.band) : null;
|
|
65
|
+
return { raise, allocation, claim, band };
|
|
66
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { addressBytes, base58Encode } from "../../codec.ts";
|
|
4
|
+
import { teamSlotHandleKey } from "../../handle.ts";
|
|
5
|
+
import { CLAIM_CREATOR, CLAIM_CREATOR_REF, CLAIM_SHARE_BOUGHT, CLAIM_TEAM_BUY, CLAIM_TEAM_SLOT, CLAIM_TRADER_REF, TEAM_SLOT_PENDING_HANDLE, TEAM_SLOT_WALLET, teamSlotAddInstruction } from "../../solana/floor/instructions.ts";
|
|
6
|
+
import type { Instruction } from "../../solana/instruction.ts";
|
|
7
|
+
import { freshRegistryPrice } from "../../registryPrice.ts";
|
|
8
|
+
import type { RegistryPrice } from "../../registryPrice.ts";
|
|
9
|
+
import { CLAIM_HOLDER, CLAIM_KNOWN_WIDE_V2, claimInstructionV2, teamShareBuyInstructionV2 } from "../solana.ts";
|
|
10
|
+
import type { TeamShareBuyBaseV2 } from "../solana.ts";
|
|
11
|
+
import { TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, WSOL_MINT, associatedTokenAddress } from "../../solana/pda.ts";
|
|
12
|
+
import { createAssociatedTokenAccountIdempotentInstruction } from "../../solana/tx.ts";
|
|
13
|
+
import { configPda as configPdaOf, teamSlotPda as teamSlotPdaOf } from "../../solana/floor/program.ts";
|
|
14
|
+
import { MEMBERS_MAX } from "../layouts.ts";
|
|
15
|
+
|
|
16
|
+
export { createLaunchInstructionV2, teamShareBuyInstructionV2, unlockCreatorBuyInstructionV2, burnTokensInstructionV2, claimInstructionV2, CLAIM_HOLDER, CLAIM_KNOWN_WIDE_V2 } from "../solana.ts";
|
|
17
|
+
export type { CreateArgsV2, ClaimLaunchV2 } from "../solana.ts";
|
|
18
|
+
export { planCreateWithSlot } from "../../solana/floor/create.ts";
|
|
19
|
+
export { createMintAccounts, MAX_NAME_LEN, MAX_SYMBOL_LEN } from "../../solana/floor/instructions.ts";
|
|
20
|
+
|
|
21
|
+
export { teamSlotAddInstruction, bindHandleInstruction, TEAM_SLOT_WALLET, TEAM_SLOT_PENDING_HANDLE } from "../../solana/floor/instructions.ts";
|
|
22
|
+
|
|
23
|
+
export { openTraderRefInstruction, openTraderLinkInstruction, openRefOwedInstruction, rollUpRefsInstruction, clearTraderRefInstruction } from "../../solana/floor/instructions.ts";
|
|
24
|
+
export { registerRoleInstruction, claimsPagePda, decodeClaimsPage, launchesFromRegistry, nextClaimsPage } from "../../solana/floor/registry.ts";
|
|
25
|
+
|
|
26
|
+
export { CLAIM_CREATOR, CLAIM_CREATOR_REF, CLAIM_TEAM_SLOT, CLAIM_TRADER_REF, CLAIM_TEAM_BUY, CLAIM_SHARE_BOUGHT } from "../../solana/floor/instructions.ts";
|
|
27
|
+
|
|
28
|
+
export { configPda, launchPda, teamSlotPda, traderRefPda, traderLinkPda, refOwedPda, quoteEntryPda, presetPda } from "../../solana/floor/program.ts";
|
|
29
|
+
|
|
30
|
+
export const TEAM_SLOT_MEMBERS_MAX = MEMBERS_MAX;
|
|
31
|
+
|
|
32
|
+
export const SOLANA_V2_TX = {
|
|
33
|
+
create_launch: { file: "v2/instructions/create.rs", struct: "CreateLaunchV2", args: "args: CreateArgs" },
|
|
34
|
+
team_share_buy: { file: "v2/instructions/team_share.rs", struct: "TeamShareBuyV2", args: "amount: u64, min_tokens_out: u64" },
|
|
35
|
+
unlock_creator_buy: { file: "instructions/platform.rs", struct: "UnlockCreatorBuy", args: "" },
|
|
36
|
+
burn_tokens: { file: "v2/instructions/burn.rs", struct: "BurnTokensV2", args: "place: u8, team_amount: u64, wallet_amount: u64" },
|
|
37
|
+
team_slot_add: { file: "instructions/team_slot.rs", struct: "TeamSlotPayment", args: "key: Pubkey, kind: u8, amount: u64, pay_now: bool" },
|
|
38
|
+
bind_handle: { file: "instructions/team_slot.rs", struct: "BindHandle", args: "index: u8, handle: [u8; 32], wallet: Pubkey" },
|
|
39
|
+
open_trader_ref: { file: "instructions/referrals.rs", struct: "OpenTraderRef", args: "trader: Pubkey, tiers: [Pubkey; 3]" },
|
|
40
|
+
open_trader_link: { file: "instructions/referrals.rs", struct: "OpenTraderLink", args: "trader: Pubkey, tiers: [Pubkey; 3]" },
|
|
41
|
+
open_ref_owed: { file: "instructions/referrals.rs", struct: "OpenRefOwed", args: "referrer: Pubkey" },
|
|
42
|
+
roll_up_refs: { file: "instructions/referrals.rs", struct: "RollUpRefs", args: "trader_refs: u8" },
|
|
43
|
+
clear_trader_ref: { file: "instructions/referrals.rs", struct: "ClearTraderRef", args: "" },
|
|
44
|
+
claim: { file: "instructions/claim.rs", struct: "Claim", args: "wallet: Pubkey, types: u8, launches: u8" },
|
|
45
|
+
claim_wide: { file: "instructions/claim.rs", struct: "Claim", args: "wallet: Pubkey, types: u16, launches: u8" },
|
|
46
|
+
} as const;
|
|
47
|
+
|
|
48
|
+
export interface ClaimWhat {
|
|
49
|
+
|
|
50
|
+
teamFees?: boolean;
|
|
51
|
+
|
|
52
|
+
creatorReferral?: boolean;
|
|
53
|
+
|
|
54
|
+
teamMilestones?: boolean;
|
|
55
|
+
|
|
56
|
+
traderReferral?: boolean;
|
|
57
|
+
|
|
58
|
+
teamBuy?: boolean;
|
|
59
|
+
|
|
60
|
+
teamShareBought?: boolean;
|
|
61
|
+
|
|
62
|
+
holder?: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function claimTypesV2(w: ClaimWhat): number {
|
|
66
|
+
const t =
|
|
67
|
+
(w.teamFees ? CLAIM_CREATOR : 0) |
|
|
68
|
+
(w.creatorReferral ? CLAIM_CREATOR_REF : 0) |
|
|
69
|
+
(w.teamMilestones ? CLAIM_TEAM_SLOT : 0) |
|
|
70
|
+
(w.traderReferral ? CLAIM_TRADER_REF : 0) |
|
|
71
|
+
(w.teamBuy ? CLAIM_TEAM_BUY : 0) |
|
|
72
|
+
(w.teamShareBought ? CLAIM_SHARE_BOUGHT : 0) |
|
|
73
|
+
(w.holder ? CLAIM_HOLDER : 0);
|
|
74
|
+
if (t === 0) throw new RangeError("claimTypesV2: nothing named (NothingToDo)");
|
|
75
|
+
if ((t & ~CLAIM_KNOWN_WIDE_V2) !== 0) throw new RangeError("claimTypesV2: a bit outside CLAIM_KNOWN_WIDE_V2");
|
|
76
|
+
return t;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type SlotMemberKey = { wallet: string } | { platform: string; handle: string };
|
|
80
|
+
|
|
81
|
+
export function slotMemberKey(m: SlotMemberKey): { key: string; kind: number } {
|
|
82
|
+
if ("wallet" in m) {
|
|
83
|
+
addressBytes(m.wallet);
|
|
84
|
+
return { key: m.wallet, kind: TEAM_SLOT_WALLET };
|
|
85
|
+
}
|
|
86
|
+
return { key: base58Encode(teamSlotHandleKey(m.platform, m.handle)), kind: TEAM_SLOT_PENDING_HANDLE };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function teamSlotAddMemberV2(
|
|
90
|
+
p: Omit<Parameters<typeof teamSlotAddInstruction>[0], "key" | "kind" | "amount" | "payNow"> & { member: SlotMemberKey; shares: bigint },
|
|
91
|
+
): Instruction {
|
|
92
|
+
if (p.shares <= 0n || p.shares >> 64n !== 0n) throw new RangeError("team_slot_add: shares is a u64 > 0 (NothingToDo)");
|
|
93
|
+
const { key, kind } = slotMemberKey(p.member);
|
|
94
|
+
const { member: _m, shares: _s, ...rest } = p;
|
|
95
|
+
return teamSlotAddInstruction({ ...rest, key, kind, amount: p.shares, payNow: false });
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function createFeeV2(p: { listed: true; createFee: bigint; registry?: { entry: RegistryPrice; now: bigint } } | { listed: false; nativeCreateFee: bigint }): { amount: bigint; inQuote: boolean } {
|
|
99
|
+
if (p.listed) {
|
|
100
|
+
if (p.registry) freshRegistryPrice(p.registry.entry, p.registry.now);
|
|
101
|
+
return { amount: p.createFee, inQuote: true };
|
|
102
|
+
}
|
|
103
|
+
return { amount: p.nativeCreateFee, inQuote: false };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function teamBuyCheck(buy: bigint, max: bigint): { buy: bigint; locked: boolean } {
|
|
107
|
+
if (buy < 0n) throw new RangeError("the Team Buy is ≥ 0");
|
|
108
|
+
if (buy > max) throw new RangeError(`the Team Buy ${buy} is over the row's share ${max} (CreatorBuyTooLarge)`);
|
|
109
|
+
return { buy, locked: buy > 0n };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const TEAM_SHARE_BUY_AND_CLAIM_TYPES_V2 = CLAIM_TEAM_SLOT | CLAIM_TEAM_BUY | CLAIM_SHARE_BOUGHT;
|
|
113
|
+
|
|
114
|
+
export function teamShareBuyAndClaimInstructionsV2(
|
|
115
|
+
p: Omit<TeamShareBuyBaseV2, "memberBase"> & {
|
|
116
|
+
amountIn: bigint; minOut: bigint;
|
|
117
|
+
memberBase?: string; quoteTokenProgram: string; config?: string; destination?: string; openMemberBase?: boolean; unwrapSol?: boolean;
|
|
118
|
+
|
|
119
|
+
quoteIsLaunch?: boolean;
|
|
120
|
+
},
|
|
121
|
+
): Instruction[] {
|
|
122
|
+
const amount = p.amountIn;
|
|
123
|
+
if (amount < 0n || amount >> 64n !== 0n) throw new RangeError("team_share_buy: amount is a u64 (0 = everything owed)");
|
|
124
|
+
const teamSlot = p.teamSlot ?? teamSlotPdaOf(p.launch, p.programId)[0];
|
|
125
|
+
const memberBase = p.memberBase ?? associatedTokenAddress(p.member, p.baseMint, TOKEN_2022_PROGRAM_ID);
|
|
126
|
+
const open = p.openMemberBase ?? p.memberBase === undefined;
|
|
127
|
+
const { quoteTokenProgram, config, destination, openMemberBase: _o, unwrapSol, quoteIsLaunch, ...buy } = p;
|
|
128
|
+
const claim = claimInstructionV2({
|
|
129
|
+
programId: p.programId, hookProgramId: p.hookProgramId, sender: p.member, wallet: p.member, quoteMint: p.quoteMint, quoteTokenProgram,
|
|
130
|
+
destination: destination ?? associatedTokenAddress(p.member, p.quoteMint, quoteTokenProgram), config: config ?? configPdaOf(p.programId)[0],
|
|
131
|
+
refOwed: null, refOwedVault: null, types: TEAM_SHARE_BUY_AND_CLAIM_TYPES_V2,
|
|
132
|
+
unwrap: (unwrapSol ?? true) && p.quoteMint === WSOL_MINT && quoteTokenProgram === TOKEN_PROGRAM_ID, quoteIsLaunch,
|
|
133
|
+
launches: [{ launch: p.launch, quoteVault: p.quoteVault, teamSlot, teamBuy: { baseMint: p.baseMint, tokenVault: p.tokenVault, walletBase: memberBase } }],
|
|
134
|
+
});
|
|
135
|
+
return [
|
|
136
|
+
...(open ? [createAssociatedTokenAccountIdempotentInstruction({ payer: p.member, owner: p.member, mint: p.baseMint, tokenProgram: TOKEN_2022_PROGRAM_ID })] : []),
|
|
137
|
+
teamShareBuyInstructionV2({ ...buy, teamSlot, memberBase }),
|
|
138
|
+
claim,
|
|
139
|
+
];
|
|
140
|
+
}
|
package/src/v2/types.ts
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { decodeAccountV2 } from "./layouts.ts";
|
|
4
|
+
import { decodeEventDataV2 } from "./events.ts";
|
|
5
|
+
|
|
6
|
+
export interface PresetRowV2Account {
|
|
7
|
+
id: number;
|
|
8
|
+
bump: number;
|
|
9
|
+
enabled: number;
|
|
10
|
+
deleted: number;
|
|
11
|
+
checked: number;
|
|
12
|
+
genesisRow: number;
|
|
13
|
+
padVersion: Uint8Array;
|
|
14
|
+
version: number;
|
|
15
|
+
rowHash: Uint8Array;
|
|
16
|
+
row: Uint8Array;
|
|
17
|
+
padEnd: Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface LaunchV2Account {
|
|
21
|
+
version: number;
|
|
22
|
+
bump: number;
|
|
23
|
+
status: number;
|
|
24
|
+
graduated: number;
|
|
25
|
+
decimals: number;
|
|
26
|
+
quoteDecimals: number;
|
|
27
|
+
presetId: number;
|
|
28
|
+
ownFees: number;
|
|
29
|
+
msClass: number;
|
|
30
|
+
flags: number;
|
|
31
|
+
nRanges: number;
|
|
32
|
+
nBands: number;
|
|
33
|
+
nC: number;
|
|
34
|
+
teamBuyRule: number;
|
|
35
|
+
listed: number;
|
|
36
|
+
padSlotRate: Uint8Array;
|
|
37
|
+
slotRateBps: number;
|
|
38
|
+
padPresetVersion: Uint8Array;
|
|
39
|
+
presetVersion: number;
|
|
40
|
+
id: bigint;
|
|
41
|
+
createdAt: bigint;
|
|
42
|
+
createdSlot: bigint;
|
|
43
|
+
creatorUnlockAt: bigint;
|
|
44
|
+
baseMint: string;
|
|
45
|
+
quoteMint: string;
|
|
46
|
+
creator: string;
|
|
47
|
+
quoteTokenProgram: string;
|
|
48
|
+
tokenVault: string;
|
|
49
|
+
quoteVault: string;
|
|
50
|
+
presetHash: Uint8Array;
|
|
51
|
+
phiBps: number;
|
|
52
|
+
wcBps: number;
|
|
53
|
+
psiTailBps: number;
|
|
54
|
+
teamBuyShareBps: number;
|
|
55
|
+
teamSlotMaxBps: number;
|
|
56
|
+
platformMsBps: number;
|
|
57
|
+
floorMsBps: number;
|
|
58
|
+
ckBps: number;
|
|
59
|
+
feePpm: number[];
|
|
60
|
+
feeStartPpm: number[];
|
|
61
|
+
bandWidthBps: number[];
|
|
62
|
+
bandShareBps: number[];
|
|
63
|
+
sqrtP0: bigint;
|
|
64
|
+
sqrtP: bigint;
|
|
65
|
+
sqrtF: bigint;
|
|
66
|
+
sqrtLMax: bigint;
|
|
67
|
+
sqrtFeeA: bigint;
|
|
68
|
+
sqrtFeeB: bigint;
|
|
69
|
+
quoteUsdCentsX64: bigint;
|
|
70
|
+
bandEdge: bigint[];
|
|
71
|
+
rngSqrtA: bigint[];
|
|
72
|
+
rngSqrtB: bigint[];
|
|
73
|
+
rngTokens: bigint[];
|
|
74
|
+
rngAskLeft: bigint[];
|
|
75
|
+
rngBack: bigint[];
|
|
76
|
+
rngPlace: bigint[];
|
|
77
|
+
rngMsCapPpm: number[];
|
|
78
|
+
rngThetaBps: number[];
|
|
79
|
+
rngPsiBps: number[];
|
|
80
|
+
rngKind: number[];
|
|
81
|
+
rngClass: number[];
|
|
82
|
+
supply: bigint;
|
|
83
|
+
deadTokens: bigint;
|
|
84
|
+
floor: bigint;
|
|
85
|
+
floorTokens: bigint;
|
|
86
|
+
bandMoney: bigint[];
|
|
87
|
+
bandTokens: bigint[];
|
|
88
|
+
bandF: bigint[];
|
|
89
|
+
bandFClaim: bigint[];
|
|
90
|
+
ckAtF: bigint;
|
|
91
|
+
ckFloorTokens: bigint;
|
|
92
|
+
msBooked: bigint[];
|
|
93
|
+
msPaid: bigint[];
|
|
94
|
+
creatorOwed: bigint;
|
|
95
|
+
platformOwed: bigint;
|
|
96
|
+
cutOwed: bigint;
|
|
97
|
+
holderOwed: bigint;
|
|
98
|
+
slotOwedTotal: bigint;
|
|
99
|
+
slotOwed: bigint[];
|
|
100
|
+
slotWeightPpb: number[];
|
|
101
|
+
creatorRef: string[];
|
|
102
|
+
creatorRefOwed: bigint[];
|
|
103
|
+
teamBuyOwed: bigint[];
|
|
104
|
+
teamBuyClaimed: bigint[];
|
|
105
|
+
slotBoughtOwed: bigint[];
|
|
106
|
+
slotBoughtClaimed: bigint[];
|
|
107
|
+
teamShareBuyDay: bigint;
|
|
108
|
+
windowRaised: bigint;
|
|
109
|
+
raise: bigint;
|
|
110
|
+
volumeBuy: bigint;
|
|
111
|
+
volumeSell: bigint;
|
|
112
|
+
trades: bigint;
|
|
113
|
+
graduatedSlot: bigint;
|
|
114
|
+
creatorLocked: bigint;
|
|
115
|
+
backingCredited: bigint;
|
|
116
|
+
incinerated: bigint;
|
|
117
|
+
lastTs: bigint;
|
|
118
|
+
bookHash: Uint8Array;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface HolderPositionAccount {
|
|
122
|
+
version: number;
|
|
123
|
+
bump: number;
|
|
124
|
+
ataBump: number;
|
|
125
|
+
pad: Uint8Array;
|
|
126
|
+
launch: string;
|
|
127
|
+
owner: string;
|
|
128
|
+
amount: bigint;
|
|
129
|
+
indexSnap: bigint;
|
|
130
|
+
owed: bigint;
|
|
131
|
+
padEnd: Uint8Array;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface HolderBookAccount {
|
|
135
|
+
version: number;
|
|
136
|
+
bump: number;
|
|
137
|
+
pad: Uint8Array;
|
|
138
|
+
launch: string;
|
|
139
|
+
mint: string;
|
|
140
|
+
w: bigint;
|
|
141
|
+
index: bigint;
|
|
142
|
+
carry: bigint;
|
|
143
|
+
bookedTotal: bigint;
|
|
144
|
+
paidTotal: bigint;
|
|
145
|
+
padEnd: Uint8Array;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface DeadMarkAccount {
|
|
149
|
+
version: number;
|
|
150
|
+
bump: number;
|
|
151
|
+
pad: Uint8Array;
|
|
152
|
+
counted: bigint;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface LaunchCreatedV2EventV2 {
|
|
156
|
+
launch: string;
|
|
157
|
+
mint: string;
|
|
158
|
+
quoteMint: string;
|
|
159
|
+
creator: string;
|
|
160
|
+
id: bigint;
|
|
161
|
+
presetId: number;
|
|
162
|
+
presetVersion: number;
|
|
163
|
+
presetHash: Uint8Array;
|
|
164
|
+
p0X64: bigint;
|
|
165
|
+
raise: bigint;
|
|
166
|
+
windowTokens: bigint;
|
|
167
|
+
creatorBuyTokens: bigint;
|
|
168
|
+
createFee: bigint;
|
|
169
|
+
name: Uint8Array;
|
|
170
|
+
symbol: Uint8Array;
|
|
171
|
+
slot: bigint;
|
|
172
|
+
ts: bigint;
|
|
173
|
+
listed: boolean;
|
|
174
|
+
quoteUsdCentsX64: bigint;
|
|
175
|
+
nativeCreateFee: bigint;
|
|
176
|
+
rowVersion: number;
|
|
177
|
+
sqrtP0: bigint;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface TradeEventV2 {
|
|
181
|
+
launch: string;
|
|
182
|
+
trader: string;
|
|
183
|
+
isBuy: boolean;
|
|
184
|
+
quoteGross: bigint;
|
|
185
|
+
quoteNet: bigint;
|
|
186
|
+
refund: bigint;
|
|
187
|
+
tokens: bigint;
|
|
188
|
+
fees: bigint[];
|
|
189
|
+
traderRef: bigint;
|
|
190
|
+
fromResale: bigint;
|
|
191
|
+
fromFirst: bigint;
|
|
192
|
+
unfilled: bigint;
|
|
193
|
+
sqrtBefore: bigint;
|
|
194
|
+
sqrtAfter: bigint;
|
|
195
|
+
sqrtF: bigint;
|
|
196
|
+
floor: bigint;
|
|
197
|
+
cushion: bigint;
|
|
198
|
+
sCirc: bigint;
|
|
199
|
+
steps: number;
|
|
200
|
+
budgetHit: boolean;
|
|
201
|
+
slot: bigint;
|
|
202
|
+
ts: bigint;
|
|
203
|
+
kind: number;
|
|
204
|
+
creatorRef: bigint;
|
|
205
|
+
recipient: string;
|
|
206
|
+
bidMoney: bigint;
|
|
207
|
+
msPaid: bigint[];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface HolderPositionOpenedEventV2 {
|
|
211
|
+
launch: string;
|
|
212
|
+
owner: string;
|
|
213
|
+
amount: bigint;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface HolderPositionClosedEventV2 {
|
|
217
|
+
launch: string;
|
|
218
|
+
owner: string;
|
|
219
|
+
amount: bigint;
|
|
220
|
+
paid: bigint;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface HolderIndexRolledEventV2 {
|
|
224
|
+
launch: string;
|
|
225
|
+
index: bigint;
|
|
226
|
+
wMatured: bigint;
|
|
227
|
+
wPending: bigint;
|
|
228
|
+
carry: bigint;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface DeadSyncedEventV2 {
|
|
232
|
+
launch: string;
|
|
233
|
+
added: bigint;
|
|
234
|
+
deadTokens: bigint;
|
|
235
|
+
sCirc: bigint;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface GenesisRaiseBoughtEventV2 {
|
|
239
|
+
launch: string;
|
|
240
|
+
trader: string;
|
|
241
|
+
isBuy: boolean;
|
|
242
|
+
quoteGross: bigint;
|
|
243
|
+
quoteNet: bigint;
|
|
244
|
+
refund: bigint;
|
|
245
|
+
tokens: bigint;
|
|
246
|
+
fees: bigint[];
|
|
247
|
+
traderRef: bigint;
|
|
248
|
+
fromResale: bigint;
|
|
249
|
+
fromFirst: bigint;
|
|
250
|
+
unfilled: bigint;
|
|
251
|
+
sqrtBefore: bigint;
|
|
252
|
+
sqrtAfter: bigint;
|
|
253
|
+
sqrtF: bigint;
|
|
254
|
+
floor: bigint;
|
|
255
|
+
cushion: bigint;
|
|
256
|
+
sCirc: bigint;
|
|
257
|
+
steps: number;
|
|
258
|
+
budgetHit: boolean;
|
|
259
|
+
slot: bigint;
|
|
260
|
+
ts: bigint;
|
|
261
|
+
kind: number;
|
|
262
|
+
creatorRef: bigint;
|
|
263
|
+
recipient: string;
|
|
264
|
+
bidMoney: bigint;
|
|
265
|
+
msPaid: bigint[];
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export type FloorEventV2Typed =
|
|
269
|
+
| { name: "LaunchCreatedV2"; fields: LaunchCreatedV2EventV2 }
|
|
270
|
+
| { name: "Trade"; fields: TradeEventV2 }
|
|
271
|
+
| { name: "HolderPositionOpened"; fields: HolderPositionOpenedEventV2 }
|
|
272
|
+
| { name: "HolderPositionClosed"; fields: HolderPositionClosedEventV2 }
|
|
273
|
+
| { name: "HolderIndexRolled"; fields: HolderIndexRolledEventV2 }
|
|
274
|
+
| { name: "DeadSynced"; fields: DeadSyncedEventV2 }
|
|
275
|
+
| { name: "GenesisRaiseBought"; fields: GenesisRaiseBoughtEventV2 };
|
|
276
|
+
|
|
277
|
+
export const decodePresetRowV2Typed = (d: Uint8Array): PresetRowV2Account => decodeAccountV2("PresetRowV2", d) as PresetRowV2Account;
|
|
278
|
+
export const decodeLaunchV2Typed = (d: Uint8Array): LaunchV2Account => decodeAccountV2("LaunchV2", d) as LaunchV2Account;
|
|
279
|
+
export const decodeHolderPositionTyped = (d: Uint8Array): HolderPositionAccount => decodeAccountV2("HolderPosition", d) as HolderPositionAccount;
|
|
280
|
+
export const decodeHolderBookTyped = (d: Uint8Array): HolderBookAccount => decodeAccountV2("HolderBook", d) as HolderBookAccount;
|
|
281
|
+
export const decodeDeadMarkTyped = (d: Uint8Array): DeadMarkAccount => decodeAccountV2("DeadMark", d) as DeadMarkAccount;
|
|
282
|
+
|
|
283
|
+
export const decodeEventV2Typed = (d: Uint8Array): FloorEventV2Typed | null => decodeEventDataV2(d) as FloorEventV2Typed | null;
|
|
284
|
+
export type { DevBuy, DevBuyRole } from "./devbuy.ts";
|
package/dist/adapter.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ChainRef } from './chain.js';
|
|
2
|
-
import type { Launch, LaunchRef, Quote, Side, TradeParams, UnsignedTx, Amount } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* What a chain package implements. `@floorlaunchpad/sdk-evm` and `@floorlaunchpad/sdk-solana` each export one factory
|
|
5
|
-
* that returns this. Reads are network calls; `build*` returns an unsigned transaction and never signs.
|
|
6
|
-
*/
|
|
7
|
-
export interface FloorChainAdapter {
|
|
8
|
-
/** The chains this adapter instance serves. */
|
|
9
|
-
readonly chains: readonly ChainRef[];
|
|
10
|
-
getLaunch(ref: LaunchRef): Promise<Launch>;
|
|
11
|
-
/** Paged, newest first. `cursor` is opaque and adapter-specific. */
|
|
12
|
-
listLaunches(chain: ChainRef, opts?: {
|
|
13
|
-
readonly limit?: number;
|
|
14
|
-
readonly cursor?: string;
|
|
15
|
-
}): Promise<{
|
|
16
|
-
readonly launches: readonly Launch[];
|
|
17
|
-
readonly cursor: string | null;
|
|
18
|
-
}>;
|
|
19
|
-
/**
|
|
20
|
-
* `trader` is used where a venue checks the seller's own state: a Solana sell-back before graduation pays the same
|
|
21
|
-
* fixed-price amount to any seller, and `trader` is read only to check that their sale position covers `amountIn`.
|
|
22
|
-
*/
|
|
23
|
-
quote(ref: LaunchRef, side: Side, amountIn: Amount, opts?: {
|
|
24
|
-
readonly trader?: string;
|
|
25
|
-
}): Promise<Quote>;
|
|
26
|
-
buildTrade(params: TradeParams): Promise<UnsignedTx>;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=adapter.d.ts.map
|
package/dist/adapter.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAElG;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC;IACrC,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,oEAAoE;IACpE,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAC/K;;;OAGG;IACH,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IACzG,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACtD"}
|
package/dist/adapter.js
DELETED