@pioneer-platform/pioneer-cache 1.1.21 → 1.1.24

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,29 @@
1
1
  # @pioneer-platform/pioneer-cache
2
2
 
3
+ ## 1.1.24
4
+
5
+ ### Patch Changes
6
+
7
+ - chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: fix: move @types/pdfkit to dependencies for Docker --production build
8
+ - Updated dependencies
9
+ - @pioneer-platform/redis-queue@8.12.14
10
+
11
+ ## 1.1.23
12
+
13
+ ### Patch Changes
14
+
15
+ - chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: fix: move @types/pdfkit to dependencies for Docker --production build
16
+ - Updated dependencies
17
+ - @pioneer-platform/redis-queue@8.12.13
18
+
19
+ ## 1.1.22
20
+
21
+ ### Patch Changes
22
+
23
+ - chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: fix: move @types/pdfkit to dependencies for Docker --production build
24
+ - Updated dependencies
25
+ - @pioneer-platform/redis-queue@8.12.12
26
+
3
27
  ## 1.1.21
4
28
 
5
29
  ### Patch Changes
@@ -14,6 +14,8 @@ export interface BalanceData {
14
14
  networkId?: string;
15
15
  type?: string;
16
16
  isNative?: boolean;
17
+ decimals?: number;
18
+ precision?: number;
17
19
  fetchedAt?: number;
18
20
  fetchedAtISO?: string;
19
21
  dataSource?: string;
@@ -107,10 +107,15 @@ class BalanceCache extends base_cache_1.BaseCache {
107
107
  if (!balanceInfo || !balanceInfo.balance) {
108
108
  log.warn(tag, `No balance returned for ${caip}/${sanitizePubkey(pubkey)}`);
109
109
  const now = Date.now();
110
+ // Get asset metadata even for zero balances
111
+ const assetData = require('@pioneer-platform/pioneer-discovery').assetData;
112
+ const assetInfo = assetData[caip.toUpperCase()] || assetData[caip.toLowerCase()] || {};
110
113
  return {
111
114
  caip,
112
115
  pubkey,
113
116
  balance: '0',
117
+ decimals: assetInfo.decimals,
118
+ precision: assetInfo.decimals, // Set precision to decimals for compatibility
114
119
  fetchedAt: now,
115
120
  fetchedAtISO: new Date(now).toISOString()
116
121
  };
@@ -155,6 +160,8 @@ class BalanceCache extends base_cache_1.BaseCache {
155
160
  symbol: assetInfo.symbol,
156
161
  name: assetInfo.name,
157
162
  networkId,
163
+ decimals: assetInfo.decimals,
164
+ precision: assetInfo.decimals, // Set precision to decimals for compatibility
158
165
  fetchedAt: now,
159
166
  fetchedAtISO: new Date(now).toISOString(),
160
167
  dataSource
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/pioneer-cache",
3
- "version": "1.1.21",
3
+ "version": "1.1.24",
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",
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "@pioneer-platform/loggerdog": "^8.11.0",
24
- "@pioneer-platform/redis-queue": "^8.12.11",
24
+ "@pioneer-platform/redis-queue": "^8.12.14",
25
25
  "@pioneer-platform/default-redis": "^8.11.7"
26
26
  },
27
27
  "devDependencies": {
@@ -57,6 +57,8 @@ export interface BalanceData {
57
57
  networkId?: string;
58
58
  type?: string; // ✅ PHASE 1: Asset type (native, token, unknown)
59
59
  isNative?: boolean; // ✅ PHASE 1: Whether asset is native to chain (backward compat)
60
+ decimals?: number; // Number of decimal places for the asset (e.g., 8 for BTC, 18 for ETH, 6 for ATOM)
61
+ precision?: number; // Precision for the asset (alias for decimals for compatibility)
60
62
  fetchedAt?: number; // Unix timestamp when balance was fetched from blockchain
61
63
  fetchedAtISO?: string; // ISO 8601 string for display (e.g., "2025-01-11T12:34:56.789Z")
62
64
  dataSource?: string; // Data source description (e.g., "Bitcoin Blockbook", "Ethereum RPC")
@@ -140,10 +142,17 @@ export class BalanceCache extends BaseCache<BalanceData> {
140
142
  if (!balanceInfo || !balanceInfo.balance) {
141
143
  log.warn(tag, `No balance returned for ${caip}/${sanitizePubkey(pubkey)}`);
142
144
  const now = Date.now();
145
+
146
+ // Get asset metadata even for zero balances
147
+ const assetData = require('@pioneer-platform/pioneer-discovery').assetData;
148
+ const assetInfo = assetData[caip.toUpperCase()] || assetData[caip.toLowerCase()] || {};
149
+
143
150
  return {
144
151
  caip,
145
152
  pubkey,
146
153
  balance: '0',
154
+ decimals: assetInfo.decimals,
155
+ precision: assetInfo.decimals, // Set precision to decimals for compatibility
147
156
  fetchedAt: now,
148
157
  fetchedAtISO: new Date(now).toISOString()
149
158
  };
@@ -188,6 +197,8 @@ export class BalanceCache extends BaseCache<BalanceData> {
188
197
  symbol: assetInfo.symbol,
189
198
  name: assetInfo.name,
190
199
  networkId,
200
+ decimals: assetInfo.decimals,
201
+ precision: assetInfo.decimals, // Set precision to decimals for compatibility
191
202
  fetchedAt: now,
192
203
  fetchedAtISO: new Date(now).toISOString(),
193
204
  dataSource