@ledgerhq/live-common 34.53.0-nightly.20251114023758 → 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/__tests__/test-helpers/environment.js +2 -0
- package/lib/__tests__/test-helpers/environment.js.map +1 -1
- 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/e2e/index.d.ts +6 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/families/evm/config.d.ts.map +1 -1
- package/lib/families/evm/config.js +33 -0
- package/lib/families/evm/config.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts +2 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +2 -0
- package/lib/featureFlags/defaultFeatures.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 +8 -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/__tests__/test-helpers/environment.js +2 -0
- package/lib-es/__tests__/test-helpers/environment.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/e2e/index.d.ts +6 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/families/evm/config.d.ts.map +1 -1
- package/lib-es/families/evm/config.js +33 -0
- package/lib-es/families/evm/config.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts +2 -0
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +2 -0
- package/lib-es/featureFlags/defaultFeatures.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 +8 -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 +59 -59
- package/src/__tests__/migration/account-migration.ts +2 -0
- package/src/__tests__/test-helpers/environment.ts +2 -0
- 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/families/evm/config.ts +33 -0
- package/src/featureFlags/defaultFeatures.ts +2 -0
- 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 +8 -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
|
@@ -1,78 +1,45 @@
|
|
|
1
1
|
import { useMemo, useState, useEffect, useRef, useCallback } from "react";
|
|
2
|
+
import { useDispatch } from "react-redux";
|
|
2
3
|
import semver from "semver";
|
|
3
4
|
import { intervalToDuration } from "date-fns";
|
|
4
|
-
import { useWalletAPIServer as useWalletAPIServerRaw } from "@ledgerhq/wallet-api-server
|
|
5
|
-
import { firstValueFrom } from "rxjs";
|
|
5
|
+
import { useWalletAPIServer as useWalletAPIServerRaw, } from "@ledgerhq/wallet-api-server";
|
|
6
6
|
import { first } from "rxjs/operators";
|
|
7
|
-
import {
|
|
7
|
+
import { getEnv } from "@ledgerhq/live-env";
|
|
8
|
+
import { UserRefusedOnDevice } from "@ledgerhq/errors";
|
|
9
|
+
import { endpoints as calEndpoints } from "@ledgerhq/cryptoassets/cal-client/state-manager/api";
|
|
10
|
+
import { accountToWalletAPIAccount, currencyToWalletAPICurrency, setWalletApiIdForAccountId, } from "./converters";
|
|
8
11
|
import { isWalletAPISupportedCurrency } from "./helpers";
|
|
9
12
|
import { getMainAccount, getParentAccount } from "../account";
|
|
10
|
-
import {
|
|
11
|
-
import { getCryptoAssetsStore } from "../bridge/crypto-assets
|
|
13
|
+
import { listSupportedCurrencies } from "../currencies";
|
|
14
|
+
import { getCryptoAssetsStore } from "../bridge/crypto-assets";
|
|
12
15
|
import { bitcoinFamilyAccountGetXPubLogic, broadcastTransactionLogic, startExchangeLogic, completeExchangeLogic, receiveOnAccountLogic, signMessageLogic, signTransactionLogic, bitcoinFamilyAccountGetAddressLogic, bitcoinFamilyAccountGetPublicKeyLogic, signRawTransactionLogic, } from "./logic";
|
|
13
16
|
import { getAccountBridge } from "../bridge";
|
|
14
|
-
import { getEnv } from "@ledgerhq/live-env";
|
|
15
17
|
import openTransportAsSubject from "../hw/openTransportAsSubject";
|
|
16
|
-
import { UserRefusedOnDevice } from "@ledgerhq/errors";
|
|
17
18
|
import { DISCOVER_INITIAL_CATEGORY, INITIAL_PLATFORM_STATE, MAX_RECENTLY_USED_LENGTH, } from "./constants";
|
|
19
|
+
import { useCurrenciesUnderFeatureFlag } from "../modularDrawer/hooks/useCurrenciesUnderFeatureFlag";
|
|
18
20
|
export function safeGetRefValue(ref) {
|
|
19
21
|
if (!ref.current) {
|
|
20
22
|
throw new Error("Ref objects doesn't have a current value");
|
|
21
23
|
}
|
|
22
24
|
return ref.current;
|
|
23
25
|
}
|
|
24
|
-
export function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return accountToWalletAPIAccount(walletState, account, parentAccount);
|
|
26
|
+
export function useSetWalletAPIAccounts(accounts) {
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
accounts.forEach(account => {
|
|
29
|
+
setWalletApiIdForAccountId(account.id);
|
|
29
30
|
});
|
|
30
|
-
}, [
|
|
31
|
+
}, [accounts]);
|
|
31
32
|
}
|
|
32
|
-
export function
|
|
33
|
-
return useMemo(() => {
|
|
34
|
-
return listCurrencies(true).reduce((filtered, currency) => {
|
|
35
|
-
if (isWalletAPISupportedCurrency(currency)) {
|
|
36
|
-
filtered.push(currencyToWalletAPICurrency(currency));
|
|
37
|
-
}
|
|
38
|
-
return filtered;
|
|
39
|
-
}, []);
|
|
40
|
-
}, []);
|
|
41
|
-
}
|
|
42
|
-
export function useManifestCurrencies(manifest) {
|
|
33
|
+
export function useDAppManifestCurrencyIds(manifest) {
|
|
43
34
|
return useMemo(() => {
|
|
44
35
|
return (manifest.dapp?.networks.map(network => {
|
|
45
|
-
return
|
|
36
|
+
return network.currency;
|
|
46
37
|
}) ?? []);
|
|
47
38
|
}, [manifest.dapp?.networks]);
|
|
48
39
|
}
|
|
49
|
-
export function useGetAccountIds(accounts$) {
|
|
50
|
-
const [accounts, setAccounts] = useState([]);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (!accounts$) {
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
const subscription = accounts$.subscribe(walletAccounts => {
|
|
56
|
-
setAccounts(walletAccounts);
|
|
57
|
-
});
|
|
58
|
-
return () => {
|
|
59
|
-
subscription.unsubscribe();
|
|
60
|
-
};
|
|
61
|
-
}, [accounts$]);
|
|
62
|
-
return useMemo(() => {
|
|
63
|
-
if (!accounts$) {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
return accounts.reduce((accountIds, account) => {
|
|
67
|
-
accountIds.set(getAccountIdFromWalletAccountId(account.id), true);
|
|
68
|
-
return accountIds;
|
|
69
|
-
}, new Map());
|
|
70
|
-
}, [accounts, accounts$]);
|
|
71
|
-
}
|
|
72
40
|
export function usePermission(manifest) {
|
|
73
41
|
return useMemo(() => ({
|
|
74
|
-
|
|
75
|
-
methodIds: manifest.permissions, // TODO remove when using the correct manifest type
|
|
42
|
+
methodIds: manifest.permissions,
|
|
76
43
|
}), [manifest]);
|
|
77
44
|
}
|
|
78
45
|
function useTransport(postMessage) {
|
|
@@ -90,7 +57,7 @@ export function useConfig({ appId, userId, tracking, wallet, mevProtected, }) {
|
|
|
90
57
|
tracking,
|
|
91
58
|
wallet,
|
|
92
59
|
mevProtected,
|
|
93
|
-
}), [appId, tracking, userId, wallet]);
|
|
60
|
+
}), [appId, mevProtected, tracking, userId, wallet]);
|
|
94
61
|
}
|
|
95
62
|
function useDeviceTransport({ manifest, tracking }) {
|
|
96
63
|
const ref = useRef();
|
|
@@ -140,73 +107,257 @@ function useDeviceTransport({ manifest, tracking }) {
|
|
|
140
107
|
return useMemo(() => ({ ref, subscribe, close, exchange }), [close, exchange, subscribe]);
|
|
141
108
|
}
|
|
142
109
|
export function useWalletAPIServer({ walletState, manifest, accounts, tracking, config, webviewHook, uiHook: { "account.request": uiAccountRequest, "account.receive": uiAccountReceive, "message.sign": uiMessageSign, "storage.get": uiStorageGet, "storage.set": uiStorageSet, "transaction.sign": uiTxSign, "transaction.signRaw": uiTxSignRaw, "transaction.broadcast": uiTxBroadcast, "device.transport": uiDeviceTransport, "device.select": uiDeviceSelect, "exchange.start": uiExchangeStart, "exchange.complete": uiExchangeComplete, }, customHandlers, }) {
|
|
110
|
+
const dispatch = useDispatch();
|
|
111
|
+
const { deactivatedCurrencyIds } = useCurrenciesUnderFeatureFlag();
|
|
143
112
|
const permission = usePermission(manifest);
|
|
144
113
|
const transport = useTransport(webviewHook.postMessage);
|
|
145
114
|
const [widgetLoaded, setWidgetLoaded] = useState(false);
|
|
146
|
-
|
|
147
|
-
|
|
115
|
+
// We need to set the wallet API account IDs mapping upfront
|
|
116
|
+
// If we don't want the map to be empty when requesting an account
|
|
117
|
+
useSetWalletAPIAccounts(accounts);
|
|
148
118
|
const { server, onMessage } = useWalletAPIServerRaw({
|
|
149
119
|
transport,
|
|
150
120
|
config,
|
|
151
|
-
accounts: walletAPIAccounts,
|
|
152
|
-
currencies: walletAPICurrencies,
|
|
153
121
|
permission,
|
|
154
122
|
customHandlers,
|
|
155
123
|
});
|
|
156
124
|
useEffect(() => {
|
|
157
125
|
tracking.load(manifest);
|
|
158
126
|
}, [tracking, manifest]);
|
|
127
|
+
// TODO: refactor each handler into its own logic function for clarity
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
server.setHandler("currency.list", async ({ currencyIds }) => {
|
|
130
|
+
tracking.currencyListRequested(manifest);
|
|
131
|
+
try {
|
|
132
|
+
// 1. Parse manifest currency patterns to determine what to include
|
|
133
|
+
const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
|
|
134
|
+
// 2. Apply query filter early - intersect with manifest patterns
|
|
135
|
+
const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
|
|
136
|
+
let effectiveCurrencyIds = manifestCurrencyIds;
|
|
137
|
+
if (queryCurrencyIdsSet) {
|
|
138
|
+
// If we have a query filter, narrow down what we need to fetch
|
|
139
|
+
effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
|
|
140
|
+
if (manifestId === "**") {
|
|
141
|
+
// Query can ask for anything, so use the query list
|
|
142
|
+
return [...queryCurrencyIdsSet];
|
|
143
|
+
}
|
|
144
|
+
else if (manifestId.endsWith("/**")) {
|
|
145
|
+
// Pattern like "ethereum/**" - keep tokens from query that match this family
|
|
146
|
+
const family = manifestId.slice(0, -3);
|
|
147
|
+
return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
|
|
148
|
+
}
|
|
149
|
+
else if (queryCurrencyIdsSet.has(manifestId)) {
|
|
150
|
+
// Specific currency/token that's in the query
|
|
151
|
+
return [manifestId];
|
|
152
|
+
}
|
|
153
|
+
// Not in query, skip it
|
|
154
|
+
return [];
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
// 3. Parse effective currency IDs to determine what to fetch
|
|
158
|
+
const includeAllCurrencies = effectiveCurrencyIds.includes("**");
|
|
159
|
+
const specificCurrencies = new Set();
|
|
160
|
+
const tokenFamilies = new Set();
|
|
161
|
+
const specificTokenIds = new Set();
|
|
162
|
+
for (const id of effectiveCurrencyIds) {
|
|
163
|
+
if (id === "**") {
|
|
164
|
+
// Already handled above
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
else if (id.endsWith("/**")) {
|
|
168
|
+
// Pattern like "ethereum/**" or "solana/**" - include tokens for this family
|
|
169
|
+
const family = id.slice(0, -3);
|
|
170
|
+
tokenFamilies.add(family);
|
|
171
|
+
}
|
|
172
|
+
else if (id.includes("/")) {
|
|
173
|
+
// Specific token ID like "ethereum/erc20/usd__coin"
|
|
174
|
+
specificTokenIds.add(id);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
// Specific currency like "bitcoin" or "ethereum"
|
|
178
|
+
specificCurrencies.add(id);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// 4. Gather all supported parent currencies
|
|
182
|
+
const allCurrencies = listSupportedCurrencies().reduce((acc, c) => {
|
|
183
|
+
if (isWalletAPISupportedCurrency(c) && !deactivatedCurrencyIds.has(c.id))
|
|
184
|
+
acc.push(currencyToWalletAPICurrency(c));
|
|
185
|
+
return acc;
|
|
186
|
+
}, []);
|
|
187
|
+
// 5. Determine which currencies to include based on patterns
|
|
188
|
+
let includedCurrencies = [];
|
|
189
|
+
if (includeAllCurrencies) {
|
|
190
|
+
includedCurrencies = allCurrencies;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
includedCurrencies = allCurrencies.filter(c => specificCurrencies.has(c.id));
|
|
194
|
+
}
|
|
195
|
+
// 6. Fetch specific tokens by ID if any
|
|
196
|
+
const specificTokens = [];
|
|
197
|
+
if (specificTokenIds.size > 0) {
|
|
198
|
+
const tokenPromises = [...specificTokenIds].map(async (tokenId) => {
|
|
199
|
+
const token = await getCryptoAssetsStore().findTokenById(tokenId);
|
|
200
|
+
return token ? currencyToWalletAPICurrency(token) : null;
|
|
201
|
+
});
|
|
202
|
+
const resolvedTokens = await Promise.all(tokenPromises);
|
|
203
|
+
specificTokens.push(...resolvedTokens.filter((t) => t !== null));
|
|
204
|
+
}
|
|
205
|
+
// 7. Determine which token families to fetch (only if not already fetched as specific tokens)
|
|
206
|
+
const familiesToFetch = new Set();
|
|
207
|
+
if (includeAllCurrencies) {
|
|
208
|
+
// Fetch tokens for all currency families
|
|
209
|
+
allCurrencies.forEach(c => {
|
|
210
|
+
if (c.type === "CryptoCurrency")
|
|
211
|
+
familiesToFetch.add(c.family);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
else if (tokenFamilies.size > 0) {
|
|
215
|
+
// Only fetch tokens for families explicitly marked with /**
|
|
216
|
+
tokenFamilies.forEach(family => familiesToFetch.add(family));
|
|
217
|
+
}
|
|
218
|
+
// 8. Fetch tokens for relevant families
|
|
219
|
+
const fetchAllPagesForFamily = async (family) => {
|
|
220
|
+
const args = { networkFamily: family, pageSize: 1000 };
|
|
221
|
+
let hasNextPage = true;
|
|
222
|
+
let data;
|
|
223
|
+
while (hasNextPage) {
|
|
224
|
+
const querySub = dispatch(calEndpoints.getTokensData.initiate(args, data ? { direction: "forward" } : undefined));
|
|
225
|
+
try {
|
|
226
|
+
const result = await querySub;
|
|
227
|
+
data = result.data;
|
|
228
|
+
hasNextPage = result.hasNextPage;
|
|
229
|
+
if (result.error)
|
|
230
|
+
throw result.error;
|
|
231
|
+
}
|
|
232
|
+
finally {
|
|
233
|
+
querySub.unsubscribe();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return (data?.pages ?? []).flatMap(p => p.tokens);
|
|
237
|
+
};
|
|
238
|
+
const tokensByFamily = await Promise.all([...familiesToFetch].map(f => fetchAllPagesForFamily(f)));
|
|
239
|
+
// 9. Combine all results (no additional filter needed since we pre-filtered)
|
|
240
|
+
const result = tokensByFamily.reduce((acc, tokens) => [...acc, ...tokens.map(t => currencyToWalletAPICurrency(t))], [...includedCurrencies, ...specificTokens]);
|
|
241
|
+
tracking.currencyListSuccess(manifest);
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
tracking.currencyListFail(manifest);
|
|
246
|
+
throw err;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}, [walletState, manifest, server, tracking, dispatch, deactivatedCurrencyIds]);
|
|
250
|
+
useEffect(() => {
|
|
251
|
+
server.setHandler("account.list", ({ currencyIds }) => {
|
|
252
|
+
tracking.accountListRequested(manifest);
|
|
253
|
+
try {
|
|
254
|
+
// 1. Parse manifest currency patterns to determine what to include
|
|
255
|
+
const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
|
|
256
|
+
// 2. Apply query filter early - intersect with manifest patterns
|
|
257
|
+
const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
|
|
258
|
+
let effectiveCurrencyIds = manifestCurrencyIds;
|
|
259
|
+
if (queryCurrencyIdsSet) {
|
|
260
|
+
// If we have a query filter, narrow down what we need to check
|
|
261
|
+
effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
|
|
262
|
+
if (manifestId === "**") {
|
|
263
|
+
// Query can ask for anything, so use the query list
|
|
264
|
+
return [...queryCurrencyIdsSet];
|
|
265
|
+
}
|
|
266
|
+
else if (manifestId.endsWith("/**")) {
|
|
267
|
+
// Pattern like "ethereum/**" - keep tokens from query that match this family
|
|
268
|
+
const family = manifestId.slice(0, -3);
|
|
269
|
+
return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
|
|
270
|
+
}
|
|
271
|
+
else if (queryCurrencyIdsSet.has(manifestId)) {
|
|
272
|
+
// Specific currency/token that's in the query
|
|
273
|
+
return [manifestId];
|
|
274
|
+
}
|
|
275
|
+
// Not in query, skip it
|
|
276
|
+
return [];
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
// 3. Build a set of allowed currency IDs based on effective patterns
|
|
280
|
+
const allowedCurrencyIds = new Set();
|
|
281
|
+
const includeAllCurrencies = effectiveCurrencyIds.includes("**");
|
|
282
|
+
const tokenFamilyPrefixes = new Set();
|
|
283
|
+
for (const id of effectiveCurrencyIds) {
|
|
284
|
+
if (id === "**") {
|
|
285
|
+
// Will match all currencies
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
else if (id.endsWith("/**")) {
|
|
289
|
+
// Pattern like "ethereum/**" - store prefix for matching
|
|
290
|
+
const family = id.slice(0, -3);
|
|
291
|
+
tokenFamilyPrefixes.add(family);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
// Specific currency/token ID
|
|
295
|
+
allowedCurrencyIds.add(id);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
// 4. Filter accounts based on effective currency IDs
|
|
299
|
+
const wapiAccounts = accounts.reduce((acc, account) => {
|
|
300
|
+
const parentAccount = getParentAccount(account, accounts);
|
|
301
|
+
const accountCurrencyId = account.type === "TokenAccount" ? account.token.id : account.currency.id;
|
|
302
|
+
const parentCurrencyId = account.type === "TokenAccount" ? account.token.parentCurrency.id : account.currency.id;
|
|
303
|
+
// Check if account currency ID matches the effective patterns
|
|
304
|
+
const isAllowed = includeAllCurrencies ||
|
|
305
|
+
allowedCurrencyIds.has(accountCurrencyId) ||
|
|
306
|
+
tokenFamilyPrefixes.has(parentCurrencyId);
|
|
307
|
+
if (isAllowed) {
|
|
308
|
+
acc.push(accountToWalletAPIAccount(walletState, account, parentAccount));
|
|
309
|
+
}
|
|
310
|
+
return acc;
|
|
311
|
+
}, []);
|
|
312
|
+
tracking.accountListSuccess(manifest);
|
|
313
|
+
return wapiAccounts;
|
|
314
|
+
}
|
|
315
|
+
catch (err) {
|
|
316
|
+
tracking.accountListFail(manifest);
|
|
317
|
+
throw err;
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}, [walletState, manifest, server, tracking, uiAccountRequest, accounts]);
|
|
159
321
|
useEffect(() => {
|
|
160
322
|
if (!uiAccountRequest)
|
|
161
323
|
return;
|
|
162
|
-
server.setHandler("account.request", async ({
|
|
324
|
+
server.setHandler("account.request", async ({ currencyIds, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
|
|
163
325
|
tracking.requestAccountRequested(manifest);
|
|
164
|
-
const currencies = await firstValueFrom(currencies$);
|
|
165
326
|
return new Promise((resolve, reject) => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
done = true;
|
|
194
|
-
tracking.requestAccountFail(manifest);
|
|
195
|
-
reject(new Error("Canceled by user"));
|
|
196
|
-
},
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
catch (error) {
|
|
200
|
-
reject(error);
|
|
201
|
-
}
|
|
202
|
-
})();
|
|
327
|
+
let done = false;
|
|
328
|
+
try {
|
|
329
|
+
uiAccountRequest({
|
|
330
|
+
currencyIds,
|
|
331
|
+
drawerConfiguration,
|
|
332
|
+
areCurrenciesFiltered,
|
|
333
|
+
useCase,
|
|
334
|
+
onSuccess: (account, parentAccount) => {
|
|
335
|
+
if (done)
|
|
336
|
+
return;
|
|
337
|
+
done = true;
|
|
338
|
+
tracking.requestAccountSuccess(manifest);
|
|
339
|
+
resolve(accountToWalletAPIAccount(walletState, account, parentAccount));
|
|
340
|
+
},
|
|
341
|
+
onCancel: () => {
|
|
342
|
+
if (done)
|
|
343
|
+
return;
|
|
344
|
+
done = true;
|
|
345
|
+
tracking.requestAccountFail(manifest);
|
|
346
|
+
reject(new Error("Canceled by user"));
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
catch (error) {
|
|
351
|
+
tracking.requestAccountFail(manifest);
|
|
352
|
+
reject(error);
|
|
353
|
+
}
|
|
203
354
|
});
|
|
204
355
|
});
|
|
205
356
|
}, [walletState, manifest, server, tracking, uiAccountRequest]);
|
|
206
357
|
useEffect(() => {
|
|
207
358
|
if (!uiAccountReceive)
|
|
208
359
|
return;
|
|
209
|
-
server.setHandler("account.receive", ({
|
|
360
|
+
server.setHandler("account.receive", ({ accountId, tokenCurrency }) => receiveOnAccountLogic(walletState, { manifest, accounts, tracking }, accountId, (account, parentAccount, accountAddress) => new Promise((resolve, reject) => {
|
|
210
361
|
let done = false;
|
|
211
362
|
return uiAccountReceive({
|
|
212
363
|
account,
|
|
@@ -239,7 +390,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
|
|
|
239
390
|
useEffect(() => {
|
|
240
391
|
if (!uiMessageSign)
|
|
241
392
|
return;
|
|
242
|
-
server.setHandler("message.sign", ({
|
|
393
|
+
server.setHandler("message.sign", ({ accountId, message, options }) => signMessageLogic({ manifest, accounts, tracking }, accountId, message.toString("hex"), (account, message) => new Promise((resolve, reject) => {
|
|
243
394
|
let done = false;
|
|
244
395
|
return uiMessageSign({
|
|
245
396
|
account,
|
|
@@ -284,31 +435,38 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
|
|
|
284
435
|
useEffect(() => {
|
|
285
436
|
if (!uiTxSign)
|
|
286
437
|
return;
|
|
287
|
-
server.setHandler("transaction.sign", async ({
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
account
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
438
|
+
server.setHandler("transaction.sign", async ({ accountId, tokenCurrency, transaction, options }) => {
|
|
439
|
+
let currency;
|
|
440
|
+
const signedOperation = await signTransactionLogic({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, signFlowInfos) => {
|
|
441
|
+
currency =
|
|
442
|
+
account.type === "TokenAccount"
|
|
443
|
+
? account.token.parentCurrency.id
|
|
444
|
+
: account.currency.id;
|
|
445
|
+
return new Promise((resolve, reject) => {
|
|
446
|
+
let done = false;
|
|
447
|
+
return uiTxSign({
|
|
448
|
+
account,
|
|
449
|
+
parentAccount,
|
|
450
|
+
signFlowInfos,
|
|
451
|
+
options,
|
|
452
|
+
onSuccess: signedOperation => {
|
|
453
|
+
if (done)
|
|
454
|
+
return;
|
|
455
|
+
done = true;
|
|
456
|
+
tracking.signTransactionSuccess(manifest);
|
|
457
|
+
resolve(signedOperation);
|
|
458
|
+
},
|
|
459
|
+
onError: error => {
|
|
460
|
+
if (done)
|
|
461
|
+
return;
|
|
462
|
+
done = true;
|
|
463
|
+
tracking.signTransactionFail(manifest);
|
|
464
|
+
reject(error);
|
|
465
|
+
},
|
|
466
|
+
});
|
|
309
467
|
});
|
|
310
|
-
}
|
|
311
|
-
return
|
|
468
|
+
}, tokenCurrency);
|
|
469
|
+
return currency === "solana"
|
|
312
470
|
? Buffer.from(signedOperation.signature, "hex")
|
|
313
471
|
: Buffer.from(signedOperation.signature);
|
|
314
472
|
});
|
|
@@ -316,8 +474,8 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
|
|
|
316
474
|
useEffect(() => {
|
|
317
475
|
if (!uiTxSignRaw)
|
|
318
476
|
return;
|
|
319
|
-
server.setHandler("transaction.signRaw", async ({
|
|
320
|
-
const signedOperation = await signRawTransactionLogic({ manifest, accounts, tracking },
|
|
477
|
+
server.setHandler("transaction.signRaw", async ({ accountId, transaction, broadcast, options }) => {
|
|
478
|
+
const signedOperation = await signRawTransactionLogic({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, tx) => new Promise((resolve, reject) => {
|
|
321
479
|
let done = false;
|
|
322
480
|
return uiTxSignRaw({
|
|
323
481
|
account,
|
|
@@ -342,7 +500,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
|
|
|
342
500
|
}));
|
|
343
501
|
let hash;
|
|
344
502
|
if (broadcast) {
|
|
345
|
-
hash = await broadcastTransactionLogic({ manifest, accounts, tracking },
|
|
503
|
+
hash = await broadcastTransactionLogic({ manifest, accounts, tracking }, accountId, signedOperation, async (account, parentAccount, signedOperation) => {
|
|
346
504
|
const bridge = getAccountBridge(account, parentAccount);
|
|
347
505
|
const mainAccount = getMainAccount(account, parentAccount);
|
|
348
506
|
let optimisticOperation = signedOperation.operation;
|
|
@@ -374,9 +532,9 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
|
|
|
374
532
|
useEffect(() => {
|
|
375
533
|
if (!uiTxSign)
|
|
376
534
|
return;
|
|
377
|
-
server.setHandler("transaction.signAndBroadcast", async ({
|
|
535
|
+
server.setHandler("transaction.signAndBroadcast", async ({ accountId, tokenCurrency, transaction, options }) => {
|
|
378
536
|
const sponsored = transaction.family === "ethereum" && transaction.sponsored;
|
|
379
|
-
const signedTransaction = await signTransactionLogic({ manifest, accounts, tracking },
|
|
537
|
+
const signedTransaction = await signTransactionLogic({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, signFlowInfos) => new Promise((resolve, reject) => {
|
|
380
538
|
let done = false;
|
|
381
539
|
return uiTxSign({
|
|
382
540
|
account,
|
|
@@ -399,7 +557,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
|
|
|
399
557
|
},
|
|
400
558
|
});
|
|
401
559
|
}), tokenCurrency);
|
|
402
|
-
return broadcastTransactionLogic({ manifest, accounts, tracking },
|
|
560
|
+
return broadcastTransactionLogic({ manifest, accounts, tracking }, accountId, signedTransaction, async (account, parentAccount, signedOperation) => {
|
|
403
561
|
const bridge = getAccountBridge(account, parentAccount);
|
|
404
562
|
const mainAccount = getMainAccount(account, parentAccount);
|
|
405
563
|
let optimisticOperation = signedOperation.operation;
|
|
@@ -605,8 +763,8 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
|
|
|
605
763
|
// retrofit of the exchange params to fit the old platform spec
|
|
606
764
|
const request = {
|
|
607
765
|
provider: params.provider,
|
|
608
|
-
fromAccountId: params.
|
|
609
|
-
toAccountId: params.exchangeType === "SWAP" ? params.
|
|
766
|
+
fromAccountId: params.fromAccountId,
|
|
767
|
+
toAccountId: params.exchangeType === "SWAP" ? params.toAccountId : undefined,
|
|
610
768
|
transaction: params.transaction,
|
|
611
769
|
binaryPayload: params.binaryPayload.toString("hex"),
|
|
612
770
|
signature: params.signature.toString("hex"),
|
|
@@ -639,7 +797,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
|
|
|
639
797
|
});
|
|
640
798
|
}, [uiExchangeComplete, accounts, manifest, server, tracking]);
|
|
641
799
|
return {
|
|
642
|
-
widgetLoaded,
|
|
800
|
+
widgetLoaded: widgetLoaded,
|
|
643
801
|
onMessage,
|
|
644
802
|
onLoad,
|
|
645
803
|
onReload,
|
|
@@ -759,9 +917,9 @@ export function useRecentlyUsed(manifests, [recentlyUsedManifestsDb, setState])
|
|
|
759
917
|
...res,
|
|
760
918
|
usedAt: calculateTimeDiff(recentlyUsed.usedAt),
|
|
761
919
|
}
|
|
762
|
-
:
|
|
920
|
+
: undefined;
|
|
763
921
|
})
|
|
764
|
-
.filter(manifest => manifest !== undefined), [recentlyUsedManifestsDb, manifests]);
|
|
922
|
+
.filter((manifest) => manifest !== undefined), [recentlyUsedManifestsDb, manifests]);
|
|
765
923
|
const append = useCallback((manifest) => {
|
|
766
924
|
setState(state => {
|
|
767
925
|
const index = state.recentlyUsed.findIndex(({ id }) => id === manifest.id);
|