@ledgerhq/live-common 34.49.0 → 34.50.0-nightly.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/test-helpers/bridge.js +1 -1
- package/lib/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib/__tests__/test-helpers/environment.js +2 -0
- package/lib/__tests__/test-helpers/environment.js.map +1 -1
- package/lib/apps/config.js +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.js +3 -0
- package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.js +11 -0
- package/lib/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +2 -3
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +11 -3
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js +6 -4
- package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +32 -4
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +4 -2
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.js +37 -0
- package/lib/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts +2 -0
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.js +8 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +15 -1
- package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js +1 -1
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/signOperation.test.js +2 -2
- package/lib/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/types.d.ts +7 -1
- package/lib/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts +7 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +31 -29
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.test.js +32 -0
- package/lib/bridge/generic-alpaca/utils.test.js.map +1 -1
- package/lib/bridge/impl.d.ts.map +1 -1
- package/lib/bridge/impl.js +1 -0
- package/lib/bridge/impl.js.map +1 -1
- package/lib/bridge/react/BridgeSync.d.ts.map +1 -1
- package/lib/bridge/react/BridgeSync.js +17 -4
- package/lib/bridge/react/BridgeSync.js.map +1 -1
- package/lib/bridge/syncSessionManager/index.d.ts +18 -0
- package/lib/bridge/syncSessionManager/index.d.ts.map +1 -0
- package/lib/bridge/syncSessionManager/index.js +75 -0
- package/lib/bridge/syncSessionManager/index.js.map +1 -0
- package/lib/bridge/syncSessionManager/index.test.d.ts +2 -0
- package/lib/bridge/syncSessionManager/index.test.d.ts.map +1 -0
- package/lib/bridge/syncSessionManager/index.test.js +118 -0
- package/lib/bridge/syncSessionManager/index.test.js.map +1 -0
- package/lib/deposit/deposit.integration.test.js +60 -1
- package/lib/deposit/deposit.integration.test.js.map +1 -1
- package/lib/e2e/data/deviceLabelsData.js +2 -2
- package/lib/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib/e2e/enum/Account.d.ts +2 -0
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +3 -1
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/DeviceLabels.d.ts +3 -9
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +2 -8
- package/lib/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +1 -0
- package/lib/e2e/enum/Network.d.ts.map +1 -1
- package/lib/e2e/enum/Network.js +1 -0
- package/lib/e2e/enum/Network.js.map +1 -1
- package/lib/e2e/families/bitcoin.d.ts +1 -0
- package/lib/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib/e2e/families/bitcoin.js +28 -1
- package/lib/e2e/families/bitcoin.js.map +1 -1
- package/lib/e2e/families/tezos.d.ts.map +1 -1
- package/lib/e2e/families/tezos.js +5 -3
- package/lib/e2e/families/tezos.js.map +1 -1
- package/lib/e2e/index.d.ts +8 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/models/Swap.d.ts +2 -0
- package/lib/e2e/models/Swap.d.ts.map +1 -1
- package/lib/e2e/models/Swap.js +6 -0
- package/lib/e2e/models/Swap.js.map +1 -1
- package/lib/e2e/speculos.d.ts +8 -0
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +23 -31
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/providers/swap.js +2 -2
- package/lib/exchange/providers/swap.js.map +1 -1
- package/lib/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib/families/canton/bridge/mock.js +1 -0
- package/lib/families/canton/bridge/mock.js.map +1 -1
- package/lib/families/canton/config.d.ts.map +1 -1
- package/lib/families/canton/config.js +2 -0
- package/lib/families/canton/config.js.map +1 -1
- package/lib/families/celo/bridge.integration.test.js +4 -1
- package/lib/families/celo/bridge.integration.test.js.map +1 -1
- package/lib/families/cosmos/datasets/axelar.integration.test.js +4 -1
- package/lib/families/cosmos/datasets/axelar.integration.test.js.map +1 -1
- package/lib/families/cosmos/datasets/desmos.integration.test.js +4 -1
- package/lib/families/cosmos/datasets/desmos.integration.test.js.map +1 -1
- package/lib/families/cosmos/datasets/onomy.integration.test.js +4 -1
- package/lib/families/cosmos/datasets/onomy.integration.test.js.map +1 -1
- package/lib/families/evm/config.d.ts.map +1 -1
- package/lib/families/evm/config.js +26 -0
- package/lib/families/evm/config.js.map +1 -1
- package/lib/families/filecoin/bridge.integration.test.js +4 -1
- package/lib/families/filecoin/bridge.integration.test.js.map +1 -1
- package/lib/families/mina/bridge.integration.test.js +4 -1
- package/lib/families/mina/bridge.integration.test.js.map +1 -1
- package/lib/families/multiversx/synchronisation.integration.test.js +4 -1
- package/lib/families/multiversx/synchronisation.integration.test.js.map +1 -1
- package/lib/families/tezos/react.d.ts +2 -1
- package/lib/families/tezos/react.d.ts.map +1 -1
- package/lib/families/tezos/react.js +19 -1
- package/lib/families/tezos/react.js.map +1 -1
- package/lib/families/tezos/setup.d.ts +1 -4
- package/lib/families/tezos/setup.d.ts.map +1 -1
- package/lib/families/tezos/setup.js +3 -11
- package/lib/families/tezos/setup.js.map +1 -1
- package/lib/families/ton/bridge.integration.test.js +4 -1
- package/lib/families/ton/bridge.integration.test.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 +4 -0
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/generated/bridge/js.d.ts +0 -1
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +10 -12
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -0
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +1 -0
- package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +1 -0
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +6 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js +11 -14
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +3 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +3 -3
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
- package/lib/modularDrawer/modules/createAssetConfiguration.js +1 -0
- package/lib/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
- package/lib/modularDrawer/utils/groupCurrenciesByProvider.d.ts +7 -0
- package/lib/modularDrawer/utils/groupCurrenciesByProvider.d.ts.map +1 -0
- package/lib/modularDrawer/utils/groupCurrenciesByProvider.js +21 -0
- package/lib/modularDrawer/utils/groupCurrenciesByProvider.js.map +1 -0
- package/lib/modularDrawer/utils/index.d.ts +2 -1
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +3 -1
- package/lib/modularDrawer/utils/index.js.map +1 -1
- package/lib/modularDrawer/utils/type.d.ts +18 -0
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib/notifications/ServiceStatusProvider/entry-points.d.ts +3 -0
- package/lib/notifications/ServiceStatusProvider/entry-points.d.ts.map +1 -0
- package/lib/notifications/ServiceStatusProvider/entry-points.js +3 -0
- package/lib/notifications/ServiceStatusProvider/entry-points.js.map +1 -0
- package/lib/notifications/ServiceStatusProvider/index.d.ts +18 -1
- package/lib/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.js +47 -9
- package/lib/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.test.d.ts +2 -0
- package/lib/notifications/ServiceStatusProvider/index.test.d.ts.map +1 -0
- package/lib/notifications/ServiceStatusProvider/index.test.js +88 -0
- package/lib/notifications/ServiceStatusProvider/index.test.js.map +1 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts +2 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts.map +1 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.js +17 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.js.map +1 -0
- package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts +154 -0
- package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts.map +1 -0
- package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.js +1192 -0
- package/lib/notifications/ServiceStatusProvider/mocks/ledgerStatus.js.map +1 -0
- package/lib/notifications/ServiceStatusProvider/types.d.ts +3 -1
- package/lib/notifications/ServiceStatusProvider/types.d.ts.map +1 -1
- package/lib/wallet-api/react.d.ts +1 -1
- package/lib/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +1 -1
- package/lib/wallet-api/react.js.map +1 -1
- package/lib-es/__tests__/test-helpers/bridge.js +1 -1
- package/lib-es/__tests__/test-helpers/bridge.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/apps/config.js +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.js +3 -0
- package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.js +11 -0
- package/lib-es/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +2 -3
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +11 -3
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +6 -4
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +32 -4
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +4 -2
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.js +38 -1
- package/lib-es/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts +2 -0
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.js +6 -0
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +15 -1
- package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js +1 -1
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js +2 -2
- package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts +7 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts +7 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +31 -29
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.test.js +33 -1
- package/lib-es/bridge/generic-alpaca/utils.test.js.map +1 -1
- package/lib-es/bridge/impl.d.ts.map +1 -1
- package/lib-es/bridge/impl.js +1 -0
- package/lib-es/bridge/impl.js.map +1 -1
- package/lib-es/bridge/react/BridgeSync.d.ts.map +1 -1
- package/lib-es/bridge/react/BridgeSync.js +17 -4
- package/lib-es/bridge/react/BridgeSync.js.map +1 -1
- package/lib-es/bridge/syncSessionManager/index.d.ts +18 -0
- package/lib-es/bridge/syncSessionManager/index.d.ts.map +1 -0
- package/lib-es/bridge/syncSessionManager/index.js +68 -0
- package/lib-es/bridge/syncSessionManager/index.js.map +1 -0
- package/lib-es/bridge/syncSessionManager/index.test.d.ts +2 -0
- package/lib-es/bridge/syncSessionManager/index.test.d.ts.map +1 -0
- package/lib-es/bridge/syncSessionManager/index.test.js +116 -0
- package/lib-es/bridge/syncSessionManager/index.test.js.map +1 -0
- package/lib-es/deposit/deposit.integration.test.js +37 -1
- package/lib-es/deposit/deposit.integration.test.js.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.js +2 -2
- package/lib-es/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +2 -0
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +3 -1
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts +3 -9
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +2 -8
- package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +1 -0
- package/lib-es/e2e/enum/Network.d.ts.map +1 -1
- package/lib-es/e2e/enum/Network.js +1 -0
- package/lib-es/e2e/enum/Network.js.map +1 -1
- package/lib-es/e2e/families/bitcoin.d.ts +1 -0
- package/lib-es/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib-es/e2e/families/bitcoin.js +27 -1
- package/lib-es/e2e/families/bitcoin.js.map +1 -1
- package/lib-es/e2e/families/tezos.d.ts.map +1 -1
- package/lib-es/e2e/families/tezos.js +6 -4
- package/lib-es/e2e/families/tezos.js.map +1 -1
- package/lib-es/e2e/index.d.ts +8 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/models/Swap.d.ts +2 -0
- package/lib-es/e2e/models/Swap.d.ts.map +1 -1
- package/lib-es/e2e/models/Swap.js +6 -0
- package/lib-es/e2e/models/Swap.js.map +1 -1
- package/lib-es/e2e/speculos.d.ts +8 -0
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +23 -32
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/providers/swap.js +2 -2
- package/lib-es/exchange/providers/swap.js.map +1 -1
- package/lib-es/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/canton/bridge/mock.js +1 -0
- package/lib-es/families/canton/bridge/mock.js.map +1 -1
- package/lib-es/families/canton/config.d.ts.map +1 -1
- package/lib-es/families/canton/config.js +2 -0
- package/lib-es/families/canton/config.js.map +1 -1
- package/lib-es/families/celo/bridge.integration.test.js +4 -1
- package/lib-es/families/celo/bridge.integration.test.js.map +1 -1
- package/lib-es/families/cosmos/datasets/axelar.integration.test.js +4 -1
- package/lib-es/families/cosmos/datasets/axelar.integration.test.js.map +1 -1
- package/lib-es/families/cosmos/datasets/desmos.integration.test.js +4 -1
- package/lib-es/families/cosmos/datasets/desmos.integration.test.js.map +1 -1
- package/lib-es/families/cosmos/datasets/onomy.integration.test.js +4 -1
- package/lib-es/families/cosmos/datasets/onomy.integration.test.js.map +1 -1
- package/lib-es/families/evm/config.d.ts.map +1 -1
- package/lib-es/families/evm/config.js +26 -0
- package/lib-es/families/evm/config.js.map +1 -1
- package/lib-es/families/filecoin/bridge.integration.test.js +4 -1
- package/lib-es/families/filecoin/bridge.integration.test.js.map +1 -1
- package/lib-es/families/mina/bridge.integration.test.js +4 -1
- package/lib-es/families/mina/bridge.integration.test.js.map +1 -1
- package/lib-es/families/multiversx/synchronisation.integration.test.js +4 -1
- package/lib-es/families/multiversx/synchronisation.integration.test.js.map +1 -1
- package/lib-es/families/tezos/react.d.ts +2 -1
- package/lib-es/families/tezos/react.d.ts.map +1 -1
- package/lib-es/families/tezos/react.js +17 -0
- package/lib-es/families/tezos/react.js.map +1 -1
- package/lib-es/families/tezos/setup.d.ts +1 -4
- package/lib-es/families/tezos/setup.d.ts.map +1 -1
- package/lib-es/families/tezos/setup.js +2 -9
- package/lib-es/families/tezos/setup.js.map +1 -1
- package/lib-es/families/ton/bridge.integration.test.js +4 -1
- package/lib-es/families/ton/bridge.integration.test.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 +4 -0
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.d.ts +0 -1
- package/lib-es/generated/bridge/js.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.js +0 -2
- package/lib-es/generated/bridge/js.js.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -0
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +1 -0
- package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +1 -0
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +6 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +11 -14
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +3 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +3 -3
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib-es/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js +1 -0
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
- package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.d.ts +7 -0
- package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.js +17 -0
- package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.js.map +1 -0
- package/lib-es/modularDrawer/utils/index.d.ts +2 -1
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +2 -1
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/modularDrawer/utils/type.d.ts +18 -0
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/entry-points.d.ts +3 -0
- package/lib-es/notifications/ServiceStatusProvider/entry-points.d.ts.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/entry-points.js +2 -0
- package/lib-es/notifications/ServiceStatusProvider/entry-points.js.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/index.d.ts +18 -1
- package/lib-es/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.js +47 -9
- package/lib-es/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts +2 -0
- package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/index.test.js +86 -0
- package/lib-es/notifications/ServiceStatusProvider/index.test.js.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts +2 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.js +14 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.js.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts +154 -0
- package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.d.ts.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.js +1189 -0
- package/lib-es/notifications/ServiceStatusProvider/mocks/ledgerStatus.js.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/types.d.ts +3 -1
- package/lib-es/notifications/ServiceStatusProvider/types.d.ts.map +1 -1
- package/lib-es/wallet-api/react.d.ts +1 -1
- package/lib-es/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +1 -1
- package/lib-es/wallet-api/react.js.map +1 -1
- package/package.json +45 -45
- package/src/__tests__/test-helpers/bridge.ts +1 -1
- package/src/__tests__/test-helpers/environment.ts +2 -0
- package/src/apps/config.ts +1 -1
- package/src/bridge/generic-alpaca/alpaca/index.ts +4 -0
- package/src/bridge/generic-alpaca/createTransaction.ts +11 -0
- package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +6 -3
- package/src/bridge/generic-alpaca/getAccountShape.ts +13 -3
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +6 -4
- package/src/bridge/generic-alpaca/prepareTransaction.ts +59 -6
- package/src/bridge/generic-alpaca/signOperation.ts +8 -2
- package/src/bridge/generic-alpaca/signer/index.ts +44 -1
- package/src/bridge/generic-alpaca/signer/signTransaction.ts +10 -0
- package/src/bridge/generic-alpaca/tests/estimateMaxSpendable.test.ts +15 -1
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +1 -0
- package/src/bridge/generic-alpaca/tests/signOperation.test.ts +2 -2
- package/src/bridge/generic-alpaca/types.ts +13 -2
- package/src/bridge/generic-alpaca/utils.test.ts +65 -0
- package/src/bridge/generic-alpaca/utils.ts +42 -30
- package/src/bridge/impl.ts +1 -0
- package/src/bridge/react/BridgeSync.tsx +17 -3
- package/src/bridge/syncSessionManager/index.test.ts +151 -0
- package/src/bridge/syncSessionManager/index.ts +93 -0
- package/src/deposit/deposit.integration.test.ts +41 -2
- package/src/e2e/data/deviceLabelsData.ts +2 -2
- package/src/e2e/enum/Account.ts +13 -0
- package/src/e2e/enum/DeviceLabels.ts +2 -8
- package/src/e2e/enum/Network.ts +1 -0
- package/src/e2e/families/bitcoin.ts +33 -1
- package/src/e2e/families/tezos.ts +13 -4
- package/src/e2e/models/Swap.ts +8 -0
- package/src/e2e/speculos.ts +26 -35
- package/src/exchange/providers/swap.ts +2 -2
- package/src/families/canton/bridge/mock.ts +1 -0
- package/src/families/canton/config.ts +2 -0
- package/src/families/celo/bridge.integration.test.ts +4 -1
- package/src/families/cosmos/datasets/__snapshots__/babylon.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap +299 -4
- package/src/families/cosmos/datasets/__snapshots__/cryptoOrg.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/injective.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/mantra.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/osmosis.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/persistence.integration.test.ts.snap +4 -4
- package/src/families/cosmos/datasets/__snapshots__/stargaze.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/__snapshots__/xion.integration.test.ts.snap +2 -2
- package/src/families/cosmos/datasets/axelar.integration.test.ts +4 -1
- package/src/families/cosmos/datasets/desmos.integration.test.ts +4 -1
- package/src/families/cosmos/datasets/onomy.integration.test.ts +4 -1
- package/src/families/evm/config.ts +26 -0
- package/src/families/filecoin/bridge.integration.test.ts +4 -1
- package/src/families/internet_computer/__snapshots__/bridge.integration.test.ts.snap +60 -3
- package/src/families/mina/bridge.integration.test.ts +4 -1
- package/src/families/multiversx/synchronisation.integration.test.ts +5 -1
- package/src/families/polkadot/__snapshots__/bridge.integration.test.ts.snap +50 -4
- package/src/families/stacks/__snapshots__/bridge.integration.test.ts.snap +23 -3
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +1490 -60
- package/src/families/tezos/react.ts +20 -1
- package/src/families/tezos/setup.ts +3 -22
- package/src/families/ton/bridge.integration.test.ts +4 -1
- package/src/featureFlags/defaultFeatures.ts +4 -0
- package/src/generated/bridge/js.ts +0 -2
- package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +26 -21
- package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +4 -2
- package/src/modularDrawer/modules/createAssetConfiguration.ts +1 -0
- package/src/modularDrawer/utils/groupCurrenciesByProvider.ts +27 -0
- package/src/modularDrawer/utils/index.ts +2 -0
- package/src/modularDrawer/utils/type.ts +19 -0
- package/src/notifications/ServiceStatusProvider/entry-points.ts +3 -0
- package/src/notifications/ServiceStatusProvider/index.test.ts +102 -0
- package/src/notifications/ServiceStatusProvider/index.tsx +61 -13
- package/src/notifications/ServiceStatusProvider/ledger-components.ts +13 -0
- package/src/notifications/ServiceStatusProvider/mocks/ledgerStatus.ts +1188 -0
- package/src/notifications/ServiceStatusProvider/types.ts +4 -1
- package/src/wallet-api/react.ts +3 -3
- package/src/families/celo/__snapshots__/bridge.integration.test.ts.snap +0 -285
- package/src/families/cosmos/datasets/__snapshots__/axelar.integration.test.ts.snap +0 -45
- package/src/families/cosmos/datasets/__snapshots__/desmos.integration.test.ts.snap +0 -45
- package/src/families/cosmos/datasets/__snapshots__/onomy.integration.test.ts.snap +0 -45
- package/src/families/filecoin/__snapshots__/bridge.integration.test.ts.snap +0 -242
- package/src/families/mina/__snapshots__/bridge.integration.test.ts.snap +0 -169
- package/src/families/ton/__snapshots__/bridge.integration.test.ts.snap +0 -338
@@ -26,7 +26,10 @@ export function genericPrepareTransaction(
|
|
26
26
|
kind,
|
27
27
|
): AccountBridge<GenericTransaction, Account>["prepareTransaction"] {
|
28
28
|
return async (account, transaction: GenericTransaction) => {
|
29
|
-
const { getAssetFromToken } = getAlpacaApi(
|
29
|
+
const { getAssetFromToken, computeIntentType, estimateFees, validateIntent } = getAlpacaApi(
|
30
|
+
account.currency.id,
|
31
|
+
kind,
|
32
|
+
);
|
30
33
|
const { assetReference, assetOwner } = getAssetFromToken
|
31
34
|
? getAssetInfos(transaction, account.freshAddress, getAssetFromToken)
|
32
35
|
: assetInfosFallback(transaction);
|
@@ -34,16 +37,20 @@ export function genericPrepareTransaction(
|
|
34
37
|
let fees: BigNumber | bigint | null = transaction.customFees?.parameters?.fees || null;
|
35
38
|
if (fees === null) {
|
36
39
|
fees = (
|
37
|
-
await
|
38
|
-
transactionToIntent(
|
39
|
-
|
40
|
-
|
40
|
+
await estimateFees(
|
41
|
+
transactionToIntent(
|
42
|
+
account,
|
43
|
+
{
|
44
|
+
...transaction,
|
45
|
+
},
|
46
|
+
computeIntentType,
|
47
|
+
),
|
41
48
|
)
|
42
49
|
).value;
|
43
50
|
}
|
44
51
|
|
45
52
|
if (!bnEq(transaction.fees, new BigNumber(fees.toString()))) {
|
46
|
-
|
53
|
+
const next: GenericTransaction = {
|
47
54
|
...transaction,
|
48
55
|
fees: new BigNumber(fees.toString()),
|
49
56
|
assetReference,
|
@@ -54,6 +61,52 @@ export function genericPrepareTransaction(
|
|
54
61
|
},
|
55
62
|
},
|
56
63
|
};
|
64
|
+
|
65
|
+
// propagate storageLimit fee parameter when present (ex: tezos)
|
66
|
+
const feeEstimation = await estimateFees(
|
67
|
+
transactionToIntent(
|
68
|
+
account,
|
69
|
+
{
|
70
|
+
...transaction,
|
71
|
+
},
|
72
|
+
computeIntentType,
|
73
|
+
),
|
74
|
+
);
|
75
|
+
const params = feeEstimation?.parameters;
|
76
|
+
if (params) {
|
77
|
+
const storageLimit = params["storageLimit"];
|
78
|
+
if (
|
79
|
+
storageLimit !== undefined &&
|
80
|
+
(typeof storageLimit === "bigint" ||
|
81
|
+
typeof storageLimit === "number" ||
|
82
|
+
typeof storageLimit === "string")
|
83
|
+
) {
|
84
|
+
next.storageLimit = new BigNumber(storageLimit.toString());
|
85
|
+
// Add storageLimit to customFees parameters
|
86
|
+
if (next.customFees?.parameters) {
|
87
|
+
next.customFees.parameters.storageLimit = new BigNumber(storageLimit.toString());
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
// align with stellar/xrp: when send max (or staking intents), reflect validated amount in UI
|
93
|
+
if (
|
94
|
+
transaction.useAllAmount ||
|
95
|
+
transaction["mode"] === "stake" ||
|
96
|
+
transaction["mode"] === "unstake"
|
97
|
+
) {
|
98
|
+
const { amount } = await validateIntent(
|
99
|
+
transactionToIntent(
|
100
|
+
account,
|
101
|
+
{
|
102
|
+
...transaction,
|
103
|
+
},
|
104
|
+
computeIntentType,
|
105
|
+
),
|
106
|
+
);
|
107
|
+
next.amount = new BigNumber(amount.toString());
|
108
|
+
}
|
109
|
+
return next;
|
57
110
|
}
|
58
111
|
|
59
112
|
return transaction;
|
@@ -96,9 +96,11 @@ export const genericSignOperation =
|
|
96
96
|
assetOwner: transaction?.assetOwner || "",
|
97
97
|
subAccountId: transaction.subAccountId || "",
|
98
98
|
family: transaction.family,
|
99
|
+
feesStrategy: transaction.feesStrategy,
|
100
|
+
data: transaction.data,
|
99
101
|
};
|
100
102
|
const { amount } = await alpacaApi.validateIntent(
|
101
|
-
transactionToIntent(account, draftTransaction),
|
103
|
+
transactionToIntent(account, draftTransaction, alpacaApi.computeIntentType),
|
102
104
|
{ value: fees },
|
103
105
|
);
|
104
106
|
transaction.amount = new BigNumber(amount.toString());
|
@@ -107,7 +109,11 @@ export const genericSignOperation =
|
|
107
109
|
const derivationPath = account.freshAddressPath;
|
108
110
|
const { publicKey } = (await signer.getAddress(derivationPath)) as Result;
|
109
111
|
|
110
|
-
let transactionIntent = transactionToIntent(
|
112
|
+
let transactionIntent = transactionToIntent(
|
113
|
+
account,
|
114
|
+
{ ...transaction },
|
115
|
+
alpacaApi.computeIntentType,
|
116
|
+
);
|
111
117
|
transactionIntent.senderPublicKey = publicKey;
|
112
118
|
|
113
119
|
// Enrich with memo and asset information
|
@@ -1,12 +1,15 @@
|
|
1
1
|
import xrpGetAddress from "@ledgerhq/coin-xrp/signer/getAddress";
|
2
2
|
import stellarGetAddress from "@ledgerhq/coin-stellar/signer/getAddress";
|
3
3
|
import Stellar from "@ledgerhq/hw-app-str";
|
4
|
-
import { signTransaction, stellarSignTransaction } from "./signTransaction";
|
4
|
+
import { signTransaction, stellarSignTransaction, tezosSignTransaction } from "./signTransaction";
|
5
5
|
import { StrKey } from "@stellar/stellar-sdk";
|
6
6
|
import { CreateSigner, executeWithSigner } from "../../setup";
|
7
7
|
import Xrp from "@ledgerhq/hw-app-xrp";
|
8
8
|
import Transport from "@ledgerhq/hw-transport";
|
9
9
|
import { AlpacaSigner } from "./types";
|
10
|
+
import { DerivationType, LedgerSigner as TaquitoLedgerSigner } from "@taquito/ledger-signer";
|
11
|
+
import tezosGetAddress from "@ledgerhq/coin-tezos/signer/getAddress";
|
12
|
+
import Tezos from "@ledgerhq/hw-app-tezos";
|
10
13
|
|
11
14
|
const createSignerXrp: CreateSigner<Xrp> = (transport: Transport) => {
|
12
15
|
return new Xrp(transport);
|
@@ -37,6 +40,39 @@ const createSignerStellar: CreateSigner<Stellar> = (transport: Transport) => {
|
|
37
40
|
|
38
41
|
const signerContextStellar = executeWithSigner(createSignerStellar);
|
39
42
|
|
43
|
+
const createSignerTezos: CreateSigner<
|
44
|
+
Tezos & { createLedgerSigner: (path: string, prompt: boolean, derivationType: number) => any }
|
45
|
+
> = (transport: Transport) => {
|
46
|
+
const tezos = new Tezos(transport);
|
47
|
+
// align with genericSignOperation that calls signer.signTransaction
|
48
|
+
return Object.assign(tezos, {
|
49
|
+
async signTransaction(path: string, rawTxHex: string) {
|
50
|
+
const { signature } = await tezos.signOperation(path, rawTxHex, {});
|
51
|
+
return signature;
|
52
|
+
},
|
53
|
+
async getAddress(path: string, { verify }: { verify?: boolean } = {}) {
|
54
|
+
// Use Taquito LedgerSigner to retrieve base58 public key and matching pkh (like oldbridge)
|
55
|
+
const ledgerSigner = new TaquitoLedgerSigner(
|
56
|
+
transport,
|
57
|
+
path,
|
58
|
+
!!verify,
|
59
|
+
DerivationType.ED25519,
|
60
|
+
);
|
61
|
+
const address = await ledgerSigner.publicKeyHash();
|
62
|
+
const publicKey = await ledgerSigner.publicKey();
|
63
|
+
return { path, address, publicKey };
|
64
|
+
},
|
65
|
+
createLedgerSigner(path: string, prompt: boolean, derivationType: number) {
|
66
|
+
// Map 0 -> ED25519, 1 -> SECP256K1, 2 -> P256 by convention
|
67
|
+
let dt: DerivationType = DerivationType.ED25519;
|
68
|
+
if (derivationType === 1) dt = DerivationType.SECP256K1;
|
69
|
+
else if (derivationType === 2) dt = DerivationType.P256;
|
70
|
+
return new TaquitoLedgerSigner(transport, path, prompt, dt);
|
71
|
+
},
|
72
|
+
});
|
73
|
+
};
|
74
|
+
const signerContextTezos = executeWithSigner(createSignerTezos);
|
75
|
+
|
40
76
|
export function getSigner(network: string): AlpacaSigner {
|
41
77
|
switch (network) {
|
42
78
|
case "ripple":
|
@@ -54,6 +90,13 @@ export function getSigner(network: string): AlpacaSigner {
|
|
54
90
|
context: signerContextStellar,
|
55
91
|
};
|
56
92
|
}
|
93
|
+
case "tezos": {
|
94
|
+
return {
|
95
|
+
getAddress: tezosGetAddress(signerContextTezos),
|
96
|
+
signTransaction: tezosSignTransaction(executeWithSigner(createSignerTezos)),
|
97
|
+
context: signerContextTezos,
|
98
|
+
};
|
99
|
+
}
|
57
100
|
}
|
58
101
|
throw new Error(`signer for ${network} not implemented`);
|
59
102
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
2
2
|
import { StellarSigner } from "@ledgerhq/coin-stellar/types/signer";
|
3
|
+
import { TezosSigner } from "@ledgerhq/coin-tezos/types/signer";
|
3
4
|
import { LegacySigner, SignTransactionOptions } from "./types";
|
4
5
|
|
5
6
|
export const signTransaction = <Signer extends LegacySigner>(
|
@@ -23,3 +24,12 @@ export const stellarSignTransaction = (signerContext: SignerContext<StellarSigne
|
|
23
24
|
return signedTx.signature.toString("base64"); // It should return a Buffer
|
24
25
|
};
|
25
26
|
};
|
27
|
+
|
28
|
+
export const tezosSignTransaction = (signerContext: SignerContext<TezosSigner>) => {
|
29
|
+
return async (deviceId: string, { path, rawTxHex }: SignTransactionOptions) => {
|
30
|
+
const signed = await signerContext(deviceId, signer =>
|
31
|
+
signer.signOperation(path, rawTxHex, {}),
|
32
|
+
);
|
33
|
+
return signed.signature;
|
34
|
+
};
|
35
|
+
};
|
@@ -35,9 +35,23 @@ const dummyAccounts = [
|
|
35
35
|
freshAddress: "s123",
|
36
36
|
pendingOperations: [],
|
37
37
|
},
|
38
|
+
{
|
39
|
+
id: "js:2:tezos:t123",
|
40
|
+
type: "Account",
|
41
|
+
spendableBalance: new BigNumber(50000000),
|
42
|
+
balance: new BigNumber(60000000),
|
43
|
+
currency: {
|
44
|
+
id: "tezos",
|
45
|
+
family: "tezos",
|
46
|
+
name: "Tezos",
|
47
|
+
units: [{ name: "XTZ", magnitude: 6 }],
|
48
|
+
},
|
49
|
+
freshAddress: "t123",
|
50
|
+
pendingOperations: [],
|
51
|
+
},
|
38
52
|
] as unknown as Account[];
|
39
53
|
|
40
|
-
["xrp", "stellar"].forEach((currencyName, idx) => {
|
54
|
+
["xrp", "stellar", "tezos"].forEach((currencyName, idx) => {
|
41
55
|
describe(`genericEstimateMaxSpendable for ${currencyName}`, () => {
|
42
56
|
const dummyAccount = dummyAccounts[idx];
|
43
57
|
|
@@ -14,7 +14,7 @@ jest.mock("../utils", () => ({
|
|
14
14
|
transactionToIntent: jest.fn(),
|
15
15
|
}));
|
16
16
|
describe("genericSignOperation", () => {
|
17
|
-
const networks = ["xrp", "stellar"];
|
17
|
+
const networks = ["xrp", "stellar", "tezos"];
|
18
18
|
const kind = "local";
|
19
19
|
|
20
20
|
const mockSignerContext = jest.fn();
|
@@ -83,7 +83,7 @@ describe("genericSignOperation", () => {
|
|
83
83
|
},
|
84
84
|
});
|
85
85
|
|
86
|
-
expect(transactionToIntent).toHaveBeenCalledWith(account, transaction);
|
86
|
+
expect(transactionToIntent).toHaveBeenCalledWith(account, transaction, undefined);
|
87
87
|
expect(txIntent.memo.memos.get("destinationTag")).toBe("1234");
|
88
88
|
});
|
89
89
|
|
@@ -9,14 +9,25 @@ type NetworkInfo = {
|
|
9
9
|
export type GenericTransaction = TransactionCommon & {
|
10
10
|
family: string;
|
11
11
|
fees?: BigNumber | null;
|
12
|
+
storageLimit?: BigNumber | null;
|
12
13
|
customFees?: {
|
13
|
-
parameters: { fees?: BigNumber | null };
|
14
|
+
parameters: { fees?: BigNumber | null; storageLimit?: BigNumber | null };
|
14
15
|
};
|
15
16
|
tag?: number | null | undefined;
|
16
17
|
feeCustomUnit?: Unit | null | undefined;
|
17
18
|
memoType?: string | null;
|
18
19
|
memoValue?: string | null;
|
19
|
-
|
20
|
+
data?: Buffer;
|
21
|
+
mode?:
|
22
|
+
| "send"
|
23
|
+
| "changeTrust"
|
24
|
+
| "send-legacy"
|
25
|
+
| "send-eip1559"
|
26
|
+
| "delegate"
|
27
|
+
| "stake"
|
28
|
+
| "undelegate"
|
29
|
+
| "unstake";
|
30
|
+
type?: number;
|
20
31
|
assetReference?: string;
|
21
32
|
assetOwner?: string;
|
22
33
|
networkInfo?: NetworkInfo | null;
|
@@ -2,11 +2,76 @@ import {
|
|
2
2
|
adaptCoreOperationToLiveOperation,
|
3
3
|
extractBalance,
|
4
4
|
findCryptoCurrencyByNetwork,
|
5
|
+
transactionToIntent,
|
5
6
|
} from "./utils";
|
6
7
|
import BigNumber from "bignumber.js";
|
7
8
|
import { Operation as CoreOperation } from "@ledgerhq/coin-framework/api/types";
|
9
|
+
import { Account } from "@ledgerhq/types-live";
|
10
|
+
import { GenericTransaction } from "./types";
|
8
11
|
|
9
12
|
describe("Alpaca utils", () => {
|
13
|
+
describe("transactionToIntent", () => {
|
14
|
+
describe("type", () => {
|
15
|
+
it("fallbacks to 'Payment' without a transaction mode", () => {
|
16
|
+
expect(
|
17
|
+
transactionToIntent(
|
18
|
+
{ currency: { name: "ethereum", units: [{}] } } as Account,
|
19
|
+
{ mode: undefined } as GenericTransaction,
|
20
|
+
),
|
21
|
+
).toMatchObject({
|
22
|
+
type: "Payment",
|
23
|
+
});
|
24
|
+
});
|
25
|
+
|
26
|
+
it.each([
|
27
|
+
["changeTrust", "changeTrust"],
|
28
|
+
["send", "send"],
|
29
|
+
["send-legacy", "send-legacy"],
|
30
|
+
["send-eip1559", "send-eip1559"],
|
31
|
+
["stake", "stake"],
|
32
|
+
["unstake", "unstake"],
|
33
|
+
["delegate", "stake"],
|
34
|
+
["undelegate", "unstake"],
|
35
|
+
])(
|
36
|
+
"by default, associates '%s' transaction mode to '%s' intent type",
|
37
|
+
(mode, expectedType) => {
|
38
|
+
expect(
|
39
|
+
transactionToIntent(
|
40
|
+
{ currency: { name: "ethereum", units: [{}] } } as Account,
|
41
|
+
{ mode } as GenericTransaction,
|
42
|
+
),
|
43
|
+
).toMatchObject({
|
44
|
+
type: expectedType,
|
45
|
+
});
|
46
|
+
},
|
47
|
+
);
|
48
|
+
|
49
|
+
it("rejects other modes", () => {
|
50
|
+
expect(() =>
|
51
|
+
transactionToIntent(
|
52
|
+
{ currency: { name: "ethereum", units: [{}] } } as Account,
|
53
|
+
{ mode: "any" as unknown } as GenericTransaction,
|
54
|
+
),
|
55
|
+
).toThrow("Unsupported transaction mode: any");
|
56
|
+
});
|
57
|
+
|
58
|
+
it("supersedes the logic with a custom function", () => {
|
59
|
+
const computeIntentType = (transaction: GenericTransaction) =>
|
60
|
+
transaction.mode === "send" && transaction.type === 2 ? "send-eip1559" : "send-legacy";
|
61
|
+
|
62
|
+
expect(
|
63
|
+
transactionToIntent(
|
64
|
+
{ currency: { name: "ethereum", units: [{}] } } as Account,
|
65
|
+
{ mode: "send", type: 2 } as GenericTransaction,
|
66
|
+
computeIntentType,
|
67
|
+
),
|
68
|
+
).toMatchObject({
|
69
|
+
type: "send-eip1559",
|
70
|
+
});
|
71
|
+
});
|
72
|
+
});
|
73
|
+
});
|
74
|
+
|
10
75
|
describe("findCryptoCurrencyByNetwork", () => {
|
11
76
|
it("finds a crypto currency by id", () => {
|
12
77
|
expect(findCryptoCurrencyByNetwork("ethereum")).toMatchObject({
|
@@ -78,6 +78,25 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
|
|
78
78
|
return res;
|
79
79
|
}
|
80
80
|
|
81
|
+
/**
|
82
|
+
* Default implementation of `computeIntentType` is a simple whitelist
|
83
|
+
* with a fallback to "Payment"
|
84
|
+
*/
|
85
|
+
function defaultComputeIntentType(transaction: GenericTransaction): string {
|
86
|
+
if (!transaction.mode) return "Payment"; // NOTE: assuming payment by default here, can be changed based on transaction.mode
|
87
|
+
|
88
|
+
const modeRemap = {
|
89
|
+
delegate: "stake",
|
90
|
+
undelegate: "unstake",
|
91
|
+
};
|
92
|
+
const mode = modeRemap[transaction.mode] ?? transaction.mode;
|
93
|
+
|
94
|
+
if (["changeTrust", "send", "send-legacy", "send-eip1559", "stake", "unstake"].includes(mode))
|
95
|
+
return mode;
|
96
|
+
|
97
|
+
throw new Error(`Unsupported transaction mode: ${transaction.mode}`);
|
98
|
+
}
|
99
|
+
|
81
100
|
/**
|
82
101
|
* Converts a transaction object into a `TransactionIntent` object, which is used to represent
|
83
102
|
* the intent of a transaction in a standardized format.
|
@@ -92,6 +111,7 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
|
|
92
111
|
* - `fees` (optional): The fees associated with the transaction.
|
93
112
|
* - `memoType` (optional): The type of memo to attach to the transaction.
|
94
113
|
* - `memoValue` (optional): The value of the memo to attach to the transaction.
|
114
|
+
* @param computeIntentType - An optional function to compute the intent type that supersedes the default implementation if present
|
95
115
|
*
|
96
116
|
* @returns A `TransactionIntent` object containing the standardized representation of the transaction.
|
97
117
|
* - Includes details such as type, sender, recipient, amount, fees, asset, and an optional memo.
|
@@ -103,41 +123,34 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
|
|
103
123
|
export function transactionToIntent(
|
104
124
|
account: Account,
|
105
125
|
transaction: GenericTransaction,
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
break;
|
119
|
-
case "send-eip1559":
|
120
|
-
transactionType = "send-eip1559";
|
121
|
-
break;
|
122
|
-
default:
|
123
|
-
throw new Error(`Unsupported transaction mode: ${transaction.mode}`);
|
124
|
-
}
|
125
|
-
}
|
126
|
-
const res: TransactionIntent & { memo?: { type: string; value?: string } } = {
|
127
|
-
type: transactionType,
|
126
|
+
computeIntentType?: (transaction: GenericTransaction) => string,
|
127
|
+
): TransactionIntent & { memo?: { type: string; value?: string } } & {
|
128
|
+
data?: { type: string; value?: unknown };
|
129
|
+
} {
|
130
|
+
const intentType = (computeIntentType ?? defaultComputeIntentType)(transaction);
|
131
|
+
const isStaking = ["stake", "unstake"].includes(intentType);
|
132
|
+
const amount = isStaking ? 0n : fromBigNumberToBigInt(transaction.amount, 0n);
|
133
|
+
const useAllAmount = isStaking || !!transaction.useAllAmount;
|
134
|
+
const res: TransactionIntent & { memo?: { type: string; value?: string } } & {
|
135
|
+
data?: { type: string; value?: unknown };
|
136
|
+
} = {
|
137
|
+
type: intentType,
|
128
138
|
sender: account.freshAddress,
|
129
139
|
recipient: transaction.recipient,
|
130
|
-
amount
|
140
|
+
amount,
|
131
141
|
asset: { type: "native", name: account.currency.name, unit: account.currency.units[0] },
|
132
|
-
useAllAmount
|
142
|
+
useAllAmount,
|
143
|
+
feesStrategy:
|
144
|
+
transaction.feesStrategy === "custom" ? undefined : transaction.feesStrategy ?? undefined,
|
145
|
+
data: Buffer.isBuffer(transaction.data)
|
146
|
+
? { type: "buffer", value: transaction.data }
|
147
|
+
: { type: "none" },
|
133
148
|
};
|
134
149
|
if (transaction.assetReference && transaction.assetOwner) {
|
135
150
|
const { subAccountId } = transaction;
|
136
151
|
const { subAccounts } = account;
|
137
152
|
|
138
|
-
const tokenAccount =
|
139
|
-
? null
|
140
|
-
: subAccounts && subAccounts.find(ta => ta.id === subAccountId);
|
153
|
+
const tokenAccount = subAccountId ? subAccounts?.find(ta => ta.id === subAccountId) : null;
|
141
154
|
|
142
155
|
res.asset = {
|
143
156
|
type: tokenAccount?.token.tokenType ?? "token",
|
@@ -155,6 +168,7 @@ export function transactionToIntent(
|
|
155
168
|
} else {
|
156
169
|
res.memo = { type: "NO_MEMO" };
|
157
170
|
}
|
171
|
+
|
158
172
|
return res;
|
159
173
|
}
|
160
174
|
|
@@ -188,9 +202,7 @@ export const buildOptimisticOperation = (
|
|
188
202
|
},
|
189
203
|
};
|
190
204
|
|
191
|
-
const tokenAccount =
|
192
|
-
? null
|
193
|
-
: subAccounts && subAccounts.find(ta => ta.id === subAccountId);
|
205
|
+
const tokenAccount = subAccountId ? subAccounts?.find(ta => ta.id === subAccountId) : null;
|
194
206
|
if (tokenAccount && subAccountId) {
|
195
207
|
operation.subOperations = [
|
196
208
|
{
|
package/src/bridge/impl.ts
CHANGED
@@ -12,6 +12,7 @@ import type { SyncAction, SyncState, BridgeSyncState } from "./types";
|
|
12
12
|
import { BridgeSyncContext, BridgeSyncStateContext } from "./context";
|
13
13
|
import type { Account, TokenAccount } from "@ledgerhq/types-live";
|
14
14
|
import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
15
|
+
import { createSyncSessionManager } from "../syncSessionManager";
|
15
16
|
|
16
17
|
export type Props = {
|
17
18
|
// this is a wrapping component that you need to put in your tree
|
@@ -52,6 +53,7 @@ export const BridgeSync = ({
|
|
52
53
|
accounts,
|
53
54
|
hydrateCurrency,
|
54
55
|
});
|
56
|
+
const sessionManager = useRef(createSyncSessionManager(trackAnalytics)).current;
|
55
57
|
const [syncQueue, syncState] = useSyncQueue({
|
56
58
|
accounts,
|
57
59
|
prepareCurrency,
|
@@ -59,10 +61,12 @@ export const BridgeSync = ({
|
|
59
61
|
trackAnalytics,
|
60
62
|
updateAccountWithUpdater,
|
61
63
|
blacklistedTokenIds,
|
64
|
+
sessionManager,
|
62
65
|
});
|
63
66
|
const sync = useSync({
|
64
67
|
syncQueue,
|
65
68
|
accounts,
|
69
|
+
sessionManager,
|
66
70
|
});
|
67
71
|
useSyncBackground({
|
68
72
|
sync,
|
@@ -111,6 +115,7 @@ function useSyncQueue({
|
|
111
115
|
trackAnalytics,
|
112
116
|
updateAccountWithUpdater,
|
113
117
|
blacklistedTokenIds,
|
118
|
+
sessionManager,
|
114
119
|
}) {
|
115
120
|
const [bridgeSyncState, setBridgeSyncState]: [BridgeSyncState, any] = useState({});
|
116
121
|
const setAccountSyncState = useCallback((accountId: string, s: SyncState) => {
|
@@ -204,6 +209,7 @@ function useSyncQueue({
|
|
204
209
|
pending: false,
|
205
210
|
error: null,
|
206
211
|
});
|
212
|
+
sessionManager.onAccountSyncDone(accountId, accounts);
|
207
213
|
next();
|
208
214
|
},
|
209
215
|
error: (raw: Error) => {
|
@@ -215,6 +221,7 @@ function useSyncQueue({
|
|
215
221
|
pending: false,
|
216
222
|
error: null,
|
217
223
|
});
|
224
|
+
sessionManager.onAccountSyncDone(accountId, accounts);
|
218
225
|
next();
|
219
226
|
return;
|
220
227
|
}
|
@@ -223,6 +230,7 @@ function useSyncQueue({
|
|
223
230
|
pending: false,
|
224
231
|
error,
|
225
232
|
});
|
233
|
+
sessionManager.onAccountSyncDone(accountId, accounts, true);
|
226
234
|
next();
|
227
235
|
},
|
228
236
|
});
|
@@ -231,6 +239,7 @@ function useSyncQueue({
|
|
231
239
|
pending: false,
|
232
240
|
error,
|
233
241
|
});
|
242
|
+
sessionManager.onAccountSyncDone(accountId, accounts, true);
|
234
243
|
next();
|
235
244
|
}
|
236
245
|
},
|
@@ -243,6 +252,7 @@ function useSyncQueue({
|
|
243
252
|
trackAnalytics,
|
244
253
|
updateAccountWithUpdater,
|
245
254
|
blacklistedTokenIds,
|
255
|
+
sessionManager,
|
246
256
|
],
|
247
257
|
);
|
248
258
|
const synchronizeRef = useRef(synchronize);
|
@@ -259,7 +269,7 @@ function useSyncQueue({
|
|
259
269
|
}
|
260
270
|
|
261
271
|
// useSync: returns a sync function with the syncQueue
|
262
|
-
function useSync({ syncQueue, accounts }) {
|
272
|
+
function useSync({ syncQueue, accounts, sessionManager }) {
|
263
273
|
const skipUnderPriority = useRef(-1);
|
264
274
|
const sync = useMemo(() => {
|
265
275
|
const schedule = (ids: string[], priority: number, reason: string) => {
|
@@ -267,6 +277,10 @@ function useSync({ syncQueue, accounts }) {
|
|
267
277
|
// by convention we remove concurrent tasks with same priority
|
268
278
|
// FIXME this is somehow a hack. ideally we should just dedup the account ids in the pending queue...
|
269
279
|
syncQueue.remove(o => priority === o.priority);
|
280
|
+
// start a global session only if initial + all accounts
|
281
|
+
if (reason === "initial" && ids.length === accounts.length) {
|
282
|
+
sessionManager.start(ids, reason);
|
283
|
+
}
|
270
284
|
log("bridge", "schedule " + ids.join(", "));
|
271
285
|
syncQueue.push(
|
272
286
|
ids.map(accountId => ({
|
@@ -289,7 +303,7 @@ function useSync({ syncQueue, accounts }) {
|
|
289
303
|
SET_SKIP_UNDER_PRIORITY: ({ priority }: { priority: number }) => {
|
290
304
|
if (priority === skipUnderPriority.current) return;
|
291
305
|
skipUnderPriority.current = priority;
|
292
|
-
syncQueue.remove(({ priority }) => priority < skipUnderPriority);
|
306
|
+
syncQueue.remove(({ priority }) => priority < skipUnderPriority.current);
|
293
307
|
|
294
308
|
if (priority === -1 && !accounts.every(isUpToDateAccount)) {
|
295
309
|
// going back to -1 priority => retriggering a background sync if it is "Paused"
|
@@ -338,7 +352,7 @@ function useSync({ syncQueue, accounts }) {
|
|
338
352
|
});
|
339
353
|
}
|
340
354
|
};
|
341
|
-
}, [accounts, syncQueue]);
|
355
|
+
}, [accounts, syncQueue, sessionManager]);
|
342
356
|
const ref = useRef(sync);
|
343
357
|
useEffect(() => {
|
344
358
|
ref.current = sync;
|