@mezo-org/passport 0.4.0-dev.82 → 0.4.0-dev.84

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 (173) hide show
  1. package/dist/src/components/Dropdown/Content.d.ts +0 -15
  2. package/dist/src/components/Dropdown/Content.d.ts.map +1 -1
  3. package/dist/src/components/Dropdown/Content.js +3 -3
  4. package/dist/src/components/Dropdown/Content.js.map +1 -1
  5. package/dist/src/components/Dropdown/Dropdown.d.ts +0 -4
  6. package/dist/src/components/Dropdown/Dropdown.d.ts.map +1 -1
  7. package/dist/src/components/Dropdown/Dropdown.js +10 -36
  8. package/dist/src/components/Dropdown/Dropdown.js.map +1 -1
  9. package/dist/src/components/Dropdown/ListingItem.d.ts +8 -7
  10. package/dist/src/components/Dropdown/ListingItem.d.ts.map +1 -1
  11. package/dist/src/components/Dropdown/ListingItem.js +36 -28
  12. package/dist/src/components/Dropdown/ListingItem.js.map +1 -1
  13. package/dist/src/components/Dropdown/NestedViewLayout.d.ts +2 -1
  14. package/dist/src/components/Dropdown/NestedViewLayout.d.ts.map +1 -1
  15. package/dist/src/components/Dropdown/NestedViewLayout.js +13 -15
  16. package/dist/src/components/Dropdown/NestedViewLayout.js.map +1 -1
  17. package/dist/src/components/Dropdown/Receive/Receive.d.ts +1 -4
  18. package/dist/src/components/Dropdown/Receive/Receive.d.ts.map +1 -1
  19. package/dist/src/components/Dropdown/Receive/Receive.js +30 -19
  20. package/dist/src/components/Dropdown/Receive/Receive.js.map +1 -1
  21. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts +2 -5
  22. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts.map +1 -1
  23. package/dist/src/components/Dropdown/Root/AccountAddressActions.js +13 -12
  24. package/dist/src/components/Dropdown/Root/AccountAddressActions.js.map +1 -1
  25. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts +2 -4
  26. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts.map +1 -1
  27. package/dist/src/components/Dropdown/Root/AccountBalance.js +24 -8
  28. package/dist/src/components/Dropdown/Root/AccountBalance.js.map +1 -1
  29. package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts +6 -0
  30. package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts.map +1 -0
  31. package/dist/src/components/Dropdown/Root/AccountBtcListing.js +27 -0
  32. package/dist/src/components/Dropdown/Root/AccountBtcListing.js.map +1 -0
  33. package/dist/src/components/Dropdown/Root/AccountError.d.ts +8 -0
  34. package/dist/src/components/Dropdown/Root/AccountError.d.ts.map +1 -0
  35. package/dist/src/components/Dropdown/Root/AccountError.js +17 -0
  36. package/dist/src/components/Dropdown/Root/AccountError.js.map +1 -0
  37. package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts +4 -0
  38. package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts.map +1 -0
  39. package/dist/src/components/Dropdown/Root/AccountMusdListing.js +21 -0
  40. package/dist/src/components/Dropdown/Root/AccountMusdListing.js.map +1 -0
  41. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts +2 -3
  42. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts.map +1 -1
  43. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js +34 -39
  44. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js.map +1 -1
  45. package/dist/src/components/Dropdown/Root/Root.d.ts +0 -15
  46. package/dist/src/components/Dropdown/Root/Root.d.ts.map +1 -1
  47. package/dist/src/components/Dropdown/Root/Root.js +22 -34
  48. package/dist/src/components/Dropdown/Root/Root.js.map +1 -1
  49. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts +2 -6
  50. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts.map +1 -1
  51. package/dist/src/components/Dropdown/Root/WalletAddress.js +37 -34
  52. package/dist/src/components/Dropdown/Root/WalletAddress.js.map +1 -1
  53. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts +2 -4
  54. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts.map +1 -1
  55. package/dist/src/components/Dropdown/Root/WelcomeBlock.js +60 -16
  56. package/dist/src/components/Dropdown/Root/WelcomeBlock.js.map +1 -1
  57. package/dist/src/components/Dropdown/SlotNumber.d.ts +19 -0
  58. package/dist/src/components/Dropdown/SlotNumber.d.ts.map +1 -0
  59. package/dist/src/components/Dropdown/SlotNumber.js +67 -0
  60. package/dist/src/components/Dropdown/SlotNumber.js.map +1 -0
  61. package/dist/src/config.d.ts +0 -1
  62. package/dist/src/config.d.ts.map +1 -1
  63. package/dist/src/config.js +1 -9
  64. package/dist/src/config.js.map +1 -1
  65. package/dist/src/hooks/useAssetsConversionRates.d.ts +8 -13
  66. package/dist/src/hooks/useAssetsConversionRates.d.ts.map +1 -1
  67. package/dist/src/hooks/useAssetsConversionRates.js +44 -67
  68. package/dist/src/hooks/useAssetsConversionRates.js.map +1 -1
  69. package/dist/src/hooks/useAuthenticateWithWallet.d.ts.map +1 -1
  70. package/dist/src/hooks/useAuthenticateWithWallet.js +1 -1
  71. package/dist/src/hooks/useAuthenticateWithWallet.js.map +1 -1
  72. package/dist/src/hooks/useBorrowData.d.ts +30 -4
  73. package/dist/src/hooks/useBorrowData.d.ts.map +1 -1
  74. package/dist/src/hooks/useBorrowData.js +53 -11
  75. package/dist/src/hooks/useBorrowData.js.map +1 -1
  76. package/dist/src/hooks/useCreateAccount.d.ts.map +1 -1
  77. package/dist/src/hooks/useCreateAccount.js +3 -3
  78. package/dist/src/hooks/useCreateAccount.js.map +1 -1
  79. package/dist/src/hooks/useGetCurrentAccount.d.ts.map +1 -1
  80. package/dist/src/hooks/useGetCurrentAccount.js +4 -6
  81. package/dist/src/hooks/useGetCurrentAccount.js.map +1 -1
  82. package/dist/src/hooks/useLinkAccount.d.ts.map +1 -1
  83. package/dist/src/hooks/useLinkAccount.js +3 -3
  84. package/dist/src/hooks/useLinkAccount.js.map +1 -1
  85. package/dist/src/hooks/useTokensBalances.d.ts +36 -35
  86. package/dist/src/hooks/useTokensBalances.d.ts.map +1 -1
  87. package/dist/src/hooks/useTokensBalances.js +93 -52
  88. package/dist/src/hooks/useTokensBalances.js.map +1 -1
  89. package/dist/src/hooks/useWalletAccount.d.ts +8 -6
  90. package/dist/src/hooks/useWalletAccount.d.ts.map +1 -1
  91. package/dist/src/hooks/useWalletAccount.js +9 -6
  92. package/dist/src/hooks/useWalletAccount.js.map +1 -1
  93. package/dist/src/lib/contracts/index.d.ts +1 -1
  94. package/dist/src/lib/contracts/index.d.ts.map +1 -1
  95. package/dist/src/lib/contracts/index.js +4 -0
  96. package/dist/src/lib/contracts/index.js.map +1 -1
  97. package/dist/src/provider.d.ts +7 -1
  98. package/dist/src/provider.d.ts.map +1 -1
  99. package/dist/src/provider.js +4 -1
  100. package/dist/src/provider.js.map +1 -1
  101. package/dist/src/utils/assets.d.ts +145 -0
  102. package/dist/src/utils/assets.d.ts.map +1 -0
  103. package/dist/src/utils/assets.js +100 -0
  104. package/dist/src/utils/assets.js.map +1 -0
  105. package/dist/src/utils/assets.test.d.ts +2 -0
  106. package/dist/src/utils/assets.test.d.ts.map +1 -0
  107. package/dist/src/utils/assets.test.js +46 -0
  108. package/dist/src/utils/assets.test.js.map +1 -0
  109. package/dist/src/utils/currency.d.ts +6 -3
  110. package/dist/src/utils/currency.d.ts.map +1 -1
  111. package/dist/src/utils/currency.js +13 -10
  112. package/dist/src/utils/currency.js.map +1 -1
  113. package/dist/src/utils/currency.test.js +44 -2
  114. package/dist/src/utils/currency.test.js.map +1 -1
  115. package/dist/src/utils/numbers.d.ts +13 -53
  116. package/dist/src/utils/numbers.d.ts.map +1 -1
  117. package/dist/src/utils/numbers.js +16 -118
  118. package/dist/src/utils/numbers.js.map +1 -1
  119. package/dist/src/utils/numbers.test.js +24 -142
  120. package/dist/src/utils/numbers.test.js.map +1 -1
  121. package/package.json +2 -1
  122. package/src/components/Dropdown/Content.tsx +3 -48
  123. package/src/components/Dropdown/Dropdown.tsx +7 -58
  124. package/src/components/Dropdown/ListingItem.tsx +155 -59
  125. package/src/components/Dropdown/NestedViewLayout.tsx +32 -20
  126. package/src/components/Dropdown/Receive/Receive.tsx +57 -32
  127. package/src/components/Dropdown/Root/AccountAddressActions.tsx +33 -35
  128. package/src/components/Dropdown/Root/AccountBalance.tsx +54 -16
  129. package/src/components/Dropdown/Root/AccountBtcListing.tsx +52 -0
  130. package/src/components/Dropdown/Root/AccountError.tsx +34 -0
  131. package/src/components/Dropdown/Root/AccountMusdListing.tsx +45 -0
  132. package/src/components/Dropdown/Root/AccountOtherAssets.tsx +63 -46
  133. package/src/components/Dropdown/Root/Root.tsx +28 -98
  134. package/src/components/Dropdown/Root/WalletAddress.tsx +87 -89
  135. package/src/components/Dropdown/Root/WelcomeBlock.tsx +112 -30
  136. package/src/components/Dropdown/SlotNumber.tsx +131 -0
  137. package/src/config.ts +1 -11
  138. package/src/hooks/useAssetsConversionRates.ts +49 -67
  139. package/src/hooks/useAuthenticateWithWallet.ts +7 -5
  140. package/src/hooks/useBorrowData.ts +71 -12
  141. package/src/hooks/useCreateAccount.ts +5 -4
  142. package/src/hooks/useGetCurrentAccount.ts +5 -7
  143. package/src/hooks/useLinkAccount.ts +5 -4
  144. package/src/hooks/useTokensBalances.ts +152 -74
  145. package/src/hooks/useWalletAccount.ts +19 -13
  146. package/src/lib/contracts/index.ts +8 -1
  147. package/src/provider.ts +11 -3
  148. package/src/utils/assets.test.ts +57 -0
  149. package/src/utils/assets.ts +103 -0
  150. package/src/utils/currency.test.ts +76 -2
  151. package/src/utils/currency.ts +20 -15
  152. package/src/utils/numbers.test.ts +29 -180
  153. package/src/utils/numbers.ts +22 -171
  154. package/dist/src/components/Dropdown/Root/AccountAssetItem.d.ts +0 -11
  155. package/dist/src/components/Dropdown/Root/AccountAssetItem.d.ts.map +0 -1
  156. package/dist/src/components/Dropdown/Root/AccountAssetItem.js +0 -9
  157. package/dist/src/components/Dropdown/Root/AccountAssetItem.js.map +0 -1
  158. package/dist/src/hooks/useDropdownData.d.ts +0 -47
  159. package/dist/src/hooks/useDropdownData.d.ts.map +0 -1
  160. package/dist/src/hooks/useDropdownData.js +0 -97
  161. package/dist/src/hooks/useDropdownData.js.map +0 -1
  162. package/dist/src/utils/cryptoAssets.d.ts +0 -44
  163. package/dist/src/utils/cryptoAssets.d.ts.map +0 -1
  164. package/dist/src/utils/cryptoAssets.js +0 -129
  165. package/dist/src/utils/cryptoAssets.js.map +0 -1
  166. package/dist/src/utils/cryptoAssets.test.d.ts +0 -2
  167. package/dist/src/utils/cryptoAssets.test.d.ts.map +0 -1
  168. package/dist/src/utils/cryptoAssets.test.js +0 -67
  169. package/dist/src/utils/cryptoAssets.test.js.map +0 -1
  170. package/src/components/Dropdown/Root/AccountAssetItem.tsx +0 -26
  171. package/src/hooks/useDropdownData.ts +0 -152
  172. package/src/utils/cryptoAssets.test.ts +0 -79
  173. package/src/utils/cryptoAssets.ts +0 -171
