pyre-world-kit 1.0.17 → 1.0.19
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/dist/actions.d.ts +1 -1
- package/dist/actions.js +15 -2
- package/dist/intel.js +31 -13
- package/dist/vanity.d.ts +4 -1
- package/dist/vanity.js +7 -3
- package/package.json +1 -1
- package/src/actions.ts +16 -3
- package/src/intel.ts +32 -14
- package/src/vanity.ts +3 -3
package/dist/actions.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function getBlacklistedMints(): string[];
|
|
|
17
17
|
export declare function getFactions(connection: Connection, params?: FactionListParams): Promise<FactionListResult>;
|
|
18
18
|
/** Get detailed info for a single faction */
|
|
19
19
|
export declare function getFaction(connection: Connection, mint: string): Promise<FactionDetail>;
|
|
20
|
-
/** Get faction members (top holders) */
|
|
20
|
+
/** Get faction members (top holders, excluding program-owned accounts) */
|
|
21
21
|
export declare function getMembers(connection: Connection, mint: string, limit?: number): Promise<MembersResult>;
|
|
22
22
|
/** Get faction comms (trade-bundled messages, including post-ascension DEX messages) */
|
|
23
23
|
export declare function getComms(connection: Connection, mint: string, limit?: number): Promise<CommsResult>;
|
package/dist/actions.js
CHANGED
|
@@ -113,9 +113,22 @@ async function getFaction(connection, mint) {
|
|
|
113
113
|
const detail = await (0, torchsdk_1.getToken)(connection, mint);
|
|
114
114
|
return (0, mappers_1.mapTokenDetailToFaction)(detail);
|
|
115
115
|
}
|
|
116
|
-
/** Get faction members (top holders) */
|
|
116
|
+
/** Get faction members (top holders, excluding program-owned accounts) */
|
|
117
117
|
async function getMembers(connection, mint, limit) {
|
|
118
|
-
const
|
|
118
|
+
const mintPk = new web3_js_1.PublicKey(mint);
|
|
119
|
+
const [bondingCurve] = (0, vanity_1.getBondingCurvePda)(mintPk);
|
|
120
|
+
const [treasury] = (0, vanity_1.getTokenTreasuryPda)(mintPk);
|
|
121
|
+
const [treasuryLock] = (0, vanity_1.getTreasuryLockPda)(mintPk);
|
|
122
|
+
const excluded = new Set([
|
|
123
|
+
bondingCurve.toString(),
|
|
124
|
+
treasury.toString(),
|
|
125
|
+
treasuryLock.toString(),
|
|
126
|
+
]);
|
|
127
|
+
// Fetch extra to compensate for filtered-out program accounts
|
|
128
|
+
const result = await (0, torchsdk_1.getHolders)(connection, mint, (limit ?? 10) + 5);
|
|
129
|
+
result.holders = result.holders.filter(h => !excluded.has(h.address));
|
|
130
|
+
if (limit)
|
|
131
|
+
result.holders = result.holders.slice(0, limit);
|
|
119
132
|
return (0, mappers_1.mapHoldersResult)(result);
|
|
120
133
|
}
|
|
121
134
|
/** Get faction comms (trade-bundled messages, including post-ascension DEX messages) */
|
package/dist/intel.js
CHANGED
|
@@ -14,8 +14,10 @@ exports.getAgentProfile = getAgentProfile;
|
|
|
14
14
|
exports.getAgentFactions = getAgentFactions;
|
|
15
15
|
exports.getWorldFeed = getWorldFeed;
|
|
16
16
|
exports.getWorldStats = getWorldStats;
|
|
17
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
17
18
|
const torchsdk_1 = require("torchsdk");
|
|
18
19
|
const mappers_1 = require("./mappers");
|
|
20
|
+
const vanity_1 = require("./vanity");
|
|
19
21
|
// ─── Faction Power & Rankings ──────────────────────────────────────
|
|
20
22
|
/**
|
|
21
23
|
* Calculate a faction's power score.
|
|
@@ -54,7 +56,8 @@ async function getFactionLeaderboard(connection, opts) {
|
|
|
54
56
|
};
|
|
55
57
|
const sdkStatus = opts?.status ? statusMap[opts.status] : 'all';
|
|
56
58
|
const result = await (0, torchsdk_1.getTokens)(connection, { limit: opts?.limit ?? 100, status: sdkStatus });
|
|
57
|
-
const
|
|
59
|
+
const pyreFactions = result.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint));
|
|
60
|
+
const powers = pyreFactions.map((t) => ({
|
|
58
61
|
mint: t.mint,
|
|
59
62
|
name: t.name,
|
|
60
63
|
symbol: t.symbol,
|
|
@@ -79,7 +82,7 @@ async function getFactionLeaderboard(connection, opts) {
|
|
|
79
82
|
async function detectAlliances(connection, mints, holderLimit = 50) {
|
|
80
83
|
// Fetch holders for each faction in parallel
|
|
81
84
|
const holdersPerFaction = await Promise.all(mints.map(async (mint) => {
|
|
82
|
-
const result = await (
|
|
85
|
+
const result = await getPyreHolders(connection, mint, holderLimit);
|
|
83
86
|
return { mint, holders: new Set(result.holders.map(h => h.address)) };
|
|
84
87
|
}));
|
|
85
88
|
// Find overlapping holders between faction pairs
|
|
@@ -118,10 +121,10 @@ async function getFactionRivals(connection, mint, limit = 50) {
|
|
|
118
121
|
const rivalCounts = new Map();
|
|
119
122
|
// Get all factions to cross-reference
|
|
120
123
|
const allFactions = await (0, torchsdk_1.getTokens)(connection, { limit: 20, sort: 'volume' });
|
|
121
|
-
for (const faction of allFactions.tokens) {
|
|
124
|
+
for (const faction of allFactions.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint))) {
|
|
122
125
|
if (faction.mint === mint)
|
|
123
126
|
continue;
|
|
124
|
-
const holders = await (
|
|
127
|
+
const holders = await getPyreHolders(connection, faction.mint, 50);
|
|
125
128
|
const holderAddrs = new Set(holders.holders.map(h => h.address));
|
|
126
129
|
const overlap = [...defectors].filter(d => holderAddrs.has(d)).length;
|
|
127
130
|
if (overlap > 0) {
|
|
@@ -163,7 +166,7 @@ async function getAgentProfile(connection, wallet) {
|
|
|
163
166
|
const factions = await getAgentFactions(connection, wallet);
|
|
164
167
|
// Find factions this wallet created
|
|
165
168
|
const allFactions = await (0, torchsdk_1.getTokens)(connection, { limit: 100 });
|
|
166
|
-
const founded = allFactions.tokens
|
|
169
|
+
const founded = allFactions.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint))
|
|
167
170
|
.filter(t => t.mint) // TokenSummary doesn't have creator, so we skip for now
|
|
168
171
|
.map(t => t.mint);
|
|
169
172
|
const totalValue = factions.reduce((sum, f) => sum + f.value_sol, 0);
|
|
@@ -194,11 +197,12 @@ async function getAgentProfile(connection, wallet) {
|
|
|
194
197
|
*/
|
|
195
198
|
async function getAgentFactions(connection, wallet, factionLimit = 50) {
|
|
196
199
|
const allFactions = await (0, torchsdk_1.getTokens)(connection, { limit: factionLimit });
|
|
200
|
+
const pyreFactions = allFactions.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint));
|
|
197
201
|
const positions = [];
|
|
198
202
|
// Check each faction for this holder
|
|
199
|
-
await Promise.all(
|
|
203
|
+
await Promise.all(pyreFactions.map(async (faction) => {
|
|
200
204
|
try {
|
|
201
|
-
const holders = await (
|
|
205
|
+
const holders = await getPyreHolders(connection, faction.mint, 100);
|
|
202
206
|
const holding = holders.holders.find(h => h.address === wallet);
|
|
203
207
|
if (holding && holding.balance > 0) {
|
|
204
208
|
positions.push({
|
|
@@ -230,7 +234,7 @@ async function getWorldFeed(connection, opts) {
|
|
|
230
234
|
const allFactions = await (0, torchsdk_1.getTokens)(connection, { limit: factionLimit, sort: 'newest' });
|
|
231
235
|
const events = [];
|
|
232
236
|
// Add launch events for each faction
|
|
233
|
-
for (const faction of allFactions.tokens) {
|
|
237
|
+
for (const faction of allFactions.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint))) {
|
|
234
238
|
events.push({
|
|
235
239
|
type: 'launch',
|
|
236
240
|
faction_mint: faction.mint,
|
|
@@ -284,11 +288,14 @@ async function getWorldFeed(connection, opts) {
|
|
|
284
288
|
*/
|
|
285
289
|
async function getWorldStats(connection) {
|
|
286
290
|
const [all, rising, ascended] = await Promise.all([
|
|
287
|
-
(0, torchsdk_1.getTokens)(connection, { limit:
|
|
291
|
+
(0, torchsdk_1.getTokens)(connection, { limit: 200, status: 'all' }),
|
|
288
292
|
(0, torchsdk_1.getTokens)(connection, { limit: 100, status: 'bonding' }),
|
|
289
293
|
(0, torchsdk_1.getTokens)(connection, { limit: 100, status: 'migrated' }),
|
|
290
294
|
]);
|
|
291
|
-
const
|
|
295
|
+
const pyreAll = all.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint));
|
|
296
|
+
const pyreRising = rising.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint));
|
|
297
|
+
const pyreAscended = ascended.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint));
|
|
298
|
+
const allFactions = [...pyreRising, ...pyreAscended];
|
|
292
299
|
const totalSolLocked = allFactions.reduce((sum, t) => sum + t.market_cap_sol, 0);
|
|
293
300
|
// Find most powerful
|
|
294
301
|
let mostPowerful = null;
|
|
@@ -312,13 +319,24 @@ async function getWorldStats(connection) {
|
|
|
312
319
|
}
|
|
313
320
|
}
|
|
314
321
|
return {
|
|
315
|
-
total_factions:
|
|
316
|
-
rising_factions:
|
|
317
|
-
ascended_factions:
|
|
322
|
+
total_factions: pyreAll.length,
|
|
323
|
+
rising_factions: pyreRising.length,
|
|
324
|
+
ascended_factions: pyreAscended.length,
|
|
318
325
|
total_sol_locked: totalSolLocked,
|
|
319
326
|
most_powerful: mostPowerful,
|
|
320
327
|
};
|
|
321
328
|
}
|
|
329
|
+
/** Fetch holders excluding program-owned accounts (bonding curve, treasury, treasury lock) */
|
|
330
|
+
async function getPyreHolders(connection, mint, limit) {
|
|
331
|
+
const mintPk = new web3_js_1.PublicKey(mint);
|
|
332
|
+
const [bondingCurve] = (0, vanity_1.getBondingCurvePda)(mintPk);
|
|
333
|
+
const [treasury] = (0, vanity_1.getTokenTreasuryPda)(mintPk);
|
|
334
|
+
const [treasuryLock] = (0, vanity_1.getTreasuryLockPda)(mintPk);
|
|
335
|
+
const excluded = new Set([bondingCurve.toString(), treasury.toString(), treasuryLock.toString()]);
|
|
336
|
+
const result = await (0, torchsdk_1.getHolders)(connection, mint, limit + 5);
|
|
337
|
+
result.holders = result.holders.filter(h => !excluded.has(h.address)).slice(0, limit);
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
322
340
|
// ─── Internal Helpers ──────────────────────────────────────────────
|
|
323
341
|
function computePowerScore(t) {
|
|
324
342
|
const mcWeight = 0.4;
|
package/dist/vanity.d.ts
CHANGED
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
* This is how we distinguish pyre faction tokens from regular torch tokens —
|
|
6
6
|
* no registry program needed, just check the mint suffix.
|
|
7
7
|
*/
|
|
8
|
-
import { Connection, Keypair } from '@solana/web3.js';
|
|
8
|
+
import { Connection, PublicKey, Keypair } from '@solana/web3.js';
|
|
9
9
|
import type { CreateTokenResult, CreateTokenParams } from 'torchsdk';
|
|
10
|
+
export declare const getBondingCurvePda: (mint: PublicKey) => [PublicKey, number];
|
|
11
|
+
export declare const getTokenTreasuryPda: (mint: PublicKey) => [PublicKey, number];
|
|
12
|
+
export declare const getTreasuryLockPda: (mint: PublicKey) => [PublicKey, number];
|
|
10
13
|
/** Grind for a keypair whose base58 address ends with "py" */
|
|
11
14
|
export declare function grindPyreMint(maxAttempts?: number): Keypair;
|
|
12
15
|
/** Check if a mint address is a pyre faction (ends with "py") */
|
package/dist/vanity.js
CHANGED
|
@@ -10,6 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.getTreasuryLockPda = exports.getTokenTreasuryPda = exports.getBondingCurvePda = void 0;
|
|
13
14
|
exports.grindPyreMint = grindPyreMint;
|
|
14
15
|
exports.isPyreMint = isPyreMint;
|
|
15
16
|
exports.buildCreateFactionTransaction = buildCreateFactionTransaction;
|
|
@@ -29,9 +30,12 @@ const torch_market_json_1 = __importDefault(require("torchsdk/dist/torch_market.
|
|
|
29
30
|
// ── PDA helpers (copied from torchsdk internals) ──
|
|
30
31
|
const getGlobalConfigPda = () => web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(GLOBAL_CONFIG_SEED)], torchsdk_1.PROGRAM_ID);
|
|
31
32
|
const getBondingCurvePda = (mint) => web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(BONDING_CURVE_SEED), mint.toBuffer()], torchsdk_1.PROGRAM_ID);
|
|
33
|
+
exports.getBondingCurvePda = getBondingCurvePda;
|
|
32
34
|
const getTokenTreasuryPda = (mint) => web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(TREASURY_SEED), mint.toBuffer()], torchsdk_1.PROGRAM_ID);
|
|
35
|
+
exports.getTokenTreasuryPda = getTokenTreasuryPda;
|
|
33
36
|
const getTreasuryTokenAccount = (mint, treasury) => (0, spl_token_1.getAssociatedTokenAddressSync)(mint, treasury, true, TOKEN_2022_PROGRAM_ID);
|
|
34
37
|
const getTreasuryLockPda = (mint) => web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(TREASURY_LOCK_SEED), mint.toBuffer()], torchsdk_1.PROGRAM_ID);
|
|
38
|
+
exports.getTreasuryLockPda = getTreasuryLockPda;
|
|
35
39
|
const getTreasuryLockTokenAccount = (mint, treasuryLock) => (0, spl_token_1.getAssociatedTokenAddressSync)(mint, treasuryLock, true, TOKEN_2022_PROGRAM_ID);
|
|
36
40
|
const makeDummyProvider = (connection, payer) => {
|
|
37
41
|
const dummyWallet = {
|
|
@@ -75,11 +79,11 @@ async function buildCreateFactionTransaction(connection, params) {
|
|
|
75
79
|
const mint = grindPyreMint();
|
|
76
80
|
// Derive PDAs
|
|
77
81
|
const [globalConfig] = getGlobalConfigPda();
|
|
78
|
-
const [bondingCurve] = getBondingCurvePda(mint.publicKey);
|
|
79
|
-
const [treasury] = getTokenTreasuryPda(mint.publicKey);
|
|
82
|
+
const [bondingCurve] = (0, exports.getBondingCurvePda)(mint.publicKey);
|
|
83
|
+
const [treasury] = (0, exports.getTokenTreasuryPda)(mint.publicKey);
|
|
80
84
|
const bondingCurveTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(mint.publicKey, bondingCurve, true, TOKEN_2022_PROGRAM_ID);
|
|
81
85
|
const treasuryTokenAccount = getTreasuryTokenAccount(mint.publicKey, treasury);
|
|
82
|
-
const [treasuryLock] = getTreasuryLockPda(mint.publicKey);
|
|
86
|
+
const [treasuryLock] = (0, exports.getTreasuryLockPda)(mint.publicKey);
|
|
83
87
|
const treasuryLockTokenAccount = getTreasuryLockTokenAccount(mint.publicKey, treasuryLock);
|
|
84
88
|
const tx = new web3_js_1.Transaction();
|
|
85
89
|
const provider = makeDummyProvider(connection, creator);
|
package/package.json
CHANGED
package/src/actions.ts
CHANGED
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
mapTokenStatusFilter,
|
|
107
107
|
} from './mappers';
|
|
108
108
|
|
|
109
|
-
import { buildCreateFactionTransaction, isPyreMint } from './vanity';
|
|
109
|
+
import { buildCreateFactionTransaction, isPyreMint, getBondingCurvePda, getTokenTreasuryPda, getTreasuryLockPda } from './vanity';
|
|
110
110
|
|
|
111
111
|
// ─── Blacklist ──────────────────────────────────────────────────────
|
|
112
112
|
// Mints from previous swarm runs. Agents should skip these and only
|
|
@@ -181,13 +181,26 @@ export async function getFaction(
|
|
|
181
181
|
return mapTokenDetailToFaction(detail);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
/** Get faction members (top holders) */
|
|
184
|
+
/** Get faction members (top holders, excluding program-owned accounts) */
|
|
185
185
|
export async function getMembers(
|
|
186
186
|
connection: Connection,
|
|
187
187
|
mint: string,
|
|
188
188
|
limit?: number,
|
|
189
189
|
): Promise<MembersResult> {
|
|
190
|
-
const
|
|
190
|
+
const mintPk = new PublicKey(mint);
|
|
191
|
+
const [bondingCurve] = getBondingCurvePda(mintPk);
|
|
192
|
+
const [treasury] = getTokenTreasuryPda(mintPk);
|
|
193
|
+
const [treasuryLock] = getTreasuryLockPda(mintPk);
|
|
194
|
+
const excluded = new Set([
|
|
195
|
+
bondingCurve.toString(),
|
|
196
|
+
treasury.toString(),
|
|
197
|
+
treasuryLock.toString(),
|
|
198
|
+
]);
|
|
199
|
+
|
|
200
|
+
// Fetch extra to compensate for filtered-out program accounts
|
|
201
|
+
const result = await getHolders(connection, mint, (limit ?? 10) + 5);
|
|
202
|
+
result.holders = result.holders.filter(h => !excluded.has(h.address));
|
|
203
|
+
if (limit) result.holders = result.holders.slice(0, limit);
|
|
191
204
|
return mapHoldersResult(result);
|
|
192
205
|
}
|
|
193
206
|
|
package/src/intel.ts
CHANGED
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
} from 'torchsdk';
|
|
18
18
|
import type { TokenDetail, TokenSummary } from 'torchsdk';
|
|
19
19
|
|
|
20
|
-
import { mapFactionStatus
|
|
20
|
+
import { mapFactionStatus } from './mappers';
|
|
21
|
+
import { isPyreMint, getBondingCurvePda, getTokenTreasuryPda, getTreasuryLockPda } from './vanity';
|
|
21
22
|
import type {
|
|
22
23
|
FactionPower,
|
|
23
24
|
AllianceCluster,
|
|
@@ -75,8 +76,9 @@ export async function getFactionLeaderboard(
|
|
|
75
76
|
};
|
|
76
77
|
const sdkStatus = opts?.status ? statusMap[opts.status] as any : 'all';
|
|
77
78
|
const result = await getTokens(connection, { limit: opts?.limit ?? 100, status: sdkStatus });
|
|
79
|
+
const pyreFactions = result.tokens.filter(t => isPyreMint(t.mint));
|
|
78
80
|
|
|
79
|
-
const powers: FactionPower[] =
|
|
81
|
+
const powers: FactionPower[] = pyreFactions.map((t) => ({
|
|
80
82
|
mint: t.mint,
|
|
81
83
|
name: t.name,
|
|
82
84
|
symbol: t.symbol,
|
|
@@ -109,7 +111,7 @@ export async function detectAlliances(
|
|
|
109
111
|
// Fetch holders for each faction in parallel
|
|
110
112
|
const holdersPerFaction = await Promise.all(
|
|
111
113
|
mints.map(async (mint) => {
|
|
112
|
-
const result = await
|
|
114
|
+
const result = await getPyreHolders(connection, mint, holderLimit);
|
|
113
115
|
return { mint, holders: new Set(result.holders.map(h => h.address)) };
|
|
114
116
|
})
|
|
115
117
|
);
|
|
@@ -158,9 +160,9 @@ export async function getFactionRivals(
|
|
|
158
160
|
|
|
159
161
|
// Get all factions to cross-reference
|
|
160
162
|
const allFactions = await getTokens(connection, { limit: 20, sort: 'volume' });
|
|
161
|
-
for (const faction of allFactions.tokens) {
|
|
163
|
+
for (const faction of allFactions.tokens.filter(t => isPyreMint(t.mint))) {
|
|
162
164
|
if (faction.mint === mint) continue;
|
|
163
|
-
const holders = await
|
|
165
|
+
const holders = await getPyreHolders(connection, faction.mint, 50);
|
|
164
166
|
const holderAddrs = new Set(holders.holders.map(h => h.address));
|
|
165
167
|
const overlap = [...defectors].filter(d => holderAddrs.has(d)).length;
|
|
166
168
|
if (overlap > 0) {
|
|
@@ -211,7 +213,7 @@ export async function getAgentProfile(
|
|
|
211
213
|
|
|
212
214
|
// Find factions this wallet created
|
|
213
215
|
const allFactions = await getTokens(connection, { limit: 100 });
|
|
214
|
-
const founded = allFactions.tokens
|
|
216
|
+
const founded = allFactions.tokens.filter(t => isPyreMint(t.mint))
|
|
215
217
|
.filter(t => t.mint) // TokenSummary doesn't have creator, so we skip for now
|
|
216
218
|
.map(t => t.mint);
|
|
217
219
|
|
|
@@ -249,13 +251,14 @@ export async function getAgentFactions(
|
|
|
249
251
|
factionLimit = 50,
|
|
250
252
|
): Promise<AgentFactionPosition[]> {
|
|
251
253
|
const allFactions = await getTokens(connection, { limit: factionLimit });
|
|
254
|
+
const pyreFactions = allFactions.tokens.filter(t => isPyreMint(t.mint));
|
|
252
255
|
const positions: AgentFactionPosition[] = [];
|
|
253
256
|
|
|
254
257
|
// Check each faction for this holder
|
|
255
258
|
await Promise.all(
|
|
256
|
-
|
|
259
|
+
pyreFactions.map(async (faction) => {
|
|
257
260
|
try {
|
|
258
|
-
const holders = await
|
|
261
|
+
const holders = await getPyreHolders(connection, faction.mint, 100);
|
|
259
262
|
const holding = holders.holders.find(h => h.address === wallet);
|
|
260
263
|
if (holding && holding.balance > 0) {
|
|
261
264
|
positions.push({
|
|
@@ -295,7 +298,7 @@ export async function getWorldFeed(
|
|
|
295
298
|
const events: WorldEvent[] = [];
|
|
296
299
|
|
|
297
300
|
// Add launch events for each faction
|
|
298
|
-
for (const faction of allFactions.tokens) {
|
|
301
|
+
for (const faction of allFactions.tokens.filter(t => isPyreMint(t.mint))) {
|
|
299
302
|
events.push({
|
|
300
303
|
type: 'launch',
|
|
301
304
|
faction_mint: faction.mint,
|
|
@@ -355,12 +358,15 @@ export async function getWorldStats(
|
|
|
355
358
|
connection: Connection,
|
|
356
359
|
): Promise<WorldStats> {
|
|
357
360
|
const [all, rising, ascended] = await Promise.all([
|
|
358
|
-
getTokens(connection, { limit:
|
|
361
|
+
getTokens(connection, { limit: 200, status: 'all' }),
|
|
359
362
|
getTokens(connection, { limit: 100, status: 'bonding' }),
|
|
360
363
|
getTokens(connection, { limit: 100, status: 'migrated' }),
|
|
361
364
|
]);
|
|
362
365
|
|
|
363
|
-
const
|
|
366
|
+
const pyreAll = all.tokens.filter(t => isPyreMint(t.mint));
|
|
367
|
+
const pyreRising = rising.tokens.filter(t => isPyreMint(t.mint));
|
|
368
|
+
const pyreAscended = ascended.tokens.filter(t => isPyreMint(t.mint));
|
|
369
|
+
const allFactions = [...pyreRising, ...pyreAscended];
|
|
364
370
|
const totalSolLocked = allFactions.reduce((sum, t) => sum + t.market_cap_sol, 0);
|
|
365
371
|
|
|
366
372
|
// Find most powerful
|
|
@@ -386,14 +392,26 @@ export async function getWorldStats(
|
|
|
386
392
|
}
|
|
387
393
|
|
|
388
394
|
return {
|
|
389
|
-
total_factions:
|
|
390
|
-
rising_factions:
|
|
391
|
-
ascended_factions:
|
|
395
|
+
total_factions: pyreAll.length,
|
|
396
|
+
rising_factions: pyreRising.length,
|
|
397
|
+
ascended_factions: pyreAscended.length,
|
|
392
398
|
total_sol_locked: totalSolLocked,
|
|
393
399
|
most_powerful: mostPowerful,
|
|
394
400
|
};
|
|
395
401
|
}
|
|
396
402
|
|
|
403
|
+
/** Fetch holders excluding program-owned accounts (bonding curve, treasury, treasury lock) */
|
|
404
|
+
async function getPyreHolders(connection: Connection, mint: string, limit: number) {
|
|
405
|
+
const mintPk = new PublicKey(mint);
|
|
406
|
+
const [bondingCurve] = getBondingCurvePda(mintPk);
|
|
407
|
+
const [treasury] = getTokenTreasuryPda(mintPk);
|
|
408
|
+
const [treasuryLock] = getTreasuryLockPda(mintPk);
|
|
409
|
+
const excluded = new Set([bondingCurve.toString(), treasury.toString(), treasuryLock.toString()]);
|
|
410
|
+
const result = await getHolders(connection, mint, limit + 5);
|
|
411
|
+
result.holders = result.holders.filter(h => !excluded.has(h.address)).slice(0, limit);
|
|
412
|
+
return result;
|
|
413
|
+
}
|
|
414
|
+
|
|
397
415
|
// ─── Internal Helpers ──────────────────────────────────────────────
|
|
398
416
|
|
|
399
417
|
function computePowerScore(t: TokenDetail): number {
|
package/src/vanity.ts
CHANGED
|
@@ -39,16 +39,16 @@ import idl from 'torchsdk/dist/torch_market.json'
|
|
|
39
39
|
const getGlobalConfigPda = (): [PublicKey, number] =>
|
|
40
40
|
PublicKey.findProgramAddressSync([Buffer.from(GLOBAL_CONFIG_SEED)], PROGRAM_ID)
|
|
41
41
|
|
|
42
|
-
const getBondingCurvePda = (mint: PublicKey): [PublicKey, number] =>
|
|
42
|
+
export const getBondingCurvePda = (mint: PublicKey): [PublicKey, number] =>
|
|
43
43
|
PublicKey.findProgramAddressSync([Buffer.from(BONDING_CURVE_SEED), mint.toBuffer()], PROGRAM_ID)
|
|
44
44
|
|
|
45
|
-
const getTokenTreasuryPda = (mint: PublicKey): [PublicKey, number] =>
|
|
45
|
+
export const getTokenTreasuryPda = (mint: PublicKey): [PublicKey, number] =>
|
|
46
46
|
PublicKey.findProgramAddressSync([Buffer.from(TREASURY_SEED), mint.toBuffer()], PROGRAM_ID)
|
|
47
47
|
|
|
48
48
|
const getTreasuryTokenAccount = (mint: PublicKey, treasury: PublicKey): PublicKey =>
|
|
49
49
|
getAssociatedTokenAddressSync(mint, treasury, true, TOKEN_2022_PROGRAM_ID)
|
|
50
50
|
|
|
51
|
-
const getTreasuryLockPda = (mint: PublicKey): [PublicKey, number] =>
|
|
51
|
+
export const getTreasuryLockPda = (mint: PublicKey): [PublicKey, number] =>
|
|
52
52
|
PublicKey.findProgramAddressSync([Buffer.from(TREASURY_LOCK_SEED), mint.toBuffer()], PROGRAM_ID)
|
|
53
53
|
|
|
54
54
|
const getTreasuryLockTokenAccount = (mint: PublicKey, treasuryLock: PublicKey): PublicKey =>
|