@b3dotfun/sdk 0.0.46 → 0.0.47-test.4

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 (174) hide show
  1. package/README.md +6 -225
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +13 -14
  3. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +14 -15
  4. package/dist/cjs/anyspend/react/components/common/OrderHistory.js +2 -2
  5. package/dist/cjs/anyspend/react/components/common/OrderHistoryItem.js +6 -3
  6. package/dist/cjs/anyspend/types/api.d.ts +176 -0
  7. package/dist/cjs/anyspend/utils/chain.js +1 -1
  8. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  9. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +15 -64
  10. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  11. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +26 -21
  12. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +2 -0
  13. package/dist/cjs/global-account/react/components/B3Provider/types.js +2 -0
  14. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  15. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  16. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  17. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  18. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +1 -1
  19. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  20. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +6 -22
  21. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  22. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +3 -2
  23. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  24. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +10 -45
  25. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  26. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -1
  27. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
  28. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +51 -2
  29. package/dist/cjs/global-account/react/hooks/useAuthentication.js +134 -84
  30. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  31. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -1
  32. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +58 -0
  33. package/dist/cjs/global-account/react/hooks/useUserQuery.js +86 -0
  34. package/dist/cjs/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  35. package/dist/cjs/global-account/react/hooks/useWagmiConfig.js +42 -0
  36. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
  37. package/dist/cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.js +245 -0
  38. package/dist/cjs/shared/utils/index.d.ts +0 -1
  39. package/dist/cjs/shared/utils/index.js +0 -1
  40. package/dist/esm/anyspend/react/components/AnySpend.js +14 -15
  41. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +15 -16
  42. package/dist/esm/anyspend/react/components/common/OrderHistory.js +2 -2
  43. package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +8 -5
  44. package/dist/esm/anyspend/types/api.d.ts +176 -0
  45. package/dist/esm/anyspend/utils/chain.js +1 -1
  46. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  47. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +19 -68
  48. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  49. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +24 -19
  50. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +2 -0
  51. package/dist/esm/global-account/react/components/B3Provider/types.js +2 -0
  52. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  53. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  54. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  55. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  56. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
  57. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  58. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +7 -23
  59. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  60. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +4 -3
  61. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  62. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +11 -46
  63. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  64. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
  65. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
  66. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +51 -2
  67. package/dist/esm/global-account/react/hooks/useAuthentication.js +137 -87
  68. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  69. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +3 -2
  70. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +58 -0
  71. package/dist/esm/global-account/react/hooks/useUserQuery.js +83 -0
  72. package/dist/esm/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  73. package/dist/esm/global-account/react/hooks/useWagmiConfig.js +39 -0
  74. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
  75. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +1 -0
  76. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.js +243 -0
  77. package/dist/esm/shared/utils/index.d.ts +0 -1
  78. package/dist/esm/shared/utils/index.js +0 -1
  79. package/dist/styles/index.css +1 -1
  80. package/dist/types/anyspend/types/api.d.ts +176 -0
  81. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  82. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  83. package/dist/types/global-account/react/components/B3Provider/types.d.ts +2 -0
  84. package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  85. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  86. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  87. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  88. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  89. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +51 -2
  90. package/dist/types/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  91. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +58 -0
  92. package/dist/types/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  93. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
  94. package/dist/types/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +1 -0
  95. package/dist/types/shared/utils/index.d.ts +0 -1
  96. package/package.json +4 -23
  97. package/src/anyspend/react/components/AnySpend.tsx +21 -19
  98. package/src/anyspend/react/components/AnyspendDepositHype.tsx +21 -21
  99. package/src/anyspend/react/components/common/OrderHistory.tsx +11 -11
  100. package/src/anyspend/react/components/common/OrderHistoryItem.tsx +124 -129
  101. package/src/anyspend/types/api.ts +176 -0
  102. package/src/anyspend/utils/chain.ts +1 -4
  103. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +51 -35
  104. package/src/global-account/react/components/B3Provider/B3Provider.tsx +28 -72
  105. package/src/global-account/react/components/B3Provider/types.ts +4 -0
  106. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +2 -3
  107. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +1 -1
  108. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  109. package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
  110. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +4 -23
  111. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +4 -3
  112. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +8 -46
  113. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  114. package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
  115. package/src/global-account/react/hooks/useAuthentication.ts +159 -90
  116. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +3 -2
  117. package/src/global-account/react/hooks/useUserQuery.ts +95 -0
  118. package/src/global-account/react/hooks/useWagmiConfig.tsx +44 -0
  119. package/src/global-account/react/stores/useModalStore.ts +0 -2
  120. package/src/shared/utils/index.ts +0 -1
  121. package/dist/cjs/anyspend/react/components/common/ErrorSection.d.ts +0 -6
  122. package/dist/cjs/anyspend/react/components/common/ErrorSection.js +0 -12
  123. package/dist/cjs/notifications/index.d.ts +0 -3
  124. package/dist/cjs/notifications/index.js +0 -25
  125. package/dist/cjs/notifications/react/hooks/index.d.ts +0 -1
  126. package/dist/cjs/notifications/react/hooks/index.js +0 -17
  127. package/dist/cjs/notifications/react/hooks/useNotifications.d.ts +0 -42
  128. package/dist/cjs/notifications/react/hooks/useNotifications.js +0 -148
  129. package/dist/cjs/notifications/react/index.d.ts +0 -1
  130. package/dist/cjs/notifications/react/index.js +0 -17
  131. package/dist/cjs/notifications/services/api.d.ts +0 -67
  132. package/dist/cjs/notifications/services/api.js +0 -184
  133. package/dist/cjs/notifications/services/index.d.ts +0 -1
  134. package/dist/cjs/notifications/services/index.js +0 -17
  135. package/dist/cjs/notifications/types/index.d.ts +0 -51
  136. package/dist/cjs/notifications/types/index.js +0 -2
  137. package/dist/cjs/shared/utils/auth-token.d.ts +0 -7
  138. package/dist/cjs/shared/utils/auth-token.js +0 -17
  139. package/dist/esm/anyspend/react/components/common/ErrorSection.d.ts +0 -6
  140. package/dist/esm/anyspend/react/components/common/ErrorSection.js +0 -9
  141. package/dist/esm/notifications/index.d.ts +0 -3
  142. package/dist/esm/notifications/index.js +0 -7
  143. package/dist/esm/notifications/react/hooks/index.d.ts +0 -1
  144. package/dist/esm/notifications/react/hooks/index.js +0 -1
  145. package/dist/esm/notifications/react/hooks/useNotifications.d.ts +0 -42
  146. package/dist/esm/notifications/react/hooks/useNotifications.js +0 -145
  147. package/dist/esm/notifications/react/index.d.ts +0 -1
  148. package/dist/esm/notifications/react/index.js +0 -1
  149. package/dist/esm/notifications/services/api.d.ts +0 -67
  150. package/dist/esm/notifications/services/api.js +0 -179
  151. package/dist/esm/notifications/services/index.d.ts +0 -1
  152. package/dist/esm/notifications/services/index.js +0 -1
  153. package/dist/esm/notifications/types/index.d.ts +0 -51
  154. package/dist/esm/shared/utils/auth-token.d.ts +0 -7
  155. package/dist/esm/shared/utils/auth-token.js +0 -11
  156. package/dist/types/anyspend/react/components/common/ErrorSection.d.ts +0 -6
  157. package/dist/types/notifications/index.d.ts +0 -3
  158. package/dist/types/notifications/react/hooks/index.d.ts +0 -1
  159. package/dist/types/notifications/react/hooks/useNotifications.d.ts +0 -42
  160. package/dist/types/notifications/react/index.d.ts +0 -1
  161. package/dist/types/notifications/services/api.d.ts +0 -67
  162. package/dist/types/notifications/services/index.d.ts +0 -1
  163. package/dist/types/notifications/types/index.d.ts +0 -51
  164. package/dist/types/shared/utils/auth-token.d.ts +0 -7
  165. package/src/anyspend/react/components/common/ErrorSection.tsx +0 -21
  166. package/src/notifications/index.ts +0 -9
  167. package/src/notifications/react/hooks/index.ts +0 -1
  168. package/src/notifications/react/hooks/useNotifications.ts +0 -153
  169. package/src/notifications/react/index.ts +0 -1
  170. package/src/notifications/services/api.ts +0 -217
  171. package/src/notifications/services/index.ts +0 -1
  172. package/src/notifications/types/index.ts +0 -58
  173. package/src/shared/utils/auth-token.ts +0 -13
  174. /package/dist/{esm/notifications/types/index.js → cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts} +0 -0
