Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/track stake programs #8917

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sharp-cheetahs-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

track all stake programs in analytics
11 changes: 11 additions & 0 deletions apps/ledger-live-desktop/src/renderer/analytics/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const getPtxAttributes = () => {
if (!analyticsFeatureFlagMethod) return {};
const fetchAdditionalCoins = analyticsFeatureFlagMethod("fetchAdditionalCoins");
const stakingProviders = analyticsFeatureFlagMethod("ethStakingProviders");
const stakePrograms = analyticsFeatureFlagMethod("stakePrograms");
const ptxCard = analyticsFeatureFlagMethod("ptxCard");

const isBatch1Enabled: boolean =
Expand All @@ -113,13 +114,23 @@ const getPtxAttributes = () => {
stakingProviders?.params?.listProvider?.length > 0
? stakingProviders?.params?.listProvider.length
: "flag not loaded";
const stakingCurrenciesEnabled =
!stakePrograms?.params?.list?.length || !stakePrograms?.enabled
? {}
: Object.fromEntries(
stakePrograms?.params?.list?.map((currencyId: string) => [
`feature_earn_${currencyId}_enabled`,
true,
]),
);

return {
isBatch1Enabled,
isBatch2Enabled,
isBatch3Enabled,
stakingProvidersEnabled,
ptxCard,
...stakingCurrenciesEnabled,
};
};

Expand Down
11 changes: 11 additions & 0 deletions apps/ledger-live-mobile/src/analytics/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const getFeatureFlagProperties = () => {
(async () => {
const fetchAdditionalCoins = analyticsFeatureFlagMethod("fetchAdditionalCoins");
const stakingProviders = analyticsFeatureFlagMethod("ethStakingProviders");
const stakePrograms = analyticsFeatureFlagMethod("stakePrograms");

const isBatch1Enabled =
!!fetchAdditionalCoins?.enabled && fetchAdditionalCoins?.params?.batch === 1;
Expand All @@ -85,12 +86,22 @@ const getFeatureFlagProperties = () => {
!!fetchAdditionalCoins?.enabled && fetchAdditionalCoins?.params?.batch === 3;
const stakingProvidersEnabled =
stakingProviders?.enabled && stakingProviders?.params?.listProvider.length;
const stakingCurrenciesEnabled =
!stakePrograms?.params?.list?.length || !stakePrograms?.enabled
? {}
: Object.fromEntries(
stakePrograms?.params?.list?.map((currencyId: string) => [
`feature_earn_${currencyId}_enabled`,
true,
]),
);

updateIdentify({
isBatch1Enabled,
isBatch2Enabled,
isBatch3Enabled,
stakingProvidersEnabled,
...stakingCurrenciesEnabled,
});
})();
};
Expand Down
Loading