From fee268be9e74aa865b603dea2822b29eac404bc5 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 20 Aug 2024 15:18:52 +0300 Subject: [PATCH] fix ledger live imports --- .../elrond/AccountHeaderManageActions.ts | 2 +- .../renderer/families/elrond/EarnRewards.tsx | 4 +-- .../components/Delegation/index.tsx | 2 +- .../Claim/fields/DelegationSelectorField.tsx | 2 +- .../Modals/Claim/steps/StepClaimRewards.tsx | 2 +- .../Modals/Claim/steps/StepConfirmation.tsx | 2 +- .../Modals/Undelegate/fields/Validator.tsx | 2 +- .../Modals/Undelegate/steps/Confirmation.tsx | 2 +- .../fields/DelegationSelectorField.tsx | 2 +- .../Withdraw/steps/StepConfirmation.tsx | 2 +- .../Modals/Withdraw/steps/StepWithdraw.tsx | 2 +- .../Unbondings/components/Unbonding/index.tsx | 2 +- .../families/elrond/operationDetails.tsx | 2 +- .../src/families/elrond/helpers.ts | 2 ++ .../packages/hw-app-elrond/package.json | 3 +- pnpm-lock.yaml | 29 +++++++++++++++++-- 16 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 libs/ledger-live-common/src/families/elrond/helpers.ts diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/AccountHeaderManageActions.ts b/apps/ledger-live-desktop/src/renderer/families/elrond/AccountHeaderManageActions.ts index 4bfd3e395352..1639d94eb4e7 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/AccountHeaderManageActions.ts +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/AccountHeaderManageActions.ts @@ -1,7 +1,7 @@ import { useCallback, useMemo } from "react"; import { useTranslation } from "react-i18next"; import { useDispatch } from "react-redux"; -import { hasMinimumDelegableBalance } from "@ledgerhq/live-common/families/elrond/helpers/hasMinimumDelegableBalance"; +import { hasMinimumDelegableBalance } from "@ledgerhq/live-common/families/elrond/helpers"; import { useElrondRandomizedValidators } from "@ledgerhq/live-common/families/elrond/react"; import { openModal } from "~/renderer/actions/modals"; import IconCoins from "~/renderer/icons/Coins"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/EarnRewards.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/EarnRewards.tsx index 4ad5a9bda827..4d4bc70899f9 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/EarnRewards.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/EarnRewards.tsx @@ -4,8 +4,8 @@ import { Trans } from "react-i18next"; import styled from "styled-components"; import { BigNumber } from "bignumber.js"; import { useElrondRandomizedValidators } from "@ledgerhq/live-common/families/elrond/react"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; -import { hasMinimumDelegableBalance } from "@ledgerhq/live-common/families/elrond/helpers/hasMinimumDelegableBalance"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; +import { hasMinimumDelegableBalance } from "@ledgerhq/live-common/families/elrond/helpers"; import Text from "~/renderer/components/Text"; import Button from "~/renderer/components/Button"; import Box from "~/renderer/components/Box"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Delegations/components/Delegation/index.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Delegations/components/Delegation/index.tsx index 105243ea3c09..08f44d9358d6 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Delegations/components/Delegation/index.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Delegations/components/Delegation/index.tsx @@ -2,7 +2,7 @@ import React, { useMemo, Fragment, useCallback, ReactNode } from "react"; import { BigNumber } from "bignumber.js"; import { Trans } from "react-i18next"; import { useDispatch } from "react-redux"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; import Box from "~/renderer/components/Box/Box"; import CheckCircle from "~/renderer/icons/CheckCircle"; import ToolTip from "~/renderer/components/Tooltip"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/fields/DelegationSelectorField.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/fields/DelegationSelectorField.tsx index 9828cffeafb8..49d2d759fc0b 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/fields/DelegationSelectorField.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/fields/DelegationSelectorField.tsx @@ -1,6 +1,6 @@ import React, { useMemo, useCallback, useState, useEffect } from "react"; import { BigNumber } from "bignumber.js"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; import Box from "~/renderer/components/Box"; import FirstLetterIcon from "~/renderer/components/FirstLetterIcon"; import Label from "~/renderer/components/Label"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/steps/StepClaimRewards.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/steps/StepClaimRewards.tsx index 969b9ee9e00e..e80b3e7245b6 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/steps/StepClaimRewards.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/steps/StepClaimRewards.tsx @@ -2,7 +2,7 @@ import React, { Fragment, useCallback } from "react"; import { Trans } from "react-i18next"; import { BigNumber } from "bignumber.js"; import { getAccountBridge } from "@ledgerhq/live-common/bridge/index"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; import invariant from "invariant"; import TrackPage from "~/renderer/analytics/TrackPage"; import Box from "~/renderer/components/Box"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/steps/StepConfirmation.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/steps/StepConfirmation.tsx index 32cf14dd9720..2b031be0da8d 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/steps/StepConfirmation.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Claim/steps/StepConfirmation.tsx @@ -1,7 +1,7 @@ import React from "react"; import { Trans } from "react-i18next"; import styled from "styled-components"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; import { SyncOneAccountOnMount } from "@ledgerhq/live-common/bridge/react/index"; import TrackPage from "~/renderer/analytics/TrackPage"; import Box from "~/renderer/components/Box"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Undelegate/fields/Validator.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Undelegate/fields/Validator.tsx index dc5dcf489306..911bf07ea1c7 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Undelegate/fields/Validator.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Undelegate/fields/Validator.tsx @@ -1,6 +1,6 @@ import React, { useMemo, useState, useCallback } from "react"; import { useTranslation } from "react-i18next"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; import FirstLetterIcon from "~/renderer/components/FirstLetterIcon"; import Box from "~/renderer/components/Box"; import Label from "~/renderer/components/Label"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Undelegate/steps/Confirmation.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Undelegate/steps/Confirmation.tsx index 78c2548d252f..26450d291aa6 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Undelegate/steps/Confirmation.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Undelegate/steps/Confirmation.tsx @@ -1,7 +1,7 @@ import React, { useCallback } from "react"; import { useTranslation, Trans } from "react-i18next"; import styled from "styled-components"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; import { SyncOneAccountOnMount } from "@ledgerhq/live-common/bridge/react/index"; import TrackPage from "~/renderer/analytics/TrackPage"; import Box from "~/renderer/components/Box"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/fields/DelegationSelectorField.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/fields/DelegationSelectorField.tsx index d75e5e29c8b5..fe66c96fbd23 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/fields/DelegationSelectorField.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/fields/DelegationSelectorField.tsx @@ -1,6 +1,6 @@ import React, { useMemo, useCallback, useState, useEffect } from "react"; import { BigNumber } from "bignumber.js"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; import Box from "~/renderer/components/Box"; import FirstLetterIcon from "~/renderer/components/FirstLetterIcon"; import Label from "~/renderer/components/Label"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/steps/StepConfirmation.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/steps/StepConfirmation.tsx index a255f29042dc..70aaadf51f09 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/steps/StepConfirmation.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/steps/StepConfirmation.tsx @@ -1,7 +1,7 @@ import React from "react"; import { Trans } from "react-i18next"; import styled from "styled-components"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; import { SyncOneAccountOnMount } from "@ledgerhq/live-common/bridge/react/index"; import TrackPage from "~/renderer/analytics/TrackPage"; import Box from "~/renderer/components/Box"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/steps/StepWithdraw.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/steps/StepWithdraw.tsx index 12f88ef06dbe..b8c1dd7833b9 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/steps/StepWithdraw.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Modals/Withdraw/steps/StepWithdraw.tsx @@ -1,5 +1,5 @@ import React, { Fragment, useCallback } from "react"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; import { getAccountBridge } from "@ledgerhq/live-common/bridge/index"; import { Trans } from "react-i18next"; import { BigNumber } from "bignumber.js"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Unbondings/components/Unbonding/index.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Unbondings/components/Unbonding/index.tsx index 28b09d355699..a0fb49d0fe9a 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/components/Unbondings/components/Unbonding/index.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/components/Unbondings/components/Unbonding/index.tsx @@ -1,6 +1,6 @@ import React, { useState, useCallback, useMemo, useEffect } from "react"; import { Trans } from "react-i18next"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; import { useDispatch } from "react-redux"; import Box from "~/renderer/components/Box/Box"; import ExclamationCircleThin from "~/renderer/icons/ExclamationCircleThin"; diff --git a/apps/ledger-live-desktop/src/renderer/families/elrond/operationDetails.tsx b/apps/ledger-live-desktop/src/renderer/families/elrond/operationDetails.tsx index 5f1924e2d772..148052061309 100644 --- a/apps/ledger-live-desktop/src/renderer/families/elrond/operationDetails.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/elrond/operationDetails.tsx @@ -5,7 +5,7 @@ import { ELROND_EXPLORER_URL, ELROND_LEDGER_VALIDATOR_ADDRESS, } from "@ledgerhq/live-common/families/elrond/constants"; -import { denominate } from "@ledgerhq/live-common/families/elrond/helpers/denominate"; +import { denominate } from "@ledgerhq/live-common/families/elrond/helpers"; import { useElrondPreloadData } from "@ledgerhq/live-common/families/elrond/react"; import { ElrondProvider, ElrondOperation } from "@ledgerhq/live-common/families/elrond/types"; import { Account, Operation } from "@ledgerhq/types-live"; diff --git a/libs/ledger-live-common/src/families/elrond/helpers.ts b/libs/ledger-live-common/src/families/elrond/helpers.ts new file mode 100644 index 000000000000..2d3b0f377ee1 --- /dev/null +++ b/libs/ledger-live-common/src/families/elrond/helpers.ts @@ -0,0 +1,2 @@ +export * from "@ledgerhq/coin-elrond/helpers/denominate"; +export * from "@ledgerhq/coin-elrond/helpers/hasMinimumDelegableBalance"; diff --git a/libs/ledgerjs/packages/hw-app-elrond/package.json b/libs/ledgerjs/packages/hw-app-elrond/package.json index de21e6a894d9..c9477a651b93 100644 --- a/libs/ledgerjs/packages/hw-app-elrond/package.json +++ b/libs/ledgerjs/packages/hw-app-elrond/package.json @@ -30,7 +30,8 @@ "@ledgerhq/hw-transport": "workspace:^", "bip32-path": "^0.4.2", "@multiversx/sdk-core": "^13.3.0", - "bignumber.js": "^9.0.1" + "bignumber.js": "^9.0.1", + "protobufjs": "^7.2.6" }, "devDependencies": { "@ledgerhq/hw-transport-mocker": "workspace:^", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e28e2bffa293..9e451480a5ef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4018,13 +4018,16 @@ importers: version: link:../hw-transport '@multiversx/sdk-core': specifier: ^13.3.0 - version: 13.3.0(bignumber.js@9.1.2) + version: 13.3.0(bignumber.js@9.1.2)(protobufjs@7.3.2) bignumber.js: specifier: ^9.0.1 version: 9.1.2 bip32-path: specifier: ^0.4.2 version: 0.4.2 + protobufjs: + specifier: ^7.2.6 + version: 7.3.2 devDependencies: '@ledgerhq/hw-transport-mocker': specifier: workspace:^ @@ -24974,6 +24977,10 @@ packages: resolution: {integrity: sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==} engines: {node: '>=12.0.0'} + protobufjs@7.3.2: + resolution: {integrity: sha512-RXyHaACeqXeqAKGLDl68rQKbmObRsTIn4TYVUUug1KfS47YWCo5MacGITEryugIgZqORCvJWEk4l449POg5Txg==} + engines: {node: '>=12.0.0'} + protocols@2.0.1: resolution: {integrity: sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q==} @@ -34553,7 +34560,7 @@ snapshots: dependencies: lodash.camelcase: 4.3.0 long: 5.2.3 - protobufjs: 7.2.5 + protobufjs: 7.3.2 yargs: 17.7.2 '@hapi/bourne@2.1.0': {} @@ -35836,7 +35843,7 @@ snapshots: outvariant: 1.4.2 strict-event-emitter: 0.5.1 - '@multiversx/sdk-core@13.3.0(bignumber.js@9.1.2)': + '@multiversx/sdk-core@13.3.0(bignumber.js@9.1.2)(protobufjs@7.3.2)': dependencies: '@multiversx/sdk-transaction-decoder': 1.0.2 bech32: 1.1.4 @@ -35845,6 +35852,7 @@ snapshots: buffer: 6.0.3 json-bigint: 1.0.0 keccak: 3.0.2 + protobufjs: 7.3.2 '@multiversx/sdk-transaction-decoder@1.0.2': dependencies: @@ -58185,6 +58193,21 @@ snapshots: '@types/node': 20.14.10 long: 5.2.3 + protobufjs@7.3.2: + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.4 + '@protobufjs/eventemitter': 1.1.0 + '@protobufjs/fetch': 1.1.0 + '@protobufjs/float': 1.0.2 + '@protobufjs/inquire': 1.1.0 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.0 + '@types/node': 20.14.10 + long: 5.2.3 + protocols@2.0.1: {} proxy-addr@2.0.7: