@mezo-org/passport 0.4.0-dev.45 → 0.4.0-dev.47
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.
- package/dist/src/api/auth.d.ts +78 -0
- package/dist/src/api/auth.d.ts.map +1 -0
- package/dist/src/api/auth.js +77 -0
- package/dist/src/api/auth.js.map +1 -0
- package/dist/src/api/client.d.ts +24 -0
- package/dist/src/api/client.d.ts.map +1 -0
- package/dist/src/api/client.js +54 -0
- package/dist/src/api/client.js.map +1 -0
- package/dist/src/api/fetch-error.d.ts +5 -0
- package/dist/src/api/fetch-error.d.ts.map +1 -0
- package/dist/src/api/fetch-error.js +8 -0
- package/dist/src/api/fetch-error.js.map +1 -0
- package/dist/src/api/index.d.ts +3 -0
- package/dist/src/api/index.d.ts.map +1 -0
- package/dist/src/api/index.js +3 -0
- package/dist/src/api/index.js.map +1 -0
- package/dist/src/api/portal.d.ts +26 -0
- package/dist/src/api/portal.d.ts.map +1 -0
- package/dist/src/api/portal.js +23 -0
- package/dist/src/api/portal.js.map +1 -0
- package/dist/src/assets/DefaultAvatar.d.ts +5 -0
- package/dist/src/assets/DefaultAvatar.d.ts.map +1 -0
- package/dist/src/assets/DefaultAvatar.js +21 -0
- package/dist/src/assets/DefaultAvatar.js.map +1 -0
- package/dist/src/components/Dropdown/ConnectedTrigger.d.ts +8 -0
- package/dist/src/components/Dropdown/ConnectedTrigger.d.ts.map +1 -0
- package/dist/src/components/Dropdown/ConnectedTrigger.js +39 -0
- package/dist/src/components/Dropdown/ConnectedTrigger.js.map +1 -0
- package/dist/src/components/Dropdown/Content.d.ts +23 -0
- package/dist/src/components/Dropdown/Content.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Content.js +27 -0
- package/dist/src/components/Dropdown/Content.js.map +1 -0
- package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts +7 -0
- package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts.map +1 -0
- package/dist/src/components/Dropdown/DisconnectedTrigger.js +13 -0
- package/dist/src/components/Dropdown/DisconnectedTrigger.js.map +1 -0
- package/dist/src/components/Dropdown/Dropdown.d.ts +27 -0
- package/dist/src/components/Dropdown/Dropdown.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Dropdown.js +68 -0
- package/dist/src/components/Dropdown/Dropdown.js.map +1 -0
- package/dist/src/components/Dropdown/ListingItem.d.ts +13 -0
- package/dist/src/components/Dropdown/ListingItem.d.ts.map +1 -0
- package/dist/src/components/Dropdown/ListingItem.js +34 -0
- package/dist/src/components/Dropdown/ListingItem.js.map +1 -0
- package/dist/src/components/Dropdown/NestedViewLayout.d.ts +7 -0
- package/dist/src/components/Dropdown/NestedViewLayout.d.ts.map +1 -0
- package/dist/src/components/Dropdown/NestedViewLayout.js +34 -0
- package/dist/src/components/Dropdown/NestedViewLayout.js.map +1 -0
- package/dist/src/components/Dropdown/Receive/Receive.d.ts +7 -0
- package/dist/src/components/Dropdown/Receive/Receive.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Receive/Receive.js +53 -0
- package/dist/src/components/Dropdown/Receive/Receive.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts +7 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.js +48 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountAssetItem.d.ts +11 -0
- package/dist/src/components/Dropdown/Root/AccountAssetItem.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountAssetItem.js +9 -0
- package/dist/src/components/Dropdown/Root/AccountAssetItem.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.d.ts +8 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.js +15 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts +9 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.js +48 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.js.map +1 -0
- package/dist/src/components/Dropdown/Root/Root.d.ts +23 -0
- package/dist/src/components/Dropdown/Root/Root.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/Root.js +57 -0
- package/dist/src/components/Dropdown/Root/Root.js.map +1 -0
- package/dist/src/components/Dropdown/Root/WalletAddress.d.ts +8 -0
- package/dist/src/components/Dropdown/Root/WalletAddress.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/WalletAddress.js +64 -0
- package/dist/src/components/Dropdown/Root/WalletAddress.js.map +1 -0
- package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts +8 -0
- package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/WelcomeBlock.js +44 -0
- package/dist/src/components/Dropdown/Root/WelcomeBlock.js.map +1 -0
- package/dist/src/components/Dropdown/TestnetTopBanner.d.ts +3 -0
- package/dist/src/components/Dropdown/TestnetTopBanner.d.ts.map +1 -0
- package/dist/src/components/Dropdown/TestnetTopBanner.js +14 -0
- package/dist/src/components/Dropdown/TestnetTopBanner.js.map +1 -0
- package/dist/src/components/Dropdown/index.d.ts +3 -0
- package/dist/src/components/Dropdown/index.d.ts.map +1 -0
- package/dist/src/components/Dropdown/index.js +2 -0
- package/dist/src/components/Dropdown/index.js.map +1 -0
- package/dist/src/components/index.d.ts +2 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/index.js +2 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/config.d.ts +33 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +75 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/constants.d.ts +16 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +17 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/hooks/constants.d.ts +7 -0
- package/dist/src/hooks/constants.d.ts.map +1 -0
- package/dist/src/hooks/constants.js +7 -0
- package/dist/src/hooks/constants.js.map +1 -0
- package/dist/src/hooks/index.d.ts +15 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/index.js +15 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/useAssetsConversionRates.d.ts +7 -0
- package/dist/src/hooks/useAssetsConversionRates.d.ts.map +1 -0
- package/dist/src/hooks/useAssetsConversionRates.js +24 -0
- package/dist/src/hooks/useAssetsConversionRates.js.map +1 -0
- package/dist/src/hooks/useAuthApiClient.d.ts +2 -0
- package/dist/src/hooks/useAuthApiClient.d.ts.map +1 -0
- package/dist/src/hooks/useAuthApiClient.js +6 -0
- package/dist/src/hooks/useAuthApiClient.js.map +1 -0
- package/dist/src/hooks/useAuthenticateWithWallet.d.ts +73 -0
- package/dist/src/hooks/useAuthenticateWithWallet.d.ts.map +1 -0
- package/dist/src/hooks/useAuthenticateWithWallet.js +69 -0
- package/dist/src/hooks/useAuthenticateWithWallet.js.map +1 -0
- package/dist/src/hooks/useBorrowData.d.ts +60 -0
- package/dist/src/hooks/useBorrowData.d.ts.map +1 -0
- package/dist/src/hooks/useBorrowData.js +122 -0
- package/dist/src/hooks/useBorrowData.js.map +1 -0
- package/dist/src/hooks/useCreateAccount.d.ts +108 -0
- package/dist/src/hooks/useCreateAccount.d.ts.map +1 -0
- package/dist/src/hooks/useCreateAccount.js +21 -0
- package/dist/src/hooks/useCreateAccount.js.map +1 -0
- package/dist/src/hooks/useCreateSession.d.ts +76 -0
- package/dist/src/hooks/useCreateSession.d.ts.map +1 -0
- package/dist/src/hooks/useCreateSession.js +29 -0
- package/dist/src/hooks/useCreateSession.js.map +1 -0
- package/dist/src/hooks/useDropdownData.d.ts +47 -0
- package/dist/src/hooks/useDropdownData.d.ts.map +1 -0
- package/dist/src/hooks/useDropdownData.js +95 -0
- package/dist/src/hooks/useDropdownData.js.map +1 -0
- package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.d.ts +5 -0
- package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.d.ts.map +1 -0
- package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.js +34 -0
- package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.js.map +1 -0
- package/dist/src/hooks/useGetAccountByAddress.d.ts +4 -0
- package/dist/src/hooks/useGetAccountByAddress.d.ts.map +1 -0
- package/dist/src/hooks/useGetAccountByAddress.js +17 -0
- package/dist/src/hooks/useGetAccountByAddress.js.map +1 -0
- package/dist/src/hooks/useGetAccountByMezoId.d.ts +4 -0
- package/dist/src/hooks/useGetAccountByMezoId.d.ts.map +1 -0
- package/dist/src/hooks/useGetAccountByMezoId.js +17 -0
- package/dist/src/hooks/useGetAccountByMezoId.js.map +1 -0
- package/dist/src/hooks/useGetCurrentAccount.d.ts +18 -0
- package/dist/src/hooks/useGetCurrentAccount.d.ts.map +1 -0
- package/dist/src/hooks/useGetCurrentAccount.js +37 -0
- package/dist/src/hooks/useGetCurrentAccount.js.map +1 -0
- package/dist/src/hooks/useGetSession.d.ts +4 -0
- package/dist/src/hooks/useGetSession.d.ts.map +1 -0
- package/dist/src/hooks/useGetSession.js +15 -0
- package/dist/src/hooks/useGetSession.js.map +1 -0
- package/dist/src/hooks/useLinkAccount.d.ts +72 -0
- package/dist/src/hooks/useLinkAccount.d.ts.map +1 -0
- package/dist/src/hooks/useLinkAccount.js +19 -0
- package/dist/src/hooks/useLinkAccount.js.map +1 -0
- package/dist/src/hooks/usePassportContext.d.ts +3 -0
- package/dist/src/hooks/usePassportContext.d.ts.map +1 -0
- package/dist/src/hooks/usePassportContext.js +10 -0
- package/dist/src/hooks/usePassportContext.js.map +1 -0
- package/dist/src/hooks/usePortalApiClient.d.ts +2 -0
- package/dist/src/hooks/usePortalApiClient.d.ts.map +1 -0
- package/dist/src/hooks/usePortalApiClient.js +6 -0
- package/dist/src/hooks/usePortalApiClient.js.map +1 -0
- package/dist/src/hooks/useRefreshPassport.d.ts +19 -0
- package/dist/src/hooks/useRefreshPassport.d.ts.map +1 -0
- package/dist/src/hooks/useRefreshPassport.js +44 -0
- package/dist/src/hooks/useRefreshPassport.js.map +1 -0
- package/dist/src/hooks/useSignInWithDiscord.d.ts +73 -0
- package/dist/src/hooks/useSignInWithDiscord.d.ts.map +1 -0
- package/dist/src/hooks/useSignInWithDiscord.js +25 -0
- package/dist/src/hooks/useSignInWithDiscord.js.map +1 -0
- package/dist/src/hooks/useSignInWithWallet.d.ts +73 -0
- package/dist/src/hooks/useSignInWithWallet.d.ts.map +1 -0
- package/dist/src/hooks/useSignInWithWallet.js +11 -0
- package/dist/src/hooks/useSignInWithWallet.js.map +1 -0
- package/dist/src/hooks/useSignOut.d.ts +72 -0
- package/dist/src/hooks/useSignOut.d.ts.map +1 -0
- package/dist/src/hooks/useSignOut.js +22 -0
- package/dist/src/hooks/useSignOut.js.map +1 -0
- package/dist/src/hooks/useSignUpWithWallet.d.ts +73 -0
- package/dist/src/hooks/useSignUpWithWallet.d.ts.map +1 -0
- package/dist/src/hooks/useSignUpWithWallet.js +11 -0
- package/dist/src/hooks/useSignUpWithWallet.js.map +1 -0
- package/dist/src/hooks/useTokensBalances.d.ts +74 -0
- package/dist/src/hooks/useTokensBalances.d.ts.map +1 -0
- package/dist/src/hooks/useTokensBalances.js +140 -0
- package/dist/src/hooks/useTokensBalances.js.map +1 -0
- package/dist/src/hooks/useUpdateMezoId.d.ts +108 -0
- package/dist/src/hooks/useUpdateMezoId.d.ts.map +1 -0
- package/dist/src/hooks/useUpdateMezoId.js +19 -0
- package/dist/src/hooks/useUpdateMezoId.js.map +1 -0
- package/dist/src/hooks/useWalletAccount.d.ts +13 -0
- package/dist/src/hooks/useWalletAccount.d.ts.map +1 -0
- package/dist/src/hooks/useWalletAccount.js +29 -0
- package/dist/src/hooks/useWalletAccount.js.map +1 -0
- package/dist/src/hooks/useWatchTransferEvents.d.ts +5 -0
- package/dist/src/hooks/useWatchTransferEvents.d.ts.map +1 -0
- package/dist/src/hooks/useWatchTransferEvents.js +63 -0
- package/dist/src/hooks/useWatchTransferEvents.js.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/contracts/index.d.ts +13 -0
- package/dist/src/lib/contracts/index.d.ts.map +1 -0
- package/dist/src/lib/contracts/index.js +57 -0
- package/dist/src/lib/contracts/index.js.map +1 -0
- package/dist/src/provider.d.ts +17 -0
- package/dist/src/provider.d.ts.map +1 -0
- package/dist/src/provider.js +16 -0
- package/dist/src/provider.js.map +1 -0
- package/dist/src/stores/dropdownStore.d.ts +12 -0
- package/dist/src/stores/dropdownStore.d.ts.map +1 -0
- package/dist/src/stores/dropdownStore.js +13 -0
- package/dist/src/stores/dropdownStore.js.map +1 -0
- package/dist/src/utils/address.d.ts +15 -0
- package/dist/src/utils/address.d.ts.map +1 -0
- package/dist/src/utils/address.js +37 -0
- package/dist/src/utils/address.js.map +1 -0
- package/dist/src/utils/address.test.d.ts +2 -0
- package/dist/src/utils/address.test.d.ts.map +1 -0
- package/dist/src/utils/address.test.js +40 -0
- package/dist/src/utils/address.test.js.map +1 -0
- package/dist/src/utils/cryptoAssets.d.ts +44 -0
- package/dist/src/utils/cryptoAssets.d.ts.map +1 -0
- package/dist/src/utils/cryptoAssets.js +131 -0
- package/dist/src/utils/cryptoAssets.js.map +1 -0
- package/dist/src/utils/cryptoAssets.test.d.ts +2 -0
- package/dist/src/utils/cryptoAssets.test.d.ts.map +1 -0
- package/dist/src/utils/cryptoAssets.test.js +67 -0
- package/dist/src/utils/cryptoAssets.test.js.map +1 -0
- package/dist/src/utils/currency.d.ts +14 -0
- package/dist/src/utils/currency.d.ts.map +1 -0
- package/dist/src/utils/currency.js +27 -0
- package/dist/src/utils/currency.js.map +1 -0
- package/dist/src/utils/currency.test.d.ts +2 -0
- package/dist/src/utils/currency.test.d.ts.map +1 -0
- package/dist/src/utils/currency.test.js +34 -0
- package/dist/src/utils/currency.test.js.map +1 -0
- package/dist/src/utils/numbers.d.ts +58 -0
- package/dist/src/utils/numbers.d.ts.map +1 -0
- package/dist/src/utils/numbers.js +132 -0
- package/dist/src/utils/numbers.js.map +1 -0
- package/dist/src/utils/numbers.test.d.ts +2 -0
- package/dist/src/utils/numbers.test.d.ts.map +1 -0
- package/dist/src/utils/numbers.test.js +170 -0
- package/dist/src/utils/numbers.test.js.map +1 -0
- package/dist/src/utils/siww.d.ts +4 -0
- package/dist/src/utils/siww.d.ts.map +1 -0
- package/dist/src/utils/siww.js +19 -0
- package/dist/src/utils/siww.js.map +1 -0
- package/dist/src/utils/time.d.ts +5 -0
- package/dist/src/utils/time.d.ts.map +1 -0
- package/dist/src/utils/time.js +5 -0
- package/dist/src/utils/time.js.map +1 -0
- package/dist/src/wallet/index.d.ts +2 -0
- package/dist/src/wallet/index.d.ts.map +1 -0
- package/dist/src/wallet/index.js +2 -0
- package/dist/src/wallet/index.js.map +1 -0
- package/package.json +2 -2
- package/src/api/portal.ts +6 -13
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ApiClient } from "./client";
|
|
2
|
+
type AuthProvider = "discord";
|
|
3
|
+
export type LinkedWalletAccount = {
|
|
4
|
+
type: "wallet";
|
|
5
|
+
btcAddress?: string;
|
|
6
|
+
evmAddress: string;
|
|
7
|
+
};
|
|
8
|
+
export type LinkedProviderAccount = {
|
|
9
|
+
type: AuthProvider;
|
|
10
|
+
name: string;
|
|
11
|
+
id: string;
|
|
12
|
+
avatarUrl: string;
|
|
13
|
+
};
|
|
14
|
+
export type LinkedAccount = LinkedWalletAccount | LinkedProviderAccount;
|
|
15
|
+
type Account = {
|
|
16
|
+
mezoId: string;
|
|
17
|
+
hasModifiedMezoId: boolean;
|
|
18
|
+
linkedAccounts: LinkedAccount[];
|
|
19
|
+
};
|
|
20
|
+
export type Session = {
|
|
21
|
+
expiresIn: number;
|
|
22
|
+
expiresAt: number;
|
|
23
|
+
sessionLinks: {
|
|
24
|
+
_links: {
|
|
25
|
+
account: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type AuthenticationProviderRedirectResponse = {
|
|
30
|
+
redirectTo: string;
|
|
31
|
+
};
|
|
32
|
+
type SignatureData = {
|
|
33
|
+
message: string;
|
|
34
|
+
signature: string;
|
|
35
|
+
};
|
|
36
|
+
export type GetSessionResponse = Session | {
|
|
37
|
+
nonce: string;
|
|
38
|
+
};
|
|
39
|
+
export type CreateSessionRequest = ({
|
|
40
|
+
type: "wallet";
|
|
41
|
+
} & SignatureData) | {
|
|
42
|
+
type: "discord";
|
|
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
|
+
};
|
|
55
|
+
export type LinkAccountRequest = CreateSessionRequest;
|
|
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: {
|
|
63
|
+
mainnet: string;
|
|
64
|
+
testnet: string;
|
|
65
|
+
};
|
|
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>;
|
|
74
|
+
createAccount(createAccountRequest: CreateAccountRequest): Promise<Account>;
|
|
75
|
+
updateMezoId(newMezoId: string): Promise<Account>;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,KAAK,YAAY,GAAG,SAAS,CAAA;AAE7B,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,QAAQ,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,YAAY,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,qBAAqB,CAAA;AAEvE,KAAK,OAAO,GAAG;IACb,MAAM,EAAE,MAAM,CAAA;IACd,iBAAiB,EAAE,OAAO,CAAA;IAC1B,cAAc,EAAE,aAAa,EAAE,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,OAAO,GA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O,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"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ApiClient } from "./client";
|
|
2
|
+
import { FetchError } from "./fetch-error";
|
|
3
|
+
export const AUTH_API_ENDPOINTS_BY_ENV = {
|
|
4
|
+
mainnet: "https://api.mezo.org",
|
|
5
|
+
testnet: "https://api.test.mezo.org",
|
|
6
|
+
};
|
|
7
|
+
export class AuthApiClient extends ApiClient {
|
|
8
|
+
constructor(environment = "mainnet", apiUrl) {
|
|
9
|
+
super(apiUrl ?? AUTH_API_ENDPOINTS_BY_ENV[environment]);
|
|
10
|
+
}
|
|
11
|
+
async getSession(code) {
|
|
12
|
+
const data = await this.handleRequest("/session", {
|
|
13
|
+
method: "GET",
|
|
14
|
+
queryParams: { code },
|
|
15
|
+
});
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
async createSession(createSessionRequest) {
|
|
19
|
+
const data = await this.handleRequest("/session", {
|
|
20
|
+
method: "POST",
|
|
21
|
+
body: createSessionRequest,
|
|
22
|
+
});
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
async deleteSession() {
|
|
26
|
+
const data = await this.handleRequest("/session", {
|
|
27
|
+
method: "DELETE",
|
|
28
|
+
});
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
async getCurrentAccount() {
|
|
32
|
+
const data = await this.handleRequest("/session/account", {
|
|
33
|
+
method: "GET",
|
|
34
|
+
});
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
async getAccountByMezoIdOrAddress(mezoIdOrAddress) {
|
|
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
|
+
}
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
async linkAccount(linkAccountRequest) {
|
|
56
|
+
const data = await this.handleRequest("/session/account/linked-accounts", {
|
|
57
|
+
method: "POST",
|
|
58
|
+
body: linkAccountRequest,
|
|
59
|
+
});
|
|
60
|
+
return data;
|
|
61
|
+
}
|
|
62
|
+
async createAccount(createAccountRequest) {
|
|
63
|
+
const data = await this.handleRequest("/accounts", {
|
|
64
|
+
method: "POST",
|
|
65
|
+
body: createAccountRequest,
|
|
66
|
+
});
|
|
67
|
+
return data;
|
|
68
|
+
}
|
|
69
|
+
async updateMezoId(newMezoId) {
|
|
70
|
+
const data = await this.handleRequest("/session/account", {
|
|
71
|
+
method: "PATCH",
|
|
72
|
+
body: { mezoId: newMezoId },
|
|
73
|
+
});
|
|
74
|
+
return data;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,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AAC;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,EAAE,IAAI,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,CAAA;YAElE,kEAAkE;YAClE,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;YACtD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,eAAe,GAAG,QAAQ,EAAE,CAAC,CAAA;YAEpD,yEAAyE;YACzE,oCAAoC;YACpC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;iBACxB,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,sBAAsB;iBACnD,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,KAAM,CAAC,CAAC,CAAA;YAElE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;gBAChC,MAAM;gBACN,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC7C,GAAG,WAAW;aACf,CAAC,CAAA;YAEF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAElC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,IAAI,EAAE,KAAK,EAAE,CAAC;gBAChC,MAAM,KAAK,GACT,IAAI,EAAE,KAAK;oBACX,gDAAgD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAA;gBACxE,MAAM,IAAI,UAAU,CAClB,QAAQ,CAAC,MAAM,EACf,UAAU,QAAQ,CAAC,MAAM,MAAM,KAAK,EAAE,CACvC,CAAA;YACH,CAAC;YAED,OAAO,IAAS,CAAA;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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,26 @@
|
|
|
1
|
+
import { ApiClient } from "./client";
|
|
2
|
+
type PortalStatistics = {
|
|
3
|
+
hodlers: number;
|
|
4
|
+
depositedBitcoin: string;
|
|
5
|
+
tvl: number;
|
|
6
|
+
currentUsdPerBtc: string;
|
|
7
|
+
currentUsdPerEth: string;
|
|
8
|
+
currentUsdPerTToken: string;
|
|
9
|
+
usdPerBtc24hChange: string;
|
|
10
|
+
};
|
|
11
|
+
type PortalMats = {
|
|
12
|
+
totalMats: number;
|
|
13
|
+
inactiveMats: number;
|
|
14
|
+
matsActivated: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const PORTAL_API_ENDPOINTS_BY_ENV: {
|
|
17
|
+
mainnet: string;
|
|
18
|
+
testnet: string;
|
|
19
|
+
};
|
|
20
|
+
export declare class PortalApiClient extends ApiClient {
|
|
21
|
+
constructor(environment?: keyof typeof PORTAL_API_ENDPOINTS_BY_ENV, apiUrl?: string);
|
|
22
|
+
getPortalStatistics(): Promise<PortalStatistics>;
|
|
23
|
+
getPortalMats(address: string): Promise<PortalMats>;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
26
|
+
//# 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,mBAAmB,EAAE,MAAM,CAAA;IAC3B,kBAAkB,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,OAAO,CAAA;CACvB,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/",
|
|
4
|
+
testnet: "https://api.test.mezo.org/api/",
|
|
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("/v1/statistics", {
|
|
12
|
+
method: "GET",
|
|
13
|
+
});
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
async getPortalMats(address) {
|
|
17
|
+
const data = await this.handleRequest(`/v2/account/${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;AAkBpC,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,OAAO,EAAE,2BAA2B;IACpC,OAAO,EAAE,gCAAgC;CAC1C,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,gBAAgB,EAAE;YACxE,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,eAAe,OAAO,OAAO,EAC7B;YACE,MAAM,EAAE,KAAK;SACd,CACF,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
|
@@ -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":[],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,CAAC,EAAC,QAAQ,EACV,KAAK,EAAC,SAAS,EACf,MAAM,EAAC,SAAS,EAChB,IAAI,EAAC,SAAS,GACd;QACF,8BACE,CAAC,EAAC,SAAS,EACX,CAAC,EAAC,QAAQ,EACV,KAAK,EAAC,SAAS,EACf,MAAM,EAAC,SAAS,EAChB,IAAI,EAAC,SAAS,GACd;QACF,8BACE,CAAC,EAAC,SAAS,EACX,CAAC,EAAC,QAAQ,EACV,KAAK,EAAC,SAAS,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 { ButtonProps } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
declare const ConnectedTrigger: React.ForwardRefExoticComponent<Omit<ButtonProps, "size" | "children"> & {
|
|
4
|
+
avatar: ReactNode;
|
|
5
|
+
size?: "medium" | "large";
|
|
6
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
export default ConnectedTrigger;
|
|
8
|
+
//# sourceMappingURL=ConnectedTrigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectedTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/ConnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAgB,MAAM,qBAAqB,CAAA;AAC9E,OAAO,KAAK,EAAE,EAAc,SAAS,EAAW,MAAM,OAAO,CAAA;AAO7D,QAAA,MAAM,gBAAgB;YAJZ,SAAS;WACV,QAAQ,GAAG,OAAO;2CAoE1B,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Block, Button, useStyletron } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { forwardRef, useMemo } from "react";
|
|
3
|
+
const ConnectedTrigger = forwardRef((props, ref) => {
|
|
4
|
+
const { onClick, avatar, size = "medium", ...restProps } = props;
|
|
5
|
+
const [, theme] = useStyletron();
|
|
6
|
+
const avatarSize = useMemo(() => {
|
|
7
|
+
const sizeMap = {
|
|
8
|
+
medium: theme.sizing.scale950,
|
|
9
|
+
large: theme.sizing.scale1400,
|
|
10
|
+
};
|
|
11
|
+
return sizeMap[size];
|
|
12
|
+
}, [theme, size]);
|
|
13
|
+
const buttonPadding = useMemo(() => {
|
|
14
|
+
const paddingMap = {
|
|
15
|
+
medium: theme.sizing.scale0,
|
|
16
|
+
large: theme.sizing.scale100,
|
|
17
|
+
};
|
|
18
|
+
return paddingMap[size];
|
|
19
|
+
}, [theme, size]);
|
|
20
|
+
return (React.createElement(Button, { overrides: {
|
|
21
|
+
BaseButton: {
|
|
22
|
+
props: { ref, ...restProps },
|
|
23
|
+
style: {
|
|
24
|
+
borderRadius: "100%",
|
|
25
|
+
overflow: "hidden",
|
|
26
|
+
padding: buttonPadding,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}, onClick: onClick }, typeof avatar === "string" ? (React.createElement(Block, { width: avatarSize, height: avatarSize, as: "img", src: avatar, alt: "" })) : (React.createElement(Block, { width: avatarSize, height: avatarSize, overrides: {
|
|
30
|
+
Block: {
|
|
31
|
+
style: {
|
|
32
|
+
borderRadius: "100%",
|
|
33
|
+
overflow: "hidden",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
} }, avatar))));
|
|
37
|
+
});
|
|
38
|
+
export default ConnectedTrigger;
|
|
39
|
+
//# sourceMappingURL=ConnectedTrigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectedTrigger.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/ConnectedTrigger.tsx"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AEf,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAC5B,oBAAC,KAAK,IACJ,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,EAClB,EAAE,EAAC,KAAK,EACR,GAAG,EAAE,MAAM,EACX,GAAG,EAAC,EAAE,GACN,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,KAAK,IACJ,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,KAAK,EAAE;oBACL,YAAY,EAAE,MAAM;oBACpB,QAAQ,EAAE,QAAQ;iBACnB;aACF;SACF,IAEA,MAAM,CACD,CACT,CACM,CACV,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DetailedCryptoAsset } from "../../utils/cryptoAssets";
|
|
3
|
+
type ContentProps = {
|
|
4
|
+
mezoId: string;
|
|
5
|
+
matsBalance: number;
|
|
6
|
+
accountAddress: string;
|
|
7
|
+
walletAddress: string;
|
|
8
|
+
walletType: "bitcoin" | "evm";
|
|
9
|
+
usdTotalBalance: number;
|
|
10
|
+
usdTroveDebt: number;
|
|
11
|
+
usdCollateral: number;
|
|
12
|
+
assets: {
|
|
13
|
+
btc: DetailedCryptoAsset;
|
|
14
|
+
musd: DetailedCryptoAsset;
|
|
15
|
+
};
|
|
16
|
+
otherAssetsCount: number;
|
|
17
|
+
otherAssetsUsdTotal: number;
|
|
18
|
+
onSignOut?: () => void;
|
|
19
|
+
onOtherAssetsClick?: () => void;
|
|
20
|
+
};
|
|
21
|
+
declare function Content(props: ContentProps): React.JSX.Element;
|
|
22
|
+
export default Content;
|
|
23
|
+
//# sourceMappingURL=Content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/Content.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAIxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAG9D,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,SAAS,GAAG,KAAK,CAAA;IAC7B,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE;QACN,GAAG,EAAE,mBAAmB,CAAA;QACxB,IAAI,EAAE,mBAAmB,CAAA;KAC1B,CAAA;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAA;CAChC,CAAA;AAED,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,qBAoEnC;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Block, useStyletron } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { useEffect } from "react";
|
|
3
|
+
import useDropdownStore, { DropdownView } from "../../stores/dropdownStore";
|
|
4
|
+
import Root from "./Root/Root";
|
|
5
|
+
import Receive from "./Receive/Receive";
|
|
6
|
+
import TestnetTopBanner from "./TestnetTopBanner";
|
|
7
|
+
function Content(props) {
|
|
8
|
+
const { mezoId, accountAddress, walletAddress, walletType, usdTotalBalance, assets, matsBalance, usdTroveDebt, usdCollateral, otherAssetsCount, otherAssetsUsdTotal, onSignOut, onOtherAssetsClick, } = props;
|
|
9
|
+
const [_, theme] = useStyletron();
|
|
10
|
+
const currentView = useDropdownStore((state) => state.view);
|
|
11
|
+
const setView = useDropdownStore((state) => state.setView);
|
|
12
|
+
useEffect(() => () => {
|
|
13
|
+
setView(DropdownView.ROOT);
|
|
14
|
+
}, [setView]);
|
|
15
|
+
return (React.createElement(Block, { display: "inline-flex", flexDirection: "column", backgroundColor: theme.colors.backgroundPrimary, width: "100%", overrides: {
|
|
16
|
+
Block: {
|
|
17
|
+
style: {
|
|
18
|
+
boxSizing: "border-box",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
} },
|
|
22
|
+
React.createElement(TestnetTopBanner, null),
|
|
23
|
+
currentView === DropdownView.ROOT && (React.createElement(Root, { mezoId: mezoId, accountAddress: accountAddress, walletAddress: walletAddress, walletType: walletType, usdTotalBalance: usdTotalBalance, assets: assets, matsBalance: matsBalance, usdTroveDebt: usdTroveDebt, usdCollateral: usdCollateral, otherAssetsCount: otherAssetsCount, otherAssetsUsdTotal: otherAssetsUsdTotal, onSignOut: onSignOut, onOtherAssetsClick: onOtherAssetsClick })),
|
|
24
|
+
currentView === DropdownView.RECEIVE && (React.createElement(Receive, { address: accountAddress }))));
|
|
25
|
+
}
|
|
26
|
+
export default Content;
|
|
27
|
+
//# sourceMappingURL=Content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/Content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,gBAAgB,EAAE,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC3E,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,OAAO,MAAM,mBAAmB,CAAA;AAEvC,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AAqBjD,SAAS,OAAO,CAAC,KAAmB;IAClC,MAAM,EACJ,MAAM,EACN,cAAc,EACd,aAAa,EACb,UAAU,EACV,eAAe,EACf,MAAM,EACN,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ACvC,oBAAC,OAAO,IAAC,OAAO,EAAE,cAAc,GAAI,CACrC,CACK,CACT,CAAA;AACH,CAAC;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ButtonProps } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React from "react";
|
|
3
|
+
declare const DisconnectedTrigger: React.ForwardRefExoticComponent<Omit<ButtonProps, "children"> & {
|
|
4
|
+
children: string;
|
|
5
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
export default DisconnectedTrigger;
|
|
7
|
+
//# sourceMappingURL=DisconnectedTrigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DisconnectedTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/DisconnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,WAAW,EAAyB,MAAM,qBAAqB,CAAA;AAChF,OAAO,KAAqB,MAAM,OAAO,CAAA;AAMzC,QAAA,MAAM,mBAAmB;cAHb,MAAM;2CA6BhB,CAAA;AAEF,eAAe,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button, LogIn01, useStyletron } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
const DisconnectedTrigger = forwardRef((props, ref) => {
|
|
4
|
+
const { onClick, children, ...restProps } = props;
|
|
5
|
+
const [, theme] = useStyletron();
|
|
6
|
+
return (React.createElement(Button, { startEnhancer: React.createElement(LogIn01, { color: "currentColor", size: theme.sizing.scale600 }), overrides: {
|
|
7
|
+
Root: {
|
|
8
|
+
props: { ref },
|
|
9
|
+
},
|
|
10
|
+
}, size: "small", shape: "pill", onClick: onClick, ...restProps }, children));
|
|
11
|
+
});
|
|
12
|
+
export default DisconnectedTrigger;
|
|
13
|
+
//# sourceMappingURL=DisconnectedTrigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DisconnectedTrigger.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/DisconnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAMzC,MAAM,mBAAmB,GAAG,UAAU,CAGpC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACf,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAA;IAEjD,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,YAAY,EAAE,CAAA;IAEhC,OAAO,CACL,oBAAC,MAAM,IACL,aAAa,EACX,oBAAC,OAAO,IAAC,KAAK,EAAC,cAAc,EAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAI,EAE/D,SAAS,EAAE;YACT,IAAI,EAAE;gBACJ,KAAK,EAAE,EAAE,GAAG,EAAE;aACf;SACF,EACD,IAAI,EAAC,OAAO,EACZ,KAAK,EAAC,MAAM,EACZ,OAAO,EAAE,OAAO,KACZ,SAAS,IAEZ,QAAQ,CACF,CACV,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ButtonProps, StatefulPopoverProps } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export type DropdownProps = {
|
|
4
|
+
/** The callback to be called when the user clicks the sign-out button */
|
|
5
|
+
onSignOut?: () => void;
|
|
6
|
+
/** The callback to be called when the user clicks the button in sign-in state */
|
|
7
|
+
onSignIn?: () => void;
|
|
8
|
+
/** The props to be passed to the trigger button */
|
|
9
|
+
triggerProps?: {
|
|
10
|
+
signedIn?: Omit<ButtonProps, "onClick" | "size"> & {
|
|
11
|
+
size: "medium" | "large";
|
|
12
|
+
};
|
|
13
|
+
signedOut?: Omit<ButtonProps, "onClick">;
|
|
14
|
+
};
|
|
15
|
+
onOtherAssetsClick?: () => void;
|
|
16
|
+
/** Time in milliseconds after which account data (like mats or mezo id) in dropdown should be re-fetched. Default is 90000 (90 secs) */
|
|
17
|
+
accountDataRefetchInterval?: number;
|
|
18
|
+
/** Time in milliseconds after which native balance in dropdown should be re-fetched. Default is 90000 (90 secs) */
|
|
19
|
+
nativeBalanceRefetchInterval?: number;
|
|
20
|
+
} & Omit<StatefulPopoverProps, "children" | "content">;
|
|
21
|
+
/**
|
|
22
|
+
* Passport Dropdown component that displays user's wallet and assets information.
|
|
23
|
+
* @param {DropdownProps} props - Component props.
|
|
24
|
+
* @returns {JSX.Element}
|
|
25
|
+
*/
|
|
26
|
+
export declare function Dropdown(props: DropdownProps): React.JSX.Element;
|
|
27
|
+
//# sourceMappingURL=Dropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,oBAAoB,EAErB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAA6B,MAAM,OAAO,CAAA;AAUjD,MAAM,MAAM,aAAa,GAAG;IAC1B,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,mDAAmD;IACnD,YAAY,CAAC,EAAE;QACb,QAAQ,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,GAAG;YACjD,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAA;SACzB,CAAA;QACD,SAAS,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;KACzC,CAAA;IACD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC/B,wIAAwI;IACxI,0BAA0B,CAAC,EAAE,MAAM,CAAA;IACnC,mHAAmH;IACnH,4BAA4B,CAAC,EAAE,MAAM,CAAA;CACtC,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,SAAS,CAAC,CAAA;AAEtD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,qBA0G5C"}
|