@dynamic-labs/sdk-react-core 2.1.0-alpha.14 → 2.1.0-alpha.16
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 +16 -0
- package/package.cjs +3 -2
- package/package.js +3 -2
- package/package.json +13 -12
- package/src/index.cjs +1 -3
- package/src/index.d.ts +1 -3
- package/src/index.js +1 -2
- package/src/lib/components/Portal/Portal.cjs +3 -1
- package/src/lib/components/Portal/Portal.js +3 -1
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.cjs +4 -0
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.js +4 -0
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.cjs +4 -0
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.js +4 -0
- package/src/lib/context/ConnectWithOtpContext/utils/findEmailProvider.cjs +4 -0
- package/src/lib/context/ConnectWithOtpContext/utils/findEmailProvider.js +4 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +20 -15
- package/src/lib/context/DynamicContext/DynamicContext.js +20 -15
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +0 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +13 -5
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +14 -6
- package/src/lib/context/DynamicContext/types/index.d.ts +4 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +2 -1
- package/src/lib/context/DynamicContext/validators/validators.cjs +0 -29
- package/src/lib/context/DynamicContext/validators/validators.d.ts +0 -2
- package/src/lib/context/DynamicContext/validators/validators.js +1 -29
- package/src/lib/context/FundingContext/FundingContext.cjs +6 -6
- package/src/lib/context/FundingContext/FundingContext.js +6 -6
- package/src/lib/context/PasskeyContext/PasskeyContext.cjs +0 -1
- package/src/lib/context/PasskeyContext/PasskeyContext.js +0 -1
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/data/api/api.cjs +25 -3
- package/src/lib/data/api/api.d.ts +1 -1
- package/src/lib/data/api/api.js +25 -3
- package/src/lib/data/api/chains/balances.cjs +2 -2
- package/src/lib/data/api/chains/balances.d.ts +1 -2
- package/src/lib/data/api/chains/balances.js +2 -2
- package/src/lib/data/api/email/email.cjs +2 -2
- package/src/lib/data/api/email/email.d.ts +1 -1
- package/src/lib/data/api/email/email.js +2 -2
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +23 -23
- package/src/lib/data/api/embeddedWallets/embeddedWallets.d.ts +11 -12
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +23 -23
- package/src/lib/data/api/embeddedWallets/types.d.ts +0 -6
- package/src/lib/data/api/mfa/mfa.cjs +18 -18
- package/src/lib/data/api/mfa/mfa.d.ts +9 -18
- package/src/lib/data/api/mfa/mfa.js +18 -18
- package/src/lib/data/api/oauth/oauth.cjs +4 -4
- package/src/lib/data/api/oauth/oauth.d.ts +3 -3
- package/src/lib/data/api/oauth/oauth.js +4 -4
- package/src/lib/data/api/session/session.cjs +2 -2
- package/src/lib/data/api/session/session.d.ts +1 -1
- package/src/lib/data/api/session/session.js +2 -2
- package/src/lib/data/api/sms/sms.cjs +2 -2
- package/src/lib/data/api/sms/sms.d.ts +1 -1
- package/src/lib/data/api/sms/sms.js +2 -2
- package/src/lib/data/api/user/user.cjs +8 -10
- package/src/lib/data/api/user/user.d.ts +4 -4
- package/src/lib/data/api/user/user.js +9 -11
- package/src/lib/data/api/wallets/wallets.cjs +8 -8
- package/src/lib/data/api/wallets/wallets.d.ts +4 -4
- package/src/lib/data/api/wallets/wallets.js +8 -8
- package/src/lib/locale/en/translation.cjs +18 -0
- package/src/lib/locale/en/translation.d.ts +18 -0
- package/src/lib/locale/en/translation.js +18 -0
- package/src/lib/shared/utils/classes/storage/localStorage.cjs +1 -8
- package/src/lib/shared/utils/classes/storage/localStorage.js +2 -9
- package/src/lib/shared/utils/functions/index.d.ts +0 -1
- package/src/lib/store/actions/storeActions/index.d.ts +1 -0
- package/src/lib/store/actions/storeActions/storeActions.cjs +10 -0
- package/src/lib/store/actions/storeActions/storeActions.d.ts +1 -0
- package/src/lib/store/actions/storeActions/storeActions.js +6 -0
- package/src/lib/store/actions/userActions/index.d.ts +1 -0
- package/src/lib/store/actions/userActions/userActions.cjs +10 -0
- package/src/lib/store/actions/userActions/userActions.d.ts +7 -0
- package/src/lib/store/actions/userActions/userActions.js +6 -0
- package/src/lib/store/hooks/useUser/index.d.ts +1 -0
- package/src/lib/store/hooks/useUser/useUser.cjs +12 -0
- package/src/lib/store/hooks/useUser/useUser.d.ts +1 -0
- package/src/lib/store/hooks/useUser/useUser.js +8 -0
- package/src/lib/store/index.d.ts +4 -0
- package/src/lib/store/store.cjs +24 -0
- package/src/lib/store/store.d.ts +13 -0
- package/src/lib/store/store.js +19 -0
- package/src/lib/store/types.d.ts +4 -0
- package/src/lib/store/utils/createStore/createStore.cjs +21 -0
- package/src/lib/store/utils/createStore/createStore.d.ts +16 -0
- package/src/lib/store/utils/createStore/createStore.js +17 -0
- package/src/lib/store/utils/createStore/index.d.ts +1 -0
- package/src/lib/store/utils/syncLegacyStorage/index.d.ts +1 -0
- package/src/lib/store/utils/syncLegacyStorage/syncLegacyStorage.cjs +30 -0
- package/src/lib/store/utils/syncLegacyStorage/syncLegacyStorage.d.ts +2 -0
- package/src/lib/store/utils/syncLegacyStorage/syncLegacyStorage.js +26 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/index.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.cjs +4 -2
- package/src/lib/utils/constants/localStorage.d.ts +2 -1
- package/src/lib/utils/constants/localStorage.js +3 -2
- package/src/lib/utils/functions/downloadFile/downloadFile.cjs +15 -0
- package/src/lib/utils/functions/downloadFile/downloadFile.d.ts +1 -0
- package/src/lib/utils/functions/downloadFile/downloadFile.js +11 -0
- package/src/lib/utils/functions/downloadFile/index.d.ts +1 -0
- package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.cjs +8 -4
- package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.d.ts +1 -2
- package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.js +8 -4
- package/src/lib/utils/functions/getOnboardingAuthToken/getOnboardingAuthToken.cjs +31 -0
- package/src/lib/utils/functions/getOnboardingAuthToken/getOnboardingAuthToken.d.ts +1 -0
- package/src/lib/utils/functions/getOnboardingAuthToken/getOnboardingAuthToken.js +27 -0
- package/src/lib/utils/functions/getOnboardingAuthToken/index.d.ts +1 -0
- package/src/lib/utils/functions/handleUnlinkHelper/handleUnlinkHelper.cjs +7 -3
- package/src/lib/utils/functions/handleUnlinkHelper/handleUnlinkHelper.js +7 -3
- package/src/lib/utils/functions/index.d.ts +2 -0
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.js +1 -1
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.cjs +2 -2
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js +2 -2
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +4 -2
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +4 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +2 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +2 -2
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +4 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +4 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +1 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +1 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +3 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +3 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +2 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +2 -0
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs +4 -4
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.js +4 -4
- package/src/lib/utils/hooks/useFetchNonce/useFetchNonce.cjs +4 -0
- package/src/lib/utils/hooks/useFetchNonce/useFetchNonce.js +4 -0
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +4 -4
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +4 -4
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +6 -3
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.d.ts +1 -4
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +5 -2
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.cjs +1 -3
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.js +1 -3
- package/src/lib/utils/hooks/useMfa/useMfa.cjs +1 -8
- package/src/lib/utils/hooks/useMfa/useMfa.js +1 -8
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +1 -1
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +1 -1
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +7 -3
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.d.ts +1 -4
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +6 -2
- package/src/lib/utils/hooks/useSendDynamicProps/useSendDynamicProps.cjs +2 -2
- package/src/lib/utils/hooks/useSendDynamicProps/useSendDynamicProps.js +2 -2
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +1 -1
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +4 -7
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +4 -7
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +11 -14
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +11 -14
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.cjs +0 -1
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.js +0 -1
- package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.cjs +1 -1
- package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.js +1 -1
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +6 -1
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +6 -1
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +3 -3
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +3 -3
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +4 -4
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +4 -4
- package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.cjs +5 -10
- package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.js +5 -10
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +2 -5
- package/src/lib/views/EmailUpdate/EmailUpdate.js +2 -5
- package/src/lib/views/EmailVerification/EmailVerification.cjs +3 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +3 -1
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +5 -2
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +5 -2
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.cjs +4 -2
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.js +4 -2
- package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.cjs +111 -0
- package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.d.ts +2 -0
- package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.js +107 -0
- package/src/lib/views/MfaDisplayBackupCodesView/index.d.ts +1 -0
- package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +3 -3
- package/src/lib/views/MfaVerificationView/MfaVerificationView.js +3 -3
- package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.cjs +0 -2
- package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.js +0 -2
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.cjs +3 -3
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.js +3 -3
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +4 -9
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +4 -9
- package/src/lib/views/WalletList/WalletListGridTabs/WalletListGridTabs.cjs +1 -1
- package/src/lib/views/WalletList/WalletListGridTabs/WalletListGridTabs.js +1 -1
- package/src/lib/views/WalletList/hooks/useTabState.cjs +4 -1
- package/src/lib/views/WalletList/hooks/useTabState.js +4 -1
- package/src/lib/views/WalletList/utils/getInitialTabIndex/getInitialTabIndex.cjs +22 -0
- package/src/lib/views/WalletList/utils/getInitialTabIndex/getInitialTabIndex.d.ts +2 -0
- package/src/lib/views/WalletList/utils/getInitialTabIndex/getInitialTabIndex.js +18 -0
- package/src/lib/views/WalletList/utils/getInitialTabIndex/index.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/shared/utils/functions/validateType/index.d.ts +0 -1
- package/src/lib/shared/utils/functions/validateType/validateType.cjs +0 -30
- package/src/lib/shared/utils/functions/validateType/validateType.d.ts +0 -1
- package/src/lib/shared/utils/functions/validateType/validateType.js +0 -26
|
@@ -9,20 +9,20 @@ import '@dynamic-labs/wallet-connector-core';
|
|
|
9
9
|
import 'react/jsx-runtime';
|
|
10
10
|
import '../../../ViewContext/ViewContext.js';
|
|
11
11
|
import '@dynamic-labs/wallet-book';
|
|
12
|
-
import { AUTH_TOKEN, AUTH_MIN_TOKEN, WALLET_PICKER_SEARCH_KEY, PHANTOM_SIGNATURE_STATE } from '../../../../utils/constants/localStorage.js';
|
|
12
|
+
import { AUTH_TOKEN, AUTH_MIN_TOKEN, WALLET_PICKER_SEARCH_KEY, PHANTOM_SIGNATURE_STATE, AUTH_ONBOARDING_TOKEN } from '../../../../utils/constants/localStorage.js';
|
|
13
13
|
import '../../../../utils/constants/colors.js';
|
|
14
14
|
import '../../../../utils/constants/values.js';
|
|
15
15
|
import { LocalStorage } from '../../../../shared/utils/classes/storage/localStorage.js';
|
|
16
16
|
import '../../../../shared/consts/index.js';
|
|
17
17
|
import '../../../../config/ApiEndpoint.js';
|
|
18
|
-
import { revokeSession } from '../../../../data/api/session/session.js';
|
|
19
|
-
import '../../../../locale/locale.js';
|
|
20
|
-
import { dynamicEvents } from '../../../../events/dynamicEvents.js';
|
|
21
18
|
import '@dynamic-labs/multi-wallet';
|
|
22
19
|
import { getMinAuthToken } from '../../../../utils/functions/getMinAuthToken/getMinAuthToken.js';
|
|
23
20
|
import 'react-international-phone';
|
|
24
21
|
import 'viem';
|
|
25
22
|
import 'viem/chains';
|
|
23
|
+
import { revokeSession } from '../../../../data/api/session/session.js';
|
|
24
|
+
import '../../../../locale/locale.js';
|
|
25
|
+
import { dynamicEvents } from '../../../../events/dynamicEvents.js';
|
|
26
26
|
import { useInternalDynamicEvents } from '../../../../utils/hooks/events/useDynamicEvents/useDynamicEvents.js';
|
|
27
27
|
import '../../DynamicContext.js';
|
|
28
28
|
import '../../../CaptchaContext/CaptchaContext.js';
|
|
@@ -72,12 +72,17 @@ import '../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/Dynamic
|
|
|
72
72
|
import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
73
73
|
import '../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
74
74
|
import '../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
75
|
+
import 'zustand';
|
|
76
|
+
import 'zustand/middleware';
|
|
77
|
+
import { clearStore } from '../../../../store/actions/storeActions/storeActions.js';
|
|
78
|
+
import 'zustand/react/shallow';
|
|
75
79
|
|
|
76
80
|
const clearFromLocalStorage = [
|
|
77
81
|
AUTH_TOKEN,
|
|
78
82
|
AUTH_MIN_TOKEN,
|
|
79
83
|
WALLET_PICKER_SEARCH_KEY,
|
|
80
84
|
PHANTOM_SIGNATURE_STATE,
|
|
85
|
+
AUTH_ONBOARDING_TOKEN,
|
|
81
86
|
];
|
|
82
87
|
const useHandleLogout = (params) => {
|
|
83
88
|
const paramsRef = useRef(params);
|
|
@@ -91,7 +96,10 @@ const useHandleLogout = (params) => {
|
|
|
91
96
|
const jwt = getMinAuthToken();
|
|
92
97
|
if (jwt && p.user) {
|
|
93
98
|
// do not await this async call - just fire and forget
|
|
94
|
-
revokeSession({
|
|
99
|
+
revokeSession({
|
|
100
|
+
environmentId: p.environmentId,
|
|
101
|
+
sessionId: p.user.sessionId,
|
|
102
|
+
});
|
|
95
103
|
}
|
|
96
104
|
p.setLegacyIsVerifying(false);
|
|
97
105
|
for (const item of clearFromLocalStorage)
|
|
@@ -116,7 +124,7 @@ const useHandleLogout = (params) => {
|
|
|
116
124
|
dynamicEvents.removeListener('embeddedWalletUpdatePasswordCompleted');
|
|
117
125
|
dynamicEvents.removeListener('embeddedWalletUpdatePasswordFailed');
|
|
118
126
|
dynamicEvents.emit('logout');
|
|
119
|
-
|
|
127
|
+
clearStore();
|
|
120
128
|
yield Promise.all(p.walletConnectors.map((connector) => connector.endSession()));
|
|
121
129
|
yield Promise.all(p.connectedWallets.map((connectedWallet) => connectedWallet.connector.endSession()));
|
|
122
130
|
}), []);
|
|
@@ -12,6 +12,7 @@ import { ConnectWalletOptions } from '../../../utils/hooks/useConnectWallet/useC
|
|
|
12
12
|
import { ThemeData, ThemeSetting } from '../../ThemeContext';
|
|
13
13
|
import { DisplayOrder, SetDisplayOrderPriority, SetShowAuthFlow } from '../hooks';
|
|
14
14
|
import { SetCallbackType } from '../useCustomerCallbacks';
|
|
15
|
+
import { SetUserAction } from '../../../store';
|
|
15
16
|
export type ChainsToConnect = {
|
|
16
17
|
chain: Chain;
|
|
17
18
|
chainId?: number;
|
|
@@ -108,6 +109,8 @@ export interface IDynamicContext {
|
|
|
108
109
|
changeLanguage: typeof changeLanguage;
|
|
109
110
|
};
|
|
110
111
|
loginWithEmail: boolean;
|
|
112
|
+
setDefaultTabIndex: (index: number) => void;
|
|
113
|
+
defaultTabIndex: number;
|
|
111
114
|
minAuthToken: string | undefined;
|
|
112
115
|
multiWallet: boolean;
|
|
113
116
|
multiWalletWidgetState: MultiWalletWidgetState;
|
|
@@ -164,7 +167,7 @@ export interface IDynamicContext {
|
|
|
164
167
|
setShowDynamicUserProfile: Dispatch<SetStateAction<boolean>>;
|
|
165
168
|
setShowQrcodeModal: Dispatch<SetStateAction<boolean>>;
|
|
166
169
|
setShowWidgetStatePopup: Dispatch<SetStateAction<boolean>>;
|
|
167
|
-
setUser:
|
|
170
|
+
setUser: SetUserAction;
|
|
168
171
|
shadowDOMEnabled: boolean;
|
|
169
172
|
showAuthFlow: boolean;
|
|
170
173
|
/**
|
|
@@ -13,7 +13,7 @@ const useDynamicContext = () => {
|
|
|
13
13
|
if (context === undefined) {
|
|
14
14
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
15
15
|
}
|
|
16
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, } = context;
|
|
16
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, setDefaultTabIndex, } = context;
|
|
17
17
|
const { setAuthMode } = useOverrides.useOverrides(context);
|
|
18
18
|
return {
|
|
19
19
|
accountSwitchState,
|
|
@@ -39,6 +39,7 @@ const useDynamicContext = () => {
|
|
|
39
39
|
sdkHasLoaded,
|
|
40
40
|
sendWagmiSettings,
|
|
41
41
|
setAuthMode,
|
|
42
|
+
setDefaultTabIndex,
|
|
42
43
|
setLogInWithEmail,
|
|
43
44
|
setMultiWalletWidgetState,
|
|
44
45
|
setPrimaryWallet,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { IDynamicContext } from '../types';
|
|
3
|
-
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setPrimaryWallet' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'walletConnectorOptions' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'setAuthMode' | 'minAuthToken'> & {
|
|
3
|
+
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setPrimaryWallet' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'walletConnectorOptions' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'setAuthMode' | 'minAuthToken' | 'setDefaultTabIndex'> & {
|
|
4
4
|
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
5
5
|
};
|
|
6
6
|
export declare const useDynamicContext: () => UseDynamicContext;
|
|
@@ -9,7 +9,7 @@ const useDynamicContext = () => {
|
|
|
9
9
|
if (context === undefined) {
|
|
10
10
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
11
11
|
}
|
|
12
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, } = context;
|
|
12
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, setDefaultTabIndex, } = context;
|
|
13
13
|
const { setAuthMode } = useOverrides(context);
|
|
14
14
|
return {
|
|
15
15
|
accountSwitchState,
|
|
@@ -35,6 +35,7 @@ const useDynamicContext = () => {
|
|
|
35
35
|
sdkHasLoaded,
|
|
36
36
|
sendWagmiSettings,
|
|
37
37
|
setAuthMode,
|
|
38
|
+
setDefaultTabIndex,
|
|
38
39
|
setLogInWithEmail,
|
|
39
40
|
setMultiWalletWidgetState,
|
|
40
41
|
setPrimaryWallet,
|
|
@@ -3,34 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
require('@dynamic-labs/sdk-api-core');
|
|
7
|
-
require('../../../shared/logger.cjs');
|
|
8
|
-
var validateType = require('../../../shared/utils/functions/validateType/validateType.cjs');
|
|
9
|
-
require('@dynamic-labs/iconic');
|
|
10
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
11
|
-
require('react/jsx-runtime');
|
|
12
|
-
require('../../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
|
-
|
|
21
|
-
// TODO: need validation for optional fields
|
|
22
|
-
// https://linear.app/dynamic-labs/issue/DYN-1461
|
|
23
|
-
const validateAuthUser = (data) => validateType.validateType(data, {
|
|
24
|
-
environmentId: 'environmentId',
|
|
25
|
-
lastVerifiedCredentialId: 'lastAuthenticatedAccountId',
|
|
26
|
-
userId: 'userId',
|
|
27
|
-
verifiedCredentials: [
|
|
28
|
-
{
|
|
29
|
-
format: 'format',
|
|
30
|
-
id: 'id',
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
});
|
|
34
6
|
const validateLocalStorageExpiry = (data) => {
|
|
35
7
|
if (!data)
|
|
36
8
|
return false;
|
|
@@ -41,5 +13,4 @@ const validateLocalStorageExpiry = (data) => {
|
|
|
41
13
|
return true;
|
|
42
14
|
};
|
|
43
15
|
|
|
44
|
-
exports.validateAuthUser = validateAuthUser;
|
|
45
16
|
exports.validateLocalStorageExpiry = validateLocalStorageExpiry;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { UserProfile } from '@dynamic-labs/types';
|
|
2
1
|
import { LocalStorageNetworks, LocalStorageNonce, LocalStorageSettings } from '../../../shared';
|
|
3
|
-
export declare const validateAuthUser: (data: UserProfile | undefined) => boolean;
|
|
4
2
|
export declare const validateLocalStorageExpiry: (data: LocalStorageNonce | LocalStorageNetworks | LocalStorageSettings | undefined) => boolean;
|
|
@@ -1,32 +1,4 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import '@dynamic-labs/sdk-api-core';
|
|
3
|
-
import '../../../shared/logger.js';
|
|
4
|
-
import { validateType } from '../../../shared/utils/functions/validateType/validateType.js';
|
|
5
|
-
import '@dynamic-labs/iconic';
|
|
6
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
7
|
-
import 'react/jsx-runtime';
|
|
8
|
-
import '../../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
|
-
|
|
17
|
-
// TODO: need validation for optional fields
|
|
18
|
-
// https://linear.app/dynamic-labs/issue/DYN-1461
|
|
19
|
-
const validateAuthUser = (data) => validateType(data, {
|
|
20
|
-
environmentId: 'environmentId',
|
|
21
|
-
lastVerifiedCredentialId: 'lastAuthenticatedAccountId',
|
|
22
|
-
userId: 'userId',
|
|
23
|
-
verifiedCredentials: [
|
|
24
|
-
{
|
|
25
|
-
format: 'format',
|
|
26
|
-
id: 'id',
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
2
|
const validateLocalStorageExpiry = (data) => {
|
|
31
3
|
if (!data)
|
|
32
4
|
return false;
|
|
@@ -37,4 +9,4 @@ const validateLocalStorageExpiry = (data) => {
|
|
|
37
9
|
return true;
|
|
38
10
|
};
|
|
39
11
|
|
|
40
|
-
export {
|
|
12
|
+
export { validateLocalStorageExpiry };
|
|
@@ -18,18 +18,18 @@ require('../../utils/constants/values.cjs');
|
|
|
18
18
|
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
19
|
require('../../shared/consts/index.cjs');
|
|
20
20
|
require('../../config/ApiEndpoint.cjs');
|
|
21
|
-
var onramp = require('../../data/api/onramp/onramp.cjs');
|
|
22
|
-
require('../../locale/locale.cjs');
|
|
23
|
-
require('../DynamicContext/DynamicContext.cjs');
|
|
24
|
-
require('../../events/dynamicEvents.cjs');
|
|
25
|
-
require('../CaptchaContext/CaptchaContext.cjs');
|
|
26
|
-
require('../ErrorContext/ErrorContext.cjs');
|
|
27
21
|
require('@dynamic-labs/multi-wallet');
|
|
28
22
|
require('react-international-phone');
|
|
29
23
|
var isOnrampProvider = require('../../utils/functions/isOnrampProvider/isOnrampProvider.cjs');
|
|
30
24
|
var getWalletAdditionalAddressByType = require('../../utils/functions/getWalletAdditionalAddressByType/getWalletAdditionalAddressByType.cjs');
|
|
31
25
|
require('viem');
|
|
32
26
|
require('viem/chains');
|
|
27
|
+
var onramp = require('../../data/api/onramp/onramp.cjs');
|
|
28
|
+
require('../../locale/locale.cjs');
|
|
29
|
+
require('../DynamicContext/DynamicContext.cjs');
|
|
30
|
+
require('../../events/dynamicEvents.cjs');
|
|
31
|
+
require('../CaptchaContext/CaptchaContext.cjs');
|
|
32
|
+
require('../ErrorContext/ErrorContext.cjs');
|
|
33
33
|
require('../AccessDeniedContext/AccessDeniedContext.cjs');
|
|
34
34
|
require('../AccountExistsContext/AccountExistsContext.cjs');
|
|
35
35
|
require('../UserWalletsContext/UserWalletsContext.cjs');
|
|
@@ -14,18 +14,18 @@ import '../../utils/constants/values.js';
|
|
|
14
14
|
import '../../shared/utils/classes/storage/localStorage.js';
|
|
15
15
|
import '../../shared/consts/index.js';
|
|
16
16
|
import '../../config/ApiEndpoint.js';
|
|
17
|
-
import { getOnrampProviders } from '../../data/api/onramp/onramp.js';
|
|
18
|
-
import '../../locale/locale.js';
|
|
19
|
-
import '../DynamicContext/DynamicContext.js';
|
|
20
|
-
import '../../events/dynamicEvents.js';
|
|
21
|
-
import '../CaptchaContext/CaptchaContext.js';
|
|
22
|
-
import '../ErrorContext/ErrorContext.js';
|
|
23
17
|
import '@dynamic-labs/multi-wallet';
|
|
24
18
|
import 'react-international-phone';
|
|
25
19
|
import { isOnrampProvider } from '../../utils/functions/isOnrampProvider/isOnrampProvider.js';
|
|
26
20
|
import { getWalletAdditionalAddressByType } from '../../utils/functions/getWalletAdditionalAddressByType/getWalletAdditionalAddressByType.js';
|
|
27
21
|
import 'viem';
|
|
28
22
|
import 'viem/chains';
|
|
23
|
+
import { getOnrampProviders } from '../../data/api/onramp/onramp.js';
|
|
24
|
+
import '../../locale/locale.js';
|
|
25
|
+
import '../DynamicContext/DynamicContext.js';
|
|
26
|
+
import '../../events/dynamicEvents.js';
|
|
27
|
+
import '../CaptchaContext/CaptchaContext.js';
|
|
28
|
+
import '../ErrorContext/ErrorContext.js';
|
|
29
29
|
import '../AccessDeniedContext/AccessDeniedContext.js';
|
|
30
30
|
import '../AccountExistsContext/AccountExistsContext.js';
|
|
31
31
|
import '../UserWalletsContext/UserWalletsContext.js';
|
|
@@ -122,7 +122,6 @@ const PasskeyContextProviderWithBrowser = ({ children, }) => {
|
|
|
122
122
|
const getUserPasskeysResult = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
123
123
|
const data = yield embeddedWallets.getUserPasskeys({
|
|
124
124
|
environmentId: environmentId,
|
|
125
|
-
userJwt: userJwt,
|
|
126
125
|
});
|
|
127
126
|
return data.passkeys;
|
|
128
127
|
}), {
|
|
@@ -118,7 +118,6 @@ const PasskeyContextProviderWithBrowser = ({ children, }) => {
|
|
|
118
118
|
const getUserPasskeysResult = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
119
119
|
const data = yield getUserPasskeys({
|
|
120
120
|
environmentId: environmentId,
|
|
121
|
-
userJwt: userJwt,
|
|
122
121
|
});
|
|
123
122
|
return data.passkeys;
|
|
124
123
|
}), {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { viewToComponentMap } from '../../../views/viewToComponentMap';
|
|
3
|
-
export type ViewType = 'select-hardware-wallet' | 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'verify-sms' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'multi-wallet-wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'merge-user-accounts-conflicts' | 'merge-user-accounts-with-same-email' | 'mfa-choose-device' | 'mfa-secure-device' | 'mfa-verification' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-add-email' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'embedded-reveal-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'create-password-view' | 'wallet-claim-intro' | 'farcaster-connect-view';
|
|
3
|
+
export type ViewType = 'select-hardware-wallet' | 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'verify-sms' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'multi-wallet-wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'merge-user-accounts-conflicts' | 'merge-user-accounts-with-same-email' | 'mfa-choose-device' | 'mfa-secure-device' | 'mfa-verification' | 'mfa-display-backup-codes' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-add-email' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'embedded-reveal-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'create-password-view' | 'wallet-claim-intro' | 'farcaster-connect-view';
|
|
4
4
|
export type ViewMapConstraint = Record<ViewType, FC<any>>;
|
|
5
5
|
type ComponentProps<T extends FC<any>> = T extends FC<infer P> ? P : never;
|
|
6
6
|
export type ViewMap = typeof viewToComponentMap;
|
package/src/lib/data/api/api.cjs
CHANGED
|
@@ -6,16 +6,38 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
7
7
|
var version = require('../../../version.cjs');
|
|
8
8
|
var ApiEndpoint = require('../../config/ApiEndpoint.cjs');
|
|
9
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
10
|
+
require('../../shared/logger.cjs');
|
|
11
|
+
require('@dynamic-labs/iconic');
|
|
12
|
+
require('react/jsx-runtime');
|
|
13
|
+
require('../../context/ViewContext/ViewContext.cjs');
|
|
14
|
+
require('react');
|
|
15
|
+
require('@dynamic-labs/wallet-book');
|
|
16
|
+
require('../../utils/constants/colors.cjs');
|
|
17
|
+
require('../../utils/constants/values.cjs');
|
|
18
|
+
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
|
+
require('@dynamic-labs/utils');
|
|
20
|
+
require('../../shared/consts/index.cjs');
|
|
21
|
+
require('../../../../_virtual/_tslib.cjs');
|
|
22
|
+
require('@dynamic-labs/multi-wallet');
|
|
23
|
+
var getMinAuthToken = require('../../utils/functions/getMinAuthToken/getMinAuthToken.cjs');
|
|
24
|
+
var getOnboardingAuthToken = require('../../utils/functions/getOnboardingAuthToken/getOnboardingAuthToken.cjs');
|
|
25
|
+
require('react-international-phone');
|
|
26
|
+
require('viem');
|
|
27
|
+
require('viem/chains');
|
|
28
|
+
require('../../locale/locale.cjs');
|
|
9
29
|
|
|
10
|
-
const sdkApi = (
|
|
30
|
+
const sdkApi = () => {
|
|
31
|
+
var _a;
|
|
11
32
|
const settings = {
|
|
12
33
|
basePath: ApiEndpoint.getBaseUrl(),
|
|
13
34
|
headers: {
|
|
14
35
|
'Content-Type': 'application/json',
|
|
15
36
|
},
|
|
16
37
|
};
|
|
17
|
-
|
|
18
|
-
|
|
38
|
+
const minJwt = (_a = getMinAuthToken.getMinAuthToken()) !== null && _a !== void 0 ? _a : getOnboardingAuthToken.getOnboardingAuthToken();
|
|
39
|
+
if (minJwt) {
|
|
40
|
+
settings.headers.Authorization = `Bearer ${minJwt}`;
|
|
19
41
|
}
|
|
20
42
|
settings.headers['x-dyn-version'] = `WalletKit/${version.VERSION}`;
|
|
21
43
|
settings.headers['x-dyn-api-version'] = `API/${version.API_VERSION}`;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SDKApi } from '@dynamic-labs/sdk-api-core';
|
|
2
|
-
export declare const sdkApi: (
|
|
2
|
+
export declare const sdkApi: () => SDKApi;
|
package/src/lib/data/api/api.js
CHANGED
|
@@ -2,16 +2,38 @@
|
|
|
2
2
|
import { SDKApi, Configuration } from '@dynamic-labs/sdk-api-core';
|
|
3
3
|
import { VERSION, API_VERSION } from '../../../version.js';
|
|
4
4
|
import ApiEndpoint from '../../config/ApiEndpoint.js';
|
|
5
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import '../../shared/logger.js';
|
|
7
|
+
import '@dynamic-labs/iconic';
|
|
8
|
+
import 'react/jsx-runtime';
|
|
9
|
+
import '../../context/ViewContext/ViewContext.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import '@dynamic-labs/wallet-book';
|
|
12
|
+
import '../../utils/constants/colors.js';
|
|
13
|
+
import '../../utils/constants/values.js';
|
|
14
|
+
import '../../shared/utils/classes/storage/localStorage.js';
|
|
15
|
+
import '@dynamic-labs/utils';
|
|
16
|
+
import '../../shared/consts/index.js';
|
|
17
|
+
import '../../../../_virtual/_tslib.js';
|
|
18
|
+
import '@dynamic-labs/multi-wallet';
|
|
19
|
+
import { getMinAuthToken } from '../../utils/functions/getMinAuthToken/getMinAuthToken.js';
|
|
20
|
+
import { getOnboardingAuthToken } from '../../utils/functions/getOnboardingAuthToken/getOnboardingAuthToken.js';
|
|
21
|
+
import 'react-international-phone';
|
|
22
|
+
import 'viem';
|
|
23
|
+
import 'viem/chains';
|
|
24
|
+
import '../../locale/locale.js';
|
|
5
25
|
|
|
6
|
-
const sdkApi = (
|
|
26
|
+
const sdkApi = () => {
|
|
27
|
+
var _a;
|
|
7
28
|
const settings = {
|
|
8
29
|
basePath: ApiEndpoint.getBaseUrl(),
|
|
9
30
|
headers: {
|
|
10
31
|
'Content-Type': 'application/json',
|
|
11
32
|
},
|
|
12
33
|
};
|
|
13
|
-
|
|
14
|
-
|
|
34
|
+
const minJwt = (_a = getMinAuthToken()) !== null && _a !== void 0 ? _a : getOnboardingAuthToken();
|
|
35
|
+
if (minJwt) {
|
|
36
|
+
settings.headers.Authorization = `Bearer ${minJwt}`;
|
|
15
37
|
}
|
|
16
38
|
settings.headers['x-dyn-version'] = `WalletKit/${VERSION}`;
|
|
17
39
|
settings.headers['x-dyn-api-version'] = `API/${API_VERSION}`;
|
|
@@ -19,9 +19,9 @@ require('@dynamic-labs/utils');
|
|
|
19
19
|
require('../../../shared/consts/index.cjs');
|
|
20
20
|
var api = require('../api.cjs');
|
|
21
21
|
|
|
22
|
-
const getAccountTokenBalances = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({
|
|
22
|
+
const getAccountTokenBalances = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ environmentId, chainName = sdkApiCore.ChainEnum.Evm, networkId, accountAddress, }) {
|
|
23
23
|
try {
|
|
24
|
-
const data = yield api.sdkApi(
|
|
24
|
+
const data = yield api.sdkApi().getAccountBalances({
|
|
25
25
|
accountAddress,
|
|
26
26
|
chainName: chainName,
|
|
27
27
|
environmentId,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ChainEnum, TokenBalance } from '@dynamic-labs/sdk-api-core';
|
|
2
|
-
export declare const getAccountTokenBalances: ({
|
|
3
|
-
userJwt: string;
|
|
2
|
+
export declare const getAccountTokenBalances: ({ environmentId, chainName, networkId, accountAddress, }: {
|
|
4
3
|
environmentId: string;
|
|
5
4
|
chainName: ChainEnum;
|
|
6
5
|
networkId: number;
|
|
@@ -15,9 +15,9 @@ import '@dynamic-labs/utils';
|
|
|
15
15
|
import '../../../shared/consts/index.js';
|
|
16
16
|
import { sdkApi } from '../api.js';
|
|
17
17
|
|
|
18
|
-
const getAccountTokenBalances = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
18
|
+
const getAccountTokenBalances = (_a) => __awaiter(void 0, [_a], void 0, function* ({ environmentId, chainName = ChainEnum.Evm, networkId, accountAddress, }) {
|
|
19
19
|
try {
|
|
20
|
-
const data = yield sdkApi(
|
|
20
|
+
const data = yield sdkApi().getAccountBalances({
|
|
21
21
|
accountAddress,
|
|
22
22
|
chainName: chainName,
|
|
23
23
|
environmentId,
|
|
@@ -91,9 +91,9 @@ const retryEmailVerification = (_d) => _tslib.__awaiter(void 0, [_d], void 0, fu
|
|
|
91
91
|
throw new utils.EmailVerificationError(data.code);
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
|
-
const verifyEmail = (_e
|
|
94
|
+
const verifyEmail = (_e) => _tslib.__awaiter(void 0, [_e], void 0, function* ({ verificationToken, verificationUUID, environmentId, }) {
|
|
95
95
|
try {
|
|
96
|
-
const res = yield api.sdkApi(
|
|
96
|
+
const res = yield api.sdkApi().verifyEmailVerification({
|
|
97
97
|
emailVerificationVerifyRequest: {
|
|
98
98
|
verificationToken,
|
|
99
99
|
verificationUUID,
|
|
@@ -87,9 +87,9 @@ const retryEmailVerification = (_d) => __awaiter(void 0, [_d], void 0, function*
|
|
|
87
87
|
throw new EmailVerificationError(data.code);
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
-
const verifyEmail = (_e
|
|
90
|
+
const verifyEmail = (_e) => __awaiter(void 0, [_e], void 0, function* ({ verificationToken, verificationUUID, environmentId, }) {
|
|
91
91
|
try {
|
|
92
|
-
const res = yield sdkApi(
|
|
92
|
+
const res = yield sdkApi().verifyEmailVerification({
|
|
93
93
|
emailVerificationVerifyRequest: {
|
|
94
94
|
verificationToken,
|
|
95
95
|
verificationUUID,
|
|
@@ -19,7 +19,7 @@ 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 createTurnkeyEmbeddedWallet = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ attestation, challenge, environmentId,
|
|
22
|
+
const createTurnkeyEmbeddedWallet = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ attestation, challenge, environmentId, chains = [sdkApiCore.ChainEnum.Evm], passkeyAlias, }) {
|
|
23
23
|
const embeddedWallets = [
|
|
24
24
|
{
|
|
25
25
|
chains,
|
|
@@ -34,16 +34,16 @@ const createTurnkeyEmbeddedWallet = (_a) => _tslib.__awaiter(void 0, [_a], void
|
|
|
34
34
|
challenge,
|
|
35
35
|
}, isAuthenticatorAttached: true });
|
|
36
36
|
}
|
|
37
|
-
return api.sdkApi(
|
|
37
|
+
return api.sdkApi().createEmbeddedWallets({
|
|
38
38
|
createEmbeddedWalletsRequest: {
|
|
39
39
|
embeddedWallets,
|
|
40
40
|
},
|
|
41
41
|
environmentId,
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
|
-
const initEmbeddedWalletSession = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ authenticatorType, walletId, publicKey, environmentId,
|
|
44
|
+
const initEmbeddedWalletSession = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ authenticatorType, walletId, publicKey, environmentId, }) {
|
|
45
45
|
if (authenticatorType === 'passkey') {
|
|
46
|
-
return api.sdkApi(
|
|
46
|
+
return api.sdkApi().initPasskeyRecovery({
|
|
47
47
|
environmentId,
|
|
48
48
|
initPasskeyRecoveryRequest: {
|
|
49
49
|
turnkeyRecoveryTargetPublicKey: publicKey,
|
|
@@ -51,7 +51,7 @@ const initEmbeddedWalletSession = (_b) => _tslib.__awaiter(void 0, [_b], void 0,
|
|
|
51
51
|
},
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
return api.sdkApi(
|
|
54
|
+
return api.sdkApi().initEmailAuth({
|
|
55
55
|
environmentId,
|
|
56
56
|
initEmailAuthRequest: {
|
|
57
57
|
turnkeyEmailAuthTargetPublicKey: publicKey,
|
|
@@ -59,8 +59,8 @@ const initEmbeddedWalletSession = (_b) => _tslib.__awaiter(void 0, [_b], void 0,
|
|
|
59
59
|
},
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
|
-
const completePasskeyRecovery = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ walletId, attestation, challenge, environmentId,
|
|
63
|
-
return api.sdkApi(
|
|
62
|
+
const completePasskeyRecovery = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ walletId, attestation, challenge, environmentId, }) {
|
|
63
|
+
return api.sdkApi().completePasskeyRecovery({
|
|
64
64
|
completePasskeyRecoveryRequest: {
|
|
65
65
|
attestation,
|
|
66
66
|
challenge,
|
|
@@ -69,9 +69,9 @@ const completePasskeyRecovery = (_c) => _tslib.__awaiter(void 0, [_c], void 0, f
|
|
|
69
69
|
environmentId,
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
|
-
const updatePasskeyRecoveryEmail = (_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({
|
|
72
|
+
const updatePasskeyRecoveryEmail = (_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ environmentId, updateRecoveryEmailRequest, }) {
|
|
73
73
|
try {
|
|
74
|
-
yield api.sdkApi(
|
|
74
|
+
yield api.sdkApi().updateEmbeddedWalletRecoveryEmail({
|
|
75
75
|
environmentId,
|
|
76
76
|
updateRecoveryEmailRequest,
|
|
77
77
|
});
|
|
@@ -81,9 +81,9 @@ const updatePasskeyRecoveryEmail = (_d) => _tslib.__awaiter(void 0, [_d], void 0
|
|
|
81
81
|
throw new utils.DynamicError('Error updating recovery email');
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
const getUserPasskeys = (_e) => _tslib.__awaiter(void 0, [_e], void 0, function* ({
|
|
84
|
+
const getUserPasskeys = (_e) => _tslib.__awaiter(void 0, [_e], void 0, function* ({ environmentId, }) {
|
|
85
85
|
try {
|
|
86
|
-
const data = yield api.sdkApi(
|
|
86
|
+
const data = yield api.sdkApi().getUserPasskeys({
|
|
87
87
|
environmentId,
|
|
88
88
|
});
|
|
89
89
|
return data;
|
|
@@ -96,9 +96,9 @@ const getUserPasskeys = (_e) => _tslib.__awaiter(void 0, [_e], void 0, function*
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
|
-
const updateUserPasskey = (_f) => _tslib.__awaiter(void 0, [_f], void 0, function* ({
|
|
99
|
+
const updateUserPasskey = (_f) => _tslib.__awaiter(void 0, [_f], void 0, function* ({ environmentId, id, alias, }) {
|
|
100
100
|
try {
|
|
101
|
-
const data = yield api.sdkApi(
|
|
101
|
+
const data = yield api.sdkApi().updatePasskey({
|
|
102
102
|
environmentId,
|
|
103
103
|
updateUserPasskeyRequest: { alias, id },
|
|
104
104
|
});
|
|
@@ -109,9 +109,9 @@ const updateUserPasskey = (_f) => _tslib.__awaiter(void 0, [_f], void 0, functio
|
|
|
109
109
|
return undefined;
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
|
-
const exportEmbeddedWallet = (_g) => _tslib.__awaiter(void 0, [_g], void 0, function* ({
|
|
112
|
+
const exportEmbeddedWallet = (_g) => _tslib.__awaiter(void 0, [_g], void 0, function* ({ environmentId, walletId, activityId, }) {
|
|
113
113
|
try {
|
|
114
|
-
const data = yield api.sdkApi(
|
|
114
|
+
const data = yield api.sdkApi().embeddedWalletExport({
|
|
115
115
|
activityId,
|
|
116
116
|
environmentId,
|
|
117
117
|
walletId,
|
|
@@ -123,9 +123,9 @@ const exportEmbeddedWallet = (_g) => _tslib.__awaiter(void 0, [_g], void 0, func
|
|
|
123
123
|
return { exportBundle: '' };
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
|
-
const getWalletAuthToken = (_h
|
|
126
|
+
const getWalletAuthToken = (_h) => _tslib.__awaiter(void 0, [_h], void 0, function* ({ environmentId, type, }) {
|
|
127
127
|
try {
|
|
128
|
-
const authToken = yield api.sdkApi(
|
|
128
|
+
const authToken = yield api.sdkApi().getAuthToken({
|
|
129
129
|
environmentId,
|
|
130
130
|
type,
|
|
131
131
|
});
|
|
@@ -135,9 +135,9 @@ const getWalletAuthToken = (_h, userJwt_1) => _tslib.__awaiter(void 0, [_h, user
|
|
|
135
135
|
return undefined;
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
|
-
const getEmbeddedWalletBackup = (_j
|
|
138
|
+
const getEmbeddedWalletBackup = (_j) => _tslib.__awaiter(void 0, [_j], void 0, function* ({ environmentId, }) {
|
|
139
139
|
try {
|
|
140
|
-
const response = yield api.sdkApi(
|
|
140
|
+
const response = yield api.sdkApi().getEmbeddedWalletBackups({
|
|
141
141
|
environmentId,
|
|
142
142
|
});
|
|
143
143
|
return response.secret;
|
|
@@ -146,9 +146,9 @@ const getEmbeddedWalletBackup = (_j, userJwt_2) => _tslib.__awaiter(void 0, [_j,
|
|
|
146
146
|
return undefined;
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
|
-
const getEmbeddedWalletPasscode = (_k
|
|
149
|
+
const getEmbeddedWalletPasscode = (_k) => _tslib.__awaiter(void 0, [_k], void 0, function* ({ environmentId, }) {
|
|
150
150
|
try {
|
|
151
|
-
const response = yield api.sdkApi(
|
|
151
|
+
const response = yield api.sdkApi().getEmbeddedWalletPasscode({
|
|
152
152
|
environmentId,
|
|
153
153
|
});
|
|
154
154
|
return response.secret;
|
|
@@ -157,10 +157,10 @@ const getEmbeddedWalletPasscode = (_k, userJwt_3) => _tslib.__awaiter(void 0, [_
|
|
|
157
157
|
return undefined;
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
|
-
const claimEmbeddedWallet = (_l
|
|
160
|
+
const claimEmbeddedWallet = (_l) => _tslib.__awaiter(void 0, [_l], void 0, function* ({ environmentId, walletId, }) {
|
|
161
161
|
var _m, _o;
|
|
162
162
|
try {
|
|
163
|
-
const response = yield api.sdkApi(
|
|
163
|
+
const response = yield api.sdkApi().claimEmbeddedWallet({
|
|
164
164
|
embeddedWalletPasscodeClaimRequest: {
|
|
165
165
|
walletId,
|
|
166
166
|
},
|