@mezo-org/passport 0.4.0-dev.81 → 0.4.0-dev.83

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 (187) hide show
  1. package/dist/src/api/auth.d.ts +1 -1
  2. package/dist/src/api/auth.d.ts.map +1 -1
  3. package/dist/src/components/Dropdown/Content.d.ts +0 -15
  4. package/dist/src/components/Dropdown/Content.d.ts.map +1 -1
  5. package/dist/src/components/Dropdown/Content.js +3 -3
  6. package/dist/src/components/Dropdown/Content.js.map +1 -1
  7. package/dist/src/components/Dropdown/Dropdown.d.ts +0 -4
  8. package/dist/src/components/Dropdown/Dropdown.d.ts.map +1 -1
  9. package/dist/src/components/Dropdown/Dropdown.js +10 -33
  10. package/dist/src/components/Dropdown/Dropdown.js.map +1 -1
  11. package/dist/src/components/Dropdown/ListingItem.d.ts +8 -7
  12. package/dist/src/components/Dropdown/ListingItem.d.ts.map +1 -1
  13. package/dist/src/components/Dropdown/ListingItem.js +36 -28
  14. package/dist/src/components/Dropdown/ListingItem.js.map +1 -1
  15. package/dist/src/components/Dropdown/NestedViewLayout.d.ts +2 -1
  16. package/dist/src/components/Dropdown/NestedViewLayout.d.ts.map +1 -1
  17. package/dist/src/components/Dropdown/NestedViewLayout.js +13 -15
  18. package/dist/src/components/Dropdown/NestedViewLayout.js.map +1 -1
  19. package/dist/src/components/Dropdown/Receive/Receive.d.ts +1 -4
  20. package/dist/src/components/Dropdown/Receive/Receive.d.ts.map +1 -1
  21. package/dist/src/components/Dropdown/Receive/Receive.js +36 -19
  22. package/dist/src/components/Dropdown/Receive/Receive.js.map +1 -1
  23. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts +2 -5
  24. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts.map +1 -1
  25. package/dist/src/components/Dropdown/Root/AccountAddressActions.js +28 -12
  26. package/dist/src/components/Dropdown/Root/AccountAddressActions.js.map +1 -1
  27. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts +2 -4
  28. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts.map +1 -1
  29. package/dist/src/components/Dropdown/Root/AccountBalance.js +24 -8
  30. package/dist/src/components/Dropdown/Root/AccountBalance.js.map +1 -1
  31. package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts +6 -0
  32. package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts.map +1 -0
  33. package/dist/src/components/Dropdown/Root/AccountBtcListing.js +27 -0
  34. package/dist/src/components/Dropdown/Root/AccountBtcListing.js.map +1 -0
  35. package/dist/src/components/Dropdown/Root/AccountError.d.ts +8 -0
  36. package/dist/src/components/Dropdown/Root/AccountError.d.ts.map +1 -0
  37. package/dist/src/components/Dropdown/Root/AccountError.js +17 -0
  38. package/dist/src/components/Dropdown/Root/AccountError.js.map +1 -0
  39. package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts +4 -0
  40. package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts.map +1 -0
  41. package/dist/src/components/Dropdown/Root/AccountMusdListing.js +21 -0
  42. package/dist/src/components/Dropdown/Root/AccountMusdListing.js.map +1 -0
  43. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts +2 -3
  44. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts.map +1 -1
  45. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js +34 -39
  46. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js.map +1 -1
  47. package/dist/src/components/Dropdown/Root/Root.d.ts +0 -15
  48. package/dist/src/components/Dropdown/Root/Root.d.ts.map +1 -1
  49. package/dist/src/components/Dropdown/Root/Root.js +22 -34
  50. package/dist/src/components/Dropdown/Root/Root.js.map +1 -1
  51. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts +2 -6
  52. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts.map +1 -1
  53. package/dist/src/components/Dropdown/Root/WalletAddress.js +43 -34
  54. package/dist/src/components/Dropdown/Root/WalletAddress.js.map +1 -1
  55. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts +2 -4
  56. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts.map +1 -1
  57. package/dist/src/components/Dropdown/Root/WelcomeBlock.js +60 -16
  58. package/dist/src/components/Dropdown/Root/WelcomeBlock.js.map +1 -1
  59. package/dist/src/components/Dropdown/SlotNumber.d.ts +19 -0
  60. package/dist/src/components/Dropdown/SlotNumber.d.ts.map +1 -0
  61. package/dist/src/components/Dropdown/SlotNumber.js +67 -0
  62. package/dist/src/components/Dropdown/SlotNumber.js.map +1 -0
  63. package/dist/src/config.d.ts +1 -11
  64. package/dist/src/config.d.ts.map +1 -1
  65. package/dist/src/config.js +3 -40
  66. package/dist/src/config.js.map +1 -1
  67. package/dist/src/constants.d.ts +0 -2
  68. package/dist/src/constants.d.ts.map +1 -1
  69. package/dist/src/constants.js +0 -2
  70. package/dist/src/constants.js.map +1 -1
  71. package/dist/src/hooks/useAssetsConversionRates.d.ts +8 -13
  72. package/dist/src/hooks/useAssetsConversionRates.d.ts.map +1 -1
  73. package/dist/src/hooks/useAssetsConversionRates.js +44 -67
  74. package/dist/src/hooks/useAssetsConversionRates.js.map +1 -1
  75. package/dist/src/hooks/useAuthenticateWithWallet.d.ts.map +1 -1
  76. package/dist/src/hooks/useAuthenticateWithWallet.js +1 -1
  77. package/dist/src/hooks/useAuthenticateWithWallet.js.map +1 -1
  78. package/dist/src/hooks/useBorrowData.d.ts +31 -5
  79. package/dist/src/hooks/useBorrowData.d.ts.map +1 -1
  80. package/dist/src/hooks/useBorrowData.js +53 -11
  81. package/dist/src/hooks/useBorrowData.js.map +1 -1
  82. package/dist/src/hooks/useCreateAccount.d.ts.map +1 -1
  83. package/dist/src/hooks/useCreateAccount.js +3 -3
  84. package/dist/src/hooks/useCreateAccount.js.map +1 -1
  85. package/dist/src/hooks/useGetCurrentAccount.d.ts +2 -2
  86. package/dist/src/hooks/useGetCurrentAccount.d.ts.map +1 -1
  87. package/dist/src/hooks/useGetCurrentAccount.js +4 -6
  88. package/dist/src/hooks/useGetCurrentAccount.js.map +1 -1
  89. package/dist/src/hooks/useLinkAccount.d.ts.map +1 -1
  90. package/dist/src/hooks/useLinkAccount.js +3 -3
  91. package/dist/src/hooks/useLinkAccount.js.map +1 -1
  92. package/dist/src/hooks/useTokensBalances.d.ts +36 -35
  93. package/dist/src/hooks/useTokensBalances.d.ts.map +1 -1
  94. package/dist/src/hooks/useTokensBalances.js +93 -52
  95. package/dist/src/hooks/useTokensBalances.js.map +1 -1
  96. package/dist/src/hooks/useWalletAccount.d.ts +8 -10
  97. package/dist/src/hooks/useWalletAccount.d.ts.map +1 -1
  98. package/dist/src/hooks/useWalletAccount.js +22 -19
  99. package/dist/src/hooks/useWalletAccount.js.map +1 -1
  100. package/dist/src/index.d.ts +1 -1
  101. package/dist/src/index.d.ts.map +1 -1
  102. package/dist/src/index.js +1 -1
  103. package/dist/src/index.js.map +1 -1
  104. package/dist/src/lib/contracts/index.d.ts +1 -1
  105. package/dist/src/lib/contracts/index.d.ts.map +1 -1
  106. package/dist/src/lib/contracts/index.js +4 -0
  107. package/dist/src/lib/contracts/index.js.map +1 -1
  108. package/dist/src/provider.d.ts +7 -1
  109. package/dist/src/provider.d.ts.map +1 -1
  110. package/dist/src/provider.js +4 -1
  111. package/dist/src/provider.js.map +1 -1
  112. package/dist/src/utils/assets.d.ts +145 -0
  113. package/dist/src/utils/assets.d.ts.map +1 -0
  114. package/dist/src/utils/assets.js +100 -0
  115. package/dist/src/utils/assets.js.map +1 -0
  116. package/dist/src/utils/assets.test.d.ts +2 -0
  117. package/dist/src/utils/assets.test.d.ts.map +1 -0
  118. package/dist/src/utils/assets.test.js +46 -0
  119. package/dist/src/utils/assets.test.js.map +1 -0
  120. package/dist/src/utils/currency.d.ts +6 -3
  121. package/dist/src/utils/currency.d.ts.map +1 -1
  122. package/dist/src/utils/currency.js +13 -10
  123. package/dist/src/utils/currency.js.map +1 -1
  124. package/dist/src/utils/currency.test.js +44 -2
  125. package/dist/src/utils/currency.test.js.map +1 -1
  126. package/dist/src/utils/numbers.d.ts +13 -53
  127. package/dist/src/utils/numbers.d.ts.map +1 -1
  128. package/dist/src/utils/numbers.js +16 -118
  129. package/dist/src/utils/numbers.js.map +1 -1
  130. package/dist/src/utils/numbers.test.js +24 -142
  131. package/dist/src/utils/numbers.test.js.map +1 -1
  132. package/package.json +2 -1
  133. package/src/api/auth.ts +1 -1
  134. package/src/components/Dropdown/Content.tsx +3 -48
  135. package/src/components/Dropdown/Dropdown.tsx +7 -55
  136. package/src/components/Dropdown/ListingItem.tsx +155 -59
  137. package/src/components/Dropdown/NestedViewLayout.tsx +32 -20
  138. package/src/components/Dropdown/Receive/Receive.tsx +69 -32
  139. package/src/components/Dropdown/Root/AccountAddressActions.tsx +64 -35
  140. package/src/components/Dropdown/Root/AccountBalance.tsx +54 -16
  141. package/src/components/Dropdown/Root/AccountBtcListing.tsx +52 -0
  142. package/src/components/Dropdown/Root/AccountError.tsx +34 -0
  143. package/src/components/Dropdown/Root/AccountMusdListing.tsx +45 -0
  144. package/src/components/Dropdown/Root/AccountOtherAssets.tsx +63 -46
  145. package/src/components/Dropdown/Root/Root.tsx +28 -98
  146. package/src/components/Dropdown/Root/WalletAddress.tsx +95 -89
  147. package/src/components/Dropdown/Root/WelcomeBlock.tsx +109 -29
  148. package/src/components/Dropdown/SlotNumber.tsx +131 -0
  149. package/src/config.ts +3 -59
  150. package/src/constants.ts +0 -6
  151. package/src/hooks/useAssetsConversionRates.ts +49 -67
  152. package/src/hooks/useAuthenticateWithWallet.ts +7 -5
  153. package/src/hooks/useBorrowData.ts +71 -12
  154. package/src/hooks/useCreateAccount.ts +5 -4
  155. package/src/hooks/useGetCurrentAccount.ts +5 -7
  156. package/src/hooks/useLinkAccount.ts +5 -4
  157. package/src/hooks/useTokensBalances.ts +152 -74
  158. package/src/hooks/useWalletAccount.ts +27 -36
  159. package/src/index.ts +0 -1
  160. package/src/lib/contracts/index.ts +8 -1
  161. package/src/provider.ts +11 -3
  162. package/src/utils/assets.test.ts +57 -0
  163. package/src/utils/assets.ts +103 -0
  164. package/src/utils/currency.test.ts +76 -2
  165. package/src/utils/currency.ts +20 -15
  166. package/src/utils/numbers.test.ts +29 -180
  167. package/src/utils/numbers.ts +22 -171
  168. package/dist/src/components/Dropdown/Root/AccountAssetItem.d.ts +0 -11
  169. package/dist/src/components/Dropdown/Root/AccountAssetItem.d.ts.map +0 -1
  170. package/dist/src/components/Dropdown/Root/AccountAssetItem.js +0 -9
  171. package/dist/src/components/Dropdown/Root/AccountAssetItem.js.map +0 -1
  172. package/dist/src/hooks/useDropdownData.d.ts +0 -47
  173. package/dist/src/hooks/useDropdownData.d.ts.map +0 -1
  174. package/dist/src/hooks/useDropdownData.js +0 -97
  175. package/dist/src/hooks/useDropdownData.js.map +0 -1
  176. package/dist/src/utils/cryptoAssets.d.ts +0 -44
  177. package/dist/src/utils/cryptoAssets.d.ts.map +0 -1
  178. package/dist/src/utils/cryptoAssets.js +0 -129
  179. package/dist/src/utils/cryptoAssets.js.map +0 -1
  180. package/dist/src/utils/cryptoAssets.test.d.ts +0 -2
  181. package/dist/src/utils/cryptoAssets.test.d.ts.map +0 -1
  182. package/dist/src/utils/cryptoAssets.test.js +0 -67
  183. package/dist/src/utils/cryptoAssets.test.js.map +0 -1
  184. package/src/components/Dropdown/Root/AccountAssetItem.tsx +0 -26
  185. package/src/hooks/useDropdownData.ts +0 -152
  186. package/src/utils/cryptoAssets.test.ts +0 -79
  187. package/src/utils/cryptoAssets.ts +0 -171
