@ledgerhq/live-common 34.53.0-nightly.20251120023735 → 34.53.0
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/__tests__/test-helpers/bridge.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/bridge.js +4 -0
- package/lib/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib/__tests__/test-helpers/environment.js +0 -3
- package/lib/__tests__/test-helpers/environment.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +10 -12
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/currencies/helpers.d.ts +3 -1
- package/lib/currencies/helpers.d.ts.map +1 -1
- package/lib/currencies/helpers.js +27 -1
- package/lib/currencies/helpers.js.map +1 -1
- package/lib/dada-client/hooks/useAssetsData.d.ts +0 -1
- package/lib/dada-client/hooks/useAssetsData.d.ts.map +1 -1
- package/lib/dada-client/hooks/useAssetsData.js +0 -1
- package/lib/dada-client/hooks/useAssetsData.js.map +1 -1
- package/lib/deposit/helper.d.ts +8 -0
- package/lib/deposit/helper.d.ts.map +1 -0
- package/lib/deposit/helper.js +125 -0
- package/lib/deposit/helper.js.map +1 -0
- package/lib/deposit/index.d.ts +3 -0
- package/lib/deposit/index.d.ts.map +1 -0
- package/lib/deposit/index.js +6 -0
- package/lib/deposit/index.js.map +1 -0
- package/lib/deposit/mock.d.ts +75 -0
- package/lib/deposit/mock.d.ts.map +1 -0
- package/lib/deposit/mock.js +15111 -0
- package/lib/deposit/mock.js.map +1 -0
- package/lib/deposit/type.d.ts +17 -0
- package/lib/deposit/type.d.ts.map +1 -1
- package/lib/deposit/type.js.map +1 -1
- package/lib/deposit/useGroupedCurrenciesByProvider.hook.d.ts +3 -0
- package/lib/deposit/useGroupedCurrenciesByProvider.hook.d.ts.map +1 -0
- package/lib/deposit/useGroupedCurrenciesByProvider.hook.js +40 -0
- package/lib/deposit/useGroupedCurrenciesByProvider.hook.js.map +1 -0
- package/lib/deviceSDK/hooks/useBatteryStatuses.d.ts +1 -2
- package/lib/deviceSDK/hooks/useBatteryStatuses.d.ts.map +1 -1
- package/lib/deviceSDK/hooks/useBatteryStatuses.js +2 -4
- package/lib/deviceSDK/hooks/useBatteryStatuses.js.map +1 -1
- package/lib/deviceSDK/tasks/core.d.ts +1 -1
- package/lib/deviceSDK/tasks/core.d.ts.map +1 -1
- package/lib/deviceSDK/tasks/core.js +1 -1
- package/lib/deviceSDK/tasks/core.js.map +1 -1
- package/lib/deviceSDK/tasks/getDeviceInfo.d.ts.map +1 -1
- package/lib/deviceSDK/tasks/getDeviceInfo.js +0 -2
- package/lib/deviceSDK/tasks/getDeviceInfo.js.map +1 -1
- package/lib/deviceSDK/tasks/getLatestFirmware.d.ts.map +1 -1
- package/lib/deviceSDK/tasks/getLatestFirmware.js +2 -2
- package/lib/deviceSDK/tasks/getLatestFirmware.js.map +1 -1
- package/lib/deviceSDK/tasks/updateFirmware.d.ts.map +1 -1
- package/lib/deviceSDK/tasks/updateFirmware.js +0 -1
- package/lib/deviceSDK/tasks/updateFirmware.js.map +1 -1
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts +3 -0
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts.map +1 -0
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.js +26 -0
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.js.map +1 -0
- package/lib/e2e/enum/Account.d.ts +1 -0
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +1 -0
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +1 -0
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +6 -2
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/families/algorand.d.ts +1 -1
- package/lib/e2e/families/algorand.d.ts.map +1 -1
- package/lib/e2e/families/algorand.js +5 -5
- package/lib/e2e/families/algorand.js.map +1 -1
- package/lib/e2e/families/aptos.d.ts +2 -2
- package/lib/e2e/families/aptos.d.ts.map +1 -1
- package/lib/e2e/families/aptos.js +9 -9
- package/lib/e2e/families/aptos.js.map +1 -1
- package/lib/e2e/families/bitcoin.d.ts +2 -2
- package/lib/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib/e2e/families/bitcoin.js +11 -11
- package/lib/e2e/families/bitcoin.js.map +1 -1
- package/lib/e2e/families/cardano.d.ts +0 -6
- package/lib/e2e/families/cardano.d.ts.map +1 -1
- package/lib/e2e/families/cardano.js +26 -28
- package/lib/e2e/families/cardano.js.map +1 -1
- package/lib/e2e/families/celo.d.ts +1 -1
- package/lib/e2e/families/celo.d.ts.map +1 -1
- package/lib/e2e/families/celo.js +5 -5
- package/lib/e2e/families/celo.js.map +1 -1
- package/lib/e2e/families/cosmos.d.ts +2 -2
- package/lib/e2e/families/cosmos.d.ts.map +1 -1
- package/lib/e2e/families/cosmos.js +9 -9
- package/lib/e2e/families/cosmos.js.map +1 -1
- package/lib/e2e/families/evm.d.ts +0 -2
- package/lib/e2e/families/evm.d.ts.map +1 -1
- package/lib/e2e/families/evm.js +12 -13
- package/lib/e2e/families/evm.js.map +1 -1
- package/lib/e2e/families/hedera.d.ts +1 -1
- package/lib/e2e/families/hedera.d.ts.map +1 -1
- package/lib/e2e/families/hedera.js +5 -5
- package/lib/e2e/families/hedera.js.map +1 -1
- package/lib/e2e/families/kaspa.d.ts +2 -2
- package/lib/e2e/families/kaspa.d.ts.map +1 -1
- package/lib/e2e/families/kaspa.js +9 -9
- package/lib/e2e/families/kaspa.js.map +1 -1
- package/lib/e2e/families/multiversX.d.ts +1 -1
- package/lib/e2e/families/multiversX.d.ts.map +1 -1
- package/lib/e2e/families/multiversX.js +5 -5
- package/lib/e2e/families/multiversX.js.map +1 -1
- package/lib/e2e/families/near.d.ts +1 -1
- package/lib/e2e/families/near.d.ts.map +1 -1
- package/lib/e2e/families/near.js +6 -6
- package/lib/e2e/families/near.js.map +1 -1
- package/lib/e2e/families/osmosis.d.ts +1 -1
- package/lib/e2e/families/osmosis.d.ts.map +1 -1
- package/lib/e2e/families/osmosis.js +5 -5
- package/lib/e2e/families/osmosis.js.map +1 -1
- package/lib/e2e/families/polkadot.d.ts +1 -1
- package/lib/e2e/families/polkadot.d.ts.map +1 -1
- package/lib/e2e/families/polkadot.js +5 -5
- package/lib/e2e/families/polkadot.js.map +1 -1
- package/lib/e2e/families/solana.d.ts +2 -2
- package/lib/e2e/families/solana.d.ts.map +1 -1
- package/lib/e2e/families/solana.js +9 -9
- package/lib/e2e/families/solana.js.map +1 -1
- package/lib/e2e/families/stellar.d.ts +1 -1
- package/lib/e2e/families/stellar.d.ts.map +1 -1
- package/lib/e2e/families/stellar.js +5 -5
- package/lib/e2e/families/stellar.js.map +1 -1
- package/lib/e2e/families/sui.d.ts +1 -1
- package/lib/e2e/families/sui.d.ts.map +1 -1
- package/lib/e2e/families/sui.js +5 -5
- package/lib/e2e/families/sui.js.map +1 -1
- package/lib/e2e/families/tezos.d.ts +1 -1
- package/lib/e2e/families/tezos.d.ts.map +1 -1
- package/lib/e2e/families/tezos.js +8 -7
- package/lib/e2e/families/tezos.js.map +1 -1
- package/lib/e2e/families/tron.d.ts +1 -1
- package/lib/e2e/families/tron.d.ts.map +1 -1
- package/lib/e2e/families/tron.js +5 -5
- package/lib/e2e/families/tron.js.map +1 -1
- package/lib/e2e/families/xrp.d.ts +1 -1
- package/lib/e2e/families/xrp.d.ts.map +1 -1
- package/lib/e2e/families/xrp.js +5 -5
- package/lib/e2e/families/xrp.js.map +1 -1
- package/lib/e2e/index.d.ts +0 -15
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts +11 -11
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +78 -78
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/providers/swap.d.ts +0 -1
- package/lib/exchange/providers/swap.d.ts.map +1 -1
- package/lib/exchange/providers/swap.js +1 -5
- package/lib/exchange/providers/swap.js.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyAll.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyAll.js +3 -2
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyAll.js.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFilteredProviders.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFilteredProviders.js +10 -15
- package/lib/exchange/swap/hooks/v5/useFilteredProviders.js.map +1 -1
- package/lib/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib/families/canton/bridge/mock.js +0 -1
- package/lib/families/canton/bridge/mock.js.map +1 -1
- package/lib/families/evm/config.d.ts.map +1 -1
- package/lib/families/evm/config.js +0 -49
- package/lib/families/evm/config.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts +0 -3
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +0 -6
- 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/market/hooks/useMarketDataProvider.js +0 -1
- package/lib/market/hooks/useMarketDataProvider.js.map +1 -1
- package/lib/market/utils/types.d.ts +0 -1
- package/lib/market/utils/types.d.ts.map +1 -1
- package/lib/market/utils/types.js.map +1 -1
- package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts +22 -0
- package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts.map +1 -0
- package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js +41 -0
- package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js.map +1 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +0 -11
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib/modularDrawer/hooks/useNetworkAccountCounts.d.ts +5 -1
- package/lib/modularDrawer/hooks/useNetworkAccountCounts.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useNetworkAccountCounts.js +2 -2
- package/lib/modularDrawer/hooks/useNetworkAccountCounts.js.map +1 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.js +2 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- package/lib/modularDrawer/utils/currencyUtils.d.ts +10 -0
- package/lib/modularDrawer/utils/currencyUtils.d.ts.map +1 -0
- package/lib/modularDrawer/utils/currencyUtils.js +74 -0
- package/lib/modularDrawer/utils/currencyUtils.js.map +1 -0
- package/lib/modularDrawer/utils/{groupCurrenciesByAsset.d.ts → groupCurrenciesByProvider.d.ts} +2 -2
- package/lib/modularDrawer/utils/groupCurrenciesByProvider.d.ts.map +1 -0
- package/lib/modularDrawer/utils/groupCurrenciesByProvider.js +21 -0
- package/lib/modularDrawer/utils/groupCurrenciesByProvider.js.map +1 -0
- package/lib/modularDrawer/utils/index.d.ts +1 -1
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +3 -3
- package/lib/modularDrawer/utils/index.js.map +1 -1
- package/lib/modularDrawer/utils/type.d.ts +5 -0
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib/platform/filters.d.ts +2 -1
- package/lib/platform/filters.d.ts.map +1 -1
- package/lib/platform/filters.js +17 -1
- package/lib/platform/filters.js.map +1 -1
- package/lib/platform/helpers.d.ts +5 -1
- package/lib/platform/helpers.d.ts.map +1 -1
- package/lib/platform/helpers.js +33 -1
- package/lib/platform/helpers.js.map +1 -1
- package/lib/platform/react.d.ts +3 -2
- package/lib/platform/react.d.ts.map +1 -1
- package/lib/platform/react.js +16 -66
- package/lib/platform/react.js.map +1 -1
- package/lib/platform/types.d.ts +3 -3
- package/lib/platform/types.d.ts.map +1 -1
- package/lib/postOnboarding/reducer.d.ts +0 -2
- package/lib/postOnboarding/reducer.d.ts.map +1 -1
- package/lib/utils/getAccountTuplesForCurrency.d.ts +1 -1
- package/lib/utils/getAccountTuplesForCurrency.d.ts.map +1 -1
- package/lib/utils/getAccountTuplesForCurrency.js +3 -2
- package/lib/utils/getAccountTuplesForCurrency.js.map +1 -1
- package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib/wallet-api/Exchange/server.js +4 -5
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib/wallet-api/converters.d.ts +0 -1
- package/lib/wallet-api/converters.d.ts.map +1 -1
- package/lib/wallet-api/converters.js +2 -7
- package/lib/wallet-api/converters.js.map +1 -1
- package/lib/wallet-api/react.d.ts +11 -6
- package/lib/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +135 -293
- package/lib/wallet-api/react.js.map +1 -1
- package/lib/wallet-api/tracking.d.ts +0 -6
- package/lib/wallet-api/tracking.d.ts.map +1 -1
- package/lib/wallet-api/tracking.js +0 -20
- package/lib/wallet-api/tracking.js.map +1 -1
- package/lib/wallet-api/types.d.ts +0 -3
- package/lib/wallet-api/types.d.ts.map +1 -1
- package/lib/wallet-api/useDappLogic.d.ts.map +1 -1
- package/lib/wallet-api/useDappLogic.js +80 -65
- package/lib/wallet-api/useDappLogic.js.map +1 -1
- package/lib/wallet-api/utils/deriveAccountIdForManifest.d.ts +0 -6
- package/lib/wallet-api/utils/deriveAccountIdForManifest.d.ts.map +1 -1
- package/lib/wallet-api/utils/deriveAccountIdForManifest.js +3 -13
- package/lib/wallet-api/utils/deriveAccountIdForManifest.js.map +1 -1
- package/lib-es/__tests__/test-helpers/bridge.d.ts.map +1 -1
- package/lib-es/__tests__/test-helpers/bridge.js +4 -0
- package/lib-es/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib-es/__tests__/test-helpers/environment.js +0 -3
- package/lib-es/__tests__/test-helpers/environment.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +11 -13
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/currencies/helpers.d.ts +3 -1
- package/lib-es/currencies/helpers.d.ts.map +1 -1
- package/lib-es/currencies/helpers.js +24 -0
- package/lib-es/currencies/helpers.js.map +1 -1
- package/lib-es/dada-client/hooks/useAssetsData.d.ts +0 -1
- package/lib-es/dada-client/hooks/useAssetsData.d.ts.map +1 -1
- package/lib-es/dada-client/hooks/useAssetsData.js +0 -1
- package/lib-es/dada-client/hooks/useAssetsData.js.map +1 -1
- package/lib-es/deposit/helper.d.ts +8 -0
- package/lib-es/deposit/helper.d.ts.map +1 -0
- package/lib-es/deposit/helper.js +117 -0
- package/lib-es/deposit/helper.js.map +1 -0
- package/lib-es/deposit/index.d.ts +3 -0
- package/lib-es/deposit/index.d.ts.map +1 -0
- package/lib-es/deposit/index.js +3 -0
- package/lib-es/deposit/index.js.map +1 -0
- package/lib-es/deposit/mock.d.ts +75 -0
- package/lib-es/deposit/mock.d.ts.map +1 -0
- package/lib-es/deposit/mock.js +15108 -0
- package/lib-es/deposit/mock.js.map +1 -0
- package/lib-es/deposit/type.d.ts +17 -0
- package/lib-es/deposit/type.d.ts.map +1 -1
- package/lib-es/deposit/type.js.map +1 -1
- package/lib-es/deposit/useGroupedCurrenciesByProvider.hook.d.ts +3 -0
- package/lib-es/deposit/useGroupedCurrenciesByProvider.hook.d.ts.map +1 -0
- package/lib-es/deposit/useGroupedCurrenciesByProvider.hook.js +36 -0
- package/lib-es/deposit/useGroupedCurrenciesByProvider.hook.js.map +1 -0
- package/lib-es/deviceSDK/hooks/useBatteryStatuses.d.ts +1 -2
- package/lib-es/deviceSDK/hooks/useBatteryStatuses.d.ts.map +1 -1
- package/lib-es/deviceSDK/hooks/useBatteryStatuses.js +2 -4
- package/lib-es/deviceSDK/hooks/useBatteryStatuses.js.map +1 -1
- package/lib-es/deviceSDK/tasks/core.d.ts +1 -1
- package/lib-es/deviceSDK/tasks/core.d.ts.map +1 -1
- package/lib-es/deviceSDK/tasks/core.js +1 -1
- package/lib-es/deviceSDK/tasks/core.js.map +1 -1
- package/lib-es/deviceSDK/tasks/getDeviceInfo.d.ts.map +1 -1
- package/lib-es/deviceSDK/tasks/getDeviceInfo.js +0 -2
- package/lib-es/deviceSDK/tasks/getDeviceInfo.js.map +1 -1
- package/lib-es/deviceSDK/tasks/getLatestFirmware.d.ts.map +1 -1
- package/lib-es/deviceSDK/tasks/getLatestFirmware.js +2 -2
- package/lib-es/deviceSDK/tasks/getLatestFirmware.js.map +1 -1
- package/lib-es/deviceSDK/tasks/updateFirmware.d.ts.map +1 -1
- package/lib-es/deviceSDK/tasks/updateFirmware.js +1 -2
- package/lib-es/deviceSDK/tasks/updateFirmware.js.map +1 -1
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts +3 -0
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts.map +1 -0
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.js +18 -0
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.js.map +1 -0
- package/lib-es/e2e/enum/Account.d.ts +1 -0
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +1 -0
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +1 -0
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +6 -2
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/families/algorand.d.ts +1 -1
- package/lib-es/e2e/families/algorand.d.ts.map +1 -1
- package/lib-es/e2e/families/algorand.js +4 -5
- package/lib-es/e2e/families/algorand.js.map +1 -1
- package/lib-es/e2e/families/aptos.d.ts +2 -2
- package/lib-es/e2e/families/aptos.d.ts.map +1 -1
- package/lib-es/e2e/families/aptos.js +7 -9
- package/lib-es/e2e/families/aptos.js.map +1 -1
- package/lib-es/e2e/families/bitcoin.d.ts +2 -2
- package/lib-es/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib-es/e2e/families/bitcoin.js +9 -11
- package/lib-es/e2e/families/bitcoin.js.map +1 -1
- package/lib-es/e2e/families/cardano.d.ts +0 -6
- package/lib-es/e2e/families/cardano.d.ts.map +1 -1
- package/lib-es/e2e/families/cardano.js +21 -23
- package/lib-es/e2e/families/cardano.js.map +1 -1
- package/lib-es/e2e/families/celo.d.ts +1 -1
- package/lib-es/e2e/families/celo.d.ts.map +1 -1
- package/lib-es/e2e/families/celo.js +4 -5
- package/lib-es/e2e/families/celo.js.map +1 -1
- package/lib-es/e2e/families/cosmos.d.ts +2 -2
- package/lib-es/e2e/families/cosmos.d.ts.map +1 -1
- package/lib-es/e2e/families/cosmos.js +7 -9
- package/lib-es/e2e/families/cosmos.js.map +1 -1
- package/lib-es/e2e/families/evm.d.ts +0 -2
- package/lib-es/e2e/families/evm.d.ts.map +1 -1
- package/lib-es/e2e/families/evm.js +9 -10
- package/lib-es/e2e/families/evm.js.map +1 -1
- package/lib-es/e2e/families/hedera.d.ts +1 -1
- package/lib-es/e2e/families/hedera.d.ts.map +1 -1
- package/lib-es/e2e/families/hedera.js +4 -5
- package/lib-es/e2e/families/hedera.js.map +1 -1
- package/lib-es/e2e/families/kaspa.d.ts +2 -2
- package/lib-es/e2e/families/kaspa.d.ts.map +1 -1
- package/lib-es/e2e/families/kaspa.js +7 -9
- package/lib-es/e2e/families/kaspa.js.map +1 -1
- package/lib-es/e2e/families/multiversX.d.ts +1 -1
- package/lib-es/e2e/families/multiversX.d.ts.map +1 -1
- package/lib-es/e2e/families/multiversX.js +4 -5
- package/lib-es/e2e/families/multiversX.js.map +1 -1
- package/lib-es/e2e/families/near.d.ts +1 -1
- package/lib-es/e2e/families/near.d.ts.map +1 -1
- package/lib-es/e2e/families/near.js +5 -6
- package/lib-es/e2e/families/near.js.map +1 -1
- package/lib-es/e2e/families/osmosis.d.ts +1 -1
- package/lib-es/e2e/families/osmosis.d.ts.map +1 -1
- package/lib-es/e2e/families/osmosis.js +4 -5
- package/lib-es/e2e/families/osmosis.js.map +1 -1
- package/lib-es/e2e/families/polkadot.d.ts +1 -1
- package/lib-es/e2e/families/polkadot.d.ts.map +1 -1
- package/lib-es/e2e/families/polkadot.js +4 -5
- package/lib-es/e2e/families/polkadot.js.map +1 -1
- package/lib-es/e2e/families/solana.d.ts +2 -2
- package/lib-es/e2e/families/solana.d.ts.map +1 -1
- package/lib-es/e2e/families/solana.js +7 -9
- package/lib-es/e2e/families/solana.js.map +1 -1
- package/lib-es/e2e/families/stellar.d.ts +1 -1
- package/lib-es/e2e/families/stellar.d.ts.map +1 -1
- package/lib-es/e2e/families/stellar.js +4 -5
- package/lib-es/e2e/families/stellar.js.map +1 -1
- package/lib-es/e2e/families/sui.d.ts +1 -1
- package/lib-es/e2e/families/sui.d.ts.map +1 -1
- package/lib-es/e2e/families/sui.js +4 -5
- package/lib-es/e2e/families/sui.js.map +1 -1
- package/lib-es/e2e/families/tezos.d.ts +1 -1
- package/lib-es/e2e/families/tezos.d.ts.map +1 -1
- package/lib-es/e2e/families/tezos.js +8 -8
- package/lib-es/e2e/families/tezos.js.map +1 -1
- package/lib-es/e2e/families/tron.d.ts +1 -1
- package/lib-es/e2e/families/tron.d.ts.map +1 -1
- package/lib-es/e2e/families/tron.js +4 -5
- package/lib-es/e2e/families/tron.js.map +1 -1
- package/lib-es/e2e/families/xrp.d.ts +1 -1
- package/lib-es/e2e/families/xrp.d.ts.map +1 -1
- package/lib-es/e2e/families/xrp.js +4 -5
- package/lib-es/e2e/families/xrp.js.map +1 -1
- package/lib-es/e2e/index.d.ts +0 -15
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts +11 -11
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +43 -54
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/providers/swap.d.ts +0 -1
- package/lib-es/exchange/providers/swap.d.ts.map +1 -1
- package/lib-es/exchange/providers/swap.js +0 -3
- package/lib-es/exchange/providers/swap.js.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyAll.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyAll.js +3 -2
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyAll.js.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFilteredProviders.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFilteredProviders.js +12 -17
- package/lib-es/exchange/swap/hooks/v5/useFilteredProviders.js.map +1 -1
- package/lib-es/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/canton/bridge/mock.js +0 -1
- package/lib-es/families/canton/bridge/mock.js.map +1 -1
- package/lib-es/families/evm/config.d.ts.map +1 -1
- package/lib-es/families/evm/config.js +0 -49
- package/lib-es/families/evm/config.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts +0 -3
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +0 -6
- 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/market/hooks/useMarketDataProvider.js +0 -1
- package/lib-es/market/hooks/useMarketDataProvider.js.map +1 -1
- package/lib-es/market/utils/types.d.ts +0 -1
- package/lib-es/market/utils/types.d.ts.map +1 -1
- package/lib-es/market/utils/types.js.map +1 -1
- package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts +22 -0
- package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts.map +1 -0
- package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js +38 -0
- package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +0 -11
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.d.ts +5 -1
- package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.js +2 -2
- package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.js.map +1 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js +2 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- package/lib-es/modularDrawer/utils/currencyUtils.d.ts +10 -0
- package/lib-es/modularDrawer/utils/currencyUtils.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/currencyUtils.js +65 -0
- package/lib-es/modularDrawer/utils/currencyUtils.js.map +1 -0
- package/lib-es/modularDrawer/utils/{groupCurrenciesByAsset.d.ts → groupCurrenciesByProvider.d.ts} +2 -2
- package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/{groupCurrenciesByAsset.js → groupCurrenciesByProvider.js} +6 -6
- package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.js.map +1 -0
- package/lib-es/modularDrawer/utils/index.d.ts +1 -1
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +1 -1
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/modularDrawer/utils/type.d.ts +5 -0
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib-es/platform/filters.d.ts +2 -1
- package/lib-es/platform/filters.d.ts.map +1 -1
- package/lib-es/platform/filters.js +15 -0
- package/lib-es/platform/filters.js.map +1 -1
- package/lib-es/platform/helpers.d.ts +5 -1
- package/lib-es/platform/helpers.d.ts.map +1 -1
- package/lib-es/platform/helpers.js +30 -1
- package/lib-es/platform/helpers.js.map +1 -1
- package/lib-es/platform/react.d.ts +3 -2
- package/lib-es/platform/react.d.ts.map +1 -1
- package/lib-es/platform/react.js +16 -67
- package/lib-es/platform/react.js.map +1 -1
- package/lib-es/platform/types.d.ts +3 -3
- package/lib-es/platform/types.d.ts.map +1 -1
- package/lib-es/postOnboarding/reducer.d.ts +0 -2
- package/lib-es/postOnboarding/reducer.d.ts.map +1 -1
- package/lib-es/utils/getAccountTuplesForCurrency.d.ts +1 -1
- package/lib-es/utils/getAccountTuplesForCurrency.d.ts.map +1 -1
- package/lib-es/utils/getAccountTuplesForCurrency.js +3 -2
- package/lib-es/utils/getAccountTuplesForCurrency.js.map +1 -1
- package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib-es/wallet-api/Exchange/server.js +4 -5
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/wallet-api/converters.d.ts +0 -1
- package/lib-es/wallet-api/converters.d.ts.map +1 -1
- package/lib-es/wallet-api/converters.js +1 -5
- package/lib-es/wallet-api/converters.js.map +1 -1
- package/lib-es/wallet-api/react.d.ts +11 -6
- package/lib-es/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +131 -291
- package/lib-es/wallet-api/react.js.map +1 -1
- package/lib-es/wallet-api/tracking.d.ts +0 -6
- package/lib-es/wallet-api/tracking.d.ts.map +1 -1
- package/lib-es/wallet-api/tracking.js +0 -20
- package/lib-es/wallet-api/tracking.js.map +1 -1
- package/lib-es/wallet-api/types.d.ts +0 -3
- package/lib-es/wallet-api/types.d.ts.map +1 -1
- package/lib-es/wallet-api/useDappLogic.d.ts.map +1 -1
- package/lib-es/wallet-api/useDappLogic.js +77 -62
- package/lib-es/wallet-api/useDappLogic.js.map +1 -1
- package/lib-es/wallet-api/utils/deriveAccountIdForManifest.d.ts +0 -6
- package/lib-es/wallet-api/utils/deriveAccountIdForManifest.d.ts.map +1 -1
- package/lib-es/wallet-api/utils/deriveAccountIdForManifest.js +2 -11
- package/lib-es/wallet-api/utils/deriveAccountIdForManifest.js.map +1 -1
- package/package.json +58 -59
- package/src/__tests__/migration/account-migration.ts +0 -3
- package/src/__tests__/test-helpers/bridge.ts +2 -0
- package/src/__tests__/test-helpers/environment.ts +0 -3
- package/src/bridge/generic-alpaca/getAccountShape.ts +12 -15
- package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +101 -142
- package/src/currencies/helpers.test.ts +20 -0
- package/src/currencies/helpers.ts +42 -1
- package/src/dada-client/hooks/useAssetsData.ts +0 -1
- package/src/deposit/deposit.integration.test.ts +88 -0
- package/src/deposit/deposit.test.ts +684 -0
- package/src/deposit/helper.ts +143 -0
- package/src/deposit/index.ts +3 -0
- package/src/deposit/mock.ts +15112 -0
- package/src/deposit/type.ts +21 -0
- package/src/deposit/useGroupedCurrenciesByProvider.hook.ts +46 -0
- package/src/deviceSDK/hooks/useBatteryStatuses.test.ts +1 -3
- package/src/deviceSDK/hooks/useBatteryStatuses.ts +1 -4
- package/src/deviceSDK/tasks/core.test.ts +0 -20
- package/src/deviceSDK/tasks/core.ts +1 -2
- package/src/deviceSDK/tasks/getDeviceInfo.ts +0 -2
- package/src/deviceSDK/tasks/getLatestFirmware.ts +4 -4
- package/src/deviceSDK/tasks/updateFirmware.ts +0 -2
- package/src/e2e/deviceInteraction/ButtonDeviceSimulator.ts +23 -0
- package/src/e2e/enum/Account.ts +6 -0
- package/src/e2e/enum/Currency.ts +6 -2
- package/src/e2e/families/algorand.ts +13 -20
- package/src/e2e/families/aptos.ts +16 -28
- package/src/e2e/families/bitcoin.ts +39 -53
- package/src/e2e/families/cardano.ts +36 -47
- package/src/e2e/families/celo.ts +12 -18
- package/src/e2e/families/cosmos.ts +23 -35
- package/src/e2e/families/evm.ts +13 -24
- package/src/e2e/families/hedera.ts +4 -6
- package/src/e2e/families/kaspa.ts +16 -28
- package/src/e2e/families/multiversX.ts +10 -16
- package/src/e2e/families/near.ts +17 -23
- package/src/e2e/families/osmosis.ts +13 -19
- package/src/e2e/families/polkadot.ts +13 -19
- package/src/e2e/families/solana.ts +23 -35
- package/src/e2e/families/stellar.ts +13 -18
- package/src/e2e/families/sui.ts +9 -15
- package/src/e2e/families/tezos.ts +18 -25
- package/src/e2e/families/tron.ts +13 -19
- package/src/e2e/families/xrp.ts +13 -19
- package/src/e2e/speculos.ts +140 -168
- package/src/exchange/providers/swap.ts +0 -4
- package/src/exchange/swap/hooks/v5/useFetchCurrencyAll.ts +3 -2
- package/src/exchange/swap/hooks/v5/useFilteredProviders.ts +12 -37
- package/src/families/canton/bridge/mock.ts +0 -1
- package/src/families/evm/config.ts +0 -49
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +12 -84
- package/src/featureFlags/defaultFeatures.ts +0 -6
- package/src/market/hooks/useMarketDataProvider.ts +0 -1
- package/src/market/utils/types.ts +0 -1
- package/src/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.ts +49 -0
- package/src/modularDrawer/hooks/__test__/useAssetAccountCounts.test.ts +5 -0
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +0 -11
- package/src/modularDrawer/hooks/useNetworkAccountCounts.tsx +6 -1
- package/src/modularDrawer/modules/__test__/createAssetConfiguration.test.tsx +2 -2
- package/src/modularDrawer/modules/__test__/createNetworkConfiguration.test.ts +342 -0
- package/src/modularDrawer/modules/createNetworkConfiguration.ts +2 -1
- package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +126 -0
- package/src/modularDrawer/utils/currencyUtils.ts +95 -0
- package/src/modularDrawer/utils/{groupCurrenciesByAsset.ts → groupCurrenciesByProvider.ts} +5 -5
- package/src/modularDrawer/utils/index.ts +1 -1
- package/src/modularDrawer/utils/type.ts +5 -0
- package/src/platform/filters.ts +23 -1
- package/src/platform/helpers.ts +49 -2
- package/src/platform/react.ts +22 -86
- package/src/platform/types.ts +1 -1
- package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +30 -0
- package/src/utils/getAccountTuplesForCurrency.ts +6 -1
- package/src/wallet-api/Exchange/server.test.ts +5 -0
- package/src/wallet-api/Exchange/server.ts +6 -7
- package/src/wallet-api/converters.ts +1 -6
- package/src/wallet-api/react.ts +137 -312
- package/src/wallet-api/tracking.ts +0 -22
- package/src/wallet-api/types.ts +0 -5
- package/src/wallet-api/useDappLogic.ts +106 -91
- package/src/wallet-api/utils/deriveAccountIdForManifest.ts +2 -14
- package/lib/device/use-cases/getDeviceHasBattery.d.ts +0 -2
- package/lib/device/use-cases/getDeviceHasBattery.d.ts.map +0 -1
- package/lib/device/use-cases/getDeviceHasBattery.js +0 -6
- package/lib/device/use-cases/getDeviceHasBattery.js.map +0 -1
- package/lib/e2e/deviceInteraction/DeviceController.d.ts +0 -41
- package/lib/e2e/deviceInteraction/DeviceController.d.ts.map +0 -1
- package/lib/e2e/deviceInteraction/DeviceController.js +0 -68
- package/lib/e2e/deviceInteraction/DeviceController.js.map +0 -1
- package/lib/e2e/enum/ReceiveFundsOptions.d.ts +0 -6
- package/lib/e2e/enum/ReceiveFundsOptions.d.ts.map +0 -1
- package/lib/e2e/enum/ReceiveFundsOptions.js +0 -8
- package/lib/e2e/enum/ReceiveFundsOptions.js.map +0 -1
- package/lib/families/canton/react.d.ts +0 -15
- package/lib/families/canton/react.d.ts.map +0 -1
- package/lib/families/canton/react.js +0 -14
- package/lib/families/canton/react.js.map +0 -1
- package/lib/modularDrawer/utils/groupCurrenciesByAsset.d.ts.map +0 -1
- package/lib/modularDrawer/utils/groupCurrenciesByAsset.js +0 -21
- package/lib/modularDrawer/utils/groupCurrenciesByAsset.js.map +0 -1
- package/lib-es/device/use-cases/getDeviceHasBattery.d.ts +0 -2
- package/lib-es/device/use-cases/getDeviceHasBattery.d.ts.map +0 -1
- package/lib-es/device/use-cases/getDeviceHasBattery.js +0 -2
- package/lib-es/device/use-cases/getDeviceHasBattery.js.map +0 -1
- package/lib-es/e2e/deviceInteraction/DeviceController.d.ts +0 -41
- package/lib-es/e2e/deviceInteraction/DeviceController.d.ts.map +0 -1
- package/lib-es/e2e/deviceInteraction/DeviceController.js +0 -63
- package/lib-es/e2e/deviceInteraction/DeviceController.js.map +0 -1
- package/lib-es/e2e/enum/ReceiveFundsOptions.d.ts +0 -6
- package/lib-es/e2e/enum/ReceiveFundsOptions.d.ts.map +0 -1
- package/lib-es/e2e/enum/ReceiveFundsOptions.js +0 -5
- package/lib-es/e2e/enum/ReceiveFundsOptions.js.map +0 -1
- package/lib-es/families/canton/react.d.ts +0 -15
- package/lib-es/families/canton/react.d.ts.map +0 -1
- package/lib-es/families/canton/react.js +0 -10
- package/lib-es/families/canton/react.js.map +0 -1
- package/lib-es/modularDrawer/utils/groupCurrenciesByAsset.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/groupCurrenciesByAsset.js.map +0 -1
- package/src/device/use-cases/getDeviceHasBattery.ts +0 -1
- package/src/e2e/deviceInteraction/DeviceController.ts +0 -85
- package/src/e2e/enum/ReceiveFundsOptions.ts +0 -7
- package/src/families/canton/react.ts +0 -50
- package/src/modularDrawer/utils/__tests__/groupCurrenciesByAsset.test.ts +0 -88
package/src/wallet-api/react.ts
CHANGED
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
import { useMemo, useState, useEffect, useRef, useCallback, RefObject } from "react";
|
|
2
|
-
import { useDispatch } from "react-redux";
|
|
3
2
|
import semver from "semver";
|
|
4
3
|
import { intervalToDuration } from "date-fns";
|
|
4
|
+
|
|
5
5
|
import { Account, AccountLike, AnyMessage, Operation, SignedOperation } from "@ledgerhq/types-live";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
WalletAPIServer,
|
|
10
|
-
useWalletAPIServer as useWalletAPIServerRaw,
|
|
11
|
-
} from "@ledgerhq/wallet-api-server";
|
|
6
|
+
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
7
|
+
import { WalletHandlers, ServerConfig, WalletAPIServer } from "@ledgerhq/wallet-api-server";
|
|
8
|
+
import { useWalletAPIServer as useWalletAPIServerRaw } from "@ledgerhq/wallet-api-server/lib/react";
|
|
12
9
|
import { Transport, Permission } from "@ledgerhq/wallet-api-core";
|
|
13
|
-
import { first } from "rxjs/operators";
|
|
14
|
-
import { getEnv } from "@ledgerhq/live-env";
|
|
15
|
-
import { UserRefusedOnDevice } from "@ledgerhq/errors";
|
|
16
|
-
import { WalletState } from "@ledgerhq/live-wallet/store";
|
|
17
|
-
import { endpoints as calEndpoints } from "@ledgerhq/cryptoassets/cal-client/state-manager/api";
|
|
18
|
-
import { ThunkDispatch, UnknownAction } from "@reduxjs/toolkit";
|
|
19
|
-
import { InfiniteData } from "@reduxjs/toolkit/query";
|
|
20
|
-
import type {
|
|
21
|
-
TokensDataWithPagination,
|
|
22
|
-
PageParam,
|
|
23
|
-
} from "@ledgerhq/cryptoassets/lib/cal-client/state-manager/types";
|
|
24
|
-
import { Subject } from "rxjs";
|
|
25
10
|
import { StateDB } from "../hooks/useDBRaw";
|
|
11
|
+
import { Observable, firstValueFrom, Subject } from "rxjs";
|
|
12
|
+
import { first } from "rxjs/operators";
|
|
26
13
|
import {
|
|
27
14
|
accountToWalletAPIAccount,
|
|
28
15
|
currencyToWalletAPICurrency,
|
|
29
|
-
|
|
16
|
+
getAccountIdFromWalletAccountId,
|
|
30
17
|
} from "./converters";
|
|
31
18
|
import { isWalletAPISupportedCurrency } from "./helpers";
|
|
32
19
|
import { WalletAPICurrency, AppManifest, WalletAPIAccount, WalletAPICustomHandlers } from "./types";
|
|
20
|
+
|
|
33
21
|
import { getMainAccount, getParentAccount } from "../account";
|
|
34
|
-
import {
|
|
35
|
-
import { getCryptoAssetsStore } from "../bridge/crypto-assets";
|
|
22
|
+
import { listCurrencies, findCryptoCurrencyById, getCryptoCurrencyById } from "../currencies";
|
|
23
|
+
import { getCryptoAssetsStore } from "../bridge/crypto-assets/index";
|
|
36
24
|
import { TrackingAPI } from "./tracking";
|
|
37
25
|
import {
|
|
38
26
|
bitcoinFamilyAccountGetXPubLogic,
|
|
@@ -49,8 +37,10 @@ import {
|
|
|
49
37
|
signRawTransactionLogic,
|
|
50
38
|
} from "./logic";
|
|
51
39
|
import { getAccountBridge } from "../bridge";
|
|
40
|
+
import { getEnv } from "@ledgerhq/live-env";
|
|
52
41
|
import openTransportAsSubject, { BidirectionalEvent } from "../hw/openTransportAsSubject";
|
|
53
42
|
import { AppResult } from "../hw/actions/app";
|
|
43
|
+
import { UserRefusedOnDevice } from "@ledgerhq/errors";
|
|
54
44
|
import { Transaction } from "../generated/types";
|
|
55
45
|
import {
|
|
56
46
|
DISCOVER_INITIAL_CATEGORY,
|
|
@@ -59,8 +49,8 @@ import {
|
|
|
59
49
|
} from "./constants";
|
|
60
50
|
import { DiscoverDB } from "./types";
|
|
61
51
|
import { LiveAppManifest } from "../platform/types";
|
|
52
|
+
import { WalletState } from "@ledgerhq/live-wallet/store";
|
|
62
53
|
import { ModularDrawerConfiguration } from "./ModularDrawer/types";
|
|
63
|
-
import { useCurrenciesUnderFeatureFlag } from "../modularDrawer/hooks/useCurrenciesUnderFeatureFlag";
|
|
64
54
|
|
|
65
55
|
export function safeGetRefValue<T>(ref: RefObject<T>): NonNullable<T> {
|
|
66
56
|
if (!ref.current) {
|
|
@@ -69,27 +59,75 @@ export function safeGetRefValue<T>(ref: RefObject<T>): NonNullable<T> {
|
|
|
69
59
|
return ref.current;
|
|
70
60
|
}
|
|
71
61
|
|
|
72
|
-
export function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
export function useWalletAPIAccounts(
|
|
63
|
+
walletState: WalletState,
|
|
64
|
+
accounts: AccountLike[],
|
|
65
|
+
): WalletAPIAccount[] {
|
|
66
|
+
return useMemo(() => {
|
|
67
|
+
return accounts.map(account => {
|
|
68
|
+
const parentAccount = getParentAccount(account, accounts);
|
|
69
|
+
|
|
70
|
+
return accountToWalletAPIAccount(walletState, account, parentAccount);
|
|
76
71
|
});
|
|
77
|
-
}, [accounts]);
|
|
72
|
+
}, [walletState, accounts]);
|
|
78
73
|
}
|
|
79
74
|
|
|
80
|
-
export function
|
|
75
|
+
export function useWalletAPICurrencies(): WalletAPICurrency[] {
|
|
76
|
+
return useMemo(() => {
|
|
77
|
+
return listCurrencies(true).reduce<WalletAPICurrency[]>((filtered, currency) => {
|
|
78
|
+
if (isWalletAPISupportedCurrency(currency)) {
|
|
79
|
+
filtered.push(currencyToWalletAPICurrency(currency));
|
|
80
|
+
}
|
|
81
|
+
return filtered;
|
|
82
|
+
}, []);
|
|
83
|
+
}, []);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function useManifestCurrencies(manifest: AppManifest) {
|
|
81
87
|
return useMemo(() => {
|
|
82
88
|
return (
|
|
83
89
|
manifest.dapp?.networks.map(network => {
|
|
84
|
-
return network.currency;
|
|
90
|
+
return getCryptoCurrencyById(network.currency);
|
|
85
91
|
}) ?? []
|
|
86
92
|
);
|
|
87
93
|
}, [manifest.dapp?.networks]);
|
|
88
94
|
}
|
|
89
95
|
|
|
96
|
+
export function useGetAccountIds(
|
|
97
|
+
accounts$: Observable<WalletAPIAccount[]> | undefined,
|
|
98
|
+
): Map<string, boolean> | undefined {
|
|
99
|
+
const [accounts, setAccounts] = useState<WalletAPIAccount[]>([]);
|
|
100
|
+
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (!accounts$) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const subscription = accounts$.subscribe(walletAccounts => {
|
|
107
|
+
setAccounts(walletAccounts);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return () => {
|
|
111
|
+
subscription.unsubscribe();
|
|
112
|
+
};
|
|
113
|
+
}, [accounts$]);
|
|
114
|
+
|
|
115
|
+
return useMemo(() => {
|
|
116
|
+
if (!accounts$) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return accounts.reduce((accountIds, account) => {
|
|
121
|
+
accountIds.set(getAccountIdFromWalletAccountId(account.id), true);
|
|
122
|
+
return accountIds;
|
|
123
|
+
}, new Map());
|
|
124
|
+
}, [accounts, accounts$]);
|
|
125
|
+
}
|
|
126
|
+
|
|
90
127
|
export interface UiHook {
|
|
91
128
|
"account.request": (params: {
|
|
92
|
-
|
|
129
|
+
accounts$?: Observable<WalletAPIAccount[]>;
|
|
130
|
+
currencies: CryptoOrTokenCurrency[];
|
|
93
131
|
areCurrenciesFiltered?: boolean;
|
|
94
132
|
useCase?: string;
|
|
95
133
|
drawerConfiguration?: ModularDrawerConfiguration;
|
|
@@ -162,10 +200,11 @@ export interface UiHook {
|
|
|
162
200
|
}) => void;
|
|
163
201
|
}
|
|
164
202
|
|
|
165
|
-
export function usePermission(manifest: AppManifest):
|
|
203
|
+
export function usePermission(manifest: AppManifest): Permission {
|
|
166
204
|
return useMemo(
|
|
167
205
|
() => ({
|
|
168
|
-
|
|
206
|
+
currencyIds: manifest.currencies === "*" ? ["**"] : manifest.currencies,
|
|
207
|
+
methodIds: manifest.permissions as unknown as string[], // TODO remove when using the correct manifest type
|
|
169
208
|
}),
|
|
170
209
|
[manifest],
|
|
171
210
|
);
|
|
@@ -195,7 +234,7 @@ export function useConfig({
|
|
|
195
234
|
wallet,
|
|
196
235
|
mevProtected,
|
|
197
236
|
}),
|
|
198
|
-
[appId,
|
|
237
|
+
[appId, tracking, userId, wallet],
|
|
199
238
|
);
|
|
200
239
|
}
|
|
201
240
|
|
|
@@ -303,19 +342,18 @@ export function useWalletAPIServer({
|
|
|
303
342
|
onLoadError: () => void;
|
|
304
343
|
widgetLoaded: boolean;
|
|
305
344
|
} {
|
|
306
|
-
const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();
|
|
307
|
-
const { deactivatedCurrencyIds } = useCurrenciesUnderFeatureFlag();
|
|
308
345
|
const permission = usePermission(manifest);
|
|
309
346
|
const transport = useTransport(webviewHook.postMessage);
|
|
310
347
|
const [widgetLoaded, setWidgetLoaded] = useState(false);
|
|
311
348
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
useSetWalletAPIAccounts(accounts);
|
|
349
|
+
const walletAPIAccounts = useWalletAPIAccounts(walletState, accounts);
|
|
350
|
+
const walletAPICurrencies = useWalletAPICurrencies();
|
|
315
351
|
|
|
316
352
|
const { server, onMessage } = useWalletAPIServerRaw({
|
|
317
353
|
transport,
|
|
318
354
|
config,
|
|
355
|
+
accounts: walletAPIAccounts,
|
|
356
|
+
currencies: walletAPICurrencies,
|
|
319
357
|
permission,
|
|
320
358
|
customHandlers,
|
|
321
359
|
});
|
|
@@ -324,259 +362,52 @@ export function useWalletAPIServer({
|
|
|
324
362
|
tracking.load(manifest);
|
|
325
363
|
}, [tracking, manifest]);
|
|
326
364
|
|
|
327
|
-
// TODO: refactor each handler into its own logic function for clarity
|
|
328
|
-
useEffect(() => {
|
|
329
|
-
server.setHandler("currency.list", async ({ currencyIds }) => {
|
|
330
|
-
tracking.currencyListRequested(manifest);
|
|
331
|
-
|
|
332
|
-
try {
|
|
333
|
-
// 1. Parse manifest currency patterns to determine what to include
|
|
334
|
-
const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
|
|
335
|
-
|
|
336
|
-
// 2. Apply query filter early - intersect with manifest patterns
|
|
337
|
-
const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
|
|
338
|
-
let effectiveCurrencyIds = manifestCurrencyIds;
|
|
339
|
-
|
|
340
|
-
if (queryCurrencyIdsSet) {
|
|
341
|
-
// If we have a query filter, narrow down what we need to fetch
|
|
342
|
-
effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
|
|
343
|
-
if (manifestId === "**") {
|
|
344
|
-
// Query can ask for anything, so use the query list
|
|
345
|
-
return [...queryCurrencyIdsSet];
|
|
346
|
-
} else if (manifestId.endsWith("/**")) {
|
|
347
|
-
// Pattern like "ethereum/**" - keep tokens from query that match this family
|
|
348
|
-
const family = manifestId.slice(0, -3);
|
|
349
|
-
return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
|
|
350
|
-
} else if (queryCurrencyIdsSet.has(manifestId)) {
|
|
351
|
-
// Specific currency/token that's in the query
|
|
352
|
-
return [manifestId];
|
|
353
|
-
}
|
|
354
|
-
// Not in query, skip it
|
|
355
|
-
return [];
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
// 3. Parse effective currency IDs to determine what to fetch
|
|
360
|
-
const includeAllCurrencies = effectiveCurrencyIds.includes("**");
|
|
361
|
-
const specificCurrencies = new Set<string>();
|
|
362
|
-
const tokenFamilies = new Set<string>();
|
|
363
|
-
const specificTokenIds = new Set<string>();
|
|
364
|
-
|
|
365
|
-
for (const id of effectiveCurrencyIds) {
|
|
366
|
-
if (id === "**") {
|
|
367
|
-
// Already handled above
|
|
368
|
-
continue;
|
|
369
|
-
} else if (id.endsWith("/**")) {
|
|
370
|
-
// Pattern like "ethereum/**" or "solana/**" - include tokens for this family
|
|
371
|
-
const family = id.slice(0, -3);
|
|
372
|
-
tokenFamilies.add(family);
|
|
373
|
-
// Additionally include the parent currency itself
|
|
374
|
-
specificCurrencies.add(family);
|
|
375
|
-
} else if (id.includes("/")) {
|
|
376
|
-
// Specific token ID like "ethereum/erc20/usd__coin"
|
|
377
|
-
specificTokenIds.add(id);
|
|
378
|
-
} else {
|
|
379
|
-
// Specific currency like "bitcoin" or "ethereum"
|
|
380
|
-
specificCurrencies.add(id);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
// 4. Gather all supported parent currencies
|
|
385
|
-
const allCurrencies = listSupportedCurrencies().reduce<WalletAPICurrency[]>((acc, c) => {
|
|
386
|
-
if (isWalletAPISupportedCurrency(c) && !deactivatedCurrencyIds.has(c.id))
|
|
387
|
-
acc.push(currencyToWalletAPICurrency(c));
|
|
388
|
-
return acc;
|
|
389
|
-
}, []);
|
|
390
|
-
|
|
391
|
-
// 5. Determine which currencies to include based on patterns
|
|
392
|
-
let includedCurrencies: WalletAPICurrency[] = [];
|
|
393
|
-
if (includeAllCurrencies) {
|
|
394
|
-
includedCurrencies = allCurrencies;
|
|
395
|
-
} else {
|
|
396
|
-
includedCurrencies = allCurrencies.filter(c => specificCurrencies.has(c.id));
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
// 6. Fetch specific tokens by ID if any
|
|
400
|
-
const specificTokens: WalletAPICurrency[] = [];
|
|
401
|
-
if (specificTokenIds.size > 0) {
|
|
402
|
-
const tokenPromises = [...specificTokenIds].map(async tokenId => {
|
|
403
|
-
const token = await getCryptoAssetsStore().findTokenById(tokenId);
|
|
404
|
-
return token ? currencyToWalletAPICurrency(token) : null;
|
|
405
|
-
});
|
|
406
|
-
const resolvedTokens = await Promise.all(tokenPromises);
|
|
407
|
-
specificTokens.push(...resolvedTokens.filter((t): t is WalletAPICurrency => t !== null));
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// 7. Determine which token families to fetch (only if not already fetched as specific tokens)
|
|
411
|
-
const familiesToFetch = new Set<string>();
|
|
412
|
-
if (includeAllCurrencies) {
|
|
413
|
-
// Fetch tokens for all currency families
|
|
414
|
-
allCurrencies.forEach(c => {
|
|
415
|
-
if (c.type === "CryptoCurrency") familiesToFetch.add(c.family);
|
|
416
|
-
});
|
|
417
|
-
} else if (tokenFamilies.size > 0) {
|
|
418
|
-
// Only fetch tokens for families explicitly marked with /**
|
|
419
|
-
tokenFamilies.forEach(family => familiesToFetch.add(family));
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// 8. Fetch tokens for relevant families
|
|
423
|
-
const fetchAllPagesForFamily = async (family: string) => {
|
|
424
|
-
const args = { networkFamily: family, pageSize: 1000 };
|
|
425
|
-
let hasNextPage = true;
|
|
426
|
-
let data: InfiniteData<TokensDataWithPagination, PageParam> | undefined;
|
|
427
|
-
|
|
428
|
-
while (hasNextPage) {
|
|
429
|
-
const querySub = dispatch(
|
|
430
|
-
calEndpoints.getTokensData.initiate(
|
|
431
|
-
args,
|
|
432
|
-
data ? { direction: "forward" } : undefined,
|
|
433
|
-
),
|
|
434
|
-
);
|
|
435
|
-
|
|
436
|
-
try {
|
|
437
|
-
const result = await querySub;
|
|
438
|
-
data = result.data;
|
|
439
|
-
hasNextPage = result.hasNextPage;
|
|
440
|
-
if (result.error) throw result.error;
|
|
441
|
-
} finally {
|
|
442
|
-
querySub.unsubscribe();
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
return (data?.pages ?? []).flatMap(p => p.tokens);
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
const tokensByFamily = await Promise.all(
|
|
450
|
-
[...familiesToFetch].map(f => fetchAllPagesForFamily(f)),
|
|
451
|
-
);
|
|
452
|
-
|
|
453
|
-
// 9. Combine all results (no additional filter needed since we pre-filtered)
|
|
454
|
-
const result = tokensByFamily.reduce<WalletAPICurrency[]>(
|
|
455
|
-
(acc, tokens) => [...acc, ...tokens.map(t => currencyToWalletAPICurrency(t))],
|
|
456
|
-
[...includedCurrencies, ...specificTokens],
|
|
457
|
-
);
|
|
458
|
-
|
|
459
|
-
tracking.currencyListSuccess(manifest);
|
|
460
|
-
return result;
|
|
461
|
-
} catch (err) {
|
|
462
|
-
tracking.currencyListFail(manifest);
|
|
463
|
-
throw err;
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
}, [walletState, manifest, server, tracking, dispatch, deactivatedCurrencyIds]);
|
|
467
|
-
|
|
468
|
-
useEffect(() => {
|
|
469
|
-
server.setHandler("account.list", ({ currencyIds }) => {
|
|
470
|
-
tracking.accountListRequested(manifest);
|
|
471
|
-
|
|
472
|
-
try {
|
|
473
|
-
// 1. Parse manifest currency patterns to determine what to include
|
|
474
|
-
const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
|
|
475
|
-
|
|
476
|
-
// 2. Apply query filter early - intersect with manifest patterns
|
|
477
|
-
const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
|
|
478
|
-
let effectiveCurrencyIds = manifestCurrencyIds;
|
|
479
|
-
|
|
480
|
-
if (queryCurrencyIdsSet) {
|
|
481
|
-
// If we have a query filter, narrow down what we need to check
|
|
482
|
-
effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
|
|
483
|
-
if (manifestId === "**") {
|
|
484
|
-
// Query can ask for anything, so use the query list
|
|
485
|
-
return [...queryCurrencyIdsSet];
|
|
486
|
-
} else if (manifestId.endsWith("/**")) {
|
|
487
|
-
// Pattern like "ethereum/**" - keep tokens from query that match this family
|
|
488
|
-
const family = manifestId.slice(0, -3);
|
|
489
|
-
return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
|
|
490
|
-
} else if (queryCurrencyIdsSet.has(manifestId)) {
|
|
491
|
-
// Specific currency/token that's in the query
|
|
492
|
-
return [manifestId];
|
|
493
|
-
}
|
|
494
|
-
// Not in query, skip it
|
|
495
|
-
return [];
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
// 3. Build a set of allowed currency IDs based on effective patterns
|
|
500
|
-
const allowedCurrencyIds = new Set<string>();
|
|
501
|
-
const includeAllCurrencies = effectiveCurrencyIds.includes("**");
|
|
502
|
-
const tokenFamilyPrefixes = new Set<string>();
|
|
503
|
-
|
|
504
|
-
for (const id of effectiveCurrencyIds) {
|
|
505
|
-
if (id === "**") {
|
|
506
|
-
// Will match all currencies
|
|
507
|
-
continue;
|
|
508
|
-
} else if (id.endsWith("/**")) {
|
|
509
|
-
// Pattern like "ethereum/**" - store prefix for matching
|
|
510
|
-
const family = id.slice(0, -3);
|
|
511
|
-
tokenFamilyPrefixes.add(family);
|
|
512
|
-
} else {
|
|
513
|
-
// Specific currency/token ID
|
|
514
|
-
allowedCurrencyIds.add(id);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
// 4. Filter accounts based on effective currency IDs
|
|
519
|
-
const wapiAccounts = accounts.reduce<WalletAPIAccount[]>((acc, account) => {
|
|
520
|
-
const parentAccount = getParentAccount(account, accounts);
|
|
521
|
-
const accountCurrencyId =
|
|
522
|
-
account.type === "TokenAccount" ? account.token.id : account.currency.id;
|
|
523
|
-
const parentCurrencyId =
|
|
524
|
-
account.type === "TokenAccount" ? account.token.parentCurrency.id : account.currency.id;
|
|
525
|
-
|
|
526
|
-
// Check if account currency ID matches the effective patterns
|
|
527
|
-
const isAllowed =
|
|
528
|
-
includeAllCurrencies ||
|
|
529
|
-
allowedCurrencyIds.has(accountCurrencyId) ||
|
|
530
|
-
tokenFamilyPrefixes.has(parentCurrencyId);
|
|
531
|
-
|
|
532
|
-
if (isAllowed) {
|
|
533
|
-
acc.push(accountToWalletAPIAccount(walletState, account, parentAccount));
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
return acc;
|
|
537
|
-
}, []);
|
|
538
|
-
|
|
539
|
-
tracking.accountListSuccess(manifest);
|
|
540
|
-
return wapiAccounts;
|
|
541
|
-
} catch (err) {
|
|
542
|
-
tracking.accountListFail(manifest);
|
|
543
|
-
throw err;
|
|
544
|
-
}
|
|
545
|
-
});
|
|
546
|
-
}, [walletState, manifest, server, tracking, uiAccountRequest, accounts]);
|
|
547
|
-
|
|
548
365
|
useEffect(() => {
|
|
549
366
|
if (!uiAccountRequest) return;
|
|
550
367
|
|
|
551
368
|
server.setHandler(
|
|
552
369
|
"account.request",
|
|
553
|
-
async ({
|
|
370
|
+
async ({ accounts$, currencies$, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
|
|
554
371
|
tracking.requestAccountRequested(manifest);
|
|
372
|
+
const currencies = await firstValueFrom(currencies$);
|
|
373
|
+
|
|
555
374
|
return new Promise((resolve, reject) => {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
375
|
+
(async () => {
|
|
376
|
+
try {
|
|
377
|
+
// handle no curencies selected case
|
|
378
|
+
const currencyList: CryptoOrTokenCurrency[] = [];
|
|
379
|
+
for (const { id } of currencies) {
|
|
380
|
+
const currency =
|
|
381
|
+
findCryptoCurrencyById(id) || (await getCryptoAssetsStore().findTokenById(id));
|
|
382
|
+
if (currency) {
|
|
383
|
+
currencyList.push(currency);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
let done = false;
|
|
388
|
+
uiAccountRequest({
|
|
389
|
+
accounts$,
|
|
390
|
+
currencies: currencyList,
|
|
391
|
+
drawerConfiguration,
|
|
392
|
+
areCurrenciesFiltered,
|
|
393
|
+
useCase,
|
|
394
|
+
onSuccess: (account: AccountLike, parentAccount: Account | undefined) => {
|
|
395
|
+
if (done) return;
|
|
396
|
+
done = true;
|
|
397
|
+
tracking.requestAccountSuccess(manifest);
|
|
398
|
+
resolve(accountToWalletAPIAccount(walletState, account, parentAccount));
|
|
399
|
+
},
|
|
400
|
+
onCancel: () => {
|
|
401
|
+
if (done) return;
|
|
402
|
+
done = true;
|
|
403
|
+
tracking.requestAccountFail(manifest);
|
|
404
|
+
reject(new Error("Canceled by user"));
|
|
405
|
+
},
|
|
406
|
+
});
|
|
407
|
+
} catch (error) {
|
|
408
|
+
reject(error);
|
|
409
|
+
}
|
|
410
|
+
})();
|
|
580
411
|
});
|
|
581
412
|
},
|
|
582
413
|
);
|
|
@@ -585,11 +416,11 @@ export function useWalletAPIServer({
|
|
|
585
416
|
useEffect(() => {
|
|
586
417
|
if (!uiAccountReceive) return;
|
|
587
418
|
|
|
588
|
-
server.setHandler("account.receive", ({
|
|
419
|
+
server.setHandler("account.receive", ({ account, tokenCurrency }) =>
|
|
589
420
|
receiveOnAccountLogic(
|
|
590
421
|
walletState,
|
|
591
422
|
{ manifest, accounts, tracking },
|
|
592
|
-
|
|
423
|
+
account.id,
|
|
593
424
|
(account, parentAccount, accountAddress) =>
|
|
594
425
|
new Promise((resolve, reject) => {
|
|
595
426
|
let done = false;
|
|
@@ -625,10 +456,10 @@ export function useWalletAPIServer({
|
|
|
625
456
|
useEffect(() => {
|
|
626
457
|
if (!uiMessageSign) return;
|
|
627
458
|
|
|
628
|
-
server.setHandler("message.sign", ({
|
|
459
|
+
server.setHandler("message.sign", ({ account, message, options }) =>
|
|
629
460
|
signMessageLogic(
|
|
630
461
|
{ manifest, accounts, tracking },
|
|
631
|
-
|
|
462
|
+
account.id,
|
|
632
463
|
message.toString("hex"),
|
|
633
464
|
(account: AccountLike, message: AnyMessage) =>
|
|
634
465
|
new Promise((resolve, reject) => {
|
|
@@ -682,18 +513,13 @@ export function useWalletAPIServer({
|
|
|
682
513
|
|
|
683
514
|
server.setHandler(
|
|
684
515
|
"transaction.sign",
|
|
685
|
-
async ({
|
|
686
|
-
let currency: string | undefined;
|
|
516
|
+
async ({ account, tokenCurrency, transaction, options }) => {
|
|
687
517
|
const signedOperation = await signTransactionLogic(
|
|
688
518
|
{ manifest, accounts, tracking },
|
|
689
|
-
|
|
519
|
+
account.id,
|
|
690
520
|
transaction,
|
|
691
|
-
(account, parentAccount, signFlowInfos) =>
|
|
692
|
-
|
|
693
|
-
account.type === "TokenAccount"
|
|
694
|
-
? account.token.parentCurrency.id
|
|
695
|
-
: account.currency.id;
|
|
696
|
-
return new Promise((resolve, reject) => {
|
|
521
|
+
(account, parentAccount, signFlowInfos) =>
|
|
522
|
+
new Promise((resolve, reject) => {
|
|
697
523
|
let done = false;
|
|
698
524
|
return uiTxSign({
|
|
699
525
|
account,
|
|
@@ -713,12 +539,11 @@ export function useWalletAPIServer({
|
|
|
713
539
|
reject(error);
|
|
714
540
|
},
|
|
715
541
|
});
|
|
716
|
-
})
|
|
717
|
-
},
|
|
542
|
+
}),
|
|
718
543
|
tokenCurrency,
|
|
719
544
|
);
|
|
720
545
|
|
|
721
|
-
return currency === "solana"
|
|
546
|
+
return account.currency === "solana"
|
|
722
547
|
? Buffer.from(signedOperation.signature, "hex")
|
|
723
548
|
: Buffer.from(signedOperation.signature);
|
|
724
549
|
},
|
|
@@ -730,10 +555,10 @@ export function useWalletAPIServer({
|
|
|
730
555
|
|
|
731
556
|
server.setHandler(
|
|
732
557
|
"transaction.signRaw",
|
|
733
|
-
async ({
|
|
558
|
+
async ({ account, transaction, broadcast, options }) => {
|
|
734
559
|
const signedOperation = await signRawTransactionLogic(
|
|
735
560
|
{ manifest, accounts, tracking },
|
|
736
|
-
|
|
561
|
+
account.id,
|
|
737
562
|
transaction,
|
|
738
563
|
(account, parentAccount, tx) =>
|
|
739
564
|
new Promise((resolve, reject) => {
|
|
@@ -763,7 +588,7 @@ export function useWalletAPIServer({
|
|
|
763
588
|
if (broadcast) {
|
|
764
589
|
hash = await broadcastTransactionLogic(
|
|
765
590
|
{ manifest, accounts, tracking },
|
|
766
|
-
|
|
591
|
+
account.id,
|
|
767
592
|
signedOperation,
|
|
768
593
|
async (account, parentAccount, signedOperation) => {
|
|
769
594
|
const bridge = getAccountBridge(account, parentAccount);
|
|
@@ -806,12 +631,12 @@ export function useWalletAPIServer({
|
|
|
806
631
|
|
|
807
632
|
server.setHandler(
|
|
808
633
|
"transaction.signAndBroadcast",
|
|
809
|
-
async ({
|
|
634
|
+
async ({ account, tokenCurrency, transaction, options }) => {
|
|
810
635
|
const sponsored = transaction.family === "ethereum" && transaction.sponsored;
|
|
811
636
|
|
|
812
637
|
const signedTransaction = await signTransactionLogic(
|
|
813
638
|
{ manifest, accounts, tracking },
|
|
814
|
-
|
|
639
|
+
account.id,
|
|
815
640
|
transaction,
|
|
816
641
|
(account, parentAccount, signFlowInfos) =>
|
|
817
642
|
new Promise((resolve, reject) => {
|
|
@@ -840,7 +665,7 @@ export function useWalletAPIServer({
|
|
|
840
665
|
|
|
841
666
|
return broadcastTransactionLogic(
|
|
842
667
|
{ manifest, accounts, tracking },
|
|
843
|
-
|
|
668
|
+
account.id,
|
|
844
669
|
signedTransaction,
|
|
845
670
|
async (account, parentAccount, signedOperation) => {
|
|
846
671
|
const bridge = getAccountBridge(account, parentAccount);
|
|
@@ -1104,8 +929,8 @@ export function useWalletAPIServer({
|
|
|
1104
929
|
// retrofit of the exchange params to fit the old platform spec
|
|
1105
930
|
const request: CompleteExchangeRequest = {
|
|
1106
931
|
provider: params.provider,
|
|
1107
|
-
fromAccountId: params.
|
|
1108
|
-
toAccountId: params.exchangeType === "SWAP" ? params.
|
|
932
|
+
fromAccountId: params.fromAccount.id,
|
|
933
|
+
toAccountId: params.exchangeType === "SWAP" ? params.toAccount.id : undefined,
|
|
1109
934
|
transaction: params.transaction,
|
|
1110
935
|
binaryPayload: params.binaryPayload.toString("hex"),
|
|
1111
936
|
signature: params.signature.toString("hex"),
|
|
@@ -1143,7 +968,7 @@ export function useWalletAPIServer({
|
|
|
1143
968
|
}, [uiExchangeComplete, accounts, manifest, server, tracking]);
|
|
1144
969
|
|
|
1145
970
|
return {
|
|
1146
|
-
widgetLoaded
|
|
971
|
+
widgetLoaded,
|
|
1147
972
|
onMessage,
|
|
1148
973
|
onLoad,
|
|
1149
974
|
onReload,
|
|
@@ -1346,9 +1171,9 @@ export function useRecentlyUsed(
|
|
|
1346
1171
|
...res,
|
|
1347
1172
|
usedAt: calculateTimeDiff(recentlyUsed.usedAt),
|
|
1348
1173
|
}
|
|
1349
|
-
:
|
|
1174
|
+
: res;
|
|
1350
1175
|
})
|
|
1351
|
-
.filter(
|
|
1176
|
+
.filter(manifest => manifest !== undefined) as RecentlyUsedManifest[],
|
|
1352
1177
|
[recentlyUsedManifestsDb, manifests],
|
|
1353
1178
|
);
|
|
1354
1179
|
const append = useCallback(
|
|
@@ -241,28 +241,6 @@ export default function trackingWrapper(trackCall: TrackWalletAPI) {
|
|
|
241
241
|
track("WalletAPI bitcoin family account xpub success", getEventData(manifest));
|
|
242
242
|
},
|
|
243
243
|
|
|
244
|
-
// currency.list handler tracking
|
|
245
|
-
currencyListRequested: (manifest: AppManifest) => {
|
|
246
|
-
track("WalletAPI CurrencyList requested", getEventData(manifest));
|
|
247
|
-
},
|
|
248
|
-
currencyListSuccess: (manifest: AppManifest) => {
|
|
249
|
-
track("WalletAPI CurrencyList success", getEventData(manifest));
|
|
250
|
-
},
|
|
251
|
-
currencyListFail: (manifest: AppManifest) => {
|
|
252
|
-
track("WalletAPI CurrencyList fail", getEventData(manifest));
|
|
253
|
-
},
|
|
254
|
-
|
|
255
|
-
// account.list handler tracking
|
|
256
|
-
accountListRequested: (manifest: AppManifest) => {
|
|
257
|
-
track("WalletAPI AccountList requested", getEventData(manifest));
|
|
258
|
-
},
|
|
259
|
-
accountListSuccess: (manifest: AppManifest) => {
|
|
260
|
-
track("WalletAPI AccountList success", getEventData(manifest));
|
|
261
|
-
},
|
|
262
|
-
accountListFail: (manifest: AppManifest) => {
|
|
263
|
-
track("WalletAPI AccountList fail", getEventData(manifest));
|
|
264
|
-
},
|
|
265
|
-
|
|
266
244
|
dappSendTransactionRequested: (manifest: AppManifest, trackingData: DAppTrackingData) => {
|
|
267
245
|
track("dApp SendTransaction requested", { ...getEventData(manifest), ...trackingData });
|
|
268
246
|
},
|
package/src/wallet-api/types.ts
CHANGED
|
@@ -83,8 +83,3 @@ export type DAppTrackingData = {
|
|
|
83
83
|
currency: string;
|
|
84
84
|
network: CryptoCurrency["id"];
|
|
85
85
|
};
|
|
86
|
-
|
|
87
|
-
export type AccountIdFormat = "uuid" | "encoded";
|
|
88
|
-
|
|
89
|
-
/** @developer note uuid = wallet API id format, encoded = ledger wallet default format */
|
|
90
|
-
export type AccountIdFormatsResponse = Record<string, AccountIdFormat>;
|