@mezo-org/passport 0.4.0-dev.1 → 0.4.0-dev.10

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 (233) hide show
  1. package/dist/src/api/auth.d.ts +57 -52
  2. package/dist/src/api/auth.d.ts.map +1 -1
  3. package/dist/src/api/auth.js +22 -53
  4. package/dist/src/api/auth.js.map +1 -1
  5. package/dist/src/api/client.d.ts +24 -0
  6. package/dist/src/api/client.d.ts.map +1 -0
  7. package/dist/src/api/client.js +54 -0
  8. package/dist/src/api/client.js.map +1 -0
  9. package/dist/src/api/fetch-error.d.ts +5 -0
  10. package/dist/src/api/fetch-error.d.ts.map +1 -0
  11. package/dist/src/api/fetch-error.js +8 -0
  12. package/dist/src/api/fetch-error.js.map +1 -0
  13. package/dist/src/api/index.d.ts +3 -0
  14. package/dist/src/api/index.d.ts.map +1 -0
  15. package/dist/src/api/index.js +3 -0
  16. package/dist/src/api/index.js.map +1 -0
  17. package/dist/src/api/portal.d.ts +32 -0
  18. package/dist/src/api/portal.d.ts.map +1 -0
  19. package/dist/src/api/portal.js +23 -0
  20. package/dist/src/api/portal.js.map +1 -0
  21. package/dist/src/assets/DefaultAvatar.d.ts +5 -0
  22. package/dist/src/assets/DefaultAvatar.d.ts.map +1 -0
  23. package/dist/src/assets/DefaultAvatar.js +21 -0
  24. package/dist/src/assets/DefaultAvatar.js.map +1 -0
  25. package/dist/src/components/Dropdown/AccountAddress.d.ts +8 -0
  26. package/dist/src/components/Dropdown/AccountAddress.d.ts.map +1 -0
  27. package/dist/src/components/Dropdown/AccountAddress.js +66 -0
  28. package/dist/src/components/Dropdown/AccountAddress.js.map +1 -0
  29. package/dist/src/components/Dropdown/AccountAssets.d.ts +14 -0
  30. package/dist/src/components/Dropdown/AccountAssets.d.ts.map +1 -0
  31. package/dist/src/components/Dropdown/AccountAssets.js +44 -0
  32. package/dist/src/components/Dropdown/AccountAssets.js.map +1 -0
  33. package/dist/src/components/Dropdown/AccountBalance.d.ts +7 -0
  34. package/dist/src/components/Dropdown/AccountBalance.d.ts.map +1 -0
  35. package/dist/src/components/Dropdown/AccountBalance.js +18 -0
  36. package/dist/src/components/Dropdown/AccountBalance.js.map +1 -0
  37. package/dist/src/components/Dropdown/ConnectedTrigger.d.ts +7 -0
  38. package/dist/src/components/Dropdown/ConnectedTrigger.d.ts.map +1 -0
  39. package/dist/src/components/Dropdown/ConnectedTrigger.js +30 -0
  40. package/dist/src/components/Dropdown/ConnectedTrigger.js.map +1 -0
  41. package/dist/src/components/Dropdown/Content.d.ts +9 -0
  42. package/dist/src/components/Dropdown/Content.d.ts.map +1 -0
  43. package/dist/src/components/Dropdown/Content.js +69 -0
  44. package/dist/src/components/Dropdown/Content.js.map +1 -0
  45. package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts +7 -0
  46. package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts.map +1 -0
  47. package/dist/src/components/Dropdown/DisconnectedTrigger.js +13 -0
  48. package/dist/src/components/Dropdown/DisconnectedTrigger.js.map +1 -0
  49. package/dist/src/components/Dropdown/Dropdown.d.ts +20 -0
  50. package/dist/src/components/Dropdown/Dropdown.d.ts.map +1 -0
  51. package/dist/src/components/Dropdown/Dropdown.js +64 -0
  52. package/dist/src/components/Dropdown/Dropdown.js.map +1 -0
  53. package/dist/src/components/Dropdown/WelcomeBlock.d.ts +8 -0
  54. package/dist/src/components/Dropdown/WelcomeBlock.d.ts.map +1 -0
  55. package/dist/src/components/Dropdown/WelcomeBlock.js +44 -0
  56. package/dist/src/components/Dropdown/WelcomeBlock.js.map +1 -0
  57. package/dist/src/components/Dropdown/index.d.ts +3 -0
  58. package/dist/src/components/Dropdown/index.d.ts.map +1 -0
  59. package/dist/src/components/Dropdown/index.js +2 -0
  60. package/dist/src/components/Dropdown/index.js.map +1 -0
  61. package/dist/src/components/index.d.ts +2 -0
  62. package/dist/src/components/index.d.ts.map +1 -0
  63. package/dist/src/components/index.js +2 -0
  64. package/dist/src/components/index.js.map +1 -0
  65. package/dist/src/hooks/constants.d.ts +3 -3
  66. package/dist/src/hooks/constants.js +4 -4
  67. package/dist/src/hooks/constants.js.map +1 -1
  68. package/dist/src/hooks/index.d.ts +1 -4
  69. package/dist/src/hooks/index.d.ts.map +1 -1
  70. package/dist/src/hooks/index.js +1 -4
  71. package/dist/src/hooks/index.js.map +1 -1
  72. package/dist/src/hooks/useAssetsUSDConversion.d.ts +8 -0
  73. package/dist/src/hooks/useAssetsUSDConversion.d.ts.map +1 -0
  74. package/dist/src/hooks/useAssetsUSDConversion.js +21 -0
  75. package/dist/src/hooks/useAssetsUSDConversion.js.map +1 -0
  76. package/dist/src/hooks/useAuthApiClient.d.ts +1 -1
  77. package/dist/src/hooks/useAuthApiClient.d.ts.map +1 -1
  78. package/dist/src/hooks/useAuthenticateWithWallet.d.ts +73 -0
  79. package/dist/src/hooks/useAuthenticateWithWallet.d.ts.map +1 -0
  80. package/dist/src/hooks/useAuthenticateWithWallet.js +69 -0
  81. package/dist/src/hooks/useAuthenticateWithWallet.js.map +1 -0
  82. package/dist/src/hooks/useCreateAccount.d.ts +41 -137
  83. package/dist/src/hooks/useCreateAccount.d.ts.map +1 -1
  84. package/dist/src/hooks/useCreateAccount.js +8 -10
  85. package/dist/src/hooks/useCreateAccount.js.map +1 -1
  86. package/dist/src/hooks/useCreateSession.d.ts +12 -182
  87. package/dist/src/hooks/useCreateSession.d.ts.map +1 -1
  88. package/dist/src/hooks/useCreateSession.js +12 -18
  89. package/dist/src/hooks/useCreateSession.js.map +1 -1
  90. package/dist/src/hooks/useDropdownData.d.ts +45 -0
  91. package/dist/src/hooks/useDropdownData.d.ts.map +1 -0
  92. package/dist/src/hooks/useDropdownData.js +74 -0
  93. package/dist/src/hooks/useDropdownData.js.map +1 -0
  94. package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.d.ts +5 -0
  95. package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.d.ts.map +1 -0
  96. package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.js +34 -0
  97. package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.js.map +1 -0
  98. package/dist/src/hooks/useGetAccountByAddress.d.ts +3 -5
  99. package/dist/src/hooks/useGetAccountByAddress.d.ts.map +1 -1
  100. package/dist/src/hooks/useGetAccountByAddress.js +3 -4
  101. package/dist/src/hooks/useGetAccountByAddress.js.map +1 -1
  102. package/dist/src/hooks/useGetAccountByMezoId.d.ts +3 -5
  103. package/dist/src/hooks/useGetAccountByMezoId.d.ts.map +1 -1
  104. package/dist/src/hooks/useGetAccountByMezoId.js +3 -4
  105. package/dist/src/hooks/useGetAccountByMezoId.js.map +1 -1
  106. package/dist/src/hooks/useGetCurrentAccount.d.ts +14 -8
  107. package/dist/src/hooks/useGetCurrentAccount.d.ts.map +1 -1
  108. package/dist/src/hooks/useGetCurrentAccount.js +28 -6
  109. package/dist/src/hooks/useGetCurrentAccount.js.map +1 -1
  110. package/dist/src/hooks/useGetSession.d.ts +3 -20
  111. package/dist/src/hooks/useGetSession.d.ts.map +1 -1
  112. package/dist/src/hooks/useGetSession.js +2 -2
  113. package/dist/src/hooks/useGetSession.js.map +1 -1
  114. package/dist/src/hooks/useLinkAccount.d.ts +15 -121
  115. package/dist/src/hooks/useLinkAccount.d.ts.map +1 -1
  116. package/dist/src/hooks/useLinkAccount.js +8 -21
  117. package/dist/src/hooks/useLinkAccount.js.map +1 -1
  118. package/dist/src/hooks/usePortalApiClient.d.ts +2 -0
  119. package/dist/src/hooks/usePortalApiClient.d.ts.map +1 -0
  120. package/dist/src/hooks/usePortalApiClient.js +6 -0
  121. package/dist/src/hooks/usePortalApiClient.js.map +1 -0
  122. package/dist/src/hooks/useSignInWithDiscord.d.ts +12 -181
  123. package/dist/src/hooks/useSignInWithDiscord.d.ts.map +1 -1
  124. package/dist/src/hooks/useSignInWithDiscord.js +11 -22
  125. package/dist/src/hooks/useSignInWithDiscord.js.map +1 -1
  126. package/dist/src/hooks/useSignInWithWallet.d.ts +12 -181
  127. package/dist/src/hooks/useSignInWithWallet.d.ts.map +1 -1
  128. package/dist/src/hooks/useSignInWithWallet.js +6 -43
  129. package/dist/src/hooks/useSignInWithWallet.js.map +1 -1
  130. package/dist/src/hooks/useSignOut.d.ts +12 -28
  131. package/dist/src/hooks/useSignOut.d.ts.map +1 -1
  132. package/dist/src/hooks/useSignOut.js +11 -6
  133. package/dist/src/hooks/useSignOut.js.map +1 -1
  134. package/dist/src/hooks/useSignUpWithWallet.d.ts +73 -0
  135. package/dist/src/hooks/useSignUpWithWallet.d.ts.map +1 -0
  136. package/dist/src/hooks/useSignUpWithWallet.js +11 -0
  137. package/dist/src/hooks/useSignUpWithWallet.js.map +1 -0
  138. package/dist/src/hooks/useUpdateMezoId.d.ts +30 -82
  139. package/dist/src/hooks/useUpdateMezoId.d.ts.map +1 -1
  140. package/dist/src/hooks/useUpdateMezoId.js +8 -12
  141. package/dist/src/hooks/useUpdateMezoId.js.map +1 -1
  142. package/dist/src/hooks/useWalletAccount.d.ts +12 -0
  143. package/dist/src/hooks/useWalletAccount.d.ts.map +1 -0
  144. package/dist/src/hooks/useWalletAccount.js +28 -0
  145. package/dist/src/hooks/useWalletAccount.js.map +1 -0
  146. package/dist/src/index.d.ts +1 -0
  147. package/dist/src/index.d.ts.map +1 -1
  148. package/dist/src/index.js +1 -0
  149. package/dist/src/index.js.map +1 -1
  150. package/dist/src/provider.d.ts +10 -13
  151. package/dist/src/provider.d.ts.map +1 -1
  152. package/dist/src/provider.js +11 -20
  153. package/dist/src/provider.js.map +1 -1
  154. package/dist/src/utils/address.d.ts +15 -0
  155. package/dist/src/utils/address.d.ts.map +1 -0
  156. package/dist/src/utils/address.js +35 -0
  157. package/dist/src/utils/address.js.map +1 -0
  158. package/dist/src/utils/address.test.d.ts +2 -0
  159. package/dist/src/utils/address.test.d.ts.map +1 -0
  160. package/dist/src/utils/address.test.js +32 -0
  161. package/dist/src/utils/address.test.js.map +1 -0
  162. package/dist/src/utils/cryptoAssets.d.ts +28 -0
  163. package/dist/src/utils/cryptoAssets.d.ts.map +1 -0
  164. package/dist/src/utils/cryptoAssets.js +73 -0
  165. package/dist/src/utils/cryptoAssets.js.map +1 -0
  166. package/dist/src/utils/cryptoAssets.test.d.ts +2 -0
  167. package/dist/src/utils/cryptoAssets.test.d.ts.map +1 -0
  168. package/dist/src/utils/cryptoAssets.test.js +50 -0
  169. package/dist/src/utils/cryptoAssets.test.js.map +1 -0
  170. package/dist/src/utils/currency.d.ts +14 -0
  171. package/dist/src/utils/currency.d.ts.map +1 -0
  172. package/dist/src/utils/currency.js +27 -0
  173. package/dist/src/utils/currency.js.map +1 -0
  174. package/dist/src/utils/currency.test.d.ts +2 -0
  175. package/dist/src/utils/currency.test.d.ts.map +1 -0
  176. package/dist/src/utils/currency.test.js +34 -0
  177. package/dist/src/utils/currency.test.js.map +1 -0
  178. package/dist/src/utils/numbers.d.ts +26 -0
  179. package/dist/src/utils/numbers.d.ts.map +1 -0
  180. package/dist/src/utils/numbers.js +40 -0
  181. package/dist/src/utils/numbers.js.map +1 -0
  182. package/dist/src/utils/numbers.test.d.ts +2 -0
  183. package/dist/src/utils/numbers.test.d.ts.map +1 -0
  184. package/dist/src/utils/numbers.test.js +54 -0
  185. package/dist/src/utils/numbers.test.js.map +1 -0
  186. package/package.json +9 -3
  187. package/src/api/auth.ts +104 -129
  188. package/src/api/client.ts +78 -0
  189. package/src/api/fetch-error.ts +8 -0
  190. package/src/api/index.ts +2 -0
  191. package/src/api/portal.ts +56 -0
  192. package/src/assets/DefaultAvatar.tsx +74 -0
  193. package/src/components/Dropdown/AccountAddress.tsx +130 -0
  194. package/src/components/Dropdown/AccountAssets.tsx +110 -0
  195. package/src/components/Dropdown/AccountBalance.tsx +38 -0
  196. package/src/components/Dropdown/ConnectedTrigger.tsx +56 -0
  197. package/src/components/Dropdown/Content.tsx +148 -0
  198. package/src/components/Dropdown/DisconnectedTrigger.tsx +36 -0
  199. package/src/components/Dropdown/Dropdown.tsx +111 -0
  200. package/src/components/Dropdown/README.md +51 -0
  201. package/src/components/Dropdown/WelcomeBlock.tsx +92 -0
  202. package/src/components/Dropdown/index.ts +2 -0
  203. package/src/components/index.ts +1 -0
  204. package/src/hooks/constants.ts +4 -4
  205. package/src/hooks/index.ts +1 -4
  206. package/src/hooks/useAssetsUSDConversion.ts +31 -0
  207. package/src/hooks/useAuthenticateWithWallet.ts +98 -0
  208. package/src/hooks/useCreateAccount.ts +20 -11
  209. package/src/hooks/useCreateSession.ts +24 -18
  210. package/src/hooks/useDropdownData.ts +131 -0
  211. package/src/hooks/useEnsureNoSessionAndFetchNonce.ts +46 -0
  212. package/src/hooks/useGetAccountByAddress.ts +11 -5
  213. package/src/hooks/useGetAccountByMezoId.ts +11 -5
  214. package/src/hooks/useGetCurrentAccount.ts +53 -7
  215. package/src/hooks/useGetSession.ts +10 -3
  216. package/src/hooks/useLinkAccount.ts +19 -31
  217. package/src/hooks/usePortalApiClient.ts +6 -0
  218. package/src/hooks/useSignInWithDiscord.ts +19 -28
  219. package/src/hooks/useSignInWithWallet.ts +14 -54
  220. package/src/hooks/useSignOut.ts +22 -6
  221. package/src/hooks/useSignUpWithWallet.ts +21 -0
  222. package/src/hooks/useUpdateMezoId.ts +20 -12
  223. package/src/hooks/useWalletAccount.ts +53 -0
  224. package/src/index.ts +1 -0
  225. package/src/provider.ts +30 -37
  226. package/src/utils/address.test.ts +38 -0
  227. package/src/utils/address.ts +43 -0
  228. package/src/utils/cryptoAssets.test.ts +61 -0
  229. package/src/utils/cryptoAssets.ts +93 -0
  230. package/src/utils/currency.test.ts +38 -0
  231. package/src/utils/currency.ts +32 -0
  232. package/src/utils/numbers.test.ts +73 -0
  233. package/src/utils/numbers.ts +55 -0
