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

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 +22 -48
  5. package/dist/src/api/auth.js.map +1 -1
  6. package/dist/src/api/client.d.ts +27 -0
  7. package/dist/src/api/client.d.ts.map +1 -0
  8. package/dist/src/api/client.js +61 -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 +26 -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 +89 -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 +96 -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,96 @@
1
+ import { useQuery } from "@tanstack/react-query"
2
+ import { useReadContract } from "wagmi"
3
+ import { ONE_SECOND_MS } from "../utils/time"
4
+ import { QUERY_KEYS } from "./constants"
5
+ import { usePortalApiClient } from "./usePortalApiClient"
6
+ import { priceOracleContract } from "../lib/contracts"
7
+ import { fromFloatToBigInt } from "../utils/numbers"
8
+ import { CHAIN_ID } from "../constants"
9
+ import { usePassportContext } from "./usePassportContext"
10
+
11
+ const BTC_TARGET_DIGITS = 18
12
+ const T_TARGET_DIGITS = 10
13
+ // If the oracle has not been updated in at least 60 seconds, it is stale.
14
+ const MAX_PRICE_DELAY = 60 * ONE_SECOND_MS
15
+
16
+ /**
17
+ * Scales the price by the number of digits.
18
+ * @dev Oracles returns prices with variable number of digits. This function
19
+ * scales the price to a fixed number of digits ensuring consistency.
20
+ * @param price - The price to scale.
21
+ * @param priceDigits - The number of digits in the price.
22
+ * @returns The scaled price.
23
+ */
24
+ function scalePriceByDigits(price: bigint, priceDigits: number): bigint {
25
+ if (priceDigits > BTC_TARGET_DIGITS) {
26
+ return price / 10n ** BigInt(priceDigits - BTC_TARGET_DIGITS)
27
+ }
28
+ if (priceDigits < BTC_TARGET_DIGITS) {
29
+ return price * 10n ** BigInt(BTC_TARGET_DIGITS - priceDigits)
30
+ }
31
+ return price
32
+ }
33
+
34
+ /**
35
+ * Hook to fetch assets conversion rates.
36
+ * @see https://github.com/mezo-org/musd/blob/f0b2030315f0d8b0fc11a9fc778856fe4673051f/solidity/contracts/PriceFeed.sol
37
+ * @returns {}.data.{}.price - The latest asset price.
38
+ * @returns {}.data.{}.digits - The latest asset price digits.
39
+ * @returns {}.isPending - Whether the request is pending.
40
+ * @returns {}.isError - Whether there was an error fetching the price.
41
+ */
42
+ export function useAssetsConversionRates() {
43
+ const portalApiClient = usePortalApiClient()
44
+ const { environment = "mainnet" } = usePassportContext()
45
+
46
+ const btcPrice = useReadContract({
47
+ ...priceOracleContract,
48
+ functionName: "latestRoundData",
49
+ query: {
50
+ refetchInterval: ({ state }) => {
51
+ if (!state.data) return MAX_PRICE_DELAY
52
+
53
+ const [, , , updatedAt] = state.data ?? []
54
+ if (!updatedAt) return MAX_PRICE_DELAY
55
+
56
+ const age = Date.now() - Number(updatedAt) * 1000
57
+
58
+ return age > MAX_PRICE_DELAY
59
+ ? // If the data is stale, we want to refetch as soon as possible, but
60
+ // not faster than once per second, to avoid excessive requests.
61
+ // Math.max ensures the interval is at least 1 second.
62
+ Math.max(ONE_SECOND_MS, MAX_PRICE_DELAY - age)
63
+ : MAX_PRICE_DELAY - age
64
+ },
65
+ select: (data) => {
66
+ const [, answer] = data
67
+ return scalePriceByDigits(answer, BTC_TARGET_DIGITS)
68
+ },
69
+ },
70
+ chainId: CHAIN_ID[environment],
71
+ })
72
+
73
+ const tPrice = useQuery({
74
+ queryKey: [QUERY_KEYS.ASSETS_USD_CONVERSION],
75
+ queryFn: () => portalApiClient.getPortalStatistics(),
76
+ select: (data) =>
77
+ fromFloatToBigInt(data.currentUsdPerTToken, T_TARGET_DIGITS),
78
+ refetchInterval: MAX_PRICE_DELAY,
79
+ throwOnError: true,
80
+ })
81
+
82
+ return {
83
+ data: {
84
+ t: {
85
+ price: tPrice.data ?? 0n,
86
+ decimals: T_TARGET_DIGITS,
87
+ },
88
+ btc: {
89
+ price: btcPrice.data ?? 0n,
90
+ decimals: BTC_TARGET_DIGITS,
91
+ },
92
+ },
93
+ isPending: tPrice.isPending || btcPrice.isPending,
94
+ isError: tPrice.isError || btcPrice.isError,
95
+ }
96
+ }
@@ -1,43 +1,45 @@
1
- import { useAccount, useSignMessage } from "wagmi"
2
- import { useBitcoinAccount } from "@mezo-org/orangekit"
3
- import { useMutation } from "@tanstack/react-query"
4
- import { useMemo } from "react"
1
+ import { useSignMessage } from "wagmi"
2
+ import { MutationOptions, useMutation } from "@tanstack/react-query"
5
3
  import { useCreateAccount } from "./useCreateAccount"
