@mezo-org/passport 0.4.0-dev.9 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/README.md +18 -22
  2. package/dist/src/api/auth.d.ts +7 -3
  3. package/dist/src/api/auth.d.ts.map +1 -1
  4. package/dist/src/api/auth.js +3 -1
  5. package/dist/src/api/auth.js.map +1 -1
  6. package/dist/src/api/client.d.ts +4 -1
  7. package/dist/src/api/client.d.ts.map +1 -1
  8. package/dist/src/api/client.js +9 -2
  9. package/dist/src/api/client.js.map +1 -1
  10. package/dist/src/api/portal.d.ts +3 -9
  11. package/dist/src/api/portal.d.ts.map +1 -1
  12. package/dist/src/api/portal.js +8 -5
  13. package/dist/src/api/portal.js.map +1 -1
  14. package/dist/src/components/Dropdown/ConnectedTrigger.d.ts +2 -1
  15. package/dist/src/components/Dropdown/ConnectedTrigger.d.ts.map +1 -1
  16. package/dist/src/components/Dropdown/ConnectedTrigger.js +29 -20
  17. package/dist/src/components/Dropdown/ConnectedTrigger.js.map +1 -1
  18. package/dist/src/components/Dropdown/Content.d.ts +4 -5
  19. package/dist/src/components/Dropdown/Content.d.ts.map +1 -1
  20. package/dist/src/components/Dropdown/Content.js +19 -61
  21. package/dist/src/components/Dropdown/Content.js.map +1 -1
  22. package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts.map +1 -1
  23. package/dist/src/components/Dropdown/DisconnectedTrigger.js +2 -2
  24. package/dist/src/components/Dropdown/DisconnectedTrigger.js.map +1 -1
  25. package/dist/src/components/Dropdown/Dropdown.d.ts +9 -6
  26. package/dist/src/components/Dropdown/Dropdown.d.ts.map +1 -1
  27. package/dist/src/components/Dropdown/Dropdown.js +10 -10
  28. package/dist/src/components/Dropdown/Dropdown.js.map +1 -1
  29. package/dist/src/components/Dropdown/ListingItem.d.ts +14 -0
  30. package/dist/src/components/Dropdown/ListingItem.d.ts.map +1 -0
  31. package/dist/src/components/Dropdown/ListingItem.js +42 -0
  32. package/dist/src/components/Dropdown/ListingItem.js.map +1 -0
  33. package/dist/src/components/Dropdown/NestedViewLayout.d.ts +8 -0
  34. package/dist/src/components/Dropdown/NestedViewLayout.d.ts.map +1 -0
  35. package/dist/src/components/Dropdown/NestedViewLayout.js +32 -0
  36. package/dist/src/components/Dropdown/NestedViewLayout.js.map +1 -0
  37. package/dist/src/components/Dropdown/Receive/Receive.d.ts +4 -0
  38. package/dist/src/components/Dropdown/Receive/Receive.d.ts.map +1 -0
  39. package/dist/src/components/Dropdown/Receive/Receive.js +64 -0
  40. package/dist/src/components/Dropdown/Receive/Receive.js.map +1 -0
  41. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts +4 -0
  42. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts.map +1 -0
  43. package/dist/src/components/Dropdown/Root/AccountAddressActions.js +49 -0
  44. package/dist/src/components/Dropdown/Root/AccountAddressActions.js.map +1 -0
  45. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts +6 -0
  46. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts.map +1 -0
  47. package/dist/src/components/Dropdown/Root/AccountBalance.js +31 -0
  48. package/dist/src/components/Dropdown/Root/AccountBalance.js.map +1 -0
  49. package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts +6 -0
  50. package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts.map +1 -0
  51. package/dist/src/components/Dropdown/Root/AccountBtcListing.js +27 -0
  52. package/dist/src/components/Dropdown/Root/AccountBtcListing.js.map +1 -0
  53. package/dist/src/components/Dropdown/Root/AccountError.d.ts +8 -0
  54. package/dist/src/components/Dropdown/Root/AccountError.d.ts.map +1 -0
  55. package/dist/src/components/Dropdown/Root/AccountError.js +17 -0
  56. package/dist/src/components/Dropdown/Root/AccountError.js.map +1 -0
  57. package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts +4 -0
  58. package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts.map +1 -0
  59. package/dist/src/components/Dropdown/Root/AccountMusdListing.js +21 -0
  60. package/dist/src/components/Dropdown/Root/AccountMusdListing.js.map +1 -0
  61. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts +8 -0
  62. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts.map +1 -0
  63. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js +43 -0
  64. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js.map +1 -0
  65. package/dist/src/components/Dropdown/Root/Root.d.ts +8 -0
  66. package/dist/src/components/Dropdown/Root/Root.d.ts.map +1 -0
  67. package/dist/src/components/Dropdown/Root/Root.js +45 -0
  68. package/dist/src/components/Dropdown/Root/Root.js.map +1 -0
  69. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts +4 -0
  70. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts.map +1 -0
  71. package/dist/src/components/Dropdown/Root/WalletAddress.js +66 -0
  72. package/dist/src/components/Dropdown/Root/WalletAddress.js.map +1 -0
  73. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts +6 -0
  74. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts.map +1 -0
  75. package/dist/src/components/Dropdown/Root/WelcomeBlock.js +88 -0
  76. package/dist/src/components/Dropdown/Root/WelcomeBlock.js.map +1 -0
  77. package/dist/src/components/Dropdown/SlotNumber.d.ts +19 -0
  78. package/dist/src/components/Dropdown/SlotNumber.d.ts.map +1 -0
  79. package/dist/src/components/Dropdown/SlotNumber.js +67 -0
  80. package/dist/src/components/Dropdown/SlotNumber.js.map +1 -0
  81. package/dist/src/components/Dropdown/TestnetTopBanner.d.ts +3 -0
  82. package/dist/src/components/Dropdown/TestnetTopBanner.d.ts.map +1 -0
  83. package/dist/src/components/Dropdown/TestnetTopBanner.js +14 -0
  84. package/dist/src/components/Dropdown/TestnetTopBanner.js.map +1 -0
  85. package/dist/src/config.d.ts +19 -5
  86. package/dist/src/config.d.ts.map +1 -1
  87. package/dist/src/config.js +58 -14
  88. package/dist/src/config.js.map +1 -1
  89. package/dist/src/constants.d.ts +11 -3
  90. package/dist/src/constants.d.ts.map +1 -1
  91. package/dist/src/constants.js +12 -4
  92. package/dist/src/constants.js.map +1 -1
  93. package/dist/src/hooks/index.d.ts +4 -0
  94. package/dist/src/hooks/index.d.ts.map +1 -1
  95. package/dist/src/hooks/index.js +4 -0
  96. package/dist/src/hooks/index.js.map +1 -1
  97. package/dist/src/hooks/useAssetsConversionRates.d.ts +18 -0
  98. package/dist/src/hooks/useAssetsConversionRates.d.ts.map +1 -0
  99. package/dist/src/hooks/useAssetsConversionRates.js +67 -0
  100. package/dist/src/hooks/useAssetsConversionRates.js.map +1 -0
  101. package/dist/src/hooks/useAuthenticateWithWallet.d.ts +13 -13
  102. package/dist/src/hooks/useAuthenticateWithWallet.d.ts.map +1 -1
  103. package/dist/src/hooks/useAuthenticateWithWallet.js +9 -8
  104. package/dist/src/hooks/useAuthenticateWithWallet.js.map +1 -1
  105. package/dist/src/hooks/useBorrowData.d.ts +108 -0
  106. package/dist/src/hooks/useBorrowData.d.ts.map +1 -0
  107. package/dist/src/hooks/useBorrowData.js +201 -0
  108. package/dist/src/hooks/useBorrowData.js.map +1 -0
  109. package/dist/src/hooks/useCreateAccount.d.ts.map +1 -1
  110. package/dist/src/hooks/useCreateAccount.js +22 -1
  111. package/dist/src/hooks/useCreateAccount.js.map +1 -1
  112. package/dist/src/hooks/useGetCurrentAccount.d.ts.map +1 -1
  113. package/dist/src/hooks/useGetCurrentAccount.js +4 -6
  114. package/dist/src/hooks/useGetCurrentAccount.js.map +1 -1
  115. package/dist/src/hooks/useLinkAccount.d.ts +19 -13
  116. package/dist/src/hooks/useLinkAccount.d.ts.map +1 -1
  117. package/dist/src/hooks/useLinkAccount.js +20 -1
  118. package/dist/src/hooks/useLinkAccount.js.map +1 -1
  119. package/dist/src/hooks/useRefreshPassport.d.ts +19 -0
  120. package/dist/src/hooks/useRefreshPassport.d.ts.map +1 -0
  121. package/dist/src/hooks/useRefreshPassport.js +44 -0
  122. package/dist/src/hooks/useRefreshPassport.js.map +1 -0
  123. package/dist/src/hooks/useSignInWithWallet.d.ts +13 -13
  124. package/dist/src/hooks/useSignInWithWallet.d.ts.map +1 -1
  125. package/dist/src/hooks/useSignUpWithWallet.d.ts +13 -13
  126. package/dist/src/hooks/useSignUpWithWallet.d.ts.map +1 -1
  127. package/dist/src/hooks/useTokensBalances.d.ts +75 -0
  128. package/dist/src/hooks/useTokensBalances.d.ts.map +1 -0
  129. package/dist/src/hooks/useTokensBalances.js +181 -0
  130. package/dist/src/hooks/useTokensBalances.js.map +1 -0
  131. package/dist/src/hooks/useValidateMezoId.d.ts +8 -0
  132. package/dist/src/hooks/useValidateMezoId.d.ts.map +1 -0
  133. package/dist/src/hooks/useValidateMezoId.js +24 -0
  134. package/dist/src/hooks/useValidateMezoId.js.map +1 -0
  135. package/dist/src/hooks/useWalletAccount.d.ts +2 -1
  136. package/dist/src/hooks/useWalletAccount.d.ts.map +1 -1
  137. package/dist/src/hooks/useWalletAccount.js +20 -15
  138. package/dist/src/hooks/useWalletAccount.js.map +1 -1
  139. package/dist/src/hooks/useWatchTransferEvents.d.ts +5 -0
  140. package/dist/src/hooks/useWatchTransferEvents.d.ts.map +1 -0
  141. package/dist/src/hooks/useWatchTransferEvents.js +63 -0
  142. package/dist/src/hooks/useWatchTransferEvents.js.map +1 -0
  143. package/dist/src/index.d.ts +2 -1
  144. package/dist/src/index.d.ts.map +1 -1
  145. package/dist/src/index.js +2 -1
  146. package/dist/src/index.js.map +1 -1
  147. package/dist/src/lib/contracts/index.d.ts +13 -0
  148. package/dist/src/lib/contracts/index.d.ts.map +1 -0
  149. package/dist/src/lib/contracts/index.js +66 -0
  150. package/dist/src/lib/contracts/index.js.map +1 -0
  151. package/dist/src/lib/contracts/priceOracle.d.ts +43 -0
  152. package/dist/src/lib/contracts/priceOracle.d.ts.map +1 -0
  153. package/dist/src/lib/contracts/priceOracle.js +52 -0
  154. package/dist/src/lib/contracts/priceOracle.js.map +1 -0
  155. package/dist/src/provider.d.ts +7 -1
  156. package/dist/src/provider.d.ts.map +1 -1
  157. package/dist/src/provider.js +4 -1
  158. package/dist/src/provider.js.map +1 -1
  159. package/dist/src/stores/dropdownStore.d.ts +12 -0
  160. package/dist/src/stores/dropdownStore.d.ts.map +1 -0
  161. package/dist/src/stores/dropdownStore.js +13 -0
  162. package/dist/src/stores/dropdownStore.js.map +1 -0
  163. package/dist/src/utils/address.d.ts +1 -1
  164. package/dist/src/utils/address.d.ts.map +1 -1
  165. package/dist/src/utils/address.js +2 -0
  166. package/dist/src/utils/address.js.map +1 -1
  167. package/dist/src/utils/address.test.js +8 -5
  168. package/dist/src/utils/address.test.js.map +1 -1
  169. package/dist/src/utils/assets.d.ts +145 -0
  170. package/dist/src/utils/assets.d.ts.map +1 -0
  171. package/dist/src/utils/assets.js +100 -0
  172. package/dist/src/utils/assets.js.map +1 -0
  173. package/dist/src/utils/assets.test.d.ts +2 -0
  174. package/dist/src/utils/assets.test.d.ts.map +1 -0
  175. package/dist/src/utils/assets.test.js +46 -0
  176. package/dist/src/utils/assets.test.js.map +1 -0
  177. package/dist/src/utils/currency.d.ts +13 -2
  178. package/dist/src/utils/currency.d.ts.map +1 -1
  179. package/dist/src/utils/currency.js +22 -8
  180. package/dist/src/utils/currency.js.map +1 -1
  181. package/dist/src/utils/currency.test.js +44 -1
  182. package/dist/src/utils/currency.test.js.map +1 -1
  183. package/dist/src/utils/mezoId.d.ts +7 -0
  184. package/dist/src/utils/mezoId.d.ts.map +1 -0
  185. package/dist/src/utils/mezoId.js +41 -0
  186. package/dist/src/utils/mezoId.js.map +1 -0
  187. package/dist/src/utils/numbers.d.ts +15 -33
  188. package/dist/src/utils/numbers.d.ts.map +1 -1
  189. package/dist/src/utils/numbers.js +26 -70
  190. package/dist/src/utils/numbers.js.map +1 -1
  191. package/dist/src/utils/numbers.test.js +46 -42
  192. package/dist/src/utils/numbers.test.js.map +1 -1
  193. package/dist/src/utils/siww.d.ts +1 -0
  194. package/dist/src/utils/siww.d.ts.map +1 -1
  195. package/dist/src/utils/siww.js +50 -12
  196. package/dist/src/utils/siww.js.map +1 -1
  197. package/dist/src/utils/wagmi.d.ts +3 -0
  198. package/dist/src/utils/wagmi.d.ts.map +1 -0
  199. package/dist/src/utils/wagmi.js +7 -0
  200. package/dist/src/utils/wagmi.js.map +1 -0
  201. package/dist/src/wallet/index.d.ts +1 -1
  202. package/dist/src/wallet/index.d.ts.map +1 -1
  203. package/dist/src/wallet/index.js +1 -1
  204. package/dist/src/wallet/index.js.map +1 -1
  205. package/package.json +11 -8
  206. package/src/api/auth.ts +8 -4
  207. package/src/api/client.ts +11 -2
  208. package/src/api/portal.ts +11 -14
  209. package/src/components/Dropdown/ConnectedTrigger.tsx +52 -32
  210. package/src/components/Dropdown/Content.tsx +26 -121
  211. package/src/components/Dropdown/DisconnectedTrigger.tsx +2 -1
  212. package/src/components/Dropdown/Dropdown.tsx +29 -17
  213. package/src/components/Dropdown/ListingItem.tsx +176 -0
  214. package/src/components/Dropdown/NestedViewLayout.tsx +87 -0
  215. package/src/components/Dropdown/README.md +10 -18
  216. package/src/components/Dropdown/Receive/Receive.tsx +144 -0
  217. package/src/components/Dropdown/Root/AccountAddressActions.tsx +99 -0
  218. package/src/components/Dropdown/Root/AccountBalance.tsx +68 -0
  219. package/src/components/Dropdown/Root/AccountBtcListing.tsx +52 -0
  220. package/src/components/Dropdown/Root/AccountError.tsx +34 -0
  221. package/src/components/Dropdown/Root/AccountMusdListing.tsx +45 -0
  222. package/src/components/Dropdown/Root/AccountOtherAssets.tsx +85 -0
  223. package/src/components/Dropdown/Root/Root.tsx +77 -0
  224. package/src/components/Dropdown/Root/WalletAddress.tsx +123 -0
  225. package/src/components/Dropdown/Root/WelcomeBlock.tsx +173 -0
  226. package/src/components/Dropdown/SlotNumber.tsx +131 -0
  227. package/src/components/Dropdown/TestnetTopBanner.tsx +32 -0
  228. package/src/config.ts +88 -20
  229. package/src/constants.ts +12 -4
  230. package/src/hooks/index.ts +7 -0
  231. package/src/hooks/useAssetsConversionRates.ts +79 -0
  232. package/src/hooks/useAuthenticateWithWallet.ts +30 -14
  233. package/src/hooks/useBorrowData.ts +246 -0
  234. package/src/hooks/useCreateAccount.ts +29 -2
  235. package/src/hooks/useGetCurrentAccount.ts +5 -7
  236. package/src/hooks/useLinkAccount.ts +37 -4
  237. package/src/hooks/useRefreshPassport.ts +56 -0
  238. package/src/hooks/useSignInWithWallet.ts +2 -2
  239. package/src/hooks/useSignUpWithWallet.ts +2 -2
  240. package/src/hooks/useTokensBalances.ts +265 -0
  241. package/src/hooks/useValidateMezoId.ts +31 -0
  242. package/src/hooks/useWalletAccount.ts +32 -20
  243. package/src/hooks/useWatchTransferEvents.ts +74 -0
  244. package/src/index.ts +12 -1
  245. package/src/lib/contracts/index.ts +99 -0
  246. package/src/lib/contracts/priceOracle.ts +53 -0
  247. package/src/provider.ts +11 -3
  248. package/src/stores/dropdownStore.ts +20 -0
  249. package/src/utils/address.test.ts +10 -6
  250. package/src/utils/address.ts +5 -3
  251. package/src/utils/assets.test.ts +57 -0
  252. package/src/utils/assets.ts +103 -0
  253. package/src/utils/currency.test.ts +77 -1
  254. package/src/utils/currency.ts +35 -9
  255. package/src/utils/mezoId.ts +51 -0
  256. package/src/utils/numbers.test.ts +49 -42
  257. package/src/utils/numbers.ts +33 -95
  258. package/src/utils/siww.ts +71 -16
  259. package/src/utils/wagmi.ts +12 -0
  260. package/src/wallet/index.ts +3 -2
  261. package/dist/src/components/Dropdown/AccountAddress.d.ts +0 -8
  262. package/dist/src/components/Dropdown/AccountAddress.d.ts.map +0 -1
  263. package/dist/src/components/Dropdown/AccountAddress.js +0 -58
  264. package/dist/src/components/Dropdown/AccountAddress.js.map +0 -1
  265. package/dist/src/components/Dropdown/AccountAssets.d.ts +0 -14
  266. package/dist/src/components/Dropdown/AccountAssets.d.ts.map +0 -1
  267. package/dist/src/components/Dropdown/AccountAssets.js +0 -44
  268. package/dist/src/components/Dropdown/AccountAssets.js.map +0 -1
  269. package/dist/src/components/Dropdown/AccountBalance.d.ts +0 -7
  270. package/dist/src/components/Dropdown/AccountBalance.d.ts.map +0 -1
  271. package/dist/src/components/Dropdown/AccountBalance.js +0 -18
  272. package/dist/src/components/Dropdown/AccountBalance.js.map +0 -1
  273. package/dist/src/components/Dropdown/WelcomeBlock.d.ts +0 -8
  274. package/dist/src/components/Dropdown/WelcomeBlock.d.ts.map +0 -1
  275. package/dist/src/components/Dropdown/WelcomeBlock.js +0 -44
  276. package/dist/src/components/Dropdown/WelcomeBlock.js.map +0 -1
  277. package/dist/src/hooks/useAssetsUSDConversion.d.ts +0 -8
  278. package/dist/src/hooks/useAssetsUSDConversion.d.ts.map +0 -1
  279. package/dist/src/hooks/useAssetsUSDConversion.js +0 -21
  280. package/dist/src/hooks/useAssetsUSDConversion.js.map +0 -1
  281. package/dist/src/hooks/useDropdownData.d.ts +0 -44
  282. package/dist/src/hooks/useDropdownData.d.ts.map +0 -1
  283. package/dist/src/hooks/useDropdownData.js +0 -73
  284. package/dist/src/hooks/useDropdownData.js.map +0 -1
  285. package/dist/src/utils/cryptoAssets.d.ts +0 -28
  286. package/dist/src/utils/cryptoAssets.d.ts.map +0 -1
  287. package/dist/src/utils/cryptoAssets.js +0 -73
  288. package/dist/src/utils/cryptoAssets.js.map +0 -1
  289. package/dist/src/utils/cryptoAssets.test.d.ts +0 -2
  290. package/dist/src/utils/cryptoAssets.test.d.ts.map +0 -1
  291. package/dist/src/utils/cryptoAssets.test.js +0 -49
  292. package/dist/src/utils/cryptoAssets.test.js.map +0 -1
  293. package/src/components/Dropdown/AccountAddress.tsx +0 -111
  294. package/src/components/Dropdown/AccountAssets.tsx +0 -110
  295. package/src/components/Dropdown/AccountBalance.tsx +0 -38
  296. package/src/components/Dropdown/WelcomeBlock.tsx +0 -92
  297. package/src/hooks/useAssetsUSDConversion.ts +0 -31
  298. package/src/hooks/useDropdownData.ts +0 -130
  299. package/src/utils/cryptoAssets.test.ts +0 -59
  300. package/src/utils/cryptoAssets.ts +0 -93
