@ledgerhq/live-common 34.54.0-nightly.20251206023719 → 34.54.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 +0 -1
- package/lib/__tests__/test-helpers/environment.js.map +1 -1
- package/lib/account/index.d.ts +0 -1
- package/lib/account/index.d.ts.map +1 -1
- package/lib/account/index.js +1 -4
- package/lib/account/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.d.ts +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.js +1 -2
- package/lib/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/broadcast.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/broadcast.js +3 -3
- package/lib/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.js +3 -3
- package/lib/bridge/generic-alpaca/currencyBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +1 -2
- 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 +7 -16
- 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 +1 -16
- 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 +4 -38
- 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 +2 -18
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts +0 -2
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/Eth.js +1 -8
- package/lib/bridge/generic-alpaca/signer/Eth.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.js +0 -7
- package/lib/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/types.d.ts +0 -4
- package/lib/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +3 -12
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/impl.d.ts.map +1 -1
- package/lib/bridge/impl.js +3 -14
- package/lib/bridge/impl.js.map +1 -1
- package/lib/currencies/cryptoIcons.d.ts +3 -0
- package/lib/currencies/cryptoIcons.d.ts.map +1 -0
- package/lib/currencies/cryptoIcons.js +24 -0
- package/lib/currencies/cryptoIcons.js.map +1 -0
- package/lib/currencies/helpers.d.ts +0 -1
- package/lib/currencies/helpers.d.ts.map +1 -1
- package/lib/currencies/helpers.js +1 -7
- package/lib/currencies/helpers.js.map +1 -1
- package/lib/e2e/data/deviceLabelsData.d.ts.map +1 -1
- package/lib/e2e/data/deviceLabelsData.js +0 -1
- package/lib/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib/e2e/enum/Device.d.ts +0 -1
- package/lib/e2e/enum/Device.d.ts.map +1 -1
- package/lib/e2e/enum/Device.js +0 -1
- package/lib/e2e/enum/Device.js.map +1 -1
- package/lib/e2e/families/cardano.d.ts.map +1 -1
- package/lib/e2e/families/cardano.js +14 -29
- package/lib/e2e/families/cardano.js.map +1 -1
- package/lib/e2e/index.d.ts +3 -23
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/index.js +1 -21
- package/lib/e2e/index.js.map +1 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +4 -31
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/e2e/speculosAppVersion.d.ts.map +1 -1
- package/lib/e2e/speculosAppVersion.js +2 -6
- package/lib/e2e/speculosAppVersion.js.map +1 -1
- package/lib/e2e/swap.d.ts.map +1 -1
- package/lib/e2e/swap.js +6 -7
- package/lib/e2e/swap.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/exchange/swap/postSwapState.d.ts.map +1 -1
- package/lib/exchange/swap/postSwapState.js +6 -10
- package/lib/exchange/swap/postSwapState.js.map +1 -1
- package/lib/exchange/swap/types.d.ts +1 -3
- package/lib/exchange/swap/types.d.ts.map +1 -1
- package/lib/families/bitcoin/walletApiAdapter.d.ts.map +1 -1
- package/lib/families/bitcoin/walletApiAdapter.js +0 -3
- package/lib/families/bitcoin/walletApiAdapter.js.map +1 -1
- package/lib/families/canton/config.d.ts.map +1 -1
- package/lib/families/canton/config.js +4 -4
- package/lib/families/canton/config.js.map +1 -1
- package/lib/families/canton/react.d.ts +0 -2
- package/lib/families/canton/react.d.ts.map +1 -1
- package/lib/families/canton/react.js +1 -40
- package/lib/families/canton/react.js.map +1 -1
- package/lib/families/celo/setup.d.ts.map +1 -1
- package/lib/families/celo/setup.js +0 -11
- package/lib/families/celo/setup.js.map +1 -1
- package/lib/families/evm/bridge/mock.d.ts +0 -1
- package/lib/families/evm/bridge/mock.d.ts.map +1 -1
- package/lib/families/evm/bridge/mock.js +0 -12
- package/lib/families/evm/bridge/mock.js.map +1 -1
- package/lib/families/evm/setup.d.ts +4 -1
- package/lib/families/evm/setup.d.ts.map +1 -1
- package/lib/families/evm/setup.js +8 -1
- package/lib/families/evm/setup.js.map +1 -1
- package/lib/families/evm/walletApiAdapter.d.ts +0 -7
- package/lib/families/evm/walletApiAdapter.d.ts.map +1 -1
- package/lib/families/evm/walletApiAdapter.js +2 -36
- package/lib/families/evm/walletApiAdapter.js.map +1 -1
- package/lib/families/polkadot/config.js +1 -1
- package/lib/families/polkadot/config.js.map +1 -1
- package/lib/families/stacks/constants.d.ts +1 -1
- package/lib/families/stacks/constants.d.ts.map +1 -1
- package/lib/families/stacks/constants.js +1 -1
- package/lib/families/stacks/constants.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +1 -18
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/stakePrograms/index.js +4 -4
- package/lib/featureFlags/stakePrograms/index.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 +1 -0
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +32 -30
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/generated/bridge/mock.d.ts +0 -1
- package/lib/generated/bridge/mock.d.ts.map +1 -1
- package/lib/helpers.d.ts +0 -1
- package/lib/helpers.d.ts.map +1 -1
- package/lib/helpers.js +0 -15
- package/lib/helpers.js.map +1 -1
- package/lib/hw/getAppAndVersion.d.ts +1 -3
- package/lib/hw/getAppAndVersion.d.ts.map +1 -1
- package/lib/hw/getAppAndVersion.js +2 -2
- package/lib/hw/getAppAndVersion.js.map +1 -1
- package/lib/load/speculos.d.ts.map +1 -1
- package/lib/load/speculos.js +0 -1
- package/lib/load/speculos.js.map +1 -1
- package/lib/operation.d.ts.map +1 -1
- package/lib/operation.js +2 -7
- package/lib/operation.js.map +1 -1
- package/lib/postOnboarding/reducer.d.ts +0 -2
- package/lib/postOnboarding/reducer.d.ts.map +1 -1
- package/lib/react.d.ts +16 -0
- package/lib/react.d.ts.map +1 -0
- package/lib/react.js +64 -0
- package/lib/react.js.map +1 -0
- package/lib/reactNative.d.ts +16 -0
- package/lib/reactNative.d.ts.map +1 -0
- package/lib/reactNative.js +43 -0
- package/lib/reactNative.js.map +1 -0
- package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib/wallet-api/Exchange/server.js +0 -4
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib/wallet-api/constants.d.ts +1 -1
- package/lib/walletSync/getEnvironmentParams.js +6 -6
- package/lib/walletSync/getEnvironmentParams.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 +0 -1
- package/lib-es/__tests__/test-helpers/environment.js.map +1 -1
- package/lib-es/account/index.d.ts +0 -1
- package/lib-es/account/index.d.ts.map +1 -1
- package/lib-es/account/index.js +0 -1
- package/lib-es/account/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.js +1 -2
- package/lib-es/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.js +3 -3
- package/lib-es/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.js +3 -3
- package/lib-es/bridge/generic-alpaca/currencyBridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +1 -2
- 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 +7 -16
- 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 +1 -16
- 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 +4 -38
- 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 +2 -18
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts +0 -2
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.js +0 -4
- package/lib-es/bridge/generic-alpaca/signer/Eth.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 +0 -7
- package/lib-es/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts +0 -4
- package/lib-es/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +3 -12
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/impl.d.ts.map +1 -1
- package/lib-es/bridge/impl.js +3 -14
- package/lib-es/bridge/impl.js.map +1 -1
- package/lib-es/currencies/cryptoIcons.d.ts +3 -0
- package/lib-es/currencies/cryptoIcons.d.ts.map +1 -0
- package/lib-es/currencies/cryptoIcons.js +20 -0
- package/lib-es/currencies/cryptoIcons.js.map +1 -0
- package/lib-es/currencies/helpers.d.ts +0 -1
- package/lib-es/currencies/helpers.d.ts.map +1 -1
- package/lib-es/currencies/helpers.js +0 -5
- package/lib-es/currencies/helpers.js.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.d.ts.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.js +0 -1
- package/lib-es/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib-es/e2e/enum/Device.d.ts +0 -1
- package/lib-es/e2e/enum/Device.d.ts.map +1 -1
- package/lib-es/e2e/enum/Device.js +0 -1
- package/lib-es/e2e/enum/Device.js.map +1 -1
- package/lib-es/e2e/families/cardano.d.ts.map +1 -1
- package/lib-es/e2e/families/cardano.js +14 -29
- package/lib-es/e2e/families/cardano.js.map +1 -1
- package/lib-es/e2e/index.d.ts +3 -23
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/index.js +0 -16
- package/lib-es/e2e/index.js.map +1 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +4 -31
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/e2e/speculosAppVersion.d.ts.map +1 -1
- package/lib-es/e2e/speculosAppVersion.js +2 -6
- package/lib-es/e2e/speculosAppVersion.js.map +1 -1
- package/lib-es/e2e/swap.d.ts.map +1 -1
- package/lib-es/e2e/swap.js +6 -7
- package/lib-es/e2e/swap.js.map +1 -1
- package/lib-es/env.react.d.ts +1 -1
- package/lib-es/env.react.d.ts.map +1 -1
- package/lib-es/exchange/swap/postSwapState.d.ts.map +1 -1
- package/lib-es/exchange/swap/postSwapState.js +6 -10
- package/lib-es/exchange/swap/postSwapState.js.map +1 -1
- package/lib-es/exchange/swap/types.d.ts +1 -3
- package/lib-es/exchange/swap/types.d.ts.map +1 -1
- package/lib-es/families/bitcoin/walletApiAdapter.d.ts.map +1 -1
- package/lib-es/families/bitcoin/walletApiAdapter.js +0 -3
- package/lib-es/families/bitcoin/walletApiAdapter.js.map +1 -1
- package/lib-es/families/canton/config.d.ts.map +1 -1
- package/lib-es/families/canton/config.js +4 -4
- package/lib-es/families/canton/config.js.map +1 -1
- package/lib-es/families/canton/react.d.ts +0 -2
- package/lib-es/families/canton/react.d.ts.map +1 -1
- package/lib-es/families/canton/react.js +1 -38
- package/lib-es/families/canton/react.js.map +1 -1
- package/lib-es/families/celo/setup.d.ts.map +1 -1
- package/lib-es/families/celo/setup.js +0 -11
- package/lib-es/families/celo/setup.js.map +1 -1
- package/lib-es/families/evm/bridge/mock.d.ts +0 -1
- package/lib-es/families/evm/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/evm/bridge/mock.js +0 -12
- package/lib-es/families/evm/bridge/mock.js.map +1 -1
- package/lib-es/families/evm/setup.d.ts +4 -1
- package/lib-es/families/evm/setup.d.ts.map +1 -1
- package/lib-es/families/evm/setup.js +8 -2
- package/lib-es/families/evm/setup.js.map +1 -1
- package/lib-es/families/evm/walletApiAdapter.d.ts +0 -7
- package/lib-es/families/evm/walletApiAdapter.d.ts.map +1 -1
- package/lib-es/families/evm/walletApiAdapter.js +1 -30
- package/lib-es/families/evm/walletApiAdapter.js.map +1 -1
- package/lib-es/families/polkadot/config.js +1 -1
- package/lib-es/families/polkadot/config.js.map +1 -1
- package/lib-es/families/stacks/constants.d.ts +1 -1
- package/lib-es/families/stacks/constants.d.ts.map +1 -1
- package/lib-es/families/stacks/constants.js +1 -1
- package/lib-es/families/stacks/constants.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +1 -18
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/stakePrograms/index.js +4 -4
- package/lib-es/featureFlags/stakePrograms/index.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 +1 -0
- package/lib-es/generated/bridge/js.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.js +2 -0
- package/lib-es/generated/bridge/js.js.map +1 -1
- package/lib-es/generated/bridge/mock.d.ts +0 -1
- package/lib-es/generated/bridge/mock.d.ts.map +1 -1
- package/lib-es/helpers.d.ts +0 -1
- package/lib-es/helpers.d.ts.map +1 -1
- package/lib-es/helpers.js +0 -1
- package/lib-es/helpers.js.map +1 -1
- package/lib-es/hw/getAppAndVersion.d.ts +1 -3
- package/lib-es/hw/getAppAndVersion.d.ts.map +1 -1
- package/lib-es/hw/getAppAndVersion.js +2 -2
- package/lib-es/hw/getAppAndVersion.js.map +1 -1
- package/lib-es/load/speculos.d.ts.map +1 -1
- package/lib-es/load/speculos.js +0 -1
- package/lib-es/load/speculos.js.map +1 -1
- package/lib-es/operation.d.ts.map +1 -1
- package/lib-es/operation.js +2 -7
- package/lib-es/operation.js.map +1 -1
- package/lib-es/postOnboarding/reducer.d.ts +0 -2
- package/lib-es/postOnboarding/reducer.d.ts.map +1 -1
- package/lib-es/react.d.ts +16 -0
- package/lib-es/react.d.ts.map +1 -0
- package/lib-es/react.js +33 -0
- package/lib-es/react.js.map +1 -0
- package/lib-es/reactNative.d.ts +16 -0
- package/lib-es/reactNative.d.ts.map +1 -0
- package/lib-es/reactNative.js +15 -0
- package/lib-es/reactNative.js.map +1 -0
- package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib-es/wallet-api/Exchange/server.js +0 -4
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/wallet-api/constants.d.ts +1 -1
- package/lib-es/walletSync/getEnvironmentParams.js +6 -6
- package/lib-es/walletSync/getEnvironmentParams.js.map +1 -1
- package/package.json +86 -78
- package/react.js +1 -0
- package/reactNative.js +1 -0
- package/src/__tests__/test-helpers/bridge.ts +1 -1
- package/src/__tests__/test-helpers/environment.ts +0 -1
- package/src/account/index.ts +0 -6
- package/src/bridge/generic-alpaca/accountBridge.ts +2 -3
- package/src/bridge/generic-alpaca/broadcast.ts +3 -6
- package/src/bridge/generic-alpaca/currencyBridge.ts +3 -3
- package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +1 -2
- package/src/bridge/generic-alpaca/getAccountShape.ts +12 -24
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +1 -16
- package/src/bridge/generic-alpaca/prepareTransaction.ts +10 -44
- package/src/bridge/generic-alpaca/signOperation.ts +2 -18
- package/src/bridge/generic-alpaca/signer/Eth.ts +1 -5
- package/src/bridge/generic-alpaca/signer/index.ts +0 -7
- package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +2 -2
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +0 -32
- package/src/bridge/generic-alpaca/types.ts +0 -4
- package/src/bridge/generic-alpaca/utils.test.ts +0 -4
- package/src/bridge/generic-alpaca/utils.ts +3 -15
- package/src/bridge/impl.ts +3 -16
- package/src/currencies/cryptoIcons.test.ts +54 -0
- package/src/currencies/cryptoIcons.ts +21 -0
- package/src/currencies/helpers.test.ts +1 -10
- package/src/currencies/helpers.ts +0 -6
- package/src/e2e/data/deviceLabelsData.ts +0 -1
- package/src/e2e/enum/Device.ts +0 -1
- package/src/e2e/families/cardano.ts +14 -32
- package/src/e2e/index.ts +0 -20
- package/src/e2e/speculos.ts +4 -35
- package/src/e2e/speculosAppVersion.ts +2 -8
- package/src/e2e/swap.ts +7 -8
- package/src/exchange/swap/postSwapState.ts +5 -10
- package/src/exchange/swap/types.ts +1 -3
- package/src/families/bitcoin/walletApiAdapter.test.ts +0 -36
- package/src/families/bitcoin/walletApiAdapter.ts +0 -4
- package/src/families/canton/config.ts +4 -5
- package/src/families/canton/react.ts +1 -45
- package/src/families/celo/setup.ts +0 -12
- package/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap +4 -73
- 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/evm/bridge/mock.ts +0 -14
- package/src/families/evm/setup.ts +22 -3
- package/src/families/evm/walletApiAdapter.ts +1 -33
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +17 -278
- package/src/families/polkadot/__snapshots__/bridge.integration.test.ts.snap +3653 -6
- package/src/families/polkadot/config.ts +1 -1
- package/src/families/stacks/__snapshots__/bridge.integration.test.ts.snap +17 -1536
- package/src/families/stacks/__tests__/sync.integration.test.ts +2 -2
- package/src/families/stacks/constants.ts +1 -1
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +9 -9
- package/src/featureFlags/defaultFeatures.ts +1 -18
- package/src/featureFlags/stakePrograms/index.ts +4 -4
- package/src/generated/bridge/js.ts +2 -0
- package/src/helpers.ts +0 -2
- package/src/hw/getAppAndVersion.ts +1 -2
- package/src/load/speculos.ts +0 -1
- package/src/operation.ts +2 -10
- package/src/react.tsx +43 -0
- package/src/reactNative.ts +23 -0
- package/src/reactNativeSvg.d.ts +19 -0
- package/src/wallet-api/Exchange/server.ts +0 -5
- package/src/walletSync/getEnvironmentParams.ts +6 -6
- package/lib/account/recentAddresses.d.ts +0 -10
- package/lib/account/recentAddresses.d.ts.map +0 -1
- package/lib/account/recentAddresses.js +0 -60
- package/lib/account/recentAddresses.js.map +0 -1
- package/lib/bridge/generic-alpaca/postSync.d.ts +0 -16
- package/lib/bridge/generic-alpaca/postSync.d.ts.map +0 -1
- package/lib/bridge/generic-alpaca/postSync.js +0 -44
- package/lib/bridge/generic-alpaca/postSync.js.map +0 -1
- package/lib/e2e/data/regexes.d.ts +0 -2
- package/lib/e2e/data/regexes.d.ts.map +0 -1
- package/lib/e2e/data/regexes.js +0 -5
- package/lib/e2e/data/regexes.js.map +0 -1
- package/lib/families/hedera/react.d.ts +0 -6
- package/lib/families/hedera/react.d.ts.map +0 -1
- package/lib/families/hedera/react.js +0 -50
- package/lib/families/hedera/react.js.map +0 -1
- package/lib/helpers/cryptoIconSize.d.ts +0 -3
- package/lib/helpers/cryptoIconSize.d.ts.map +0 -1
- package/lib/helpers/cryptoIconSize.js +0 -40
- package/lib/helpers/cryptoIconSize.js.map +0 -1
- package/lib/hooks/useHtmlLinkSegments.d.ts +0 -19
- package/lib/hooks/useHtmlLinkSegments.d.ts.map +0 -1
- package/lib/hooks/useHtmlLinkSegments.js +0 -128
- package/lib/hooks/useHtmlLinkSegments.js.map +0 -1
- package/lib-es/account/recentAddresses.d.ts +0 -10
- package/lib-es/account/recentAddresses.d.ts.map +0 -1
- package/lib-es/account/recentAddresses.js +0 -55
- package/lib-es/account/recentAddresses.js.map +0 -1
- package/lib-es/bridge/generic-alpaca/postSync.d.ts +0 -16
- package/lib-es/bridge/generic-alpaca/postSync.d.ts.map +0 -1
- package/lib-es/bridge/generic-alpaca/postSync.js +0 -37
- package/lib-es/bridge/generic-alpaca/postSync.js.map +0 -1
- package/lib-es/e2e/data/regexes.d.ts +0 -2
- package/lib-es/e2e/data/regexes.d.ts.map +0 -1
- package/lib-es/e2e/data/regexes.js +0 -2
- package/lib-es/e2e/data/regexes.js.map +0 -1
- package/lib-es/families/hedera/react.d.ts +0 -6
- package/lib-es/families/hedera/react.d.ts.map +0 -1
- package/lib-es/families/hedera/react.js +0 -41
- package/lib-es/families/hedera/react.js.map +0 -1
- package/lib-es/helpers/cryptoIconSize.d.ts +0 -3
- package/lib-es/helpers/cryptoIconSize.d.ts.map +0 -1
- package/lib-es/helpers/cryptoIconSize.js +0 -35
- package/lib-es/helpers/cryptoIconSize.js.map +0 -1
- package/lib-es/hooks/useHtmlLinkSegments.d.ts +0 -19
- package/lib-es/hooks/useHtmlLinkSegments.d.ts.map +0 -1
- package/lib-es/hooks/useHtmlLinkSegments.js +0 -121
- package/lib-es/hooks/useHtmlLinkSegments.js.map +0 -1
- package/src/account/recentAddresses.test.ts +0 -104
- package/src/account/recentAddresses.ts +0 -84
- package/src/bridge/generic-alpaca/postSync.test.ts +0 -97
- package/src/bridge/generic-alpaca/postSync.ts +0 -42
- package/src/e2e/data/regexes.ts +0 -1
- package/src/families/canton/react.test.ts +0 -147
- package/src/families/hedera/react.test.ts +0 -272
- package/src/families/hedera/react.ts +0 -63
- package/src/helpers/cryptoIconSize.ts +0 -25
- package/src/hooks/__tests__/useHtmlLinkSegments.test.ts +0 -105
- package/src/hooks/useHtmlLinkSegments.ts +0 -158
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AccountBridge } from "@ledgerhq/types-live";
|
|
2
2
|
import { makeSync } from "../jsHelpers";
|
|
3
3
|
import { genericGetAccountShape } from "./getAccountShape";
|
|
4
4
|
import {
|
|
@@ -16,7 +16,6 @@ import { genericBroadcast } from "./broadcast";
|
|
|
16
16
|
import { genericSignOperation } from "./signOperation";
|
|
17
17
|
import { genericSignRawOperation } from "./signRawOperation";
|
|
18
18
|
import type { AlpacaSigner } from "./signer/types";
|
|
19
|
-
import { postSync } from "./postSync";
|
|
20
19
|
|
|
21
20
|
export function getAlpacaAccountBridge(
|
|
22
21
|
network: string,
|
|
@@ -25,7 +24,7 @@ export function getAlpacaAccountBridge(
|
|
|
25
24
|
): AccountBridge<any> {
|
|
26
25
|
const signer = customSigner ?? getSigner(network);
|
|
27
26
|
return {
|
|
28
|
-
sync: makeSync({ getAccountShape: genericGetAccountShape(network, kind)
|
|
27
|
+
sync: makeSync({ getAccountShape: genericGetAccountShape(network, kind) }),
|
|
29
28
|
receive: makeAccountBridgeReceive(getAddressWrapper(signer.getAddress)),
|
|
30
29
|
createTransaction: createTransaction,
|
|
31
30
|
updateTransaction: updateTransaction<any>,
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { AccountBridge, TransactionCommon } from "@ledgerhq/types-live";
|
|
2
|
-
import { patchOperationWithHash } from "
|
|
2
|
+
import { patchOperationWithHash } from "../../operation";
|
|
3
3
|
import { getAlpacaApi } from "./alpaca";
|
|
4
4
|
|
|
5
5
|
export const genericBroadcast: (network, kind) => AccountBridge<TransactionCommon>["broadcast"] =
|
|
6
6
|
(network, kind) =>
|
|
7
|
-
async ({ signedOperation: { signature, operation }, account
|
|
8
|
-
const hash = await getAlpacaApi(account.currency.id, kind).broadcast(
|
|
9
|
-
signature,
|
|
10
|
-
broadcastConfig,
|
|
11
|
-
);
|
|
7
|
+
async ({ signedOperation: { signature, operation }, account }) => {
|
|
8
|
+
const hash = await getAlpacaApi(account.currency.id, kind).broadcast(signature);
|
|
12
9
|
|
|
13
10
|
return patchOperationWithHash(operation, hash);
|
|
14
11
|
};
|
|
@@ -3,7 +3,6 @@ import { CurrencyBridge } from "@ledgerhq/types-live";
|
|
|
3
3
|
import { genericGetAccountShape } from "./getAccountShape";
|
|
4
4
|
import { getSigner } from "./signer";
|
|
5
5
|
import type { AlpacaSigner } from "./signer/types";
|
|
6
|
-
import { postSync } from "./postSync";
|
|
7
6
|
|
|
8
7
|
export function getAlpacaCurrencyBridge(
|
|
9
8
|
network: string,
|
|
@@ -13,11 +12,12 @@ export function getAlpacaCurrencyBridge(
|
|
|
13
12
|
const signer = customSigner ?? getSigner(network);
|
|
14
13
|
return {
|
|
15
14
|
preload: () => Promise.resolve({}),
|
|
16
|
-
hydrate: () =>
|
|
15
|
+
hydrate: () => {
|
|
16
|
+
return;
|
|
17
|
+
},
|
|
17
18
|
scanAccounts: makeScanAccounts({
|
|
18
19
|
getAccountShape: genericGetAccountShape(network, kind),
|
|
19
20
|
getAddressFn: signer.getAddress.bind(signer),
|
|
20
|
-
postSync,
|
|
21
21
|
}),
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -30,12 +30,11 @@ export function genericEstimateMaxSpendable(
|
|
|
30
30
|
)
|
|
31
31
|
).value;
|
|
32
32
|
}
|
|
33
|
-
// TODO Remove the call to `validateIntent` https://ledgerhq.atlassian.net/browse/LIVE-22229
|
|
34
33
|
const { amount } = await alpacaApi.validateIntent(
|
|
35
34
|
transactionToIntent(account, { ...draftTransaction }, alpacaApi.computeIntentType),
|
|
36
35
|
{ value: transaction?.fees ? BigInt(transaction.fees.toString()) : 0n },
|
|
37
36
|
);
|
|
38
|
-
if (["stellar", "tezos"
|
|
37
|
+
if (["stellar", "tezos"].includes(network)) {
|
|
39
38
|
return amount > 0 ? new BigNumber(amount.toString()) : new BigNumber(0);
|
|
40
39
|
}
|
|
41
40
|
const bnFee = BigNumber(fees.toString());
|
|
@@ -17,10 +17,6 @@ function isNftCoreOp(operation: Operation): boolean {
|
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function isInternalLiveOp(operation: OperationCommon): boolean {
|
|
21
|
-
return !!operation.extra?.internal;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
20
|
export function genericGetAccountShape(network: string, kind: string): GetAccountShape {
|
|
25
21
|
return async (info, syncConfig) => {
|
|
26
22
|
const { address, initialAccount, currency, derivationMode } = info;
|
|
@@ -62,7 +58,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
|
62
58
|
|
|
63
59
|
// Calculate minHeight for pagination
|
|
64
60
|
const minHeight = syncFromScratch ? 0 : (oldOps[0]?.blockHeight ?? 0) + 1;
|
|
65
|
-
const paginationParams: Pagination = { minHeight, order: "
|
|
61
|
+
const paginationParams: Pagination = { minHeight, order: "asc" };
|
|
66
62
|
if (lastPagingToken && !syncFromScratch) {
|
|
67
63
|
paginationParams.lastPagingToken = lastPagingToken;
|
|
68
64
|
}
|
|
@@ -78,7 +74,6 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
|
78
74
|
operation?.extra?.assetOwner &&
|
|
79
75
|
!["OPT_IN", "OPT_OUT"].includes(operation.type),
|
|
80
76
|
);
|
|
81
|
-
const newInternalOperations = newOps.filter(isInternalLiveOp);
|
|
82
77
|
const newSubAccounts = await buildSubAccounts({
|
|
83
78
|
accountId,
|
|
84
79
|
allTokenAssetsBalances,
|
|
@@ -90,29 +85,22 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
|
90
85
|
? newSubAccounts
|
|
91
86
|
: mergeSubAccounts(initialAccount?.subAccounts ?? [], newSubAccounts);
|
|
92
87
|
|
|
93
|
-
const newOpsWithSubs = newOps
|
|
94
|
-
|
|
95
|
-
.map(op => {
|
|
96
|
-
const subOperations = inferSubOperations(op.hash, newSubAccounts);
|
|
97
|
-
const internalOperations = newInternalOperations.filter(it => it.hash === op.hash);
|
|
88
|
+
const newOpsWithSubs = newOps.map(op => {
|
|
89
|
+
const subOperations = inferSubOperations(op.hash, newSubAccounts);
|
|
98
90
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
internalOperations,
|
|
103
|
-
});
|
|
91
|
+
return cleanedOperation({
|
|
92
|
+
...op,
|
|
93
|
+
subOperations,
|
|
104
94
|
});
|
|
105
|
-
|
|
106
|
-
// Useful for integrations without explorers
|
|
107
|
-
const operationsToRefresh = initialAccount?.pendingOperations.filter(
|
|
108
|
-
pendingOp => !newOpsWithSubs.some(newOp => pendingOp.hash === newOp.hash),
|
|
109
|
-
);
|
|
95
|
+
});
|
|
110
96
|
const confirmedOperations =
|
|
111
|
-
alpacaApi.refreshOperations &&
|
|
112
|
-
? await alpacaApi.refreshOperations(
|
|
97
|
+
alpacaApi.refreshOperations && initialAccount?.pendingOperations.length
|
|
98
|
+
? await alpacaApi.refreshOperations(initialAccount.pendingOperations)
|
|
113
99
|
: [];
|
|
114
100
|
const newOperations = [...confirmedOperations, ...newOpsWithSubs];
|
|
115
|
-
const operations =
|
|
101
|
+
const operations = syncFromScratch
|
|
102
|
+
? newOperations
|
|
103
|
+
: (mergeOps(oldOps, newOperations) as OperationCommon[]);
|
|
116
104
|
|
|
117
105
|
const res: Partial<Account> = {
|
|
118
106
|
id: accountId,
|
|
@@ -26,7 +26,6 @@ export function genericGetTransactionStatus(
|
|
|
26
26
|
feesStrategy: transaction.feesStrategy,
|
|
27
27
|
data: transaction.data,
|
|
28
28
|
type: transaction.type,
|
|
29
|
-
sponsored: transaction.sponsored,
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
if (alpacaApi.getChainSpecificRules) {
|
|
@@ -38,24 +37,10 @@ export function genericGetTransactionStatus(
|
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
const fees = BigInt(transaction.fees?.toString() || "0");
|
|
42
|
-
const feesParameters = {
|
|
43
|
-
...(transaction.gasLimit ? { gasLimit: BigInt(transaction.gasLimit.toFixed()) } : {}),
|
|
44
|
-
...(transaction.gasPrice ? { gasPrice: BigInt(transaction.gasPrice.toFixed()) } : {}),
|
|
45
|
-
...(transaction.maxFeePerGas
|
|
46
|
-
? { maxFeePerGas: BigInt(transaction.maxFeePerGas.toFixed()) }
|
|
47
|
-
: {}),
|
|
48
|
-
...(transaction.maxPriorityFeePerGas
|
|
49
|
-
? { maxPriorityFeePerGas: BigInt(transaction.maxPriorityFeePerGas.toFixed()) }
|
|
50
|
-
: {}),
|
|
51
|
-
...(transaction.additionalFees
|
|
52
|
-
? { additionalFees: BigInt(transaction.additionalFees.toFixed()) }
|
|
53
|
-
: {}),
|
|
54
|
-
};
|
|
55
40
|
const { errors, warnings, estimatedFees, amount, totalSpent, totalFees } =
|
|
56
41
|
await alpacaApi.validateIntent(
|
|
57
42
|
transactionToIntent(account, draftTransaction, alpacaApi.computeIntentType),
|
|
58
|
-
{ value: fees
|
|
43
|
+
{ value: transaction.fees ? BigInt(transaction.fees.toString()) : 0n },
|
|
59
44
|
);
|
|
60
45
|
|
|
61
46
|
return {
|
|
@@ -31,11 +31,6 @@ function propagateField(estimation: FeeEstimation, field: string, dest: GenericT
|
|
|
31
31
|
dest[field] = Number(value.toString());
|
|
32
32
|
return;
|
|
33
33
|
case "storageLimit":
|
|
34
|
-
case "gasLimit":
|
|
35
|
-
case "gasPrice":
|
|
36
|
-
case "maxFeePerGas":
|
|
37
|
-
case "maxPriorityFeePerGas":
|
|
38
|
-
case "additionalFees":
|
|
39
34
|
dest[field] = new BigNumber(value.toString());
|
|
40
35
|
return;
|
|
41
36
|
default:
|
|
@@ -56,37 +51,17 @@ export function genericPrepareTransaction(
|
|
|
56
51
|
? await getAssetInfos(transaction, account.freshAddress, getAssetFromToken)
|
|
57
52
|
: assetInfosFallback(transaction);
|
|
58
53
|
const customParametersFees = transaction.customFees?.parameters?.fees;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Ticking `useAllAmount` constantly resets the amount to 0. This is problematic
|
|
62
|
-
* because some Blockchain need the actual transaction amount to compute the fees
|
|
63
|
-
* (Example with EVM and ERC20 transactions)
|
|
64
|
-
* In case of `useAllAmount` and token transaction, we read the token account spendable
|
|
65
|
-
* balance instead.
|
|
66
|
-
*/
|
|
67
|
-
let amount = transaction.amount;
|
|
68
|
-
if (transaction.useAllAmount && transaction.subAccountId) {
|
|
69
|
-
const subAccount = account.subAccounts?.find(acc => acc.id === transaction.subAccountId);
|
|
70
|
-
amount = subAccount?.spendableBalance ?? amount;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Pass any parameters that help estimating fees
|
|
74
|
-
const intent = transactionToIntent(
|
|
75
|
-
account,
|
|
76
|
-
{
|
|
77
|
-
...transaction,
|
|
78
|
-
amount,
|
|
79
|
-
},
|
|
80
|
-
computeIntentType,
|
|
81
|
-
);
|
|
82
54
|
const estimation: FeeEstimation = customParametersFees
|
|
83
55
|
? { value: BigInt(customParametersFees.toFixed()) }
|
|
84
|
-
: await estimateFees(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
56
|
+
: await estimateFees(
|
|
57
|
+
transactionToIntent(
|
|
58
|
+
account,
|
|
59
|
+
{
|
|
60
|
+
...transaction,
|
|
61
|
+
},
|
|
62
|
+
computeIntentType,
|
|
63
|
+
),
|
|
64
|
+
);
|
|
90
65
|
const fees = new BigNumber(estimation.value.toString());
|
|
91
66
|
|
|
92
67
|
if (!bnEq(transaction.fees, fees)) {
|
|
@@ -103,15 +78,7 @@ export function genericPrepareTransaction(
|
|
|
103
78
|
};
|
|
104
79
|
|
|
105
80
|
// Propagate needed fields
|
|
106
|
-
const fieldsToPropagate = [
|
|
107
|
-
"type",
|
|
108
|
-
"storageLimit",
|
|
109
|
-
"gasLimit",
|
|
110
|
-
"gasPrice",
|
|
111
|
-
"maxFeePerGas",
|
|
112
|
-
"maxPriorityFeePerGas",
|
|
113
|
-
"additionalFees",
|
|
114
|
-
];
|
|
81
|
+
const fieldsToPropagate = ["type", "storageLimit"];
|
|
115
82
|
|
|
116
83
|
for (const field of fieldsToPropagate) {
|
|
117
84
|
propagateField(estimation, field, next);
|
|
@@ -119,7 +86,6 @@ export function genericPrepareTransaction(
|
|
|
119
86
|
|
|
120
87
|
// align with stellar/xrp: when send max (or staking intents), reflect validated amount in UI
|
|
121
88
|
if (transaction.useAllAmount || ["stake", "unstake"].includes(transaction.mode ?? "")) {
|
|
122
|
-
// TODO Remove the call to `validateIntent` https://ledgerhq.atlassian.net/browse/LIVE-22228
|
|
123
89
|
const { amount } = await validateIntent(
|
|
124
90
|
transactionToIntent(
|
|
125
91
|
account,
|
|
@@ -86,19 +86,6 @@ export const genericSignOperation =
|
|
|
86
86
|
const alpacaApi = getAlpacaApi(account.currency.id, kind);
|
|
87
87
|
if (!transaction.fees) throw new FeeNotLoaded();
|
|
88
88
|
const fees = BigInt(transaction.fees?.toString() || "0");
|
|
89
|
-
const feesParameters = {
|
|
90
|
-
...(transaction.gasLimit ? { gasLimit: BigInt(transaction.gasLimit.toFixed()) } : {}),
|
|
91
|
-
...(transaction.gasPrice ? { gasPrice: BigInt(transaction.gasPrice.toFixed()) } : {}),
|
|
92
|
-
...(transaction.maxFeePerGas
|
|
93
|
-
? { maxFeePerGas: BigInt(transaction.maxFeePerGas.toFixed()) }
|
|
94
|
-
: {}),
|
|
95
|
-
...(transaction.maxPriorityFeePerGas
|
|
96
|
-
? { maxPriorityFeePerGas: BigInt(transaction.maxPriorityFeePerGas.toFixed()) }
|
|
97
|
-
: {}),
|
|
98
|
-
...(transaction.additionalFees
|
|
99
|
-
? { additionalFees: BigInt(transaction.additionalFees.toFixed()) }
|
|
100
|
-
: {}),
|
|
101
|
-
};
|
|
102
89
|
if (transaction.useAllAmount) {
|
|
103
90
|
const draftTransaction = {
|
|
104
91
|
mode: transaction.mode,
|
|
@@ -111,12 +98,10 @@ export const genericSignOperation =
|
|
|
111
98
|
family: transaction.family,
|
|
112
99
|
feesStrategy: transaction.feesStrategy,
|
|
113
100
|
data: transaction.data,
|
|
114
|
-
type: transaction.type,
|
|
115
101
|
};
|
|
116
|
-
// TODO Remove the call to `validateIntent` https://ledgerhq.atlassian.net/browse/LIVE-22227
|
|
117
102
|
const { amount } = await alpacaApi.validateIntent(
|
|
118
103
|
transactionToIntent(account, draftTransaction, alpacaApi.computeIntentType),
|
|
119
|
-
{ value: fees
|
|
104
|
+
{ value: fees },
|
|
120
105
|
);
|
|
121
106
|
transaction.amount = new BigNumber(amount.toString());
|
|
122
107
|
}
|
|
@@ -134,7 +119,7 @@ export const genericSignOperation =
|
|
|
134
119
|
// Enrich with memo and asset information
|
|
135
120
|
transactionIntent = enrichTransactionIntent(transactionIntent, transaction, publicKey);
|
|
136
121
|
|
|
137
|
-
if (typeof transactionIntent.sequence !== "bigint"
|
|
122
|
+
if (typeof transactionIntent.sequence !== "bigint") {
|
|
138
123
|
// TODO: should compute it and pass it down to craftTransaction (duplicate call right now)
|
|
139
124
|
const sequenceNumber = await alpacaApi.getSequence(transactionIntent.sender);
|
|
140
125
|
transactionIntent.sequence = sequenceNumber;
|
|
@@ -143,7 +128,6 @@ export const genericSignOperation =
|
|
|
143
128
|
/* Craft unsigned blob via Alpaca */
|
|
144
129
|
const { transaction: unsigned } = await alpacaApi.craftTransaction(transactionIntent, {
|
|
145
130
|
value: fees,
|
|
146
|
-
parameters: feesParameters,
|
|
147
131
|
});
|
|
148
132
|
|
|
149
133
|
/* Notify UI that the device is now showing the tx */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { filter, firstValueFrom } from "rxjs";
|
|
2
2
|
import { EvmAddress, EvmSignature, EvmSigner } from "@ledgerhq/coin-evm/types/signer";
|
|
3
|
-
import { CreateSigner
|
|
3
|
+
import { CreateSigner } from "../../setup";
|
|
4
4
|
import { DeviceManagementKit } from "@ledgerhq/device-management-kit";
|
|
5
5
|
import { DmkSignerEth, LegacySignerEth } from "@ledgerhq/live-signer-evm";
|
|
6
6
|
import Transport from "@ledgerhq/hw-transport";
|
|
@@ -8,7 +8,6 @@ import { getEnv } from "@ledgerhq/live-env";
|
|
|
8
8
|
import { ResolutionConfig, LoadConfig } from "@ledgerhq/hw-app-eth/lib/services/types";
|
|
9
9
|
import { Signature } from "ethers";
|
|
10
10
|
import type { DomainServiceResolution } from "@ledgerhq/types-live";
|
|
11
|
-
import resolver from "@ledgerhq/coin-evm/hw-getAddress";
|
|
12
11
|
|
|
13
12
|
export type Signer = {
|
|
14
13
|
getAddress: (path: string) => Promise<EvmAddress>;
|
|
@@ -71,6 +70,3 @@ export const createSigner: CreateSigner<Signer> = (transport: Transport) => {
|
|
|
71
70
|
},
|
|
72
71
|
};
|
|
73
72
|
};
|
|
74
|
-
|
|
75
|
-
export const context = executeWithSigner(createSigner);
|
|
76
|
-
export const getAddress = resolver(context);
|
|
@@ -10,7 +10,6 @@ import { AlpacaSigner } from "./types";
|
|
|
10
10
|
import { DerivationType, LedgerSigner as TaquitoLedgerSigner } from "@taquito/ledger-signer";
|
|
11
11
|
import tezosGetAddress from "@ledgerhq/coin-tezos/signer/getAddress";
|
|
12
12
|
import Tezos from "@ledgerhq/hw-app-tezos";
|
|
13
|
-
import { context as evmContext, getAddress as evmGetAddress } from "./Eth";
|
|
14
13
|
|
|
15
14
|
const createSignerXrp: CreateSigner<Xrp> = (transport: Transport) => {
|
|
16
15
|
return new Xrp(transport);
|
|
@@ -98,12 +97,6 @@ export function getSigner(network: string): AlpacaSigner {
|
|
|
98
97
|
context: signerContextTezos,
|
|
99
98
|
};
|
|
100
99
|
}
|
|
101
|
-
case "evm": {
|
|
102
|
-
return {
|
|
103
|
-
getAddress: evmGetAddress,
|
|
104
|
-
context: evmContext,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
100
|
}
|
|
108
101
|
throw new Error(`signer for ${network} not implemented`);
|
|
109
102
|
}
|
|
@@ -71,7 +71,7 @@ describe("genericGetAccountShape", () => {
|
|
|
71
71
|
"sync-hash",
|
|
72
72
|
{
|
|
73
73
|
minHeight: 11,
|
|
74
|
-
order: "
|
|
74
|
+
order: "asc",
|
|
75
75
|
lastPagingToken: "pt1",
|
|
76
76
|
},
|
|
77
77
|
[
|
|
@@ -100,7 +100,7 @@ describe("genericGetAccountShape", () => {
|
|
|
100
100
|
"outdated-sync-hash",
|
|
101
101
|
{
|
|
102
102
|
minHeight: 0,
|
|
103
|
-
order: "
|
|
103
|
+
order: "asc",
|
|
104
104
|
},
|
|
105
105
|
[
|
|
106
106
|
{
|
|
@@ -2,7 +2,6 @@ import { genericPrepareTransaction } from "../prepareTransaction";
|
|
|
2
2
|
import { getAlpacaApi } from "../alpaca";
|
|
3
3
|
import { transactionToIntent } from "../utils";
|
|
4
4
|
import BigNumber from "bignumber.js";
|
|
5
|
-
import { GenericTransaction } from "../types";
|
|
6
5
|
|
|
7
6
|
jest.mock("../alpaca", () => ({
|
|
8
7
|
getAlpacaApi: jest.fn(),
|
|
@@ -96,11 +95,6 @@ describe("genericPrepareTransaction", () => {
|
|
|
96
95
|
it.each([
|
|
97
96
|
["type", 2, 2],
|
|
98
97
|
["storageLimit", 300n, new BigNumber(300)],
|
|
99
|
-
["gasLimit", 300n, new BigNumber(300)],
|
|
100
|
-
["gasPrice", 300n, new BigNumber(300)],
|
|
101
|
-
["maxFeePerGas", 300n, new BigNumber(300)],
|
|
102
|
-
["maxPriorityFeePerGas", 300n, new BigNumber(300)],
|
|
103
|
-
["additionalFees", 300n, new BigNumber(300)],
|
|
104
98
|
])(
|
|
105
99
|
"propagates %s from estimation parameters",
|
|
106
100
|
async (parameterName, parameterValue, expectedValue) => {
|
|
@@ -128,30 +122,4 @@ describe("genericPrepareTransaction", () => {
|
|
|
128
122
|
);
|
|
129
123
|
},
|
|
130
124
|
);
|
|
131
|
-
|
|
132
|
-
it("estimates using the token account spendable balance when sending all amount", async () => {
|
|
133
|
-
const estimateFees = jest.fn().mockResolvedValue({ value: new BigNumber(50) });
|
|
134
|
-
(transactionToIntent as jest.Mock).mockImplementation((_, transaction) => ({
|
|
135
|
-
amount: BigInt(transaction.amount.toFixed()),
|
|
136
|
-
}));
|
|
137
|
-
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
138
|
-
estimateFees,
|
|
139
|
-
validateIntent: intent => Promise.resolve({ amount: intent.amount }),
|
|
140
|
-
});
|
|
141
|
-
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
142
|
-
|
|
143
|
-
await prepareTransaction(
|
|
144
|
-
{
|
|
145
|
-
...account,
|
|
146
|
-
subAccounts: [{ id: "test-sub-account", spendableBalance: new BigNumber(100) }],
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
subAccountId: "test-sub-account",
|
|
150
|
-
useAllAmount: true,
|
|
151
|
-
amount: new BigNumber(0),
|
|
152
|
-
} as GenericTransaction,
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
expect(estimateFees).toHaveBeenCalledWith(expect.objectContaining({ amount: 100n }), {});
|
|
156
|
-
});
|
|
157
125
|
});
|
|
@@ -70,9 +70,7 @@ export type GenericTransaction = TransactionCommon & {
|
|
|
70
70
|
gasPrice?: BigNumber | null;
|
|
71
71
|
maxFeePerGas?: BigNumber | null;
|
|
72
72
|
maxPriorityFeePerGas?: BigNumber | null;
|
|
73
|
-
additionalFees?: BigNumber | null;
|
|
74
73
|
gasOptions?: GasOptions;
|
|
75
|
-
sponsored?: boolean;
|
|
76
74
|
};
|
|
77
75
|
|
|
78
76
|
export type GenericTransactionRaw = TransactionCommonRaw & {
|
|
@@ -106,9 +104,7 @@ export type GenericTransactionRaw = TransactionCommonRaw & {
|
|
|
106
104
|
gasPrice?: string | null;
|
|
107
105
|
maxFeePerGas?: string | null;
|
|
108
106
|
maxPriorityFeePerGas?: string | null;
|
|
109
|
-
additionalFees?: string | null;
|
|
110
107
|
gasOptions?: GasOptionsRaw;
|
|
111
|
-
sponsored?: boolean;
|
|
112
108
|
};
|
|
113
109
|
|
|
114
110
|
export interface OperationCommon extends Operation {
|
|
@@ -166,12 +166,10 @@ describe("Alpaca utils", () => {
|
|
|
166
166
|
},
|
|
167
167
|
...params,
|
|
168
168
|
} as GenericTransaction,
|
|
169
|
-
3n,
|
|
170
169
|
);
|
|
171
170
|
|
|
172
171
|
expect(operation).toMatchObject({
|
|
173
172
|
id: `parent-account-id--${expected.parentType}`,
|
|
174
|
-
transactionSequenceNumber: new BigNumber(3),
|
|
175
173
|
type: expected.parentType,
|
|
176
174
|
value: expected.parentValue,
|
|
177
175
|
accountId: "parent-account-id",
|
|
@@ -196,12 +194,10 @@ describe("Alpaca utils", () => {
|
|
|
196
194
|
subOperations: [
|
|
197
195
|
{
|
|
198
196
|
id: `sub-account-id--${expected.subType}`,
|
|
199
|
-
transactionSequenceNumber: new BigNumber(3),
|
|
200
197
|
accountId: "sub-account-id",
|
|
201
198
|
type: expected.subType,
|
|
202
199
|
senders: ["account-address"],
|
|
203
200
|
recipients: ["recipient-address"],
|
|
204
|
-
fee: new BigNumber(12),
|
|
205
201
|
value: new BigNumber(50),
|
|
206
202
|
blockHash: null,
|
|
207
203
|
blockHeight: null,
|
|
@@ -72,7 +72,6 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
|
|
|
72
72
|
parentRecipients?: string[];
|
|
73
73
|
ledgerOpType?: string | undefined;
|
|
74
74
|
memo?: string | undefined;
|
|
75
|
-
internal?: boolean;
|
|
76
75
|
} = {};
|
|
77
76
|
|
|
78
77
|
if (op.details?.ledgerOpType !== undefined) {
|
|
@@ -107,11 +106,6 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
|
|
|
107
106
|
if (op.details?.memo) {
|
|
108
107
|
extra.memo = op.details.memo as string;
|
|
109
108
|
}
|
|
110
|
-
|
|
111
|
-
if (op.details?.internal === true) {
|
|
112
|
-
extra.internal = op.details?.internal;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
109
|
const bnFees = new BigNumber(op.tx.fees.toString());
|
|
116
110
|
const hasFailed = op.tx.failed;
|
|
117
111
|
|
|
@@ -220,7 +214,6 @@ export function transactionToIntent(
|
|
|
220
214
|
transaction.nonce !== null && transaction.nonce !== undefined
|
|
221
215
|
? BigInt(transaction.nonce.toString())
|
|
222
216
|
: undefined,
|
|
223
|
-
sponsored: transaction.sponsored,
|
|
224
217
|
};
|
|
225
218
|
if (transaction.assetReference && transaction.assetOwner) {
|
|
226
219
|
const { subAccountId } = transaction;
|
|
@@ -272,11 +265,8 @@ function toGenericTransactionRaw(transaction: GenericTransaction): GenericTransa
|
|
|
272
265
|
family: transaction.family,
|
|
273
266
|
};
|
|
274
267
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
if (field in transaction) {
|
|
278
|
-
raw[field] = transaction[field];
|
|
279
|
-
}
|
|
268
|
+
if ("useAllAmount" in transaction) {
|
|
269
|
+
raw.useAllAmount = transaction.useAllAmount;
|
|
280
270
|
}
|
|
281
271
|
|
|
282
272
|
const stringFieldsToPropagate = [
|
|
@@ -306,7 +296,6 @@ function toGenericTransactionRaw(transaction: GenericTransaction): GenericTransa
|
|
|
306
296
|
"gasPrice",
|
|
307
297
|
"maxFeePerGas",
|
|
308
298
|
"maxPriorityFeePerGas",
|
|
309
|
-
"additionalFees",
|
|
310
299
|
] as const;
|
|
311
300
|
for (const field of bigNumberFieldsToPropagate) {
|
|
312
301
|
if (field in transaction) {
|
|
@@ -418,12 +407,11 @@ export const buildOptimisticOperation = (
|
|
|
418
407
|
hash: "",
|
|
419
408
|
type,
|
|
420
409
|
value: transaction.useAllAmount ? tokenAccount.balance : transaction.amount,
|
|
421
|
-
fee: new BigNumber(
|
|
410
|
+
fee: new BigNumber(0),
|
|
422
411
|
blockHash: null,
|
|
423
412
|
blockHeight: null,
|
|
424
413
|
senders: [account.freshAddress],
|
|
425
414
|
recipients: [transaction.recipient],
|
|
426
|
-
transactionSequenceNumber: new BigNumber(sequenceNumber?.toString() ?? 0),
|
|
427
415
|
accountId: subAccountId,
|
|
428
416
|
date: new Date(),
|
|
429
417
|
transactionRaw: toGenericTransactionRaw({
|
package/src/bridge/impl.ts
CHANGED
|
@@ -23,7 +23,6 @@ import { AddressesSanctionedError } from "@ledgerhq/coin-framework/sanction/erro
|
|
|
23
23
|
// Removed: stores are now managed globally by @ledgerhq/cryptoassets/cal-client/store
|
|
24
24
|
|
|
25
25
|
const alpacaized = {
|
|
26
|
-
evm: true,
|
|
27
26
|
xrp: true,
|
|
28
27
|
stellar: true,
|
|
29
28
|
tezos: true,
|
|
@@ -36,13 +35,7 @@ const currencyBridgeCache: Record<string, CurrencyBridge> = {};
|
|
|
36
35
|
export const getCurrencyBridge = (currency: CryptoCurrency): CurrencyBridge => {
|
|
37
36
|
if (getEnv("MOCK")) {
|
|
38
37
|
const mockBridge = mockBridges[currency.family];
|
|
39
|
-
|
|
40
|
-
if (mockBridge) {
|
|
41
|
-
if (typeof mockBridge.loadCoinConfig === "function") {
|
|
42
|
-
mockBridge.loadCoinConfig();
|
|
43
|
-
}
|
|
44
|
-
return mockBridge.currencyBridge;
|
|
45
|
-
}
|
|
38
|
+
if (mockBridge) return mockBridge.currencyBridge;
|
|
46
39
|
throw new CurrencyNotSupported("no mock implementation available for currency " + currency.id, {
|
|
47
40
|
currencyName: currency.id,
|
|
48
41
|
});
|
|
@@ -92,19 +85,13 @@ export function getAccountBridgeByFamily(family: string, accountId?: string): Ac
|
|
|
92
85
|
|
|
93
86
|
if (type === "mock") {
|
|
94
87
|
const mockBridge = mockBridges[family];
|
|
95
|
-
|
|
96
|
-
if (mockBridge) {
|
|
97
|
-
if (typeof mockBridge.loadCoinConfig === "function") {
|
|
98
|
-
mockBridge.loadCoinConfig();
|
|
99
|
-
}
|
|
100
|
-
return wrapAccountBridge(mockBridge.accountBridge);
|
|
101
|
-
}
|
|
88
|
+
if (mockBridge) return wrapAccountBridge(mockBridge.accountBridge);
|
|
102
89
|
}
|
|
103
90
|
}
|
|
104
91
|
|
|
105
92
|
if (alpacaized[family]) {
|
|
106
93
|
if (!bridgeCache[family]) {
|
|
107
|
-
bridgeCache[family] =
|
|
94
|
+
bridgeCache[family] = getAlpacaAccountBridge(family, "local");
|
|
108
95
|
}
|
|
109
96
|
return bridgeCache[family];
|
|
110
97
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
|
2
|
+
import { setupMockCryptoAssetsStore } from "../test-helpers/cryptoAssetsStore";
|
|
3
|
+
import { inferCryptoCurrencyIcon } from "./cryptoIcons";
|
|
4
|
+
import { getCryptoAssetsStore } from "@ledgerhq/cryptoassets/state";
|
|
5
|
+
|
|
6
|
+
beforeAll(() => {
|
|
7
|
+
// Setup mock store for unit tests
|
|
8
|
+
setupMockCryptoAssetsStore({
|
|
9
|
+
findTokenById: async (id: string) => {
|
|
10
|
+
// Return a mock token for the test
|
|
11
|
+
if (id === "ethereum/erc20/usd_tether__erc20_") {
|
|
12
|
+
return {
|
|
13
|
+
type: "TokenCurrency",
|
|
14
|
+
id: "ethereum/erc20/usd_tether__erc20_",
|
|
15
|
+
contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
16
|
+
parentCurrency: getCryptoCurrencyById("ethereum"),
|
|
17
|
+
tokenType: "erc20",
|
|
18
|
+
name: "Tether USD",
|
|
19
|
+
ticker: "USDT",
|
|
20
|
+
delisted: false,
|
|
21
|
+
disableCountervalue: false,
|
|
22
|
+
units: [{ name: "USDT", code: "USDT", magnitude: 6 }],
|
|
23
|
+
} as any;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("inferCryptoCurrencyIcon", () => {
|
|
31
|
+
const registryMock = {
|
|
32
|
+
BTC: 1,
|
|
33
|
+
ETH: 2,
|
|
34
|
+
CURRENCY_ARBITRUM: 3,
|
|
35
|
+
USDT: 4,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
test("Bitcoin Testnet is inferred properly", () => {
|
|
39
|
+
expect(inferCryptoCurrencyIcon(registryMock, getCryptoCurrencyById("bitcoin_testnet"))).toBe(1);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("Ethereum is inferred properly", () => {
|
|
43
|
+
expect(inferCryptoCurrencyIcon(registryMock, getCryptoCurrencyById("ethereum"))).toBe(2);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test("Arbitrum is inferred properly", () => {
|
|
47
|
+
expect(inferCryptoCurrencyIcon(registryMock, getCryptoCurrencyById("arbitrum"))).toBe(3);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("USDT is inferred properly", async () => {
|
|
51
|
+
const token = await getCryptoAssetsStore().findTokenById("ethereum/erc20/usd_tether__erc20_");
|
|
52
|
+
expect(inferCryptoCurrencyIcon(registryMock, token!)).toBe(4);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// logic that infer a crypto icons slug from a currency
|
|
2
|
+
|
|
3
|
+
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
4
|
+
|
|
5
|
+
export function inferCryptoCurrencyIcon<Icon>(
|
|
6
|
+
iconsRegistry: Record<string, Icon>,
|
|
7
|
+
currency: CryptoCurrency | TokenCurrency,
|
|
8
|
+
): Icon | null | undefined {
|
|
9
|
+
if (currency.type === "TokenCurrency") {
|
|
10
|
+
// FIXME DEPRECATED (ongoing hack due to ticker collision)
|
|
11
|
+
if (currency.disableCountervalue) return null;
|
|
12
|
+
} else {
|
|
13
|
+
// we allow the icons to define a CURRENCY_{id} format (check in libs/ui/crypto-icons compiled files, they get uppercased. we will improve in future)
|
|
14
|
+
const maybeIconById = iconsRegistry[`currency_${currency.id}`.toUpperCase()];
|
|
15
|
+
if (maybeIconById) return maybeIconById;
|
|
16
|
+
}
|
|
17
|
+
// otherwise we fallback by a token lookup
|
|
18
|
+
let id = currency.ticker.toUpperCase();
|
|
19
|
+
if (!isNaN(parseInt(id.charAt(0), 10))) id = `_${id}`; // fix variable name leading with a numerical value
|
|
20
|
+
return iconsRegistry[id];
|
|
21
|
+
}
|