@mezo-org/passport 0.4.0-dev.5 → 0.4.0-dev.50

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 (328) hide show
  1. package/README.md +18 -22
  2. package/dist/src/api/auth.d.ts +36 -59
  3. package/dist/src/api/auth.d.ts.map +1 -1
  4. package/dist/src/api/auth.js +21 -49
  5. package/dist/src/api/auth.js.map +1 -1
  6. package/dist/src/api/client.d.ts +24 -0
  7. package/dist/src/api/client.d.ts.map +1 -0
  8. package/dist/src/api/client.js +54 -0
  9. package/dist/src/api/client.js.map +1 -0
  10. package/dist/src/api/endpoint-error.d.ts +4 -0
  11. package/dist/src/api/endpoint-error.d.ts.map +1 -0
  12. package/dist/src/api/endpoint-error.js +6 -0
  13. package/dist/src/api/endpoint-error.js.map +1 -0
  14. package/dist/src/api/fetch-error copy.d.ts +5 -0
  15. package/dist/src/api/fetch-error copy.d.ts.map +1 -0
  16. package/dist/src/api/fetch-error copy.js +8 -0
  17. package/dist/src/api/fetch-error copy.js.map +1 -0
  18. package/dist/src/api/fetch-error.d.ts +5 -0
  19. package/dist/src/api/fetch-error.d.ts.map +1 -0
  20. package/dist/src/api/fetch-error.js +8 -0
  21. package/dist/src/api/fetch-error.js.map +1 -0
  22. package/dist/src/api/index.d.ts +3 -0
  23. package/dist/src/api/index.d.ts.map +1 -0
  24. package/dist/src/api/index.js +3 -0
  25. package/dist/src/api/index.js.map +1 -0
  26. package/dist/src/api/portal.d.ts +26 -0
  27. package/dist/src/api/portal.d.ts.map +1 -0
  28. package/dist/src/api/portal.js +23 -0
  29. package/dist/src/api/portal.js.map +1 -0
  30. package/dist/src/assets/DefaultAvatar.d.ts +5 -0
  31. package/dist/src/assets/DefaultAvatar.d.ts.map +1 -0
  32. package/dist/src/assets/DefaultAvatar.js +21 -0
  33. package/dist/src/assets/DefaultAvatar.js.map +1 -0
  34. package/dist/src/components/Dropdown/ConnectedTrigger.d.ts +8 -0
  35. package/dist/src/components/Dropdown/ConnectedTrigger.d.ts.map +1 -0
  36. package/dist/src/components/Dropdown/ConnectedTrigger.js +39 -0
  37. package/dist/src/components/Dropdown/ConnectedTrigger.js.map +1 -0
  38. package/dist/src/components/Dropdown/Content.d.ts +23 -0
  39. package/dist/src/components/Dropdown/Content.d.ts.map +1 -0
  40. package/dist/src/components/Dropdown/Content.js +27 -0
  41. package/dist/src/components/Dropdown/Content.js.map +1 -0
  42. package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts +7 -0
  43. package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts.map +1 -0
  44. package/dist/src/components/Dropdown/DisconnectedTrigger.js +13 -0
  45. package/dist/src/components/Dropdown/DisconnectedTrigger.js.map +1 -0
  46. package/dist/src/components/Dropdown/Dropdown.d.ts +27 -0
  47. package/dist/src/components/Dropdown/Dropdown.d.ts.map +1 -0
  48. package/dist/src/components/Dropdown/Dropdown.js +68 -0
  49. package/dist/src/components/Dropdown/Dropdown.js.map +1 -0
  50. package/dist/src/components/Dropdown/ListingItem.d.ts +13 -0
  51. package/dist/src/components/Dropdown/ListingItem.d.ts.map +1 -0
  52. package/dist/src/components/Dropdown/ListingItem.js +34 -0
  53. package/dist/src/components/Dropdown/ListingItem.js.map +1 -0
  54. package/dist/src/components/Dropdown/NestedViewLayout.d.ts +7 -0
  55. package/dist/src/components/Dropdown/NestedViewLayout.d.ts.map +1 -0
  56. package/dist/src/components/Dropdown/NestedViewLayout.js +34 -0
  57. package/dist/src/components/Dropdown/NestedViewLayout.js.map +1 -0
  58. package/dist/src/components/Dropdown/Receive/Receive.d.ts +7 -0
  59. package/dist/src/components/Dropdown/Receive/Receive.d.ts.map +1 -0
  60. package/dist/src/components/Dropdown/Receive/Receive.js +53 -0
  61. package/dist/src/components/Dropdown/Receive/Receive.js.map +1 -0
  62. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts +7 -0
  63. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts.map +1 -0
  64. package/dist/src/components/Dropdown/Root/AccountAddressActions.js +48 -0
  65. package/dist/src/components/Dropdown/Root/AccountAddressActions.js.map +1 -0
  66. package/dist/src/components/Dropdown/Root/AccountAssetItem.d.ts +11 -0
  67. package/dist/src/components/Dropdown/Root/AccountAssetItem.d.ts.map +1 -0
  68. package/dist/src/components/Dropdown/Root/AccountAssetItem.js +9 -0
  69. package/dist/src/components/Dropdown/Root/AccountAssetItem.js.map +1 -0
  70. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts +8 -0
  71. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts.map +1 -0
  72. package/dist/src/components/Dropdown/Root/AccountBalance.js +15 -0
  73. package/dist/src/components/Dropdown/Root/AccountBalance.js.map +1 -0
  74. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts +9 -0
  75. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts.map +1 -0
  76. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js +48 -0
  77. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js.map +1 -0
  78. package/dist/src/components/Dropdown/Root/Root.d.ts +23 -0
  79. package/dist/src/components/Dropdown/Root/Root.d.ts.map +1 -0
  80. package/dist/src/components/Dropdown/Root/Root.js +57 -0
  81. package/dist/src/components/Dropdown/Root/Root.js.map +1 -0
  82. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts +8 -0
  83. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts.map +1 -0
  84. package/dist/src/components/Dropdown/Root/WalletAddress.js +64 -0
  85. package/dist/src/components/Dropdown/Root/WalletAddress.js.map +1 -0
  86. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts +8 -0
  87. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts.map +1 -0
  88. package/dist/src/components/Dropdown/Root/WelcomeBlock.js +44 -0
  89. package/dist/src/components/Dropdown/Root/WelcomeBlock.js.map +1 -0
  90. package/dist/src/components/Dropdown/TestnetTopBanner.d.ts +3 -0
  91. package/dist/src/components/Dropdown/TestnetTopBanner.d.ts.map +1 -0
  92. package/dist/src/components/Dropdown/TestnetTopBanner.js +14 -0
  93. package/dist/src/components/Dropdown/TestnetTopBanner.js.map +1 -0
  94. package/dist/src/components/Dropdown/index.d.ts +3 -0
  95. package/dist/src/components/Dropdown/index.d.ts.map +1 -0
  96. package/dist/src/components/Dropdown/index.js +2 -0
  97. package/dist/src/components/Dropdown/index.js.map +1 -0
  98. package/dist/src/components/index.d.ts +2 -0
  99. package/dist/src/components/index.d.ts.map +1 -0
  100. package/dist/src/components/index.js +2 -0
  101. package/dist/src/components/index.js.map +1 -0
  102. package/dist/src/config.d.ts +17 -5
  103. package/dist/src/config.d.ts.map +1 -1
  104. package/dist/src/config.js +51 -14
  105. package/dist/src/config.js.map +1 -1
  106. package/dist/src/constants.d.ts +11 -3
  107. package/dist/src/constants.d.ts.map +1 -1
  108. package/dist/src/constants.js +12 -4
  109. package/dist/src/constants.js.map +1 -1
  110. package/dist/src/hooks/constants.d.ts +1 -0
  111. package/dist/src/hooks/constants.d.ts.map +1 -1
  112. package/dist/src/hooks/constants.js +1 -0
  113. package/dist/src/hooks/constants.js.map +1 -1
  114. package/dist/src/hooks/index.d.ts +3 -1
  115. package/dist/src/hooks/index.d.ts.map +1 -1
  116. package/dist/src/hooks/index.js +3 -1
  117. package/dist/src/hooks/index.js.map +1 -1
  118. package/dist/src/hooks/useAssetsConversionRates.d.ts +23 -0
  119. package/dist/src/hooks/useAssetsConversionRates.d.ts.map +1 -0
  120. package/dist/src/hooks/useAssetsConversionRates.js +85 -0
  121. package/dist/src/hooks/useAssetsConversionRates.js.map +1 -0
  122. package/dist/src/hooks/useAuthApiClient.d.ts +1 -1
  123. package/dist/src/hooks/useAuthApiClient.d.ts.map +1 -1
  124. package/dist/src/hooks/useAuthenticateWithWallet.d.ts +12 -102
  125. package/dist/src/hooks/useAuthenticateWithWallet.d.ts.map +1 -1
  126. package/dist/src/hooks/useAuthenticateWithWallet.js +28 -17
  127. package/dist/src/hooks/useAuthenticateWithWallet.js.map +1 -1
  128. package/dist/src/hooks/useBitcoinPriceConversion copy.d.ts +2 -0
  129. package/dist/src/hooks/useBitcoinPriceConversion copy.d.ts.map +1 -0
  130. package/dist/src/hooks/useBitcoinPriceConversion copy.js +43 -0
  131. package/dist/src/hooks/useBitcoinPriceConversion copy.js.map +1 -0
  132. package/dist/src/hooks/useBitcoinPriceConversion.d.ts +103 -0
  133. package/dist/src/hooks/useBitcoinPriceConversion.d.ts.map +1 -0
  134. package/dist/src/hooks/useBitcoinPriceConversion.js +50 -0
  135. package/dist/src/hooks/useBitcoinPriceConversion.js.map +1 -0
  136. package/dist/src/hooks/useBitcoinPriceFeed.d.ts +15 -0
  137. package/dist/src/hooks/useBitcoinPriceFeed.d.ts.map +1 -0
  138. package/dist/src/hooks/useBitcoinPriceFeed.js +67 -0
  139. package/dist/src/hooks/useBitcoinPriceFeed.js.map +1 -0
  140. package/dist/src/hooks/useBorrowData.d.ts +60 -0
  141. package/dist/src/hooks/useBorrowData.d.ts.map +1 -0
  142. package/dist/src/hooks/useBorrowData.js +122 -0
  143. package/dist/src/hooks/useBorrowData.js.map +1 -0
  144. package/dist/src/hooks/useCreateAccount.d.ts +23 -173
  145. package/dist/src/hooks/useCreateAccount.d.ts.map +1 -1
  146. package/dist/src/hooks/useCreateAccount.js +7 -4
  147. package/dist/src/hooks/useCreateAccount.js.map +1 -1
  148. package/dist/src/hooks/useCreateSession.d.ts +12 -101
  149. package/dist/src/hooks/useCreateSession.d.ts.map +1 -1
  150. package/dist/src/hooks/useCreateSession.js +10 -8
  151. package/dist/src/hooks/useCreateSession.js.map +1 -1
  152. package/dist/src/hooks/useDropdownData.d.ts +47 -0
  153. package/dist/src/hooks/useDropdownData.d.ts.map +1 -0
  154. package/dist/src/hooks/useDropdownData.js +99 -0
  155. package/dist/src/hooks/useDropdownData.js.map +1 -0
  156. package/dist/src/hooks/useGetAccountByAddress.d.ts +2 -2
  157. package/dist/src/hooks/useGetAccountByAddress.d.ts.map +1 -1
  158. package/dist/src/hooks/useGetAccountByMezoId.d.ts +2 -2
  159. package/dist/src/hooks/useGetAccountByMezoId.d.ts.map +1 -1
  160. package/dist/src/hooks/useGetCurrentAccount.d.ts +16 -2
  161. package/dist/src/hooks/useGetCurrentAccount.d.ts.map +1 -1
  162. package/dist/src/hooks/useGetCurrentAccount.js +25 -3
  163. package/dist/src/hooks/useGetCurrentAccount.js.map +1 -1
  164. package/dist/src/hooks/useGetSession.d.ts +1 -1
  165. package/dist/src/hooks/useGetSession.d.ts.map +1 -1
  166. package/dist/src/hooks/useLinkAccount.d.ts +15 -175
  167. package/dist/src/hooks/useLinkAccount.d.ts.map +1 -1
  168. package/dist/src/hooks/useLinkAccount.js +7 -4
  169. package/dist/src/hooks/useLinkAccount.js.map +1 -1
  170. package/dist/src/hooks/usePortalApiClient.d.ts +2 -0
  171. package/dist/src/hooks/usePortalApiClient.d.ts.map +1 -0
  172. package/dist/src/hooks/usePortalApiClient.js +6 -0
  173. package/dist/src/hooks/usePortalApiClient.js.map +1 -0
  174. package/dist/src/hooks/useRefreshPassport.d.ts +19 -0
  175. package/dist/src/hooks/useRefreshPassport.d.ts.map +1 -0
  176. package/dist/src/hooks/useRefreshPassport.js +44 -0
  177. package/dist/src/hooks/useRefreshPassport.js.map +1 -0
  178. package/dist/src/hooks/useSignInWithDiscord.d.ts +12 -100
  179. package/dist/src/hooks/useSignInWithDiscord.d.ts.map +1 -1
  180. package/dist/src/hooks/useSignInWithDiscord.js +6 -3
  181. package/dist/src/hooks/useSignInWithDiscord.js.map +1 -1
  182. package/dist/src/hooks/useSignInWithWallet.d.ts +12 -100
  183. package/dist/src/hooks/useSignInWithWallet.d.ts.map +1 -1
  184. package/dist/src/hooks/useSignInWithWallet.js +2 -2
  185. package/dist/src/hooks/useSignInWithWallet.js.map +1 -1
  186. package/dist/src/hooks/useSignOut.d.ts +12 -28
  187. package/dist/src/hooks/useSignOut.d.ts.map +1 -1
  188. package/dist/src/hooks/useSignOut.js +7 -4
  189. package/dist/src/hooks/useSignOut.js.map +1 -1
  190. package/dist/src/hooks/useSignUpWithWallet.d.ts +12 -100
  191. package/dist/src/hooks/useSignUpWithWallet.d.ts.map +1 -1
  192. package/dist/src/hooks/useSignUpWithWallet.js +2 -2
  193. package/dist/src/hooks/useSignUpWithWallet.js.map +1 -1
  194. package/dist/src/hooks/useTokensBalances.d.ts +74 -0
  195. package/dist/src/hooks/useTokensBalances.d.ts.map +1 -0
  196. package/dist/src/hooks/useTokensBalances.js +140 -0
  197. package/dist/src/hooks/useTokensBalances.js.map +1 -0
  198. package/dist/src/hooks/useUpdateMezoId.d.ts +30 -136
  199. package/dist/src/hooks/useUpdateMezoId.d.ts.map +1 -1
  200. package/dist/src/hooks/useUpdateMezoId.js +7 -4
  201. package/dist/src/hooks/useUpdateMezoId.js.map +1 -1
  202. package/dist/src/hooks/useWalletAccount.d.ts +13 -0
  203. package/dist/src/hooks/useWalletAccount.d.ts.map +1 -0
  204. package/dist/src/hooks/useWalletAccount.js +29 -0
  205. package/dist/src/hooks/useWalletAccount.js.map +1 -0
  206. package/dist/src/hooks/useWatchTransferEvents.d.ts +5 -0
  207. package/dist/src/hooks/useWatchTransferEvents.d.ts.map +1 -0
  208. package/dist/src/hooks/useWatchTransferEvents.js +63 -0
  209. package/dist/src/hooks/useWatchTransferEvents.js.map +1 -0
  210. package/dist/src/index.d.ts +2 -1
  211. package/dist/src/index.d.ts.map +1 -1
  212. package/dist/src/index.js +2 -1
  213. package/dist/src/index.js.map +1 -1
  214. package/dist/src/lib/contracts/index.d.ts +13 -0
  215. package/dist/src/lib/contracts/index.d.ts.map +1 -0
  216. package/dist/src/lib/contracts/index.js +58 -0
  217. package/dist/src/lib/contracts/index.js.map +1 -0
  218. package/dist/src/lib/contracts/price-oracle.d.ts +43 -0
  219. package/dist/src/lib/contracts/price-oracle.d.ts.map +1 -0
  220. package/dist/src/lib/contracts/price-oracle.js +52 -0
  221. package/dist/src/lib/contracts/price-oracle.js.map +1 -0
  222. package/dist/src/lib/contracts/priceOracle.d.ts +43 -0
  223. package/dist/src/lib/contracts/priceOracle.d.ts.map +1 -0
  224. package/dist/src/lib/contracts/priceOracle.js +52 -0
  225. package/dist/src/lib/contracts/priceOracle.js.map +1 -0
  226. package/dist/src/provider.d.ts +10 -13
  227. package/dist/src/provider.d.ts.map +1 -1
  228. package/dist/src/provider.js +11 -20
  229. package/dist/src/provider.js.map +1 -1
  230. package/dist/src/stores/dropdownStore.d.ts +12 -0
  231. package/dist/src/stores/dropdownStore.d.ts.map +1 -0
  232. package/dist/src/stores/dropdownStore.js +13 -0
  233. package/dist/src/stores/dropdownStore.js.map +1 -0
  234. package/dist/src/utils/address.d.ts +15 -0
  235. package/dist/src/utils/address.d.ts.map +1 -0
  236. package/dist/src/utils/address.js +37 -0
  237. package/dist/src/utils/address.js.map +1 -0
  238. package/dist/src/utils/address.test.d.ts +2 -0
  239. package/dist/src/utils/address.test.d.ts.map +1 -0
  240. package/dist/src/utils/address.test.js +40 -0
  241. package/dist/src/utils/address.test.js.map +1 -0
  242. package/dist/src/utils/cryptoAssets.d.ts +44 -0
  243. package/dist/src/utils/cryptoAssets.d.ts.map +1 -0
  244. package/dist/src/utils/cryptoAssets.js +132 -0
  245. package/dist/src/utils/cryptoAssets.js.map +1 -0
  246. package/dist/src/utils/cryptoAssets.test.d.ts +2 -0
  247. package/dist/src/utils/cryptoAssets.test.d.ts.map +1 -0
  248. package/dist/src/utils/cryptoAssets.test.js +67 -0
  249. package/dist/src/utils/cryptoAssets.test.js.map +1 -0
  250. package/dist/src/utils/currency.d.ts +14 -0
  251. package/dist/src/utils/currency.d.ts.map +1 -0
  252. package/dist/src/utils/currency.js +27 -0
  253. package/dist/src/utils/currency.js.map +1 -0
  254. package/dist/src/utils/currency.test.d.ts +2 -0
  255. package/dist/src/utils/currency.test.d.ts.map +1 -0
  256. package/dist/src/utils/currency.test.js +34 -0
  257. package/dist/src/utils/currency.test.js.map +1 -0
  258. package/dist/src/utils/numbers.d.ts +58 -0
  259. package/dist/src/utils/numbers.d.ts.map +1 -0
  260. package/dist/src/utils/numbers.js +132 -0
  261. package/dist/src/utils/numbers.js.map +1 -0
  262. package/dist/src/utils/numbers.test.d.ts +2 -0
  263. package/dist/src/utils/numbers.test.d.ts.map +1 -0
  264. package/dist/src/utils/numbers.test.js +170 -0
  265. package/dist/src/utils/numbers.test.js.map +1 -0
  266. package/package.json +14 -8
  267. package/src/api/auth.ts +73 -128
  268. package/src/api/client.ts +87 -0
  269. package/src/api/fetch-error.ts +8 -0
  270. package/src/api/index.ts +2 -0
  271. package/src/api/portal.ts +53 -0
  272. package/src/assets/DefaultAvatar.tsx +74 -0
  273. package/src/components/Dropdown/ConnectedTrigger.tsx +76 -0
  274. package/src/components/Dropdown/Content.tsx +98 -0
  275. package/src/components/Dropdown/DisconnectedTrigger.tsx +36 -0
  276. package/src/components/Dropdown/Dropdown.tsx +148 -0
  277. package/src/components/Dropdown/ListingItem.tsx +80 -0
  278. package/src/components/Dropdown/NestedViewLayout.tsx +75 -0
  279. package/src/components/Dropdown/README.md +41 -0
  280. package/src/components/Dropdown/Receive/Receive.tsx +119 -0
  281. package/src/components/Dropdown/Root/AccountAddressActions.tsx +101 -0
  282. package/src/components/Dropdown/Root/AccountAssetItem.tsx +26 -0
  283. package/src/components/Dropdown/Root/AccountBalance.tsx +30 -0
  284. package/src/components/Dropdown/Root/AccountOtherAssets.tsx +68 -0
  285. package/src/components/Dropdown/Root/Root.tsx +147 -0
  286. package/src/components/Dropdown/Root/WalletAddress.tsx +128 -0
  287. package/src/components/Dropdown/Root/WelcomeBlock.tsx +91 -0
  288. package/src/components/Dropdown/TestnetTopBanner.tsx +32 -0
  289. package/src/components/Dropdown/index.ts +2 -0
  290. package/src/components/index.ts +1 -0
  291. package/src/config.ts +77 -20
  292. package/src/constants.ts +12 -4
  293. package/src/hooks/constants.ts +1 -0
  294. package/src/hooks/index.ts +6 -1
  295. package/src/hooks/useAssetsConversionRates.ts +92 -0
  296. package/src/hooks/useAuthenticateWithWallet.ts +44 -23
  297. package/src/hooks/useBorrowData.ts +143 -0
  298. package/src/hooks/useCreateAccount.ts +19 -5
  299. package/src/hooks/useCreateSession.ts +22 -9
  300. package/src/hooks/useDropdownData.ts +149 -0
  301. package/src/hooks/useGetAccountByAddress.ts +2 -2
  302. package/src/hooks/useGetAccountByMezoId.ts +2 -2
  303. package/src/hooks/useGetCurrentAccount.ts +46 -6
  304. package/src/hooks/useGetSession.ts +1 -1
  305. package/src/hooks/useLinkAccount.ts +18 -5
  306. package/src/hooks/usePortalApiClient.ts +6 -0
  307. package/src/hooks/useRefreshPassport.ts +56 -0
  308. package/src/hooks/useSignInWithDiscord.ts +14 -5
  309. package/src/hooks/useSignInWithWallet.ts +9 -2
  310. package/src/hooks/useSignOut.ts +18 -4
  311. package/src/hooks/useSignUpWithWallet.ts +9 -2
  312. package/src/hooks/useTokensBalances.ts +187 -0
  313. package/src/hooks/useUpdateMezoId.ts +19 -4
  314. package/src/hooks/useWalletAccount.ts +55 -0
  315. package/src/hooks/useWatchTransferEvents.ts +74 -0
  316. package/src/index.ts +12 -1
  317. package/src/lib/contracts/index.ts +90 -0
  318. package/src/lib/contracts/priceOracle.ts +53 -0
  319. package/src/provider.ts +30 -37
  320. package/src/stores/dropdownStore.ts +20 -0
  321. package/src/utils/address.test.ts +48 -0
  322. package/src/utils/address.ts +45 -0
  323. package/src/utils/cryptoAssets.test.ts +79 -0
  324. package/src/utils/cryptoAssets.ts +173 -0
  325. package/src/utils/currency.test.ts +38 -0
  326. package/src/utils/currency.ts +32 -0
  327. package/src/utils/numbers.test.ts +220 -0
  328. package/src/utils/numbers.ts +188 -0
