@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/lib/wallet-api/react.js
CHANGED
|
@@ -3,24 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useDisclaimerRaw = exports.useRecentlyUsed = exports.useCacheBustedLiveApps = exports.useLocalLiveApp = exports.useCategories = exports.ExchangeType = exports.useWalletAPIServer = exports.useConfig = exports.usePermission = exports.
|
|
6
|
+
exports.useDisclaimerRaw = exports.useRecentlyUsed = exports.useCacheBustedLiveApps = exports.useLocalLiveApp = exports.useCategories = exports.ExchangeType = exports.useWalletAPIServer = exports.useConfig = exports.usePermission = exports.useDAppManifestCurrencyIds = exports.useSetWalletAPIAccounts = exports.safeGetRefValue = void 0;
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
+
const react_redux_1 = require("react-redux");
|
|
8
9
|
const semver_1 = __importDefault(require("semver"));
|
|
9
10
|
const date_fns_1 = require("date-fns");
|
|
10
|
-
const
|
|
11
|
-
const rxjs_1 = require("rxjs");
|
|
11
|
+
const wallet_api_server_1 = require("@ledgerhq/wallet-api-server");
|
|
12
12
|
const operators_1 = require("rxjs/operators");
|
|
13
|
+
const live_env_1 = require("@ledgerhq/live-env");
|
|
14
|
+
const errors_1 = require("@ledgerhq/errors");
|
|
15
|
+
const api_1 = require("@ledgerhq/cryptoassets/cal-client/state-manager/api");
|
|
13
16
|
const converters_1 = require("./converters");
|
|
14
17
|
const helpers_1 = require("./helpers");
|
|
15
18
|
const account_1 = require("../account");
|
|
16
19
|
const currencies_1 = require("../currencies");
|
|
17
|
-
const
|
|
20
|
+
const crypto_assets_1 = require("../bridge/crypto-assets");
|
|
18
21
|
const logic_1 = require("./logic");
|
|
19
22
|
const bridge_1 = require("../bridge");
|
|
20
|
-
const live_env_1 = require("@ledgerhq/live-env");
|
|
21
23
|
const openTransportAsSubject_1 = __importDefault(require("../hw/openTransportAsSubject"));
|
|
22
|
-
const errors_1 = require("@ledgerhq/errors");
|
|
23
24
|
const constants_1 = require("./constants");
|
|
25
|
+
const useCurrenciesUnderFeatureFlag_1 = require("../modularDrawer/hooks/useCurrenciesUnderFeatureFlag");
|
|
24
26
|
function safeGetRefValue(ref) {
|
|
25
27
|
if (!ref.current) {
|
|
26
28
|
throw new Error("Ref objects doesn't have a current value");
|
|
@@ -28,62 +30,25 @@ function safeGetRefValue(ref) {
|
|
|
28
30
|
return ref.current;
|
|
29
31
|
}
|
|
30
32
|
exports.safeGetRefValue = safeGetRefValue;
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return (0, converters_1.accountToWalletAPIAccount)(walletState, account, parentAccount);
|
|
33
|
+
function useSetWalletAPIAccounts(accounts) {
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
accounts.forEach(account => {
|
|
36
|
+
(0, converters_1.setWalletApiIdForAccountId)(account.id);
|
|
36
37
|
});
|
|
37
|
-
}, [
|
|
38
|
+
}, [accounts]);
|
|
38
39
|
}
|
|
39
|
-
exports.
|
|
40
|
-
function
|
|
41
|
-
return (0, react_1.useMemo)(() => {
|
|
42
|
-
return (0, currencies_1.listCurrencies)(true).reduce((filtered, currency) => {
|
|
43
|
-
if ((0, helpers_1.isWalletAPISupportedCurrency)(currency)) {
|
|
44
|
-
filtered.push((0, converters_1.currencyToWalletAPICurrency)(currency));
|
|
45
|
-
}
|
|
46
|
-
return filtered;
|
|
47
|
-
}, []);
|
|
48
|
-
}, []);
|
|
49
|
-
}
|
|
50
|
-
exports.useWalletAPICurrencies = useWalletAPICurrencies;
|
|
51
|
-
function useManifestCurrencies(manifest) {
|
|
40
|
+
exports.useSetWalletAPIAccounts = useSetWalletAPIAccounts;
|
|
41
|
+
function useDAppManifestCurrencyIds(manifest) {
|
|
52
42
|
return (0, react_1.useMemo)(() => {
|
|
53
43
|
return (manifest.dapp?.networks.map(network => {
|
|
54
|
-
return
|
|
44
|
+
return network.currency;
|
|
55
45
|
}) ?? []);
|
|
56
46
|
}, [manifest.dapp?.networks]);
|
|
57
47
|
}
|
|
58
|
-
exports.
|
|
59
|
-
function useGetAccountIds(accounts$) {
|
|
60
|
-
const [accounts, setAccounts] = (0, react_1.useState)([]);
|
|
61
|
-
(0, react_1.useEffect)(() => {
|
|
62
|
-
if (!accounts$) {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
const subscription = accounts$.subscribe(walletAccounts => {
|
|
66
|
-
setAccounts(walletAccounts);
|
|
67
|
-
});
|
|
68
|
-
return () => {
|
|
69
|
-
subscription.unsubscribe();
|
|
70
|
-
};
|
|
71
|
-
}, [accounts$]);
|
|
72
|
-
return (0, react_1.useMemo)(() => {
|
|
73
|
-
if (!accounts$) {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
return accounts.reduce((accountIds, account) => {
|
|
77
|
-
accountIds.set((0, converters_1.getAccountIdFromWalletAccountId)(account.id), true);
|
|
78
|
-
return accountIds;
|
|
79
|
-
}, new Map());
|
|
80
|
-
}, [accounts, accounts$]);
|
|
81
|
-
}
|
|
82
|
-
exports.useGetAccountIds = useGetAccountIds;
|
|
48
|
+
exports.useDAppManifestCurrencyIds = useDAppManifestCurrencyIds;
|
|
83
49
|
function usePermission(manifest) {
|
|
84
50
|
return (0, react_1.useMemo)(() => ({
|
|
85
|
-
|
|
86
|
-
methodIds: manifest.permissions, // TODO remove when using the correct manifest type
|
|
51
|
+
methodIds: manifest.permissions,
|
|
87
52
|
}), [manifest]);
|
|
88
53
|
}
|
|
89
54
|
exports.usePermission = usePermission;
|
|
@@ -102,7 +67,7 @@ function useConfig({ appId, userId, tracking, wallet, mevProtected, }) {
|
|
|
102
67
|
tracking,
|
|
103
68
|
wallet,
|
|
104
69
|
mevProtected,
|
|
105
|
-
}), [appId, tracking, userId, wallet]);
|
|
70
|
+
}), [appId, mevProtected, tracking, userId, wallet]);
|
|
106
71
|
}
|
|
107
72
|
exports.useConfig = useConfig;
|
|
108
73
|
function useDeviceTransport({ manifest, tracking }) {
|
|
@@ -153,73 +118,257 @@ function useDeviceTransport({ manifest, tracking }) {
|
|
|
153
118
|
return (0, react_1.useMemo)(() => ({ ref, subscribe, close, exchange }), [close, exchange, subscribe]);
|
|
154
119
|
}
|
|
155
120
|
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, }) {
|
|
121
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
122
|
+
const { deactivatedCurrencyIds } = (0, useCurrenciesUnderFeatureFlag_1.useCurrenciesUnderFeatureFlag)();
|
|
156
123
|
const permission = usePermission(manifest);
|
|
157
124
|
const transport = useTransport(webviewHook.postMessage);
|
|
158
125
|
const [widgetLoaded, setWidgetLoaded] = (0, react_1.useState)(false);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
126
|
+
// We need to set the wallet API account IDs mapping upfront
|
|
127
|
+
// If we don't want the map to be empty when requesting an account
|
|
128
|
+
useSetWalletAPIAccounts(accounts);
|
|
129
|
+
const { server, onMessage } = (0, wallet_api_server_1.useWalletAPIServer)({
|
|
162
130
|
transport,
|
|
163
131
|
config,
|
|
164
|
-
accounts: walletAPIAccounts,
|
|
165
|
-
currencies: walletAPICurrencies,
|
|
166
132
|
permission,
|
|
167
133
|
customHandlers,
|
|
168
134
|
});
|
|
169
135
|
(0, react_1.useEffect)(() => {
|
|
170
136
|
tracking.load(manifest);
|
|
171
137
|
}, [tracking, manifest]);
|
|
138
|
+
// TODO: refactor each handler into its own logic function for clarity
|
|
139
|
+
(0, react_1.useEffect)(() => {
|
|
140
|
+
server.setHandler("currency.list", async ({ currencyIds }) => {
|
|
141
|
+
tracking.currencyListRequested(manifest);
|
|
142
|
+
try {
|
|
143
|
+
// 1. Parse manifest currency patterns to determine what to include
|
|
144
|
+
const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
|
|
145
|
+
// 2. Apply query filter early - intersect with manifest patterns
|
|
146
|
+
const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
|
|
147
|
+
let effectiveCurrencyIds = manifestCurrencyIds;
|
|
148
|
+
if (queryCurrencyIdsSet) {
|
|
149
|
+
// If we have a query filter, narrow down what we need to fetch
|
|
150
|
+
effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
|
|
151
|
+
if (manifestId === "**") {
|
|
152
|
+
// Query can ask for anything, so use the query list
|
|
153
|
+
return [...queryCurrencyIdsSet];
|
|
154
|
+
}
|
|
155
|
+
else if (manifestId.endsWith("/**")) {
|
|
156
|
+
// Pattern like "ethereum/**" - keep tokens from query that match this family
|
|
157
|
+
const family = manifestId.slice(0, -3);
|
|
158
|
+
return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
|
|
159
|
+
}
|
|
160
|
+
else if (queryCurrencyIdsSet.has(manifestId)) {
|
|
161
|
+
// Specific currency/token that's in the query
|
|
162
|
+
return [manifestId];
|
|
163
|
+
}
|
|
164
|
+
// Not in query, skip it
|
|
165
|
+
return [];
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
// 3. Parse effective currency IDs to determine what to fetch
|
|
169
|
+
const includeAllCurrencies = effectiveCurrencyIds.includes("**");
|
|
170
|
+
const specificCurrencies = new Set();
|
|
171
|
+
const tokenFamilies = new Set();
|
|
172
|
+
const specificTokenIds = new Set();
|
|
173
|
+
for (const id of effectiveCurrencyIds) {
|
|
174
|
+
if (id === "**") {
|
|
175
|
+
// Already handled above
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
else if (id.endsWith("/**")) {
|
|
179
|
+
// Pattern like "ethereum/**" or "solana/**" - include tokens for this family
|
|
180
|
+
const family = id.slice(0, -3);
|
|
181
|
+
tokenFamilies.add(family);
|
|
182
|
+
}
|
|
183
|
+
else if (id.includes("/")) {
|
|
184
|
+
// Specific token ID like "ethereum/erc20/usd__coin"
|
|
185
|
+
specificTokenIds.add(id);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
// Specific currency like "bitcoin" or "ethereum"
|
|
189
|
+
specificCurrencies.add(id);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// 4. Gather all supported parent currencies
|
|
193
|
+
const allCurrencies = (0, currencies_1.listSupportedCurrencies)().reduce((acc, c) => {
|
|
194
|
+
if ((0, helpers_1.isWalletAPISupportedCurrency)(c) && !deactivatedCurrencyIds.has(c.id))
|
|
195
|
+
acc.push((0, converters_1.currencyToWalletAPICurrency)(c));
|
|
196
|
+
return acc;
|
|
197
|
+
}, []);
|
|
198
|
+
// 5. Determine which currencies to include based on patterns
|
|
199
|
+
let includedCurrencies = [];
|
|
200
|
+
if (includeAllCurrencies) {
|
|
201
|
+
includedCurrencies = allCurrencies;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
includedCurrencies = allCurrencies.filter(c => specificCurrencies.has(c.id));
|
|
205
|
+
}
|
|
206
|
+
// 6. Fetch specific tokens by ID if any
|
|
207
|
+
const specificTokens = [];
|
|
208
|
+
if (specificTokenIds.size > 0) {
|
|
209
|
+
const tokenPromises = [...specificTokenIds].map(async (tokenId) => {
|
|
210
|
+
const token = await (0, crypto_assets_1.getCryptoAssetsStore)().findTokenById(tokenId);
|
|
211
|
+
return token ? (0, converters_1.currencyToWalletAPICurrency)(token) : null;
|
|
212
|
+
});
|
|
213
|
+
const resolvedTokens = await Promise.all(tokenPromises);
|
|
214
|
+
specificTokens.push(...resolvedTokens.filter((t) => t !== null));
|
|
215
|
+
}
|
|
216
|
+
// 7. Determine which token families to fetch (only if not already fetched as specific tokens)
|
|
217
|
+
const familiesToFetch = new Set();
|
|
218
|
+
if (includeAllCurrencies) {
|
|
219
|
+
// Fetch tokens for all currency families
|
|
220
|
+
allCurrencies.forEach(c => {
|
|
221
|
+
if (c.type === "CryptoCurrency")
|
|
222
|
+
familiesToFetch.add(c.family);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
else if (tokenFamilies.size > 0) {
|
|
226
|
+
// Only fetch tokens for families explicitly marked with /**
|
|
227
|
+
tokenFamilies.forEach(family => familiesToFetch.add(family));
|
|
228
|
+
}
|
|
229
|
+
// 8. Fetch tokens for relevant families
|
|
230
|
+
const fetchAllPagesForFamily = async (family) => {
|
|
231
|
+
const args = { networkFamily: family, pageSize: 1000 };
|
|
232
|
+
let hasNextPage = true;
|
|
233
|
+
let data;
|
|
234
|
+
while (hasNextPage) {
|
|
235
|
+
const querySub = dispatch(api_1.endpoints.getTokensData.initiate(args, data ? { direction: "forward" } : undefined));
|
|
236
|
+
try {
|
|
237
|
+
const result = await querySub;
|
|
238
|
+
data = result.data;
|
|
239
|
+
hasNextPage = result.hasNextPage;
|
|
240
|
+
if (result.error)
|
|
241
|
+
throw result.error;
|
|
242
|
+
}
|
|
243
|
+
finally {
|
|
244
|
+
querySub.unsubscribe();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return (data?.pages ?? []).flatMap(p => p.tokens);
|
|
248
|
+
};
|
|
249
|
+
const tokensByFamily = await Promise.all([...familiesToFetch].map(f => fetchAllPagesForFamily(f)));
|
|
250
|
+
// 9. Combine all results (no additional filter needed since we pre-filtered)
|
|
251
|
+
const result = tokensByFamily.reduce((acc, tokens) => [...acc, ...tokens.map(t => (0, converters_1.currencyToWalletAPICurrency)(t))], [...includedCurrencies, ...specificTokens]);
|
|
252
|
+
tracking.currencyListSuccess(manifest);
|
|
253
|
+
return result;
|
|
254
|
+
}
|
|
255
|
+
catch (err) {
|
|
256
|
+
tracking.currencyListFail(manifest);
|
|
257
|
+
throw err;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}, [walletState, manifest, server, tracking, dispatch, deactivatedCurrencyIds]);
|
|
261
|
+
(0, react_1.useEffect)(() => {
|
|
262
|
+
server.setHandler("account.list", ({ currencyIds }) => {
|
|
263
|
+
tracking.accountListRequested(manifest);
|
|
264
|
+
try {
|
|
265
|
+
// 1. Parse manifest currency patterns to determine what to include
|
|
266
|
+
const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
|
|
267
|
+
// 2. Apply query filter early - intersect with manifest patterns
|
|
268
|
+
const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
|
|
269
|
+
let effectiveCurrencyIds = manifestCurrencyIds;
|
|
270
|
+
if (queryCurrencyIdsSet) {
|
|
271
|
+
// If we have a query filter, narrow down what we need to check
|
|
272
|
+
effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
|
|
273
|
+
if (manifestId === "**") {
|
|
274
|
+
// Query can ask for anything, so use the query list
|
|
275
|
+
return [...queryCurrencyIdsSet];
|
|
276
|
+
}
|
|
277
|
+
else if (manifestId.endsWith("/**")) {
|
|
278
|
+
// Pattern like "ethereum/**" - keep tokens from query that match this family
|
|
279
|
+
const family = manifestId.slice(0, -3);
|
|
280
|
+
return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
|
|
281
|
+
}
|
|
282
|
+
else if (queryCurrencyIdsSet.has(manifestId)) {
|
|
283
|
+
// Specific currency/token that's in the query
|
|
284
|
+
return [manifestId];
|
|
285
|
+
}
|
|
286
|
+
// Not in query, skip it
|
|
287
|
+
return [];
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
// 3. Build a set of allowed currency IDs based on effective patterns
|
|
291
|
+
const allowedCurrencyIds = new Set();
|
|
292
|
+
const includeAllCurrencies = effectiveCurrencyIds.includes("**");
|
|
293
|
+
const tokenFamilyPrefixes = new Set();
|
|
294
|
+
for (const id of effectiveCurrencyIds) {
|
|
295
|
+
if (id === "**") {
|
|
296
|
+
// Will match all currencies
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
else if (id.endsWith("/**")) {
|
|
300
|
+
// Pattern like "ethereum/**" - store prefix for matching
|
|
301
|
+
const family = id.slice(0, -3);
|
|
302
|
+
tokenFamilyPrefixes.add(family);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
// Specific currency/token ID
|
|
306
|
+
allowedCurrencyIds.add(id);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// 4. Filter accounts based on effective currency IDs
|
|
310
|
+
const wapiAccounts = accounts.reduce((acc, account) => {
|
|
311
|
+
const parentAccount = (0, account_1.getParentAccount)(account, accounts);
|
|
312
|
+
const accountCurrencyId = account.type === "TokenAccount" ? account.token.id : account.currency.id;
|
|
313
|
+
const parentCurrencyId = account.type === "TokenAccount" ? account.token.parentCurrency.id : account.currency.id;
|
|
314
|
+
// Check if account currency ID matches the effective patterns
|
|
315
|
+
const isAllowed = includeAllCurrencies ||
|
|
316
|
+
allowedCurrencyIds.has(accountCurrencyId) ||
|
|
317
|
+
tokenFamilyPrefixes.has(parentCurrencyId);
|
|
318
|
+
if (isAllowed) {
|
|
319
|
+
acc.push((0, converters_1.accountToWalletAPIAccount)(walletState, account, parentAccount));
|
|
320
|
+
}
|
|
321
|
+
return acc;
|
|
322
|
+
}, []);
|
|
323
|
+
tracking.accountListSuccess(manifest);
|
|
324
|
+
return wapiAccounts;
|
|
325
|
+
}
|
|
326
|
+
catch (err) {
|
|
327
|
+
tracking.accountListFail(manifest);
|
|
328
|
+
throw err;
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}, [walletState, manifest, server, tracking, uiAccountRequest, accounts]);
|
|
172
332
|
(0, react_1.useEffect)(() => {
|
|
173
333
|
if (!uiAccountRequest)
|
|
174
334
|
return;
|
|
175
|
-
server.setHandler("account.request", async ({
|
|
335
|
+
server.setHandler("account.request", async ({ currencyIds, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
|
|
176
336
|
tracking.requestAccountRequested(manifest);
|
|
177
|
-
const currencies = await (0, rxjs_1.firstValueFrom)(currencies$);
|
|
178
337
|
return new Promise((resolve, reject) => {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
done = true;
|
|
207
|
-
tracking.requestAccountFail(manifest);
|
|
208
|
-
reject(new Error("Canceled by user"));
|
|
209
|
-
},
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
catch (error) {
|
|
213
|
-
reject(error);
|
|
214
|
-
}
|
|
215
|
-
})();
|
|
338
|
+
let done = false;
|
|
339
|
+
try {
|
|
340
|
+
uiAccountRequest({
|
|
341
|
+
currencyIds,
|
|
342
|
+
drawerConfiguration,
|
|
343
|
+
areCurrenciesFiltered,
|
|
344
|
+
useCase,
|
|
345
|
+
onSuccess: (account, parentAccount) => {
|
|
346
|
+
if (done)
|
|
347
|
+
return;
|
|
348
|
+
done = true;
|
|
349
|
+
tracking.requestAccountSuccess(manifest);
|
|
350
|
+
resolve((0, converters_1.accountToWalletAPIAccount)(walletState, account, parentAccount));
|
|
351
|
+
},
|
|
352
|
+
onCancel: () => {
|
|
353
|
+
if (done)
|
|
354
|
+
return;
|
|
355
|
+
done = true;
|
|
356
|
+
tracking.requestAccountFail(manifest);
|
|
357
|
+
reject(new Error("Canceled by user"));
|
|
358
|
+
},
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
catch (error) {
|
|
362
|
+
tracking.requestAccountFail(manifest);
|
|
363
|
+
reject(error);
|
|
364
|
+
}
|
|
216
365
|
});
|
|
217
366
|
});
|
|
218
367
|
}, [walletState, manifest, server, tracking, uiAccountRequest]);
|
|
219
368
|
(0, react_1.useEffect)(() => {
|
|
220
369
|
if (!uiAccountReceive)
|
|
221
370
|
return;
|
|
222
|
-
server.setHandler("account.receive", ({
|
|
371
|
+
server.setHandler("account.receive", ({ accountId, tokenCurrency }) => (0, logic_1.receiveOnAccountLogic)(walletState, { manifest, accounts, tracking }, accountId, (account, parentAccount, accountAddress) => new Promise((resolve, reject) => {
|
|
223
372
|
let done = false;
|
|
224
373
|
return uiAccountReceive({
|
|
225
374
|
account,
|
|
@@ -252,7 +401,7 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
|
|
|
252
401
|
(0, react_1.useEffect)(() => {
|
|
253
402
|
if (!uiMessageSign)
|
|
254
403
|
return;
|
|
255
|
-
server.setHandler("message.sign", ({
|
|
404
|
+
server.setHandler("message.sign", ({ accountId, message, options }) => (0, logic_1.signMessageLogic)({ manifest, accounts, tracking }, accountId, message.toString("hex"), (account, message) => new Promise((resolve, reject) => {
|
|
256
405
|
let done = false;
|
|
257
406
|
return uiMessageSign({
|
|
258
407
|
account,
|
|
@@ -297,31 +446,38 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
|
|
|
297
446
|
(0, react_1.useEffect)(() => {
|
|
298
447
|
if (!uiTxSign)
|
|
299
448
|
return;
|
|
300
|
-
server.setHandler("transaction.sign", async ({
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
account
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
449
|
+
server.setHandler("transaction.sign", async ({ accountId, tokenCurrency, transaction, options }) => {
|
|
450
|
+
let currency;
|
|
451
|
+
const signedOperation = await (0, logic_1.signTransactionLogic)({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, signFlowInfos) => {
|
|
452
|
+
currency =
|
|
453
|
+
account.type === "TokenAccount"
|
|
454
|
+
? account.token.parentCurrency.id
|
|
455
|
+
: account.currency.id;
|
|
456
|
+
return new Promise((resolve, reject) => {
|
|
457
|
+
let done = false;
|
|
458
|
+
return uiTxSign({
|
|
459
|
+
account,
|
|
460
|
+
parentAccount,
|
|
461
|
+
signFlowInfos,
|
|
462
|
+
options,
|
|
463
|
+
onSuccess: signedOperation => {
|
|
464
|
+
if (done)
|
|
465
|
+
return;
|
|
466
|
+
done = true;
|
|
467
|
+
tracking.signTransactionSuccess(manifest);
|
|
468
|
+
resolve(signedOperation);
|
|
469
|
+
},
|
|
470
|
+
onError: error => {
|
|
471
|
+
if (done)
|
|
472
|
+
return;
|
|
473
|
+
done = true;
|
|
474
|
+
tracking.signTransactionFail(manifest);
|
|
475
|
+
reject(error);
|
|
476
|
+
},
|
|
477
|
+
});
|
|
322
478
|
});
|
|
323
|
-
}
|
|
324
|
-
return
|
|
479
|
+
}, tokenCurrency);
|
|
480
|
+
return currency === "solana"
|
|
325
481
|
? Buffer.from(signedOperation.signature, "hex")
|
|
326
482
|
: Buffer.from(signedOperation.signature);
|
|
327
483
|
});
|
|
@@ -329,8 +485,8 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
|
|
|
329
485
|
(0, react_1.useEffect)(() => {
|
|
330
486
|
if (!uiTxSignRaw)
|
|
331
487
|
return;
|
|
332
|
-
server.setHandler("transaction.signRaw", async ({
|
|
333
|
-
const signedOperation = await (0, logic_1.signRawTransactionLogic)({ manifest, accounts, tracking },
|
|
488
|
+
server.setHandler("transaction.signRaw", async ({ accountId, transaction, broadcast, options }) => {
|
|
489
|
+
const signedOperation = await (0, logic_1.signRawTransactionLogic)({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, tx) => new Promise((resolve, reject) => {
|
|
334
490
|
let done = false;
|
|
335
491
|
return uiTxSignRaw({
|
|
336
492
|
account,
|
|
@@ -355,7 +511,7 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
|
|
|
355
511
|
}));
|
|
356
512
|
let hash;
|
|
357
513
|
if (broadcast) {
|
|
358
|
-
hash = await (0, logic_1.broadcastTransactionLogic)({ manifest, accounts, tracking },
|
|
514
|
+
hash = await (0, logic_1.broadcastTransactionLogic)({ manifest, accounts, tracking }, accountId, signedOperation, async (account, parentAccount, signedOperation) => {
|
|
359
515
|
const bridge = (0, bridge_1.getAccountBridge)(account, parentAccount);
|
|
360
516
|
const mainAccount = (0, account_1.getMainAccount)(account, parentAccount);
|
|
361
517
|
let optimisticOperation = signedOperation.operation;
|
|
@@ -387,9 +543,9 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
|
|
|
387
543
|
(0, react_1.useEffect)(() => {
|
|
388
544
|
if (!uiTxSign)
|
|
389
545
|
return;
|
|
390
|
-
server.setHandler("transaction.signAndBroadcast", async ({
|
|
546
|
+
server.setHandler("transaction.signAndBroadcast", async ({ accountId, tokenCurrency, transaction, options }) => {
|
|
391
547
|
const sponsored = transaction.family === "ethereum" && transaction.sponsored;
|
|
392
|
-
const signedTransaction = await (0, logic_1.signTransactionLogic)({ manifest, accounts, tracking },
|
|
548
|
+
const signedTransaction = await (0, logic_1.signTransactionLogic)({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, signFlowInfos) => new Promise((resolve, reject) => {
|
|
393
549
|
let done = false;
|
|
394
550
|
return uiTxSign({
|
|
395
551
|
account,
|
|
@@ -412,7 +568,7 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
|
|
|
412
568
|
},
|
|
413
569
|
});
|
|
414
570
|
}), tokenCurrency);
|
|
415
|
-
return (0, logic_1.broadcastTransactionLogic)({ manifest, accounts, tracking },
|
|
571
|
+
return (0, logic_1.broadcastTransactionLogic)({ manifest, accounts, tracking }, accountId, signedTransaction, async (account, parentAccount, signedOperation) => {
|
|
416
572
|
const bridge = (0, bridge_1.getAccountBridge)(account, parentAccount);
|
|
417
573
|
const mainAccount = (0, account_1.getMainAccount)(account, parentAccount);
|
|
418
574
|
let optimisticOperation = signedOperation.operation;
|
|
@@ -618,8 +774,8 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
|
|
|
618
774
|
// retrofit of the exchange params to fit the old platform spec
|
|
619
775
|
const request = {
|
|
620
776
|
provider: params.provider,
|
|
621
|
-
fromAccountId: params.
|
|
622
|
-
toAccountId: params.exchangeType === "SWAP" ? params.
|
|
777
|
+
fromAccountId: params.fromAccountId,
|
|
778
|
+
toAccountId: params.exchangeType === "SWAP" ? params.toAccountId : undefined,
|
|
623
779
|
transaction: params.transaction,
|
|
624
780
|
binaryPayload: params.binaryPayload.toString("hex"),
|
|
625
781
|
signature: params.signature.toString("hex"),
|
|
@@ -652,7 +808,7 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
|
|
|
652
808
|
});
|
|
653
809
|
}, [uiExchangeComplete, accounts, manifest, server, tracking]);
|
|
654
810
|
return {
|
|
655
|
-
widgetLoaded,
|
|
811
|
+
widgetLoaded: widgetLoaded,
|
|
656
812
|
onMessage,
|
|
657
813
|
onLoad,
|
|
658
814
|
onReload,
|
|
@@ -776,9 +932,9 @@ function useRecentlyUsed(manifests, [recentlyUsedManifestsDb, setState]) {
|
|
|
776
932
|
...res,
|
|
777
933
|
usedAt: calculateTimeDiff(recentlyUsed.usedAt),
|
|
778
934
|
}
|
|
779
|
-
:
|
|
935
|
+
: undefined;
|
|
780
936
|
})
|
|
781
|
-
.filter(manifest => manifest !== undefined), [recentlyUsedManifestsDb, manifests]);
|
|
937
|
+
.filter((manifest) => manifest !== undefined), [recentlyUsedManifestsDb, manifests]);
|
|
782
938
|
const append = (0, react_1.useCallback)((manifest) => {
|
|
783
939
|
setState(state => {
|
|
784
940
|
const index = state.recentlyUsed.findIndex(({ id }) => id === manifest.id);
|