@mezo-org/passport 0.16.0-dev.0 → 0.16.0-dev.2

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 (196) hide show
  1. package/dist/src/api/auth.d.ts +9 -0
  2. package/dist/src/api/auth.d.ts.map +1 -1
  3. package/dist/src/api/auth.js +7 -0
  4. package/dist/src/api/auth.js.map +1 -1
  5. package/dist/src/config.d.ts +3 -4
  6. package/dist/src/config.d.ts.map +1 -1
  7. package/dist/src/config.js +9 -13
  8. package/dist/src/config.js.map +1 -1
  9. package/dist/src/hooks/index.d.ts +2 -0
  10. package/dist/src/hooks/index.d.ts.map +1 -1
  11. package/dist/src/hooks/index.js +2 -0
  12. package/dist/src/hooks/index.js.map +1 -1
  13. package/dist/src/hooks/useAcceptDocuments.d.ts +18 -0
  14. package/dist/src/hooks/useAcceptDocuments.d.ts.map +1 -1
  15. package/dist/src/hooks/useAuthenticateWithWallet.d.ts +11 -11
  16. package/dist/src/hooks/useAuthenticateWithWallet.js +1 -1
  17. package/dist/src/hooks/useAuthenticateWithWallet.js.map +1 -1
  18. package/dist/src/hooks/useBorrowData.js +1 -1
  19. package/dist/src/hooks/useBorrowData.js.map +1 -1
  20. package/dist/src/hooks/useCollateralPrice.js +1 -1
  21. package/dist/src/hooks/useCollateralPrice.js.map +1 -1
  22. package/dist/src/hooks/useCreateAccount.d.ts +18 -0
  23. package/dist/src/hooks/useCreateAccount.d.ts.map +1 -1
  24. package/dist/src/hooks/useCreateAccount.js +1 -1
  25. package/dist/src/hooks/useCreateAccount.js.map +1 -1
  26. package/dist/src/hooks/useLinkAccount.js +1 -1
  27. package/dist/src/hooks/useLinkAccount.js.map +1 -1
  28. package/dist/src/hooks/useSignInWithWallet.d.ts +11 -11
  29. package/dist/src/hooks/useSignUpWithWallet.d.ts +11 -11
  30. package/dist/src/hooks/useTokensBalances.d.ts.map +1 -1
  31. package/dist/src/hooks/useTokensBalances.js +2 -10
  32. package/dist/src/hooks/useTokensBalances.js.map +1 -1
  33. package/dist/src/hooks/useUpdateMezoId.d.ts +18 -0
  34. package/dist/src/hooks/useUpdateMezoId.d.ts.map +1 -1
  35. package/dist/src/hooks/useUpdateUserProfile.d.ts +171 -0
  36. package/dist/src/hooks/useUpdateUserProfile.d.ts.map +1 -0
  37. package/dist/src/hooks/useUpdateUserProfile.js +19 -0
  38. package/dist/src/hooks/useUpdateUserProfile.js.map +1 -0
  39. package/dist/src/hooks/useWalletAccount.d.ts +3 -6
  40. package/dist/src/hooks/useWalletAccount.d.ts.map +1 -1
  41. package/dist/src/hooks/useWalletAccount.js +6 -4
  42. package/dist/src/hooks/useWalletAccount.js.map +1 -1
  43. package/dist/src/hooks/useWatchTransferEvents.d.ts.map +1 -1
  44. package/dist/src/hooks/useWatchTransferEvents.js +0 -1
  45. package/dist/src/hooks/useWatchTransferEvents.js.map +1 -1
  46. package/dist/src/index.d.ts +1 -2
  47. package/dist/src/index.d.ts.map +1 -1
  48. package/dist/src/index.js +1 -2
  49. package/dist/src/index.js.map +1 -1
  50. package/dist/src/lib/contracts/index.d.ts +1 -1
  51. package/dist/src/lib/contracts/index.d.ts.map +1 -1
  52. package/dist/src/lib/contracts/index.js +0 -3
  53. package/dist/src/lib/contracts/index.js.map +1 -1
  54. package/dist/src/stores/dropdownStore.d.ts +2 -1
  55. package/dist/src/stores/dropdownStore.d.ts.map +1 -1
  56. package/dist/src/stores/dropdownStore.js +1 -0
  57. package/dist/src/stores/dropdownStore.js.map +1 -1
  58. package/dist/src/utils/assets.d.ts +0 -15
  59. package/dist/src/utils/assets.d.ts.map +1 -1
  60. package/dist/src/utils/assets.js +0 -13
  61. package/dist/src/utils/assets.js.map +1 -1
  62. package/dist/src/utils/validation.d.ts +13 -0
  63. package/dist/src/utils/validation.d.ts.map +1 -0
  64. package/dist/src/utils/validation.js +34 -0
  65. package/dist/src/utils/validation.js.map +1 -0
  66. package/dist/src/utils/validation.test.d.ts +2 -0
  67. package/dist/src/utils/validation.test.d.ts.map +1 -0
  68. package/dist/src/utils/validation.test.js +63 -0
  69. package/dist/src/utils/validation.test.js.map +1 -0
  70. package/package.json +10 -9
  71. package/src/api/auth.ts +22 -0
  72. package/src/config.ts +16 -26
  73. package/src/hooks/index.ts +2 -0
  74. package/src/hooks/useAuthenticateWithWallet.ts +1 -1
  75. package/src/hooks/useBorrowData.ts +1 -1
  76. package/src/hooks/useCollateralPrice.ts +1 -1
  77. package/src/hooks/useCreateAccount.ts +1 -1
  78. package/src/hooks/useLinkAccount.ts +1 -1
  79. package/src/hooks/useTokensBalances.ts +1 -10
  80. package/src/hooks/useUpdateUserProfile.ts +34 -0
  81. package/src/hooks/useWalletAccount.ts +15 -10
  82. package/src/hooks/useWatchTransferEvents.ts +0 -1
  83. package/src/index.ts +0 -2
  84. package/src/lib/contracts/index.ts +0 -4
  85. package/src/stores/dropdownStore.ts +1 -0
  86. package/src/utils/assets.ts +0 -14
  87. package/src/utils/validation.test.ts +97 -0
  88. package/src/utils/validation.ts +35 -0
  89. package/dist/src/assets/DefaultAvatar.d.ts +0 -5
  90. package/dist/src/assets/DefaultAvatar.d.ts.map +0 -1
  91. package/dist/src/assets/DefaultAvatar.js +0 -21
  92. package/dist/src/assets/DefaultAvatar.js.map +0 -1
  93. package/dist/src/components/Dropdown/ConnectedTrigger.d.ts +0 -8
  94. package/dist/src/components/Dropdown/ConnectedTrigger.d.ts.map +0 -1
  95. package/dist/src/components/Dropdown/ConnectedTrigger.js +0 -39
  96. package/dist/src/components/Dropdown/ConnectedTrigger.js.map +0 -1
  97. package/dist/src/components/Dropdown/Content.d.ts +0 -8
  98. package/dist/src/components/Dropdown/Content.d.ts.map +0 -1
  99. package/dist/src/components/Dropdown/Content.js +0 -27
  100. package/dist/src/components/Dropdown/Content.js.map +0 -1
  101. package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts +0 -7
  102. package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts.map +0 -1
  103. package/dist/src/components/Dropdown/DisconnectedTrigger.js +0 -13
  104. package/dist/src/components/Dropdown/DisconnectedTrigger.js.map +0 -1
  105. package/dist/src/components/Dropdown/Dropdown.d.ts +0 -23
  106. package/dist/src/components/Dropdown/Dropdown.d.ts.map +0 -1
  107. package/dist/src/components/Dropdown/Dropdown.js +0 -45
  108. package/dist/src/components/Dropdown/Dropdown.js.map +0 -1
  109. package/dist/src/components/Dropdown/ListingItem.d.ts +0 -14
  110. package/dist/src/components/Dropdown/ListingItem.d.ts.map +0 -1
  111. package/dist/src/components/Dropdown/ListingItem.js +0 -42
  112. package/dist/src/components/Dropdown/ListingItem.js.map +0 -1
  113. package/dist/src/components/Dropdown/NestedViewLayout.d.ts +0 -8
  114. package/dist/src/components/Dropdown/NestedViewLayout.d.ts.map +0 -1
  115. package/dist/src/components/Dropdown/NestedViewLayout.js +0 -32
  116. package/dist/src/components/Dropdown/NestedViewLayout.js.map +0 -1
  117. package/dist/src/components/Dropdown/Receive/Receive.d.ts +0 -4
  118. package/dist/src/components/Dropdown/Receive/Receive.d.ts.map +0 -1
  119. package/dist/src/components/Dropdown/Receive/Receive.js +0 -64
  120. package/dist/src/components/Dropdown/Receive/Receive.js.map +0 -1
  121. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts +0 -4
  122. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts.map +0 -1
  123. package/dist/src/components/Dropdown/Root/AccountAddressActions.js +0 -49
  124. package/dist/src/components/Dropdown/Root/AccountAddressActions.js.map +0 -1
  125. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts +0 -6
  126. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts.map +0 -1
  127. package/dist/src/components/Dropdown/Root/AccountBalance.js +0 -32
  128. package/dist/src/components/Dropdown/Root/AccountBalance.js.map +0 -1
  129. package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts +0 -6
  130. package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts.map +0 -1
  131. package/dist/src/components/Dropdown/Root/AccountBtcListing.js +0 -28
  132. package/dist/src/components/Dropdown/Root/AccountBtcListing.js.map +0 -1
  133. package/dist/src/components/Dropdown/Root/AccountError.d.ts +0 -8
  134. package/dist/src/components/Dropdown/Root/AccountError.d.ts.map +0 -1
  135. package/dist/src/components/Dropdown/Root/AccountError.js +0 -17
  136. package/dist/src/components/Dropdown/Root/AccountError.js.map +0 -1
  137. package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts +0 -4
  138. package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts.map +0 -1
  139. package/dist/src/components/Dropdown/Root/AccountMusdListing.js +0 -21
  140. package/dist/src/components/Dropdown/Root/AccountMusdListing.js.map +0 -1
  141. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts +0 -8
  142. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts.map +0 -1
  143. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js +0 -43
  144. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js.map +0 -1
  145. package/dist/src/components/Dropdown/Root/Root.d.ts +0 -8
  146. package/dist/src/components/Dropdown/Root/Root.d.ts.map +0 -1
  147. package/dist/src/components/Dropdown/Root/Root.js +0 -45
  148. package/dist/src/components/Dropdown/Root/Root.js.map +0 -1
  149. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts +0 -4
  150. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts.map +0 -1
  151. package/dist/src/components/Dropdown/Root/WalletAddress.js +0 -66
  152. package/dist/src/components/Dropdown/Root/WalletAddress.js.map +0 -1
  153. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts +0 -6
  154. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts.map +0 -1
  155. package/dist/src/components/Dropdown/Root/WelcomeBlock.js +0 -88
  156. package/dist/src/components/Dropdown/Root/WelcomeBlock.js.map +0 -1
  157. package/dist/src/components/Dropdown/SlotNumber.d.ts +0 -19
  158. package/dist/src/components/Dropdown/SlotNumber.d.ts.map +0 -1
  159. package/dist/src/components/Dropdown/SlotNumber.js +0 -67
  160. package/dist/src/components/Dropdown/SlotNumber.js.map +0 -1
  161. package/dist/src/components/Dropdown/TestnetTopBanner.d.ts +0 -3
  162. package/dist/src/components/Dropdown/TestnetTopBanner.d.ts.map +0 -1
  163. package/dist/src/components/Dropdown/TestnetTopBanner.js +0 -14
  164. package/dist/src/components/Dropdown/TestnetTopBanner.js.map +0 -1
  165. package/dist/src/components/Dropdown/index.d.ts +0 -3
  166. package/dist/src/components/Dropdown/index.d.ts.map +0 -1
  167. package/dist/src/components/Dropdown/index.js +0 -2
  168. package/dist/src/components/Dropdown/index.js.map +0 -1
  169. package/dist/src/components/index.d.ts +0 -2
  170. package/dist/src/components/index.d.ts.map +0 -1
  171. package/dist/src/components/index.js +0 -2
  172. package/dist/src/components/index.js.map +0 -1
  173. package/dist/src/lib/contracts/artifacts/MEZO.json +0 -428
  174. package/src/assets/DefaultAvatar.tsx +0 -74
  175. package/src/components/Dropdown/ConnectedTrigger.tsx +0 -76
  176. package/src/components/Dropdown/Content.tsx +0 -53
  177. package/src/components/Dropdown/DisconnectedTrigger.tsx +0 -36
  178. package/src/components/Dropdown/Dropdown.tsx +0 -100
  179. package/src/components/Dropdown/ListingItem.tsx +0 -176
  180. package/src/components/Dropdown/NestedViewLayout.tsx +0 -87
  181. package/src/components/Dropdown/README.md +0 -41
  182. package/src/components/Dropdown/Receive/Receive.tsx +0 -144
  183. package/src/components/Dropdown/Root/AccountAddressActions.tsx +0 -99
  184. package/src/components/Dropdown/Root/AccountBalance.tsx +0 -69
  185. package/src/components/Dropdown/Root/AccountBtcListing.tsx +0 -53
  186. package/src/components/Dropdown/Root/AccountError.tsx +0 -34
  187. package/src/components/Dropdown/Root/AccountMusdListing.tsx +0 -45
  188. package/src/components/Dropdown/Root/AccountOtherAssets.tsx +0 -85
  189. package/src/components/Dropdown/Root/Root.tsx +0 -77
  190. package/src/components/Dropdown/Root/WalletAddress.tsx +0 -123
  191. package/src/components/Dropdown/Root/WelcomeBlock.tsx +0 -173
  192. package/src/components/Dropdown/SlotNumber.tsx +0 -131
  193. package/src/components/Dropdown/TestnetTopBanner.tsx +0 -32
  194. package/src/components/Dropdown/index.ts +0 -2
  195. package/src/components/index.ts +0 -1
  196. package/src/lib/contracts/artifacts/MEZO.json +0 -428
