@floorlaunchpad/sdk 0.3.2 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +94 -0
- package/README.md +16 -0
- package/dist/abi/evm.gen.js +6 -1
- package/dist/abi/solana.gen.js +1 -1
- package/dist/client/evm/index.js +16 -2
- package/dist/client/solana/index.js +31 -14
- package/dist/config/generated.js +26864 -402
- package/dist/config/registry.gen.js +33 -2
- package/dist/evm/chains.js +85 -16
- package/dist/evm/floor/abi.gen.js +1 -1
- package/dist/evm/floor/events.js +9 -1
- package/dist/evm/floor/legacy-events.js +25 -0
- package/dist/evm/router.js +25 -1
- package/dist/evm/squid.js +9 -9
- package/dist/evm/zap.js +148 -35
- package/dist/indexer/bodies.js +96 -17
- package/dist/indexer/client.js +36 -14
- package/dist/indexer/contract.js +178 -28
- package/dist/indexer/partners.js +3 -2
- package/dist/indexer/paths.js +87 -29
- package/dist/indexer/read.js +30 -15
- package/dist/indexer/search.js +130 -0
- package/dist/indexer/stack-edge.js +35 -0
- package/dist/indexer/stream.js +70 -23
- package/dist/math/v2/split.js +11 -3
- package/dist/solana/floor/events.js +1 -1
- package/dist/solana/floor/genesis.js +9 -3
- package/dist/solana/floor/instructions.js +14 -5
- package/dist/solana/floor/registry.js +4 -0
- package/dist/v2/devbuy.js +6 -4
- package/dist/v2/presetRowEvm.js +21 -2
- package/dist/v2/solana.js +17 -2
- package/dist/v2/tx/solana.js +1 -1
- package/docs/aggregator.md +22 -0
- package/docs/bot.md +44 -1
- package/docs/cursor-pages.md +58 -0
- package/docs/floor-line.md +9 -4
- package/docs/frontend.md +2 -0
- package/docs/wallet.md +2 -0
- package/examples/floor-line.html +6 -6
- package/package.json +1 -1
- package/src/abi/evm.gen.ts +6 -1
- package/src/abi/solana.gen.ts +1 -1
- package/src/client/evm/index.ts +16 -2
- package/src/client/solana/index.ts +31 -14
- package/src/client/types.ts +1 -1
- package/src/config/generated.ts +26864 -402
- package/src/config/index.ts +9 -2
- package/src/config/registry.gen.ts +33 -2
- package/src/events/types.gen.ts +2 -1
- package/src/evm/chains.ts +94 -15
- package/src/evm/floor/abi.gen.ts +1 -1
- package/src/evm/floor/events.ts +11 -1
- package/src/evm/floor/legacy-events.ts +27 -0
- package/src/evm/router.ts +26 -1
- package/src/evm/squid.ts +9 -9
- package/src/evm/zap.ts +185 -36
- package/src/indexer/bodies.ts +106 -17
- package/src/indexer/client.ts +56 -30
- package/src/indexer/contract.ts +197 -29
- package/src/indexer/partners.ts +3 -2
- package/src/indexer/paths.ts +131 -29
- package/src/indexer/read.ts +36 -17
- package/src/indexer/search.ts +138 -0
- package/src/indexer/stack-edge.ts +46 -0
- package/src/indexer/stream.ts +78 -24
- package/src/math/v2/split.ts +11 -3
- package/src/solana/floor/events.ts +1 -1
- package/src/solana/floor/genesis.ts +8 -2
- package/src/solana/floor/instructions.ts +13 -5
- package/src/solana/floor/registry.ts +4 -0
- package/src/v2/devbuy.ts +6 -4
- package/src/v2/presetRowEvm.ts +21 -2
- package/src/v2/solana.ts +20 -3
- package/src/v2/tx/solana.ts +1 -1
package/dist/indexer/read.js
CHANGED
|
@@ -9,11 +9,14 @@ import { errorCode } from "./contract.js";
|
|
|
9
9
|
export * from "./bodies.js";
|
|
10
10
|
export { ShapeError, decode } from "./decode.js";
|
|
11
11
|
|
|
12
|
-
export { FIRSTS_MAX, IDS_MAX, INDEXER_ROUTES, LAUNCHES_PAGE_MAX, LAUNCH_SORTS, STREAM_STATE_MAX, indexerPath, query } from "./paths.js";
|
|
12
|
+
export { FIRSTS_MAX, IDS_MAX, INDEXER_ROUTES, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PRESET_FILTER_MAX, STREAM_STATE_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX, indexerPath, query } from "./paths.js";
|
|
13
|
+
export { ADDRESS_PREFIX_MIN, SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX, SEARCH_PARITY_CORPUS, SEARCH_Q_MAX, SEARCH_SUBSTRING_MIN, searchFold, searchNeedle, searchNeedles, searchServed, searchServedTier, searchTier, searchTierFolded } from "./search.js";
|
|
14
|
+
|
|
13
15
|
export * from "./partners.js";
|
|
14
|
-
export
|
|
16
|
+
export * from "./stack-edge.js";
|
|
17
|
+
export { INDEXER_CONTRACT, INDEXER_ERROR_CODES, LIMITS, OPEN_ROUTES, ROUTE_NAMES, UNITS, clampLimit, errorCode, matchRoute, pageAsked, pageLimit, queryArg, queryBool, queryLimit, queryRefusal, routeLimit, spanRefusal } from "./contract.js";
|
|
15
18
|
|
|
16
|
-
export { createIndexerClient, routePath } from "./client.js";
|
|
19
|
+
export { DRAIN_NAMES, createIndexerClient, routePath } from "./client.js";
|
|
17
20
|
|
|
18
21
|
export class IndexerError extends Error {
|
|
19
22
|
status ;
|
|
@@ -53,8 +56,11 @@ export const readFloorRouted = (get ) => readRoute(g
|
|
|
53
56
|
|
|
54
57
|
export const readEvents = (get , fromBlock , toBlock ) => readRoute(get, indexerPath.events(fromBlock, toBlock), B.EVENTS);
|
|
55
58
|
|
|
59
|
+
export const readLaunchLists = (get , q ) => readRoute(get, indexerPath.launchLists(q), B.LAUNCH_LISTS);
|
|
56
60
|
export const readLaunches = (get , q = {}) => readRoute(get, indexerPath.launches(q), B.LAUNCHES);
|
|
57
61
|
|
|
62
|
+
export const readLaunchSearch = (get , q ) => readRoute(get, indexerPath.search(q), B.LAUNCH_SEARCH);
|
|
63
|
+
|
|
58
64
|
export const readLaunch = (get , id ) => readRoute(get, indexerPath.launch(id), B.LAUNCH_ONE);
|
|
59
65
|
|
|
60
66
|
export const readLaunchState = (get , id ) => readRoute(get, indexerPath.launchState(id), B.LAUNCH_STATE);
|
|
@@ -63,10 +69,10 @@ export const readMilestones = (get , id )
|
|
|
63
69
|
export const readHolders = (get , id , q = {}) => readRoute(get, indexerPath.holders(id, q), B.HOLDERS);
|
|
64
70
|
|
|
65
71
|
export const readTrades = (get , id , q = {}) => readRoute(get, indexerPath.trades(id, q), B.TRADES);
|
|
66
|
-
export const readLaunchClaims = (get , id , q
|
|
67
|
-
export const readDevBuys = (get , id ) => readRoute(get, indexerPath.devBuys(id), B.DEV_BUYS);
|
|
72
|
+
export const readLaunchClaims = (get , id , q = {}) => readRoute(get, indexerPath.launchClaims(id, q), B.LAUNCH_CLAIMS);
|
|
73
|
+
export const readDevBuys = (get , id , q = {}) => readRoute(get, indexerPath.devBuys(id, q), B.DEV_BUYS);
|
|
68
74
|
|
|
69
|
-
export const readMemberSold = (get , id ) => readRoute(get, indexerPath.memberSold(id), B.MEMBER_SOLD);
|
|
75
|
+
export const readMemberSold = (get , id , q = {}) => readRoute(get, indexerPath.memberSold(id, q), B.MEMBER_SOLD);
|
|
70
76
|
|
|
71
77
|
export const readLaunchAccount = (get , id ) => readRoute(get, indexerPath.launchAccount(id), B.LAUNCH_ACCOUNT);
|
|
72
78
|
|
|
@@ -81,31 +87,35 @@ export const readTraders = (get , id , q
|
|
|
81
87
|
export const readQuoteChain = (get , id ) => readRoute(get, indexerPath.quoteChain(id), B.QUOTE_CHAIN);
|
|
82
88
|
|
|
83
89
|
export const readDevTrades = (get , id , q = {}) => readRoute(get, indexerPath.devTrades(id, q), B.DEV_TRADES);
|
|
84
|
-
export const readBurns = (get , id ) => readRoute(get, indexerPath.burns(id), B.BURNS);
|
|
90
|
+
export const readBurns = (get , id , q = {}) => readRoute(get, indexerPath.burns(id, q), B.BURNS);
|
|
85
91
|
export const readLaunchLocks = (get , id ) => readRoute(get, indexerPath.launchLocks(id), B.LAUNCH_LOCKS);
|
|
86
92
|
|
|
87
93
|
export const readMarks = (get , id , q = {}) => readRoute(get, indexerPath.marks(id, q), B.MARKS);
|
|
88
94
|
export const readPrice = (get , id ) => readRoute(get, indexerPath.price(id), B.PRICE);
|
|
89
95
|
|
|
90
96
|
export const readCandles = (get , q ) => readRoute(get, indexerPath.candles(q), B.CANDLES);
|
|
97
|
+
|
|
98
|
+
export const readCandlesMany = (get , q ) => readRoute(get, indexerPath.candlesMany(q), B.CANDLES_MANY);
|
|
91
99
|
export const readCandleBundle = (get , id , q = {}) => readRoute(get, indexerPath.candleBundle(id, q), B.CANDLE_BUNDLE);
|
|
92
100
|
export const readHighs = (get , id , q = {}) => readRoute(get, indexerPath.highs(id, q), B.HIGHS);
|
|
93
101
|
|
|
94
102
|
export const readWalletTrades = (get , wallet , q = {}) => readRoute(get, indexerPath.walletTrades(wallet, q), B.WALLET_TRADES);
|
|
95
|
-
export const
|
|
103
|
+
export const readTonActivity = (get , wallet , q = {}) => readRoute(get, indexerPath.tonActivity(wallet, q), B.TON_ACTIVITY);
|
|
104
|
+
export const readTonOutcome = (get , wallet , queryId ) => readRoute(get, indexerPath.tonOutcome(wallet, queryId), B.TON_OUTCOME);
|
|
105
|
+
export const readPositions = (get , wallet , q = {}) => readRoute(get, indexerPath.positions(wallet, q), B.POSITIONS);
|
|
96
106
|
|
|
97
|
-
export const readInbox = (get , wallet , q
|
|
98
|
-
export const readWalletLocks = (get , wallet ) => readRoute(get, indexerPath.walletLocks(wallet), B.WALLET_LOCKS);
|
|
99
|
-
export const readClaimHistory = (get , wallet ) => readRoute(get, indexerPath.claimHistory(wallet), B.CLAIM_HISTORY);
|
|
107
|
+
export const readInbox = (get , wallet , q = {}) => readRoute(get, indexerPath.inbox(wallet, q), B.INBOX);
|
|
108
|
+
export const readWalletLocks = (get , wallet , q = {}) => readRoute(get, indexerPath.walletLocks(wallet, q), B.WALLET_LOCKS);
|
|
109
|
+
export const readClaimHistory = (get , wallet , q = {}) => readRoute(get, indexerPath.claimHistory(wallet, q), B.CLAIM_HISTORY);
|
|
100
110
|
|
|
101
|
-
export const readClaimView = (get , wallet ) => readRoute(get, indexerPath.claimView(wallet), B.CLAIM_VIEW);
|
|
111
|
+
export const readClaimView = (get , wallet , q = {}) => readRoute(get, indexerPath.claimView(wallet, q), B.CLAIM_VIEW);
|
|
102
112
|
export const readFirsts = (get , wallet ) => readRoute(get, indexerPath.firsts(wallet), B.FIRSTS);
|
|
103
113
|
|
|
104
114
|
export const readFirstsMany = (get , wallets ) => readRoute(get, indexerPath.firstsMany(wallets), B.FIRSTS_MANY);
|
|
105
|
-
export const readPeople = (get , wallet ) => readRoute(get, indexerPath.people(wallet), B.PEOPLE);
|
|
106
|
-
export const readRoles = (get , wallet ) => readRoute(get, indexerPath.roles(wallet), B.ROLES);
|
|
115
|
+
export const readPeople = (get , wallet , q = {}) => readRoute(get, indexerPath.people(wallet, q), B.PEOPLE);
|
|
116
|
+
export const readRoles = (get , wallet , q = {}) => readRoute(get, indexerPath.roles(wallet, q), B.ROLES);
|
|
107
117
|
|
|
108
|
-
export const readHandlePlaces = (get , handle ) => readRoute(get, indexerPath.handlePlaces(handle), B.HANDLE_PLACES);
|
|
118
|
+
export const readHandlePlaces = (get , handle , q = {}) => readRoute(get, indexerPath.handlePlaces(handle, q), B.HANDLE_PLACES);
|
|
109
119
|
|
|
110
120
|
export const readTraderBoard = (get , q = {}) => readRoute(get, indexerPath.traderBoard(q), B.TRADER_BOARD);
|
|
111
121
|
export const readLauncherBoard = (get , q = {}) => readRoute(get, indexerPath.launcherBoard(q), B.LAUNCHER_BOARD);
|
|
@@ -120,3 +130,8 @@ export function offPriceBps(price , quotedX64
|
|
|
120
130
|
if (p === 0n) return null;
|
|
121
131
|
return Number(((quotedX64 - p) * 10_000n) / p);
|
|
122
132
|
}
|
|
133
|
+
|
|
134
|
+
export function cursorPage (body , rows ) {
|
|
135
|
+
if (body.next === undefined) throw new Error(`not a page: the body has no next (rows ${rows})`);
|
|
136
|
+
return { rows: body[rows], next: body.next };
|
|
137
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export const SEARCH_Q_MAX = 64;
|
|
4
|
+
|
|
5
|
+
export const SEARCH_PAGE_DEFAULT = 12;
|
|
6
|
+
|
|
7
|
+
export const SEARCH_PAGE_MAX = 100;
|
|
8
|
+
|
|
9
|
+
export const ADDRESS_PREFIX_MIN = 4;
|
|
10
|
+
|
|
11
|
+
export const SEARCH_SUBSTRING_MIN = 3;
|
|
12
|
+
|
|
13
|
+
export function searchFold(s ) {
|
|
14
|
+
return s.normalize("NFKC").toLowerCase().replace(/\s+/g, " ").trim();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function searchNeedles(q ) {
|
|
18
|
+
const f = searchFold(q);
|
|
19
|
+
if (!f.startsWith("$")) return f === "" ? [] : [f];
|
|
20
|
+
const bare = f.slice(1).trim();
|
|
21
|
+
return bare === "" ? [f] : [bare, f];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function searchNeedle(q ) {
|
|
25
|
+
return searchNeedles(q)[0] ?? "";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function searchTierFolded(name , symbol , token , n ) {
|
|
29
|
+
if (n === "") return null;
|
|
30
|
+
if (symbol === n || name === n || token === n) return 0;
|
|
31
|
+
if (symbol.startsWith(n)) return 1;
|
|
32
|
+
if (name.startsWith(n) || name.includes(` ${n}`)) return 2;
|
|
33
|
+
if (symbol.includes(n) || name.includes(n)) return 3;
|
|
34
|
+
if (token.startsWith(n)) return 4;
|
|
35
|
+
if ((name + symbol + token).includes(n)) return 5;
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function searchServed(tier , needle ) {
|
|
40
|
+
const n = [...needle].length;
|
|
41
|
+
if (tier <= 2) return true;
|
|
42
|
+
if (tier === 3) return n >= SEARCH_SUBSTRING_MIN;
|
|
43
|
+
if (tier === 4) return n >= ADDRESS_PREFIX_MIN;
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function searchTier(l , q ) {
|
|
48
|
+
const name = searchFold(l.name ?? ""), symbol = searchFold(l.symbol ?? ""), token = searchFold(l.token);
|
|
49
|
+
let best = null;
|
|
50
|
+
for (const n of searchNeedles(q)) {
|
|
51
|
+
const t = searchTierFolded(name, symbol, token, n);
|
|
52
|
+
if (t !== null && (best === null || t < best)) best = t;
|
|
53
|
+
}
|
|
54
|
+
return best;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function searchServedTier(l , q ) {
|
|
58
|
+
const name = searchFold(l.name ?? ""), symbol = searchFold(l.symbol ?? ""), token = searchFold(l.token);
|
|
59
|
+
let best = null;
|
|
60
|
+
for (const n of searchNeedles(q)) {
|
|
61
|
+
const t = searchTierFolded(name, symbol, token, n);
|
|
62
|
+
if (t !== null && searchServed(t, n) && (best === null || t < best)) best = t;
|
|
63
|
+
}
|
|
64
|
+
return best;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const SOL = "So11111111111111111111111111111111111111112";
|
|
68
|
+
const EVM = "0xabCDeF0123456789AbcdEf0123456789aBCDEF01";
|
|
69
|
+
|
|
70
|
+
export const SEARCH_PARITY_CORPUS = [
|
|
71
|
+
|
|
72
|
+
["Doge Wif Hat", "WIF", SOL, "wif", 0],
|
|
73
|
+
["Doge Wif Hat", "WIF", SOL, "WIF", 0],
|
|
74
|
+
["Doge Wif Hat", "WIF", SOL, "$wif", 0],
|
|
75
|
+
["Doge Wif Hat", "WIF", SOL, " doge wif hat ", 0],
|
|
76
|
+
["Doge Wif Hat", "WIF", SOL, SOL, 0],
|
|
77
|
+
["Doge Wif Hat", "WIF", EVM, EVM.toLowerCase(), 0],
|
|
78
|
+
["Doge Wif Hat", "WIF", EVM, EVM.toUpperCase().replace("0X", "0x"), 0],
|
|
79
|
+
["FLOOR", "FLR", SOL, "flr", 0],
|
|
80
|
+
["Café", "CAFE", SOL, "café", 0],
|
|
81
|
+
["Café", "CF", SOL, "café", 0],
|
|
82
|
+
["Ⅻ Club", "XII", SOL, "xii", 0],
|
|
83
|
+
["Dog", "DOG", SOL, "$dog", 0],
|
|
84
|
+
|
|
85
|
+
["Moon Rocket", "MOONR", SOL, "moo", 1],
|
|
86
|
+
["Moon Rocket", "MOONR", SOL, "$MOO", 1],
|
|
87
|
+
["Moon Rocket", "MOONR", SOL, "moo", 1],
|
|
88
|
+
|
|
89
|
+
["Moon Rocket", "MR", SOL, "moon", 2],
|
|
90
|
+
["Moon Rocket", "MR", SOL, "rock", 2],
|
|
91
|
+
["Moon Rocket", "MR", SOL, "moon rock", 2],
|
|
92
|
+
["Moon\tRocket", "MR", SOL, "moon r", 2],
|
|
93
|
+
["The Big Dog", "TBD", SOL, "big d", 2],
|
|
94
|
+
|
|
95
|
+
["Moon Rocket", "MR", SOL, "ocke", 3],
|
|
96
|
+
["Moon Rocket", "XMOONX", SOL, "oon", 3],
|
|
97
|
+
["Pepe", "PEPE", SOL, "ep", 3],
|
|
98
|
+
["Pepe Coin", "PC", SOL, "pe c", 3],
|
|
99
|
+
|
|
100
|
+
["Moon Rocket", "MR", SOL, "so1", 4],
|
|
101
|
+
["Moon Rocket", "MR", SOL, "so11", 4],
|
|
102
|
+
["Moon Rocket", "MR", EVM, "0xab", 4],
|
|
103
|
+
["Moon Rocket", "MR", EVM, "0xA", 4],
|
|
104
|
+
|
|
105
|
+
["Moon Rocket", "MR", SOL, "1111", 5],
|
|
106
|
+
["Moon Rocket", "MR", EVM, "cdef01", 5],
|
|
107
|
+
["Moon Rocket", "MR", SOL, "rocketmr", 5],
|
|
108
|
+
["Moon Rocket", "MR", SOL, "mrso", 5],
|
|
109
|
+
|
|
110
|
+
[null, "ZED", SOL, "zed", 0],
|
|
111
|
+
[null, null, SOL, "zed", null],
|
|
112
|
+
["Zed", null, SOL, "ze", 2],
|
|
113
|
+
[null, null, SOL, "so11", 4],
|
|
114
|
+
|
|
115
|
+
["Moon Rocket", "MR", SOL, "venus", null],
|
|
116
|
+
["Moon Rocket", "MR", SOL, "", null],
|
|
117
|
+
["Moon Rocket", "MR", SOL, " ", null],
|
|
118
|
+
["Moon Rocket", "MR", SOL, "$", null],
|
|
119
|
+
|
|
120
|
+
["$$ Bills", "BILL", SOL, "$$", 2],
|
|
121
|
+
["Bills", "$BILL", SOL, "$$bill", 0],
|
|
122
|
+
|
|
123
|
+
["Big Money", "BM", SOL, "$ money", 2],
|
|
124
|
+
|
|
125
|
+
["$WIF Coin", "$WIF", SOL, "$wif", 0],
|
|
126
|
+
["Doge Wif Hat", "WIF", SOL, "$wif", 0],
|
|
127
|
+
["$1 Coin", "ONE", SOL, "$1", 2],
|
|
128
|
+
["Cash $ Money", "CASH", SOL, "$", 2],
|
|
129
|
+
["Cash $ Money", "CASH", SOL, " $ ", 2],
|
|
130
|
+
];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
function startBar(bars , graduatedAt ) {
|
|
4
|
+
let start = 0;
|
|
5
|
+
for (let j = 0; j < bars.length; j++) {
|
|
6
|
+
if (bars[j] .time <= graduatedAt) start = j;
|
|
7
|
+
else break;
|
|
8
|
+
}
|
|
9
|
+
return start;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function stackEdgeWalk(bars , graduatedAt , endPrice ) {
|
|
13
|
+
const out = [];
|
|
14
|
+
let m = 0;
|
|
15
|
+
for (let j = startBar(bars, graduatedAt); j < bars.length; j++) {
|
|
16
|
+
const b = bars[j] ;
|
|
17
|
+
if (!(b.close > 0) || !(b.high > 0)) continue;
|
|
18
|
+
m = Math.max(m, b.high);
|
|
19
|
+
if (endPrice !== null && endPrice > 0 && m >= endPrice) break;
|
|
20
|
+
out.push({ i: j, edge: m });
|
|
21
|
+
}
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function stackEdgeEnd(bars , graduatedAt , endPrice ) {
|
|
26
|
+
if (endPrice === null || !(endPrice > 0)) return null;
|
|
27
|
+
let m = 0;
|
|
28
|
+
for (let j = startBar(bars, graduatedAt); j < bars.length; j++) {
|
|
29
|
+
const b = bars[j] ;
|
|
30
|
+
if (!(b.close > 0) || !(b.high > 0)) continue;
|
|
31
|
+
m = Math.max(m, b.high);
|
|
32
|
+
if (m >= endPrice) return j;
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
package/dist/indexer/stream.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { decode, int, nullable, object, str, unknown } from "./decode.js";
|
|
3
|
+
import { decode, int, nullable, object, optional, str, unknown } from "./decode.js";
|
|
4
4
|
import { HEAD, LIVE_LAUNCH, TRADE } from "./bodies.js";
|
|
5
5
|
|
|
6
6
|
import { indexerPath } from "./paths.js";
|
|
7
7
|
|
|
8
|
-
const HELLO = object({ head: HEAD, window: int, oldest: nullable(str) });
|
|
8
|
+
const HELLO = object({ head: HEAD, window: int, oldest: nullable(str), epoch: optional(str) });
|
|
9
9
|
const HEAD_SEEN = object({ block: int, age: int });
|
|
10
10
|
const LAUNCH_FRAME = object({ launch: LIVE_LAUNCH });
|
|
11
11
|
const STATE = object({ launch: str, mint: str, block: int, ts: nullable(int), seq: int, prev: unknown, state: LIVE_LAUNCH });
|
|
@@ -45,27 +45,74 @@ export function decodeStreamFrame(event , data , id )
|
|
|
45
45
|
|
|
46
46
|
export function parseStreamFrames(text ) {
|
|
47
47
|
const frames = [];
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
const t = text.indexOf("\r") < 0 ? text : text.replace(/\r\n/g, "\n");
|
|
50
|
+
let at = 0;
|
|
49
51
|
let cut ;
|
|
50
|
-
while ((cut =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
52
|
+
while ((cut = t.indexOf("\n\n", at)) >= 0) {
|
|
53
|
+
frameOf(t.slice(at, cut), frames);
|
|
54
|
+
at = cut + 2;
|
|
55
|
+
}
|
|
56
|
+
return { frames, rest: at === 0 ? t : t.slice(at) };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function createStreamParser() {
|
|
60
|
+
let pieces = [];
|
|
61
|
+
let cr = false;
|
|
62
|
+
let endsNl = false;
|
|
63
|
+
const parser = {
|
|
64
|
+
push(chunk ) {
|
|
65
|
+
const frames = [];
|
|
66
|
+
let c = cr ? `\r${chunk}` : chunk;
|
|
67
|
+
cr = c.endsWith("\r");
|
|
68
|
+
if (cr) c = c.slice(0, -1);
|
|
69
|
+
if (c.indexOf("\r") >= 0) c = c.replace(/\r\n/g, "\n");
|
|
70
|
+
if (c.length === 0) return frames;
|
|
71
|
+
let at = 0;
|
|
72
|
+
|
|
73
|
+
if (endsNl && pieces.length > 0 && c.charCodeAt(0) === 10) {
|
|
74
|
+
const block = pieces.join("");
|
|
75
|
+
pieces = [];
|
|
76
|
+
frameOf(block.slice(0, -1), frames);
|
|
77
|
+
at = 1;
|
|
78
|
+
}
|
|
79
|
+
let cut ;
|
|
80
|
+
while ((cut = c.indexOf("\n\n", at)) >= 0) {
|
|
81
|
+
const head = c.slice(at, cut);
|
|
82
|
+
frameOf(pieces.length > 0 ? pieces.join("") + head : head, frames);
|
|
83
|
+
pieces = [];
|
|
84
|
+
at = cut + 2;
|
|
85
|
+
}
|
|
86
|
+
if (at < c.length) {
|
|
87
|
+
pieces.push(at === 0 ? c : c.slice(at));
|
|
88
|
+
endsNl = c.charCodeAt(c.length - 1) === 10;
|
|
89
|
+
} else endsNl = false;
|
|
90
|
+
return frames;
|
|
91
|
+
},
|
|
92
|
+
rest() {
|
|
93
|
+
const r = pieces.join("");
|
|
94
|
+
pieces = r.length > 0 ? [r] : [];
|
|
95
|
+
return cr ? `${r}\r` : r;
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
return parser;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function frameOf(block , frames ) {
|
|
102
|
+
let event = "message";
|
|
103
|
+
let id ;
|
|
104
|
+
const data = [];
|
|
105
|
+
let comment = null;
|
|
106
|
+
for (const line of block.split("\n")) {
|
|
107
|
+
if (line.startsWith(":")) comment = line.slice(1).trim();
|
|
108
|
+
else if (line.startsWith("event:")) event = line.slice(6).trim();
|
|
109
|
+
else if (line.startsWith("id:")) id = line.slice(3).trim();
|
|
110
|
+
else if (line.startsWith("data:")) data.push(line.slice(5).replace(/^ /, ""));
|
|
111
|
+
}
|
|
112
|
+
if (data.length === 0) {
|
|
113
|
+
if (comment !== null) frames.push({ event: "comment", text: comment });
|
|
114
|
+
return;
|
|
69
115
|
}
|
|
70
|
-
|
|
116
|
+
const f = decodeStreamFrame(event, JSON.parse(data.join("\n")), id);
|
|
117
|
+
if (f !== null) frames.push(f);
|
|
71
118
|
}
|
package/dist/math/v2/split.js
CHANGED
|
@@ -23,7 +23,7 @@ const flatUp = (s , n ) => ov(flatMoneyForTokens(s, n, UP));
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
export function splitRowOfRowV2(r
|
|
26
|
+
export function splitRowOfRowV2(r ) {
|
|
27
27
|
const ck = r.ckTargetBps ?? r.ckBps;
|
|
28
28
|
if (!Number.isInteger(ck)) throw new RangeError("splitRowOfRowV2: the row has no C + K share (`ckTargetBps`)");
|
|
29
29
|
if (r.ckTargetBps !== undefined && r.ckBps !== undefined && r.ckTargetBps !== r.ckBps) {
|
|
@@ -32,7 +32,8 @@ export function splitRowOfRowV2(r
|
|
|
32
32
|
return {
|
|
33
33
|
phiBps: r.phiBps,
|
|
34
34
|
ckBps: ck ,
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
wcBps: r.wcBps ?? 300,
|
|
36
37
|
cShareBps: 5_000,
|
|
37
38
|
msClass: r.msClass,
|
|
38
39
|
platformMsBps: (r.flags & 1) !== 0 ? r.platformMsBps : 0,
|
|
@@ -40,12 +41,19 @@ export function splitRowOfRowV2(r
|
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
export function surplus(sqrtF , back , n ) {
|
|
45
|
+
const base = flatMoneyForTokens(sqrtF, n, UP);
|
|
46
|
+
return base === null || base === undefined ? 0n : sat(back, base);
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
export function split(row , ranges , inp , pieces ) {
|
|
44
50
|
let tokensSum = 0n;
|
|
45
51
|
for (const p of pieces) tokensSum += p.tokens;
|
|
46
52
|
let sr = inp.sNew - tokensSum;
|
|
47
53
|
if (sr < 0n) fail("Overflow");
|
|
48
54
|
let fr = inp.fTotal;
|
|
55
|
+
|
|
56
|
+
const s0 = surplus(inp.sqrtF, fr + inp.fClaims, sr + inp.held);
|
|
49
57
|
const phi = BigInt(row.phiBps);
|
|
50
58
|
let ckAdd = 0n;
|
|
51
59
|
let ms = 0n;
|
|
@@ -61,7 +69,7 @@ export function split(row , ranges , inp , pie
|
|
|
61
69
|
const capB = cdiv(cdiv(pc.money * inp.sqrtF, lo) * inp.sqrtF, lo);
|
|
62
70
|
const cap = min(max(capA, capB), pc.money);
|
|
63
71
|
const n = sr + inp.held;
|
|
64
|
-
const needAll = max(flatUp(inp.sqrtF, n), cdiv(flatUp(pc.sqrtHi, n) * phi, 10_000n));
|
|
72
|
+
const needAll = max(flatUp(inp.sqrtF, n) + s0, cdiv(flatUp(pc.sqrtHi, n) * phi, 10_000n));
|
|
65
73
|
if (r.kind !== KIND_TAIL) topNeed = needAll;
|
|
66
74
|
const need = sat(needAll, fr + inp.fClaims);
|
|
67
75
|
const dF = min(cap, need);
|
|
@@ -9,7 +9,7 @@ const S = (...f ) => f;
|
|
|
9
9
|
export const EVENTS = {
|
|
10
10
|
LaunchCreated: S(["launch", "pubkey"], ["mint", "pubkey"], ["quoteMint", "pubkey"], ["creator", "pubkey"], ["id", "u64"], ["presetId", "u8"], ["presetVersion", "u32"], ["presetHash", "bytes:32"], ["p0X64", "u128"], ["raise", "u64"], ["windowTokens", "u64"], ["creatorBuyTokens", "u64"], ["createFee", "u64"], ["name", "bytes:32"], ["symbol", "bytes:10"], ["slot", "u64"], ["ts", "i64"], ["listed", "bool"], ["quoteUsdCentsX64", "u128"], ["nativeCreateFee", "u64"]),
|
|
11
11
|
|
|
12
|
-
Graduated: S(["launch", "pubkey"], ["
|
|
12
|
+
Graduated: S(["launch", "pubkey"], ["windowPriceX64", "u128"], ["windowRaised", "u64"], ["windowTokens", "u64"], ["slot", "u64"], ["ts", "i64"], ["priceX64", "u128"]),
|
|
13
13
|
PotsSwept: S(["launch", "pubkey"], ["amount", "u64"], ["reason", "u8"]),
|
|
14
14
|
Claimed: S(["wallet", "pubkey"], ["sender", "pubkey"], ["launch", "pubkey"], ["quoteMint", "pubkey"], ["types", "u8"], ["creator", "u64"], ["creatorRef", "u64"], ["teamSlot", "u64"], ["traderRef", "u64"], ["extra", "u64"], ["amount", "u64"], ["teamBuy", "u64?"], ["shareBought", "u64?"], ["typesHi", "u8?"]),
|
|
15
15
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
import { BPS, fail } from "../../math/index.js";
|
|
4
|
+
import { WAGMI_GENESIS_KEEP_USD } from "../../math/v2/rows.js";
|
|
4
5
|
import { fixedRaiseClaim, genesisClaim, genesisWeightListed } from "../../math/genesis.js";
|
|
5
6
|
import { GENESIS_ALLOC_CLAIMED, GENESIS_ALLOC_MIGRATED, GENESIS_ALLOC_REFUNDED, GENESIS_ALLOC_WAGMI_CLAIMED } from "./accounts.js";
|
|
6
7
|
|
|
@@ -50,15 +51,20 @@ export function genesisConvertTake(want , room , quote
|
|
|
50
51
|
return [take, usdc];
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
|
|
54
55
|
|
|
55
|
-
export function genesisWaterfall(p
|
|
56
|
+
export function genesisWaterfall(p ) {
|
|
56
57
|
if (p.solConverted > p.raisedFinal) fail("Overflow");
|
|
57
58
|
const floorUsdc = p.usdcConverted < p.floorCapUsdc ? p.usdcConverted : p.floorCapUsdc;
|
|
58
59
|
const used = p.floorUsed ?? floorUsdc;
|
|
59
60
|
if (used > floorUsdc) fail("Overflow");
|
|
60
61
|
const left = p.usdcConverted - used;
|
|
61
|
-
|
|
62
|
+
|
|
63
|
+
const px = p.usdcPxX64 ?? 100n << 64n;
|
|
64
|
+
if (px <= 0n) fail("Zero");
|
|
65
|
+
const keepAll = (WAGMI_GENESIS_KEEP_USD * 100n * 10n ** BigInt(p.usdcDecimals ?? 6) << 64n) / px;
|
|
66
|
+
const keep = keepAll > U64_MAX ? U64_MAX : keepAll;
|
|
67
|
+
const wagmiOffer = p.wagmiPinned ? (left < keep ? left : keep) : 0n;
|
|
62
68
|
const wagmiUsdc = p.wagmiSpent ?? wagmiOffer;
|
|
63
69
|
if (wagmiUsdc > wagmiOffer) fail("Overflow");
|
|
64
70
|
return { floorUsdc, wagmiOffer, wagmiUsdc, usdcRefund: left - wagmiUsdc, solUnconverted: p.raisedFinal - p.solConverted };
|
|
@@ -11,6 +11,8 @@ import { Writer } from "./borsh.js";
|
|
|
11
11
|
import { CLAIM_BITS, CLAIM_KNOWN_MASKS, CLAIM_RESERVED, CLAIM_CREATOR, CLAIM_CREATOR_REF, CLAIM_TEAM_SLOT, CLAIM_TRADER_REF, CLAIM_RESERVED_HOLDER, CLAIM_EXTRA, CLAIM_TEAM_BUY, CLAIM_SHARE_BOUGHT } from "../../generated/index.js";
|
|
12
12
|
import { launchMintPda } from "./mint.js";
|
|
13
13
|
|
|
14
|
+
import { FLOOR_HOOK_PROGRAM_ID, extraAccountMetasPda, holderBookPda, holderPositionPda, quoteHookBlock } from "../../v2/solana.js";
|
|
15
|
+
|
|
14
16
|
const pid = (c ) => c?.programId ?? FLOOR_AMM_PROGRAM_ID;
|
|
15
17
|
const evPair = (c ) => [R(floorEventAuthorityPda(pid(c))[0]), R(pid(c))];
|
|
16
18
|
function ix(name , accounts , args , c ) {
|
|
@@ -74,8 +76,11 @@ export function clearTraderRefInstruction(p
|
|
|
74
76
|
return withRest(i, (p.traderRefs ?? []).map((r) => W(r)));
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
export function withdrawPlatformInstruction(p
|
|
78
|
-
|
|
79
|
+
export function withdrawPlatformInstruction(p ) {
|
|
80
|
+
const i = ix("withdraw_platform", [RS(p.authority), R(p.config), W(p.launch), R(p.quoteMint), W(p.quoteVault), W(p.destination), R(p.quoteTokenProgram)], (w) => w.u64(p.amount), p);
|
|
81
|
+
if (!p.quoteIsLaunch) return i;
|
|
82
|
+
if (!p.treasury) throw new RangeError("withdraw_platform: a launch-token quote needs the treasury (its position receives)");
|
|
83
|
+
return withRest(i, quoteHookBlock(p.quoteMint, p.treasury, [p.launch], p));
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
export function checkPresetInstruction(p ) {
|
|
@@ -188,12 +193,16 @@ export function openRefOwedInstruction(p
|
|
|
188
193
|
return ix("open_ref_owed", [WS(p.payer), R(p.quoteMint), W(p.refOwed), W(p.vault), R(p.quoteTokenProgram), R(ASSOCIATED_TOKEN_PROGRAM_ID), R(SYSTEM_PROGRAM_ID)], (w) => w.pubkey(p.referrer), p);
|
|
189
194
|
}
|
|
190
195
|
|
|
191
|
-
export function rollUpRefsInstruction(p
|
|
196
|
+
export function rollUpRefsInstruction(p ) {
|
|
192
197
|
if (p.traderRefs.length > 255) throw new RangeError("at most 255 links a roll-up");
|
|
193
198
|
const base = ix("roll_up_refs", [R(p.quoteMint), R(p.quoteTokenProgram)], (w) => w.u8(p.traderRefs.length), p);
|
|
194
199
|
const rest = [];
|
|
195
|
-
|
|
196
|
-
|
|
200
|
+
const hook = p.hookProgramId;
|
|
201
|
+
const ql = p.quoteIsLaunch ? launchPda(p.quoteMint, pid(p))[0] : "";
|
|
202
|
+
const pos = (owner ) => (p.quoteIsLaunch ? [W(holderPositionPda(ql, owner, hook)[0])] : []);
|
|
203
|
+
for (const t of p.traderRefs) rest.push(W(t.traderRef), W(t.escrow), ...pos(t.traderRef));
|
|
204
|
+
for (const r of p.refOwed) rest.push(W(r.refOwed), W(r.vault), ...pos(r.refOwed));
|
|
205
|
+
if (p.quoteIsLaunch) rest.push(R(extraAccountMetasPda(p.quoteMint, hook)[0]), R(ql), W(holderBookPda(ql, hook)[0]), R(hook ?? FLOOR_HOOK_PROGRAM_ID));
|
|
197
206
|
return { ...base, accounts: [...base.accounts, ...rest] };
|
|
198
207
|
}
|
|
199
208
|
|
|
@@ -60,6 +60,10 @@ export function nextClaimsPage(pages ) {
|
|
|
60
60
|
return last.count < CLAIMS_PAGE_ENTRIES ? last.page : last.page + 1;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
export function hookClaimsPage(pages ) {
|
|
64
|
+
return pages.length === 0 ? 0 : pages[pages.length - 1].page;
|
|
65
|
+
}
|
|
66
|
+
|
|
63
67
|
function ix(name , accounts , args , programId = FLOOR_AMM_PROGRAM_ID) {
|
|
64
68
|
const ev = floorEventAuthorityPda(programId)[0];
|
|
65
69
|
return { programAddress: programId, accounts: [...accounts, R(ev), R(programId)], data: args(new Writer().bytes(instructionDiscriminator(name))).done() };
|
package/dist/v2/devbuy.js
CHANGED
|
@@ -18,18 +18,20 @@ export function teamSlotWallets(slot ) {
|
|
|
18
18
|
|
|
19
19
|
export const impactBps = (before , after ) => (before === 0n ? 0n : ((after - before) * 10_000n) / before);
|
|
20
20
|
|
|
21
|
-
export function devBuyFromTrade(t , team , ctx
|
|
21
|
+
export function devBuyFromTrade(t , team , ctx = {}) {
|
|
22
22
|
if (!t.isBuy) return null;
|
|
23
|
+
|
|
24
|
+
const person = ctx.buyer ?? t.trader;
|
|
23
25
|
let role = null;
|
|
24
26
|
if (t.kind === TRADE_KIND_TEAM_BUY || ctx.teamBuy) role = "team_buy";
|
|
25
27
|
else if (t.kind === TRADE_KIND_TEAM_SHARE_BUY || ctx.teamShareBuy) role = "team_share_buy";
|
|
26
|
-
else if (
|
|
27
|
-
else if (teamSlotWallets(team.teamSlot).includes(
|
|
28
|
+
else if (person === team.creator) role = "creator";
|
|
29
|
+
else if (teamSlotWallets(team.teamSlot).includes(person)) role = "team_member";
|
|
28
30
|
if (role === null) return null;
|
|
29
31
|
const priceBeforeX64 = priceX64(t.sqrtBefore);
|
|
30
32
|
const priceAfterX64 = priceX64(t.sqrtAfter);
|
|
31
33
|
return {
|
|
32
|
-
launch: t.launch, trader:
|
|
34
|
+
launch: t.launch, trader: person, role, quoteIn: t.quoteGross - t.refund, tokens: t.tokens, priceBeforeX64, priceAfterX64,
|
|
33
35
|
impactBps: impactBps(priceBeforeX64, priceAfterX64), slot: t.slot,
|
|
34
36
|
};
|
|
35
37
|
}
|
package/dist/v2/presetRowEvm.js
CHANGED
|
@@ -5,6 +5,7 @@ import { bytesToHex, decodeAbi, encodeCall, hexToBytes } from "../evm/abi.js";
|
|
|
5
5
|
import { ROW_LEN, decodeRowV2 } from "../math/v2/preset.js";
|
|
6
6
|
|
|
7
7
|
import { evmSignature } from "../generated/index.js";
|
|
8
|
+
import { MULTICALL3_ADDRESS, aggregate3Call, decodeAggregate3Result } from "../evm/multicall.js";
|
|
8
9
|
|
|
9
10
|
export const PRESET_ROW_VIEW_EVM = { sig: evmSignature("presetRow"), ret: ["(uint8,bool,bool,uint32,bytes32,bytes)"] } ;
|
|
10
11
|
export const NEXT_PRESET_ID_VIEW_EVM = { sig: evmSignature("nextPresetId"), ret: ["uint8"] } ;
|
|
@@ -37,9 +38,27 @@ export function presetMenuV2(rows )
|
|
|
37
38
|
.map((r) => ({ id: r.id, version: r.version, rowHash: bytesToHex(r.rowHash), row: decodeRowV2(r.row) }));
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
const PRESET_MENU_BATCH = 100;
|
|
42
|
+
|
|
43
|
+
export async function readPresetMenuEvmV2(
|
|
44
|
+
rpc , amm , opts = {},
|
|
45
|
+
) {
|
|
41
46
|
const next = decodeNextPresetIdEvmV2(await rpc.ethCall(amm, nextPresetIdCallV2()));
|
|
42
47
|
const ids = Array.from({ length: Math.max(0, next - 1) }, (_, i) => i + 1).filter((id) => id !== RETIRED_ID);
|
|
43
|
-
|
|
48
|
+
if (opts.multicall === null) {
|
|
49
|
+
return presetMenuV2(await Promise.all(ids.map(async (id) => decodePresetRowEvmV2(await rpc.ethCall(amm, presetRowCallV2(id))))));
|
|
50
|
+
}
|
|
51
|
+
const multicall = opts.multicall ?? MULTICALL3_ADDRESS;
|
|
52
|
+
const chunks = [];
|
|
53
|
+
for (let i = 0; i < ids.length; i += PRESET_MENU_BATCH) chunks.push(ids.slice(i, i + PRESET_MENU_BATCH));
|
|
54
|
+
const rows = (await Promise.all(chunks.map(async (chunk) => {
|
|
55
|
+
const call = aggregate3Call(chunk.map((id) => ({ target: amm, allowFailure: true, callData: presetRowCallV2(id) })), multicall);
|
|
56
|
+
const res = decodeAggregate3Result(await rpc.ethCall(call.to, call.data));
|
|
57
|
+
if (res.length !== chunk.length) throw new RangeError(`aggregate3: ${res.length} results, ${chunk.length} calls`);
|
|
58
|
+
return res.map((r, i) => {
|
|
59
|
+
if (!r.success) throw new Error(`presetRow(${chunk[i]}) failed: ${r.returnData}`);
|
|
60
|
+
return decodePresetRowEvmV2(r.returnData);
|
|
61
|
+
});
|
|
62
|
+
}))).flat();
|
|
44
63
|
return presetMenuV2(rows);
|
|
45
64
|
}
|
package/dist/v2/solana.js
CHANGED
|
@@ -173,14 +173,29 @@ export function presetV2Instructions(p
|
|
|
173
173
|
return out;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
176
180
|
export function teamShareBuyInstructionV2(p ) {
|
|
181
|
+
if (!p.traderRef !== !p.escrow) throw new RangeError("team_share_buy: traderRef and escrow go together");
|
|
182
|
+
const referred = Boolean(p.traderRef);
|
|
183
|
+
if (referred && !p.quoteTokenProgram) throw new RangeError("team_share_buy: a referred buyback needs quoteTokenProgram");
|
|
177
184
|
const base = ix(
|
|
178
185
|
"team_share_buy",
|
|
179
|
-
|
|
186
|
+
|
|
187
|
+
[WS(p.member), W(p.launch), R(p.baseMint), R(p.quoteMint), W(p.tokenVault), referred ? W(p.quoteVault) : R(p.quoteVault), R(p.teamSlot ?? teamSlotPda(p.launch, pid(p))[0]), W(p.memberBase), R(TOKEN_2022_PROGRAM_ID)],
|
|
180
188
|
(w) => w.u64(p.amountIn).u64(minOut(p.minOut, "minOut")),
|
|
181
189
|
p,
|
|
182
190
|
);
|
|
183
|
-
|
|
191
|
+
const accounts = [...base.accounts, ...hookAccountsFor({ baseMint: p.baseMint, srcOwner: p.launch, dstOwner: p.member, programId: p.programId, hookProgramId: p.hookProgramId })];
|
|
192
|
+
if (!referred) return { ...base, accounts };
|
|
193
|
+
accounts.push(W(p.traderRef ), W(p.escrow ), R(p.quoteTokenProgram ));
|
|
194
|
+
if (p.quoteIsLaunch) {
|
|
195
|
+
accounts.push(...hookAccountsFor({ baseMint: p.quoteMint, srcOwner: p.launch, dstOwner: p.traderRef , programId: p.programId, hookProgramId: p.hookProgramId }));
|
|
196
|
+
accounts.push(W(holderPositionPda(launchPda(p.quoteMint, pid(p))[0], p.traderRef , hid(p))[0]));
|
|
197
|
+
}
|
|
198
|
+
return { ...base, accounts };
|
|
184
199
|
}
|
|
185
200
|
|
|
186
201
|
const REM_HOOK_AT = 5;
|
package/dist/v2/tx/solana.js
CHANGED
|
@@ -112,7 +112,7 @@ export function teamShareBuyAndClaimInstructionsV2(
|
|
|
112
112
|
});
|
|
113
113
|
return [
|
|
114
114
|
...(open ? [createAssociatedTokenAccountIdempotentInstruction({ payer: p.member, owner: p.member, mint: p.baseMint, tokenProgram: TOKEN_2022_PROGRAM_ID })] : []),
|
|
115
|
-
teamShareBuyInstructionV2({ ...buy, teamSlot, memberBase }),
|
|
115
|
+
teamShareBuyInstructionV2({ ...buy, teamSlot, memberBase, quoteTokenProgram, quoteIsLaunch }),
|
|
116
116
|
claim,
|
|
117
117
|
];
|
|
118
118
|
}
|