From 073414f3e191bc92fa9a26c7dfd60e8f632a19a1 Mon Sep 17 00:00:00 2001 From: Canestin Date: Wed, 18 Dec 2024 15:47:23 +0100 Subject: [PATCH 1/9] feat: zenrock integration --- apps/cli/src/live-common-setup-base.ts | 1 + .../live-common-set-supported-currencies.ts | 1 + .../AddAccounts/steps/StepChooseCurrency.tsx | 3 + .../wallet-api-currencies-darwin.json | 9 +++ .../wallet-api-currencies-linux.json | 9 +++ .../src/live-common-setup.ts | 1 + .../screens/AddAccounts/01-SelectCrypto.tsx | 3 + apps/web-tools/live-common-setup.ts | 1 + .../formatCurrencyUnit.test.ts.snap | 22 ++++++ .../coin-cosmos/src/chain/Zenrock.ts | 20 ++++++ .../coin-cosmos/src/chain/chain.ts | 4 ++ .../coin-cosmos/src/chain/chain.unit.test.ts | 1 + libs/coin-modules/coin-cosmos/src/config.ts | 10 +++ libs/coin-modules/coin-cosmos/src/specs.ts | 10 +++ .../src/__tests__/test-helpers/environment.ts | 1 + .../ledger-live-common/src/account/helpers.ts | 1 + .../sortByMarketcap.test.ts.snap | 1 + .../ledger-live-common/src/currencies/mock.ts | 1 + .../src/currencies/sortByMarketcap.test.ts | 1 + .../zenrock.integration.test.ts.snap | 28 ++++++++ .../datasets/zenrock.integration.test.ts | 14 ++++ .../src/families/cosmos/datasets/zenrock.ts | 67 +++++++++++++++++++ .../src/featureFlags/defaultFeatures.ts | 1 + .../packages/cryptoassets/src/abandonseed.ts | 1 + .../packages/cryptoassets/src/currencies.ts | 29 ++++++++ .../packages/types-cryptoassets/src/index.ts | 1 + .../packages/types-live/src/feature.ts | 1 + .../ui/packages/crypto-icons/src/svg/ROCK.svg | 10 +++ 28 files changed, 252 insertions(+) create mode 100644 libs/coin-modules/coin-cosmos/src/chain/Zenrock.ts create mode 100644 libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/zenrock.integration.test.ts.snap create mode 100644 libs/ledger-live-common/src/families/cosmos/datasets/zenrock.integration.test.ts create mode 100644 libs/ledger-live-common/src/families/cosmos/datasets/zenrock.ts create mode 100644 libs/ui/packages/crypto-icons/src/svg/ROCK.svg diff --git a/apps/cli/src/live-common-setup-base.ts b/apps/cli/src/live-common-setup-base.ts index 631f9ec6fdf4..f3eddbad9ac0 100644 --- a/apps/cli/src/live-common-setup-base.ts +++ b/apps/cli/src/live-common-setup-base.ts @@ -103,6 +103,7 @@ setSupportedCurrencies([ "zksync_sepolia", "mantra", "xion", + "zenrock", ]); for (const k in process.env) setEnvUnsafe(k as EnvName, process.env[k]); diff --git a/apps/ledger-live-desktop/src/live-common-set-supported-currencies.ts b/apps/ledger-live-desktop/src/live-common-set-supported-currencies.ts index a9ad1858c4bc..1a774f691381 100644 --- a/apps/ledger-live-desktop/src/live-common-set-supported-currencies.ts +++ b/apps/ledger-live-desktop/src/live-common-set-supported-currencies.ts @@ -97,4 +97,5 @@ setSupportedCurrencies([ "zksync_sepolia", "mantra", "xion", + "zenrock", ]); diff --git a/apps/ledger-live-desktop/src/renderer/modals/AddAccounts/steps/StepChooseCurrency.tsx b/apps/ledger-live-desktop/src/renderer/modals/AddAccounts/steps/StepChooseCurrency.tsx index 50d28cde6e2c..c87fa2cd3f96 100644 --- a/apps/ledger-live-desktop/src/renderer/modals/AddAccounts/steps/StepChooseCurrency.tsx +++ b/apps/ledger-live-desktop/src/renderer/modals/AddAccounts/steps/StepChooseCurrency.tsx @@ -86,6 +86,7 @@ const StepChooseCurrency = ({ currency, setCurrency }: StepProps) => { const zksyncSepolia = useFeature("currencyZkSyncSepolia"); const mantra = useFeature("currencyMantra"); const xion = useFeature("currencyXion"); + const zenrock = useFeature("currencyZenrock"); const featureFlaggedCurrencies = useMemo( (): Partial | null>> => ({ @@ -140,6 +141,7 @@ const StepChooseCurrency = ({ currency, setCurrency }: StepProps) => { zksync_sepolia: zksyncSepolia, mantra, xion, + zenrock, }), [ axelar, @@ -193,6 +195,7 @@ const StepChooseCurrency = ({ currency, setCurrency }: StepProps) => { zksyncSepolia, mantra, xion, + zenrock, ], ); diff --git a/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts-snapshots/wallet-api-currencies-darwin.json b/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts-snapshots/wallet-api-currencies-darwin.json index efcbd915c445..a8c7bf733151 100644 --- a/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts-snapshots/wallet-api-currencies-darwin.json +++ b/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts-snapshots/wallet-api-currencies-darwin.json @@ -817,5 +817,14 @@ "family": "cosmos", "color": "#000000", "decimals": 6 + }, + { + "type": "CryptoCurrency", + "id": "zenrock", + "ticker": "ROCK", + "name": "Zenrock", + "family": "cosmos", + "color": "#080c44", + "decimals": 6 } ] \ No newline at end of file diff --git a/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts-snapshots/wallet-api-currencies-linux.json b/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts-snapshots/wallet-api-currencies-linux.json index efcbd915c445..a8c7bf733151 100644 --- a/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts-snapshots/wallet-api-currencies-linux.json +++ b/apps/ledger-live-desktop/tests/specs/services/wallet-api.spec.ts-snapshots/wallet-api-currencies-linux.json @@ -817,5 +817,14 @@ "family": "cosmos", "color": "#000000", "decimals": 6 + }, + { + "type": "CryptoCurrency", + "id": "zenrock", + "ticker": "ROCK", + "name": "Zenrock", + "family": "cosmos", + "color": "#080c44", + "decimals": 6 } ] \ No newline at end of file diff --git a/apps/ledger-live-mobile/src/live-common-setup.ts b/apps/ledger-live-mobile/src/live-common-setup.ts index 9010091d9022..d63b0d66a0c9 100644 --- a/apps/ledger-live-mobile/src/live-common-setup.ts +++ b/apps/ledger-live-mobile/src/live-common-setup.ts @@ -130,6 +130,7 @@ setSupportedCurrencies([ "zksync_sepolia", "mantra", "xion", + "zenrock", ]); if (Config.BLE_LOG_LEVEL) BluetoothTransport.setLogLevel(Config.BLE_LOG_LEVEL); diff --git a/apps/ledger-live-mobile/src/screens/AddAccounts/01-SelectCrypto.tsx b/apps/ledger-live-mobile/src/screens/AddAccounts/01-SelectCrypto.tsx index 6e930fb44c88..94cfbe72e39a 100644 --- a/apps/ledger-live-mobile/src/screens/AddAccounts/01-SelectCrypto.tsx +++ b/apps/ledger-live-mobile/src/screens/AddAccounts/01-SelectCrypto.tsx @@ -108,6 +108,7 @@ export default function AddAccountsSelectCrypto({ navigation, route }: Props) { const zksyncSepolia = useFeature("currencyZkSyncSepolia"); const mantra = useFeature("currencyMantra"); const xion = useFeature("currencyXion"); + const zenrock = useFeature("currencyZenrock"); const featureFlaggedCurrencies = useMemo( (): Partial | null>> => ({ @@ -162,6 +163,7 @@ export default function AddAccountsSelectCrypto({ navigation, route }: Props) { zksync_sepolia: zksyncSepolia, mantra, xion, + zenrock, }), [ axelar, @@ -215,6 +217,7 @@ export default function AddAccountsSelectCrypto({ navigation, route }: Props) { zksyncSepolia, mantra, xion, + zenrock, ], ); diff --git a/apps/web-tools/live-common-setup.ts b/apps/web-tools/live-common-setup.ts index b5d7c10cd3f7..233f85d49592 100644 --- a/apps/web-tools/live-common-setup.ts +++ b/apps/web-tools/live-common-setup.ts @@ -71,4 +71,5 @@ setSupportedCurrencies([ "linea_sepolia", "mantra", "xion", + "zenrock", ]); diff --git a/libs/coin-framework/src/currencies/__snapshots__/formatCurrencyUnit.test.ts.snap b/libs/coin-framework/src/currencies/__snapshots__/formatCurrencyUnit.test.ts.snap index 79f5a23ede14..1859ee14ddd9 100644 --- a/libs/coin-framework/src/currencies/__snapshots__/formatCurrencyUnit.test.ts.snap +++ b/libs/coin-framework/src/currencies/__snapshots__/formatCurrencyUnit.test.ts.snap @@ -326,6 +326,8 @@ exports[`formatCurrencyUnit with custom options with locale de-DE should correct exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Zcash unit (zcash) 1`] = `"123.456.789,00000000- -ZEC"`; +exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Zenrock unit (Zenrock) 1`] = `"12.345.678.900,000000- -ROCK"`; + exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Zilliqa unit (ZIL) 1`] = `"12.345,678900000000- -ZIL"`; exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format dYdX unit (dYdX) 1`] = `"0,012345678900000000- -dydx"`; @@ -660,6 +662,8 @@ exports[`formatCurrencyUnit with custom options with locale en-US should correct exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Zcash unit (zcash) 1`] = `"123,456,789.00000000- -ZEC"`; +exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Zenrock unit (Zenrock) 1`] = `"12,345,678,900.000000- -ROCK"`; + exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Zilliqa unit (ZIL) 1`] = `"12,345.678900000000- -ZIL"`; exports[`formatCurrencyUnit with custom options with locale en-US should correctly format dYdX unit (dYdX) 1`] = `"0.012345678900000000- -dydx"`; @@ -994,6 +998,8 @@ exports[`formatCurrencyUnit with custom options with locale es-ES should correct exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Zcash unit (zcash) 1`] = `"123.456.789,00000000- -ZEC"`; +exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Zenrock unit (Zenrock) 1`] = `"12.345.678.900,000000- -ROCK"`; + exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Zilliqa unit (ZIL) 1`] = `"12.345,678900000000- -ZIL"`; exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format dYdX unit (dYdX) 1`] = `"0,012345678900000000- -dydx"`; @@ -1328,6 +1334,8 @@ exports[`formatCurrencyUnit with custom options with locale fr-FR should correct exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Zcash unit (zcash) 1`] = `"123 456 789,00000000- -ZEC"`; +exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Zenrock unit (Zenrock) 1`] = `"12 345 678 900,000000- -ROCK"`; + exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Zilliqa unit (ZIL) 1`] = `"12 345,678900000000- -ZIL"`; exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format dYdX unit (dYdX) 1`] = `"0,012345678900000000- -dydx"`; @@ -1662,6 +1670,8 @@ exports[`formatCurrencyUnit with custom options with locale ja-JP should correct exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Zcash unit (zcash) 1`] = `"123,456,789.00000000- -ZEC"`; +exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Zenrock unit (Zenrock) 1`] = `"12,345,678,900.000000- -ROCK"`; + exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Zilliqa unit (ZIL) 1`] = `"12,345.678900000000- -ZIL"`; exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format dYdX unit (dYdX) 1`] = `"0.012345678900000000- -dydx"`; @@ -1996,6 +2006,8 @@ exports[`formatCurrencyUnit with custom options with locale ko-KR should correct exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Zcash unit (zcash) 1`] = `"123,456,789.00000000- -ZEC"`; +exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Zenrock unit (Zenrock) 1`] = `"12,345,678,900.000000- -ROCK"`; + exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Zilliqa unit (ZIL) 1`] = `"12,345.678900000000- -ZIL"`; exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format dYdX unit (dYdX) 1`] = `"0.012345678900000000- -dydx"`; @@ -2330,6 +2342,8 @@ exports[`formatCurrencyUnit with custom options with locale pt-BR should correct exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Zcash unit (zcash) 1`] = `"123.456.789,00000000- -ZEC"`; +exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Zenrock unit (Zenrock) 1`] = `"12.345.678.900,000000- -ROCK"`; + exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Zilliqa unit (ZIL) 1`] = `"12.345,678900000000- -ZIL"`; exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format dYdX unit (dYdX) 1`] = `"0,012345678900000000- -dydx"`; @@ -2664,6 +2678,8 @@ exports[`formatCurrencyUnit with custom options with locale ru-RU should correct exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Zcash unit (zcash) 1`] = `"123 456 789,00000000- -ZEC"`; +exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Zenrock unit (Zenrock) 1`] = `"12 345 678 900,000000- -ROCK"`; + exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Zilliqa unit (ZIL) 1`] = `"12 345,678900000000- -ZIL"`; exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format dYdX unit (dYdX) 1`] = `"0,012345678900000000- -dydx"`; @@ -2998,6 +3014,8 @@ exports[`formatCurrencyUnit with custom options with locale tr-TR should correct exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Zcash unit (zcash) 1`] = `"123.456.789,00000000- -ZEC"`; +exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Zenrock unit (Zenrock) 1`] = `"12.345.678.900,000000- -ROCK"`; + exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Zilliqa unit (ZIL) 1`] = `"12.345,678900000000- -ZIL"`; exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format dYdX unit (dYdX) 1`] = `"0,012345678900000000- -dydx"`; @@ -3332,6 +3350,8 @@ exports[`formatCurrencyUnit with custom options with locale zh-CN should correct exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Zcash unit (zcash) 1`] = `"123,456,789.00000000- -ZEC"`; +exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Zenrock unit (Zenrock) 1`] = `"12,345,678,900.000000- -ROCK"`; + exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Zilliqa unit (ZIL) 1`] = `"12,345.678900000000- -ZIL"`; exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format dYdX unit (dYdX) 1`] = `"0.012345678900000000- -dydx"`; @@ -3666,6 +3686,8 @@ exports[`formatCurrencyUnit with default options should correctly format ZKsync exports[`formatCurrencyUnit with default options should correctly format Zcash unit (zcash) 1`] = `"123,456,789"`; +exports[`formatCurrencyUnit with default options should correctly format Zenrock unit (Zenrock) 1`] = `"12,345,678,900"`; + exports[`formatCurrencyUnit with default options should correctly format Zilliqa unit (ZIL) 1`] = `"12,345.6"`; exports[`formatCurrencyUnit with default options should correctly format dYdX unit (dYdX) 1`] = `"0.0123456"`; diff --git a/libs/coin-modules/coin-cosmos/src/chain/Zenrock.ts b/libs/coin-modules/coin-cosmos/src/chain/Zenrock.ts new file mode 100644 index 000000000000..c243537e9648 --- /dev/null +++ b/libs/coin-modules/coin-cosmos/src/chain/Zenrock.ts @@ -0,0 +1,20 @@ +import CosmosBase from "./cosmosBase"; + +class Zenrock extends CosmosBase { + stakingDocUrl: string; + unbondingPeriod: number; + prefix: string; + validatorPrefix: string; + // Provided by coin config + ledgerValidator!: string; + lcd!: string; + constructor() { + super(); + this.stakingDocUrl = ""; + this.unbondingPeriod = 21; + this.prefix = "zen"; + this.validatorPrefix = `${this.prefix}valoper`; + } +} + +export default Zenrock; diff --git a/libs/coin-modules/coin-cosmos/src/chain/chain.ts b/libs/coin-modules/coin-cosmos/src/chain/chain.ts index ccbfdee3c575..044582747016 100644 --- a/libs/coin-modules/coin-cosmos/src/chain/chain.ts +++ b/libs/coin-modules/coin-cosmos/src/chain/chain.ts @@ -19,6 +19,7 @@ import Dydx from "./Dydx"; import Mantra from "./Mantra"; import CryptoOrg from "./CryptoOrg"; import Xion from "./Xion"; +import Zenrock from "./Zenrock"; const cosmosChainParams: { [key: string]: CosmosBase } = {}; export default function cryptoFactory(currencyId: string): CosmosBase { @@ -86,6 +87,9 @@ export default function cryptoFactory(currencyId: string): CosmosBase { case "xion": cosmosChainParams[currencyId] = new Xion(); break; + case "zenrock": + cosmosChainParams[currencyId] = new Zenrock(); + break; default: throw new Error(`${currencyId} is not supported`); } diff --git a/libs/coin-modules/coin-cosmos/src/chain/chain.unit.test.ts b/libs/coin-modules/coin-cosmos/src/chain/chain.unit.test.ts index 5be6d778d190..812cc180a18e 100644 --- a/libs/coin-modules/coin-cosmos/src/chain/chain.unit.test.ts +++ b/libs/coin-modules/coin-cosmos/src/chain/chain.unit.test.ts @@ -23,6 +23,7 @@ describe("cryptoFactory test", () => { "mantra", "crypto_org", "xion", + "zenrock", ]; currencies.forEach(currency => { expect(cryptoFactory(currency)).not.toBeNull(); diff --git a/libs/coin-modules/coin-cosmos/src/config.ts b/libs/coin-modules/coin-cosmos/src/config.ts index 12cd96bdc732..57dce0ad4798 100644 --- a/libs/coin-modules/coin-cosmos/src/config.ts +++ b/libs/coin-modules/coin-cosmos/src/config.ts @@ -189,6 +189,16 @@ export const cosmosConfig: CosmosConfig = { }, }, }, + config_currency_zenrock: { + type: "object", + default: { + lcd: "https://api.diamond.zenrocklabs.io", + minGasPrice: 0.1, + status: { + type: "active", + }, + }, + }, }; import buildCoinConfig, { type CurrencyConfig } from "@ledgerhq/coin-framework/config"; diff --git a/libs/coin-modules/coin-cosmos/src/specs.ts b/libs/coin-modules/coin-cosmos/src/specs.ts index b463b772c7c9..7eebed45c163 100644 --- a/libs/coin-modules/coin-cosmos/src/specs.ts +++ b/libs/coin-modules/coin-cosmos/src/specs.ts @@ -618,6 +618,15 @@ const xion = { }), }; +const zenrockMinimalTransactionAmount = new BigNumber(20000); +const zenrock = { + ...generateGenericCosmosTest("zenrock", false, { + minViableAmount: zenrockMinimalTransactionAmount, + mutations: cosmosLikeMutations(zenrockMinimalTransactionAmount), + skipOperationHistory: true, + }), +}; + export default { axelar, cosmos, @@ -636,4 +645,5 @@ export default { mantra, cryptoOrg, xion, + zenrock, }; diff --git a/libs/ledger-live-common/src/__tests__/test-helpers/environment.ts b/libs/ledger-live-common/src/__tests__/test-helpers/environment.ts index 42528c9f6990..3e638e4c760f 100644 --- a/libs/ledger-live-common/src/__tests__/test-helpers/environment.ts +++ b/libs/ledger-live-common/src/__tests__/test-helpers/environment.ts @@ -105,6 +105,7 @@ setSupportedCurrencies([ "zksync_sepolia", "mantra", "xion", + "zenrock", ]); LiveConfig.setConfig(liveConfig); diff --git a/libs/ledger-live-common/src/account/helpers.ts b/libs/ledger-live-common/src/account/helpers.ts index 057d254e1d93..73bf0247cdf8 100644 --- a/libs/ledger-live-common/src/account/helpers.ts +++ b/libs/ledger-live-common/src/account/helpers.ts @@ -81,6 +81,7 @@ export const getVotesCount = ( case "mantra": case "crypto_org": case "xion": + case "zenrock": return (mainAccount as CosmosAccount)?.cosmosResources?.delegations.length || 0; default: return 0; diff --git a/libs/ledger-live-common/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap b/libs/ledger-live-common/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap index 05b1ea249f81..666df5bf4381 100644 --- a/libs/ledger-live-common/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +++ b/libs/ledger-live-common/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap @@ -1637,6 +1637,7 @@ exports[`sortCurrenciesByIds snapshot 1`] = ` "binance_beacon_chain", "mantra", "xion", + "zenrock", "ethereum/erc20/$aapl", "ethereum/erc20/$based", "ethereum/erc20/$die", diff --git a/libs/ledger-live-common/src/currencies/mock.ts b/libs/ledger-live-common/src/currencies/mock.ts index 01637d93a4a7..8d45ea3becf4 100644 --- a/libs/ledger-live-common/src/currencies/mock.ts +++ b/libs/ledger-live-common/src/currencies/mock.ts @@ -42,6 +42,7 @@ export const IDS = [ "mantra", "crypto_org", "xion", + "zenrock", ]; export const CURRENCIES_LIST: CryptoCurrency[] = [ diff --git a/libs/ledger-live-common/src/currencies/sortByMarketcap.test.ts b/libs/ledger-live-common/src/currencies/sortByMarketcap.test.ts index fa07d54e6af5..62e0639ffaf6 100644 --- a/libs/ledger-live-common/src/currencies/sortByMarketcap.test.ts +++ b/libs/ledger-live-common/src/currencies/sortByMarketcap.test.ts @@ -34,6 +34,7 @@ test("sortCurrenciesByIds simulate staking from portfolio", () => { "mantra", "crypto_org", "xion", + "zenrock", "quicksilver", ]); }); diff --git a/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/zenrock.integration.test.ts.snap b/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/zenrock.integration.test.ts.snap new file mode 100644 index 000000000000..3251a02d8498 --- /dev/null +++ b/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/zenrock.integration.test.ts.snap @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`zenrock currency bridge scanAccounts zenrock seed 1 1`] = ` +[ + { + "balance": "0", + "currencyId": "zenrock", + "derivationMode": "", + "freshAddress": "zen1gyauvl44q2apn3u3aujm36q8zrj74vry04vkrc", + "freshAddressPath": "44'/118'/0'/0/0", + "id": "js:2:zenrock:zen1gyauvl44q2apn3u3aujm36q8zrj74vry04vkrc:", + "index": 0, + "pendingOperations": [], + "seedIdentifier": "03d5e0ebb3f1ae2afe87e5d5a24b5029a59cc12f8fd1056840091b2f0b97e54e83", + "spendableBalance": "0", + "swapHistory": [], + "syncHash": undefined, + "used": false, + "xpub": "zen1gyauvl44q2apn3u3aujm36q8zrj74vry04vkrc", + }, +] +`; + +exports[`zenrock currency bridge scanAccounts zenrock seed 1 2`] = ` +[ + [], +] +`; diff --git a/libs/ledger-live-common/src/families/cosmos/datasets/zenrock.integration.test.ts b/libs/ledger-live-common/src/families/cosmos/datasets/zenrock.integration.test.ts new file mode 100644 index 000000000000..72d528893fab --- /dev/null +++ b/libs/ledger-live-common/src/families/cosmos/datasets/zenrock.integration.test.ts @@ -0,0 +1,14 @@ +import { DatasetTest } from "@ledgerhq/types-live"; +import { testBridge } from "../../../__tests__/test-helpers/bridge"; +import "../../../__tests__/test-helpers/setup"; +import type { Transaction } from "../types"; +import zenrock from "./zenrock"; + +const dataset: DatasetTest = { + implementations: ["js"], + currencies: { + zenrock, + }, +}; + +testBridge(dataset); diff --git a/libs/ledger-live-common/src/families/cosmos/datasets/zenrock.ts b/libs/ledger-live-common/src/families/cosmos/datasets/zenrock.ts new file mode 100644 index 000000000000..2056fd9b9e97 --- /dev/null +++ b/libs/ledger-live-common/src/families/cosmos/datasets/zenrock.ts @@ -0,0 +1,67 @@ +import { fromTransactionRaw } from "@ledgerhq/coin-cosmos/transaction"; +import { CurrenciesData } from "@ledgerhq/types-live"; +import { BigNumber } from "bignumber.js"; +import type { Transaction } from "../types"; + +const dataset: CurrenciesData = { + FIXME_ignoreAccountFields: ["cosmosResources", "operationsCount", "operations"], + FIXME_ignorePreloadFields: ["validators"], + scanAccounts: [ + { + name: "zenrock seed 1", + apdus: ` + => 5504000018037a656e2c00008076000080000000800000000000000000 + <= 03d5e0ebb3f1ae2afe87e5d5a24b5029a59cc12f8fd1056840091b2f0b97e54e837a656e3167796175766c3434713261706e33753361756a6d333671387a726a37347672793034766b72639000 + => 5504000018037a656e2c00008076000080000000800000000000000000 + <= 03d5e0ebb3f1ae2afe87e5d5a24b5029a59cc12f8fd1056840091b2f0b97e54e837a656e3167796175766c3434713261706e33753361756a6d333671387a726a37347672793034766b72639000 + `, + }, + ], + accounts: [ + { + FIXME_tests: ["balance is sum of ops", "pendingOperations are cleaned up"], + raw: { + id: "js:2:zenrock:zen1gyauvl44q2apn3u3aujm36q8zrj74vry04vkrc:", + seedIdentifier: "03d5e0ebb3f1ae2afe87e5d5a24b5029a59cc12f8fd1056840091b2f0b97e54e83", + freshAddress: "zen1gyauvl44q2apn3u3aujm36q8zrj74vry04vkrc", + xpub: "zen1gyauvl44q2apn3u3aujm36q8zrj74vry04vkrc", + freshAddressPath: "44'/118'/0'/0/0", + derivationMode: "", + index: 0, + currencyId: "zenrock", + operationsCount: 0, + operations: [], + pendingOperations: [], + lastSyncDate: "", + balance: "0", + spendableBalance: "0", + blockHeight: 431928, + }, + transactions: [ + { + name: "Normal transaction", + transaction: fromTransactionRaw({ + amount: "10000", + recipient: "zen1704dk997ccmk5x8smn8secphckfvbgxxfd99ssr", + useAllAmount: false, + family: "cosmos", + mode: "send", + networkInfo: null, + fees: "8744", + gas: "87440", + validators: [], + memo: "", + sourceValidator: "", + }), + expectedStatus: () => ({ + errors: {}, + warnings: {}, + amount: BigNumber("10000"), + }), + }, + ], + }, + ], +}; + +export default dataset; diff --git a/libs/ledger-live-common/src/featureFlags/defaultFeatures.ts b/libs/ledger-live-common/src/featureFlags/defaultFeatures.ts index 6656a08f7986..ec05e9b528b1 100644 --- a/libs/ledger-live-common/src/featureFlags/defaultFeatures.ts +++ b/libs/ledger-live-common/src/featureFlags/defaultFeatures.ts @@ -84,6 +84,7 @@ export const CURRENCY_DEFAULT_FEATURES = { currencyZkSyncSepolia: DEFAULT_FEATURE, currencyMantra: DEFAULT_FEATURE, currencyXion: DEFAULT_FEATURE, + currencyZenrock: DEFAULT_FEATURE, }; /** diff --git a/libs/ledgerjs/packages/cryptoassets/src/abandonseed.ts b/libs/ledgerjs/packages/cryptoassets/src/abandonseed.ts index 7be448eae23c..82d0a1b63d5c 100644 --- a/libs/ledgerjs/packages/cryptoassets/src/abandonseed.ts +++ b/libs/ledgerjs/packages/cryptoassets/src/abandonseed.ts @@ -114,6 +114,7 @@ const abandonSeedAddresses: Partial> = { zksync_sepolia: EVM_DEAD_ADDRESS, mantra: "mantra12jypwtxm7npfszx5x9780fhz0j3ken696fdp33", xion: "xion19rl4cm2hmr8afy4kldpxz3fka4jguq0a5xyz123", + zenrock: "zen1704dk997ccmk5x8smn8secphckfvbgxxfd99xxr", }; /** diff --git a/libs/ledgerjs/packages/cryptoassets/src/currencies.ts b/libs/ledgerjs/packages/cryptoassets/src/currencies.ts index 7a20ab850e8c..4fd00f1e4e52 100644 --- a/libs/ledgerjs/packages/cryptoassets/src/currencies.ts +++ b/libs/ledgerjs/packages/cryptoassets/src/currencies.ts @@ -4377,6 +4377,35 @@ export const cryptocurrenciesById: Record = { }, ], }, + zenrock: { + type: "CryptoCurrency", + id: "zenrock", + coinType: CoinType.ATOM, + name: "Zenrock", + managerAppName: "Cosmos", + ticker: "ROCK", + scheme: "zenrock", + color: "#080c44", + family: "cosmos", + units: [ + { + name: "Zenrock", + code: "ROCK", + magnitude: 6, + }, + { + name: "Micro-Zenrock", + code: "urock", + magnitude: 0, + }, + ], + explorerViews: [ + { + tx: "https://explorer.diamond.zenrocklabs.io/transactions/$hash", + address: "https://explorer.diamond.zenrocklabs.io/validators/$address", + }, + ], + }, }; const cryptocurrenciesByScheme: Record = {}; diff --git a/libs/ledgerjs/packages/types-cryptoassets/src/index.ts b/libs/ledgerjs/packages/types-cryptoassets/src/index.ts index 939757d0e208..445248422193 100644 --- a/libs/ledgerjs/packages/types-cryptoassets/src/index.ts +++ b/libs/ledgerjs/packages/types-cryptoassets/src/index.ts @@ -168,6 +168,7 @@ export type CryptoCurrencyId = | "zksync_sepolia" | "mantra" | "xion"; + | "zenrock"; export type LedgerExplorerId = | "btc" diff --git a/libs/ledgerjs/packages/types-live/src/feature.ts b/libs/ledgerjs/packages/types-live/src/feature.ts index 51f1676513d5..e065f601aae0 100644 --- a/libs/ledgerjs/packages/types-live/src/feature.ts +++ b/libs/ledgerjs/packages/types-live/src/feature.ts @@ -125,6 +125,7 @@ export type CurrencyFeatures = { currencyZkSyncSepolia: DefaultFeature; currencyMantra: DefaultFeature; currencyXion: DefaultFeature; + currencyZenrock: DefaultFeature; }; /** diff --git a/libs/ui/packages/crypto-icons/src/svg/ROCK.svg b/libs/ui/packages/crypto-icons/src/svg/ROCK.svg new file mode 100644 index 000000000000..dd39dd79692b --- /dev/null +++ b/libs/ui/packages/crypto-icons/src/svg/ROCK.svg @@ -0,0 +1,10 @@ + + + + + + + + + + From ff552003fca381933cf8bd2621b4e90565821308 Mon Sep 17 00:00:00 2001 From: qperrot Date: Thu, 19 Dec 2024 09:40:34 +0100 Subject: [PATCH 2/9] fix: add zenrock mock --- .../ledger-live-common/src/currencies/mock.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/libs/ledger-live-common/src/currencies/mock.ts b/libs/ledger-live-common/src/currencies/mock.ts index 8d45ea3becf4..425e7e792a17 100644 --- a/libs/ledger-live-common/src/currencies/mock.ts +++ b/libs/ledger-live-common/src/currencies/mock.ts @@ -596,4 +596,33 @@ export const CURRENCIES_LIST: CryptoCurrency[] = [ }, ], }, + { + type: "CryptoCurrency", + id: "zenrock", + coinType: 118, + name: "Zenrock", + managerAppName: "Cosmos", + ticker: "ROCK", + scheme: "zenrock", + color: "#000000", + family: "cosmos", + units: [ + { + name: "Zenrock", + code: "ROCK", + magnitude: 6, + }, + { + name: "Micro-Zenrock", + code: "urock", + magnitude: 0, + }, + ], + explorerViews: [ + { + tx: "https://explorer.diamond.zenrocklabs.io/transactions/$hash", + address: "https://explorer.diamond.zenrocklabs.io/validators/$address", + }, + ], + }, ]; From a1a8768900cff6c2a3be5cc12922fed053747515 Mon Sep 17 00:00:00 2001 From: qperrot Date: Fri, 20 Dec 2024 15:52:10 +0100 Subject: [PATCH 3/9] fix: remove extra dot --- libs/ledgerjs/packages/types-cryptoassets/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ledgerjs/packages/types-cryptoassets/src/index.ts b/libs/ledgerjs/packages/types-cryptoassets/src/index.ts index 445248422193..15624125384d 100644 --- a/libs/ledgerjs/packages/types-cryptoassets/src/index.ts +++ b/libs/ledgerjs/packages/types-cryptoassets/src/index.ts @@ -167,7 +167,7 @@ export type CryptoCurrencyId = | "zksync" | "zksync_sepolia" | "mantra" - | "xion"; + | "xion" | "zenrock"; export type LedgerExplorerId = From c2d24cd0299ea04e39306279b6f833696bc4f4fb Mon Sep 17 00:00:00 2001 From: qperrot Date: Mon, 23 Dec 2024 16:37:41 +0100 Subject: [PATCH 4/9] chore: add changeset --- .changeset/stupid-eggs-fry.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .changeset/stupid-eggs-fry.md diff --git a/.changeset/stupid-eggs-fry.md b/.changeset/stupid-eggs-fry.md new file mode 100644 index 000000000000..fbc9383f077e --- /dev/null +++ b/.changeset/stupid-eggs-fry.md @@ -0,0 +1,15 @@ +--- +"@ledgerhq/types-cryptoassets": minor +"@ledgerhq/cryptoassets": minor +"@ledgerhq/types-live": minor +"@ledgerhq/coin-cosmos": minor +"@ledgerhq/crypto-icons-ui": minor +"ledger-live-desktop": minor +"live-mobile": minor +"@ledgerhq/live-common": minor +"@ledgerhq/coin-framework": minor +"@ledgerhq/web-tools": minor +"@ledgerhq/live-cli": minor +--- + +Zenrock integration From 5c8b96a4ac33d4ad372cd712601366da32e8a685 Mon Sep 17 00:00:00 2001 From: qperrot Date: Mon, 6 Jan 2025 15:59:30 +0100 Subject: [PATCH 5/9] fix: change type for zenrock delegation amino --- .../coin-cosmos/src/buildTransaction.ts | 76 +++++++++++++++---- 1 file changed, 60 insertions(+), 16 deletions(-) diff --git a/libs/coin-modules/coin-cosmos/src/buildTransaction.ts b/libs/coin-modules/coin-cosmos/src/buildTransaction.ts index ae2d4f63a427..4ff868a579b7 100644 --- a/libs/coin-modules/coin-cosmos/src/buildTransaction.ts +++ b/libs/coin-modules/coin-cosmos/src/buildTransaction.ts @@ -18,16 +18,40 @@ import { PubKey } from "@keplr-wallet/proto-types/cosmos/crypto/secp256k1/keys"; import { AuthInfo, Fee } from "@keplr-wallet/proto-types/cosmos/tx/v1beta1/tx"; import type { Account } from "@ledgerhq/types-live"; import { Transaction } from "./types"; +import { AminoMsg, Coin } from "@cosmjs/amino"; type ProtoMsg = { typeUrl: string; value: Uint8Array; }; -type AminoMsg = { - readonly type: string; - readonly value: any; -}; +export interface AminoZenrockMsgDelegate extends AminoMsg { + readonly type: "zrchain/MsgDelegate"; + readonly value: { + readonly delegator_address: string; + readonly validator_address: string; + readonly amount: Coin; + }; +} + +export interface AminoZenrockMsgBeginRedelegate extends AminoMsg { + readonly type: "zrchain/MsgBeginRedelegate"; + readonly value: { + readonly delegator_address: string; + readonly validator_src_address: string; + readonly validator_dst_address: string; + readonly amount: Coin; + }; +} + +export interface AminoZenrockMsgUndelegate extends AminoMsg { + readonly type: "zrchain/MsgUndelegate"; + readonly value: { + readonly delegator_address: string; + readonly validator_address: string; + readonly amount: Coin; + }; +} export const txToMessages = ( account: Account, @@ -73,8 +97,9 @@ export const txToMessages = ( if (transaction.validators && transaction.validators.length > 0) { const validator = transaction.validators[0]; if (validator && validator.address && transaction.amount.gt(0)) { - const aminoMsg: AminoMsgDelegate = { - type: "cosmos-sdk/MsgDelegate", + const aminoMsg: AminoMsgDelegate | AminoZenrockMsgDelegate = { + type: + account.currency.id === "zenrock" ? "zrchain/MsgDelegate" : "cosmos-sdk/MsgDelegate", value: { delegator_address: account.freshAddress, validator_address: validator.address, @@ -88,7 +113,10 @@ export const txToMessages = ( // PROTO MESSAGE protoMsgs.push({ - typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + typeUrl: + account.currency.id === "zenrock" + ? "/zrchain.validation.MsgDelegate" + : "/cosmos.staking.v1beta1.MsgDelegate", value: MsgDelegate.encode({ delegatorAddress: account.freshAddress, validatorAddress: validator.address, @@ -111,8 +139,11 @@ export const txToMessages = ( transaction.validators[0].amount.gt(0) ) { const validator = transaction.validators[0]; - const aminoMsg: AminoMsgBeginRedelegate = { - type: "cosmos-sdk/MsgBeginRedelegate", + const aminoMsg: AminoMsgBeginRedelegate | AminoZenrockMsgBeginRedelegate = { + type: + account.currency.id === "zenrock" + ? "zrchain/MsgBeginRedelegate" + : "cosmos-sdk/MsgBeginRedelegate", value: { delegator_address: account.freshAddress, validator_src_address: transaction.sourceValidator, @@ -127,7 +158,10 @@ export const txToMessages = ( // PROTO MESSAGE protoMsgs.push({ - typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", + typeUrl: + account.currency.id === "zenrock" + ? "/zrchain.validation.MsgBeginRedelegate" + : "/cosmos.staking.v1beta1.MsgBeginRedelegate", value: MsgBeginRedelegate.encode({ delegatorAddress: account.freshAddress, validatorSrcAddress: transaction.sourceValidator, @@ -145,8 +179,11 @@ export const txToMessages = ( if (transaction.validators && transaction.validators.length > 0) { const validator = transaction.validators[0]; if (validator && validator.address && validator.amount.gt(0)) { - const aminoMsg: AminoMsgUndelegate = { - type: "cosmos-sdk/MsgUndelegate", + const aminoMsg: AminoMsgUndelegate | AminoZenrockMsgUndelegate = { + type: + account.currency.id === "zenrock" + ? "zrchain/MsgUndelegate" + : "cosmos-sdk/MsgUndelegate", value: { delegator_address: account.freshAddress, validator_address: validator.address, @@ -160,7 +197,10 @@ export const txToMessages = ( // PROTO MESSAGE protoMsgs.push({ - typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", + typeUrl: + account.currency.id === "zenrock" + ? "/zrchain.validation.MsgUndelegate" + : "/cosmos.staking.v1beta1.MsgUndelegate", value: MsgUndelegate.encode({ delegatorAddress: account.freshAddress, validatorAddress: validator.address, @@ -215,8 +255,9 @@ export const txToMessages = ( validator_address: validator.address, }, }; - const aminoDelegateMsg: AminoMsgDelegate = { - type: "cosmos-sdk/MsgDelegate", + const aminoDelegateMsg: AminoMsgDelegate | AminoZenrockMsgDelegate = { + type: + account.currency.id === "zenrock" ? "zrchain/MsgDelegate" : "cosmos-sdk/MsgDelegate", value: { delegator_address: account.freshAddress, validator_address: validator.address, @@ -237,7 +278,10 @@ export const txToMessages = ( }).finish(), }); protoMsgs.push({ - typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + typeUrl: + account.currency.id === "zenrock" + ? "/zrchain.validation.MsgDelegate" + : "/cosmos.staking.v1beta1.MsgDelegate", value: MsgDelegate.encode({ delegatorAddress: account.freshAddress, validatorAddress: validator.address, From 0c0884a5940ef743c7d02c3f597a442afb77cd77 Mon Sep 17 00:00:00 2001 From: qperrot Date: Mon, 6 Jan 2025 17:06:04 +0100 Subject: [PATCH 6/9] fix: injective fixed --- libs/coin-modules/coin-cosmos/src/buildTransaction.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/coin-modules/coin-cosmos/src/buildTransaction.ts b/libs/coin-modules/coin-cosmos/src/buildTransaction.ts index 4ff868a579b7..f392774e8acf 100644 --- a/libs/coin-modules/coin-cosmos/src/buildTransaction.ts +++ b/libs/coin-modules/coin-cosmos/src/buildTransaction.ts @@ -18,13 +18,18 @@ import { PubKey } from "@keplr-wallet/proto-types/cosmos/crypto/secp256k1/keys"; import { AuthInfo, Fee } from "@keplr-wallet/proto-types/cosmos/tx/v1beta1/tx"; import type { Account } from "@ledgerhq/types-live"; import { Transaction } from "./types"; -import { AminoMsg, Coin } from "@cosmjs/amino"; +import { Coin } from "@cosmjs/amino"; type ProtoMsg = { typeUrl: string; value: Uint8Array; }; +type AminoMsg = { + readonly type: string; + readonly value: any; +}; + export interface AminoZenrockMsgDelegate extends AminoMsg { readonly type: "zrchain/MsgDelegate"; readonly value: { From f219f9a42e5489851fc4a8bb141b0861d78e17a4 Mon Sep 17 00:00:00 2001 From: qperrot Date: Tue, 7 Jan 2025 08:33:15 +0100 Subject: [PATCH 7/9] fix: extends from AminoMsgDelegate --- .../coin-cosmos/src/buildTransaction.ts | 22 +- .../cosmos.integration.test.ts.snap | 67 ++++++- .../cryptoOrg.integration.test.ts.snap | 24 +-- .../xion.integration.test.ts.snap | 189 +----------------- 4 files changed, 75 insertions(+), 227 deletions(-) diff --git a/libs/coin-modules/coin-cosmos/src/buildTransaction.ts b/libs/coin-modules/coin-cosmos/src/buildTransaction.ts index f392774e8acf..5586ccaeb574 100644 --- a/libs/coin-modules/coin-cosmos/src/buildTransaction.ts +++ b/libs/coin-modules/coin-cosmos/src/buildTransaction.ts @@ -30,32 +30,16 @@ type AminoMsg = { readonly value: any; }; -export interface AminoZenrockMsgDelegate extends AminoMsg { +export interface AminoZenrockMsgDelegate extends Omit { readonly type: "zrchain/MsgDelegate"; - readonly value: { - readonly delegator_address: string; - readonly validator_address: string; - readonly amount: Coin; - }; } -export interface AminoZenrockMsgBeginRedelegate extends AminoMsg { +export interface AminoZenrockMsgBeginRedelegate extends Omit { readonly type: "zrchain/MsgBeginRedelegate"; - readonly value: { - readonly delegator_address: string; - readonly validator_src_address: string; - readonly validator_dst_address: string; - readonly amount: Coin; - }; } -export interface AminoZenrockMsgUndelegate extends AminoMsg { +export interface AminoZenrockMsgUndelegate extends Omit { readonly type: "zrchain/MsgUndelegate"; - readonly value: { - readonly delegator_address: string; - readonly validator_address: string; - readonly amount: Coin; - }; } export const txToMessages = ( diff --git a/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap b/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap index 27b2f55ac428..4652b8b8d970 100644 --- a/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap +++ b/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap @@ -3,7 +3,7 @@ exports[`cosmos currency bridge scanAccounts cosmos seed 1 1`] = ` [ { - "balance": "1640550", + "balance": "1612686", "currencyId": "cosmos", "derivationMode": "", "freshAddress": "cosmos1g84934jpu3v5de5yqukkkhxmcvsw3u2ajxvpdl", @@ -12,7 +12,7 @@ exports[`cosmos currency bridge scanAccounts cosmos seed 1 1`] = ` "index": 0, "pendingOperations": [], "seedIdentifier": "0388459b2653519948b12492f1a0b464720110c147a8155d23d423a5cc3c21d89a", - "spendableBalance": "343568", + "spendableBalance": "315704", "swapHistory": [], "syncHash": undefined, "used": true, @@ -754,6 +754,29 @@ exports[`cosmos currency bridge scanAccounts cosmos seed 1 2`] = ` "type": "OUT", "value": "5286", }, + { + "accountId": "js:2:cosmos:cosmos1g84934jpu3v5de5yqukkkhxmcvsw3u2ajxvpdl:", + "blockHash": null, + "blockHeight": 23845374, + "extra": { + "memo": "Ledger Live", + "validators": [ + { + "address": "cosmosvaloper10wljxpl03053h9690apmyeakly3ylhejrucvtm", + "amount": "18139", + }, + ], + }, + "fee": "19524", + "hasFailed": false, + "hash": "4053AE62D6BCEA382E76DFE6C1B28D2802508752EBC19A246889AA5D2BA7AA57", + "id": "js:2:cosmos:cosmos1g84934jpu3v5de5yqukkkhxmcvsw3u2ajxvpdl:-4053AE62D6BCEA382E76DFE6C1B28D2802508752EBC19A246889AA5D2BA7AA57-REWARD", + "recipients": [], + "senders": [], + "transactionSequenceNumber": 156, + "type": "REWARD", + "value": "18139", + }, { "accountId": "js:2:cosmos:cosmos1g84934jpu3v5de5yqukkkhxmcvsw3u2ajxvpdl:", "blockHash": null, @@ -1077,6 +1100,23 @@ exports[`cosmos currency bridge scanAccounts cosmos seed 1 2`] = ` "type": "OUT", "value": "1329", }, + { + "accountId": "js:2:cosmos:cosmos1g84934jpu3v5de5yqukkkhxmcvsw3u2ajxvpdl:", + "blockHash": null, + "blockHeight": 23845364, + "extra": { + "memo": "Ledger Live", + }, + "fee": "12184", + "hasFailed": false, + "hash": "711ED4F08B8CB5912709A26B9C5AA3B22245F17BA5EB177D3EC9A4C5C91E54E6", + "id": "js:2:cosmos:cosmos1g84934jpu3v5de5yqukkkhxmcvsw3u2ajxvpdl:-711ED4F08B8CB5912709A26B9C5AA3B22245F17BA5EB177D3EC9A4C5C91E54E6-REWARD", + "recipients": [], + "senders": [], + "transactionSequenceNumber": 155, + "type": "REWARD", + "value": "0", + }, { "accountId": "js:2:cosmos:cosmos1g84934jpu3v5de5yqukkkhxmcvsw3u2ajxvpdl:", "blockHash": null, @@ -2074,6 +2114,29 @@ exports[`cosmos currency bridge scanAccounts cosmos seed 1 2`] = ` "type": "OUT", "value": "4344", }, + { + "accountId": "js:2:cosmos:cosmos1g84934jpu3v5de5yqukkkhxmcvsw3u2ajxvpdl:", + "blockHash": null, + "blockHeight": 23845362, + "extra": { + "memo": "Ledger Live", + "validators": [ + { + "address": "cosmosvaloper196ax4vc0lwpxndu9dyhvca7jhxp70rmcvrj90c", + "amount": "252", + }, + ], + }, + "fee": "14547", + "hasFailed": false, + "hash": "CAFBA91B50154E02533D4570A5FA6A6319FAC94FAFA4420D6A143EE2EB181E8C", + "id": "js:2:cosmos:cosmos1g84934jpu3v5de5yqukkkhxmcvsw3u2ajxvpdl:-CAFBA91B50154E02533D4570A5FA6A6319FAC94FAFA4420D6A143EE2EB181E8C-REWARD", + "recipients": [], + "senders": [], + "transactionSequenceNumber": 154, + "type": "REWARD", + "value": "252", + }, { "accountId": "js:2:cosmos:cosmos1g84934jpu3v5de5yqukkkhxmcvsw3u2ajxvpdl:", "blockHash": null, diff --git a/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/cryptoOrg.integration.test.ts.snap b/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/cryptoOrg.integration.test.ts.snap index 7bc5d62f4795..e1b5a942facf 100644 --- a/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/cryptoOrg.integration.test.ts.snap +++ b/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/cryptoOrg.integration.test.ts.snap @@ -20,7 +20,7 @@ exports[`crypto_org currency bridge scanAccounts crypto_org seed 1 1`] = ` "freshAddressPath": "44'/394'/0'/0/0", "id": "js:2:crypto_org:cro1jr0kggxjd3k67eu7xr7lz4s30tynsmrz44fr39:", "index": 0, - "operationsCount": 1, + "operationsCount": 0, "pendingOperations": [], "seedIdentifier": "0346289788c2f518a158232e7028e8e86b30cff0670326d3a2507183cb0d81cecb", "spendableBalance": "10000000", @@ -61,27 +61,7 @@ exports[`crypto_org currency bridge scanAccounts crypto_org seed 1 1`] = ` exports[`crypto_org currency bridge scanAccounts crypto_org seed 1 2`] = ` [ - [ - { - "accountId": "js:2:crypto_org:cro1jr0kggxjd3k67eu7xr7lz4s30tynsmrz44fr39:", - "blockHash": null, - "blockHeight": 20675998, - "extra": {}, - "fee": "5000", - "hasFailed": false, - "hash": "26AD74D54761E751720F49D7427B703EB1F179CB87255BEFDB725F4016B38F89", - "id": "js:2:crypto_org:cro1jr0kggxjd3k67eu7xr7lz4s30tynsmrz44fr39:-26AD74D54761E751720F49D7427B703EB1F179CB87255BEFDB725F4016B38F89-IN", - "recipients": [ - "cro1jr0kggxjd3k67eu7xr7lz4s30tynsmrz44fr39", - ], - "senders": [ - "cro1urt70xd2naehl3jxtjhpsrmjhaspd2azlkh44c", - ], - "transactionSequenceNumber": 5, - "type": "IN", - "value": "10000000", - }, - ], + [], [], ] `; diff --git a/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/xion.integration.test.ts.snap b/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/xion.integration.test.ts.snap index afb0a24e8a4f..c96826df845b 100644 --- a/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/xion.integration.test.ts.snap +++ b/libs/ledger-live-common/src/families/cosmos/datasets/__snapshots__/xion.integration.test.ts.snap @@ -1,4 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP + exports[`xion currency bridge scanAccounts xion seed 1 1`] = ` [ { @@ -11,7 +12,7 @@ exports[`xion currency bridge scanAccounts xion seed 1 1`] = ` "index": 0, "pendingOperations": [], "seedIdentifier": "03d5e0ebb3f1ae2afe87e5d5a24b5029a59cc12f8fd1056840091b2f0b97e54e83", - "spendableBalance": "0", + "spendableBalance": "114155", "swapHistory": [], "syncHash": undefined, "used": true, @@ -35,190 +36,10 @@ exports[`xion currency bridge scanAccounts xion seed 1 1`] = ` }, ] `; + exports[`xion currency bridge scanAccounts xion seed 1 2`] = ` [ - [ - { - "accountId": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:", - "blockHash": null, - "blockHeight": 4488607, - "extra": { - "memo": "Ledger Live", - "validators": [ - { - "address": "xionvaloper1t8ysd9cg6s38ak9xfadkjtvfv9uczvrn8wzv77", - "amount": "209175", - }, - ], - }, - "fee": "8410", - "hasFailed": false, - "hash": "0DFDF9C21EE698B9918AA30CF4B49000028943254A3FFAF36DDB0E053687CD9A", - "id": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:-0DFDF9C21EE698B9918AA30CF4B49000028943254A3FFAF36DDB0E053687CD9A-DELEGATE", - "recipients": [], - "senders": [], - "transactionSequenceNumber": 6, - "type": "DELEGATE", - "value": "8410", - }, - { - "accountId": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:", - "blockHash": null, - "blockHeight": 4488564, - "extra": { - "memo": "Ledger Live", - "validators": [ - { - "address": "xionvaloper1t8ysd9cg6s38ak9xfadkjtvfv9uczvrn8wzv77", - "amount": "66225", - }, - ], - }, - "fee": "7206", - "hasFailed": false, - "hash": "2A2B7691BAD01B57C7778300C4067B0832FE4AE34D256A65F34168C7CA891D15", - "id": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:-2A2B7691BAD01B57C7778300C4067B0832FE4AE34D256A65F34168C7CA891D15-DELEGATE", - "recipients": [], - "senders": [], - "transactionSequenceNumber": 4, - "type": "DELEGATE", - "value": "7206", - }, - { - "accountId": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:", - "blockHash": null, - "blockHeight": 4486960, - "extra": { - "memo": "Ledger Live", - }, - "fee": "4349", - "hasFailed": false, - "hash": "3E0ED76323E0606A7AFABC7B1C7DDA4D07FE78F6B4CFCFF141F37F4532CF3267", - "id": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:-3E0ED76323E0606A7AFABC7B1C7DDA4D07FE78F6B4CFCFF141F37F4532CF3267-IN", - "recipients": [ - "xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez", - ], - "senders": [ - "xion1g84934jpu3v5de5yqukkkhxmcvsw3u2as0krm5", - ], - "transactionSequenceNumber": 3, - "type": "IN", - "value": "684211", - }, - { - "accountId": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:", - "blockHash": null, - "blockHeight": 4488530, - "extra": { - "memo": "Ledger Live", - "validators": [ - { - "address": "xionvaloper1t8ysd9cg6s38ak9xfadkjtvfv9uczvrn8wzv77", - "amount": "10", - }, - ], - }, - "fee": "6371", - "hasFailed": false, - "hash": "62DE7FF0CFFFE7FA3AFBC5E4B31A234494B249C2F6B61AB72094E336BE93A7F3", - "id": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:-62DE7FF0CFFFE7FA3AFBC5E4B31A234494B249C2F6B61AB72094E336BE93A7F3-REWARD", - "recipients": [], - "senders": [], - "transactionSequenceNumber": 2, - "type": "REWARD", - "value": "10", - }, - { - "accountId": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:", - "blockHash": null, - "blockHeight": 4488578, - "extra": { - "memo": "Ledger Live", - "validators": [ - { - "address": "xionvaloper18hj7x8dlchh77dd2k9wr7dqvygmmpxrpxtzql9", - "amount": "22075", - }, - ], - }, - "fee": "7219", - "hasFailed": false, - "hash": "7E470E2AB00F4BC595AD9F9416C4ECCF6C987818AB6A8F5A94EAC04241D5A4E3", - "id": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:-7E470E2AB00F4BC595AD9F9416C4ECCF6C987818AB6A8F5A94EAC04241D5A4E3-DELEGATE", - "recipients": [], - "senders": [], - "transactionSequenceNumber": 5, - "type": "DELEGATE", - "value": "7219", - }, - { - "accountId": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:", - "blockHash": null, - "blockHeight": 4488540, - "extra": { - "memo": "Ledger Live", - "validators": [ - { - "address": "xionvaloper1t8ysd9cg6s38ak9xfadkjtvfv9uczvrn8wzv77", - "amount": "114155", - }, - ], - }, - "fee": "9314", - "hasFailed": false, - "hash": "82E94B0710F4EDC16D269560263E0185F1FB877A94F857D37615BD0814ACD335", - "id": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:-82E94B0710F4EDC16D269560263E0185F1FB877A94F857D37615BD0814ACD335-UNDELEGATE", - "recipients": [], - "senders": [], - "transactionSequenceNumber": 3, - "type": "UNDELEGATE", - "value": "9314", - }, - { - "accountId": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:", - "blockHash": null, - "blockHeight": 4487736, - "extra": { - "memo": "Ledger Live", - }, - "fee": "4466", - "hasFailed": false, - "hash": "8DA137619218388751C60C5515062F8F313143AF493C7CE3D839C210A94A6E46", - "id": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:-8DA137619218388751C60C5515062F8F313143AF493C7CE3D839C210A94A6E46-OUT", - "recipients": [ - "xion1rs97j43nfyvc689y5rjvnnhrq3tes6ghe4j84x", - ], - "senders": [ - "xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez", - ], - "transactionSequenceNumber": 1, - "type": "OUT", - "value": "226195", - }, - { - "accountId": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:", - "blockHash": null, - "blockHeight": 4486979, - "extra": { - "memo": "Ledger Live", - "validators": [ - { - "address": "xionvaloper1t8ysd9cg6s38ak9xfadkjtvfv9uczvrn8wzv77", - "amount": "114155", - }, - ], - }, - "fee": "7876", - "hasFailed": false, - "hash": "C0042A42F14C0454C8F5D46BA16C50B6810E5E3504E25C731BB03DD688083B47", - "id": "js:2:xion:xion1gyauvl44q2apn3u3aujm36q8zrj74vryh3y4ez:-C0042A42F14C0454C8F5D46BA16C50B6810E5E3504E25C731BB03DD688083B47-DELEGATE", - "recipients": [], - "senders": [], - "transactionSequenceNumber": 0, - "type": "DELEGATE", - "value": "7876", - }, - ], + [], [], ] -`; \ No newline at end of file +`; From 66df32071ab5ffbe5bfc44966eceeb0a2fcb89fa Mon Sep 17 00:00:00 2001 From: qperrot Date: Tue, 7 Jan 2025 08:39:54 +0100 Subject: [PATCH 8/9] fix: lint remove Coin --- libs/coin-modules/coin-cosmos/src/buildTransaction.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/coin-modules/coin-cosmos/src/buildTransaction.ts b/libs/coin-modules/coin-cosmos/src/buildTransaction.ts index 5586ccaeb574..98f9ad8627cd 100644 --- a/libs/coin-modules/coin-cosmos/src/buildTransaction.ts +++ b/libs/coin-modules/coin-cosmos/src/buildTransaction.ts @@ -18,7 +18,6 @@ import { PubKey } from "@keplr-wallet/proto-types/cosmos/crypto/secp256k1/keys"; import { AuthInfo, Fee } from "@keplr-wallet/proto-types/cosmos/tx/v1beta1/tx"; import type { Account } from "@ledgerhq/types-live"; import { Transaction } from "./types"; -import { Coin } from "@cosmjs/amino"; type ProtoMsg = { typeUrl: string; From 83d71724f7f054d63dafcb6a1a4c077c2802d644 Mon Sep 17 00:00:00 2001 From: qperrot Date: Tue, 7 Jan 2025 11:15:15 +0100 Subject: [PATCH 9/9] fix: change desmos lcd --- libs/coin-modules/coin-cosmos/src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/coin-modules/coin-cosmos/src/config.ts b/libs/coin-modules/coin-cosmos/src/config.ts index 57dce0ad4798..0c8d012f872c 100644 --- a/libs/coin-modules/coin-cosmos/src/config.ts +++ b/libs/coin-modules/coin-cosmos/src/config.ts @@ -28,7 +28,7 @@ export const cosmosConfig: CosmosConfig = { config_currency_desmos: { type: "object", default: { - lcd: "https://desmos-api.ibs.team", + lcd: "https://api.mainnet.desmos.network/", minGasPrice: 0.0025, }, },