Skip to content

Commit dac68dc

Browse files
authored
Merge pull request #9888 from LedgerHQ/LIVE-18045-mainnet-live-on-10th-april-lld-llm-babylon-mainnet-integration-cosmos
[LIVE-18045] Babylon mainnet light integration
2 parents 21d3113 + de92b67 commit dac68dc

File tree

37 files changed

+621
-30
lines changed

37 files changed

+621
-30
lines changed

.changeset/metal-planes-visit.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
"@ledgerhq/types-cryptoassets": minor
3+
"@ledgerhq/cryptoassets": minor
4+
"@ledgerhq/types-live": minor
5+
"@ledgerhq/coin-cosmos": minor
6+
"@ledgerhq/crypto-icons-ui": minor
7+
"ledger-live-desktop": minor
8+
"live-mobile": minor
9+
"@ledgerhq/live-common": minor
10+
"@ledgerhq/coin-framework": minor
11+
"@ledgerhq/web-tools": minor
12+
"@ledgerhq/live-cli": minor
13+
---
14+
15+
add babylon currency

apps/cli/src/live-common-setup-base.ts

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ setSupportedCurrencies([
112112
"sonic",
113113
"sonic_blaze",
114114
"mina",
115+
"babylon",
115116
]);
116117

117118
for (const k in process.env) setEnvUnsafe(k as EnvName, process.env[k]);

apps/ledger-live-desktop/src/live-common-set-supported-currencies.ts

+1
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,5 @@ setSupportedCurrencies([
106106
"sonic",
107107
"sonic_blaze",
108108
"mina",
109+
"babylon",
109110
]);

apps/ledger-live-desktop/src/renderer/families/cosmos/AccountBalanceSummaryFooter.tsx

+21-14
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { CosmosAccount } from "@ledgerhq/live-common/families/cosmos/types";
1515
import { CosmosAPI } from "@ledgerhq/coin-cosmos/network/Cosmos";
1616
import { TokenAccount } from "@ledgerhq/types-live";
1717
import { useAccountUnit } from "~/renderer/hooks/useAccountUnit";
18+
import { getCurrencyConfiguration } from "@ledgerhq/live-common/config/index";
1819

