@dynamic-labs/sdk-react-core 2.1.0-alpha.10 → 2.1.0-alpha.12
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/CHANGELOG.md +20 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +13 -13
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
- package/src/lib/components/CopyButton/CopyButton.cjs +3 -3
- package/src/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/src/lib/components/CopyButton/CopyButton.js +3 -3
- package/src/lib/components/LoadingQrCode/LoadingQrCode.cjs +11 -0
- package/src/lib/components/LoadingQrCode/LoadingQrCode.d.ts +8 -0
- package/src/lib/components/LoadingQrCode/LoadingQrCode.js +7 -0
- package/src/lib/components/LoadingQrCode/index.d.ts +1 -0
- package/src/lib/components/QrCodeWrapper/QrCodeContainer/QrCodeContainer.cjs +2 -1
- package/src/lib/components/QrCodeWrapper/QrCodeContainer/QrCodeContainer.js +2 -1
- package/src/lib/components/QrCodeWrapper/QrCodeWrapper.cjs +5 -1
- package/src/lib/components/QrCodeWrapper/QrCodeWrapper.js +5 -1
- package/src/lib/data/api/chains/balances.cjs +38 -0
- package/src/lib/data/api/chains/balances.d.ts +8 -0
- package/src/lib/data/api/chains/balances.js +34 -0
- package/src/lib/data/api/chains/index.d.ts +1 -0
- package/src/lib/shared/types/general.d.ts +1 -0
- package/src/lib/utils/constants/errors.cjs +2 -0
- package/src/lib/utils/constants/errors.d.ts +1 -0
- package/src/lib/utils/constants/errors.js +2 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +34 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.d.ts +18 -9
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +34 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.cjs +5 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.d.ts +1 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.js +5 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs +4 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.d.ts +2 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js +3 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +68 -28
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.d.ts +11 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +70 -30
- package/src/lib/utils/hooks/useTokenBalances/index.d.ts +1 -0
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.cjs +141 -0
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.d.ts +12 -0
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.js +137 -0
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +1 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +1 -1
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +5 -4
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +5 -4
- package/src/lib/views/FarcasterQrCodeView/FarcasterQrCodeView.cjs +103 -0
- package/src/lib/views/FarcasterQrCodeView/FarcasterQrCodeView.d.ts +6 -0
- package/src/lib/views/FarcasterQrCodeView/FarcasterQrCodeView.js +99 -0
- package/src/lib/views/FarcasterQrCodeView/index.d.ts +1 -0
- package/src/lib/views/LoginView/LoginView.cjs +9 -1
- package/src/lib/views/LoginView/LoginView.js +9 -1
- package/src/lib/views/LoginView/utils/showFarcasterQrCodeView/index.d.ts +1 -0
- package/src/lib/views/LoginView/utils/showFarcasterQrCodeView/showFarcasterQrCodeView.cjs +14 -0
- package/src/lib/views/LoginView/utils/showFarcasterQrCodeView/showFarcasterQrCodeView.d.ts +2 -0
- package/src/lib/views/LoginView/utils/showFarcasterQrCodeView/showFarcasterQrCodeView.js +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.12](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.11...v2.1.0-alpha.12) (2024-05-02)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* display Farcaster QR code when it is the only login option ([#5514](https://github.com/dynamic-labs/DynamicAuth/issues/5514)) ([7b166d9](https://github.com/dynamic-labs/DynamicAuth/commit/7b166d9a30c581746f0e2edb71c44fc015dc128e))
|
|
8
|
+
|
|
9
|
+
## [2.1.0-alpha.11](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.10...v2.1.0-alpha.11) (2024-05-02)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **GVTY-1050:** add account token balances hook ([#5521](https://github.com/dynamic-labs/DynamicAuth/issues/5521)) ([5a6f937](https://github.com/dynamic-labs/DynamicAuth/commit/5a6f93733019f3b8d5c7a2c7a5537172a1e7eba4))
|
|
15
|
+
* headless reveal embedded wallet key ([#5518](https://github.com/dynamic-labs/DynamicAuth/issues/5518)) ([77c1536](https://github.com/dynamic-labs/DynamicAuth/commit/77c15360b2b28c52cbdeafb3ce8ca7e80dbecf57))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* fallback to walletconnect for zerion on mobile ([#5536](https://github.com/dynamic-labs/DynamicAuth/issues/5536)) ([f0e5bfe](https://github.com/dynamic-labs/DynamicAuth/commit/f0e5bfea0b2ab271fd4c1475c8ce708ecb1a5926))
|
|
21
|
+
|
|
2
22
|
## [2.1.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.9...v2.1.0-alpha.10) (2024-04-30)
|
|
3
23
|
|
|
4
24
|
|
package/package.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "2.1.0-alpha.
|
|
6
|
+
var version = "2.1.0-alpha.12";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.0.433",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"country-list": "2.3.0",
|
|
11
11
|
formik: "2.2.9",
|
package/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "2.1.0-alpha.
|
|
2
|
+
var version = "2.1.0-alpha.12";
|
|
3
3
|
var dependencies = {
|
|
4
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
4
|
+
"@dynamic-labs/sdk-api-core": "0.0.433",
|
|
5
5
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
6
6
|
"country-list": "2.3.0",
|
|
7
7
|
formik: "2.2.9",
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.12",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
7
7
|
"directory": "packages/sdk-react-core"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
10
|
+
"@dynamic-labs/sdk-api-core": "0.0.433",
|
|
11
11
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
12
12
|
"country-list": "2.3.0",
|
|
13
13
|
"formik": "2.2.9",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/iconic": "2.1.0-alpha.
|
|
21
|
-
"@dynamic-labs/logger": "2.1.0-alpha.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "2.1.0-alpha.
|
|
23
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.
|
|
24
|
-
"@dynamic-labs/rpc-provider-solana": "2.1.0-alpha.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "2.1.0-alpha.
|
|
26
|
-
"@dynamic-labs/types": "2.1.0-alpha.
|
|
27
|
-
"@dynamic-labs/utils": "2.1.0-alpha.
|
|
28
|
-
"@dynamic-labs/viem-utils": "2.1.0-alpha.
|
|
29
|
-
"@dynamic-labs/wallet-book": "2.1.0-alpha.
|
|
30
|
-
"@dynamic-labs/wallet-connector-core": "2.1.0-alpha.
|
|
20
|
+
"@dynamic-labs/iconic": "2.1.0-alpha.12",
|
|
21
|
+
"@dynamic-labs/logger": "2.1.0-alpha.12",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "2.1.0-alpha.12",
|
|
23
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.12",
|
|
24
|
+
"@dynamic-labs/rpc-provider-solana": "2.1.0-alpha.12",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "2.1.0-alpha.12",
|
|
26
|
+
"@dynamic-labs/types": "2.1.0-alpha.12",
|
|
27
|
+
"@dynamic-labs/utils": "2.1.0-alpha.12",
|
|
28
|
+
"@dynamic-labs/viem-utils": "2.1.0-alpha.12",
|
|
29
|
+
"@dynamic-labs/wallet-book": "2.1.0-alpha.12",
|
|
30
|
+
"@dynamic-labs/wallet-connector-core": "2.1.0-alpha.12",
|
|
31
31
|
"eventemitter3": "5.0.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
package/src/index.cjs
CHANGED
|
@@ -110,6 +110,7 @@ var useEmbeddedReveal = require('./lib/utils/hooks/useEmbeddedReveal/useEmbedded
|
|
|
110
110
|
var useEmbeddedWalletAuthenticator = require('./lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.cjs');
|
|
111
111
|
var useDynamicModals = require('./lib/utils/hooks/useDynamicModals/useDynamicModals.cjs');
|
|
112
112
|
var useMfa = require('./lib/utils/hooks/useMfa/useMfa.cjs');
|
|
113
|
+
var useTokenBalances = require('./lib/utils/hooks/useTokenBalances/useTokenBalances.cjs');
|
|
113
114
|
var DynamicConnectButton = require('./lib/components/DynamicConnectButton/DynamicConnectButton.cjs');
|
|
114
115
|
require('./lib/components/InlineWidget/InlineWidget.cjs');
|
|
115
116
|
var IsBrowser = require('./lib/components/IsBrowser/IsBrowser.cjs');
|
|
@@ -207,6 +208,7 @@ exports.useEmbeddedReveal = useEmbeddedReveal.useEmbeddedReveal;
|
|
|
207
208
|
exports.useEmbeddedWalletAuthenticator = useEmbeddedWalletAuthenticator.useEmbeddedWalletAuthenticator;
|
|
208
209
|
exports.useDynamicModals = useDynamicModals.useDynamicModals;
|
|
209
210
|
exports.useMfa = useMfa.useMfa;
|
|
211
|
+
exports.useTokenBalances = useTokenBalances.useTokenBalances;
|
|
210
212
|
exports.DynamicConnectButton = DynamicConnectButton.DynamicConnectButton;
|
|
211
213
|
exports.IsBrowser = IsBrowser.IsBrowser;
|
|
212
214
|
exports.NoQrNotInstalledView = NoQrNotInstalledView.NoQrNotInstalledView;
|
package/src/index.d.ts
CHANGED
|
@@ -106,7 +106,7 @@ export { FilterAndSortWallets, FilterBridgeChainsName, FilterChain, FilterWallet
|
|
|
106
106
|
export {
|
|
107
107
|
/** @deprecated */
|
|
108
108
|
DynamicWidgetContextProvider, } from './lib/widgets/DynamicWidget/context';
|
|
109
|
-
export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, } from './lib/utils/hooks';
|
|
109
|
+
export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, } from './lib/utils/hooks';
|
|
110
110
|
export { useUserUpdateRequest, useWalletConnectorEvent, } from './lib/utils/hooks';
|
|
111
111
|
export { type VerifyOtp, useOtpVerificationRequest, } from './lib/utils/hooks/authenticationHooks/';
|
|
112
112
|
export type { UpdateUserFieldsArg } from './lib/utils/hooks/';
|
package/src/index.js
CHANGED
|
@@ -106,6 +106,7 @@ export { useEmbeddedReveal } from './lib/utils/hooks/useEmbeddedReveal/useEmbedd
|
|
|
106
106
|
export { useEmbeddedWalletAuthenticator } from './lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.js';
|
|
107
107
|
export { useDynamicModals } from './lib/utils/hooks/useDynamicModals/useDynamicModals.js';
|
|
108
108
|
export { useMfa } from './lib/utils/hooks/useMfa/useMfa.js';
|
|
109
|
+
export { useTokenBalances } from './lib/utils/hooks/useTokenBalances/useTokenBalances.js';
|
|
109
110
|
export { DynamicConnectButton } from './lib/components/DynamicConnectButton/DynamicConnectButton.js';
|
|
110
111
|
import './lib/components/InlineWidget/InlineWidget.js';
|
|
111
112
|
export { IsBrowser } from './lib/components/IsBrowser/IsBrowser.js';
|
|
@@ -10,7 +10,7 @@ var TextButton = require('../TextButton/TextButton.cjs');
|
|
|
10
10
|
var TypographyButton = require('../TypographyButton/TypographyButton.cjs');
|
|
11
11
|
var Tooltip = require('../Tooltip/Tooltip.cjs');
|
|
12
12
|
|
|
13
|
-
const CopyButton = ({ children, className = '', textToCopy, onClick, variant = 'text', copykey, buttonPadding = 'small', buttonVariant = 'primary', buttonClassName = '', startSlot, }) => {
|
|
13
|
+
const CopyButton = ({ children, className = '', textToCopy, onClick, variant = 'text', copykey, buttonPadding = 'small', buttonVariant = 'primary', buttonClassName = '', startSlot, disabled, }) => {
|
|
14
14
|
const [copied, setCopied] = React.useState(false);
|
|
15
15
|
const copyToClipboard = () => {
|
|
16
16
|
navigator.clipboard.writeText(textToCopy);
|
|
@@ -19,9 +19,9 @@ const CopyButton = ({ children, className = '', textToCopy, onClick, variant = '
|
|
|
19
19
|
};
|
|
20
20
|
const CopyButtonTooltip = () => (jsxRuntime.jsx(Tooltip.Tooltip, { className: 'copy-button__tooltip', content: copied ? 'Copied' : 'Copy', children: children }));
|
|
21
21
|
if (variant === 'text') {
|
|
22
|
-
return (jsxRuntime.jsx(TextButton.TextButton, { className: classNames.classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, children: jsxRuntime.jsx(CopyButtonTooltip, {}) }));
|
|
22
|
+
return (jsxRuntime.jsx(TextButton.TextButton, { className: classNames.classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, disabled: disabled, children: jsxRuntime.jsx(CopyButtonTooltip, {}) }));
|
|
23
23
|
}
|
|
24
|
-
return (jsxRuntime.jsx(TypographyButton.TypographyButton, { expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, children: jsxRuntime.jsx(CopyButtonTooltip, {}) }));
|
|
24
|
+
return (jsxRuntime.jsx(TypographyButton.TypographyButton, { expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, disabled: disabled, children: jsxRuntime.jsx(CopyButtonTooltip, {}) }));
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
exports.CopyButton = CopyButton;
|
|
@@ -8,5 +8,5 @@ type Props = ComponentPropsWithoutRef<'button'> & {
|
|
|
8
8
|
textToCopy: string;
|
|
9
9
|
variant?: 'text' | 'button';
|
|
10
10
|
} & CopyKey & Pick<ButtonProps, 'buttonPadding' | 'buttonVariant' | 'buttonClassName' | 'startSlot'>;
|
|
11
|
-
export declare const CopyButton: ({ children, className, textToCopy, onClick, variant, copykey, buttonPadding, buttonVariant, buttonClassName, startSlot, }: Props) => JSX.Element;
|
|
11
|
+
export declare const CopyButton: ({ children, className, textToCopy, onClick, variant, copykey, buttonPadding, buttonVariant, buttonClassName, startSlot, disabled, }: Props) => JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -6,7 +6,7 @@ import { TextButton } from '../TextButton/TextButton.js';
|
|
|
6
6
|
import { TypographyButton } from '../TypographyButton/TypographyButton.js';
|
|
7
7
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
8
8
|
|
|
9
|
-
const CopyButton = ({ children, className = '', textToCopy, onClick, variant = 'text', copykey, buttonPadding = 'small', buttonVariant = 'primary', buttonClassName = '', startSlot, }) => {
|
|
9
|
+
const CopyButton = ({ children, className = '', textToCopy, onClick, variant = 'text', copykey, buttonPadding = 'small', buttonVariant = 'primary', buttonClassName = '', startSlot, disabled, }) => {
|
|
10
10
|
const [copied, setCopied] = useState(false);
|
|
11
11
|
const copyToClipboard = () => {
|
|
12
12
|
navigator.clipboard.writeText(textToCopy);
|
|
@@ -15,9 +15,9 @@ const CopyButton = ({ children, className = '', textToCopy, onClick, variant = '
|
|
|
15
15
|
};
|
|
16
16
|
const CopyButtonTooltip = () => (jsx(Tooltip, { className: 'copy-button__tooltip', content: copied ? 'Copied' : 'Copy', children: children }));
|
|
17
17
|
if (variant === 'text') {
|
|
18
|
-
return (jsx(TextButton, { className: classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, children: jsx(CopyButtonTooltip, {}) }));
|
|
18
|
+
return (jsx(TextButton, { className: classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, disabled: disabled, children: jsx(CopyButtonTooltip, {}) }));
|
|
19
19
|
}
|
|
20
|
-
return (jsx(TypographyButton, { expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, children: jsx(CopyButtonTooltip, {}) }));
|
|
20
|
+
return (jsx(TypographyButton, { expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, disabled: disabled, children: jsx(CopyButtonTooltip, {}) }));
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export { CopyButton };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var IconWithSpinner = require('../IconWithSpinner/IconWithSpinner.cjs');
|
|
8
|
+
|
|
9
|
+
const LoadingQrCode = ({ Icon, logoSize }) => (jsxRuntime.jsx("div", { className: 'qrcode__container qrcode', "data-testid": 'loading-qrcode', children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: Icon, iconSize: logoSize, isSpinning: true, className: 'qrcode__icon' }) }));
|
|
10
|
+
|
|
11
|
+
exports.LoadingQrCode = LoadingQrCode;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { IconWithSpinner } from '../IconWithSpinner/IconWithSpinner.js';
|
|
4
|
+
|
|
5
|
+
const LoadingQrCode = ({ Icon, logoSize }) => (jsx("div", { className: 'qrcode__container qrcode', "data-testid": 'loading-qrcode', children: jsx(IconWithSpinner, { Icon: Icon, iconSize: logoSize, isSpinning: true, className: 'qrcode__icon' }) }));
|
|
6
|
+
|
|
7
|
+
export { LoadingQrCode };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LoadingQrCode } from './LoadingQrCode';
|
|
@@ -77,6 +77,7 @@ require('../../IsBrowser/IsBrowser.cjs');
|
|
|
77
77
|
require('../../Popper/Popper/Popper.cjs');
|
|
78
78
|
require('../../Popper/PopperContext/PopperContext.cjs');
|
|
79
79
|
var QRCode = require('../../QRCode/QRCode.cjs');
|
|
80
|
+
var LoadingQrCode = require('../../LoadingQrCode/LoadingQrCode.cjs');
|
|
80
81
|
require('../../../views/WalletList/WalletList.cjs');
|
|
81
82
|
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
82
83
|
require('@hcaptcha/react-hcaptcha');
|
|
@@ -101,7 +102,7 @@ const QrCodeContainer = ({ accentColor, walletConnector, qrcodeValue, Icon: Main
|
|
|
101
102
|
};
|
|
102
103
|
return (jsxRuntime.jsxs("div", { className: classNames.classNames('qrcode-container__container', {
|
|
103
104
|
'qrcode-container__container--message': showQrCodeMessage,
|
|
104
|
-
}), children: [jsxRuntime.jsxs("div", { className: 'qrcode-container__top', children: [qrcodeValue
|
|
105
|
+
}), children: [jsxRuntime.jsxs("div", { className: 'qrcode-container__top', children: [qrcodeValue.length ? (jsxRuntime.jsx(QRCode.QRCode, { Icon: MainIcon, accentColor: accentColor, value: qrcodeValue, logoSize: 50, walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, showQrCodeImage: showQrCodeImage })) : (jsxRuntime.jsx(LoadingQrCode.LoadingQrCode, { Icon: MainIcon, logoSize: 50 })), jsxRuntime.jsx(MockedQrCode.MockedQrCode, {}), jsxRuntime.jsxs("div", { className: 'button-container', children: [showCopyToClipboardButton && (jsxRuntime.jsx(CopyButton.CopyButton, { variant: 'button', textToCopy: qrcodeValue, disabled: !qrcodeValue.length, buttonClassName: 'qr-code-button', copykey: 'dyn_qr_code.copy_button', startSlot:
|
|
105
106
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
106
107
|
jsxRuntime.jsx(Icon.Icon, { size: 'mini', color: 'text-tertiary', children: jsxRuntime.jsx(link.ReactComponent, {}) }), children: t('dyn_qr_code.copy_button') })), renderAppOrExtensionButton()] })] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', className: 'qrcode-container__content', copykey: 'dyn_qr_code.scan_title', children: t('dyn_qr_code.scan_title', {
|
|
107
108
|
app: walletConnector ? 'wallet' : 'app',
|
|
@@ -73,6 +73,7 @@ import '../../IsBrowser/IsBrowser.js';
|
|
|
73
73
|
import '../../Popper/Popper/Popper.js';
|
|
74
74
|
import '../../Popper/PopperContext/PopperContext.js';
|
|
75
75
|
import { QRCode } from '../../QRCode/QRCode.js';
|
|
76
|
+
import { LoadingQrCode } from '../../LoadingQrCode/LoadingQrCode.js';
|
|
76
77
|
import '../../../views/WalletList/WalletList.js';
|
|
77
78
|
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
78
79
|
import '@hcaptcha/react-hcaptcha';
|
|
@@ -97,7 +98,7 @@ const QrCodeContainer = ({ accentColor, walletConnector, qrcodeValue, Icon: Main
|
|
|
97
98
|
};
|
|
98
99
|
return (jsxs("div", { className: classNames('qrcode-container__container', {
|
|
99
100
|
'qrcode-container__container--message': showQrCodeMessage,
|
|
100
|
-
}), children: [jsxs("div", { className: 'qrcode-container__top', children: [qrcodeValue
|
|
101
|
+
}), children: [jsxs("div", { className: 'qrcode-container__top', children: [qrcodeValue.length ? (jsx(QRCode, { Icon: MainIcon, accentColor: accentColor, value: qrcodeValue, logoSize: 50, walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, showQrCodeImage: showQrCodeImage })) : (jsx(LoadingQrCode, { Icon: MainIcon, logoSize: 50 })), jsx(MockedQrCode, {}), jsxs("div", { className: 'button-container', children: [showCopyToClipboardButton && (jsx(CopyButton, { variant: 'button', textToCopy: qrcodeValue, disabled: !qrcodeValue.length, buttonClassName: 'qr-code-button', copykey: 'dyn_qr_code.copy_button', startSlot:
|
|
101
102
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
102
103
|
jsx(Icon, { size: 'mini', color: 'text-tertiary', children: jsx(SvgLink, {}) }), children: t('dyn_qr_code.copy_button') })), renderAppOrExtensionButton()] })] }), jsx(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', className: 'qrcode-container__content', copykey: 'dyn_qr_code.scan_title', children: t('dyn_qr_code.scan_title', {
|
|
103
104
|
app: walletConnector ? 'wallet' : 'app',
|
|
@@ -81,7 +81,11 @@ require('../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSign
|
|
|
81
81
|
const QrCodeWrapper = ({ uri, desktopUri, icon, accentColor, showCopyToClipboardButton, walletConnector, }) => {
|
|
82
82
|
const [showQrCodeMessage, setShowQrCodeMessage] = React.useState(false);
|
|
83
83
|
const [showQrCodeImage, setShowQrCodeImage] = React.useState(false);
|
|
84
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Show the QR code message after 5 seconds
|
|
86
|
+
* disabled if url is empty
|
|
87
|
+
*/
|
|
88
|
+
useTimeout.useTimeout(() => setShowQrCodeMessage(true), uri.length ? 5000 : null);
|
|
85
89
|
return (jsxRuntime.jsxs("div", { "data-testid": 'qr-code-wrapper', children: [jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, { style: { width: '100%' } }), children: showQrCodeMessage && !showQrCodeImage && (jsxRuntime.jsxs("div", { className: 'qr-code-wrapper__scan-issue-message', children: [jsxRuntime.jsx(Typography.Typography, { color: 'primary', variant: 'body_small', children: "If you're having issues scanning, click\u00A0" }), jsxRuntime.jsx("button", { "data-testid": 'qr-code-wrapper__scan-issue-button', className: 'qr-code-wrapper__scan-issue-button', onClick: () => setShowQrCodeImage(true), children: "here" })] })) }), jsxRuntime.jsx(QrCodeContainer.QrCodeContainer, { showQrCodeMessage: showQrCodeMessage, desktopUri: desktopUri, accentColor: accentColor, walletConnector: walletConnector, qrcodeValue: uri, Icon: icon, showCopyToClipboardButton: showCopyToClipboardButton, showQrCodeImage: showQrCodeImage })] }));
|
|
86
90
|
};
|
|
87
91
|
|
|
@@ -77,7 +77,11 @@ import '../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignI
|
|
|
77
77
|
const QrCodeWrapper = ({ uri, desktopUri, icon, accentColor, showCopyToClipboardButton, walletConnector, }) => {
|
|
78
78
|
const [showQrCodeMessage, setShowQrCodeMessage] = useState(false);
|
|
79
79
|
const [showQrCodeImage, setShowQrCodeImage] = useState(false);
|
|
80
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Show the QR code message after 5 seconds
|
|
82
|
+
* disabled if url is empty
|
|
83
|
+
*/
|
|
84
|
+
useTimeout(() => setShowQrCodeMessage(true), uri.length ? 5000 : null);
|
|
81
85
|
return (jsxs("div", { "data-testid": 'qr-code-wrapper', children: [jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, { style: { width: '100%' } }), children: showQrCodeMessage && !showQrCodeImage && (jsxs("div", { className: 'qr-code-wrapper__scan-issue-message', children: [jsx(Typography, { color: 'primary', variant: 'body_small', children: "If you're having issues scanning, click\u00A0" }), jsx("button", { "data-testid": 'qr-code-wrapper__scan-issue-button', className: 'qr-code-wrapper__scan-issue-button', onClick: () => setShowQrCodeImage(true), children: "here" })] })) }), jsx(QrCodeContainer, { showQrCodeMessage: showQrCodeMessage, desktopUri: desktopUri, accentColor: accentColor, walletConnector: walletConnector, qrcodeValue: uri, Icon: icon, showCopyToClipboardButton: showCopyToClipboardButton, showQrCodeImage: showQrCodeImage })] }));
|
|
82
86
|
};
|
|
83
87
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
8
|
+
var logger = require('../../../shared/logger.cjs');
|
|
9
|
+
require('@dynamic-labs/iconic');
|
|
10
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
11
|
+
require('react/jsx-runtime');
|
|
12
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
13
|
+
require('react');
|
|
14
|
+
require('@dynamic-labs/wallet-book');
|
|
15
|
+
require('../../../utils/constants/colors.cjs');
|
|
16
|
+
require('../../../utils/constants/values.cjs');
|
|
17
|
+
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
18
|
+
require('@dynamic-labs/utils');
|
|
19
|
+
require('../../../shared/consts/index.cjs');
|
|
20
|
+
var api = require('../api.cjs');
|
|
21
|
+
|
|
22
|
+
const getAccountTokenBalances = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ userJwt, environmentId, chainName = sdkApiCore.ChainEnum.Evm, networkId, accountAddress, }) {
|
|
23
|
+
try {
|
|
24
|
+
const data = yield api.sdkApi(userJwt).getAccountBalances({
|
|
25
|
+
accountAddress,
|
|
26
|
+
chainName: chainName,
|
|
27
|
+
environmentId,
|
|
28
|
+
networkId,
|
|
29
|
+
});
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
logger.logger.error(e);
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
exports.getAccountTokenBalances = getAccountTokenBalances;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChainEnum, TokenBalance } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
export declare const getAccountTokenBalances: ({ userJwt, environmentId, chainName, networkId, accountAddress, }: {
|
|
3
|
+
userJwt: string;
|
|
4
|
+
environmentId: string;
|
|
5
|
+
chainName: ChainEnum;
|
|
6
|
+
networkId: number;
|
|
7
|
+
accountAddress: string;
|
|
8
|
+
}) => Promise<TokenBalance[] | undefined>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { ChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
4
|
+
import { logger } from '../../../shared/logger.js';
|
|
5
|
+
import '@dynamic-labs/iconic';
|
|
6
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
7
|
+
import 'react/jsx-runtime';
|
|
8
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@dynamic-labs/wallet-book';
|
|
11
|
+
import '../../../utils/constants/colors.js';
|
|
12
|
+
import '../../../utils/constants/values.js';
|
|
13
|
+
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
14
|
+
import '@dynamic-labs/utils';
|
|
15
|
+
import '../../../shared/consts/index.js';
|
|
16
|
+
import { sdkApi } from '../api.js';
|
|
17
|
+
|
|
18
|
+
const getAccountTokenBalances = (_a) => __awaiter(void 0, [_a], void 0, function* ({ userJwt, environmentId, chainName = ChainEnum.Evm, networkId, accountAddress, }) {
|
|
19
|
+
try {
|
|
20
|
+
const data = yield sdkApi(userJwt).getAccountBalances({
|
|
21
|
+
accountAddress,
|
|
22
|
+
chainName: chainName,
|
|
23
|
+
environmentId,
|
|
24
|
+
networkId,
|
|
25
|
+
});
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
logger.error(e);
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export { getAccountTokenBalances };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './balances';
|
|
@@ -7,6 +7,7 @@ const MISSING_ADDRESS_ERROR = 'missing_address';
|
|
|
7
7
|
// HEADLESS ERRORS
|
|
8
8
|
const ACTIVE_SESSION = 'session_active';
|
|
9
9
|
const ERROR_SENDING_CODE = 'error_sending_code';
|
|
10
|
+
const ERROR_PROCESSING_REVEAL_REQUEST = 'error_processing_reveal_request';
|
|
10
11
|
const INVALID_REQUEST = 'invalid_request';
|
|
11
12
|
const INVALID_WALLET_DATA = 'invalid_wallet';
|
|
12
13
|
const SECURE_ENCLAVE_PROVIDER_NOT_ENABLED = 'secure_enclave_provider_not_enabled';
|
|
@@ -17,6 +18,7 @@ const SESSION_RESTORED = 'SESSION_RESTORED';
|
|
|
17
18
|
|
|
18
19
|
exports.ACTIVE_SESSION = ACTIVE_SESSION;
|
|
19
20
|
exports.CODE_SENT = CODE_SENT;
|
|
21
|
+
exports.ERROR_PROCESSING_REVEAL_REQUEST = ERROR_PROCESSING_REVEAL_REQUEST;
|
|
20
22
|
exports.ERROR_SENDING_CODE = ERROR_SENDING_CODE;
|
|
21
23
|
exports.INVALID_REQUEST = INVALID_REQUEST;
|
|
22
24
|
exports.INVALID_WALLET_DATA = INVALID_WALLET_DATA;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const MISSING_ADDRESS_ERROR = "missing_address";
|
|
2
2
|
export declare const ACTIVE_SESSION = "session_active";
|
|
3
3
|
export declare const ERROR_SENDING_CODE = "error_sending_code";
|
|
4
|
+
export declare const ERROR_PROCESSING_REVEAL_REQUEST = "error_processing_reveal_request";
|
|
4
5
|
export declare const INVALID_REQUEST = "invalid_request";
|
|
5
6
|
export declare const INVALID_WALLET_DATA = "invalid_wallet";
|
|
6
7
|
export declare const SECURE_ENCLAVE_PROVIDER_NOT_ENABLED = "secure_enclave_provider_not_enabled";
|
|
@@ -3,6 +3,7 @@ const MISSING_ADDRESS_ERROR = 'missing_address';
|
|
|
3
3
|
// HEADLESS ERRORS
|
|
4
4
|
const ACTIVE_SESSION = 'session_active';
|
|
5
5
|
const ERROR_SENDING_CODE = 'error_sending_code';
|
|
6
|
+
const ERROR_PROCESSING_REVEAL_REQUEST = 'error_processing_reveal_request';
|
|
6
7
|
const INVALID_REQUEST = 'invalid_request';
|
|
7
8
|
const INVALID_WALLET_DATA = 'invalid_wallet';
|
|
8
9
|
const SECURE_ENCLAVE_PROVIDER_NOT_ENABLED = 'secure_enclave_provider_not_enabled';
|
|
@@ -11,4 +12,4 @@ const CODE_SENT = 'code_sent';
|
|
|
11
12
|
const SESSION_CREATED = 'session_created';
|
|
12
13
|
const SESSION_RESTORED = 'SESSION_RESTORED';
|
|
13
14
|
|
|
14
|
-
export { ACTIVE_SESSION, CODE_SENT, ERROR_SENDING_CODE, INVALID_REQUEST, INVALID_WALLET_DATA, MISSING_ADDRESS_ERROR, SECURE_ENCLAVE_PROVIDER_NOT_ENABLED, SESSION_CREATED, SESSION_RESTORED, USER_NOT_LOGGED_IN };
|
|
15
|
+
export { ACTIVE_SESSION, CODE_SENT, ERROR_PROCESSING_REVEAL_REQUEST, ERROR_SENDING_CODE, INVALID_REQUEST, INVALID_WALLET_DATA, MISSING_ADDRESS_ERROR, SECURE_ENCLAVE_PROVIDER_NOT_ENABLED, SESSION_CREATED, SESSION_RESTORED, USER_NOT_LOGGED_IN };
|
|
@@ -53,3 +53,4 @@ export { useNetworkNotSupported } from './useNetworkNotSupported';
|
|
|
53
53
|
export { useHandleVerifiedUser } from './useHandleVerifiedUser';
|
|
54
54
|
export { useMfa } from './useMfa';
|
|
55
55
|
export { useMergeUserAccounts } from './useMergeUserAccounts';
|
|
56
|
+
export { useTokenBalances } from './useTokenBalances';
|
|
@@ -35,6 +35,7 @@ require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
|
35
35
|
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
36
36
|
require('react-dom');
|
|
37
37
|
var WalletContext = require('../../../context/WalletContext/WalletContext.cjs');
|
|
38
|
+
var useIsTurnkeyWallet = require('../useIsTurnkeyWallet/useIsTurnkeyWallet.cjs');
|
|
38
39
|
var useSecureEnclaveEmbeddedWallet = require('./useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs');
|
|
39
40
|
var useMPCEmbeddedWallet = require('./useMPCEmbeddedWallet/useMPCEmbeddedWallet.cjs');
|
|
40
41
|
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
@@ -82,21 +83,33 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
82
83
|
/**
|
|
83
84
|
* @returns {
|
|
84
85
|
* createEmbeddedWallet, - creates Dynamic embedded wallet according to the settings
|
|
86
|
+
* createOrRestoreSession, - creates or restores session for the embedded wallet
|
|
87
|
+
* createPasskey, - creates passkey for the embedded wallet
|
|
85
88
|
* createPassword, - creates MPC embedded wallet password
|
|
89
|
+
* getPasskeys, - gets passkeys for the embedded wallet
|
|
86
90
|
* isLoadingEmbeddedWallet, - loading state of the embedded wallet
|
|
91
|
+
* isSessionActive, - checks if the session is active for the embedded wallet
|
|
92
|
+
* revealWalletKey, - reveals the private key or recovery phrase for the embedded wallet
|
|
93
|
+
* sendOneTimeCode, - sends one time code for the embedded wallet
|
|
87
94
|
* userHasEmbeddedWallet, - checks if the user has an embedded wallet
|
|
88
95
|
* }
|
|
89
96
|
*/
|
|
90
97
|
const useEmbeddedWallet = () => {
|
|
91
|
-
const { onboardingOnlyJwt } = useInternalDynamicContext.useInternalDynamicContext();
|
|
92
|
-
const {
|
|
93
|
-
const { createEmbeddedWallet:
|
|
98
|
+
const { onboardingOnlyJwt, user } = useInternalDynamicContext.useInternalDynamicContext();
|
|
99
|
+
const { isTurnkeyWallet } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
100
|
+
const { createEmbeddedWallet: createCoinbaseMPCWallet, canCreateMPCWallet, createPassword, revealEmbeddedWalletKey: reveaCoinbaseMPCEmbeddedWalletKey, } = useMPCEmbeddedWallet.useMPCEmbeddedWallet();
|
|
101
|
+
const { createEmbeddedWallet: createTurnkeyEmbeddedWallet, createOrRestoreSession, createPasskey, revealEmbeddedWalletKey: revealTurnkeyEmbeddedWalletKey, getPasskeys, isSessionActive, sendOneTimeCode, } = useSecureEnclaveEmbeddedWallet.useSecureEnclaveEmbeddedWallet();
|
|
94
102
|
const { isLoadingEmbeddedWallet } = WalletContext.useWalletContext();
|
|
103
|
+
/**
|
|
104
|
+
* Checks if user has some embedded wallet
|
|
105
|
+
* @returns boolean - true if the user has an embedded wallet
|
|
106
|
+
*/
|
|
95
107
|
const userHasEmbeddedWallet = () => hasEmbeddedWallet.hasEmbeddedWallet(getAuthToken.getAuthToken() || onboardingOnlyJwt);
|
|
96
108
|
/**
|
|
97
109
|
* Creates Dynamic embedded wallet according to the settings
|
|
98
110
|
* @param chains - array of chains to create the wallet for
|
|
99
111
|
* @param options - options for the wallet creation
|
|
112
|
+
* @returns Promise<Wallet | undefined> - created wallet object
|
|
100
113
|
*/
|
|
101
114
|
const createEmbeddedWallet = React.useCallback((chains, options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
102
115
|
if (yield canCreateMPCWallet(chains)) {
|
|
@@ -106,6 +119,23 @@ const useEmbeddedWallet = () => {
|
|
|
106
119
|
const wallet = yield createTurnkeyEmbeddedWallet(chains, options);
|
|
107
120
|
return wallet;
|
|
108
121
|
}), [canCreateMPCWallet, createCoinbaseMPCWallet, createTurnkeyEmbeddedWallet]);
|
|
122
|
+
/**
|
|
123
|
+
* Reveals the private key or recovery phrase for the embedded wallet
|
|
124
|
+
* @param options - options for revealing the wallet key
|
|
125
|
+
* @returns Promise<boolean> - true if the key was revealed successfully
|
|
126
|
+
*/
|
|
127
|
+
const revealWalletKey = (options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
128
|
+
if (!user) {
|
|
129
|
+
throw new Error('User is not logged in');
|
|
130
|
+
}
|
|
131
|
+
if (!userHasEmbeddedWallet()) {
|
|
132
|
+
throw new Error('Embedded wallet not found');
|
|
133
|
+
}
|
|
134
|
+
if (isTurnkeyWallet) {
|
|
135
|
+
return revealTurnkeyEmbeddedWalletKey(options);
|
|
136
|
+
}
|
|
137
|
+
return reveaCoinbaseMPCEmbeddedWalletKey();
|
|
138
|
+
});
|
|
109
139
|
return {
|
|
110
140
|
createEmbeddedWallet,
|
|
111
141
|
createOrRestoreSession,
|
|
@@ -114,6 +144,7 @@ const useEmbeddedWallet = () => {
|
|
|
114
144
|
getPasskeys,
|
|
115
145
|
isLoadingEmbeddedWallet,
|
|
116
146
|
isSessionActive,
|
|
147
|
+
revealWalletKey,
|
|
117
148
|
sendOneTimeCode,
|
|
118
149
|
userHasEmbeddedWallet,
|
|
119
150
|
};
|
|
@@ -1,28 +1,37 @@
|
|
|
1
1
|
import { ChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
2
|
-
import { WebAuthnAttestation } from '@dynamic-labs/wallet-connector-core';
|
|
3
2
|
import { Wallet } from '../../../shared';
|
|
4
3
|
/**
|
|
5
4
|
* @returns {
|
|
6
5
|
* createEmbeddedWallet, - creates Dynamic embedded wallet according to the settings
|
|
6
|
+
* createOrRestoreSession, - creates or restores session for the embedded wallet
|
|
7
|
+
* createPasskey, - creates passkey for the embedded wallet
|
|
7
8
|
* createPassword, - creates MPC embedded wallet password
|
|
9
|
+
* getPasskeys, - gets passkeys for the embedded wallet
|
|
8
10
|
* isLoadingEmbeddedWallet, - loading state of the embedded wallet
|
|
11
|
+
* isSessionActive, - checks if the session is active for the embedded wallet
|
|
12
|
+
* revealWalletKey, - reveals the private key or recovery phrase for the embedded wallet
|
|
13
|
+
* sendOneTimeCode, - sends one time code for the embedded wallet
|
|
9
14
|
* userHasEmbeddedWallet, - checks if the user has an embedded wallet
|
|
10
15
|
* }
|
|
11
16
|
*/
|
|
12
17
|
export declare const useEmbeddedWallet: () => {
|
|
13
18
|
readonly createEmbeddedWallet: (chains?: ChainEnum[], options?: {
|
|
14
|
-
webAuthnAttestation: WebAuthnAttestation;
|
|
15
|
-
}) => Promise<Wallet | undefined>;
|
|
16
|
-
readonly createOrRestoreSession: (
|
|
17
|
-
oneTimeCode
|
|
18
|
-
}) => Promise<string>;
|
|
19
|
-
readonly createPasskey: (
|
|
20
|
-
oneTimeCode
|
|
21
|
-
}) => Promise<WebAuthnAttestation>;
|
|
19
|
+
webAuthnAttestation: import("dist/packages/wallet-connector-core/src").WebAuthnAttestation;
|
|
20
|
+
} | undefined) => Promise<Wallet | undefined>;
|
|
21
|
+
readonly createOrRestoreSession: (options: {
|
|
22
|
+
oneTimeCode: string;
|
|
23
|
+
} | undefined) => Promise<string>;
|
|
24
|
+
readonly createPasskey: (options: {
|
|
25
|
+
oneTimeCode: string;
|
|
26
|
+
} | undefined) => Promise<import("dist/packages/wallet-connector-core/src").WebAuthnAttestation>;
|
|
22
27
|
readonly createPassword: (showIntro?: boolean | undefined) => Promise<string>;
|
|
23
28
|
readonly getPasskeys: () => Promise<import("@dynamic-labs/sdk-api-core").UserPasskey[]>;
|
|
24
29
|
readonly isLoadingEmbeddedWallet: boolean;
|
|
25
30
|
readonly isSessionActive: boolean;
|
|
31
|
+
readonly revealWalletKey: (options?: {
|
|
32
|
+
type: "recoveryPhrase" | "privateKey";
|
|
33
|
+
htmlContainerId?: string | undefined;
|
|
34
|
+
} | undefined) => Promise<boolean>;
|
|
26
35
|
readonly sendOneTimeCode: () => Promise<string>;
|
|
27
36
|
readonly userHasEmbeddedWallet: () => boolean;
|
|
28
37
|
};
|