@@ -64,11 +64,6 @@ declare const ASSETS: {
64
64
  symbol: string;
65
65
  decimals: number;
66
66
  };
67
- MEZO: {
68
- name: string;
69
- symbol: string;
70
- decimals: number;
71
- };
72
67
  };
73
68
  /**
74
69
  * Gets details of given crypto asset
@@ -127,10 +122,6 @@ export declare function getAsset(key: keyof typeof ASSETS): {
127
122
  name: string;
128
123
  symbol: string;
129
124
  decimals: number;
130
- } | {
131
- name: string;
132
- symbol: string;
133
- decimals: number;
134
125
  };
135
126
  /**
136
127
  * Checks if given crypto asset is Bitcoin-like
@@ -150,11 +141,5 @@ export declare function isUsdLikeCryptoAsset(key: string): boolean;
150
141
  * @returns True if crypto asset is T token
151
142
  */
152
143
  export declare function isTTokenCryptoAsset(key: string): boolean;
153
- /**
154
- * Checks if given crypto asset is MEZO token
155
- * @param key The key of crypto asset
156
- * @returns True if crypto asset is MEZO token
157
- */
158
- export declare function isMezoCryptoAsset(key: string): boolean;
159
144
  export {};
160
145
  //# sourceMappingURL=assets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/utils/assets.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuEX,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;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,WAE5C"}
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"}
@@ -64,11 +64,6 @@ const ASSETS = {
64
64
  symbol: "mxSolvBTC",
65
65
  decimals: 18,
66
66
  },
