@ledgerhq/live-common 34.50.0-nightly.6 → 34.51.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/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +3 -6
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js +60 -0
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/types.d.ts +0 -1
- package/lib/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib/exchange/swap/postSwapState.d.ts.map +1 -1
- package/lib/exchange/swap/postSwapState.js +19 -23
- package/lib/exchange/swap/postSwapState.js.map +1 -1
- package/lib/exchange/swap/setBroadcastTransaction.d.ts +4 -4
- package/lib/exchange/swap/setBroadcastTransaction.js +7 -7
- package/lib/exchange/swap/setBroadcastTransaction.js.map +1 -1
- package/lib/exchange/swap/types.d.ts +3 -3
- package/lib/exchange/swap/types.d.ts.map +1 -1
- package/lib/families/tezos/config.js +2 -2
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.js +5 -2
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +5 -8
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js +15 -24
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +6 -25
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +4 -3
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.js +8 -4
- package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts +2 -0
- package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts.map +1 -0
- package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.js +212 -0
- package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.js.map +1 -0
- package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts +2 -0
- package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts.map +1 -0
- package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js +202 -0
- package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js.map +1 -0
- package/lib/modularDrawer/utils/calculateProviderTotal.d.ts +1 -0
- package/lib/modularDrawer/utils/calculateProviderTotal.d.ts.map +1 -1
- package/lib/modularDrawer/utils/calculateProviderTotal.js +10 -2
- package/lib/modularDrawer/utils/calculateProviderTotal.js.map +1 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +6 -4
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +9 -22
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -1
- package/lib/modularDrawer/utils/groupAccountsByAsset.d.ts +4 -3
- package/lib/modularDrawer/utils/groupAccountsByAsset.d.ts.map +1 -1
- package/lib/modularDrawer/utils/groupAccountsByAsset.js +27 -11
- package/lib/modularDrawer/utils/groupAccountsByAsset.js.map +1 -1
- package/lib/modularDrawer/utils/index.d.ts +0 -1
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +1 -3
- package/lib/modularDrawer/utils/index.js.map +1 -1
- package/lib/modularDrawer/utils/sortByBalance.d.ts +1 -3
- package/lib/modularDrawer/utils/sortByBalance.d.ts.map +1 -1
- package/lib/modularDrawer/utils/sortByBalance.js +6 -18
- package/lib/modularDrawer/utils/sortByBalance.js.map +1 -1
- package/lib/modularDrawer/utils/type.d.ts +9 -8
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib/wallet-api/Exchange/server.js +6 -6
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +3 -6
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js +60 -0
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts +0 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib-es/exchange/swap/postSwapState.d.ts.map +1 -1
- package/lib-es/exchange/swap/postSwapState.js +19 -23
- package/lib-es/exchange/swap/postSwapState.js.map +1 -1
- package/lib-es/exchange/swap/setBroadcastTransaction.d.ts +4 -4
- package/lib-es/exchange/swap/setBroadcastTransaction.js +7 -7
- package/lib-es/exchange/swap/setBroadcastTransaction.js.map +1 -1
- package/lib-es/exchange/swap/types.d.ts +3 -3
- package/lib-es/exchange/swap/types.d.ts.map +1 -1
- package/lib-es/families/tezos/config.js +2 -2
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.js +1 -1
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +5 -8
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +15 -24
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +6 -25
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +4 -3
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js +8 -4
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts +2 -0
- package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.js +207 -0
- package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.js.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts +2 -0
- package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js +197 -0
- package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js.map +1 -0
- package/lib-es/modularDrawer/utils/calculateProviderTotal.d.ts +1 -0
- package/lib-es/modularDrawer/utils/calculateProviderTotal.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/calculateProviderTotal.js +10 -2
- package/lib-es/modularDrawer/utils/calculateProviderTotal.js.map +1 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +6 -4
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +9 -22
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -1
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.d.ts +4 -3
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.js +27 -11
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.js.map +1 -1
- package/lib-es/modularDrawer/utils/index.d.ts +0 -1
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +0 -1
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/modularDrawer/utils/sortByBalance.d.ts +1 -3
- package/lib-es/modularDrawer/utils/sortByBalance.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/sortByBalance.js +5 -15
- package/lib-es/modularDrawer/utils/sortByBalance.js.map +1 -1
- package/lib-es/modularDrawer/utils/type.d.ts +9 -8
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib-es/wallet-api/Exchange/server.js +6 -6
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/package.json +70 -70
- package/src/bridge/generic-alpaca/prepareTransaction.ts +3 -7
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +78 -0
- package/src/bridge/generic-alpaca/types.ts +1 -1
- package/src/exchange/swap/postSwapState.ts +28 -32
- package/src/exchange/swap/setBroadcastTransaction.ts +12 -12
- package/src/exchange/swap/types.ts +3 -3
- package/src/families/tezos/config.ts +2 -2
- package/src/modularDrawer/hooks/modules/useRightMarketTrendModule.tsx +1 -1
- package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +22 -38
- package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +5 -7
- package/src/modularDrawer/modules/createNetworkConfiguration.ts +10 -5
- package/src/modularDrawer/utils/__tests__/calculateProviderTotal.test.ts +237 -0
- package/src/modularDrawer/utils/__tests__/groupAccountsByAsset.test.ts +228 -0
- package/src/modularDrawer/utils/calculateProviderTotal.ts +13 -2
- package/src/modularDrawer/utils/getBalanceAndFiatValueByAssets.ts +13 -37
- package/src/modularDrawer/utils/groupAccountsByAsset.ts +38 -19
- package/src/modularDrawer/utils/index.ts +0 -2
- package/src/modularDrawer/utils/sortByBalance.tsx +5 -18
- package/src/modularDrawer/utils/type.ts +13 -4
- package/src/wallet-api/Exchange/server.ts +6 -6
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts +0 -2
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts.map +0 -1
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.js +0 -496
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.js.map +0 -1
- package/lib/modularDrawer/utils/counterValueFormatter.d.ts +0 -14
- package/lib/modularDrawer/utils/counterValueFormatter.d.ts.map +0 -1
- package/lib/modularDrawer/utils/counterValueFormatter.js +0 -107
- package/lib/modularDrawer/utils/counterValueFormatter.js.map +0 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.d.ts +0 -20
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.d.ts.map +0 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.js +0 -39
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.js.map +0 -1
- package/lib/modularDrawer/utils/parseToBigNumber.d.ts +0 -9
- package/lib/modularDrawer/utils/parseToBigNumber.d.ts.map +0 -1
- package/lib/modularDrawer/utils/parseToBigNumber.js +0 -24
- package/lib/modularDrawer/utils/parseToBigNumber.js.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts +0 -2
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.js +0 -494
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.js.map +0 -1
- package/lib-es/modularDrawer/utils/counterValueFormatter.d.ts +0 -14
- package/lib-es/modularDrawer/utils/counterValueFormatter.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/counterValueFormatter.js +0 -103
- package/lib-es/modularDrawer/utils/counterValueFormatter.js.map +0 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.d.ts +0 -20
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.js +0 -32
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.js.map +0 -1
- package/lib-es/modularDrawer/utils/parseToBigNumber.d.ts +0 -9
- package/lib-es/modularDrawer/utils/parseToBigNumber.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/parseToBigNumber.js +0 -17
- package/lib-es/modularDrawer/utils/parseToBigNumber.js.map +0 -1
- package/src/modularDrawer/utils/__tests__/counterValueFormatter.test.ts +0 -549
- package/src/modularDrawer/utils/counterValueFormatter.ts +0 -165
- package/src/modularDrawer/utils/getBalanceAndFiatValue.ts +0 -53
- package/src/modularDrawer/utils/parseToBigNumber.ts +0 -17
@@ -1,53 +0,0 @@
|
|
1
|
-
import { formatCurrencyUnit } from "@ledgerhq/coin-framework/currencies/formatCurrencyUnit";
|
2
|
-
import { isAccount } from "@ledgerhq/coin-framework/account/helpers";
|
3
|
-
import {
|
4
|
-
getPortfolioCount,
|
5
|
-
getBalanceHistoryWithCountervalue,
|
6
|
-
} from "@ledgerhq/live-countervalues/portfolio";
|
7
|
-
import type { CounterValuesState } from "@ledgerhq/live-countervalues/types";
|
8
|
-
import { Currency } from "@ledgerhq/types-cryptoassets";
|
9
|
-
import { Account, TokenAccount } from "@ledgerhq/types-live";
|
10
|
-
import BigNumber from "bignumber.js";
|
11
|
-
|
12
|
-
/**
|
13
|
-
*
|
14
|
-
* @param account - The account to get the balance and fiat value for
|
15
|
-
* @param state - The current state of countervalues
|
16
|
-
* @param toCurrency - The currency to convert to
|
17
|
-
* @param discreet - Whether to show the balance in discreet mode
|
18
|
-
* @param showCode - Whether to show the currency code in the formatted balance
|
19
|
-
* @returns An object containing the balance and fiat value
|
20
|
-
*/
|
21
|
-
export const getBalanceAndFiatValue = (
|
22
|
-
account: Account | TokenAccount,
|
23
|
-
state: CounterValuesState,
|
24
|
-
toCurrency: Currency,
|
25
|
-
discreet: boolean = false,
|
26
|
-
showCode: boolean = true,
|
27
|
-
) => {
|
28
|
-
const isAnAccount = isAccount(account);
|
29
|
-
const details = isAnAccount ? account.currency : account.token;
|
30
|
-
const balance = formatCurrencyUnit(details.units[0], account.balance, {
|
31
|
-
showCode,
|
32
|
-
discreet,
|
33
|
-
});
|
34
|
-
|
35
|
-
const count = getPortfolioCount([account], "day");
|
36
|
-
const { history, countervalueAvailable } = getBalanceHistoryWithCountervalue(
|
37
|
-
account,
|
38
|
-
"day",
|
39
|
-
count,
|
40
|
-
state,
|
41
|
-
toCurrency,
|
42
|
-
);
|
43
|
-
|
44
|
-
if (!countervalueAvailable) return { balance, fiatValue: undefined };
|
45
|
-
|
46
|
-
const { countervalue } = history[history.length - 1] ?? {};
|
47
|
-
const fiatValue = formatCurrencyUnit(toCurrency.units[0], BigNumber(countervalue ?? 0), {
|
48
|
-
showCode,
|
49
|
-
discreet,
|
50
|
-
});
|
51
|
-
|
52
|
-
return { balance, fiatValue };
|
53
|
-
};
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import BigNumber from "bignumber.js";
|
2
|
-
|
3
|
-
/**
|
4
|
-
*
|
5
|
-
* @param value - The value to parse into a BigNumber. It can be a string, number, or an existing BigNumber instance.
|
6
|
-
* @template T - The type of the value, which can be string, number, or BigNumber.
|
7
|
-
* @returns A BigNumber instance representing the parsed value.
|
8
|
-
*/
|
9
|
-
export const parseToBigNumber = <T extends string | number | BigNumber>(value: T): BigNumber => {
|
10
|
-
if (value instanceof BigNumber) {
|
11
|
-
return value;
|
12
|
-
}
|
13
|
-
if (typeof value === "string") {
|
14
|
-
return new BigNumber(value.replace(/,/g, ""));
|
15
|
-
}
|
16
|
-
return new BigNumber(value);
|
17
|
-
};
|