@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,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
|
+
import { DropdownCryptoAsset } from "../../hooks/useDropdownData";
|
|
4
|
+
export type DropdownProps = {
|
|
5
|
+
/** The callback to be called when the user clicks the sign-out button */
|
|
6
|
+
onSignOut?: () => void;
|
|
7
|
+
/** The callback to be called when the user clicks the button in sign-in state */
|
|
8
|
+
onSignIn?: () => void;
|
|
9
|
+
/** The set of EVM native assets to be displayed in the dropdown */
|
|
10
|
+
evmNativeAssets?: DropdownCryptoAsset<"tbtc" | "wbtc">[];
|
|
11
|
+
/** The set of Matsnet assets to be displayed in the dropdown */
|
|
12
|
+
matsnetAssets?: DropdownCryptoAsset<"mbtc" | "musd">[];
|
|
13
|
+
/** The props to be passed to the trigger button */
|
|
14
|
+
triggerProps?: {
|
|
15
|
+
signedIn?: Omit<ButtonProps, "onClick" | "size"> & {
|
|
16
|
+
size: "medium" | "large";
|
|
17
|
+
};
|
|
18
|
+
signedOut?: Omit<ButtonProps, "onClick">;
|
|
19
|
+
};
|
|
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,KAAoB,MAAM,OAAO,CAAA;AAGxC,OAAwB,EACtB,mBAAmB,EACpB,MAAM,6BAA6B,CAAA;AAOpC,MAAM,MAAM,aAAa,GAAG;IAC1B,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,mEAAmE;IACnE,eAAe,CAAC,EAAE,mBAAmB,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACxD,gEAAgE;IAChE,aAAa,CAAC,EAAE,mBAAmB,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACtD,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;CACF,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,SAAS,CAAC,CAAA;AAEtD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,qBAiF5C"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { StatefulPopover, useStyletron, } from "@mezo-org/mezo-clay";
|
|
2
|
+
import { useConnectModal } from "@rainbow-me/rainbowkit";
|
|
3
|
+
import React, { useEffect } from "react";
|
|
4
|
+
import { useDisconnect } from "wagmi";
|
|
5
|
+
import DefaultAvatar from "../../assets/DefaultAvatar";
|
|
6
|
+
import useDropdownData from "../../hooks/useDropdownData";
|
|
7
|
+
import useWalletAccount from "../../hooks/useWalletAccount";
|
|
8
|
+
import ConnectedTrigger from "./ConnectedTrigger";
|
|
9
|
+
import Content from "./Content";
|
|
10
|
+
import DisconnectedTrigger from "./DisconnectedTrigger";
|
|
11
|
+
import { useSignInWithWallet } from "../../hooks";
|
|
12
|
+
/**
|
|
13
|
+
* Passport Dropdown component that displays user's wallet and assets information.
|
|
14
|
+
* @param {DropdownProps} props - Component props.
|
|
15
|
+
* @returns {JSX.Element}
|
|
16
|
+
*/
|
|
17
|
+
export function Dropdown(props) {
|
|
18
|
+
const { placement = "bottomRight", animateOutTime = 120, onSignIn, onSignOut, evmNativeAssets, matsnetAssets, overrides, triggerProps, ...restProps } = props;
|
|
19
|
+
const [, theme] = useStyletron();
|
|
20
|
+
const dropdownData = useDropdownData({ evmNativeAssets, matsnetAssets });
|
|
21
|
+
const { openConnectModal } = useConnectModal();
|
|
22
|
+
const { isConnected } = useWalletAccount();
|
|
23
|
+
const { signInWithWalletAsync, isPending } = useSignInWithWallet();
|
|
24
|
+
const { disconnectAsync } = useDisconnect();
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (onSignIn)
|
|
27
|
+
return;
|
|
28
|
+
const handleSignIn = async () => {
|
|
29
|
+
if (!isConnected)
|
|
30
|
+
return;
|
|
31
|
+
try {
|
|
32
|
+
await signInWithWalletAsync();
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
await disconnectAsync();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
handleSignIn();
|
|
39
|
+
}, [disconnectAsync, isConnected, onSignIn, signInWithWalletAsync]);
|
|
40
|
+
if (!dropdownData || !isConnected) {
|
|
41
|
+
return (React.createElement(DisconnectedTrigger
|
|
42
|
+
// If connect wallet flow is not provided it fallbacks to RainbowKit's
|
|
43
|
+
// connect modal
|
|
44
|
+
, {
|
|
45
|
+
// If connect wallet flow is not provided it fallbacks to RainbowKit's
|
|
46
|
+
// connect modal
|
|
47
|
+
onClick: onSignIn || openConnectModal, isLoading: isPending, ...triggerProps?.signedOut }, "Sign in"));
|
|
48
|
+
}
|
|
49
|
+
return (React.createElement(StatefulPopover, { content: React.createElement(Content, { data: dropdownData, onSignOut: onSignOut }), placement: placement, animateOutTime: animateOutTime, overrides: {
|
|
50
|
+
...overrides,
|
|
51
|
+
Body: {
|
|
52
|
+
...overrides?.Body,
|
|
53
|
+
style: {
|
|
54
|
+
width: "396px",
|
|
55
|
+
borderRadius: theme.borders.radius500,
|
|
56
|
+
boxShadow: theme.lighting.shadow500,
|
|
57
|
+
overflow: "hidden",
|
|
58
|
+
...overrides?.Body?.style,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
}, ...restProps },
|
|
62
|
+
React.createElement(ConnectedTrigger, { avatar: React.createElement(DefaultAvatar, null), ...triggerProps?.signedIn })));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEf,YAAY,GACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAA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,CAAA;QAED,YAAY,EAAE,CAAA;IAChB,CAAC,EAAE,CAAC,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAA;IAEnE,IAAI,CAAC,YAAY,IAAI,CAAC,WAAW,EAAE,CAAC;QAClC,OAAO,CACL,oBAAC,mBAAmB;QAClB,sEAAsE;QACtE,gBAAgB;;YADhB,sEAAsE;YACtE,gBAAgB;YAChB,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EACrC,SAAS,EAAE,SAAS,KAChB,YAAY,EAAE,SAAS,cAGP,CACvB,CAAA;IACH,CAAC;IAED,OAAO,CACL,oBAAC,eAAe,IACd,OAAO,EAAE,oBAAC,OAAO,IAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,GAAI,EAC9D,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE;YACT,GAAG,SAAS;YACZ,IAAI,EAAE;gBACJ,GAAG,SAAS,EAAE,IAAI;gBAClB,KAAK,EAAE;oBACL,KAAK,EAAE,OAAO;oBACd,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS;oBACrC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS;oBACnC,QAAQ,EAAE,QAAQ;oBAClB,GAAG,SAAS,EAAE,IAAI,EAAE,KAAK;iBAC1B;aACF;SACF,KACG,SAAS;QAEb,oBAAC,gBAAgB,IACf,MAAM,EAAE,oBAAC,aAAa,OAAG,KACrB,YAAY,EAAE,QAAQ,GAC1B,CACc,CACnB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
type NestedViewLayoutProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare function NestedViewLayout(props: NestedViewLayoutProps): React.JSX.Element;
|
|
6
|
+
export default NestedViewLayout;
|
|
7
|
+
//# sourceMappingURL=NestedViewLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NestedViewLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/NestedViewLayout.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAe,MAAM,OAAO,CAAA;AAUrD,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,qBAmDrD;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ArrowLeft, Block, ButtonIcon, LabelMedium, useStyletron, } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { useCallback } from "react";
|
|
3
|
+
import useDropdownStore, { DropdownView } from "../../stores/dropdownStore";
|
|
4
|
+
const getHeaderTitle = (view) => {
|
|
5
|
+
const titleMap = {
|
|
6
|
+
[DropdownView.RECEIVE]: "Receive",
|
|
7
|
+
};
|
|
8
|
+
return titleMap[view];
|
|
9
|
+
};
|
|
10
|
+
function NestedViewLayout(props) {
|
|
11
|
+
const { children, ...restProps } = props;
|
|
12
|
+
const currentView = useDropdownStore((state) => state.view);
|
|
13
|
+
const setView = useDropdownStore((state) => state.setView);
|
|
14
|
+
const isNested = useDropdownStore((state) => state.isNestedView());
|
|
15
|
+
const [, theme] = useStyletron();
|
|
16
|
+
const handleOnButtonClick = useCallback(() => {
|
|
17
|
+
setView(DropdownView.ROOT);
|
|
18
|
+
}, [setView]);
|
|
19
|
+
return (React.createElement(Block, { display: "flex", flexDirection: "column", minHeight: "588px", padding: theme.sizing.scale700, paddingTop: 0, ...restProps },
|
|
20
|
+
React.createElement(Block, { display: "flex", alignItems: "center", paddingTop: theme.sizing.scale600, paddingBottom: theme.sizing.scale600, marginBottom: theme.sizing.scale300 },
|
|
21
|
+
React.createElement(ButtonIcon, { onClick: handleOnButtonClick, shape: "circle", size: "small", overrides: {
|
|
22
|
+
BaseButton: {
|
|
23
|
+
style: {
|
|
24
|
+
background: theme.colors.backgroundPrimary,
|
|
25
|
+
marginRight: isNested ? theme.sizing.scale300 : undefined,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
} },
|
|
29
|
+
React.createElement(ArrowLeft, { size: theme.sizing.scale700 })),
|
|
30
|
+
React.createElement(LabelMedium, null, getHeaderTitle(currentView))),
|
|
31
|
+
children));
|
|
32
|
+
}
|
|
33
|
+
export default NestedViewLayout;
|
|
34
|
+
//# sourceMappingURL=NestedViewLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NestedViewLayout.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/NestedViewLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,gBAAgB,EAAE,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE3E,MAAM,cAAc,GAAG,CAAC,IAAkB,EAAE,EAAE;IAC5C,MAAM,QAAQ,GAA0C;QACtD,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,SAAS;KAClC,CAAA;IACD,OAAO,QAAQ,CAAC,IAAI,CAAE,CAAA;AACxB,CAAC,CAAA;AAMD,SAAS,gBAAgB,CAAC,KAA4B;IACpD,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAA;IAExC,MAAM,WAAW,GAAG,gBAAgB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC3D,MAAM,OAAO,GAAG,gBAAgB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAC1D,MAAM,QAAQ,GAAG,gBAAgB,C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1 @@
|
|
|
1
|
+
{"version":3,"file":"Receive.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Receive/Receive.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAgC,MAAM,OAAO,CAAA;AAQpD,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,qBAgGnC;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Block, Button, LabelMedium, MonoLabelXSmall, ParagraphSmall, useStyletron, } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { useCallback, useState } from "react";
|
|
3
|
+
import { useCopyToClipboard } from "usehooks-ts";
|
|
4
|
+
import { QRCodeSVG } from "qrcode.react";
|
|
5
|
+
import NestedViewLayout from "../NestedViewLayout";
|
|
6
|
+
import { getAddressExplorerUrl } from "../../../utils/address";
|
|
7
|
+
import { usePassportContext } from "../../../hooks/usePassportContext";
|
|
8
|
+
import useWalletAccount from "../../../hooks/useWalletAccount";
|
|
9
|
+
function Receive(props) {
|
|
10
|
+
const { address } = props;
|
|
11
|
+
const { environment } = usePassportContext();
|
|
12
|
+
const blockExplorerUrl = getAddressExplorerUrl(address, "mezo", environment === "testnet");
|
|
13
|
+
const [, theme] = useStyletron();
|
|
14
|
+
const [, copy] = useCopyToClipboard();
|
|
15
|
+
const [isCopiedMessageVisible, setIsCopiedMessageVisible] = useState(false);
|
|
16
|
+
const handleCopyAddress = useCallback(() => {
|
|
17
|
+
copy(address);
|
|
18
|
+
setIsCopiedMessageVisible(true);
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
setIsCopiedMessageVisible(false);
|
|
21
|
+
}, 2000);
|
|
22
|
+
}, [copy, address]);
|
|
23
|
+
const { networkFamily } = useWalletAccount();
|
|
24
|
+
return (React.createElement(NestedViewLayout, null,
|
|
25
|
+
React.createElement(LabelMedium, null, "Receive assets on Mezo"),
|
|
26
|
+
React.createElement(ParagraphSmall, { marginTop: theme.sizing.scale300, marginBottom: theme.sizing.scale600, color: theme.colors.contentTertiary }, networkFamily === "bitcoin" ? (React.createElement(React.Fragment, null, "Mezo automatically created a smart account that's fully controlled by your connected Bitcoin wallet. Use this address to receive assets on Mezo.")) : (React.createElement(React.Fragment, null, "Your connected wallet address is your Mezo address. Use this address to receive assets on Mezo."))),
|
|
27
|
+
React.createElement(Block, { as: QRCodeSVG, value: address, flex: 1, overrides: {
|
|
28
|
+
Block: {
|
|
29
|
+
style: {
|
|
30
|
+
aspectRatio: 1,
|
|
31
|
+
width: "fit-content",
|
|
32
|
+
margin: "0 auto",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
} }),
|
|
36
|
+
React.createElement(MonoLabelXSmall, { marginTop: theme.sizing.scale800, marginBottom: theme.sizing.scale800, overrides: {
|
|
37
|
+
Block: {
|
|
38
|
+
style: {
|
|
39
|
+
textAlign: "center",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
} }, address),
|
|
43
|
+
React.createElement(Button, { onClick: handleCopyAddress, overrides: {
|
|
44
|
+
BaseButton: {
|
|
45
|
+
style: {
|
|
46
|
+
marginBottom: theme.sizing.scale400,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
} }, isCopiedMessageVisible ? "Copied!" : "Copy Mezo Address"),
|
|
50
|
+
React.createElement(Button, { kind: "secondary", "$as": "a", href: blockExplorerUrl, target: "_blank" }, "View Explorer")));
|
|
51
|
+
}
|
|
52
|
+
export default Receive;
|
|
53
|
+
//# sourceMappingURL=Receive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Receive.js","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Receive/Receive.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,MAAM,EACN,WAAW,EACX,eAAe,EACf,cAAc,EACd,YAAY,GACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK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AK,CAAC,MAAM,CAAC,QAAQ,EAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EACnC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,IAElC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,CAC7B,6LAIG,CACJ,CAAC,CAAC,CAAC,CACF,4IAGG,CACJ,CACc;QAEjB,oBAAC,KAAK,IACJ,EAAE,EAAE,SAAS,EACb,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,CAAC,EACP,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,KAAK,EAAE;wBACL,WAAW,EAAE,CAAC;wBACd,KAAK,EAAE,aAAa;wBACpB,MAAM,EAAE,QAAQ;qBACjB;iBACF;aACF,GACD;QAEF,oBAAC,eAAe,IACd,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EACnC,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,KAAK,EAAE;wBACL,SAAS,EAAE,QAAQ;qBACpB;iBACF;aACF,IAEA,OAAO,CACQ;QAElB,oBAAC,MAAM,IACL,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE;gBACT,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ;qBACpC;iBACF;aACF,IAEA,sBAAsB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAClD;QAET,oBAAC,MAAM,IAAC,IAAI,EAAC,WAAW,SAAK,GAAG,EAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAC,QAAQ,oBAE/D,CACQ,CACpB,CAAA;AACH,CAAC;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountAddressActions.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/AccountAddressActions.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAK1C,KAAK,0BAA0B,GAAG;IAChC,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAqBD,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC3C,KAAK,EAAE,0BAA0B,qBA+DlC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ArrowNarrowLeft, Block, Button, Cube01, useStyletron, } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { useCallback } from "react";
|
|
3
|
+
import { usePassportContext } from "../../../hooks/usePassportContext";
|
|
4
|
+
import { getAddressExplorerUrl } from "../../../utils/address";
|
|
5
|
+
import useDropdownStore, { DropdownView } from "../../../stores/dropdownStore";
|
|
6
|
+
const buttonStartEnhancerSize = 12;
|
|
7
|
+
const commonButtonProps = {
|
|
8
|
+
kind: "secondary",
|
|
9
|
+
size: "xsmall",
|
|
10
|
+
overrides: {
|
|
11
|
+
BaseButton: {
|
|
12
|
+
style: {
|
|
13
|
+
flex: 1,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
StartEnhancer: {
|
|
17
|
+
style: {
|
|
18
|
+
stroke: "currentColor",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export default function AccountAddressActions(props) {
|
|
24
|
+
const { address } = props;
|
|
25
|
+
const [, theme] = useStyletron();
|
|
26
|
+
const { environment } = usePassportContext();
|
|
27
|
+
const blockExplorerUrl = getAddressExplorerUrl(address, "mezo", environment === "testnet");
|
|
28
|
+
const setDropdownView = useDropdownStore((state) => state.setView);
|
|
29
|
+
const handleReceiveClick = useCallback(() => {
|
|
30
|
+
setDropdownView(DropdownView.RECEIVE);
|
|
31
|
+
}, [setDropdownView]);
|
|
32
|
+
return (React.createElement(Block, { display: "flex", alignItems: "center", backgroundColor: "transparent", marginBottom: theme.sizing.scale600, overrides: {
|
|
33
|
+
Block: {
|
|
34
|
+
style: {
|
|
35
|
+
gap: theme.sizing.scale600,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
} },
|
|
39
|
+
React.createElement(Button, { startEnhancer: React.createElement(Cube01, { size: buttonStartEnhancerSize }), "$as": "a", href: blockExplorerUrl, target: "_blank", ...commonButtonProps }, "View Mezo Explorer"),
|
|
40
|
+
React.createElement(Button, { onClick: handleReceiveClick, startEnhancer: React.createElement(ArrowNarrowLeft, { size: buttonStartEnhancerSize, overrides: {
|
|
41
|
+
Svg: {
|
|
42
|
+
style: {
|
|
43
|
+
transform: "rotate(-45deg)",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
} }), ...commonButtonProps }, "Receive")));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=AccountAddressActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountAddressActions.js","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/AccountAddressActions.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,EACL,MAAM,EAEN,MAAM,EACN,YAAY,GACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,gBAAgB,EAAE,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAM9E,MAAM,uBAAuB,GAAG,EAAE,CAAA;AAElC,MAAM,iBAAiB,GAAyB;IAC9C,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE;QACT,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,CAAC;aACR;SACF;QACD,aAAa,EAAE;YACb,KAAK,EAAE;gBACL,MAAM,EAAE,cAAc;aACvB;SACF;KACF;CACF,CAAA;AAED,MAAM,C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H,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CryptoAssetKey } from "../../../utils/cryptoAssets";
|
|
3
|
+
type AccountAssetsProps = {
|
|
4
|
+
label: string | React.ReactNode;
|
|
5
|
+
assets: {
|
|
6
|
+
type: CryptoAssetKey;
|
|
7
|
+
balance: string;
|
|
8
|
+
balanceInUsd: string;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
export default function AccountAssets(props: AccountAssetsProps): React.JSX.Element | null;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=AccountAssets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountAssets.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/AccountAssets.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,cAAc,EAAkB,MAAM,6BAA6B,CAAA;AAE5E,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;IAC/B,MAAM,EAAE;QACN,IAAI,EAAE,cAAc,CAAA;QACpB,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,MAAM,CAAA;KACrB,EAAE,CAAA;CACJ,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,4BAyF9D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Block, LabelSmall, ParagraphSmall, useStyletron, } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { getCryptoAsset } from "../../../utils/cryptoAssets";
|
|
4
|
+
export default function AccountAssets(props) {
|
|
5
|
+
const { label, assets } = props;
|
|
6
|
+
const [, theme] = useStyletron();
|
|
7
|
+
const assetsData = useMemo(() => assets.map((token) => {
|
|
8
|
+
const { name, symbol, icon } = getCryptoAsset(token.type);
|
|
9
|
+
return {
|
|
10
|
+
...token,
|
|
11
|
+
icon,
|
|
12
|
+
label: name,
|
|
13
|
+
symbol,
|
|
14
|
+
};
|
|
15
|
+
}), [assets]);
|
|
16
|
+
const labelContent = typeof label === "string" ? (React.createElement(ParagraphSmall, { margin: 0, color: theme.colors.gray800 }, label)) : (label);
|
|
17
|
+
if (assetsData.length === 0) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return (React.createElement(Block, { padding: `0 ${theme.sizing.scale500}` },
|
|
21
|
+
React.createElement(Block, { margin: `${theme.sizing.scale400} 0` }, labelContent),
|
|
22
|
+
React.createElement(Block, { as: "ul", marginBottom: theme.sizing.scale600, padding: 0, display: "flex", flexDirection: "column", overrides: {
|
|
23
|
+
Block: {
|
|
24
|
+
style: {
|
|
25
|
+
gap: theme.sizing.scale100,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
} }, assetsData.map((asset) => (React.createElement(Block, { as: "li", key: `${asset.type}-${asset.balance}`, display: "flex", justifyContent: "space-between", alignItems: "center", margin: `${theme.sizing.scale100} 0` },
|
|
29
|
+
React.createElement(asset.icon, { size: theme.sizing.scale800, overrides: {
|
|
30
|
+
Svg: {
|
|
31
|
+
style: {
|
|
32
|
+
marginRight: theme.sizing.scale500,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
} }),
|
|
36
|
+
React.createElement(Block, { flex: 1 },
|
|
37
|
+
React.createElement(LabelSmall, { margin: 0 }, asset.label),
|
|
38
|
+
React.createElement(ParagraphSmall, { margin: 0, color: theme.colors.gray500 }, asset.symbol)),
|
|
39
|
+
React.createElement(Block, { display: "flex", alignItems: "end", flexDirection: "column" },
|
|
40
|
+
React.createElement(LabelSmall, { margin: 0 }, asset.balance),
|
|
41
|
+
React.createElement(ParagraphSmall, { margin: 0, color: theme.colors.gray500 }, asset.balanceInUsd))))))));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=AccountAssets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountAssets.js","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/AccountAssets.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,UAAU,EACV,cAAc,EACd,YAAY,GACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAkB,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAW5E,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAyB;IAC7D,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;IAE/B,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,YAAY,EAAE,CAAA;IAEhC,MAAM,UAAU,GAAG,OAAO,CACxB,GAAG,EAAE,CACH,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACnB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAEzD,OAAO;YACL,GAAG,KAAK;YACR,IAAI;YACJ,KAAK,EAAE,IAAI;YACX,MAAM;SACP,CAAA;IACH,CAAC,CAAC,EACJ,CAAC,MAAM,CAAC,CACT,CAAA;IAED,MAAM,YAAY,GAChB,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAC1B,oBAAC,cAAc,IAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,IACnD,KAAK,CACS,CAClB,CAAC,CAAC,CAAC,CACF,KAAK,CACN,CAAA;IAEH,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,oBAAC,KAAK,IAAC,OAAO,EAAE,KAAK,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;QAC1C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;gBAC3D,oBAAC,UAAU,IAAC,MAAM,EAAE,CAAC,IAAG,KAAK,CAAC,OAAO,CAAc;gBACnD,oBAAC,cAAc,IAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,IACnD,KAAK,CAAC,YAAY,CACJ,CACX,CACF,CACT,CAAC,CACI,CACF,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountBalance.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/AccountBalance.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAsBhE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Block, HeadingSmall, ParagraphSmall, useStyletron, } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export default function AccountBalance(props) {
|
|
4
|
+
const { amount } = props;
|
|
5
|
+
const [, theme] = useStyletron();
|
|
6
|
+
return (React.createElement(Block, { padding: theme.sizing.scale500, overrides: {
|
|
7
|
+
Block: {
|
|
8
|
+
style: {
|
|
9
|
+
borderBottom: `1px solid ${theme.colors.backgroundPrimary}`,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
} },
|
|
13
|
+
React.createElement(ParagraphSmall, { margin: 0, color: theme.colors.gray800 }, "Available balance"),
|
|
14
|
+
React.createElement(HeadingSmall, { margin: 0 }, amount)));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=AccountBalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountBalance.js","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/AccountBalance.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAA0B;IAC/D,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;IAExB,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,YAAY,EAAE,CAAA;IAEhC,OAAO,CACL,oBAAC,KAAK,IACJ,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC9B,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,KAAK,EAAE;oBACL,YAAY,EAAE,aAAa,KAAK,CAAC,MAAM,CAAC,iBAAiB,EAAE;iBAC5D;aACF;SACF;QAED,oBAAC,cAAc,IAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,wBAErC;QACjB,oBAAC,YAAY,IAAC,MAAM,EAAE,CAAC,IAAG,MAAM,CAAgB,CAC1C,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DropdownData } from "../../../hooks/useDropdownData";
|
|
3
|
+
type RootProps = DropdownData & {
|
|
4
|
+
onSignOut?: () => void;
|
|
5
|
+
};
|
|
6
|
+
export default function Root(props: RootProps): React.JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=Root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/Root.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAG1C,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AA2B7D,KAAK,SAAS,GAAG,YAAY,GAAG;IAC9B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,SAAS,qBAkG5C"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Block, Button, LogOut01, Mats, ParagraphSmall, useStyletron, } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { useCallback } from "react";
|
|
3
|
+
import { useDisconnect } from "wagmi";
|
|
4
|
+
import { useSignOut } from "../../../hooks";
|
|
5
|
+
import WalletAddress from "./WalletAddress";
|
|
6
|
+
import AccountAssets from "./AccountAssets";
|
|
7
|
+
import AccountBalance from "./AccountBalance";
|
|
8
|
+
import WelcomeBlock from "./WelcomeBlock";
|
|
9
|
+
import AccountAddressActions from "./AccountAddressActions";
|
|
10
|
+
function MatsnetLabel() {
|
|
11
|
+
const [, theme] = useStyletron();
|
|
12
|
+
return (React.createElement(ParagraphSmall, { color: theme.colors.contentTertiary },
|
|
13
|
+
React.createElement(Mats, { color: "currentColor", size: theme.sizing.scale400, overrides: {
|
|
14
|
+
Svg: {
|
|
15
|
+
style: {
|
|
16
|
+
marginRight: theme.sizing.scale300,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
} }),
|
|
20
|
+
"Matsnet Assets"));
|
|
21
|
+
}
|
|
22
|
+
export default function Root(props) {
|
|
23
|
+
const { mezoId, walletAddress, accountAddress, walletType, totalBalanceInUsd, formattedNativeAssets, matsnet, onSignOut, } = props;
|
|
24
|
+
const [, theme] = useStyletron();
|
|
25
|
+
const { disconnect } = useDisconnect();
|
|
26
|
+
const { signOut } = useSignOut();
|
|
27
|
+
const handleLogOut = useCallback(() => {
|
|
28
|
+
if (onSignOut) {
|
|
29
|
+
onSignOut();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
signOut();
|
|
33
|
+
disconnect();
|
|
34
|
+
}, [signOut, disconnect, onSignOut]);
|
|
35
|
+
return (React.createElement(Block, { display: "inline-flex", flexDirection: "column", padding: theme.sizing.scale600 },
|
|
36
|
+
React.createElement(WelcomeBlock, { mezoId: mezoId, matsBalance: matsnet.mats }),
|
|
37
|
+
React.createElement(AccountAddressActions, { address: accountAddress }),
|
|
38
|
+
React.createElement(Block, { display: "flex", flexDirection: "column", backgroundColor: theme.colors.backgroundSecondary, overflow: "hidden", overrides: {
|
|
39
|
+
Block: { style: { borderRadius: theme.borders.radius300 } },
|
|
40
|
+
} },
|
|
41
|
+
React.createElement(WalletAddress, { address: walletAddress, type: walletType }),
|
|
42
|
+
React.createElement(AccountBalance, { amount: totalBalanceInUsd }),
|
|
43
|
+
React.createElement(AccountAssets, { label: "Assets", assets: formattedNativeAssets })),
|
|
44
|
+
matsnet.formattedAssets.length > 0 && (React.createElement(Block, { marginTop: theme.sizing.scale600, backgroundColor: theme.colors.backgroundSecondary, overflow: "hidden", overrides: {
|
|
45
|
+
Block: { style: { borderRadius: theme.borders.radius300 } },
|
|
46
|
+
} },
|
|
47
|
+
React.createElement(AccountAssets, { label: React.createElement(MatsnetLabel, null), assets: matsnet.formattedAssets }))),
|
|
48
|
+
React.createElement(Block, { marginTop: theme.sizing.scale700, padding: `0 ${theme.sizing.scale100}` },
|
|
49
|
+
React.createElement(Button, { size: "small", kind: "tertiary", startEnhancer: React.createElement(LogOut01, { color: "currentColor", size: 12 }), onClick: () => handleLogOut(), overrides: {
|
|
50
|
+
Root: {
|
|
51
|
+
style: {
|
|
52
|
+
":hover": {
|
|
53
|
+
backgroundColor: theme.colors.backgroundSecondary,
|
|
54
|
+
boxShadow: "none",
|
|
55
|
+
},
|
|
56
|
+
":active": {
|
|
57
|
+
backgroundColor: theme.colors.backgroundSecondary,
|
|
58
|
+
color: theme.colors.contentPrimary,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
} }, "Log out"))));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=Root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Root.js","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/Root.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AE,KAAK,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE;aAC5D;YAED,oBAAC,aAAa,IACZ,KAAK,EAAE,oBAAC,YAAY,OAAG,EACvB,MAAM,EAAE,OAAO,CAAC,eAAe,GAC/B,CACI,CACT;QAED,oBAAC,KAAK,IACJ,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAChC,OAAO,EAAE,KAAK,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;YAErC,oBAAC,MAAM,IACL,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,UAAU,EACf,aAAa,EAAE,oBAAC,QAAQ,IAAC,KAAK,EAAC,cAAc,EAAC,IAAI,EAAE,EAAE,GAAI,EAC1D,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE,EAC7B,SAAS,EAAE;oBACT,IAAI,EAAE;wBACJ,KAAK,EAAE;4BACL,QAAQ,EAAE;gCACR,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB;gCACjD,SAAS,EAAE,MAAM;6BAClB;4BACD,SAAS,EAAE;gCACT,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB;gCACjD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc;6BACnC;yBACF;qBACF;iBACF,cAGM,CACH,CACF,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletAddress.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/WalletAddress.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAgC,MAAM,OAAO,CAAA;AAMpD,KAAK,kBAAkB,GAAG;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,SAAS,GAAG,KAAK,CAAA;CACxB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBA6G9D"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Block, Copy03 as CopyIcon, LinkExternal02 as LinkIcon, ParagraphSmall, useStyletron, } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { useCallback, useState } from "react";
|
|
3
|
+
import { useCopyToClipboard } from "usehooks-ts";
|
|
4
|
+
import { usePassportContext } from "../../../hooks/usePassportContext";
|
|
5
|
+
import { getAddressExplorerUrl, trimAddress } from "../../../utils/address";
|
|
6
|
+
import { getCryptoAsset } from "../../../utils/cryptoAssets";
|
|
7
|
+
export default function WalletAddress(props) {
|
|
8
|
+
const { address, type } = props;
|
|
9
|
+
const { environment } = usePassportContext();
|
|
10
|
+
const blockExplorerUrl = getAddressExplorerUrl(address, type, environment === "testnet");
|
|
11
|
+
const trimmedAddress = trimAddress(address);
|
|
12
|
+
const { icon: accountIcon } = getCryptoAsset(type === "bitcoin" ? "btc" : "eth");
|
|
13
|
+
const [, theme] = useStyletron();
|
|
14
|
+
const [, copy] = useCopyToClipboard();
|
|
15
|
+
const [isCopiedMessageVisible, setIsCopiedMessageVisible] = useState(false);
|
|
16
|
+
const handleCopyAddress = useCallback(() => {
|
|
17
|
+
copy(address);
|
|
18
|
+
setIsCopiedMessageVisible(true);
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
setIsCopiedMessageVisible(false);
|
|
21
|
+
}, 2000);
|
|
22
|
+
}, [copy, address]);
|
|
23
|
+
return (React.createElement(Block, { as: "button", onClick: handleCopyAddress, display: "flex", alignItems: "center", backgroundColor: "transparent", padding: `${theme.sizing.scale600} ${theme.sizing.scale500}`, overrides: {
|
|
24
|
+
Block: {
|
|
25
|
+
style: {
|
|
26
|
+
borderWidth: 0,
|
|
27
|
+
cursor: "pointer",
|
|
28
|
+
":hover": {
|
|
29
|
+
backgroundColor: theme.colors.backgroundTertiary,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
} },
|
|
34
|
+
React.createElement(Block, { as: accountIcon, size: theme.sizing.scale600 }),
|
|
35
|
+
isCopiedMessageVisible ? (React.createElement(ParagraphSmall, { margin: 0, marginLeft: theme.sizing.scale300, color: theme.colors.gray800 }, "Copied address to clipboard")) : (React.createElement(Block, { as: "a", marginLeft: theme.sizing.scale300, href: blockExplorerUrl, target: "_blank", overrides: {
|
|
36
|
+
Block: {
|
|
37
|
+
style: {
|
|
38
|
+
color: "inherit",
|
|
39
|
+
textDecoration: "none",
|
|
40
|
+
":hover": {
|
|
41
|
+
textDecoration: "underline",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
} },
|
|
46
|
+
React.createElement(ParagraphSmall, { display: "flex", alignItems: "center", margin: 0, color: theme.colors.gray800 },
|
|
47
|
+
trimmedAddress,
|
|
48
|
+
React.createElement(LinkIcon, { display: "inline", size: theme.sizing.scale550, overrides: {
|
|
49
|
+
Svg: {
|
|
50
|
+
style: {
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
marginLeft: theme.sizing.scale200,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
} })))),
|
|
56
|
+
React.createElement(CopyIcon, { size: theme.sizing.scale550, overrides: {
|
|
57
|
+
Svg: {
|
|
58
|
+
style: {
|
|
59
|
+
marginLeft: "auto",
|
|
60
|
+
stroke: "currentColor",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
} })));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=WalletAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletAddress.js","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/WalletAddress.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,MAAM,IAAI,QAAQ,EAClB,cAAc,IAAI,QAAQ,EAC1B,cAAc,EACd,YAAY,GACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,kBAAk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AC3B,SAAS,EAAE;wBACT,GAAG,EAAE;4BACH,KAAK,EAAE;gCACL,MAAM,EAAE,cAAc;gCACtB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ;6BAClC;yBACF;qBACF,GACD,CACa,CACX,CACT;QACD,oBAAC,QAAQ,IACP,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC3B,SAAS,EAAE;gBACT,GAAG,EAAE;oBACH,KAAK,EAAE;wBACL,UAAU,EAAE,MAAM;wBAClB,MAAM,EAAE,cAAc;qBACvB;iBACF;aACF,GACD,CACI,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WelcomeBlock.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/WelcomeBlock.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBAyE5D"}
|