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