@ledgerhq/live-common 21.29.0 → 21.32.0-hotfix.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/families/bitcoin/wallet-btc/wallet.integration.test.js +1 -0
- package/lib/__tests__/families/bitcoin/wallet-btc/wallet.integration.test.js.map +1 -1
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.d.ts +2 -0
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.d.ts.map +1 -0
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.js +126 -0
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.js.map +1 -0
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.js +0 -10
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.js.map +1 -1
- package/lib/__tests__/test-helpers/bridge.js +1 -1
- package/lib/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib/__tests__/test-helpers/setup.js +1 -0
- package/lib/__tests__/test-helpers/setup.js.map +1 -1
- package/lib/account/support.d.ts.map +1 -1
- package/lib/account/support.js.map +1 -1
- package/lib/api/Ethereum.d.ts.map +1 -1
- package/lib/api/Ethereum.js +1 -0
- package/lib/api/Ethereum.js.map +1 -1
- package/lib/apps/hw.d.ts.map +1 -1
- package/lib/apps/hw.js +8 -3
- package/lib/apps/hw.js.map +1 -1
- package/lib/apps/logic.d.ts.map +1 -1
- package/lib/apps/logic.js +7 -5
- package/lib/apps/logic.js.map +1 -1
- package/lib/apps/polyfill.d.ts.map +1 -1
- package/lib/apps/polyfill.js +1 -0
- package/lib/apps/polyfill.js.map +1 -1
- package/lib/bot/engine.d.ts.map +1 -1
- package/lib/bot/engine.js +4 -1
- package/lib/bot/engine.js.map +1 -1
- package/lib/bridge/jsHelpers.js +1 -1
- package/lib/data/icons/react/celo.d.ts +8 -0
- package/lib/data/icons/react/celo.d.ts.map +1 -0
- package/lib/data/icons/react/celo.js +32 -0
- package/lib/data/icons/react/celo.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 +11 -8
- package/lib/data/icons/react/index.js.map +1 -1
- package/lib/data/icons/reactNative/celo.d.ts +8 -0
- package/lib/data/icons/reactNative/celo.d.ts.map +1 -0
- package/lib/data/icons/reactNative/celo.js +33 -0
- package/lib/data/icons/reactNative/celo.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 +11 -8
- package/lib/data/icons/reactNative/index.js.map +1 -1
- package/lib/env.d.ts +25 -5
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +20 -0
- package/lib/env.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/errors.d.ts +3 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +3 -2
- package/lib/errors.js.map +1 -1
- package/lib/exchange/platform/transfer/index.d.ts.map +1 -1
- package/lib/exchange/platform/transfer/index.js +15 -1
- package/lib/exchange/platform/transfer/index.js.map +1 -1
- package/lib/families/algorand/buildTransaction.d.ts +2 -2
- package/lib/families/algorand/buildTransaction.d.ts.map +1 -1
- package/lib/families/algorand/buildTransaction.js +13 -19
- package/lib/families/algorand/buildTransaction.js.map +1 -1
- package/lib/families/algorand/js-getFeesForTransaction.js +4 -6
- package/lib/families/algorand/js-getFeesForTransaction.js.map +1 -1
- package/lib/families/algorand/js-signOperation.js +3 -7
- package/lib/families/algorand/js-signOperation.js.map +1 -1
- package/lib/families/algorand/js-synchronization.d.ts.map +1 -1
- package/lib/families/algorand/js-synchronization.js +1 -0
- package/lib/families/algorand/js-synchronization.js.map +1 -1
- package/lib/families/bitcoin/js-signOperation.d.ts.map +1 -1
- package/lib/families/bitcoin/js-signOperation.js +3 -5
- package/lib/families/bitcoin/js-signOperation.js.map +1 -1
- package/lib/families/bitcoin/js-synchronisation.js +4 -4
- package/lib/families/bitcoin/js-synchronisation.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts +4 -3
- package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/base.js +8 -7
- package/lib/families/bitcoin/wallet-btc/crypto/base.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bip32.js +2 -2
- package/lib/families/bitcoin/wallet-btc/crypto/bip32.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.d.ts +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js +3 -7
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.d.ts +3 -4
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js +27 -53
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/decred.d.ts +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/decred.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/decred.js +2 -7
- package/lib/families/bitcoin/wallet-btc/crypto/decred.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/litecoin.d.ts +1 -6
- package/lib/families/bitcoin/wallet-btc/crypto/litecoin.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js +0 -51
- package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/types.d.ts +1 -0
- package/lib/families/bitcoin/wallet-btc/crypto/types.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts +5 -6
- package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zec.js +63 -33
- package/lib/families/bitcoin/wallet-btc/crypto/zec.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts +3 -5
- package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zen.js +77 -46
- package/lib/families/bitcoin/wallet-btc/crypto/zen.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/explorer/index.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/explorer/index.js +20 -0
- package/lib/families/bitcoin/wallet-btc/explorer/index.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/types.d.ts +0 -1
- package/lib/families/bitcoin/wallet-btc/storage/types.d.ts.map +1 -1
- package/lib/families/celo/api/hubble.d.ts +8 -0
- package/lib/families/celo/api/hubble.d.ts.map +1 -0
- package/lib/families/celo/api/hubble.js +144 -0
- package/lib/families/celo/api/hubble.js.map +1 -0
- package/lib/families/celo/api/index.d.ts +2 -0
- package/lib/families/celo/api/index.d.ts.map +1 -0
- package/lib/families/celo/api/index.js +13 -0
- package/lib/families/celo/api/index.js.map +1 -0
- package/lib/families/celo/api/sdk.d.ts +3 -0
- package/lib/families/celo/api/sdk.d.ts.map +1 -0
- package/lib/families/celo/api/sdk.js +13 -0
- package/lib/families/celo/api/sdk.js.map +1 -0
- package/lib/families/celo/bridge/js.d.ts +8 -0
- package/lib/families/celo/bridge/js.d.ts.map +1 -0
- package/lib/families/celo/bridge/js.js +87 -0
- package/lib/families/celo/bridge/js.js.map +1 -0
- package/lib/families/celo/cli-transaction.d.ts +14 -0
- package/lib/families/celo/cli-transaction.d.ts.map +1 -0
- package/lib/families/celo/cli-transaction.js +37 -0
- package/lib/families/celo/cli-transaction.js.map +1 -0
- package/lib/families/celo/datasets/celo.scanAccounts.1.d.ts +5 -0
- package/lib/families/celo/datasets/celo.scanAccounts.1.d.ts.map +1 -0
- package/lib/families/celo/datasets/celo.scanAccounts.1.js +12 -0
- package/lib/families/celo/datasets/celo.scanAccounts.1.js.map +1 -0
- package/lib/families/celo/deviceTransactionConfig.d.ts +4 -0
- package/lib/families/celo/deviceTransactionConfig.d.ts.map +1 -0
- package/lib/families/celo/deviceTransactionConfig.js +16 -0
- package/lib/families/celo/deviceTransactionConfig.js.map +1 -0
- package/lib/families/celo/hw-app-celo.d.ts +19 -0
- package/lib/families/celo/hw-app-celo.d.ts.map +1 -0
- package/lib/families/celo/hw-app-celo.js +147 -0
- package/lib/families/celo/hw-app-celo.js.map +1 -0
- package/lib/families/celo/hw-getAddress.d.ts +2 -0
- package/lib/families/celo/hw-getAddress.d.ts.map +1 -0
- package/lib/families/celo/hw-getAddress.js +13 -0
- package/lib/families/celo/hw-getAddress.js.map +1 -0
- package/lib/families/celo/js-broadcast.d.ts +8 -0
- package/lib/families/celo/js-broadcast.d.ts.map +1 -0
- package/lib/families/celo/js-broadcast.js +58 -0
- package/lib/families/celo/js-broadcast.js.map +1 -0
- package/lib/families/celo/js-buildTransaction.d.ts +6 -0
- package/lib/families/celo/js-buildTransaction.d.ts.map +1 -0
- package/lib/families/celo/js-buildTransaction.js +89 -0
- package/lib/families/celo/js-buildTransaction.js.map +1 -0
- package/lib/families/celo/js-createTransaction.d.ts +4 -0
- package/lib/families/celo/js-createTransaction.d.ts.map +1 -0
- package/lib/families/celo/js-createTransaction.js +12 -0
- package/lib/families/celo/js-createTransaction.js.map +1 -0
- package/lib/families/celo/js-estimateMaxSpendable.d.ts +10 -0
- package/lib/families/celo/js-estimateMaxSpendable.d.ts.map +1 -0
- package/lib/families/celo/js-estimateMaxSpendable.js +77 -0
- package/lib/families/celo/js-estimateMaxSpendable.js.map +1 -0
- package/lib/families/celo/js-getFeesForTransaction.d.ts +8 -0
- package/lib/families/celo/js-getFeesForTransaction.d.ts.map +1 -0
- package/lib/families/celo/js-getFeesForTransaction.js +76 -0
- package/lib/families/celo/js-getFeesForTransaction.js.map +1 -0
- package/lib/families/celo/js-getTransactionStatus.d.ts +5 -0
- package/lib/families/celo/js-getTransactionStatus.d.ts.map +1 -0
- package/lib/families/celo/js-getTransactionStatus.js +86 -0
- package/lib/families/celo/js-getTransactionStatus.js.map +1 -0
- package/lib/families/celo/js-prepareTransaction.d.ts +5 -0
- package/lib/families/celo/js-prepareTransaction.d.ts.map +1 -0
- package/lib/families/celo/js-prepareTransaction.js +76 -0
- package/lib/families/celo/js-prepareTransaction.js.map +1 -0
- package/lib/families/celo/js-signOperation.d.ts +13 -0
- package/lib/families/celo/js-signOperation.d.ts.map +1 -0
- package/lib/families/celo/js-signOperation.js +150 -0
- package/lib/families/celo/js-signOperation.js.map +1 -0
- package/lib/families/celo/js-synchronisation.d.ts +10 -0
- package/lib/families/celo/js-synchronisation.d.ts.map +1 -0
- package/lib/families/celo/js-synchronisation.js +88 -0
- package/lib/families/celo/js-synchronisation.js.map +1 -0
- package/lib/families/celo/specs.d.ts +7 -0
- package/lib/families/celo/specs.d.ts.map +1 -0
- package/lib/families/celo/specs.js +56 -0
- package/lib/families/celo/specs.js.map +1 -0
- package/lib/families/celo/speculos-deviceActions.d.ts +7 -0
- package/lib/families/celo/speculos-deviceActions.d.ts.map +1 -0
- package/lib/families/celo/speculos-deviceActions.js +52 -0
- package/lib/families/celo/speculos-deviceActions.js.map +1 -0
- package/lib/families/celo/transaction.d.ts +11 -0
- package/lib/families/celo/transaction.d.ts.map +1 -0
- package/lib/families/celo/transaction.js +39 -0
- package/lib/families/celo/transaction.js.map +1 -0
- package/lib/families/celo/types.d.ts +16 -0
- package/lib/families/celo/types.d.ts.map +1 -0
- package/lib/families/celo/types.js +6 -0
- package/lib/families/celo/types.js.map +1 -0
- package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.d.ts +1 -0
- package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.d.ts.map +1 -1
- package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.js +1 -0
- package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.js.map +1 -1
- package/lib/families/ethereum/modules/erc1155.d.ts.map +1 -1
- package/lib/families/ethereum/modules/erc1155.js +8 -2
- package/lib/families/ethereum/modules/erc1155.js.map +1 -1
- package/lib/families/ethereum/signOperation.d.ts.map +1 -1
- package/lib/families/ethereum/signOperation.js +26 -15
- package/lib/families/ethereum/signOperation.js.map +1 -1
- package/lib/families/ethereum/specs.d.ts.map +1 -1
- package/lib/families/ethereum/specs.js +2 -4
- package/lib/families/ethereum/specs.js.map +1 -1
- package/lib/families/ethereum/transaction.d.ts +4 -1
- package/lib/families/ethereum/transaction.d.ts.map +1 -1
- package/lib/families/ethereum/transaction.js +15 -27
- package/lib/families/ethereum/transaction.js.map +1 -1
- package/lib/families/polkadot/cache.d.ts +1 -1
- package/lib/families/polkadot/cache.js +1 -1
- package/lib/families/solana/api/chain/index.d.ts +2 -2
- package/lib/families/solana/api/chain/index.d.ts.map +1 -1
- package/lib/families/solana/api/chain/index.js +1 -3
- package/lib/families/solana/api/chain/index.js.map +1 -1
- package/lib/families/solana/api/chain/instruction/token/types.d.ts +1 -1
- package/lib/families/solana/bridge/bridge.js +5 -5
- package/lib/families/solana/bridge/bridge.js.map +1 -1
- package/lib/families/solana/bridge/js.js +3 -3
- package/lib/families/solana/bridge/js.js.map +1 -1
- package/lib/families/solana/bridge/mock.js +1 -1
- package/lib/families/solana/bridge/mock.js.map +1 -1
- package/lib/families/solana/specs.js +1 -1
- package/lib/families/solana/specs.js.map +1 -1
- package/lib/families/solana/test-dataset.d.ts.map +1 -1
- package/lib/families/solana/test-dataset.js +210 -209
- package/lib/families/solana/test-dataset.js.map +1 -1
- package/lib/families/solana/utils.d.ts +1 -2
- package/lib/families/solana/utils.d.ts.map +1 -1
- package/lib/families/solana/utils.js +11 -9
- package/lib/families/solana/utils.js.map +1 -1
- package/lib/families/tezos/bakers.whitelist-default.d.ts.map +1 -1
- package/lib/families/tezos/bakers.whitelist-default.js +1 -1
- package/lib/families/tezos/bakers.whitelist-default.js.map +1 -1
- package/lib/families/tezos/bridge/js.d.ts.map +1 -1
- package/lib/families/tezos/bridge/js.js +2 -1
- package/lib/families/tezos/bridge/js.js.map +1 -1
- package/lib/families/tezos/synchronisation.d.ts.map +1 -1
- package/lib/families/tezos/synchronisation.js +2 -0
- package/lib/families/tezos/synchronisation.js.map +1 -1
- package/lib/families/tezos/test-specifics.d.ts.map +1 -1
- package/lib/families/tezos/test-specifics.js +1 -0
- package/lib/families/tezos/test-specifics.js.map +1 -1
- package/lib/families/tron/synchronisation.test.js +1 -0
- package/lib/families/tron/synchronisation.test.js.map +1 -1
- package/lib/featureFlags/FeatureToggle.d.ts +10 -0
- package/lib/featureFlags/FeatureToggle.d.ts.map +1 -0
- package/lib/featureFlags/FeatureToggle.js +17 -0
- package/lib/featureFlags/FeatureToggle.js.map +1 -0
- package/lib/featureFlags/defaultFeatures.d.ts +3 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -0
- package/lib/featureFlags/defaultFeatures.js +9 -0
- package/lib/featureFlags/defaultFeatures.js.map +1 -0
- package/lib/featureFlags/index.d.ts +5 -0
- package/lib/featureFlags/index.d.ts.map +1 -0
- package/lib/featureFlags/index.js +17 -0
- package/lib/featureFlags/index.js.map +1 -0
- package/lib/featureFlags/provider.d.ts +13 -0
- package/lib/featureFlags/provider.d.ts.map +1 -0
- package/lib/featureFlags/provider.js +68 -0
- package/lib/featureFlags/provider.js.map +1 -0
- package/lib/featureFlags/types.d.ts +8 -0
- package/lib/featureFlags/types.d.ts.map +1 -0
- package/lib/featureFlags/types.js +3 -0
- package/lib/featureFlags/types.js.map +1 -0
- package/lib/featureFlags/useFeature.d.ts +3 -0
- package/lib/featureFlags/useFeature.d.ts.map +1 -0
- package/lib/featureFlags/useFeature.js +9 -0
- package/lib/featureFlags/useFeature.js.map +1 -0
- package/lib/generated/bridge/js.d.ts +4 -0
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +24 -22
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/generated/cli-transaction.d.ts +9 -0
- package/lib/generated/cli-transaction.d.ts.map +1 -1
- package/lib/generated/cli-transaction.js +24 -22
- package/lib/generated/cli-transaction.js.map +1 -1
- package/lib/generated/deviceTransactionConfig.d.ts +2 -0
- package/lib/generated/deviceTransactionConfig.d.ts.map +1 -1
- package/lib/generated/deviceTransactionConfig.js +22 -20
- package/lib/generated/deviceTransactionConfig.js.map +1 -1
- package/lib/generated/hw-getAddress.d.ts +1 -0
- package/lib/generated/hw-getAddress.d.ts.map +1 -1
- package/lib/generated/hw-getAddress.js +26 -24
- package/lib/generated/hw-getAddress.js.map +1 -1
- package/lib/generated/specs.d.ts +3 -0
- package/lib/generated/specs.d.ts.map +1 -1
- package/lib/generated/specs.js +24 -22
- package/lib/generated/specs.js.map +1 -1
- package/lib/generated/speculos-deviceActions.d.ts +3 -0
- package/lib/generated/speculos-deviceActions.d.ts.map +1 -1
- package/lib/generated/speculos-deviceActions.js +24 -22
- package/lib/generated/speculos-deviceActions.js.map +1 -1
- package/lib/generated/transaction.d.ts +5 -0
- package/lib/generated/transaction.d.ts.map +1 -1
- package/lib/generated/transaction.js +26 -24
- package/lib/generated/transaction.js.map +1 -1
- package/lib/generated/types.d.ts +12 -6
- package/lib/generated/types.d.ts.map +1 -1
- package/lib/generated/types.js +14 -12
- package/lib/generated/types.js.map +1 -1
- package/lib/load/speculos.d.ts +7 -0
- package/lib/load/speculos.d.ts.map +1 -1
- package/lib/load/speculos.js +27 -11
- package/lib/load/speculos.js.map +1 -1
- package/lib/platform/PlatformAppProvider/helpers.d.ts +1 -0
- package/lib/platform/PlatformAppProvider/helpers.d.ts.map +1 -1
- package/lib/platform/PlatformAppProvider/helpers.js +23 -1
- package/lib/platform/PlatformAppProvider/helpers.js.map +1 -1
- package/lib/platform/PlatformAppProvider/index.d.ts.map +1 -1
- package/lib/platform/PlatformAppProvider/index.js +2 -1
- package/lib/platform/PlatformAppProvider/index.js.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +1 -0
- package/lib/types/index.js.map +1 -1
- package/lib/types/manager.d.ts +7 -0
- package/lib/types/manager.d.ts.map +1 -1
- package/lib/types/manager.js +7 -0
- package/lib/types/manager.js.map +1 -1
- package/package.json +24 -21
- package/src/.DS_Store +0 -0
- package/src/__tests__/.DS_Store +0 -0
- package/src/__tests__/__snapshots__/all.libcore.ts.snap +457 -33597
- package/src/__tests__/families/bitcoin/wallet-btc/wallet.integration.test.ts +2 -0
- package/src/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.ts +78 -0
- package/src/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.ts +0 -11
- package/src/__tests__/test-helpers/bridge.ts +1 -1
- package/src/__tests__/test-helpers/setup.ts +1 -0
- package/src/account/support.ts +1 -0
- package/src/api/Ethereum.ts +1 -0
- package/src/apps/hw.ts +7 -0
- package/src/apps/logic.ts +6 -3
- package/src/apps/polyfill.ts +1 -0
- package/src/bot/engine.ts +4 -1
- package/src/bridge/jsHelpers.ts +1 -1
- package/src/data/icons/react/celo.tsx +12 -0
- package/src/data/icons/react/index.tsx +1 -0
- package/src/data/icons/reactNative/celo.tsx +13 -0
- package/src/data/icons/reactNative/index.tsx +1 -0
- package/src/data/icons/svg/CELO.svg +5 -0
- package/src/env.ts +20 -0
- package/src/errors.ts +3 -0
- package/src/exchange/platform/transfer/index.ts +21 -1
- package/src/families/algorand/buildTransaction.ts +4 -8
- package/src/families/algorand/js-getFeesForTransaction.ts +1 -1
- package/src/families/algorand/js-signOperation.ts +2 -2
- package/src/families/algorand/js-synchronization.ts +1 -0
- package/src/families/bitcoin/js-signOperation.ts +3 -5
- package/src/families/bitcoin/js-synchronisation.ts +4 -4
- package/src/families/bitcoin/wallet-btc/crypto/base.ts +31 -18
- package/src/families/bitcoin/wallet-btc/crypto/bip32.ts +2 -2
- package/src/families/bitcoin/wallet-btc/crypto/bitcoin.ts +3 -17
- package/src/families/bitcoin/wallet-btc/crypto/bitcoincash.ts +5 -39
- package/src/families/bitcoin/wallet-btc/crypto/decred.ts +2 -15
- package/src/families/bitcoin/wallet-btc/crypto/litecoin.ts +1 -71
- package/src/families/bitcoin/wallet-btc/crypto/types.ts +7 -0
- package/src/families/bitcoin/wallet-btc/crypto/zec.ts +23 -41
- package/src/families/bitcoin/wallet-btc/crypto/zen.ts +30 -49
- package/src/families/bitcoin/wallet-btc/explorer/index.ts +20 -0
- package/src/families/bitcoin/wallet-btc/storage/types.ts +0 -1
- package/src/families/celo/api/hubble.ts +93 -0
- package/src/families/celo/api/index.ts +1 -0
- package/src/families/celo/api/sdk.ts +8 -0
- package/src/families/celo/bridge/js.ts +38 -0
- package/src/families/celo/cli-transaction.ts +41 -0
- package/src/families/celo/datasets/celo.scanAccounts.1.ts +20 -0
- package/src/families/celo/deviceTransactionConfig.ts +19 -0
- package/src/families/celo/hw-app-celo.ts +108 -0
- package/src/families/celo/hw-getAddress.ts +1 -0
- package/src/families/celo/js-broadcast.ts +12 -0
- package/src/families/celo/js-buildTransaction.ts +32 -0
- package/src/families/celo/js-createTransaction.ts +12 -0
- package/src/families/celo/js-estimateMaxSpendable.ts +28 -0
- package/src/families/celo/js-getFeesForTransaction.ts +38 -0
- package/src/families/celo/js-getTransactionStatus.ts +67 -0
- package/src/families/celo/js-prepareTransaction.ts +28 -0
- package/src/families/celo/js-signOperation.ts +149 -0
- package/src/families/celo/js-synchronisation.ts +40 -0
- package/src/families/celo/specs.ts +53 -0
- package/src/families/celo/speculos-deviceActions.ts +50 -0
- package/src/families/celo/transaction.ts +39 -0
- package/src/families/celo/types.ts +20 -0
- package/src/families/ethereum/datasets/ethereum.scanAccounts.1.ts +1 -0
- package/src/families/ethereum/modules/erc1155.ts +9 -0
- package/src/families/ethereum/signOperation.ts +21 -20
- package/src/families/ethereum/specs.ts +0 -2
- package/src/families/ethereum/transaction.ts +10 -24
- package/src/families/polkadot/cache.ts +1 -1
- package/src/families/solana/api/chain/index.ts +2 -5
- package/src/families/solana/bridge/bridge.ts +11 -11
- package/src/families/solana/bridge/js.ts +3 -3
- package/src/families/solana/bridge/mock.ts +1 -1
- package/src/families/solana/specs.ts +1 -1
- package/src/families/solana/test-dataset.ts +340 -338
- package/src/families/solana/utils.ts +9 -8
- package/src/families/tezos/bakers.whitelist-default.ts +0 -2
- package/src/families/tezos/bridge/js.ts +6 -1
- package/src/families/tezos/synchronisation.ts +2 -0
- package/src/families/tezos/test-specifics.ts +1 -0
- package/src/families/tron/synchronisation.test.ts +2 -0
- package/src/featureFlags/FeatureToggle.tsx +24 -0
- package/src/featureFlags/defaultFeatures.ts +7 -0
- package/src/featureFlags/index.ts +4 -0
- package/src/featureFlags/provider.tsx +48 -0
- package/src/featureFlags/types.ts +9 -0
- package/src/featureFlags/useFeature.ts +8 -0
- package/src/generated/bridge/js.ts +3 -0
- package/src/generated/cli-transaction.ts +3 -0
- package/src/generated/deviceTransactionConfig.ts +3 -0
- package/src/generated/hw-getAddress.ts +3 -0
- package/src/generated/specs.ts +3 -0
- package/src/generated/speculos-deviceActions.ts +3 -0
- package/src/generated/transaction.ts +3 -0
- package/src/generated/types.ts +14 -0
- package/src/load/speculos.ts +23 -10
- package/src/platform/PlatformAppProvider/helpers.ts +29 -0
- package/src/platform/PlatformAppProvider/index.tsx +3 -2
- package/src/types/index.ts +1 -0
- package/src/types/manager.ts +7 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import { FeeNotLoaded } from "@ledgerhq/errors";
|
|
4
|
+
import type { Transaction } from "./types";
|
|
5
|
+
import type { Account, Operation, SignOperationEvent } from "../../types";
|
|
6
|
+
import { encodeOperationId } from "../../operation";
|
|
7
|
+
import { CeloApp } from "./hw-app-celo";
|
|
8
|
+
import buildTransaction from "./js-buildTransaction";
|
|
9
|
+
import { rlpEncodedTx, encodeTransaction } from "@celo/wallet-base";
|
|
10
|
+
import { tokenInfoByAddressAndChainId } from "@celo/wallet-ledger/lib/tokens";
|
|
11
|
+
import { withDevice } from "../../hw/deviceAccess";
|
|
12
|
+
|
|
13
|
+
const buildOptimisticOperation = (
|
|
14
|
+
account: Account,
|
|
15
|
+
transaction: Transaction,
|
|
16
|
+
fee: BigNumber
|
|
17
|
+
): Operation => {
|
|
18
|
+
const type = "OUT";
|
|
19
|
+
|
|
20
|
+
const value = new BigNumber(transaction.amount).plus(fee);
|
|
21
|
+
|
|
22
|
+
const operation: Operation = {
|
|
23
|
+
id: encodeOperationId(account.id, "", type),
|
|
24
|
+
hash: "",
|
|
25
|
+
type,
|
|
26
|
+
value,
|
|
27
|
+
fee,
|
|
28
|
+
blockHash: null,
|
|
29
|
+
blockHeight: null,
|
|
30
|
+
senders: [account.freshAddress],
|
|
31
|
+
recipients: [transaction.recipient].filter(Boolean),
|
|
32
|
+
accountId: account.id,
|
|
33
|
+
date: new Date(),
|
|
34
|
+
extra: { additionalField: transaction.amount },
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return operation;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const trimLeading0x = (input: string) =>
|
|
41
|
+
input.startsWith("0x") ? input.slice(2) : input;
|
|
42
|
+
|
|
43
|
+
const parseSigningResponse = (
|
|
44
|
+
response: {
|
|
45
|
+
s: string;
|
|
46
|
+
v: string;
|
|
47
|
+
r: string;
|
|
48
|
+
},
|
|
49
|
+
chainId: number
|
|
50
|
+
): {
|
|
51
|
+
s: Buffer;
|
|
52
|
+
v: number;
|
|
53
|
+
r: Buffer;
|
|
54
|
+
} => {
|
|
55
|
+
// EIP155
|
|
56
|
+
const sigV = parseInt(response.v, 16);
|
|
57
|
+
let eip155V = chainId * 2 + 35;
|
|
58
|
+
if (sigV !== eip155V && (sigV & eip155V) !== sigV) {
|
|
59
|
+
eip155V += 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
s: Buffer.from(response.s, "hex"),
|
|
64
|
+
v: eip155V,
|
|
65
|
+
r: Buffer.from(response.r, "hex"),
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Sign Transaction with Ledger hardware
|
|
71
|
+
*/
|
|
72
|
+
const signOperation = ({
|
|
73
|
+
account,
|
|
74
|
+
deviceId,
|
|
75
|
+
transaction,
|
|
76
|
+
}: {
|
|
77
|
+
account: Account;
|
|
78
|
+
deviceId: any;
|
|
79
|
+
transaction: Transaction;
|
|
80
|
+
}): Observable<SignOperationEvent> =>
|
|
81
|
+
withDevice(deviceId)(
|
|
82
|
+
(transport) =>
|
|
83
|
+
new Observable((o) => {
|
|
84
|
+
let cancelled;
|
|
85
|
+
|
|
86
|
+
async function main() {
|
|
87
|
+
if (!transaction.fees) {
|
|
88
|
+
throw new FeeNotLoaded();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const celo = new CeloApp(transport);
|
|
92
|
+
const unsignedTransaction = await buildTransaction(
|
|
93
|
+
account,
|
|
94
|
+
transaction
|
|
95
|
+
);
|
|
96
|
+
const { chainId, to } = unsignedTransaction;
|
|
97
|
+
const rlpEncodedTransaction = rlpEncodedTx(unsignedTransaction);
|
|
98
|
+
|
|
99
|
+
const tokenInfo = tokenInfoByAddressAndChainId(to!, chainId!);
|
|
100
|
+
if (tokenInfo) {
|
|
101
|
+
await celo.provideERC20TokenInformation(tokenInfo);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
o.next({ type: "device-signature-requested" });
|
|
105
|
+
|
|
106
|
+
const response = await celo.signTransaction(
|
|
107
|
+
account.freshAddressPath,
|
|
108
|
+
trimLeading0x(rlpEncodedTransaction.rlpEncode)
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
if (cancelled) return;
|
|
112
|
+
|
|
113
|
+
const signature = parseSigningResponse(response, chainId!);
|
|
114
|
+
|
|
115
|
+
o.next({ type: "device-signature-granted" });
|
|
116
|
+
|
|
117
|
+
const encodedTransaction = await encodeTransaction(
|
|
118
|
+
rlpEncodedTransaction,
|
|
119
|
+
signature
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const operation = buildOptimisticOperation(
|
|
123
|
+
account,
|
|
124
|
+
transaction,
|
|
125
|
+
transaction.fees ?? new BigNumber(0)
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
o.next({
|
|
129
|
+
type: "signed",
|
|
130
|
+
signedOperation: {
|
|
131
|
+
operation,
|
|
132
|
+
signature: encodedTransaction.raw,
|
|
133
|
+
expirationDate: null,
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
main().then(
|
|
139
|
+
() => o.complete(),
|
|
140
|
+
(e) => o.error(e)
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
return () => {
|
|
144
|
+
cancelled = true;
|
|
145
|
+
};
|
|
146
|
+
})
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
export default signOperation;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Account } from "../../types";
|
|
2
|
+
import { encodeAccountId } from "../../account";
|
|
3
|
+
import type { GetAccountShape } from "../../bridge/jsHelpers";
|
|
4
|
+
import { makeSync, makeScanAccounts, mergeOps } from "../../bridge/jsHelpers";
|
|
5
|
+
import { getAccountDetails } from "./api";
|
|
6
|
+
|
|
7
|
+
const getAccountShape: GetAccountShape = async (info) => {
|
|
8
|
+
const { address, currency, initialAccount, derivationMode } = info;
|
|
9
|
+
const oldOperations = initialAccount?.operations || [];
|
|
10
|
+
|
|
11
|
+
const accountId = encodeAccountId({
|
|
12
|
+
type: "js",
|
|
13
|
+
version: "2",
|
|
14
|
+
currencyId: currency.id,
|
|
15
|
+
xpubOrAddress: address,
|
|
16
|
+
derivationMode,
|
|
17
|
+
});
|
|
18
|
+
const {
|
|
19
|
+
blockHeight,
|
|
20
|
+
balance,
|
|
21
|
+
spendableBalance,
|
|
22
|
+
operations: newOperations,
|
|
23
|
+
} = await getAccountDetails(address, accountId);
|
|
24
|
+
const operations = mergeOps(oldOperations, newOperations);
|
|
25
|
+
const shape = {
|
|
26
|
+
id: accountId,
|
|
27
|
+
balance,
|
|
28
|
+
spendableBalance,
|
|
29
|
+
operationsCount: operations.length,
|
|
30
|
+
blockHeight,
|
|
31
|
+
};
|
|
32
|
+
return { ...shape, operations };
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const postSync = (_initial: Account, parent: Account) => {
|
|
36
|
+
return parent;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const scanAccounts = makeScanAccounts(getAccountShape);
|
|
40
|
+
export const sync = makeSync(getAccountShape, postSync);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import type { Transaction } from "./types";
|
|
3
|
+
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
|
|
4
|
+
import { pickSiblings } from "../../bot/specs";
|
|
5
|
+
import type { AppSpec } from "../../bot/types";
|
|
6
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
7
|
+
|
|
8
|
+
const currency = getCryptoCurrencyById("celo");
|
|
9
|
+
const minimalAmount = parseCurrencyUnit(currency.units[0], "0.001");
|
|
10
|
+
const maxAccount = 3;
|
|
11
|
+
|
|
12
|
+
const celo: AppSpec<Transaction> = {
|
|
13
|
+
name: "Celo",
|
|
14
|
+
currency,
|
|
15
|
+
appQuery: {
|
|
16
|
+
model: DeviceModelId.nanoS,
|
|
17
|
+
appName: "Celo",
|
|
18
|
+
},
|
|
19
|
+
testTimeout: 2 * 60 * 1000,
|
|
20
|
+
mutations: [
|
|
21
|
+
{
|
|
22
|
+
name: "move 50% to another account",
|
|
23
|
+
maxRun: 2,
|
|
24
|
+
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
25
|
+
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
|
|
26
|
+
const sibling = pickSiblings(siblings, maxAccount);
|
|
27
|
+
const recipient = sibling.freshAddress;
|
|
28
|
+
const amount = maxSpendable.div(2).integerValue();
|
|
29
|
+
return {
|
|
30
|
+
transaction: bridge.createTransaction(account),
|
|
31
|
+
updates: [{ recipient }, { amount }],
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "send max to another account",
|
|
37
|
+
maxRun: 1,
|
|
38
|
+
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
39
|
+
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
|
|
40
|
+
const sibling = pickSiblings(siblings, maxAccount);
|
|
41
|
+
const recipient = sibling.freshAddress;
|
|
42
|
+
return {
|
|
43
|
+
transaction: bridge.createTransaction(account),
|
|
44
|
+
updates: [{ recipient }, { useAllAmount: true }],
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
celo,
|
|
53
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { DeviceAction } from "../../bot/types";
|
|
2
|
+
import type { Transaction } from "./types";
|
|
3
|
+
import { deviceActionFlow } from "../../bot/specs";
|
|
4
|
+
import { formatCurrencyUnit } from "../../currencies";
|
|
5
|
+
const acceptTransaction: DeviceAction<Transaction, any> = deviceActionFlow({
|
|
6
|
+
steps: [
|
|
7
|
+
{
|
|
8
|
+
title: "Review",
|
|
9
|
+
button: "Rr",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: "Amount",
|
|
13
|
+
button: "Rr",
|
|
14
|
+
expectedValue: ({ account, status }) => {
|
|
15
|
+
const formattedValue =
|
|
16
|
+
"CELO " +
|
|
17
|
+
formatCurrencyUnit(account.unit, status.amount, {
|
|
18
|
+
disableRounding: true,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
if (!formattedValue.includes(".")) {
|
|
22
|
+
// if the value is pure integer, in the app it will automatically add an .0
|
|
23
|
+
return formattedValue + ".0";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return formattedValue;
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: "Address",
|
|
31
|
+
button: "Rr",
|
|
32
|
+
expectedValue: ({ transaction }) => transaction.recipient,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: "Max Fees",
|
|
36
|
+
button: "Rr",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: "No Gateway Fee",
|
|
40
|
+
button: "Rr",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
title: "Accept",
|
|
44
|
+
button: "LRlr",
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
export default {
|
|
49
|
+
acceptTransaction,
|
|
50
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Transaction, TransactionRaw } from "./types";
|
|
2
|
+
import { BigNumber } from "bignumber.js";
|
|
3
|
+
import {
|
|
4
|
+
fromTransactionCommonRaw,
|
|
5
|
+
toTransactionCommonRaw,
|
|
6
|
+
} from "../../transaction/common";
|
|
7
|
+
import type { Account } from "../../types";
|
|
8
|
+
import { getAccountUnit } from "../../account";
|
|
9
|
+
import { formatCurrencyUnit } from "../../currencies";
|
|
10
|
+
export const formatTransaction = (t: Transaction, account: Account): string => `
|
|
11
|
+
SEND ${formatCurrencyUnit(getAccountUnit(account), t.amount, {
|
|
12
|
+
showCode: true,
|
|
13
|
+
disableRounding: true,
|
|
14
|
+
})}
|
|
15
|
+
TO ${t.recipient}`;
|
|
16
|
+
|
|
17
|
+
const fromTransactionRaw = (tr: TransactionRaw): Transaction => {
|
|
18
|
+
const common = fromTransactionCommonRaw(tr);
|
|
19
|
+
return {
|
|
20
|
+
...common,
|
|
21
|
+
family: tr.family,
|
|
22
|
+
fees: tr.fees ? new BigNumber(tr.fees) : null,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const toTransactionRaw = (t: Transaction): TransactionRaw => {
|
|
27
|
+
const common = toTransactionCommonRaw(t);
|
|
28
|
+
return {
|
|
29
|
+
...common,
|
|
30
|
+
family: t.family,
|
|
31
|
+
fees: t.fees?.toString() || null,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
formatTransaction,
|
|
37
|
+
fromTransactionRaw,
|
|
38
|
+
toTransactionRaw,
|
|
39
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
import type {
|
|
3
|
+
TransactionCommon,
|
|
4
|
+
TransactionCommonRaw,
|
|
5
|
+
} from "../../types/transaction";
|
|
6
|
+
|
|
7
|
+
export type Transaction = TransactionCommon & {
|
|
8
|
+
family: "celo";
|
|
9
|
+
fees: BigNumber | null | undefined;
|
|
10
|
+
};
|
|
11
|
+
export type TransactionRaw = TransactionCommonRaw & {
|
|
12
|
+
family: "celo";
|
|
13
|
+
fees: string | null | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type CoreStatics = Record<string, never>;
|
|
17
|
+
export type CoreAccountSpecifics = Record<string, never>;
|
|
18
|
+
export type CoreOperationSpecifics = Record<string, never>;
|
|
19
|
+
export type CoreCurrencySpecifics = Record<string, never>;
|
|
20
|
+
export const reflect = (_declare: any) => {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
name: "ethereum seed 1",
|
|
3
|
+
unstableAccounts: true, // FIXME LL-9155
|
|
3
4
|
apdus: `
|
|
4
5
|
=> e00200000d038000002c8000003c80000000
|
|
5
6
|
<= 410469877df9567b58e6ef8f6cf1fb8a8e1bf28a327dee31b183a6b9cd1f3da063af0924506a9912793ef31e41df19f8653fa31bb1fecc32d2e41abdddb22ccb621028373561453661383832363036353137343345356546433033373937313136413335363539663638359000
|
|
@@ -14,6 +14,9 @@ import { prepareTransaction } from "./erc721";
|
|
|
14
14
|
const notOwnedNft = createCustomErrorClass("NotOwnedNft");
|
|
15
15
|
const notEnoughNftOwned = createCustomErrorClass("NotEnoughNftOwned");
|
|
16
16
|
const notTokenIdsProvided = createCustomErrorClass("NotTokenIdsProvided");
|
|
17
|
+
const quantityNeedsToBePositive = createCustomErrorClass(
|
|
18
|
+
"QuantityNeedsToBePositive"
|
|
19
|
+
);
|
|
17
20
|
|
|
18
21
|
export type Modes = "erc1155.transfer";
|
|
19
22
|
|
|
@@ -43,6 +46,12 @@ const erc1155Transfer: ModeModule = {
|
|
|
43
46
|
result.errors.amount = new NotEnoughBalanceInParentAccount();
|
|
44
47
|
}
|
|
45
48
|
|
|
49
|
+
t.quantities?.forEach((quantity) => {
|
|
50
|
+
if (quantity.isLessThan(1)) {
|
|
51
|
+
result.errors.amount = new quantityNeedsToBePositive();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
46
55
|
const enoughTokensOwned: true | Error =
|
|
47
56
|
t.tokenIds?.reduce((acc, tokenId, index) => {
|
|
48
57
|
if (acc instanceof Error) {
|
|
@@ -2,6 +2,7 @@ import invariant from "invariant";
|
|
|
2
2
|
import { Observable, from, of } from "rxjs";
|
|
3
3
|
import { mergeMap } from "rxjs/operators";
|
|
4
4
|
import eip55 from "eip55";
|
|
5
|
+
import { encode } from "rlp";
|
|
5
6
|
import { BigNumber } from "bignumber.js";
|
|
6
7
|
import { log } from "@ledgerhq/logs";
|
|
7
8
|
import { FeeNotLoaded } from "@ledgerhq/errors";
|
|
@@ -17,6 +18,7 @@ import { modes } from "./modules";
|
|
|
17
18
|
import { isNFTActive } from "../../nft";
|
|
18
19
|
import { getEnv } from "../../env";
|
|
19
20
|
import { LoadConfig } from "@ledgerhq/hw-app-eth/lib/services/types";
|
|
21
|
+
import { Transaction as EthereumTx } from "@ethereumjs/tx";
|
|
20
22
|
export const signOperation = ({
|
|
21
23
|
account,
|
|
22
24
|
deviceId,
|
|
@@ -54,18 +56,16 @@ export const signOperation = ({
|
|
|
54
56
|
throw new FeeNotLoaded();
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
const { tx, fillTransactionDataResult } =
|
|
58
|
-
account,
|
|
59
|
-
|
|
60
|
-
nonce
|
|
61
|
-
);
|
|
62
|
-
const to = eip55.encode("0x" + tx.to.toString("hex"));
|
|
59
|
+
const { ethTxObject, tx, common, fillTransactionDataResult } =
|
|
60
|
+
buildEthereumTx(account, transaction, nonce);
|
|
61
|
+
const to = eip55.encode((tx.to || "").toString());
|
|
63
62
|
const value = new BigNumber(
|
|
64
63
|
"0x" + (tx.value.toString("hex") || "0")
|
|
65
64
|
);
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
65
|
+
// rawData Format: `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])`
|
|
66
|
+
const rawData = tx.raw();
|
|
67
|
+
rawData[6] = Buffer.from([common.chainIdBN().toNumber()]);
|
|
68
|
+
const txHex = Buffer.from(encode(rawData)).toString("hex");
|
|
69
69
|
const loadConfig: LoadConfig = {};
|
|
70
70
|
if (isNFTActive(account.currency)) {
|
|
71
71
|
loadConfig.nftExplorerBaseURL =
|
|
@@ -106,26 +106,27 @@ export const signOperation = ({
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
o.next({
|
|
110
|
-
type: "device-signature-requested",
|
|
111
|
-
});
|
|
109
|
+
o.next({ type: "device-signature-requested" });
|
|
112
110
|
const result = await eth.signTransaction(
|
|
113
111
|
freshAddressPath,
|
|
114
112
|
txHex,
|
|
115
113
|
resolution
|
|
116
114
|
);
|
|
117
115
|
if (cancelled) return;
|
|
118
|
-
o.next({
|
|
119
|
-
type: "device-signature-granted",
|
|
120
|
-
});
|
|
116
|
+
o.next({ type: "device-signature-granted" });
|
|
121
117
|
// Second, we re-set some tx fields from the device signature
|
|
122
|
-
const v = result.v
|
|
118
|
+
const v = `0x${result.v}`;
|
|
119
|
+
const r = `0x${result.r}`;
|
|
120
|
+
const s = `0x${result.s}`;
|
|
121
|
+
|
|
122
|
+
const signedTx = new EthereumTx(
|
|
123
|
+
{ ...ethTxObject, v, r, s },
|
|
124
|
+
{ common }
|
|
125
|
+
);
|
|
123
126
|
|
|
124
|
-
tx.v = Buffer.from(v, "hex");
|
|
125
|
-
tx.r = Buffer.from(result.r, "hex");
|
|
126
|
-
tx.s = Buffer.from(result.s, "hex");
|
|
127
127
|
// Generate the signature ready to be broadcasted
|
|
128
|
-
const signature = `0x${
|
|
128
|
+
const signature = `0x${signedTx.serialize().toString("hex")}`;
|
|
129
|
+
|
|
129
130
|
// build optimistic operation
|
|
130
131
|
const txHash = ""; // resolved at broadcast time
|
|
131
132
|
|
|
@@ -118,7 +118,6 @@ const ethereum: AppSpec<Transaction> = {
|
|
|
118
118
|
appQuery: {
|
|
119
119
|
model: DeviceModelId.nanoS,
|
|
120
120
|
appName: "Ethereum",
|
|
121
|
-
appVersion: "1.5.0-rc3",
|
|
122
121
|
},
|
|
123
122
|
testTimeout: 4 * 60 * 1000,
|
|
124
123
|
transactionCheck: ({ maxSpendable }) => {
|
|
@@ -380,7 +379,6 @@ const ethereumRopsten: AppSpec<Transaction> = {
|
|
|
380
379
|
appQuery: {
|
|
381
380
|
model: DeviceModelId.nanoS,
|
|
382
381
|
appName: "Ethereum",
|
|
383
|
-
appVersion: "1.5.0-rc3",
|
|
384
382
|
},
|
|
385
383
|
testTimeout: 2 * 60 * 1000,
|
|
386
384
|
transactionCheck: ({ maxSpendable }) => {
|
|
@@ -6,8 +6,8 @@ import type {
|
|
|
6
6
|
TransactionRaw,
|
|
7
7
|
EthereumGasLimitRequest,
|
|
8
8
|
} from "./types";
|
|
9
|
-
import Common from "ethereumjs
|
|
10
|
-
import { Transaction as EthereumTx } from "ethereumjs
|
|
9
|
+
import Common from "@ethereumjs/common";
|
|
10
|
+
import { Transaction as EthereumTx } from "@ethereumjs/tx";
|
|
11
11
|
import eip55 from "eip55";
|
|
12
12
|
import {
|
|
13
13
|
InvalidAddress,
|
|
@@ -196,23 +196,18 @@ function getEthereumjsTxCommon(currency) {
|
|
|
196
196
|
`currency ${currency.id} did not set ethereumLikeInfo`
|
|
197
197
|
);
|
|
198
198
|
if (ethereumLikeInfo.chainId === 1) {
|
|
199
|
-
return new Common(
|
|
200
|
-
|
|
201
|
-
ethereumLikeInfo.
|
|
202
|
-
|
|
203
|
-
ethereumLikeInfo.hardfork || "petersburg"
|
|
204
|
-
);
|
|
199
|
+
return new Common({
|
|
200
|
+
chain: ethereumLikeInfo.baseChain || "mainnet",
|
|
201
|
+
hardfork: ethereumLikeInfo.hardfork || "petersburg",
|
|
202
|
+
});
|
|
205
203
|
}
|
|
206
204
|
return Common.forCustomChain(
|
|
207
|
-
// $FlowFixMe
|
|
208
205
|
ethereumLikeInfo.baseChain || "mainnet",
|
|
209
206
|
{
|
|
210
207
|
name: currency.ticker,
|
|
211
208
|
chainId: ethereumLikeInfo.chainId,
|
|
212
|
-
// $FlowFixMe
|
|
213
209
|
networkId: ethereumLikeInfo.networkId || ethereumLikeInfo.chainId,
|
|
214
210
|
},
|
|
215
|
-
// $FlowFixMe
|
|
216
211
|
ethereumLikeInfo.hardfork || "petersburg"
|
|
217
212
|
);
|
|
218
213
|
}
|
|
@@ -239,8 +234,6 @@ export function buildEthereumTx(
|
|
|
239
234
|
"only token accounts expected"
|
|
240
235
|
);
|
|
241
236
|
const common = getEthereumjsTxCommon(currency);
|
|
242
|
-
invariant(common, `common not found for currency ${currency.name}`);
|
|
243
|
-
// FIXME: make sure it doesn't break
|
|
244
237
|
if (!common) {
|
|
245
238
|
throw new Error(`common not found for currency ${currency.name}`);
|
|
246
239
|
}
|
|
@@ -258,18 +251,11 @@ export function buildEthereumTx(
|
|
|
258
251
|
ethTxObject
|
|
259
252
|
);
|
|
260
253
|
log("ethereum", "buildEthereumTx", ethTxObject);
|
|
261
|
-
const tx = new EthereumTx(ethTxObject, {
|
|
262
|
-
common,
|
|
263
|
-
});
|
|
264
|
-
// these will be filled by device signature
|
|
265
|
-
tx.raw[6] = Buffer.from([common.chainId()]); // v
|
|
266
|
-
|
|
267
|
-
tx.raw[7] = Buffer.from([]); // r
|
|
268
|
-
|
|
269
|
-
tx.raw[8] = Buffer.from([]); // s
|
|
270
|
-
|
|
254
|
+
const tx = new EthereumTx(ethTxObject, { common });
|
|
271
255
|
return {
|
|
272
256
|
tx,
|
|
257
|
+
common,
|
|
258
|
+
ethTxObject,
|
|
273
259
|
fillTransactionDataResult,
|
|
274
260
|
};
|
|
275
261
|
}
|
|
@@ -294,7 +280,7 @@ export function inferEthereumGasLimitRequest(
|
|
|
294
280
|
}
|
|
295
281
|
|
|
296
282
|
if (to) {
|
|
297
|
-
r.to =
|
|
283
|
+
r.to = to.toString();
|
|
298
284
|
}
|
|
299
285
|
|
|
300
286
|
if (data) {
|
|
@@ -87,7 +87,7 @@ export const getTransactionParams: CacheRes<
|
|
|
87
87
|
);
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* Cache the payment info (fee estimate), with a hash
|
|
90
|
+
* Cache the payment info (fee estimate), with a hash depending on fees-changing transaction params and tx size.
|
|
91
91
|
*
|
|
92
92
|
* @param {Account} arg1.a
|
|
93
93
|
* @param {Transaction} arg1.t
|
|
@@ -4,8 +4,6 @@ import {
|
|
|
4
4
|
TOKEN_PROGRAM_ID,
|
|
5
5
|
} from "@solana/spl-token";
|
|
6
6
|
import {
|
|
7
|
-
Cluster,
|
|
8
|
-
clusterApiUrl,
|
|
9
7
|
Connection,
|
|
10
8
|
FeeCalculator,
|
|
11
9
|
PublicKey,
|
|
@@ -15,7 +13,7 @@ import {
|
|
|
15
13
|
import { Awaited } from "../../logic";
|
|
16
14
|
|
|
17
15
|
export type Config = {
|
|
18
|
-
readonly
|
|
16
|
+
readonly endpoint: string;
|
|
19
17
|
};
|
|
20
18
|
|
|
21
19
|
export type ChainAPI = Readonly<{
|
|
@@ -60,8 +58,7 @@ export type ChainAPI = Readonly<{
|
|
|
60
58
|
}>;
|
|
61
59
|
|
|
62
60
|
export function getChainAPI(config: Config): ChainAPI {
|
|
63
|
-
const connection = () =>
|
|
64
|
-
new Connection(clusterApiUrl(config.cluster), "finalized");
|
|
61
|
+
const connection = () => new Connection(config.endpoint, "finalized");
|
|
65
62
|
|
|
66
63
|
return {
|
|
67
64
|
getBalance: (address: string) =>
|
|
@@ -22,7 +22,7 @@ import { broadcastWithAPI } from "../js-broadcast";
|
|
|
22
22
|
import { prepareTransaction as prepareTransactionWithAPI } from "../js-prepareTransaction";
|
|
23
23
|
import { ChainAPI, Config } from "../api";
|
|
24
24
|
import { makeLRUCache } from "../../../cache";
|
|
25
|
-
import {
|
|
25
|
+
import { endpointByCurrencyId } from "../utils";
|
|
26
26
|
import { minutes, seconds } from "../api/cached";
|
|
27
27
|
import hash from "object-hash";
|
|
28
28
|
import BigNumber from "bignumber.js";
|
|
@@ -32,8 +32,8 @@ function makePrepare(getChainAPI: (config: Config) => Promise<ChainAPI>) {
|
|
|
32
32
|
mainAccount: Account,
|
|
33
33
|
transaction: Transaction
|
|
34
34
|
) {
|
|
35
|
-
const config = {
|
|
36
|
-
|
|
35
|
+
const config: Config = {
|
|
36
|
+
endpoint: endpointByCurrencyId(mainAccount.currency.id),
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
const chainAPI = await getChainAPI(config);
|
|
@@ -61,8 +61,8 @@ function makePrepare(getChainAPI: (config: Config) => Promise<ChainAPI>) {
|
|
|
61
61
|
|
|
62
62
|
function makeSyncAndScan(getChainAPI: (config: Config) => Promise<ChainAPI>) {
|
|
63
63
|
const getAccountShape: GetAccountShape = async (info) => {
|
|
64
|
-
const config = {
|
|
65
|
-
|
|
64
|
+
const config: Config = {
|
|
65
|
+
endpoint: endpointByCurrencyId(info.currency.id),
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
const chainAPI = await getChainAPI(config);
|
|
@@ -91,8 +91,8 @@ function makeEstimateMaxSpendable(
|
|
|
91
91
|
throw new Error("currency not found");
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
const config = {
|
|
95
|
-
|
|
94
|
+
const config: Config = {
|
|
95
|
+
endpoint: endpointByCurrencyId(currencyId),
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
const api = await getChainAPI(config);
|
|
@@ -110,8 +110,8 @@ function makeBroadcast(
|
|
|
110
110
|
getChainAPI: (config: Config) => Promise<ChainAPI>
|
|
111
111
|
): BroadcastFnSignature {
|
|
112
112
|
return async (info) => {
|
|
113
|
-
const config = {
|
|
114
|
-
|
|
113
|
+
const config: Config = {
|
|
114
|
+
endpoint: endpointByCurrencyId(info.account.currency.id),
|
|
115
115
|
};
|
|
116
116
|
const api = await getChainAPI(config);
|
|
117
117
|
return broadcastWithAPI(info, api);
|
|
@@ -122,8 +122,8 @@ function makeSign(
|
|
|
122
122
|
getChainAPI: (config: Config) => Promise<ChainAPI>
|
|
123
123
|
): SignOperationFnSignature<Transaction> {
|
|
124
124
|
return (info) => {
|
|
125
|
-
const config = {
|
|
126
|
-
|
|
125
|
+
const config: Config = {
|
|
126
|
+
endpoint: endpointByCurrencyId(info.account.currency.id),
|
|
127
127
|
};
|
|
128
128
|
const api = () => getChainAPI(config);
|
|
129
129
|
return signOperationWithAPI(info, api);
|
|
@@ -5,19 +5,19 @@ import { minutes } from "../api/cached";
|
|
|
5
5
|
|
|
6
6
|
const getAPI = makeLRUCache(
|
|
7
7
|
(config: Config) => Promise.resolve(getChainAPI(config)),
|
|
8
|
-
(config) => config.
|
|
8
|
+
(config) => config.endpoint,
|
|
9
9
|
minutes(1000)
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
const getQueuedAPI = makeLRUCache(
|
|
13
13
|
(config: Config) => getAPI(config).then((api) => queued(api, 100)),
|
|
14
|
-
(config) => config.
|
|
14
|
+
(config) => config.endpoint,
|
|
15
15
|
minutes(1000)
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
const getQueuedAndCachedAPI = makeLRUCache(
|
|
19
19
|
(config: Config) => getQueuedAPI(config).then(cached),
|
|
20
|
-
(config) => config.
|
|
20
|
+
(config) => config.endpoint,
|
|
21
21
|
minutes(1000)
|
|
22
22
|
);
|
|
23
23
|
|