1920
const Wrapper = styled(Box).attrs(() => ({
2021
horizontal: true,
@@ -100,6 +101,10 @@ const AccountBalanceSummaryFooter = ({ account }: Props) => {
100101

101102
const isDyDx = account.currency.id === "dydx";
102103

104+
const coinConfig = getCurrencyConfiguration(account.currency);
105+
const disableDelegation =
106+
"disableDelegation" in coinConfig && coinConfig.disableDelegation === true;
107+
103108
return (
104109
<Wrapper>
105110
<BalanceDetail>
@@ -115,19 +120,21 @@ const AccountBalanceSummaryFooter = ({ account }: Props) => {
115120
<Discreet>{spendableBalance}</Discreet>
116121
</AmountValue>
117122
</BalanceDetail>
118-
<BalanceDetail>
119-
<ToolTip content={<Trans i18nKey="account.delegatedTooltip" />}>
120-
<TitleWrapper>
121-
<Title>
122-
<Trans i18nKey="account.delegatedAssets" />
123-
</Title>
124-
<InfoCircle size={13} />
125-
</TitleWrapper>
126-
</ToolTip>
127-
<AmountValue>
128-
<Discreet>{delegatedBalance}</Discreet>
129-
</AmountValue>
130-
</BalanceDetail>
123+
{!disableDelegation && (
124+
<BalanceDetail>
125+
<ToolTip content={<Trans i18nKey="account.delegatedTooltip" />}>
126+
<TitleWrapper>
127+
<Title>
128+
<Trans i18nKey="account.delegatedAssets" />
129+
</Title>
130+
<InfoCircle size={13} />
131+
</TitleWrapper>
132+
</ToolTip>
133+
<AmountValue>
134+
<Discreet>{delegatedBalance}</Discreet>
135+
</AmountValue>
136+
</BalanceDetail>
137+
)}
131138
{/* FIXME: this is a hack to display USDC claimableRewards for dYdX until ibc tokens are properly handle in LL */}
132139
{isDyDx && (
133140
<BalanceDetail>
@@ -144,7 +151,7 @@ const AccountBalanceSummaryFooter = ({ account }: Props) => {
144151
</AmountValue>
145152
</BalanceDetail>
146153
)}
147-
{_unbondingBalance.gt(0) && (
154+
{!disableDelegation && _unbondingBalance.gt(0) && (
148155
<BalanceDetail>
149156
<ToolTip
150157
content={

apps/ledger-live-desktop/src/renderer/families/cosmos/Delegation/index.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { useLocalizedUrl } from "~/renderer/hooks/useLocalizedUrls";
3030
import { useAccountUnit } from "~/renderer/hooks/useAccountUnit";
3131
import cosmosBase from "@ledgerhq/coin-cosmos/chain/cosmosBase";
3232
import { useHistory } from "react-router";
33+
import { getCurrencyConfiguration } from "@ledgerhq/live-common/config/index";
3334

3435
const Wrapper = styled(Box).attrs(() => ({
3536
p: 3,
@@ -264,6 +265,11 @@ const Delegation = ({ account }: { account: CosmosAccount }) => {
264265
const Delegations = ({ account }: { account: CosmosAccount | TokenAccount }) => {
265266
if (account.type !== "Account") return null;
266267

268+
const coinConfig = getCurrencyConfiguration(account.currency);
269+
if ("disableDelegation" in coinConfig && coinConfig.disableDelegation === true) {
270+
return null;
271+
}
272+
267273
return <Delegation account={account} />;
268274
};
269275
export default Delegations;

apps/ledger-live-desktop/src/renderer/modals/AddAccounts/steps/StepChooseCurrency.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ const StepChooseCurrency = ({ currency, setCurrency }: StepProps) => {
9393
const sonicBlaze = useFeature("currencySonicBlaze");
9494
const sui = useFeature("currencySui");
9595
const mina = useFeature("currencyMina");
96+
const babylon = useFeature("currencyBabylon");
9697

9798
const featureFlaggedCurrencies = useMemo(
9899
(): Partial<Record<CryptoCurrencyId, Feature<unknown> | null>> => ({
@@ -154,6 +155,7 @@ const StepChooseCurrency = ({ currency, setCurrency }: StepProps) => {
154155
sonic_blaze: sonicBlaze,
155156
sui,
156157
mina,
158+
babylon,
157159
}),
158160
[
159161
aptos,
@@ -214,6 +216,7 @@ const StepChooseCurrency = ({ currency, setCurrency }: StepProps) => {
214216
sonicBlaze,
215217
sui,
216218
mina,
219+
babylon,
217220
],
218221
);
219222

apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts-snapshots/wallet-api-currencies-darwin.json

+9
Original file line numberDiff line numberDiff line change
@@ -889,5 +889,14 @@
889889
"family": "ethereum",
890890
"color": "#FFFFFF",
891891
"decimals": 18
892+
},
893+
{
894+
"type": "CryptoCurrency",
895+
"id": "babylon",
896+
"ticker": "BABY",
897+
"name": "Babylon",
898+
"family": "cosmos",
899+
"color": "#CE6533",
900+
"decimals": 6
892901
}
893902
]

apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts-snapshots/wallet-api-currencies-linux.json

+9
Original file line numberDiff line numberDiff line change
@@ -889,5 +889,14 @@
889889
"family": "ethereum",
890890
"color": "#FFFFFF",
891891
"decimals": 18
892+
},
893+
{
894+
"type": "CryptoCurrency",
895+
"id": "babylon",
896+
"ticker": "BABY",
897+
"name": "Babylon",
898+
"family": "cosmos",
899+
"color": "#CE6533",
900+
"decimals": 6
892901
}
893902
]

apps/ledger-live-mobile/src/families/cosmos/AccountBalanceSummaryFooter.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type { ModalInfo } from "~/modals/Info";
1414
import CurrencyUnitValue from "~/components/CurrencyUnitValue";
1515
import InfoItem from "~/components/BalanceSummaryInfoItem";
1616
import { useAccountUnit } from "~/hooks/useAccountUnit";
17+
import { getCurrencyConfiguration } from "@ledgerhq/live-common/config/index";
1718

1819
type Props = {
1920
account: CosmosAccount;
@@ -40,6 +41,10 @@ function AccountBalanceSummaryFooter({ account }: Props) {
4041

4142
const [dydxUsdcRewards, setDydxUsdcRewards] = useState(new BigNumber(0));
4243

44+
const coinConfig = getCurrencyConfiguration(account.currency);
45+
const disableDelegation =
46+
"disableDelegation" in coinConfig && coinConfig.disableDelegation === true;
47+
4348
useEffect(() => {
4449
if (account.type !== "Account") {
4550
return;
@@ -79,7 +84,7 @@ function AccountBalanceSummaryFooter({ account }: Props) {
7984
value={<CurrencyUnitValue unit={unit} value={spendableBalance} disableRounding />}
8085
isLast={!delegatedBalance.gt(0) && !unbondingBalance.gt(0)}
8186
/>
82-
{delegatedBalance.gt(0) && (
87+
{delegatedBalance.gt(0) && !disableDelegation && (
8388
<InfoItem
8489
title={t("account.delegatedAssets")}
8590
onPress={onPressInfoCreator("delegated")}
@@ -96,7 +101,7 @@ function AccountBalanceSummaryFooter({ account }: Props) {
96101
isLast={!dydxUsdcRewards.gt(0)}
97102
/>
98103
)}
99-
{unbondingBalance.gt(0) && (
104+
{unbondingBalance.gt(0) && !disableDelegation && (
100105
<InfoItem
101106
title={t("account.undelegating")}
102107
onPress={onPressInfoCreator("undelegating")}

apps/ledger-live-mobile/src/families/cosmos/Delegations/index.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import ValidatorImage from "../shared/ValidatorImage";
5757
import { useAccountName } from "~/reducers/wallet";
5858
import { useAccountUnit } from "~/hooks/useAccountUnit";
5959
import { useStake } from "LLM/hooks/useStake/useStake";
60+
import { getCurrencyConfiguration } from "@ledgerhq/live-common/config/index";
6061

6162
type Props = {
6263
account: CosmosAccount;
@@ -557,8 +558,14 @@ function Delegations({ account }: Props) {
557558
);
558559
}
559560

560-
export default function CosmosDelegations({ account }: { account: AccountLike }) {
561-
if (!(account as CosmosAccount).cosmosResources) return null;
561+
export default function CosmosDelegations({ account }: { account: AccountLike<CosmosAccount> }) {
562+
if (account.type !== "Account" || !account.cosmosResources) return null;
563+
564+
const coinConfig = getCurrencyConfiguration(account.currency);
565+
if ("disableDelegation" in coinConfig && coinConfig.disableDelegation === true) {
566+
return null;
567+
}
568+
562569
return <Delegations account={account as CosmosAccount} />;
563570
}
564571

apps/ledger-live-mobile/src/live-common-setup.ts

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ setSupportedCurrencies([
128128
"sonic",
129129
"sonic_blaze",
130130
"mina",
131+
"babylon",
131132
]);
132133

133134
if (Config.FORCE_PROVIDER && !isNaN(parseInt(Config.FORCE_PROVIDER, 10)))

apps/ledger-live-mobile/src/screens/Account/ListHeaderComponent.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import WarningBannerStatus from "~/components/WarningBannerStatus";
3636
import ErrorWarning from "./ErrorWarning";
3737
import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
3838
import { isNFTCollectionsDisplayable } from "./nftHelper";
39+
import { getCurrencyConfiguration } from "@ledgerhq/live-common/config/index";
3940

4041
type Props = {
4142
account?: AccountLike;
@@ -137,6 +138,10 @@ export function useListHeaderComponents({
137138
llmSolanaNftsEnabled: llmSolanaNfts?.enabled,
138139
});
139140

141+
const coinConfig = getCurrencyConfiguration(currency);
142+
const disableDelegation =
143+
"disableDelegation" in coinConfig && coinConfig.disableDelegation === true;
144+
140145
return {
141146
listHeaderComponents: [
142147
<Box mt={6} onLayout={onAccountCardLayout} key="AccountGraphCard">
@@ -177,6 +182,7 @@ export function useListHeaderComponents({
177182
<FabAccountMainActions account={account} parentAccount={parentAccount} />
178183
</SectionContainer>,
179184
...(!empty &&
185+
!disableDelegation &&
180186
(AccountHeaderRendered || AccountBalanceSummaryFooterRendered || secondaryActions.length > 0)
181187
? [
182188
<SectionContainer key="AccountHeader">

apps/ledger-live-mobile/src/screens/AddAccounts/01-SelectCrypto.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export default function AddAccountsSelectCrypto({ navigation, route }: Props) {
115115
const sonic = useFeature("currencySonic");
116116
const sonicBlaze = useFeature("currencySonicBlaze");
117117
const sui = useFeature("currencySui");
118+
const babylon = useFeature("currencyBabylon");
118119

119120
const featureFlaggedCurrencies = useMemo(
120121
(): Partial<Record<CryptoCurrencyId, Feature<unknown> | null>> => ({
@@ -176,6 +177,7 @@ export default function AddAccountsSelectCrypto({ navigation, route }: Props) {
176177
sonic_blaze: sonicBlaze,
177178
sui,
178179
mina,
180+
babylon,
179181
}),
180182
[
181183
aptos,
@@ -236,6 +238,7 @@ export default function AddAccountsSelectCrypto({ navigation, route }: Props) {
236238
sonicBlaze,
237239
sui,
238240
mina,
241+
babylon,
239242
],
240243
);
241244

apps/web-tools/live-common-setup.ts

+1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,5 @@ setSupportedCurrencies([
7474
"zenrock",
7575
"sui",
7676
"mina",
77+
"babylon",
7778
]);

libs/coin-framework/src/currencies/__snapshots__/formatCurrencyUnit.test.ts.snap

+22
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ exports[`formatCurrencyUnit with custom options with locale de-DE should correct
2424

2525
exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Axelar unit (Axelar) 1`] = `"12.345.678.900,000000- -AXL"`;
2626

27+
exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Babylon unit (Babylon) 1`] = `"12.345.678.900,000000- -BABY"`;
28+
2729
exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Banano unit (BANANO) 1`] = `"123.456.789,00000000- -BANANO"`;
2830

2931
exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Base Sepolia unit (ETH) 1`] = `"0,012345678900000000- -ETH"`;
@@ -372,6 +374,8 @@ exports[`formatCurrencyUnit with custom options with locale en-US should correct
372374

373375
exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Axelar unit (Axelar) 1`] = `"12,345,678,900.000000- -AXL"`;
374376

377+
exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Babylon unit (Babylon) 1`] = `"12,345,678,900.000000- -BABY"`;
378+
375379
exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Banano unit (BANANO) 1`] = `"123,456,789.00000000- -BANANO"`;
376380

377381
exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Base Sepolia unit (ETH) 1`] = `"0.012345678900000000- -ETH"`;
@@ -720,6 +724,8 @@ exports[`formatCurrencyUnit with custom options with locale es-ES should correct
720724

721725
exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Axelar unit (Axelar) 1`] = `"12.345.678.900,000000- -AXL"`;
722726

727+
exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Babylon unit (Babylon) 1`] = `"12.345.678.900,000000- -BABY"`;
728+
723729
exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Banano unit (BANANO) 1`] = `"123.456.789,00000000- -BANANO"`;
724730

725731
exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Base Sepolia unit (ETH) 1`] = `"0,012345678900000000- -ETH"`;
@@ -1068,6 +1074,8 @@ exports[`formatCurrencyUnit with custom options with locale fr-FR should correct
10681074

10691075
exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Axelar unit (Axelar) 1`] = `"12 345 678 900,000000- -AXL"`;
10701076

1077+
exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Babylon unit (Babylon) 1`] = `"12 345 678 900,000000- -BABY"`;
1078+
10711079
exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Banano unit (BANANO) 1`] = `"123 456 789,00000000- -BANANO"`;
10721080

10731081
exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Base Sepolia unit (ETH) 1`] = `"0,012345678900000000- -ETH"`;
@@ -1416,6 +1424,8 @@ exports[`formatCurrencyUnit with custom options with locale ja-JP should correct
14161424

14171425
exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Axelar unit (Axelar) 1`] = `"12,345,678,900.000000- -AXL"`;
14181426

1427+
exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Babylon unit (Babylon) 1`] = `"12,345,678,900.000000- -BABY"`;
1428+
14191429
exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Banano unit (BANANO) 1`] = `"123,456,789.00000000- -BANANO"`;
14201430

14211431
exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Base Sepolia unit (ETH) 1`] = `"0.012345678900000000- -ETH"`;
@@ -1764,6 +1774,8 @@ exports[`formatCurrencyUnit with custom options with locale ko-KR should correct
17641774

17651775
exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Axelar unit (Axelar) 1`] = `"12,345,678,900.000000- -AXL"`;
17661776

1777+
exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Babylon unit (Babylon) 1`] = `"12,345,678,900.000000- -BABY"`;
1778+
17671779
exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Banano unit (BANANO) 1`] = `"123,456,789.00000000- -BANANO"`;
17681780

17691781
exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Base Sepolia unit (ETH) 1`] = `"0.012345678900000000- -ETH"`;
@@ -2112,6 +2124,8 @@ exports[`formatCurrencyUnit with custom options with locale pt-BR should correct
21122124

21132125
exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Axelar unit (Axelar) 1`] = `"12.345.678.900,000000- -AXL"`;
21142126

2127+
exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Babylon unit (Babylon) 1`] = `"12.345.678.900,000000- -BABY"`;
2128+
21152129
exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Banano unit (BANANO) 1`] = `"123.456.789,00000000- -BANANO"`;
21162130

21172131
exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Base Sepolia unit (ETH) 1`] = `"0,012345678900000000- -ETH"`;
@@ -2460,6 +2474,8 @@ exports[`formatCurrencyUnit with custom options with locale ru-RU should correct
24602474

24612475
exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Axelar unit (Axelar) 1`] = `"12 345 678 900,000000- -AXL"`;
24622476

2477+
exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Babylon unit (Babylon) 1`] = `"12 345 678 900,000000- -BABY"`;
2478+
24632479
exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Banano unit (BANANO) 1`] = `"123 456 789,00000000- -BANANO"`;
24642480

24652481
exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Base Sepolia unit (ETH) 1`] = `"0,012345678900000000- -ETH"`;
@@ -2808,6 +2824,8 @@ exports[`formatCurrencyUnit with custom options with locale tr-TR should correct
28082824

28092825
exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Axelar unit (Axelar) 1`] = `"12.345.678.900,000000- -AXL"`;
28102826

2827+
exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Babylon unit (Babylon) 1`] = `"12.345.678.900,000000- -BABY"`;
2828+
28112829
exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Banano unit (BANANO) 1`] = `"123.456.789,00000000- -BANANO"`;
28122830

28132831
exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Base Sepolia unit (ETH) 1`] = `"0,012345678900000000- -ETH"`;
@@ -3156,6 +3174,8 @@ exports[`formatCurrencyUnit with custom options with locale zh-CN should correct
31563174

31573175
exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Axelar unit (Axelar) 1`] = `"12,345,678,900.000000- -AXL"`;
31583176

3177+
exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Babylon unit (Babylon) 1`] = `"12,345,678,900.000000- -BABY"`;
3178+
31593179
exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Banano unit (BANANO) 1`] = `"123,456,789.00000000- -BANANO"`;
31603180

31613181
exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Base Sepolia unit (ETH) 1`] = `"0.012345678900000000- -ETH"`;
@@ -3504,6 +3524,8 @@ exports[`formatCurrencyUnit with default options should correctly format Avalanc
35043524

35053525
exports[`formatCurrencyUnit with default options should correctly format Axelar unit (Axelar) 1`] = `"12,345,678,900"`;
35063526

3527+
exports[`formatCurrencyUnit with default options should correctly format Babylon unit (Babylon) 1`] = `"12,345,678,900"`;
3528+
35073529
exports[`formatCurrencyUnit with default options should correctly format Banano unit (BANANO) 1`] = `"123,456,789"`;
35083530

35093531
exports[`formatCurrencyUnit with default options should correctly format Base Sepolia unit (ETH) 1`] = `"0.0123456"`;

0 commit comments

Comments
 (0)