@ledgerhq/live-common 27.2.0 → 27.3.0-nightly.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/bot/index.d.ts.map +1 -1
- package/lib/bot/index.js +8 -3
- package/lib/bot/index.js.map +1 -1
- package/lib/bot/specs.d.ts +9 -0
- package/lib/bot/specs.d.ts.map +1 -1
- package/lib/bot/specs.js +49 -1
- package/lib/bot/specs.js.map +1 -1
- package/lib/currencies/support.d.ts.map +1 -1
- package/lib/currencies/support.js +2 -1
- package/lib/currencies/support.js.map +1 -1
- package/lib/derivation.d.ts.map +1 -1
- package/lib/derivation.js +2 -4
- package/lib/derivation.js.map +1 -1
- package/lib/env.js +1 -1
- package/lib/exchange/swap/getExchangeRates.d.ts.map +1 -1
- package/lib/exchange/swap/getExchangeRates.js +1 -1
- package/lib/exchange/swap/getExchangeRates.js.map +1 -1
- package/lib/exchange/swap/getProviders.d.ts.map +1 -1
- package/lib/exchange/swap/getProviders.js +45 -5
- package/lib/exchange/swap/getProviders.js.map +1 -1
- package/lib/exchange/swap/getProviders.test.d.ts +2 -0
- package/lib/exchange/swap/getProviders.test.d.ts.map +1 -0
- package/lib/exchange/swap/getProviders.test.js +519 -0
- package/lib/exchange/swap/getProviders.test.js.map +1 -0
- package/lib/exchange/swap/hooks/useProviderRates.d.ts +1 -0
- package/lib/exchange/swap/hooks/useProviderRates.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useProviderRates.js +19 -4
- package/lib/exchange/swap/hooks/useProviderRates.js.map +1 -1
- package/lib/exchange/swap/hooks/useProviderRates.test.js +42 -0
- package/lib/exchange/swap/hooks/useProviderRates.test.js.map +1 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts +1 -0
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.js +2 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
- package/lib/exchange/swap/index.d.ts +2 -1
- package/lib/exchange/swap/index.d.ts.map +1 -1
- package/lib/exchange/swap/index.js +11 -1
- package/lib/exchange/swap/index.js.map +1 -1
- package/lib/exchange/swap/index.test.js +22 -0
- package/lib/exchange/swap/index.test.js.map +1 -1
- package/lib/exchange/swap/mock.js +1 -1
- package/lib/exchange/swap/mock.js.map +1 -1
- package/lib/exchange/swap/types.d.ts +14 -0
- package/lib/exchange/swap/types.d.ts.map +1 -1
- package/lib/exchange/swap/utils/index.d.ts +1 -0
- package/lib/exchange/swap/utils/index.d.ts.map +1 -1
- package/lib/exchange/swap/utils/index.js +6 -1
- package/lib/exchange/swap/utils/index.js.map +1 -1
- package/lib/exchange/swap/utils/index.test.js +12 -0
- package/lib/exchange/swap/utils/index.test.js.map +1 -1
- package/lib/families/algorand/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/algorand/speculos-deviceActions.js +2 -29
- package/lib/families/algorand/speculos-deviceActions.js.map +1 -1
- package/lib/families/bitcoin/specs.d.ts.map +1 -1
- package/lib/families/bitcoin/specs.js +0 -1
- package/lib/families/bitcoin/specs.js.map +1 -1
- package/lib/families/bitcoin/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/bitcoin/speculos-deviceActions.js +2 -22
- package/lib/families/bitcoin/speculos-deviceActions.js.map +1 -1
- package/lib/families/cardano/specs.d.ts.map +1 -1
- package/lib/families/cardano/specs.js +4 -3
- package/lib/families/cardano/specs.js.map +1 -1
- package/lib/families/cardano/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/cardano/speculos-deviceActions.js +2 -10
- package/lib/families/cardano/speculos-deviceActions.js.map +1 -1
- package/lib/families/celo/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/celo/speculos-deviceActions.js +3 -10
- package/lib/families/celo/speculos-deviceActions.js.map +1 -1
- package/lib/families/elrond/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/elrond/speculos-deviceActions.js +3 -8
- package/lib/families/elrond/speculos-deviceActions.js.map +1 -1
- package/lib/families/ethereum/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/ethereum/speculos-deviceActions.js +10 -33
- package/lib/families/ethereum/speculos-deviceActions.js.map +1 -1
- package/lib/families/evm/specs.d.ts.map +1 -1
- package/lib/families/evm/specs.js +9 -5
- package/lib/families/evm/specs.js.map +1 -1
- package/lib/families/evm/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/evm/speculos-deviceActions.js +5 -25
- package/lib/families/evm/speculos-deviceActions.js.map +1 -1
- package/lib/families/filecoin/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/filecoin/speculos-deviceActions.js +6 -7
- package/lib/families/filecoin/speculos-deviceActions.js.map +1 -1
- package/lib/families/polkadot/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/polkadot/speculos-deviceActions.js +3 -10
- package/lib/families/polkadot/speculos-deviceActions.js.map +1 -1
- package/lib/families/ripple/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/ripple/speculos-deviceActions.js +2 -22
- package/lib/families/ripple/speculos-deviceActions.js.map +1 -1
- package/lib/families/solana/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/solana/speculos-deviceActions.js +5 -7
- package/lib/families/solana/speculos-deviceActions.js.map +1 -1
- package/lib/families/stellar/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/stellar/speculos-deviceActions.js +4 -8
- package/lib/families/stellar/speculos-deviceActions.js.map +1 -1
- package/lib/families/tezos/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/tezos/speculos-deviceActions.js +6 -11
- package/lib/families/tezos/speculos-deviceActions.js.map +1 -1
- package/lib/families/tron/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/tron/speculos-deviceActions.js +2 -14
- package/lib/families/tron/speculos-deviceActions.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +3 -0
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/hw/extractOnboardingState.d.ts +5 -1
- package/lib/hw/extractOnboardingState.d.ts.map +1 -1
- package/lib/hw/extractOnboardingState.js +17 -9
- package/lib/hw/extractOnboardingState.js.map +1 -1
- package/lib/hw/extractOnboardingState.test.js +21 -11
- package/lib/hw/extractOnboardingState.test.js.map +1 -1
- package/lib/postOnboarding/PostOnboardingProvider.d.ts +20 -0
- package/lib/postOnboarding/PostOnboardingProvider.d.ts.map +1 -0
- package/lib/postOnboarding/PostOnboardingProvider.js +33 -0
- package/lib/postOnboarding/PostOnboardingProvider.js.map +1 -0
- package/lib/postOnboarding/actions.d.ts +20 -0
- package/lib/postOnboarding/actions.d.ts.map +1 -0
- package/lib/postOnboarding/actions.js +37 -0
- package/lib/postOnboarding/actions.js.map +1 -0
- package/lib/postOnboarding/hooks/index.d.ts +6 -0
- package/lib/postOnboarding/hooks/index.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/index.js +22 -0
- package/lib/postOnboarding/hooks/index.js.map +1 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.d.ts +8 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.js +16 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.js.map +1 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.d.ts +2 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.js +75 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.js.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingContext.d.ts +3 -0
- package/lib/postOnboarding/hooks/usePostOnboardingContext.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingContext.js +10 -0
- package/lib/postOnboarding/hooks/usePostOnboardingContext.js.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.d.ts +8 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.js +20 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.js.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.d.ts +2 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.js +64 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.js.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.d.ts +12 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.js +65 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.js.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.d.ts +2 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.js +129 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.js.map +1 -0
- package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.d.ts +13 -0
- package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.js +34 -0
- package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.js.map +1 -0
- package/lib/postOnboarding/mock.d.ts +8 -0
- package/lib/postOnboarding/mock.d.ts.map +1 -0
- package/lib/postOnboarding/mock.js +46 -0
- package/lib/postOnboarding/mock.js.map +1 -0
- package/lib/postOnboarding/reducer.d.ts +22 -0
- package/lib/postOnboarding/reducer.d.ts.map +1 -0
- package/lib/postOnboarding/reducer.js +71 -0
- package/lib/postOnboarding/reducer.js.map +1 -0
- package/lib/postOnboarding/reducer.test.d.ts +2 -0
- package/lib/postOnboarding/reducer.test.d.ts.map +1 -0
- package/lib/postOnboarding/reducer.test.js +251 -0
- package/lib/postOnboarding/reducer.test.js.map +1 -0
- package/package.json +8 -4
- package/src/bot/index.ts +11 -12
- package/src/bot/specs.ts +45 -0
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +1 -35
- package/src/currencies/support.ts +2 -1
- package/src/derivation.ts +2 -4
- package/src/env.ts +1 -1
- package/src/exchange/swap/getExchangeRates.ts +7 -3
- package/src/exchange/swap/getProviders.test.ts +450 -0
- package/src/exchange/swap/getProviders.ts +31 -8
- package/src/exchange/swap/hooks/useProviderRates.test.ts +43 -0
- package/src/exchange/swap/hooks/useProviderRates.ts +22 -3
- package/src/exchange/swap/hooks/useSwapTransaction.ts +3 -1
- package/src/exchange/swap/index.test.ts +36 -1
- package/src/exchange/swap/index.ts +15 -0
- package/src/exchange/swap/mock.ts +2 -2
- package/src/exchange/swap/types.ts +11 -0
- package/src/exchange/swap/utils/index.test.ts +19 -0
- package/src/exchange/swap/utils/index.ts +5 -0
- package/src/families/algorand/speculos-deviceActions.ts +4 -35
- package/src/families/bitcoin/specs.ts +0 -1
- package/src/families/bitcoin/speculos-deviceActions.ts +3 -26
- package/src/families/cardano/specs.ts +4 -3
- package/src/families/cardano/speculos-deviceActions.ts +3 -14
- package/src/families/celo/speculos-deviceActions.ts +6 -14
- package/src/families/elrond/speculos-deviceActions.ts +4 -9
- package/src/families/ethereum/speculos-deviceActions.ts +16 -46
- package/src/families/evm/specs.ts +12 -8
- package/src/families/evm/speculos-deviceActions.ts +7 -35
- package/src/families/filecoin/speculos-deviceActions.ts +7 -8
- package/src/families/polkadot/speculos-deviceActions.ts +5 -16
- package/src/families/ripple/speculos-deviceActions.ts +3 -28
- package/src/families/solana/speculos-deviceActions.ts +6 -8
- package/src/families/stellar/speculos-deviceActions.ts +5 -11
- package/src/families/tezos/speculos-deviceActions.ts +9 -16
- package/src/families/tron/speculos-deviceActions.ts +4 -12
- package/src/featureFlags/defaultFeatures.ts +3 -0
- package/src/hw/extractOnboardingState.test.ts +29 -12
- package/src/hw/extractOnboardingState.ts +17 -9
- package/src/postOnboarding/PostOnboardingProvider.tsx +49 -0
- package/src/postOnboarding/actions.ts +40 -0
- package/src/postOnboarding/hooks/index.ts +5 -0
- package/src/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.ts +82 -0
- package/src/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.ts +12 -0
- package/src/postOnboarding/hooks/usePostOnboardingContext.ts +9 -0
- package/src/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.ts +83 -0
- package/src/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.ts +22 -0
- package/src/postOnboarding/hooks/usePostOnboardingHubState.test.ts +184 -0
- package/src/postOnboarding/hooks/usePostOnboardingHubState.ts +56 -0
- package/src/postOnboarding/hooks/useStartPostOnboardingCallback.ts +38 -0
- package/src/postOnboarding/mock.ts +53 -0
- package/src/postOnboarding/reducer.test.ts +247 -0
- package/src/postOnboarding/reducer.ts +105 -0
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
},
|
|
5
5
|
"name": "@ledgerhq/live-common",
|
|
6
6
|
"description": "Common ground for the Ledger Live apps",
|
|
7
|
-
"version": "27.
|
|
7
|
+
"version": "27.3.0-nightly.0",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -75,7 +75,9 @@
|
|
|
75
75
|
"react": ">=16",
|
|
76
76
|
"react-dom": ">=16",
|
|
77
77
|
"react-native": ">=0.65.1",
|
|
78
|
-
"react-native-svg": ">=12.1.1"
|
|
78
|
+
"react-native-svg": ">=12.1.1",
|
|
79
|
+
"react-redux": "7.2.6",
|
|
80
|
+
"redux-actions": "2.6.5"
|
|
79
81
|
},
|
|
80
82
|
"peerDependenciesMeta": {
|
|
81
83
|
"react-dom": {
|
|
@@ -129,7 +131,7 @@
|
|
|
129
131
|
"@ledgerhq/hw-transport-node-speculos": "^6.27.4",
|
|
130
132
|
"@ledgerhq/json-bignumber": "^1.1.0",
|
|
131
133
|
"@ledgerhq/live-app-sdk": "^0.8.1",
|
|
132
|
-
"@ledgerhq/logs": "^6.10.0",
|
|
134
|
+
"@ledgerhq/logs": "^6.10.1-nightly.0",
|
|
133
135
|
"@polkadot/types": "8.12.2",
|
|
134
136
|
"@polkadot/types-known": "8.12.2",
|
|
135
137
|
"@polkadot/util": "10.0.2",
|
|
@@ -221,7 +223,7 @@
|
|
|
221
223
|
"@keplr-wallet/proto-types": "^0.10.4",
|
|
222
224
|
"@ledgerhq/types-cryptoassets": "^6.23.0",
|
|
223
225
|
"@ledgerhq/types-devices": "^6.22.1",
|
|
224
|
-
"@ledgerhq/types-live": "^6.24.0",
|
|
226
|
+
"@ledgerhq/types-live": "^6.24.1-nightly.0",
|
|
225
227
|
"@svgr/core": "^5.5.0",
|
|
226
228
|
"@testing-library/react": "12",
|
|
227
229
|
"@testing-library/react-hooks": "^4.0.1",
|
|
@@ -260,7 +262,9 @@
|
|
|
260
262
|
"react-dom": "17.0.2",
|
|
261
263
|
"react-native": "0.65.1",
|
|
262
264
|
"react-native-svg": "^12.1.1",
|
|
265
|
+
"react-redux": "7.2.6",
|
|
263
266
|
"react-test-renderer": "^17.0.2",
|
|
267
|
+
"redux-actions": "2.6.5",
|
|
264
268
|
"timemachine": "^0.3.2",
|
|
265
269
|
"ts-jest": "^28.0.5",
|
|
266
270
|
"ts-node": "^10.4.0",
|
package/src/bot/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
formatCurrencyUnit,
|
|
18
18
|
getFiatCurrencyByTicker,
|
|
19
19
|
} from "../currencies";
|
|
20
|
-
import { isAccountEmpty, toAccountRaw } from "../account";
|
|
20
|
+
import { formatAccount, isAccountEmpty, toAccountRaw } from "../account";
|
|
21
21
|
import { runWithAppSpec } from "./engine";
|
|
22
22
|
import { formatReportForConsole, formatError, formatTime } from "./formatters";
|
|
23
23
|
import {
|
|
@@ -508,12 +508,9 @@ export async function bot({
|
|
|
508
508
|
|
|
509
509
|
const beforeOps = countOps(r.accountsBefore);
|
|
510
510
|
const afterOps = countOps(r.accountsAfter);
|
|
511
|
-
const
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
(r.accountsBefore || []).filter((a) => a.used).length
|
|
515
|
-
}) `
|
|
516
|
-
);
|
|
511
|
+
const accounts = r.accountsAfter || r.accountsBefore || [];
|
|
512
|
+
const firstAccount = accounts[0];
|
|
513
|
+
appendBody(`| ${r.spec.name} (${accounts.filter((a) => a.used).length}) `);
|
|
517
514
|
appendBody(
|
|
518
515
|
`| ${afterOps || beforeOps}${
|
|
519
516
|
afterOps > beforeOps ? ` (+${afterOps - beforeOps})` : ""
|
|
@@ -525,6 +522,11 @@ export async function bot({
|
|
|
525
522
|
);
|
|
526
523
|
appendBody("|\n");
|
|
527
524
|
});
|
|
525
|
+
|
|
526
|
+
appendBody("\n```\n");
|
|
527
|
+
appendBody(allAccountsAfter.map((a) => formatAccount(a, "head")).join("\n"));
|
|
528
|
+
appendBody("\n```\n");
|
|
529
|
+
|
|
528
530
|
appendBody("\n</details>\n\n");
|
|
529
531
|
|
|
530
532
|
// Add performance details
|
|
@@ -589,11 +591,8 @@ export async function bot({
|
|
|
589
591
|
);
|
|
590
592
|
|
|
591
593
|
results.forEach((r) => {
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
(r.accountsBefore || []).filter((a) => a.used).length
|
|
595
|
-
}) |`
|
|
596
|
-
);
|
|
594
|
+
const accounts = r.accountsAfter || r.accountsBefore || [];
|
|
595
|
+
appendBody(`| ${r.spec.name} (${accounts.filter((a) => a.used).length}) |`);
|
|
597
596
|
appendBody(`${formatTime(r.preloadDuration || 0)} |`);
|
|
598
597
|
appendBody(`${formatTime(r.scanDuration || 0)} |`);
|
|
599
598
|
appendBody(
|
package/src/bot/specs.ts
CHANGED
|
@@ -8,6 +8,8 @@ import type { DeviceAction, DeviceActionArg } from "./types";
|
|
|
8
8
|
import { Account } from "@ledgerhq/types-live";
|
|
9
9
|
import type { Transaction } from "../generated/types";
|
|
10
10
|
import { botTest } from "./bot-test-context";
|
|
11
|
+
import { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
12
|
+
import BigNumber from "bignumber.js";
|
|
11
13
|
|
|
12
14
|
export { botTest };
|
|
13
15
|
|
|
@@ -173,3 +175,46 @@ export function deviceActionFlow<T extends Transaction>(
|
|
|
173
175
|
};
|
|
174
176
|
};
|
|
175
177
|
}
|
|
178
|
+
|
|
179
|
+
type DeviceAmountFormatOptions = {
|
|
180
|
+
// the ticker of the coin is AFTER the amount on the device (e.g. "600.1 USDT")
|
|
181
|
+
postfixCode: boolean;
|
|
182
|
+
// the device shows "42" as "42.0"
|
|
183
|
+
forceFloating: boolean;
|
|
184
|
+
// device don't even display the code (unit ticker)
|
|
185
|
+
hideCode: boolean;
|
|
186
|
+
// force the visibility of all digits of the amount
|
|
187
|
+
showAllDigits: boolean;
|
|
188
|
+
};
|
|
189
|
+
const defaultFormatOptions: DeviceAmountFormatOptions = {
|
|
190
|
+
postfixCode: false,
|
|
191
|
+
forceFloating: false,
|
|
192
|
+
hideCode: false,
|
|
193
|
+
showAllDigits: false,
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const sep = " ";
|
|
197
|
+
export function formatDeviceAmount(
|
|
198
|
+
currency: CryptoCurrency | TokenCurrency,
|
|
199
|
+
value: BigNumber,
|
|
200
|
+
options: Partial<DeviceAmountFormatOptions> = defaultFormatOptions
|
|
201
|
+
): string {
|
|
202
|
+
const [unit] = currency.units;
|
|
203
|
+
let code = unit.code;
|
|
204
|
+
if (currency.type === "CryptoCurrency") {
|
|
205
|
+
const { deviceTicker } = currency;
|
|
206
|
+
if (deviceTicker) code = deviceTicker;
|
|
207
|
+
}
|
|
208
|
+
const fValue = value.div(new BigNumber(10).pow(unit.magnitude));
|
|
209
|
+
let v = options.showAllDigits
|
|
210
|
+
? fValue.toFixed(unit.magnitude)
|
|
211
|
+
: fValue.toString(10);
|
|
212
|
+
if (options.forceFloating) {
|
|
213
|
+
if (!v.includes(".")) {
|
|
214
|
+
// if the value is pure integer, in the app it will automatically add an .0
|
|
215
|
+
v += ".0";
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (options.hideCode) return v;
|
|
219
|
+
return options.postfixCode ? v + sep + code : code + sep + v;
|
|
220
|
+
}
|
|
@@ -694,7 +694,6 @@ Array [
|
|
|
694
694
|
"ethereum/erc20/mark",
|
|
695
695
|
"ethereum/erc20/flip_token",
|
|
696
696
|
"ethereum/erc20/team",
|
|
697
|
-
"polygon/erc20/ig_orb_(pos)",
|
|
698
697
|
"ethereum/erc20/syncfab_manufacturing",
|
|
699
698
|
"ethereum/erc20/niobium",
|
|
700
699
|
"ethereum/erc20/bob_s_repair",
|
|
@@ -728,7 +727,7 @@ Array [
|
|
|
728
727
|
"ethereum/erc20/coinus",
|
|
729
728
|
"ethereum/erc20/rating",
|
|
730
729
|
"ethereum/erc20/uptrennd",
|
|
731
|
-
"
|
|
730
|
+
"ethereum/erc20/stoxtoken",
|
|
732
731
|
"ethereum/erc20/smartshare_token",
|
|
733
732
|
"ethereum/erc20/fti",
|
|
734
733
|
"ethereum/erc20/neurochain_clausius",
|
|
@@ -1579,7 +1578,6 @@ Array [
|
|
|
1579
1578
|
"ethereum/erc20/ape_stax",
|
|
1580
1579
|
"ethereum/erc20/apebullinu",
|
|
1581
1580
|
"ethereum/erc20/apecoin",
|
|
1582
|
-
"ethereum/erc20/apecoin_dev",
|
|
1583
1581
|
"ethereum/erc20/apehaven",
|
|
1584
1582
|
"ethereum/erc20/apenft",
|
|
1585
1583
|
"ethereum/erc20/apenftio",
|
|
@@ -1831,7 +1829,6 @@ Array [
|
|
|
1831
1829
|
"ethereum/erc20/bitboost",
|
|
1832
1830
|
"ethereum/erc20/bitcar_token",
|
|
1833
1831
|
"ethereum/erc20/bitcashpay",
|
|
1834
|
-
"ethereum/erc20/bitcci_cash",
|
|
1835
1832
|
"ethereum/erc20/bitcloud_token",
|
|
1836
1833
|
"ethereum/erc20/bitcoin_boutique",
|
|
1837
1834
|
"ethereum/erc20/bitcoin_zero",
|
|
@@ -2045,7 +2042,6 @@ Array [
|
|
|
2045
2042
|
"ethereum/erc20/capital_finance",
|
|
2046
2043
|
"ethereum/erc20/capitalsharetoken",
|
|
2047
2044
|
"ethereum/erc20/capsule_coin",
|
|
2048
|
-
"ethereum/erc20/captain_inu",
|
|
2049
2045
|
"ethereum/erc20/car_coin",
|
|
2050
2046
|
"ethereum/erc20/car_sharing_community",
|
|
2051
2047
|
"ethereum/erc20/carbcoin",
|
|
@@ -2070,7 +2066,6 @@ Array [
|
|
|
2070
2066
|
"ethereum/erc20/cat__blockcat_",
|
|
2071
2067
|
"ethereum/erc20/cat_trade",
|
|
2072
2068
|
"ethereum/erc20/catcoin",
|
|
2073
|
-
"ethereum/erc20/catecoin",
|
|
2074
2069
|
"ethereum/erc20/cavapoo",
|
|
2075
2070
|
"ethereum/erc20/cavo",
|
|
2076
2071
|
"ethereum/erc20/cbdao",
|
|
@@ -2109,7 +2104,6 @@ Array [
|
|
|
2109
2104
|
"ethereum/erc20/cherry_token",
|
|
2110
2105
|
"ethereum/erc20/chi_gastoken_by_1inch",
|
|
2111
2106
|
"ethereum/erc20/chicken",
|
|
2112
|
-
"ethereum/erc20/chihiro_inu",
|
|
2113
2107
|
"ethereum/erc20/chihua_token",
|
|
2114
2108
|
"ethereum/erc20/chihuahua",
|
|
2115
2109
|
"ethereum/erc20/chipz",
|
|
@@ -2261,7 +2255,6 @@ Array [
|
|
|
2261
2255
|
"ethereum/erc20/creedtoken",
|
|
2262
2256
|
"ethereum/erc20/cremit",
|
|
2263
2257
|
"ethereum/erc20/crespo",
|
|
2264
|
-
"ethereum/erc20/creverse",
|
|
2265
2258
|
"ethereum/erc20/criptoro_coin",
|
|
2266
2259
|
"ethereum/erc20/cro",
|
|
2267
2260
|
"ethereum/erc20/crossfi",
|
|
@@ -2688,7 +2681,6 @@ Array [
|
|
|
2688
2681
|
"ethereum/erc20/enkronostoken",
|
|
2689
2682
|
"ethereum/erc20/enreachdao",
|
|
2690
2683
|
"ethereum/erc20/entanmo",
|
|
2691
|
-
"ethereum/erc20/enter_governance_token",
|
|
2692
2684
|
"ethereum/erc20/entone",
|
|
2693
2685
|
"ethereum/erc20/entropy",
|
|
2694
2686
|
"ethereum/erc20/envicoin",
|
|
@@ -3027,7 +3019,6 @@ Array [
|
|
|
3027
3019
|
"ethereum/erc20/gera",
|
|
3028
3020
|
"ethereum/erc20/gerowallet",
|
|
3029
3021
|
"ethereum/erc20/geyser",
|
|
3030
|
-
"ethereum/erc20/gg_token",
|
|
3031
3022
|
"ethereum/erc20/ggcoin",
|
|
3032
3023
|
"ethereum/erc20/ggtoken",
|
|
3033
3024
|
"ethereum/erc20/ghoul",
|
|
@@ -3110,7 +3101,6 @@ Array [
|
|
|
3110
3101
|
"ethereum/erc20/grearn's_token",
|
|
3111
3102
|
"ethereum/erc20/green",
|
|
3112
3103
|
"ethereum/erc20/green_light_erc20",
|
|
3113
|
-
"ethereum/erc20/green_metaverse_token",
|
|
3114
3104
|
"ethereum/erc20/green_token",
|
|
3115
3105
|
"ethereum/erc20/greenmed",
|
|
3116
3106
|
"ethereum/erc20/grey_token",
|
|
@@ -3194,7 +3184,6 @@ Array [
|
|
|
3194
3184
|
"ethereum/erc20/hiz_finance",
|
|
3195
3185
|
"ethereum/erc20/hkg",
|
|
3196
3186
|
"ethereum/erc20/hlandtoken",
|
|
3197
|
-
"ethereum/erc20/hmmm",
|
|
3198
3187
|
"ethereum/erc20/hoard_token",
|
|
3199
3188
|
"ethereum/erc20/hobonickels",
|
|
3200
3189
|
"ethereum/erc20/hodlcoin",
|
|
@@ -3512,7 +3501,6 @@ Array [
|
|
|
3512
3501
|
"ethereum/erc20/libartysharetoken",
|
|
3513
3502
|
"ethereum/erc20/libera",
|
|
3514
3503
|
"ethereum/erc20/libereum",
|
|
3515
|
-
"ethereum/erc20/libero_financial_freedom",
|
|
3516
3504
|
"ethereum/erc20/libertas",
|
|
3517
3505
|
"ethereum/erc20/libfx",
|
|
3518
3506
|
"ethereum/erc20/libratoken",
|
|
@@ -3678,7 +3666,6 @@ Array [
|
|
|
3678
3666
|
"ethereum/erc20/meta_network",
|
|
3679
3667
|
"ethereum/erc20/metafabric",
|
|
3680
3668
|
"ethereum/erc20/metafactory",
|
|
3681
|
-
"ethereum/erc20/metafluence",
|
|
3682
3669
|
"ethereum/erc20/metaverse_index",
|
|
3683
3670
|
"ethereum/erc20/metaverse_nft_index",
|
|
3684
3671
|
"ethereum/erc20/metawhale_btc",
|
|
@@ -4263,7 +4250,6 @@ Array [
|
|
|
4263
4250
|
"ethereum/erc20/quannabu",
|
|
4264
4251
|
"ethereum/erc20/quantfury_data_token",
|
|
4265
4252
|
"ethereum/erc20/quantfury_token",
|
|
4266
|
-
"ethereum/erc20/quarashi",
|
|
4267
4253
|
"ethereum/erc20/quickmining_token",
|
|
4268
4254
|
"ethereum/erc20/quickswap",
|
|
4269
4255
|
"ethereum/erc20/quiverx",
|
|
@@ -4318,7 +4304,6 @@ Array [
|
|
|
4318
4304
|
"ethereum/erc20/reditoken",
|
|
4319
4305
|
"ethereum/erc20/reef_finance",
|
|
4320
4306
|
"ethereum/erc20/reeth_token",
|
|
4321
|
-
"ethereum/erc20/refi",
|
|
4322
4307
|
"ethereum/erc20/refine_medium_token",
|
|
4323
4308
|
"ethereum/erc20/reflect_finance",
|
|
4324
4309
|
"ethereum/erc20/reflector_finance",
|
|
@@ -4451,7 +4436,6 @@ Array [
|
|
|
4451
4436
|
"ethereum/erc20/savetoken",
|
|
4452
4437
|
"ethereum/erc20/savix",
|
|
4453
4438
|
"ethereum/erc20/scaleswaptoken",
|
|
4454
|
-
"ethereum/erc20/scallop",
|
|
4455
4439
|
"ethereum/erc20/scandiweb_coin",
|
|
4456
4440
|
"ethereum/erc20/scardust",
|
|
4457
4441
|
"ethereum/erc20/scatter_cx",
|
|
@@ -4461,14 +4445,12 @@ Array [
|
|
|
4461
4445
|
"ethereum/erc20/scifitoken",
|
|
4462
4446
|
"ethereum/erc20/scoobi-doge",
|
|
4463
4447
|
"ethereum/erc20/scott",
|
|
4464
|
-
"ethereum/erc20/scratchtoken",
|
|
4465
4448
|
"ethereum/erc20/scrl",
|
|
4466
4449
|
"ethereum/erc20/sdog",
|
|
4467
4450
|
"ethereum/erc20/sea_cucumber_chain",
|
|
4468
4451
|
"ethereum/erc20/sealblock_token",
|
|
4469
4452
|
"ethereum/erc20/sechain",
|
|
4470
4453
|
"ethereum/erc20/secret_finance",
|
|
4471
|
-
"ethereum/erc20/sector",
|
|
4472
4454
|
"ethereum/erc20/secure_pad",
|
|
4473
4455
|
"ethereum/erc20/securypto",
|
|
4474
4456
|
"ethereum/erc20/seed",
|
|
@@ -4859,7 +4841,6 @@ Array [
|
|
|
4859
4841
|
"ethereum/erc20/taklimakan_network",
|
|
4860
4842
|
"ethereum/erc20/talao",
|
|
4861
4843
|
"ethereum/erc20/talent_coin",
|
|
4862
|
-
"ethereum/erc20/talkado",
|
|
4863
4844
|
"ethereum/erc20/tama_egg_niftygotchi",
|
|
4864
4845
|
"ethereum/erc20/tamadoge",
|
|
4865
4846
|
"ethereum/erc20/tamy_token",
|
|
@@ -4953,7 +4934,6 @@ Array [
|
|
|
4953
4934
|
"ethereum/erc20/tingles",
|
|
4954
4935
|
"ethereum/erc20/tinku",
|
|
4955
4936
|
"ethereum/erc20/tio",
|
|
4956
|
-
"ethereum/erc20/titano",
|
|
4957
4937
|
"ethereum/erc20/titanswap",
|
|
4958
4938
|
"ethereum/erc20/tixl_token",
|
|
4959
4939
|
"ethereum/erc20/tknt",
|
|
@@ -5768,7 +5748,6 @@ Array [
|
|
|
5768
5748
|
"polygon/erc20/ground_coin",
|
|
5769
5749
|
"polygon/erc20/grumpy_cat",
|
|
5770
5750
|
"polygon/erc20/guaranteed_entrance_token",
|
|
5771
|
-
"polygon/erc20/guppy_treat_token",
|
|
5772
5751
|
"polygon/erc20/hashgard",
|
|
5773
5752
|
"polygon/erc20/hex",
|
|
5774
5753
|
"polygon/erc20/holotoken",
|
|
@@ -5784,10 +5763,6 @@ Array [
|
|
|
5784
5763
|
"polygon/erc20/instadapp_(pos)",
|
|
5785
5764
|
"polygon/erc20/internxt",
|
|
5786
5765
|
"polygon/erc20/inverse",
|
|
5787
|
-
"polygon/erc20/invictus_bitcoin_alpha",
|
|
5788
|
-
"polygon/erc20/invictus_crypto10_hedged",
|
|
5789
|
-
"polygon/erc20/invictus_crypto20",
|
|
5790
|
-
"polygon/erc20/invictus_stable_growth",
|
|
5791
5766
|
"polygon/erc20/iron_finance_ice_token",
|
|
5792
5767
|
"polygon/erc20/iron_stablecoin",
|
|
5793
5768
|
"polygon/erc20/iron_titanium_token",
|
|
@@ -5830,7 +5805,6 @@ Array [
|
|
|
5830
5805
|
"polygon/erc20/musd",
|
|
5831
5806
|
"polygon/erc20/museum_of_crypto_art",
|
|
5832
5807
|
"polygon/erc20/mysterium_(pos)",
|
|
5833
|
-
"polygon/erc20/nakamoto.games",
|
|
5834
5808
|
"polygon/erc20/napoleonx",
|
|
5835
5809
|
"polygon/erc20/neighbourhoods_token",
|
|
5836
5810
|
"polygon/erc20/neos_credits_(pos)",
|
|
@@ -5895,7 +5869,6 @@ Array [
|
|
|
5895
5869
|
"polygon/erc20/sand",
|
|
5896
5870
|
"polygon/erc20/sand_old",
|
|
5897
5871
|
"polygon/erc20/sapien_network",
|
|
5898
|
-
"polygon/erc20/sekuritance_(pos)",
|
|
5899
5872
|
"polygon/erc20/sentinel",
|
|
5900
5873
|
"polygon/erc20/serum",
|
|
5901
5874
|
"polygon/erc20/shiba_inu_(pos)",
|
|
@@ -6136,7 +6109,6 @@ Array [
|
|
|
6136
6109
|
"bsc/bep20/cartesi_token",
|
|
6137
6110
|
"bsc/bep20/catcoin",
|
|
6138
6111
|
"bsc/bep20/catecoin",
|
|
6139
|
-
"bsc/bep20/catecoin_old",
|
|
6140
6112
|
"bsc/bep20/ceek",
|
|
6141
6113
|
"bsc/bep20/cellframe_token",
|
|
6142
6114
|
"bsc/bep20/cerby_token",
|
|
@@ -6244,14 +6216,12 @@ Array [
|
|
|
6244
6216
|
"bsc/bep20/gamyfi",
|
|
6245
6217
|
"bsc/bep20/genta",
|
|
6246
6218
|
"bsc/bep20/gforce",
|
|
6247
|
-
"bsc/bep20/gg_token",
|
|
6248
6219
|
"bsc/bep20/gomining_token",
|
|
6249
6220
|
"bsc/bep20/goose_coin",
|
|
6250
6221
|
"bsc/bep20/goose_golden_egg",
|
|
6251
6222
|
"bsc/bep20/gorilladiamond",
|
|
6252
6223
|
"bsc/bep20/goswapp",
|
|
6253
6224
|
"bsc/bep20/gourmetgalaxy",
|
|
6254
|
-
"bsc/bep20/green_metaverse_token",
|
|
6255
6225
|
"bsc/bep20/gummy_bull_token",
|
|
6256
6226
|
"bsc/bep20/hachiro_inu",
|
|
6257
6227
|
"bsc/bep20/hacken_token",
|
|
@@ -6366,7 +6336,6 @@ Array [
|
|
|
6366
6336
|
"bsc/bep20/orbital_lps",
|
|
6367
6337
|
"bsc/bep20/orbs",
|
|
6368
6338
|
"bsc/bep20/oreo",
|
|
6369
|
-
"bsc/bep20/orica",
|
|
6370
6339
|
"bsc/bep20/ovr",
|
|
6371
6340
|
"bsc/bep20/paid_network",
|
|
6372
6341
|
"bsc/bep20/pancakeswap_token",
|
|
@@ -6402,7 +6371,6 @@ Array [
|
|
|
6402
6371
|
"bsc/bep20/puli_inu",
|
|
6403
6372
|
"bsc/bep20/qian_governance_token",
|
|
6404
6373
|
"bsc/bep20/qian_second_generation_dollar",
|
|
6405
|
-
"bsc/bep20/quarashi",
|
|
6406
6374
|
"bsc/bep20/quarkchain_token",
|
|
6407
6375
|
"bsc/bep20/qusd_stablecoin",
|
|
6408
6376
|
"bsc/bep20/rabbit_coin",
|
|
@@ -6473,7 +6441,6 @@ Array [
|
|
|
6473
6441
|
"bsc/bep20/swipe",
|
|
6474
6442
|
"bsc/bep20/switcheo_token",
|
|
6475
6443
|
"bsc/bep20/taco",
|
|
6476
|
-
"bsc/bep20/talkado",
|
|
6477
6444
|
"bsc/bep20/tbitcoin",
|
|
6478
6445
|
"bsc/bep20/tdogecoin",
|
|
6479
6446
|
"bsc/bep20/tenet",
|
|
@@ -6536,7 +6503,6 @@ Array [
|
|
|
6536
6503
|
"bsc/bep20/venus_xrp",
|
|
6537
6504
|
"bsc/bep20/venus_xvs",
|
|
6538
6505
|
"bsc/bep20/vfox",
|
|
6539
|
-
"bsc/bep20/volt_inu",
|
|
6540
6506
|
"bsc/bep20/vswap.fi",
|
|
6541
6507
|
"bsc/bep20/wall_street_games",
|
|
6542
6508
|
"bsc/bep20/wanaka_farm",
|
|
@@ -75,7 +75,8 @@ export function listSupportedFiats(): FiatCurrency[] {
|
|
|
75
75
|
return userSupportedFiats;
|
|
76
76
|
}
|
|
77
77
|
export function setSupportedCurrencies(ids: CryptoCurrencyIds[]) {
|
|
78
|
-
userSupportedCurrencies =
|
|
78
|
+
userSupportedCurrencies = Array.from(new Set(ids)) // Make sure to remove duplicates
|
|
79
|
+
.map((id) => getCryptoCurrencyById(id));
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
function getExperimentalSupports() {
|
package/src/derivation.ts
CHANGED
|
@@ -156,16 +156,14 @@ const modes = Object.freeze({
|
|
|
156
156
|
polkadotbip44: {
|
|
157
157
|
overridesDerivation: "44'/354'/<account>'/0'/<address>'",
|
|
158
158
|
},
|
|
159
|
-
// glif legacy derivation
|
|
160
159
|
gliflegacy: {
|
|
161
160
|
overridesDerivation: "44'/1'/0'/0/<account>",
|
|
162
|
-
tag: "
|
|
161
|
+
tag: "legacy",
|
|
163
162
|
},
|
|
164
|
-
// glif normal derivation
|
|
165
163
|
glif: {
|
|
166
164
|
overridesDerivation: "44'/461'/0'/0/<account>",
|
|
167
165
|
startsAt: 1,
|
|
168
|
-
tag: "
|
|
166
|
+
tag: "third-party",
|
|
169
167
|
},
|
|
170
168
|
solanaMain: {
|
|
171
169
|
isNonIterable: true,
|
package/src/env.ts
CHANGED
|
@@ -13,7 +13,12 @@ import {
|
|
|
13
13
|
} from "../../errors";
|
|
14
14
|
import network from "../../network";
|
|
15
15
|
import type { Transaction } from "../../generated/types";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
getAvailableProviders,
|
|
18
|
+
getSwapAPIBaseURL,
|
|
19
|
+
getSwapAPIError,
|
|
20
|
+
getSwapAPIVersion,
|
|
21
|
+
} from "./";
|
|
17
22
|
import { mockGetExchangeRates } from "./mock";
|
|
18
23
|
import type { CustomMinOrMaxError, Exchange, GetExchangeRates } from "./types";
|
|
19
24
|
|
|
@@ -26,8 +31,7 @@ const getExchangeRates: GetExchangeRates = async (
|
|
|
26
31
|
if (getEnv("MOCK"))
|
|
27
32
|
return mockGetExchangeRates(exchange, transaction, currencyTo);
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
const usesV3 = getSwapAPIBaseURL().endsWith("v3");
|
|
34
|
+
const usesV3 = getSwapAPIVersion() >= 3;
|
|
31
35
|
const from = getAccountCurrency(exchange.fromAccount).id;
|
|
32
36
|
const unitFrom = getAccountUnit(exchange.fromAccount);
|
|
33
37
|
const unitTo =
|