67
- MEZO: {
68
- name: "MEZO",
69
- symbol: "MEZO",
70
- decimals: 18,
71
- },
72
67
  };
73
68
  /**
74
69
  * Gets details of given crypto asset
@@ -102,12 +97,4 @@ export function isUsdLikeCryptoAsset(key) {
102
97
  export function isTTokenCryptoAsset(key) {
103
98
  return /^(mt|t)$/i.test(key);
104
99
  }
105
- /**
106
- * Checks if given crypto asset is MEZO token
107
- * @param key The key of crypto asset
108
- * @returns True if crypto asset is MEZO token
109
- */
110
- export function isMezoCryptoAsset(key) {
111
- return /^mezo$/i.test(key);
112
- }
113
100
  //# sourceMappingURL=assets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ass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CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Validates an email address.
3
+ * @param value - The email address to validate
4
+ * @returns An error message if invalid, null if valid or empty
5
+ */
6
+ export declare function validateEmail(value: string): string | null;
7
+ /**
8
+ * Validates a Telegram handle.
9
+ * @param value - The Telegram handle to validate (with or without @ prefix)
10
+ * @returns An error message if invalid, null if valid or empty
11
+ */
12
+ export declare function validateTelegram(value: string): string | null;
13
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ1D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAY7D"}
@@ -0,0 +1,34 @@
1
+ const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
2
+ /**
3
+ * Validates an email address.
4
+ * @param value - The email address to validate
5
+ * @returns An error message if invalid, null if valid or empty
6
+ */
7
+ export function validateEmail(value) {
8
+ if (!value) {
9
+ return null;
10
+ }
11
+ if (!EMAIL_REGEX.test(value)) {
12
+ return "Please enter a valid email address";
13
+ }
14
+ return null;
15
+ }
16
+ /**
17
+ * Validates a Telegram handle.
18
+ * @param value - The Telegram handle to validate (with or without @ prefix)
19
+ * @returns An error message if invalid, null if valid or empty
20
+ */
21
+ export function validateTelegram(value) {
22
+ if (!value) {
23
+ return null;
24
+ }
25
+ const handle = value.startsWith("@") ? value.slice(1) : value;
26
+ if (handle.length < 5) {
27
+ return "Telegram handle must be at least 5 characters";
28
+ }
29
+ if (!/^[a-zA-Z0-9_]+$/.test(handle)) {
30
+ return "Telegram handle can only contain letters, numbers, and underscores";
31
+ }
32
+ return null;
33
+ }
34
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,4BAA4B,CAAA;AAEhD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,oCAAoC,CAAA;IAC7C,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IAC7D,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,+CAA+C,CAAA;IACxD,CAAC;IACD,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,OAAO,oEAAoE,CAAA;IAC7E,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validation.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.test.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,63 @@
1
+ import { validateEmail, validateTelegram } from "./validation";
2
+ describe("validateEmail", () => {
3
+ it("returns null for empty string", () => {
4
+ expect(validateEmail("")).toBeNull();
5
+ });
6
+ it("returns null for valid email", () => {
7
+ expect(validateEmail("user@example.com")).toBeNull();
8
+ });
9
+ it("returns null for valid email with subdomain", () => {
10
+ expect(validateEmail("user@mail.example.com")).toBeNull();
11
+ });
12
+ it("returns null for valid email with plus addressing", () => {
13
+ expect(validateEmail("user+tag@example.com")).toBeNull();
14
+ });
15
+ it("returns error for email without @", () => {
16
+ expect(validateEmail("userexample.com")).toBe("Please enter a valid email address");
17
+ });
18
+ it("returns error for email without domain", () => {
19
+ expect(validateEmail("user@")).toBe("Please enter a valid email address");
20
+ });
21
+ it("returns error for email without TLD", () => {
22
+ expect(validateEmail("user@example")).toBe("Please enter a valid email address");
23
+ });
24
+ it("returns error for email with spaces", () => {
25
+ expect(validateEmail("user @example.com")).toBe("Please enter a valid email address");
26
+ });
27
+ });
28
+ describe("validateTelegram", () => {
29
+ it("returns null for empty string", () => {
30
+ expect(validateTelegram("")).toBeNull();
31
+ });
32
+ it("returns null for valid handle without @", () => {
33
+ expect(validateTelegram("username")).toBeNull();
34
+ });
35
+ it("returns null for valid handle with @", () => {
36
+ expect(validateTelegram("@username")).toBeNull();
37
+ });
38
+ it("returns null for handle with numbers", () => {
39
+ expect(validateTelegram("user123")).toBeNull();
40
+ });
41
+ it("returns null for handle with underscores", () => {
42
+ expect(validateTelegram("user_name")).toBeNull();
43
+ });
44
+ it("returns null for exactly 5 character handle", () => {
45
+ expect(validateTelegram("abcde")).toBeNull();
46
+ });
47
+ it("returns error for handle shorter than 5 characters", () => {
48
+ expect(validateTelegram("abcd")).toBe("Telegram handle must be at least 5 characters");
49
+ });
50
+ it("returns error for handle with @ that is too short", () => {
51
+ expect(validateTelegram("@abcd")).toBe("Telegram handle must be at least 5 characters");
52
+ });
53
+ it("returns error for handle with special characters", () => {
54
+ expect(validateTelegram("user-name")).toBe("Telegram handle can only contain letters, numbers, and underscores");
55
+ });
56
+ it("returns error for handle with spaces", () => {
57
+ expect(validateTelegram("user name")).toBe("Telegram handle can only contain letters, numbers, and underscores");
58
+ });
59
+ it("returns error for handle with dots", () => {
60
+ expect(validateTelegram("user.name")).toBe("Telegram handle can only contain letters, numbers, and underscores");
61
+ });
62
+ });
63
+ //# sourceMappingURL=validation.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.test.js","sourceRoot":"","sources":["../../../src/utils/validation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE9D,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IACtC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IACtD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC3D,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC1D,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAC3C,oCAAoC,CACrC,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,oCAAoC,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C,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC9C,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CACnC,+CAA+C,CAChD,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CACpC,+CAA+C,CAChD,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CACxC,oEAAoE,CACrE,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CACxC,oEAAoE,CACrE,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CACxC,oEAAoE,CACrE,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mezo-org/passport",
3
- "version": "0.16.0-dev.0",
3
+ "version": "0.16.0-dev.2",
4
4
  "main": "dist/src/index.js",
