@ledgerhq/live-common 27.3.2 → 27.4.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/environment.test.d.ts +2 -0
- package/lib/__tests__/environment.test.d.ts.map +1 -0
- package/lib/__tests__/environment.test.js +13 -0
- package/lib/__tests__/environment.test.js.map +1 -0
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.js +0 -31
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.js.map +1 -1
- package/lib/account/support.d.ts.map +1 -1
- package/lib/account/support.js +3 -2
- package/lib/account/support.js.map +1 -1
- package/lib/apps/hw.d.ts +4 -1
- package/lib/apps/hw.d.ts.map +1 -1
- package/lib/apps/hw.js +10 -4
- package/lib/apps/hw.js.map +1 -1
- package/lib/apps/mock.d.ts +1 -0
- package/lib/apps/mock.d.ts.map +1 -1
- package/lib/apps/mock.js +24 -2
- package/lib/apps/mock.js.map +1 -1
- package/lib/apps/runner.d.ts +8 -1
- package/lib/apps/runner.d.ts.map +1 -1
- package/lib/apps/runner.js +15 -3
- package/lib/apps/runner.js.map +1 -1
- package/lib/bot/engine.d.ts.map +1 -1
- package/lib/bot/engine.js +5 -2
- package/lib/bot/engine.js.map +1 -1
- package/lib/bot/index.d.ts.map +1 -1
- package/lib/bot/index.js +5 -3
- package/lib/bot/index.js.map +1 -1
- package/lib/bot/types.d.ts +2 -0
- package/lib/bot/types.d.ts.map +1 -1
- 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 +3 -1
- package/lib/data/icons/react/index.js.map +1 -1
- package/lib/data/icons/react/yae.d.ts +8 -0
- package/lib/data/icons/react/yae.d.ts.map +1 -0
- package/lib/data/icons/react/yae.js +36 -0
- package/lib/data/icons/react/yae.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 +3 -1
- package/lib/data/icons/reactNative/index.js.map +1 -1
- package/lib/data/icons/reactNative/yae.d.ts +8 -0
- package/lib/data/icons/reactNative/yae.d.ts.map +1 -0
- package/lib/data/icons/reactNative/yae.js +37 -0
- package/lib/data/icons/reactNative/yae.js.map +1 -0
- package/lib/exchange/hw-app-exchange/Exchange.js +4 -4
- package/lib/families/bitcoin/account.d.ts.map +1 -1
- package/lib/families/bitcoin/bech32m.d.ts +2 -8
- package/lib/families/bitcoin/bech32m.d.ts.map +1 -1
- package/lib/families/bitcoin/bridge/js.d.ts.map +1 -1
- package/lib/families/bitcoin/bridge/js.js.map +1 -1
- package/lib/families/bitcoin/bridge/mock.d.ts.map +1 -1
- package/lib/families/bitcoin/bridge/mock.js.map +1 -1
- package/lib/families/bitcoin/cache.d.ts +2 -15
- package/lib/families/bitcoin/cache.d.ts.map +1 -1
- package/lib/families/bitcoin/js-getFeesForTransaction.d.ts +2 -15
- package/lib/families/bitcoin/js-getFeesForTransaction.d.ts.map +1 -1
- package/lib/families/bitcoin/js-synchronisation.d.ts.map +1 -1
- package/lib/families/bitcoin/js-synchronisation.js.map +1 -1
- package/lib/families/bitcoin/logic.d.ts +1 -1
- package/lib/families/bitcoin/logic.d.ts.map +1 -1
- package/lib/families/bitcoin/logic.js.map +1 -1
- package/lib/families/bitcoin/presync.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts +0 -2
- package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/base.js +0 -16
- package/lib/families/bitcoin/wallet-btc/crypto/base.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bip32.d.ts +4 -3
- package/lib/families/bitcoin/wallet-btc/crypto/bip32.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bip32.js +3 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bip32.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.d.ts +2 -3
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js +0 -7
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/factory.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/factory.js +0 -3
- package/lib/families/bitcoin/wallet-btc/crypto/factory.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/litecoin.d.ts +2 -3
- package/lib/families/bitcoin/wallet-btc/crypto/litecoin.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js +0 -16
- package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/types.d.ts +0 -1
- package/lib/families/bitcoin/wallet-btc/crypto/types.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts +0 -2
- package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zec.js +0 -5
- package/lib/families/bitcoin/wallet-btc/crypto/zec.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts +0 -2
- package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/zen.js +0 -5
- package/lib/families/bitcoin/wallet-btc/crypto/zen.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/explorer/index.d.ts +11 -5
- package/lib/families/bitcoin/wallet-btc/explorer/index.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/explorer/index.js +8 -40
- package/lib/families/bitcoin/wallet-btc/explorer/index.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/pickingstrategies/CoinSelect.d.ts +1 -1
- package/lib/families/bitcoin/wallet-btc/pickingstrategies/CoinSelect.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/pickingstrategies/CoinSelect.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/pickingstrategies/DeepFirst.d.ts +1 -1
- package/lib/families/bitcoin/wallet-btc/pickingstrategies/DeepFirst.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/pickingstrategies/DeepFirst.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/pickingstrategies/Merge.d.ts +1 -1
- package/lib/families/bitcoin/wallet-btc/pickingstrategies/Merge.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/pickingstrategies/Merge.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/index.d.ts +1 -5
- package/lib/families/bitcoin/wallet-btc/storage/index.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/index.js +7 -9
- package/lib/families/bitcoin/wallet-btc/storage/index.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/utils.d.ts +3 -3
- package/lib/families/bitcoin/wallet-btc/utils.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/utils.js +2 -11
- package/lib/families/bitcoin/wallet-btc/utils.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/wallet.d.ts +10 -7
- package/lib/families/bitcoin/wallet-btc/wallet.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/wallet.js +1 -18
- package/lib/families/bitcoin/wallet-btc/wallet.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/xpub.d.ts +1 -9
- package/lib/families/bitcoin/wallet-btc/xpub.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/xpub.js +60 -208
- package/lib/families/bitcoin/wallet-btc/xpub.js.map +1 -1
- package/lib/families/cardano/js-synchronisation.js +1 -1
- package/lib/families/cardano/js-synchronisation.js.map +1 -1
- package/lib/families/cardano/specs.js +1 -1
- package/lib/families/celo/specs/createSendMutation.d.ts.map +1 -1
- package/lib/families/celo/specs/createSendMutation.js +0 -2
- package/lib/families/celo/specs/createSendMutation.js.map +1 -1
- package/lib/families/celo/specs.js +1 -1
- package/lib/families/crypto_org/specs.d.ts.map +1 -1
- package/lib/families/crypto_org/specs.js +3 -2
- package/lib/families/crypto_org/specs.js.map +1 -1
- package/lib/families/ethereum/specs.js +1 -1
- package/lib/families/evm/specs.js +1 -1
- package/lib/families/filecoin/specs.d.ts.map +1 -1
- package/lib/families/filecoin/specs.js +1 -2
- package/lib/families/filecoin/specs.js.map +1 -1
- package/lib/families/hedera/api/network.d.ts.map +1 -1
- package/lib/families/hedera/api/network.js +16 -8
- package/lib/families/hedera/api/network.js.map +1 -1
- package/lib/families/hedera/errors.d.ts +4 -0
- package/lib/families/hedera/errors.d.ts.map +1 -0
- package/lib/families/hedera/errors.js +6 -0
- package/lib/families/hedera/errors.js.map +1 -0
- package/lib/families/hedera/specs.d.ts.map +1 -1
- package/lib/families/hedera/specs.js +0 -11
- package/lib/families/hedera/specs.js.map +1 -1
- package/lib/families/osmosis/specs.js +1 -1
- package/lib/families/polkadot/specs.d.ts.map +1 -1
- package/lib/families/polkadot/specs.js +1 -0
- package/lib/families/polkadot/specs.js.map +1 -1
- package/lib/families/solana/specs.d.ts.map +1 -1
- package/lib/families/solana/specs.js +1 -0
- 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/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +6 -0
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/hw/actions/app.d.ts +7 -0
- package/lib/hw/actions/app.d.ts.map +1 -1
- package/lib/hw/actions/app.js +25 -11
- package/lib/hw/actions/app.js.map +1 -1
- package/lib/hw/connectApp.d.ts +4 -0
- package/lib/hw/connectApp.d.ts.map +1 -1
- package/lib/hw/connectApp.js +10 -1
- package/lib/hw/connectApp.js.map +1 -1
- package/lib/manager/localization.d.ts +1 -1
- package/lib/manager/localization.d.ts.map +1 -1
- package/lib/manager/localization.js +1 -1
- package/lib/manager/localization.js.map +1 -1
- package/lib/rxjs/operators/retryWithDelay.d.ts +12 -0
- package/lib/rxjs/operators/retryWithDelay.d.ts.map +1 -0
- package/lib/rxjs/operators/retryWithDelay.js +28 -0
- package/lib/rxjs/operators/retryWithDelay.js.map +1 -0
- package/lib/rxjs/operators/throwIf.d.ts +23 -0
- package/lib/rxjs/operators/throwIf.d.ts.map +1 -0
- package/lib/rxjs/operators/throwIf.js +37 -0
- package/lib/rxjs/operators/throwIf.js.map +1 -0
- package/package.json +5 -5
- package/src/__tests__/environment.test.ts +12 -0
- package/src/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.ts +0 -33
- package/src/account/support.ts +3 -2
- package/src/apps/hw.ts +17 -4
- package/src/apps/mock.ts +24 -2
- package/src/apps/runner.ts +28 -4
- package/src/bot/engine.ts +9 -1
- package/src/bot/index.ts +7 -2
- package/src/bot/types.ts +3 -0
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +33 -0
- package/src/data/icons/react/index.tsx +1 -0
- package/src/data/icons/react/yae.tsx +14 -0
- package/src/data/icons/reactNative/index.tsx +1 -0
- package/src/data/icons/reactNative/yae.tsx +15 -0
- package/src/data/icons/svg/YAE.svg +4 -0
- package/src/exchange/hw-app-exchange/Exchange.ts +4 -4
- package/src/families/algorand/__snapshots__/bridge.integration.test.ts.snap +807 -27
- package/src/families/bitcoin/account.ts +1 -1
- package/src/families/bitcoin/bech32m.ts +2 -2
- package/src/families/bitcoin/bridge/js.ts +6 -3
- package/src/families/bitcoin/bridge/mock.ts +6 -2
- package/src/families/bitcoin/js-getFeesForTransaction.ts +1 -1
- package/src/families/bitcoin/js-synchronisation.ts +0 -1
- package/src/families/bitcoin/logic.ts +5 -2
- package/src/families/bitcoin/presync.ts +1 -1
- package/src/families/bitcoin/specs.ts +1 -1
- package/src/families/bitcoin/wallet-btc/crypto/base.ts +0 -20
- package/src/families/bitcoin/wallet-btc/crypto/bip32.ts +6 -5
- package/src/families/bitcoin/wallet-btc/crypto/bitcoincash.ts +1 -9
- package/src/families/bitcoin/wallet-btc/crypto/factory.ts +1 -4
- package/src/families/bitcoin/wallet-btc/crypto/litecoin.ts +1 -20
- package/src/families/bitcoin/wallet-btc/crypto/types.ts +0 -3
- package/src/families/bitcoin/wallet-btc/crypto/zec.ts +1 -7
- package/src/families/bitcoin/wallet-btc/crypto/zen.ts +1 -7
- package/src/families/bitcoin/wallet-btc/explorer/index.ts +24 -49
- package/src/families/bitcoin/wallet-btc/pickingstrategies/CoinSelect.ts +6 -1
- package/src/families/bitcoin/wallet-btc/pickingstrategies/DeepFirst.ts +6 -1
- package/src/families/bitcoin/wallet-btc/pickingstrategies/Merge.ts +6 -1
- package/src/families/bitcoin/wallet-btc/storage/index.ts +34 -20
- package/src/families/bitcoin/wallet-btc/utils.ts +16 -21
- package/src/families/bitcoin/wallet-btc/wallet.ts +17 -31
- package/src/families/bitcoin/wallet-btc/xpub.ts +41 -150
- package/src/families/cardano/js-synchronisation.ts +1 -1
- package/src/families/cardano/specs.ts +1 -1
- package/src/families/celo/specs/createSendMutation.ts +1 -3
- package/src/families/celo/specs.ts +1 -1
- package/src/families/crypto_org/specs.ts +3 -2
- package/src/families/ethereum/specs.ts +1 -1
- package/src/families/evm/specs.ts +1 -1
- package/src/families/filecoin/__snapshots__/bridge.integration.test.ts.snap +24 -2
- package/src/families/filecoin/specs.ts +1 -2
- package/src/families/hedera/api/network.ts +10 -3
- package/src/families/hedera/errors.ts +5 -0
- package/src/families/hedera/specs.ts +0 -17
- package/src/families/osmosis/__snapshots__/bridge.integration.test.ts.snap +101 -3
- package/src/families/osmosis/specs.ts +1 -1
- package/src/families/polkadot/specs.ts +1 -0
- package/src/families/solana/specs.ts +1 -0
- package/src/families/tezos/bakers.whitelist-default.ts +0 -2
- package/src/families/tezos/bridge/js.ts +4 -1
- package/src/featureFlags/defaultFeatures.ts +6 -0
- package/src/hw/actions/app.ts +35 -4
- package/src/hw/connectApp.ts +18 -1
- package/src/manager/localization.ts +2 -2
- package/src/rxjs/operators/retryWithDelay.ts +36 -0
- package/src/rxjs/operators/throwIf.ts +40 -0
- package/lib/families/bitcoin/wallet-btc/utils/eventemitter.d.ts +0 -6
- package/lib/families/bitcoin/wallet-btc/utils/eventemitter.d.ts.map +0 -1
- package/lib/families/bitcoin/wallet-btc/utils/eventemitter.js +0 -64
- package/lib/families/bitcoin/wallet-btc/utils/eventemitter.js.map +0 -1
- package/src/families/bitcoin/wallet-btc/utils/eventemitter.ts +0 -9
|
@@ -50,7 +50,7 @@ const osmosis: AppSpec<Transaction> = {
|
|
|
50
50
|
appName: "Cosmos",
|
|
51
51
|
},
|
|
52
52
|
genericDeviceAction: acceptTransaction,
|
|
53
|
-
testTimeout:
|
|
53
|
+
testTimeout: 8 * 60 * 1000,
|
|
54
54
|
minViableAmount: minimalAmount,
|
|
55
55
|
transactionCheck: ({ maxSpendable }) => {
|
|
56
56
|
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
|
|
@@ -71,6 +71,7 @@ const polkadot: AppSpec<Transaction> = {
|
|
|
71
71
|
invariant((account as PolkadotAccount).polkadotResources, "polkadot");
|
|
72
72
|
const sibling = pickSiblings(siblings, maxAccounts);
|
|
73
73
|
let amount = account.spendableBalance
|
|
74
|
+
.minus(EXISTENTIAL_DEPOSIT)
|
|
74
75
|
.div(1.9 + 0.2 * Math.random())
|
|
75
76
|
.integerValue();
|
|
76
77
|
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
const whitelist = `\
|
|
3
3
|
tz1WCd2jm4uSt4vntk4vSuUWoZQGhLcDuR9q
|
|
4
4
|
tz1Scdr2HsZiQjc7bHMeBbmDRXYVvdhjJbBh
|
|
5
|
-
tz1VmiY38m3y95HqQLjMwqnMS7sdMfGomzKi
|
|
6
5
|
tz1g8vkmcde6sWKaG2NN9WKzCkDM6Rziq194
|
|
7
6
|
tz1PWCDnz783NNGGQjEFFsHtrcK5yBW4E2rm
|
|
8
7
|
tz1d6Fx42mYgVFnHUW8T8A7WBfJ6nD9pVok8
|
|
9
8
|
tz1RV1MBbZMR68tacosb7Mwj6LkbPSUS1er1
|
|
10
9
|
tz1KfEsrtDaA1sX7vdM4qmEPWuSytuqCDp5j
|
|
11
|
-
tz1QLXqnfN51dkjeghXvKHkJfhvGiM5gK4tc
|
|
12
10
|
tz1V4qCyvPKZ5UeqdH14HN42rxvNPQfc9UZg
|
|
13
11
|
tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6
|
|
14
12
|
tz1Ldzz6k1BHdhuKvAtMRX7h5kJSMHESMHLC
|
|
@@ -140,7 +140,10 @@ const getTransactionStatus = async (
|
|
|
140
140
|
log("taquitoerror", String(t.taquitoError));
|
|
141
141
|
|
|
142
142
|
// remap taquito errors
|
|
143
|
-
if (
|
|
143
|
+
if (
|
|
144
|
+
t.taquitoError.endsWith("balance_too_low") ||
|
|
145
|
+
t.taquitoError.endsWith("subtraction_underflow")
|
|
146
|
+
) {
|
|
144
147
|
if (t.mode === "send") {
|
|
145
148
|
resetTotalSpent = true;
|
|
146
149
|
errors.amount = new NotEnoughBalance();
|
|
@@ -53,6 +53,12 @@ export const defaultFeatures: DefaultFeatures = {
|
|
|
53
53
|
currencyFlareMobile: {
|
|
54
54
|
enabled: false,
|
|
55
55
|
},
|
|
56
|
+
deviceInitialApps: {
|
|
57
|
+
enabled: false,
|
|
58
|
+
params: {
|
|
59
|
+
apps: ["Boilerplate", "Boilerplate_2", "Boilerplate_3"],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
56
62
|
ratings: {
|
|
57
63
|
enabled: false,
|
|
58
64
|
params: {
|
package/src/hw/actions/app.ts
CHANGED
|
@@ -37,6 +37,7 @@ import { useReplaySubject } from "../../observable";
|
|
|
37
37
|
import { getAccountName } from "../../account";
|
|
38
38
|
import type { Device, Action } from "./types";
|
|
39
39
|
import { shouldUpgrade } from "../../apps";
|
|
40
|
+
import { AppOp } from "../../apps/types";
|
|
40
41
|
import { ConnectAppTimeout } from "../../errors";
|
|
41
42
|
import perFamilyAccount from "../../generated/account";
|
|
42
43
|
import type {
|
|
@@ -81,6 +82,11 @@ type State = {
|
|
|
81
82
|
installingApp?: boolean;
|
|
82
83
|
progress?: number;
|
|
83
84
|
listingApps?: boolean;
|
|
85
|
+
|
|
86
|
+
request: AppRequest | undefined;
|
|
87
|
+
installQueue?: string[];
|
|
88
|
+
currentAppOp?: AppOp;
|
|
89
|
+
itemProgress?: number;
|
|
84
90
|
};
|
|
85
91
|
|
|
86
92
|
export type AppState = State & {
|
|
@@ -100,6 +106,7 @@ export type AppRequest = {
|
|
|
100
106
|
account?: Account;
|
|
101
107
|
tokenCurrency?: TokenCurrency;
|
|
102
108
|
dependencies?: AppRequest[];
|
|
109
|
+
withInlineInstallProgress?: boolean;
|
|
103
110
|
requireLatestFirmware?: boolean;
|
|
104
111
|
};
|
|
105
112
|
|
|
@@ -111,6 +118,7 @@ export type AppResult = {
|
|
|
111
118
|
account?: Account;
|
|
112
119
|
tokenCurrency?: TokenCurrency;
|
|
113
120
|
dependencies?: AppRequest[];
|
|
121
|
+
withInlineInstallProgress?: boolean;
|
|
114
122
|
requireLatestFirmware?: boolean;
|
|
115
123
|
};
|
|
116
124
|
|
|
@@ -145,7 +153,10 @@ const mapResult = ({
|
|
|
145
153
|
}
|
|
146
154
|
: null;
|
|
147
155
|
|
|
148
|
-
const getInitialState = (
|
|
156
|
+
const getInitialState = (
|
|
157
|
+
device?: Device | null | undefined,
|
|
158
|
+
request?: AppRequest
|
|
159
|
+
): State => ({
|
|
149
160
|
isLoading: !!device,
|
|
150
161
|
requestQuitApp: false,
|
|
151
162
|
requestOpenApp: null,
|
|
@@ -165,6 +176,11 @@ const getInitialState = (device?: Device | null | undefined): State => ({
|
|
|
165
176
|
displayUpgradeWarning: false,
|
|
166
177
|
installingApp: false,
|
|
167
178
|
listingApps: false,
|
|
179
|
+
|
|
180
|
+
request,
|
|
181
|
+
currentAppOp: undefined,
|
|
182
|
+
installQueue: [],
|
|
183
|
+
itemProgress: 0,
|
|
168
184
|
});
|
|
169
185
|
|
|
170
186
|
const reducer = (state: State, e: Event): State => {
|
|
@@ -180,10 +196,13 @@ const reducer = (state: State, e: Event): State => {
|
|
|
180
196
|
};
|
|
181
197
|
|
|
182
198
|
case "disconnected":
|
|
183
|
-
return {
|
|
199
|
+
return {
|
|
200
|
+
...getInitialState(null, state.request),
|
|
201
|
+
isLoading: !!e.expected,
|
|
202
|
+
};
|
|
184
203
|
|
|
185
204
|
case "deviceChange":
|
|
186
|
-
return { ...getInitialState(e.device), device: e.device };
|
|
205
|
+
return { ...getInitialState(e.device, state.request), device: e.device };
|
|
187
206
|
|
|
188
207
|
case "stream-install":
|
|
189
208
|
return {
|
|
@@ -205,6 +224,11 @@ const reducer = (state: State, e: Event): State => {
|
|
|
205
224
|
progress: e.progress || 0,
|
|
206
225
|
requestOpenApp: null,
|
|
207
226
|
listingApps: false,
|
|
227
|
+
|
|
228
|
+
request: state.request,
|
|
229
|
+
currentAppOp: e.currentAppOp,
|
|
230
|
+
itemProgress: e.itemProgress || 0,
|
|
231
|
+
installQueue: e.installQueue || [],
|
|
208
232
|
};
|
|
209
233
|
|
|
210
234
|
case "listing-apps":
|
|
@@ -212,11 +236,12 @@ const reducer = (state: State, e: Event): State => {
|
|
|
212
236
|
|
|
213
237
|
case "error":
|
|
214
238
|
return {
|
|
215
|
-
...getInitialState(e.device),
|
|
239
|
+
...getInitialState(e.device, state.request),
|
|
216
240
|
device: e.device || null,
|
|
217
241
|
error: e.error,
|
|
218
242
|
isLoading: false,
|
|
219
243
|
listingApps: false,
|
|
244
|
+
request: state.request,
|
|
220
245
|
};
|
|
221
246
|
|
|
222
247
|
case "ask-open-app":
|
|
@@ -236,6 +261,7 @@ const reducer = (state: State, e: Event): State => {
|
|
|
236
261
|
displayUpgradeWarning: false,
|
|
237
262
|
unresponsive: false,
|
|
238
263
|
requestOpenApp: e.appName,
|
|
264
|
+
request: state.request,
|
|
239
265
|
};
|
|
240
266
|
|
|
241
267
|
case "ask-quit-app":
|
|
@@ -255,6 +281,7 @@ const reducer = (state: State, e: Event): State => {
|
|
|
255
281
|
displayUpgradeWarning: false,
|
|
256
282
|
unresponsive: false,
|
|
257
283
|
requestQuitApp: true,
|
|
284
|
+
request: state.request,
|
|
258
285
|
};
|
|
259
286
|
|
|
260
287
|
case "device-permission-requested":
|
|
@@ -274,6 +301,7 @@ const reducer = (state: State, e: Event): State => {
|
|
|
274
301
|
allowOpeningRequestedWording: null,
|
|
275
302
|
allowManagerGranted: false,
|
|
276
303
|
allowManagerRequestedWording: e.wording,
|
|
304
|
+
request: state.request,
|
|
277
305
|
};
|
|
278
306
|
|
|
279
307
|
case "device-permission-granted":
|
|
@@ -293,6 +321,7 @@ const reducer = (state: State, e: Event): State => {
|
|
|
293
321
|
allowOpeningRequestedWording: null,
|
|
294
322
|
allowManagerGranted: true,
|
|
295
323
|
allowManagerRequestedWording: null,
|
|
324
|
+
request: state.request,
|
|
296
325
|
};
|
|
297
326
|
|
|
298
327
|
case "app-not-installed":
|
|
@@ -315,6 +344,7 @@ const reducer = (state: State, e: Event): State => {
|
|
|
315
344
|
appNames: e.appNames,
|
|
316
345
|
appName: e.appName,
|
|
317
346
|
},
|
|
347
|
+
request: state.request,
|
|
318
348
|
};
|
|
319
349
|
|
|
320
350
|
case "opened":
|
|
@@ -333,6 +363,7 @@ const reducer = (state: State, e: Event): State => {
|
|
|
333
363
|
opened: true,
|
|
334
364
|
appAndVersion: e.app,
|
|
335
365
|
derivation: e.derivation,
|
|
366
|
+
request: state.request,
|
|
336
367
|
displayUpgradeWarning:
|
|
337
368
|
state.device && e.app
|
|
338
369
|
? shouldUpgrade(state.device.modelId, e.app.name, e.app.version)
|
package/src/hw/connectApp.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import type Transport from "@ledgerhq/hw-transport";
|
|
14
14
|
import type { DeviceModelId } from "@ledgerhq/devices";
|
|
15
15
|
import type { DerivationMode } from "../derivation";
|
|
16
|
+
import type { AppOp } from "../apps/types";
|
|
16
17
|
import { getCryptoCurrencyById } from "../currencies";
|
|
17
18
|
import appSupportsQuitApp from "../appSupportsQuitApp";
|
|
18
19
|
import { withDevice } from "./deviceAccess";
|
|
@@ -75,6 +76,9 @@ export type ConnectAppEvent =
|
|
|
75
76
|
| {
|
|
76
77
|
type: "stream-install";
|
|
77
78
|
progress: number;
|
|
79
|
+
itemProgress: number;
|
|
80
|
+
currentAppOp: AppOp;
|
|
81
|
+
installQueue: string[];
|
|
78
82
|
}
|
|
79
83
|
| {
|
|
80
84
|
type: "listing-apps";
|
|
@@ -305,9 +309,13 @@ const cmd = ({
|
|
|
305
309
|
}
|
|
306
310
|
// check if we meet dependencies
|
|
307
311
|
if (dependencies?.length) {
|
|
312
|
+
const completesInDashboard = isDashboardName(appName);
|
|
308
313
|
return streamAppInstall({
|
|
309
314
|
transport,
|
|
310
|
-
appNames: [
|
|
315
|
+
appNames: [
|
|
316
|
+
...(completesInDashboard ? [] : [appName]),
|
|
317
|
+
...dependencies,
|
|
318
|
+
],
|
|
311
319
|
onSuccessObs: () => {
|
|
312
320
|
o.next({
|
|
313
321
|
type: "dependencies-resolved",
|
|
@@ -319,6 +327,15 @@ const cmd = ({
|
|
|
319
327
|
});
|
|
320
328
|
}
|
|
321
329
|
|
|
330
|
+
// maybe we want to be in the dashboard
|
|
331
|
+
if (appName === appAndVersion.name) {
|
|
332
|
+
const e: ConnectAppEvent = {
|
|
333
|
+
type: "opened",
|
|
334
|
+
app: appAndVersion,
|
|
335
|
+
};
|
|
336
|
+
return of(e);
|
|
337
|
+
}
|
|
338
|
+
|
|
322
339
|
// we're in dashboard
|
|
323
340
|
return openAppFromDashboard(transport, appName);
|
|
324
341
|
}
|
|
@@ -3,14 +3,14 @@ import { satisfies as versionSatisfies } from "semver";
|
|
|
3
3
|
|
|
4
4
|
const deviceVersionRangesForLocalization: { [key in DeviceModelId]?: string } =
|
|
5
5
|
{
|
|
6
|
-
nanoX: ">=2.1.0 || =2.1.0-lo2 || =2.1.0-lo4 || =2.1.0-lo5
|
|
6
|
+
nanoX: ">=2.1.0 || =2.1.0-lo2 || =2.1.0-lo4 || =2.1.0-lo5 || =2.1.0-rc1",
|
|
7
7
|
nanoSP: ">=1.1.0 || =1.1.0-lo1 || =1.1.0-rc1",
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const isDeviceLocalizationSupported = (
|
|
11
11
|
seVersion: string,
|
|
12
12
|
modelId?: DeviceModelId
|
|
13
|
-
) =>
|
|
13
|
+
): boolean =>
|
|
14
14
|
modelId &&
|
|
15
15
|
deviceVersionRangesForLocalization[modelId] &&
|
|
16
16
|
versionSatisfies(
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MonoTypeOperatorFunction } from "rxjs";
|
|
2
|
+
import { delay as delayOperator, retryWhen, scan } from "rxjs/operators";
|
|
3
|
+
import { throwIf } from "./throwIf";
|
|
4
|
+
|
|
5
|
+
// from https://github.com/NiklasPor/rxjs-boost (MIT)
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Retries an Observable with a [delay].
|
|
9
|
+
* Will retry [count] times. Defaults to `1`.
|
|
10
|
+
*
|
|
11
|
+
* @param delay The delay (milliseconds) the operator will wait before each retry.
|
|
12
|
+
* This also includes the first try.
|
|
13
|
+
* @param count The number of times the operator will retry the execution.
|
|
14
|
+
* Defaults to `1`.
|
|
15
|
+
*/
|
|
16
|
+
export function retryWithDelay<T>(
|
|
17
|
+
delay: number,
|
|
18
|
+
count = 1
|
|
19
|
+
): MonoTypeOperatorFunction<T> {
|
|
20
|
+
return (input) =>
|
|
21
|
+
input.pipe(
|
|
22
|
+
retryWhen((errors) =>
|
|
23
|
+
errors.pipe(
|
|
24
|
+
scan((acc, error) => ({ count: acc.count + 1, error }), {
|
|
25
|
+
count: 0,
|
|
26
|
+
error: undefined as any,
|
|
27
|
+
}),
|
|
28
|
+
throwIf(
|
|
29
|
+
(current) => current.count > count,
|
|
30
|
+
(current) => current.error
|
|
31
|
+
),
|
|
32
|
+
delayOperator(delay)
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { map } from "rxjs/operators";
|
|
3
|
+
|
|
4
|
+
// from https://github.com/NiklasPor/rxjs-boost (MIT)
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Throws the error built by `errorFn` if `conditionFn` evaluates to be truthy.
|
|
8
|
+
*
|
|
9
|
+
* @param conditionFn Determines if an error should be thrown.
|
|
10
|
+
* @param errorFn Evaluates to the error which can be thrown.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* const input = cold(' ft', { f: false, t: true });
|
|
15
|
+
* const expected = cold('f#', { f: false }, 'error');
|
|
16
|
+
*
|
|
17
|
+
* const result = input.pipe(
|
|
18
|
+
* // will throw 'error' for values === true
|
|
19
|
+
* throwIf(
|
|
20
|
+
* (val) => val
|
|
21
|
+
* () => error
|
|
22
|
+
* )
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function throwIf<T>(
|
|
27
|
+
conditionFn: (value: T, index: number) => boolean,
|
|
28
|
+
errorFn: (value: T, index: number) => any
|
|
29
|
+
) {
|
|
30
|
+
return (input: Observable<T>) =>
|
|
31
|
+
input.pipe(
|
|
32
|
+
map((value, index) => {
|
|
33
|
+
if (conditionFn(value, index)) {
|
|
34
|
+
throw errorFn(value, index);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return value;
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eventemitter.d.ts","sourceRoot":"","sources":["../../../../../src/families/bitcoin/wallet-btc/utils/eventemitter.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM,CAAC,YAAY;IAE3D,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;CAI5C"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
18
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
|
-
if (!m) return o;
|
|
20
|
-
var i = m.call(o), r, ar = [], e;
|
|
21
|
-
try {
|
|
22
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
23
|
-
}
|
|
24
|
-
catch (error) { e = { error: error }; }
|
|
25
|
-
finally {
|
|
26
|
-
try {
|
|
27
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
28
|
-
}
|
|
29
|
-
finally { if (e) throw e.error; }
|
|
30
|
-
}
|
|
31
|
-
return ar;
|
|
32
|
-
};
|
|
33
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
34
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
35
|
-
if (ar || !(i in from)) {
|
|
36
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
37
|
-
ar[i] = from[i];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
41
|
-
};
|
|
42
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
|
-
};
|
|
45
|
-
exports.__esModule = true;
|
|
46
|
-
var events_1 = __importDefault(require("events"));
|
|
47
|
-
var EventEmitter = /** @class */ (function (_super) {
|
|
48
|
-
__extends(EventEmitter, _super);
|
|
49
|
-
function EventEmitter() {
|
|
50
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
51
|
-
}
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
-
EventEmitter.prototype.emit = function (event) {
|
|
54
|
-
var data = [];
|
|
55
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
56
|
-
data[_i - 1] = arguments[_i];
|
|
57
|
-
}
|
|
58
|
-
_super.prototype.emit.call(this, "*", { event: event, data: data });
|
|
59
|
-
return _super.prototype.emit.apply(this, __spreadArray([event], __read(data), false));
|
|
60
|
-
};
|
|
61
|
-
return EventEmitter;
|
|
62
|
-
}(events_1["default"].EventEmitter));
|
|
63
|
-
exports["default"] = EventEmitter;
|
|
64
|
-
//# sourceMappingURL=eventemitter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eventemitter.js","sourceRoot":"","sources":["../../../../../src/families/bitcoin/wallet-btc/utils/eventemitter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4B;AAE5B;IAA0C,gCAAmB;IAA7D;;IAMA,CAAC;IALC,8DAA8D;IAC9D,2BAAI,GAAJ,UAAK,KAAsB;QAAE,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,6BAAc;;QACzC,iBAAM,IAAI,YAAC,GAAG,EAAE,EAAE,KAAK,OAAA,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QACjC,OAAO,iBAAM,IAAI,4BAAC,KAAK,UAAK,IAAI,WAAE;IACpC,CAAC;IACH,mBAAC;AAAD,CAAC,AAND,CAA0C,mBAAM,CAAC,YAAY,GAM5D"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import events from "events";
|
|
2
|
-
|
|
3
|
-
export default class EventEmitter extends events.EventEmitter {
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
-
emit(event: string | symbol, ...data: any[]) {
|
|
6
|
-
super.emit("*", { event, data });
|
|
7
|
-
return super.emit(event, ...data);
|
|
8
|
-
}
|
|
9
|
-
}
|