@ledgerhq/live-common 29.1.0 → 29.2.0-next.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/account/serialization.d.ts +0 -6
- package/lib/account/serialization.d.ts.map +1 -1
- package/lib/account/serialization.js +11 -50
- package/lib/account/serialization.js.map +1 -1
- package/lib/apps/hw.js +1 -1
- package/lib/apps/hw.js.map +1 -1
- package/lib/countervalues/react.d.ts.map +1 -1
- package/lib/countervalues/react.js +1 -1
- package/lib/countervalues/react.js.map +1 -1
- package/lib/data/icons/react/gm.d.ts +8 -0
- package/lib/data/icons/react/gm.d.ts.map +1 -0
- package/lib/data/icons/react/gm.js +36 -0
- package/lib/data/icons/react/gm.js.map +1 -0
- package/lib/data/icons/react/index.d.ts +1 -0
- package/lib/data/icons/react/index.d.ts.map +1 -1
- package/lib/data/icons/react/index.js +9 -7
- package/lib/data/icons/react/index.js.map +1 -1
- package/lib/data/icons/reactNative/gm.d.ts +8 -0
- package/lib/data/icons/reactNative/gm.d.ts.map +1 -0
- package/lib/data/icons/reactNative/gm.js +37 -0
- package/lib/data/icons/reactNative/gm.js.map +1 -0
- package/lib/data/icons/reactNative/index.d.ts +1 -0
- package/lib/data/icons/reactNative/index.d.ts.map +1 -1
- package/lib/data/icons/reactNative/index.js +9 -7
- package/lib/data/icons/reactNative/index.js.map +1 -1
- package/lib/families/algorand/bridge/js.d.ts.map +1 -1
- package/lib/families/algorand/bridge/js.js +0 -1
- package/lib/families/algorand/bridge/js.js.map +1 -1
- package/lib/families/algorand/bridge/mock.d.ts.map +1 -1
- package/lib/families/algorand/bridge/mock.js +0 -1
- package/lib/families/algorand/bridge/mock.js.map +1 -1
- package/lib/families/algorand/serialization.d.ts +0 -1
- package/lib/families/algorand/serialization.d.ts.map +1 -1
- package/lib/families/algorand/serialization.js +1 -16
- package/lib/families/algorand/serialization.js.map +1 -1
- package/lib/families/bitcoin/bridge/js.d.ts.map +1 -1
- package/lib/families/bitcoin/bridge/js.js +4 -1
- package/lib/families/bitcoin/bridge/js.js.map +1 -1
- package/lib/families/bitcoin/descriptor.test.js +2 -0
- package/lib/families/bitcoin/descriptor.test.js.map +1 -1
- package/lib/families/bitcoin/satstack.test.js +2 -0
- package/lib/families/bitcoin/satstack.test.js.map +1 -1
- package/lib/families/bitcoin/serialization.d.ts +3 -0
- package/lib/families/bitcoin/serialization.d.ts.map +1 -1
- package/lib/families/bitcoin/serialization.js +16 -1
- package/lib/families/bitcoin/serialization.js.map +1 -1
- package/lib/families/bitcoin/serialization.test.d.ts +2 -0
- package/lib/families/bitcoin/serialization.test.d.ts.map +1 -0
- package/lib/families/bitcoin/serialization.test.js +110 -0
- package/lib/families/bitcoin/serialization.test.js.map +1 -0
- package/lib/families/cardano/bridge/js.d.ts.map +1 -1
- package/lib/families/cardano/bridge/js.js +0 -1
- package/lib/families/cardano/bridge/js.js.map +1 -1
- package/lib/families/cardano/serialization.d.ts +0 -1
- package/lib/families/cardano/serialization.d.ts.map +1 -1
- package/lib/families/cardano/serialization.js +1 -18
- package/lib/families/cardano/serialization.js.map +1 -1
- package/lib/families/celo/bridge/js.d.ts.map +1 -1
- package/lib/families/celo/bridge/js.js +0 -1
- package/lib/families/celo/bridge/js.js.map +1 -1
- package/lib/families/celo/serialization.d.ts +0 -1
- package/lib/families/celo/serialization.d.ts.map +1 -1
- package/lib/families/celo/serialization.js +1 -15
- package/lib/families/celo/serialization.js.map +1 -1
- package/lib/families/cosmos/bridge/js.d.ts.map +1 -1
- package/lib/families/cosmos/bridge/js.js +0 -2
- package/lib/families/cosmos/bridge/js.js.map +1 -1
- package/lib/families/cosmos/js-synchronisation.d.ts +1 -3
- package/lib/families/cosmos/js-synchronisation.d.ts.map +1 -1
- package/lib/families/cosmos/js-synchronisation.js +1 -16
- package/lib/families/cosmos/js-synchronisation.js.map +1 -1
- package/lib/families/crypto_org/api/sdk.d.ts.map +1 -1
- package/lib/families/crypto_org/api/sdk.js +6 -9
- package/lib/families/crypto_org/api/sdk.js.map +1 -1
- package/lib/families/crypto_org/js-buildTransaction.d.ts.map +1 -1
- package/lib/families/crypto_org/js-buildTransaction.js +3 -2
- package/lib/families/crypto_org/js-buildTransaction.js.map +1 -1
- package/lib/families/crypto_org/js-signOperation.js +1 -1
- package/lib/families/crypto_org/js-signOperation.js.map +1 -1
- package/lib/families/crypto_org/logic.d.ts +0 -16
- package/lib/families/crypto_org/logic.d.ts.map +1 -1
- package/lib/families/crypto_org/logic.js +6 -20
- package/lib/families/crypto_org/logic.js.map +1 -1
- package/lib/families/elrond/bridge/js.d.ts.map +1 -1
- package/lib/families/elrond/bridge/js.js +0 -2
- package/lib/families/elrond/bridge/js.js.map +1 -1
- package/lib/families/elrond/js-synchronisation.d.ts +1 -3
- package/lib/families/elrond/js-synchronisation.d.ts.map +1 -1
- package/lib/families/elrond/js-synchronisation.js +1 -16
- package/lib/families/elrond/js-synchronisation.js.map +1 -1
- package/lib/families/ethereum/__tests__/nft.integration.test.js +0 -7
- package/lib/families/ethereum/__tests__/nft.integration.test.js.map +1 -1
- package/lib/families/hedera/api/mirror.d.ts.map +1 -1
- package/lib/families/hedera/api/mirror.js +40 -16
- package/lib/families/hedera/api/mirror.js.map +1 -1
- package/lib/families/hedera/api/network.js +6 -1
- package/lib/families/hedera/api/network.js.map +1 -1
- package/lib/families/hedera/bridge.integration.test.js +1 -2
- package/lib/families/hedera/bridge.integration.test.js.map +1 -1
- package/lib/families/hedera/js-estimateMaxSpendable.d.ts.map +1 -1
- package/lib/families/hedera/js-estimateMaxSpendable.js +55 -11
- package/lib/families/hedera/js-estimateMaxSpendable.js.map +1 -1
- package/lib/families/hedera/js-getTransactionStatus.d.ts.map +1 -1
- package/lib/families/hedera/js-getTransactionStatus.js +5 -2
- package/lib/families/hedera/js-getTransactionStatus.js.map +1 -1
- package/lib/families/hedera/js-signOperation.js +23 -16
- package/lib/families/hedera/js-signOperation.js.map +1 -1
- package/lib/families/hedera/tests/js-estimateMaxSpendable.integration.test.d.ts +2 -0
- package/lib/families/hedera/tests/js-estimateMaxSpendable.integration.test.d.ts.map +1 -0
- package/lib/families/hedera/tests/{js-estimateMaxSpendable.test.js → js-estimateMaxSpendable.integration.test.js} +27 -3
- package/lib/families/hedera/tests/js-estimateMaxSpendable.integration.test.js.map +1 -0
- package/lib/families/hedera/tests/utils.integration.test.d.ts +2 -0
- package/lib/families/hedera/tests/utils.integration.test.d.ts.map +1 -0
- package/lib/families/hedera/tests/{utils.test.js → utils.integration.test.js} +28 -4
- package/lib/families/hedera/tests/utils.integration.test.js.map +1 -0
- package/lib/families/hedera/utils.d.ts +1 -1
- package/lib/families/hedera/utils.d.ts.map +1 -1
- package/lib/families/hedera/utils.js +40 -14
- package/lib/families/hedera/utils.js.map +1 -1
- package/lib/families/near/bridge/js.d.ts.map +1 -1
- package/lib/families/near/bridge/js.js +1 -2
- package/lib/families/near/bridge/js.js.map +1 -1
- package/lib/families/near/serialization.d.ts +0 -1
- package/lib/families/near/serialization.d.ts.map +1 -1
- package/lib/families/near/serialization.js +1 -15
- package/lib/families/near/serialization.js.map +1 -1
- package/lib/families/solana/api/chain/web3.d.ts +1 -0
- package/lib/families/solana/api/chain/web3.d.ts.map +1 -1
- package/lib/families/solana/api/chain/web3.js +16 -1
- package/lib/families/solana/api/chain/web3.js.map +1 -1
- package/lib/families/solana/bridge/bridge.d.ts.map +1 -1
- package/lib/families/solana/bridge/bridge.js +0 -1
- package/lib/families/solana/bridge/bridge.js.map +1 -1
- package/lib/families/solana/bridge.integration.test.js +7 -4
- package/lib/families/solana/bridge.integration.test.js.map +1 -1
- package/lib/families/solana/js-estimateMaxSpendable.d.ts.map +1 -1
- package/lib/families/solana/js-estimateMaxSpendable.js +9 -6
- package/lib/families/solana/js-estimateMaxSpendable.js.map +1 -1
- package/lib/families/solana/js-prepareTransaction.d.ts.map +1 -1
- package/lib/families/solana/js-prepareTransaction.js +15 -8
- package/lib/families/solana/js-prepareTransaction.js.map +1 -1
- package/lib/families/solana/logic.d.ts +0 -1
- package/lib/families/solana/logic.d.ts.map +1 -1
- package/lib/families/solana/logic.js +1 -4
- package/lib/families/solana/logic.js.map +1 -1
- package/lib/families/solana/serialization.d.ts +0 -1
- package/lib/families/solana/serialization.d.ts.map +1 -1
- package/lib/families/solana/serialization.js +1 -15
- package/lib/families/solana/serialization.js.map +1 -1
- package/lib/families/tezos/bridge/js.d.ts.map +1 -1
- package/lib/families/tezos/bridge/js.js +0 -1
- package/lib/families/tezos/bridge/js.js.map +1 -1
- package/lib/families/tezos/serialization.d.ts +0 -1
- package/lib/families/tezos/serialization.d.ts.map +1 -1
- package/lib/families/tezos/serialization.js +1 -18
- package/lib/families/tezos/serialization.js.map +1 -1
- package/lib/families/tron/bridge/js.d.ts.map +1 -1
- package/lib/families/tron/bridge/js.js +0 -1
- package/lib/families/tron/bridge/js.js.map +1 -1
- package/lib/families/tron/serialization.d.ts +0 -1
- package/lib/families/tron/serialization.d.ts.map +1 -1
- package/lib/families/tron/serialization.js +1 -15
- package/lib/families/tron/serialization.js.map +1 -1
- package/lib/hw/deviceAccess.d.ts.map +1 -1
- package/lib/hw/deviceAccess.js +4 -2
- package/lib/hw/deviceAccess.js.map +1 -1
- package/lib/hw/extractOnboardingState.d.ts +5 -3
- package/lib/hw/extractOnboardingState.d.ts.map +1 -1
- package/lib/hw/extractOnboardingState.js +6 -2
- package/lib/hw/extractOnboardingState.js.map +1 -1
- package/lib/hw/extractOnboardingState.test.js +46 -16
- package/lib/hw/extractOnboardingState.test.js.map +1 -1
- package/lib/hw/getDeviceName.d.ts.map +1 -1
- package/lib/hw/getDeviceName.js +2 -0
- package/lib/hw/getDeviceName.js.map +1 -1
- package/lib/hw/getDeviceName.test.js +16 -0
- package/lib/hw/getDeviceName.test.js.map +1 -1
- package/lib/hw/getOnboardingStatePolling.d.ts.map +1 -1
- package/lib/hw/getOnboardingStatePolling.js +38 -58
- package/lib/hw/getOnboardingStatePolling.js.map +1 -1
- package/lib/hw/getOnboardingStatePolling.test.js +1 -1
- package/lib/hw/getOnboardingStatePolling.test.js.map +1 -1
- package/lib/hw/hooks/useGenuineCheck.d.ts.map +1 -1
- package/lib/hw/hooks/useGenuineCheck.js +1 -0
- package/lib/hw/hooks/useGenuineCheck.js.map +1 -1
- package/lib/migrations/accounts-dataset.js +1 -1
- package/lib/migrations/accounts-dataset.js.map +1 -1
- package/lib/platform/providers/RemoteLiveAppProvider/index.d.ts +1 -0
- package/lib/platform/providers/RemoteLiveAppProvider/index.d.ts.map +1 -1
- package/lib/platform/providers/RemoteLiveAppProvider/index.js +6 -1
- package/lib/platform/providers/RemoteLiveAppProvider/index.js.map +1 -1
- package/lib/platform/types.d.ts +1 -0
- package/lib/platform/types.d.ts.map +1 -1
- package/lib-es/account/serialization.d.ts +0 -6
- package/lib-es/account/serialization.d.ts.map +1 -1
- package/lib-es/account/serialization.js +0 -36
- package/lib-es/account/serialization.js.map +1 -1
- package/lib-es/apps/hw.js +1 -1
- package/lib-es/apps/hw.js.map +1 -1
- package/lib-es/countervalues/react.d.ts.map +1 -1
- package/lib-es/countervalues/react.js +1 -1
- package/lib-es/countervalues/react.js.map +1 -1
- package/lib-es/data/icons/react/gm.d.ts +8 -0
- package/lib-es/data/icons/react/gm.d.ts.map +1 -0
- package/lib-es/data/icons/react/gm.js +11 -0
- package/lib-es/data/icons/react/gm.js.map +1 -0
- package/lib-es/data/icons/react/index.d.ts +1 -0
- package/lib-es/data/icons/react/index.d.ts.map +1 -1
- package/lib-es/data/icons/react/index.js +1 -0
- package/lib-es/data/icons/react/index.js.map +1 -1
- package/lib-es/data/icons/reactNative/gm.d.ts +8 -0
- package/lib-es/data/icons/reactNative/gm.d.ts.map +1 -0
- package/lib-es/data/icons/reactNative/gm.js +12 -0
- package/lib-es/data/icons/reactNative/gm.js.map +1 -0
- package/lib-es/data/icons/reactNative/index.d.ts +1 -0
- package/lib-es/data/icons/reactNative/index.d.ts.map +1 -1
- package/lib-es/data/icons/reactNative/index.js +1 -0
- package/lib-es/data/icons/reactNative/index.js.map +1 -1
- package/lib-es/families/algorand/bridge/js.d.ts.map +1 -1
- package/lib-es/families/algorand/bridge/js.js +1 -2
- package/lib-es/families/algorand/bridge/js.js.map +1 -1
- package/lib-es/families/algorand/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/algorand/bridge/mock.js +1 -2
- package/lib-es/families/algorand/bridge/mock.js.map +1 -1
- package/lib-es/families/algorand/serialization.d.ts +0 -1
- package/lib-es/families/algorand/serialization.d.ts.map +1 -1
- package/lib-es/families/algorand/serialization.js +0 -11
- package/lib-es/families/algorand/serialization.js.map +1 -1
- package/lib-es/families/bitcoin/bridge/js.d.ts.map +1 -1
- package/lib-es/families/bitcoin/bridge/js.js +4 -1
- package/lib-es/families/bitcoin/bridge/js.js.map +1 -1
- package/lib-es/families/bitcoin/descriptor.test.js +2 -0
- package/lib-es/families/bitcoin/descriptor.test.js.map +1 -1
- package/lib-es/families/bitcoin/satstack.test.js +2 -0
- package/lib-es/families/bitcoin/satstack.test.js.map +1 -1
- package/lib-es/families/bitcoin/serialization.d.ts +3 -0
- package/lib-es/families/bitcoin/serialization.d.ts.map +1 -1
- package/lib-es/families/bitcoin/serialization.js +13 -0
- package/lib-es/families/bitcoin/serialization.js.map +1 -1
- package/lib-es/families/bitcoin/serialization.test.d.ts +2 -0
- package/lib-es/families/bitcoin/serialization.test.d.ts.map +1 -0
- package/lib-es/families/bitcoin/serialization.test.js +105 -0
- package/lib-es/families/bitcoin/serialization.test.js.map +1 -0
- package/lib-es/families/cardano/bridge/js.d.ts.map +1 -1
- package/lib-es/families/cardano/bridge/js.js +1 -2
- package/lib-es/families/cardano/bridge/js.js.map +1 -1
- package/lib-es/families/cardano/serialization.d.ts +0 -1
- package/lib-es/families/cardano/serialization.d.ts.map +1 -1
- package/lib-es/families/cardano/serialization.js +0 -13
- package/lib-es/families/cardano/serialization.js.map +1 -1
- package/lib-es/families/celo/bridge/js.d.ts.map +1 -1
- package/lib-es/families/celo/bridge/js.js +1 -2
- package/lib-es/families/celo/bridge/js.js.map +1 -1
- package/lib-es/families/celo/serialization.d.ts +0 -1
- package/lib-es/families/celo/serialization.d.ts.map +1 -1
- package/lib-es/families/celo/serialization.js +0 -13
- package/lib-es/families/celo/serialization.js.map +1 -1
- package/lib-es/families/cosmos/bridge/js.d.ts.map +1 -1
- package/lib-es/families/cosmos/bridge/js.js +0 -2
- package/lib-es/families/cosmos/bridge/js.js.map +1 -1
- package/lib-es/families/cosmos/js-synchronisation.d.ts +1 -3
- package/lib-es/families/cosmos/js-synchronisation.d.ts.map +1 -1
- package/lib-es/families/cosmos/js-synchronisation.js +0 -14
- package/lib-es/families/cosmos/js-synchronisation.js.map +1 -1
- package/lib-es/families/crypto_org/api/sdk.d.ts.map +1 -1
- package/lib-es/families/crypto_org/api/sdk.js +6 -9
- package/lib-es/families/crypto_org/api/sdk.js.map +1 -1
- package/lib-es/families/crypto_org/js-buildTransaction.d.ts.map +1 -1
- package/lib-es/families/crypto_org/js-buildTransaction.js +3 -2
- package/lib-es/families/crypto_org/js-buildTransaction.js.map +1 -1
- package/lib-es/families/crypto_org/js-signOperation.js +1 -1
- package/lib-es/families/crypto_org/js-signOperation.js.map +1 -1
- package/lib-es/families/crypto_org/logic.d.ts +0 -16
- package/lib-es/families/crypto_org/logic.d.ts.map +1 -1
- package/lib-es/families/crypto_org/logic.js +5 -19
- package/lib-es/families/crypto_org/logic.js.map +1 -1
- package/lib-es/families/elrond/bridge/js.d.ts.map +1 -1
- package/lib-es/families/elrond/bridge/js.js +0 -2
- package/lib-es/families/elrond/bridge/js.js.map +1 -1
- package/lib-es/families/elrond/js-synchronisation.d.ts +1 -3
- package/lib-es/families/elrond/js-synchronisation.d.ts.map +1 -1
- package/lib-es/families/elrond/js-synchronisation.js +0 -14
- package/lib-es/families/elrond/js-synchronisation.js.map +1 -1
- package/lib-es/families/ethereum/__tests__/nft.integration.test.js +1 -8
- package/lib-es/families/ethereum/__tests__/nft.integration.test.js.map +1 -1
- package/lib-es/families/hedera/api/mirror.d.ts.map +1 -1
- package/lib-es/families/hedera/api/mirror.js +40 -16
- package/lib-es/families/hedera/api/mirror.js.map +1 -1
- package/lib-es/families/hedera/api/network.js +6 -1
- package/lib-es/families/hedera/api/network.js.map +1 -1
- package/lib-es/families/hedera/bridge.integration.test.js +1 -2
- package/lib-es/families/hedera/bridge.integration.test.js.map +1 -1
- package/lib-es/families/hedera/js-estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/families/hedera/js-estimateMaxSpendable.js +56 -12
- package/lib-es/families/hedera/js-estimateMaxSpendable.js.map +1 -1
- package/lib-es/families/hedera/js-getTransactionStatus.d.ts.map +1 -1
- package/lib-es/families/hedera/js-getTransactionStatus.js +5 -2
- package/lib-es/families/hedera/js-getTransactionStatus.js.map +1 -1
- package/lib-es/families/hedera/js-signOperation.js +24 -17
- package/lib-es/families/hedera/js-signOperation.js.map +1 -1
- package/lib-es/families/hedera/tests/js-estimateMaxSpendable.integration.test.d.ts +2 -0
- package/lib-es/families/hedera/tests/js-estimateMaxSpendable.integration.test.d.ts.map +1 -0
- package/lib-es/families/hedera/tests/{js-estimateMaxSpendable.test.js → js-estimateMaxSpendable.integration.test.js} +27 -3
- package/lib-es/families/hedera/tests/js-estimateMaxSpendable.integration.test.js.map +1 -0
- package/lib-es/families/hedera/tests/utils.integration.test.d.ts +2 -0
- package/lib-es/families/hedera/tests/utils.integration.test.d.ts.map +1 -0
- package/lib-es/families/hedera/tests/{utils.test.js → utils.integration.test.js} +28 -4
- package/lib-es/families/hedera/tests/utils.integration.test.js.map +1 -0
- package/lib-es/families/hedera/utils.d.ts +1 -1
- package/lib-es/families/hedera/utils.d.ts.map +1 -1
- package/lib-es/families/hedera/utils.js +38 -13
- package/lib-es/families/hedera/utils.js.map +1 -1
- package/lib-es/families/near/bridge/js.d.ts.map +1 -1
- package/lib-es/families/near/bridge/js.js +2 -3
- package/lib-es/families/near/bridge/js.js.map +1 -1
- package/lib-es/families/near/serialization.d.ts +0 -1
- package/lib-es/families/near/serialization.d.ts.map +1 -1
- package/lib-es/families/near/serialization.js +0 -13
- package/lib-es/families/near/serialization.js.map +1 -1
- package/lib-es/families/solana/api/chain/web3.d.ts +1 -0
- package/lib-es/families/solana/api/chain/web3.d.ts.map +1 -1
- package/lib-es/families/solana/api/chain/web3.js +14 -0
- package/lib-es/families/solana/api/chain/web3.js.map +1 -1
- package/lib-es/families/solana/bridge/bridge.d.ts.map +1 -1
- package/lib-es/families/solana/bridge/bridge.js +1 -2
- package/lib-es/families/solana/bridge/bridge.js.map +1 -1
- package/lib-es/families/solana/bridge.integration.test.js +8 -5
- package/lib-es/families/solana/bridge.integration.test.js.map +1 -1
- package/lib-es/families/solana/js-estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/families/solana/js-estimateMaxSpendable.js +10 -7
- package/lib-es/families/solana/js-estimateMaxSpendable.js.map +1 -1
- package/lib-es/families/solana/js-prepareTransaction.d.ts.map +1 -1
- package/lib-es/families/solana/js-prepareTransaction.js +17 -10
- package/lib-es/families/solana/js-prepareTransaction.js.map +1 -1
- package/lib-es/families/solana/logic.d.ts +0 -1
- package/lib-es/families/solana/logic.d.ts.map +1 -1
- package/lib-es/families/solana/logic.js +1 -4
- package/lib-es/families/solana/logic.js.map +1 -1
- package/lib-es/families/solana/serialization.d.ts +0 -1
- package/lib-es/families/solana/serialization.d.ts.map +1 -1
- package/lib-es/families/solana/serialization.js +0 -13
- package/lib-es/families/solana/serialization.js.map +1 -1
- package/lib-es/families/tezos/bridge/js.d.ts.map +1 -1
- package/lib-es/families/tezos/bridge/js.js +1 -2
- package/lib-es/families/tezos/bridge/js.js.map +1 -1
- package/lib-es/families/tezos/serialization.d.ts +0 -1
- package/lib-es/families/tezos/serialization.d.ts.map +1 -1
- package/lib-es/families/tezos/serialization.js +0 -13
- package/lib-es/families/tezos/serialization.js.map +1 -1
- package/lib-es/families/tron/bridge/js.d.ts.map +1 -1
- package/lib-es/families/tron/bridge/js.js +1 -2
- package/lib-es/families/tron/bridge/js.js.map +1 -1
- package/lib-es/families/tron/serialization.d.ts +0 -1
- package/lib-es/families/tron/serialization.d.ts.map +1 -1
- package/lib-es/families/tron/serialization.js +0 -13
- package/lib-es/families/tron/serialization.js.map +1 -1
- package/lib-es/hw/deviceAccess.d.ts.map +1 -1
- package/lib-es/hw/deviceAccess.js +4 -2
- package/lib-es/hw/deviceAccess.js.map +1 -1
- package/lib-es/hw/extractOnboardingState.d.ts +5 -3
- package/lib-es/hw/extractOnboardingState.d.ts.map +1 -1
- package/lib-es/hw/extractOnboardingState.js +6 -2
- package/lib-es/hw/extractOnboardingState.js.map +1 -1
- package/lib-es/hw/extractOnboardingState.test.js +46 -16
- package/lib-es/hw/extractOnboardingState.test.js.map +1 -1
- package/lib-es/hw/getDeviceName.d.ts.map +1 -1
- package/lib-es/hw/getDeviceName.js +2 -0
- package/lib-es/hw/getDeviceName.js.map +1 -1
- package/lib-es/hw/getDeviceName.test.js +16 -0
- package/lib-es/hw/getDeviceName.test.js.map +1 -1
- package/lib-es/hw/getOnboardingStatePolling.d.ts.map +1 -1
- package/lib-es/hw/getOnboardingStatePolling.js +39 -59
- package/lib-es/hw/getOnboardingStatePolling.js.map +1 -1
- package/lib-es/hw/getOnboardingStatePolling.test.js +1 -1
- package/lib-es/hw/getOnboardingStatePolling.test.js.map +1 -1
- package/lib-es/hw/hooks/useGenuineCheck.d.ts.map +1 -1
- package/lib-es/hw/hooks/useGenuineCheck.js +1 -0
- package/lib-es/hw/hooks/useGenuineCheck.js.map +1 -1
- package/lib-es/migrations/accounts-dataset.js +1 -1
- package/lib-es/migrations/accounts-dataset.js.map +1 -1
- package/lib-es/platform/providers/RemoteLiveAppProvider/index.d.ts +1 -0
- package/lib-es/platform/providers/RemoteLiveAppProvider/index.d.ts.map +1 -1
- package/lib-es/platform/providers/RemoteLiveAppProvider/index.js +4 -0
- package/lib-es/platform/providers/RemoteLiveAppProvider/index.js.map +1 -1
- package/lib-es/platform/types.d.ts +1 -0
- package/lib-es/platform/types.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/account/serialization.ts +0 -55
- package/src/apps/hw.ts +1 -1
- package/src/bot/portfolio/__snapshots__/formatter.test.ts.snap +1 -1
- package/src/countervalues/react.tsx +2 -2
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +34 -2
- package/src/data/icons/react/gm.tsx +14 -0
- package/src/data/icons/react/index.tsx +1 -0
- package/src/data/icons/reactNative/gm.tsx +15 -0
- package/src/data/icons/reactNative/index.tsx +1 -0
- package/src/data/icons/svg/GM.svg +4 -0
- package/src/families/algorand/bridge/js.ts +1 -6
- package/src/families/algorand/bridge/mock.ts +1 -6
- package/src/families/algorand/serialization.ts +0 -23
- package/src/families/bitcoin/bridge/js.ts +3 -0
- package/src/families/bitcoin/descriptor.test.ts +3 -0
- package/src/families/bitcoin/satstack.test.ts +3 -0
- package/src/families/bitcoin/serialization.test.ts +150 -0
- package/src/families/bitcoin/serialization.ts +22 -0
- package/src/families/cardano/bridge/js.ts +1 -6
- package/src/families/cardano/serialization.ts +0 -25
- package/src/families/celo/bridge/js.ts +1 -6
- package/src/families/celo/serialization.ts +0 -25
- package/src/families/cosmos/bridge/js.ts +0 -2
- package/src/families/cosmos/js-synchronisation.ts +1 -28
- package/src/families/crypto_org/api/sdk.ts +14 -18
- package/src/families/crypto_org/js-buildTransaction.ts +3 -2
- package/src/families/crypto_org/js-signOperation.ts +1 -1
- package/src/families/crypto_org/logic.ts +5 -19
- package/src/families/elrond/bridge/js.ts +0 -2
- package/src/families/elrond/js-synchronisation.ts +0 -28
- package/src/families/ethereum/__tests__/nft.integration.test.ts +1 -12
- package/src/families/hedera/api/mirror.ts +16 -15
- package/src/families/hedera/api/network.ts +9 -1
- package/src/families/hedera/bridge.integration.test.ts +1 -4
- package/src/families/hedera/js-estimateMaxSpendable.ts +4 -6
- package/src/families/hedera/js-getTransactionStatus.ts +3 -1
- package/src/families/hedera/js-signOperation.ts +2 -2
- package/src/families/hedera/tests/{js-estimateMaxSpendable.test.ts → js-estimateMaxSpendable.integration.test.ts} +17 -2
- package/src/families/hedera/tests/{utils.test.ts → utils.integration.test.ts} +18 -3
- package/src/families/hedera/utils.ts +17 -5
- package/src/families/near/bridge/js.ts +1 -6
- package/src/families/near/serialization.ts +0 -25
- package/src/families/solana/api/chain/web3.ts +11 -0
- package/src/families/solana/bridge/bridge.ts +1 -6
- package/src/families/solana/bridge.integration.test.ts +11 -5
- package/src/families/solana/js-estimateMaxSpendable.ts +14 -3
- package/src/families/solana/js-prepareTransaction.ts +23 -5
- package/src/families/solana/logic.ts +1 -6
- package/src/families/solana/serialization.ts +0 -26
- package/src/families/tezos/bridge/js.ts +1 -6
- package/src/families/tezos/serialization.ts +0 -25
- package/src/families/tron/bridge/js.ts +1 -6
- package/src/families/tron/serialization.ts +0 -25
- package/src/hw/deviceAccess.ts +6 -2
- package/src/hw/extractOnboardingState.test.ts +63 -16
- package/src/hw/extractOnboardingState.ts +6 -2
- package/src/hw/getDeviceName.test.ts +10 -0
- package/src/hw/getDeviceName.ts +2 -0
- package/src/hw/getOnboardingStatePolling.test.ts +1 -1
- package/src/hw/getOnboardingStatePolling.ts +13 -40
- package/src/hw/hooks/useGenuineCheck.ts +1 -0
- package/src/migrations/accounts-dataset.ts +1 -1
- package/src/platform/providers/RemoteLiveAppProvider/index.tsx +4 -0
- package/src/platform/types.ts +1 -0
- package/lib/__tests__/reconciliation.d.ts +0 -2
- package/lib/__tests__/reconciliation.d.ts.map +0 -1
- package/lib/__tests__/reconciliation.js +0 -51
- package/lib/__tests__/reconciliation.js.map +0 -1
- package/lib/families/hedera/tests/js-estimateMaxSpendable.test.d.ts +0 -2
- package/lib/families/hedera/tests/js-estimateMaxSpendable.test.d.ts.map +0 -1
- package/lib/families/hedera/tests/js-estimateMaxSpendable.test.js.map +0 -1
- package/lib/families/hedera/tests/utils.test.d.ts +0 -2
- package/lib/families/hedera/tests/utils.test.d.ts.map +0 -1
- package/lib/families/hedera/tests/utils.test.js.map +0 -1
- package/lib/reconciliation.d.ts +0 -9
- package/lib/reconciliation.d.ts.map +0 -1
- package/lib/reconciliation.js +0 -450
- package/lib/reconciliation.js.map +0 -1
- package/lib-es/__tests__/reconciliation.d.ts +0 -2
- package/lib-es/__tests__/reconciliation.d.ts.map +0 -1
- package/lib-es/__tests__/reconciliation.js +0 -49
- package/lib-es/__tests__/reconciliation.js.map +0 -1
- package/lib-es/families/hedera/tests/js-estimateMaxSpendable.test.d.ts +0 -2
- package/lib-es/families/hedera/tests/js-estimateMaxSpendable.test.d.ts.map +0 -1
- package/lib-es/families/hedera/tests/js-estimateMaxSpendable.test.js.map +0 -1
- package/lib-es/families/hedera/tests/utils.test.d.ts +0 -2
- package/lib-es/families/hedera/tests/utils.test.d.ts.map +0 -1
- package/lib-es/families/hedera/tests/utils.test.js.map +0 -1
- package/lib-es/reconciliation.d.ts +0 -9
- package/lib-es/reconciliation.d.ts.map +0 -1
- package/lib-es/reconciliation.js +0 -438
- package/lib-es/reconciliation.js.map +0 -1
- package/src/__tests__/reconciliation.ts +0 -40
- package/src/reconciliation.ts +0 -536
|
@@ -2,13 +2,25 @@ import estimateMaxSpendable from "./js-estimateMaxSpendable";
|
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
3
|
import type { Account } from "@ledgerhq/types-live";
|
|
4
4
|
import type { Transaction } from "./types";
|
|
5
|
+
import network from "../../network";
|
|
5
6
|
|
|
6
|
-
// NOTE: Hedera declares stable fees in USD
|
|
7
|
-
// If we can get the current USD/HBAR price here..
|
|
8
|
-
// > transfer fee is 0.0001 USD
|
|
9
|
-
export const estimatedFees = new BigNumber("83300"); // 0.000833 ℏ (as of 2021-09-20)
|
|
10
7
|
export const estimatedFeeSafetyRate = 2;
|
|
11
8
|
|
|
9
|
+
export async function getEstimatedFees(): Promise<BigNumber> {
|
|
10
|
+
try {
|
|
11
|
+
const { data } = await network({
|
|
12
|
+
method: "GET",
|
|
13
|
+
url: "https://countervalues.live.ledger.com/latest/direct?pairs=hbar:usd",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return new BigNumber(10000).dividedBy(data[0]);
|
|
17
|
+
} catch {
|
|
18
|
+
// as fees are based on a currency conversion, we stay
|
|
19
|
+
// on the safe side here and double the estimate for "max spendable"
|
|
20
|
+
return new BigNumber("150200").multipliedBy(estimatedFeeSafetyRate); // 0.001502 ℏ (as of 2023-03-14)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
12
24
|
export async function calculateAmount({
|
|
13
25
|
account,
|
|
14
26
|
transaction,
|
|
@@ -25,7 +37,7 @@ export async function calculateAmount({
|
|
|
25
37
|
|
|
26
38
|
return {
|
|
27
39
|
amount,
|
|
28
|
-
totalSpent: amount.plus(
|
|
40
|
+
totalSpent: amount.plus(await getEstimatedFees()),
|
|
29
41
|
};
|
|
30
42
|
}
|
|
31
43
|
|
|
@@ -13,11 +13,7 @@ import signOperation from "../js-signOperation";
|
|
|
13
13
|
import broadcast from "../js-broadcast";
|
|
14
14
|
import estimateMaxSpendable from "../js-estimateMaxSpendable";
|
|
15
15
|
import { preload, hydrate, getPreloadStrategy } from "../preload";
|
|
16
|
-
import {
|
|
17
|
-
assignToAccountRaw,
|
|
18
|
-
assignFromAccountRaw,
|
|
19
|
-
applyReconciliation,
|
|
20
|
-
} from "../serialization";
|
|
16
|
+
import { assignToAccountRaw, assignFromAccountRaw } from "../serialization";
|
|
21
17
|
|
|
22
18
|
const receive = makeAccountBridgeReceive();
|
|
23
19
|
|
|
@@ -40,7 +36,6 @@ const accountBridge: AccountBridge<Transaction> = {
|
|
|
40
36
|
broadcast,
|
|
41
37
|
assignToAccountRaw,
|
|
42
38
|
assignFromAccountRaw,
|
|
43
|
-
applyReconciliation,
|
|
44
39
|
};
|
|
45
40
|
|
|
46
41
|
export default { currencyBridge, accountBridge };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BigNumber } from "bignumber.js";
|
|
2
|
-
import { isEqual } from "lodash";
|
|
3
2
|
import type {
|
|
4
3
|
NearAccount,
|
|
5
4
|
NearAccountRaw,
|
|
@@ -73,27 +72,3 @@ export function assignFromAccountRaw(accountRaw: AccountRaw, account: Account) {
|
|
|
73
72
|
(account as NearAccount).nearResources =
|
|
74
73
|
fromNearResourcesRaw(nearResourcesRaw);
|
|
75
74
|
}
|
|
76
|
-
|
|
77
|
-
export function applyReconciliation(
|
|
78
|
-
account: Account,
|
|
79
|
-
updatedRaw: AccountRaw,
|
|
80
|
-
next: Account
|
|
81
|
-
): boolean {
|
|
82
|
-
let changed = false;
|
|
83
|
-
const nearAcc = account as NearAccount;
|
|
84
|
-
const nearUpdatedRaw = updatedRaw as NearAccountRaw;
|
|
85
|
-
if (
|
|
86
|
-
nearUpdatedRaw.nearResources &&
|
|
87
|
-
(!nearAcc.nearResources ||
|
|
88
|
-
!isEqual(
|
|
89
|
-
toNearResourcesRaw(nearAcc.nearResources),
|
|
90
|
-
nearUpdatedRaw.nearResources
|
|
91
|
-
))
|
|
92
|
-
) {
|
|
93
|
-
(next as NearAccount).nearResources = fromNearResourcesRaw(
|
|
94
|
-
nearUpdatedRaw.nearResources
|
|
95
|
-
);
|
|
96
|
-
changed = true;
|
|
97
|
-
}
|
|
98
|
-
return changed;
|
|
99
|
-
}
|
|
@@ -260,6 +260,17 @@ export function getStakeAccountMinimumBalanceForRentExemption(api: ChainAPI) {
|
|
|
260
260
|
return api.getMinimumBalanceForRentExemption(StakeProgram.space);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
export async function getAccountMinimumBalanceForRentExemption(
|
|
264
|
+
api: ChainAPI,
|
|
265
|
+
address: string
|
|
266
|
+
) {
|
|
267
|
+
const accInfo = await api.getAccountInfo(address);
|
|
268
|
+
const accSpace =
|
|
269
|
+
accInfo !== null && "parsed" in accInfo.data ? accInfo.data.space : 0;
|
|
270
|
+
|
|
271
|
+
return api.getMinimumBalanceForRentExemption(accSpace);
|
|
272
|
+
}
|
|
273
|
+
|
|
263
274
|
export async function getStakeAccountAddressWithSeed({
|
|
264
275
|
fromAddress,
|
|
265
276
|
seed,
|
|
@@ -26,11 +26,7 @@ import { getAccountShapeWithAPI } from "../js-synchronization";
|
|
|
26
26
|
import type { SolanaAccount, Transaction } from "../types";
|
|
27
27
|
import { endpointByCurrencyId } from "../utils";
|
|
28
28
|
import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
29
|
-
import {
|
|
30
|
-
assignToAccountRaw,
|
|
31
|
-
applyReconciliation,
|
|
32
|
-
assignFromAccountRaw,
|
|
33
|
-
} from "../serialization";
|
|
29
|
+
import { assignToAccountRaw, assignFromAccountRaw } from "../serialization";
|
|
34
30
|
|
|
35
31
|
function makePrepare(getChainAPI: (config: Config) => Promise<ChainAPI>) {
|
|
36
32
|
async function prepareTransaction(
|
|
@@ -178,7 +174,6 @@ export function makeBridges({
|
|
|
178
174
|
prepareTransaction: makePrepare(getQueuedAndCachedAPI),
|
|
179
175
|
broadcast: makeBroadcast(getAPI),
|
|
180
176
|
signOperation: makeSign(getAPI),
|
|
181
|
-
applyReconciliation,
|
|
182
177
|
assignFromAccountRaw,
|
|
183
178
|
assignToAccountRaw,
|
|
184
179
|
};
|
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
encodeAccountIdWithTokenAccountAddress,
|
|
34
34
|
MAX_MEMO_LENGTH,
|
|
35
|
-
SOLANA_DUST,
|
|
36
35
|
} from "./logic";
|
|
37
36
|
import createTransaction from "./js-createTransaction";
|
|
38
37
|
import { compact } from "lodash/fp";
|
|
@@ -73,6 +72,7 @@ const testOnChainData = {
|
|
|
73
72
|
validatorAddress: "9QU2QSxhb24FUX3Tu2FpczXjpK3VYrvRudywSZaM29mF",
|
|
74
73
|
fees: {
|
|
75
74
|
stakeAccountRentExempt: 2282880,
|
|
75
|
+
systemAccountRentExempt: 890880,
|
|
76
76
|
lamportsPerSignature: 5000,
|
|
77
77
|
},
|
|
78
78
|
// --- maybe outdated or not real, fine for tests ---
|
|
@@ -328,8 +328,12 @@ function transferTests(): TransactionTestSpec[] {
|
|
|
328
328
|
errors: {},
|
|
329
329
|
warnings: {},
|
|
330
330
|
estimatedFees: fees(1),
|
|
331
|
-
amount: testOnChainData.fundedSenderBalance
|
|
332
|
-
|
|
331
|
+
amount: testOnChainData.fundedSenderBalance
|
|
332
|
+
.minus(fees(1))
|
|
333
|
+
.minus(testOnChainData.fees.systemAccountRentExempt),
|
|
334
|
+
totalSpent: testOnChainData.fundedSenderBalance.minus(
|
|
335
|
+
testOnChainData.fees.systemAccountRentExempt
|
|
336
|
+
),
|
|
333
337
|
},
|
|
334
338
|
},
|
|
335
339
|
{
|
|
@@ -758,11 +762,13 @@ function stakingTests(): TransactionTestSpec[] {
|
|
|
758
762
|
amount: testOnChainData.fundedSenderBalance
|
|
759
763
|
.minus(fees(1))
|
|
760
764
|
.minus(testOnChainData.fees.stakeAccountRentExempt)
|
|
761
|
-
.minus(
|
|
765
|
+
.minus(testOnChainData.fees.systemAccountRentExempt),
|
|
762
766
|
estimatedFees: fees(1).plus(
|
|
763
767
|
testOnChainData.fees.stakeAccountRentExempt
|
|
764
768
|
),
|
|
765
|
-
totalSpent: testOnChainData.fundedSenderBalance.minus(
|
|
769
|
+
totalSpent: testOnChainData.fundedSenderBalance.minus(
|
|
770
|
+
testOnChainData.fees.systemAccountRentExempt
|
|
771
|
+
),
|
|
766
772
|
errors: {},
|
|
767
773
|
},
|
|
768
774
|
},
|
|
@@ -2,7 +2,10 @@ import type { AccountBridge } from "@ledgerhq/types-live";
|
|
|
2
2
|
import type { Transaction } from "./types";
|
|
3
3
|
import BigNumber from "bignumber.js";
|
|
4
4
|
import { ChainAPI } from "./api";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
getAccountMinimumBalanceForRentExemption,
|
|
7
|
+
getStakeAccountMinimumBalanceForRentExemption,
|
|
8
|
+
} from "./api/chain/web3";
|
|
6
9
|
import { getMainAccount } from "../../account";
|
|
7
10
|
import { estimateTxFee } from "./tx-fees";
|
|
8
11
|
|
|
@@ -30,8 +33,16 @@ const estimateMaxSpendableWithAPI = async (
|
|
|
30
33
|
0
|
|
31
34
|
);
|
|
32
35
|
}
|
|
33
|
-
default:
|
|
34
|
-
|
|
36
|
+
default: {
|
|
37
|
+
const rentExemptMin = await getAccountMinimumBalanceForRentExemption(
|
|
38
|
+
api,
|
|
39
|
+
account.freshAddress
|
|
40
|
+
);
|
|
41
|
+
return BigNumber.max(
|
|
42
|
+
account.spendableBalance.minus(txFee).minus(rentExemptMin),
|
|
43
|
+
0
|
|
44
|
+
);
|
|
45
|
+
}
|
|
35
46
|
}
|
|
36
47
|
}
|
|
37
48
|
case "TokenAccount":
|
|
@@ -11,6 +11,7 @@ import { findSubAccountById } from "../../account";
|
|
|
11
11
|
import type { Account } from "@ledgerhq/types-live";
|
|
12
12
|
import { ChainAPI } from "./api";
|
|
13
13
|
import {
|
|
14
|
+
getAccountMinimumBalanceForRentExemption,
|
|
14
15
|
getMaybeTokenAccount,
|
|
15
16
|
getMaybeVoteAccount,
|
|
16
17
|
getStakeAccountAddressWithSeed,
|
|
@@ -40,7 +41,6 @@ import {
|
|
|
40
41
|
isEd25519Address,
|
|
41
42
|
isValidBase58Address,
|
|
42
43
|
MAX_MEMO_LENGTH,
|
|
43
|
-
SOLANA_DUST,
|
|
44
44
|
} from "./logic";
|
|
45
45
|
import { estimateTxFee } from "./tx-fees";
|
|
46
46
|
import type {
|
|
@@ -326,8 +326,16 @@ async function deriveTransferCommandDescriptor(
|
|
|
326
326
|
|
|
327
327
|
const fee = await estimateTxFee(api, mainAccount, "transfer");
|
|
328
328
|
|
|
329
|
+
const rentExemptMin = await getAccountMinimumBalanceForRentExemption(
|
|
330
|
+
api,
|
|
331
|
+
mainAccount.freshAddress
|
|
332
|
+
);
|
|
333
|
+
|
|
329
334
|
const txAmount = tx.useAllAmount
|
|
330
|
-
? BigNumber.max(
|
|
335
|
+
? BigNumber.max(
|
|
336
|
+
mainAccount.spendableBalance.minus(fee).minus(rentExemptMin),
|
|
337
|
+
0
|
|
338
|
+
)
|
|
331
339
|
: tx.amount;
|
|
332
340
|
|
|
333
341
|
if (tx.useAllAmount) {
|
|
@@ -337,7 +345,9 @@ async function deriveTransferCommandDescriptor(
|
|
|
337
345
|
} else {
|
|
338
346
|
if (txAmount.lte(0)) {
|
|
339
347
|
errors.amount = new AmountRequired();
|
|
340
|
-
} else if (
|
|
348
|
+
} else if (
|
|
349
|
+
txAmount.plus(fee).plus(rentExemptMin).gt(mainAccount.spendableBalance)
|
|
350
|
+
) {
|
|
341
351
|
errors.amount = new NotEnoughBalance();
|
|
342
352
|
}
|
|
343
353
|
}
|
|
@@ -375,16 +385,24 @@ async function deriveStakeCreateAccountCommandDescriptor(
|
|
|
375
385
|
const stakeAccRentExemptAmount =
|
|
376
386
|
await getStakeAccountMinimumBalanceForRentExemption(api);
|
|
377
387
|
|
|
388
|
+
const rentExemptMin = await getAccountMinimumBalanceForRentExemption(
|
|
389
|
+
api,
|
|
390
|
+
mainAccount.freshAddress
|
|
391
|
+
);
|
|
392
|
+
|
|
378
393
|
const fee = txFee + stakeAccRentExemptAmount;
|
|
379
394
|
|
|
380
395
|
const amount = tx.useAllAmount
|
|
381
396
|
? BigNumber.max(
|
|
382
|
-
mainAccount.spendableBalance.minus(fee).minus(
|
|
397
|
+
mainAccount.spendableBalance.minus(fee).minus(rentExemptMin),
|
|
383
398
|
0
|
|
384
399
|
)
|
|
385
400
|
: tx.amount;
|
|
386
401
|
|
|
387
|
-
if (
|
|
402
|
+
if (
|
|
403
|
+
!errors.amount &&
|
|
404
|
+
mainAccount.spendableBalance.lt(amount.plus(fee).plus(rentExemptMin))
|
|
405
|
+
) {
|
|
388
406
|
errors.amount = new NotEnoughBalance();
|
|
389
407
|
}
|
|
390
408
|
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { findTokenById
|
|
1
|
+
import { findTokenById } from "@ledgerhq/cryptoassets";
|
|
2
2
|
import { PublicKey } from "@solana/web3.js";
|
|
3
3
|
import { TokenAccount } from "@ledgerhq/types-live";
|
|
4
4
|
import { StakeMeta } from "./api/chain/account/stake";
|
|
5
5
|
import { SolanaStake, StakeAction } from "./types";
|
|
6
6
|
import { assertUnreachable } from "./utils";
|
|
7
|
-
import { parseCurrencyUnit } from "../../currencies";
|
|
8
|
-
|
|
9
|
-
const currency = getCryptoCurrencyById("solana");
|
|
10
7
|
|
|
11
8
|
export type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
|
|
12
9
|
|
|
13
10
|
export const MAX_MEMO_LENGTH = 500;
|
|
14
11
|
|
|
15
|
-
export const SOLANA_DUST = parseCurrencyUnit(currency.units[0], "0.00001");
|
|
16
|
-
|
|
17
12
|
export const isValidBase58Address = (address: string): boolean => {
|
|
18
13
|
try {
|
|
19
14
|
return Boolean(new PublicKey(address));
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
SolanaResourcesRaw,
|
|
6
6
|
} from "./types";
|
|
7
7
|
import { Account, AccountRaw } from "@ledgerhq/types-live";
|
|
8
|
-
import { isEqual } from "lodash";
|
|
9
8
|
|
|
10
9
|
export function toSolanaResourcesRaw(
|
|
11
10
|
resources: SolanaResources
|
|
@@ -38,28 +37,3 @@ export function assignFromAccountRaw(accountRaw: AccountRaw, account: Account) {
|
|
|
38
37
|
(account as SolanaAccount).solanaResources =
|
|
39
38
|
fromSolanaResourcesRaw(solanaResourcesRaw);
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
export function applyReconciliation(
|
|
43
|
-
account: Account,
|
|
44
|
-
updatedRaw: AccountRaw,
|
|
45
|
-
next: Account
|
|
46
|
-
): boolean {
|
|
47
|
-
let changed = false;
|
|
48
|
-
const solanaAcc = account as SolanaAccount;
|
|
49
|
-
const solanaUpdatedRaw = updatedRaw as SolanaAccountRaw;
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
solanaUpdatedRaw.solanaResources &&
|
|
53
|
-
(!solanaAcc.solanaResources ||
|
|
54
|
-
!isEqual(
|
|
55
|
-
toSolanaResourcesRaw(solanaAcc.solanaResources),
|
|
56
|
-
solanaUpdatedRaw.solanaResources
|
|
57
|
-
))
|
|
58
|
-
) {
|
|
59
|
-
(next as SolanaAccount).solanaResources = fromSolanaResourcesRaw(
|
|
60
|
-
solanaUpdatedRaw.solanaResources
|
|
61
|
-
);
|
|
62
|
-
changed = true;
|
|
63
|
-
}
|
|
64
|
-
return changed;
|
|
65
|
-
}
|
|
@@ -41,11 +41,7 @@ import { patchOperationWithHash } from "../../../operation";
|
|
|
41
41
|
import { log } from "@ledgerhq/logs";
|
|
42
42
|
import { InvalidAddressBecauseAlreadyDelegated } from "../../../errors";
|
|
43
43
|
import api from "../api/tzkt";
|
|
44
|
-
import {
|
|
45
|
-
applyReconciliation,
|
|
46
|
-
assignFromAccountRaw,
|
|
47
|
-
assignToAccountRaw,
|
|
48
|
-
} from "../serialization";
|
|
44
|
+
import { assignFromAccountRaw, assignToAccountRaw } from "../serialization";
|
|
49
45
|
|
|
50
46
|
const validateRecipient = (currency, recipient) => {
|
|
51
47
|
let recipientError: Error | null = null;
|
|
@@ -403,7 +399,6 @@ const accountBridge: AccountBridge<Transaction> = {
|
|
|
403
399
|
receive,
|
|
404
400
|
signOperation,
|
|
405
401
|
broadcast,
|
|
406
|
-
applyReconciliation,
|
|
407
402
|
assignToAccountRaw,
|
|
408
403
|
assignFromAccountRaw,
|
|
409
404
|
};
|
|
@@ -5,7 +5,6 @@ import type {
|
|
|
5
5
|
TezosResourcesRaw,
|
|
6
6
|
} from "./types";
|
|
7
7
|
import { Account, AccountRaw } from "@ledgerhq/types-live";
|
|
8
|
-
import isEqual from "lodash/isEqual";
|
|
9
8
|
|
|
10
9
|
export function toTezosResourcesRaw(r: TezosResources): TezosResourcesRaw {
|
|
11
10
|
const { revealed, counter } = r;
|
|
@@ -32,27 +31,3 @@ export function assignFromAccountRaw(accountRaw: AccountRaw, account: Account) {
|
|
|
32
31
|
(account as TezosAccount).tezosResources =
|
|
33
32
|
fromTezosResourcesRaw(tezosResourcesRaw);
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
export function applyReconciliation(
|
|
37
|
-
account: Account,
|
|
38
|
-
updatedRaw: AccountRaw,
|
|
39
|
-
next: Account
|
|
40
|
-
): boolean {
|
|
41
|
-
let changed = false;
|
|
42
|
-
const tezosAcc = account as TezosAccount;
|
|
43
|
-
const tezosUpdatedRaw = updatedRaw as TezosAccountRaw;
|
|
44
|
-
if (
|
|
45
|
-
tezosUpdatedRaw.tezosResources &&
|
|
46
|
-
(!tezosAcc.tezosResources ||
|
|
47
|
-
!isEqual(
|
|
48
|
-
toTezosResourcesRaw(tezosAcc.tezosResources),
|
|
49
|
-
tezosUpdatedRaw.tezosResources
|
|
50
|
-
))
|
|
51
|
-
) {
|
|
52
|
-
(next as TezosAccount).tezosResources = fromTezosResourcesRaw(
|
|
53
|
-
tezosUpdatedRaw.tezosResources
|
|
54
|
-
);
|
|
55
|
-
changed = true;
|
|
56
|
-
}
|
|
57
|
-
return changed;
|
|
58
|
-
}
|
|
@@ -86,11 +86,7 @@ import {
|
|
|
86
86
|
import { activationFees, oneTrx } from "../constants";
|
|
87
87
|
import { makeAccountBridgeReceive } from "../../../bridge/jsHelpers";
|
|
88
88
|
import type { AccountShapeInfo } from "../../../bridge/jsHelpers";
|
|
89
|
-
import {
|
|
90
|
-
assignFromAccountRaw,
|
|
91
|
-
assignToAccountRaw,
|
|
92
|
-
applyReconciliation,
|
|
93
|
-
} from "../serialization";
|
|
89
|
+
import { assignFromAccountRaw, assignToAccountRaw } from "../serialization";
|
|
94
90
|
|
|
95
91
|
const receive = makeAccountBridgeReceive();
|
|
96
92
|
|
|
@@ -849,7 +845,6 @@ const accountBridge: AccountBridge<Transaction> = {
|
|
|
849
845
|
receive,
|
|
850
846
|
signOperation,
|
|
851
847
|
broadcast,
|
|
852
|
-
applyReconciliation,
|
|
853
848
|
assignFromAccountRaw,
|
|
854
849
|
assignToAccountRaw,
|
|
855
850
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BigNumber } from "bignumber.js";
|
|
2
|
-
import { isEqual } from "lodash";
|
|
3
2
|
import type {
|
|
4
3
|
TronAccount,
|
|
5
4
|
TronAccountRaw,
|
|
@@ -171,27 +170,3 @@ export function assignFromAccountRaw(accountRaw: AccountRaw, account: Account) {
|
|
|
171
170
|
(account as TronAccount).tronResources =
|
|
172
171
|
fromTronResourcesRaw(tronResourcesRaw);
|
|
173
172
|
}
|
|
174
|
-
|
|
175
|
-
export function applyReconciliation(
|
|
176
|
-
account: Account,
|
|
177
|
-
updatedRaw: AccountRaw,
|
|
178
|
-
next: Account
|
|
179
|
-
): boolean {
|
|
180
|
-
let changed = false;
|
|
181
|
-
const tronAcc = account as TronAccount;
|
|
182
|
-
const tronUpdatedRaw = updatedRaw as TronAccountRaw;
|
|
183
|
-
if (
|
|
184
|
-
tronUpdatedRaw.tronResources &&
|
|
185
|
-
(!tronAcc.tronResources ||
|
|
186
|
-
!isEqual(
|
|
187
|
-
toTronResourcesRaw(tronAcc.tronResources),
|
|
188
|
-
tronUpdatedRaw.tronResources
|
|
189
|
-
))
|
|
190
|
-
) {
|
|
191
|
-
(next as TronAccount).tronResources = fromTronResourcesRaw(
|
|
192
|
-
tronUpdatedRaw.tronResources
|
|
193
|
-
);
|
|
194
|
-
changed = true;
|
|
195
|
-
}
|
|
196
|
-
return changed;
|
|
197
|
-
}
|
package/src/hw/deviceAccess.ts
CHANGED
|
@@ -106,6 +106,7 @@ export const withDevice =
|
|
|
106
106
|
|
|
107
107
|
// When we'll finish all the current job, we'll call finish
|
|
108
108
|
let resolveQueuedDevice;
|
|
109
|
+
|
|
109
110
|
// This new promise is the next exec queue
|
|
110
111
|
deviceQueues[deviceId] = new Promise((resolve) => {
|
|
111
112
|
resolveQueuedDevice = resolve;
|
|
@@ -118,12 +119,14 @@ export const withDevice =
|
|
|
118
119
|
deviceQueue
|
|
119
120
|
.then(() => open(deviceId)) // open the transport
|
|
120
121
|
.then(async (transport) => {
|
|
121
|
-
log("withDevice", `${nonce}:
|
|
122
|
-
|
|
122
|
+
log("withDevice", `${nonce}: got a transport`);
|
|
123
|
+
|
|
123
124
|
if (unsubscribed) {
|
|
125
|
+
log("withDevice", `${nonce}: but we're unsubscribed`);
|
|
124
126
|
// It was unsubscribed prematurely
|
|
125
127
|
return finalize(transport, [resolveQueuedDevice]);
|
|
126
128
|
}
|
|
129
|
+
setAllowAutoDisconnect(transport, deviceId, false);
|
|
127
130
|
|
|
128
131
|
if (needsCleanup[identifyTransport(transport)]) {
|
|
129
132
|
delete needsCleanup[identifyTransport(transport)];
|
|
@@ -149,6 +152,7 @@ export const withDevice =
|
|
|
149
152
|
return finalize(transport, [resolveQueuedDevice]);
|
|
150
153
|
}
|
|
151
154
|
|
|
155
|
+
log("withDevice", `${nonce}: Starting job`);
|
|
152
156
|
sub = job(transport)
|
|
153
157
|
.pipe(
|
|
154
158
|
catchError(initialErrorRemapping),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeviceExtractOnboardingStateError } from "@ledgerhq/errors";
|
|
1
2
|
import {
|
|
2
3
|
extractOnboardingState,
|
|
3
4
|
OnboardingStep,
|
|
@@ -8,9 +9,10 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
8
9
|
describe("When the flag bytes are incorrect", () => {
|
|
9
10
|
it("should throw an error", () => {
|
|
10
11
|
const incompleteFlagsBytes = Buffer.from([0, 0]);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
expect(() => extractOnboardingState(incompleteFlagsBytes)).toThrow(
|
|
14
|
+
DeviceExtractOnboardingStateError
|
|
15
|
+
);
|
|
14
16
|
});
|
|
15
17
|
});
|
|
16
18
|
|
|
@@ -75,17 +77,17 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
75
77
|
});
|
|
76
78
|
});
|
|
77
79
|
|
|
78
|
-
describe("and the user is
|
|
80
|
+
describe("and the user is on 'choose name' step", () => {
|
|
79
81
|
beforeEach(() => {
|
|
80
|
-
flagsBytes[3] =
|
|
82
|
+
flagsBytes[3] = 12;
|
|
81
83
|
});
|
|
82
84
|
|
|
83
|
-
it("should return an onboarding step that is set at
|
|
85
|
+
it("should return an onboarding step that is set at ready", () => {
|
|
84
86
|
const onboardingState = extractOnboardingState(flagsBytes);
|
|
85
87
|
|
|
86
88
|
expect(onboardingState).not.toBeNull();
|
|
87
89
|
expect(onboardingState?.currentOnboardingStep).toBe(
|
|
88
|
-
OnboardingStep.
|
|
90
|
+
OnboardingStep.ChooseName
|
|
89
91
|
);
|
|
90
92
|
});
|
|
91
93
|
});
|
|
@@ -105,6 +107,21 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
105
107
|
});
|
|
106
108
|
});
|
|
107
109
|
|
|
110
|
+
describe("and the user is choosing what kind of setup they want", () => {
|
|
111
|
+
beforeEach(() => {
|
|
112
|
+
flagsBytes[3] = 5;
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("should return an onboarding step that is set at the setup choice", () => {
|
|
116
|
+
const onboardingState = extractOnboardingState(flagsBytes);
|
|
117
|
+
|
|
118
|
+
expect(onboardingState).not.toBeNull();
|
|
119
|
+
expect(onboardingState?.currentOnboardingStep).toBe(
|
|
120
|
+
OnboardingStep.SetupChoice
|
|
121
|
+
);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
108
125
|
describe("and the user is generating a new seed", () => {
|
|
109
126
|
describe("and the seed phrase type is set to 24 words", () => {
|
|
110
127
|
beforeEach(() => {
|
|
@@ -175,7 +192,22 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
175
192
|
});
|
|
176
193
|
});
|
|
177
194
|
|
|
178
|
-
describe("and the user
|
|
195
|
+
describe("and the user wants to restore a seed, choosing between restoring their own seed or Recover", () => {
|
|
196
|
+
beforeEach(() => {
|
|
197
|
+
flagsBytes[3] = 14;
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it("should return an onboarding step that is set at the setup restore choice", () => {
|
|
201
|
+
const onboardingState = extractOnboardingState(flagsBytes);
|
|
202
|
+
|
|
203
|
+
expect(onboardingState).not.toBeNull();
|
|
204
|
+
expect(onboardingState?.currentOnboardingStep).toBe(
|
|
205
|
+
OnboardingStep.SetupChoiceRestore
|
|
206
|
+
);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
describe("and the user is restoring a seed directly (without Recover)", () => {
|
|
179
211
|
describe("and the seed phrase type is set to X words", () => {
|
|
180
212
|
it("should return a device state with the correct seed phrase type", () => {
|
|
181
213
|
const byte3 = flagsBytes[2];
|
|
@@ -234,32 +266,32 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
234
266
|
});
|
|
235
267
|
});
|
|
236
268
|
|
|
237
|
-
describe("and the user
|
|
269
|
+
describe("and the user wants to restore with Recover", () => {
|
|
238
270
|
beforeEach(() => {
|
|
239
|
-
flagsBytes[3] =
|
|
271
|
+
flagsBytes[3] = 13;
|
|
240
272
|
});
|
|
241
273
|
|
|
242
|
-
it("should return an onboarding step that is set at the
|
|
274
|
+
it("should return an onboarding step that is set at the restore with Recover", () => {
|
|
243
275
|
const onboardingState = extractOnboardingState(flagsBytes);
|
|
244
276
|
|
|
245
277
|
expect(onboardingState).not.toBeNull();
|
|
246
278
|
expect(onboardingState?.currentOnboardingStep).toBe(
|
|
247
|
-
OnboardingStep.
|
|
279
|
+
OnboardingStep.RecoverRestore
|
|
248
280
|
);
|
|
249
281
|
});
|
|
250
282
|
});
|
|
251
283
|
|
|
252
|
-
describe("and the user is on
|
|
284
|
+
describe("and the user is on the safety warning screen", () => {
|
|
253
285
|
beforeEach(() => {
|
|
254
|
-
flagsBytes[3] =
|
|
286
|
+
flagsBytes[3] = 10;
|
|
255
287
|
});
|
|
256
288
|
|
|
257
|
-
it("should return an onboarding step that is set at
|
|
289
|
+
it("should return an onboarding step that is set at the safety warning screen", () => {
|
|
258
290
|
const onboardingState = extractOnboardingState(flagsBytes);
|
|
259
291
|
|
|
260
292
|
expect(onboardingState).not.toBeNull();
|
|
261
293
|
expect(onboardingState?.currentOnboardingStep).toBe(
|
|
262
|
-
OnboardingStep.
|
|
294
|
+
OnboardingStep.SafetyWarning
|
|
263
295
|
);
|
|
264
296
|
});
|
|
265
297
|
});
|
|
@@ -278,6 +310,21 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
278
310
|
);
|
|
279
311
|
});
|
|
280
312
|
});
|
|
313
|
+
|
|
314
|
+
describe("and the device is set to an onboarding step/flag that is not handled yet", () => {
|
|
315
|
+
beforeEach(() => {
|
|
316
|
+
// To update so it's never handled
|
|
317
|
+
flagsBytes[3] = 20;
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it("should thrown an error", () => {
|
|
321
|
+
// DeviceExtractOnboardingStateError is not of type Error,
|
|
322
|
+
// so cannot check in toThrow(DeviceExtractOnboardingStateError)
|
|
323
|
+
expect(() => extractOnboardingState(flagsBytes)).toThrow(
|
|
324
|
+
DeviceExtractOnboardingStateError
|
|
325
|
+
);
|
|
326
|
+
});
|
|
327
|
+
});
|
|
281
328
|
});
|
|
282
329
|
});
|
|
283
330
|
});
|
|
@@ -30,14 +30,16 @@ export enum OnboardingStep {
|
|
|
30
30
|
WelcomeScreen3 = "WELCOME_SCREEN_3",
|
|
31
31
|
WelcomeScreen4 = "WELCOME_SCREEN_4",
|
|
32
32
|
WelcomeScreenReminder = "WELCOME_SCREEN_REMINDER",
|
|
33
|
-
|
|
33
|
+
ChooseName = "CHOOSE_NAME",
|
|
34
34
|
Pin = "PIN",
|
|
35
|
+
SetupChoice = "SETUP_CHOICE",
|
|
35
36
|
NewDevice = "NEW_DEVICE", // path "new device" & currentSeedWordIndex available
|
|
36
37
|
NewDeviceConfirming = "NEW_DEVICE_CONFIRMING", // path "new device" & currentSeedWordIndex available
|
|
38
|
+
SetupChoiceRestore = "SETUP_CHOICE_RESTORE", // choosing between restoring a see directly (RestoreSeed) or use Recover (RecoverRestore)
|
|
37
39
|
RestoreSeed = "RESTORE_SEED", // path "restore seed" & currentSeedWordIndex available
|
|
40
|
+
RecoverRestore = "RECOVER_RESTORE", // path "restore with Recover"
|
|
38
41
|
SafetyWarning = "SAFETY WARNING",
|
|
39
42
|
Ready = "READY",
|
|
40
|
-
ChooseName = "CHOOSE_NAME",
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
const fromBitsToOnboardingStep = new Map<number, OnboardingStep>([
|
|
@@ -54,6 +56,8 @@ const fromBitsToOnboardingStep = new Map<number, OnboardingStep>([
|
|
|
54
56
|
[10, OnboardingStep.SafetyWarning],
|
|
55
57
|
[11, OnboardingStep.Ready],
|
|
56
58
|
[12, OnboardingStep.ChooseName],
|
|
59
|
+
[13, OnboardingStep.RecoverRestore],
|
|
60
|
+
[14, OnboardingStep.SetupChoiceRestore],
|
|
57
61
|
]);
|
|
58
62
|
|
|
59
63
|
export type OnboardingState = {
|