@@ -0,0 +1,43 @@
1
+ import { Address } from "viem";
2
+ declare const _default: {
3
+ address: Address;
4
+ abi: readonly [{
5
+ readonly inputs: readonly [];
6
+ readonly name: "decimals";
7
+ readonly outputs: readonly [{
8
+ readonly internalType: "uint8";
9
+ readonly name: "";
10
+ readonly type: "uint8";
11
+ }];
12
+ readonly stateMutability: "view";
13
+ readonly type: "function";
14
+ }, {
15
+ readonly inputs: readonly [];
16
+ readonly name: "latestRoundData";
17
+ readonly outputs: readonly [{
18
+ readonly internalType: "uint80";
19
+ readonly name: "roundId";
20
+ readonly type: "uint80";
21
+ }, {
22
+ readonly internalType: "int256";
23
+ readonly name: "answer";
24
+ readonly type: "int256";
25
+ }, {
26
+ readonly internalType: "uint256";
27
+ readonly name: "startedAt";
28
+ readonly type: "uint256";
29
+ }, {
30
+ readonly internalType: "uint256";
31
+ readonly name: "updatedAt";
32
+ readonly type: "uint256";
33
+ }, {
34
+ readonly internalType: "uint80";
35
+ readonly name: "answeredInRound";
36
+ readonly type: "uint80";
37
+ }];
38
+ readonly stateMutability: "view";
39
+ readonly type: "function";
40
+ }];
41
+ };
42
+ export default _default;
43
+ //# sourceMappingURL=priceOracle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"priceOracle.d.ts","sourceRoot":"","sources":["../../../../src/lib/contracts/priceOracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;;aAG6B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AADlE,wBAkDC"}
@@ -0,0 +1,52 @@
1
+ export default {
2
+ address: "0x7b7c000000000000000000000000000000000015",
3
+ abi: [
4
+ {
5
+ inputs: [],
6
+ name: "decimals",
7
+ outputs: [
8
+ {
9
+ internalType: "uint8",
10
+ name: "",
11
+ type: "uint8",
12
+ },
13
+ ],
14
+ stateMutability: "view",
15
+ type: "function",
16
+ },
17
+ {
18
+ inputs: [],
19
+ name: "latestRoundData",
20
+ outputs: [
21
+ {
22
+ internalType: "uint80",
23
+ name: "roundId",
24
+ type: "uint80",
25
+ },
26
+ {
27
+ internalType: "int256",
28
+ name: "answer",
29
+ type: "int256",
30
+ },
31
+ {
32
+ internalType: "uint256",
33
+ name: "startedAt",
34
+ type: "uint256",
35
+ },
36
+ {
37
+ internalType: "uint256",
38
+ name: "updatedAt",
39
+ type: "uint256",
40
+ },
41
+ {
42
+ internalType: "uint80",
43
+ name: "answeredInRound",
44
+ type: "uint80",
45
+ },
46
+ ],
47
+ stateMutability: "view",
48
+ type: "function",
49
+ },
50
+ ],
51
+ };
52
+ //# sourceMappingURL=priceOracle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"priceOracle.js","sourceRoot":"","sources":["../../../../src/lib/contracts/priceOracle.ts"],"names":[],"mappings":"AAEA,eAAe;IACb,OAAO,EAAE,4CAAuD;IAChE,GAAG,EAAE;QACH;YACE,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE;gBACP;oBACE,YAAY,EAAE,OAAO;oBACrB,IAAI,EAAE,EAAE;oBACR,IAAI,EAAE,OAAO;iBACd;aACF;YACD,eAAe,EAAE,MAAM;YACvB,IAAI,EAAE,UAAU;SACjB;QACD;YACE,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,iBAAiB;YACvB,OAAO,EAAE;gBACP;oBACE,YAAY,EAAE,QAAQ;oBACtB,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,QAAQ;iBACf;gBACD;oBACE,YAAY,EAAE,QAAQ;oBACtB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,QAAQ;iBACf;gBACD;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,YAAY,EAAE,QAAQ;oBACtB,IAAI,EAAE,iBAAiB;oBACvB,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,eAAe,EAAE,MAAM;YACvB,IAAI,EAAE,UAAU;SACjB;KACO;CACX,CAAA"}
@@ -1,20 +1,17 @@
1
- /// <reference types="react" />
2
- import { API_ENDPOINTS_BY_ENV, AuthApiClient } from "./api/auth";
1
+ import { AuthApiClient, PortalApiClient } from "./api";
3
2
  export interface PassportContextValue {
4
3
  authApiClient: AuthApiClient;
4
+ portalApiClient: PortalApiClient;
5
+ environment?: Environment;
5
6
  }