@@ -1,65 +1,25 @@
1
+ type CompactStringDecimals = Intl.NumberFormatOptions["minimumFractionDigits"] & BigIntToLocaleStringOptions["minimumFractionDigits"];
1
2
  /**
2
3
  * Formats a number or bigint into compact string with K, M, B, or T suffix.
3
4
  * @param value The number or bigint to format.
4
5
  * @param decimals Number of decimal places to include (ignored for bigint to avoid floating point issues).
5
6
  * @returns The formatted number as a string.
6
7
  */
7
- export declare function formatNumberToCompactString(value: number | bigint, decimals?: number): string;
8
+ export declare function formatNumberToCompactString(value: number | bigint, decimals?: CompactStringDecimals): string;
8
9
  /**
9
- * Formats a number or string into a locale-sensitive string with the desired number of decimals.
10
- * @param value The number or string to format.
11
- * @param desiredDecimals The number of decimal places to include.
12
- * @returns The formatted number as a string.
13
- * @see https://github.com/thesis/acre/blob/2078d339f4ddce79e69c78529c9d72910dd2640a/dapp/src/utils/numbersUtils.ts#L5-L19
14
- */
15
- export declare function formatNumberToLocaleString(value: string | number, desiredDecimals?: number): string;
16
- /**
17
- * Returns a number rounded up to the desired number of decimals.
18
- * @param amount The number to round up.
19
- * @param desiredDecimals The number of decimals to round up to.
20
- * @returns The rounded up number.
21
- * @see https://github.com/thesis/acre/blob/2078d339f4ddce79e69c78529c9d72910dd2640a/dapp/src/utils/numbersUtils.ts#L1-L3
22
- */
23
- export declare function roundUpNumber(amount: number, desiredDecimals?: number): number;
24
- /**
25
- * Convert a fixed point bigint with precision `fixedPointDecimals` to a
26
- * floating point number truncated to `desiredDecimals`.
27
- * @param fixedPoint The fixed point bigint to convert.
28
- * @param fixedPointDecimals The number of decimals in the fixed point bigint.
29
- * @param desiredDecimals The number of decimals in the output number.
30
- * @returns The floating point number truncated to `desiredDecimals`.
31
- * @see https://github.com/tahowallet/extension/blob/f6b26b7cb4a0a0278b1fccc6319626638f1a6dfa/background/lib/fixed-point.ts#L216-L239
32
- */
33
- export declare function fromFixedPoint(fixedPoint: bigint, fixedPointDecimals: number, desiredDecimals?: number): number;
34
- /**
35
- * Display a token amount correctly with desired decimals.
36
- * The function returns a string with a language-sensitive representation of this number.
37
- * @param amount The fixed point number to convert.
38
- * @param decimals The number of decimals in the fixed point number.
39
- * @param desiredDecimals The number of decimals to display.
40
- * @param withRoundUp Whether to round up the number.
41
- * @returns The formatted number as a string.
42
- * @see https://github.com/thesis/acre/blob/2078d339f4ddce79e69c78529c9d72910dd2640a/dapp/src/utils/numbersUtils.ts#L57-L87
43
- */
44
- export declare const fromFixedPointToString: (amount: number | string | bigint, decimals?: number, desiredDecimals?: number, withRoundUp?: boolean) => string;
45
- /**
46
- * Converts a floating-point number or string to a bigint representation
47
- * scaled by the specified number of decimal places (default: 18).
48
- *
49
- * This function avoids floating-point precision issues by manually
50
- * parsing and scaling the number.
51
- *
52
- * @param amount - A number or string containing a floating point number.
53
- * @param decimals - Number of decimals to scale to (default: 18).
54
- * @returns A bigint representation scaled to the given decimal places.
55
- * @see https://github.com/thesis/mezo-portal/blob/3bd4f39cb77c39948af2886a6ce7415a0c60307a/dapp/src/shared/utils/numbers.ts#L55
10
+ * Normalizes a bigint value to a target precision.
11
+ * @param value The bigint value to normalize.
12
+ * @param currentPrecision The current precision of the value.
13
+ * @param targetPrecision The target precision to normalize to.
14
+ * @returns The normalized bigint value.
56
15
  */
