@ledgerhq/live-common 21.30.1 → 21.32.2
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/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 +100 -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/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/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 +15 -5
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +10 -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/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/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 +3 -4
- package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zec.js +26 -17
- package/lib/families/bitcoin/wallet-btc/crypto/zec.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts +3 -4
- package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zen.js +33 -24
- 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/instruction/token/types.d.ts +1 -1
- package/lib/families/solana/specs.js +1 -1
- package/lib/families/solana/specs.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/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/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/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/package.json +23 -21
- package/src/.DS_Store +0 -0
- package/src/{data/flags → __tests__}/.DS_Store +0 -0
- package/src/__tests__/__snapshots__/all.libcore.ts.snap +457 -33509
- package/src/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.ts +47 -0
- package/src/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.ts +0 -11
- 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/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 +10 -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/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 +4 -22
- package/src/families/bitcoin/wallet-btc/crypto/zen.ts +4 -22
- 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/specs.ts +1 -1
- package/src/families/tezos/bakers.whitelist-default.ts +0 -2
- package/src/families/tezos/bridge/js.ts +6 -1
- package/src/families/tezos/test-specifics.ts +1 -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/types/index.ts +1 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DerivationModes } from "../../../../families/bitcoin/wallet-btc";
|
|
2
|
+
import BitcoinLikeStorage from "../../../../families/bitcoin/wallet-btc/storage";
|
|
3
|
+
import BitcoinLikeExplorer from "../../../../families/bitcoin/wallet-btc/explorer";
|
|
4
|
+
import Xpub from "../../../../families/bitcoin/wallet-btc/xpub";
|
|
5
|
+
import coininfo from "coininfo";
|
|
6
|
+
import BCHCrypto from "../../../../families/bitcoin/wallet-btc/crypto/bitcoincash";
|
|
7
|
+
import BTCCrypto from "../../../../families/bitcoin/wallet-btc/crypto/bitcoin";
|
|
8
|
+
|
|
9
|
+
describe("Unit tests for getAddress", () => {
|
|
10
|
+
it("Test getAddress for bch and btc", async () => {
|
|
11
|
+
const bchCrypto = new BCHCrypto({
|
|
12
|
+
network: coininfo.bitcoincash.main.toBitcoinJS(),
|
|
13
|
+
});
|
|
14
|
+
const btcCrypto = new BTCCrypto({
|
|
15
|
+
network: coininfo.bitcoin.main.toBitcoinJS(),
|
|
16
|
+
});
|
|
17
|
+
const bchxpub = new Xpub({
|
|
18
|
+
storage: new BitcoinLikeStorage(),
|
|
19
|
+
explorer: new BitcoinLikeExplorer({
|
|
20
|
+
explorerURI: "https://explorers.api.vault.ledger.com/blockchain/v3/bch",
|
|
21
|
+
explorerVersion: "v3",
|
|
22
|
+
}),
|
|
23
|
+
crypto: bchCrypto,
|
|
24
|
+
xpub: "xpub6BtWBf3Pu6hYwJBKvEwG7JtrTxxDrSGy39HaTgZz6GTSaFWFdoCtuEXSQtoKGaYdz1emg8xTXKYwjhu3xXRPzFnYS1z4yjKj7hLDQyNeDZr",
|
|
25
|
+
derivationMode: DerivationModes.LEGACY,
|
|
26
|
+
});
|
|
27
|
+
await bchxpub.syncAddress(0, 0);
|
|
28
|
+
let addresses = await bchxpub.getXpubAddresses();
|
|
29
|
+
expect(addresses[0].address).toEqual(
|
|
30
|
+
"bitcoincash:qrgwhfg7tn4xs9pg2vu5rhkud490j9yfnqd63uk64m"
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const btcxpub = new Xpub({
|
|
34
|
+
storage: new BitcoinLikeStorage(),
|
|
35
|
+
explorer: new BitcoinLikeExplorer({
|
|
36
|
+
explorerURI: "https://explorers.api.vault.ledger.com/blockchain/v3/btc",
|
|
37
|
+
explorerVersion: "v3",
|
|
38
|
+
}),
|
|
39
|
+
crypto: btcCrypto,
|
|
40
|
+
xpub: "xpub6BtWBf3Pu6hYwJBKvEwG7JtrTxxDrSGy39HaTgZz6GTSaFWFdoCtuEXSQtoKGaYdz1emg8xTXKYwjhu3xXRPzFnYS1z4yjKj7hLDQyNeDZr",
|
|
41
|
+
derivationMode: DerivationModes.LEGACY,
|
|
42
|
+
});
|
|
43
|
+
await btcxpub.syncAddress(0, 0);
|
|
44
|
+
addresses = await btcxpub.getXpubAddresses();
|
|
45
|
+
expect(addresses[0].address).toEqual("1L3fqoWstvLqEA6TgXkuLoXX8xG1xhirG3");
|
|
46
|
+
}, 60000);
|
|
47
|
+
});
|
package/src/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.ts
CHANGED
|
@@ -67,7 +67,6 @@ describe("testing xpub legacy transactions", () => {
|
|
|
67
67
|
output_index: 0,
|
|
68
68
|
value: "5000000000",
|
|
69
69
|
address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
|
|
70
|
-
script_hex: "76a914af9ab6987aa41b37c8bcb7c61154165d23f09e3488ac",
|
|
71
70
|
output_hash:
|
|
72
71
|
"9e1b337875c21f751e70ee2c2c6ee93d8a6733d0f3ba6d139ae6a0479ebcefb0",
|
|
73
72
|
block_height: 1,
|
|
@@ -77,8 +76,6 @@ describe("testing xpub legacy transactions", () => {
|
|
|
77
76
|
output_index: 1,
|
|
78
77
|
value: "0",
|
|
79
78
|
address: "<unknown>",
|
|
80
|
-
script_hex:
|
|
81
|
-
"6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9",
|
|
82
79
|
output_hash:
|
|
83
80
|
"9e1b337875c21f751e70ee2c2c6ee93d8a6733d0f3ba6d139ae6a0479ebcefb0",
|
|
84
81
|
block_height: 1,
|
|
@@ -112,7 +109,6 @@ describe("testing xpub legacy transactions", () => {
|
|
|
112
109
|
output_index: 0,
|
|
113
110
|
value: "300000000",
|
|
114
111
|
address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
|
|
115
|
-
script_hex: "76a914af9ab6987aa41b37c8bcb7c61154165d23f09e3488ac",
|
|
116
112
|
output_hash:
|
|
117
113
|
"0b9f98d07eb418fa20573112d3cba6b871d429a06c724a7888ff0886be5213d1",
|
|
118
114
|
block_height: 120,
|
|
@@ -122,7 +118,6 @@ describe("testing xpub legacy transactions", () => {
|
|
|
122
118
|
output_index: 1,
|
|
123
119
|
value: "4699983200",
|
|
124
120
|
address: "2MynSTpze5SDcuLr1DekSV7RVrFpQCo3LeP",
|
|
125
|
-
script_hex: "a91447b810238a31777fc4e4de474419464c46aadf8187",
|
|
126
121
|
output_hash:
|
|
127
122
|
"0b9f98d07eb418fa20573112d3cba6b871d429a06c724a7888ff0886be5213d1",
|
|
128
123
|
block_height: 120,
|
|
@@ -209,7 +204,6 @@ describe("testing xpub legacy transactions", () => {
|
|
|
209
204
|
output_index: 0,
|
|
210
205
|
value: "4599966400",
|
|
211
206
|
address: "2NCSYYp4bWdHDYf9nYP1NDKb1GMBqa8e57H",
|
|
212
|
-
script_hex: "a914d28e7592fc2657433296eafc89e4a8d29289ebf087",
|
|
213
207
|
output_hash:
|
|
214
208
|
"8f30fe84da5a5846d668b4bad260730f2b0125fa66fb2633fa1cee23c6b11053",
|
|
215
209
|
block_height: 122,
|
|
@@ -219,7 +213,6 @@ describe("testing xpub legacy transactions", () => {
|
|
|
219
213
|
output_index: 1,
|
|
220
214
|
value: "100000000",
|
|
221
215
|
address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
|
|
222
|
-
script_hex: "76a914af9ab6987aa41b37c8bcb7c61154165d23f09e3488ac",
|
|
223
216
|
output_hash:
|
|
224
217
|
"8f30fe84da5a5846d668b4bad260730f2b0125fa66fb2633fa1cee23c6b11053",
|
|
225
218
|
block_height: 122,
|
|
@@ -253,7 +246,6 @@ describe("testing xpub legacy transactions", () => {
|
|
|
253
246
|
output_index: 0,
|
|
254
247
|
value: "4399949600",
|
|
255
248
|
address: "2NFToPiLBtuKiqzZj43nPXknN8d4xNySe3o",
|
|
256
|
-
script_hex: "a914f3b3a49bd90e6e9ae30882a2b7e9b7edfe579a8c87",
|
|
257
249
|
output_hash:
|
|
258
250
|
"2f90f3312ffd4dce490cb2f7429c586a43ef68c99fc2f8e549127b72af7b4209",
|
|
259
251
|
block_height: 123,
|
|
@@ -263,7 +255,6 @@ describe("testing xpub legacy transactions", () => {
|
|
|
263
255
|
output_index: 1,
|
|
264
256
|
value: "200000000",
|
|
265
257
|
address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
|
|
266
|
-
script_hex: "76a914af9ab6987aa41b37c8bcb7c61154165d23f09e3488ac",
|
|
267
258
|
output_hash:
|
|
268
259
|
"2f90f3312ffd4dce490cb2f7429c586a43ef68c99fc2f8e549127b72af7b4209",
|
|
269
260
|
block_height: 123,
|
|
@@ -297,7 +288,6 @@ describe("testing xpub legacy transactions", () => {
|
|
|
297
288
|
output_index: 0,
|
|
298
289
|
value: "600000000",
|
|
299
290
|
address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
|
|
300
|
-
script_hex: "76a914af9ab6987aa41b37c8bcb7c61154165d23f09e3488ac",
|
|
301
291
|
output_hash:
|
|
302
292
|
"2fee0c4b55e08583aa5bc565d7e428f7cdcbd2b73262f62208a6a72a74e2c945",
|
|
303
293
|
block_height: 124,
|
|
@@ -307,7 +297,6 @@ describe("testing xpub legacy transactions", () => {
|
|
|
307
297
|
output_index: 1,
|
|
308
298
|
value: "3799932800",
|
|
309
299
|
address: "2N53XuFRxqbShpK4XKwC1VXT4zu1wCzbAMU",
|
|
310
|
-
script_hex: "a914816b7896ce2c4f21c39c865030fe07e7a042a9c687",
|
|
311
300
|
output_hash:
|
|
312
301
|
"2fee0c4b55e08583aa5bc565d7e428f7cdcbd2b73262f62208a6a72a74e2c945",
|
|
313
302
|
block_height: 124,
|
package/src/account/support.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { getAccountBridge } from "../bridge";
|
|
|
21
21
|
import jsBridges from "../generated/bridge/js";
|
|
22
22
|
|
|
23
23
|
const experimentalIntegrations = ["algorand", "tezos"];
|
|
24
|
+
|
|
24
25
|
export function shouldUseJS(currency: CryptoCurrency) {
|
|
25
26
|
const jsBridge = jsBridges[currency.family];
|
|
26
27
|
if (!jsBridge) return false;
|
package/src/api/Ethereum.ts
CHANGED
package/src/apps/polyfill.ts
CHANGED
|
@@ -53,6 +53,7 @@ export const whitelistDependencies = ["Decred", "Decred Testnet"];
|
|
|
53
53
|
["POAP", "Ethereum"],
|
|
54
54
|
["OlympusDAO", "Ethereum"],
|
|
55
55
|
["Rarible", "Ethereum"],
|
|
56
|
+
["Ricochet", "Ethereum"],
|
|
56
57
|
].forEach(([name, dep]) => declareDep(name, dep));
|
|
57
58
|
export const getDependencies = (appName: string): string[] =>
|
|
58
59
|
directDep[appName] || [];
|
package/src/bot/engine.ts
CHANGED
|
@@ -81,6 +81,9 @@ export async function runWithAppSpec<T extends Transaction>(
|
|
|
81
81
|
const mutationReports: MutationReport<T>[] = [];
|
|
82
82
|
const { appQuery, currency, dependency } = spec;
|
|
83
83
|
const appCandidate = findAppCandidate(appCandidates, appQuery);
|
|
84
|
+
if (!appCandidate) {
|
|
85
|
+
console.warn("no app found for " + spec.name, { appQuery, appCandidates });
|
|
86
|
+
}
|
|
84
87
|
invariant(
|
|
85
88
|
appCandidate,
|
|
86
89
|
"%s: no app found. Are you sure your COINAPPS is up to date?",
|
|
@@ -401,7 +404,7 @@ export async function runOnAccount<T extends Transaction>({
|
|
|
401
404
|
}
|
|
402
405
|
}
|
|
403
406
|
|
|
404
|
-
// without recovering
|
|
407
|
+
// without recovering mechanism, we simply assume an error is a failure
|
|
405
408
|
if (errors.length) {
|
|
406
409
|
throw errors[0];
|
|
407
410
|
}
|
package/src/bridge/jsHelpers.ts
CHANGED
|
@@ -97,7 +97,7 @@ Operation[] {
|
|
|
97
97
|
newOps.forEach((op) => {
|
|
98
98
|
newOpsIds[op.id] = op;
|
|
99
99
|
});
|
|
100
|
-
// return
|
|
100
|
+
// return existing when there is no real new operations
|
|
101
101
|
if (newOps.length === 0) return existing;
|
|
102
102
|
// edge case, existing can be empty. return the sorted list.
|
|
103
103
|
if (existing.length === 0) return Object.values(newOpsIds);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
interface Props {
|
|
4
|
+
size: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function celo({size, color = "currentColor"}: Props) {
|
|
9
|
+
return <svg width={size} height={size} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.1053 19.1053C12.9834 19.1053 15.3158 16.7728 15.3158 13.8947C15.3158 11.0166 12.9834 8.68421 10.1053 8.68421C7.22716 8.68421 4.89474 11.0166 4.89474 13.8947C4.89474 16.7728 7.22716 19.1053 10.1053 19.1053ZM10.1053 21C6.18126 21 3 17.8187 3 13.8947C3 9.97074 6.18126 6.78947 10.1053 6.78947C14.0293 6.78947 17.2105 9.97074 17.2105 13.8947C17.2105 17.8187 14.0293 21 10.1053 21Z" fill={color} /><path d="M13.8947 15.3158C16.7728 15.3158 19.1053 12.9834 19.1053 10.1053C19.1053 7.22716 16.7728 4.89474 13.8947 4.89474C11.0166 4.89474 8.68421 7.22716 8.68421 10.1053C8.68421 12.9834 11.0166 15.3158 13.8947 15.3158ZM13.8947 17.2105C9.97074 17.2105 6.78947 14.0293 6.78947 10.1053C6.78947 6.18126 9.97074 3 13.8947 3C17.8187 3 21 6.18126 21 10.1053C21 14.0293 17.8187 17.2105 13.8947 17.2105Z" fill={color} /><path d="M14.1297 17.2105C14.6223 16.6137 14.9747 15.9145 15.1623 15.1623C15.9126 14.9747 16.6118 14.6223 17.2105 14.1297C17.184 14.9994 16.9964 15.8558 16.6573 16.6592C15.8558 16.9964 14.9994 17.184 14.1297 17.2105ZM8.83768 8.83768C8.08737 9.02526 7.38821 9.37768 6.78947 9.87032C6.816 9.00063 7.00358 8.14421 7.34274 7.34274C8.14421 7.00547 9.00253 6.81789 9.87032 6.78947C9.37768 7.38632 9.02526 8.08547 8.83768 8.83768Z" fill={color} /></svg>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default celo;
|
|
@@ -78,6 +78,7 @@ export { default as call } from "./call";
|
|
|
78
78
|
export { default as cc } from "./cc";
|
|
79
79
|
export { default as cdn } from "./cdn";
|
|
80
80
|
export { default as cdt } from "./cdt";
|
|
81
|
+
export { default as celo } from "./celo";
|
|
81
82
|
export { default as cenz } from "./cenz";
|
|
82
83
|
export { default as chain } from "./chain";
|
|
83
84
|
export { default as chat } from "./chat";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import Svg, { Path } from "react-native-svg";
|
|
4
|
+
interface Props {
|
|
5
|
+
size: number;
|
|
6
|
+
color: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function celo({ size, color }: Props) {
|
|
10
|
+
return <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><Path d="M10.1053 19.1053C12.9834 19.1053 15.3158 16.7728 15.3158 13.8947C15.3158 11.0166 12.9834 8.68421 10.1053 8.68421C7.22716 8.68421 4.89474 11.0166 4.89474 13.8947C4.89474 16.7728 7.22716 19.1053 10.1053 19.1053ZM10.1053 21C6.18126 21 3 17.8187 3 13.8947C3 9.97074 6.18126 6.78947 10.1053 6.78947C14.0293 6.78947 17.2105 9.97074 17.2105 13.8947C17.2105 17.8187 14.0293 21 10.1053 21Z" fill={color} /><Path d="M13.8947 15.3158C16.7728 15.3158 19.1053 12.9834 19.1053 10.1053C19.1053 7.22716 16.7728 4.89474 13.8947 4.89474C11.0166 4.89474 8.68421 7.22716 8.68421 10.1053C8.68421 12.9834 11.0166 15.3158 13.8947 15.3158ZM13.8947 17.2105C9.97074 17.2105 6.78947 14.0293 6.78947 10.1053C6.78947 6.18126 9.97074 3 13.8947 3C17.8187 3 21 6.18126 21 10.1053C21 14.0293 17.8187 17.2105 13.8947 17.2105Z" fill={color} /><Path d="M14.1297 17.2105C14.6223 16.6137 14.9747 15.9145 15.1623 15.1623C15.9126 14.9747 16.6118 14.6223 17.2105 14.1297C17.184 14.9994 16.9964 15.8558 16.6573 16.6592C15.8558 16.9964 14.9994 17.184 14.1297 17.2105ZM8.83768 8.83768C8.08737 9.02526 7.38821 9.37768 6.78947 9.87032C6.816 9.00063 7.00358 8.14421 7.34274 7.34274C8.14421 7.00547 9.00253 6.81789 9.87032 6.78947C9.37768 7.38632 9.02526 8.08547 8.83768 8.83768Z" fill={color} /></Svg>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default celo;
|
|
@@ -78,6 +78,7 @@ export { default as call } from "./call";
|
|
|
78
78
|
export { default as cc } from "./cc";
|
|
79
79
|
export { default as cdn } from "./cdn";
|
|
80
80
|
export { default as cdt } from "./cdt";
|
|
81
|
+
export { default as celo } from "./celo";
|
|
81
82
|
export { default as cenz } from "./cenz";
|
|
82
83
|
export { default as chain } from "./chain";
|
|
83
84
|
export { default as chat } from "./chat";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M10.1053 19.1053C12.9834 19.1053 15.3158 16.7728 15.3158 13.8947C15.3158 11.0166 12.9834 8.68421 10.1053 8.68421C7.22716 8.68421 4.89474 11.0166 4.89474 13.8947C4.89474 16.7728 7.22716 19.1053 10.1053 19.1053ZM10.1053 21C6.18126 21 3 17.8187 3 13.8947C3 9.97074 6.18126 6.78947 10.1053 6.78947C14.0293 6.78947 17.2105 9.97074 17.2105 13.8947C17.2105 17.8187 14.0293 21 10.1053 21Z" fill="#42D689"/>
|
|
3
|
+
<path d="M13.8947 15.3158C16.7728 15.3158 19.1053 12.9834 19.1053 10.1053C19.1053 7.22716 16.7728 4.89474 13.8947 4.89474C11.0166 4.89474 8.68421 7.22716 8.68421 10.1053C8.68421 12.9834 11.0166 15.3158 13.8947 15.3158ZM13.8947 17.2105C9.97074 17.2105 6.78947 14.0293 6.78947 10.1053C6.78947 6.18126 9.97074 3 13.8947 3C17.8187 3 21 6.18126 21 10.1053C21 14.0293 17.8187 17.2105 13.8947 17.2105Z" fill="#42D689"/>
|
|
4
|
+
<path d="M14.1297 17.2105C14.6223 16.6137 14.9747 15.9145 15.1623 15.1623C15.9126 14.9747 16.6118 14.6223 17.2105 14.1297C17.184 14.9994 16.9964 15.8558 16.6573 16.6592C15.8558 16.9964 14.9994 17.184 14.1297 17.2105ZM8.83768 8.83768C8.08737 9.02526 7.38821 9.37768 6.78947 9.87032C6.816 9.00063 7.00358 8.14421 7.34274 7.34274C8.14421 7.00547 9.00253 6.81789 9.87032 6.78947C9.37768 7.38632 9.02526 8.08547 8.83768 8.83768Z" fill="#42D689"/>
|
|
5
|
+
</svg>
|
package/src/env.ts
CHANGED
|
@@ -40,6 +40,16 @@ const envDefinitions = {
|
|
|
40
40
|
parser: stringParser,
|
|
41
41
|
desc: "Node API endpoint for algorand",
|
|
42
42
|
},
|
|
43
|
+
API_CELO_INDEXER: {
|
|
44
|
+
def: "https://celo.coin.ledger.com/indexer/",
|
|
45
|
+
parser: stringParser,
|
|
46
|
+
desc: "Explorer API for celo",
|
|
47
|
+
},
|
|
48
|
+
API_CELO_NODE: {
|
|
49
|
+
def: "https://celo.coin.ledger.com/archive/",
|
|
50
|
+
parser: stringParser,
|
|
51
|
+
desc: "Node endpoint for celo",
|
|
52
|
+
},
|
|
43
53
|
API_COSMOS_BLOCKCHAIN_EXPLORER_API_ENDPOINT: {
|
|
44
54
|
def: "https://cosmoshub4.coin.ledger.com/",
|
|
45
55
|
parser: stringParser,
|
|
@@ -32,7 +32,27 @@ const fundProviders: Record<
|
|
|
32
32
|
curve: string;
|
|
33
33
|
}
|
|
34
34
|
> = {
|
|
35
|
-
|
|
35
|
+
baanx: {
|
|
36
|
+
/**
|
|
37
|
+
* nameAndPubkey is the concatenation of:
|
|
38
|
+
* - an empty buffer of the size of the partner name
|
|
39
|
+
* - a buffer created from the partner name string in ascii encoding
|
|
40
|
+
* - a buffer created from the hexadecimal version of the partner public key
|
|
41
|
+
*/
|
|
42
|
+
nameAndPubkey: Buffer.concat([
|
|
43
|
+
Buffer.from([5]),
|
|
44
|
+
Buffer.from("Baanx", "ascii"),
|
|
45
|
+
Buffer.from(
|
|
46
|
+
"04551878b446b6a711949fa51cc5a8685602f8ffb1dfd08f6ab869019d7c125d7737a79e8b5022d860ec7dfbe062d510fec3b5fe0f6ebb1f5e55a074bb7e5dbc4e",
|
|
47
|
+
"hex"
|
|
48
|
+
),
|
|
49
|
+
]),
|
|
50
|
+
signature: Buffer.from(
|
|
51
|
+
"304402200345c39e93a22c5ac3f1e70f8b9938b3a60d3a4906067443cf11095af0e685a502201ee5d88dd5539ce36341e49e2505c2a1659e26d8ff08801ed33c50a9126aedd1",
|
|
52
|
+
"hex"
|
|
53
|
+
),
|
|
54
|
+
curve: "secp256r1",
|
|
55
|
+
},
|
|
36
56
|
};
|
|
37
57
|
|
|
38
58
|
const getProvider = (
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { encode as msgpackEncode } from "algo-msgpack-with-bigint";
|
|
2
2
|
import type {
|
|
3
|
-
SuggestedParams as AlgoSuggestedParams,
|
|
4
3
|
Transaction as AlgoTransaction,
|
|
5
4
|
EncodedTransaction as AlgoTransactionPayload,
|
|
6
5
|
EncodedSignedTransaction as AlgoSignedTransactionPayload,
|
|
@@ -28,8 +27,7 @@ export const buildTransactionPayload = async (
|
|
|
28
27
|
|
|
29
28
|
const note = memo ? new TextEncoder().encode(memo) : undefined;
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
const params = (await getTransactionParams()) as AlgoSuggestedParams;
|
|
30
|
+
const params = await getTransactionParams();
|
|
33
31
|
|
|
34
32
|
let algoTxn: AlgoTransaction;
|
|
35
33
|
if (subAccount || (assetId && mode === "optIn")) {
|
|
@@ -78,18 +76,16 @@ export const buildTransactionPayload = async (
|
|
|
78
76
|
return sorted;
|
|
79
77
|
};
|
|
80
78
|
|
|
81
|
-
export const encodeToSign =
|
|
82
|
-
payload: AlgoTransactionPayload
|
|
83
|
-
): Promise<string> => {
|
|
79
|
+
export const encodeToSign = (payload: AlgoTransactionPayload): string => {
|
|
84
80
|
const msgPackEncoded = msgpackEncode(payload);
|
|
85
81
|
|
|
86
82
|
return Buffer.from(msgPackEncoded).toString("hex");
|
|
87
83
|
};
|
|
88
84
|
|
|
89
|
-
export const encodeToBroadcast =
|
|
85
|
+
export const encodeToBroadcast = (
|
|
90
86
|
payload: AlgoTransactionPayload,
|
|
91
87
|
signature: Buffer
|
|
92
|
-
):
|
|
88
|
+
): Buffer => {
|
|
93
89
|
const signedPayload: AlgoSignedTransactionPayload = {
|
|
94
90
|
sig: signature,
|
|
95
91
|
txn: payload,
|
|
@@ -17,7 +17,7 @@ export const getEstimatedFees = async (
|
|
|
17
17
|
let suggestedFees = 0;
|
|
18
18
|
if (params.fee) {
|
|
19
19
|
const payload = await buildTransactionPayload(account, transaction);
|
|
20
|
-
const encoded =
|
|
20
|
+
const encoded = encodeToSign(payload);
|
|
21
21
|
suggestedFees =
|
|
22
22
|
params.fee * (Buffer.from(encoded, "hex").length + SINGLE_SIGNATURE_SIZE);
|
|
23
23
|
}
|
|
@@ -36,7 +36,7 @@ export const signOperation = ({
|
|
|
36
36
|
|
|
37
37
|
const algoTx = await buildTransactionPayload(account, transaction);
|
|
38
38
|
|
|
39
|
-
const toSign =
|
|
39
|
+
const toSign = encodeToSign(algoTx);
|
|
40
40
|
|
|
41
41
|
const hwApp = new Algorand(transport);
|
|
42
42
|
const { freshAddressPath } = account;
|
|
@@ -53,7 +53,7 @@ export const signOperation = ({
|
|
|
53
53
|
throw new Error("No signature");
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
const toBroadcast =
|
|
56
|
+
const toBroadcast = encodeToBroadcast(algoTx, signature);
|
|
57
57
|
|
|
58
58
|
const operation = buildOptimisticOperation(account, transaction);
|
|
59
59
|
|
|
@@ -32,7 +32,7 @@ const signOperation = ({
|
|
|
32
32
|
try {
|
|
33
33
|
log("hw", `signTransaction ${currency.id} for account ${account.id}`);
|
|
34
34
|
const txInfo = await buildTransaction(account, transaction);
|
|
35
|
-
let senders
|
|
35
|
+
let senders = new Set<string>();
|
|
36
36
|
let recipients: string[] = [];
|
|
37
37
|
let fee = new BigNumber(0);
|
|
38
38
|
// Maybe better not re-calculate these fields here, instead include them
|
|
@@ -41,9 +41,7 @@ const signOperation = ({
|
|
|
41
41
|
account,
|
|
42
42
|
transaction,
|
|
43
43
|
}).then((res) => {
|
|
44
|
-
senders = res.txInputs
|
|
45
|
-
.map((i) => i.address)
|
|
46
|
-
.filter(Boolean) as string[];
|
|
44
|
+
senders = new Set(res.txInputs.map((i) => i.address).filter(Boolean));
|
|
47
45
|
recipients = res.txOutputs
|
|
48
46
|
.filter((o) => o.address && !o.isChange)
|
|
49
47
|
.map((o) => o.address) as string[];
|
|
@@ -140,7 +138,7 @@ const signOperation = ({
|
|
|
140
138
|
fee,
|
|
141
139
|
blockHash: null,
|
|
142
140
|
blockHeight: null,
|
|
143
|
-
senders,
|
|
141
|
+
senders: Array.from(senders),
|
|
144
142
|
recipients,
|
|
145
143
|
accountId: account.id,
|
|
146
144
|
date: new Date(),
|
|
@@ -100,7 +100,7 @@ const mapTxToOperations = (
|
|
|
100
100
|
const blockHeight = tx.block?.height;
|
|
101
101
|
const blockHash = tx.block?.hash;
|
|
102
102
|
const date = new Date(tx.block?.time || tx.received_at);
|
|
103
|
-
const senders
|
|
103
|
+
const senders = new Set<string>();
|
|
104
104
|
const recipients: string[] = [];
|
|
105
105
|
let type: OperationType = "OUT";
|
|
106
106
|
let value = new BigNumber(0);
|
|
@@ -111,7 +111,7 @@ const mapTxToOperations = (
|
|
|
111
111
|
|
|
112
112
|
for (const input of tx.inputs) {
|
|
113
113
|
if (input.address) {
|
|
114
|
-
senders.
|
|
114
|
+
senders.add(
|
|
115
115
|
syncReplaceAddress ? syncReplaceAddress(input.address) : input.address
|
|
116
116
|
);
|
|
117
117
|
|
|
@@ -195,7 +195,7 @@ const mapTxToOperations = (
|
|
|
195
195
|
type,
|
|
196
196
|
value,
|
|
197
197
|
fee,
|
|
198
|
-
senders,
|
|
198
|
+
senders: Array.from(senders),
|
|
199
199
|
recipients,
|
|
200
200
|
blockHeight,
|
|
201
201
|
blockHash,
|
|
@@ -229,7 +229,7 @@ const mapTxToOperations = (
|
|
|
229
229
|
type,
|
|
230
230
|
value,
|
|
231
231
|
fee,
|
|
232
|
-
senders,
|
|
232
|
+
senders: Array.from(senders),
|
|
233
233
|
recipients,
|
|
234
234
|
blockHeight,
|
|
235
235
|
blockHash,
|
|
@@ -84,14 +84,22 @@ class Base implements ICrypto {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// derive legacy address at account and index positions
|
|
87
|
-
getLegacyAddress(
|
|
87
|
+
protected getLegacyAddress(
|
|
88
|
+
xpub: string,
|
|
89
|
+
account: number,
|
|
90
|
+
index: number
|
|
91
|
+
): string {
|
|
88
92
|
const publicKeyBuffer: Buffer = this.getPubkeyAt(xpub, account, index);
|
|
89
93
|
const publicKeyHash160: Buffer = bjs.crypto.hash160(publicKeyBuffer);
|
|
90
94
|
return bjs.address.toBase58Check(publicKeyHash160, this.network.pubKeyHash);
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
// derive native SegWit at account and index positions
|
|
94
|
-
getNativeSegWitAddress(
|
|
98
|
+
private getNativeSegWitAddress(
|
|
99
|
+
xpub: string,
|
|
100
|
+
account: number,
|
|
101
|
+
index: number
|
|
102
|
+
): string {
|
|
95
103
|
const publicKeyBuffer: Buffer = this.getPubkeyAt(xpub, account, index);
|
|
96
104
|
const publicKeyHash160: Buffer = bjs.crypto.hash160(publicKeyBuffer);
|
|
97
105
|
const words: number[] = bech32.toWords(publicKeyHash160);
|
|
@@ -100,7 +108,11 @@ class Base implements ICrypto {
|
|
|
100
108
|
}
|
|
101
109
|
|
|
102
110
|
// derive SegWit at account and index positions
|
|
103
|
-
getSegWitAddress(
|
|
111
|
+
private getSegWitAddress(
|
|
112
|
+
xpub: string,
|
|
113
|
+
account: number,
|
|
114
|
+
index: number
|
|
115
|
+
): string {
|
|
104
116
|
const publicKeyBuffer: Buffer = this.getPubkeyAt(xpub, account, index);
|
|
105
117
|
const redeemOutput: Buffer = bjs.script.compile([
|
|
106
118
|
0,
|
|
@@ -129,28 +141,29 @@ class Base implements ICrypto {
|
|
|
129
141
|
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
130
142
|
];
|
|
131
143
|
}
|
|
144
|
+
const res = this.customGetAddress(derivationMode, xpub, account, index);
|
|
145
|
+
Base.addressCache[
|
|
146
|
+
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
147
|
+
] = res;
|
|
148
|
+
return res;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
customGetAddress(
|
|
152
|
+
derivationMode: string,
|
|
153
|
+
xpub: string,
|
|
154
|
+
account: number,
|
|
155
|
+
index: number
|
|
156
|
+
): string {
|
|
132
157
|
switch (derivationMode) {
|
|
133
158
|
case DerivationModes.LEGACY:
|
|
134
|
-
|
|
135
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
136
|
-
] = this.getLegacyAddress(xpub, account, index);
|
|
137
|
-
break;
|
|
159
|
+
return this.getLegacyAddress(xpub, account, index);
|
|
138
160
|
case DerivationModes.SEGWIT:
|
|
139
|
-
|
|
140
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
141
|
-
] = this.getSegWitAddress(xpub, account, index);
|
|
142
|
-
break;
|
|
161
|
+
return this.getSegWitAddress(xpub, account, index);
|
|
143
162
|
case DerivationModes.NATIVE_SEGWIT:
|
|
144
|
-
|
|
145
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
146
|
-
] = this.getNativeSegWitAddress(xpub, account, index);
|
|
147
|
-
break;
|
|
163
|
+
return this.getNativeSegWitAddress(xpub, account, index);
|
|
148
164
|
default:
|
|
149
165
|
throw new Error(`Invalid derivation Mode: ${derivationMode}`);
|
|
150
166
|
}
|
|
151
|
-
return Base.addressCache[
|
|
152
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
153
|
-
];
|
|
154
167
|
}
|
|
155
168
|
|
|
156
169
|
// infer address type from its syntax
|
|
@@ -119,31 +119,17 @@ class Bitcoin extends Base {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
// get address given an address type
|
|
122
|
-
|
|
122
|
+
customGetAddress(
|
|
123
123
|
derivationMode: string,
|
|
124
124
|
xpub: string,
|
|
125
125
|
account: number,
|
|
126
126
|
index: number
|
|
127
127
|
): string {
|
|
128
|
-
if (
|
|
129
|
-
Base.addressCache[
|
|
130
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
131
|
-
]
|
|
132
|
-
) {
|
|
133
|
-
return Base.addressCache[
|
|
134
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
135
|
-
];
|
|
136
|
-
}
|
|
137
128
|
switch (derivationMode) {
|
|
138
129
|
case DerivationModes.TAPROOT:
|
|
139
|
-
|
|
140
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
141
|
-
] = this.getTaprootAddress(xpub, account, index);
|
|
142
|
-
return Base.addressCache[
|
|
143
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
144
|
-
];
|
|
130
|
+
return this.getTaprootAddress(xpub, account, index);
|
|
145
131
|
default:
|
|
146
|
-
return super.
|
|
132
|
+
return super.customGetAddress(derivationMode, xpub, account, index);
|
|
147
133
|
}
|
|
148
134
|
}
|
|
149
135
|
|
|
@@ -1,73 +1,44 @@
|
|
|
1
|
-
// Fix the "More than one instance of bitcore-lib-cash" issue. Refer to https://github.com/bitpay/bitcore/issues/1457
|
|
2
|
-
delete global._bitcoreCash;
|
|
3
|
-
import * as bch from "bitcore-lib-cash";
|
|
4
1
|
import bchaddr from "bchaddrjs";
|
|
5
2
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
3
|
// @ts-ignore
|
|
7
4
|
import { toOutputScript } from "bitcoinjs-lib/src/address";
|
|
8
5
|
import { InvalidAddress } from "@ledgerhq/errors";
|
|
9
6
|
import { DerivationModes } from "../types";
|
|
10
|
-
import { ICrypto } from "./types";
|
|
11
7
|
import Base from "./base";
|
|
12
8
|
|
|
13
9
|
// a mock explorer class that just use js objects
|
|
14
|
-
class BitcoinCash
|
|
10
|
+
class BitcoinCash extends Base {
|
|
15
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
12
|
network: any;
|
|
17
13
|
|
|
18
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
15
|
constructor({ network }: { network: any }) {
|
|
16
|
+
super({ network });
|
|
20
17
|
this.network = network;
|
|
21
18
|
this.network.dustThreshold = 5430;
|
|
22
19
|
this.network.dustPolicy = "FIXED";
|
|
23
20
|
this.network.usesTimestampedTransaction = false;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
// Based on https://github.com/go-faast/bitcoin-cash-payments/blob/54397eb97c7a9bf08b32e10bef23d5f27aa5ab01/index.js#L63-L73
|
|
27
23
|
// eslint-disable-next-line
|
|
28
24
|
getLegacyBitcoinCashAddress(
|
|
29
25
|
xpub: string,
|
|
30
26
|
account: number,
|
|
31
27
|
index: number
|
|
32
28
|
): string {
|
|
33
|
-
|
|
34
|
-
const child = node.derive(account).derive(index);
|
|
35
|
-
const address = new bch.Address(child.publicKey, bch.Networks.livenet);
|
|
36
|
-
const addrstr = address.toString().split(":");
|
|
37
|
-
if (addrstr.length === 2) {
|
|
38
|
-
return bchaddr.toCashAddress(bchaddr.toLegacyAddress(addrstr[1]));
|
|
39
|
-
}
|
|
40
|
-
throw new Error(`Unable to derive cash address for ${address}`);
|
|
29
|
+
return bchaddr.toCashAddress(super.getLegacyAddress(xpub, account, index));
|
|
41
30
|
}
|
|
42
31
|
|
|
43
32
|
// get address given an address type
|
|
44
|
-
|
|
33
|
+
customGetAddress(
|
|
45
34
|
derivationMode: string,
|
|
46
35
|
xpub: string,
|
|
47
36
|
account: number,
|
|
48
37
|
index: number
|
|
49
38
|
): string {
|
|
50
|
-
|
|
51
|
-
Base.addressCache[
|
|
52
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
53
|
-
]
|
|
54
|
-
) {
|
|
55
|
-
return Base.addressCache[
|
|
56
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
57
|
-
];
|
|
58
|
-
}
|
|
59
|
-
const address = this.getLegacyBitcoinCashAddress(xpub, account, index);
|
|
60
|
-
Base.addressCache[
|
|
61
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
62
|
-
] = address;
|
|
63
|
-
return address;
|
|
39
|
+
return this.getLegacyBitcoinCashAddress(xpub, account, index);
|
|
64
40
|
}
|
|
65
41
|
|
|
66
|
-
// infer address type from its syntax
|
|
67
|
-
//
|
|
68
|
-
// TODO: improve the prefix matching: make the expected prefix
|
|
69
|
-
// correspond to the actual type (currently, a `ltc1` prefix
|
|
70
|
-
// could match a native Bitcoin address type for instance)
|
|
71
42
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
72
43
|
getDerivationMode(address: string) {
|
|
73
44
|
return DerivationModes.LEGACY;
|
|
@@ -85,11 +56,6 @@ class BitcoinCash implements ICrypto {
|
|
|
85
56
|
validateAddress(address: string): boolean {
|
|
86
57
|
return bchaddr.isValidAddress(address);
|
|
87
58
|
}
|
|
88
|
-
|
|
89
|
-
// eslint-disable-next-line
|
|
90
|
-
isTaprootAddress(address: string): boolean {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
59
|
}
|
|
94
60
|
|
|
95
61
|
export default BitcoinCash;
|