@pioneer-platform/pioneer-sdk 8.15.38 → 8.15.40

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/index.cjs CHANGED
@@ -472,6 +472,14 @@ function processPortfolioBalance(balance, primaryAddress, context, blockchains)
472
472
  valueUsd: balance.valueUsd.toString(),
473
473
  updated: new Date().getTime()
474
474
  };
475
+ if (balance.caip === "cosmos:cosmoshub-4/slip44:118" || balance.caip === "cosmos:osmosis-1/slip44:118") {
476
+ console.log(tag2, `\uD83D\uDCCA [CHART CREATED] ${assetInfo?.symbol || balance.symbol}:`, {
477
+ caip: balance.caip,
478
+ decimal: chartBalance.decimal,
479
+ decimals: chartBalance.decimals,
480
+ precision: chartBalance.precision
481
+ });
482
+ }
475
483
  if (balance.display) {
476
484
  chartBalance.icon = ["multi", chartBalance.icon, balance.display.toString()].toString();
477
485
  }
@@ -4463,6 +4471,13 @@ function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
4463
4471
  valueUsd: balance.valueUsd,
4464
4472
  priceUsd: balance.priceUsd
4465
4473
  });
4474
+ if (balance.caip === "cosmos:cosmoshub-4/slip44:118" || balance.caip === "cosmos:osmosis-1/slip44:118") {
4475
+ console.log(tag, `✅ [DEBUG] Enriched ${balance.symbol}:`, {
4476
+ caip: balance.caip,
4477
+ decimals: balance.decimals,
4478
+ precision: balance.precision
4479
+ });
4480
+ }
4466
4481
  enrichedBalances.push(balance);
4467
4482
  }
