@ledgerhq/live-common 34.51.0-nightly.1 → 34.51.0-nightly.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib/bridge/crypto-assets/index.js +0 -2
- package/lib/bridge/crypto-assets/index.js.map +1 -1
- package/lib/bridge/crypto-assets/index.test.js +0 -4
- package/lib/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.js +2 -0
- package/lib/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +1 -0
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +3 -0
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +37 -45
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +0 -20
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/signRawOperation.d.ts +8 -0
- package/lib/bridge/generic-alpaca/signRawOperation.d.ts.map +1 -0
- package/lib/bridge/generic-alpaca/signRawOperation.js +55 -0
- package/lib/bridge/generic-alpaca/signRawOperation.js.map +1 -0
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js +1 -0
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js +186 -88
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +1 -0
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/mockHelpers.d.ts +1 -0
- package/lib/bridge/mockHelpers.d.ts.map +1 -1
- package/lib/bridge/mockHelpers.js +53 -1
- package/lib/bridge/mockHelpers.js.map +1 -1
- package/lib/bridge/react/BridgeSync.d.ts +1 -0
- package/lib/bridge/react/BridgeSync.d.ts.map +1 -1
- package/lib/bridge/react/BridgeSync.js +19 -16
- package/lib/bridge/react/BridgeSync.js.map +1 -1
- package/lib/bridge/react/BridgeSync.test.js +403 -66
- package/lib/bridge/react/BridgeSync.test.js.map +1 -1
- package/lib/currencies/index.d.ts +1 -1
- package/lib/currencies/index.d.ts.map +1 -1
- package/lib/currencies/index.js +2 -3
- package/lib/currencies/index.js.map +1 -1
- package/lib/currencies/sortByMarketcap.test.js +1 -3
- package/lib/currencies/sortByMarketcap.test.js.map +1 -1
- package/lib/dada-client/entities/index.d.ts +1 -1
- package/lib/dada-client/entities/index.d.ts.map +1 -1
- package/lib/e2e/enum/Account.d.ts +4 -0
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +4 -0
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/AppInfos.d.ts +1 -0
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/AppInfos.js +1 -0
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +2 -0
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +2 -0
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +2 -1
- package/lib/e2e/enum/Network.d.ts.map +1 -1
- package/lib/e2e/enum/Network.js +1 -0
- package/lib/e2e/enum/Network.js.map +1 -1
- package/lib/e2e/enum/TokenType.d.ts +2 -1
- package/lib/e2e/enum/TokenType.d.ts.map +1 -1
- package/lib/e2e/enum/TokenType.js +1 -0
- package/lib/e2e/enum/TokenType.js.map +1 -1
- package/lib/e2e/enum/TransactionStatus.d.ts +4 -1
- package/lib/e2e/enum/TransactionStatus.d.ts.map +1 -1
- package/lib/e2e/enum/TransactionStatus.js +3 -0
- package/lib/e2e/enum/TransactionStatus.js.map +1 -1
- package/lib/e2e/families/sui.d.ts +2 -0
- package/lib/e2e/families/sui.d.ts.map +1 -0
- package/lib/e2e/families/sui.js +11 -0
- package/lib/e2e/families/sui.js.map +1 -0
- package/lib/e2e/index.d.ts +11 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts +1 -0
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +23 -1
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/exchange/providers/swap.js +4 -4
- package/lib/exchange/providers/swap.js.map +1 -1
- package/lib/exchange/swap/api/v5/__mocks__/fetchRates.mocks.d.ts.map +1 -1
- package/lib/exchange/swap/api/v5/__mocks__/fetchRates.mocks.js +1 -1
- package/lib/exchange/swap/api/v5/__mocks__/fetchRates.mocks.js.map +1 -1
- package/lib/exchange/swap/mock.js +1 -1
- package/lib/exchange/swap/mock.js.map +1 -1
- package/lib/families/algorand/bridge/mock.d.ts.map +1 -1
- package/lib/families/algorand/bridge/mock.js +1 -0
- package/lib/families/algorand/bridge/mock.js.map +1 -1
- package/lib/families/bitcoin/bridge/mock.d.ts.map +1 -1
- package/lib/families/bitcoin/bridge/mock.js +1 -0
- package/lib/families/bitcoin/bridge/mock.js.map +1 -1
- package/lib/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib/families/canton/bridge/mock.js +3 -0
- package/lib/families/canton/bridge/mock.js.map +1 -1
- package/lib/families/cardano/bridge/mock.d.ts.map +1 -1
- package/lib/families/cardano/bridge/mock.js +1 -0
- package/lib/families/cardano/bridge/mock.js.map +1 -1
- package/lib/families/casper/bridge/mock.d.ts.map +1 -1
- package/lib/families/casper/bridge/mock.js +1 -0
- package/lib/families/casper/bridge/mock.js.map +1 -1
- package/lib/families/cosmos/bridge/mock.d.ts.map +1 -1
- package/lib/families/cosmos/bridge/mock.js +1 -0
- package/lib/families/cosmos/bridge/mock.js.map +1 -1
- package/lib/families/evm/bridge/mock.d.ts.map +1 -1
- package/lib/families/evm/bridge/mock.js +1 -0
- package/lib/families/evm/bridge/mock.js.map +1 -1
- package/lib/families/icon/bridge/mock.d.ts.map +1 -1
- package/lib/families/icon/bridge/mock.js +1 -0
- package/lib/families/icon/bridge/mock.js.map +1 -1
- package/lib/families/multiversx/bridge/mock.d.ts.map +1 -1
- package/lib/families/multiversx/bridge/mock.js +1 -0
- package/lib/families/multiversx/bridge/mock.js.map +1 -1
- package/lib/families/polkadot/bridge/mock.d.ts.map +1 -1
- package/lib/families/polkadot/bridge/mock.js +1 -0
- package/lib/families/polkadot/bridge/mock.js.map +1 -1
- package/lib/families/polkadot/config.d.ts.map +1 -1
- package/lib/families/polkadot/config.js +84 -0
- package/lib/families/polkadot/config.js.map +1 -1
- package/lib/families/polkadot/setup.d.ts.map +1 -1
- package/lib/families/polkadot/setup.js +5 -4
- package/lib/families/polkadot/setup.js.map +1 -1
- package/lib/families/solana/bridge/mock.d.ts +1 -0
- package/lib/families/solana/bridge/mock.d.ts.map +1 -1
- package/lib/families/stellar/bridge/mock.d.ts.map +1 -1
- package/lib/families/stellar/bridge/mock.js +1 -0
- package/lib/families/stellar/bridge/mock.js.map +1 -1
- package/lib/families/tezos/bridge/mock.d.ts.map +1 -1
- package/lib/families/tezos/bridge/mock.js +1 -0
- package/lib/families/tezos/bridge/mock.js.map +1 -1
- package/lib/families/tron/bridge/mock.d.ts.map +1 -1
- package/lib/families/tron/bridge/mock.js +1 -0
- package/lib/families/tron/bridge/mock.js.map +1 -1
- package/lib/families/xrp/bridge/mock.d.ts.map +1 -1
- package/lib/families/xrp/bridge/mock.js +1 -0
- package/lib/families/xrp/bridge/mock.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts +3 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +14 -1
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/generated/bridge/mock.d.ts +1 -0
- package/lib/generated/bridge/mock.d.ts.map +1 -1
- package/lib/hooks/useManifestWithSessionId.d.ts +12 -0
- package/lib/hooks/useManifestWithSessionId.d.ts.map +1 -0
- package/lib/hooks/useManifestWithSessionId.js +67 -0
- package/lib/hooks/useManifestWithSessionId.js.map +1 -0
- package/lib/hooks/useManifestWithSessionId.test.d.ts +2 -0
- package/lib/hooks/useManifestWithSessionId.test.d.ts.map +1 -0
- package/lib/hooks/useManifestWithSessionId.test.js +71 -0
- package/lib/hooks/useManifestWithSessionId.test.js.map +1 -0
- package/lib/hw/actions/rawTransaction.d.ts +37 -0
- package/lib/hw/actions/rawTransaction.d.ts.map +1 -0
- package/lib/hw/actions/rawTransaction.js +107 -0
- package/lib/hw/actions/rawTransaction.js.map +1 -0
- package/lib/market/utils/index.d.ts +1 -0
- package/lib/market/utils/index.d.ts.map +1 -1
- package/lib/market/utils/index.js +16 -0
- package/lib/market/utils/index.js.map +1 -1
- package/lib/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.d.ts +2 -0
- package/lib/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.js +350 -0
- package/lib/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.js.map +1 -0
- package/lib/modularDrawer/hooks/index.d.ts +2 -0
- package/lib/modularDrawer/hooks/index.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/index.js +6 -0
- package/lib/modularDrawer/hooks/index.js.map +1 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +9 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib/modularDrawer/hooks/useDetailedAccountsCore.d.ts +14 -0
- package/lib/modularDrawer/hooks/useDetailedAccountsCore.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useDetailedAccountsCore.js +119 -0
- package/lib/modularDrawer/hooks/useDetailedAccountsCore.js.map +1 -0
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js +9 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +6 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +12 -4
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib/modularDrawer/index.d.ts +4 -0
- package/lib/modularDrawer/index.d.ts.map +1 -0
- package/lib/modularDrawer/index.js +20 -0
- package/lib/modularDrawer/index.js.map +1 -0
- package/lib/modularDrawer/types/detailedAccount.d.ts +46 -0
- package/lib/modularDrawer/types/detailedAccount.d.ts.map +1 -0
- package/lib/modularDrawer/types/detailedAccount.js +3 -0
- package/lib/modularDrawer/types/detailedAccount.js.map +1 -0
- package/lib/modularDrawer/types/index.d.ts +2 -0
- package/lib/modularDrawer/types/index.d.ts.map +1 -0
- package/lib/modularDrawer/types/index.js +18 -0
- package/lib/modularDrawer/types/index.js.map +1 -0
- package/lib/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.d.ts +2 -0
- package/lib/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.d.ts.map +1 -0
- package/lib/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.js +106 -0
- package/lib/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.js.map +1 -0
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +3 -4
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +7 -0
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -1
- package/lib/modularDrawer/utils/index.d.ts +1 -0
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +3 -1
- package/lib/modularDrawer/utils/index.js.map +1 -1
- package/lib/modularDrawer/utils/sortAccountsByFiatValue.d.ts +8 -0
- package/lib/modularDrawer/utils/sortAccountsByFiatValue.d.ts.map +1 -0
- package/lib/modularDrawer/utils/sortAccountsByFiatValue.js +17 -0
- package/lib/modularDrawer/utils/sortAccountsByFiatValue.js.map +1 -0
- package/lib/modularDrawer/utils/type.d.ts +2 -2
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib/platform/providers/RemoteLiveAppProvider/api/mock.json +3 -3
- package/lib/wallet-api/logic.d.ts +1 -0
- package/lib/wallet-api/logic.d.ts.map +1 -1
- package/lib/wallet-api/logic.js +21 -1
- package/lib/wallet-api/logic.js.map +1 -1
- package/lib/wallet-api/react.d.ts +9 -1
- package/lib/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +60 -2
- package/lib/wallet-api/react.js.map +1 -1
- package/lib/wallet-api/tracking.d.ts +3 -0
- package/lib/wallet-api/tracking.d.ts.map +1 -1
- package/lib/wallet-api/tracking.js +12 -0
- package/lib/wallet-api/tracking.js.map +1 -1
- package/lib/wallet-api/useDappLogic.js +1 -1
- package/lib/wallet-api/useDappLogic.js.map +1 -1
- package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib-es/bridge/crypto-assets/index.js +0 -2
- package/lib-es/bridge/crypto-assets/index.js.map +1 -1
- package/lib-es/bridge/crypto-assets/index.test.js +0 -4
- package/lib-es/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.js +2 -0
- package/lib-es/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +1 -0
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js +3 -0
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +37 -45
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +0 -17
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signRawOperation.d.ts +8 -0
- package/lib-es/bridge/generic-alpaca/signRawOperation.d.ts.map +1 -0
- package/lib-es/bridge/generic-alpaca/signRawOperation.js +48 -0
- package/lib-es/bridge/generic-alpaca/signRawOperation.js.map +1 -0
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js +1 -0
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js +163 -88
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +1 -0
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/mockHelpers.d.ts +1 -0
- package/lib-es/bridge/mockHelpers.d.ts.map +1 -1
- package/lib-es/bridge/mockHelpers.js +51 -0
- package/lib-es/bridge/mockHelpers.js.map +1 -1
- package/lib-es/bridge/react/BridgeSync.d.ts +1 -0
- package/lib-es/bridge/react/BridgeSync.d.ts.map +1 -1
- package/lib-es/bridge/react/BridgeSync.js +17 -15
- package/lib-es/bridge/react/BridgeSync.js.map +1 -1
- package/lib-es/bridge/react/BridgeSync.test.js +382 -65
- package/lib-es/bridge/react/BridgeSync.test.js.map +1 -1
- package/lib-es/currencies/index.d.ts +1 -1
- package/lib-es/currencies/index.d.ts.map +1 -1
- package/lib-es/currencies/index.js +1 -1
- package/lib-es/currencies/index.js.map +1 -1
- package/lib-es/currencies/sortByMarketcap.test.js +1 -3
- package/lib-es/currencies/sortByMarketcap.test.js.map +1 -1
- package/lib-es/dada-client/entities/index.d.ts +1 -1
- package/lib-es/dada-client/entities/index.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +4 -0
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +4 -0
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts +1 -0
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/AppInfos.js +1 -0
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +2 -0
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +2 -0
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +2 -1
- package/lib-es/e2e/enum/Network.d.ts.map +1 -1
- package/lib-es/e2e/enum/Network.js +1 -0
- package/lib-es/e2e/enum/Network.js.map +1 -1
- package/lib-es/e2e/enum/TokenType.d.ts +2 -1
- package/lib-es/e2e/enum/TokenType.d.ts.map +1 -1
- package/lib-es/e2e/enum/TokenType.js +1 -0
- package/lib-es/e2e/enum/TokenType.js.map +1 -1
- package/lib-es/e2e/enum/TransactionStatus.d.ts +4 -1
- package/lib-es/e2e/enum/TransactionStatus.d.ts.map +1 -1
- package/lib-es/e2e/enum/TransactionStatus.js +3 -0
- package/lib-es/e2e/enum/TransactionStatus.js.map +1 -1
- package/lib-es/e2e/families/sui.d.ts +2 -0
- package/lib-es/e2e/families/sui.d.ts.map +1 -0
- package/lib-es/e2e/families/sui.js +7 -0
- package/lib-es/e2e/families/sui.js.map +1 -0
- package/lib-es/e2e/index.d.ts +11 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts +1 -0
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +21 -0
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/env.react.d.ts +1 -1
- package/lib-es/env.react.d.ts.map +1 -1
- package/lib-es/exchange/providers/swap.js +4 -4
- package/lib-es/exchange/providers/swap.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/__mocks__/fetchRates.mocks.d.ts.map +1 -1
- package/lib-es/exchange/swap/api/v5/__mocks__/fetchRates.mocks.js +1 -1
- package/lib-es/exchange/swap/api/v5/__mocks__/fetchRates.mocks.js.map +1 -1
- package/lib-es/exchange/swap/mock.js +1 -1
- package/lib-es/exchange/swap/mock.js.map +1 -1
- package/lib-es/families/algorand/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/algorand/bridge/mock.js +2 -1
- package/lib-es/families/algorand/bridge/mock.js.map +1 -1
- package/lib-es/families/bitcoin/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/bitcoin/bridge/mock.js +2 -1
- package/lib-es/families/bitcoin/bridge/mock.js.map +1 -1
- package/lib-es/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/canton/bridge/mock.js +3 -0
- package/lib-es/families/canton/bridge/mock.js.map +1 -1
- package/lib-es/families/cardano/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/cardano/bridge/mock.js +2 -1
- package/lib-es/families/cardano/bridge/mock.js.map +1 -1
- package/lib-es/families/casper/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/casper/bridge/mock.js +2 -1
- package/lib-es/families/casper/bridge/mock.js.map +1 -1
- package/lib-es/families/cosmos/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/cosmos/bridge/mock.js +2 -1
- package/lib-es/families/cosmos/bridge/mock.js.map +1 -1
- package/lib-es/families/evm/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/evm/bridge/mock.js +2 -1
- package/lib-es/families/evm/bridge/mock.js.map +1 -1
- package/lib-es/families/icon/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/icon/bridge/mock.js +2 -1
- package/lib-es/families/icon/bridge/mock.js.map +1 -1
- package/lib-es/families/multiversx/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/multiversx/bridge/mock.js +2 -1
- package/lib-es/families/multiversx/bridge/mock.js.map +1 -1
- package/lib-es/families/polkadot/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/polkadot/bridge/mock.js +2 -1
- package/lib-es/families/polkadot/bridge/mock.js.map +1 -1
- package/lib-es/families/polkadot/config.d.ts.map +1 -1
- package/lib-es/families/polkadot/config.js +84 -0
- package/lib-es/families/polkadot/config.js.map +1 -1
- package/lib-es/families/polkadot/setup.d.ts.map +1 -1
- package/lib-es/families/polkadot/setup.js +5 -4
- package/lib-es/families/polkadot/setup.js.map +1 -1
- package/lib-es/families/solana/bridge/mock.d.ts +1 -0
- package/lib-es/families/solana/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/stellar/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/stellar/bridge/mock.js +2 -1
- package/lib-es/families/stellar/bridge/mock.js.map +1 -1
- package/lib-es/families/tezos/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/tezos/bridge/mock.js +2 -1
- package/lib-es/families/tezos/bridge/mock.js.map +1 -1
- package/lib-es/families/tron/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/tron/bridge/mock.js +2 -1
- package/lib-es/families/tron/bridge/mock.js.map +1 -1
- package/lib-es/families/xrp/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/xrp/bridge/mock.js +2 -1
- package/lib-es/families/xrp/bridge/mock.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts +3 -0
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +14 -1
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/generated/bridge/mock.d.ts +1 -0
- package/lib-es/generated/bridge/mock.d.ts.map +1 -1
- package/lib-es/hooks/useManifestWithSessionId.d.ts +12 -0
- package/lib-es/hooks/useManifestWithSessionId.d.ts.map +1 -0
- package/lib-es/hooks/useManifestWithSessionId.js +60 -0
- package/lib-es/hooks/useManifestWithSessionId.js.map +1 -0
- package/lib-es/hooks/useManifestWithSessionId.test.d.ts +2 -0
- package/lib-es/hooks/useManifestWithSessionId.test.d.ts.map +1 -0
- package/lib-es/hooks/useManifestWithSessionId.test.js +69 -0
- package/lib-es/hooks/useManifestWithSessionId.test.js.map +1 -0
- package/lib-es/hw/actions/rawTransaction.d.ts +37 -0
- package/lib-es/hw/actions/rawTransaction.d.ts.map +1 -0
- package/lib-es/hw/actions/rawTransaction.js +103 -0
- package/lib-es/hw/actions/rawTransaction.js.map +1 -0
- package/lib-es/market/utils/index.d.ts +1 -0
- package/lib-es/market/utils/index.d.ts.map +1 -1
- package/lib-es/market/utils/index.js +2 -0
- package/lib-es/market/utils/index.js.map +1 -1
- package/lib-es/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.d.ts +2 -0
- package/lib-es/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.js +345 -0
- package/lib-es/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.js.map +1 -0
- package/lib-es/modularDrawer/hooks/index.d.ts +2 -0
- package/lib-es/modularDrawer/hooks/index.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/index.js +2 -0
- package/lib-es/modularDrawer/hooks/index.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +9 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useDetailedAccountsCore.d.ts +14 -0
- package/lib-es/modularDrawer/hooks/useDetailedAccountsCore.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useDetailedAccountsCore.js +115 -0
- package/lib-es/modularDrawer/hooks/useDetailedAccountsCore.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +6 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +6 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +9 -4
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib-es/modularDrawer/index.d.ts +4 -0
- package/lib-es/modularDrawer/index.d.ts.map +1 -0
- package/lib-es/modularDrawer/index.js +4 -0
- package/lib-es/modularDrawer/index.js.map +1 -0
- package/lib-es/modularDrawer/types/detailedAccount.d.ts +46 -0
- package/lib-es/modularDrawer/types/detailedAccount.d.ts.map +1 -0
- package/lib-es/modularDrawer/types/detailedAccount.js +2 -0
- package/lib-es/modularDrawer/types/detailedAccount.js.map +1 -0
- package/lib-es/modularDrawer/types/index.d.ts +2 -0
- package/lib-es/modularDrawer/types/index.d.ts.map +1 -0
- package/lib-es/modularDrawer/types/index.js +2 -0
- package/lib-es/modularDrawer/types/index.js.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.d.ts +2 -0
- package/lib-es/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.js +101 -0
- package/lib-es/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.js.map +1 -0
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +3 -4
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +4 -0
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -1
- package/lib-es/modularDrawer/utils/index.d.ts +1 -0
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +1 -0
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/modularDrawer/utils/sortAccountsByFiatValue.d.ts +8 -0
- package/lib-es/modularDrawer/utils/sortAccountsByFiatValue.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/sortAccountsByFiatValue.js +13 -0
- package/lib-es/modularDrawer/utils/sortAccountsByFiatValue.js.map +1 -0
- package/lib-es/modularDrawer/utils/type.d.ts +2 -2
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib-es/platform/providers/RemoteLiveAppProvider/api/mock.json +3 -3
- package/lib-es/wallet-api/logic.d.ts +1 -0
- package/lib-es/wallet-api/logic.d.ts.map +1 -1
- package/lib-es/wallet-api/logic.js +19 -0
- package/lib-es/wallet-api/logic.js.map +1 -1
- package/lib-es/wallet-api/react.d.ts +9 -1
- package/lib-es/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +61 -3
- package/lib-es/wallet-api/react.js.map +1 -1
- package/lib-es/wallet-api/tracking.d.ts +3 -0
- package/lib-es/wallet-api/tracking.d.ts.map +1 -1
- package/lib-es/wallet-api/tracking.js +12 -0
- package/lib-es/wallet-api/tracking.js.map +1 -1
- package/lib-es/wallet-api/useDappLogic.js +2 -2
- package/lib-es/wallet-api/useDappLogic.js.map +1 -1
- package/package.json +59 -59
- package/src/bridge/crypto-assets/index.test.ts +0 -4
- package/src/bridge/crypto-assets/index.ts +0 -2
- package/src/bridge/generic-alpaca/accountBridge.ts +2 -0
- package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +8 -0
- package/src/bridge/generic-alpaca/prepareTransaction.ts +46 -69
- package/src/bridge/generic-alpaca/signOperation.ts +0 -20
- package/src/bridge/generic-alpaca/signRawOperation.ts +86 -0
- package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +1 -0
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +191 -109
- package/src/bridge/generic-alpaca/utils.ts +1 -0
- package/src/bridge/mockHelpers.ts +57 -0
- package/src/bridge/react/BridgeSync.test.tsx +513 -82
- package/src/bridge/react/BridgeSync.tsx +18 -17
- package/src/currencies/index.ts +1 -2
- package/src/currencies/sortByMarketcap.test.ts +1 -3
- package/src/dada-client/MIGRATION_GUIDE.md +215 -0
- package/src/dada-client/entities/index.ts +1 -1
- package/src/e2e/enum/Account.ts +31 -0
- package/src/e2e/enum/AppInfos.ts +2 -0
- package/src/e2e/enum/Currency.ts +11 -0
- package/src/e2e/enum/Network.ts +1 -0
- package/src/e2e/enum/TokenType.ts +1 -0
- package/src/e2e/enum/TransactionStatus.ts +3 -0
- package/src/e2e/families/sui.ts +7 -0
- package/src/e2e/speculos.ts +23 -0
- package/src/exchange/providers/swap.ts +4 -4
- package/src/exchange/swap/api/v5/__mocks__/fetchRates.mocks.ts +1 -2
- package/src/exchange/swap/mock.ts +1 -1
- package/src/families/algorand/bridge/mock.ts +2 -0
- package/src/families/bitcoin/bridge/mock.ts +2 -0
- package/src/families/canton/bridge/mock.ts +3 -0
- package/src/families/cardano/bridge/mock.ts +2 -0
- package/src/families/casper/bridge/mock.ts +2 -0
- package/src/families/cosmos/bridge/mock.ts +2 -0
- package/src/families/evm/bridge/mock.ts +2 -0
- package/src/families/icon/bridge/mock.ts +2 -0
- package/src/families/multiversx/bridge/mock.ts +2 -0
- package/src/families/polkadot/bridge/mock.ts +2 -0
- package/src/families/polkadot/config.ts +84 -0
- package/src/families/polkadot/setup.ts +6 -4
- package/src/families/stellar/bridge/mock.ts +2 -0
- package/src/families/tezos/bridge/mock.ts +2 -0
- package/src/families/tron/bridge/mock.ts +2 -0
- package/src/families/xrp/bridge/mock.ts +2 -0
- package/src/featureFlags/defaultFeatures.ts +15 -1
- package/src/hooks/useManifestWithSessionId.test.ts +105 -0
- package/src/hooks/useManifestWithSessionId.ts +83 -0
- package/src/hw/actions/rawTransaction.ts +190 -0
- package/src/market/utils/index.ts +3 -0
- package/src/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.ts +472 -0
- package/src/modularDrawer/hooks/index.ts +1 -0
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +9 -0
- package/src/modularDrawer/hooks/useDetailedAccountsCore.ts +146 -0
- package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +5 -1
- package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +10 -4
- package/src/modularDrawer/index.ts +3 -0
- package/src/modularDrawer/types/detailedAccount.ts +49 -0
- package/src/modularDrawer/types/index.ts +1 -0
- package/src/modularDrawer/utils/__tests__/sortAccountsByFiatValue.test.ts +117 -0
- package/src/modularDrawer/utils/getBalanceAndFiatValueByAssets.ts +6 -3
- package/src/modularDrawer/utils/index.ts +1 -0
- package/src/modularDrawer/utils/sortAccountsByFiatValue.ts +14 -0
- package/src/modularDrawer/utils/type.ts +3 -2
- package/src/platform/providers/RemoteLiveAppProvider/api/mock.json +3 -3
- package/src/wallet-api/logic.ts +35 -0
- package/src/wallet-api/react.ts +87 -1
- package/src/wallet-api/tracking.ts +15 -0
- package/src/wallet-api/useDappLogic.ts +3 -3
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Unit } from "@ledgerhq/types-cryptoassets";
|
|
2
|
+
import { AccountLike } from "@ledgerhq/types-live";
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base raw detailed account with unformatted values for UI formatting
|
|
7
|
+
* This is the shared interface that both mobile and desktop can extend
|
|
8
|
+
*/
|
|
9
|
+
export interface BaseRawDetailedAccount {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
ticker: string;
|
|
13
|
+
balance: BigNumber;
|
|
14
|
+
balanceUnit: Unit;
|
|
15
|
+
fiatValue: number;
|
|
16
|
+
address: string;
|
|
17
|
+
cryptoId: string;
|
|
18
|
+
parentId?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Extended detailed account that includes the original account references
|
|
23
|
+
* Used by mobile implementation that needs access to the full account objects
|
|
24
|
+
*/
|
|
25
|
+
export interface ExtendedRawDetailedAccount extends BaseRawDetailedAccount {
|
|
26
|
+
account: AccountLike;
|
|
27
|
+
parentAccount?: AccountLike;
|
|
28
|
+
protocol?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Configuration for formatting detailed accounts
|
|
33
|
+
*/
|
|
34
|
+
export interface DetailedAccountFormatConfig {
|
|
35
|
+
discreet?: boolean;
|
|
36
|
+
locale?: string;
|
|
37
|
+
showCode?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Parameters for creating detailed accounts
|
|
42
|
+
*/
|
|
43
|
+
export interface CreateDetailedAccountsParams {
|
|
44
|
+
asset: any; // CryptoOrTokenCurrency - avoiding import to keep this generic
|
|
45
|
+
accountTuples: any[]; // AccountTuple[] - avoiding import to keep this generic
|
|
46
|
+
accountNameMap: Record<string, string>;
|
|
47
|
+
isTokenCurrency: boolean;
|
|
48
|
+
formatConfig?: DetailedAccountFormatConfig;
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./detailedAccount";
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { sortAccountsByFiatValue } from "../sortAccountsByFiatValue";
|
|
2
|
+
import { BaseRawDetailedAccount } from "../../types/detailedAccount";
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
|
|
5
|
+
const mockBalanceUnit = { name: "Ethereum", code: "ETH", magnitude: 18 };
|
|
6
|
+
|
|
7
|
+
const mockAccounts: BaseRawDetailedAccount[] = [
|
|
8
|
+
{
|
|
9
|
+
name: "Ethereum 1",
|
|
10
|
+
id: "js:2:ethereum:0xaDf49b9f133fb137e82b24F06D23E49c51f586C7:",
|
|
11
|
+
ticker: "ETH",
|
|
12
|
+
balance: new BigNumber("1.55699"),
|
|
13
|
+
balanceUnit: mockBalanceUnit,
|
|
14
|
+
fiatValue: 4149.62,
|
|
15
|
+
address: "0xaDf...586C7",
|
|
16
|
+
cryptoId: "ethereum",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "Ethereum 2",
|
|
20
|
+
id: "js:2:ethereum:0xd4b6595ff5f3c21E0b00edB8947A31110a9c4B8f:",
|
|
21
|
+
ticker: "ETH",
|
|
22
|
+
balance: new BigNumber("0.178403"),
|
|
23
|
+
balanceUnit: mockBalanceUnit,
|
|
24
|
+
fiatValue: 475.47,
|
|
25
|
+
address: "0xd4b...c4B8f",
|
|
26
|
+
cryptoId: "ethereum",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "Ethereum 3",
|
|
30
|
+
id: "js:2:ethereum:0x833eBB4bDa11da33a7F1C907C8171e5995Fe33c7:",
|
|
31
|
+
ticker: "ETH",
|
|
32
|
+
balance: new BigNumber("5.10589"),
|
|
33
|
+
balanceUnit: mockBalanceUnit,
|
|
34
|
+
fiatValue: 13607.93,
|
|
35
|
+
address: "0x833...e33c7",
|
|
36
|
+
cryptoId: "ethereum",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "Ethereum 4",
|
|
40
|
+
id: "js:2:ethereum:0xDbD543b0e80e0E73FbD49FDEe902FC59652753B9:",
|
|
41
|
+
ticker: "ETH",
|
|
42
|
+
balance: new BigNumber("0.00148572"),
|
|
43
|
+
balanceUnit: mockBalanceUnit,
|
|
44
|
+
fiatValue: 3.96,
|
|
45
|
+
address: "0xDbD...753B9",
|
|
46
|
+
cryptoId: "ethereum",
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const expectedSortedAccounts = [
|
|
51
|
+
mockAccounts[2], // 13607.93
|
|
52
|
+
mockAccounts[0], // 4149.62
|
|
53
|
+
mockAccounts[1], // 475.47
|
|
54
|
+
mockAccounts[3], // 3.96
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
describe("sortAccountsByFiatValue", () => {
|
|
58
|
+
it("should sort accounts by fiat value in descending order", () => {
|
|
59
|
+
const sortedAccounts = sortAccountsByFiatValue(mockAccounts);
|
|
60
|
+
expect(sortedAccounts).toEqual(expectedSortedAccounts);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("should handle empty accounts array", () => {
|
|
64
|
+
const sortedAccounts = sortAccountsByFiatValue([]);
|
|
65
|
+
expect(sortedAccounts).toEqual([]);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("should handle accounts with identical fiat values", () => {
|
|
69
|
+
const identicalAccounts = [
|
|
70
|
+
{ ...mockAccounts[0], fiatValue: 1000 },
|
|
71
|
+
{ ...mockAccounts[1], fiatValue: 1000 },
|
|
72
|
+
];
|
|
73
|
+
const sortedAccounts = sortAccountsByFiatValue(identicalAccounts);
|
|
74
|
+
expect(sortedAccounts).toEqual(identicalAccounts);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("should handle accounts with zero fiat value", () => {
|
|
78
|
+
const zeroBalanceAccounts = [
|
|
79
|
+
{ ...mockAccounts[0], fiatValue: 0 },
|
|
80
|
+
{ ...mockAccounts[1], fiatValue: 10000 },
|
|
81
|
+
];
|
|
82
|
+
const sortedAccounts = sortAccountsByFiatValue(zeroBalanceAccounts);
|
|
83
|
+
expect(sortedAccounts).toEqual([zeroBalanceAccounts[1], zeroBalanceAccounts[0]]);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("should handle accounts with undefined fiat value", () => {
|
|
87
|
+
const undefinedFiatAccounts = [
|
|
88
|
+
{ ...mockAccounts[0], fiatValue: undefined as any },
|
|
89
|
+
{ ...mockAccounts[1], fiatValue: 5000 },
|
|
90
|
+
];
|
|
91
|
+
const sortedAccounts = sortAccountsByFiatValue(undefinedFiatAccounts);
|
|
92
|
+
expect(sortedAccounts).toEqual([undefinedFiatAccounts[1], undefinedFiatAccounts[0]]);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("should not mutate the original array", () => {
|
|
96
|
+
const originalAccounts = [...mockAccounts];
|
|
97
|
+
const sortedAccounts = sortAccountsByFiatValue(mockAccounts);
|
|
98
|
+
|
|
99
|
+
expect(mockAccounts).toEqual(originalAccounts);
|
|
100
|
+
expect(sortedAccounts).not.toBe(mockAccounts);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("should work with extended account types", () => {
|
|
104
|
+
interface ExtendedAccount extends BaseRawDetailedAccount {
|
|
105
|
+
customField: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const extendedAccounts: ExtendedAccount[] = [
|
|
109
|
+
{ ...mockAccounts[0], customField: "test1" },
|
|
110
|
+
{ ...mockAccounts[2], customField: "test2" },
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
const sortedAccounts = sortAccountsByFiatValue(extendedAccounts);
|
|
114
|
+
expect(sortedAccounts[0].customField).toBe("test2"); // Higher fiat value
|
|
115
|
+
expect(sortedAccounts[1].customField).toBe("test1"); // Lower fiat value
|
|
116
|
+
});
|
|
117
|
+
});
|
|
@@ -5,9 +5,9 @@ import { AccountLike } from "@ledgerhq/types-live";
|
|
|
5
5
|
import BigNumber from "bignumber.js";
|
|
6
6
|
import type { CounterValuesState } from "@ledgerhq/live-countervalues/types";
|
|
7
7
|
|
|
8
|
-
interface ExtendedAssetType extends AssetType {
|
|
9
|
-
currency
|
|
10
|
-
balance
|
|
8
|
+
export interface ExtendedAssetType extends AssetType {
|
|
9
|
+
currency: CryptoOrTokenCurrency;
|
|
10
|
+
balance: BigNumber;
|
|
11
11
|
fiatValue?: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -30,6 +30,9 @@ export const getBalanceAndFiatValueByAssets = (
|
|
|
30
30
|
id: asset.id,
|
|
31
31
|
name: asset.name,
|
|
32
32
|
ticker: asset.ticker,
|
|
33
|
+
currency: asset,
|
|
34
|
+
balance: new BigNumber(0),
|
|
35
|
+
fiatValue: 0,
|
|
33
36
|
};
|
|
34
37
|
});
|
|
35
38
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
2
2
|
export { groupCurrenciesByProvider } from "./groupCurrenciesByProvider";
|
|
3
|
+
export { sortAccountsByFiatValue } from "./sortAccountsByFiatValue";
|
|
3
4
|
|
|
4
5
|
function isCorrespondingCurrency(
|
|
5
6
|
elem: CryptoOrTokenCurrency,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseRawDetailedAccount } from "../types/detailedAccount";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sorts accounts by their fiat value in descending order
|
|
5
|
+
* @param accounts - List of accounts with fiat values to sort
|
|
6
|
+
* @returns Sorted list of accounts by fiat value balance in descending order
|
|
7
|
+
*/
|
|
8
|
+
export function sortAccountsByFiatValue<T extends BaseRawDetailedAccount>(accounts: T[]): T[] {
|
|
9
|
+
return [...accounts].sort((a, b) => {
|
|
10
|
+
const fiatValueA = a.fiatValue ?? 0;
|
|
11
|
+
const fiatValueB = b.fiatValue ?? 0;
|
|
12
|
+
return fiatValueB - fiatValueA;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -42,10 +42,10 @@ export type UseBalanceDeps = () => {
|
|
|
42
42
|
|
|
43
43
|
export type BalanceUI = {
|
|
44
44
|
// Raw values
|
|
45
|
-
balance
|
|
45
|
+
balance: BigNumber;
|
|
46
46
|
fiatValue?: number;
|
|
47
47
|
fiatUnit?: Unit;
|
|
48
|
-
currency
|
|
48
|
+
currency: CryptoOrTokenCurrency;
|
|
49
49
|
// Formatting parameters
|
|
50
50
|
locale?: string;
|
|
51
51
|
discreet?: boolean;
|
|
@@ -83,6 +83,7 @@ export type NetworkHookParams = {
|
|
|
83
83
|
networks: CryptoOrTokenCurrency[];
|
|
84
84
|
accounts$?: Observable<WalletAPIAccount[]>;
|
|
85
85
|
};
|
|
86
|
+
// Network hook type that returns currency properties spread at top level
|
|
86
87
|
export type NetworkHook = (
|
|
87
88
|
params: NetworkHookParams,
|
|
88
89
|
) => Array<CryptoOrTokenCurrency & Network & { balanceData?: BalanceUI; count?: number }>;
|
|
@@ -263,9 +263,9 @@
|
|
|
263
263
|
{
|
|
264
264
|
"id": "1inch",
|
|
265
265
|
"name": "1inch",
|
|
266
|
-
"url": "https://dapp-browser.apps.ledger.com/?params=%7B%22dappUrl%22%3A%22https%3A%2F%
|
|
266
|
+
"url": "https://dapp-browser.apps.ledger.com/?params=%7B%22dappUrl%22%3A%22https%3A%2F%2F1inch.com%2Fswap%2F%22%2C%22nanoApp%22%3A%221inch%22%2C%22dappName%22%3A%221inch%22%2C%22networks%22%3A%5B%7B%22currency%22%3A%22ethereum%22%2C%22chainID%22%3A1%2C%22nodeURL%22%3A%22wss%3A%2F%2Feth-mainnet.ws.alchemyapi.io%2Fv2%2F0fyudoTG94QWC0tEtfJViM9v2ZXJuij2%22%7D%2C%7B%22currency%22%3A%22bsc%22%2C%22chainID%22%3A56%2C%22nodeURL%22%3A%22https%3A%2F%2Fbsc-dataseed.binance.org%2F%22%7D%2C%7B%22currency%22%3A%22polygon%22%2C%22chainID%22%3A137%2C%22nodeURL%22%3A%22https%3A%2F%2Fpolygon-mainnet.g.alchemy.com%2Fv2%2FoPIxZM7kXsPVVY1Sk0kOQwkoIOpSu8PE%22%7D%5D%7D",
|
|
267
267
|
"params": {
|
|
268
|
-
"dappUrl": "https://
|
|
268
|
+
"dappUrl": "https://1inch.com/swap/",
|
|
269
269
|
"nanoApp": "1inch",
|
|
270
270
|
"dappName": "1inch",
|
|
271
271
|
"networks": [
|
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
}
|
|
287
287
|
]
|
|
288
288
|
},
|
|
289
|
-
"homepageUrl": "https://1inch.
|
|
289
|
+
"homepageUrl": "https://1inch.com/",
|
|
290
290
|
"icon": "https://cdn.live.ledger.com/icons/platform/1inch.png",
|
|
291
291
|
"platforms": ["ios", "android", "desktop"],
|
|
292
292
|
"apiVersion": "^1.0.0 || ~0.0.1",
|
package/src/wallet-api/logic.ts
CHANGED
|
@@ -139,6 +139,41 @@ export function signTransactionLogic(
|
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
export function signRawTransactionLogic(
|
|
143
|
+
{ manifest, accounts, tracking }: WalletAPIContext,
|
|
144
|
+
walletAccountId: string,
|
|
145
|
+
transaction: string,
|
|
146
|
+
uiNavigation: (
|
|
147
|
+
account: AccountLike,
|
|
148
|
+
parentAccount: Account | undefined,
|
|
149
|
+
transaction: string,
|
|
150
|
+
) => Promise<SignedOperation>,
|
|
151
|
+
): Promise<SignedOperation> {
|
|
152
|
+
tracking.signRawTransactionRequested(manifest);
|
|
153
|
+
|
|
154
|
+
if (!transaction) {
|
|
155
|
+
tracking.signRawTransactionFail(manifest);
|
|
156
|
+
return Promise.reject(new Error("Transaction required"));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const accountId = getAccountIdFromWalletAccountId(walletAccountId);
|
|
160
|
+
if (!accountId) {
|
|
161
|
+
tracking.signRawTransactionFail(manifest);
|
|
162
|
+
return Promise.reject(new Error(`accountId ${walletAccountId} unknown`));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const account = accounts.find(account => account.id === accountId);
|
|
166
|
+
|
|
167
|
+
if (!account) {
|
|
168
|
+
tracking.signRawTransactionFail(manifest);
|
|
169
|
+
return Promise.reject(new Error("Account required"));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const parentAccount = getParentAccount(account, accounts);
|
|
173
|
+
|
|
174
|
+
return uiNavigation(account, parentAccount, transaction);
|
|
175
|
+
}
|
|
176
|
+
|
|
142
177
|
export function broadcastTransactionLogic(
|
|
143
178
|
{ manifest, accounts, tracking }: WalletAPIContext,
|
|
144
179
|
walletAccountId: string,
|
package/src/wallet-api/react.ts
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
signTransactionLogic,
|
|
38
38
|
bitcoinFamilyAccountGetAddressLogic,
|
|
39
39
|
bitcoinFamilyAccountGetPublicKeyLogic,
|
|
40
|
+
signRawTransactionLogic,
|
|
40
41
|
} from "./logic";
|
|
41
42
|
import { getAccountBridge } from "../bridge";
|
|
42
43
|
import { getEnv } from "@ledgerhq/live-env";
|
|
@@ -154,6 +155,14 @@ export interface UiHook {
|
|
|
154
155
|
}) => void;
|
|
155
156
|
"storage.get": WalletHandlers["storage.get"];
|
|
156
157
|
"storage.set": WalletHandlers["storage.set"];
|
|
158
|
+
"transaction.signRaw": (params: {
|
|
159
|
+
account: AccountLike;
|
|
160
|
+
parentAccount: Account | undefined;
|
|
161
|
+
transaction: string;
|
|
162
|
+
options: Parameters<WalletHandlers["transaction.sign"]>[0]["options"];
|
|
163
|
+
onSuccess: (signedOperation: SignedOperation) => void;
|
|
164
|
+
onError: (error: Error) => void;
|
|
165
|
+
}) => void;
|
|
157
166
|
"transaction.sign": (params: {
|
|
158
167
|
account: AccountLike;
|
|
159
168
|
parentAccount: Account | undefined;
|
|
@@ -320,6 +329,7 @@ export function useWalletAPIServer({
|
|
|
320
329
|
"storage.get": uiStorageGet,
|
|
321
330
|
"storage.set": uiStorageSet,
|
|
322
331
|
"transaction.sign": uiTxSign,
|
|
332
|
+
"transaction.signRaw": uiTxSignRaw,
|
|
323
333
|
"transaction.broadcast": uiTxBroadcast,
|
|
324
334
|
"device.transport": uiDeviceTransport,
|
|
325
335
|
"device.select": uiDeviceSelect,
|
|
@@ -536,6 +546,82 @@ export function useWalletAPIServer({
|
|
|
536
546
|
);
|
|
537
547
|
}, [accounts, manifest, server, tracking, uiTxSign]);
|
|
538
548
|
|
|
549
|
+
useEffect(() => {
|
|
550
|
+
if (!uiTxSignRaw) return;
|
|
551
|
+
|
|
552
|
+
server.setHandler(
|
|
553
|
+
"transaction.signRaw",
|
|
554
|
+
async ({ account, transaction, broadcast, options }) => {
|
|
555
|
+
const signedOperation = await signRawTransactionLogic(
|
|
556
|
+
{ manifest, accounts, tracking },
|
|
557
|
+
account.id,
|
|
558
|
+
transaction,
|
|
559
|
+
(account, parentAccount, tx) =>
|
|
560
|
+
new Promise((resolve, reject) => {
|
|
561
|
+
let done = false;
|
|
562
|
+
return uiTxSignRaw({
|
|
563
|
+
account,
|
|
564
|
+
parentAccount,
|
|
565
|
+
transaction: tx,
|
|
566
|
+
options,
|
|
567
|
+
onSuccess: signedOperation => {
|
|
568
|
+
if (done) return;
|
|
569
|
+
done = true;
|
|
570
|
+
tracking.signRawTransactionSuccess(manifest);
|
|
571
|
+
resolve(signedOperation);
|
|
572
|
+
},
|
|
573
|
+
onError: error => {
|
|
574
|
+
if (done) return;
|
|
575
|
+
done = true;
|
|
576
|
+
tracking.signRawTransactionFail(manifest);
|
|
577
|
+
reject(error);
|
|
578
|
+
},
|
|
579
|
+
});
|
|
580
|
+
}),
|
|
581
|
+
);
|
|
582
|
+
|
|
583
|
+
let hash: string | undefined;
|
|
584
|
+
if (broadcast) {
|
|
585
|
+
hash = await broadcastTransactionLogic(
|
|
586
|
+
{ manifest, accounts, tracking },
|
|
587
|
+
account.id,
|
|
588
|
+
signedOperation,
|
|
589
|
+
async (account, parentAccount, signedOperation) => {
|
|
590
|
+
const bridge = getAccountBridge(account, parentAccount);
|
|
591
|
+
const mainAccount = getMainAccount(account, parentAccount);
|
|
592
|
+
|
|
593
|
+
let optimisticOperation: Operation = signedOperation.operation;
|
|
594
|
+
|
|
595
|
+
if (!getEnv("DISABLE_TRANSACTION_BROADCAST")) {
|
|
596
|
+
try {
|
|
597
|
+
optimisticOperation = await bridge.broadcast({
|
|
598
|
+
account: mainAccount,
|
|
599
|
+
signedOperation,
|
|
600
|
+
broadcastConfig: { mevProtected: !!config.mevProtected },
|
|
601
|
+
});
|
|
602
|
+
tracking.broadcastSuccess(manifest);
|
|
603
|
+
} catch (error) {
|
|
604
|
+
tracking.broadcastFail(manifest);
|
|
605
|
+
throw error;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
uiTxBroadcast &&
|
|
610
|
+
uiTxBroadcast(account, parentAccount, mainAccount, optimisticOperation);
|
|
611
|
+
|
|
612
|
+
return optimisticOperation.hash;
|
|
613
|
+
},
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
return {
|
|
618
|
+
signedTransactionHex: signedOperation.signature,
|
|
619
|
+
transactionHash: hash,
|
|
620
|
+
};
|
|
621
|
+
},
|
|
622
|
+
);
|
|
623
|
+
}, [accounts, config.mevProtected, manifest, server, tracking, uiTxBroadcast, uiTxSignRaw]);
|
|
624
|
+
|
|
539
625
|
useEffect(() => {
|
|
540
626
|
if (!uiTxSign) return;
|
|
541
627
|
|
|
@@ -604,7 +690,7 @@ export function useWalletAPIServer({
|
|
|
604
690
|
);
|
|
605
691
|
},
|
|
606
692
|
);
|
|
607
|
-
}, [accounts, manifest, server, tracking, uiTxBroadcast, uiTxSign]);
|
|
693
|
+
}, [accounts, config.mevProtected, manifest, server, tracking, uiTxBroadcast, uiTxSign]);
|
|
608
694
|
|
|
609
695
|
const onLoad = useCallback(() => {
|
|
610
696
|
tracking.loadSuccess(manifest);
|
|
@@ -70,6 +70,21 @@ export default function trackingWrapper(trackCall: TrackWalletAPI) {
|
|
|
70
70
|
track("WalletAPI SignTransaction Success", getEventData(manifest));
|
|
71
71
|
},
|
|
72
72
|
|
|
73
|
+
// Sign Raw transaction modal open
|
|
74
|
+
signRawTransactionRequested: (manifest: AppManifest) => {
|
|
75
|
+
track("WalletAPI SignRawTransaction", getEventData(manifest));
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// Failed to sign raw transaction (cancel or error)
|
|
79
|
+
signRawTransactionFail: (manifest: AppManifest) => {
|
|
80
|
+
track("WalletAPI SignRawTransaction Fail", getEventData(manifest));
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
// Successfully signed raw transaction
|
|
84
|
+
signRawTransactionSuccess: (manifest: AppManifest) => {
|
|
85
|
+
track("WalletAPI SignRawTransaction Success", getEventData(manifest));
|
|
86
|
+
},
|
|
87
|
+
|
|
73
88
|
// Select account modal open
|
|
74
89
|
requestAccountRequested: (manifest: AppManifest) => {
|
|
75
90
|
track("WalletAPI RequestAccount", getEventData(manifest));
|
|
@@ -8,7 +8,7 @@ import { getAccountBridge } from "../bridge";
|
|
|
8
8
|
import { getEnv } from "@ledgerhq/live-env";
|
|
9
9
|
import network from "@ledgerhq/live-network/network";
|
|
10
10
|
import { getWalletAPITransactionSignFlowInfos } from "./converters";
|
|
11
|
-
import {
|
|
11
|
+
import { findTokenByAddressInCurrency, getCryptoCurrencyById } from "@ledgerhq/cryptoassets/index";
|
|
12
12
|
import { prepareMessageToSign } from "../hw/signMessage/index";
|
|
13
13
|
import { CurrentAccountHistDB, UiHook, usePermission } from "./react";
|
|
14
14
|
import BigNumber from "bignumber.js";
|
|
@@ -482,8 +482,6 @@ export function useDappLogic({
|
|
|
482
482
|
|
|
483
483
|
const transactionType = getTxType(signFlowInfos.liveTx as EvmTransaction);
|
|
484
484
|
|
|
485
|
-
const token = findTokenByAddress(tx.recipient);
|
|
486
|
-
|
|
487
485
|
const accountCurrencyName =
|
|
488
486
|
currentAccount.type === "TokenAccount"
|
|
489
487
|
? currentAccount.token.name
|
|
@@ -494,6 +492,8 @@ export function useDappLogic({
|
|
|
494
492
|
? currentAccount.token.parentCurrency.id
|
|
495
493
|
: currentAccount.currency.id;
|
|
496
494
|
|
|
495
|
+
const token = findTokenByAddressInCurrency(tx.recipient, accountNetwork);
|
|
496
|
+
|
|
497
497
|
trackingData = {
|
|
498
498
|
type: transactionType,
|
|
499
499
|
currency: token ? token.name : accountCurrencyName,
|