@ledgerhq/live-common 34.53.0-nightly.20251115023630 → 34.53.0-nightly.20251118023800
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/currencies/helpers.d.ts +1 -3
- package/lib/currencies/helpers.d.ts.map +1 -1
- package/lib/currencies/helpers.js +1 -27
- package/lib/currencies/helpers.js.map +1 -1
- package/lib/dada-client/hooks/useAssetsData.d.ts +1 -0
- package/lib/dada-client/hooks/useAssetsData.d.ts.map +1 -1
- package/lib/dada-client/hooks/useAssetsData.js +1 -0
- package/lib/dada-client/hooks/useAssetsData.js.map +1 -1
- package/lib/deviceSDK/actions/getBatteryStatuses.d.ts +2 -1
- package/lib/deviceSDK/actions/getBatteryStatuses.d.ts.map +1 -1
- package/lib/deviceSDK/actions/getBatteryStatuses.js +2 -2
- package/lib/deviceSDK/actions/getBatteryStatuses.js.map +1 -1
- package/lib/deviceSDK/actions/getDeviceInfo.d.ts +2 -1
- package/lib/deviceSDK/actions/getDeviceInfo.d.ts.map +1 -1
- package/lib/deviceSDK/actions/getDeviceInfo.js +2 -2
- package/lib/deviceSDK/actions/getDeviceInfo.js.map +1 -1
- package/lib/deviceSDK/actions/getLatestAvailableFirmware.d.ts +2 -1
- package/lib/deviceSDK/actions/getLatestAvailableFirmware.d.ts.map +1 -1
- package/lib/deviceSDK/actions/getLatestAvailableFirmware.js +6 -3
- package/lib/deviceSDK/actions/getLatestAvailableFirmware.js.map +1 -1
- package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts +2 -1
- package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts.map +1 -1
- package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.js +2 -2
- package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.js.map +1 -1
- package/lib/deviceSDK/actions/updateFirmware.d.ts +2 -1
- package/lib/deviceSDK/actions/updateFirmware.d.ts.map +1 -1
- package/lib/deviceSDK/actions/updateFirmware.js +4 -3
- package/lib/deviceSDK/actions/updateFirmware.js.map +1 -1
- package/lib/deviceSDK/hooks/useBatteryStatuses.d.ts +2 -1
- package/lib/deviceSDK/hooks/useBatteryStatuses.d.ts.map +1 -1
- package/lib/deviceSDK/hooks/useBatteryStatuses.js +3 -2
- package/lib/deviceSDK/hooks/useBatteryStatuses.js.map +1 -1
- package/lib/deviceSDK/hooks/useGetDeviceInfo.d.ts +2 -1
- package/lib/deviceSDK/hooks/useGetDeviceInfo.d.ts.map +1 -1
- package/lib/deviceSDK/hooks/useGetDeviceInfo.js +3 -3
- package/lib/deviceSDK/hooks/useGetDeviceInfo.js.map +1 -1
- package/lib/deviceSDK/hooks/useGetLatestAvailableFirmware.d.ts +2 -1
- package/lib/deviceSDK/hooks/useGetLatestAvailableFirmware.d.ts.map +1 -1
- package/lib/deviceSDK/hooks/useGetLatestAvailableFirmware.js +2 -1
- package/lib/deviceSDK/hooks/useGetLatestAvailableFirmware.js.map +1 -1
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts +2 -1
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts.map +1 -1
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js +3 -2
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js.map +1 -1
- package/lib/deviceSDK/hooks/useUpdateFirmware.d.ts +2 -1
- package/lib/deviceSDK/hooks/useUpdateFirmware.d.ts.map +1 -1
- package/lib/deviceSDK/hooks/useUpdateFirmware.js +3 -2
- package/lib/deviceSDK/hooks/useUpdateFirmware.js.map +1 -1
- package/lib/deviceSDK/tasks/getBatteryStatuses.d.ts +1 -0
- package/lib/deviceSDK/tasks/getBatteryStatuses.d.ts.map +1 -1
- package/lib/deviceSDK/tasks/getBatteryStatuses.js +2 -2
- package/lib/deviceSDK/tasks/getBatteryStatuses.js.map +1 -1
- package/lib/deviceSDK/tasks/getDeviceInfo.d.ts +2 -1
- package/lib/deviceSDK/tasks/getDeviceInfo.d.ts.map +1 -1
- package/lib/deviceSDK/tasks/getDeviceInfo.js +2 -2
- package/lib/deviceSDK/tasks/getDeviceInfo.js.map +1 -1
- package/lib/deviceSDK/tasks/getLatestFirmware.d.ts +1 -0
- 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/toggleOnboardingEarlyCheck.d.ts +1 -0
- package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.d.ts.map +1 -1
- package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.js +2 -2
- package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.js.map +1 -1
- package/lib/deviceSDK/tasks/updateFirmware.d.ts +1 -0
- package/lib/deviceSDK/tasks/updateFirmware.d.ts.map +1 -1
- package/lib/deviceSDK/tasks/updateFirmware.js +2 -2
- package/lib/deviceSDK/tasks/updateFirmware.js.map +1 -1
- package/lib/deviceSDK/transports/core.d.ts +1 -0
- package/lib/deviceSDK/transports/core.d.ts.map +1 -1
- package/lib/deviceSDK/transports/core.js +2 -2
- package/lib/deviceSDK/transports/core.js.map +1 -1
- package/lib/hw/actions/app.d.ts.map +1 -1
- package/lib/hw/actions/app.js +2 -1
- package/lib/hw/actions/app.js.map +1 -1
- package/lib/hw/actions/customLockScreenLoad.d.ts +1 -1
- package/lib/hw/actions/customLockScreenLoad.d.ts.map +1 -1
- package/lib/hw/actions/customLockScreenLoad.js +2 -0
- package/lib/hw/actions/customLockScreenLoad.js.map +1 -1
- package/lib/hw/actions/implementations.d.ts +1 -0
- package/lib/hw/actions/implementations.d.ts.map +1 -1
- package/lib/hw/actions/implementations.js +12 -2
- package/lib/hw/actions/implementations.js.map +1 -1
- package/lib/hw/connectApp.d.ts +2 -1
- package/lib/hw/connectApp.d.ts.map +1 -1
- package/lib/hw/connectApp.js +4 -4
- package/lib/hw/connectApp.js.map +1 -1
- package/lib/hw/connectManager.d.ts +2 -1
- package/lib/hw/connectManager.d.ts.map +1 -1
- package/lib/hw/connectManager.js +4 -4
- package/lib/hw/connectManager.js.map +1 -1
- package/lib/hw/customLockScreenFetch.d.ts +2 -1
- package/lib/hw/customLockScreenFetch.d.ts.map +1 -1
- package/lib/hw/customLockScreenFetch.js +2 -2
- package/lib/hw/customLockScreenFetch.js.map +1 -1
- package/lib/hw/customLockScreenLoad.d.ts +2 -1
- package/lib/hw/customLockScreenLoad.d.ts.map +1 -1
- package/lib/hw/customLockScreenLoad.js +2 -2
- package/lib/hw/customLockScreenLoad.js.map +1 -1
- package/lib/hw/deviceAccess.d.ts +3 -3
- package/lib/hw/deviceAccess.d.ts.map +1 -1
- package/lib/hw/deviceAccess.js +2 -1
- package/lib/hw/deviceAccess.js.map +1 -1
- package/lib/hw/getGenuineCheckFromDeviceId.d.ts +2 -1
- package/lib/hw/getGenuineCheckFromDeviceId.d.ts.map +1 -1
- package/lib/hw/getGenuineCheckFromDeviceId.js +2 -2
- package/lib/hw/getGenuineCheckFromDeviceId.js.map +1 -1
- package/lib/hw/getOnboardingStatePolling.d.ts +2 -1
- package/lib/hw/getOnboardingStatePolling.d.ts.map +1 -1
- package/lib/hw/getOnboardingStatePolling.js +5 -2
- package/lib/hw/getOnboardingStatePolling.js.map +1 -1
- package/lib/hw/hooks/useGenuineCheck.d.ts +2 -1
- package/lib/hw/hooks/useGenuineCheck.d.ts.map +1 -1
- package/lib/hw/hooks/useGenuineCheck.js +3 -1
- package/lib/hw/hooks/useGenuineCheck.js.map +1 -1
- package/lib/hw/index.d.ts +6 -2
- package/lib/hw/index.d.ts.map +1 -1
- package/lib/hw/index.js +6 -6
- package/lib/hw/index.js.map +1 -1
- package/lib/hw/installLanguage.d.ts +2 -1
- package/lib/hw/installLanguage.d.ts.map +1 -1
- package/lib/hw/installLanguage.js +2 -2
- package/lib/hw/installLanguage.js.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +2 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib/modularDrawer/hooks/useNetworkAccountCounts.d.ts +1 -5
- 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 +1 -2
- package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- package/lib/modularDrawer/utils/type.d.ts +0 -5
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib/onboarding/hooks/useOnboardingStatePolling.d.ts.map +1 -1
- package/lib/onboarding/hooks/useOnboardingStatePolling.js +1 -0
- package/lib/onboarding/hooks/useOnboardingStatePolling.js.map +1 -1
- package/lib/platform/filters.d.ts +1 -2
- package/lib/platform/filters.d.ts.map +1 -1
- package/lib/platform/filters.js +1 -17
- package/lib/platform/filters.js.map +1 -1
- package/lib/platform/helpers.d.ts +1 -5
- package/lib/platform/helpers.d.ts.map +1 -1
- package/lib/platform/helpers.js +1 -33
- package/lib/platform/helpers.js.map +1 -1
- package/lib/platform/react.d.ts +2 -3
- package/lib/platform/react.d.ts.map +1 -1
- package/lib/platform/react.js +66 -16
- 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/utils/getAccountTuplesForCurrency.d.ts +1 -1
- package/lib/utils/getAccountTuplesForCurrency.d.ts.map +1 -1
- package/lib/utils/getAccountTuplesForCurrency.js +2 -3
- 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 +5 -4
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib/wallet-api/converters.d.ts +1 -0
- package/lib/wallet-api/converters.d.ts.map +1 -1
- package/lib/wallet-api/converters.js +7 -2
- package/lib/wallet-api/converters.js.map +1 -1
- package/lib/wallet-api/react.d.ts +6 -11
- package/lib/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +291 -135
- package/lib/wallet-api/react.js.map +1 -1
- package/lib/wallet-api/tracking.d.ts +6 -0
- package/lib/wallet-api/tracking.d.ts.map +1 -1
- package/lib/wallet-api/tracking.js +20 -0
- package/lib/wallet-api/tracking.js.map +1 -1
- package/lib/wallet-api/useDappLogic.d.ts.map +1 -1
- package/lib/wallet-api/useDappLogic.js +65 -80
- package/lib/wallet-api/useDappLogic.js.map +1 -1
- package/lib-es/currencies/helpers.d.ts +1 -3
- package/lib-es/currencies/helpers.d.ts.map +1 -1
- package/lib-es/currencies/helpers.js +0 -24
- package/lib-es/currencies/helpers.js.map +1 -1
- package/lib-es/dada-client/hooks/useAssetsData.d.ts +1 -0
- package/lib-es/dada-client/hooks/useAssetsData.d.ts.map +1 -1
- package/lib-es/dada-client/hooks/useAssetsData.js +1 -0
- package/lib-es/dada-client/hooks/useAssetsData.js.map +1 -1
- package/lib-es/deviceSDK/actions/getBatteryStatuses.d.ts +2 -1
- package/lib-es/deviceSDK/actions/getBatteryStatuses.d.ts.map +1 -1
- package/lib-es/deviceSDK/actions/getBatteryStatuses.js +2 -2
- package/lib-es/deviceSDK/actions/getBatteryStatuses.js.map +1 -1
- package/lib-es/deviceSDK/actions/getDeviceInfo.d.ts +2 -1
- package/lib-es/deviceSDK/actions/getDeviceInfo.d.ts.map +1 -1
- package/lib-es/deviceSDK/actions/getDeviceInfo.js +2 -2
- package/lib-es/deviceSDK/actions/getDeviceInfo.js.map +1 -1
- package/lib-es/deviceSDK/actions/getLatestAvailableFirmware.d.ts +2 -1
- package/lib-es/deviceSDK/actions/getLatestAvailableFirmware.d.ts.map +1 -1
- package/lib-es/deviceSDK/actions/getLatestAvailableFirmware.js +6 -3
- package/lib-es/deviceSDK/actions/getLatestAvailableFirmware.js.map +1 -1
- package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts +2 -1
- package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts.map +1 -1
- package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.js +2 -2
- package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.js.map +1 -1
- package/lib-es/deviceSDK/actions/updateFirmware.d.ts +2 -1
- package/lib-es/deviceSDK/actions/updateFirmware.d.ts.map +1 -1
- package/lib-es/deviceSDK/actions/updateFirmware.js +4 -3
- package/lib-es/deviceSDK/actions/updateFirmware.js.map +1 -1
- package/lib-es/deviceSDK/hooks/useBatteryStatuses.d.ts +2 -1
- package/lib-es/deviceSDK/hooks/useBatteryStatuses.d.ts.map +1 -1
- package/lib-es/deviceSDK/hooks/useBatteryStatuses.js +3 -2
- package/lib-es/deviceSDK/hooks/useBatteryStatuses.js.map +1 -1
- package/lib-es/deviceSDK/hooks/useGetDeviceInfo.d.ts +2 -1
- package/lib-es/deviceSDK/hooks/useGetDeviceInfo.d.ts.map +1 -1
- package/lib-es/deviceSDK/hooks/useGetDeviceInfo.js +3 -3
- package/lib-es/deviceSDK/hooks/useGetDeviceInfo.js.map +1 -1
- package/lib-es/deviceSDK/hooks/useGetLatestAvailableFirmware.d.ts +2 -1
- package/lib-es/deviceSDK/hooks/useGetLatestAvailableFirmware.d.ts.map +1 -1
- package/lib-es/deviceSDK/hooks/useGetLatestAvailableFirmware.js +2 -1
- package/lib-es/deviceSDK/hooks/useGetLatestAvailableFirmware.js.map +1 -1
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts +2 -1
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts.map +1 -1
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js +3 -2
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js.map +1 -1
- package/lib-es/deviceSDK/hooks/useUpdateFirmware.d.ts +2 -1
- package/lib-es/deviceSDK/hooks/useUpdateFirmware.d.ts.map +1 -1
- package/lib-es/deviceSDK/hooks/useUpdateFirmware.js +3 -2
- package/lib-es/deviceSDK/hooks/useUpdateFirmware.js.map +1 -1
- package/lib-es/deviceSDK/tasks/getBatteryStatuses.d.ts +1 -0
- package/lib-es/deviceSDK/tasks/getBatteryStatuses.d.ts.map +1 -1
- package/lib-es/deviceSDK/tasks/getBatteryStatuses.js +2 -2
- package/lib-es/deviceSDK/tasks/getBatteryStatuses.js.map +1 -1
- package/lib-es/deviceSDK/tasks/getDeviceInfo.d.ts +2 -1
- package/lib-es/deviceSDK/tasks/getDeviceInfo.d.ts.map +1 -1
- package/lib-es/deviceSDK/tasks/getDeviceInfo.js +2 -2
- package/lib-es/deviceSDK/tasks/getDeviceInfo.js.map +1 -1
- package/lib-es/deviceSDK/tasks/getLatestFirmware.d.ts +1 -0
- 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/toggleOnboardingEarlyCheck.d.ts +1 -0
- package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.d.ts.map +1 -1
- package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.js +2 -2
- package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.js.map +1 -1
- package/lib-es/deviceSDK/tasks/updateFirmware.d.ts +1 -0
- package/lib-es/deviceSDK/tasks/updateFirmware.d.ts.map +1 -1
- package/lib-es/deviceSDK/tasks/updateFirmware.js +2 -2
- package/lib-es/deviceSDK/tasks/updateFirmware.js.map +1 -1
- package/lib-es/deviceSDK/transports/core.d.ts +1 -0
- package/lib-es/deviceSDK/transports/core.d.ts.map +1 -1
- package/lib-es/deviceSDK/transports/core.js +2 -2
- package/lib-es/deviceSDK/transports/core.js.map +1 -1
- package/lib-es/hw/actions/app.d.ts.map +1 -1
- package/lib-es/hw/actions/app.js +2 -1
- package/lib-es/hw/actions/app.js.map +1 -1
- package/lib-es/hw/actions/customLockScreenLoad.d.ts +1 -1
- package/lib-es/hw/actions/customLockScreenLoad.d.ts.map +1 -1
- package/lib-es/hw/actions/customLockScreenLoad.js +2 -0
- package/lib-es/hw/actions/customLockScreenLoad.js.map +1 -1
- package/lib-es/hw/actions/implementations.d.ts +1 -0
- package/lib-es/hw/actions/implementations.d.ts.map +1 -1
- package/lib-es/hw/actions/implementations.js +12 -2
- package/lib-es/hw/actions/implementations.js.map +1 -1
- package/lib-es/hw/connectApp.d.ts +2 -1
- package/lib-es/hw/connectApp.d.ts.map +1 -1
- package/lib-es/hw/connectApp.js +4 -4
- package/lib-es/hw/connectApp.js.map +1 -1
- package/lib-es/hw/connectManager.d.ts +2 -1
- package/lib-es/hw/connectManager.d.ts.map +1 -1
- package/lib-es/hw/connectManager.js +4 -4
- package/lib-es/hw/connectManager.js.map +1 -1
- package/lib-es/hw/customLockScreenFetch.d.ts +2 -1
- package/lib-es/hw/customLockScreenFetch.d.ts.map +1 -1
- package/lib-es/hw/customLockScreenFetch.js +2 -2
- package/lib-es/hw/customLockScreenFetch.js.map +1 -1
- package/lib-es/hw/customLockScreenLoad.d.ts +2 -1
- package/lib-es/hw/customLockScreenLoad.d.ts.map +1 -1
- package/lib-es/hw/customLockScreenLoad.js +2 -2
- package/lib-es/hw/customLockScreenLoad.js.map +1 -1
- package/lib-es/hw/deviceAccess.d.ts +3 -3
- package/lib-es/hw/deviceAccess.d.ts.map +1 -1
- package/lib-es/hw/deviceAccess.js +2 -1
- package/lib-es/hw/deviceAccess.js.map +1 -1
- package/lib-es/hw/getGenuineCheckFromDeviceId.d.ts +2 -1
- package/lib-es/hw/getGenuineCheckFromDeviceId.d.ts.map +1 -1
- package/lib-es/hw/getGenuineCheckFromDeviceId.js +2 -2
- package/lib-es/hw/getGenuineCheckFromDeviceId.js.map +1 -1
- package/lib-es/hw/getOnboardingStatePolling.d.ts +2 -1
- package/lib-es/hw/getOnboardingStatePolling.d.ts.map +1 -1
- package/lib-es/hw/getOnboardingStatePolling.js +5 -2
- package/lib-es/hw/getOnboardingStatePolling.js.map +1 -1
- package/lib-es/hw/hooks/useGenuineCheck.d.ts +2 -1
- package/lib-es/hw/hooks/useGenuineCheck.d.ts.map +1 -1
- package/lib-es/hw/hooks/useGenuineCheck.js +3 -1
- package/lib-es/hw/hooks/useGenuineCheck.js.map +1 -1
- package/lib-es/hw/index.d.ts +6 -2
- package/lib-es/hw/index.d.ts.map +1 -1
- package/lib-es/hw/index.js +6 -6
- package/lib-es/hw/index.js.map +1 -1
- package/lib-es/hw/installLanguage.d.ts +2 -1
- package/lib-es/hw/installLanguage.d.ts.map +1 -1
- package/lib-es/hw/installLanguage.js +2 -2
- package/lib-es/hw/installLanguage.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +2 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.d.ts +1 -5
- 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 +1 -2
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- package/lib-es/modularDrawer/utils/type.d.ts +0 -5
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib-es/onboarding/hooks/useOnboardingStatePolling.d.ts.map +1 -1
- package/lib-es/onboarding/hooks/useOnboardingStatePolling.js +1 -0
- package/lib-es/onboarding/hooks/useOnboardingStatePolling.js.map +1 -1
- package/lib-es/platform/filters.d.ts +1 -2
- package/lib-es/platform/filters.d.ts.map +1 -1
- package/lib-es/platform/filters.js +0 -15
- package/lib-es/platform/filters.js.map +1 -1
- package/lib-es/platform/helpers.d.ts +1 -5
- package/lib-es/platform/helpers.d.ts.map +1 -1
- package/lib-es/platform/helpers.js +1 -30
- package/lib-es/platform/helpers.js.map +1 -1
- package/lib-es/platform/react.d.ts +2 -3
- package/lib-es/platform/react.d.ts.map +1 -1
- package/lib-es/platform/react.js +67 -16
- 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/utils/getAccountTuplesForCurrency.d.ts +1 -1
- package/lib-es/utils/getAccountTuplesForCurrency.d.ts.map +1 -1
- package/lib-es/utils/getAccountTuplesForCurrency.js +2 -3
- 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 +5 -4
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/wallet-api/converters.d.ts +1 -0
- package/lib-es/wallet-api/converters.d.ts.map +1 -1
- package/lib-es/wallet-api/converters.js +5 -1
- package/lib-es/wallet-api/converters.js.map +1 -1
- package/lib-es/wallet-api/react.d.ts +6 -11
- package/lib-es/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +289 -131
- package/lib-es/wallet-api/react.js.map +1 -1
- package/lib-es/wallet-api/tracking.d.ts +6 -0
- package/lib-es/wallet-api/tracking.d.ts.map +1 -1
- package/lib-es/wallet-api/tracking.js +20 -0
- package/lib-es/wallet-api/tracking.js.map +1 -1
- package/lib-es/wallet-api/useDappLogic.d.ts.map +1 -1
- package/lib-es/wallet-api/useDappLogic.js +62 -77
- package/lib-es/wallet-api/useDappLogic.js.map +1 -1
- package/package.json +55 -55
- package/src/currencies/helpers.ts +1 -42
- package/src/dada-client/hooks/useAssetsData.ts +1 -0
- package/src/deviceSDK/actions/getBatteryStatuses.ts +3 -1
- package/src/deviceSDK/actions/getDeviceInfo.ts +3 -2
- package/src/deviceSDK/actions/getLatestAvailableFirmware.test.ts +31 -0
- package/src/deviceSDK/actions/getLatestAvailableFirmware.ts +7 -2
- package/src/deviceSDK/actions/toggleOnboardingEarlyCheck.ts +3 -1
- package/src/deviceSDK/actions/updateFirmware.ts +5 -2
- package/src/deviceSDK/hooks/useBatteryStatuses.test.ts +3 -1
- package/src/deviceSDK/hooks/useBatteryStatuses.ts +4 -1
- package/src/deviceSDK/hooks/useGetDeviceInfo.ts +4 -2
- package/src/deviceSDK/hooks/useGetLatestAvailableFirmware.ts +3 -0
- package/src/deviceSDK/hooks/useToggleOnboardingEarlyChecks.test.ts +2 -0
- package/src/deviceSDK/hooks/useToggleOnboardingEarlyChecks.ts +4 -1
- package/src/deviceSDK/hooks/useUpdateFirmware.ts +4 -1
- package/src/deviceSDK/tasks/getBatteryStatuses.ts +6 -1
- package/src/deviceSDK/tasks/getDeviceInfo.ts +6 -2
- package/src/deviceSDK/tasks/getLatestFirmware.ts +6 -1
- package/src/deviceSDK/tasks/toggleOnboardingEarlyCheck.test.ts +3 -0
- package/src/deviceSDK/tasks/toggleOnboardingEarlyCheck.ts +6 -1
- package/src/deviceSDK/tasks/updateFirmware.ts +6 -1
- package/src/deviceSDK/transports/core.ts +6 -3
- package/src/hw/actions/app.ts +2 -1
- package/src/hw/actions/customLockScreenLoad.ts +6 -2
- package/src/hw/actions/implementations.ts +17 -3
- package/src/hw/connectApp.ts +12 -5
- package/src/hw/connectManager.ts +13 -6
- package/src/hw/customLockScreenFetch.ts +10 -2
- package/src/hw/customLockScreenLoad.test.ts +28 -3
- package/src/hw/customLockScreenLoad.ts +10 -2
- package/src/hw/deviceAccess.ts +4 -3
- package/src/hw/getGenuineCheckFromDeviceId.test.ts +4 -0
- package/src/hw/getGenuineCheckFromDeviceId.ts +6 -1
- package/src/hw/getOnboardingStatePolling.test.ts +34 -0
- package/src/hw/getOnboardingStatePolling.ts +6 -3
- package/src/hw/hooks/useGenuineCheck.test.ts +37 -0
- package/src/hw/hooks/useGenuineCheck.ts +4 -0
- package/src/hw/index.test.ts +27 -6
- package/src/hw/index.ts +15 -8
- package/src/hw/installLanguage.ts +6 -1
- package/src/modularDrawer/hooks/__test__/useAssetAccountCounts.test.ts +0 -5
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +2 -0
- package/src/modularDrawer/hooks/useNetworkAccountCounts.tsx +1 -6
- package/src/modularDrawer/modules/createNetworkConfiguration.ts +1 -2
- package/src/modularDrawer/utils/type.ts +0 -5
- package/src/onboarding/hooks/useOnboardingStatePolling.ts +1 -0
- package/src/platform/filters.ts +1 -23
- package/src/platform/helpers.ts +2 -49
- package/src/platform/react.ts +86 -22
- package/src/platform/types.ts +1 -1
- package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +0 -30
- package/src/utils/getAccountTuplesForCurrency.ts +1 -6
- package/src/wallet-api/Exchange/server.test.ts +0 -5
- package/src/wallet-api/Exchange/server.ts +7 -6
- package/src/wallet-api/converters.ts +6 -1
- package/src/wallet-api/react.ts +310 -137
- package/src/wallet-api/tracking.ts +22 -0
- package/src/wallet-api/useDappLogic.ts +91 -106
- package/src/currencies/helpers.test.ts +0 -20
package/src/wallet-api/react.ts
CHANGED
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
import { useMemo, useState, useEffect, useRef, useCallback, RefObject } from "react";
|
|
2
|
+
import { useDispatch } from "react-redux";
|
|
2
3
|
import semver from "semver";
|
|
3
4
|
import { intervalToDuration } from "date-fns";
|
|
4
|
-
|
|
5
5
|
import { Account, AccountLike, AnyMessage, Operation, SignedOperation } from "@ledgerhq/types-live";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import {
|
|
7
|
+
WalletHandlers,
|
|
8
|
+
ServerConfig,
|
|
9
|
+
WalletAPIServer,
|
|
10
|
+
useWalletAPIServer as useWalletAPIServerRaw,
|
|
11
|
+
} from "@ledgerhq/wallet-api-server";
|
|
9
12
|
import { Transport, Permission } from "@ledgerhq/wallet-api-core";
|
|
10
|
-
import { StateDB } from "../hooks/useDBRaw";
|
|
11
|
-
import { Observable, firstValueFrom, Subject } from "rxjs";
|
|
12
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
|
+
import { StateDB } from "../hooks/useDBRaw";
|
|
13
26
|
import {
|
|
14
27
|
accountToWalletAPIAccount,
|
|
15
28
|
currencyToWalletAPICurrency,
|
|
16
|
-
|
|
29
|
+
setWalletApiIdForAccountId,
|
|
17
30
|
} from "./converters";
|
|
18
31
|
import { isWalletAPISupportedCurrency } from "./helpers";
|
|
19
32
|
import { WalletAPICurrency, AppManifest, WalletAPIAccount, WalletAPICustomHandlers } from "./types";
|
|
20
|
-
|
|
21
33
|
import { getMainAccount, getParentAccount } from "../account";
|
|
22
|
-
import {
|
|
23
|
-
import { getCryptoAssetsStore } from "../bridge/crypto-assets
|
|
34
|
+
import { listSupportedCurrencies } from "../currencies";
|
|
35
|
+
import { getCryptoAssetsStore } from "../bridge/crypto-assets";
|
|
24
36
|
import { TrackingAPI } from "./tracking";
|
|
25
37
|
import {
|
|
26
38
|
bitcoinFamilyAccountGetXPubLogic,
|
|
@@ -37,10 +49,8 @@ import {
|
|
|
37
49
|
signRawTransactionLogic,
|
|
38
50
|
} from "./logic";
|
|
39
51
|
import { getAccountBridge } from "../bridge";
|
|
40
|
-
import { getEnv } from "@ledgerhq/live-env";
|
|
41
52
|
import openTransportAsSubject, { BidirectionalEvent } from "../hw/openTransportAsSubject";
|
|
42
53
|
import { AppResult } from "../hw/actions/app";
|
|
43
|
-
import { UserRefusedOnDevice } from "@ledgerhq/errors";
|
|
44
54
|
import { Transaction } from "../generated/types";
|
|
45
55
|
import {
|
|
46
56
|
DISCOVER_INITIAL_CATEGORY,
|
|
@@ -49,8 +59,8 @@ import {
|
|
|
49
59
|
} from "./constants";
|
|
50
60
|
import { DiscoverDB } from "./types";
|
|
51
61
|
import { LiveAppManifest } from "../platform/types";
|
|
52
|
-
import { WalletState } from "@ledgerhq/live-wallet/store";
|
|
53
62
|
import { ModularDrawerConfiguration } from "./ModularDrawer/types";
|
|
63
|
+
import { useCurrenciesUnderFeatureFlag } from "../modularDrawer/hooks/useCurrenciesUnderFeatureFlag";
|
|
54
64
|
|
|
55
65
|
export function safeGetRefValue<T>(ref: RefObject<T>): NonNullable<T> {
|
|
56
66
|
if (!ref.current) {
|
|
@@ -59,75 +69,27 @@ export function safeGetRefValue<T>(ref: RefObject<T>): NonNullable<T> {
|
|
|
59
69
|
return ref.current;
|
|
60
70
|
}
|
|
61
71
|
|
|
62
|
-
export function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)
|
|
66
|
-
return useMemo(() => {
|
|
67
|
-
return accounts.map(account => {
|
|
68
|
-
const parentAccount = getParentAccount(account, accounts);
|
|
69
|
-
|
|
70
|
-
return accountToWalletAPIAccount(walletState, account, parentAccount);
|
|
72
|
+
export function useSetWalletAPIAccounts(accounts: AccountLike[]): void {
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
accounts.forEach(account => {
|
|
75
|
+
setWalletApiIdForAccountId(account.id);
|
|
71
76
|
});
|
|
72
|
-
}, [
|
|
77
|
+
}, [accounts]);
|
|
73
78
|
}
|
|
74
79
|
|
|
75
|
-
export function
|
|
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) {
|
|
80
|
+
export function useDAppManifestCurrencyIds(manifest: AppManifest) {
|
|
87
81
|
return useMemo(() => {
|
|
88
82
|
return (
|
|
89
83
|
manifest.dapp?.networks.map(network => {
|
|
90
|
-
return
|
|
84
|
+
return network.currency;
|
|
91
85
|
}) ?? []
|
|
92
86
|
);
|
|
93
87
|
}, [manifest.dapp?.networks]);
|
|
94
88
|
}
|
|
95
89
|
|
|
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
|
-
|
|
127
90
|
export interface UiHook {
|
|
128
91
|
"account.request": (params: {
|
|
129
|
-
|
|
130
|
-
currencies: CryptoOrTokenCurrency[];
|
|
92
|
+
currencyIds?: string[];
|
|
131
93
|
areCurrenciesFiltered?: boolean;
|
|
132
94
|
useCase?: string;
|
|
133
95
|
drawerConfiguration?: ModularDrawerConfiguration;
|
|
@@ -200,11 +162,10 @@ export interface UiHook {
|
|
|
200
162
|
}) => void;
|
|
201
163
|
}
|
|
202
164
|
|
|
203
|
-
export function usePermission(manifest: AppManifest): Permission {
|
|
165
|
+
export function usePermission(manifest: AppManifest): Omit<Permission, "currencyIds"> {
|
|
204
166
|
return useMemo(
|
|
205
167
|
() => ({
|
|
206
|
-
|
|
207
|
-
methodIds: manifest.permissions as unknown as string[], // TODO remove when using the correct manifest type
|
|
168
|
+
methodIds: manifest.permissions,
|
|
208
169
|
}),
|
|
209
170
|
[manifest],
|
|
210
171
|
);
|
|
@@ -234,7 +195,7 @@ export function useConfig({
|
|
|
234
195
|
wallet,
|
|
235
196
|
mevProtected,
|
|
236
197
|
}),
|
|
237
|
-
[appId, tracking, userId, wallet],
|
|
198
|
+
[appId, mevProtected, tracking, userId, wallet],
|
|
238
199
|
);
|
|
239
200
|
}
|
|
240
201
|
|
|
@@ -342,18 +303,19 @@ export function useWalletAPIServer({
|
|
|
342
303
|
onLoadError: () => void;
|
|
343
304
|
widgetLoaded: boolean;
|
|
344
305
|
} {
|
|
306
|
+
const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();
|
|
307
|
+
const { deactivatedCurrencyIds } = useCurrenciesUnderFeatureFlag();
|
|
345
308
|
const permission = usePermission(manifest);
|
|
346
309
|
const transport = useTransport(webviewHook.postMessage);
|
|
347
310
|
const [widgetLoaded, setWidgetLoaded] = useState(false);
|
|
348
311
|
|
|
349
|
-
|
|
350
|
-
|
|
312
|
+
// We need to set the wallet API account IDs mapping upfront
|
|
313
|
+
// If we don't want the map to be empty when requesting an account
|
|
314
|
+
useSetWalletAPIAccounts(accounts);
|
|
351
315
|
|
|
352
316
|
const { server, onMessage } = useWalletAPIServerRaw({
|
|
353
317
|
transport,
|
|
354
318
|
config,
|
|
355
|
-
accounts: walletAPIAccounts,
|
|
356
|
-
currencies: walletAPICurrencies,
|
|
357
319
|
permission,
|
|
358
320
|
customHandlers,
|
|
359
321
|
});
|
|
@@ -362,52 +324,257 @@ export function useWalletAPIServer({
|
|
|
362
324
|
tracking.load(manifest);
|
|
363
325
|
}, [tracking, manifest]);
|
|
364
326
|
|
|
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
|
+
} else if (id.includes("/")) {
|
|
374
|
+
// Specific token ID like "ethereum/erc20/usd__coin"
|
|
375
|
+
specificTokenIds.add(id);
|
|
376
|
+
} else {
|
|
377
|
+
// Specific currency like "bitcoin" or "ethereum"
|
|
378
|
+
specificCurrencies.add(id);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// 4. Gather all supported parent currencies
|
|
383
|
+
const allCurrencies = listSupportedCurrencies().reduce<WalletAPICurrency[]>((acc, c) => {
|
|
384
|
+
if (isWalletAPISupportedCurrency(c) && !deactivatedCurrencyIds.has(c.id))
|
|
385
|
+
acc.push(currencyToWalletAPICurrency(c));
|
|
386
|
+
return acc;
|
|
387
|
+
}, []);
|
|
388
|
+
|
|
389
|
+
// 5. Determine which currencies to include based on patterns
|
|
390
|
+
let includedCurrencies: WalletAPICurrency[] = [];
|
|
391
|
+
if (includeAllCurrencies) {
|
|
392
|
+
includedCurrencies = allCurrencies;
|
|
393
|
+
} else {
|
|
394
|
+
includedCurrencies = allCurrencies.filter(c => specificCurrencies.has(c.id));
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// 6. Fetch specific tokens by ID if any
|
|
398
|
+
const specificTokens: WalletAPICurrency[] = [];
|
|
399
|
+
if (specificTokenIds.size > 0) {
|
|
400
|
+
const tokenPromises = [...specificTokenIds].map(async tokenId => {
|
|
401
|
+
const token = await getCryptoAssetsStore().findTokenById(tokenId);
|
|
402
|
+
return token ? currencyToWalletAPICurrency(token) : null;
|
|
403
|
+
});
|
|
404
|
+
const resolvedTokens = await Promise.all(tokenPromises);
|
|
405
|
+
specificTokens.push(...resolvedTokens.filter((t): t is WalletAPICurrency => t !== null));
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// 7. Determine which token families to fetch (only if not already fetched as specific tokens)
|
|
409
|
+
const familiesToFetch = new Set<string>();
|
|
410
|
+
if (includeAllCurrencies) {
|
|
411
|
+
// Fetch tokens for all currency families
|
|
412
|
+
allCurrencies.forEach(c => {
|
|
413
|
+
if (c.type === "CryptoCurrency") familiesToFetch.add(c.family);
|
|
414
|
+
});
|
|
415
|
+
} else if (tokenFamilies.size > 0) {
|
|
416
|
+
// Only fetch tokens for families explicitly marked with /**
|
|
417
|
+
tokenFamilies.forEach(family => familiesToFetch.add(family));
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// 8. Fetch tokens for relevant families
|
|
421
|
+
const fetchAllPagesForFamily = async (family: string) => {
|
|
422
|
+
const args = { networkFamily: family, pageSize: 1000 };
|
|
423
|
+
let hasNextPage = true;
|
|
424
|
+
let data: InfiniteData<TokensDataWithPagination, PageParam> | undefined;
|
|
425
|
+
|
|
426
|
+
while (hasNextPage) {
|
|
427
|
+
const querySub = dispatch(
|
|
428
|
+
calEndpoints.getTokensData.initiate(
|
|
429
|
+
args,
|
|
430
|
+
data ? { direction: "forward" } : undefined,
|
|
431
|
+
),
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
try {
|
|
435
|
+
const result = await querySub;
|
|
436
|
+
data = result.data;
|
|
437
|
+
hasNextPage = result.hasNextPage;
|
|
438
|
+
if (result.error) throw result.error;
|
|
439
|
+
} finally {
|
|
440
|
+
querySub.unsubscribe();
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
return (data?.pages ?? []).flatMap(p => p.tokens);
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
const tokensByFamily = await Promise.all(
|
|
448
|
+
[...familiesToFetch].map(f => fetchAllPagesForFamily(f)),
|
|
449
|
+
);
|
|
450
|
+
|
|
451
|
+
// 9. Combine all results (no additional filter needed since we pre-filtered)
|
|
452
|
+
const result = tokensByFamily.reduce<WalletAPICurrency[]>(
|
|
453
|
+
(acc, tokens) => [...acc, ...tokens.map(t => currencyToWalletAPICurrency(t))],
|
|
454
|
+
[...includedCurrencies, ...specificTokens],
|
|
455
|
+
);
|
|
456
|
+
|
|
457
|
+
tracking.currencyListSuccess(manifest);
|
|
458
|
+
return result;
|
|
459
|
+
} catch (err) {
|
|
460
|
+
tracking.currencyListFail(manifest);
|
|
461
|
+
throw err;
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
}, [walletState, manifest, server, tracking, dispatch, deactivatedCurrencyIds]);
|
|
465
|
+
|
|
466
|
+
useEffect(() => {
|
|
467
|
+
server.setHandler("account.list", ({ currencyIds }) => {
|
|
468
|
+
tracking.accountListRequested(manifest);
|
|
469
|
+
|
|
470
|
+
try {
|
|
471
|
+
// 1. Parse manifest currency patterns to determine what to include
|
|
472
|
+
const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
|
|
473
|
+
|
|
474
|
+
// 2. Apply query filter early - intersect with manifest patterns
|
|
475
|
+
const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
|
|
476
|
+
let effectiveCurrencyIds = manifestCurrencyIds;
|
|
477
|
+
|
|
478
|
+
if (queryCurrencyIdsSet) {
|
|
479
|
+
// If we have a query filter, narrow down what we need to check
|
|
480
|
+
effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
|
|
481
|
+
if (manifestId === "**") {
|
|
482
|
+
// Query can ask for anything, so use the query list
|
|
483
|
+
return [...queryCurrencyIdsSet];
|
|
484
|
+
} else if (manifestId.endsWith("/**")) {
|
|
485
|
+
// Pattern like "ethereum/**" - keep tokens from query that match this family
|
|
486
|
+
const family = manifestId.slice(0, -3);
|
|
487
|
+
return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
|
|
488
|
+
} else if (queryCurrencyIdsSet.has(manifestId)) {
|
|
489
|
+
// Specific currency/token that's in the query
|
|
490
|
+
return [manifestId];
|
|
491
|
+
}
|
|
492
|
+
// Not in query, skip it
|
|
493
|
+
return [];
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// 3. Build a set of allowed currency IDs based on effective patterns
|
|
498
|
+
const allowedCurrencyIds = new Set<string>();
|
|
499
|
+
const includeAllCurrencies = effectiveCurrencyIds.includes("**");
|
|
500
|
+
const tokenFamilyPrefixes = new Set<string>();
|
|
501
|
+
|
|
502
|
+
for (const id of effectiveCurrencyIds) {
|
|
503
|
+
if (id === "**") {
|
|
504
|
+
// Will match all currencies
|
|
505
|
+
continue;
|
|
506
|
+
} else if (id.endsWith("/**")) {
|
|
507
|
+
// Pattern like "ethereum/**" - store prefix for matching
|
|
508
|
+
const family = id.slice(0, -3);
|
|
509
|
+
tokenFamilyPrefixes.add(family);
|
|
510
|
+
} else {
|
|
511
|
+
// Specific currency/token ID
|
|
512
|
+
allowedCurrencyIds.add(id);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// 4. Filter accounts based on effective currency IDs
|
|
517
|
+
const wapiAccounts = accounts.reduce<WalletAPIAccount[]>((acc, account) => {
|
|
518
|
+
const parentAccount = getParentAccount(account, accounts);
|
|
519
|
+
const accountCurrencyId =
|
|
520
|
+
account.type === "TokenAccount" ? account.token.id : account.currency.id;
|
|
521
|
+
const parentCurrencyId =
|
|
522
|
+
account.type === "TokenAccount" ? account.token.parentCurrency.id : account.currency.id;
|
|
523
|
+
|
|
524
|
+
// Check if account currency ID matches the effective patterns
|
|
525
|
+
const isAllowed =
|
|
526
|
+
includeAllCurrencies ||
|
|
527
|
+
allowedCurrencyIds.has(accountCurrencyId) ||
|
|
528
|
+
tokenFamilyPrefixes.has(parentCurrencyId);
|
|
529
|
+
|
|
530
|
+
if (isAllowed) {
|
|
531
|
+
acc.push(accountToWalletAPIAccount(walletState, account, parentAccount));
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return acc;
|
|
535
|
+
}, []);
|
|
536
|
+
|
|
537
|
+
tracking.accountListSuccess(manifest);
|
|
538
|
+
return wapiAccounts;
|
|
539
|
+
} catch (err) {
|
|
540
|
+
tracking.accountListFail(manifest);
|
|
541
|
+
throw err;
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
}, [walletState, manifest, server, tracking, uiAccountRequest, accounts]);
|
|
545
|
+
|
|
365
546
|
useEffect(() => {
|
|
366
547
|
if (!uiAccountRequest) return;
|
|
367
548
|
|
|
368
549
|
server.setHandler(
|
|
369
550
|
"account.request",
|
|
370
|
-
async ({
|
|
551
|
+
async ({ currencyIds, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
|
|
371
552
|
tracking.requestAccountRequested(manifest);
|
|
372
|
-
const currencies = await firstValueFrom(currencies$);
|
|
373
|
-
|
|
374
553
|
return new Promise((resolve, reject) => {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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
|
-
})();
|
|
554
|
+
let done = false;
|
|
555
|
+
try {
|
|
556
|
+
uiAccountRequest({
|
|
557
|
+
currencyIds,
|
|
558
|
+
drawerConfiguration,
|
|
559
|
+
areCurrenciesFiltered,
|
|
560
|
+
useCase,
|
|
561
|
+
onSuccess: (account: AccountLike, parentAccount: Account | undefined) => {
|
|
562
|
+
if (done) return;
|
|
563
|
+
done = true;
|
|
564
|
+
tracking.requestAccountSuccess(manifest);
|
|
565
|
+
resolve(accountToWalletAPIAccount(walletState, account, parentAccount));
|
|
566
|
+
},
|
|
567
|
+
onCancel: () => {
|
|
568
|
+
if (done) return;
|
|
569
|
+
done = true;
|
|
570
|
+
tracking.requestAccountFail(manifest);
|
|
571
|
+
reject(new Error("Canceled by user"));
|
|
572
|
+
},
|
|
573
|
+
});
|
|
574
|
+
} catch (error) {
|
|
575
|
+
tracking.requestAccountFail(manifest);
|
|
576
|
+
reject(error);
|
|
577
|
+
}
|
|
411
578
|
});
|
|
412
579
|
},
|
|
413
580
|
);
|
|
@@ -416,11 +583,11 @@ export function useWalletAPIServer({
|
|
|
416
583
|
useEffect(() => {
|
|
417
584
|
if (!uiAccountReceive) return;
|
|
418
585
|
|
|
419
|
-
server.setHandler("account.receive", ({
|
|
586
|
+
server.setHandler("account.receive", ({ accountId, tokenCurrency }) =>
|
|
420
587
|
receiveOnAccountLogic(
|
|
421
588
|
walletState,
|
|
422
589
|
{ manifest, accounts, tracking },
|
|
423
|
-
|
|
590
|
+
accountId,
|
|
424
591
|
(account, parentAccount, accountAddress) =>
|
|
425
592
|
new Promise((resolve, reject) => {
|
|
426
593
|
let done = false;
|
|
@@ -456,10 +623,10 @@ export function useWalletAPIServer({
|
|
|
456
623
|
useEffect(() => {
|
|
457
624
|
if (!uiMessageSign) return;
|
|
458
625
|
|
|
459
|
-
server.setHandler("message.sign", ({
|
|
626
|
+
server.setHandler("message.sign", ({ accountId, message, options }) =>
|
|
460
627
|
signMessageLogic(
|
|
461
628
|
{ manifest, accounts, tracking },
|
|
462
|
-
|
|
629
|
+
accountId,
|
|
463
630
|
message.toString("hex"),
|
|
464
631
|
(account: AccountLike, message: AnyMessage) =>
|
|
465
632
|
new Promise((resolve, reject) => {
|
|
@@ -513,13 +680,18 @@ export function useWalletAPIServer({
|
|
|
513
680
|
|
|
514
681
|
server.setHandler(
|
|
515
682
|
"transaction.sign",
|
|
516
|
-
async ({
|
|
683
|
+
async ({ accountId, tokenCurrency, transaction, options }) => {
|
|
684
|
+
let currency: string | undefined;
|
|
517
685
|
const signedOperation = await signTransactionLogic(
|
|
518
686
|
{ manifest, accounts, tracking },
|
|
519
|
-
|
|
687
|
+
accountId,
|
|
520
688
|
transaction,
|
|
521
|
-
(account, parentAccount, signFlowInfos) =>
|
|
522
|
-
|
|
689
|
+
(account, parentAccount, signFlowInfos) => {
|
|
690
|
+
currency =
|
|
691
|
+
account.type === "TokenAccount"
|
|
692
|
+
? account.token.parentCurrency.id
|
|
693
|
+
: account.currency.id;
|
|
694
|
+
return new Promise((resolve, reject) => {
|
|
523
695
|
let done = false;
|
|
524
696
|
return uiTxSign({
|
|
525
697
|
account,
|
|
@@ -539,11 +711,12 @@ export function useWalletAPIServer({
|
|
|
539
711
|
reject(error);
|
|
540
712
|
},
|
|
541
713
|
});
|
|
542
|
-
})
|
|
714
|
+
});
|
|
715
|
+
},
|
|
543
716
|
tokenCurrency,
|
|
544
717
|
);
|
|
545
718
|
|
|
546
|
-
return
|
|
719
|
+
return currency === "solana"
|
|
547
720
|
? Buffer.from(signedOperation.signature, "hex")
|
|
548
721
|
: Buffer.from(signedOperation.signature);
|
|
549
722
|
},
|
|
@@ -555,10 +728,10 @@ export function useWalletAPIServer({
|
|
|
555
728
|
|
|
556
729
|
server.setHandler(
|
|
557
730
|
"transaction.signRaw",
|
|
558
|
-
async ({
|
|
731
|
+
async ({ accountId, transaction, broadcast, options }) => {
|
|
559
732
|
const signedOperation = await signRawTransactionLogic(
|
|
560
733
|
{ manifest, accounts, tracking },
|
|
561
|
-
|
|
734
|
+
accountId,
|
|
562
735
|
transaction,
|
|
563
736
|
(account, parentAccount, tx) =>
|
|
564
737
|
new Promise((resolve, reject) => {
|
|
@@ -588,7 +761,7 @@ export function useWalletAPIServer({
|
|
|
588
761
|
if (broadcast) {
|
|
589
762
|
hash = await broadcastTransactionLogic(
|
|
590
763
|
{ manifest, accounts, tracking },
|
|
591
|
-
|
|
764
|
+
accountId,
|
|
592
765
|
signedOperation,
|
|
593
766
|
async (account, parentAccount, signedOperation) => {
|
|
594
767
|
const bridge = getAccountBridge(account, parentAccount);
|
|
@@ -631,12 +804,12 @@ export function useWalletAPIServer({
|
|
|
631
804
|
|
|
632
805
|
server.setHandler(
|
|
633
806
|
"transaction.signAndBroadcast",
|
|
634
|
-
async ({
|
|
807
|
+
async ({ accountId, tokenCurrency, transaction, options }) => {
|
|
635
808
|
const sponsored = transaction.family === "ethereum" && transaction.sponsored;
|
|
636
809
|
|
|
637
810
|
const signedTransaction = await signTransactionLogic(
|
|
638
811
|
{ manifest, accounts, tracking },
|
|
639
|
-
|
|
812
|
+
accountId,
|
|
640
813
|
transaction,
|
|
641
814
|
(account, parentAccount, signFlowInfos) =>
|
|
642
815
|
new Promise((resolve, reject) => {
|
|
@@ -665,7 +838,7 @@ export function useWalletAPIServer({
|
|
|
665
838
|
|
|
666
839
|
return broadcastTransactionLogic(
|
|
667
840
|
{ manifest, accounts, tracking },
|
|
668
|
-
|
|
841
|
+
accountId,
|
|
669
842
|
signedTransaction,
|
|
670
843
|
async (account, parentAccount, signedOperation) => {
|
|
671
844
|
const bridge = getAccountBridge(account, parentAccount);
|
|
@@ -929,8 +1102,8 @@ export function useWalletAPIServer({
|
|
|
929
1102
|
// retrofit of the exchange params to fit the old platform spec
|
|
930
1103
|
const request: CompleteExchangeRequest = {
|
|
931
1104
|
provider: params.provider,
|
|
932
|
-
fromAccountId: params.
|
|
933
|
-
toAccountId: params.exchangeType === "SWAP" ? params.
|
|
1105
|
+
fromAccountId: params.fromAccountId,
|
|
1106
|
+
toAccountId: params.exchangeType === "SWAP" ? params.toAccountId : undefined,
|
|
934
1107
|
transaction: params.transaction,
|
|
935
1108
|
binaryPayload: params.binaryPayload.toString("hex"),
|
|
936
1109
|
signature: params.signature.toString("hex"),
|
|
@@ -968,7 +1141,7 @@ export function useWalletAPIServer({
|
|
|
968
1141
|
}, [uiExchangeComplete, accounts, manifest, server, tracking]);
|
|
969
1142
|
|
|
970
1143
|
return {
|
|
971
|
-
widgetLoaded,
|
|
1144
|
+
widgetLoaded: widgetLoaded,
|
|
972
1145
|
onMessage,
|
|
973
1146
|
onLoad,
|
|
974
1147
|
onReload,
|
|
@@ -1171,9 +1344,9 @@ export function useRecentlyUsed(
|
|
|
1171
1344
|
...res,
|
|
1172
1345
|
usedAt: calculateTimeDiff(recentlyUsed.usedAt),
|
|
1173
1346
|
}
|
|
1174
|
-
:
|
|
1347
|
+
: undefined;
|
|
1175
1348
|
})
|
|
1176
|
-
.filter(manifest => manifest !== undefined)
|
|
1349
|
+
.filter((manifest): manifest is RecentlyUsedManifest => manifest !== undefined),
|
|
1177
1350
|
[recentlyUsedManifestsDb, manifests],
|
|
1178
1351
|
);
|
|
1179
1352
|
const append = useCallback(
|
|
@@ -241,6 +241,28 @@ 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
|
+
|
|
244
266
|
dappSendTransactionRequested: (manifest: AppManifest, trackingData: DAppTrackingData) => {
|
|
245
267
|
track("dApp SendTransaction requested", { ...getEventData(manifest), ...trackingData });
|
|
246
268
|
},
|