@mezo-org/passport 0.4.0-dev.2 → 0.4.0-dev.20
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 +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 +32 -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 +9 -0
- package/dist/src/components/Dropdown/Content.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Content.js +25 -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 +64 -0
- package/dist/src/components/Dropdown/Dropdown.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/AccountAssets.d.ts +13 -0
- package/dist/src/components/Dropdown/Root/AccountAssets.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountAssets.js +43 -0
- package/dist/src/components/Dropdown/Root/AccountAssets.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.d.ts +7 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.js +16 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.js.map +1 -0
- package/dist/src/components/Dropdown/Root/Root.d.ts +8 -0
- package/dist/src/components/Dropdown/Root/Root.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/Root.js +64 -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 +65 -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 +43 -0
- package/dist/src/components/Dropdown/Root/WelcomeBlock.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/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 +2 -4
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +2 -4
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/useAssetsUSDConversion.d.ts +8 -0
- package/dist/src/hooks/useAssetsUSDConversion.d.ts.map +1 -0
- package/dist/src/hooks/useAssetsUSDConversion.js +21 -0
- package/dist/src/hooks/useAssetsUSDConversion.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/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 +45 -0
- package/dist/src/hooks/useDropdownData.d.ts.map +1 -0
- package/dist/src/hooks/useDropdownData.js +80 -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/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 +12 -0
- package/dist/src/hooks/useWalletAccount.d.ts.map +1 -0
- package/dist/src/hooks/useWalletAccount.js +28 -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/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 +28 -0
- package/dist/src/utils/cryptoAssets.d.ts.map +1 -0
- package/dist/src/utils/cryptoAssets.js +73 -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 +50 -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 +45 -0
- package/dist/src/utils/numbers.d.ts.map +1 -0
- package/dist/src/utils/numbers.js +86 -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 +10 -4
- 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 +56 -0
- package/src/assets/DefaultAvatar.tsx +74 -0
- package/src/components/Dropdown/ConnectedTrigger.tsx +76 -0
- package/src/components/Dropdown/Content.tsx +62 -0
- package/src/components/Dropdown/DisconnectedTrigger.tsx +36 -0
- package/src/components/Dropdown/Dropdown.tsx +124 -0
- package/src/components/Dropdown/NestedViewLayout.tsx +75 -0
- package/src/components/Dropdown/README.md +55 -0
- package/src/components/Dropdown/Receive/Receive.tsx +119 -0
- package/src/components/Dropdown/Root/AccountAddressActions.tsx +101 -0
- package/src/components/Dropdown/Root/AccountAssets.tsx +108 -0
- package/src/components/Dropdown/Root/AccountBalance.tsx +35 -0
- package/src/components/Dropdown/Root/Root.tsx +141 -0
- package/src/components/Dropdown/Root/WalletAddress.tsx +128 -0
- package/src/components/Dropdown/Root/WelcomeBlock.tsx +91 -0
- package/src/components/Dropdown/index.ts +2 -0
- package/src/components/index.ts +1 -0
- package/src/hooks/constants.ts +4 -4
- package/src/hooks/index.ts +2 -4
- package/src/hooks/useAssetsUSDConversion.ts +31 -0
- package/src/hooks/useAuthenticateWithWallet.ts +98 -0
- package/src/hooks/useCreateAccount.ts +20 -11
- package/src/hooks/useCreateSession.ts +24 -18
- package/src/hooks/useDropdownData.ts +160 -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/useUpdateMezoId.ts +20 -12
- package/src/hooks/useWalletAccount.ts +53 -0
- package/src/index.ts +1 -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 +61 -0
- package/src/utils/cryptoAssets.ts +93 -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 +120 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Block, HeadingSmall, LabelSmall, Mats, useStyletron, } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import DefaultAvatar from "../../../assets/DefaultAvatar";
|
|
4
|
+
const DOT_DELIMITER_REGEX = /(?=\.)/;
|
|
5
|
+
export default function WelcomeBlock(props) {
|
|
6
|
+
const { mezoId, matsBalance } = props;
|
|
7
|
+
const [name, nameSuffix] = mezoId.split(DOT_DELIMITER_REGEX);
|
|
8
|
+
const [, theme] = useStyletron();
|
|
9
|
+
return (React.createElement(Block, { display: "flex", alignItems: "center", padding: `${theme.sizing.scale600} 0`, marginBottom: theme.sizing.scale300, overrides: {
|
|
10
|
+
Block: {
|
|
11
|
+
style: {
|
|
12
|
+
gap: theme.sizing.scale600,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
} },
|
|
16
|
+
React.createElement(Block, { as: DefaultAvatar, width: theme.sizing.scale1200, height: theme.sizing.scale1200, overrides: {
|
|
17
|
+
Block: {
|
|
18
|
+
style: {
|
|
19
|
+
borderRadius: "100%",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
} }),
|
|
23
|
+
React.createElement(Block, { display: "flex", flexDirection: "column", overrides: {
|
|
24
|
+
Block: {
|
|
25
|
+
style: {
|
|
26
|
+
gap: theme.sizing.scale100,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
} },
|
|
30
|
+
React.createElement(HeadingSmall, { as: "span" },
|
|
31
|
+
React.createElement(Block, { as: "span" }, name),
|
|
32
|
+
React.createElement(Block, { as: "span", color: theme.colors.gray500 }, nameSuffix)),
|
|
33
|
+
React.createElement(LabelSmall, { display: "flex", alignItems: "center", margin: 0, color: theme.colors.contentTertiary, overrides: {
|
|
34
|
+
Block: {
|
|
35
|
+
style: {
|
|
36
|
+
gap: theme.sizing.scale300,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
} },
|
|
40
|
+
React.createElement(Mats, { color: theme.colors.contentPrimary, size: theme.sizing.scale600 }),
|
|
41
|
+
matsBalance))));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=WelcomeBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WelcomeBlock.js","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/WelcomeBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,YAAY,GACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,aAAa,MAAM,+BAA+B,CAAA;AAEzD,MAAM,mBAAmB,GAAG,QAAQ,CAAA;AAOpC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAwB;IAC3D,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAA;IAErC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC5D,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,YAAY,EAAE,CAAA;IAEhC,OAAO,CACL,oBAAC,KAAK,IACJ,OAAO,EAAC,MAAM,EACd,UAAU,EAAC,QAAQ,EACnB,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,EACrC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EACnC,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,KAAK,EAAE;oBACL,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ;iBAC3B;aACF;SACF;QAED,oBAAC,KAAK,IACJ,EAAE,EAAE,aAAa,EACjB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,EAC7B,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,EAC9B,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,KAAK,EAAE;wBACL,YAAY,EAAE,MAAM;qBACrB;iBACF;aACF,GACD;QAEF,oBAAC,KAAK,IACJ,OAAO,EAAC,MAAM,EACd,aAAa,EAAC,QAAQ,EACtB,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,KAAK,EAAE;wBACL,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ;qBAC3B;iBACF;aACF;YAED,oBAAC,YAAY,IAAC,EAAE,EAAC,MAAM;gBACrB,oBAAC,KAAK,IAAC,EAAE,EAAC,MAAM,IAAE,IAAI,CAAS;gBAC/B,oBAAC,KAAK,IAAC,EAAE,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,IACzC,UAAU,CACL,CACK;YAEf,oBAAC,UAAU,IACT,OAAO,EAAC,MAAM,EACd,UAAU,EAAC,QAAQ,EACnB,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,EACnC,SAAS,EAAE;oBACT,KAAK,EAAE;wBACL,KAAK,EAAE;4BACL,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ;yBAC3B;qBACF;iBACF;gBAED,oBAAC,IAAI,IACH,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc,EAClC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,GAC3B;gBACD,WAAW,CACD,CACP,CACF,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const QUERY_KEYS = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
ACCOUNT: "account",
|
|
3
|
+
SESSION: "session",
|
|
4
|
+
CURRENT: "current",
|
|
5
|
+
ASSETS_USD_CONVERSION: "assetsUsdConversion",
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/hooks/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/hooks/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,qBAAqB,EAAE,qBAAqB;CAC7C,CAAA"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
export { useBitcoinAccount, useSendBitcoin, useSendTransaction, useSubscribeToConnectedToUnsupportedBitcoinAddress, useSubscribeToConnectorEvent, useSubscribeToWalletNetworkDoesNotMatchProviderChain, } from "@mezo-org/orangekit";
|
|
2
|
-
export * from "./constants";
|
|
3
|
-
export * from "./useAuthApiClient";
|
|
4
|
-
export * from "./useCreateAccount";
|
|
5
2
|
export * from "./useGetAccountByAddress";
|
|
6
3
|
export * from "./useGetAccountByMezoId";
|
|
7
4
|
export * from "./useGetCurrentAccount";
|
|
8
5
|
export * from "./useGetSession";
|
|
9
6
|
export * from "./useLinkAccount";
|
|
10
|
-
export * from "./usePassportContext";
|
|
11
7
|
export * from "./useSignInWithDiscord";
|
|
12
8
|
export * from "./useSignInWithWallet";
|
|
13
9
|
export * from "./useSignOut";
|
|
10
|
+
export * from "./useSignUpWithWallet";
|
|
14
11
|
export * from "./useUpdateMezoId";
|
|
12
|
+
export * from "./useRefreshPassport";
|
|
15
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,kDAAkD,EAClD,4BAA4B,EAC5B,oDAAoD,GACrD,MAAM,qBAAqB,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,kDAAkD,EAClD,4BAA4B,EAC5B,oDAAoD,GACrD,MAAM,qBAAqB,CAAA;AAC5B,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA"}
|
package/dist/src/hooks/index.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
export { useBitcoinAccount, useSendBitcoin, useSendTransaction, useSubscribeToConnectedToUnsupportedBitcoinAddress, useSubscribeToConnectorEvent, useSubscribeToWalletNetworkDoesNotMatchProviderChain, } from "@mezo-org/orangekit";
|
|
2
|
-
export * from "./constants";
|
|
3
|
-
export * from "./useAuthApiClient";
|
|
4
|
-
export * from "./useCreateAccount";
|
|
5
2
|
export * from "./useGetAccountByAddress";
|
|
6
3
|
export * from "./useGetAccountByMezoId";
|
|
7
4
|
export * from "./useGetCurrentAccount";
|
|
8
5
|
export * from "./useGetSession";
|
|
9
6
|
export * from "./useLinkAccount";
|
|
10
|
-
export * from "./usePassportContext";
|
|
11
7
|
export * from "./useSignInWithDiscord";
|
|
12
8
|
export * from "./useSignInWithWallet";
|
|
13
9
|
export * from "./useSignOut";
|
|
10
|
+
export * from "./useSignUpWithWallet";
|
|
14
11
|
export * from "./useUpdateMezoId";
|
|
12
|
+
export * from "./useRefreshPassport";
|
|
15
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,kDAAkD,EAClD,4BAA4B,EAC5B,oDAAoD,GACrD,MAAM,qBAAqB,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,kDAAkD,EAClD,4BAA4B,EAC5B,oDAAoD,GACrD,MAAM,qBAAqB,CAAA;AAC5B,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseBaseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
type AssetsUsdConversion = {
|
|
3
|
+
btcUsd: string;
|
|
4
|
+
ethUsd: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function useAssetsUsdConversion(useQueryOptions?: Partial<UseBaseQueryOptions<AssetsUsdConversion>>): import("@tanstack/react-query").UseQueryResult<AssetsUsdConversion, Error>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=useAssetsUSDConversion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAssetsUSDConversion.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAssetsUSDConversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAY,MAAM,uBAAuB,CAAA;AAKrE,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAgB,sBAAsB,CACpC,eAAe,GAAE,OAAO,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAM,8EAmBxE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { ONE_MINUTE_MS } from "../utils/time";
|
|
3
|
+
import { QUERY_KEYS } from "./constants";
|
|
4
|
+
import { usePortalApiClient } from "./usePortalApiClient";
|
|
5
|
+
export function useAssetsUsdConversion(useQueryOptions = {}) {
|
|
6
|
+
const portalApiClient = usePortalApiClient();
|
|
7
|
+
return useQuery({
|
|
8
|
+
queryKey: [QUERY_KEYS.ASSETS_USD_CONVERSION],
|
|
9
|
+
queryFn: async () => {
|
|
10
|
+
const { currentUsdPerBtc, currentUsdPerEth } = await portalApiClient.getPortalStatistics();
|
|
11
|
+
return {
|
|
12
|
+
btcUsd: currentUsdPerBtc,
|
|
13
|
+
ethUsd: currentUsdPerEth,
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
staleTime: 30 * ONE_MINUTE_MS,
|
|
17
|
+
retry: 1,
|
|
18
|
+
...useQueryOptions,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=useAssetsUSDConversion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAssetsUSDConversion.js","sourceRoot":"","sources":["../../../src/hooks/useAssetsUSDConversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAOzD,MAAM,UAAU,sBAAsB,CACpC,kBAAqE,EAAE;IAEvE,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAA;IAE5C,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC;QAC5C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAC1C,MAAM,eAAe,CAAC,mBAAmB,EAAE,CAAA;YAE7C,OAAO;gBACL,MAAM,EAAE,gBAAgB;gBACxB,MAAM,EAAE,gBAAgB;aACzB,CAAA;QACH,CAAC;QACD,SAAS,EAAE,EAAE,GAAG,aAAa;QAC7B,KAAK,EAAE,CAAC;QACR,GAAG,eAAe;KACnB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function useAuthApiClient(): import("../api
|
|
1
|
+
export declare function useAuthApiClient(): import("../api").AuthApiClient;
|
|
2
2
|
//# sourceMappingURL=useAuthApiClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthApiClient.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAuthApiClient.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"useAuthApiClient.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAuthApiClient.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,mCAG/B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { MutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import type { Session } from "../api";
|
|
3
|
+
declare function useAuthenticateWithWallet(shouldCreateAccount?: boolean, mutationOptions?: Omit<MutationOptions<Session>, "mutationFn" | "mutationKey">): {
|
|
4
|
+
data: undefined;
|
|
5
|
+
variables: undefined;
|
|
6
|
+
error: null;
|
|
7
|
+
isError: false;
|
|
8
|
+
isIdle: true;
|
|
9
|
+
isPending: false;
|
|
10
|
+
isSuccess: false;
|
|
11
|
+
status: "idle";
|
|
12
|
+
reset: () => void;
|
|
13
|
+
context: unknown;
|
|
14
|
+
failureCount: number;
|
|
15
|
+
failureReason: Error | null;
|
|
16
|
+
isPaused: boolean;
|
|
17
|
+
submittedAt: number;
|
|
18
|
+
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
19
|
+
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
20
|
+
} | {
|
|
21
|
+
data: undefined;
|
|
22
|
+
variables: void;
|
|
23
|
+
error: null;
|
|
24
|
+
isError: false;
|
|
25
|
+
isIdle: false;
|
|
26
|
+
isPending: true;
|
|
27
|
+
isSuccess: false;
|
|
28
|
+
status: "pending";
|
|
29
|
+
reset: () => void;
|
|
30
|
+
context: unknown;
|
|
31
|
+
failureCount: number;
|
|
32
|
+
failureReason: Error | null;
|
|
33
|
+
isPaused: boolean;
|
|
34
|
+
submittedAt: number;
|
|
35
|
+
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
36
|
+
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
37
|
+
} | {
|
|
38
|
+
data: undefined;
|
|
39
|
+
error: Error;
|
|
40
|
+
variables: void;
|
|
41
|
+
isError: true;
|
|
42
|
+
isIdle: false;
|
|
43
|
+
isPending: false;
|
|
44
|
+
isSuccess: false;
|
|
45
|
+
status: "error";
|
|
46
|
+
reset: () => void;
|
|
47
|
+
context: unknown;
|
|
48
|
+
failureCount: number;
|
|
49
|
+
failureReason: Error | null;
|
|
50
|
+
isPaused: boolean;
|
|
51
|
+
submittedAt: number;
|
|
52
|
+
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
53
|
+
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
54
|
+
} | {
|
|
55
|
+
data: Session;
|
|
56
|
+
error: null;
|
|
57
|
+
variables: void;
|
|
58
|
+
isError: false;
|
|
59
|
+
isIdle: false;
|
|
60
|
+
isPending: false;
|
|
61
|
+
isSuccess: true;
|
|
62
|
+
status: "success";
|
|
63
|
+
reset: () => void;
|
|
64
|
+
context: unknown;
|
|
65
|
+
failureCount: number;
|
|
66
|
+
failureReason: Error | null;
|
|
67
|
+
isPaused: boolean;
|
|
68
|
+
submittedAt: number;
|
|
69
|
+
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
70
|
+
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
71
|
+
};
|
|
72
|
+
export { useAuthenticateWithWallet };
|
|
73
|
+
//# sourceMappingURL=useAuthenticateWithWallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAuthenticateWithWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAuthenticateWithWallet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAe,MAAM,uBAAuB,CAAA;AAMpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAGrC,iBAAS,yBAAyB,CAChC,mBAAmB,UAAQ,EAC3B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,OAAO,CAAC,EACxB,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgFP;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { useSignMessage } from "wagmi";
|
|
2
|
+
import { useMutation } from "@tanstack/react-query";
|
|
3
|
+
import { useCreateAccount } from "./useCreateAccount";
|
|
4
|
+
import { useCreateSession } from "./useCreateSession";
|
|
5
|
+
import { useEnsureNoSessionAndFetchNonce } from "./useEnsureNoSessionAndFetchNonce";
|
|
6
|
+
import { createSignInWithWalletMessage } from "../utils/siww";
|
|
7
|
+
import { useGetAccountByAddress } from "./useGetAccountByAddress";
|
|
8
|
+
import useWalletAccount from "./useWalletAccount";
|
|
9
|
+
function useAuthenticateWithWallet(shouldCreateAccount = false, mutationOptions = {}) {
|
|
10
|
+
const { address, chainId, connector, networkFamily } = useWalletAccount();
|
|
11
|
+
const { ensureNoSessionAndFetchNonce } = useEnsureNoSessionAndFetchNonce();
|
|
12
|
+
const { createSessionAsync } = useCreateSession();
|
|
13
|
+
const { createAccountAsync } = useCreateAccount();
|
|
14
|
+
const { signMessageAsync } = useSignMessage();
|
|
15
|
+
const { refetch: getAccountByAddress } = useGetAccountByAddress(address, {
|
|
16
|
+
enabled: false,
|
|
17
|
+
retry: false,
|
|
18
|
+
});
|
|
19
|
+
const { mutate, mutateAsync, ...signInMutationRestParameters } = useMutation({
|
|
20
|
+
mutationFn: async () => {
|
|
21
|
+
if (!address) {
|
|
22
|
+
throw new Error("Sign in error: Wallet not connected!");
|
|
23
|
+
}
|
|
24
|
+
const nonce = await ensureNoSessionAndFetchNonce();
|
|
25
|
+
const messageResult = createSignInWithWalletMessage(address, nonce, networkFamily, chainId);
|
|
26
|
+
const signatureResult = await signMessageAsync({
|
|
27
|
+
message: messageResult,
|
|
28
|
+
connector,
|
|
29
|
+
});
|
|
30
|
+
if (shouldCreateAccount) {
|
|
31
|
+
const getAccountByAddressResult = await getAccountByAddress();
|
|
32
|
+
if (getAccountByAddressResult.data) {
|
|
33
|
+
throw new Error("Wallet authentication failed: Account creation failed. Account already exists.");
|
|
34
|
+
}
|
|
35
|
+
if (getAccountByAddressResult.error) {
|
|
36
|
+
throw new Error(`Wallet authentication failed: Account creation failed. Could not verify if account already exists: ${getAccountByAddressResult.error}`);
|
|
37
|
+
}
|
|
38
|
+
// Fetch was successful, but no account was found
|
|
39
|
+
try {
|
|
40
|
+
const createAccountResult = await createAccountAsync({
|
|
41
|
+
type: "wallet",
|
|
42
|
+
message: messageResult,
|
|
43
|
+
signature: signatureResult,
|
|
44
|
+
});
|
|
45
|
+
if (!createAccountResult) {
|
|
46
|
+
throw new Error("Failed to create new account");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw new Error(`Wallet authentication failed: Account creation failed: ${error}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return (await createSessionAsync({
|
|
54
|
+
type: "wallet",
|
|
55
|
+
message: messageResult,
|
|
56
|
+
signature: signatureResult,
|
|
57
|
+
}));
|
|
58
|
+
// ^ By passing type: "wallet" we know for sure the return type is Session
|
|
59
|
+
},
|
|
60
|
+
...mutationOptions,
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
authenticateWithWallet: mutate,
|
|
64
|
+
authenticateWithWalletAsync: mutateAsync,
|
|
65
|
+
...signInMutationRestParameters,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export { useAuthenticateWithWallet };
|
|
69
|
+
//# sourceMappingURL=useAuthenticateWithWallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAuthenticateWithWallet.js","sourceRoot":"","sources":["../../../src/hooks/useAuthenticateWithWallet.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { MutationOptions, DefaultError } from "@tanstack/react-query";
|
|
2
|
+
import type { CreateAccountRequest, CreateAccountResponse } from "../api";
|
|
3
|
+
export declare function useCreateAccount(mutationOptions?: Omit<MutationOptions<CreateAccountResponse, DefaultError, CreateAccountRequest>, "mutationFn" | "mutationKey">): {
|
|
2
4
|
data: undefined;
|
|
3
5
|
variables: undefined;
|
|
4
6
|
error: null;
|
|
@@ -14,42 +16,18 @@ export declare function useCreateAccount(useMutationOptions?: {}): {
|
|
|
14
16
|
isPaused: boolean;
|
|
15
17
|
submittedAt: number;
|
|
16
18
|
createAccount: import("@tanstack/react-query").UseMutateFunction<{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
user_metadata: {
|
|
22
|
-
mezoId?: string | undefined;
|
|
23
|
-
btcAddress: string;
|
|
24
|
-
evmAddress: string;
|
|
25
|
-
};
|
|
26
|
-
}, Error, {
|
|
27
|
-
type: "wallet";
|
|
28
|
-
message: string;
|
|
29
|
-
signature: string;
|
|
30
|
-
}, unknown>;
|
|
19
|
+
mezoId: string;
|
|
20
|
+
hasModifiedMezoId: boolean;
|
|
21
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
22
|
+
}, Error, CreateAccountRequest, unknown>;
|
|
31
23
|
createAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
user_metadata: {
|
|
37
|
-
mezoId?: string | undefined;
|
|
38
|
-
btcAddress: string;
|
|
39
|
-
evmAddress: string;
|
|
40
|
-
};
|
|
41
|
-
}, Error, {
|
|
42
|
-
type: "wallet";
|
|
43
|
-
message: string;
|
|
44
|
-
signature: string;
|
|
45
|
-
}, unknown>;
|
|
24
|
+
mezoId: string;
|
|
25
|
+
hasModifiedMezoId: boolean;
|
|
26
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
27
|
+
}, Error, CreateAccountRequest, unknown>;
|
|
46
28
|
} | {
|
|
47
29
|
data: undefined;
|
|
48
|
-
variables:
|
|
49
|
-
type: "wallet";
|
|
50
|
-
message: string;
|
|
51
|
-
signature: string;
|
|
52
|
-
};
|
|
30
|
+
variables: CreateAccountRequest;
|
|
53
31
|
error: null;
|
|
54
32
|
isError: false;
|
|
55
33
|
isIdle: false;
|
|
@@ -63,43 +41,19 @@ export declare function useCreateAccount(useMutationOptions?: {}): {
|
|
|
63
41
|
isPaused: boolean;
|
|
64
42
|
submittedAt: number;
|
|
65
43
|
createAccount: import("@tanstack/react-query").UseMutateFunction<{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
user_metadata: {
|
|
71
|
-
mezoId?: string | undefined;
|
|
72
|
-
btcAddress: string;
|
|
73
|
-
evmAddress: string;
|
|
74
|
-
};
|
|
75
|
-
}, Error, {
|
|
76
|
-
type: "wallet";
|
|
77
|
-
message: string;
|
|
78
|
-
signature: string;
|
|
79
|
-
}, unknown>;
|
|
44
|
+
mezoId: string;
|
|
45
|
+
hasModifiedMezoId: boolean;
|
|
46
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
47
|
+
}, Error, CreateAccountRequest, unknown>;
|
|
80
48
|
createAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
user_metadata: {
|
|
86
|
-
mezoId?: string | undefined;
|
|
87
|
-
btcAddress: string;
|
|
88
|
-
evmAddress: string;
|
|
89
|
-
};
|
|
90
|
-
}, Error, {
|
|
91
|
-
type: "wallet";
|
|
92
|
-
message: string;
|
|
93
|
-
signature: string;
|
|
94
|
-
}, unknown>;
|
|
49
|
+
mezoId: string;
|
|
50
|
+
hasModifiedMezoId: boolean;
|
|
51
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
52
|
+
}, Error, CreateAccountRequest, unknown>;
|
|
95
53
|
} | {
|
|
96
54
|
data: undefined;
|
|
97
55
|
error: Error;
|
|
98
|
-
variables:
|
|
99
|
-
type: "wallet";
|
|
100
|
-
message: string;
|
|
101
|
-
signature: string;
|
|
102
|
-
};
|
|
56
|
+
variables: CreateAccountRequest;
|
|
103
57
|
isError: true;
|
|
104
58
|
isIdle: false;
|
|
105
59
|
isPending: false;
|
|
@@ -112,53 +66,23 @@ export declare function useCreateAccount(useMutationOptions?: {}): {
|
|
|
112
66
|
isPaused: boolean;
|
|
113
67
|
submittedAt: number;
|
|
114
68
|
createAccount: import("@tanstack/react-query").UseMutateFunction<{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
user_metadata: {
|
|
120
|
-
mezoId?: string | undefined;
|
|
121
|
-
btcAddress: string;
|
|
122
|
-
evmAddress: string;
|
|
123
|
-
};
|
|
124
|
-
}, Error, {
|
|
125
|
-
type: "wallet";
|
|
126
|
-
message: string;
|
|
127
|
-
signature: string;
|
|
128
|
-
}, unknown>;
|
|
69
|
+
mezoId: string;
|
|
70
|
+
hasModifiedMezoId: boolean;
|
|
71
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
72
|
+
}, Error, CreateAccountRequest, unknown>;
|
|
129
73
|
createAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
user_metadata: {
|
|
135
|
-
mezoId?: string | undefined;
|
|
136
|
-
btcAddress: string;
|
|
137
|
-
evmAddress: string;
|
|
138
|
-
};
|
|
139
|
-
}, Error, {
|
|
140
|
-
type: "wallet";
|
|
141
|
-
message: string;
|
|
142
|
-
signature: string;
|
|
143
|
-
}, unknown>;
|
|
74
|
+
mezoId: string;
|
|
75
|
+
hasModifiedMezoId: boolean;
|
|
76
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
77
|
+
}, Error, CreateAccountRequest, unknown>;
|
|
144
78
|
} | {
|
|
145
79
|
data: {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
};
|
|
150
|
-
user_metadata: {
|
|
151
|
-
mezoId?: string | undefined;
|
|
152
|
-
btcAddress: string;
|
|
153
|
-
evmAddress: string;
|
|
154
|
-
};
|
|
80
|
+
mezoId: string;
|
|
81
|
+
hasModifiedMezoId: boolean;
|
|
82
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
155
83
|
};
|
|
156
84
|
error: null;
|
|
157
|
-
variables:
|
|
158
|
-
type: "wallet";
|
|
159
|
-
message: string;
|
|
160
|
-
signature: string;
|
|
161
|
-
};
|
|
85
|
+
variables: CreateAccountRequest;
|
|
162
86
|
isError: false;
|
|
163
87
|
isIdle: false;
|
|
164
88
|
isPending: false;
|
|
@@ -171,34 +95,14 @@ export declare function useCreateAccount(useMutationOptions?: {}): {
|
|
|
171
95
|
isPaused: boolean;
|
|
172
96
|
submittedAt: number;
|
|
173
97
|
createAccount: import("@tanstack/react-query").UseMutateFunction<{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
user_metadata: {
|
|
179
|
-
mezoId?: string | undefined;
|
|
180
|
-
btcAddress: string;
|
|
181
|
-
evmAddress: string;
|
|
182
|
-
};
|
|
183
|
-
}, Error, {
|
|
184
|
-
type: "wallet";
|
|
185
|
-
message: string;
|
|
186
|
-
signature: string;
|
|
187
|
-
}, unknown>;
|
|
98
|
+
mezoId: string;
|
|
99
|
+
hasModifiedMezoId: boolean;
|
|
100
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
101
|
+
}, Error, CreateAccountRequest, unknown>;
|
|
188
102
|
createAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
user_metadata: {
|
|
194
|
-
mezoId?: string | undefined;
|
|
195
|
-
btcAddress: string;
|
|
196
|
-
evmAddress: string;
|
|
197
|
-
};
|
|
198
|
-
}, Error, {
|
|
199
|
-
type: "wallet";
|
|
200
|
-
message: string;
|
|
201
|
-
signature: string;
|
|
202
|
-
}, unknown>;
|
|
103
|
+
mezoId: string;
|
|
104
|
+
hasModifiedMezoId: boolean;
|
|
105
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
106
|
+
}, Error, CreateAccountRequest, unknown>;
|
|
203
107
|
};
|
|
204
108
|
//# sourceMappingURL=useCreateAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateAccount.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCreateAccount.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCreateAccount.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCreateAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,YAAY,EACb,MAAM,uBAAuB,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAEzE,wBAAgB,gBAAgB,CAC9B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,qBAAqB,EAAE,YAAY,EAAE,oBAAoB,CAAC,EAC1E,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBP"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { useQueryClient, useMutation } from "@tanstack/react-query";
|
|
1
|
+
import { useQueryClient, useMutation, } from "@tanstack/react-query";
|
|
2
2
|
import { useAuthApiClient } from "./useAuthApiClient";
|
|
3
3
|
import { QUERY_KEYS } from "./constants";
|
|
4
|
-
export function useCreateAccount(
|
|
4
|
+
export function useCreateAccount(mutationOptions = {}) {
|
|
5
5
|
const queryClient = useQueryClient();
|
|
6
6
|
const authApiClient = useAuthApiClient();
|
|
7
|
+
const { onSuccess: customOnSuccess, ...restMutationOptions } = mutationOptions;
|
|
7
8
|
const { mutate, mutateAsync, ...rest } = useMutation({
|
|
8
9
|
mutationFn: (createAccountRequest) => authApiClient.createAccount(createAccountRequest),
|
|
9
|
-
onSuccess: () => {
|
|
10
|
+
onSuccess: (data, variables, context) => {
|
|
10
11
|
queryClient.resetQueries({
|
|
11
|
-
queryKey: [QUERY_KEYS.
|
|
12
|
-
exact: false,
|
|
13
|
-
});
|
|
14
|
-
queryClient.resetQueries({
|
|
15
|
-
queryKey: [QUERY_KEYS.ACCOUNT_BY_MEZO_ID],
|
|
16
|
-
exact: false,
|
|
12
|
+
queryKey: [QUERY_KEYS.ACCOUNT],
|
|
17
13
|
});
|
|
14
|
+
if (customOnSuccess)
|
|
15
|
+
customOnSuccess(data, variables, context);
|
|
18
16
|
},
|
|
19
|
-
...
|
|
17
|
+
...restMutationOptions,
|
|
20
18
|
});
|
|
21
19
|
return { createAccount: mutate, createAccountAsync: mutateAsync, ...rest };
|
|
22
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateAccount.js","sourceRoot":"","sources":["../../../src/hooks/useCreateAccount.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useCreateAccount.js","sourceRoot":"","sources":["../../../src/hooks/useCreateAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,MAAM,UAAU,gBAAgB,CAC9B,kBAGI,EAAE;IAEN,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAA;IAExC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,mBAAmB,EAAE,GAAG,eAAe,CAAA;IAE9E,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,WAAW,CAAC;QACnD,UAAU,EAAE,CAAC,oBAA0C,EAAE,EAAE,CACzD,aAAa,CAAC,aAAa,CAAC,oBAAoB,CAAC;QACnD,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;YACtC,WAAW,CAAC,YAAY,CAAC;gBACvB,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;aAC/B,CAAC,CAAA;YAEF,IAAI,eAAe;gBAAE,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAChE,CAAC;QACD,GAAG,mBAAmB;KACvB,CAAC,CAAA;IAEF,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,CAAA;AAC5E,CAAC"}
|