pyre-world-kit 1.0.18 → 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 +15 -3
- 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 +16 -4
- 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,6 +14,7 @@ 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");
|
|
19
20
|
const vanity_1 = require("./vanity");
|
|
@@ -81,7 +82,7 @@ async function getFactionLeaderboard(connection, opts) {
|
|
|
81
82
|
async function detectAlliances(connection, mints, holderLimit = 50) {
|
|
82
83
|
// Fetch holders for each faction in parallel
|
|
83
84
|
const holdersPerFaction = await Promise.all(mints.map(async (mint) => {
|
|
84
|
-
const result = await (
|
|
85
|
+
const result = await getPyreHolders(connection, mint, holderLimit);
|
|
85
86
|
return { mint, holders: new Set(result.holders.map(h => h.address)) };
|
|
86
87
|
}));
|
|
87
88
|
// Find overlapping holders between faction pairs
|
|
@@ -123,7 +124,7 @@ async function getFactionRivals(connection, mint, limit = 50) {
|
|
|
123
124
|
for (const faction of allFactions.tokens.filter(t => (0, vanity_1.isPyreMint)(t.mint))) {
|
|
124
125
|
if (faction.mint === mint)
|
|
125
126
|
continue;
|
|
126
|
-
const holders = await (
|
|
127
|
+
const holders = await getPyreHolders(connection, faction.mint, 50);
|
|
127
128
|
const holderAddrs = new Set(holders.holders.map(h => h.address));
|
|
128
129
|
const overlap = [...defectors].filter(d => holderAddrs.has(d)).length;
|
|
129
130
|
if (overlap > 0) {
|
|
@@ -201,7 +202,7 @@ async function getAgentFactions(connection, wallet, factionLimit = 50) {
|
|
|
201
202
|
// Check each faction for this holder
|
|
202
203
|
await Promise.all(pyreFactions.map(async (faction) => {
|
|
203
204
|
try {
|
|
204
|
-
const holders = await (
|
|
205
|
+
const holders = await getPyreHolders(connection, faction.mint, 100);
|
|
205
206
|
const holding = holders.holders.find(h => h.address === wallet);
|
|
206
207
|
if (holding && holding.balance > 0) {
|
|
207
208
|
positions.push({
|
|
@@ -325,6 +326,17 @@ async function getWorldStats(connection) {
|
|
|
325
326
|
most_powerful: mostPowerful,
|
|
326
327
|
};
|
|
327
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
|
+
}
|
|
328
340
|
// ─── Internal Helpers ──────────────────────────────────────────────
|
|
329
341
|
function computePowerScore(t) {
|
|
330
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
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import type { TokenDetail, TokenSummary } from 'torchsdk';
|
|
19
19
|
|
|
20
20
|
import { mapFactionStatus } from './mappers';
|
|
21
|
-
import { isPyreMint } from './vanity';
|
|
21
|
+
import { isPyreMint, getBondingCurvePda, getTokenTreasuryPda, getTreasuryLockPda } from './vanity';
|
|
22
22
|
import type {
|
|
23
23
|
FactionPower,
|
|
24
24
|
AllianceCluster,
|
|
@@ -111,7 +111,7 @@ export async function detectAlliances(
|
|
|
111
111
|
// Fetch holders for each faction in parallel
|
|
112
112
|
const holdersPerFaction = await Promise.all(
|
|
113
113
|
mints.map(async (mint) => {
|
|
114
|
-
const result = await
|
|
114
|
+
const result = await getPyreHolders(connection, mint, holderLimit);
|
|
115
115
|
return { mint, holders: new Set(result.holders.map(h => h.address)) };
|
|
116
116
|
})
|
|
117
117
|
);
|
|
@@ -162,7 +162,7 @@ export async function getFactionRivals(
|
|
|
162
162
|
const allFactions = await getTokens(connection, { limit: 20, sort: 'volume' });
|
|
163
163
|
for (const faction of allFactions.tokens.filter(t => isPyreMint(t.mint))) {
|
|
164
164
|
if (faction.mint === mint) continue;
|
|
165
|
-
const holders = await
|
|
165
|
+
const holders = await getPyreHolders(connection, faction.mint, 50);
|
|
166
166
|
const holderAddrs = new Set(holders.holders.map(h => h.address));
|
|
167
167
|
const overlap = [...defectors].filter(d => holderAddrs.has(d)).length;
|
|
168
168
|
if (overlap > 0) {
|
|
@@ -258,7 +258,7 @@ export async function getAgentFactions(
|
|
|
258
258
|
await Promise.all(
|
|
259
259
|
pyreFactions.map(async (faction) => {
|
|
260
260
|
try {
|
|
261
|
-
const holders = await
|
|
261
|
+
const holders = await getPyreHolders(connection, faction.mint, 100);
|
|
262
262
|
const holding = holders.holders.find(h => h.address === wallet);
|
|
263
263
|
if (holding && holding.balance > 0) {
|
|
264
264
|
positions.push({
|
|
@@ -400,6 +400,18 @@ export async function getWorldStats(
|
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
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
|
+
|
|
403
415
|
// ─── Internal Helpers ──────────────────────────────────────────────
|
|
404
416
|
|
|
405
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 =>
|