@@ -0,0 +1,145 @@
1
+ declare const ASSETS: {
2
+ BTC: {
3
+ name: string;
4
+ symbol: string;
5
+ decimals: number;
6
+ };
7
+ ETH: {
8
+ name: string;
9
+ symbol: string;
10
+ decimals: number;
11
+ };
12
+ MUSD: {
13
+ name: string;
14
+ symbol: string;
15
+ decimals: number;
16
+ };
17
+ mDAI: {
18
+ name: string;
19
+ symbol: string;
20
+ decimals: number;
21
+ };
22
+ mFBTC: {
23
+ name: string;
24
+ symbol: string;
25
+ decimals: number;
26
+ };
27
+ mcbBTC: {
28
+ name: string;
29
+ symbol: string;
30
+ decimals: number;
31
+ };
32
+ mSolvBTC: {
33
+ name: string;
34
+ symbol: string;
35
+ decimals: number;
36
+ };
37
+ mswBTC: {
38
+ name: string;
39
+ symbol: string;
40
+ decimals: number;
41
+ };
42
+ mT: {
43
+ name: string;
44
+ symbol: string;
45
+ decimals: number;
46
+ };
47
+ mUSDC: {
48
+ name: string;
49
+ symbol: string;
50
+ decimals: number;
51
+ };
52
+ mUSDe: {
53
+ name: string;
54
+ symbol: string;
55
+ decimals: number;
56
+ };
57
+ mUSDT: {
58
+ name: string;
59
+ symbol: string;
60
+ decimals: number;
61
+ };
62
+ mxSolvBTC: {
63
+ name: string;
64
+ symbol: string;
65
+ decimals: number;
66
+ };
67
+ };
68
+ /**
69
+ * Gets details of given crypto asset
70
+ * @param key The key of crypto asset
71
+ * @returns The crypto asset details
72
+ */
73
+ export declare function getAsset(key: keyof typeof ASSETS): {
74
+ name: string;
75
+ symbol: string;
76
+ decimals: number;
77
+ } | {
78
+ name: string;
79
+ symbol: string;
80
+ decimals: number;
81
+ } | {
82
+ name: string;
83
+ symbol: string;
84
+ decimals: number;
85
+ } | {
86
+ name: string;
87
+ symbol: string;
88
+ decimals: number;
89
+ } | {
90
+ name: string;
91
+ symbol: string;
92
+ decimals: number;
93
+ } | {
94
+ name: string;
95
+ symbol: string;
96
+ decimals: number;
97
+ } | {
98
+ name: string;
99
+ symbol: string;
100
+ decimals: number;
101
+ } | {
102
+ name: string;
103
+ symbol: string;
104
+ decimals: number;
105
+ } | {
106
+ name: string;
107
+ symbol: string;
108
+ decimals: number;
109
+ } | {
110
+ name: string;
111
+ symbol: string;
112
+ decimals: number;
113
+ } | {
114
+ name: string;
115
+ symbol: string;
116
+ decimals: number;
117
+ } | {
118
+ name: string;
119
+ symbol: string;
120
+ decimals: number;
121
+ } | {
122
+ name: string;
123
+ symbol: string;
124
+ decimals: number;
125
+ };
126
+ /**
127
+ * Checks if given crypto asset is Bitcoin-like
128
+ * @param key The key of crypto asset
129
+ * @returns True if crypto asset is Bitcoin-like
130
+ */
131
+ export declare function isBitcoinLikeCryptoAsset(key: string): boolean;
132
+ /**
133
+ * Checks if given crypto asset is USD-like
134
+ * @param key The key of crypto asset
135
+ * @returns True if crypto asset is USD-like
136
+ */
137
+ export declare function isUsdLikeCryptoAsset(key: string): boolean;
138
+ /**
139
+ * Checks if given crypto asset is T token
140
+ * @param key The key of crypto asset
141
+ * @returns True if crypto asset is T token
142
+ */
143
+ export declare function isTTokenCryptoAsset(key: string): boolean;
144
+ export {};
145
+ //# sourceMappingURL=assets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/utils/assets.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEX,CAAA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEhD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,WAEnD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,WAE/C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,WAE9C"}
@@ -0,0 +1,100 @@
1
+ const ASSETS = {
2
+ BTC: {
3
+ name: "Bitcoin",
4
+ symbol: "BTC",
5
+ decimals: 18,
6
+ },
7
+ ETH: {
8
+ name: "Ethereum",
9
+ symbol: "ETH",
10
+ decimals: 18,
11
+ },
12
+ MUSD: {
13
+ name: "MUSD",
14
+ symbol: "MUSD",
15
+ decimals: 18,
16
+ },
17
+ mDAI: {
18
+ name: "Mezo Dai Stablecoin",
19
+ symbol: "mDAI",
20
+ decimals: 18,
21
+ },
22
+ mFBTC: {
23
+ name: "Mezo Fire Bitcoin",
24
+ symbol: "mFBTC",
25
+ decimals: 8,
26
+ },
27
+ mcbBTC: {
28
+ name: "Mezo Coinbase Wrapped BTC",
29
+ symbol: "mcbBTC",
30
+ decimals: 8,
31
+ },
32
+ mSolvBTC: {
33
+ name: "Mezo SolvBTC",
34
+ symbol: "mSolvBTC",
35
+ decimals: 18,
36
+ },
37
+ mswBTC: {
38
+ name: "Mezo swBTC",
39
+ symbol: "mswBTC",
40
+ decimals: 8,
41
+ },
42
+ mT: {
43
+ name: "Mezo Threshold Network Token",
44
+ symbol: "mT",
45
+ decimals: 18,
46
+ },
47
+ mUSDC: {
48
+ name: "Mezo Circle USDC",
49
+ symbol: "mUSDC",
50
+ decimals: 6,
51
+ },
52
+ mUSDe: {
53
+ name: "Mezo Ethena USDe",
54
+ symbol: "mUSDe",
55
+ decimals: 18,
56
+ },
57
+ mUSDT: {
58
+ name: "Mezo Tether USDe",
59
+ symbol: "mUSDT",
60
+ decimals: 6,
61
+ },
62
+ mxSolvBTC: {
63
+ name: "Mezo xSolvBTC",
64
+ symbol: "mxSolvBTC",
65
+ decimals: 18,
66
+ },
67
+ };
68
+ /**
69
+ * Gets details of given crypto asset
70
+ * @param key The key of crypto asset
71
+ * @returns The crypto asset details
72
+ */
73
+ export function getAsset(key) {
74
+ return ASSETS[key];
75
+ }
76
+ /**
77
+ * Checks if given crypto asset is Bitcoin-like
78
+ * @param key The key of crypto asset
79
+ * @returns True if crypto asset is Bitcoin-like
80
+ */
81
+ export function isBitcoinLikeCryptoAsset(key) {
82
+ return /(btc)/i.test(key);
83
+ }
84
+ /**
85
+ * Checks if given crypto asset is USD-like
86
+ * @param key The key of crypto asset
87
+ * @returns True if crypto asset is USD-like
88
+ */
89
+ export function isUsdLikeCryptoAsset(key) {
90
+ return /(usd|dai)/i.test(key);
91
+ }
92
+ /**
93
+ * Checks if given crypto asset is T token
94
+ * @param key The key of crypto asset
95
+ * @returns True if crypto asset is T token
96
+ */
97
+ export function isTTokenCryptoAsset(key) {
98
+ return /^(mt|t)$/i.test(key);
99
+ }
100
+ //# sourceMappingURL=assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.js","sourceRoot":"","sources":["../../../src/utils/assets.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IACb,GAAG,EAAE;QACH,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,EAAE;KACb;IACD,GAAG,EAAE;QACH,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,EAAE;KACb;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,EAAE;KACb;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAqB;QAC3B,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,EAAE;KACb;IACD,KAAK,EAAE;QACL,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,CAAC;KACZ;IACD,MAAM,EAAE;QACN,IAAI,EAAE,2BAA2B;QACjC,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,CAAC;KACZ;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,EAAE;KACb;IACD,MAAM,EAAE;QACN,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,CAAC;KACZ;IACD,EAAE,EAAE;QACF,IAAI,EAAE,8BAA8B;QACpC,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,EAAE;KACb;IACD,KAAK,EAAE;QACL,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,CAAC;KACZ;IACD,KAAK,EAAE;QACL,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,EAAE;KACb;IACD,KAAK,EAAE;QACL,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,CAAC;KACZ;IACD,SAAS,EAAE;QACT,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,EAAE;KACb;CACF,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAwB;IAC/C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAClD,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=assets.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.test.d.ts","sourceRoot":"","sources":["../../../src/utils/assets.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ import { getAsset, isBitcoinLikeCryptoAsset, isUsdLikeCryptoAsset, isTTokenCryptoAsset, } from "./assets";
2
+ describe("getAsset", () => {
3
+ it("should return correct asset data", () => {
4
+ const asset = getAsset("BTC");
5
+ expect(asset).toEqual({
6
+ name: "Bitcoin",
7
+ symbol: "BTC",
8
+ decimals: 18,
9
+ });
10
+ });
11
+ });
12
+ describe("isBitcoinLikeCryptoAsset", () => {
13
+ it('should return true for keys containing "btc"', () => {
14
+ expect(isBitcoinLikeCryptoAsset("BTC")).toBe(true);
15
+ expect(isBitcoinLikeCryptoAsset("mFBTC")).toBe(true);
16
+ expect(isBitcoinLikeCryptoAsset("mcbBTC")).toBe(true);
17
+ expect(isBitcoinLikeCryptoAsset("mxSolvBTC")).toBe(true);
18
+ });
19
+ it("should return false for non-Bitcoin assets", () => {
20
+ expect(isBitcoinLikeCryptoAsset("ETH")).toBe(false);
21
+ expect(isBitcoinLikeCryptoAsset("mUSDC")).toBe(false);
22
+ });
23
+ });
24
+ describe("isUsdLikeCryptoAsset", () => {
25
+ it('should return true for keys containing "usd" or "dai"', () => {
26
+ expect(isUsdLikeCryptoAsset("mUSDC")).toBe(true);
27
+ expect(isUsdLikeCryptoAsset("mUSDT")).toBe(true);
28
+ expect(isUsdLikeCryptoAsset("mUSDe")).toBe(true);
29
+ expect(isUsdLikeCryptoAsset("mDAI")).toBe(true);
30
+ });
31
+ it("should return false for other tokens", () => {
32
+ expect(isUsdLikeCryptoAsset("BTC")).toBe(false);
33
+ expect(isUsdLikeCryptoAsset("mT")).toBe(false);
34
+ });
35
+ });
36
+ describe("isTTokenCryptoAsset", () => {
37
+ it('should return true for keys like "mT" or "t"', () => {
38
+ expect(isTTokenCryptoAsset("mT")).toBe(true);
39
+ expect(isTTokenCryptoAsset("T")).toBe(true);
40
+ });
41
+ it("should return false for other tokens", () => {
42
+ expect(isTTokenCryptoAsset("BTC")).toBe(false);
43
+ expect(isTTokenCryptoAsset("mUSDT")).toBe(false);
44
+ });
45
+ });
46
+ //# sourceMappingURL=assets.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.test.js","sourceRoot":"","sources":["../../../src/utils/assets.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,UAAU,CAAA;AAEjB,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC7B,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;YACpB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,EAAE;SACb,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClD,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACpD,MAAM,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACrD,MAAM,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC1D,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnD,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC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CAAA;QAC9C,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -4,11 +4,22 @@
4
4
  * @param options The options to pass to the formatter