5
5
  "license": "GPL-3.0-only",
6
6
  "scripts": {
@@ -34,25 +34,26 @@
34
34
  "prettier": "^3.2.5",
35
35
  "ts-jest": "^29.1.2",
36
36
  "ts-node": "^10.9.2",
37
- "typescript": "^5.4.3"
37
+ "typescript": "^5.8.2"
38
38
  },
39
39
  "dependencies": {
40
- "@mezo-org/mezo-clay": "0.1.0-dev.37",
41
40
  "@mezo-org/mezod-contracts": "^1.0.0",
42
41
  "@mezo-org/musd-contracts": "^1.0.1",
43
- "@mezo-org/orangekit": "1.0.0-beta.40-dev.19",
42
+ "@mezo-org/orangekit": "1.0.0-beta.40",
44
43
  "@mezo-org/sign-in-with-wallet": "1.0.0-beta.8",
44
+ "@rainbow-me/rainbowkit": "2.0.2",
45
+ "@tanstack/react-query": "^5.28.4",
46
+ "motion": "^12.23.6",
45
47
  "qrcode.react": "^4.2.0",
46
48
  "styletron-engine-monolithic": "^1.0.0",
47
49
  "usehooks-ts": "^3.1.1",
48
- "motion": "^12.23.6",
49
50
  "zustand": "^5.0.3"
50
51
  },