@@ -1,71 +1,76 @@
1
- type RequestHandlerOptions = Omit<RequestInit, "credentials" | "body"> & {
2
- body?: Record<string, unknown>;
3
- queryParams?: Record<string, string | undefined>;
4
- };
5
- type PassportIdentityProvider = "wallet" | "discord" | "email";
6
- type AccountPublicData = {
7
- mezoId?: string;
8
- btcAddress: string;
1
+ import { ApiClient } from "./client";
2
+ type AuthProvider = "discord";
3
+ export type LinkedWalletAccount = {
4
+ type: "wallet";
5
+ btcAddress?: string;
9
6
  evmAddress: string;
10
7
  };
8
+ export type LinkedProviderAccount = {
9
+ type: AuthProvider;
10
+ name: string;
11
+ id: string;
12
+ avatarUrl: string;
13
+ };
14
+ export type LinkedAccount = LinkedWalletAccount | LinkedProviderAccount;
11
15
  type Account = {
12
- app_metadata: {
13
- provider: PassportIdentityProvider;
14
- providers: PassportIdentityProvider[];
15
- };
16
- user_metadata: AccountPublicData;
16
+ mezoId: string;
17
+ hasModifiedMezoId: boolean;
18
+ linkedAccounts: LinkedAccount[];
17
19
  };
18
- type Session = {
19
- access_token: string;
20
- token_type: string;
21
- expires_in: number;
22
- expires_at: number;
23
- refresh_token: string;
24
- user: Account;
20
+ export type Session = {
21
+ expiresIn: number;
22
+ expiresAt: number;
23
+ sessionLinks: {
24
+ _links: {
25
+ account: string;
26
+ };
27
+ };
25
28
  };
26
- type AuthenticationProviderRedirectResponse = {
29
+ export type AuthenticationProviderRedirectResponse = {
27
30
  redirectTo: string;
28
31
  };
29
- type WalletAccountCredentials = {
30
- type: "wallet";
32
+ type SignatureData = {
31
33
  message: string;
32
34
  signature: string;
33
35
  };
34
- export type CreateSessionRequest = WalletAccountCredentials | {
36
+ export type GetSessionResponse = Session | {
37
+ nonce: string;
38
+ };
39
+ export type CreateSessionRequest = ({
40
+ type: "wallet";
41
+ } & SignatureData) | {
35
42
  type: "discord";
36
43
  };
44
+ export type CreateSessionResponse = Session | AuthenticationProviderRedirectResponse;
45
+ export type DeleteSessionResponse = {
46
+ message: string;
47
+ };
48
+ export type GetCurrentAccountResponse = Partial<Account> | null;
49
+ export type GetAccountByMezoIdOrAddressResponse = {
50
+ mezoId?: string;
51
+ linkedAccounts?: Extract<LinkedAccount, {
52
+ type: "wallet";
53
+ }>[];
54
+ };
37
55
  export type LinkAccountRequest = CreateSessionRequest;
38
- export type CreateAccountRequest = WalletAccountCredentials;
39
- export declare const API_ENDPOINTS_BY_ENV: {
56
+ export type LinkAccountResponse = Account | AuthenticationProviderRedirectResponse;
57
+ export type CreateAccountRequest = {
58
+ type: "wallet";
59
+ } & SignatureData;
60
+ export type CreateAccountResponse = Account;
61
+ export type UpdateMezoIdResponse = Account;
62
+ export declare const AUTH_API_ENDPOINTS_BY_ENV: {
40
63
  mainnet: string;
41
64
  testnet: string;
42
65
  };
43
- export declare class AuthApiClient {
44
- private apiUrl;
45
- constructor(apiUrl?: string);
46
- /**
47
- * The request handler for the Passport API. It accepts an API endpoint and
48
- * request options.
49
- * @dev Generic type `D` is a type of returned object from the function
50
- * @param endpoint - The API endpoint to request. Should start with
51
- * forward slash ("/")
52
- * @param {RequestHandlerOptions<B>} options - The request options, the
53
- * `RequestInit` type with additional type-safe properties
54
- * @returns The promise of the API response
55
- */
56
- protected handleRequest<D>(endpoint: `/${string}`, options: RequestHandlerOptions): Promise<D>;
57
- getSession(code?: string): Promise<Session | {
58
- nonce: string;
59
- }>;
60
- createSession(createSessionRequest: CreateSessionRequest): Promise<Session | {
61
- redirectTo: string;
62
- }>;
63
- deleteSession(): Promise<{
64
- message: string;
65
- }>;
66
- getCurrentAccount(): Promise<Account>;
67
- getAccountByMezoIdOrAddress(mezoIdOrAddress: string): Promise<AccountPublicData>;
68
- linkAccount(linkAccountRequest: LinkAccountRequest): Promise<Account | AuthenticationProviderRedirectResponse>;
66
+ export declare class AuthApiClient extends ApiClient {
67
+ constructor(environment?: keyof typeof AUTH_API_ENDPOINTS_BY_ENV, apiUrl?: string);
68
+ getSession(code?: string): Promise<GetSessionResponse>;
69
+ createSession(createSessionRequest: CreateSessionRequest): Promise<CreateSessionResponse>;
70
+ deleteSession(): Promise<DeleteSessionResponse>;
71
+ getCurrentAccount(): Promise<GetCurrentAccountResponse>;
72
+ getAccountByMezoIdOrAddress(mezoIdOrAddress: string): Promise<GetAccountByMezoIdOrAddressResponse | null>;
73
+ linkAccount(linkAccountRequest: LinkAccountRequest): Promise<LinkAccountResponse>;
69
74
  createAccount(createAccountRequest: CreateAccountRequest): Promise<Account>;
70
75
  updateMezoId(newMezoId: string): Promise<Account>;
71
76
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,KAAK,qBAAqB,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,MAAM,CAAC,GAAG;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CACjD,CAAA;AACD,KAAK,wBAAwB,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAA;AAE9D,KAAK,iBAAiB,GAAG;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,KAAK,OAAO,GAAG;IACb,YAAY,EAAE;QACZ,QAAQ,EAAE,wBAAwB,CAAA;QAClC,SAAS,EAAE,wBAAwB,EAAE,CAAA;KACtC,CAAA;IACD,aAAa,EAAE,iBAAiB,CAAA;CACjC,CAAA;AAED,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAED,KAAK,sCAAsC,GAAG;IAC5C,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA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AAA;AACrD,MAAM,MAAM,mBAAmB,GAC3B,OAAO,GACP,sCAAsC,CAAA;AAE1C,MAAM,MAAM,oBAAoB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,aAAa,CAAA;AACrE,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAA;AAE3C,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAE1C,eAAO,MAAM,yBAAyB;;;CAGrC,CAAA;AAED,qBAAa,aAAc,SAAQ,SAAS;gBAExC,WAAW,GAAE,MAAM,OAAO,yBAAqC,EAC/D,MAAM,CAAC,EAAE,MAAM;IAKX,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM;IASxB,aAAa,CAAC,oBAAoB,EAAE,oBAAoB;IASxD,aAAa;IAQb,iBAAiB;IAWjB,2BAA2B,CAAC,eAAe,EAAE,MAAM;IAqBnD,WAAW,CAAC,kBAAkB,EAAE,kBAAkB;IAYlD,aAAa,CAAC,oBAAoB,EAAE,oBAAoB;IASxD,YAAY,CAAC,SAAS,EAAE,MAAM;CAWrC"}
@@ -1,55 +1,12 @@
1
- export const API_ENDPOINTS_BY_ENV = {
1
+ import { ApiClient } from "./client";
2
+ import { FetchError } from "./fetch-error";
3
+ export const AUTH_API_ENDPOINTS_BY_ENV = {
2
4
  mainnet: "https://api.mezo.org",
3
5
  testnet: "https://api.test.mezo.org",
4
6
  };
5
- const DEFAULT_API_ENDPOINT = API_ENDPOINTS_BY_ENV.mainnet;
6
- export class AuthApiClient {
7
- apiUrl;
8
- constructor(apiUrl) {
9
- this.apiUrl = apiUrl ?? DEFAULT_API_ENDPOINT;
10
- }
11
- /**
12
- * The request handler for the Passport API. It accepts an API endpoint and
13
- * request options.
14
- * @dev Generic type `D` is a type of returned object from the function
15
- * @param endpoint - The API endpoint to request. Should start with
16
- * forward slash ("/")
17
- * @param {RequestHandlerOptions<B>} options - The request options, the
18
- * `RequestInit` type with additional type-safe properties
19
- * @returns The promise of the API response
20
- */
21
- async handleRequest(endpoint, options) {
22
- const { method, headers, body, queryParams = {}, ...restOptions } = options || {};
23
- // If last character in apiUrl is forward slash we are removing it
24
- const authApiUrlRoute = this.apiUrl.replace(/\/$/, "");
25
- const url = new URL(`${authApiUrlRoute}${endpoint}`);
26
- // Removes falsy values (e.g. null, undefined etc.) from query params and
27
- // appends remaining ones to the URL
28
- Object.entries(queryParams)
29
- .filter(([, value]) => value) // Remove falsy values
30
- .forEach(([key, value]) => url.searchParams.append(key, value));
31
- try {
32
- const response = await fetch(url, {
33
- method,
34
- credentials: "include",
35
- headers: {
36
- "Content-Type": "application/json",
37
- ...headers,
38
- },
39
- body: body ? JSON.stringify(body) : undefined,
40
- ...restOptions,
41
- });
42
- const data = await response.json();
43
- if (!response.ok || data?.error) {
44
- const error = data?.error || "An error occurred";
45
- throw new Error(error);
46
- }
47
- return data;
48
- }
49
- catch (error) {
50
- const errorMessage = error instanceof Error ? error.message : "An error occurred";
51
- throw new Error(errorMessage);
52
- }
7
+ export class AuthApiClient extends ApiClient {
8
+ constructor(environment = "mainnet", apiUrl) {
9
+ super(apiUrl ?? AUTH_API_ENDPOINTS_BY_ENV[environment]);
53
10
  }
54
11
  async getSession(code) {
55
12
  const data = await this.handleRequest("/session", {
@@ -78,9 +35,21 @@ export class AuthApiClient {
78
35
  return data;
79
36
  }
80
37
  async getAccountByMezoIdOrAddress(mezoIdOrAddress) {
81
- const data = await this.handleRequest(`/accounts/${mezoIdOrAddress}`, {
82
- method: "GET",
83
- });
38
+ let data;
39
+ try {
40
+ data = await this.handleRequest(`/accounts/${mezoIdOrAddress}`, {
41
+ method: "GET",
42
+ });
43
+ }
44
+ catch (error) {
45
+ // Return null if account is not found instead of throwing an error
46
+ if (error instanceof FetchError && error.status === 404) {
47
+ data = null;
48
+ }
49
+ else {
50
+ throw error;
51
+ }
52
+ }
84
53
  return data;
85
54
  }
86
55
  async linkAccount(linkAccountRequest) {
@@ -100,7 +69,7 @@ export class AuthApiClient {
100
69
  async updateMezoId(newMezoId) {
101
70
  const data = await this.handleRequest("/session/account", {
102
71
  method: "PATCH",
103
- body: { newMezoId },
72
+ body: { mezoId: newMezoId },
104
73
  });
105
74
  return data;
106
75
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AA+CA,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,OAAO,EAAE,sBAAsB;IAC/B,OAAO,EAAE,2BAA2B;CACrC,CAAA;AAED,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,OAAO,CAAA;AAEzD,MAAM,OAAO,aAAa;IAChB,MAAM,CAAQ;IAEtB,YAAY,MAAe;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,oBAAoB,CAAA;IAC9C,CAAC;IAED;;;;;;;;;OASG;IACO,KAAK,CAAC,aAAa,CAC3B,QAAsB,EACtB,OAA8B;QAE9B,MAAM,EACJ,MAAM,EACN,OAAO,EACP,IAAI,EACJ,WAAW,GAAG,EAAE,EAChB,GAAG,WAAW,EACf,GAAG,OAAO,IAAI,EAAE,CAAA;QAEjB,kEAAkE;QAClE,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QACtD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,eAAe,GAAG,QAAQ,EAAE,CAAC,CAAA;QAEpD,yEAAyE;QACzE,oCAAoC;QACpC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;aACxB,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,sBAAsB;aACnD,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,KAAM,CAAC,CAAC,CAAA;QAElE,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,M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,EAC9B;gBACE,MAAM,EAAE,KAAK;aACd,CACF,CAAA;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,mEAAmE;YACnE,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACxD,IAAI,GAAG,IAAI,CAAA;YACb,CAAC;iBAAM,CAAC;gBACN,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,kBAAsC;QACtD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CACnC,kCAAkC,EAClC;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,kBAAkB;SACzB,CACF,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,oBAA0C;QAC5D,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CAAwB,WAAW,EAAE;YACxE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,oBAAoB;SAC3B,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,SAAiB;QAClC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CACnC,kBAAkB,EAClB;YACE,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;SAC5B,CACF,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ type RequestHandlerOptions = Omit<RequestInit, "credentials" | "body"> & {
2
+ body?: Record<string, unknown>;
3
+ queryParams?: Record<string, string | undefined>;
4
+ };
5
+ export declare abstract class ApiClient {
6
+ private apiUrl;
7
+ constructor(apiUrl: string);
8
+ /**
9
+ * The request handler for the Passport API. It accepts an API endpoint and
10
+ * request options.
11
+ * @dev Generic type `D` is a type of returned object from the function
12
+ * @dev WARNING: This function hardcodes `credentials: "include"`, meaning
13
+ * cookies and authentication headers will be sent with every request. Ensure
14
+ * this is safe if you plan to use it in other contexts than auth api worker.
15
+ * @param endpoint - The API endpoint to request. Should start with
16
+ * forward slash ("/")
17
+ * @param options - The request options, the `RequestInit` type with
18
+ * additional type-safe properties
19
+ * @returns The promise of the API response
20
+ */
21
+ protected handleRequest<D>(endpoint: `/${string}`, options?: RequestHandlerOptions): Promise<D>;
22
+ }
23
+ export {};
24
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,MAAM,CAAC,GAAG;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CACjD,CAAA;AAED,8BAAsB,SAAS;IAC7B,OAAO,CAAC,MAAM,CAAQ;gBAEV,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;OAYG;cACa,aAAa,CAAC,CAAC,EAC7B,QAAQ,EAAE,IAAI,MAAM,EAAE,EACtB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,CAAC,CAAC;CA+Cd"}
@@ -0,0 +1,54 @@
1
+ import { FetchError } from "./fetch-error";
2
+ export class ApiClient {
3
+ apiUrl;
4
+ constructor(apiUrl) {
5
+ this.apiUrl = apiUrl;
6
+ }
7
+ /**
8
+ * The request handler for the Passport API. It accepts an API endpoint and
9
+ * request options.
10
+ * @dev Generic type `D` is a type of returned object from the function
11
+ * @dev WARNING: This function hardcodes `credentials: "include"`, meaning
12
+ * cookies and authentication headers will be sent with every request. Ensure
13
+ * this is safe if you plan to use it in other contexts than auth api worker.
14
+ * @param endpoint - The API endpoint to request. Should start with
15
+ * forward slash ("/")
16
+ * @param options - The request options, the `RequestInit` type with
17
+ * additional type-safe properties
18
+ * @returns The promise of the API response
19
+ */
20
+ async handleRequest(endpoint, options = {}) {
21
+ try {
22
+ const { method, body, queryParams = {}, ...restOptions } = options;
23
+ // If last character in apiUrl is forward slash we are removing it
24
+ const authApiUrlRoute = this.apiUrl.replace(/\/$/, "");
25
+ const url = new URL(`${authApiUrlRoute}${endpoint}`);
26
+ // Removes falsy values (e.g. null, undefined etc.) from query params and
27
+ // appends remaining ones to the URL
28
+ Object.entries(queryParams)
29
+ .filter(([, value]) => value) // Remove falsy values
30
+ .forEach(([key, value]) => url.searchParams.append(key, value));
31
+ const response = await fetch(url, {
32
+ method,
33
+ credentials: "include",
34
+ body: body ? JSON.stringify(body) : undefined,
35
+ ...restOptions,
36
+ });
37
+ const data = await response.json();
38
+ if (!response.ok || data?.error) {
39
+ const error = data?.error ||
40
+ `An error occurred when handling API request: ${JSON.stringify(data)}`;
41
+ throw new FetchError(response.status, `Error [${response.status}]: ${error}`);
42
+ }
43
+ return data;
44
+ }
45
+ catch (error) {
46
+ if (error instanceof FetchError) {
47
+ throw error;
48
+ }
49
+ const errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
50
+ throw new FetchError(500, `Error [500]: An error occurred when handling API request: ${errorMessage}`);
51
+ }
52
+ }
53
+ }
54
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAO1C,MAAM,OAAgB,SAAS;IACrB,MAAM,CAAQ;IAEtB,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;OAYG;IACO,KAAK,CAAC,aAAa,CAC3B,QAAsB,EACtB,UAAiC,EAAE;QAEnC,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,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,CAAC;YACf,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;gBAChC,MAAM,KAAK,CAAA;YACb,CAAC;YAED,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;YAChE,MAAM,IAAI,UAAU,CAClB,GAAG,EACH,6DAA6D,YAAY,EAAE,CAC5E,CAAA;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ export declare class FetchError extends Error {
2
+ status: number;
3
+ constructor(status: number, message?: string);
4
+ }
5
+ //# sourceMappingURL=fetch-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-error.d.ts","sourceRoot":"","sources":["../../../src/api/fetch-error.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAW,SAAQ,KAAK;IAE1B,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM;CAInB"}
@@ -0,0 +1,8 @@
1
+ export class FetchError extends Error {
2
+ status;
3
+ constructor(status, message) {
4
+ super(message);
5
+ this.status = status;
6
+ }
7
+ }
8
+ //# sourceMappingURL=fetch-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-error.js","sourceRoot":"","sources":["../../../src/api/fetch-error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAW,SAAQ,KAAK;IAE1B;IADT,YACS,MAAc,EACrB,OAAgB;QAEhB,KAAK,CAAC,OAAO,CAAC,CAAA;QAHP,WAAM,GAAN,MAAM,CAAQ;IAIvB,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export * from "./auth";
2
+ export * from "./portal";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from "./auth";
2
+ export * from "./portal";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { ApiClient } from "./client";
2
+ type PortalStatistics = {
3
+ hodlers: number;
4
+ depositedBitcoin: string;
5
+ tvl: number;
6
+ currentUsdPerBtc: string;
7
+ currentUsdPerEth: string;
8
+ usdPerBtc24hChange: string;
9
+ };
10
+ type PortalMats = {
11
+ address: string;
12
+ totalMats: number;
13
+ matsFromDeposits: number;
14
+ matsFromReferrals: number;
15
+ matsFromSecondaryReferrals: number;
16
+ netMatsTransferred: number;
17
+ dailyMats: number;
18
+ dailyMatsFromDeposits: number;
19
+ dailyMatsFromReferrals: number;
20
+ dailyMatsFromSecondaryReferrals: number;
21
+ };
22
+ export declare const PORTAL_API_ENDPOINTS_BY_ENV: {
23
+ mainnet: string;
24
+ testnet: string;
25
+ };
26
+ export declare class PortalApiClient extends ApiClient {
27
+ constructor(environment?: keyof typeof PORTAL_API_ENDPOINTS_BY_ENV, apiUrl?: string);
28
+ getPortalStatistics(): Promise<PortalStatistics>;
29
+ getPortalMats(address: string): Promise<PortalMats>;
30
+ }
31
+ export {};
32
+ //# sourceMappingURL=portal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../src/api/portal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,MAAM,CAAA;IACxB,kBAAkB,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,iBAAiB,EAAE,MAAM,CAAA;IACzB,0BAA0B,EAAE,MAAM,CAAA;IAClC,kBAAkB,EAAE,MAAM,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,sBAAsB,EAAE,MAAM,CAAA;IAC9B,+BAA+B,EAAE,MAAM,CAAA;CACxC,CAAA;AAED,eAAO,MAAM,2BAA2B;;;CAGvC,CAAA;AAED,qBAAa,eAAgB,SAAQ,SAAS;gBAE1C,WAAW,GAAE,MAAM,OAAO,2BAAuC,EACjE,MAAM,CAAC,EAAE,MAAM;IAKX,mBAAmB;IAQnB,aAAa,CAAC,OAAO,EAAE,MAAM;CAUpC"}
@@ -0,0 +1,23 @@
1
+ import { ApiClient } from "./client";
2
+ export const PORTAL_API_ENDPOINTS_BY_ENV = {
3
+ mainnet: "https://api.mezo.org/api/v1",
4
+ testnet: "https://api.test.mezo.org/api/v1",
5
+ };
6
+ export class PortalApiClient extends ApiClient {
7
+ constructor(environment = "mainnet", apiUrl) {
8
+ super(apiUrl ?? PORTAL_API_ENDPOINTS_BY_ENV[environment]);
9
+ }
10
+ async getPortalStatistics() {
11
+ const data = await this.handleRequest("/statistics", {
12
+ method: "GET",
13
+ });
14
+ return data;
15
+ }
16
+ async getPortalMats(address) {
17
+ const data = await this.handleRequest(`/accounts/${address}/mats`, {
18
+ method: "GET",
19
+ });
20
+ return data;
21
+ }
22
+ }
23
+ //# sourceMappingURL=portal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal.js","sourceRoot":"","sources":["../../../src/api/portal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAwBpC,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,OAAO,EAAE,6BAA6B;IACtC,OAAO,EAAE,kCAAkC;CAC5C,CAAA;AAED,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,YACE,cAAwD,SAAS,EACjE,MAAe;QAEf,KAAK,CAAC,MAAM,IAAI,2BAA2B,CAAC,WAAW,CAAC,CAAC,CAAA;IAC3D,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CAAmB,aAAa,EAAE;YACrE,MAAM,EAAE,KAAK;SACd,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAe;QACjC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CACnC,aAAa,OAAO,OAAO,EAC3B;YACE,MAAM,EAAE,KAAK;SACd,CACF,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { BlockProps } from "@mezo-org/mezo-clay";
2
+ import React from "react";
3
+ declare function DefaultAvatarComponent(props: BlockProps): React.JSX.Element;
4
+ export default DefaultAvatarComponent;
5
+ //# sourceMappingURL=DefaultAvatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultAvatar.d.ts","sourceRoot":"","sources":["../../../src/assets/DefaultAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAmB,MAAM,OAAO,CAAA;AAoEvC,iBAAS,sBAAsB,CAAC,KAAK,EAAE,UAAU,qBAEhD;AAED,eAAe,sBAAsB,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { Block } from "@mezo-org/mezo-clay";
2
+ import React from "react";
3
+ function DefaultAvatar(props) {
4
+ return (React.createElement("svg", { viewBox: "0 0 214 214", fill: "none", ...props },
5
+ React.createElement("rect", { y: "-0.478027", width: "166.379", height: "81.7091", fill: "#FF004D" }),
6
+ React.createElement("rect", { x: "166", y: "-0.478027", width: "48", height: "82", fill: "black" }),
7
+ React.createElement("rect", { x: "166.379", y: "81.231", width: "24.1044", height: "132.291", fill: "#DFFF80" }),
8
+ React.createElement("rect", { x: "118.758", y: "81.231", width: "24.1044", height: "132.291", fill: "#FF5500" }),
9
+ React.createElement("rect", { x: "71.1372", y: "81.231", width: "24.1044", height: "132.291", fill: "#5A59A7" }),
10
+ React.createElement("rect", { x: "23.5166", y: "81.231", width: "24.1044", height: "132.291", fill: "#47B5FF" }),
11
+ React.createElement("rect", { y: "81.231", width: "23.5165", height: "132.291", fill: "#A3C238" }),
12
+ React.createElement("rect", { x: "190.483", y: "81.231", width: "23.5165", height: "132.291", fill: "#6E6E70" }),
13
+ React.createElement("rect", { x: "142.863", y: "81.231", width: "23.5165", height: "132.291", fill: "#0A3C01" }),
14
+ React.createElement("rect", { x: "95.2417", y: "81.231", width: "23.5165", height: "132.291", fill: "#F2A91F" }),
15
+ React.createElement("rect", { x: "47.6211", y: "81.231", width: "23.5165", height: "132.291", fill: "#6B3D01" })));
16
+ }
17
+ function DefaultAvatarComponent(props) {
18
+ return React.createElement(Block, { as: DefaultAvatar, ...props });
19
+ }
20
+ export default DefaultAvatarComponent;
21
+ //# sourceMappingURL=DefaultAvatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultAvatar.js","sourceRoot":"","sources":["../../../src/assets/DefaultAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,SAAS,aAAa,CAAC,KAA8B;IACnD,OAAO,CACL,6BAAK,OAAO,EAAC,aAAa,EAAC,IAAI,EAAC,MAAM,KAAK,KAAK;QAC9C,8BAAM,CAAC,EAAC,WAAW,EAAC,KAAK,EAAC,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,IAAI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,EACf,MAAM,EAAC,SAAS,EAChB,IAAI,EAAC,SAAS,GACd,CACE,CACP,CAAA;AACH,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAiB;IAC/C,OAAO,oBAAC,KAAK,IAAC,EAAE,EAAE,aAAa,KAAM,KAAK,GAAI,CAAA;AAChD,CAAC;AAED,eAAe,sBAAsB,CAAA"}
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ type AccountAddressProps = {
3
+ address: string;
4
+ type: "bitcoin" | "evm";
5
+ };
6
+ export default function AccountAddress(props: AccountAddressProps): React.JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=AccountAddress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountAddress.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/AccountAddress.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAgC,MAAM,OAAO,CAAA;AAMpD,KAAK,mBAAmB,GAAG;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,SAAS,GAAG,KAAK,CAAA;CACxB,CAAA;AAID,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBA6GhE"}
@@ -0,0 +1,66 @@
1
+ import { Block, Copy03 as CopyIcon, LinkExternal02 as LinkIcon, ParagraphSmall, useStyletron, } from "@mezo-org/mezo-clay";
2
+ import React, { useCallback, useState } from "react";
3
+ import { useCopyToClipboard } from "usehooks-ts";
4
+ import { usePassportContext } from "../../hooks/usePassportContext";
5
+ import { getAddressExplorerUrl, trimAddress } from "../../utils/address";
6
+ import { getCryptoAsset } from "../../utils/cryptoAssets";
7
+ // TODO: Add visual feedback on copy
8
+ export default function AccountAddress(props) {
9
+ const { address, type } = props;
10
+ const { environment } = usePassportContext();
11
+ const blockExplorerUrl = getAddressExplorerUrl(address, type, environment === "testnet");
12
+ const trimmedAddress = trimAddress(address);
13
+ const { icon: accountIcon } = getCryptoAsset(type === "bitcoin" ? "btc" : "eth");
14
+ const [, theme] = useStyletron();
15
+ const [, copy] = useCopyToClipboard();
16
+ const [isCopiedMessageVisible, setIsCopiedMessageVisible] = useState(false);
17
+ const handleCopyAddress = useCallback(() => {
18
+ copy(address);
19
+ setIsCopiedMessageVisible(true);
20
+ setTimeout(() => {
21
+ setIsCopiedMessageVisible(false);
22
+ }, 2000);
23
+ }, [copy, address]);
24
+ return (React.createElement(Block, { as: "button", onClick: handleCopyAddress, display: "flex", alignItems: "center", backgroundColor: "transparent", padding: `${theme.sizing.scale600} ${theme.sizing.scale500}`, overrides: {
25
+ Block: {
26
+ style: {
27
+ borderWidth: 0,
28
+ cursor: "pointer",
29
+ ":hover": {
30
+ backgroundColor: theme.colors.backgroundTertiary,
31
+ },
32
+ },
33
+ },
34
+ } },
35
+ React.createElement(Block, { as: accountIcon, size: theme.sizing.scale600 }),
36
+ isCopiedMessageVisible ? (React.createElement(ParagraphSmall, { margin: 0, marginLeft: theme.sizing.scale300, color: theme.colors.gray800 }, "Copied address to clipboard")) : (React.createElement(Block, { as: "a", marginLeft: theme.sizing.scale300, href: blockExplorerUrl, target: "_blank", overrides: {
37
+ Block: {
38
+ style: {
39
+ color: "inherit",
40
+ textDecoration: "none",
41
+ ":hover": {
42
+ textDecoration: "underline",
43
+ },
44
+ },
45
+ },
46
+ } },
47
+ React.createElement(ParagraphSmall, { display: "flex", alignItems: "center", margin: 0, color: theme.colors.gray800 },
48
+ trimmedAddress,
49
+ React.createElement(LinkIcon, { display: "inline", size: theme.sizing.scale550, overrides: {
50
+ Svg: {
51
+ style: {
52
+ stroke: "currentColor",
53
+ marginLeft: theme.sizing.scale200,
54
+ },
55
+ },
56
+ } })))),
57
+ React.createElement(CopyIcon, { size: theme.sizing.scale550, overrides: {
58
+ Svg: {
59
+ style: {
60
+ marginLeft: "auto",
61
+ stroke: "currentColor",
62
+ },
63
+ },
64
+ } })));
65
+ }
66
+ //# sourceMappingURL=AccountAddress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountAddress.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E;4BACR,cAAc,EAAE,WAAW;yBAC5B;qBACF;iBACF;aACF;YAED,oBAAC,cAAc,IACb,OAAO,EAAC,MAAM,EACd,UAAU,EAAC,QAAQ,EACnB,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO;gBAE1B,cAAc;gBACf,oBAAC,QAAQ,IACP,OAAO,EAAC,QAAQ,EAChB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC3B,SAAS,EAAE;wBACT,GAAG,EAAE;4BACH,KAAK,EAAE;gCACL,MAAM,EAAE,cAAc;gCACtB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ;6BAClC;yBACF;qBACF,GACD,CACa,CACX,CACT;QACD,oBAAC,QAAQ,IACP,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC3B,SAAS,EAAE;gBACT,GAAG,EAAE;oBACH,KAAK,EAAE;wBACL,UAAU,EAAE,MAAM;wBAClB,MAAM,EAAE,cAAc;qBACvB;iBACF;aACF,GACD,CACI,CACT,CAAA;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { CryptoAssetKey } from "../../utils/cryptoAssets";
3
+ type AccountAssetsProps = {
4
+ label: string | React.ReactNode;
5
+ assets: {
6
+ type: CryptoAssetKey;
7
+ decimals: number;
8
+ balance: number;
9
+ balanceInUsd: number;
10
+ }[];
11
+ };
12
+ export default function AccountAssets(props: AccountAssetsProps): React.JSX.Element | null;
13
+ export {};
14
+ //# sourceMappingURL=AccountAssets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountAssets.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/AccountAssets.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,cAAc,EAAkB,MAAM,0BAA0B,CAAA;AAGzE,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;IAC/B,MAAM,EAAE;QACN,IAAI,EAAE,cAAc,CAAA;QACpB,QAAQ,EAAE,MAAM,CAAA;QAChB,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,MAAM,CAAA;KACrB,EAAE,CAAA;CACJ,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,4BAyF9D"}