@pioneer-platform/pioneer-sdk 8.15.4 → 8.15.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/index.cjs +13 -14
- package/dist/index.es.js +13 -14
- package/dist/index.js +13 -14
- package/package.json +1 -1
- package/src/charts/cosmos-staking.ts +7 -16
- package/src/charts/index.ts +11 -3
package/dist/index.cjs
CHANGED
|
@@ -644,15 +644,6 @@ async function getCosmosStakingCharts(params) {
|
|
|
644
644
|
const { blockchains, pioneer, pubkeys, context } = params;
|
|
645
645
|
const balances = [];
|
|
646
646
|
try {
|
|
647
|
-
try {
|
|
648
|
-
const fastFlag = typeof process !== "undefined" && process.env && process.env.PIONEER_FAST === "1";
|
|
649
|
-
const isTestContext = typeof context === "string" && /test|e2e/i.test(context);
|
|
650
|
-
if (fastFlag || isTestContext) {
|
|
651
|
-
console.log(tag4, "Fast mode detected (test/e2e). Skipping cosmos staking fetch.");
|
|
652
|
-
return balances;
|
|
653
|
-
}
|
|
654
|
-
} catch (_) {
|
|
655
|
-
}
|
|
656
647
|
console.log(tag4, "Adding Cosmos staking positions to charts...");
|
|
657
648
|
console.log(tag4, "Total pubkeys:", pubkeys.length);
|
|
658
649
|
console.log(tag4, "All pubkeys:", pubkeys.map((p) => ({ address: p.address, networks: p.networks })));
|
|
@@ -696,12 +687,13 @@ async function fetchStakingPositionsForNetwork(networkId, address, context, pion
|
|
|
696
687
|
network,
|
|
697
688
|
address
|
|
698
689
|
});
|
|
699
|
-
|
|
690
|
+
const positions = stakingResponse?.data?.data || stakingResponse?.data || [];
|
|
691
|
+
if (!Array.isArray(positions) || positions.length === 0) {
|
|
700
692
|
console.log(tag4, `No staking positions found for ${address} on ${networkId}`);
|
|
701
693
|
return;
|
|
702
694
|
}
|
|
703
|
-
console.log(tag4, `Found ${
|
|
704
|
-
for (const position of
|
|
695
|
+
console.log(tag4, `Found ${positions.length} staking positions for ${networkId}`);
|
|
696
|
+
for (const position of positions) {
|
|
705
697
|
const processedPosition = processStakingPosition(position, address, context, networkId);
|
|
706
698
|
if (processedPosition && !checkDuplicateBalance(balances, processedPosition.caip, processedPosition.pubkey, processedPosition.validator)) {
|
|
707
699
|
balances.push(processedPosition);
|
|
@@ -773,8 +765,15 @@ var tag5 = "| getCharts |", getCharts = async (blockchains, pioneer, pubkeys, co
|
|
|
773
765
|
balances.push(...evmBalances);
|
|
774
766
|
const mayaBalances = await getMayaCharts(params, balances);
|
|
775
767
|
balances.push(...mayaBalances);
|
|
776
|
-
|
|
777
|
-
|
|
768
|
+
console.log(tag5, "About to call getCosmosStakingCharts...");
|
|
769
|
+
try {
|
|
770
|
+
const stakingBalances = await getCosmosStakingCharts(params);
|
|
771
|
+
console.log(tag5, "getCosmosStakingCharts returned", stakingBalances.length, "balances");
|
|
772
|
+
balances.push(...stakingBalances);
|
|
773
|
+
} catch (stakingError) {
|
|
774
|
+
console.error(tag5, "Error in getCosmosStakingCharts:", stakingError);
|
|
775
|
+
}
|
|
776
|
+
console.log(tag5, "Final balance count:", balances.length);
|
|
778
777
|
return balances;
|
|
779
778
|
} catch (error) {
|
|
780
779
|
console.error(tag5, "Error processing charts:", error);
|
package/dist/index.es.js
CHANGED
|
@@ -635,15 +635,6 @@ async function getCosmosStakingCharts(params) {
|
|
|
635
635
|
const { blockchains, pioneer, pubkeys, context } = params;
|
|
636
636
|
const balances = [];
|
|
637
637
|
try {
|
|
638
|
-
try {
|
|
639
|
-
const fastFlag = typeof process !== "undefined" && process.env && process.env.PIONEER_FAST === "1";
|
|
640
|
-
const isTestContext = typeof context === "string" && /test|e2e/i.test(context);
|
|
641
|
-
if (fastFlag || isTestContext) {
|
|
642
|
-
console.log(tag4, "Fast mode detected (test/e2e). Skipping cosmos staking fetch.");
|
|
643
|
-
return balances;
|
|
644
|
-
}
|
|
645
|
-
} catch (_2) {
|
|
646
|
-
}
|
|
647
638
|
console.log(tag4, "Adding Cosmos staking positions to charts...");
|
|
648
639
|
console.log(tag4, "Total pubkeys:", pubkeys.length);
|
|
649
640
|
console.log(tag4, "All pubkeys:", pubkeys.map((p) => ({ address: p.address, networks: p.networks })));
|
|
@@ -687,12 +678,13 @@ async function fetchStakingPositionsForNetwork(networkId, address, context, pion
|
|
|
687
678
|
network,
|
|
688
679
|
address
|
|
689
680
|
});
|
|
690
|
-
|
|
681
|
+
const positions = stakingResponse?.data?.data || stakingResponse?.data || [];
|
|
682
|
+
if (!Array.isArray(positions) || positions.length === 0) {
|
|
691
683
|
console.log(tag4, `No staking positions found for ${address} on ${networkId}`);
|
|
692
684
|
return;
|
|
693
685
|
}
|
|
694
|
-
console.log(tag4, `Found ${
|
|
695
|
-
for (const position of
|
|
686
|
+
console.log(tag4, `Found ${positions.length} staking positions for ${networkId}`);
|
|
687
|
+
for (const position of positions) {
|
|
696
688
|
const processedPosition = processStakingPosition(position, address, context, networkId);
|
|
697
689
|
if (processedPosition && !checkDuplicateBalance(balances, processedPosition.caip, processedPosition.pubkey, processedPosition.validator)) {
|
|
698
690
|
balances.push(processedPosition);
|
|
@@ -764,8 +756,15 @@ var tag5 = "| getCharts |", getCharts = async (blockchains, pioneer, pubkeys, co
|
|
|
764
756
|
balances.push(...evmBalances);
|
|
765
757
|
const mayaBalances = await getMayaCharts(params, balances);
|
|
766
758
|
balances.push(...mayaBalances);
|
|
767
|
-
|
|
768
|
-
|
|
759
|
+
console.log(tag5, "About to call getCosmosStakingCharts...");
|
|
760
|
+
try {
|
|
761
|
+
const stakingBalances = await getCosmosStakingCharts(params);
|
|
762
|
+
console.log(tag5, "getCosmosStakingCharts returned", stakingBalances.length, "balances");
|
|
763
|
+
balances.push(...stakingBalances);
|
|
764
|
+
} catch (stakingError) {
|
|
765
|
+
console.error(tag5, "Error in getCosmosStakingCharts:", stakingError);
|
|
766
|
+
}
|
|
767
|
+
console.log(tag5, "Final balance count:", balances.length);
|
|
769
768
|
return balances;
|
|
770
769
|
} catch (error) {
|
|
771
770
|
console.error(tag5, "Error processing charts:", error);
|
package/dist/index.js
CHANGED
|
@@ -635,15 +635,6 @@ async function getCosmosStakingCharts(params) {
|
|
|
635
635
|
const { blockchains, pioneer, pubkeys, context } = params;
|
|
636
636
|
const balances = [];
|
|
637
637
|
try {
|
|
638
|
-
try {
|
|
639
|
-
const fastFlag = typeof process !== "undefined" && process.env && process.env.PIONEER_FAST === "1";
|
|
640
|
-
const isTestContext = typeof context === "string" && /test|e2e/i.test(context);
|
|
641
|
-
if (fastFlag || isTestContext) {
|
|
642
|
-
console.log(tag4, "Fast mode detected (test/e2e). Skipping cosmos staking fetch.");
|
|
643
|
-
return balances;
|
|
644
|
-
}
|
|
645
|
-
} catch (_2) {
|
|
646
|
-
}
|
|
647
638
|
console.log(tag4, "Adding Cosmos staking positions to charts...");
|
|
648
639
|
console.log(tag4, "Total pubkeys:", pubkeys.length);
|
|
649
640
|
console.log(tag4, "All pubkeys:", pubkeys.map((p) => ({ address: p.address, networks: p.networks })));
|
|
@@ -687,12 +678,13 @@ async function fetchStakingPositionsForNetwork(networkId, address, context, pion
|
|
|
687
678
|
network,
|
|
688
679
|
address
|
|
689
680
|
});
|
|
690
|
-
|
|
681
|
+
const positions = stakingResponse?.data?.data || stakingResponse?.data || [];
|
|
682
|
+
if (!Array.isArray(positions) || positions.length === 0) {
|
|
691
683
|
console.log(tag4, `No staking positions found for ${address} on ${networkId}`);
|
|
692
684
|
return;
|
|
693
685
|
}
|
|
694
|
-
console.log(tag4, `Found ${
|
|
695
|
-
for (const position of
|
|
686
|
+
console.log(tag4, `Found ${positions.length} staking positions for ${networkId}`);
|
|
687
|
+
for (const position of positions) {
|
|
696
688
|
const processedPosition = processStakingPosition(position, address, context, networkId);
|
|
697
689
|
if (processedPosition && !checkDuplicateBalance(balances, processedPosition.caip, processedPosition.pubkey, processedPosition.validator)) {
|
|
698
690
|
balances.push(processedPosition);
|
|
@@ -764,8 +756,15 @@ var tag5 = "| getCharts |", getCharts = async (blockchains, pioneer, pubkeys, co
|
|
|
764
756
|
balances.push(...evmBalances);
|
|
765
757
|
const mayaBalances = await getMayaCharts(params, balances);
|
|
766
758
|
balances.push(...mayaBalances);
|
|
767
|
-
|
|
768
|
-
|
|
759
|
+
console.log(tag5, "About to call getCosmosStakingCharts...");
|
|
760
|
+
try {
|
|
761
|
+
const stakingBalances = await getCosmosStakingCharts(params);
|
|
762
|
+
console.log(tag5, "getCosmosStakingCharts returned", stakingBalances.length, "balances");
|
|
763
|
+
balances.push(...stakingBalances);
|
|
764
|
+
} catch (stakingError) {
|
|
765
|
+
console.error(tag5, "Error in getCosmosStakingCharts:", stakingError);
|
|
766
|
+
}
|
|
767
|
+
console.log(tag5, "Final balance count:", balances.length);
|
|
769
768
|
return balances;
|
|
770
769
|
} catch (error) {
|
|
771
770
|
console.error(tag5, "Error processing charts:", error);
|
package/package.json
CHANGED
|
@@ -6,20 +6,8 @@ const tag = '| charts-cosmos-staking |';
|
|
|
6
6
|
export async function getCosmosStakingCharts(params: ChartParams): Promise<ChartBalance[]> {
|
|
7
7
|
const { blockchains, pioneer, pubkeys, context } = params;
|
|
8
8
|
const balances: ChartBalance[] = [];
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
// Fast-path: skip staking in test/e2e or when explicitly requested
|
|
12
|
-
try {
|
|
13
|
-
const fastFlag = typeof process !== 'undefined' && process.env && process.env.PIONEER_FAST === '1';
|
|
14
|
-
const isTestContext = typeof context === 'string' && /test|e2e/i.test(context);
|
|
15
|
-
if (fastFlag || isTestContext) {
|
|
16
|
-
console.log(tag, 'Fast mode detected (test/e2e). Skipping cosmos staking fetch.');
|
|
17
|
-
return balances;
|
|
18
|
-
}
|
|
19
|
-
} catch (_) {
|
|
20
|
-
// ignore
|
|
21
|
-
}
|
|
22
9
|
|
|
10
|
+
try {
|
|
23
11
|
console.log(tag, 'Adding Cosmos staking positions to charts...');
|
|
24
12
|
console.log(tag, 'Total pubkeys:', pubkeys.length);
|
|
25
13
|
console.log(tag, 'All pubkeys:', pubkeys.map((p: any) => ({ address: p.address, networks: p.networks })));
|
|
@@ -105,17 +93,20 @@ async function fetchStakingPositionsForNetwork(
|
|
|
105
93
|
address,
|
|
106
94
|
});
|
|
107
95
|
|
|
108
|
-
|
|
96
|
+
// Extract positions array from nested data structure
|
|
97
|
+
const positions = stakingResponse?.data?.data || stakingResponse?.data || [];
|
|
98
|
+
|
|
99
|
+
if (!Array.isArray(positions) || positions.length === 0) {
|
|
109
100
|
console.log(tag, `No staking positions found for ${address} on ${networkId}`);
|
|
110
101
|
return;
|
|
111
102
|
}
|
|
112
103
|
|
|
113
104
|
console.log(
|
|
114
105
|
tag,
|
|
115
|
-
`Found ${
|
|
106
|
+
`Found ${positions.length} staking positions for ${networkId}`,
|
|
116
107
|
);
|
|
117
108
|
|
|
118
|
-
for (const position of
|
|
109
|
+
for (const position of positions) {
|
|
119
110
|
const processedPosition = processStakingPosition(
|
|
120
111
|
position,
|
|
121
112
|
address,
|
package/src/charts/index.ts
CHANGED
|
@@ -35,9 +35,17 @@ export const getCharts = async (
|
|
|
35
35
|
balances.push(...mayaBalances);
|
|
36
36
|
|
|
37
37
|
// Add Cosmos Staking Positions to charts
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
console.log(tag, 'About to call getCosmosStakingCharts...');
|
|
39
|
+
try {
|
|
40
|
+
const stakingBalances = await getCosmosStakingCharts(params);
|
|
41
|
+
console.log(tag, 'getCosmosStakingCharts returned', stakingBalances.length, 'balances');
|
|
42
|
+
balances.push(...stakingBalances);
|
|
43
|
+
} catch (stakingError) {
|
|
44
|
+
console.error(tag, 'Error in getCosmosStakingCharts:', stakingError);
|
|
45
|
+
// Don't throw, continue with other balances
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log(tag, 'Final balance count:', balances.length);
|
|
41
49
|
return balances;
|
|
42
50
|
} catch (error) {
|
|
43
51
|
console.error(tag, 'Error processing charts:', error);
|