51
52
  "peerDependencies": {
52
- "@rainbow-me/rainbowkit": "2.0.2",
53
+ "@rainbow-me/rainbowkit": "^2.0.2",
53
54
  "@tanstack/react-query": "^5.28.4",
54
55
  "react": "^18.2.0",
55
- "viem": "2.22.8",
56
- "wagmi": "2.5.12"
56
+ "viem": "^2.22.8",
57
+ "wagmi": "^2.5.12"
57
58
  }
58
- }
59
+ }
package/src/api/auth.ts CHANGED
@@ -31,6 +31,8 @@ type Account = {
31
31
  hasModifiedMezoId: boolean
32
32
  linkedAccounts: LinkedAccount[]
33
33
  documents?: Record<DocumentType, UserDocumentStatus>
34
+ email?: string
35
+ telegram?: string
34
36
  }
35
37
 
36
38
  export type Session = {
@@ -94,6 +96,14 @@ export type AcceptDocumentsRequest = Partial<
94
96
  Record<DocumentType, { acceptedVersion: string }>
95
97
  >
96
98
 
99
+ export type UpdateAccountRequest = {
100
+ mezoId?: string
101
+ email?: string
102
+ telegram?: string
103
+ }
104
+
105
+ export type UpdateAccountResponse = Account
106
+
97
107
  export const AUTH_API_ENDPOINTS_BY_ENV = {
98
108
  mainnet: "https://api.mezo.org",
99
109
  testnet: "https://api.test.mezo.org",
@@ -222,4 +232,16 @@ export class AuthApiClient extends ApiClient {
222
232
 
223
233
  return data
224
234
  }
235
+
236
+ async updateAccount(updates: UpdateAccountRequest) {
237
+ const data = await this.handleRequest<UpdateAccountResponse>(
238
+ "/session/account",
239
+ {
240
+ method: "PATCH",
241
+ body: updates,
242
+ },
243
+ )
244
+
245
+ return data
246
+ }
225
247
  }
package/src/config.ts CHANGED
@@ -12,7 +12,7 @@ import { getOKXWallet, getUnisatWallet, getXverseWallet } from "./wallet"
12
12
 
13
13
  type WagmiConfigParameters = Omit<
14
14
  CreateConfigParameters,
15
- "client" | "connectors" | "chains" | "wallets" | "transports"
15
+ "client" | "connectors" | "chains" | "transports"
16
16
  >
17
17
  type GetDefaultConfigParameters = WagmiConfigParameters & {
18
18
  appName: string
@@ -20,32 +20,12 @@ type GetDefaultConfigParameters = WagmiConfigParameters & {
20
20
  appDescription?: string
21
21
  appUrl?: string
22
22
  appIcon?: string
23
- bitcoinWallets?: WalletList
24
- walletConnectProjectId?: string
23
+ wallets?: WalletList
24
+ walletConnectProjectId: string
25
25
  chains?: [Chain, ...Chain[]]
26
26
  transports?: Pick<CreateConfigParameters, "transports">
27
27
  }
28
28
 
29
- const transports = {
30
- [CHAIN_ID.mainnet]: http(RPC_BY_NETWORK.mainnet.http),
31
- [CHAIN_ID.testnet]: http(RPC_BY_NETWORK.testnet.http),
32
- } as Pick<CreateConfigParameters, "transports">
33
-
34
- export const defaultConfig: Required<
35
- Pick<
36
- GetDefaultConfigParameters,
37
- | "transports"
38
- | "walletConnectProjectId"
39
- | "chains"
40
- | "multiInjectedProviderDiscovery"
41
- >
42
- > = {
43
- transports,
44
- walletConnectProjectId: "",
45
- chains: [mezoMainnet, mezoTestnet],
46
- multiInjectedProviderDiscovery: true,
47
- }
48
-
49
29
  const bitcoinWalletTestnetConfig = {
50
30
  rpcUrl: RPC_BY_NETWORK.testnet.http,
51
31
  chainId: CHAIN_ID.testnet,
@@ -112,17 +92,27 @@ export function getConfig(config: GetDefaultConfigParameters): Config {
112
92
  const {
113
93
  appName,
114
94
  mezoNetwork = "mainnet",
115
- walletConnectProjectId = defaultConfig.walletConnectProjectId,
95
+ walletConnectProjectId,
116
96
  ...restParameters
117
97
  } = config
118
98
 
119
- const wallets = config.bitcoinWallets ?? [...getDefaultWallets(mezoNetwork)]
99
+ const chains: [Chain, ...Chain[]] =
100
+ mezoNetwork === "mainnet" ? [mezoMainnet] : [mezoTestnet]
101
+
102
+ const transports =
103
+ mezoNetwork === "mainnet"
104
+ ? { [mezoMainnet.id]: http(RPC_BY_NETWORK.mainnet.http) }
105
+ : { [mezoTestnet.id]: http(RPC_BY_NETWORK.testnet.http) }
106
+
107
+ const wallets = config.wallets ?? [...getDefaultWallets(mezoNetwork)]
120
108
 
121
109
  return getDefaultConfig({
122
- ...defaultConfig,
123
110
  appName,
111
+ chains,
112
+ transports,
124
113
  wallets,
125
114
  projectId: walletConnectProjectId,
115
+ multiInjectedProviderDiscovery: true,
126
116
  ...restParameters,
127
117
  })
128
118
  }
@@ -25,5 +25,7 @@ export {
25
25
  useResetTokensBalances,
26
26
  } from "./useTokensBalances"
27
27
  export * from "./useUpdateMezoId"
28
+ export * from "./useUpdateUserProfile"
28
29
  export * from "./useValidateMezoId"
29
30
  export * from "./useRewardsApiClient"
31
+ export * from "./useWalletAccount"
@@ -13,7 +13,7 @@ import {
13
13
  } from "../utils/siww"
14
14
  import { useGetAccountByAddress } from "./useGetAccountByAddress"
15
15
  import type { Session } from "../api"
16
- import useWalletAccount from "./useWalletAccount"
16
+ import { useWalletAccount } from "./useWalletAccount"
17
17
 
18
18
  function useAuthenticateWithWallet(
19
19
  shouldCreateAccount = false,
@@ -9,7 +9,7 @@ import {
9
9
  import { usePassportContext } from "./usePassportContext"
10
10
  import { CHAIN_ID } from "../constants"
11
11
  import { bigIntMax, normalizePrecision } from "../utils/numbers"
12
- import useWalletAccount from "./useWalletAccount"
12
+ import { useWalletAccount } from "./useWalletAccount"
13
13
  import { getAsset } from "../utils/assets"
14
14
  import { convertToUsd } from "../utils/currency"
15
15
  import { useCollateralPrice } from "./useCollateralPrice"
@@ -6,7 +6,7 @@ import {
6
6
  } from "../lib/contracts"
7
7
  import { usePassportContext } from "./usePassportContext"
8
8
  import { CHAIN_ID } from "../constants"
9
- import useWalletAccount from "./useWalletAccount"
9
+ import { useWalletAccount } from "./useWalletAccount"
10
10
 
11
11
  // Wagmi handles typesafety with ABI const assertions. TypeScript doesn't
12
12
  // support importing JSON as const yet so types cannot be inferred from the
@@ -7,7 +7,7 @@ import {
7
7
  import { useAuthApiClient } from "./useAuthApiClient"
8
8
  import { QUERY_KEYS } from "./constants"
9
9
  import type { CreateAccountRequest, CreateAccountResponse } from "../api"
10
- import useWalletAccount from "./useWalletAccount"
10
+ import { useWalletAccount } from "./useWalletAccount"
11
11
  import { getBitcoinPublicKeyFromConnector } from "../utils/wagmi"
12
12
 
13
13
  export function useCreateAccount(
@@ -7,7 +7,7 @@ import {
7
7
  import { useAuthApiClient } from "./useAuthApiClient"
8
8
  import type { LinkAccountResponse, SignatureData } from "../api"
9
9
  import { QUERY_KEYS } from "./constants"
10
- import useWalletAccount from "./useWalletAccount"
10
+ import { useWalletAccount } from "./useWalletAccount"
11
11
  import { getBitcoinPublicKeyFromConnector } from "../utils/wagmi"
12
12
 
13
13
  type LinkAccountMutationFnParameters =
@@ -13,12 +13,11 @@ import {
13
13
  MezoChainToken,
14
14
  testnetTokenContracts,
15
15
  } from "../lib/contracts"
16
- import useWalletAccount from "./useWalletAccount"
16
+ import { useWalletAccount } from "./useWalletAccount"
17
17
  import {
18
18
  getAsset,
19
19
  isBitcoinLikeCryptoAsset,
20
20
  isTTokenCryptoAsset,
21
- isMezoCryptoAsset,
22
21
  } from "../utils/assets"
23
22
  import { convertToUsd } from "../utils/currency"
24
23
  import { CHAIN_ID, mezoMainnet, mezoTestnet } from "../constants"
@@ -66,7 +65,6 @@ const BALANCE_TOKENS: MezoChainToken[] = [
66
65
  "mUSDT",
67
66
  "mxSolvBTC",
68
67
  "MUSD",
69
- "MEZO",
70
68
  ]
71
69
 
72
70
  type UseMezoChainTokensBalancesOptions<T extends MezoChainToken[]> = {
@@ -221,13 +219,6 @@ export function useTokensBalances<T extends MezoChainToken[]>(
221
219
  conversion.decimals,
222
220
  )
223
221
  }
224
- // TODO: Provide MEZO oracle to get accurate token price
225
- if (isMezoCryptoAsset(tokenBalance.symbol)) {
226
- usd = {
227
- value: 0n,
228
- formatted: "0",
229
- }
230
- }
231
222
 
232
223
  return { ...tokenBalance, usd }
233
224
  })
@@ -0,0 +1,34 @@
1
+ import {
2
+ useQueryClient,
3
+ useMutation,
4
+ MutationOptions,
5
+ DefaultError,
6
+ } from "@tanstack/react-query"
7
+ import { useAuthApiClient } from "./useAuthApiClient"
8
+ import { QUERY_KEYS } from "./constants"
9
+ import type { UpdateAccountRequest, UpdateAccountResponse } from "../api"
10
+
11
+ export function useUpdateUserProfile(
12
+ mutationOptions: Omit<
13
+ MutationOptions<UpdateAccountResponse, DefaultError, UpdateAccountRequest>,
14
+ "mutationFn" | "mutationKey"
15
+ > = {},
16
+ ) {
17
+ const queryClient = useQueryClient()
18
+ const authApiClient = useAuthApiClient()
19
+
20
+ const { onSuccess: customOnSuccess, ...restMutationOptions } = mutationOptions
21
+
22
+ const { mutate, mutateAsync, ...rest } = useMutation({
23
+ mutationFn: (updates: UpdateAccountRequest) =>
24
+ authApiClient.updateAccount(updates),
25
+ onSuccess: (data, variables, context) => {
26
+ queryClient.resetQueries({ queryKey: [QUERY_KEYS.ACCOUNT] })
27
+
28
+ if (customOnSuccess) customOnSuccess(data, variables, context)
29
+ },
30
+ ...restMutationOptions,
31
+ })
32
+
33
+ return { updateProfile: mutate, updateProfileAsync: mutateAsync, ...rest }
34
+ }
@@ -2,21 +2,22 @@ import { OrangeKitConnector } from "@mezo-org/orangekit"
2
2
  import { useQuery } from "@tanstack/react-query"
3
3
  import { useMemo } from "react"
4
4
  import { Address } from "viem"
5
- import { Connector, useAccount } from "wagmi"
5
+ import { useAccount, UseAccountReturnType } from "wagmi"
6
6
 
7
- type UseWalletAccountReturn = {
7
+ type UseWalletAccountReturn = Omit<UseAccountReturnType, "address"> & {
8
8
  accountAddress?: Address
9
9
  walletAddress?: string
10
- isConnected: boolean
11
10
  networkFamily: "bitcoin" | "evm"
12
- connector?: Connector
13
- chainId?: number
14
11
  }
15
12
 
16
- // TODO: Invesitgate race conditions and refactor
17
-
18
- export default function useWalletAccount(): UseWalletAccountReturn {
19
- const { address: evmAddress, connector, chainId } = useAccount()
13
+ export function useWalletAccount(): UseWalletAccountReturn {
14
+ const {
15
+ address: evmAddress,
16
+ connector,
17
+ chainId,
18
+ isConnected,
19
+ ...rest
20
+ } = useAccount()
20
21
 
21
22
  const networkFamily = useMemo(
22
23
  () => (connector?.type !== "orangekit" ? "evm" : "bitcoin"),
@@ -38,6 +39,7 @@ export default function useWalletAccount(): UseWalletAccountReturn {
38
39
  balance,
39
40
  }
40
41
  },
42
+ enabled: networkFamily === "bitcoin" && !!connector,
41
43
  })
42
44
 
43
45
  const { address: btcAddress } = btcData || {}
@@ -45,9 +47,12 @@ export default function useWalletAccount(): UseWalletAccountReturn {
45
47
  return {
46
48
  accountAddress: evmAddress,
47
49
  walletAddress: btcAddress ?? evmAddress,
48
- isConnected: networkFamily === "bitcoin" ? !!btcAddress : !!evmAddress,
50
+ isConnected:
51
+ isConnected &&
52
+ (networkFamily === "bitcoin" ? !!btcAddress : !!evmAddress),
49
53
  networkFamily,
50
54
  connector,
51
55
  chainId,
56
+ ...rest,
52
57
  }
53
58
  }
@@ -69,7 +69,6 @@ function useWatchTransferEventsForAllTokens() {
69
69
  useWatchTransferEvents("mUSDT")
70
70
  useWatchTransferEvents("mxSolvBTC")
71
71
  useWatchTransferEvents("MUSD")
72
- useWatchTransferEvents("MEZO")
73
72
  }
74
73
 
75
74
  export { useWatchTransferEvents, useWatchTransferEventsForAllTokens }
package/src/index.ts CHANGED
@@ -1,6 +1,4 @@
1
- export * from "./components"
2
1
  export {
3
- defaultConfig,
4
2
  unisatWalletMezoMainnet,
5
3
  unisatWalletMezoTestnet,
6
4
  okxWalletMezoMainnet,
@@ -29,7 +29,6 @@ import priceFeed from "@mezo-org/musd-contracts/deployments/mainnet/PriceFeed.js
29
29
  import priceFeedTestnet from "@mezo-org/musd-contracts/deployments/matsnet/PriceFeed.json"
30
30
 
31
31
  import { Abi, Address } from "viem"
32
- import mezoArtifact from "./artifacts/MEZO.json"
33
32
 
34
33
  export type MezoChainToken =
35
34
  | "mcbBTC"
@@ -43,7 +42,6 @@ export type MezoChainToken =
43
42
  | "mUSDT"
44
43
  | "mxSolvBTC"
45
44
  | "MUSD"
46
- | "MEZO"
47
45
 
48
46
  export type MezoBorrowContract =
49
47
  | "TroveManager"
@@ -70,7 +68,6 @@ export const testnetTokenContracts = {
70
68
  mUSDT: usdtTestnet,
71
69
  mxSolvBTC: xsolvbtcTestnet,
72
70
  MUSD: musdTestnet,
73
- MEZO: mezoArtifact,
74
71
  } as unknown as ContractsMap<MezoChainToken>
75
72
 
76
73
  export const mainnetTokenContracts = {
@@ -85,7 +82,6 @@ export const mainnetTokenContracts = {
85
82
  mUSDT: usdtMainnet,
86
83
  mxSolvBTC: xsolvbtcMainnet,
87
84
  MUSD: musdMainnet,
88
- MEZO: mezoArtifact,
89
85
  } as unknown as ContractsMap<MezoChainToken>
90
86
 
91
87
  export const mainnetBorrowContracts = {
@@ -3,6 +3,7 @@ import { create } from "zustand"
3
3
  export enum DropdownView {
4
4
  ROOT = "ROOT",
5
5
  RECEIVE = "RECEIVE",
6
+ SETTINGS = "SETTINGS",
6
7
  }
7
8
 
8
9
  interface DropdownStore {
@@ -64,11 +64,6 @@ const ASSETS = {
64
64
  symbol: "mxSolvBTC",
65
65
  decimals: 18,
66
66
  },
67
- MEZO: {
68
- name: "MEZO",
69
- symbol: "MEZO",
70
- decimals: 18,
71
- },
72
67
  }
73
68
 
74
69
  /**
@@ -106,12 +101,3 @@ export function isUsdLikeCryptoAsset(key: string) {
106
101
  export function isTTokenCryptoAsset(key: string) {
107
102
  return /^(mt|t)$/i.test(key)
108
103
  }
109
-
110
- /**
111
- * Checks if given crypto asset is MEZO token
112
- * @param key The key of crypto asset
113
- * @returns True if crypto asset is MEZO token
114
- */
115
- export function isMezoCryptoAsset(key: string) {
116
- return /^mezo$/i.test(key)
117
- }