57
- export declare const fromFloatToBigInt: (amount: string | number, decimals?: number) => bigint;
16
+ export declare const normalizePrecision: (value: bigint, currentPrecision: number, targetPrecision?: number) => bigint;
58
17
  /**
59
- * Utility function to find the maximum value from an array of bigint values.
60
- * @param values Array of bigint values to find the maximum from.
61
- * @returns The maximum value from the provided bigint values.
62
- * @dev Works exactly like `Math.max` but for bigint values.
18
+ * Utility function to find the maximum value from given `BigInt` values.
19
+ * @param values Array of BigInt values to find the maximum from.
20
+ * @returns The maximum value from the provided `BigInt` values.
21
+ * @dev Works exactly like `Math.max` but for `BigInt` values.
63
22
  */
64
23
  export declare const bigIntMax: (...values: bigint[]) => bigint;
24
+ export {};
65
25
  //# sourceMappingURL=numbers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../../src/utils/numbers.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,SAAI,GACX,MAAM,CAMR;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,eAAe,SAAI,UAYpB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,SAAI,GAAG,MAAM,CAEzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,kBAAkB,EAAE,MAAM,EAC1B,eAAe,SAAI,GAClB,MAAM,CAUR;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,MAAM,GAAG,MAAM,GAAG,MAAM,EAChC,iBAAa,EACb,wBAAmB,EACnB,qBAAmB,WA0BpB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,GAAG,MAAM,EACvB,iBAAa,KACZ,MAmDF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,GAAG,QAAQ,MAAM,EAAE,WACe,CAAA"}
