@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
package/src/reconciliation.ts
DELETED
|
@@ -1,536 +0,0 @@
|
|
|
1
|
-
// reconciliation by the React definition. https://reactjs.org/docs/reconciliation.html
|
|
2
|
-
import isEqual from "lodash/isEqual";
|
|
3
|
-
import { BigNumber } from "bignumber.js";
|
|
4
|
-
import { sameOp } from "./bridge/jsHelpers";
|
|
5
|
-
import type {
|
|
6
|
-
Operation,
|
|
7
|
-
OperationRaw,
|
|
8
|
-
Account,
|
|
9
|
-
AccountLike,
|
|
10
|
-
AccountRaw,
|
|
11
|
-
SubAccount,
|
|
12
|
-
SubAccountRaw,
|
|
13
|
-
BalanceHistoryCache,
|
|
14
|
-
} from "@ledgerhq/types-live";
|
|
15
|
-
import {
|
|
16
|
-
fromAccountRaw,
|
|
17
|
-
fromOperationRaw,
|
|
18
|
-
fromSubAccountRaw,
|
|
19
|
-
fromBitcoinResourcesRaw,
|
|
20
|
-
fromPolkadotResourcesRaw,
|
|
21
|
-
fromCryptoOrgResourcesRaw,
|
|
22
|
-
fromNFTRaw,
|
|
23
|
-
toPolkadotResourcesRaw,
|
|
24
|
-
toCryptoOrgResourcesRaw,
|
|
25
|
-
} from "./account";
|
|
26
|
-
import consoleWarnExpectToEqual from "./consoleWarnExpectToEqual";
|
|
27
|
-
import { BitcoinAccount, BitcoinAccountRaw } from "./families/bitcoin/types";
|
|
28
|
-
import {
|
|
29
|
-
CryptoOrgAccount,
|
|
30
|
-
CryptoOrgAccountRaw,
|
|
31
|
-
} from "./families/crypto_org/types";
|
|
32
|
-
import { PolkadotAccount, PolkadotAccountRaw } from "./families/polkadot/types";
|
|
33
|
-
import { getAccountBridge } from "./bridge";
|
|
34
|
-
|
|
35
|
-
// aim to build operations with the minimal diff & call to coin implementation possible
|
|
36
|
-
export async function minimalOperationsBuilder<CO>(
|
|
37
|
-
existingOperations: Operation[],
|
|
38
|
-
coreOperations: CO[],
|
|
39
|
-
buildOp: (coreOperation: CO) => Promise<Operation | null | undefined>, // if defined, allows to merge some consecutive operation that have same hash
|
|
40
|
-
mergeSameHashOps?: (arg0: Operation[]) => Operation
|
|
41
|
-
): Promise<Operation[]> {
|
|
42
|
-
if (existingOperations.length === 0 && coreOperations.length === 0) {
|
|
43
|
-
return existingOperations;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const state: StepBuilderState = {
|
|
47
|
-
finished: false,
|
|
48
|
-
operations: [],
|
|
49
|
-
existingOps: existingOperations || [],
|
|
50
|
-
immutableOpCmpDoneOnce: false,
|
|
51
|
-
};
|
|
52
|
-
let operationWithSameHash: Operation[] = [];
|
|
53
|
-
|
|
54
|
-
for (let i = coreOperations.length - 1; i >= 0; i--) {
|
|
55
|
-
const coreOperation = coreOperations[i];
|
|
56
|
-
const op = await buildOp(coreOperation);
|
|
57
|
-
if (!op) continue; // some operation can be skipped by implementation
|
|
58
|
-
|
|
59
|
-
let newOp;
|
|
60
|
-
|
|
61
|
-
if (mergeSameHashOps) {
|
|
62
|
-
if (
|
|
63
|
-
operationWithSameHash.length === 0 ||
|
|
64
|
-
operationWithSameHash[0].hash === op.hash
|
|
65
|
-
) {
|
|
66
|
-
// we accumulate consecutive op of same hash in operationWithSameHash
|
|
67
|
-
operationWithSameHash.push(op);
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// when the new op no longer matches the one accumulated,
|
|
72
|
-
// we can "release" one operation resulting of merging the accumulation
|
|
73
|
-
newOp = mergeSameHashOps(operationWithSameHash);
|
|
74
|
-
operationWithSameHash = [op];
|
|
75
|
-
} else {
|
|
76
|
-
// mergeSameHashOps not used = normal iteration
|
|
77
|
-
newOp = op;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
stepBuilder(state, newOp, i);
|
|
81
|
-
|
|
82
|
-
if (state.finished) {
|
|
83
|
-
return state.operations;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (mergeSameHashOps && operationWithSameHash.length) {
|
|
88
|
-
stepBuilder(state, mergeSameHashOps(operationWithSameHash), 0);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return state.operations;
|
|
92
|
-
}
|
|
93
|
-
export function minimalOperationsBuilderSync<CO>(
|
|
94
|
-
existingOperations: Operation[],
|
|
95
|
-
coreOperations: CO[],
|
|
96
|
-
buildOp: (coreOperation: CO) => Operation | null | undefined
|
|
97
|
-
): Operation[] {
|
|
98
|
-
if (existingOperations.length === 0 && coreOperations.length === 0) {
|
|
99
|
-
return existingOperations;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const state: StepBuilderState = {
|
|
103
|
-
finished: false,
|
|
104
|
-
operations: [],
|
|
105
|
-
existingOps: existingOperations || [],
|
|
106
|
-
immutableOpCmpDoneOnce: false,
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
for (let i = coreOperations.length - 1; i >= 0; i--) {
|
|
110
|
-
const coreOperation = coreOperations[i];
|
|
111
|
-
const newOp = buildOp(coreOperation);
|
|
112
|
-
if (!newOp) continue;
|
|
113
|
-
stepBuilder(state, newOp, i);
|
|
114
|
-
|
|
115
|
-
if (state.finished) {
|
|
116
|
-
return state.operations;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return state.operations;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const shouldRefreshBalanceHistoryCache = (
|
|
124
|
-
balanceHistoryCache: BalanceHistoryCache,
|
|
125
|
-
account: AccountLike
|
|
126
|
-
): boolean => {
|
|
127
|
-
const oldH = account.balanceHistoryCache.HOUR;
|
|
128
|
-
const newH = balanceHistoryCache.HOUR;
|
|
129
|
-
if (oldH.latestDate !== newH.latestDate) return true; // date have changed, need to refresh the array
|
|
130
|
-
|
|
131
|
-
if (oldH.balances.length !== newH.balances.length) return true; // balances length changes (new ops for instance)
|
|
132
|
-
|
|
133
|
-
const length = newH.balances.length;
|
|
134
|
-
if (length === 0) return false;
|
|
135
|
-
if (oldH.balances[length - 1] !== newH.balances[length - 1]) return true; // latest datapoint changes.
|
|
136
|
-
|
|
137
|
-
return false;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
function shouldRefreshBitcoinResources(
|
|
141
|
-
updatedRaw: AccountRaw,
|
|
142
|
-
account: Account
|
|
143
|
-
) {
|
|
144
|
-
if (!(updatedRaw as BitcoinAccountRaw).bitcoinResources) return false;
|
|
145
|
-
if (!(account as BitcoinAccount).bitcoinResources) return true;
|
|
146
|
-
if (updatedRaw.blockHeight !== account.blockHeight) return true;
|
|
147
|
-
if (updatedRaw.operations.length !== account.operations.length) return true;
|
|
148
|
-
const { bitcoinResources: existing } = account as BitcoinAccount;
|
|
149
|
-
const { bitcoinResources: raw } = updatedRaw as BitcoinAccountRaw;
|
|
150
|
-
// FIXME Need more typing in wallet-btc to have a meaningful comparison
|
|
151
|
-
//if (!isEqual(raw.walletAccount?.xpub?.data, existing.walletAccount?.xpub?.data)) return true;
|
|
152
|
-
if (raw.utxos.length !== existing.utxos.length) return true;
|
|
153
|
-
return !isEqual(raw.utxos, existing.utxos);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export function patchAccount(
|
|
157
|
-
account: Account,
|
|
158
|
-
updatedRaw: AccountRaw
|
|
159
|
-
): Account {
|
|
160
|
-
// id can change after a sync typically if changing the version or filling more info. in that case we consider all changes.
|
|
161
|
-
if (account.id !== updatedRaw.id) return fromAccountRaw(updatedRaw);
|
|
162
|
-
let subAccounts;
|
|
163
|
-
|
|
164
|
-
if (updatedRaw.subAccounts) {
|
|
165
|
-
const existingSubAccounts = account.subAccounts || [];
|
|
166
|
-
let subAccountsChanged =
|
|
167
|
-
updatedRaw.subAccounts.length !== existingSubAccounts.length;
|
|
168
|
-
subAccounts = updatedRaw.subAccounts.map((ta) => {
|
|
169
|
-
const existing = existingSubAccounts.find((t) => t.id === ta.id);
|
|
170
|
-
const patched = patchSubAccount(existing, ta);
|
|
171
|
-
|
|
172
|
-
if (patched !== existing) {
|
|
173
|
-
subAccountsChanged = true;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return patched;
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
if (!subAccountsChanged) {
|
|
180
|
-
subAccounts = existingSubAccounts;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const operations = patchOperations(
|
|
185
|
-
account.operations,
|
|
186
|
-
updatedRaw.operations,
|
|
187
|
-
updatedRaw.id,
|
|
188
|
-
subAccounts
|
|
189
|
-
);
|
|
190
|
-
const pendingOperations = patchOperations(
|
|
191
|
-
account.pendingOperations,
|
|
192
|
-
updatedRaw.pendingOperations,
|
|
193
|
-
updatedRaw.id,
|
|
194
|
-
subAccounts
|
|
195
|
-
);
|
|
196
|
-
const next: Account = { ...account };
|
|
197
|
-
let changed = false;
|
|
198
|
-
|
|
199
|
-
if (subAccounts && account.subAccounts !== subAccounts) {
|
|
200
|
-
next.subAccounts = subAccounts;
|
|
201
|
-
changed = true;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (account.operations !== operations) {
|
|
205
|
-
next.operations = operations;
|
|
206
|
-
changed = true;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (
|
|
210
|
-
account.operationsCount !== updatedRaw.operationsCount &&
|
|
211
|
-
updatedRaw.operationsCount
|
|
212
|
-
) {
|
|
213
|
-
next.operationsCount = updatedRaw.operationsCount;
|
|
214
|
-
changed = true;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (account.pendingOperations !== pendingOperations) {
|
|
218
|
-
next.pendingOperations = pendingOperations;
|
|
219
|
-
changed = true;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (updatedRaw.balance !== account.balance.toString()) {
|
|
223
|
-
next.balance = new BigNumber(updatedRaw.balance);
|
|
224
|
-
changed = true;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (updatedRaw.spendableBalance !== account.spendableBalance.toString()) {
|
|
228
|
-
next.spendableBalance = new BigNumber(
|
|
229
|
-
updatedRaw.spendableBalance || updatedRaw.balance
|
|
230
|
-
);
|
|
231
|
-
changed = true;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (updatedRaw.lastSyncDate !== account.lastSyncDate.toISOString()) {
|
|
235
|
-
next.lastSyncDate = new Date(updatedRaw.lastSyncDate);
|
|
236
|
-
changed = true;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
if (
|
|
240
|
-
updatedRaw.creationDate &&
|
|
241
|
-
updatedRaw.creationDate !== account.creationDate.toISOString()
|
|
242
|
-
) {
|
|
243
|
-
next.creationDate = new Date(updatedRaw.creationDate);
|
|
244
|
-
changed = true;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (account.freshAddress !== updatedRaw.freshAddress) {
|
|
248
|
-
next.freshAddress = updatedRaw.freshAddress;
|
|
249
|
-
changed = true;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (account.freshAddressPath !== updatedRaw.freshAddressPath) {
|
|
253
|
-
next.freshAddressPath = updatedRaw.freshAddressPath;
|
|
254
|
-
changed = true;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (account.blockHeight !== updatedRaw.blockHeight) {
|
|
258
|
-
next.blockHeight = updatedRaw.blockHeight;
|
|
259
|
-
changed = true;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (account.syncHash !== updatedRaw.syncHash) {
|
|
263
|
-
next.syncHash = updatedRaw.syncHash;
|
|
264
|
-
changed = true;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
const { balanceHistoryCache } = updatedRaw;
|
|
268
|
-
|
|
269
|
-
if (balanceHistoryCache) {
|
|
270
|
-
if (shouldRefreshBalanceHistoryCache(balanceHistoryCache, account)) {
|
|
271
|
-
next.balanceHistoryCache = balanceHistoryCache;
|
|
272
|
-
changed = true;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// TODO This will be reworked to belong in each coin family
|
|
277
|
-
// Temporary logic to patch resources for each coin is:
|
|
278
|
-
// - there is raw data to patch from
|
|
279
|
-
// AND
|
|
280
|
-
// - there is no current account data
|
|
281
|
-
// OR
|
|
282
|
-
// - current account data is different
|
|
283
|
-
switch (account.currency.family) {
|
|
284
|
-
case "bitcoin": {
|
|
285
|
-
if (shouldRefreshBitcoinResources(updatedRaw, account)) {
|
|
286
|
-
(next as BitcoinAccount).bitcoinResources = fromBitcoinResourcesRaw(
|
|
287
|
-
(updatedRaw as BitcoinAccountRaw).bitcoinResources
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
case "polkadot": {
|
|
293
|
-
const polkadotAcc = account as PolkadotAccount;
|
|
294
|
-
const polkadotUpdatedRaw = updatedRaw as PolkadotAccountRaw;
|
|
295
|
-
if (
|
|
296
|
-
polkadotUpdatedRaw.polkadotResources &&
|
|
297
|
-
(!polkadotAcc.polkadotResources ||
|
|
298
|
-
!areSameResources(
|
|
299
|
-
toPolkadotResourcesRaw(polkadotAcc.polkadotResources),
|
|
300
|
-
polkadotUpdatedRaw.polkadotResources
|
|
301
|
-
))
|
|
302
|
-
) {
|
|
303
|
-
(next as PolkadotAccount).polkadotResources = fromPolkadotResourcesRaw(
|
|
304
|
-
polkadotUpdatedRaw.polkadotResources
|
|
305
|
-
);
|
|
306
|
-
changed = true;
|
|
307
|
-
}
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
310
|
-
case "crypto_org": {
|
|
311
|
-
const cryptoOrgAcc = account as CryptoOrgAccount;
|
|
312
|
-
const cryptoOrgUpdatedRaw = updatedRaw as CryptoOrgAccountRaw;
|
|
313
|
-
if (
|
|
314
|
-
cryptoOrgUpdatedRaw.cryptoOrgResources &&
|
|
315
|
-
(!cryptoOrgAcc.cryptoOrgResources ||
|
|
316
|
-
!areSameResources(
|
|
317
|
-
toCryptoOrgResourcesRaw(cryptoOrgAcc.cryptoOrgResources),
|
|
318
|
-
cryptoOrgUpdatedRaw.cryptoOrgResources
|
|
319
|
-
))
|
|
320
|
-
) {
|
|
321
|
-
(next as CryptoOrgAccount).cryptoOrgResources =
|
|
322
|
-
fromCryptoOrgResourcesRaw(cryptoOrgUpdatedRaw.cryptoOrgResources);
|
|
323
|
-
changed = true;
|
|
324
|
-
}
|
|
325
|
-
break;
|
|
326
|
-
}
|
|
327
|
-
default: {
|
|
328
|
-
const bridge = getAccountBridge(account);
|
|
329
|
-
const applyReconciliation = bridge.applyReconciliation;
|
|
330
|
-
if (applyReconciliation) {
|
|
331
|
-
changed = changed || applyReconciliation(account, updatedRaw, next);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
const nfts = updatedRaw?.nfts?.map(fromNFTRaw);
|
|
337
|
-
if (!updatedRaw.nfts && account.nfts) {
|
|
338
|
-
delete next.nfts;
|
|
339
|
-
changed = true;
|
|
340
|
-
} else if (!isEqual(account.nfts, nfts)) {
|
|
341
|
-
next.nfts = nfts;
|
|
342
|
-
changed = true;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
if (!changed) return account; // nothing changed at all
|
|
346
|
-
|
|
347
|
-
return next;
|
|
348
|
-
}
|
|
349
|
-
export function patchSubAccount(
|
|
350
|
-
account: SubAccount | null | undefined,
|
|
351
|
-
updatedRaw: SubAccountRaw
|
|
352
|
-
): SubAccount {
|
|
353
|
-
// id can change after a sync typically if changing the version or filling more info. in that case we consider all changes.
|
|
354
|
-
if (
|
|
355
|
-
!account ||
|
|
356
|
-
account.id !== updatedRaw.id ||
|
|
357
|
-
account.parentId !== updatedRaw.parentId
|
|
358
|
-
) {
|
|
359
|
-
return fromSubAccountRaw(updatedRaw);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
const operations = patchOperations(
|
|
363
|
-
account.operations,
|
|
364
|
-
updatedRaw.operations,
|
|
365
|
-
updatedRaw.id,
|
|
366
|
-
undefined
|
|
367
|
-
);
|
|
368
|
-
const pendingOperations = patchOperations(
|
|
369
|
-
account.pendingOperations,
|
|
370
|
-
updatedRaw.pendingOperations,
|
|
371
|
-
updatedRaw.id,
|
|
372
|
-
undefined
|
|
373
|
-
);
|
|
374
|
-
// $FlowFixMe destructing union type?
|
|
375
|
-
const next: SubAccount = { ...account };
|
|
376
|
-
let changed = false;
|
|
377
|
-
|
|
378
|
-
if (
|
|
379
|
-
account.operationsCount !== updatedRaw.operationsCount &&
|
|
380
|
-
updatedRaw.operationsCount
|
|
381
|
-
) {
|
|
382
|
-
next.operationsCount = updatedRaw.operationsCount;
|
|
383
|
-
changed = true;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
if (
|
|
387
|
-
updatedRaw.creationDate &&
|
|
388
|
-
updatedRaw.creationDate !== account.creationDate.toISOString()
|
|
389
|
-
) {
|
|
390
|
-
next.creationDate = new Date(updatedRaw.creationDate);
|
|
391
|
-
changed = true;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
if (account.operations !== operations) {
|
|
395
|
-
next.operations = operations;
|
|
396
|
-
changed = true;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
if (account.pendingOperations !== pendingOperations) {
|
|
400
|
-
next.pendingOperations = pendingOperations;
|
|
401
|
-
changed = true;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
if (updatedRaw.balance !== account.balance.toString()) {
|
|
405
|
-
next.balance = new BigNumber(updatedRaw.balance);
|
|
406
|
-
changed = true;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
if (
|
|
410
|
-
next.type === "TokenAccount" &&
|
|
411
|
-
account.type === "TokenAccount" &&
|
|
412
|
-
updatedRaw.type === "TokenAccountRaw"
|
|
413
|
-
) {
|
|
414
|
-
if (updatedRaw.spendableBalance !== account.spendableBalance.toString()) {
|
|
415
|
-
next.spendableBalance = new BigNumber(
|
|
416
|
-
updatedRaw.spendableBalance || updatedRaw.balance
|
|
417
|
-
);
|
|
418
|
-
changed = true;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
if (updatedRaw.compoundBalance !== account.compoundBalance?.toString()) {
|
|
422
|
-
next.compoundBalance = updatedRaw.compoundBalance
|
|
423
|
-
? new BigNumber(updatedRaw.compoundBalance)
|
|
424
|
-
: undefined;
|
|
425
|
-
changed = true;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
if (
|
|
429
|
-
updatedRaw.approvals &&
|
|
430
|
-
!isEqual(updatedRaw.approvals, account.approvals)
|
|
431
|
-
) {
|
|
432
|
-
next.approvals = updatedRaw.approvals;
|
|
433
|
-
changed = true;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
const { balanceHistoryCache } = updatedRaw;
|
|
438
|
-
|
|
439
|
-
if (balanceHistoryCache) {
|
|
440
|
-
if (shouldRefreshBalanceHistoryCache(balanceHistoryCache, account)) {
|
|
441
|
-
next.balanceHistoryCache = balanceHistoryCache;
|
|
442
|
-
changed = true;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
if (!changed) return account; // nothing changed at all
|
|
447
|
-
|
|
448
|
-
return next;
|
|
449
|
-
}
|
|
450
|
-
export function patchOperations(
|
|
451
|
-
operations: Operation[],
|
|
452
|
-
updated: OperationRaw[],
|
|
453
|
-
accountId: string,
|
|
454
|
-
subAccounts: SubAccount[] | null | undefined
|
|
455
|
-
): Operation[] {
|
|
456
|
-
return minimalOperationsBuilderSync(
|
|
457
|
-
operations,
|
|
458
|
-
updated.slice(0).reverse(),
|
|
459
|
-
(raw) => fromOperationRaw(raw, accountId, subAccounts)
|
|
460
|
-
);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
function findExistingOp(ops, op) {
|
|
464
|
-
return ops.find((o) => o.id === op.id);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
type StepBuilderState = {
|
|
468
|
-
operations: Operation[];
|
|
469
|
-
existingOps: Operation[];
|
|
470
|
-
immutableOpCmpDoneOnce: boolean;
|
|
471
|
-
finished: boolean;
|
|
472
|
-
};
|
|
473
|
-
|
|
474
|
-
// This is one step of the logic of minimalOperationsBuilder
|
|
475
|
-
// it implements an heuristic to skip prematurely the operations loop
|
|
476
|
-
// as soon as we find an existing operation that matches newOp
|
|
477
|
-
function stepBuilder(state, newOp, i) {
|
|
478
|
-
const existingOp = findExistingOp(state.existingOps, newOp);
|
|
479
|
-
|
|
480
|
-
if (existingOp && !state.immutableOpCmpDoneOnce) {
|
|
481
|
-
// an Operation is supposedly immutable.
|
|
482
|
-
if (existingOp.blockHeight !== newOp.blockHeight) {
|
|
483
|
-
// except for blockHeight that can temporarily be null
|
|
484
|
-
state.operations.push(newOp);
|
|
485
|
-
return;
|
|
486
|
-
} else {
|
|
487
|
-
state.immutableOpCmpDoneOnce = true;
|
|
488
|
-
|
|
489
|
-
// we still check the first existing op we meet...
|
|
490
|
-
if (!sameOp(existingOp, newOp)) {
|
|
491
|
-
// this implement a failsafe in case an op changes (when we fix bugs)
|
|
492
|
-
// trade-off: in such case, we assume all existingOps are to trash
|
|
493
|
-
consoleWarnExpectToEqual(
|
|
494
|
-
newOp,
|
|
495
|
-
existingOp,
|
|
496
|
-
"op mismatch. doing a full clear cache."
|
|
497
|
-
);
|
|
498
|
-
state.existingOps = [];
|
|
499
|
-
state.operations.push(newOp);
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
if (existingOp) {
|
|
506
|
-
// as soon as we've found a first matching op in old op list,
|
|
507
|
-
const j = state.existingOps.indexOf(existingOp);
|
|
508
|
-
const rest = state.existingOps.slice(j);
|
|
509
|
-
|
|
510
|
-
if (rest.length > i + 1) {
|
|
511
|
-
// if coin implementation happen to have less ops that what we had,
|
|
512
|
-
// we actually need to continue because we don't know where hole will be,
|
|
513
|
-
// but we can keep existingOp
|
|
514
|
-
state.operations.push(existingOp);
|
|
515
|
-
} else {
|
|
516
|
-
// otherwise we stop the coin implementation iteration and continue with previous data
|
|
517
|
-
// and we're done on the iteration
|
|
518
|
-
if (state.operations.length === 0 && j === 0) {
|
|
519
|
-
// special case: we preserve the operations array as much as possible
|
|
520
|
-
state.operations = state.existingOps;
|
|
521
|
-
} else {
|
|
522
|
-
state.operations = state.operations.concat(rest);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
state.finished = true;
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
|
-
} else {
|
|
529
|
-
// otherwise it's a new op
|
|
530
|
-
state.operations.push(newOp);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
export function areSameResources(a: any, b: any) {
|
|
535
|
-
return isEqual(a, b);
|
|
536
|
-
}
|