@pioneer-platform/pioneer-cache 1.10.0 → 1.15.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @pioneer-platform/pioneer-cache
2
2
 
3
+ ## 1.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - chore: feat(pioneer-server): Migrate from Bun to Node.js for Blockbook WebSocket compatibility
8
+
9
+ ## 1.14.0
10
+
11
+ ### Minor Changes
12
+
13
+ - feat(pioneer-server): Migrate from Bun to Node.js for Blockbook WebSocket compatibility
14
+
15
+ ## 1.13.0
16
+
17
+ ### Minor Changes
18
+
19
+ - feat(pioneer-server): Migrate from Bun to Node.js for Blockbook WebSocket compatibility
20
+
21
+ ## 1.12.0
22
+
23
+ ### Minor Changes
24
+
25
+ - feat(pioneer-server): Migrate from Bun to Node.js for Blockbook WebSocket compatibility
26
+
27
+ ## 1.11.0
28
+
29
+ ### Minor Changes
30
+
31
+ - feat(pioneer-server): Migrate from Bun to Node.js for Blockbook WebSocket compatibility
32
+
33
+ ## 1.10.1
34
+
35
+ ### Patch Changes
36
+
37
+ - fix(pioneer-server): Fix Blockbook WebSocket event system initialization
38
+
3
39
  ## 1.10.0
4
40
 
5
41
  ### Minor Changes
@@ -16,6 +16,7 @@ export interface ChartData {
16
16
  icon?: string;
17
17
  type?: string;
18
18
  decimal?: number;
19
+ decimals?: number;
19
20
  }