6
4
  import { useCreateSession } from "./useCreateSession"
7
5
  import { useEnsureNoSessionAndFetchNonce } from "./useEnsureNoSessionAndFetchNonce"
8
6
  import { createSignInWithWalletMessage } from "../utils/siww"
9
7
  import { useGetAccountByAddress } from "./useGetAccountByAddress"
8
+ import type { Session } from "../api"
9
+ import useWalletAccount from "./useWalletAccount"
10
10
 
11
- function useAuthenticateWithWallet({
12
- signUp = false,
13
- }: { signUp?: boolean } = {}) {
14
- const { chainId, address, connector } = useAccount()
15
- const { btcAddress } = useBitcoinAccount()
11
+ function useAuthenticateWithWallet(
12
+ shouldCreateAccount = false,
13
+ mutationOptions: Omit<
14
+ MutationOptions<Session>,
15
+ "mutationFn" | "mutationKey"
16
+ > = {},
17
+ ) {
18
+ const { walletAddress, chainId, connector, networkFamily } =
19
+ useWalletAccount()
16
20
  const { ensureNoSessionAndFetchNonce } = useEnsureNoSessionAndFetchNonce()
17
21
  const { createSessionAsync } = useCreateSession()
18
22
  const { createAccountAsync } = useCreateAccount()
19
23
  const { signMessageAsync } = useSignMessage()
20
- const walletAddress = useMemo(
21
- () => (connector?.type === "orangekit" ? btcAddress : address),
22
- [btcAddress, address, connector],
23
- )
24
24
 
25
25
  const { refetch: getAccountByAddress } = useGetAccountByAddress(
26
26
  walletAddress,
27
- { enabled: false, retry: false },
27
+ {
28
+ enabled: false,
29
+ retry: false,
30
+ },
28
31
  )
29
32
 
30
33
  const { mutate, mutateAsync, ...signInMutationRestParameters } = useMutation({
31
34
  mutationFn: async () => {
32
- if (!address) {
35
+ if (!walletAddress) {
33
36
  throw new Error("Sign in error: Wallet not connected!")
34
37
  }
35
38
 
36
39
  const nonce = await ensureNoSessionAndFetchNonce()
37
40
 
38
- const networkFamily = btcAddress ? "bitcoin" : "evm"
39
41
  const messageResult = createSignInWithWalletMessage(
40
- btcAddress ? btcAddress! : address!,
42
+ walletAddress,
41
43
  nonce,
42
44
  networkFamily,
43
45
  chainId,
@@ -47,10 +49,23 @@ function useAuthenticateWithWallet({
47
49
  connector,
48
50
  })
49
51
 
50
- if (signUp) {
51
- const getAcountByAddressResult = await getAccountByAddress()
52
+ if (shouldCreateAccount) {
53
+ const getAccountByAddressResult = await getAccountByAddress()
54
+
55
+ if (getAccountByAddressResult.data) {
56
+ throw new Error(
57
+ "Wallet authentication failed: Account creation failed. Account already exists.",
58
+ )
59
+ }
52
60
 
53
- if (!getAcountByAddressResult.data) {
61
+ if (getAccountByAddressResult.error) {
62
+ throw new Error(
63
+ `Wallet authentication failed: Account creation failed. Could not verify if account already exists: ${getAccountByAddressResult.error}`,
64
+ )
65
+ }
66
+
67
+ // Fetch was successful, but no account was found
68
+ try {
54
69
  const createAccountResult = await createAccountAsync({
55
70
  type: "wallet",
56
71
  message: messageResult,
@@ -58,17 +73,23 @@ function useAuthenticateWithWallet({
58
73
  })
59
74
 
60
75
  if (!createAccountResult) {
61
- throw new Error("Sign in error: Failed to create new account")
76
+ throw new Error("Failed to create new account")
62
77
  }
78
+ } catch (error) {
79
+ throw new Error(
80
+ `Wallet authentication failed: Account creation failed: ${error}`,
81
+ )
63
82
  }
64
83
  }
65
84
 
66
- return createSessionAsync({
85
+ return (await createSessionAsync({
67
86
  type: "wallet",
68
87
  message: messageResult,
69
88
  signature: signatureResult,
70
- })
89
+ })) as Session
90
+ // ^ By passing type: "wallet" we know for sure the return type is Session
71
91
  },
92
+ ...mutationOptions,
72
93
  })
73
94
 
74
95
  return {
@@ -0,0 +1,143 @@
1
+ import { useAccount, useReadContract } from "wagmi"
2
+ import { useCallback, useMemo } from "react"
3
+ import { useQueryClient } from "@tanstack/react-query"
4
+ import { ONE_MINUTE_MS } from "../utils/time"
5
+ import {
6
+ mainnetBorrowContracts,
7
+ testnetBorrowContracts,
8
+ } from "../lib/contracts"
9
+ import { usePassportContext } from "./usePassportContext"
10
+ import { CHAIN_ID } from "../constants"
11
+
12
+ // Wagmi handles typesafety with ABI const assertions. TypeScript doesn't
13
+ // support importing JSON as const yet so types cannot be inferred from the
14
+ // imported contract. As a workaround there is minimal ABI definition that can
15
+ // be asserted types from.
16
+ // Ref: https://wagmi.sh/core/typescript#const-assert-abis-typed-data
17
+
18
+ const TROVE_MANAGER_ABI = [
19
+ {
20
+ inputs: [
21
+ {
22
+ internalType: "address",
23
+ name: "_borrower",
24
+ type: "address",
25
+ },
26
+ ],
27
+ name: "getEntireDebtAndColl",
28
+ outputs: [
29
+ {
30
+ internalType: "uint256",
31
+ name: "coll",
32
+ type: "uint256",
33
+ },
34
+ {
35
+ internalType: "uint256",
36
+ name: "principal",
37
+ type: "uint256",
38
+ },
39
+ {
40
+ internalType: "uint256",
41
+ name: "interest",
42
+ type: "uint256",
43
+ },
44
+ {
45
+ internalType: "uint256",
46
+ name: "pendingCollateral",
47
+ type: "uint256",
48
+ },
49
+ {
50
+ internalType: "uint256",
51
+ name: "pendingPrincipal",
52
+ type: "uint256",
53
+ },
54
+ {
55
+ internalType: "uint256",
56
+ name: "pendingInterest",
57
+ type: "uint256",
58
+ },
59
+ ],
60
+ stateMutability: "view",
61
+ type: "function",
62
+ },
63
+ ] as const
64
+
65
+ /**
66
+ * Query hook for getting borrow data. Returns collateral and trove debt for the
67
+ * connected account, based on it's evm address.
68
+ * @param queryOptions Query options passed to the underlying `useQuery` hook.
69
+ */
70
+ export function useBorrowData(queryOptions = {}) {
71
+ const { environment = "mainnet" } = usePassportContext()
72
+ const { address } = useAccount()
73
+
74
+ const contractAddress = useMemo(() => {
75
+ if (environment === "mainnet") {
76
+ return mainnetBorrowContracts.TroveManager.address
77
+ }
78
+ return testnetBorrowContracts.TroveManager.address
79
+ }, [environment])
80
+
81
+ return useReadContract({
82
+ abi: TROVE_MANAGER_ABI,
83
+ address: contractAddress,
84
+ functionName: "getEntireDebtAndColl",
85
+ args: [address || "0x"],
86
+ query: {
87
+ enabled: !!address,
88
+ staleTime: 5 * ONE_MINUTE_MS,
89
+ retry: 1,
90
+ select: (data) => {
91
+ if (!data) return undefined
92
+
93
+ const [collateral, principal, interest] = data
94
+ return {
95
+ collateral,
96
+ troveDebt: principal + interest,
97
+ }
98
+ },
99
+ ...queryOptions,
100
+ },
101
+ chainId: CHAIN_ID[environment],
102
+ })
103
+ }
104
+
105
+ /**
106
+ * Hook for for invalidating current user's borrow data. Can be used to
107
+ * invalidate borrow data manually, which forces the data to be re-fetched.
108
+ * @returns Function `invalidateBorrowData` for invalidating the borrow data
109
+ */
110
+ export function useInvalidateBorrowData() {
111
+ const queryClient = useQueryClient()
112
+
113
+ const { queryKey } = useBorrowData()
114
+
115
+ const invalidateBorrowDataHandler = useCallback(
116
+ () => queryClient.invalidateQueries({ queryKey }),
117
+ [queryClient, queryKey],
118
+ )
119
+
120
+ return {
121
+ invalidateBorrowData: invalidateBorrowDataHandler,
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Hook for for resetting current user's borrow data. Can be used to reset
127
+ * borrow data manually, which forces the data to be re-fetched.
128
+ * @returns Function `resetBorrowData` for resetting the borrow data
129
+ */
130
+ export function useResetBorrowData() {
131
+ const queryClient = useQueryClient()
132
+
133
+ const { queryKey } = useBorrowData()
134
+
135
+ const resetBorrowDataHandler = useCallback(
136
+ () => queryClient.resetQueries({ queryKey }),
137
+ [queryClient, queryKey],
138
+ )
139
+
140
+ return {
141
+ resetBorrowData: resetBorrowDataHandler,
142
+ }
143
+ }
@@ -1,21 +1,35 @@
1
- import { useQueryClient, useMutation } from "@tanstack/react-query"
1
+ import {
2
+ useQueryClient,
3
+ useMutation,
4
+ MutationOptions,
5
+ DefaultError,
6
+ } from "@tanstack/react-query"
2
7
  import { useAuthApiClient } from "./useAuthApiClient"
3
8
  import { QUERY_KEYS } from "./constants"
4
- import { CreateAccountRequest } from "../api/auth"
9
+ import type { CreateAccountRequest, CreateAccountResponse } from "../api"
5
10
 
6
- export function useCreateAccount(useMutationOptions = {}) {
11
+ export function useCreateAccount(
12
+ mutationOptions: Omit<
13
+ MutationOptions<CreateAccountResponse, DefaultError, CreateAccountRequest>,
14
+ "mutationFn" | "mutationKey"
15
+ > = {},
16
+ ) {
7
17
  const queryClient = useQueryClient()
8
18
  const authApiClient = useAuthApiClient()
9
19
 
20
+ const { onSuccess: customOnSuccess, ...restMutationOptions } = mutationOptions
21
+
10
22
  const { mutate, mutateAsync, ...rest } = useMutation({
11
23
  mutationFn: (createAccountRequest: CreateAccountRequest) =>
12
24
  authApiClient.createAccount(createAccountRequest),
13
- onSuccess: () => {
25
+ onSuccess: (data, variables, context) => {
14
26
  queryClient.resetQueries({
15
27
  queryKey: [QUERY_KEYS.ACCOUNT],
16
28
  })
29
+
30
+ if (customOnSuccess) customOnSuccess(data, variables, context)
17
31
  },
18
- ...useMutationOptions,
32
+ ...restMutationOptions,
19
33
  })
20
34
 
21
35
  return { createAccount: mutate, createAccountAsync: mutateAsync, ...rest }
@@ -1,30 +1,43 @@
1
- import { useQueryClient, useMutation } from "@tanstack/react-query"
1
+ import {
2
+ useQueryClient,
3
+ useMutation,
4
+ MutationOptions,
5
+ DefaultError,
6
+ } from "@tanstack/react-query"
2
7
  import { useAuthApiClient } from "./useAuthApiClient"
3
- import { CreateSessionRequest } from "../api/auth"
8
+ import type { CreateSessionRequest, CreateSessionResponse } from "../api"
4
9
  import { QUERY_KEYS } from "./constants"
5
10
 
6
11
  /**
7
12
  * This hook is not exposed for external consumers. For creating session they
8
13
  * should use `useSignIn` hook related to the authentication method.
9
14
  */
10
- export function useCreateSession(useMutationOptions = {}) {
15
+ export function useCreateSession(
16
+ mutationOptions: Omit<
17
+ MutationOptions<CreateSessionResponse, DefaultError, CreateSessionRequest>,
18
+ "mutationFn" | "mutationKey"
19
+ > = {},
20
+ ) {
11
21
  const queryClient = useQueryClient()
12
22
  const authApiClient = useAuthApiClient()
13
23
 
24
+ const { onSuccess: customOnSuccess, ...restMutationOptions } = mutationOptions
25
+
14
26
  const { mutate, mutateAsync, ...rest } = useMutation({
15
27
  mutationFn: (createSessionRequest: CreateSessionRequest) =>
16
28
  authApiClient.createSession(createSessionRequest),
17
- onSuccess: () => {
18
- // Since `getSession` query also has code in it's query keys we can't
19
- // set query data for a specific query, because we don't know if the
20
- // code was used or not. Because of that we just reset all getSession
21
- // queries
29
+ onSuccess: (data, variables, context) => {
30
+ // Since `getSession` query also has code in its query keys we can't set
31
+ // query data for a specific query, because we don't know if the code was
32
+ // used or not. Because of that we just reset all getSession queries
22
33
  queryClient.resetQueries({ queryKey: [QUERY_KEYS.SESSION] })
23
34
  queryClient.resetQueries({
24
35
  queryKey: [QUERY_KEYS.ACCOUNT, QUERY_KEYS.CURRENT],
25
36
  })
37
+
38
+ if (customOnSuccess) customOnSuccess(data, variables, context)
26
39
  },
27
- ...useMutationOptions,
40
+ ...restMutationOptions,
28
41
  })
29
42
 
30
43
  return { createSession: mutate, createSessionAsync: mutateAsync, ...rest }
@@ -0,0 +1,149 @@
1
+ import { useBalance } from "wagmi"
2
+ import { useGetCurrentAccount } from "."
3
+ import {
4
+ CryptoAssetKey,
5
+ isBitcoinLikeCryptoAsset,
6
+ mapCryptoAssetToDetails,
7
+ } from "../utils/cryptoAssets"
8
+ import { fromFixedPoint } from "../utils/numbers"
9
+ import { useAssetsConversionRates } from "./useAssetsConversionRates"
10
+ import useWalletAccount from "./useWalletAccount"
11
+ import { useTokensBalances } from "./useTokensBalances"
12
+ import { useBorrowData } from "./useBorrowData"
13
+ import { CHAIN_ID } from "../constants"
14
+ import { usePassportContext } from "./usePassportContext"
15
+ import { useWatchTransferEventsForAllTokens } from "./useWatchTransferEvents"
16
+
17
+ export type DropdownCryptoAsset<T = CryptoAssetKey> = {
18
+ type: T
19
+ balance: bigint
20
+ }
21
+
22
+ const DEFAULT_ASSET_DATA = {
23
+ rawBalance: 0n,
24
+ formattedBalance: "0.0000",
25
+ usdBalance: 0,
26
+ formattedUsdBalance: "$0.00",
27
+ }
28
+
29
+ /**
30
+ * Aggregates dropdown data for Dropdown component.
31
+ * @param {accountDataRefetchInterval: number, nativeBalanceRefetchInterval: number }
32
+ * Object containing refetch intervals time (in milliseconds) for account data
33
+ * (like mats or mezo id) and for native balance. After that time the specific
34
+ * value should be marked as stale and re-fetched. Default value for both is
35
+ * 90000 (90 secs).
36
+ * @returns Dropdown data.
37
+ * @dev This hook is for internal use only.
38
+ */
39
+ export default function useDropdownData({
40
+ accountDataRefetchInterval = 90000,
41
+ nativeBalanceRefetchInterval = 90000,
42
+ }) {
43
+ const {
44
+ walletAddress,
45
+ accountAddress,
46
+ networkFamily: walletType,
47
+ } = useWalletAccount()
48
+ const { environment = "mainnet" } = usePassportContext()
49
+ const { data: btcBalance } = useBalance({
50
+ address: accountAddress,
51
+ chainId: CHAIN_ID[environment],
52
+ query: {
53
+ staleTime: nativeBalanceRefetchInterval,
54
+ refetchInterval: nativeBalanceRefetchInterval,
55
+ },
56
+ })
57
+ const { data: passportAccount } = useGetCurrentAccount({
58
+ staleTime: accountDataRefetchInterval,
59
+ refetchInterval: accountDataRefetchInterval,
60
+ enabled: !!accountAddress,
61
+ })
62
+ const { data: assetsConversionRates } = useAssetsConversionRates()
63
+ const { data: tokensBalances } = useTokensBalances()
64
+ const { data: debt } = useBorrowData()
65
+
66
+ useWatchTransferEventsForAllTokens()
67
+
68
+ const mezoId = passportAccount?.mezoId
69
+
70
+ const detailedAssets = [
71
+ ["BTC", btcBalance?.value ?? 0n],
72
+ ...Object.entries(tokensBalances ?? {}),
73
+ ].map((asset) => {
74
+ const [type, balance] = asset as [CryptoAssetKey, bigint]
75
+
76
+ let conversionRate: bigint | undefined
77
+ let conversionRateDecimals: number | undefined
78
+
79
+ if (isBitcoinLikeCryptoAsset(type)) {
80
+ conversionRate = assetsConversionRates.btc.price
81
+ conversionRateDecimals = assetsConversionRates.btc.decimals
82
+ }
83
+ if (type === "mT") {
84
+ conversionRate = assetsConversionRates.t.price
85
+ conversionRateDecimals = assetsConversionRates.t.decimals
86
+ }
87
+
88
+ return mapCryptoAssetToDetails(
89
+ type,
90
+ balance,
91
+ conversionRate,
92
+ conversionRateDecimals,
93
+ )
94
+ })
95
+
96
+ const btcData = detailedAssets.find(({ type }) => type === "BTC")!
97
+ const musdData = detailedAssets.find(({ type }) => type === "MUSD")!
98
+ const otherAssetsData = detailedAssets.filter(
99
+ ({ type }) => !["BTC", "MUSD"].includes(type),
100
+ )
101
+
102
+ const otherAssetsCount = otherAssetsData.filter(
103
+ (asset) => asset.rawBalance !== 0n,
104
+ ).length
105
+
106
+ const assets = {
107
+ btc: btcData || {
108
+ type: "BTC",
109
+ ...DEFAULT_ASSET_DATA,
110
+ },
111
+ musd: musdData || {
112
+ type: "mUSD",
113
+ ...DEFAULT_ASSET_DATA,
114
+ },
115
+ }
116
+
117
+ const otherAssetsUsdTotal = otherAssetsData.reduce(
118
+ (sum, { usdBalance }) => sum + usdBalance,
119
+ 0,
120
+ )
121
+
122
+ const usdTotalBalance = detailedAssets.reduce(
123
+ (sum, { usdBalance }) => sum + usdBalance,
124
+ 0,
125
+ )
126
+
127
+ const matsBalance = passportAccount?.mats.totalMats || 0
128
+
129
+ const usdCollateral = fromFixedPoint(
130
+ (debt?.collateral ?? 0n) * assetsConversionRates.btc.price,
131
+ 18,
132
+ )
133
+
134
+ const usdTroveDebt = fromFixedPoint(debt?.troveDebt ?? 0n, 18)
135
+
136
+ return {
137
+ mezoId,
138
+ matsBalance,
139
+ accountAddress,
140
+ walletAddress,
141
+ walletType,
142
+ usdTotalBalance,
143
+ usdTroveDebt,
144
+ usdCollateral,
145
+ assets,
146
+ otherAssetsCount,
147
+ otherAssetsUsdTotal,
148
+ }
149
+ }
@@ -2,12 +2,12 @@ import { useQuery, skipToken, UseBaseQueryOptions } from "@tanstack/react-query"
2
2
  import { useAuthApiClient } from "./useAuthApiClient"
3
3
  import { QUERY_KEYS } from "./constants"
4
4
  import { ONE_MINUTE_MS } from "../utils/time"
5
- import { GetAccountByMezoIdOrAddressResponse } from "../api/auth"
5
+ import type { GetAccountByMezoIdOrAddressResponse } from "../api"
6
6
 
7
7
  export function useGetAccountByAddress(
8
8
  address?: string,
9
9
  queryOptions: Omit<
10
- UseBaseQueryOptions<GetAccountByMezoIdOrAddressResponse>,
10
+ UseBaseQueryOptions<GetAccountByMezoIdOrAddressResponse | null>,
11
11
  "queryKey" | "queryFn"
12
12
  > = {},
13
13
  ) {
@@ -2,12 +2,12 @@ import { useQuery, skipToken, UseBaseQueryOptions } from "@tanstack/react-query"
2
2
  import { useAuthApiClient } from "./useAuthApiClient"
3
3
  import { QUERY_KEYS } from "./constants"
4
4
  import { ONE_MINUTE_MS } from "../utils/time"
5
- import { GetAccountByMezoIdOrAddressResponse } from "../api/auth"
5
+ import type { GetAccountByMezoIdOrAddressResponse } from "../api"
6
6
 
7
7
  export function useGetAccountByMezoId(
8
8
  mezoId?: string,
9
9
  queryOptions: Omit<
10
- UseBaseQueryOptions<GetAccountByMezoIdOrAddressResponse>,
10
+ UseBaseQueryOptions<GetAccountByMezoIdOrAddressResponse | null>,
11
11
  "queryKey" | "queryFn"
12
12
  > = {},
13
13
  ) {