1
+ {"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../../src/utils/numbers.ts"],"names":[],"mappings":"AAAA,KAAK,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,GAC5E,2BAA2B,CAAC,uBAAuB,CAAC,CAAA;AACtD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,GAAE,qBAAyB,GAClC,MAAM,CAMR;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,MAAM,EACb,kBAAkB,MAAM,EACxB,wBAAkC,KACjC,MAQF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,GAAG,QAAQ,MAAM,EAAE,KAAG,MACY,CAAA"}
@@ -4,7 +4,7 @@
4
4
  * @param decimals Number of decimal places to include (ignored for bigint to avoid floating point issues).
5
5
  * @returns The formatted number as a string.
6
6
  */
7
- export function formatNumberToCompactString(value, decimals = 4) {
7
+ export function formatNumberToCompactString(value, decimals = 2) {
8
8
  return value.toLocaleString("en-US", {
9
9
  notation: "compact",
10
10
  compactDisplay: "short",
@@ -12,128 +12,26 @@ export function formatNumberToCompactString(value, decimals = 4) {
12
12
  });
13
13
  }
14
14
  /**
15
- * Formats a number or string into a locale-sensitive string with the desired number of decimals.
16
- * @param value The number or string to format.
17
- * @param desiredDecimals The number of decimal places to include.
18
- * @returns The formatted number as a string.
19
- * @see https://github.com/thesis/acre/blob/2078d339f4ddce79e69c78529c9d72910dd2640a/dapp/src/utils/numbersUtils.ts#L5-L19
20
- */
21
- export function formatNumberToLocaleString(value, desiredDecimals = 0) {
22
- const number = typeof value === "number" ? value : parseFloat(value);
23
- if (number === 0 && desiredDecimals === 0)
24
- return "0";
25
- if (number === 0)
26
- return `0.${"0".repeat(desiredDecimals)}`;
27
- return number.toLocaleString("en-US", {
28
- minimumFractionDigits: desiredDecimals,
29
- maximumFractionDigits: desiredDecimals,
30
- });
31
- }
32
- /**
33
- * Returns a number rounded up to the desired number of decimals.
34
- * @param amount The number to round up.
35
- * @param desiredDecimals The number of decimals to round up to.
36
- * @returns The rounded up number.
37
- * @see https://github.com/thesis/acre/blob/2078d339f4ddce79e69c78529c9d72910dd2640a/dapp/src/utils/numbersUtils.ts#L1-L3
38
- */
39
- export function roundUpNumber(amount, desiredDecimals = 2) {
40
- return Math.ceil(amount * 10 ** desiredDecimals) / 10 ** desiredDecimals;
41
- }
42
- /**
43
- * Convert a fixed point bigint with precision `fixedPointDecimals` to a
44
- * floating point number truncated to `desiredDecimals`.
45
- * @param fixedPoint The fixed point bigint to convert.
46
- * @param fixedPointDecimals The number of decimals in the fixed point bigint.
47
- * @param desiredDecimals The number of decimals in the output number.
48
- * @returns The floating point number truncated to `desiredDecimals`.
49
- * @see https://github.com/tahowallet/extension/blob/f6b26b7cb4a0a0278b1fccc6319626638f1a6dfa/background/lib/fixed-point.ts#L216-L239
15
+ * Normalizes a bigint value to a target precision.
16
+ * @param value The bigint value to normalize.
17
+ * @param currentPrecision The current precision of the value.
18
+ * @param targetPrecision The target precision to normalize to.
19
+ * @returns The normalized bigint value.
50
20
  */
51
- export function fromFixedPoint(fixedPoint, fixedPointDecimals, desiredDecimals = 4) {
52
- const fixedPointDesiredDecimalsAmount = fixedPoint /
53
- 10n ** BigInt(Math.max(1, fixedPointDecimals - desiredDecimals));
54
- const formattedAmount = Number(fixedPointDesiredDecimalsAmount) /
55
- 10 ** Math.min(desiredDecimals, fixedPointDecimals);
56
- return formattedAmount;
57
- }
58
- /**
59
- * Display a token amount correctly with desired decimals.
60
- * The function returns a string with a language-sensitive representation of this number.
61
- * @param amount The fixed point number to convert.
62
- * @param decimals The number of decimals in the fixed point number.
63
- * @param desiredDecimals The number of decimals to display.
64
- * @param withRoundUp Whether to round up the number.
65
- * @returns The formatted number as a string.
66
- * @see https://github.com/thesis/acre/blob/2078d339f4ddce79e69c78529c9d72910dd2640a/dapp/src/utils/numbersUtils.ts#L57-L87
67
- */
68
- export const fromFixedPointToString = (amount, decimals = 18, desiredDecimals = 4, withRoundUp = false) => {
69
- const fixedPoint = BigInt(amount);
70
- if (fixedPoint === 0n) {
71
- return `0.${"0".repeat(desiredDecimals)}`;
21
+ export const normalizePrecision = (value, currentPrecision, targetPrecision = currentPrecision) => {
22
+ if (currentPrecision > targetPrecision) {
23
+ return value / 10n ** BigInt(currentPrecision - targetPrecision);
72
24
  }
73
- const formattedAmount = fromFixedPoint(fixedPoint, decimals,
74
- // To round the amount up, let's increase the precision by one.
75
- // The desired decimal numbers will be set later anyway.
76
- withRoundUp ? desiredDecimals + 1 : desiredDecimals);
77
- const minAmountToDisplay = 1 / 10 ** Math.min(desiredDecimals, decimals);
78
- if (minAmountToDisplay > formattedAmount) {
79
- return `<0.${"0".repeat(desiredDecimals - 1)}1`;
80
- }
81
- const finalFormattedAmount = withRoundUp
82
- ? Math.ceil(formattedAmount * 10 ** desiredDecimals) / 10 ** desiredDecimals
83
- : formattedAmount;
84
- return formatNumberToLocaleString(finalFormattedAmount, desiredDecimals);
85
- };
86
- /**
87
- * Converts a floating-point number or string to a bigint representation
88
- * scaled by the specified number of decimal places (default: 18).
89
- *
90
- * This function avoids floating-point precision issues by manually
91
- * parsing and scaling the number.
92
- *
93
- * @param amount - A number or string containing a floating point number.
94
- * @param decimals - Number of decimals to scale to (default: 18).
95
- * @returns A bigint representation scaled to the given decimal places.
96
- * @see https://github.com/thesis/mezo-portal/blob/3bd4f39cb77c39948af2886a6ce7415a0c60307a/dapp/src/shared/utils/numbers.ts#L55
97
- */
98
- export const fromFloatToBigInt = (amount, decimals = 18) => {
99
- const FLOATING_POINT_REGEX = /^-?\d{1,3}(,\d{3})*(\.\d+)?$|^-?\d+(\.\d+)?$/;
100
- const parseToFixedPointNumber = (floatingPointString) => {
101
- if (!floatingPointString.match(FLOATING_POINT_REGEX)) {
102
- return undefined;
103
- }
104
- const [whole, decimalsPart, ...extra] = floatingPointString.split(".");
105
- if (extra.length > 0)
106
- return undefined;
107
- const noThousandsSeparatorWhole = whole.replace(/,/g, "");
108
- const setDecimals = decimalsPart ?? "";
109
- try {
110
- return {
111
- amount: BigInt([noThousandsSeparatorWhole, setDecimals].join("")),
112
- decimals: setDecimals.length,
113
- };
114
- }
115
- catch {
116
- return undefined;
117
- }
118
- };
119
- const convertFixedPoint = (fixedPoint, fixedPointDecimals, targetDecimals) => {
120
- if (fixedPointDecimals >= targetDecimals) {
121
- return fixedPoint / 10n ** BigInt(fixedPointDecimals - targetDecimals);
122
- }
123
- return fixedPoint * 10n ** BigInt(targetDecimals - fixedPointDecimals);
124
- };
125
- const parsedAmount = amount.toString();
126
- const fixedPointAmount = parseToFixedPointNumber(parsedAmount);
127
- if (typeof fixedPointAmount === "undefined") {
128
- return 0n;
25
+ if (currentPrecision < targetPrecision) {
26
+ return value * 10n ** BigInt(targetPrecision - currentPrecision);
129
27
  }
130
- return convertFixedPoint(fixedPointAmount.amount, fixedPointAmount.decimals, decimals);
28
+ return value;
131
29
  };
132
30
  /**
133
- * Utility function to find the maximum value from an array of bigint values.
134
- * @param values Array of bigint values to find the maximum from.
135
- * @returns The maximum value from the provided bigint values.
136
- * @dev Works exactly like `Math.max` but for bigint values.
31
+ * Utility function to find the maximum value from given `BigInt` values.
32
+ * @param values Array of BigInt values to find the maximum from.
33
+ * @returns The maximum value from the provided `BigInt` values.
34
+ * @dev Works exactly like `Math.max` but for `BigInt` values.
137
35
  */
138
36
  export const bigIntMax = (...values) => values.reduce((max, value) => (value > max ? value : max));
139
37
  //# sourceMappingURL=numbers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"numbers.js","sourceRoot":"","sources":["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CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA"}
@@ -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,6C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AAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QAC9C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC/B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,MAAM,GAAG,kBAAkB,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QACnD,MAAM,CAAC,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.82",
3
+ "version": "0.4.0-dev.84",
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": {
@@ -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
  }