20
21
  /**
21
22
  * Full portfolio data for a pubkey set
@@ -128,7 +128,8 @@ class PortfolioCache extends base_cache_1.BaseCache {
128
128
  await ethNetwork.init({});
129
129
  }
130
130
  catch (error) {
131
- log.error(tag, 'Failed to initialize eth-network:', error);
131
+ const errorMsg = error.message || String(error);
132
+ log.error(tag, `Failed to initialize eth-network: ${errorMsg}`);
132
133
  return stableCharts;
133
134
  }
134
135
  // Fetch stable coins for each network
@@ -177,7 +178,10 @@ class PortfolioCache extends base_cache_1.BaseCache {
177
178
  return chartData;
178
179
  }
179
180
  catch (error) {
180
- log.error(tag, `Error fetching ${tokenConfig.symbol}:`, error);
181
+ const errorMsg = error.isAxiosError
182
+ ? `${error.message} (${error.code}) - ${error.config?.url || 'unknown url'}`
183
+ : error.message || String(error);
184
+ log.error(tag, `Error fetching ${tokenConfig.symbol}: ${errorMsg}`);
181
185
  return null;
182
186
  }
183
187
  });
@@ -189,7 +193,8 @@ class PortfolioCache extends base_cache_1.BaseCache {
189
193
  return stableCharts;
190
194
  }
191
195
  catch (error) {
192
- log.error(tag, 'Error fetching stable coins:', error);
196
+ const errorMsg = error.message || String(error);
197
+ log.error(tag, `Error fetching stable coins: ${errorMsg}`);
193
198
  return stableCharts;
194
199
  }
195
200
  }
@@ -274,12 +279,16 @@ class PortfolioCache extends base_cache_1.BaseCache {
274
279
  valueUsd,
275
280
  icon: assetInfo.icon || '',
276
281
  type: assetInfo.type || 'native',
277
- decimal: assetInfo.decimal
282
+ decimal: assetInfo.decimals ?? assetInfo.decimal // FIX: Try plural first, fallback to singular
278
283
  };
279
284
  return chartData;
280
285
  }
281
286
  catch (error) {
282
- log.error(tag, `Error fetching balance for ${item.caip}/${item.pubkey}:`, error);
287
+ // Format error as single line
288
+ const errorMsg = error.isAxiosError
289
+ ? `${error.message} (${error.code}) - ${error.config?.url || 'unknown url'}`
290
+ : error.message || String(error);
291
+ log.error(tag, `Error fetching balance for ${item.caip}/${item.pubkey}: ${errorMsg}`);
283
292
  return null;
284
293
  }
285
294
  });
@@ -323,7 +332,8 @@ class PortfolioCache extends base_cache_1.BaseCache {
323
332
  };
324
333
  }
325
334
  catch (error) {
326
- log.error(tag, 'Error fetching portfolio:', error);
335
+ const errorMsg = error.message || String(error);
336
+ log.error(tag, `Error fetching portfolio: ${errorMsg}`);
327
337
  throw error;
328
338
  }
329
339
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/pioneer-cache",
3
- "version": "1.10.0",
3
+ "version": "1.15.0",
4
4
  "description": "Unified caching system for Pioneer platform with Redis backend",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -26,6 +26,7 @@ export interface ChartData {
26
26
  icon?: string;
27
27
  type?: string; // 'native', 'token', etc.
28
28
  decimal?: number;
29
+ decimals?: number; // For backward compatibility with both naming conventions
29
30
  }
30
31
 
31
32
  /**
@@ -181,8 +182,9 @@ export class PortfolioCache extends BaseCache<PortfolioData> {
181
182
  try {
182
183
  ethNetwork = require('@pioneer-platform/eth-network');
183
184
  await ethNetwork.init({});
184
- } catch (error) {
185
- log.error(tag, 'Failed to initialize eth-network:', error);
185
+ } catch (error: any) {
186
+ const errorMsg = error.message || String(error);
187
+ log.error(tag, `Failed to initialize eth-network: ${errorMsg}`);
186
188
  return stableCharts;
187
189
  }
188
190
 
@@ -242,8 +244,11 @@ export class PortfolioCache extends BaseCache<PortfolioData> {
242
244
  log.info(tag, `✅ ${tokenConfig.symbol}: ${balance} ($${valueUsd.toFixed(2)})`);
243
245
  return chartData;
244
246
 
245
- } catch (error) {
246
- log.error(tag, `Error fetching ${tokenConfig.symbol}:`, error);
247
+ } catch (error: any) {
248
+ const errorMsg = error.isAxiosError
249
+ ? `${error.message} (${error.code}) - ${error.config?.url || 'unknown url'}`
250
+ : error.message || String(error);
251
+ log.error(tag, `Error fetching ${tokenConfig.symbol}: ${errorMsg}`);
247
252
  return null;
248
253
  }
249
254
  });
@@ -256,8 +261,9 @@ export class PortfolioCache extends BaseCache<PortfolioData> {
256
261
  log.info(tag, `Fetched ${stableCharts.length} stable coin balances`);
257
262
  return stableCharts;
258
263
 
259
- } catch (error) {
260
- log.error(tag, 'Error fetching stable coins:', error);
264
+ } catch (error: any) {
265
+ const errorMsg = error.message || String(error);
266
+ log.error(tag, `Error fetching stable coins: ${errorMsg}`);
261
267
  return stableCharts;
262
268
  }
263
269
  }
@@ -357,13 +363,17 @@ export class PortfolioCache extends BaseCache<PortfolioData> {
357
363
  valueUsd,
358
364
  icon: assetInfo.icon || '',
359
365
  type: assetInfo.type || 'native',
360
- decimal: assetInfo.decimal
366
+ decimal: assetInfo.decimals ?? assetInfo.decimal // FIX: Try plural first, fallback to singular
361
367
  };
362
368
 
363
369
  return chartData;
364
370
 
365
- } catch (error) {
366
- log.error(tag, `Error fetching balance for ${item.caip}/${item.pubkey}:`, error);
371
+ } catch (error: any) {
372
+ // Format error as single line
373
+ const errorMsg = error.isAxiosError
374
+ ? `${error.message} (${error.code}) - ${error.config?.url || 'unknown url'}`
375
+ : error.message || String(error);
376
+ log.error(tag, `Error fetching balance for ${item.caip}/${item.pubkey}: ${errorMsg}`);
367
377
  return null;
368
378
  }
369
379
  });
@@ -420,8 +430,9 @@ export class PortfolioCache extends BaseCache<PortfolioData> {
420
430
  timestamp: Date.now()
421
431
  };
422
432
 
423
- } catch (error) {
424
- log.error(tag, 'Error fetching portfolio:', error);
433
+ } catch (error: any) {
434
+ const errorMsg = error.message || String(error);
435
+ log.error(tag, `Error fetching portfolio: ${errorMsg}`);
425
436
  throw error;
426
437
  }
427
438
  }