@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.
Files changed (179) hide show
  1. package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
  2. package/lib/bridge/generic-alpaca/prepareTransaction.js +3 -6
  3. package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
  4. package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js +60 -0
  5. package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
  6. package/lib/bridge/generic-alpaca/types.d.ts +0 -1
  7. package/lib/bridge/generic-alpaca/types.d.ts.map +1 -1
  8. package/lib/exchange/swap/postSwapState.d.ts.map +1 -1
  9. package/lib/exchange/swap/postSwapState.js +19 -23
  10. package/lib/exchange/swap/postSwapState.js.map +1 -1
  11. package/lib/exchange/swap/setBroadcastTransaction.d.ts +4 -4
  12. package/lib/exchange/swap/setBroadcastTransaction.js +7 -7
  13. package/lib/exchange/swap/setBroadcastTransaction.js.map +1 -1
  14. package/lib/exchange/swap/types.d.ts +3 -3
  15. package/lib/exchange/swap/types.d.ts.map +1 -1
  16. package/lib/families/tezos/config.js +2 -2
  17. package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.js +5 -2
  18. package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.js.map +1 -1
  19. package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +5 -8
  20. package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
  21. package/lib/modularDrawer/hooks/useRightBalanceAsset.js +15 -24
  22. package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
  23. package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +6 -25
  24. package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
  25. package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +4 -3
  26. package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
  27. package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
  28. package/lib/modularDrawer/modules/createNetworkConfiguration.js +8 -4
  29. package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
  30. package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts +2 -0
  31. package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts.map +1 -0
  32. package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.js +212 -0
  33. package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.js.map +1 -0
  34. package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts +2 -0
  35. package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts.map +1 -0
  36. package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js +202 -0
  37. package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js.map +1 -0
  38. package/lib/modularDrawer/utils/calculateProviderTotal.d.ts +1 -0
  39. package/lib/modularDrawer/utils/calculateProviderTotal.d.ts.map +1 -1
  40. package/lib/modularDrawer/utils/calculateProviderTotal.js +10 -2
  41. package/lib/modularDrawer/utils/calculateProviderTotal.js.map +1 -1
  42. package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +6 -4
  43. package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -1
  44. package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +9 -22
  45. package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -1
  46. package/lib/modularDrawer/utils/groupAccountsByAsset.d.ts +4 -3
  47. package/lib/modularDrawer/utils/groupAccountsByAsset.d.ts.map +1 -1
  48. package/lib/modularDrawer/utils/groupAccountsByAsset.js +27 -11
  49. package/lib/modularDrawer/utils/groupAccountsByAsset.js.map +1 -1
  50. package/lib/modularDrawer/utils/index.d.ts +0 -1
  51. package/lib/modularDrawer/utils/index.d.ts.map +1 -1
  52. package/lib/modularDrawer/utils/index.js +1 -3
  53. package/lib/modularDrawer/utils/index.js.map +1 -1
  54. package/lib/modularDrawer/utils/sortByBalance.d.ts +1 -3
  55. package/lib/modularDrawer/utils/sortByBalance.d.ts.map +1 -1
  56. package/lib/modularDrawer/utils/sortByBalance.js +6 -18
  57. package/lib/modularDrawer/utils/sortByBalance.js.map +1 -1
  58. package/lib/modularDrawer/utils/type.d.ts +9 -8
  59. package/lib/modularDrawer/utils/type.d.ts.map +1 -1
  60. package/lib/wallet-api/Exchange/server.js +6 -6
  61. package/lib/wallet-api/Exchange/server.js.map +1 -1
  62. package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
  63. package/lib-es/bridge/generic-alpaca/prepareTransaction.js +3 -6
  64. package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
  65. package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js +60 -0
  66. package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
  67. package/lib-es/bridge/generic-alpaca/types.d.ts +0 -1
  68. package/lib-es/bridge/generic-alpaca/types.d.ts.map +1 -1
  69. package/lib-es/exchange/swap/postSwapState.d.ts.map +1 -1
  70. package/lib-es/exchange/swap/postSwapState.js +19 -23
  71. package/lib-es/exchange/swap/postSwapState.js.map +1 -1
  72. package/lib-es/exchange/swap/setBroadcastTransaction.d.ts +4 -4
  73. package/lib-es/exchange/swap/setBroadcastTransaction.js +7 -7
  74. package/lib-es/exchange/swap/setBroadcastTransaction.js.map +1 -1
  75. package/lib-es/exchange/swap/types.d.ts +3 -3
  76. package/lib-es/exchange/swap/types.d.ts.map +1 -1
  77. package/lib-es/families/tezos/config.js +2 -2
  78. package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.js +1 -1
  79. package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.js.map +1 -1
  80. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +5 -8
  81. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
  82. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +15 -24
  83. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
  84. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +6 -25
  85. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
  86. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +4 -3
  87. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
  88. package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
  89. package/lib-es/modularDrawer/modules/createNetworkConfiguration.js +8 -4
  90. package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
  91. package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts +2 -0
  92. package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts.map +1 -0
  93. package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.js +207 -0
  94. package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.js.map +1 -0
  95. package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts +2 -0
  96. package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts.map +1 -0
  97. package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js +197 -0
  98. package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js.map +1 -0
  99. package/lib-es/modularDrawer/utils/calculateProviderTotal.d.ts +1 -0
  100. package/lib-es/modularDrawer/utils/calculateProviderTotal.d.ts.map +1 -1
  101. package/lib-es/modularDrawer/utils/calculateProviderTotal.js +10 -2
  102. package/lib-es/modularDrawer/utils/calculateProviderTotal.js.map +1 -1
  103. package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +6 -4
  104. package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -1
  105. package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +9 -22
  106. package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -1
  107. package/lib-es/modularDrawer/utils/groupAccountsByAsset.d.ts +4 -3
  108. package/lib-es/modularDrawer/utils/groupAccountsByAsset.d.ts.map +1 -1
  109. package/lib-es/modularDrawer/utils/groupAccountsByAsset.js +27 -11
  110. package/lib-es/modularDrawer/utils/groupAccountsByAsset.js.map +1 -1
  111. package/lib-es/modularDrawer/utils/index.d.ts +0 -1
  112. package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
  113. package/lib-es/modularDrawer/utils/index.js +0 -1
  114. package/lib-es/modularDrawer/utils/index.js.map +1 -1
  115. package/lib-es/modularDrawer/utils/sortByBalance.d.ts +1 -3
  116. package/lib-es/modularDrawer/utils/sortByBalance.d.ts.map +1 -1
  117. package/lib-es/modularDrawer/utils/sortByBalance.js +5 -15
  118. package/lib-es/modularDrawer/utils/sortByBalance.js.map +1 -1
  119. package/lib-es/modularDrawer/utils/type.d.ts +9 -8
  120. package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
  121. package/lib-es/wallet-api/Exchange/server.js +6 -6
  122. package/lib-es/wallet-api/Exchange/server.js.map +1 -1
  123. package/package.json +70 -70
  124. package/src/bridge/generic-alpaca/prepareTransaction.ts +3 -7
  125. package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +78 -0
  126. package/src/bridge/generic-alpaca/types.ts +1 -1
  127. package/src/exchange/swap/postSwapState.ts +28 -32
  128. package/src/exchange/swap/setBroadcastTransaction.ts +12 -12
  129. package/src/exchange/swap/types.ts +3 -3
  130. package/src/families/tezos/config.ts +2 -2
  131. package/src/modularDrawer/hooks/modules/useRightMarketTrendModule.tsx +1 -1
  132. package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +22 -38
  133. package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +5 -7
  134. package/src/modularDrawer/modules/createNetworkConfiguration.ts +10 -5
  135. package/src/modularDrawer/utils/__tests__/calculateProviderTotal.test.ts +237 -0
  136. package/src/modularDrawer/utils/__tests__/groupAccountsByAsset.test.ts +228 -0
  137. package/src/modularDrawer/utils/calculateProviderTotal.ts +13 -2
  138. package/src/modularDrawer/utils/getBalanceAndFiatValueByAssets.ts +13 -37
  139. package/src/modularDrawer/utils/groupAccountsByAsset.ts +38 -19
  140. package/src/modularDrawer/utils/index.ts +0 -2
  141. package/src/modularDrawer/utils/sortByBalance.tsx +5 -18
  142. package/src/modularDrawer/utils/type.ts +13 -4
  143. package/src/wallet-api/Exchange/server.ts +6 -6
  144. package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts +0 -2
  145. package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts.map +0 -1
  146. package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.js +0 -496
  147. package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.js.map +0 -1
  148. package/lib/modularDrawer/utils/counterValueFormatter.d.ts +0 -14
  149. package/lib/modularDrawer/utils/counterValueFormatter.d.ts.map +0 -1
  150. package/lib/modularDrawer/utils/counterValueFormatter.js +0 -107
  151. package/lib/modularDrawer/utils/counterValueFormatter.js.map +0 -1
  152. package/lib/modularDrawer/utils/getBalanceAndFiatValue.d.ts +0 -20
  153. package/lib/modularDrawer/utils/getBalanceAndFiatValue.d.ts.map +0 -1
  154. package/lib/modularDrawer/utils/getBalanceAndFiatValue.js +0 -39
  155. package/lib/modularDrawer/utils/getBalanceAndFiatValue.js.map +0 -1
  156. package/lib/modularDrawer/utils/parseToBigNumber.d.ts +0 -9
  157. package/lib/modularDrawer/utils/parseToBigNumber.d.ts.map +0 -1
  158. package/lib/modularDrawer/utils/parseToBigNumber.js +0 -24
  159. package/lib/modularDrawer/utils/parseToBigNumber.js.map +0 -1
  160. package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts +0 -2
  161. package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts.map +0 -1
  162. package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.js +0 -494
  163. package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.js.map +0 -1
  164. package/lib-es/modularDrawer/utils/counterValueFormatter.d.ts +0 -14
  165. package/lib-es/modularDrawer/utils/counterValueFormatter.d.ts.map +0 -1
  166. package/lib-es/modularDrawer/utils/counterValueFormatter.js +0 -103
  167. package/lib-es/modularDrawer/utils/counterValueFormatter.js.map +0 -1
  168. package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.d.ts +0 -20
  169. package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.d.ts.map +0 -1
  170. package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.js +0 -32
  171. package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.js.map +0 -1
  172. package/lib-es/modularDrawer/utils/parseToBigNumber.d.ts +0 -9
  173. package/lib-es/modularDrawer/utils/parseToBigNumber.d.ts.map +0 -1
  174. package/lib-es/modularDrawer/utils/parseToBigNumber.js +0 -17
  175. package/lib-es/modularDrawer/utils/parseToBigNumber.js.map +0 -1
  176. package/src/modularDrawer/utils/__tests__/counterValueFormatter.test.ts +0 -549
  177. package/src/modularDrawer/utils/counterValueFormatter.ts +0 -165
  178. package/src/modularDrawer/utils/getBalanceAndFiatValue.ts +0 -53
  179. package/src/modularDrawer/utils/parseToBigNumber.ts +0 -17
