@mezo-org/passport 0.4.0-dev.2 → 0.4.0-dev.21
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/README.md +18 -22
- package/dist/src/api/auth.d.ts +57 -52
- package/dist/src/api/auth.d.ts.map +1 -1
- package/dist/src/api/auth.js +22 -53
- package/dist/src/api/auth.js.map +1 -1
- 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 +33 -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 +23 -0
- package/dist/src/components/Dropdown/Dropdown.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Dropdown.js +65 -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 +47 -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.js +2 -2
- package/dist/src/config.js.map +1 -1
- package/dist/src/constants.d.ts +2 -1
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +5 -4
- package/dist/src/constants.js.map +1 -1
- package/dist/src/hooks/constants.d.ts +3 -3
- package/dist/src/hooks/constants.js +4 -4
- package/dist/src/hooks/constants.js.map +1 -1
- package/dist/src/hooks/index.d.ts +4 -4
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +4 -4
- package/dist/src/hooks/index.js.map +1 -1
- 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 +1 -1
- package/dist/src/hooks/useAuthApiClient.d.ts.map +1 -1
- 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 +1418 -0
- package/dist/src/hooks/useBorrowData.d.ts.map +1 -0
- package/dist/src/hooks/useBorrowData.js +65 -0
- package/dist/src/hooks/useBorrowData.js.map +1 -0
- package/dist/src/hooks/useCreateAccount.d.ts +41 -137
- package/dist/src/hooks/useCreateAccount.d.ts.map +1 -1
- package/dist/src/hooks/useCreateAccount.js +8 -10
- package/dist/src/hooks/useCreateAccount.js.map +1 -1
- package/dist/src/hooks/useCreateSession.d.ts +12 -182
- package/dist/src/hooks/useCreateSession.d.ts.map +1 -1
- package/dist/src/hooks/useCreateSession.js +12 -18
- package/dist/src/hooks/useCreateSession.js.map +1 -1
- package/dist/src/hooks/useDropdownData.d.ts +39 -0
- package/dist/src/hooks/useDropdownData.d.ts.map +1 -0
- package/dist/src/hooks/useDropdownData.js +63 -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 +3 -5
- package/dist/src/hooks/useGetAccountByAddress.d.ts.map +1 -1
- package/dist/src/hooks/useGetAccountByAddress.js +3 -4
- package/dist/src/hooks/useGetAccountByAddress.js.map +1 -1
- package/dist/src/hooks/useGetAccountByMezoId.d.ts +3 -5
- package/dist/src/hooks/useGetAccountByMezoId.d.ts.map +1 -1
- package/dist/src/hooks/useGetAccountByMezoId.js +3 -4
- package/dist/src/hooks/useGetAccountByMezoId.js.map +1 -1
- package/dist/src/hooks/useGetCurrentAccount.d.ts +14 -8
- package/dist/src/hooks/useGetCurrentAccount.d.ts.map +1 -1
- package/dist/src/hooks/useGetCurrentAccount.js +28 -6
- package/dist/src/hooks/useGetCurrentAccount.js.map +1 -1
- package/dist/src/hooks/useGetSession.d.ts +3 -20
- package/dist/src/hooks/useGetSession.d.ts.map +1 -1
- package/dist/src/hooks/useGetSession.js +2 -2
- package/dist/src/hooks/useGetSession.js.map +1 -1
- package/dist/src/hooks/useLinkAccount.d.ts +15 -121
- package/dist/src/hooks/useLinkAccount.d.ts.map +1 -1
- package/dist/src/hooks/useLinkAccount.js +8 -21
- package/dist/src/hooks/useLinkAccount.js.map +1 -1
- 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 +17 -0
- package/dist/src/hooks/useRefreshPassport.d.ts.map +1 -0
- package/dist/src/hooks/useRefreshPassport.js +29 -0
- package/dist/src/hooks/useRefreshPassport.js.map +1 -0
- package/dist/src/hooks/useSignInWithDiscord.d.ts +12 -181
- package/dist/src/hooks/useSignInWithDiscord.d.ts.map +1 -1
- package/dist/src/hooks/useSignInWithDiscord.js +11 -22
- package/dist/src/hooks/useSignInWithDiscord.js.map +1 -1
- package/dist/src/hooks/useSignInWithWallet.d.ts +12 -181
- package/dist/src/hooks/useSignInWithWallet.d.ts.map +1 -1
- package/dist/src/hooks/useSignInWithWallet.js +6 -44
- package/dist/src/hooks/useSignInWithWallet.js.map +1 -1
- package/dist/src/hooks/useSignOut.d.ts +12 -28
- package/dist/src/hooks/useSignOut.d.ts.map +1 -1
- package/dist/src/hooks/useSignOut.js +11 -6
- package/dist/src/hooks/useSignOut.js.map +1 -1
- 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 +30 -82
- package/dist/src/hooks/useUpdateMezoId.d.ts.map +1 -1
- package/dist/src/hooks/useUpdateMezoId.js +8 -12
- package/dist/src/hooks/useUpdateMezoId.js.map +1 -1
- 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/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/contracts/index.d.ts +10 -0
- package/dist/src/lib/contracts/index.d.ts.map +1 -0
- package/dist/src/lib/contracts/index.js +49 -0
- package/dist/src/lib/contracts/index.js.map +1 -0
- package/dist/src/lib/contracts/musd.d.ts +107 -0
- package/dist/src/lib/contracts/musd.d.ts.map +1 -0
- package/dist/src/lib/contracts/musd.js +1070 -0
- package/dist/src/lib/contracts/musd.js.map +1 -0
- package/dist/src/lib/contracts/troveManager.d.ts +1401 -0
- package/dist/src/lib/contracts/troveManager.d.ts.map +1 -0
- package/dist/src/lib/contracts/troveManager.js +1820 -0
- package/dist/src/lib/contracts/troveManager.js.map +1 -0
- package/dist/src/provider.d.ts +10 -13
- package/dist/src/provider.d.ts.map +1 -1
- package/dist/src/provider.js +11 -20
- package/dist/src/provider.js.map +1 -1
- 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/package.json +12 -5
- package/src/api/auth.ts +104 -129
- package/src/api/client.ts +78 -0
- package/src/api/fetch-error.ts +8 -0
- package/src/api/index.ts +2 -0
- package/src/api/portal.ts +57 -0
- package/src/assets/DefaultAvatar.tsx +74 -0
- package/src/components/Dropdown/ConnectedTrigger.tsx +76 -0
- package/src/components/Dropdown/Content.tsx +98 -0
- package/src/components/Dropdown/DisconnectedTrigger.tsx +36 -0
- package/src/components/Dropdown/Dropdown.tsx +139 -0
- package/src/components/Dropdown/ListingItem.tsx +80 -0
- package/src/components/Dropdown/NestedViewLayout.tsx +75 -0
- package/src/components/Dropdown/README.md +41 -0
- package/src/components/Dropdown/Receive/Receive.tsx +119 -0
- package/src/components/Dropdown/Root/AccountAddressActions.tsx +101 -0
- package/src/components/Dropdown/Root/AccountAssetItem.tsx +26 -0
- package/src/components/Dropdown/Root/AccountBalance.tsx +30 -0
- package/src/components/Dropdown/Root/AccountOtherAssets.tsx +63 -0
- package/src/components/Dropdown/Root/Root.tsx +147 -0
- package/src/components/Dropdown/Root/WalletAddress.tsx +128 -0
- package/src/components/Dropdown/Root/WelcomeBlock.tsx +91 -0
- package/src/components/Dropdown/TestnetTopBanner.tsx +32 -0
- package/src/components/Dropdown/index.ts +2 -0
- package/src/components/index.ts +1 -0
- package/src/config.ts +2 -2
- package/src/constants.ts +5 -4
- package/src/hooks/constants.ts +4 -4
- package/src/hooks/index.ts +7 -4
- package/src/hooks/useAssetsConversionRates.ts +32 -0
- package/src/hooks/useAuthenticateWithWallet.ts +102 -0
- package/src/hooks/useBorrowData.ts +79 -0
- package/src/hooks/useCreateAccount.ts +20 -11
- package/src/hooks/useCreateSession.ts +24 -18
- package/src/hooks/useDropdownData.ts +101 -0
- package/src/hooks/useEnsureNoSessionAndFetchNonce.ts +46 -0
- package/src/hooks/useGetAccountByAddress.ts +11 -5
- package/src/hooks/useGetAccountByMezoId.ts +11 -5
- package/src/hooks/useGetCurrentAccount.ts +53 -7
- package/src/hooks/useGetSession.ts +10 -3
- package/src/hooks/useLinkAccount.ts +19 -31
- package/src/hooks/usePortalApiClient.ts +6 -0
- package/src/hooks/useRefreshPassport.ts +40 -0
- package/src/hooks/useSignInWithDiscord.ts +19 -28
- package/src/hooks/useSignInWithWallet.ts +14 -55
- package/src/hooks/useSignOut.ts +22 -6
- package/src/hooks/useSignUpWithWallet.ts +21 -0
- package/src/hooks/useTokensBalances.ts +187 -0
- package/src/hooks/useUpdateMezoId.ts +20 -12
- package/src/hooks/useWalletAccount.ts +55 -0
- package/src/index.ts +1 -0
- package/src/lib/contracts/index.ts +75 -0
- package/src/lib/contracts/musd.ts +1071 -0
- package/src/lib/contracts/troveManager.ts +1819 -0
- package/src/provider.ts +30 -37
- package/src/stores/dropdownStore.ts +20 -0
- package/src/utils/address.test.ts +48 -0
- package/src/utils/address.ts +45 -0
- package/src/utils/cryptoAssets.test.ts +79 -0
- package/src/utils/cryptoAssets.ts +173 -0
- package/src/utils/currency.test.ts +38 -0
- package/src/utils/currency.ts +32 -0
- package/src/utils/numbers.test.ts +220 -0
- package/src/utils/numbers.ts +188 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePortalApiClient.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePortalApiClient.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,qCAGjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePortalApiClient.js","sourceRoot":"","sources":["../../../src/hooks/usePortalApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,MAAM,UAAU,kBAAkB;IAChC,MAAM,EAAE,eAAe,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAChD,OAAO,eAAe,CAAA;AACxB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to refresh the passport using query invalidation mechanism.
|
|
3
|
+
* By calling the refresh function, the latest data will be refetched as soon as possible.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const { refreshCurrentAccount, refreshUsdConversion } = useRefreshPassport()
|
|
7
|
+
*
|
|
8
|
+
* // Call this function to refresh the current account
|
|
9
|
+
* const handlerefreshCurrentAccount = async () => {
|
|
10
|
+
* await refreshCurrentAccount()
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export declare function useRefreshPassport(): {
|
|
14
|
+
refreshCurrentAccount: () => Promise<void>;
|
|
15
|
+
refreshUsdConversion: () => Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useRefreshPassport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRefreshPassport.d.ts","sourceRoot":"","sources":["../../../src/hooks/useRefreshPassport.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB;;;EAuBjC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { QUERY_KEYS } from "./constants";
|
|
4
|
+
/**
|
|
5
|
+
* Hook to refresh the passport using query invalidation mechanism.
|
|
6
|
+
* By calling the refresh function, the latest data will be refetched as soon as possible.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const { refreshCurrentAccount, refreshUsdConversion } = useRefreshPassport()
|
|
10
|
+
*
|
|
11
|
+
* // Call this function to refresh the current account
|
|
12
|
+
* const handlerefreshCurrentAccount = async () => {
|
|
13
|
+
* await refreshCurrentAccount()
|
|
14
|
+
* }
|
|
15
|
+
*/
|
|
16
|
+
export function useRefreshPassport() {
|
|
17
|
+
const queryClient = useQueryClient();
|
|
18
|
+
const refreshCurrentAccount = useCallback(() => queryClient.invalidateQueries({
|
|
19
|
+
queryKey: [QUERY_KEYS.ACCOUNT, QUERY_KEYS.CURRENT],
|
|
20
|
+
}), [queryClient]);
|
|
21
|
+
const refreshUsdConversion = useCallback(() => queryClient.invalidateQueries({
|
|
22
|
+
queryKey: [QUERY_KEYS.ASSETS_USD_CONVERSION],
|
|
23
|
+
}), [queryClient]);
|
|
24
|
+
return {
|
|
25
|
+
refreshCurrentAccount,
|
|
26
|
+
refreshUsdConversion,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=useRefreshPassport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRefreshPassport.js","sourceRoot":"","sources":["../../../src/hooks/useRefreshPassport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IAEpC,MAAM,qBAAqB,GAAG,WAAW,CACvC,GAAG,EAAE,CACH,WAAW,CAAC,iBAAiB,CAAC;QAC5B,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;KACnD,CAAC,EACJ,CAAC,WAAW,CAAC,CACd,CAAA;IAED,MAAM,oBAAoB,GAAG,WAAW,CACtC,GAAG,EAAE,CACH,WAAW,CAAC,iBAAiB,CAAC;QAC5B,QAAQ,EAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC;KAC7C,CAAC,EACJ,CAAC,WAAW,CAAC,CACd,CAAA;IAED,OAAO;QACL,qBAAqB;QACrB,oBAAoB;KACrB,CAAA;AACH,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { MutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import type { AuthenticationProviderRedirectResponse } from "../api";
|
|
3
|
+
declare function useSignInWithDiscord(mutationOptions?: Omit<MutationOptions<AuthenticationProviderRedirectResponse>, "mutationFn" | "mutationKey">): {
|
|
2
4
|
data: undefined;
|
|
3
5
|
variables: undefined;
|
|
4
6
|
error: null;
|
|
@@ -13,46 +15,8 @@ declare function useSignInWithDiscord(): {
|
|
|
13
15
|
failureReason: Error | null;
|
|
14
16
|
isPaused: boolean;
|
|
15
17
|
submittedAt: number;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
token_type: string;
|
|
19
|
-
expires_in: number;
|
|
20
|
-
expires_at: number;
|
|
21
|
-
refresh_token: string;
|
|
22
|
-
user: {
|
|
23
|
-
app_metadata: {
|
|
24
|
-
provider: "wallet" | "discord" | "email";
|
|
25
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
26
|
-
};
|
|
27
|
-
user_metadata: {
|
|
28
|
-
mezoId?: string | undefined;
|
|
29
|
-
btcAddress: string;
|
|
30
|
-
evmAddress: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
} | {
|
|
34
|
-
redirectTo: string;
|
|
35
|
-
}, Error, void, unknown>;
|
|
36
|
-
signInAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
37
|
-
access_token: string;
|
|
38
|
-
token_type: string;
|
|
39
|
-
expires_in: number;
|
|
40
|
-
expires_at: number;
|
|
41
|
-
refresh_token: string;
|
|
42
|
-
user: {
|
|
43
|
-
app_metadata: {
|
|
44
|
-
provider: "wallet" | "discord" | "email";
|
|
45
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
46
|
-
};
|
|
47
|
-
user_metadata: {
|
|
48
|
-
mezoId?: string | undefined;
|
|
49
|
-
btcAddress: string;
|
|
50
|
-
evmAddress: string;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
} | {
|
|
54
|
-
redirectTo: string;
|
|
55
|
-
}, Error, void, unknown>;
|
|
18
|
+
signInWithDiscord: import("@tanstack/react-query").UseMutateFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
19
|
+
signInWithDiscordAsync: import("@tanstack/react-query").UseMutateAsyncFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
56
20
|
} | {
|
|
57
21
|
data: undefined;
|
|
58
22
|
variables: void;
|
|
@@ -68,46 +32,8 @@ declare function useSignInWithDiscord(): {
|
|
|
68
32
|
failureReason: Error | null;
|
|
69
33
|
isPaused: boolean;
|
|
70
34
|
submittedAt: number;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
token_type: string;
|
|
74
|
-
expires_in: number;
|
|
75
|
-
expires_at: number;
|
|
76
|
-
refresh_token: string;
|
|
77
|
-
user: {
|
|
78
|
-
app_metadata: {
|
|
79
|
-
provider: "wallet" | "discord" | "email";
|
|
80
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
81
|
-
};
|
|
82
|
-
user_metadata: {
|
|
83
|
-
mezoId?: string | undefined;
|
|
84
|
-
btcAddress: string;
|
|
85
|
-
evmAddress: string;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
} | {
|
|
89
|
-
redirectTo: string;
|
|
90
|
-
}, Error, void, unknown>;
|
|
91
|
-
signInAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
92
|
-
access_token: string;
|
|
93
|
-
token_type: string;
|
|
94
|
-
expires_in: number;
|
|
95
|
-
expires_at: number;
|
|
96
|
-
refresh_token: string;
|
|
97
|
-
user: {
|
|
98
|
-
app_metadata: {
|
|
99
|
-
provider: "wallet" | "discord" | "email";
|
|
100
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
101
|
-
};
|
|
102
|
-
user_metadata: {
|
|
103
|
-
mezoId?: string | undefined;
|
|
104
|
-
btcAddress: string;
|
|
105
|
-
evmAddress: string;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
} | {
|
|
109
|
-
redirectTo: string;
|
|
110
|
-
}, Error, void, unknown>;
|
|
35
|
+
signInWithDiscord: import("@tanstack/react-query").UseMutateFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
36
|
+
signInWithDiscordAsync: import("@tanstack/react-query").UseMutateAsyncFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
111
37
|
} | {
|
|
112
38
|
data: undefined;
|
|
113
39
|
error: Error;
|
|
@@ -123,67 +49,10 @@ declare function useSignInWithDiscord(): {
|
|
|
123
49
|
failureReason: Error | null;
|
|
124
50
|
isPaused: boolean;
|
|
125
51
|
submittedAt: number;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
token_type: string;
|
|
129
|
-
expires_in: number;
|
|
130
|
-
expires_at: number;
|
|
131
|
-
refresh_token: string;
|
|
132
|
-
user: {
|
|
133
|
-
app_metadata: {
|
|
134
|
-
provider: "wallet" | "discord" | "email";
|
|
135
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
136
|
-
};
|
|
137
|
-
user_metadata: {
|
|
138
|
-
mezoId?: string | undefined;
|
|
139
|
-
btcAddress: string;
|
|
140
|
-
evmAddress: string;
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
} | {
|
|
144
|
-
redirectTo: string;
|
|
145
|
-
}, Error, void, unknown>;
|
|
146
|
-
signInAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
147
|
-
access_token: string;
|
|
148
|
-
token_type: string;
|
|
149
|
-
expires_in: number;
|
|
150
|
-
expires_at: number;
|
|
151
|
-
refresh_token: string;
|
|
152
|
-
user: {
|
|
153
|
-
app_metadata: {
|
|
154
|
-
provider: "wallet" | "discord" | "email";
|
|
155
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
156
|
-
};
|
|
157
|
-
user_metadata: {
|
|
158
|
-
mezoId?: string | undefined;
|
|
159
|
-
btcAddress: string;
|
|
160
|
-
evmAddress: string;
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
} | {
|
|
164
|
-
redirectTo: string;
|
|
165
|
-
}, Error, void, unknown>;
|
|
52
|
+
signInWithDiscord: import("@tanstack/react-query").UseMutateFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
53
|
+
signInWithDiscordAsync: import("@tanstack/react-query").UseMutateAsyncFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
166
54
|
} | {
|
|
167
|
-
data:
|
|
168
|
-
access_token: string;
|
|
169
|
-
token_type: string;
|
|
170
|
-
expires_in: number;
|
|
171
|
-
expires_at: number;
|
|
172
|
-
refresh_token: string;
|
|
173
|
-
user: {
|
|
174
|
-
app_metadata: {
|
|
175
|
-
provider: "wallet" | "discord" | "email";
|
|
176
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
177
|
-
};
|
|
178
|
-
user_metadata: {
|
|
179
|
-
mezoId?: string | undefined;
|
|
180
|
-
btcAddress: string;
|
|
181
|
-
evmAddress: string;
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
} | {
|
|
185
|
-
redirectTo: string;
|
|
186
|
-
};
|
|
55
|
+
data: AuthenticationProviderRedirectResponse;
|
|
187
56
|
error: null;
|
|
188
57
|
variables: void;
|
|
189
58
|
isError: false;
|
|
@@ -197,46 +66,8 @@ declare function useSignInWithDiscord(): {
|
|
|
197
66
|
failureReason: Error | null;
|
|
198
67
|
isPaused: boolean;
|
|
199
68
|
submittedAt: number;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
token_type: string;
|
|
203
|
-
expires_in: number;
|
|
204
|
-
expires_at: number;
|
|
205
|
-
refresh_token: string;
|
|
206
|
-
user: {
|
|
207
|
-
app_metadata: {
|
|
208
|
-
provider: "wallet" | "discord" | "email";
|
|
209
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
210
|
-
};
|
|
211
|
-
user_metadata: {
|
|
212
|
-
mezoId?: string | undefined;
|
|
213
|
-
btcAddress: string;
|
|
214
|
-
evmAddress: string;
|
|
215
|
-
};
|
|
216
|
-
};
|
|
217
|
-
} | {
|
|
218
|
-
redirectTo: string;
|
|
219
|
-
}, Error, void, unknown>;
|
|
220
|
-
signInAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
221
|
-
access_token: string;
|
|
222
|
-
token_type: string;
|
|
223
|
-
expires_in: number;
|
|
224
|
-
expires_at: number;
|
|
225
|
-
refresh_token: string;
|
|
226
|
-
user: {
|
|
227
|
-
app_metadata: {
|
|
228
|
-
provider: "wallet" | "discord" | "email";
|
|
229
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
230
|
-
};
|
|
231
|
-
user_metadata: {
|
|
232
|
-
mezoId?: string | undefined;
|
|
233
|
-
btcAddress: string;
|
|
234
|
-
evmAddress: string;
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
} | {
|
|
238
|
-
redirectTo: string;
|
|
239
|
-
}, Error, void, unknown>;
|
|
69
|
+
signInWithDiscord: import("@tanstack/react-query").UseMutateFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
70
|
+
signInWithDiscordAsync: import("@tanstack/react-query").UseMutateAsyncFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
240
71
|
};
|
|
241
72
|
export { useSignInWithDiscord };
|
|
242
73
|
//# sourceMappingURL=useSignInWithDiscord.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignInWithDiscord.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignInWithDiscord.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSignInWithDiscord.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignInWithDiscord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAe,MAAM,uBAAuB,CAAA;AAGpE,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,QAAQ,CAAA;AAEpE,iBAAS,oBAAoB,CAC3B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,sCAAsC,CAAC,EACvD,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBP;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -1,34 +1,23 @@
|
|
|
1
|
-
import { useAccount } from "wagmi";
|
|
2
1
|
import { useMutation } from "@tanstack/react-query";
|
|
3
|
-
import { useGetSession } from "./useGetSession";
|
|
4
2
|
import { useCreateSession } from "./useCreateSession";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
enabled: false,
|
|
9
|
-
});
|
|
3
|
+
import { useEnsureNoSessionAndFetchNonce } from "./useEnsureNoSessionAndFetchNonce";
|
|
4
|
+
function useSignInWithDiscord(mutationOptions = {}) {
|
|
5
|
+
const { ensureNoSessionAndFetchNonce } = useEnsureNoSessionAndFetchNonce();
|
|
10
6
|
const { createSessionAsync } = useCreateSession();
|
|
11
7
|
const { mutate, mutateAsync, ...signInMutationRestParameters } = useMutation({
|
|
12
8
|
mutationFn: async () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
const getSessionResult = await getSession();
|
|
17
|
-
// TODO: We should create a separate endpoint that will always return nonce
|
|
18
|
-
if (!getSessionResult.data || !("nonce" in getSessionResult.data)) {
|
|
19
|
-
if (getSessionResult.error) {
|
|
20
|
-
throw new Error(`Sign in error: ${getSessionResult.error}`);
|
|
21
|
-
}
|
|
22
|
-
throw new Error("Sign in error: Nonce not available! Remove the session first.");
|
|
23
|
-
}
|
|
24
|
-
return createSessionAsync({
|
|
9
|
+
await ensureNoSessionAndFetchNonce();
|
|
10
|
+
return (await createSessionAsync({
|
|
25
11
|
type: "discord",
|
|
26
|
-
});
|
|
12
|
+
}));
|
|
13
|
+
// ^ By passing type: "discord" we know for sure the return type is
|
|
14
|
+
// AuthenticationProviderRedirectResponse
|
|
27
15
|
},
|
|
16
|
+
...mutationOptions,
|
|
28
17
|
});
|
|
29
18
|
return {
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
signInWithDiscord: mutate,
|
|
20
|
+
signInWithDiscordAsync: mutateAsync,
|
|
32
21
|
...signInMutationRestParameters,
|
|
33
22
|
};
|
|
34
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignInWithDiscord.js","sourceRoot":"","sources":["../../../src/hooks/useSignInWithDiscord.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useSignInWithDiscord.js","sourceRoot":"","sources":["../../../src/hooks/useSignInWithDiscord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAA;AAGnF,SAAS,oBAAoB,CAC3B,kBAGI,EAAE;IAEN,MAAM,EAAE,4BAA4B,EAAE,GAAG,+BAA+B,EAAE,CAAA;IAC1E,MAAM,EAAE,kBAAkB,EAAE,GAAG,gBAAgB,EAAE,CAAA;IAEjD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,4BAA4B,EAAE,GAAG,WAAW,CAAC;QAC3E,UAAU,EAAE,KAAK,IAAqD,EAAE;YACtE,MAAM,4BAA4B,EAAE,CAAA;YAEpC,OAAO,CAAC,MAAM,kBAAkB,CAAC;gBAC/B,IAAI,EAAE,SAAS;aAChB,CAAC,CAA2C,CAAA;YAC7C,mEAAmE;YACnE,yCAAyC;QAC3C,CAAC;QACD,GAAG,eAAe;KACnB,CAAC,CAAA;IAEF,OAAO;QACL,iBAAiB,EAAE,MAAM;QACzB,sBAAsB,EAAE,WAAW;QACnC,GAAG,4BAA4B;KAChC,CAAA;AACH,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { MutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import type { Session } from "../api";
|
|
3
|
+
declare function useSignInWithWallet(mutationOptions?: Omit<MutationOptions<Session>, "mutationFn" | "mutationKey">): {
|
|
2
4
|
data: undefined;
|
|
3
5
|
variables: undefined;
|
|
4
6
|
error: null;
|
|
@@ -13,46 +15,8 @@ declare function useSignInWithWallet(): {
|
|
|
13
15
|
failureReason: Error | null;
|
|
14
16
|
isPaused: boolean;
|
|
15
17
|
submittedAt: number;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
token_type: string;
|
|
19
|
-
expires_in: number;
|
|
20
|
-
expires_at: number;
|
|
21
|
-
refresh_token: string;
|
|
22
|
-
user: {
|
|
23
|
-
app_metadata: {
|
|
24
|
-
provider: "wallet" | "discord" | "email";
|
|
25
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
26
|
-
};
|
|
27
|
-
user_metadata: {
|
|
28
|
-
mezoId?: string | undefined;
|
|
29
|
-
btcAddress: string;
|
|
30
|
-
evmAddress: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
} | {
|
|
34
|
-
redirectTo: string;
|
|
35
|
-
}, Error, void, unknown>;
|
|
36
|
-
signInAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
37
|
-
access_token: string;
|
|
38
|
-
token_type: string;
|
|
39
|
-
expires_in: number;
|
|
40
|
-
expires_at: number;
|
|
41
|
-
refresh_token: string;
|
|
42
|
-
user: {
|
|
43
|
-
app_metadata: {
|
|
44
|
-
provider: "wallet" | "discord" | "email";
|
|
45
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
46
|
-
};
|
|
47
|
-
user_metadata: {
|
|
48
|
-
mezoId?: string | undefined;
|
|
49
|
-
btcAddress: string;
|
|
50
|
-
evmAddress: string;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
} | {
|
|
54
|
-
redirectTo: string;
|
|
55
|
-
}, Error, void, unknown>;
|
|
18
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
19
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
56
20
|
} | {
|
|
57
21
|
data: undefined;
|
|
58
22
|
variables: void;
|
|
@@ -68,46 +32,8 @@ declare function useSignInWithWallet(): {
|
|
|
68
32
|
failureReason: Error | null;
|
|
69
33
|
isPaused: boolean;
|
|
70
34
|
submittedAt: number;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
token_type: string;
|
|
74
|
-
expires_in: number;
|
|
75
|
-
expires_at: number;
|
|
76
|
-
refresh_token: string;
|
|
77
|
-
user: {
|
|
78
|
-
app_metadata: {
|
|
79
|
-
provider: "wallet" | "discord" | "email";
|
|
80
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
81
|
-
};
|
|
82
|
-
user_metadata: {
|
|
83
|
-
mezoId?: string | undefined;
|
|
84
|
-
btcAddress: string;
|
|
85
|
-
evmAddress: string;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
} | {
|
|
89
|
-
redirectTo: string;
|
|
90
|
-
}, Error, void, unknown>;
|
|
91
|
-
signInAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
92
|
-
access_token: string;
|
|
93
|
-
token_type: string;
|
|
94
|
-
expires_in: number;
|
|
95
|
-
expires_at: number;
|
|
96
|
-
refresh_token: string;
|
|
97
|
-
user: {
|
|
98
|
-
app_metadata: {
|
|
99
|
-
provider: "wallet" | "discord" | "email";
|
|
100
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
101
|
-
};
|
|
102
|
-
user_metadata: {
|
|
103
|
-
mezoId?: string | undefined;
|
|
104
|
-
btcAddress: string;
|
|
105
|
-
evmAddress: string;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
} | {
|
|
109
|
-
redirectTo: string;
|
|
110
|
-
}, Error, void, unknown>;
|
|
35
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
36
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
111
37
|
} | {
|
|
112
38
|
data: undefined;
|
|
113
39
|
error: Error;
|
|
@@ -123,67 +49,10 @@ declare function useSignInWithWallet(): {
|
|
|
123
49
|
failureReason: Error | null;
|
|
124
50
|
isPaused: boolean;
|
|
125
51
|
submittedAt: number;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
token_type: string;
|
|
129
|
-
expires_in: number;
|
|
130
|
-
expires_at: number;
|
|
131
|
-
refresh_token: string;
|
|
132
|
-
user: {
|
|
133
|
-
app_metadata: {
|
|
134
|
-
provider: "wallet" | "discord" | "email";
|
|
135
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
136
|
-
};
|
|
137
|
-
user_metadata: {
|
|
138
|
-
mezoId?: string | undefined;
|
|
139
|
-
btcAddress: string;
|
|
140
|
-
evmAddress: string;
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
} | {
|
|
144
|
-
redirectTo: string;
|
|
145
|
-
}, Error, void, unknown>;
|
|
146
|
-
signInAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
147
|
-
access_token: string;
|
|
148
|
-
token_type: string;
|
|
149
|
-
expires_in: number;
|
|
150
|
-
expires_at: number;
|
|
151
|
-
refresh_token: string;
|
|
152
|
-
user: {
|
|
153
|
-
app_metadata: {
|
|
154
|
-
provider: "wallet" | "discord" | "email";
|
|
155
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
156
|
-
};
|
|
157
|
-
user_metadata: {
|
|
158
|
-
mezoId?: string | undefined;
|
|
159
|
-
btcAddress: string;
|
|
160
|
-
evmAddress: string;
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
} | {
|
|
164
|
-
redirectTo: string;
|
|
165
|
-
}, Error, void, unknown>;
|
|
52
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
53
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
166
54
|
} | {
|
|
167
|
-
data:
|
|
168
|
-
access_token: string;
|
|
169
|
-
token_type: string;
|
|
170
|
-
expires_in: number;
|
|
171
|
-
expires_at: number;
|
|
172
|
-
refresh_token: string;
|
|
173
|
-
user: {
|
|
174
|
-
app_metadata: {
|
|
175
|
-
provider: "wallet" | "discord" | "email";
|
|
176
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
177
|
-
};
|
|
178
|
-
user_metadata: {
|
|
179
|
-
mezoId?: string | undefined;
|
|
180
|
-
btcAddress: string;
|
|
181
|
-
evmAddress: string;
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
} | {
|
|
185
|
-
redirectTo: string;
|
|
186
|
-
};
|
|
55
|
+
data: Session;
|
|
187
56
|
error: null;
|
|
188
57
|
variables: void;
|
|
189
58
|
isError: false;
|
|
@@ -197,46 +66,8 @@ declare function useSignInWithWallet(): {
|
|
|
197
66
|
failureReason: Error | null;
|
|
198
67
|
isPaused: boolean;
|
|
199
68
|
submittedAt: number;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
token_type: string;
|
|
203
|
-
expires_in: number;
|
|
204
|
-
expires_at: number;
|
|
205
|
-
refresh_token: string;
|
|
206
|
-
user: {
|
|
207
|
-
app_metadata: {
|
|
208
|
-
provider: "wallet" | "discord" | "email";
|
|
209
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
210
|
-
};
|
|
211
|
-
user_metadata: {
|
|
212
|
-
mezoId?: string | undefined;
|
|
213
|
-
btcAddress: string;
|
|
214
|
-
evmAddress: string;
|
|
215
|
-
};
|
|
216
|
-
};
|
|
217
|
-
} | {
|
|
218
|
-
redirectTo: string;
|
|
219
|
-
}, Error, void, unknown>;
|
|
220
|
-
signInAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
221
|
-
access_token: string;
|
|
222
|
-
token_type: string;
|
|
223
|
-
expires_in: number;
|
|
224
|
-
expires_at: number;
|
|
225
|
-
refresh_token: string;
|
|
226
|
-
user: {
|
|
227
|
-
app_metadata: {
|
|
228
|
-
provider: "wallet" | "discord" | "email";
|
|
229
|
-
providers: ("wallet" | "discord" | "email")[];
|
|
230
|
-
};
|
|
231
|
-
user_metadata: {
|
|
232
|
-
mezoId?: string | undefined;
|
|
233
|
-
btcAddress: string;
|
|
234
|
-
evmAddress: string;
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
} | {
|
|
238
|
-
redirectTo: string;
|
|
239
|
-
}, Error, void, unknown>;
|
|
69
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
70
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
240
71
|
};
|
|
241
72
|
export { useSignInWithWallet };
|
|
242
73
|
//# sourceMappingURL=useSignInWithWallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignInWithWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignInWithWallet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSignInWithWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignInWithWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,iBAAS,mBAAmB,CAC1B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,OAAO,CAAC,EACxB,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUP;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,48 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { useGetSession } from "./useGetSession";
|
|
5
|
-
import { useCreateSession } from "./useCreateSession";
|
|
6
|
-
import { createSignInWithWalletMessage } from "../utils/siww";
|
|
7
|
-
function useSignInWithWallet() {
|
|
8
|
-
console.log("use sign int with wallet broooo");
|
|
9
|
-
const { chainId, address, connector } = useAccount();
|
|
10
|
-
const { btcAddress } = useBitcoinAccount();
|
|
11
|
-
const { refetch: getSession } = useGetSession(undefined, {
|
|
12
|
-
enabled: false,
|
|
13
|
-
});
|
|
14
|
-
const { createSessionAsync } = useCreateSession();
|
|
15
|
-
const { signMessageAsync } = useSignMessage();
|
|
16
|
-
const { mutate, mutateAsync, ...signInMutationRestParameters } = useMutation({
|
|
17
|
-
mutationFn: async () => {
|
|
18
|
-
if (!address) {
|
|
19
|
-
throw new Error("Sign in error: User not connected!");
|
|
20
|
-
}
|
|
21
|
-
const getSessionResult = await getSession();
|
|
22
|
-
// TODO: We should create a separate endpoint that will always return nonce
|
|
23
|
-
if (!getSessionResult.data || !("nonce" in getSessionResult.data)) {
|
|
24
|
-
if (getSessionResult.error) {
|
|
25
|
-
throw new Error(`Sign in error: ${getSessionResult.error}`);
|
|
26
|
-
}
|
|
27
|
-
throw new Error("Sign in error: Nonce not available! Remove the session first.");
|
|
28
|
-
}
|
|
29
|
-
const networkFamily = btcAddress ? "bitcoin" : "evm";
|
|
30
|
-
const messageResult = createSignInWithWalletMessage(btcAddress ? btcAddress : address, getSessionResult.data.nonce, networkFamily, chainId);
|
|
31
|
-
const signatureResult = await signMessageAsync({
|
|
32
|
-
message: messageResult,
|
|
33
|
-
connector,
|
|
34
|
-
});
|
|
35
|
-
return createSessionAsync({
|
|
36
|
-
type: "wallet",
|
|
37
|
-
message: messageResult,
|
|
38
|
-
signature: signatureResult,
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
});
|
|
1
|
+
import { useAuthenticateWithWallet } from "./useAuthenticateWithWallet";
|
|
2
|
+
function useSignInWithWallet(mutationOptions = {}) {
|
|
3
|
+
const { authenticateWithWallet, authenticateWithWalletAsync, ...rest } = useAuthenticateWithWallet(false, mutationOptions);
|
|
42
4
|
return {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
...
|
|
5
|
+
signInWithWallet: authenticateWithWallet,
|
|
6
|
+
signInWithWalletAsync: authenticateWithWalletAsync,
|
|
7
|
+
...rest,
|
|
46
8
|
};
|
|
47
9
|
}
|
|
48
10
|
export { useSignInWithWallet };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignInWithWallet.js","sourceRoot":"","sources":["../../../src/hooks/useSignInWithWallet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSignInWithWallet.js","sourceRoot":"","sources":["../../../src/hooks/useSignInWithWallet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAGvE,SAAS,mBAAmB,CAC1B,kBAGI,EAAE;IAEN,MAAM,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,GAAG,IAAI,EAAE,GACpE,yBAAyB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;IAEnD,OAAO;QACL,gBAAgB,EAAE,sBAAsB;QACxC,qBAAqB,EAAE,2BAA2B;QAClD,GAAG,IAAI;KACR,CAAA;AACH,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|