@dynamic-labs/sdk-react-core 2.0.0-alpha.31 → 2.0.0-alpha.32
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 +2 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +14 -14
- package/src/index.d.ts +1 -1
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.cjs +21 -6
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.js +16 -1
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.cjs +17 -3
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.js +15 -1
- package/src/lib/context/ConnectWithOtpContext/utils/findEmailProvider.cjs +19 -4
- package/src/lib/context/ConnectWithOtpContext/utils/findEmailProvider.js +16 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +17 -17
- package/src/lib/context/DynamicContext/DynamicContext.js +3 -3
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +6 -6
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +5 -5
- package/src/lib/context/FundingContext/FundingContext.cjs +6 -6
- package/src/lib/context/FundingContext/FundingContext.js +5 -5
- package/src/lib/context/PasskeyContext/PasskeyContext.cjs +4 -4
- package/src/lib/context/PasskeyContext/PasskeyContext.js +3 -3
- package/src/lib/data/api/api.cjs +24 -0
- package/src/lib/data/api/api.d.ts +2 -0
- package/src/lib/data/api/api.js +20 -0
- package/src/lib/data/api/email/email.cjs +118 -0
- package/src/lib/data/api/email/email.d.ts +26 -0
- package/src/lib/data/api/email/email.js +110 -0
- package/src/lib/data/api/email/index.d.ts +1 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +191 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.d.ts +30 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +177 -0
- package/src/lib/data/api/embeddedWallets/index.d.ts +2 -0
- package/src/lib/data/api/embeddedWallets/types.d.ts +39 -0
- package/src/lib/data/api/index.d.ts +10 -0
- package/src/lib/data/api/oauth/index.d.ts +1 -0
- package/src/lib/data/api/oauth/oauth.cjs +136 -0
- package/src/lib/data/api/oauth/oauth.d.ts +11 -0
- package/src/lib/data/api/oauth/oauth.js +128 -0
- package/src/lib/data/api/onramp/index.d.ts +1 -0
- package/src/lib/data/api/onramp/onramp.cjs +22 -0
- package/src/lib/data/api/onramp/onramp.d.ts +8 -0
- package/src/lib/data/api/onramp/onramp.js +18 -0
- package/src/lib/data/api/session/index.d.ts +1 -0
- package/src/lib/data/api/session/session.cjs +77 -0
- package/src/lib/data/api/session/session.d.ts +17 -0
- package/src/lib/data/api/session/session.js +69 -0
- package/src/lib/data/api/settings/index.d.ts +1 -0
- package/src/lib/data/api/settings/settings.cjs +58 -0
- package/src/lib/data/api/settings/settings.d.ts +7 -0
- package/src/lib/data/api/settings/settings.js +53 -0
- package/src/lib/data/api/sms/index.d.ts +1 -0
- package/src/lib/data/api/sms/sms.cjs +102 -0
- package/src/lib/data/api/sms/sms.d.ts +32 -0
- package/src/lib/data/api/sms/sms.js +95 -0
- package/src/lib/data/api/user/index.d.ts +1 -0
- package/src/lib/data/api/user/user.cjs +77 -0
- package/src/lib/data/api/user/user.d.ts +9 -0
- package/src/lib/data/api/user/user.js +71 -0
- package/src/lib/data/api/utils.cjs +20 -0
- package/src/lib/data/api/utils.d.ts +1 -0
- package/src/lib/data/api/utils.js +16 -0
- package/src/lib/data/api/wallets/index.d.ts +1 -0
- package/src/lib/data/api/wallets/wallets.cjs +137 -0
- package/src/lib/data/api/wallets/wallets.d.ts +10 -0
- package/src/lib/data/api/wallets/wallets.js +130 -0
- package/src/lib/data/index.d.ts +1 -0
- package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +3 -4
- package/src/lib/shared/types/general.d.ts +1 -0
- package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.cjs +18 -4
- package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.js +15 -1
- package/src/lib/utils/functions/handleUnlinkHelper/handleUnlinkHelper.cjs +6 -4
- package/src/lib/utils/functions/handleUnlinkHelper/handleUnlinkHelper.js +5 -3
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.cjs +4 -3
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.d.ts +3 -3
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.js +3 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +4 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +3 -1
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +6 -6
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +3 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +4 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +3 -3
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs +4 -4
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.js +3 -3
- package/src/lib/utils/hooks/useFetchNonce/useFetchNonce.cjs +6 -4
- package/src/lib/utils/hooks/useFetchNonce/useFetchNonce.js +3 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +6 -6
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +3 -3
- package/src/lib/utils/hooks/useHandleVerificationRequired/useHandleVerificationRequired.d.ts +4 -4
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +8 -8
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +3 -3
- package/src/lib/utils/hooks/useSendDynamicProps/useSendDynamicProps.cjs +9 -6
- package/src/lib/utils/hooks/useSendDynamicProps/useSendDynamicProps.js +4 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +4 -4
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +3 -3
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +7 -7
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +3 -3
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +4 -4
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +3 -3
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +5 -5
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +3 -3
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +4 -4
- package/src/lib/views/EmailUpdate/EmailUpdate.js +3 -3
- package/src/lib/views/EmailVerification/EmailVerification.cjs +11 -11
- package/src/lib/views/EmailVerification/EmailVerification.js +3 -3
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +4 -2
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +3 -1
- package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/useSubmitPhoneNumber/useSubmitPhoneNumber.cjs +3 -3
- package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/useSubmitPhoneNumber/useSubmitPhoneNumber.js +2 -2
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +7 -7
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +3 -3
- package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.cjs +4 -4
- package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.js +3 -3
- package/src/lib/views/Passkey/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.cjs +4 -2
- package/src/lib/views/Passkey/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.js +3 -1
- package/src/lib/views/Passkey/utils/createPregeneratedWallet/createPregeneratedWallet.cjs +4 -2
- package/src/lib/views/Passkey/utils/createPregeneratedWallet/createPregeneratedWallet.js +3 -1
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +11 -8
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +5 -2
- package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/index.d.ts +1 -0
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +4 -4
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +2 -2
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +4 -4
- package/src/lib/views/WalletUsedView/WalletUsedView.js +3 -3
- package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.cjs +6 -2
- package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.js +6 -2
- package/src/lib/data/api.cjs +0 -797
- package/src/lib/data/api.d.ts +0 -179
- package/src/lib/data/api.js +0 -753
package/src/lib/data/api.js
DELETED
|
@@ -1,753 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
2
|
-
import { NoAccessError, AccountExistsError, EmailVerificationError, WalletUsedError, DynamicError, EmailAlreadyExistsError, UsernameAlreadyExistsError, TooManyEmailVerificationsError, InvalidPhoneNumberError, UserHasAccountWithEmailError, SmsVerificationError, WalletNotDeployedError, ChainalysisError, GateBlockedError, EmailProviderError, SocialAccountAlreadyExistsError } from '@dynamic-labs/utils';
|
|
3
|
-
import { VerifyRequestFromJSON, SDKApi, Configuration, UnprocessableEntityErrorCode, ChainEnum, WalletProviderEnum, AuthModeEnum, EmbeddedWalletProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
4
|
-
import { VERSION, API_VERSION } from '../../version.js';
|
|
5
|
-
import ApiEndpoint from '../config/ApiEndpoint.js';
|
|
6
|
-
import { logger } from '../shared/logger.js';
|
|
7
|
-
import '@dynamic-labs/iconic';
|
|
8
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
9
|
-
import 'react/jsx-runtime';
|
|
10
|
-
import '../context/ViewContext/ViewContext.js';
|
|
11
|
-
import 'react';
|
|
12
|
-
import '@dynamic-labs/wallet-book';
|
|
13
|
-
import '../utils/constants/colors.js';
|
|
14
|
-
import '../utils/constants/values.js';
|
|
15
|
-
import '../shared/utils/classes/storage/localStorage.js';
|
|
16
|
-
import '../shared/consts/index.js';
|
|
17
|
-
import { isDynamicContextSessionSettingExpired, setDynamicContextSessionSettings, isWagmiSessionSettingExpired, setWagmiSessionSettings } from '../context/DynamicContext/helpers/helpers.js';
|
|
18
|
-
import { Locale } from '../locale/locale.js';
|
|
19
|
-
|
|
20
|
-
const sdkApi = (jwt) => {
|
|
21
|
-
const settings = {
|
|
22
|
-
basePath: ApiEndpoint.getBaseUrl(),
|
|
23
|
-
headers: {
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
if (jwt) {
|
|
28
|
-
settings.headers.Authorization = `Bearer ${jwt}`;
|
|
29
|
-
}
|
|
30
|
-
settings.headers['x-dyn-version'] = `WalletKit/${VERSION}`;
|
|
31
|
-
settings.headers['x-dyn-api-version'] = `API/${API_VERSION}`;
|
|
32
|
-
return new SDKApi(new Configuration(settings));
|
|
33
|
-
};
|
|
34
|
-
const fetchNonce = (environmentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
-
try {
|
|
36
|
-
const res = yield sdkApi().getNonce({
|
|
37
|
-
environmentId,
|
|
38
|
-
});
|
|
39
|
-
return res.nonce;
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const getEmailProvider = ({ email, environmentId, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
try {
|
|
47
|
-
const res = yield sdkApi().getEmailProvider({
|
|
48
|
-
email,
|
|
49
|
-
environmentId,
|
|
50
|
-
});
|
|
51
|
-
return res;
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
const data = yield e.json();
|
|
55
|
-
logger.error(data.error);
|
|
56
|
-
throw new EmailProviderError(data.code);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
const createEmailVerification = ({ email, environmentId, captchaToken, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
-
try {
|
|
61
|
-
const res = yield sdkApi().createEmailVerification({
|
|
62
|
-
emailVerificationCreateRequest: {
|
|
63
|
-
captchaToken,
|
|
64
|
-
email,
|
|
65
|
-
},
|
|
66
|
-
environmentId,
|
|
67
|
-
});
|
|
68
|
-
return res;
|
|
69
|
-
}
|
|
70
|
-
catch (e) {
|
|
71
|
-
const data = yield e.json();
|
|
72
|
-
logger.error(data.error);
|
|
73
|
-
throw new EmailVerificationError(data.code);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
const signInWithEmailVerification = ({ verificationToken, verificationUUID, environmentId, captchaToken, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
-
try {
|
|
78
|
-
const res = yield sdkApi().signInWithEmailVerification({
|
|
79
|
-
emailVerificationVerifyRequest: {
|
|
80
|
-
captchaToken,
|
|
81
|
-
verificationToken,
|
|
82
|
-
verificationUUID,
|
|
83
|
-
},
|
|
84
|
-
environmentId,
|
|
85
|
-
});
|
|
86
|
-
return res;
|
|
87
|
-
}
|
|
88
|
-
catch (e) {
|
|
89
|
-
const data = yield e.json();
|
|
90
|
-
logger.error(data.error);
|
|
91
|
-
if (data.error.code === 'missing_from_list') {
|
|
92
|
-
throw new NoAccessError({ email: data.payload.email });
|
|
93
|
-
}
|
|
94
|
-
if (data.code === 'email_associated_with_different_provider') {
|
|
95
|
-
throw new AccountExistsError(data.error, data.payload);
|
|
96
|
-
}
|
|
97
|
-
throw new EmailVerificationError(data.code);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
const retryEmailVerification = ({ email, environmentId, verificationUUID, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
|
-
try {
|
|
102
|
-
const res = yield sdkApi().retryEmailVerification({
|
|
103
|
-
emailVerificationRetryRequest: {
|
|
104
|
-
email,
|
|
105
|
-
verificationUUID,
|
|
106
|
-
},
|
|
107
|
-
environmentId,
|
|
108
|
-
});
|
|
109
|
-
return res;
|
|
110
|
-
}
|
|
111
|
-
catch (e) {
|
|
112
|
-
const data = yield e.json();
|
|
113
|
-
logger.error(data.error);
|
|
114
|
-
throw new EmailVerificationError(data.code);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
const verifyEmail = ({ verificationToken, verificationUUID, environmentId, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
118
|
-
try {
|
|
119
|
-
const res = yield sdkApi(userJwt).verifyEmailVerification({
|
|
120
|
-
emailVerificationVerifyRequest: {
|
|
121
|
-
verificationToken,
|
|
122
|
-
verificationUUID,
|
|
123
|
-
},
|
|
124
|
-
environmentId,
|
|
125
|
-
});
|
|
126
|
-
return res;
|
|
127
|
-
}
|
|
128
|
-
catch (e) {
|
|
129
|
-
const data = yield e.json();
|
|
130
|
-
logger.error(data.error);
|
|
131
|
-
if (data.code === UnprocessableEntityErrorCode.UserHasAlreadyAccountWithEmail) {
|
|
132
|
-
throw new UserHasAccountWithEmailError(data.error);
|
|
133
|
-
}
|
|
134
|
-
throw new EmailVerificationError(data.code);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
const revokeSession = ({ environmentId, sessionId, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
138
|
-
try {
|
|
139
|
-
yield sdkApi(userJwt).revokeSession({
|
|
140
|
-
environmentId,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
catch (error) {
|
|
144
|
-
const body = yield error.json();
|
|
145
|
-
logger.error(Error(body.error.message));
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
const linkWallet = (environmentId, { messageToSign, network, signedMessage, publicWalletAddress, chain, walletName, walletProvider, additionalWalletAddresses, backup, password, passwordSource, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
149
|
-
const verifyRequest = VerifyRequestFromJSON({
|
|
150
|
-
additionalWalletAddresses,
|
|
151
|
-
backup,
|
|
152
|
-
chain,
|
|
153
|
-
messageToSign,
|
|
154
|
-
network,
|
|
155
|
-
password,
|
|
156
|
-
passwordSource,
|
|
157
|
-
publicWalletAddress,
|
|
158
|
-
signedMessage,
|
|
159
|
-
walletName,
|
|
160
|
-
walletProvider,
|
|
161
|
-
});
|
|
162
|
-
try {
|
|
163
|
-
const response = yield sdkApi(userJwt).verifyLink({
|
|
164
|
-
environmentId,
|
|
165
|
-
verifyRequest,
|
|
166
|
-
});
|
|
167
|
-
return response;
|
|
168
|
-
}
|
|
169
|
-
catch (e) {
|
|
170
|
-
logger.error(e);
|
|
171
|
-
const data = yield e.json();
|
|
172
|
-
if (data.code === 'reassign_wallet_confirm' ||
|
|
173
|
-
data.code === 'reassign_wallet_error') {
|
|
174
|
-
throw new WalletUsedError(data.code);
|
|
175
|
-
}
|
|
176
|
-
return undefined;
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
const unlinkWallet = ({ environmentId, primaryWalletId, walletId, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
180
|
-
try {
|
|
181
|
-
const response = yield sdkApi(userJwt).verifyUnlink({
|
|
182
|
-
environmentId,
|
|
183
|
-
verifyUnlinkRequest: {
|
|
184
|
-
primaryWalletId,
|
|
185
|
-
walletId,
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
return response;
|
|
189
|
-
}
|
|
190
|
-
catch (e) {
|
|
191
|
-
return undefined;
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
const transferWallet = (environmentId, { network, messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, skipEmptyAccountCheck = false, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
195
|
-
// We should find a better way to do this than force type casting
|
|
196
|
-
const verifyRequest = {
|
|
197
|
-
chain,
|
|
198
|
-
messageToSign,
|
|
199
|
-
network,
|
|
200
|
-
publicWalletAddress,
|
|
201
|
-
signedMessage,
|
|
202
|
-
skipEmptyAccountCheck,
|
|
203
|
-
walletName,
|
|
204
|
-
walletProvider,
|
|
205
|
-
};
|
|
206
|
-
try {
|
|
207
|
-
const response = yield sdkApi(userJwt).verifyTransfer({
|
|
208
|
-
environmentId,
|
|
209
|
-
verifyRequest,
|
|
210
|
-
});
|
|
211
|
-
return response;
|
|
212
|
-
}
|
|
213
|
-
catch (_a) {
|
|
214
|
-
return undefined;
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
const mapChainToChainEnum = (chain) => {
|
|
218
|
-
const foundChain = Object.values(ChainEnum).find((value) => value === chain);
|
|
219
|
-
if (!foundChain) {
|
|
220
|
-
throw new DynamicError(`Invalid chain ${chain}`);
|
|
221
|
-
}
|
|
222
|
-
return foundChain;
|
|
223
|
-
};
|
|
224
|
-
const mapProviderToProviderEnum = (provider) => {
|
|
225
|
-
const foundProvider = Object.values(WalletProviderEnum).find((value) => value === provider);
|
|
226
|
-
if (!foundProvider) {
|
|
227
|
-
throw new DynamicError(`Invalid provider ${provider}`);
|
|
228
|
-
}
|
|
229
|
-
return foundProvider;
|
|
230
|
-
};
|
|
231
|
-
const mapAuthModeTypeToEnum = (authMode) => {
|
|
232
|
-
const found = Object.values(AuthModeEnum).find((value) => value === authMode);
|
|
233
|
-
if (!found) {
|
|
234
|
-
throw new DynamicError(`Invalid authMode ${authMode}`);
|
|
235
|
-
}
|
|
236
|
-
return found;
|
|
237
|
-
};
|
|
238
|
-
const createVisit = ({ authMode, chain, environmentId, walletProvider, publicWalletAddress, walletName, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
239
|
-
try {
|
|
240
|
-
const connectRequest = {
|
|
241
|
-
address: publicWalletAddress,
|
|
242
|
-
authMode: mapAuthModeTypeToEnum(authMode),
|
|
243
|
-
chain: mapChainToChainEnum(chain),
|
|
244
|
-
provider: mapProviderToProviderEnum(walletProvider),
|
|
245
|
-
walletName,
|
|
246
|
-
};
|
|
247
|
-
yield sdkApi().createVisit({
|
|
248
|
-
connectRequest,
|
|
249
|
-
environmentId,
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
catch (error) {
|
|
253
|
-
// log error to console, don't do anything else
|
|
254
|
-
logger.error(error);
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
const verifyWallet = (environmentId, { messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, captchaToken, network, oauth, additionalWalletAddresses, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
258
|
-
const verifyRequest = VerifyRequestFromJSON({
|
|
259
|
-
additionalWalletAddresses,
|
|
260
|
-
captchaToken,
|
|
261
|
-
chain,
|
|
262
|
-
messageToSign,
|
|
263
|
-
network,
|
|
264
|
-
oauth,
|
|
265
|
-
publicWalletAddress,
|
|
266
|
-
signedMessage,
|
|
267
|
-
walletName,
|
|
268
|
-
walletProvider,
|
|
269
|
-
});
|
|
270
|
-
try {
|
|
271
|
-
const response = yield sdkApi().verify({
|
|
272
|
-
environmentId,
|
|
273
|
-
verifyRequest,
|
|
274
|
-
});
|
|
275
|
-
return response;
|
|
276
|
-
}
|
|
277
|
-
catch (e) {
|
|
278
|
-
logger.error(e);
|
|
279
|
-
const data = yield e.json();
|
|
280
|
-
if (data.code === 'wallet_not_deployed') {
|
|
281
|
-
throw new WalletNotDeployedError();
|
|
282
|
-
}
|
|
283
|
-
if (data.error.code === 'chainalysis_blocked_wallet') {
|
|
284
|
-
throw new ChainalysisError(data.payload.walletPublicKey);
|
|
285
|
-
}
|
|
286
|
-
if (data.error.code === 'gate_blocked') {
|
|
287
|
-
throw new GateBlockedError(data.payload.walletPublicKey);
|
|
288
|
-
}
|
|
289
|
-
if (data.error.code === 'missing_from_list') {
|
|
290
|
-
throw new NoAccessError({
|
|
291
|
-
walletPublicKey: data.payload.walletPublicKey,
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
if (data.code === 'email_associated_with_different_provider') {
|
|
295
|
-
throw new AccountExistsError(data.error, data.payload);
|
|
296
|
-
}
|
|
297
|
-
return undefined;
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
const fetchProjectSettings = (environmentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
301
|
-
try {
|
|
302
|
-
const res = yield sdkApi().getEnvironmentSettings({
|
|
303
|
-
environmentId,
|
|
304
|
-
});
|
|
305
|
-
return res;
|
|
306
|
-
}
|
|
307
|
-
catch (e) {
|
|
308
|
-
logger.error(e);
|
|
309
|
-
return undefined;
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
const updateUserProfileFields = (jwt, environmentId, fields) => __awaiter(void 0, void 0, void 0, function* () {
|
|
313
|
-
try {
|
|
314
|
-
if (!jwt)
|
|
315
|
-
throw new DynamicError('User not authenticated');
|
|
316
|
-
const res = yield sdkApi(jwt).updateSelf({
|
|
317
|
-
environmentId,
|
|
318
|
-
userFields: fields,
|
|
319
|
-
});
|
|
320
|
-
return res;
|
|
321
|
-
}
|
|
322
|
-
catch (e) {
|
|
323
|
-
logger.error(e);
|
|
324
|
-
if (e instanceof Response) {
|
|
325
|
-
const error = yield e.json();
|
|
326
|
-
if (error.code === 'email_already_exists') {
|
|
327
|
-
throw new EmailAlreadyExistsError();
|
|
328
|
-
}
|
|
329
|
-
else if (error.code === 'username_already_exists') {
|
|
330
|
-
throw new UsernameAlreadyExistsError();
|
|
331
|
-
}
|
|
332
|
-
else if (error.code === 'too_many_verification_attempts') {
|
|
333
|
-
throw new TooManyEmailVerificationsError();
|
|
334
|
-
}
|
|
335
|
-
else if (error.code === 'invalid_phone') {
|
|
336
|
-
throw new InvalidPhoneNumberError();
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
throw e;
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
const verifyOAuth = (environmentId, providerType, { code, codeVerifier, state }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
343
|
-
const oauthRequest = {
|
|
344
|
-
code,
|
|
345
|
-
codeVerifier,
|
|
346
|
-
state,
|
|
347
|
-
};
|
|
348
|
-
try {
|
|
349
|
-
const response = yield sdkApi(userJwt).oauthVerify({
|
|
350
|
-
environmentId,
|
|
351
|
-
oauthRequest,
|
|
352
|
-
providerType,
|
|
353
|
-
});
|
|
354
|
-
return response;
|
|
355
|
-
}
|
|
356
|
-
catch (e) {
|
|
357
|
-
logger.error(e);
|
|
358
|
-
const data = yield e.json();
|
|
359
|
-
if (data.code === 'social_account_already_exists') {
|
|
360
|
-
throw new SocialAccountAlreadyExistsError();
|
|
361
|
-
}
|
|
362
|
-
return undefined;
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
const unlinkOAuth = ({ environmentId, primaryWalletId, verifiedCrentialId, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
366
|
-
try {
|
|
367
|
-
const response = yield sdkApi(userJwt).verifyUnlink({
|
|
368
|
-
environmentId,
|
|
369
|
-
verifyUnlinkRequest: {
|
|
370
|
-
primaryWalletId,
|
|
371
|
-
verifiedCrentialId,
|
|
372
|
-
},
|
|
373
|
-
});
|
|
374
|
-
return response;
|
|
375
|
-
}
|
|
376
|
-
catch (e) {
|
|
377
|
-
return undefined;
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
const signInOAuth = (environmentId, providerType, { code, codeVerifier, state, captchaToken }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
381
|
-
var _b;
|
|
382
|
-
const oauthRequest = {
|
|
383
|
-
captchaToken,
|
|
384
|
-
code,
|
|
385
|
-
codeVerifier,
|
|
386
|
-
state,
|
|
387
|
-
};
|
|
388
|
-
try {
|
|
389
|
-
const response = yield sdkApi().oauthSignIn({
|
|
390
|
-
environmentId,
|
|
391
|
-
oauthRequest,
|
|
392
|
-
providerType,
|
|
393
|
-
});
|
|
394
|
-
return response;
|
|
395
|
-
}
|
|
396
|
-
catch (e) {
|
|
397
|
-
logger.error(e);
|
|
398
|
-
const data = yield e.json();
|
|
399
|
-
if (data.error.code === 'gate_blocked') {
|
|
400
|
-
throw new GateBlockedError(data.payload.walletPublicKey);
|
|
401
|
-
}
|
|
402
|
-
if (data.error.code === 'missing_from_list') {
|
|
403
|
-
throw new NoAccessError({
|
|
404
|
-
walletPublicKey: (_b = data === null || data === void 0 ? void 0 : data.payload) === null || _b === void 0 ? void 0 : _b.walletPublicKey,
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
if (data.code === 'email_associated_with_different_provider') {
|
|
408
|
-
throw new AccountExistsError(data.error, data.payload);
|
|
409
|
-
}
|
|
410
|
-
return undefined;
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
const getOAuthResult = (environmentId, providerType, { state }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
414
|
-
const oauthResultRequest = {
|
|
415
|
-
state,
|
|
416
|
-
};
|
|
417
|
-
try {
|
|
418
|
-
const result = yield sdkApi().oauthResult({
|
|
419
|
-
environmentId,
|
|
420
|
-
oauthResultRequest,
|
|
421
|
-
providerType,
|
|
422
|
-
});
|
|
423
|
-
return result;
|
|
424
|
-
}
|
|
425
|
-
catch (e) {
|
|
426
|
-
logger.error(e);
|
|
427
|
-
return undefined;
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
const getOnrampProviders = ({ chain, environmentId, networkId, token, walletAddress, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
431
|
-
const { onramps } = yield sdkApi().getSupportedOnramps({
|
|
432
|
-
chain,
|
|
433
|
-
environmentId,
|
|
434
|
-
networkId: networkId ? String(networkId) : undefined,
|
|
435
|
-
token,
|
|
436
|
-
walletAddress,
|
|
437
|
-
});
|
|
438
|
-
if (!onramps || onramps.length === 0) {
|
|
439
|
-
throw new Error('No onramps');
|
|
440
|
-
}
|
|
441
|
-
return onramps;
|
|
442
|
-
});
|
|
443
|
-
const sendDynamicProps = (environmentId, settingsToSend) => __awaiter(void 0, void 0, void 0, function* () {
|
|
444
|
-
try {
|
|
445
|
-
const { dynamicContextProps, dynamicWagmiSettings, frameworkSettings } = settingsToSend;
|
|
446
|
-
if (dynamicContextProps) {
|
|
447
|
-
yield sendDynamicContextSettings(environmentId, { dynamicContextProps, frameworkSettings }, isDynamicContextSessionSettingExpired, setDynamicContextSessionSettings);
|
|
448
|
-
}
|
|
449
|
-
if (dynamicWagmiSettings) {
|
|
450
|
-
yield sendDynamicContextSettings(environmentId, { dynamicWagmiSettings }, isWagmiSessionSettingExpired, setWagmiSessionSettings);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
catch (error) {
|
|
454
|
-
logger.warn('Error caught when sending sdkSettings to api. Please notify Dynamic, and send the DynamicContextProvider settings you currently have configured', { error });
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
const sendDynamicContextSettings = (environmentId, sdkSettingsRequest, isSdkSettingExpired, setSDKSessionSettings) => __awaiter(void 0, void 0, void 0, function* () {
|
|
458
|
-
// sent once. no need to send again
|
|
459
|
-
if (!isSdkSettingExpired()) {
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
yield sdkApi().logDynamicSdkSettings({ environmentId, sdkSettingsRequest });
|
|
463
|
-
setSDKSessionSettings();
|
|
464
|
-
});
|
|
465
|
-
const mergeUserAccounts = (userJwt, environmentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
466
|
-
try {
|
|
467
|
-
const response = yield sdkApi(userJwt).mergeUsers({
|
|
468
|
-
environmentId,
|
|
469
|
-
});
|
|
470
|
-
return response;
|
|
471
|
-
}
|
|
472
|
-
catch (e) {
|
|
473
|
-
logger.error(e);
|
|
474
|
-
throw e;
|
|
475
|
-
}
|
|
476
|
-
});
|
|
477
|
-
const createTurnkeyEmbeddedWallet = ({ attestation, challenge, environmentId, userJwt, chains = [ChainEnum.Evm], passkeyAlias, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
478
|
-
const embeddedWallets = [
|
|
479
|
-
{
|
|
480
|
-
chains,
|
|
481
|
-
embeddedWalletProvider: EmbeddedWalletProviderEnum.Turnkeyhd,
|
|
482
|
-
isAuthenticatorAttached: false,
|
|
483
|
-
passkeyAlias,
|
|
484
|
-
},
|
|
485
|
-
];
|
|
486
|
-
if (attestation && challenge) {
|
|
487
|
-
embeddedWallets[0] = Object.assign(Object.assign({}, embeddedWallets[0]), { embeddedWalletSpecificOpts: {
|
|
488
|
-
attestation,
|
|
489
|
-
challenge,
|
|
490
|
-
}, isAuthenticatorAttached: true });
|
|
491
|
-
}
|
|
492
|
-
return sdkApi(userJwt).createEmbeddedWallets({
|
|
493
|
-
createEmbeddedWalletsRequest: {
|
|
494
|
-
embeddedWallets,
|
|
495
|
-
},
|
|
496
|
-
environmentId,
|
|
497
|
-
});
|
|
498
|
-
});
|
|
499
|
-
const initEmbeddedWalletSession = ({ authenticatorType, walletId, publicKey, environmentId, userJwt, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
500
|
-
if (authenticatorType === 'passkey') {
|
|
501
|
-
return sdkApi(userJwt).initPasskeyRecovery({
|
|
502
|
-
environmentId,
|
|
503
|
-
initPasskeyRecoveryRequest: {
|
|
504
|
-
turnkeyRecoveryTargetPublicKey: publicKey,
|
|
505
|
-
walletId,
|
|
506
|
-
},
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
return sdkApi(userJwt).initEmailAuth({
|
|
510
|
-
environmentId,
|
|
511
|
-
initEmailAuthRequest: {
|
|
512
|
-
turnkeyEmailAuthTargetPublicKey: publicKey,
|
|
513
|
-
walletId,
|
|
514
|
-
},
|
|
515
|
-
});
|
|
516
|
-
});
|
|
517
|
-
const completePasskeyRecovery = ({ walletId, attestation, challenge, environmentId, userJwt, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
518
|
-
return sdkApi(userJwt).completePasskeyRecovery({
|
|
519
|
-
completePasskeyRecoveryRequest: {
|
|
520
|
-
attestation,
|
|
521
|
-
challenge,
|
|
522
|
-
walletId,
|
|
523
|
-
},
|
|
524
|
-
environmentId,
|
|
525
|
-
});
|
|
526
|
-
});
|
|
527
|
-
const updatePasskeyRecoveryEmail = ({ userJwt, environmentId, updateRecoveryEmailRequest, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
528
|
-
try {
|
|
529
|
-
yield sdkApi(userJwt).updateEmbeddedWalletRecoveryEmail({
|
|
530
|
-
environmentId,
|
|
531
|
-
updateRecoveryEmailRequest,
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
catch (e) {
|
|
535
|
-
logger.error('Error while trying to update recovery email: ', e);
|
|
536
|
-
throw new DynamicError('Error updating recovery email');
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
|
-
const getUserPasskeys = ({ userJwt, environmentId, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
540
|
-
try {
|
|
541
|
-
const data = yield sdkApi(userJwt).getUserPasskeys({
|
|
542
|
-
environmentId,
|
|
543
|
-
});
|
|
544
|
-
return data;
|
|
545
|
-
}
|
|
546
|
-
catch (e) {
|
|
547
|
-
logger.error(e);
|
|
548
|
-
return {
|
|
549
|
-
count: 0,
|
|
550
|
-
passkeys: [],
|
|
551
|
-
};
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
const updateUserPasskey = ({ userJwt, environmentId, id, alias, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
555
|
-
try {
|
|
556
|
-
const data = yield sdkApi(userJwt).updatePasskey({
|
|
557
|
-
environmentId,
|
|
558
|
-
updateUserPasskeyRequest: { alias, id },
|
|
559
|
-
});
|
|
560
|
-
return data;
|
|
561
|
-
}
|
|
562
|
-
catch (e) {
|
|
563
|
-
logger.error(e);
|
|
564
|
-
return undefined;
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
|
-
const exportEmbeddedWallet = ({ userJwt, environmentId, walletId, activityId, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
568
|
-
try {
|
|
569
|
-
const data = yield sdkApi(userJwt).embeddedWalletExport({
|
|
570
|
-
activityId,
|
|
571
|
-
environmentId,
|
|
572
|
-
walletId,
|
|
573
|
-
});
|
|
574
|
-
return data;
|
|
575
|
-
}
|
|
576
|
-
catch (e) {
|
|
577
|
-
logger.error(e);
|
|
578
|
-
return { exportBundle: '' };
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
const getWalletAuthToken = ({ environmentId, type, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
582
|
-
try {
|
|
583
|
-
const authToken = yield sdkApi(userJwt).getAuthToken({
|
|
584
|
-
environmentId,
|
|
585
|
-
type,
|
|
586
|
-
});
|
|
587
|
-
return authToken.token;
|
|
588
|
-
}
|
|
589
|
-
catch (e) {
|
|
590
|
-
return undefined;
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
const getEmbeddedWalletBackup = ({ environmentId, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
594
|
-
try {
|
|
595
|
-
const response = yield sdkApi(userJwt).getEmbeddedWalletBackups({
|
|
596
|
-
environmentId,
|
|
597
|
-
});
|
|
598
|
-
return response.secret;
|
|
599
|
-
}
|
|
600
|
-
catch (e) {
|
|
601
|
-
return undefined;
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
const getEmbeddedWalletPasscode = ({ environmentId, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
605
|
-
try {
|
|
606
|
-
const response = yield sdkApi(userJwt).getEmbeddedWalletPasscode({
|
|
607
|
-
environmentId,
|
|
608
|
-
});
|
|
609
|
-
return response.secret;
|
|
610
|
-
}
|
|
611
|
-
catch (e) {
|
|
612
|
-
return undefined;
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
const claimEmbeddedWallet = ({ environmentId, walletId, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
616
|
-
try {
|
|
617
|
-
const response = yield sdkApi(userJwt).claimEmbeddedWallet({
|
|
618
|
-
embeddedWalletPasscodeClaimRequest: {
|
|
619
|
-
walletId,
|
|
620
|
-
},
|
|
621
|
-
environmentId,
|
|
622
|
-
});
|
|
623
|
-
return response;
|
|
624
|
-
}
|
|
625
|
-
catch (e) {
|
|
626
|
-
return handleVerifyResponseError(e);
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
const refreshUserJwt = ({ environmentId, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
630
|
-
try {
|
|
631
|
-
const { jwt, minifiedJwt } = yield sdkApi(userJwt).refreshAuth({
|
|
632
|
-
environmentId,
|
|
633
|
-
});
|
|
634
|
-
return { jwt, minifiedJwt };
|
|
635
|
-
}
|
|
636
|
-
catch (e) {
|
|
637
|
-
return undefined;
|
|
638
|
-
}
|
|
639
|
-
});
|
|
640
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
641
|
-
const handleVerifyResponseError = (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
642
|
-
var _c, _d;
|
|
643
|
-
logger.error(e);
|
|
644
|
-
// request failed, return unknown error
|
|
645
|
-
const data = yield ((_c = e === null || e === void 0 ? void 0 : e.json) === null || _c === void 0 ? void 0 : _c.call(e));
|
|
646
|
-
if (!((_d = data === null || data === void 0 ? void 0 : data.error) === null || _d === void 0 ? void 0 : _d.code)) {
|
|
647
|
-
return { code: 'unknown_error' };
|
|
648
|
-
}
|
|
649
|
-
throw e;
|
|
650
|
-
});
|
|
651
|
-
// ==================================================
|
|
652
|
-
// SMS VERIFICATION
|
|
653
|
-
// ==================================================
|
|
654
|
-
const createSmsVerification = ({ isoCountryCode, phoneNumber, phoneCountryCode, environmentId, captchaToken, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
655
|
-
try {
|
|
656
|
-
return yield sdkApi().createSmsVerification({
|
|
657
|
-
environmentId,
|
|
658
|
-
smsVerificationCreateRequest: {
|
|
659
|
-
captchaToken,
|
|
660
|
-
isoCountryCode,
|
|
661
|
-
phoneCountryCode,
|
|
662
|
-
phoneNumber,
|
|
663
|
-
},
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
|
-
catch (e) {
|
|
667
|
-
const data = yield e.json();
|
|
668
|
-
logger.error(data.error);
|
|
669
|
-
throw new SmsVerificationError(data.error, data.code);
|
|
670
|
-
}
|
|
671
|
-
});
|
|
672
|
-
const signInWithSmsVerification = ({ verificationToken, verificationUUID, environmentId, captchaToken, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
673
|
-
var _e;
|
|
674
|
-
try {
|
|
675
|
-
return yield sdkApi().signInWithSmsVerification({
|
|
676
|
-
environmentId,
|
|
677
|
-
smsVerificationVerifyRequest: {
|
|
678
|
-
captchaToken,
|
|
679
|
-
verificationToken,
|
|
680
|
-
verificationUUID,
|
|
681
|
-
},
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
catch (e) {
|
|
685
|
-
const data = yield e.json();
|
|
686
|
-
logger.error(data.error);
|
|
687
|
-
if (((_e = data.error) === null || _e === void 0 ? void 0 : _e.code) === 'missing_from_list') {
|
|
688
|
-
throw new NoAccessError({ phoneNumber: data.payload.phoneNumber });
|
|
689
|
-
}
|
|
690
|
-
if (data.code === 'wrong_sms_verification_token') {
|
|
691
|
-
throw new SmsVerificationError(Locale.getInstance().t('dyn_login.helper.phone_number_form.invalid_sms_verification'), data.code);
|
|
692
|
-
}
|
|
693
|
-
throw new SmsVerificationError(data.error, data.code);
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
const retrySmsVerification = ({ isoCountryCode, phoneCountryCode, phoneNumber, environmentId, verificationUUID, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
697
|
-
try {
|
|
698
|
-
return yield sdkApi().retrySmsVerification({
|
|
699
|
-
environmentId,
|
|
700
|
-
smsVerificationRetryRequest: {
|
|
701
|
-
isoCountryCode,
|
|
702
|
-
phoneCountryCode,
|
|
703
|
-
phoneNumber,
|
|
704
|
-
verificationUUID,
|
|
705
|
-
},
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
catch (e) {
|
|
709
|
-
const data = yield e.json();
|
|
710
|
-
logger.error(data.error);
|
|
711
|
-
throw new SmsVerificationError(data.error, data.code);
|
|
712
|
-
}
|
|
713
|
-
});
|
|
714
|
-
const verifySms = ({ verificationToken, verificationUUID, environmentId, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
715
|
-
try {
|
|
716
|
-
return yield sdkApi(userJwt).verifySmsVerification({
|
|
717
|
-
environmentId,
|
|
718
|
-
smsVerificationVerifyRequest: {
|
|
719
|
-
verificationToken,
|
|
720
|
-
verificationUUID,
|
|
721
|
-
},
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
catch (e) {
|
|
725
|
-
const data = yield e.json();
|
|
726
|
-
logger.error(data.error);
|
|
727
|
-
throw new SmsVerificationError(data.error, data.code);
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
const farcasterSignIn = (environmentId, farcasterSignInRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
731
|
-
try {
|
|
732
|
-
const response = yield sdkApi().farcasterSignIn({
|
|
733
|
-
environmentId,
|
|
734
|
-
farcasterSignInRequest,
|
|
735
|
-
});
|
|
736
|
-
return response;
|
|
737
|
-
}
|
|
738
|
-
catch (e) {
|
|
739
|
-
logger.error(e);
|
|
740
|
-
const data = yield e.json();
|
|
741
|
-
if (data.error.code === 'gate_blocked') {
|
|
742
|
-
throw new GateBlockedError(data.payload.walletPublicKey);
|
|
743
|
-
}
|
|
744
|
-
if (data.error.code === 'missing_from_list') {
|
|
745
|
-
throw new NoAccessError({
|
|
746
|
-
walletPublicKey: data.payload.walletPublicKey,
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
return undefined;
|
|
750
|
-
}
|
|
751
|
-
});
|
|
752
|
-
|
|
753
|
-
export { claimEmbeddedWallet, completePasskeyRecovery, createEmailVerification, createSmsVerification, createTurnkeyEmbeddedWallet, createVisit, exportEmbeddedWallet, farcasterSignIn, fetchNonce, fetchProjectSettings, getEmailProvider, getEmbeddedWalletBackup, getEmbeddedWalletPasscode, getOAuthResult, getOnrampProviders, getUserPasskeys, getWalletAuthToken, initEmbeddedWalletSession, linkWallet, mapAuthModeTypeToEnum, mapChainToChainEnum, mapProviderToProviderEnum, mergeUserAccounts, refreshUserJwt, retryEmailVerification, retrySmsVerification, revokeSession, sendDynamicProps, signInOAuth, signInWithEmailVerification, signInWithSmsVerification, transferWallet, unlinkOAuth, unlinkWallet, updatePasskeyRecoveryEmail, updateUserPasskey, updateUserProfileFields, verifyEmail, verifyOAuth, verifySms, verifyWallet };
|