pyre-world-kit 1.0.6 → 1.0.8

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 CHANGED
@@ -81,3 +81,8 @@ export declare function confirmAction(connection: Connection, signature: string,
81
81
  export { createEphemeralAgent } from 'torchsdk';
82
82
  /** Get the Raydium pool state PDA for an ascended faction's DEX pool */
83
83
  export declare function getDexPool(mint: string): PublicKey;
84
+ /** Get Raydium pool vault addresses for an ascended faction */
85
+ export declare function getDexVaults(mint: string): {
86
+ solVault: string;
87
+ tokenVault: string;
88
+ };
package/dist/actions.js CHANGED
@@ -46,6 +46,7 @@ exports.convertTithe = convertTithe;
46
46
  exports.verifyAgent = verifyAgent;
47
47
  exports.confirmAction = confirmAction;
48
48
  exports.getDexPool = getDexPool;
49
+ exports.getDexVaults = getDexVaults;
49
50
  const web3_js_1 = require("@solana/web3.js");
50
51
  const bs58_1 = __importDefault(require("bs58"));
51
52
  const torchsdk_1 = require("torchsdk");
@@ -63,34 +64,34 @@ async function getFactions(connection, params) {
63
64
  const result = await (0, torchsdk_1.getTokens)(connection, sdkParams);
64
65
  const listResult = (0, mappers_1.mapTokenListResult)(result);
65
66
  // Enrich ascended factions with live pool price (list endpoint only has stale bonding curve mcap)
67
+ // Use Promise.allSettled so a single failure doesn't block/break the list
66
68
  const ascended = listResult.factions.filter(f => f.status === 'ascended');
67
69
  if (ascended.length > 0) {
68
- await Promise.all(ascended.map(async (faction) => {
69
- try {
70
- const mint = new web3_js_1.PublicKey(faction.mint);
71
- const raydium = (0, torchsdk_1.getRaydiumMigrationAccounts)(mint);
72
- const [vault0Info, vault1Info] = await Promise.all([
73
- connection.getTokenAccountBalance(raydium.token0Vault),
74
- connection.getTokenAccountBalance(raydium.token1Vault),
75
- ]);
76
- const vault0 = Number(vault0Info.value.amount);
77
- const vault1 = Number(vault1Info.value.amount);
78
- const solReserves = raydium.isWsolToken0 ? vault0 : vault1;
79
- const tokenReserves = raydium.isWsolToken0 ? vault1 : vault0;
80
- if (tokenReserves > 0) {
81
- // solReserves in lamports, tokenReserves in base units (10^6)
82
- const LAMPORTS = 1_000_000_000;
83
- const TOKEN_MUL = 1_000_000;
84
- const priceInSol = (solReserves * TOKEN_MUL) / (tokenReserves * LAMPORTS);
85
- const TOTAL_SUPPLY = 1_000_000_000 * TOKEN_MUL;
86
- faction.price_sol = priceInSol;
87
- faction.market_cap_sol = (priceInSol * TOTAL_SUPPLY) / TOKEN_MUL;
88
- }
89
- }
90
- catch {
91
- // Pool may not exist yet — keep stale values
70
+ const enrichPromise = Promise.allSettled(ascended.map(async (faction) => {
71
+ const mint = new web3_js_1.PublicKey(faction.mint);
72
+ const raydium = (0, torchsdk_1.getRaydiumMigrationAccounts)(mint);
73
+ const [vault0Info, vault1Info] = await Promise.all([
74
+ connection.getTokenAccountBalance(raydium.token0Vault),
75
+ connection.getTokenAccountBalance(raydium.token1Vault),
76
+ ]);
77
+ const vault0 = Number(vault0Info.value.amount);
78
+ const vault1 = Number(vault1Info.value.amount);
79
+ const solReserves = raydium.isWsolToken0 ? vault0 : vault1;
80
+ const tokenReserves = raydium.isWsolToken0 ? vault1 : vault0;
81
+ if (tokenReserves > 0) {
82
+ const LAMPORTS = 1_000_000_000;
83
+ const TOKEN_MUL = 1_000_000;
84
+ const priceInSol = (solReserves * TOKEN_MUL) / (tokenReserves * LAMPORTS);
85
+ const TOTAL_SUPPLY = 1_000_000_000 * TOKEN_MUL;
86
+ faction.price_sol = priceInSol;
87
+ faction.market_cap_sol = (priceInSol * TOTAL_SUPPLY) / TOKEN_MUL;
92
88
  }
93
89
  }));
90
+ // Race enrichment against a 3s timeout so the list always loads
91
+ await Promise.race([
92
+ enrichPromise,
93
+ new Promise(resolve => setTimeout(resolve, 3000)),
94
+ ]);
94
95
  }
95
96
  return listResult;
96
97
  }
@@ -433,3 +434,11 @@ function getDexPool(mint) {
433
434
  const { poolState } = (0, torchsdk_1.getRaydiumMigrationAccounts)(new web3_js_1.PublicKey(mint));
434
435
  return poolState;
435
436
  }
437
+ /** Get Raydium pool vault addresses for an ascended faction */
438
+ function getDexVaults(mint) {
439
+ const accts = (0, torchsdk_1.getRaydiumMigrationAccounts)(new web3_js_1.PublicKey(mint));
440
+ return {
441
+ solVault: (accts.isWsolToken0 ? accts.token0Vault : accts.token1Vault).toString(),
442
+ tokenVault: (accts.isWsolToken0 ? accts.token1Vault : accts.token0Vault).toString(),
443
+ };
444
+ }
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * so agents think in factions, not tokens.
7
7
  */
8
8
  export type { FactionStatus, FactionTier, Strategy, AgentHealth, FactionSummary, FactionDetail, Stronghold, AgentLink, Comms, WarChest, WarLoan, WarLoanWithAgent, Member, FactionListResult, MembersResult, CommsResult, AllWarLoansResult, LaunchFactionParams, JoinFactionParams, DirectJoinFactionParams, DefectParams, RallyParams, RequestWarLoanParams, RepayWarLoanParams, SiegeParams, TradeOnDexParams, ClaimSpoilsParams, CreateStrongholdParams, FundStrongholdParams, WithdrawFromStrongholdParams, RecruitAgentParams, ExileAgentParams, CoupParams, WithdrawAssetsParams, AscendParams, RazeParams, TitheParams, ConvertTitheParams, JoinFactionResult, LaunchFactionResult, TransactionResult, EphemeralAgent, SaidVerification, ConfirmResult, FactionSortOption, FactionStatusFilter, FactionListParams, FactionPower, AllianceCluster, RivalFaction, AgentProfile, AgentFactionPosition, WorldEventType, WorldEvent, WorldStats, } from './types';
9
- export { getFactions, getFaction, getMembers, getComms, getJoinQuote, getDefectQuote, getStronghold, getStrongholdForAgent, getAgentLink, getWarChest, getWarLoan, getAllWarLoans, launchFaction, joinFaction, directJoinFaction, defect, rally, requestWarLoan, repayWarLoan, tradeOnDex, claimSpoils, createStronghold, fundStronghold, withdrawFromStronghold, recruitAgent, exileAgent, coup, withdrawAssets, siege, ascend, raze, tithe, convertTithe, verifyAgent, confirmAction, createEphemeralAgent, getDexPool, } from './actions';
9
+ export { getFactions, getFaction, getMembers, getComms, getJoinQuote, getDefectQuote, getStronghold, getStrongholdForAgent, getAgentLink, getWarChest, getWarLoan, getAllWarLoans, launchFaction, joinFaction, directJoinFaction, defect, rally, requestWarLoan, repayWarLoan, tradeOnDex, claimSpoils, createStronghold, fundStronghold, withdrawFromStronghold, recruitAgent, exileAgent, coup, withdrawAssets, siege, ascend, raze, tithe, convertTithe, verifyAgent, confirmAction, createEphemeralAgent, getDexPool, getDexVaults, } from './actions';
10
10
  export { getFactionPower, getFactionLeaderboard, detectAlliances, getFactionRivals, getAgentProfile, getAgentFactions, getWorldFeed, getWorldStats, } from './intel';
11
11
  export { isPyreMint, grindPyreMint } from './vanity';
12
12
  export { PROGRAM_ID, LAMPORTS_PER_SOL, TOKEN_MULTIPLIER, TOTAL_SUPPLY } from 'torchsdk';
package/dist/index.js CHANGED
@@ -7,8 +7,8 @@
7
7
  * so agents think in factions, not tokens.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.TOKEN_MULTIPLIER = exports.LAMPORTS_PER_SOL = exports.PROGRAM_ID = exports.grindPyreMint = exports.isPyreMint = exports.getWorldStats = exports.getWorldFeed = exports.getAgentFactions = exports.getAgentProfile = exports.getFactionRivals = exports.detectAlliances = exports.getFactionLeaderboard = exports.getFactionPower = exports.getDexPool = exports.createEphemeralAgent = exports.confirmAction = exports.verifyAgent = exports.convertTithe = exports.tithe = exports.raze = exports.ascend = exports.siege = exports.withdrawAssets = exports.coup = exports.exileAgent = exports.recruitAgent = exports.withdrawFromStronghold = exports.fundStronghold = exports.createStronghold = exports.claimSpoils = exports.tradeOnDex = exports.repayWarLoan = exports.requestWarLoan = exports.rally = exports.defect = exports.directJoinFaction = exports.joinFaction = exports.launchFaction = exports.getAllWarLoans = exports.getWarLoan = exports.getWarChest = exports.getAgentLink = exports.getStrongholdForAgent = exports.getStronghold = exports.getDefectQuote = exports.getJoinQuote = exports.getComms = exports.getMembers = exports.getFaction = exports.getFactions = void 0;
11
- exports.TOTAL_SUPPLY = void 0;
10
+ exports.LAMPORTS_PER_SOL = exports.PROGRAM_ID = exports.grindPyreMint = exports.isPyreMint = exports.getWorldStats = exports.getWorldFeed = exports.getAgentFactions = exports.getAgentProfile = exports.getFactionRivals = exports.detectAlliances = exports.getFactionLeaderboard = exports.getFactionPower = exports.getDexVaults = exports.getDexPool = exports.createEphemeralAgent = exports.confirmAction = exports.verifyAgent = exports.convertTithe = exports.tithe = exports.raze = exports.ascend = exports.siege = exports.withdrawAssets = exports.coup = exports.exileAgent = exports.recruitAgent = exports.withdrawFromStronghold = exports.fundStronghold = exports.createStronghold = exports.claimSpoils = exports.tradeOnDex = exports.repayWarLoan = exports.requestWarLoan = exports.rally = exports.defect = exports.directJoinFaction = exports.joinFaction = exports.launchFaction = exports.getAllWarLoans = exports.getWarLoan = exports.getWarChest = exports.getAgentLink = exports.getStrongholdForAgent = exports.getStronghold = exports.getDefectQuote = exports.getJoinQuote = exports.getComms = exports.getMembers = exports.getFaction = exports.getFactions = void 0;
11
+ exports.TOTAL_SUPPLY = exports.TOKEN_MULTIPLIER = void 0;
12
12
  // ─── Actions ───────────────────────────────────────────────────────
13
13
  var actions_1 = require("./actions");
14
14
  // Read operations
@@ -54,6 +54,7 @@ Object.defineProperty(exports, "confirmAction", { enumerable: true, get: functio
54
54
  // Utility
55
55
  Object.defineProperty(exports, "createEphemeralAgent", { enumerable: true, get: function () { return actions_1.createEphemeralAgent; } });
56
56
  Object.defineProperty(exports, "getDexPool", { enumerable: true, get: function () { return actions_1.getDexPool; } });
57
+ Object.defineProperty(exports, "getDexVaults", { enumerable: true, get: function () { return actions_1.getDexVaults; } });
57
58
  // ─── Intel ─────────────────────────────────────────────────────────
58
59
  var intel_1 = require("./intel");
59
60
  Object.defineProperty(exports, "getFactionPower", { enumerable: true, get: function () { return intel_1.getFactionPower; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-world-kit",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
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/actions.ts CHANGED
@@ -122,33 +122,35 @@ export async function getFactions(
122
122
  const listResult = mapTokenListResult(result);
123
123
 
124
124
  // Enrich ascended factions with live pool price (list endpoint only has stale bonding curve mcap)
125
+ // Use Promise.allSettled so a single failure doesn't block/break the list
125
126
  const ascended = listResult.factions.filter(f => f.status === 'ascended');
126
127
  if (ascended.length > 0) {
127
- await Promise.all(ascended.map(async (faction) => {
128
- try {
129
- const mint = new PublicKey(faction.mint);
130
- const raydium = getRaydiumMigrationAccounts(mint);
131
- const [vault0Info, vault1Info] = await Promise.all([
132
- connection.getTokenAccountBalance(raydium.token0Vault),
133
- connection.getTokenAccountBalance(raydium.token1Vault),
134
- ]);
135
- const vault0 = Number(vault0Info.value.amount);
136
- const vault1 = Number(vault1Info.value.amount);
137
- const solReserves = raydium.isWsolToken0 ? vault0 : vault1;
138
- const tokenReserves = raydium.isWsolToken0 ? vault1 : vault0;
139
- if (tokenReserves > 0) {
140
- // solReserves in lamports, tokenReserves in base units (10^6)
141
- const LAMPORTS = 1_000_000_000;
142
- const TOKEN_MUL = 1_000_000;
143
- const priceInSol = (solReserves * TOKEN_MUL) / (tokenReserves * LAMPORTS);
144
- const TOTAL_SUPPLY = 1_000_000_000 * TOKEN_MUL;
145
- faction.price_sol = priceInSol;
146
- faction.market_cap_sol = (priceInSol * TOTAL_SUPPLY) / TOKEN_MUL;
147
- }
148
- } catch {
149
- // Pool may not exist yet — keep stale values
128
+ const enrichPromise = Promise.allSettled(ascended.map(async (faction) => {
129
+ const mint = new PublicKey(faction.mint);
130
+ const raydium = getRaydiumMigrationAccounts(mint);
131
+ const [vault0Info, vault1Info] = await Promise.all([
132
+ connection.getTokenAccountBalance(raydium.token0Vault),
133
+ connection.getTokenAccountBalance(raydium.token1Vault),
134
+ ]);
135
+ const vault0 = Number(vault0Info.value.amount);
136
+ const vault1 = Number(vault1Info.value.amount);
137
+ const solReserves = raydium.isWsolToken0 ? vault0 : vault1;
138
+ const tokenReserves = raydium.isWsolToken0 ? vault1 : vault0;
139
+ if (tokenReserves > 0) {
140
+ const LAMPORTS = 1_000_000_000;
141
+ const TOKEN_MUL = 1_000_000;
142
+ const priceInSol = (solReserves * TOKEN_MUL) / (tokenReserves * LAMPORTS);
143
+ const TOTAL_SUPPLY = 1_000_000_000 * TOKEN_MUL;
144
+ faction.price_sol = priceInSol;
145
+ faction.market_cap_sol = (priceInSol * TOTAL_SUPPLY) / TOKEN_MUL;
150
146
  }
151
147
  }));
148
+
149
+ // Race enrichment against a 3s timeout so the list always loads
150
+ await Promise.race([
151
+ enrichPromise,
152
+ new Promise(resolve => setTimeout(resolve, 3000)),
153
+ ]);
152
154
  }
153
155
 
154
156
  return listResult;
@@ -657,3 +659,12 @@ export function getDexPool(mint: string): PublicKey {
657
659
  const { poolState } = getRaydiumMigrationAccounts(new PublicKey(mint));
658
660
  return poolState;
659
661
  }
662
+
663
+ /** Get Raydium pool vault addresses for an ascended faction */
664
+ export function getDexVaults(mint: string): { solVault: string; tokenVault: string } {
665
+ const accts = getRaydiumMigrationAccounts(new PublicKey(mint));
666
+ return {
667
+ solVault: (accts.isWsolToken0 ? accts.token0Vault : accts.token1Vault).toString(),
668
+ tokenVault: (accts.isWsolToken0 ? accts.token1Vault : accts.token0Vault).toString(),
669
+ };
670
+ }
package/src/index.ts CHANGED
@@ -119,6 +119,7 @@ export {
119
119
  // Utility
120
120
  createEphemeralAgent,
121
121
  getDexPool,
122
+ getDexVaults,
122
123
  } from './actions';
123
124
 
124
125
  // ─── Intel ─────────────────────────────────────────────────────────