5
5
  * @returns The formatted currency
6
6
  */
7
- export declare function formatCurrency(value: number, options?: Omit<Intl.NumberFormatOptions, "style">): string;
7
+ export declare function formatCurrency(value: number, options: Omit<Intl.NumberFormatOptions, "style">): string;
8
8
  /**
9
9
  * Formats a number as a USD currency
10
10
  * @param value The value to format
11
11
  * @returns The formatted currency
12
12
  */
13
- export declare function formatUsd(value: number): string;
13
+ export declare function formatUsd(value: number | string): string;
14
+ /**
15
+ * Converts an asset amount to USD based on a conversion rate and decimals
16
+ * @param assetAmount - The amount of the asset in its smallest unit (e.g., satoshis for BTC)
17
+ * @param conversionRate - The conversion rate from the asset to USD in fixed-point format
18
+ * @param decimals - The number of decimals for the asset
19
+ * @returns - The value in USD as a number
20
+ */
21
+ export declare function convertToUsd(assetAmount: bigint, assetDecimals: number, conversionRate: bigint, conversionRateDecimals: number): {
22
+ value: bigint;
23
+ formatted: string;
24
+ };
14
25
  //# sourceMappingURL=currency.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/utils/currency.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAM,GACpD,MAAM,CAOR;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C"}
