@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
|
@@ -68,21 +68,12 @@ class Decred extends Base {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// get address given an address type
|
|
71
|
-
|
|
71
|
+
customGetAddress(
|
|
72
72
|
derivationMode: string,
|
|
73
73
|
xpub: string,
|
|
74
74
|
account: number,
|
|
75
75
|
index: number
|
|
76
76
|
): string {
|
|
77
|
-
if (
|
|
78
|
-
Base.addressCache[
|
|
79
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
80
|
-
]
|
|
81
|
-
) {
|
|
82
|
-
return Base.addressCache[
|
|
83
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
84
|
-
];
|
|
85
|
-
}
|
|
86
77
|
let buffer: Buffer;
|
|
87
78
|
try {
|
|
88
79
|
buffer = Decred.bs58check.decode(xpub);
|
|
@@ -95,11 +86,7 @@ class Decred extends Base {
|
|
|
95
86
|
const X = buffer.slice(45, 78);
|
|
96
87
|
const hd = new BIP32(X, chainCode, this.network, depth, i);
|
|
97
88
|
const publicKey = hd.derive(account).derive(index).publicKey;
|
|
98
|
-
|
|
99
|
-
Base.addressCache[
|
|
100
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
101
|
-
] = address;
|
|
102
|
-
return address;
|
|
89
|
+
return Decred.getAddressFromPk(publicKey);
|
|
103
90
|
}
|
|
104
91
|
}
|
|
105
92
|
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import * as bjs from "bitcoinjs-lib";
|
|
2
|
-
import * as bip32 from "bip32";
|
|
3
1
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
2
|
// @ts-ignore
|
|
5
3
|
import { toOutputScript } from "bitcoinjs-lib/src/address";
|
|
6
4
|
import * as bech32 from "bech32";
|
|
7
5
|
import { DerivationModes } from "../types";
|
|
8
|
-
import { ICrypto } from "./types";
|
|
9
6
|
import Base from "./base";
|
|
10
7
|
|
|
11
8
|
// Todo copy paste from bitcoin.ts. we can merge them later
|
|
12
|
-
class Litecoin extends Base
|
|
9
|
+
class Litecoin extends Base {
|
|
13
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
11
|
network: any;
|
|
15
12
|
|
|
@@ -21,73 +18,6 @@ class Litecoin extends Base implements ICrypto {
|
|
|
21
18
|
this.network.usesTimestampedTransaction = false;
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
getLegacyAddress(xpub: string, account: number, index: number): string {
|
|
25
|
-
const { address } = bjs.payments.p2pkh({
|
|
26
|
-
pubkey: bip32.fromBase58(xpub, this.network).derive(account).derive(index)
|
|
27
|
-
.publicKey,
|
|
28
|
-
network: this.network,
|
|
29
|
-
});
|
|
30
|
-
return String(address);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
getSegWitAddress(xpub: string, account: number, index: number): string {
|
|
34
|
-
const { address } = bjs.payments.p2sh({
|
|
35
|
-
redeem: bjs.payments.p2wpkh({
|
|
36
|
-
pubkey: bip32
|
|
37
|
-
.fromBase58(xpub, this.network)
|
|
38
|
-
.derive(account)
|
|
39
|
-
.derive(index).publicKey,
|
|
40
|
-
network: this.network,
|
|
41
|
-
}),
|
|
42
|
-
});
|
|
43
|
-
return String(address);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
getNativeSegWitAddress(xpub: string, account: number, index: number): string {
|
|
47
|
-
const { address } = bjs.payments.p2wpkh({
|
|
48
|
-
pubkey: bip32.fromBase58(xpub, this.network).derive(account).derive(index)
|
|
49
|
-
.publicKey,
|
|
50
|
-
network: this.network,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return String(address);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
getAddress(
|
|
57
|
-
derivationMode: DerivationModes,
|
|
58
|
-
xpub: string,
|
|
59
|
-
account: number,
|
|
60
|
-
index: number
|
|
61
|
-
): string {
|
|
62
|
-
if (
|
|
63
|
-
Base.addressCache[
|
|
64
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
65
|
-
]
|
|
66
|
-
) {
|
|
67
|
-
return Base.addressCache[
|
|
68
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
let address: string;
|
|
72
|
-
switch (derivationMode) {
|
|
73
|
-
case DerivationModes.LEGACY:
|
|
74
|
-
address = this.getLegacyAddress(xpub, account, index);
|
|
75
|
-
break;
|
|
76
|
-
case DerivationModes.SEGWIT:
|
|
77
|
-
address = this.getSegWitAddress(xpub, account, index);
|
|
78
|
-
break;
|
|
79
|
-
case DerivationModes.NATIVE_SEGWIT:
|
|
80
|
-
address = this.getNativeSegWitAddress(xpub, account, index);
|
|
81
|
-
break;
|
|
82
|
-
default:
|
|
83
|
-
throw new Error("Should not be reachable");
|
|
84
|
-
}
|
|
85
|
-
Base.addressCache[
|
|
86
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
87
|
-
] = address;
|
|
88
|
-
return address;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
21
|
// infer address type from its syntax
|
|
92
22
|
getDerivationMode(address: string) {
|
|
93
23
|
if (address.match("^(ltc1).*")) {
|
|
@@ -7,6 +7,13 @@ export interface ICrypto {
|
|
|
7
7
|
account: number,
|
|
8
8
|
index: number
|
|
9
9
|
): string;
|
|
10
|
+
customGetAddress(
|
|
11
|
+
derivationMode: string,
|
|
12
|
+
xpub: string,
|
|
13
|
+
account: number,
|
|
14
|
+
index: number
|
|
15
|
+
): string;
|
|
16
|
+
|
|
10
17
|
getDerivationMode(address: string): string;
|
|
11
18
|
|
|
12
19
|
toOutputScript(address: string): Buffer;
|
|
@@ -8,15 +8,15 @@ import bs58check from "bs58check";
|
|
|
8
8
|
import coininfo from "coininfo";
|
|
9
9
|
import { InvalidAddress } from "@ledgerhq/errors";
|
|
10
10
|
import { DerivationModes } from "../types";
|
|
11
|
-
import { ICrypto } from "./types";
|
|
12
11
|
import Base from "./base";
|
|
13
12
|
|
|
14
|
-
class ZCash
|
|
13
|
+
class ZCash extends Base {
|
|
15
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
15
|
network: any;
|
|
17
16
|
|
|
18
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
18
|
constructor({ network }: { network: any }) {
|
|
19
|
+
super({ network });
|
|
20
20
|
this.network = network;
|
|
21
21
|
this.network.dustThreshold = 10000;
|
|
22
22
|
this.network.dustPolicy = "FIXED";
|
|
@@ -47,26 +47,13 @@ class ZCash implements ICrypto {
|
|
|
47
47
|
return address.toString();
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
customGetAddress(
|
|
51
51
|
derivationMode: string,
|
|
52
52
|
xpub: string,
|
|
53
53
|
account: number,
|
|
54
54
|
index: number
|
|
55
55
|
): string {
|
|
56
|
-
|
|
57
|
-
Base.addressCache[
|
|
58
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
59
|
-
]
|
|
60
|
-
) {
|
|
61
|
-
return Base.addressCache[
|
|
62
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
63
|
-
];
|
|
64
|
-
}
|
|
65
|
-
const address = this.getLegacyAddress(xpub, account, index);
|
|
66
|
-
Base.addressCache[
|
|
67
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
68
|
-
] = address;
|
|
69
|
-
return address;
|
|
56
|
+
return this.getLegacyAddress(xpub, account, index);
|
|
70
57
|
}
|
|
71
58
|
|
|
72
59
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -89,11 +76,6 @@ class ZCash implements ICrypto {
|
|
|
89
76
|
validateAddress(address: string): boolean {
|
|
90
77
|
return zec.Address.isValid(address, "livenet");
|
|
91
78
|
}
|
|
92
|
-
|
|
93
|
-
// eslint-disable-next-line
|
|
94
|
-
isTaprootAddress(address: string): boolean {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
79
|
}
|
|
98
80
|
|
|
99
81
|
export default ZCash;
|
|
@@ -8,15 +8,15 @@ import bs58check from "bs58check";
|
|
|
8
8
|
import coininfo from "coininfo";
|
|
9
9
|
import { InvalidAddress } from "@ledgerhq/errors";
|
|
10
10
|
import { DerivationModes } from "../types";
|
|
11
|
-
import { ICrypto } from "./types";
|
|
12
11
|
import Base from "./base";
|
|
13
12
|
|
|
14
|
-
class Zen
|
|
13
|
+
class Zen extends Base {
|
|
15
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
15
|
network: any;
|
|
17
16
|
|
|
18
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
18
|
constructor({ network }: { network: any }) {
|
|
19
|
+
super({ network });
|
|
20
20
|
// refer to https://github.com/HorizenOfficial/zen/blob/master/src/chainparams.cpp for the blockchain params
|
|
21
21
|
this.network = network;
|
|
22
22
|
this.network.versions = {
|
|
@@ -67,26 +67,13 @@ class Zen implements ICrypto {
|
|
|
67
67
|
return this.baddrToTaddr(bs58check.encode(Buffer.from(baddr)));
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
customGetAddress(
|
|
71
71
|
derivationMode: string,
|
|
72
72
|
xpub: string,
|
|
73
73
|
account: number,
|
|
74
74
|
index: number
|
|
75
75
|
): string {
|
|
76
|
-
|
|
77
|
-
Base.addressCache[
|
|
78
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
79
|
-
]
|
|
80
|
-
) {
|
|
81
|
-
return Base.addressCache[
|
|
82
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
83
|
-
];
|
|
84
|
-
}
|
|
85
|
-
const address = this.getLegacyAddress(xpub, account, index);
|
|
86
|
-
Base.addressCache[
|
|
87
|
-
`${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
|
|
88
|
-
] = address;
|
|
89
|
-
return address;
|
|
76
|
+
return this.getLegacyAddress(xpub, account, index);
|
|
90
77
|
}
|
|
91
78
|
|
|
92
79
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -122,11 +109,6 @@ class Zen implements ICrypto {
|
|
|
122
109
|
(res[1] === 0x89 || res[1] === 0x96)
|
|
123
110
|
);
|
|
124
111
|
}
|
|
125
|
-
|
|
126
|
-
// eslint-disable-next-line
|
|
127
|
-
isTaprootAddress(address: string): boolean {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
112
|
}
|
|
131
113
|
|
|
132
114
|
export default Zen;
|
|
@@ -239,6 +239,12 @@ class BitcoinLikeExplorer extends EventEmitter implements IExplorer {
|
|
|
239
239
|
// @ts-ignore
|
|
240
240
|
// eslint-disable-next-line no-param-reassign
|
|
241
241
|
delete tx.confirmations;
|
|
242
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
243
|
+
// @ts-ignore
|
|
244
|
+
delete tx.id;
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
246
|
+
// @ts-ignore
|
|
247
|
+
delete tx.lock_time;
|
|
242
248
|
|
|
243
249
|
// eslint-disable-next-line no-param-reassign
|
|
244
250
|
tx.account = address.account;
|
|
@@ -246,7 +252,21 @@ class BitcoinLikeExplorer extends EventEmitter implements IExplorer {
|
|
|
246
252
|
tx.index = address.index;
|
|
247
253
|
// eslint-disable-next-line no-param-reassign
|
|
248
254
|
tx.address = address.address;
|
|
255
|
+
tx.inputs.forEach((input) => {
|
|
256
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
257
|
+
// @ts-ignore
|
|
258
|
+
delete input.txinwitness;
|
|
259
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
260
|
+
// @ts-ignore
|
|
261
|
+
delete input.script_signature;
|
|
262
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
263
|
+
// @ts-ignore
|
|
264
|
+
delete input.input_index;
|
|
265
|
+
});
|
|
249
266
|
tx.outputs.forEach((output) => {
|
|
267
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
268
|
+
// @ts-ignore
|
|
269
|
+
delete output.script_hex;
|
|
250
270
|
// eslint-disable-next-line no-param-reassign
|
|
251
271
|
output.output_hash = tx.hash;
|
|
252
272
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
import network from "../../../network";
|
|
3
|
+
import { getEnv } from "../../../env";
|
|
4
|
+
import { Operation, OperationType } from "../../../types";
|
|
5
|
+
import { encodeOperationId } from "../../../operation";
|
|
6
|
+
|
|
7
|
+
const DEFAULT_TRANSACTIONS_LIMIT = 200;
|
|
8
|
+
const getUrl = (route): string => `${getEnv("API_CELO_INDEXER")}${route || ""}`;
|
|
9
|
+
|
|
10
|
+
// Indexer returns both account data and transactions in one call.
|
|
11
|
+
// Transactions are just limited, there's no block height offset
|
|
12
|
+
const fetchAccountDetails = async (
|
|
13
|
+
address: string,
|
|
14
|
+
transactionsLimit: number = DEFAULT_TRANSACTIONS_LIMIT
|
|
15
|
+
) => {
|
|
16
|
+
const { data } = await network({
|
|
17
|
+
method: "GET",
|
|
18
|
+
url: getUrl(`/account_details/${address}?limit=${transactionsLimit}`),
|
|
19
|
+
});
|
|
20
|
+
return data;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const fetchStatus = async () => {
|
|
24
|
+
const { data } = await network({
|
|
25
|
+
method: "GET",
|
|
26
|
+
url: getUrl(`/status`),
|
|
27
|
+
});
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getOperationType = (type: string): OperationType => {
|
|
32
|
+
switch (type) {
|
|
33
|
+
case "InternalTransferSent":
|
|
34
|
+
return "OUT";
|
|
35
|
+
case "InternalTransferReceived":
|
|
36
|
+
return "IN";
|
|
37
|
+
case "AccountSlashed":
|
|
38
|
+
return "SLASH";
|
|
39
|
+
default:
|
|
40
|
+
return "NONE";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const transactionToOperation = (
|
|
45
|
+
address: string,
|
|
46
|
+
accountId: string,
|
|
47
|
+
transaction
|
|
48
|
+
): Operation => {
|
|
49
|
+
const type: OperationType = getOperationType(transaction.kind);
|
|
50
|
+
const hasFailed = transaction.data.success
|
|
51
|
+
? !transaction.data.success
|
|
52
|
+
: false;
|
|
53
|
+
const senders = transaction.data.from ? [transaction.data.from] : [];
|
|
54
|
+
const recipients = transaction.data.to ? [transaction.data.to] : [];
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
id: encodeOperationId(accountId, transaction.transaction_hash, type),
|
|
58
|
+
hash: transaction.transaction_hash,
|
|
59
|
+
accountId,
|
|
60
|
+
fee: new BigNumber(0),
|
|
61
|
+
value: new BigNumber(transaction.amount),
|
|
62
|
+
type,
|
|
63
|
+
blockHeight: transaction.height,
|
|
64
|
+
date: new Date(transaction.time),
|
|
65
|
+
senders,
|
|
66
|
+
recipients,
|
|
67
|
+
hasFailed,
|
|
68
|
+
blockHash: null,
|
|
69
|
+
extra: {},
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const getAccountDetails = async (address: string, accountId: string) => {
|
|
74
|
+
const accountDetails = await fetchAccountDetails(address);
|
|
75
|
+
const spendableBalance = new BigNumber(accountDetails.gold_balance);
|
|
76
|
+
const lockedBalance = new BigNumber(accountDetails.total_locked_gold);
|
|
77
|
+
const balance = spendableBalance.plus(lockedBalance);
|
|
78
|
+
const indexerStatus = await fetchStatus();
|
|
79
|
+
|
|
80
|
+
const allTransactions = accountDetails.internal_transfers.concat(
|
|
81
|
+
accountDetails.transactions
|
|
82
|
+
);
|
|
83
|
+
const operations = allTransactions.map((transaction) =>
|
|
84
|
+
transactionToOperation(address, accountId, transaction)
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
blockHeight: indexerStatus.last_indexed_height,
|
|
89
|
+
balance,
|
|
90
|
+
spendableBalance,
|
|
91
|
+
operations,
|
|
92
|
+
};
|
|
93
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getAccountDetails } from "./hubble";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AccountBridge, CurrencyBridge } from "../../../types";
|
|
2
|
+
import type { Transaction } from "../types";
|
|
3
|
+
import { makeAccountBridgeReceive } from "../../../bridge/jsHelpers";
|
|
4
|
+
import { sync, scanAccounts } from "../js-synchronisation";
|
|
5
|
+
import signOperation from "../js-signOperation";
|
|
6
|
+
import getTransactionStatus from "../js-getTransactionStatus";
|
|
7
|
+
import broadcast from "../js-broadcast";
|
|
8
|
+
import estimateMaxSpendable from "../js-estimateMaxSpendable";
|
|
9
|
+
import prepareTransaction from "../js-prepareTransaction";
|
|
10
|
+
import createTransaction from "../js-createTransaction";
|
|
11
|
+
|
|
12
|
+
const updateTransaction = (t, patch) => ({ ...t, ...patch });
|
|
13
|
+
|
|
14
|
+
const receive = makeAccountBridgeReceive();
|
|
15
|
+
|
|
16
|
+
const preload = async () => Promise.resolve({});
|
|
17
|
+
const hydrate = (): void => {};
|
|
18
|
+
|
|
19
|
+
const currencyBridge: CurrencyBridge = {
|
|
20
|
+
preload,
|
|
21
|
+
hydrate,
|
|
22
|
+
scanAccounts,
|
|
23
|
+
};
|
|
24
|
+
const accountBridge: AccountBridge<Transaction> = {
|
|
25
|
+
estimateMaxSpendable,
|
|
26
|
+
createTransaction,
|
|
27
|
+
updateTransaction,
|
|
28
|
+
getTransactionStatus,
|
|
29
|
+
prepareTransaction,
|
|
30
|
+
sync,
|
|
31
|
+
receive,
|
|
32
|
+
signOperation,
|
|
33
|
+
broadcast,
|
|
34
|
+
};
|
|
35
|
+
export default {
|
|
36
|
+
currencyBridge,
|
|
37
|
+
accountBridge,
|
|
38
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import flatMap from "lodash/flatMap";
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
Transaction,
|
|
6
|
+
Account,
|
|
7
|
+
AccountLike,
|
|
8
|
+
AccountLikeArray,
|
|
9
|
+
} from "../../types";
|
|
10
|
+
|
|
11
|
+
const options = [];
|
|
12
|
+
|
|
13
|
+
function inferAccounts(account: Account): AccountLikeArray {
|
|
14
|
+
invariant(account.currency.family === "celo", "celo family");
|
|
15
|
+
|
|
16
|
+
const accounts: Account[] = [account];
|
|
17
|
+
return accounts;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function inferTransactions(
|
|
21
|
+
transactions: Array<{
|
|
22
|
+
account: AccountLike;
|
|
23
|
+
transaction: Transaction;
|
|
24
|
+
mainAccount: Account;
|
|
25
|
+
}>
|
|
26
|
+
): Transaction[] {
|
|
27
|
+
return flatMap(transactions, ({ transaction }) => {
|
|
28
|
+
invariant(transaction.family === "celo", "celo family");
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
...transaction,
|
|
32
|
+
family: "celo",
|
|
33
|
+
} as Transaction;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default {
|
|
38
|
+
options,
|
|
39
|
+
inferAccounts,
|
|
40
|
+
inferTransactions,
|
|
41
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CurrenciesData } from "../../../types";
|
|
2
|
+
import type { Transaction } from "../types";
|
|
3
|
+
|
|
4
|
+
const dataset: CurrenciesData<Transaction> = {
|
|
5
|
+
scanAccounts: [
|
|
6
|
+
{
|
|
7
|
+
name: "celo seed 1",
|
|
8
|
+
apdus: `
|
|
9
|
+
=> e002000009028000002c8000ce10
|
|
10
|
+
<= 41040106794f46b69e1ae56dff904510959e59074a37341f8cc740e9ce7a0b24421c42e7023481f5ef03926739baa6bb26cac7bf48f249a24793264711d48499499528433235323935323541463035434134313939633236413838623438393463383342303330433733399000
|
|
11
|
+
=> e002000015058000002c8000ce10800000000000000000000000
|
|
12
|
+
<= 41044f4998c3f81966645f25e95082f9fe7d104b1ba4286486a8ecd8fd11f79ef02bd8110f086b390a418ab619a650f3df59a3c84912ce1ea125386d7aa7732fcd0b28393634313334336638346535304143304334434133626644313244433063346231653732363544359000
|
|
13
|
+
=> e002000015058000002c8000ce10800000010000000000000000
|
|
14
|
+
<= 4104630b6447b0f690520a5612f1dc57da90b84f6b59dfeb375bed1113fb34a8d0f9181ec63e40f9fde05761084dbd022ba76711eb2b36442cf4b5d2bc19def9156428343435306565646238623532333931354534393639633239646241653944354563303646453837349000
|
|
15
|
+
`,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default dataset;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DeviceTransactionField } from "../../transaction";
|
|
2
|
+
|
|
3
|
+
function getDeviceTransactionConfig(): Array<DeviceTransactionField> {
|
|
4
|
+
const fields: Array<DeviceTransactionField> = [];
|
|
5
|
+
|
|
6
|
+
fields.push({
|
|
7
|
+
type: "amount",
|
|
8
|
+
label: "Amount",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
fields.push({
|
|
12
|
+
type: "fees",
|
|
13
|
+
label: "Fees",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return fields;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default getDeviceTransactionConfig;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type Transport from "@ledgerhq/hw-transport";
|
|
2
|
+
import { decode, encode } from "rlp";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Heavily inspiried by celo-web-wallet
|
|
6
|
+
* https://github.com/celo-tools/celo-web-wallet/blob/master/src/features/ledger/CeloLedgerApp.ts
|
|
7
|
+
*/
|
|
8
|
+
export class CeloApp {
|
|
9
|
+
transport: Transport;
|
|
10
|
+
|
|
11
|
+
constructor(transport: any) {
|
|
12
|
+
this.transport = transport;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async signTransaction(
|
|
16
|
+
path: string,
|
|
17
|
+
rawTxHex: string
|
|
18
|
+
): Promise<{
|
|
19
|
+
s: string;
|
|
20
|
+
v: string;
|
|
21
|
+
r: string;
|
|
22
|
+
}> {
|
|
23
|
+
const paths = splitPath(path);
|
|
24
|
+
const rawTx = Buffer.from(rawTxHex, "hex");
|
|
25
|
+
let offset = 0;
|
|
26
|
+
let response;
|
|
27
|
+
|
|
28
|
+
const rlpTx = decode(rawTx);
|
|
29
|
+
let rlpOffset = 0;
|
|
30
|
+
if (rlpTx.length > 6) {
|
|
31
|
+
const rlpVrs = encode(rlpTx.slice(-3));
|
|
32
|
+
rlpOffset = rawTx.length - (rlpVrs.length - 1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
while (offset !== rawTx.length) {
|
|
36
|
+
const first = offset === 0;
|
|
37
|
+
const maxChunkSize = first ? 150 - 1 - paths.length * 4 : 150;
|
|
38
|
+
let chunkSize =
|
|
39
|
+
offset + maxChunkSize > rawTx.length
|
|
40
|
+
? rawTx.length - offset
|
|
41
|
+
: maxChunkSize;
|
|
42
|
+
if (rlpOffset != 0 && offset + chunkSize == rlpOffset) {
|
|
43
|
+
// Make sure that the chunk doesn't end right on the EIP 155 marker if set
|
|
44
|
+
chunkSize--;
|
|
45
|
+
}
|
|
46
|
+
const buffer = Buffer.alloc(
|
|
47
|
+
first ? 1 + paths.length * 4 + chunkSize : chunkSize
|
|
48
|
+
);
|
|
49
|
+
if (first) {
|
|
50
|
+
buffer[0] = paths.length;
|
|
51
|
+
paths.forEach((element, index) => {
|
|
52
|
+
buffer.writeUInt32BE(element, 1 + 4 * index);
|
|
53
|
+
});
|
|
54
|
+
rawTx.copy(buffer, 1 + 4 * paths.length, offset, offset + chunkSize);
|
|
55
|
+
} else {
|
|
56
|
+
rawTx.copy(buffer, 0, offset, offset + chunkSize);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
response = await this.transport
|
|
60
|
+
.send(0xe0, 0x04, first ? 0x00 : 0x80, 0x00, buffer)
|
|
61
|
+
.catch((e) => {
|
|
62
|
+
throw e;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
offset += chunkSize;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const v = response.slice(0, 1).toString("hex");
|
|
69
|
+
const r = response.slice(1, 1 + 32).toString("hex");
|
|
70
|
+
const s = response.slice(1 + 32, 1 + 32 + 32).toString("hex");
|
|
71
|
+
return { v, r, s };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
provideERC20TokenInformation({ data }: { data: Buffer }): Promise<boolean> {
|
|
75
|
+
return provideERC20TokenInformation(this.transport, data);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function splitPath(path: string): number[] {
|
|
80
|
+
const result: number[] = [];
|
|
81
|
+
const components = path.split("/");
|
|
82
|
+
components.forEach((element) => {
|
|
83
|
+
let number = parseInt(element, 10);
|
|
84
|
+
if (isNaN(number)) {
|
|
85
|
+
return; // FIXME shouldn't it throws instead?
|
|
86
|
+
}
|
|
87
|
+
if (element.length > 1 && element[element.length - 1] === "'") {
|
|
88
|
+
number += 0x80000000;
|
|
89
|
+
}
|
|
90
|
+
result.push(number);
|
|
91
|
+
});
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function provideERC20TokenInformation(
|
|
96
|
+
transport: Transport,
|
|
97
|
+
data: Buffer
|
|
98
|
+
): Promise<boolean> {
|
|
99
|
+
return transport.send(0xe0, 0x0a, 0x00, 0x00, data).then(
|
|
100
|
+
() => true,
|
|
101
|
+
(e) => {
|
|
102
|
+
if (e && e.statusCode === 0x6d00) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
throw e;
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "../ethereum/hw-getAddress";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { patchOperationWithHash } from "../../operation";
|
|
2
|
+
import { celoKit } from "./api/sdk";
|
|
3
|
+
|
|
4
|
+
const broadcast = async ({ signedOperation: { operation, signature } }) => {
|
|
5
|
+
const kit = celoKit();
|
|
6
|
+
const { transactionHash } = await kit.web3.eth.sendSignedTransaction(
|
|
7
|
+
signature
|
|
8
|
+
);
|
|
9
|
+
return patchOperationWithHash(operation, transactionHash);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default broadcast;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Transaction } from "./types";
|
|
2
|
+
import type { Account } from "../../types";
|
|
3
|
+
import { CeloTx } from "@celo/connect";
|
|
4
|
+
import { celoKit } from "./api/sdk";
|
|
5
|
+
|
|
6
|
+
const buildTransaction = async (account: Account, transaction: Transaction) => {
|
|
7
|
+
const kit = celoKit();
|
|
8
|
+
const { amount } = transaction;
|
|
9
|
+
const value = transaction.useAllAmount
|
|
10
|
+
? account.spendableBalance.minus(transaction.fees || 0)
|
|
11
|
+
: amount;
|
|
12
|
+
|
|
13
|
+
const celoToken = await kit.contracts.getGoldToken();
|
|
14
|
+
|
|
15
|
+
const celoTransaction = {
|
|
16
|
+
from: account.freshAddress,
|
|
17
|
+
to: celoToken.address,
|
|
18
|
+
data: celoToken
|
|
19
|
+
.transfer(transaction.recipient, value.toFixed())
|
|
20
|
+
.txo.encodeABI(),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
...celoTransaction,
|
|
25
|
+
chainId: await kit.connection.chainId(),
|
|
26
|
+
nonce: await kit.connection.nonce(account.freshAddress),
|
|
27
|
+
gas: await kit.connection.estimateGasWithInflationFactor(celoTransaction),
|
|
28
|
+
gasPrice: await kit.connection.gasPrice(),
|
|
29
|
+
} as CeloTx;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default buildTransaction;
|