@@ -0,0 +1,243 @@
1
+ import { describe, it, expect, vi, beforeEach } from "vitest";
2
+ import { renderHook } from "@testing-library/react";
3
+ import { useCurrencyConversion } from "../useCurrencyConversion.js";
4
+ // Mock the external dependencies
5
+ // Store mock rates for different quote currencies
6
+ const mockRates = {};
7
+ // Mock store state
8
+ const mockStoreState = {
9
+ selectedCurrency: "B3",
10
+ baseCurrency: "B3",
11
+ setSelectedCurrency: vi.fn(),
12
+ setBaseCurrency: vi.fn(),
13
+ };
14
+ vi.mock("@b3dotfun/sdk/global-account/react", () => ({
15
+ useExchangeRate: vi.fn((params) => {
16
+ const rate = mockRates[params?.quoteCurrency];
17
+ return { rate };
18
+ }),
19
+ }));
20
+ vi.mock("@b3dotfun/sdk/shared/utils/number", () => ({
21
+ formatDisplayNumber: vi.fn((value) => {
22
+ const num = Number(value);
23
+ if (isNaN(num))
24
+ return "0";
25
+ return num.toLocaleString("en-US", { maximumFractionDigits: 6 });
26
+ }),
27
+ }));
28
+ vi.mock("../../stores/currencyStore", () => ({
29
+ useCurrencyStore: vi.fn((selector) => {
30
+ if (selector) {
31
+ return selector(mockStoreState);
32
+ }
33
+ return mockStoreState;
34
+ }),
35
+ CURRENCY_SYMBOLS: {
36
+ B3: "B3",
37
+ USD: "$",
38
+ EUR: "€",
39
+ GBP: "£",
40
+ JPY: "¥",
41
+ CAD: "C$",
42
+ AUD: "A$",
43
+ ETH: "ETH",
44
+ SOL: "SOL",
45
+ KRW: "₩",
46
+ },
47
+ }));
48
+ describe("useCurrencyConversion", () => {
49
+ beforeEach(() => {
50
+ vi.clearAllMocks();
51
+ // Reset mock rates to default
52
+ Object.keys(mockRates).forEach(key => delete mockRates[key]);
53
+ mockRates.USD = 1.0;
54
+ // Reset store state
55
+ mockStoreState.selectedCurrency = "B3";
56
+ mockStoreState.baseCurrency = "B3";
57
+ });
58
+ describe("formatCurrencyValue", () => {
59
+ it("should format base currency (B3) without conversion", () => {
60
+ mockStoreState.selectedCurrency = "B3";
61
+ mockStoreState.baseCurrency = "B3";
62
+ const { result } = renderHook(() => useCurrencyConversion());
63
+ const formatted = result.current.formatCurrencyValue(100);
64
+ expect(formatted).toContain("B3");
65
+ expect(formatted).toContain("100");
66
+ });
67
+ it("should show base currency when exchange rate is unavailable", () => {
68
+ mockRates.USD = undefined;
69
+ mockStoreState.selectedCurrency = "USD";
70
+ mockStoreState.baseCurrency = "B3";
71
+ const { result } = renderHook(() => useCurrencyConversion());
72
+ const formatted = result.current.formatCurrencyValue(100);
73
+ expect(formatted).toContain("B3");
74
+ expect(formatted).not.toContain("$");
75
+ });
76
+ it("should format USD with prefix symbol", () => {
77
+ mockRates.USD = 2.0;
78
+ mockStoreState.selectedCurrency = "USD";
79
+ mockStoreState.baseCurrency = "B3";
80
+ const { result } = renderHook(() => useCurrencyConversion());
81
+ const formatted = result.current.formatCurrencyValue(100);
82
+ expect(formatted).toMatch(/^\$/);
83
+ expect(formatted).toContain("200");
84
+ });
85
+ it("should format EUR with prefix symbol", () => {
86
+ mockRates.EUR = 1.8;
87
+ mockRates.USD = 2.0;
88
+ mockStoreState.selectedCurrency = "EUR";
89
+ mockStoreState.baseCurrency = "B3";
90
+ const { result } = renderHook(() => useCurrencyConversion());
91
+ const formatted = result.current.formatCurrencyValue(100);
92
+ expect(formatted).toMatch(/^€/);
93
+ });
94
+ it("should format JPY without decimals", () => {
95
+ mockRates.JPY = 150;
96
+ mockRates.USD = 2.0;
97
+ mockStoreState.selectedCurrency = "JPY";
98
+ mockStoreState.baseCurrency = "B3";
99
+ const { result } = renderHook(() => useCurrencyConversion());
100
+ const formatted = result.current.formatCurrencyValue(100);
101
+ expect(formatted).toContain("¥");
102
+ expect(formatted).not.toContain(".");
103
+ });
104
+ it("should format KRW without decimals", () => {
105
+ mockRates.KRW = 1300;
106
+ mockRates.USD = 2.0;
107
+ mockStoreState.selectedCurrency = "KRW";
108
+ mockStoreState.baseCurrency = "B3";
109
+ const { result } = renderHook(() => useCurrencyConversion());
110
+ const formatted = result.current.formatCurrencyValue(100);
111
+ expect(formatted).toContain("₩");
112
+ expect(formatted).not.toContain(".");
113
+ });
114
+ it("should format ETH with suffix symbol", () => {
115
+ mockRates.ETH = 0.0005;
116
+ mockRates.USD = 2.0;
117
+ mockStoreState.selectedCurrency = "ETH";
118
+ mockStoreState.baseCurrency = "B3";
119
+ const { result } = renderHook(() => useCurrencyConversion());
120
+ const formatted = result.current.formatCurrencyValue(100);
121
+ expect(formatted).toContain("ETH");
122
+ expect(formatted).not.toMatch(/^ETH/);
123
+ });
124
+ it("should format SOL with suffix symbol", () => {
125
+ mockRates.SOL = 0.05;
126
+ mockRates.USD = 2.0;
127
+ mockStoreState.selectedCurrency = "SOL";
128
+ mockStoreState.baseCurrency = "B3";
129
+ const { result } = renderHook(() => useCurrencyConversion());
130
+ const formatted = result.current.formatCurrencyValue(100);
131
+ expect(formatted).toContain("SOL");
132
+ expect(formatted).not.toMatch(/^SOL/);
133
+ });
134
+ it("should handle small USD amounts with proper conversion", () => {
135
+ mockRates.USD = 1.5;
136
+ mockStoreState.selectedCurrency = "USD";
137
+ mockStoreState.baseCurrency = "B3";
138
+ const { result } = renderHook(() => useCurrencyConversion());
139
+ const formatted = result.current.formatCurrencyValue(10);
140
+ // 10 * 1.5 = 15
141
+ expect(formatted).toMatch(/^\$/);
142
+ expect(formatted).toContain("15");
143
+ });
144
+ it("should apply correct exchange rate conversion", () => {
145
+ const testRate = 3.5;
146
+ mockRates.USD = testRate;
147
+ mockStoreState.selectedCurrency = "USD";
148
+ mockStoreState.baseCurrency = "B3";
149
+ const { result } = renderHook(() => useCurrencyConversion());
150
+ const inputValue = 100;
151
+ const formatted = result.current.formatCurrencyValue(inputValue);
152
+ expect(formatted).toContain("350");
153
+ });
154
+ });
155
+ describe("return values", () => {
156
+ it("should return selected currency", () => {
157
+ mockStoreState.selectedCurrency = "USD";
158
+ mockStoreState.baseCurrency = "B3";
159
+ const { result } = renderHook(() => useCurrencyConversion());
160
+ expect(result.current.selectedCurrency).toBe("USD");
161
+ });
162
+ it("should return base currency", () => {
163
+ mockStoreState.selectedCurrency = "USD";
164
+ mockStoreState.baseCurrency = "B3";
165
+ const { result } = renderHook(() => useCurrencyConversion());
166
+ expect(result.current.baseCurrency).toBe("B3");
167
+ });
168
+ it("should return exchange rate", () => {
169
+ const testRate = 2.5;
170
+ mockRates.USD = testRate;
171
+ mockStoreState.selectedCurrency = "USD";
172
+ mockStoreState.baseCurrency = "B3";
173
+ const { result } = renderHook(() => useCurrencyConversion());
174
+ expect(result.current.exchangeRate).toBe(testRate);
175
+ });
176
+ it("should return correct currency symbols", () => {
177
+ mockStoreState.selectedCurrency = "EUR";
178
+ mockStoreState.baseCurrency = "B3";
179
+ const { result } = renderHook(() => useCurrencyConversion());
180
+ expect(result.current.selectedCurrencySymbol).toBe("€");
181
+ expect(result.current.baseCurrencySymbol).toBe("B3");
182
+ });
183
+ });
184
+ describe("formatTooltipValue", () => {
185
+ it("should show USD equivalent when displaying base currency", () => {
186
+ mockRates.USD = 1.5;
187
+ mockStoreState.selectedCurrency = "B3";
188
+ mockStoreState.baseCurrency = "B3";
189
+ const { result } = renderHook(() => useCurrencyConversion());
190
+ const tooltip = result.current.formatTooltipValue(100);
191
+ expect(tooltip).toContain("USD");
192
+ expect(tooltip).toContain("150");
193
+ });
194
+ it("should show base currency when displaying other currency", () => {
195
+ mockRates.EUR = 0.9;
196
+ mockRates.USD = 1.2;
197
+ mockStoreState.selectedCurrency = "EUR";
198
+ mockStoreState.baseCurrency = "B3";
199
+ const { result } = renderHook(() => useCurrencyConversion());
200
+ const tooltip = result.current.formatTooltipValue(100);
201
+ expect(tooltip).toContain("B3");
202
+ expect(tooltip).toContain("100");
203
+ });
204
+ it("should handle custom currency for base currency", () => {
205
+ mockRates.USD = 2.0;
206
+ mockRates.EUR = 1.8;
207
+ mockStoreState.selectedCurrency = "EUR";
208
+ mockStoreState.baseCurrency = "B3";
209
+ const { result } = renderHook(() => useCurrencyConversion());
210
+ const tooltip = result.current.formatTooltipValue(100, "B3");
211
+ expect(tooltip).toContain("USD");
212
+ expect(tooltip).toContain("200");
213
+ });
214
+ it("should handle custom currency for non-base currency", () => {
215
+ mockRates.USD = 2.0;
216
+ mockStoreState.selectedCurrency = "USD";
217
+ mockStoreState.baseCurrency = "B3";
218
+ const { result } = renderHook(() => useCurrencyConversion());
219
+ const tooltip = result.current.formatTooltipValue(50, "ETH");
220
+ expect(tooltip).toContain("ETH");
221
+ expect(tooltip).toContain("50");
222
+ });
223
+ it("should handle absolute values for negative amounts", () => {
224
+ mockRates.USD = 1.5;
225
+ mockStoreState.selectedCurrency = "B3";
226
+ mockStoreState.baseCurrency = "B3";
227
+ const { result } = renderHook(() => useCurrencyConversion());
228
+ const tooltip = result.current.formatTooltipValue(-100);
229
+ expect(tooltip).toContain("USD");
230
+ expect(tooltip).toContain("150");
231
+ expect(tooltip).not.toContain("-");
232
+ });
233
+ it("should handle exchange rate unavailable", () => {
234
+ mockRates.USD = undefined;
235
+ mockStoreState.selectedCurrency = "B3";
236
+ mockStoreState.baseCurrency = "B3";
237
+ const { result } = renderHook(() => useCurrencyConversion());
238
+ const tooltip = result.current.formatTooltipValue(100);
239
+ expect(tooltip).toContain("USD");
240
+ expect(tooltip).toContain("100");
241
+ });
242
+ });
243
+ });
@@ -1,4 +1,3 @@
1
- export * from "./auth-token";
2
1
  export * from "./cn";
3
2
  export * from "./formatNumber";
4
3
  export * from "./formatUsername";
@@ -1,5 +1,4 @@
1
1
  // Export utility functions
2
- export * from "./auth-token.js";
3
2
  export * from "./cn.js";
4
3
  export * from "./formatNumber.js";
5
4
  export * from "./formatUsername.js";