@dynamic-labs/sdk-react-core 2.1.0-alpha.7 → 2.1.0-alpha.9
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 +18 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +13 -13
- package/src/lib/components/Portal/Portal.cjs +2 -1
- package/src/lib/components/Portal/Portal.js +2 -1
- package/src/lib/components/SandboxIndicatorWrapper/SandboxIndicatorWrapper.d.ts +0 -2
- package/src/lib/components/Toolkit/components/index.d.ts +0 -6
- package/src/lib/components/Tooltip/Tooltip.cjs +2 -1
- package/src/lib/components/Tooltip/Tooltip.js +2 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +5 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +5 -2
- package/src/lib/context/DynamicContext/types/index.d.ts +0 -1
- package/src/lib/data/api/wallets/wallets.cjs +21 -5
- package/src/lib/data/api/wallets/wallets.d.ts +4 -0
- package/src/lib/data/api/wallets/wallets.js +21 -6
- package/src/lib/shared/utils/classes/storage/localStorage.cjs +2 -2
- package/src/lib/shared/utils/classes/storage/localStorage.js +2 -2
- package/src/lib/utils/functions/addPasskeyIdentifierToWalletConnector/addPasskeyIdentifierToWalletConnector.cjs +14 -0
- package/src/lib/utils/functions/addPasskeyIdentifierToWalletConnector/addPasskeyIdentifierToWalletConnector.d.ts +3 -0
- package/src/lib/utils/functions/addPasskeyIdentifierToWalletConnector/addPasskeyIdentifierToWalletConnector.js +10 -0
- package/src/lib/utils/functions/addPasskeyIdentifierToWalletConnector/index.d.ts +1 -0
- package/src/lib/utils/functions/createUserProfile/createUserProfile.cjs +1 -2
- package/src/lib/utils/functions/createUserProfile/createUserProfile.js +1 -2
- package/src/lib/utils/functions/findEmbeddedWalletFromVerifiedCredentials/findEmbeddedWalletFromVerifiedCredentials.cjs +3 -4
- package/src/lib/utils/functions/findEmbeddedWalletFromVerifiedCredentials/findEmbeddedWalletFromVerifiedCredentials.d.ts +1 -1
- package/src/lib/utils/functions/findEmbeddedWalletFromVerifiedCredentials/findEmbeddedWalletFromVerifiedCredentials.js +4 -5
- package/src/lib/utils/functions/findTurnkeyWallet/findTurnkeyWallet.cjs +1 -1
- package/src/lib/utils/functions/findTurnkeyWallet/findTurnkeyWallet.d.ts +3 -1
- package/src/lib/utils/functions/findTurnkeyWallet/findTurnkeyWallet.js +1 -1
- package/src/lib/utils/functions/getUserVerifiedCredentialType/getUserVerifiedCredentialType.cjs +5 -5
- package/src/lib/utils/functions/getUserVerifiedCredentialType/getUserVerifiedCredentialType.d.ts +3 -2
- package/src/lib/utils/functions/getUserVerifiedCredentialType/getUserVerifiedCredentialType.js +5 -5
- package/src/lib/utils/functions/hasEmbeddedWallet/hasEmbeddedWallet.cjs +7 -2
- package/src/lib/utils/functions/hasEmbeddedWallet/hasEmbeddedWallet.js +7 -2
- package/src/lib/utils/functions/index.d.ts +1 -1
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.cjs +2 -1
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.js +2 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +16 -11
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.d.ts +7 -2
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +16 -11
- package/src/lib/utils/hooks/useDynamicScopes/useDynamicScopes.cjs +3 -3
- package/src/lib/utils/hooks/useDynamicScopes/useDynamicScopes.js +3 -3
- package/src/lib/utils/hooks/useElementById/useElementById.cjs +33 -18
- package/src/lib/utils/hooks/useElementById/useElementById.d.ts +3 -1
- package/src/lib/utils/hooks/useElementById/useElementById.js +33 -18
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +9 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.d.ts +6 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +9 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +6 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.d.ts +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +6 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.cjs +7 -7
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.d.ts +2 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.js +7 -7
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +24 -27
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.d.ts +6 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +24 -27
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +16 -11
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.d.ts +4 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +16 -11
- package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs +2 -2
- package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js +2 -2
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +2 -1
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +2 -1
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +13 -4
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.d.ts +10 -2
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +13 -4
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +2 -3
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +2 -3
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.cjs +2 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.js +2 -1
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +5 -4
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.d.ts +6 -1
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +5 -4
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs +2 -1
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js +2 -1
- package/src/lib/views/Passkey/utils/{createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.cjs → createEmbeddedWalletRequest/createEmbeddedWalletRequest.cjs} +17 -18
- package/src/lib/views/Passkey/utils/{createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.d.ts → createEmbeddedWalletRequest/createEmbeddedWalletRequest.d.ts} +7 -3
- package/src/lib/views/Passkey/utils/{createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.js → createEmbeddedWalletRequest/createEmbeddedWalletRequest.js} +17 -18
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/index.d.ts +1 -0
- package/src/lib/views/Passkey/utils/index.d.ts +1 -2
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +2 -2
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +2 -2
- package/src/lib/views/WalletList/WalletList.cjs +3 -6
- package/src/lib/views/WalletList/WalletList.js +3 -6
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +2 -8
- package/src/lib/views/WalletLockedView/WalletLockedView.js +2 -8
- package/src/lib/views/viewToComponentMap.d.ts +4 -2
- package/src/lib/widgets/DynamicWidget/components/PromptModal/PromptModal.cjs +2 -1
- package/src/lib/widgets/DynamicWidget/components/PromptModal/PromptModal.js +2 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchNameService/useFetchNameService.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchNameService/useFetchNameService.js +1 -1
- package/src/lib/utils/functions/isEmbeddedWalletPresent/index.d.ts +0 -1
- package/src/lib/utils/functions/isEmbeddedWalletPresent/isEmbeddedWalletPresent.cjs +0 -19
- package/src/lib/utils/functions/isEmbeddedWalletPresent/isEmbeddedWalletPresent.d.ts +0 -1
- package/src/lib/utils/functions/isEmbeddedWalletPresent/isEmbeddedWalletPresent.js +0 -15
- package/src/lib/views/Passkey/utils/createEmbeddedWalletWithPasskey/index.d.ts +0 -1
- package/src/lib/views/Passkey/utils/createPregeneratedWallet/createPregeneratedWallet.cjs +0 -65
- package/src/lib/views/Passkey/utils/createPregeneratedWallet/createPregeneratedWallet.d.ts +0 -16
- package/src/lib/views/Passkey/utils/createPregeneratedWallet/createPregeneratedWallet.js +0 -61
- package/src/lib/views/Passkey/utils/createPregeneratedWallet/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.9](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.8...v2.1.0-alpha.9) (2024-04-30)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* headless create embedded wallet with optional passkey data parameter ([#5487](https://github.com/dynamic-labs/DynamicAuth/issues/5487)) ([891c3d7](https://github.com/dynamic-labs/DynamicAuth/commit/891c3d77a02a019140bcb8dd03b62b1afd69710e))
|
|
8
|
+
|
|
9
|
+
## [2.1.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.7...v2.1.0-alpha.8) (2024-04-26)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* display wallet tabs when linking a wallet ([#5491](https://github.com/dynamic-labs/DynamicAuth/issues/5491)) ([10fd6b4](https://github.com/dynamic-labs/DynamicAuth/commit/10fd6b4d9aec7596338c50e17f79f6be534cf2c1))
|
|
15
|
+
* ensure zerodev viem client handles eth_accounts call ([#5477](https://github.com/dynamic-labs/DynamicAuth/issues/5477)) ([1132e1e](https://github.com/dynamic-labs/DynamicAuth/commit/1132e1e8655b58e81cb56789453ba56a059f52ec))
|
|
16
|
+
* network with keplr ([#5485](https://github.com/dynamic-labs/DynamicAuth/issues/5485)) ([b86f2fc](https://github.com/dynamic-labs/DynamicAuth/commit/b86f2fce491f9752e80a86643916da9ac7fb9276))
|
|
17
|
+
* refetch nameservice data and display properly ([#5476](https://github.com/dynamic-labs/DynamicAuth/issues/5476)) ([2aee798](https://github.com/dynamic-labs/DynamicAuth/commit/2aee798846f69496201bec7aa52e7ec1f370b7c3))
|
|
18
|
+
* use embeddedWallet create response authToken in embeddedWalletCreated ([#5478](https://github.com/dynamic-labs/DynamicAuth/issues/5478)) ([51772da](https://github.com/dynamic-labs/DynamicAuth/commit/51772daf557a72984c757efd8301e2b510dc37f1))
|
|
19
|
+
|
|
2
20
|
## [2.1.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.6...v2.1.0-alpha.7) (2024-04-25)
|
|
3
21
|
|
|
4
22
|
|
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.9";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.0.429",
|
|
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.9";
|
|
3
3
|
var dependencies = {
|
|
4
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
4
|
+
"@dynamic-labs/sdk-api-core": "0.0.429",
|
|
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.9",
|
|
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.429",
|
|
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.9",
|
|
21
|
+
"@dynamic-labs/logger": "2.1.0-alpha.9",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "2.1.0-alpha.9",
|
|
23
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.9",
|
|
24
|
+
"@dynamic-labs/rpc-provider-solana": "2.1.0-alpha.9",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "2.1.0-alpha.9",
|
|
26
|
+
"@dynamic-labs/types": "2.1.0-alpha.9",
|
|
27
|
+
"@dynamic-labs/utils": "2.1.0-alpha.9",
|
|
28
|
+
"@dynamic-labs/viem-utils": "2.1.0-alpha.9",
|
|
29
|
+
"@dynamic-labs/wallet-book": "2.1.0-alpha.9",
|
|
30
|
+
"@dynamic-labs/wallet-connector-core": "2.1.0-alpha.9",
|
|
31
31
|
"eventemitter3": "5.0.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -106,7 +106,8 @@ const ModalComponent = ({ children, handleClose, withBackdrop = true, zIndex, wh
|
|
|
106
106
|
style: { zIndex: zIndex ? zIndex - 2 : undefined }, className: 'portal__backdrop' })), jsxRuntime.jsx("div", { style: { zIndex }, children: children })] }));
|
|
107
107
|
};
|
|
108
108
|
const Portal = ({ children, isShown, handleClose, withBackdrop, zIndex, transitionEvents, elementId = 'dynamic-modal', }) => {
|
|
109
|
-
const
|
|
109
|
+
const { createRootElement } = useElementById.useElementById();
|
|
110
|
+
const modalRootElementRef = createRootElement(elementId);
|
|
110
111
|
return reactDom.createPortal(jsxRuntime.jsx(ShadowDOM.ShadowDOM, { zIndex: zIndex, dataTestId: 'dynamic-modal-shadow', children: jsxRuntime.jsx(OpacityTransition.OpacityTransition, Object.assign({ isShown: isShown }, transitionEvents, { children: jsxRuntime.jsx(ModalComponent, { handleClose: handleClose, withBackdrop: withBackdrop, whiteList: (node) => modalRootElementRef.current.contains(node), children: children }) })) }), modalRootElementRef.current);
|
|
111
112
|
};
|
|
112
113
|
|
|
@@ -98,7 +98,8 @@ const ModalComponent = ({ children, handleClose, withBackdrop = true, zIndex, wh
|
|
|
98
98
|
style: { zIndex: zIndex ? zIndex - 2 : undefined }, className: 'portal__backdrop' })), jsx("div", { style: { zIndex }, children: children })] }));
|
|
99
99
|
};
|
|
100
100
|
const Portal = ({ children, isShown, handleClose, withBackdrop, zIndex, transitionEvents, elementId = 'dynamic-modal', }) => {
|
|
101
|
-
const
|
|
101
|
+
const { createRootElement } = useElementById();
|
|
102
|
+
const modalRootElementRef = createRootElement(elementId);
|
|
102
103
|
return createPortal(jsx(ShadowDOM, { zIndex: zIndex, dataTestId: 'dynamic-modal-shadow', children: jsx(OpacityTransition, Object.assign({ isShown: isShown }, transitionEvents, { children: jsx(ModalComponent, { handleClose: handleClose, withBackdrop: withBackdrop, whiteList: (node) => modalRootElementRef.current.contains(node), children: children }) })) }), modalRootElementRef.current);
|
|
103
104
|
};
|
|
104
105
|
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { ThemeSwitch } from './ThemeSwitch';
|
|
2
|
-
export { PrimaryColorInput } from './PrimaryColorInput';
|
|
3
|
-
export { AuthModeSwitch } from './AuthModeSwitch';
|
|
4
|
-
export { LoginWithEmailSwitch } from './LoginWithEmailSwitch';
|
|
5
|
-
export { LoginWithEmailViewDisplayPriorityOrderSwitch } from './LoginWithEmailViewDisplayPriorityOrderSwitch';
|
|
6
|
-
export { TemplateSelect } from './TemplateSelect';
|
|
@@ -79,7 +79,8 @@ require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage
|
|
|
79
79
|
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
80
80
|
|
|
81
81
|
const Tooltip = ({ children, content, className, as: Tag = 'span', copykey, }) => {
|
|
82
|
-
const
|
|
82
|
+
const { createRootElement } = useElementById.useElementById();
|
|
83
|
+
const portalRoot = createRootElement('dynamic-tooltips');
|
|
83
84
|
const [vector, setVector] = React.useState([0, 0]);
|
|
84
85
|
const childrenRef = React.useRef(null);
|
|
85
86
|
const [visible, setVisible] = React.useState(false);
|
|
@@ -75,7 +75,8 @@ import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.
|
|
|
75
75
|
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
76
76
|
|
|
77
77
|
const Tooltip = ({ children, content, className, as: Tag = 'span', copykey, }) => {
|
|
78
|
-
const
|
|
78
|
+
const { createRootElement } = useElementById();
|
|
79
|
+
const portalRoot = createRootElement('dynamic-tooltips');
|
|
79
80
|
const [vector, setVector] = useState([0, 0]);
|
|
80
81
|
const childrenRef = useRef(null);
|
|
81
82
|
const [visible, setVisible] = useState(false);
|
|
@@ -228,7 +228,11 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
228
228
|
walletUiUtils,
|
|
229
229
|
});
|
|
230
230
|
const [authMode, setAuthMode] = useLocalStorage.useLocalStorage(localStorage$1.AUTH_MODE, initialAuthenticationMode);
|
|
231
|
-
const { clearPrimaryWalletId, primaryWalletId, setPrimaryWalletId } = usePrimaryWalletId.usePrimaryWalletId(
|
|
231
|
+
const { clearPrimaryWalletId, primaryWalletId, setPrimaryWalletId } = usePrimaryWalletId.usePrimaryWalletId({
|
|
232
|
+
environmentId,
|
|
233
|
+
minAuthToken: getMinAuthToken.getMinAuthToken(),
|
|
234
|
+
setUser,
|
|
235
|
+
});
|
|
232
236
|
// this is a state because it's set based on primaryWallet and bridgeChainsToConnect,
|
|
233
237
|
// which are only available further down and have would have circular dependencies
|
|
234
238
|
const [requiredWalletsConnected, setRequiredWalletsConnected] = React.useState(false);
|
|
@@ -440,7 +444,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
440
444
|
customPrivacyPolicy,
|
|
441
445
|
customTermsOfServices,
|
|
442
446
|
debugError,
|
|
443
|
-
decodedAuthToken: decodeJwt.decodeJwt(getAuthToken.getAuthToken()),
|
|
444
447
|
decodedOnboardingOnlyToken: decodeJwt.decodeJwt(onboardingOnlyJwt),
|
|
445
448
|
defaultNumberOfWalletsToShow,
|
|
446
449
|
desktopUri,
|
|
@@ -224,7 +224,11 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
224
224
|
walletUiUtils,
|
|
225
225
|
});
|
|
226
226
|
const [authMode, setAuthMode] = useLocalStorage(AUTH_MODE, initialAuthenticationMode);
|
|
227
|
-
const { clearPrimaryWalletId, primaryWalletId, setPrimaryWalletId } = usePrimaryWalletId(
|
|
227
|
+
const { clearPrimaryWalletId, primaryWalletId, setPrimaryWalletId } = usePrimaryWalletId({
|
|
228
|
+
environmentId,
|
|
229
|
+
minAuthToken: getMinAuthToken(),
|
|
230
|
+
setUser,
|
|
231
|
+
});
|
|
228
232
|
// this is a state because it's set based on primaryWallet and bridgeChainsToConnect,
|
|
229
233
|
// which are only available further down and have would have circular dependencies
|
|
230
234
|
const [requiredWalletsConnected, setRequiredWalletsConnected] = useState(false);
|
|
@@ -436,7 +440,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
436
440
|
customPrivacyPolicy,
|
|
437
441
|
customTermsOfServices,
|
|
438
442
|
debugError,
|
|
439
|
-
decodedAuthToken: decodeJwt(getAuthToken()),
|
|
440
443
|
decodedOnboardingOnlyToken: decodeJwt(onboardingOnlyJwt),
|
|
441
444
|
defaultNumberOfWalletsToShow,
|
|
442
445
|
desktopUri,
|
|
@@ -78,7 +78,6 @@ export interface IDynamicContext {
|
|
|
78
78
|
customPrivacyPolicy?: ReactNode;
|
|
79
79
|
customTermsOfServices?: ReactNode;
|
|
80
80
|
debugError: boolean;
|
|
81
|
-
decodedAuthToken: Omit<DynamicJwt, 'jwt'> | undefined;
|
|
82
81
|
decodedOnboardingOnlyToken: Omit<DynamicJwt, 'jwt'> | undefined;
|
|
83
82
|
defaultNumberOfWalletsToShow: number;
|
|
84
83
|
desktopUri: string;
|
|
@@ -19,7 +19,22 @@ require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
|
19
19
|
require('../../../shared/consts/index.cjs');
|
|
20
20
|
var api = require('../api.cjs');
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const storeSelectedWallet = (_a, userJwt_1) => _tslib.__awaiter(void 0, [_a, userJwt_1], void 0, function* ({ environmentId, walletId, }, userJwt) {
|
|
23
|
+
try {
|
|
24
|
+
const response = yield api.sdkApi(userJwt).selectUserWallet({
|
|
25
|
+
environmentId,
|
|
26
|
+
userWalletSelectionRequest: {
|
|
27
|
+
walletId,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
return response;
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
logger.logger.error('error storing selected wallet', e);
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const linkWallet = (environmentId_1, _b, userJwt_2) => _tslib.__awaiter(void 0, [environmentId_1, _b, userJwt_2], void 0, function* (environmentId, { messageToSign, network, signedMessage, publicWalletAddress, chain, walletName, walletProvider, additionalWalletAddresses, backup, password, passwordSource, }, userJwt) {
|
|
23
38
|
const verifyRequest = sdkApiCore.VerifyRequestFromJSON({
|
|
24
39
|
additionalWalletAddresses,
|
|
25
40
|
backup,
|
|
@@ -57,7 +72,7 @@ const linkWallet = (environmentId_1, _a, userJwt_1) => _tslib.__awaiter(void 0,
|
|
|
57
72
|
return undefined;
|
|
58
73
|
}
|
|
59
74
|
});
|
|
60
|
-
const unlinkWallet = (
|
|
75
|
+
const unlinkWallet = (_c, userJwt_3) => _tslib.__awaiter(void 0, [_c, userJwt_3], void 0, function* ({ environmentId, primaryWalletId, walletId, }, userJwt) {
|
|
61
76
|
try {
|
|
62
77
|
const response = yield api.sdkApi(userJwt).verifyUnlink({
|
|
63
78
|
environmentId,
|
|
@@ -72,7 +87,7 @@ const unlinkWallet = (_b, userJwt_2) => _tslib.__awaiter(void 0, [_b, userJwt_2]
|
|
|
72
87
|
return undefined;
|
|
73
88
|
}
|
|
74
89
|
});
|
|
75
|
-
const transferWallet = (environmentId_2,
|
|
90
|
+
const transferWallet = (environmentId_2, _d, userJwt_4) => _tslib.__awaiter(void 0, [environmentId_2, _d, userJwt_4], void 0, function* (environmentId, { network, messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, skipEmptyAccountCheck = false, }, userJwt) {
|
|
76
91
|
// We should find a better way to do this than force type casting
|
|
77
92
|
const verifyRequest = {
|
|
78
93
|
chain,
|
|
@@ -91,11 +106,11 @@ const transferWallet = (environmentId_2, _c, userJwt_3) => _tslib.__awaiter(void
|
|
|
91
106
|
});
|
|
92
107
|
return response;
|
|
93
108
|
}
|
|
94
|
-
catch (
|
|
109
|
+
catch (_e) {
|
|
95
110
|
return undefined;
|
|
96
111
|
}
|
|
97
112
|
});
|
|
98
|
-
const verifyWallet = (environmentId_3,
|
|
113
|
+
const verifyWallet = (environmentId_3, _f) => _tslib.__awaiter(void 0, [environmentId_3, _f], void 0, function* (environmentId, { messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, captchaToken, network, oauth, additionalWalletAddresses, }) {
|
|
99
114
|
const verifyRequest = sdkApiCore.VerifyRequestFromJSON({
|
|
100
115
|
additionalWalletAddresses,
|
|
101
116
|
captchaToken,
|
|
@@ -140,6 +155,7 @@ const verifyWallet = (environmentId_3, _e) => _tslib.__awaiter(void 0, [environm
|
|
|
140
155
|
});
|
|
141
156
|
|
|
142
157
|
exports.linkWallet = linkWallet;
|
|
158
|
+
exports.storeSelectedWallet = storeSelectedWallet;
|
|
143
159
|
exports.transferWallet = transferWallet;
|
|
144
160
|
exports.unlinkWallet = unlinkWallet;
|
|
145
161
|
exports.verifyWallet = verifyWallet;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { VerifyResponse } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
import { VerifyWallet } from '../../../shared/types';
|
|
3
|
+
export declare const storeSelectedWallet: ({ environmentId, walletId, }: {
|
|
4
|
+
environmentId: string;
|
|
5
|
+
walletId: string;
|
|
6
|
+
}, userJwt: string) => Promise<VerifyResponse | undefined>;
|
|
3
7
|
export declare const linkWallet: (environmentId: string, { messageToSign, network, signedMessage, publicWalletAddress, chain, walletName, walletProvider, additionalWalletAddresses, backup, password, passwordSource, }: VerifyWallet, userJwt: string) => Promise<VerifyResponse | undefined>;
|
|
4
8
|
export declare const unlinkWallet: ({ environmentId, primaryWalletId, walletId, }: {
|
|
5
9
|
environmentId: string;
|
|
@@ -15,7 +15,22 @@ import '../../../shared/utils/classes/storage/localStorage.js';
|
|
|
15
15
|
import '../../../shared/consts/index.js';
|
|
16
16
|
import { sdkApi } from '../api.js';
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const storeSelectedWallet = (_a, userJwt_1) => __awaiter(void 0, [_a, userJwt_1], void 0, function* ({ environmentId, walletId, }, userJwt) {
|
|
19
|
+
try {
|
|
20
|
+
const response = yield sdkApi(userJwt).selectUserWallet({
|
|
21
|
+
environmentId,
|
|
22
|
+
userWalletSelectionRequest: {
|
|
23
|
+
walletId,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
return response;
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
logger.error('error storing selected wallet', e);
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const linkWallet = (environmentId_1, _b, userJwt_2) => __awaiter(void 0, [environmentId_1, _b, userJwt_2], void 0, function* (environmentId, { messageToSign, network, signedMessage, publicWalletAddress, chain, walletName, walletProvider, additionalWalletAddresses, backup, password, passwordSource, }, userJwt) {
|
|
19
34
|
const verifyRequest = VerifyRequestFromJSON({
|
|
20
35
|
additionalWalletAddresses,
|
|
21
36
|
backup,
|
|
@@ -53,7 +68,7 @@ const linkWallet = (environmentId_1, _a, userJwt_1) => __awaiter(void 0, [enviro
|
|
|
53
68
|
return undefined;
|
|
54
69
|
}
|
|
55
70
|
});
|
|
56
|
-
const unlinkWallet = (
|
|
71
|
+
const unlinkWallet = (_c, userJwt_3) => __awaiter(void 0, [_c, userJwt_3], void 0, function* ({ environmentId, primaryWalletId, walletId, }, userJwt) {
|
|
57
72
|
try {
|
|
58
73
|
const response = yield sdkApi(userJwt).verifyUnlink({
|
|
59
74
|
environmentId,
|
|
@@ -68,7 +83,7 @@ const unlinkWallet = (_b, userJwt_2) => __awaiter(void 0, [_b, userJwt_2], void
|
|
|
68
83
|
return undefined;
|
|
69
84
|
}
|
|
70
85
|
});
|
|
71
|
-
const transferWallet = (environmentId_2,
|
|
86
|
+
const transferWallet = (environmentId_2, _d, userJwt_4) => __awaiter(void 0, [environmentId_2, _d, userJwt_4], void 0, function* (environmentId, { network, messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, skipEmptyAccountCheck = false, }, userJwt) {
|
|
72
87
|
// We should find a better way to do this than force type casting
|
|
73
88
|
const verifyRequest = {
|
|
74
89
|
chain,
|
|
@@ -87,11 +102,11 @@ const transferWallet = (environmentId_2, _c, userJwt_3) => __awaiter(void 0, [en
|
|
|
87
102
|
});
|
|
88
103
|
return response;
|
|
89
104
|
}
|
|
90
|
-
catch (
|
|
105
|
+
catch (_e) {
|
|
91
106
|
return undefined;
|
|
92
107
|
}
|
|
93
108
|
});
|
|
94
|
-
const verifyWallet = (environmentId_3,
|
|
109
|
+
const verifyWallet = (environmentId_3, _f) => __awaiter(void 0, [environmentId_3, _f], void 0, function* (environmentId, { messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, captchaToken, network, oauth, additionalWalletAddresses, }) {
|
|
95
110
|
const verifyRequest = VerifyRequestFromJSON({
|
|
96
111
|
additionalWalletAddresses,
|
|
97
112
|
captchaToken,
|
|
@@ -135,4 +150,4 @@ const verifyWallet = (environmentId_3, _e) => __awaiter(void 0, [environmentId_3
|
|
|
135
150
|
}
|
|
136
151
|
});
|
|
137
152
|
|
|
138
|
-
export { linkWallet, transferWallet, unlinkWallet, verifyWallet };
|
|
153
|
+
export { linkWallet, storeSelectedWallet, transferWallet, unlinkWallet, verifyWallet };
|
|
@@ -17,8 +17,8 @@ class LocalStorage {
|
|
|
17
17
|
static getDynamicLSKey(key) {
|
|
18
18
|
return `${key}${LocalStorage.getSuffix()}`;
|
|
19
19
|
}
|
|
20
|
-
static validateRequest(key,
|
|
21
|
-
if (key === localStorage.AUTH_TOKEN && !
|
|
20
|
+
static validateRequest(key, fromAuxiliaryAuthFunctions) {
|
|
21
|
+
if (key === localStorage.AUTH_TOKEN && !fromAuxiliaryAuthFunctions) {
|
|
22
22
|
throw new Error('You cannot access AUTH_TOKEN through localStorage. Use getAuthToken/ storeAuthToken helper functions instead');
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -13,8 +13,8 @@ class LocalStorage {
|
|
|
13
13
|
static getDynamicLSKey(key) {
|
|
14
14
|
return `${key}${LocalStorage.getSuffix()}`;
|
|
15
15
|
}
|
|
16
|
-
static validateRequest(key,
|
|
17
|
-
if (key === AUTH_TOKEN && !
|
|
16
|
+
static validateRequest(key, fromAuxiliaryAuthFunctions) {
|
|
17
|
+
if (key === AUTH_TOKEN && !fromAuxiliaryAuthFunctions) {
|
|
18
18
|
throw new Error('You cannot access AUTH_TOKEN through localStorage. Use getAuthToken/ storeAuthToken helper functions instead');
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const addPasskeyIdentifierToWalletConnector = (walletConnector, user) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const passkeyIdentifier = (user === null || user === void 0 ? void 0 : user.phoneNumber) ||
|
|
9
|
+
((_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => vc.oauthDisplayName)) === null || _a === void 0 ? void 0 : _a.oauthDisplayName) ||
|
|
10
|
+
'';
|
|
11
|
+
walletConnector.setPasskeyIdentifier(passkeyIdentifier);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.addPasskeyIdentifierToWalletConnector = addPasskeyIdentifierToWalletConnector;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const addPasskeyIdentifierToWalletConnector = (walletConnector, user) => {
|
|
3
|
+
var _a;
|
|
4
|
+
const passkeyIdentifier = (user === null || user === void 0 ? void 0 : user.phoneNumber) ||
|
|
5
|
+
((_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => vc.oauthDisplayName)) === null || _a === void 0 ? void 0 : _a.oauthDisplayName) ||
|
|
6
|
+
'';
|
|
7
|
+
walletConnector.setPasskeyIdentifier(passkeyIdentifier);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { addPasskeyIdentifierToWalletConnector };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { addPasskeyIdentifierToWalletConnector } from './addPasskeyIdentifierToWalletConnector';
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var index = require('../../../shared/utils/functions/lastAuthenticatedAccount/index.cjs');
|
|
7
7
|
|
|
8
8
|
const createUserProfile = (decodedJwt) => {
|
|
9
|
-
var _a;
|
|
10
9
|
const wallet = index.lastAuthenticatedAccount(decodedJwt);
|
|
11
10
|
const kyc = {
|
|
12
11
|
alias: decodedJwt.alias,
|
|
@@ -30,7 +29,7 @@ const createUserProfile = (decodedJwt) => {
|
|
|
30
29
|
team: decodedJwt.team,
|
|
31
30
|
username: decodedJwt.username,
|
|
32
31
|
};
|
|
33
|
-
const userProfile = Object.assign({ chain: wallet === null || wallet === void 0 ? void 0 : wallet.chain, ens: wallet === null || wallet === void 0 ? void 0 : wallet.nameService, environmentId: decodedJwt.environmentId, isAuthenticatedWithAWallet: (
|
|
32
|
+
const userProfile = Object.assign({ chain: wallet === null || wallet === void 0 ? void 0 : wallet.chain, ens: wallet === null || wallet === void 0 ? void 0 : wallet.nameService, environmentId: decodedJwt.environmentId, isAuthenticatedWithAWallet: (wallet === null || wallet === void 0 ? void 0 : wallet.format) === 'blockchain', lastVerifiedCredentialId: decodedJwt.lastVerifiedCredentialId, lists: decodedJwt.lists, metadata: decodedJwt.metadata, newUser: decodedJwt.newUser, scope: decodedJwt.scope, sessionId: decodedJwt.sid, userId: decodedJwt.sub, verifiedCredentials: decodedJwt.verifiedCredentials || [], wallet: wallet === null || wallet === void 0 ? void 0 : wallet.walletName }, kyc);
|
|
34
33
|
return userProfile;
|
|
35
34
|
};
|
|
36
35
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { lastAuthenticatedAccount } from '../../../shared/utils/functions/lastAuthenticatedAccount/index.js';
|
|
3
3
|
|
|
4
4
|
const createUserProfile = (decodedJwt) => {
|
|
5
|
-
var _a;
|
|
6
5
|
const wallet = lastAuthenticatedAccount(decodedJwt);
|
|
7
6
|
const kyc = {
|
|
8
7
|
alias: decodedJwt.alias,
|
|
@@ -26,7 +25,7 @@ const createUserProfile = (decodedJwt) => {
|
|
|
26
25
|
team: decodedJwt.team,
|
|
27
26
|
username: decodedJwt.username,
|
|
28
27
|
};
|
|
29
|
-
const userProfile = Object.assign({ chain: wallet === null || wallet === void 0 ? void 0 : wallet.chain, ens: wallet === null || wallet === void 0 ? void 0 : wallet.nameService, environmentId: decodedJwt.environmentId, isAuthenticatedWithAWallet: (
|
|
28
|
+
const userProfile = Object.assign({ chain: wallet === null || wallet === void 0 ? void 0 : wallet.chain, ens: wallet === null || wallet === void 0 ? void 0 : wallet.nameService, environmentId: decodedJwt.environmentId, isAuthenticatedWithAWallet: (wallet === null || wallet === void 0 ? void 0 : wallet.format) === 'blockchain', lastVerifiedCredentialId: decodedJwt.lastVerifiedCredentialId, lists: decodedJwt.lists, metadata: decodedJwt.metadata, newUser: decodedJwt.newUser, scope: decodedJwt.scope, sessionId: decodedJwt.sid, userId: decodedJwt.sub, verifiedCredentials: decodedJwt.verifiedCredentials || [], wallet: wallet === null || wallet === void 0 ? void 0 : wallet.walletName }, kyc);
|
|
30
29
|
return userProfile;
|
|
31
30
|
};
|
|
32
31
|
|
|
@@ -19,13 +19,12 @@ require('@dynamic-labs/utils');
|
|
|
19
19
|
require('../../../shared/consts/index.cjs');
|
|
20
20
|
|
|
21
21
|
// TODO: Check if this is actually returning the correct verified credential
|
|
22
|
-
const findEmbeddedWalletFromVerifiedCredentials = (jwt,
|
|
22
|
+
const findEmbeddedWalletFromVerifiedCredentials = (jwt, chains) => {
|
|
23
23
|
var _a;
|
|
24
24
|
const decodedJwt = decodeJwt.decodeJwt(jwt);
|
|
25
25
|
const verifiedCredentials = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.filter(({ walletProvider }) => walletProvider === 'embeddedWallet');
|
|
26
|
-
if ((verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.length) &&
|
|
27
|
-
|
|
28
|
-
return verifiedCredentials.find(({ chain }) => chain === chainName);
|
|
26
|
+
if ((verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.length) && (chains === null || chains === void 0 ? void 0 : chains.length)) {
|
|
27
|
+
return verifiedCredentials.find(({ chain }) => chain && chains.includes(values.VerifiedCredentialNameToChainEnum[chain]));
|
|
29
28
|
}
|
|
30
29
|
return verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.shift();
|
|
31
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const findEmbeddedWalletFromVerifiedCredentials: (jwt: string,
|
|
1
|
+
export declare const findEmbeddedWalletFromVerifiedCredentials: (jwt: string, chains?: string[]) => import("@dynamic-labs/sdk-api-core").JwtVerifiedCredential | undefined;
|
|
@@ -9,19 +9,18 @@ import '../../../context/ViewContext/ViewContext.js';
|
|
|
9
9
|
import 'react';
|
|
10
10
|
import '@dynamic-labs/wallet-book';
|
|
11
11
|
import '../../constants/colors.js';
|
|
12
|
-
import {
|
|
12
|
+
import { VerifiedCredentialNameToChainEnum } from '../../constants/values.js';
|
|
13
13
|
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
14
14
|
import '@dynamic-labs/utils';
|
|
15
15
|
import '../../../shared/consts/index.js';
|
|
16
16
|
|
|
17
17
|
// TODO: Check if this is actually returning the correct verified credential
|
|
18
|
-
const findEmbeddedWalletFromVerifiedCredentials = (jwt,
|
|
18
|
+
const findEmbeddedWalletFromVerifiedCredentials = (jwt, chains) => {
|
|
19
19
|
var _a;
|
|
20
20
|
const decodedJwt = decodeJwt(jwt);
|
|
21
21
|
const verifiedCredentials = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.filter(({ walletProvider }) => walletProvider === 'embeddedWallet');
|
|
22
|
-
if ((verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.length) &&
|
|
23
|
-
|
|
24
|
-
return verifiedCredentials.find(({ chain }) => chain === chainName);
|
|
22
|
+
if ((verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.length) && (chains === null || chains === void 0 ? void 0 : chains.length)) {
|
|
23
|
+
return verifiedCredentials.find(({ chain }) => chain && chains.includes(VerifiedCredentialNameToChainEnum[chain]));
|
|
25
24
|
}
|
|
26
25
|
return verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.shift();
|
|
27
26
|
};
|
|
@@ -19,7 +19,7 @@ const findTurnkeyWalletByPrimaryChain = (walletOptions, chainConfigurations, ver
|
|
|
19
19
|
const walletConnector = findTurnkeyWalletByChain(walletOptions, values.ChainEnumToVerifiedCredentialName[primaryEmbeddedChain]);
|
|
20
20
|
const turnkeyVC = verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find(({ walletName, chain }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) &&
|
|
21
21
|
chain === values.ChainEnumToVerifiedCredentialName[primaryEmbeddedChain]);
|
|
22
|
-
if (!
|
|
22
|
+
if (!walletConnector) {
|
|
23
23
|
return undefined;
|
|
24
24
|
}
|
|
25
25
|
return Object.assign(Object.assign({}, turnkeyVC), walletConnector);
|
|
@@ -2,7 +2,9 @@ import { ChainConfiguration, JwtVerifiedCredential } from '@dynamic-labs/sdk-api
|
|
|
2
2
|
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { WalletOption } from '../../../shared';
|
|
4
4
|
export declare const findTurnkeyWalletByChain: (walletOptions: WalletOption[] | undefined, chainName: string | undefined) => WalletOption | undefined;
|
|
5
|
-
|
|
5
|
+
type FindTurnkeyWalletByChainResult = (JwtVerifiedCredential & WalletOption) | WalletOption | undefined;
|
|
6
|
+
export declare const findTurnkeyWalletByPrimaryChain: (walletOptions: WalletOption[] | undefined, chainConfigurations: ChainConfiguration[] | undefined, verifiedCredentials: JwtVerifiedCredential[]) => FindTurnkeyWalletByChainResult;
|
|
6
7
|
export declare const findTurnkeyWalletByAddress: (walletOptions: WalletOption[] | undefined, verifiedCredentials: JwtVerifiedCredential[], address: string | undefined) => (JwtVerifiedCredential & {
|
|
7
8
|
walletConnector?: WalletConnector;
|
|
8
9
|
}) | undefined;
|
|
10
|
+
export {};
|
|
@@ -15,7 +15,7 @@ const findTurnkeyWalletByPrimaryChain = (walletOptions, chainConfigurations, ver
|
|
|
15
15
|
const walletConnector = findTurnkeyWalletByChain(walletOptions, ChainEnumToVerifiedCredentialName[primaryEmbeddedChain]);
|
|
16
16
|
const turnkeyVC = verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find(({ walletName, chain }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) &&
|
|
17
17
|
chain === ChainEnumToVerifiedCredentialName[primaryEmbeddedChain]);
|
|
18
|
-
if (!
|
|
18
|
+
if (!walletConnector) {
|
|
19
19
|
return undefined;
|
|
20
20
|
}
|
|
21
21
|
return Object.assign(Object.assign({}, turnkeyVC), walletConnector);
|
package/src/lib/utils/functions/getUserVerifiedCredentialType/getUserVerifiedCredentialType.cjs
CHANGED
|
@@ -5,19 +5,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* This will return a string which we can present to the user credential type
|
|
8
|
-
* @param
|
|
8
|
+
* @param user
|
|
9
9
|
* @param type optional parameter to check for specific credential type
|
|
10
10
|
* @returns JwtVerifiedCredentialFormatEnum | undefined
|
|
11
11
|
*/
|
|
12
|
-
const getUserVerifiedCredentialType = (
|
|
12
|
+
const getUserVerifiedCredentialType = (user, type) => {
|
|
13
13
|
var _a, _b, _c;
|
|
14
|
-
if (!
|
|
14
|
+
if (!user) {
|
|
15
15
|
return undefined;
|
|
16
16
|
}
|
|
17
17
|
if (type) {
|
|
18
|
-
return (_b = (_a =
|
|
18
|
+
return (_b = (_a = user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find((credentials) => credentials.format === type)) === null || _b === void 0 ? void 0 : _b.format;
|
|
19
19
|
}
|
|
20
|
-
const verifiedCredential = (_c =
|
|
20
|
+
const verifiedCredential = (_c = user.verifiedCredentials) === null || _c === void 0 ? void 0 : _c.find((credentials) => credentials.id === user.lastVerifiedCredentialId);
|
|
21
21
|
return verifiedCredential === null || verifiedCredential === void 0 ? void 0 : verifiedCredential.format;
|
|
22
22
|
};
|
|
23
23
|
|
package/src/lib/utils/functions/getUserVerifiedCredentialType/getUserVerifiedCredentialType.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DynamicJwt, JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
import { UserProfile } from '../../../..';
|
|
2
3
|
/**
|
|
3
4
|
* This will return a string which we can present to the user credential type
|
|
4
|
-
* @param
|
|
5
|
+
* @param user
|
|
5
6
|
* @param type optional parameter to check for specific credential type
|
|
6
7
|
* @returns JwtVerifiedCredentialFormatEnum | undefined
|
|
7
8
|
*/
|
|
8
|
-
export declare const getUserVerifiedCredentialType: (
|
|
9
|
+
export declare const getUserVerifiedCredentialType: (user: UserProfile | DynamicJwt | undefined, type?: JwtVerifiedCredentialFormatEnum) => JwtVerifiedCredentialFormatEnum | undefined;
|
package/src/lib/utils/functions/getUserVerifiedCredentialType/getUserVerifiedCredentialType.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
/**
|
|
3
3
|
* This will return a string which we can present to the user credential type
|
|
4
|
-
* @param
|
|
4
|
+
* @param user
|
|
5
5
|
* @param type optional parameter to check for specific credential type
|
|
6
6
|
* @returns JwtVerifiedCredentialFormatEnum | undefined
|
|
7
7
|
*/
|
|
8
|
-
const getUserVerifiedCredentialType = (
|
|
8
|
+
const getUserVerifiedCredentialType = (user, type) => {
|
|
9
9
|
var _a, _b, _c;
|
|
10
|
-
if (!
|
|
10
|
+
if (!user) {
|
|
11
11
|
return undefined;
|
|
12
12
|
}
|
|
13
13
|
if (type) {
|
|
14
|
-
return (_b = (_a =
|
|
14
|
+
return (_b = (_a = user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find((credentials) => credentials.format === type)) === null || _b === void 0 ? void 0 : _b.format;
|
|
15
15
|
}
|
|
16
|
-
const verifiedCredential = (_c =
|
|
16
|
+
const verifiedCredential = (_c = user.verifiedCredentials) === null || _c === void 0 ? void 0 : _c.find((credentials) => credentials.id === user.lastVerifiedCredentialId);
|
|
17
17
|
return verifiedCredential === null || verifiedCredential === void 0 ? void 0 : verifiedCredential.format;
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var findEmbeddedWalletFromVerifiedCredentials = require('../findEmbeddedWalletFromVerifiedCredentials/findEmbeddedWalletFromVerifiedCredentials.cjs');
|
|
7
7
|
|
|
8
8
|
const hasEmbeddedWallet = (jwt, walletName) => {
|
|
9
|
+
var _a;
|
|
9
10
|
if (!jwt) {
|
|
10
11
|
return false;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
const embeddedWallet = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(jwt);
|
|
14
|
+
if (!walletName) {
|
|
15
|
+
return Boolean(embeddedWallet);
|
|
16
|
+
}
|
|
17
|
+
return Boolean((_a = embeddedWallet === null || embeddedWallet === void 0 ? void 0 : embeddedWallet.walletName) === null || _a === void 0 ? void 0 : _a.startsWith(walletName));
|
|
13
18
|
};
|
|
14
19
|
|
|
15
20
|
exports.hasEmbeddedWallet = hasEmbeddedWallet;
|