pyre-world-kit 1.0.6 → 1.0.7

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.js CHANGED
@@ -63,34 +63,34 @@ async function getFactions(connection, params) {
63
63
  const result = await (0, torchsdk_1.getTokens)(connection, sdkParams);
64
64
  const listResult = (0, mappers_1.mapTokenListResult)(result);
65
65
  // Enrich ascended factions with live pool price (list endpoint only has stale bonding curve mcap)
66
+ // Use Promise.allSettled so a single failure doesn't block/break the list
66
67
  const ascended = listResult.factions.filter(f => f.status === 'ascended');
67
68
  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
69
+ const enrichPromise = Promise.allSettled(ascended.map(async (faction) => {
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
+ const LAMPORTS = 1_000_000_000;
82
+ const TOKEN_MUL = 1_000_000;
83
+ const priceInSol = (solReserves * TOKEN_MUL) / (tokenReserves * LAMPORTS);
84
+ const TOTAL_SUPPLY = 1_000_000_000 * TOKEN_MUL;
85
+ faction.price_sol = priceInSol;
86
+ faction.market_cap_sol = (priceInSol * TOTAL_SUPPLY) / TOKEN_MUL;
92
87
  }
93
88
  }));
89
+ // Race enrichment against a 3s timeout so the list always loads
90
+ await Promise.race([
91
+ enrichPromise,
92
+ new Promise(resolve => setTimeout(resolve, 3000)),
93
+ ]);
94
94
  }
95
95
  return listResult;
96
96
  }
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.7",
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;