pyre-world-kit 1.0.17 → 1.0.18

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.
Files changed (3) hide show
  1. package/dist/intel.js +16 -10
  2. package/package.json +1 -1
  3. package/src/intel.ts +17 -11
package/dist/intel.js CHANGED
@@ -16,6 +16,7 @@ exports.getWorldFeed = getWorldFeed;
16
16
  exports.getWorldStats = getWorldStats;
17
17
  const torchsdk_1 = require("torchsdk");
18
18
  const mappers_1 = require("./mappers");
19
+ const vanity_1 = require("./vanity");
19
20
  // ─── Faction Power & Rankings ──────────────────────────────────────
20
21
  /**
21
22
  * Calculate a faction's power score.
@@ -54,7 +55,8 @@ async function getFactionLeaderboard(connection, opts) {
54
55
  };
55
56
  const sdkStatus = opts?.status ? statusMap[opts.status] : 'all';
56
57
  const result = await (0, torchsdk_1.getTokens)(connection, { limit: opts?.limit ?? 100, status: sdkStatus });
57
- const powers = result.tokens.map((t) => ({
58
+ const pyreFactions = result.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint));
59
+ const powers = pyreFactions.map((t) => ({
58
60
  mint: t.mint,
59
61
  name: t.name,
60
62
  symbol: t.symbol,
@@ -118,7 +120,7 @@ async function getFactionRivals(connection, mint, limit = 50) {
118
120
  const rivalCounts = new Map();
119
121
  // Get all factions to cross-reference
120
122
  const allFactions = await (0, torchsdk_1.getTokens)(connection, { limit: 20, sort: 'volume' });
121
- for (const faction of allFactions.tokens) {
123
+ for (const faction of allFactions.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint))) {
122
124
  if (faction.mint === mint)
123
125
  continue;
124
126
  const holders = await (0, torchsdk_1.getHolders)(connection, faction.mint, 50);
@@ -163,7 +165,7 @@ async function getAgentProfile(connection, wallet) {
163
165
  const factions = await getAgentFactions(connection, wallet);
164
166
  // Find factions this wallet created
165
167
  const allFactions = await (0, torchsdk_1.getTokens)(connection, { limit: 100 });
166
- const founded = allFactions.tokens
168
+ const founded = allFactions.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint))
167
169
  .filter(t => t.mint) // TokenSummary doesn't have creator, so we skip for now
168
170
  .map(t => t.mint);
169
171
  const totalValue = factions.reduce((sum, f) => sum + f.value_sol, 0);
@@ -194,9 +196,10 @@ async function getAgentProfile(connection, wallet) {
194
196
  */
195
197
  async function getAgentFactions(connection, wallet, factionLimit = 50) {
196
198
  const allFactions = await (0, torchsdk_1.getTokens)(connection, { limit: factionLimit });
199
+ const pyreFactions = allFactions.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint));
197
200
  const positions = [];
198
201
  // Check each faction for this holder
199
- await Promise.all(allFactions.tokens.map(async (faction) => {
202
+ await Promise.all(pyreFactions.map(async (faction) => {
200
203
  try {
201
204
  const holders = await (0, torchsdk_1.getHolders)(connection, faction.mint, 100);
202
205
  const holding = holders.holders.find(h => h.address === wallet);
@@ -230,7 +233,7 @@ async function getWorldFeed(connection, opts) {
230
233
  const allFactions = await (0, torchsdk_1.getTokens)(connection, { limit: factionLimit, sort: 'newest' });
231
234
  const events = [];
232
235
  // Add launch events for each faction
233
- for (const faction of allFactions.tokens) {
236
+ for (const faction of allFactions.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint))) {
234
237
  events.push({
235
238
  type: 'launch',
236
239
  faction_mint: faction.mint,
@@ -284,11 +287,14 @@ async function getWorldFeed(connection, opts) {
284
287
  */
285
288
  async function getWorldStats(connection) {
286
289
  const [all, rising, ascended] = await Promise.all([
287
- (0, torchsdk_1.getTokens)(connection, { limit: 1, status: 'all' }),
290
+ (0, torchsdk_1.getTokens)(connection, { limit: 200, status: 'all' }),
288
291
  (0, torchsdk_1.getTokens)(connection, { limit: 100, status: 'bonding' }),
289
292
  (0, torchsdk_1.getTokens)(connection, { limit: 100, status: 'migrated' }),
290
293
  ]);
291
- const allFactions = [...rising.tokens, ...ascended.tokens];
294
+ const pyreAll = all.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint));
295
+ const pyreRising = rising.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint));
296
+ const pyreAscended = ascended.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint));
297
+ const allFactions = [...pyreRising, ...pyreAscended];
292
298
  const totalSolLocked = allFactions.reduce((sum, t) => sum + t.market_cap_sol, 0);
293
299
  // Find most powerful
294
300
  let mostPowerful = null;
@@ -312,9 +318,9 @@ async function getWorldStats(connection) {
312
318
  }
313
319
  }
314
320
  return {
315
- total_factions: all.total,
316
- rising_factions: rising.total,
317
- ascended_factions: ascended.total,
321
+ total_factions: pyreAll.length,
322
+ rising_factions: pyreRising.length,
323
+ ascended_factions: pyreAscended.length,
318
324
  total_sol_locked: totalSolLocked,
319
325
  most_powerful: mostPowerful,
320
326
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-world-kit",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Agent-first faction warfare kit — game-semantic wrapper over torchsdk",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
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, } from './mappers';
20
+ import { mapFactionStatus } from './mappers';
21
+ import { isPyreMint } 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[] = result.tokens.map((t) => ({
81
+ const powers: FactionPower[] = pyreFactions.map((t) => ({
80
82
  mint: t.mint,
81
83
  name: t.name,
82
84
  symbol: t.symbol,
@@ -158,7 +160,7 @@ 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
165
  const holders = await getHolders(connection, faction.mint, 50);
164
166
  const holderAddrs = new Set(holders.holders.map(h => h.address));
@@ -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,11 +251,12 @@ 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
- allFactions.tokens.map(async (faction) => {
259
+ pyreFactions.map(async (faction) => {
257
260
  try {
258
261
  const holders = await getHolders(connection, faction.mint, 100);
259
262
  const holding = holders.holders.find(h => h.address === wallet);
@@ -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: 1, status: 'all' }),
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 allFactions = [...rising.tokens, ...ascended.tokens];
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,9 +392,9 @@ export async function getWorldStats(
386
392
  }
387
393
 
388
394
  return {
389
- total_factions: all.total,
390
- rising_factions: rising.total,
391
- ascended_factions: ascended.total,
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
  };