6
7
  export declare const PassportContext: import("react").Context<PassportContextValue | undefined>;
7
- interface PassportProviderProps {
8
- options: {
9
- environment?: keyof typeof API_ENDPOINTS_BY_ENV;
10
- apiUrl?: string;
11
- } & ({
12
- environment: keyof typeof API_ENDPOINTS_BY_ENV;
13
- } | {
14
- apiUrl: string;
15
- });
8
+ type Environment = "mainnet" | "testnet";
9
+ type PassportProviderProps = {
16
10
  children: React.ReactNode;
17
- }
18
- export declare function PassportProvider({ options, children }: PassportProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<PassportContextValue | undefined>>;
11
+ environment?: Environment;
12
+ authApiUrl?: string;
13
+ portalApiUrl?: string;
14
+ };
15
+ export declare function PassportProvider({ environment, authApiUrl, portalApiUrl, children, }: PassportProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<PassportContextValue | undefined>>;
19
16
  export {};
20
17
  //# sourceMappingURL=provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhE,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,aAAa,CAAA;CAC7B;AAED,eAAO,MAAM,eAAe,2DAE3B,CAAA;AAED,UAAU,qBAAqB;IAE7B,OAAO,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,OAAO,oBAAoB,CAAA;QAC/C,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,GAAG,CACA;QACE,WAAW,EAAE,MAAM,OAAO,oBAAoB,CAAA;KAC/C,GACD;QACE,MAAM,EAAE,MAAM,CAAA;KACf,CACJ,CAAA;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,qBAAqB,6GA6B5E"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAEtD,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,aAAa,CAAA;IAC5B,eAAe,EAAE,eAAe,CAAA;IAChC,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED,eAAO,MAAM,eAAe,2DAE3B,CAAA;AAED,KAAK,WAAW,GAAG,SAAS,GAAG,SAAS,CAAA;AAExC,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IAEzB,WAAW,CAAC,EAAE,WAAW,CAAA;IAEzB,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,WAAW,EACX,UAAU,EACV,YAAY,EACZ,QAAQ,GACT,EAAE,qBAAqB,6GAmBvB"}
@@ -1,25 +1,16 @@
1
- import { createContext, createElement, useMemo } from "react";
2
- import { API_ENDPOINTS_BY_ENV, AuthApiClient } from "./api/auth";
1
+ import { createContext, createElement } from "react";
2
+ import { AuthApiClient, PortalApiClient } from "./api";
3
3
  export const PassportContext = createContext(undefined);
4
- export function PassportProvider({ options, children }) {
5
- const { environment, apiUrl } = options;
6
- const finalApiUrl = useMemo(() => {
7
- if (!environment && !apiUrl) {
8
- throw new Error("Neither apiUrl or environment are specified in Passport Provider");
9
- }
10
- if (apiUrl)
11
- return apiUrl;
12
- if (!(environment in API_ENDPOINTS_BY_ENV)) {
13
- throw new Error("Wrong environment passed to PassportProvider.");
14
- }
15
- return API_ENDPOINTS_BY_ENV[environment];
16
- }, [environment, apiUrl]);
4
+ export function PassportProvider({ environment, authApiUrl, portalApiUrl, children, }) {
5
+ if (environment && !["mainnet", "testnet"].includes(environment)) {
6
+ throw new Error("Wrong environment passed to PassportProvider.");
7
+ }
17
8
  return createElement(PassportContext.Provider, {
18
- value: finalApiUrl
19
- ? {
20
- authApiClient: new AuthApiClient(finalApiUrl),
21
- }
22
- : undefined,
9
+ value: {
10
+ authApiClient: new AuthApiClient(environment ?? "mainnet", authApiUrl),
11
+ portalApiClient: new PortalApiClient(environment ?? "mainnet", portalApiUrl),
12
+ environment,
13
+ },
23
14
  }, children);
24
15
  }
25
16
  //# sourceMappingURL=provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAMhE,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAC1C,SAAS,CACV,CAAA;AAkBD,MAAM,UAAU,gBAAgB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAyB;IAC3E,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IAEvC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE;QAC/B,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CACb,kEAAkE,CACnE,CAAA;QACH,CAAC;QACD,IAAI,MAAM;YAAE,OAAO,MAAM,CAAA;QAEzB,IAAI,CAAC,CAAC,WAAY,IAAI,oBAAoB,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;QAClE,CAAC;QAED,OAAO,oBAAoB,CAAC,WAAY,CAAC,CAAA;IAC3C,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAA;IAEzB,OAAO,aAAa,CAClB,eAAe,CAAC,QAAQ,EACxB;QACE,KAAK,EAAE,WAAW;YAChB,CAAC,CAAC;gBACE,aAAa,EAAE,IAAI,aAAa,CAAC,WAAW,CAAC;aAC9C;YACH,CAAC,CAAC,SAAS;KACd,EACD,QAAQ,CACT,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAQtD,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAC1C,SAAS,CACV,CAAA;AAcD,MAAM,UAAU,gBAAgB,CAAC,EAC/B,WAAW,EACX,UAAU,EACV,YAAY,EACZ,QAAQ,GACc;IACtB,IAAI,WAAW,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACjE,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;IAClE,CAAC;IAED,OAAO,aAAa,CAClB,eAAe,CAAC,QAAQ,EACxB;QACE,KAAK,EAAE;YACL,aAAa,EAAE,IAAI,aAAa,CAAC,WAAW,IAAI,SAAS,EAAE,UAAU,CAAC;YACtE,eAAe,EAAE,IAAI,eAAe,CAClC,WAAW,IAAI,SAAS,EACxB,YAAY,CACb;YACD,WAAW;SACZ;KACF,EACD,QAAQ,CACT,CAAA;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare enum DropdownView {
2
+ ROOT = "ROOT",
3
+ RECEIVE = "RECEIVE"
4
+ }
5
+ interface DropdownStore {
6
+ view: DropdownView;
7
+ setView: (view: DropdownView) => void;
8
+ isNestedView: () => boolean;
9
+ }
10
+ declare const useDropdownStore: import("zustand").UseBoundStore<import("zustand").StoreApi<DropdownStore>>;
11
+ export default useDropdownStore;
12
+ //# sourceMappingURL=dropdownStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdownStore.d.ts","sourceRoot":"","sources":["../../../src/stores/dropdownStore.ts"],"names":[],"mappings":"AAEA,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAA;IACrC,YAAY,EAAE,MAAM,OAAO,CAAA;CAC5B;AAED,QAAA,MAAM,gBAAgB,4EAInB,CAAA;AAEH,eAAe,gBAAgB,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { create } from "zustand";
2
+ export var DropdownView;
3
+ (function (DropdownView) {
4
+ DropdownView["ROOT"] = "ROOT";
5
+ DropdownView["RECEIVE"] = "RECEIVE";
6
+ })(DropdownView || (DropdownView = {}));
7
+ const useDropdownStore = create((set, get) => ({
8
+ view: DropdownView.ROOT,
9
+ setView: (view) => set({ view }),
10
+ isNestedView: () => get().view !== DropdownView.ROOT,
11
+ }));
12
+ export default useDropdownStore;
13
+ //# sourceMappingURL=dropdownStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdownStore.js","sourceRoot":"","sources":["../../../src/stores/dropdownStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhC,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,mCAAmB,CAAA;AACrB,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AAQD,MAAM,gBAAgB,GAAG,MAAM,CAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,YAAY,CAAC,IAAI;IACvB,OAAO,EAAE,CAAC,IAAkB,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IAC9C,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,KAAK,YAAY,CAAC,IAAI;CACrD,CAAC,CAAC,CAAA;AAEH,eAAe,gBAAgB,CAAA"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Trims the address to the first 5 and last 5 characters.
3
+ * @param address The address to trim.
4
+ * @returns The trimmed address.
5
+ */
6
+ export declare function trimAddress(address: string): string;
7
+ /**
8
+ * Get the URL of the block explorer page for an address.
9
+ * @param address - The address to link to.
10
+ * @param chainType - The chain type of the address.
11
+ * @param isTestnet - Whether the address is on testnet.
12
+ * @returns The URL of the block explorer page for the address.
13
+ */
14
+ export declare function getAddressExplorerUrl(address: string, chainType: "bitcoin" | "evm" | "mezo", isTestnet: boolean): string;
15
+ //# sourceMappingURL=address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../src/utils/address.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMnD;AAcD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,EACrC,SAAS,EAAE,OAAO,UASnB"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Trims the address to the first 5 and last 5 characters.
3
+ * @param address The address to trim.
4
+ * @returns The trimmed address.
5
+ */
6
+ export function trimAddress(address) {
7
+ if (address.length < 11)
8
+ return address;
9
+ const trimmedAddress = `${address.slice(0, 5)}...${address.slice(-5)}`;
10
+ return trimmedAddress;
11
+ }
12
+ const MAINNET_EXPLORER_URLS = {
13
+ bitcoin: "https://mempool.space",
14
+ evm: "https://etherscan.io",
15
+ mezo: "https://explorer.mezo.org",
16
+ };
17
+ const TESTNET_EXPLORER_URLS = {
18
+ bitcoin: "https://mempool.space/testnet",
19
+ evm: "https://sepolia.etherscan.io",
20
+ mezo: "https://explorer.test.mezo.org",
21
+ };
22
+ /**
23
+ * Get the URL of the block explorer page for an address.
24
+ * @param address - The address to link to.
25
+ * @param chainType - The chain type of the address.
26
+ * @param isTestnet - Whether the address is on testnet.
27
+ * @returns The URL of the block explorer page for the address.
28
+ */
29
+ export function getAddressExplorerUrl(address, chainType, isTestnet) {
30
+ const EXPLORER_URLS = isTestnet
31
+ ? TESTNET_EXPLORER_URLS
32
+ : MAINNET_EXPLORER_URLS;
33
+ const baseUrl = EXPLORER_URLS[chainType];
34
+ const endpoint = `address/${address}`;
35
+ return `${baseUrl}/${endpoint}`;
36
+ }
37
+ //# sourceMappingURL=address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src/utils/address.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,IAAI,OAAO,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,OAAO,CAAA;IAEvC,MAAM,cAAc,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAEtE,OAAO,cAAc,CAAA;AACvB,CAAC;AAED,MAAM,qBAAqB,GAA+C;IACxE,OAAO,EAAE,uBAAuB;IAChC,GAAG,EAAE,sBAAsB;IAC3B,IAAI,EAAE,2BAA2B;CAClC,CAAA;AAED,MAAM,qBAAqB,GAA+C;IACxE,OAAO,EAAE,+BAA+B;IACxC,GAAG,EAAE,8BAA8B;IACnC,IAAI,EAAE,gCAAgC;CACvC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAe,EACf,SAAqC,EACrC,SAAkB;IAElB,MAAM,aAAa,GAAG,SAAS;QAC7B,CAAC,CAAC,qBAAqB;QACvB,CAAC,CAAC,qBAAqB,CAAA;IACzB,MAAM,OAAO,GAAG,aAAa,CAAC,SAAS,CAAC,CAAA;IACxC,MAAM,QAAQ,GAAG,WAAW,OAAO,EAAE,CAAA;IAErC,OAAO,GAAG,OAAO,IAAI,QAAQ,EAAE,CAAA;AACjC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=address.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.test.d.ts","sourceRoot":"","sources":["../../../src/utils/address.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ import { getAddressExplorerUrl, trimAddress } from "./address";
2
+ describe("trimAddress", () => {
3
+ it("returns full address if length is less than 11", () => {
4
+ expect(trimAddress("0x12345")).toBe("0x12345");
5
+ });
6
+ it("returns trimmed address if length is 11 or more", () => {
7
+ const input = "0x123456789abcdef";
8
+ const expected = "0x123...bcdef";
9
+ expect(trimAddress(input)).toBe(expected);
10
+ });
11
+ });
12
+ describe("getAddressExplorerUrl", () => {
13
+ const btcAddress = "bc1qxyz123";
14
+ const evmAddress = "0x1234567890abcdef";
15
+ it("returns correct mainnet Bitcoin explorer URL", () => {
16
+ const url = getAddressExplorerUrl(btcAddress, "bitcoin", false);
17
+ expect(url).toBe(`https://mempool.space/address/${btcAddress}`);
18
+ });
19
+ it("returns correct testnet Bitcoin explorer URL", () => {
20
+ const url = getAddressExplorerUrl(btcAddress, "bitcoin", true);
21
+ expect(url).toBe(`https://mempool.space/testnet/address/${btcAddress}`);
22
+ });
23
+ it("returns correct mainnet EVM explorer URL", () => {
24
+ const url = getAddressExplorerUrl(evmAddress, "evm", false);
25
+ expect(url).toBe(`https://etherscan.io/address/${evmAddress}`);
26
+ });
27
+ it("returns correct testnet EVM explorer URL", () => {
28
+ const url = getAddressExplorerUrl(evmAddress, "evm", true);
29
+ expect(url).toBe(`https://sepolia.etherscan.io/address/${evmAddress}`);
30
+ });
31
+ it("returns correct mainnet Mezo explorer URL", () => {
32
+ const url = getAddressExplorerUrl(evmAddress, "mezo", false);
33
+ expect(url).toBe(`https://explorer.mezo.org/address/${evmAddress}`);
34
+ });
35
+ it("returns correct testnet Mezo explorer URL", () => {
36
+ const url = getAddressExplorerUrl(evmAddress, "mezo", true);
37
+ expect(url).toBe(`https://explorer.test.mezo.org/address/${evmAddress}`);
38
+ });
39
+ });
40
+ //# sourceMappingURL=address.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.test.js","sourceRoot":"","sources":["../../../src/utils/address.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE9D,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAChD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,KAAK,GAAG,mBAAmB,CAAA;QACjC,MAAM,QAAQ,GAAG,eAAe,CAAA;QAChC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC3C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,MAAM,UAAU,GAAG,YAAY,CAAA;IAC/B,MAAM,UAAU,GAAG,oBAAoB,CAAA;IAEvC,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,GAAG,GAAG,qBAAqB,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC,CAAA;QAC/D,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,iCAAiC,UAAU,EAAE,CAAC,CAAA;IACjE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,GAAG,GAAG,qBAAqB,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;QAC9D,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,yCAAyC,UAAU,EAAE,CAAC,CAAA;IACzE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,GAAG,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;QAC3D,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,gCAAgC,UAAU,EAAE,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,GAAG,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;QAC1D,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,wCAAwC,UAAU,EAAE,CAAC,CAAA;IACxE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,GAAG,GAAG,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;QAC5D,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,qCAAqC,UAAU,EAAE,CAAC,CAAA;IACrE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,GAAG,GAAG,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QAC3D,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,0CAA0C,UAAU,EAAE,CAAC,CAAA;IAC1E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,44 @@
1
+ import { IconProps } from "@mezo-org/mezo-clay";
2
+ import { FC } from "react";
3
+ import { MezoChainToken } from "../lib/contracts";
4
+ export type CryptoAssetKey = MezoChainToken | "BTC" | "ETH";
5
+ export type CryptoAsset = {
6
+ name: string;
7
+ symbol: string;
8
+ icon: FC<IconProps>;
9
+ decimals: number;
10
+ };
11
+ /**
12
+ * Gets details of given crypto asset
13
+ * @param key The key of crypto asset
14
+ * @returns The crypto asset details
15
+ */
16
+ export declare function getCryptoAsset(key: CryptoAssetKey): CryptoAsset;
17
+ /**
18
+ * Checks if given crypto asset is Bitcoin-like
19
+ * @param key The key of crypto asset
20
+ * @returns True if crypto asset is Bitcoin-like
21
+ */
22
+ export declare function isBitcoinLikeCryptoAsset(key: CryptoAssetKey): boolean;
23
+ /**
24
+ * Checks if given crypto asset is USD-like
25
+ * @param key The key of crypto asset
26
+ * @returns True if crypto asset is USD-like
27
+ */
28
+ export declare function isUsdLikeCryptoAsset(key: CryptoAssetKey): boolean;
29
+ /**
30
+ * Formats crypto asset to balance details (balance in USD and decimals)
31
+ * @param type The type of crypto asset
32
+ * @param balance The balance of crypto asset
33
+ * @param usdConversionRate The USD conversion rate
34
+ * @returns The balance details
35
+ */
36
+ export declare function mapCryptoAssetToDetails(type: CryptoAssetKey, balance: bigint, usdConversionRate?: bigint, usdConversionRateDecimals?: number): {
37
+ type: CryptoAssetKey;
38
+ rawBalance: bigint;
39
+ formattedBalance: string;
40
+ usdBalance: number;
41
+ formattedUsdBalance: string;
42
+ };
43
+ export type DetailedCryptoAsset = ReturnType<typeof mapCryptoAssetToDetails>;
44
+ //# sourceMappingURL=cryptoAssets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cryptoAssets.d.ts","sourceRoot":"","sources":["../../../src/utils/cryptoAssets.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAGV,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAIjD,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,KAAK,GAAG,KAAK,CAAA;AAE3D,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAqFD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,cAAc,eAEjD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,cAAc,WAE3D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,cAAc,WAEvD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,MAAM,EACf,iBAAiB,CAAC,EAAE,MAAM,EAC1B,yBAAyB,CAAC,EAAE,MAAM;;;;;;EA4BnC;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
@@ -0,0 +1,132 @@
1
+ import { BitcoinCircle, EthCircle, MUsdCircle02, Cryptocurrency04, } from "@mezo-org/mezo-clay";
2
+ import { formatUsd } from "./currency";
3
+ import { fromFixedPointToString, fromFixedPoint } from "./numbers";
4
+ // TODO: Add actual icons for the assets
5
+ const CRYPTO_ASSETS = {
6
+ BTC: {
7
+ name: "Bitcoin",
8
+ symbol: "BTC",
9
+ icon: BitcoinCircle,
10
+ decimals: 18,
11
+ },
12
+ ETH: {
13
+ name: "Ethereum",
14
+ symbol: "ETH",
15
+ icon: EthCircle,
16
+ decimals: 18,
17
+ },
18
+ MUSD: {
19
+ name: "MUSD",
20
+ symbol: "MUSD",
21
+ icon: MUsdCircle02,
22
+ decimals: 18,
23
+ },
24
+ mDAI: {
25
+ name: "mDAI",
26
+ symbol: "mDAI",
27
+ icon: Cryptocurrency04,
28
+ decimals: 18,
29
+ },
30
+ mFBTC: {
31
+ name: "mFBTC",
32
+ symbol: "mFBTC",
33
+ icon: BitcoinCircle,
34
+ decimals: 8,
35
+ },
36
+ mcbBTC: {
37
+ name: "mcbBTC",
38
+ symbol: "mcbBTC",
39
+ icon: BitcoinCircle,
40
+ decimals: 8,
41
+ },
42
+ mSolvBTC: {
43
+ name: "mSolvBTC",
44
+ symbol: "mSolvBTC",
45
+ icon: BitcoinCircle,
46
+ decimals: 18,
47
+ },
48
+ mswBTC: {
49
+ name: "mswBTC",
50
+ symbol: "mswBTC",
51
+ icon: BitcoinCircle,
52
+ decimals: 8,
53
+ },
54
+ mT: {
55
+ name: "mT",
56
+ symbol: "mT",
57
+ icon: Cryptocurrency04,
58
+ decimals: 18,
59
+ },
60
+ mUSDC: {
61
+ name: "mUSDC",
62
+ symbol: "mUSDC",
63
+ icon: Cryptocurrency04,
64
+ decimals: 6,
65
+ },
66
+ mUSDe: {
67
+ name: "mUSDe",
68
+ symbol: "mUSDe",
69
+ icon: Cryptocurrency04,
70
+ decimals: 18,
71
+ },
72
+ mUSDT: {
73
+ name: "mUSDT",
74
+ symbol: "mUSDT",
75
+ icon: Cryptocurrency04,
76
+ decimals: 6,
77
+ },
78
+ mxSolvBTC: {
79
+ name: "mxSolvBTC",
80
+ symbol: "mxSolvBTC",
81
+ icon: BitcoinCircle,
82
+ decimals: 18,
83
+ },
84
+ };
85
+ /**
86
+ * Gets details of given crypto asset
87
+ * @param key The key of crypto asset
88
+ * @returns The crypto asset details
89
+ */
90
+ export function getCryptoAsset(key) {
91
+ return CRYPTO_ASSETS[key];
92
+ }
93
+ /**
94
+ * Checks if given crypto asset is Bitcoin-like
95
+ * @param key The key of crypto asset
96
+ * @returns True if crypto asset is Bitcoin-like
97
+ */
98
+ export function isBitcoinLikeCryptoAsset(key) {
99
+ return /(btc)/i.test(key);
100
+ }
101
+ /**
102
+ * Checks if given crypto asset is USD-like
103
+ * @param key The key of crypto asset
104
+ * @returns True if crypto asset is USD-like
105
+ */
106
+ export function isUsdLikeCryptoAsset(key) {
107
+ return /(usd|dai)/i.test(key);
108
+ }
109
+ /**
110
+ * Formats crypto asset to balance details (balance in USD and decimals)
111
+ * @param type The type of crypto asset
112
+ * @param balance The balance of crypto asset
113
+ * @param usdConversionRate The USD conversion rate
114
+ * @returns The balance details
115
+ */
116
+ export function mapCryptoAssetToDetails(type, balance, usdConversionRate, usdConversionRateDecimals) {
117
+ const { decimals } = getCryptoAsset(type);
118
+ const formattedBalance = fromFixedPointToString(balance, decimals, isUsdLikeCryptoAsset(type) ? 2 : 4);
119
+ let usdBalance = fromFixedPoint(balance, decimals);
120
+ if (usdConversionRate && usdConversionRateDecimals) {
121
+ usdBalance = fromFixedPoint((usdConversionRate * balance) / 10n ** BigInt(decimals), usdConversionRateDecimals);
122
+ }
123
+ const formattedUsdBalance = formatUsd(usdBalance);
124
+ return {
125
+ type,
126
+ rawBalance: balance,
127
+ formattedBalance,
128
+ usdBalance,
129
+ formattedUsdBalance,
130
+ };
131
+ }
132
+ //# sourceMappingURL=cryptoAssets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cryptoAssets.js","sourceRoot":"","sources":["../../../src/utils/cryptoAssets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EAET,YAAY,EACZ,gBAAgB,GACjB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAWlE,wCAAwC;AAExC,MAAM,aAAa,GAAwC;IACzD,GAAG,EAAE;QACH,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,EAAE;KACb;IACD,GAAG,EAAE;QACH,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,EAAE;KACb;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,MAAM;QACd,IAA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"","sources":["../../../src/utils/cryptoAssets.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,67 @@
1
+ import { BitcoinCircle, EthCircle, MUsdCircle02 } from "@mezo-org/mezo-clay";
2
+ import { getCryptoAsset, isBitcoinLikeCryptoAsset, isUsdLikeCryptoAsset, } from "./cryptoAssets";
3
+ // FIXME: Test fails if run in full suite (pnpm test) but works when run in isolation (pnpm test cryptoAssets)
4
+ describe("getCryptoAsset", () => {
5
+ it("returns the correct asset for 'BTC (mBTC)'", () => {
6
+ const asset = getCryptoAsset("BTC");
7
+ expect(asset.name).toBe("Bitcoin");
8
+ expect(asset.symbol).toBe("BTC");
9
+ expect(asset.decimals).toBe(18);
10
+ expect(asset.icon).toBe(BitcoinCircle);
11
+ });
12
+ it("returns the correct asset for 'ETH'", () => {
13
+ const asset = getCryptoAsset("ETH");
14
+ expect(asset.name).toBe("Ethereum");
15
+ expect(asset.symbol).toBe("ETH");
16
+ expect(asset.decimals).toBe(18);
17
+ expect(asset.icon).toBe(EthCircle);
18
+ });
19
+ it("returns the correct asset for 'MUSD'", () => {
20
+ const asset = getCryptoAsset("MUSD");
21
+ expect(asset.name).toBe("MUSD");
22
+ expect(asset.symbol).toBe("MUSD");
23
+ expect(asset.decimals).toBe(18);
24
+ expect(asset.icon).toBe(MUsdCircle02);
25
+ });
26
+ });
27
+ describe("isBitcoinLikeCryptoAsset", () => {
28
+ const cases = [
29
+ { input: "mcbBTC", expected: true },
30
+ { input: "mDAI", expected: false },
31
+ { input: "mFBTC", expected: true },
32
+ { input: "mSolvBTC", expected: true },
33
+ { input: "mswBTC", expected: true },
34
+ { input: "mT", expected: false },
35
+ { input: "mUSDC", expected: false },
36
+ { input: "mUSDe", expected: false },
37
+ { input: "mUSDT", expected: false },
38
+ { input: "mxSolvBTC", expected: true },
39
+ { input: "MUSD", expected: false },
40
+ ];
41
+ cases.forEach(({ input, expected }) => {
42
+ it(`returns ${expected} for ${input}`, () => {
43
+ expect(isBitcoinLikeCryptoAsset(input)).toBe(expected);
44
+ });
45
+ });
46
+ });
47
+ describe("isUsdLikeCryptoAsset", () => {
48
+ const cases = [
49
+ { input: "mcbBTC", expected: false },
50
+ { input: "mDAI", expected: true },
51
+ { input: "mFBTC", expected: false },
52
+ { input: "mSolvBTC", expected: false },
53
+ { input: "mswBTC", expected: false },
54
+ { input: "mT", expected: false },
55
+ { input: "mUSDC", expected: true },
56
+ { input: "mUSDe", expected: true },
57
+ { input: "mUSDT", expected: true },
58
+ { input: "mxSolvBTC", expected: false },
59
+ { input: "MUSD", expected: true },
60
+ ];
61
+ cases.forEach(({ input, expected }) => {
62
+ it(`returns ${expected} for ${input}`, () => {
63
+ expect(isUsdLikeCryptoAsset(input)).toBe(expected);
64
+ });
65
+ });
66
+ });
67
+ //# sourceMappingURL=cryptoAssets.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cryptoAssets.test.js","sourceRoot":"","sources":["../../../src/utils/cryptoAssets.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAEL,cAAc,EACd,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,gBAAgB,CAAA;AAEvB,8GAA8G;AAE9G,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;QACnC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAClC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAChC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC/B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CA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,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE;QAClC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE;QAClC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE;QAClC,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;QACvC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;KAClC,CAAA;IAED,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;QACpC,EAAE,CAAC,WAAW,QAAQ,QAAQ,KAAK,EAAE,EAAE,GAAG,EAAE;YAC1C,MAAM,CAAC,oBAAoB,CAAC,KAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACtE,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Formats a number as a currency
3
+ * @param value The value to format
4
+ * @param options The options to pass to the formatter
5
+ * @returns The formatted currency
6
+ */
7
+ export declare function formatCurrency(value: number, options?: Omit<Intl.NumberFormatOptions, "style">): string;
8
+ /**
9
+ * Formats a number as a USD currency
10
+ * @param value The value to format
11
+ * @returns The formatted currency
12
+ */
13
+ export declare function formatUsd(value: number): string;
14
+ //# sourceMappingURL=currency.d.ts.map
@@ -0,0 +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"}