4468
4483
  if (enrichedBalances.length < balances.length) {
@@ -5825,7 +5840,7 @@ class SDK {
5825
5840
  const { getCharts: getChartsModular } = await Promise.resolve().then(() => (init_charts(), exports_charts));
5826
5841
  const newBalances = await getChartsModular(this.blockchains, this.pioneer, this.pubkeys, this.context);
5827
5842
  console.log(tag6, `Modular charts returned ${newBalances.length} balances (native + tokens + staking)`);
5828
- const uniqueBalances = new Map([...this.balances, ...newBalances].map((balance) => [
5843
+ const uniqueBalances = new Map([...newBalances, ...this.balances].map((balance) => [
5829
5844
  balance.identifier || `${balance.caip}:${balance.pubkey}`,
5830
5845
  {
5831
5846
  ...balance,
package/dist/index.es.js CHANGED
@@ -463,6 +463,14 @@ function processPortfolioBalance(balance, primaryAddress, context, blockchains)
463
463
  valueUsd: balance.valueUsd.toString(),
464
464
  updated: new Date().getTime()
465
465
  };
466
+ if (balance.caip === "cosmos:cosmoshub-4/slip44:118" || balance.caip === "cosmos:osmosis-1/slip44:118") {
467
+ console.log(tag2, `\uD83D\uDCCA [CHART CREATED] ${assetInfo?.symbol || balance.symbol}:`, {
468
+ caip: balance.caip,
469
+ decimal: chartBalance.decimal,
470
+ decimals: chartBalance.decimals,
471
+ precision: chartBalance.precision
472
+ });
473
+ }
466
474
  if (balance.display) {
467
475
  chartBalance.icon = ["multi", chartBalance.icon, balance.display.toString()].toString();
468
476
  }
@@ -4647,6 +4655,13 @@ function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
4647
4655
  valueUsd: balance.valueUsd,
4648
4656
  priceUsd: balance.priceUsd
4649
4657
  });
4658
+ if (balance.caip === "cosmos:cosmoshub-4/slip44:118" || balance.caip === "cosmos:osmosis-1/slip44:118") {
4659
+ console.log(tag, `✅ [DEBUG] Enriched ${balance.symbol}:`, {
4660
+ caip: balance.caip,
4661
+ decimals: balance.decimals,
4662
+ precision: balance.precision
4663
+ });
4664
+ }
4650
4665
  enrichedBalances.push(balance);
4651
4666
  }
4652
4667
  if (enrichedBalances.length < balances.length) {
@@ -6009,7 +6024,7 @@ class SDK {
6009
6024
  const { getCharts: getChartsModular } = await Promise.resolve().then(() => (init_charts(), exports_charts));
6010
6025
  const newBalances = await getChartsModular(this.blockchains, this.pioneer, this.pubkeys, this.context);
6011
6026
  console.log(tag6, `Modular charts returned ${newBalances.length} balances (native + tokens + staking)`);
6012
- const uniqueBalances = new Map([...this.balances, ...newBalances].map((balance) => [
6027
+ const uniqueBalances = new Map([...newBalances, ...this.balances].map((balance) => [
6013
6028
  balance.identifier || `${balance.caip}:${balance.pubkey}`,
6014
6029
  {
6015
6030
  ...balance,
package/dist/index.js CHANGED
@@ -463,6 +463,14 @@ function processPortfolioBalance(balance, primaryAddress, context, blockchains)
463
463
  valueUsd: balance.valueUsd.toString(),
464
464
  updated: new Date().getTime()
465
465
  };
466
+ if (balance.caip === "cosmos:cosmoshub-4/slip44:118" || balance.caip === "cosmos:osmosis-1/slip44:118") {
467
+ console.log(tag2, `\uD83D\uDCCA [CHART CREATED] ${assetInfo?.symbol || balance.symbol}:`, {
468
+ caip: balance.caip,
469
+ decimal: chartBalance.decimal,
470
+ decimals: chartBalance.decimals,
471
+ precision: chartBalance.precision
472
+ });
473
+ }
466
474
  if (balance.display) {
467
475
  chartBalance.icon = ["multi", chartBalance.icon, balance.display.toString()].toString();
468
476
  }
@@ -4647,6 +4655,13 @@ function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
4647
4655
  valueUsd: balance.valueUsd,
4648
4656
  priceUsd: balance.priceUsd
4649
4657
  });
4658
+ if (balance.caip === "cosmos:cosmoshub-4/slip44:118" || balance.caip === "cosmos:osmosis-1/slip44:118") {
4659
+ console.log(tag, `✅ [DEBUG] Enriched ${balance.symbol}:`, {
4660
+ caip: balance.caip,
4661
+ decimals: balance.decimals,
4662
+ precision: balance.precision
4663
+ });
4664
+ }
4650
4665
  enrichedBalances.push(balance);
4651
4666
  }
4652
4667
  if (enrichedBalances.length < balances.length) {
@@ -6009,7 +6024,7 @@ class SDK {
6009
6024
  const { getCharts: getChartsModular } = await Promise.resolve().then(() => (init_charts(), exports_charts));
6010
6025
  const newBalances = await getChartsModular(this.blockchains, this.pioneer, this.pubkeys, this.context);
6011
6026
  console.log(tag6, `Modular charts returned ${newBalances.length} balances (native + tokens + staking)`);
6012
- const uniqueBalances = new Map([...this.balances, ...newBalances].map((balance) => [
6027
+ const uniqueBalances = new Map([...newBalances, ...this.balances].map((balance) => [
6013
6028
  balance.identifier || `${balance.caip}:${balance.pubkey}`,
6014
6029
  {
6015
6030
  ...balance,
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "author": "highlander",
3
3
  "name": "@pioneer-platform/pioneer-sdk",
4
- "version": "8.15.38",
4
+ "version": "8.15.40",
5
5
  "dependencies": {
6
6
  "@keepkey/keepkey-sdk": "^0.2.62",
7
- "@pioneer-platform/pioneer-caip": "^9.10.15",
8
- "@pioneer-platform/pioneer-client": "^9.10.21",
9
- "@pioneer-platform/pioneer-coins": "^9.11.15",
10
- "@pioneer-platform/pioneer-discovery": "^8.15.38",
11
- "@pioneer-platform/pioneer-events": "^8.12.10",
7
+ "@pioneer-platform/pioneer-caip": "^9.10.17",
8
+ "@pioneer-platform/pioneer-client": "^9.10.23",
9
+ "@pioneer-platform/pioneer-coins": "^9.11.17",
10
+ "@pioneer-platform/pioneer-discovery": "^8.15.40",
11
+ "@pioneer-platform/pioneer-events": "^8.12.12",
12
12
  "coinselect": "^3.1.13",
13
13
  "eventemitter3": "^5.0.1",
14
14
  "neotraverse": "^0.6.8",
package/src/charts/evm.ts CHANGED
@@ -120,6 +120,7 @@ export async function getEvmCharts(params: ChartParams): Promise<ChartBalance[]>
120
120
 
121
121
  for (const token of portfolio.tokens) {
122
122
  const processedToken = processPortfolioToken(token, primaryAddress, context, blockchains);
123
+
123
124
  if (processedToken && !checkDuplicateBalance(balances, processedToken.caip, processedToken.pubkey)) {
124
125
  balances.push(processedToken);
125
126
  }
@@ -224,6 +225,16 @@ function processPortfolioBalance(
224
225
  updated: new Date().getTime(),
225
226
  };
226
227
 
228
+ // DEBUG: Log ATOM and OSMO chart balance creation
229
+ if (balance.caip === 'cosmos:cosmoshub-4/slip44:118' || balance.caip === 'cosmos:osmosis-1/slip44:118') {
230
+ console.log(tag, `📊 [CHART CREATED] ${assetInfo?.symbol || balance.symbol}:`, {
231
+ caip: balance.caip,
232
+ decimal: chartBalance.decimal,
233
+ decimals: chartBalance.decimals,
234
+ precision: chartBalance.precision,
235
+ });
236
+ }
237
+
227
238
  // Handle display icon for multi-asset icons
228
239
  if (balance.display) {
229
240
  chartBalance.icon = ['multi', chartBalance.icon, balance.display.toString()].toString();
@@ -15,6 +15,8 @@ export interface ChartBalance {
15
15
  type: string;
16
16
  token?: boolean; // Indicates if this is a token balance
17
17
  decimal?: number;
18
+ decimals?: number; // Number of decimal places (NEW standard)
19
+ precision?: number; // Precision for the asset (alias for decimals)
18
20
  balance: string;
19
21
  priceUsd: number;
20
22
  valueUsd: number | string;
package/src/index.ts CHANGED
@@ -1755,8 +1755,10 @@ export class SDK {
1755
1755
  console.log(tag, `Modular charts returned ${newBalances.length} balances (native + tokens + staking)`);
1756
1756
 
1757
1757
  // Deduplicate balances using a Map with `identifier` as the key
1758
+ // CRITICAL: Put newBalances FIRST so this.balances (with enriched data) override incomplete newBalances
1759
+ // When Map is constructed from an array with duplicate keys, the LAST occurrence wins
1758
1760
  const uniqueBalances = new Map(
1759
- [...this.balances, ...newBalances].map((balance: any) => [
1761
+ [...newBalances, ...this.balances].map((balance: any) => [
1760
1762
  balance.identifier || `${balance.caip}:${balance.pubkey}`,
1761
1763
  {
1762
1764
  ...balance,
@@ -376,6 +376,15 @@ export function enrichBalancesWithAssetInfo(
376
376
  priceUsd: balance.priceUsd,
377
377
  });
378
378
 
379
+ // DEBUG: Verify ATOM and OSMO after enrichment
380
+ if (balance.caip === 'cosmos:cosmoshub-4/slip44:118' || balance.caip === 'cosmos:osmosis-1/slip44:118') {
381
+ console.log(tag, `✅ [DEBUG] Enriched ${balance.symbol}:`, {
382
+ caip: balance.caip,
383
+ decimals: balance.decimals,
384
+ precision: balance.precision,
385
+ });
386
+ }
387
+
379
388
  enrichedBalances.push(balance);
380
389
  }
381
390