@@ -1,103 +0,0 @@
1
- import { rangeDataTable } from "../../market/utils/rangeDataTable";
2
- export const RANGES = Object.keys(rangeDataTable).filter(key => key !== "1h");
3
- const indexes = [
4
- ["d", 1],
5
- ["K", 1000],
6
- ["M", 1000000],
7
- ["B", 1000000000],
8
- ["T", 1000000000000],
9
- ["Q", 1000000000000000],
10
- ["Qn", 1000000000000000000],
11
- ];
12
- const formatters = {};
13
- const getSanitizedValue = (currency, locale) => {
14
- if (currency) {
15
- return `${formatters[locale][currency]
16
- ?.format(0)
17
- .replace(/[0-9,.]+/, "***")
18
- .trim()}`;
19
- }
20
- return "***";
21
- };
22
- const shouldReturnDash = (value, allowZeroValue, discreetMode) => {
23
- return !discreetMode && (isNaN(value) || (!value && !allowZeroValue));
24
- };
25
- const ensureFormatterExists = (locale, currency, decimalPlaces) => {
26
- if (!formatters[locale])
27
- formatters[locale] = {};
28
- if (currency && !formatters[locale]?.[currency]) {
29
- createCurrencyFormatter(locale, currency, decimalPlaces);
30
- }
31
- else if (!currency && !formatters[locale]?.[`decimal_${decimalPlaces}`]) {
32
- createDecimalFormatter(locale, decimalPlaces);
33
- }
34
- };
35
- const createCurrencyFormatter = (locale, currency, decimalPlaces) => {
36
- try {
37
- formatters[locale][currency] = new Intl.NumberFormat(locale, {
38
- style: "currency",
39
- currency,
40
- });
41
- }
42
- catch {
43
- formatters[locale][currency] = new Intl.NumberFormat(locale, {
44
- style: "decimal",
45
- minimumFractionDigits: decimalPlaces,
46
- maximumFractionDigits: 8,
47
- });
48
- }
49
- };
50
- const createDecimalFormatter = (locale, decimalPlaces) => {
51
- formatters[locale][`decimal_${decimalPlaces}`] = new Intl.NumberFormat(locale, {
52
- style: "decimal",
53
- minimumFractionDigits: decimalPlaces,
54
- maximumFractionDigits: decimalPlaces,
55
- });
56
- };
57
- const getFormatter = (currency, locale, shorten, decimalPlaces) => {
58
- if (currency) {
59
- return formatters[locale][currency];
60
- }
61
- if (shorten) {
62
- return new Intl.NumberFormat(locale, {
63
- notation: "compact",
64
- maximumFractionDigits: 3,
65
- minimumFractionDigits: Math.min(decimalPlaces, 3),
66
- });
67
- }
68
- return formatters[locale][`decimal_${decimalPlaces}`];
69
- };
70
- const formatShortenedValue = (value, formatter, t) => {
71
- const sign = value > 0 ? "" : "-";
72
- const v = Math.abs(value);
73
- const index = Math.floor(Math.log10(v) / 3) || 0;
74
- const [i, n] = indexes[index] || ["", 1];
75
- const roundedValue = Math.round((v / n) * 1000) / 1000;
76
- const number = formatter.format(roundedValue);
77
- const I = t(`numberCompactNotation.${i}`);
78
- const formattedNumber = number.replace(/([0-9,. ]+)/, `${sign}$1 ${I}`);
79
- return formattedNumber.trim();
80
- };
81
- const formatRegularValue = (value, formatter, ticker, currency, locale, discreetMode) => {
82
- if (discreetMode) {
83
- return getSanitizedValue(currency, locale);
84
- }
85
- const formattedValue = formatter.format(value);
86
- const upperCaseTicker = ticker?.trim()?.toLocaleUpperCase();
87
- return `${formattedValue} ${upperCaseTicker}`.trim();
88
- };
89
- export const counterValueFormatter = ({ currency, value, shorten, locale, t, allowZeroValue = false, ticker = "", discreetMode = false, decimalPlaces = 2, }) => {
90
- if (shouldReturnDash(value, allowZeroValue, discreetMode)) {
91
- return "-";
92
- }
93
- ensureFormatterExists(locale, currency, decimalPlaces);
94
- const formatter = getFormatter(currency, locale, shorten, decimalPlaces);
95
- if (!formatter) {
96
- return String(value);
97
- }
98
- if (shorten && t) {
99
- return formatShortenedValue(value, formatter, t);
100
- }
101
- return formatRegularValue(value, formatter, ticker, currency, locale, discreetMode);
102
- };
103
- //# sourceMappingURL=counterValueFormatter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"counterValueFormatter.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/counterValueFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGnE,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC;AAE9E,MAAM,OAAO,GAAuB;IAClC,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,OAAO,CAAC;IACd,CAAC,GAAG,EAAE,UAAU,CAAC;IACjB,CAAC,GAAG,EAAE,aAAa,CAAC;IACpB,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC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M,qBAAqB,GAAG,CAAC,EACpC,QAAQ,EACR,KAAK,EACL,OAAO,EACP,MAAM,EACN,CAAC,EACD,cAAc,GAAG,KAAK,EACtB,MAAM,GAAG,EAAE,EACX,YAAY,GAAG,KAAK,EACpB,aAAa,GAAG,CAAC,GAWlB,EAAU,EAAE;IACX,IAAI,gBAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE;QACzD,OAAO,GAAG,CAAC;KACZ;IAED,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;IAEvD,MAAM,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IAEzE,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;KACtB;IAED,IAAI,OAAO,IAAI,CAAC,EAAE;QAChB,OAAO,oBAAoB,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;KAClD;IAED,OAAO,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AACtF,CAAC,CAAC"}
@@ -1,20 +0,0 @@
1
- import type { CounterValuesState } from "@ledgerhq/live-countervalues/types";
2
- import { Currency } from "@ledgerhq/types-cryptoassets";
3
- import { Account, TokenAccount } from "@ledgerhq/types-live";
4
- /**
5
- *
6
- * @param account - The account to get the balance and fiat value for
7
- * @param state - The current state of countervalues
8
- * @param toCurrency - The currency to convert to
9
- * @param discreet - Whether to show the balance in discreet mode
10
- * @param showCode - Whether to show the currency code in the formatted balance
11
- * @returns An object containing the balance and fiat value
12
- */
13
- export declare const getBalanceAndFiatValue: (account: Account | TokenAccount, state: CounterValuesState, toCurrency: Currency, discreet?: boolean, showCode?: boolean) => {
14
- balance: string;
15
- fiatValue: undefined;
16
- } | {
17
- balance: string;
18
- fiatValue: string;
19
- };
20
- //# sourceMappingURL=getBalanceAndFiatValue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getBalanceAndFiatValue.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getBalanceAndFiatValue.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG7D;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,YACxB,OAAO,GAAG,YAAY,SACxB,kBAAkB,cACb,QAAQ,aACV,OAAO,aACP,OAAO;;;;;;CA2BlB,CAAC"}
@@ -1,32 +0,0 @@
1
- import { formatCurrencyUnit } from "@ledgerhq/coin-framework/currencies/formatCurrencyUnit";
2
- import { isAccount } from "@ledgerhq/coin-framework/account/helpers";
3
- import { getPortfolioCount, getBalanceHistoryWithCountervalue, } from "@ledgerhq/live-countervalues/portfolio";
4
- import BigNumber from "bignumber.js";
5
- /**
6
- *
7
- * @param account - The account to get the balance and fiat value for
8
- * @param state - The current state of countervalues
9
- * @param toCurrency - The currency to convert to
10
- * @param discreet - Whether to show the balance in discreet mode
11
- * @param showCode - Whether to show the currency code in the formatted balance
12
- * @returns An object containing the balance and fiat value
13
- */
14
- export const getBalanceAndFiatValue = (account, state, toCurrency, discreet = false, showCode = true) => {
15
- const isAnAccount = isAccount(account);
16
- const details = isAnAccount ? account.currency : account.token;
17
- const balance = formatCurrencyUnit(details.units[0], account.balance, {
18
- showCode,
19
- discreet,
20
- });
21
- const count = getPortfolioCount([account], "day");
22
- const { history, countervalueAvailable } = getBalanceHistoryWithCountervalue(account, "day", count, state, toCurrency);
23
- if (!countervalueAvailable)
24
- return { balance, fiatValue: undefined };
25
- const { countervalue } = history[history.length - 1] ?? {};
26
- const fiatValue = formatCurrencyUnit(toCurrency.units[0], BigNumber(countervalue ?? 0), {
27
- showCode,
28
- discreet,
29
- });
30
- return { balance, fiatValue };
31
- };
32
- //# sourceMappingURL=getBalanceAndFiatValue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getBalanceAndFiatValue.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getBalanceAndFiatValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AACrE,OAAO,EACL,iBAAiB,EACjB,iCAAiC,GAClC,MAAM,wCAAwC,CAAC;AAIhD,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,OAA+B,EAC/B,KAAyB,EACzB,UAAoB,EACpB,WAAoB,KAAK,EACzB,WAAoB,IAAI,EACxB,EAAE;IACF,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAC/D,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE;QACpE,QAAQ;QACR,QAAQ;KACT,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,iBAAiB,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;IAClD,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE,GAAG,iCAAiC,CAC1E,OAAO,EACP,KAAK,EACL,KAAK,EACL,KAAK,EACL,UAAU,CACX,CAAC;IAEF,IAAI,CAAC,qBAAqB;QAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IAErE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3D,MAAM,SAAS,GAAG,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,YAAY,IAAI,CAAC,CAAC,EAAE;QACtF,QAAQ;QACR,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAChC,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- import BigNumber from "bignumber.js";
2
- /**
3
- *
4
- * @param value - The value to parse into a BigNumber. It can be a string, number, or an existing BigNumber instance.
5
- * @template T - The type of the value, which can be string, number, or BigNumber.
6
- * @returns A BigNumber instance representing the parsed value.
7
- */
8
- export declare const parseToBigNumber: <T extends string | number | BigNumber>(value: T) => BigNumber;
9
- //# sourceMappingURL=parseToBigNumber.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseToBigNumber.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/parseToBigNumber.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,uDAAsD,SAQlF,CAAC"}
@@ -1,17 +0,0 @@
1
- import BigNumber from "bignumber.js";
2
- /**
3
- *
4
- * @param value - The value to parse into a BigNumber. It can be a string, number, or an existing BigNumber instance.
5
- * @template T - The type of the value, which can be string, number, or BigNumber.
6
- * @returns A BigNumber instance representing the parsed value.
7
- */
8
- export const parseToBigNumber = (value) => {
9
- if (value instanceof BigNumber) {
10
- return value;
11
- }
12
- if (typeof value === "string") {
13
- return new BigNumber(value.replace(/,/g, ""));
14
- }
15
- return new BigNumber(value);
16
- };
17
- //# sourceMappingURL=parseToBigNumber.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseToBigNumber.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/parseToBigNumber.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAwC,KAAQ,EAAa,EAAE;IAC7F,IAAI,KAAK,YAAY,SAAS,EAAE;QAC9B,OAAO,KAAK,CAAC;KACd;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;KAC/C;IACD,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC,CAAC"}