@@ -1,4 +1,4 @@
1
- import { formatNumberToCompactString, fromFixedPoint, roundUpNumber, formatNumberToLocaleString, fromFixedPointToString, bigIntMax, } from "./numbers";
1
+ import { formatNumberToCompactString, bigIntMax, normalizePrecision, } from "./numbers";
2
2
  describe("formatNumberToCompactString", () => {
3
3
  it("formats number less than 1000 with decimals", () => {
4
4
  expect(formatNumberToCompactString(123.456789, 2)).toBe("123.46");
@@ -26,147 +26,6 @@ describe("formatNumberToCompactString", () => {
26
26
  expect(formatNumberToCompactString(1_000, 2)).toBe("1K");
27
27
  });
28
28
  });
29
- describe("roundUpNumber", () => {
30
- it("rounds up to 2 decimals", () => {
31
- expect(roundUpNumber(1.234)).toBe(1.24);
32
- });
33
- it("rounds up to 3 decimals", () => {
34
- expect(roundUpNumber(9.87654, 3)).toBe(9.877);
35
- });
36
- it("rounds up exact decimal", () => {
37
- expect(roundUpNumber(2.5, 1)).toBe(2.5);
38
- });
39
- });
40
- describe("fromFixedPoint", () => {
41
- it("converts fixed point with 18 decimals to float", () => {
42
- const raw = 1234567890000000000n; // 1.23456789 ETH in 18 decimals
43
- expect(fromFixedPoint(raw, 18)).toBe(1.2345);
44
- });
45
- it("converts with truncation to 2 decimals", () => {
46
- const raw = 987654321000000000n; // ~0.987654321 ETH
47
- expect(fromFixedPoint(raw, 18, 2)).toBe(0.98);
48
- });
49
- it("handles large fixedPoint decimals", () => {
50
- const raw = 1000000000000000000000000n; // 1M with 6 decimals
51
- expect(fromFixedPoint(raw, 6, 2)).toBe(1000000000000000000);
52
- });
53
- });
54
- describe("formatNumberToLocaleString", () => {
55
- it("formats zero with 0 decimals", () => {
56
- expect(formatNumberToLocaleString(0, 0)).toBe("0");
57
- });
58
- it("formats zero with >0 decimals", () => {
59
- expect(formatNumberToLocaleString(0, 2)).toBe("0.00");
60
- expect(formatNumberToLocaleString(0, 4)).toBe("0.0000");
61
- });
62
- it("formats small decimal number", () => {
63
- expect(formatNumberToLocaleString(0.123456, 2)).toBe("0.12");
64
- expect(formatNumberToLocaleString(0.123456, 4)).toBe("0.1235");
65
- });
66
- it("formats number just above 1", () => {
67
- expect(formatNumberToLocaleString(1.000001, 3)).toBe("1.000");
68
- expect(formatNumberToLocaleString(1.234567, 2)).toBe("1.23");
69
- });
70
- it("formats whole number", () => {
71
- expect(formatNumberToLocaleString(1234, 0)).toBe("1,234");
72
- expect(formatNumberToLocaleString(1000, 2)).toBe("1,000.00");
73
- });
74
- it("formats number with trailing decimal zeroes", () => {
75
- expect(formatNumberToLocaleString(10.1, 3)).toBe("10.100");
76
- expect(formatNumberToLocaleString(5.0, 2)).toBe("5.00");
77
- });
78
- it("formats string input", () => {
79
- expect(formatNumberToLocaleString("123.456", 2)).toBe("123.46");
80
- expect(formatNumberToLocaleString("0.00123", 4)).toBe("0.0012");
81
- });
82
- it("formats negative number", () => {
83
- expect(formatNumberToLocaleString(-123.456, 2)).toBe("-123.46");
84
- expect(formatNumberToLocaleString("-0.00999", 3)).toBe("-0.010");
85
- });
86
- it("formats large number with commas", () => {
87
- expect(formatNumberToLocaleString(12345678.9, 2)).toBe("12,345,678.90");
88
- });
89
- it("handles max decimals safely", () => {
90
- expect(formatNumberToLocaleString(1.123456789, 8)).toBe("1.12345679");
91
- expect(formatNumberToLocaleString("0.000000000000000001", 18)).toBe("0.000000000000000001");
92
- });
93
- it("defaults to 0 decimals if not passed", () => {
94
- expect(formatNumberToLocaleString(1234.567)).toBe("1,235"); // rounds up by default
95
- });
96
- });
97
- describe("fromFixedPointToString", () => {
98
- const toFixedPoint = (num) => BigInt(Math.round(num * 1e18));
99
- const cases = [
100
- { input: 2.0, expected: "2.000" },
101
- { input: 2.009, expected: "2.009" },
102
- { input: 2.01, expected: "2.010" },
103
- { input: 2.015, expected: "2.016" },
104
- { input: 2.05, expected: "2.050" },
105
- { input: 2.09, expected: "2.090" },
106
- ];
107
- describe("withRoundUp: true", () => {
108
- cases.forEach(({ input, expected }) => {
109
- it(`formats ${input} → ${expected}`, () => {
110
- const fixed = toFixedPoint(input);
111
- expect(fromFixedPointToString(fixed, 18, 3, true)).toBe(expected);
112
- });
113
- });
114
- });
115
- describe("withRoundUp: false", () => {
116
- const noRoundCases = [
117
- { input: 2.0099, expected: "2.009" },
118
- { input: 2.0159, expected: "2.015" },
119
- { input: 2.0101, expected: "2.010" },
120
- { input: 2.0199, expected: "2.019" },
121
- ];
122
- noRoundCases.forEach(({ input, expected }) => {
123
- it(`formats ${input} → ${expected} (no rounding)`, () => {
124
- const fixed = toFixedPoint(input);
125
- expect(fromFixedPointToString(fixed, 18, 3, false)).toBe(expected);
126
- });
127
- });
128
- });
129
- describe("zero handling", () => {
130
- it("formats 0 → 0.000 (3 decimals)", () => {
131
- expect(fromFixedPointToString(0n, 18, 3)).toBe("0.000");
132
- });
133
- it("formats 0 → 0.0000 (4 decimals)", () => {
134
- expect(fromFixedPointToString(0n, 18, 4)).toBe("0.0000");
135
- });
136
- });
137
- describe("very small numbers below display threshold", () => {
138
- it("returns <0.0001 for small number (3 decimals)", () => {
139
- const small = BigInt(123); // ~1.23e-16
140
- expect(fromFixedPointToString(small, 18, 4)).toBe("<0.0001");
141
- });
142
- it("returns <0.01 for small number with only 2 decimals", () => {
143
- const tiny = BigInt(9999999999999); // <0.01
144
- expect(fromFixedPointToString(tiny, 18, 2)).toBe("<0.01");
145
- });
146
- });
147
- describe("input types", () => {
148
- it("accepts bigint", () => {
149
- const amount = 2100000000000000000n;
150
- expect(fromFixedPointToString(amount, 18, 3)).toBe("2.100");
151
- });
152
- it("accepts string", () => {
153
- expect(fromFixedPointToString("2000000000000000000", 18, 3)).toBe("2.000");
154
- });
155
- it("accepts number", () => {
156
- expect(fromFixedPointToString(Number("1000000000000000000"), 18, 3)).toBe("1.000");
157
- });
158
- });
159
- describe("high values", () => {
160
- it("formats 1_000_000.123456789 correctly", () => {
161
- const big = toFixedPoint(1_000_000.123456789);
162
- expect(fromFixedPointToString(big, 18, 6)).toBe("1,000,000.123456");
163
- });
164
- it("formats 1e12 ETH", () => {
165
- const big = BigInt("1000000000000000000000000000000");
166
- expect(fromFixedPointToString(big, 18, 2)).toBe("1,000,000,000,000.00");
167
- });
168
- });
169
- });
170
29
  describe("bigIntMax", () => {
171
30
  it("returns the maximum of positive bigint values", () => {
172
31
  expect(bigIntMax(1n, 2n, 3n)).toBe(3n);
@@ -187,4 +46,27 @@ describe("bigIntMax", () => {
187
46
  expect(bigIntMax(5n, 5n, 5n)).toBe(5n);
188
47
  });
189
48
  });
49
+ describe("normalizePrecision", () => {
50
+ it("reduces precision correctly (scale down)", () => {
51
+ const result = normalizePrecision(1234500n, 6, 3);
52
+ expect(result).toBe(1234n);
53
+ });
54
+ it("increases precision correctly (scale up)", () => {
55
+ const result = normalizePrecision(1234n, 3, 6);
56
+ expect(result).toBe(1234000n);
57
+ });
58
+ it("returns the same value when precision is equal", () => {
59
+ const result = normalizePrecision(987654321n, 5, 5);
60
+ expect(result).toBe(987654321n);
61
+ });
62
+ it("handles zero value correctly", () => {
63
+ const result = normalizePrecision(0n, 4, 8);
64
+ expect(result).toBe(0n);
65
+ });
66
+ it("handles large numbers without precision loss", () => {
67
+ const value = 123456789012345678901234567890n;
68
+ const result = normalizePrecision(value, 18, 20);
69
+ expect(result).toBe(value * 100n);
70
+ });
71
+ });
190
72
  //# sourceMappingURL=numbers.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"numbers.test.js","sourceRoot":"","sources":["../../../src/utils/numbers.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,cAAc,EACd,aAAa,EACb,0BAA0B,EAC1B,sBAAsB,EACtB,SAAS,GACV,MAAM,WAAW,CAAA;AAElB,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,CAAC,2BAA2B,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACnE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,MAAM,CAAC,2BAA2B,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC/D,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,MAAM,CAAC,2BAA2B,CAAC,UAAU,EAAE,CAAC,CAAC,CA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,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,MAAM,GAAG,kBAAkB,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACzB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,KAAK,GAAG,+BAA+B,CAAA;QAC7C,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;QAChD,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAA;IACnC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mezo-org/passport",
3
- "version": "0.4.0-dev.81",
3
+ "version": "0.4.0-dev.83",
4
4
  "main": "dist/src/index.js",
5
5
  "license": "GPL-3.0-only",
6
6
  "scripts": {
@@ -45,6 +45,7 @@
45
45
  "qrcode.react": "^4.2.0",
46
46
  "styletron-engine-monolithic": "^1.0.0",
47
47
  "usehooks-ts": "^3.1.1",
48
+ "motion": "^12.23.6",
48
49
  "zustand": "^5.0.3"
49
50
  },
50
51
  "peerDependencies": {
package/src/api/auth.ts CHANGED
@@ -55,7 +55,7 @@ export type CreateSessionResponse =
55
55
 
56
56
  export type DeleteSessionResponse = { message: string }
57
57
 
58
- export type GetCurrentAccountResponse = Partial<Account> | null
58
+ export type GetCurrentAccountResponse = Account | null
59
59
 
60
60
  export type GetAccountByMezoIdOrAddressResponse = {
61
61
  mezoId?: string
@@ -3,44 +3,15 @@ import React, { useEffect } from "react"
3
3
  import useDropdownStore, { DropdownView } from "../../stores/dropdownStore"
4
4
  import Root from "./Root/Root"
5
5
  import Receive from "./Receive/Receive"
6
- import { DetailedCryptoAsset } from "../../utils/cryptoAssets"
7
6
  import TestnetTopBanner from "./TestnetTopBanner"
8
7
 
9
8
  type ContentProps = {
10
- mezoId: string
11
- matsBalance: number
12
- accountAddress: string
13
- walletAddress: string
14
- walletType: "bitcoin" | "evm"
15
- usdTotalBalance: number
16
- usdTroveDebt: number
17
- usdCollateral: number
18
- assets: {
19
- btc: DetailedCryptoAsset
20
- musd: DetailedCryptoAsset
21
- }
22
- otherAssetsCount: number
23
- otherAssetsUsdTotal: number
24
9
  onSignOut?: () => void
25
10
  onOtherAssetsClick?: () => void
26
11
  }
27
12
 
28
13
  function Content(props: ContentProps) {
29
- const {
30
- mezoId,
31
- accountAddress,
32
- walletAddress,
33
- walletType,
34
- usdTotalBalance,
35
- assets,
36
- matsBalance,
37
- usdTroveDebt,
38
- usdCollateral,
39
- otherAssetsCount,
40
- otherAssetsUsdTotal,
41
- onSignOut,
42
- onOtherAssetsClick,
43
- } = props
14
+ const { onSignOut, onOtherAssetsClick } = props
44
15
 
45
16
  const [_, theme] = useStyletron()
46
17
 
@@ -71,26 +42,10 @@ function Content(props: ContentProps) {
71
42
  <TestnetTopBanner />
72
43
 
73
44
  {currentView === DropdownView.ROOT && (
74
- <Root
75
- mezoId={mezoId}
76
- accountAddress={accountAddress}
77
- walletAddress={walletAddress}
78
- walletType={walletType}
79
- usdTotalBalance={usdTotalBalance}
80
- assets={assets}
81
- matsBalance={matsBalance}
82
- usdTroveDebt={usdTroveDebt}
83
- usdCollateral={usdCollateral}
84
- otherAssetsCount={otherAssetsCount}
85
- otherAssetsUsdTotal={otherAssetsUsdTotal}
86
- onSignOut={onSignOut}
87
- onOtherAssetsClick={onOtherAssetsClick}
88
- />
45
+ <Root onSignOut={onSignOut} onOtherAssetsClick={onOtherAssetsClick} />
89
46
  )}
90
47
 
91
- {currentView === DropdownView.RECEIVE && (
92
- <Receive address={accountAddress} />
93
- )}
48
+ {currentView === DropdownView.RECEIVE && <Receive />}
94
49
  </Block>
95
50
  )
96
51
  }
@@ -5,15 +5,13 @@ import {
5
5
  useStyletron,
6
6
  } from "@mezo-org/mezo-clay"
7
7
  import { useConnectModal } from "@rainbow-me/rainbowkit"
8
- import React, { useEffect, useMemo } from "react"
9
- import { useDisconnect } from "wagmi"
8
+ import React from "react"
10
9
  import DefaultAvatar from "../../assets/DefaultAvatar"
11
- import useWalletAccount from "../../hooks/useWalletAccount"
12
10
  import ConnectedTrigger from "./ConnectedTrigger"
13
11
  import Content from "./Content"
14
12
  import DisconnectedTrigger from "./DisconnectedTrigger"
15
- import { useSignInWithWallet } from "../../hooks"
16
- import useDropdownData from "../../hooks/useDropdownData"
13
+ import useWalletAccount from "../../hooks/useWalletAccount"
14
+ import { useWatchTransferEventsForAllTokens } from "../../hooks/useWatchTransferEvents"
17
15
 
18
16
  export type DropdownProps = {
19
17
  /** The callback to be called when the user clicks the sign-out button */
@@ -28,10 +26,6 @@ export type DropdownProps = {
28
26
  signedOut?: Omit<ButtonProps, "onClick">
29
27
  }
30
28
  onOtherAssetsClick?: () => void
31
- /** Time in milliseconds after which account data (like mats or mezo id) in dropdown should be re-fetched. Default is 90000 (90 secs) */
32
- accountDataRefetchInterval?: number
33
- /** Time in milliseconds after which native balance in dropdown should be re-fetched. Default is 90000 (90 secs) */
34
- nativeBalanceRefetchInterval?: number
35
29
  } & Omit<StatefulPopoverProps, "children" | "content">
36
30
 
37
31
  /**
@@ -48,54 +42,23 @@ export function Dropdown(props: DropdownProps) {
48
42
  overrides,
49
43
  triggerProps,
50
44
  onOtherAssetsClick,
51
- accountDataRefetchInterval,
52
- nativeBalanceRefetchInterval,
53
45
  ...restProps
54
46
  } = props
55
47
 
56
48
  const [, theme] = useStyletron()
57
49
 
58
- const data = useDropdownData({
59
- accountDataRefetchInterval,
60
- nativeBalanceRefetchInterval,
61
- })
50
+ const { data: walletAccountData } = useWalletAccount()
62
51
 
63
- const isCriticalDropdownDataLoaded = useMemo(
64
- () => Boolean(data.mezoId && data.accountAddress && data.walletAddress),
65
- [data],
66
- )
52
+ useWatchTransferEventsForAllTokens()
67
53
 
68
54
  const { openConnectModal } = useConnectModal()
69
55
 
70
- const { isConnected } = useWalletAccount()
71
-
72
- const { signInWithWalletAsync, isPending } = useSignInWithWallet()
73
-
74
- const { disconnectAsync } = useDisconnect()
75
-
76
- useEffect(() => {
77
- if (onSignIn) return
78
-
79
- const handleSignIn = async () => {
80
- if (!isConnected) return
81
-
82
- try {
83
- await signInWithWalletAsync()
84
- } catch (error) {
85
- await disconnectAsync()
86
- }
87
- }
88
-
89
- handleSignIn()
90
- }, [disconnectAsync, isConnected, onSignIn, signInWithWalletAsync])
91
-
92
- if (!isConnected || !isCriticalDropdownDataLoaded) {
56
+ if (!walletAccountData?.isConnected) {
93
57
  return (
94
58
  <DisconnectedTrigger
95
59
  // If connect wallet flow is not provided it fallbacks to RainbowKit's
96
60
  // connect modal
97
61
  onClick={onSignIn || openConnectModal}
98
- isLoading={isPending}
99
62
  {...triggerProps?.signedOut}
100
63
  >
101
64
  Sign in
@@ -107,17 +70,6 @@ export function Dropdown(props: DropdownProps) {
107
70
  <StatefulPopover
108
71
  content={
109
72
  <Content
110
- mezoId={data.mezoId!}
111
- matsBalance={data.matsBalance}
112
- accountAddress={data.accountAddress!}
113
- walletAddress={data.walletAddress!}
114
- walletType={data.walletType}
115
- usdTotalBalance={data.usdTotalBalance}
116
- usdTroveDebt={data.usdTroveDebt}
117
- usdCollateral={data.usdCollateral}
118
- assets={data.assets}
119
- otherAssetsCount={data.otherAssetsCount}
120
- otherAssetsUsdTotal={data.otherAssetsUsdTotal}
121
73
  onSignOut={onSignOut}
122
74
  onOtherAssetsClick={onOtherAssetsClick}
123
75
  />
@@ -129,7 +81,7 @@ export function Dropdown(props: DropdownProps) {
129
81
  Body: {
130
82
  ...overrides?.Body,
131
83
  style: {
132
- width: "396px",
84
+ width: "402px",
133
85
  borderRadius: theme.borders.radius500,
134
86
  boxShadow: theme.lighting.shadow500,
135
87
  overflow: "hidden",
@@ -1,80 +1,176 @@
1
1
  import {
2
- ListItem,
3
- ListItemLabel,
4
2
  mergeOverrides,
5
- ListItemLabelProps,
6
- IconProps,
7
- ListItemProps,
3
+ Block,
4
+ useStyletron,
5
+ BlockProps,
6
+ Skeleton,
7
+ LabelMedium,
8
+ ParagraphSmall,
8
9
  } from "@mezo-org/mezo-clay"
9
- import React, { FC } from "react"
10
+ import React, { ReactNode } from "react"
11
+ import SlotNumber from "./SlotNumber"
12
+ import { formatUsd } from "../../utils/currency"
10
13
 
11
- const SHARED_LABEL_OVERRIDES: ListItemLabelProps["overrides"] = {
12
- LabelDescription: {
13
- style: {
14
- color: "#4B4B4B", // contentSecondary
15
- },
16
- },
14
+ type ListingItemLayoutProps = Omit<BlockProps, "children"> & {
15
+ icon: ReactNode
16
+ label: ReactNode
17
+ value: ReactNode
18
+ subLabel: ReactNode
19
+ subValue: ReactNode
20
+ }
21
+
22
+ function ListingItemLayout(props: ListingItemLayoutProps) {
23
+ const { icon, label, value, subLabel, subValue, overrides, ...restProps } =
24
+ props
25
+ const [, theme] = useStyletron()
26
+
27
+ return (
28
+ <Block
29
+ display="flex"
30
+ alignItems="center"
31
+ paddingLeft={theme.sizing.scale600}
32
+ paddingRight={theme.sizing.scale600}
33
+ overrides={mergeOverrides(
34
+ {
35
+ Block: {
36
+ style: {
37
+ gap: theme.sizing.scale600,
38
+ minHeight: "72px",
39
+ },
40
+ },
41
+ },
42
+ overrides,
43
+ )}
44
+ {...restProps}
45
+ >
46
+ {icon && icon}
47
+
48
+ <Block display="flex" flexDirection="column" alignItems="flex-start">
49
+ {label && label}
50
+ {subLabel && subLabel}
51
+ </Block>
52
+
53
+ <Block
54
+ display="flex"
55
+ flexDirection="column"
56
+ alignItems="flex-end"
57
+ marginLeft="auto"
58
+ >
59
+ {value && value}
60
+ {subValue && subValue}
61
+ </Block>
62
+ </Block>
63
+ )
17
64
  }
18
65
 
19
66
  type ListingItemProps = {
20
- icon?: FC<IconProps>
21
- label: string
67
+ icon?: ReactNode
68
+ label?: string
22
69
  subLabel?: string
23
- value: string
24
- subValue?: string
25
- overrides?: ListItemProps["overrides"]
70
+ value?: number
71
+ subValue?: number
72
+ overrides?: BlockProps["overrides"]
73
+ isLoading?: boolean
26
74
  }
27
75
 
28
76
  export default function ListingItem(props: ListingItemProps) {
29
77
  const {
30
- icon: Icon,
78
+ icon,
31
79
  label,
32
- subLabel = "",
80
+ subLabel,
33
81
  value,
34
- subValue = "",
82
+ subValue,
35
83
  overrides,
84
+ isLoading = false,
36
85
  } = props
37
86
 
38
- return (
39
- <ListItem
40
- artwork={Icon}
41
- // eslint-disable-next-line react/no-unstable-nested-components
42
- endEnhancer={() => (
43
- <ListItemLabel
44
- description={subValue}
45
- overrides={mergeOverrides(
46
- {
47
- LabelRoot: {
48
- style: {
49
- textAlign: "right",
50
- },
87
+ const [, theme] = useStyletron()
88
+
89
+ if (isLoading) {
90
+ return (
91
+ <ListingItemLayout
92
+ icon={
93
+ <Skeleton
94
+ animation
95
+ width={theme.sizing.scale800}
96
+ height={theme.sizing.scale800}
97
+ />
98
+ }
99
+ label={
100
+ <Skeleton
101
+ animation
102
+ width={theme.sizing.scale2400}
103
+ height={theme.sizing.scale600}
104
+ overrides={{
105
+ Root: {
106
+ style: { marginBottom: theme.sizing.scale100 },
51
107
  },
52
- },
53
- SHARED_LABEL_OVERRIDES,
54
- )}
108
+ }}
109
+ />
110
+ }
111
+ subLabel={
112
+ <Skeleton
113
+ animation
114
+ width={theme.sizing.scale1600}
115
+ height={theme.sizing.scale550}
116
+ />
117
+ }
118
+ value={
119
+ <Skeleton
120
+ animation
121
+ width={theme.sizing.scale2400}
122
+ height={theme.sizing.scale600}
123
+ overrides={{
124
+ Root: {
125
+ style: { marginBottom: theme.sizing.scale100 },
126
+ },
127
+ }}
128
+ />
129
+ }
130
+ subValue={
131
+ <Skeleton
132
+ animation
133
+ width={theme.sizing.scale1600}
134
+ height={theme.sizing.scale550}
135
+ />
136
+ }
137
+ overrides={overrides}
138
+ />
139
+ )
140
+ }
141
+
142
+ return (
143
+ <ListingItemLayout
144
+ icon={icon}
145
+ label={<LabelMedium>{label}</LabelMedium>}
146
+ subLabel={
147
+ <ParagraphSmall
148
+ margin={0}
149
+ as="div"
150
+ color={theme.colors.contentSecondary}
55
151
  >
56
- {value}
57
- </ListItemLabel>
58
- )}
59
- overrides={mergeOverrides(
60
- {
61
- Root: {
62
- style: {
63
- backgroundColor: "transparent",
64
- },
65
- },
66
- Content: {
67
- style: {
68
- border: 0,
69
- },
70
- },
71
- },
72
- overrides,
73
- )}
74
- >
75
- <ListItemLabel description={subLabel} overrides={SHARED_LABEL_OVERRIDES}>
76
- {label}
77
- </ListItemLabel>
78
- </ListItem>
152
+ {subLabel}
153
+ </ParagraphSmall>
154
+ }
155
+ value={
156
+ value !== undefined && (
157
+ <LabelMedium>
158
+ <SlotNumber formatFunction={formatUsd}>{value}</SlotNumber>
159
+ </LabelMedium>
160
+ )
161
+ }
162
+ subValue={
163
+ subValue !== undefined && (
164
+ <ParagraphSmall
165
+ margin={0}
166
+ as="div"
167
+ color={theme.colors.contentSecondary}
168
+ >
169
+ <SlotNumber formatFunction={formatUsd}>{subValue}</SlotNumber>
170
+ </ParagraphSmall>
171
+ )
172
+ }
173
+ overrides={overrides}
174
+ />
79
175
  )
80
176
  }