1
+ {"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/utils/currency.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,GAC/C,MAAM,CASR;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,sBAAsB,EAAE,MAAM;;;EAc/B"}
@@ -1,17 +1,16 @@
1
- const DEFAULT_FORMAT_OPTIONS = {
2
- style: "currency",
3
- minimumFractionDigits: 2,
4
- maximumFractionDigits: 2,
5
- };
1
+ import { formatUnits } from "viem";
2
+ import { normalizePrecision } from "./numbers";
6
3
  /**
7
4
  * Formats a number as a currency
8
5
  * @param value The value to format
9
6
  * @param options The options to pass to the formatter
10
7
  * @returns The formatted currency
11
8
  */
12
- export function formatCurrency(value, options = {}) {
9
+ export function formatCurrency(value, options) {
13
10
  const formatter = new Intl.NumberFormat("en-US", {
14
- ...DEFAULT_FORMAT_OPTIONS,
11
+ style: "currency",
12
+ minimumFractionDigits: 2,
13
+ maximumFractionDigits: 2,
15
14
  ...options,
16
15
  });
17
16
  return formatter.format(value);
@@ -22,6 +21,21 @@ export function formatCurrency(value, options = {}) {
22
21
  * @returns The formatted currency
23
22
  */
24
23
  export function formatUsd(value) {
25
- return formatCurrency(value, { currency: "USD" });
24
+ return formatCurrency(Number(value), { currency: "USD" });
25
+ }
26
+ /**
27
+ * Converts an asset amount to USD based on a conversion rate and decimals
28
+ * @param assetAmount - The amount of the asset in its smallest unit (e.g., satoshis for BTC)
29
+ * @param conversionRate - The conversion rate from the asset to USD in fixed-point format
30
+ * @param decimals - The number of decimals for the asset
31
+ * @returns - The value in USD as a number
32
+ */
33
+ export function convertToUsd(assetAmount, assetDecimals, conversionRate, conversionRateDecimals) {
34
+ const value = normalizePrecision(assetAmount * conversionRate, assetDecimals + conversionRateDecimals, conversionRateDecimals);
35
+ const formatted = formatUnits(value, conversionRateDecimals);
36
+ return {
37
+ value,
38
+ formatted,
39
+ };
26
40
  }
27
41
  //# sourceMappingURL=currency.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"currency.js","sourceRoot":"","sources":["../../../src/utils/currency.ts"],"names":[],"mappings":"AAAA,MAAM,sBAAsB,GAA6B;IACvD,KAAK,EAAE,UAAU;IACjB,qBAAqB,EAAE,CAAC;IACxB,qBAAqB,EAAE,CAAC;CACzB,CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAa,EACb,UAAmD,EAAE;IAErD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;QAC/C,GAAG,sBAAsB;QACzB,GAAG,OAAO;KACX,CAAC,CAAA;IAEF,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,cAAc,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;AACnD,CAAC"}
1
+ {"version":3,"file":"currency.js","sourceRoot":"","sources":["../../../src/utils/currency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAa,EACb,OAAgD;IAEhD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;QAC/C,KAAK,EAAE,UAAU;QACjB,qBAAqB,EAAE,CAAC;QACxB,qBAAqB,EAAE,CAAC;QACxB,GAAG,OAAO;KACX,CAAC,CAAA;IAEF,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAsB;IAC9C,OAAO,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;AAC3D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC1B,WAAmB,EACnB,aAAqB,EACrB,cAAsB,EACtB,sBAA8B;IAE9B,MAAM,KAAK,GAAG,kBAAkB,CAC9B,WAAW,GAAG,cAAc,EAC5B,aAAa,GAAG,sBAAsB,EACtC,sBAAsB,CACvB,CAAA;IAED,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAA;IAE5D,OAAO;QACL,KAAK;QACL,SAAS;KACV,CAAA;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import { formatCurrency, formatUsd } from "./currency";
1
+ import { convertToUsd, formatCurrency, formatUsd } from "./currency";
2
2
  describe("formatCurrency", () => {
3
3
  it("formats a number as currency with default options", () => {
4
4
  const result = formatCurrency(1234.5, { currency: "EUR" });
@@ -31,4 +31,47 @@ describe("formatUsd", () => {
31
31
  expect(result).toBe("$0.00");
32
32
  });
33
33
  });
34
+ describe("convertToUsd", () => {
35
+ it("converts 1 BTC (8 decimals) with $30,000 rate (6 decimals)", () => {
36
+ const assetAmount = 100000000n; // 1 BTC
37
+ const assetDecimals = 8;
38
+ const conversionRate = 30000000000n; // $30,000 in 6 decimals
39
+ const conversionRateDecimals = 6;
40
+ const result = convertToUsd(assetAmount, assetDecimals, conversionRate, conversionRateDecimals);
41
+ expect(result.value).toBe(30000000000n);
42
+ expect(result.formatted).toBe("30000");
43
+ });
44
+ it("converts 0.5 BTC correctly", () => {
45
+ const assetAmount = 50000000n; // 0.5 BTC
46
+ const assetDecimals = 8;
47
+ const conversionRate = 40000000000n; // $40,000
48
+ const conversionRateDecimals = 6;
49
+ const result = convertToUsd(assetAmount, assetDecimals, conversionRate, conversionRateDecimals);
50
+ expect(result.value).toBe(20000000000n);
51
+ expect(result.formatted).toBe("20000");
52
+ });
53
+ it("converts 1 ETH (18 decimals) with $2,000 rate (6 decimals)", () => {
54
+ const assetAmount = 1000000000000000000n; // 1 ETH
55
+ const assetDecimals = 18;
56
+ const conversionRate = 2000000000n;
57
+ const conversionRateDecimals = 6;
58
+ const result = convertToUsd(assetAmount, assetDecimals, conversionRate, conversionRateDecimals);
59
+ expect(result.value).toBe(2000000000n);
60
+ expect(result.formatted).toBe("2000");
61
+ });
62
+ it("handles zero amount correctly", () => {
63
+ const result = convertToUsd(0n, 18, 999999999n, 6);
64
+ expect(result.value).toBe(0n);
65
+ expect(result.formatted).toBe("0");
66
+ });
67
+ it("handles assets with fewer decimals than conversion rate", () => {
68
+ const assetAmount = 100n;
69
+ const assetDecimals = 2;
70
+ const conversionRate = 1500000000n; // $1500
71
+ const conversionRateDecimals = 6;
72
+ const result = convertToUsd(assetAmount, assetDecimals, conversionRate, conversionRateDecimals);
73
+ expect(result.value).toBe(1500000000n);
74
+ expect(result.formatted).toBe("1500");
75
+ });
76
+ });
34
77
  //# sourceMappingURL=currency.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"currency.test.js","sourceRoot":"","sources":["../../../src/utils/currency.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;QAC1D,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,EAAE;YACjC,QAAQ,EAAE,KAAK;YACf,qBAAqB,EAAE,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AC,KAAK,CAAC,CAAC,IAAI,CAAC,WAAa,CAAC,CAAA;QACxC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACvC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,UAAW,EAAE,CAAC,CAAC,CAAA;QACnD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC7B,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,WAAW,GAAG,IAAI,CAAA;QACxB,MAAM,aAAa,GAAG,CAAC,CAAA;QACvB,MAAM,cAAc,GAAG,WAAa,CAAA,CAAC,QAAQ;QAC7C,MAAM,sBAAsB,GAAG,CAAC,CAAA;QAEhC,MAAM,MAAM,GAAG,YAAY,CACzB,WAAW,EACX,aAAa,EACb,cAAc,EACd,sBAAsB,CACvB,CAAA;QAED,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,WAAa,CAAC,CAAA;QACxC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACvC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ export type MezoId = `${string}.mezo`;
2
+ export declare const DISALLOWED_MEZO_ID_PATTERNS: {
3
+ pattern: RegExp;
4
+ error: string;
5
+ }[];
6
+ export declare function validateMezoId(mezoId: string): string[];
7
+ //# sourceMappingURL=mezoId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mezoId.d.ts","sourceRoot":"","sources":["../../../src/utils/mezoId.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,GAAG,MAAM,OAAO,CAAA;AAWrC,eAAO,MAAM,2BAA2B,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAyBzE,CAAA;AAEH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAYvD"}
@@ -0,0 +1,41 @@
1
+ // NOTE: This was copied from mezo-portal and is based on the validation from
2
+ // workers/passport-auth/src/utils/mezo-id.ts.
3
+ // Most of these are restrictions for an DNS hostname label (i.e., the part
4
+ // before/after `.` in a full hostname) as outlined in RFC1034
5
+ // (https://www.rfc-editor.org/rfc/rfc1034).
6
+ //
7
+ // A few addenda are made to ensure that nothing can sneak through that could
8
+ // look like an Ethereum or Bitcoin address.
9
+ export const DISALLOWED_MEZO_ID_PATTERNS = [
10
+ // RFC1034.
11
+ { pattern: /^$/, error: "Must not be empty." },
12
+ { pattern: /^.{16,}$/, error: "Must have 15 characters or fewer." },
13
+ {
14
+ pattern: /^[^A-Za-z]/,
15
+ error: "Must start with one of the letters A-Z or a-z.",
16
+ },
17
+ {
18
+ pattern: /[^A-Za-z0-9-]/,
19
+ error: "Must only use letters or numbers (A-Z, a-z, or 0-9), or hyphen (-).",
20
+ },
21
+ { pattern: /-$/, error: "Must not end in a hyphen (-)." },
22
+ // On-chain shenanigan avoidance.
23
+ { pattern: /0x/i, error: "Must not contain 0x." },
24
+ {
25
+ pattern: /^(?:bc1|tb1|[a-z]pub|[a-z]priv)/i,
26
+ error: "Must not start with a Bitcoin magic string.",
27
+ },
28
+ {
29
+ pattern: /^m[0-9]+$/i,
30
+ error: 'No "m" + "numeric string" prefixes.',
31
+ },
32
+ ];
33
+ export function validateMezoId(mezoId) {
34
+ if (!/\.mezo$/.test(mezoId)) {
35
+ return ["Must end with '.mezo'."];
36
+ }
37
+ const mezoIdWithoutSuffix = mezoId.replace(/\.mezo$/, "");
38
+ const errors = DISALLOWED_MEZO_ID_PATTERNS.flatMap(({ pattern, error }) => pattern.test(mezoIdWithoutSuffix) ? [error] : []);
39
+ return errors;
40
+ }
41
+ //# sourceMappingURL=mezoId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mezoId.js","sourceRoot":"","sources":["../../../src/utils/mezoId.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,8CAA8C;AAE9C,2EAA2E;AAC3E,8DAA8D;AAC9D,4CAA4C;AAC5C,EAAE;AACF,6EAA6E;AAC7E,4CAA4C;AAC5C,MAAM,CAAC,MAAM,2BAA2B,GACtC;IACE,WAAW;IACX,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,oBAAoB,EAAE;IAC9C,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,mCAAmC,EAAE;IACnE;QACE,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,gDAAgD;KACxD;IACD;QACE,OAAO,EAAE,eAAe;QACxB,KAAK,EACH,qEAAqE;KACxE;IACD,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,+BAA+B,EAAE;IACzD,iCAAiC;IACjC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE;IACjD;QACE,OAAO,EAAE,kCAAkC;QAC3C,KAAK,EAAE,6CAA6C;KACrD;IACD;QACE,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,qCAAqC;KAC7C;CACF,CAAA;AAEH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,wBAAwB,CAAC,CAAA;IACnC,CAAC;IAED,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;IAEzD,MAAM,MAAM,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CACxE,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CACjD,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -1,43 +1,25 @@
1
+ type CompactStringDecimals = Intl.NumberFormatOptions["minimumFractionDigits"] & BigIntToLocaleStringOptions["minimumFractionDigits"];
1
2
  /**
2
- * Formats a number or bigint into a human-readable string with K, M, B, or T suffix.
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 formatHumanReadableNumber(value: number | bigint, decimals?: number): string;
8
+ export declare function formatNumberToCompactString(value: number | bigint, decimals?: CompactStringDecimals): string;
8
9
  /**
9
- * Returns a number rounded up to the desired number of decimals.
10
- * @param amount The number to round up.
11
- * @param desiredDecimals The number of decimals to round up to.
12
- * @returns The rounded up number.
13
- * @see https://github.com/thesis/acre/blob/main/dapp/src/utils/numbersUtils.ts#L1-L3
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.
14
15
  */
15
- export declare function roundUpNumber(amount: number, desiredDecimals?: number): number;
16
+ export declare const normalizePrecision: (value: bigint, currentPrecision: number, targetPrecision?: number) => bigint;
16
17
  /**
17
- * Convert a fixed point bigint with precision `fixedPointDecimals` to a
18
- * floating point number truncated to `desiredDecimals`.
19
- * @param fixedPoint The fixed point bigint to convert.
20
- * @param fixedPointDecimals The number of decimals in the fixed point bigint.
21
- * @param desiredDecimals The number of decimals in the output number.
22
- * @returns The floating point number truncated to `desiredDecimals`.
23
- * @see https://github.com/tahowallet/extension/blob/main/background/lib/fixed-point.ts#L216-L239
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.
24
22
  */
25
- export declare function fromFixedPoint(fixedPoint: bigint, fixedPointDecimals: number, desiredDecimals?: number): number;
26
- /**
27
- * Display a cryptoAsset amount correctly with desired decimals.
28
- * The function returns a string with a language-sensitive representation of this number.
29
- * - If the amount entered is zero, return the result with the desired decimals.
30
- * For example, 0.00 for a precision of 2.
31
- * - If `formattedAmount` is less than the minimum amount to display
32
- * for the specified precision return information about this.
33
- * For example, <0.01 for a precision of 2.
34
- * - Other amounts are formatted according to the use of the `bigIntToUserAmount` function.
35
- * @param amount The amount of tokens to format.
36
- * @param decimals The number of decimals the cryptoAsset has.
37
- * @param desiredDecimals The number of decimals to display.
38
- * @param withRoundUp If true, the amount will be rounded up.
39
- * @returns The formatted cryptoAsset amount.
40
- * @see https://github.com/thesis/acre/blob/main/dapp/src/utils/numbersUtils.ts#L57-L87
41
- */
42
- export declare function formatTokenAmount(amount: number | string | bigint, decimals?: number, desiredDecimals?: number, withRoundUp?: boolean): string;
23
+ export declare const bigIntMax: (...values: bigint[]) => bigint;
24
+ export {};
43
25
  //# sourceMappingURL=numbers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../../src/utils/numbers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,GAAE,MAAU,GACnB,MAAM,CAgBR;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;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAChC,QAAQ,SAAK,EACb,eAAe,SAAI,EACnB,WAAW,UAAQ,UA0BpB"}
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"}