@dynamic-labs/sdk-react-core 3.9.4 → 3.9.6
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 +15 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/TransactionCard/TransactionCard.cjs +3 -2
- package/src/lib/components/TransactionCard/TransactionCard.d.ts +1 -0
- package/src/lib/components/TransactionCard/TransactionCard.js +3 -2
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +2 -2
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.d.ts +1 -0
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +2 -2
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.cjs +7 -7
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.js +7 -7
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.cjs +5 -5
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.js +5 -5
- package/src/lib/context/ConnectWithOtpContext/utils/findEmailProvider.cjs +4 -4
- package/src/lib/context/ConnectWithOtpContext/utils/findEmailProvider.js +4 -4
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +6 -6
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +6 -6
- package/src/lib/context/FundingContext/FundingContext.cjs +5 -5
- package/src/lib/context/FundingContext/FundingContext.js +5 -5
- package/src/lib/data/api/email/email.cjs +17 -32
- package/src/lib/data/api/email/email.js +6 -21
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +21 -32
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +17 -28
- package/src/lib/data/api/externalAuth/externalAuth.cjs +10 -23
- package/src/lib/data/api/externalAuth/externalAuth.js +3 -16
- package/src/lib/data/api/mfa/mfa.cjs +15 -33
- package/src/lib/data/api/mfa/mfa.js +11 -29
- package/src/lib/data/api/oauth/oauth.cjs +11 -12
- package/src/lib/data/api/oauth/oauth.js +4 -5
- package/src/lib/data/api/session/session.cjs +7 -19
- package/src/lib/data/api/session/session.js +3 -15
- package/src/lib/data/api/sms/sms.cjs +14 -16
- package/src/lib/data/api/sms/sms.js +5 -7
- package/src/lib/data/api/user/user.cjs +13 -11
- package/src/lib/data/api/user/user.js +6 -4
- package/src/lib/data/api/utils.cjs +24 -0
- package/src/lib/data/api/utils.d.ts +1 -0
- package/src/lib/data/api/utils.js +24 -1
- package/src/lib/data/api/wallets/wallets.cjs +17 -28
- package/src/lib/data/api/wallets/wallets.js +6 -17
- package/src/lib/locale/en/translation.cjs +2 -1
- package/src/lib/locale/en/translation.d.ts +1 -0
- package/src/lib/locale/en/translation.js +2 -1
- package/src/lib/store/state/projectSettings/projectSettings.cjs +5 -5
- package/src/lib/store/state/projectSettings/projectSettings.js +5 -5
- package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.cjs +5 -5
- package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.js +5 -5
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +6 -6
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +6 -6
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +5 -5
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +5 -5
- package/src/lib/utils/hooks/useExternalAuth/useExternalAuth.cjs +5 -5
- package/src/lib/utils/hooks/useExternalAuth/useExternalAuth.js +5 -5
- package/src/lib/utils/hooks/useFetchNonce/useFetchNonce.cjs +7 -7
- package/src/lib/utils/hooks/useFetchNonce/useFetchNonce.js +7 -7
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +3 -3
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +3 -3
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.cjs +5 -5
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.js +5 -5
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.cjs +2 -0
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.js +2 -0
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +6 -6
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +6 -6
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.cjs +6 -6
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.js +6 -6
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +8 -8
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +8 -8
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +5 -3
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +5 -3
|
@@ -2,18 +2,8 @@
|
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { NoAccessError, AccountExistsError, SandboxMaximumThresholdReachedError, EmailVerificationError, UserHasAccountWithEmailError, EmailProviderError } from '@dynamic-labs/utils';
|
|
4
4
|
import { UnprocessableEntityErrorCode } from '@dynamic-labs/sdk-api-core';
|
|
5
|
-
import { logger } from '../../../shared/logger.js';
|
|
6
|
-
import '@dynamic-labs/iconic';
|
|
7
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
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 '../../../store/state/loadingAndLifecycle.js';
|
|
15
|
-
import '../../../shared/consts/index.js';
|
|
16
5
|
import { sdkApi } from '../api.js';
|
|
6
|
+
import { logResponseError } from '../utils.js';
|
|
17
7
|
|
|
18
8
|
const getEmailProvider = (_a) => __awaiter(void 0, [_a], void 0, function* ({ email, environmentId, }) {
|
|
19
9
|
try {
|
|
@@ -24,8 +14,7 @@ const getEmailProvider = (_a) => __awaiter(void 0, [_a], void 0, function* ({ em
|
|
|
24
14
|
return res;
|
|
25
15
|
}
|
|
26
16
|
catch (e) {
|
|
27
|
-
const data = yield e
|
|
28
|
-
logger.error(data.error);
|
|
17
|
+
const data = yield logResponseError(e, 'Error getting email provider');
|
|
29
18
|
throw new EmailProviderError(data.code);
|
|
30
19
|
}
|
|
31
20
|
});
|
|
@@ -41,8 +30,7 @@ const createEmailVerification = (_b) => __awaiter(void 0, [_b], void 0, function
|
|
|
41
30
|
return res;
|
|
42
31
|
}
|
|
43
32
|
catch (e) {
|
|
44
|
-
const data = yield e
|
|
45
|
-
logger.error(data.error);
|
|
33
|
+
const data = yield logResponseError(e, 'Error creating email verification');
|
|
46
34
|
throw new EmailVerificationError(data.code);
|
|
47
35
|
}
|
|
48
36
|
});
|
|
@@ -60,8 +48,7 @@ const signInWithEmailVerification = (_c) => __awaiter(void 0, [_c], void 0, func
|
|
|
60
48
|
return res;
|
|
61
49
|
}
|
|
62
50
|
catch (e) {
|
|
63
|
-
const data = yield e
|
|
64
|
-
logger.error(data.error);
|
|
51
|
+
const data = yield logResponseError(e, 'Error email signin');
|
|
65
52
|
if (data.error.code === 'missing_from_list') {
|
|
66
53
|
throw new NoAccessError({ email: data.payload.email });
|
|
67
54
|
}
|
|
@@ -86,8 +73,7 @@ const retryEmailVerification = (_d) => __awaiter(void 0, [_d], void 0, function*
|
|
|
86
73
|
return res;
|
|
87
74
|
}
|
|
88
75
|
catch (e) {
|
|
89
|
-
const data = yield e
|
|
90
|
-
logger.error(data.error);
|
|
76
|
+
const data = yield logResponseError(e, 'Error retrying email verification');
|
|
91
77
|
throw new EmailVerificationError(data.code);
|
|
92
78
|
}
|
|
93
79
|
});
|
|
@@ -103,8 +89,7 @@ const verifyEmail = (_e) => __awaiter(void 0, [_e], void 0, function* ({ verific
|
|
|
103
89
|
return res;
|
|
104
90
|
}
|
|
105
91
|
catch (e) {
|
|
106
|
-
const data = yield e
|
|
107
|
-
logger.error(data.error);
|
|
92
|
+
const data = yield logResponseError(e, 'Error linking email');
|
|
108
93
|
if (data.code === UnprocessableEntityErrorCode.UserHasAlreadyAccountWithEmail) {
|
|
109
94
|
throw new UserHasAccountWithEmailError(data.error);
|
|
110
95
|
}
|
|
@@ -5,21 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
8
|
-
var utils = require('@dynamic-labs/utils');
|
|
9
|
-
var logger = require('../../../shared/logger.cjs');
|
|
10
|
-
require('@dynamic-labs/iconic');
|
|
11
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
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('../../../store/state/loadingAndLifecycle.cjs');
|
|
19
|
-
require('../../../shared/consts/index.cjs');
|
|
8
|
+
var utils$1 = require('@dynamic-labs/utils');
|
|
20
9
|
var storeAuthTokenAndUser = require('../../../store/state/user/storeAuthTokenAndUser/storeAuthTokenAndUser.cjs');
|
|
21
10
|
require('../../../store/state/user/user.cjs');
|
|
22
11
|
var api = require('../api.cjs');
|
|
12
|
+
var utils = require('../utils.cjs');
|
|
23
13
|
|
|
24
14
|
const createTurnkeyEmbeddedWallet = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ attestation, challenge, environmentId, chains = [sdkApiCore.EmbeddedWalletChainEnum.Evm], passkeyAlias, }) {
|
|
25
15
|
const embeddedWallets = [
|
|
@@ -47,7 +37,7 @@ const createTurnkeyEmbeddedWallet = (_a) => _tslib.__awaiter(void 0, [_a], void
|
|
|
47
37
|
return user;
|
|
48
38
|
}
|
|
49
39
|
catch (e) {
|
|
50
|
-
|
|
40
|
+
yield utils.logResponseError(e, 'Error creating embedded wallet');
|
|
51
41
|
return undefined;
|
|
52
42
|
}
|
|
53
43
|
});
|
|
@@ -82,7 +72,7 @@ const completePasskeyRecovery = (_c) => _tslib.__awaiter(void 0, [_c], void 0, f
|
|
|
82
72
|
return storeAuthTokenAndUser.storeAuthTokenAndUser(response);
|
|
83
73
|
}
|
|
84
74
|
catch (e) {
|
|
85
|
-
|
|
75
|
+
yield utils.logResponseError(e, 'Error completing passkey recovery');
|
|
86
76
|
return undefined;
|
|
87
77
|
}
|
|
88
78
|
});
|
|
@@ -94,8 +84,8 @@ const updatePasskeyRecoveryEmail = (_d) => _tslib.__awaiter(void 0, [_d], void 0
|
|
|
94
84
|
});
|
|
95
85
|
}
|
|
96
86
|
catch (e) {
|
|
97
|
-
|
|
98
|
-
throw new utils.DynamicError('Error updating recovery email');
|
|
87
|
+
yield utils.logResponseError(e, 'Error while trying to update recovery email');
|
|
88
|
+
throw new utils$1.DynamicError('Error updating recovery email');
|
|
99
89
|
}
|
|
100
90
|
});
|
|
101
91
|
const getUserPasskeys = (_e) => _tslib.__awaiter(void 0, [_e], void 0, function* ({ environmentId, }) {
|
|
@@ -106,7 +96,7 @@ const getUserPasskeys = (_e) => _tslib.__awaiter(void 0, [_e], void 0, function*
|
|
|
106
96
|
return data;
|
|
107
97
|
}
|
|
108
98
|
catch (e) {
|
|
109
|
-
|
|
99
|
+
yield utils.logResponseError(e, 'Error getting user passkeys');
|
|
110
100
|
return {
|
|
111
101
|
count: 0,
|
|
112
102
|
passkeys: [],
|
|
@@ -122,7 +112,7 @@ const updateUserPasskey = (_f) => _tslib.__awaiter(void 0, [_f], void 0, functio
|
|
|
122
112
|
return data;
|
|
123
113
|
}
|
|
124
114
|
catch (e) {
|
|
125
|
-
|
|
115
|
+
yield utils.logResponseError(e, 'Error updating user passkeys');
|
|
126
116
|
return undefined;
|
|
127
117
|
}
|
|
128
118
|
});
|
|
@@ -136,7 +126,7 @@ const exportEmbeddedWallet = (_g) => _tslib.__awaiter(void 0, [_g], void 0, func
|
|
|
136
126
|
return data;
|
|
137
127
|
}
|
|
138
128
|
catch (e) {
|
|
139
|
-
|
|
129
|
+
yield utils.logResponseError(e, 'Error exporting embedded wallet');
|
|
140
130
|
return { exportBundle: '' };
|
|
141
131
|
}
|
|
142
132
|
});
|
|
@@ -149,6 +139,7 @@ const getWalletAuthToken = (_h) => _tslib.__awaiter(void 0, [_h], void 0, functi
|
|
|
149
139
|
return authToken.token;
|
|
150
140
|
}
|
|
151
141
|
catch (e) {
|
|
142
|
+
yield utils.logResponseError(e, 'Error getting wallet auth token');
|
|
152
143
|
return undefined;
|
|
153
144
|
}
|
|
154
145
|
});
|
|
@@ -175,7 +166,7 @@ const getEmbeddedWalletPasscode = (_k) => _tslib.__awaiter(void 0, [_k], void 0,
|
|
|
175
166
|
}
|
|
176
167
|
});
|
|
177
168
|
const claimEmbeddedWallet = (_l) => _tslib.__awaiter(void 0, [_l], void 0, function* ({ environmentId, walletId, }) {
|
|
178
|
-
var _m
|
|
169
|
+
var _m;
|
|
179
170
|
try {
|
|
180
171
|
const response = yield api.sdkApi().claimEmbeddedWallet({
|
|
181
172
|
embeddedWalletPasscodeClaimRequest: {
|
|
@@ -187,16 +178,14 @@ const claimEmbeddedWallet = (_l) => _tslib.__awaiter(void 0, [_l], void 0, funct
|
|
|
187
178
|
return response;
|
|
188
179
|
}
|
|
189
180
|
catch (e) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const data = yield ((_m = e === null || e === void 0 ? void 0 : e.json) === null || _m === void 0 ? void 0 : _m.call(e));
|
|
193
|
-
if (!((_o = data === null || data === void 0 ? void 0 : data.error) === null || _o === void 0 ? void 0 : _o.code)) {
|
|
181
|
+
const data = yield utils.logResponseError(e, 'Error claiming embedded wallet');
|
|
182
|
+
if (!((_m = data === null || data === void 0 ? void 0 : data.error) === null || _m === void 0 ? void 0 : _m.code)) {
|
|
194
183
|
return { code: 'unknown_error' };
|
|
195
184
|
}
|
|
196
185
|
throw e;
|
|
197
186
|
}
|
|
198
187
|
});
|
|
199
|
-
const registerSessionKey = (
|
|
188
|
+
const registerSessionKey = (_o) => _tslib.__awaiter(void 0, [_o], void 0, function* ({ environmentId, publicKey, }) {
|
|
200
189
|
try {
|
|
201
190
|
yield api.sdkApi().registerSessionKey({
|
|
202
191
|
environmentId,
|
|
@@ -205,11 +194,11 @@ const registerSessionKey = (_p) => _tslib.__awaiter(void 0, [_p], void 0, functi
|
|
|
205
194
|
return publicKey;
|
|
206
195
|
}
|
|
207
196
|
catch (e) {
|
|
208
|
-
|
|
197
|
+
yield utils.logResponseError(e, 'Error register session key');
|
|
209
198
|
return undefined;
|
|
210
199
|
}
|
|
211
200
|
});
|
|
212
|
-
const getCreateEmbeddedWalletAccountRequest = (
|
|
201
|
+
const getCreateEmbeddedWalletAccountRequest = (_p) => _tslib.__awaiter(void 0, [_p], void 0, function* ({ environmentId, chain, }) {
|
|
213
202
|
try {
|
|
214
203
|
const response = yield api.sdkApi().getCreateWalletAccountRequest({
|
|
215
204
|
chain,
|
|
@@ -218,11 +207,11 @@ const getCreateEmbeddedWalletAccountRequest = (_q) => _tslib.__awaiter(void 0, [
|
|
|
218
207
|
return response;
|
|
219
208
|
}
|
|
220
209
|
catch (e) {
|
|
221
|
-
|
|
222
|
-
throw new utils.DynamicError('Error fetching create embedded wallet account request');
|
|
210
|
+
yield utils.logResponseError(e, 'Error fetching create embedded wallet account request');
|
|
211
|
+
throw new utils$1.DynamicError('Error fetching create embedded wallet account request');
|
|
223
212
|
}
|
|
224
213
|
});
|
|
225
|
-
const createEmbeddedWalletAccount = (
|
|
214
|
+
const createEmbeddedWalletAccount = (_q) => _tslib.__awaiter(void 0, [_q], void 0, function* ({ environmentId, createEmbeddedWalletAccountRequest, }) {
|
|
226
215
|
try {
|
|
227
216
|
const response = yield api.sdkApi().createWalletAccount({
|
|
228
217
|
createWalletAccountRequest: {
|
|
@@ -233,8 +222,8 @@ const createEmbeddedWalletAccount = (_r) => _tslib.__awaiter(void 0, [_r], void
|
|
|
233
222
|
return response;
|
|
234
223
|
}
|
|
235
224
|
catch (e) {
|
|
236
|
-
|
|
237
|
-
throw new utils.DynamicError('Error creating embedded wallet account');
|
|
225
|
+
yield utils.logResponseError(e, 'Error creating embedded wallet account');
|
|
226
|
+
throw new utils$1.DynamicError('Error creating embedded wallet account');
|
|
238
227
|
}
|
|
239
228
|
});
|
|
240
229
|
|
|
@@ -2,20 +2,10 @@
|
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { EmbeddedWalletProviderEnum, EmbeddedWalletChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
4
4
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
5
|
-
import { logger } from '../../../shared/logger.js';
|
|
6
|
-
import '@dynamic-labs/iconic';
|
|
7
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
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 '../../../store/state/loadingAndLifecycle.js';
|
|
15
|
-
import '../../../shared/consts/index.js';
|
|
16
5
|
import { storeAuthTokenAndUser } from '../../../store/state/user/storeAuthTokenAndUser/storeAuthTokenAndUser.js';
|
|
17
6
|
import '../../../store/state/user/user.js';
|
|
18
7
|
import { sdkApi } from '../api.js';
|
|
8
|
+
import { logResponseError } from '../utils.js';
|
|
19
9
|
|
|
20
10
|
const createTurnkeyEmbeddedWallet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ attestation, challenge, environmentId, chains = [EmbeddedWalletChainEnum.Evm], passkeyAlias, }) {
|
|
21
11
|
const embeddedWallets = [
|
|
@@ -43,7 +33,7 @@ const createTurnkeyEmbeddedWallet = (_a) => __awaiter(void 0, [_a], void 0, func
|
|
|
43
33
|
return user;
|
|
44
34
|
}
|
|
45
35
|
catch (e) {
|
|
46
|
-
|
|
36
|
+
yield logResponseError(e, 'Error creating embedded wallet');
|
|
47
37
|
return undefined;
|
|
48
38
|
}
|
|
49
39
|
});
|
|
@@ -78,7 +68,7 @@ const completePasskeyRecovery = (_c) => __awaiter(void 0, [_c], void 0, function
|
|
|
78
68
|
return storeAuthTokenAndUser(response);
|
|
79
69
|
}
|
|
80
70
|
catch (e) {
|
|
81
|
-
|
|
71
|
+
yield logResponseError(e, 'Error completing passkey recovery');
|
|
82
72
|
return undefined;
|
|
83
73
|
}
|
|
84
74
|
});
|
|
@@ -90,7 +80,7 @@ const updatePasskeyRecoveryEmail = (_d) => __awaiter(void 0, [_d], void 0, funct
|
|
|
90
80
|
});
|
|
91
81
|
}
|
|
92
82
|
catch (e) {
|
|
93
|
-
|
|
83
|
+
yield logResponseError(e, 'Error while trying to update recovery email');
|
|
94
84
|
throw new DynamicError('Error updating recovery email');
|
|
95
85
|
}
|
|
96
86
|
});
|
|
@@ -102,7 +92,7 @@ const getUserPasskeys = (_e) => __awaiter(void 0, [_e], void 0, function* ({ env
|
|
|
102
92
|
return data;
|
|
103
93
|
}
|
|
104
94
|
catch (e) {
|
|
105
|
-
|
|
95
|
+
yield logResponseError(e, 'Error getting user passkeys');
|
|
106
96
|
return {
|
|
107
97
|
count: 0,
|
|
108
98
|
passkeys: [],
|
|
@@ -118,7 +108,7 @@ const updateUserPasskey = (_f) => __awaiter(void 0, [_f], void 0, function* ({ e
|
|
|
118
108
|
return data;
|
|
119
109
|
}
|
|
120
110
|
catch (e) {
|
|
121
|
-
|
|
111
|
+
yield logResponseError(e, 'Error updating user passkeys');
|
|
122
112
|
return undefined;
|
|
123
113
|
}
|
|
124
114
|
});
|
|
@@ -132,7 +122,7 @@ const exportEmbeddedWallet = (_g) => __awaiter(void 0, [_g], void 0, function* (
|
|
|
132
122
|
return data;
|
|
133
123
|
}
|
|
134
124
|
catch (e) {
|
|
135
|
-
|
|
125
|
+
yield logResponseError(e, 'Error exporting embedded wallet');
|
|
136
126
|
return { exportBundle: '' };
|
|
137
127
|
}
|
|
138
128
|
});
|
|
@@ -145,6 +135,7 @@ const getWalletAuthToken = (_h) => __awaiter(void 0, [_h], void 0, function* ({
|
|
|
145
135
|
return authToken.token;
|
|
146
136
|
}
|
|
147
137
|
catch (e) {
|
|
138
|
+
yield logResponseError(e, 'Error getting wallet auth token');
|
|
148
139
|
return undefined;
|
|
149
140
|
}
|
|
150
141
|
});
|
|
@@ -171,7 +162,7 @@ const getEmbeddedWalletPasscode = (_k) => __awaiter(void 0, [_k], void 0, functi
|
|
|
171
162
|
}
|
|
172
163
|
});
|
|
173
164
|
const claimEmbeddedWallet = (_l) => __awaiter(void 0, [_l], void 0, function* ({ environmentId, walletId, }) {
|
|
174
|
-
var _m
|
|
165
|
+
var _m;
|
|
175
166
|
try {
|
|
176
167
|
const response = yield sdkApi().claimEmbeddedWallet({
|
|
177
168
|
embeddedWalletPasscodeClaimRequest: {
|
|
@@ -183,16 +174,14 @@ const claimEmbeddedWallet = (_l) => __awaiter(void 0, [_l], void 0, function* ({
|
|
|
183
174
|
return response;
|
|
184
175
|
}
|
|
185
176
|
catch (e) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const data = yield ((_m = e === null || e === void 0 ? void 0 : e.json) === null || _m === void 0 ? void 0 : _m.call(e));
|
|
189
|
-
if (!((_o = data === null || data === void 0 ? void 0 : data.error) === null || _o === void 0 ? void 0 : _o.code)) {
|
|
177
|
+
const data = yield logResponseError(e, 'Error claiming embedded wallet');
|
|
178
|
+
if (!((_m = data === null || data === void 0 ? void 0 : data.error) === null || _m === void 0 ? void 0 : _m.code)) {
|
|
190
179
|
return { code: 'unknown_error' };
|
|
191
180
|
}
|
|
192
181
|
throw e;
|
|
193
182
|
}
|
|
194
183
|
});
|
|
195
|
-
const registerSessionKey = (
|
|
184
|
+
const registerSessionKey = (_o) => __awaiter(void 0, [_o], void 0, function* ({ environmentId, publicKey, }) {
|
|
196
185
|
try {
|
|
197
186
|
yield sdkApi().registerSessionKey({
|
|
198
187
|
environmentId,
|
|
@@ -201,11 +190,11 @@ const registerSessionKey = (_p) => __awaiter(void 0, [_p], void 0, function* ({
|
|
|
201
190
|
return publicKey;
|
|
202
191
|
}
|
|
203
192
|
catch (e) {
|
|
204
|
-
|
|
193
|
+
yield logResponseError(e, 'Error register session key');
|
|
205
194
|
return undefined;
|
|
206
195
|
}
|
|
207
196
|
});
|
|
208
|
-
const getCreateEmbeddedWalletAccountRequest = (
|
|
197
|
+
const getCreateEmbeddedWalletAccountRequest = (_p) => __awaiter(void 0, [_p], void 0, function* ({ environmentId, chain, }) {
|
|
209
198
|
try {
|
|
210
199
|
const response = yield sdkApi().getCreateWalletAccountRequest({
|
|
211
200
|
chain,
|
|
@@ -214,11 +203,11 @@ const getCreateEmbeddedWalletAccountRequest = (_q) => __awaiter(void 0, [_q], vo
|
|
|
214
203
|
return response;
|
|
215
204
|
}
|
|
216
205
|
catch (e) {
|
|
217
|
-
|
|
206
|
+
yield logResponseError(e, 'Error fetching create embedded wallet account request');
|
|
218
207
|
throw new DynamicError('Error fetching create embedded wallet account request');
|
|
219
208
|
}
|
|
220
209
|
});
|
|
221
|
-
const createEmbeddedWalletAccount = (
|
|
210
|
+
const createEmbeddedWalletAccount = (_q) => __awaiter(void 0, [_q], void 0, function* ({ environmentId, createEmbeddedWalletAccountRequest, }) {
|
|
222
211
|
try {
|
|
223
212
|
const response = yield sdkApi().createWalletAccount({
|
|
224
213
|
createWalletAccountRequest: {
|
|
@@ -229,7 +218,7 @@ const createEmbeddedWalletAccount = (_r) => __awaiter(void 0, [_r], void 0, func
|
|
|
229
218
|
return response;
|
|
230
219
|
}
|
|
231
220
|
catch (e) {
|
|
232
|
-
|
|
221
|
+
yield logResponseError(e, 'Error creating embedded wallet account');
|
|
233
222
|
throw new DynamicError('Error creating embedded wallet account');
|
|
234
223
|
}
|
|
235
224
|
});
|
|
@@ -4,22 +4,11 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
-
var utils = require('@dynamic-labs/utils');
|
|
8
|
-
require('@dynamic-labs/sdk-api-core');
|
|
9
|
-
var logger = require('../../../shared/logger.cjs');
|
|
10
|
-
require('@dynamic-labs/iconic');
|
|
11
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
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('../../../store/state/loadingAndLifecycle.cjs');
|
|
19
|
-
require('../../../shared/consts/index.cjs');
|
|
7
|
+
var utils$1 = require('@dynamic-labs/utils');
|
|
20
8
|
var storeAuthTokenAndUser = require('../../../store/state/user/storeAuthTokenAndUser/storeAuthTokenAndUser.cjs');
|
|
21
9
|
require('../../../store/state/user/user.cjs');
|
|
22
10
|
var api = require('../api.cjs');
|
|
11
|
+
var utils = require('../utils.cjs');
|
|
23
12
|
|
|
24
13
|
const externalAuthSignin = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ environmentId, externalJwt, sessionPublicKey, }) {
|
|
25
14
|
try {
|
|
@@ -33,15 +22,14 @@ const externalAuthSignin = (_a) => _tslib.__awaiter(void 0, [_a], void 0, functi
|
|
|
33
22
|
return storeAuthTokenAndUser.storeAuthTokenAndUser(response);
|
|
34
23
|
}
|
|
35
24
|
catch (e) {
|
|
36
|
-
const data = yield
|
|
37
|
-
logger.logger.error('Error signing in with external JWT', data);
|
|
25
|
+
const data = yield utils.logResponseError(e, 'Error signing in with external JWT');
|
|
38
26
|
if (data.code === 'invalid_external_auth') {
|
|
39
|
-
throw new utils.ExternalAuthError(data.code);
|
|
27
|
+
throw new utils$1.ExternalAuthError(data.code);
|
|
40
28
|
}
|
|
41
29
|
if (data.error.code === 'sandbox_maximum_threshold_reached') {
|
|
42
|
-
throw new utils.SandboxMaximumThresholdReachedError(data.error.message);
|
|
30
|
+
throw new utils$1.SandboxMaximumThresholdReachedError(data.error.message);
|
|
43
31
|
}
|
|
44
|
-
throw new utils.DynamicError(data.error);
|
|
32
|
+
throw new utils$1.DynamicError(data.error);
|
|
45
33
|
}
|
|
46
34
|
});
|
|
47
35
|
const externalAuthVerify = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ environmentId, externalJwt, }) {
|
|
@@ -55,15 +43,14 @@ const externalAuthVerify = (_b) => _tslib.__awaiter(void 0, [_b], void 0, functi
|
|
|
55
43
|
return storeAuthTokenAndUser.storeAuthTokenAndUser(response);
|
|
56
44
|
}
|
|
57
45
|
catch (e) {
|
|
58
|
-
const data = yield
|
|
59
|
-
logger.logger.error('Error verifying external JWT', data);
|
|
46
|
+
const data = yield utils.logResponseError(e, 'Error verifying external JWT');
|
|
60
47
|
if (data.code === 'invalid_external_auth') {
|
|
61
|
-
throw new utils.ExternalAuthError(data.code);
|
|
48
|
+
throw new utils$1.ExternalAuthError(data.code);
|
|
62
49
|
}
|
|
63
50
|
if (data.error.code === 'sandbox_maximum_threshold_reached') {
|
|
64
|
-
throw new utils.SandboxMaximumThresholdReachedError(data.error.message);
|
|
51
|
+
throw new utils$1.SandboxMaximumThresholdReachedError(data.error.message);
|
|
65
52
|
}
|
|
66
|
-
throw new utils.DynamicError(data.error);
|
|
53
|
+
throw new utils$1.DynamicError(data.error);
|
|
67
54
|
}
|
|
68
55
|
});
|
|
69
56
|
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { ExternalAuthError, SandboxMaximumThresholdReachedError, DynamicError } from '@dynamic-labs/utils';
|
|
4
|
-
import '@dynamic-labs/sdk-api-core';
|
|
5
|
-
import { logger } from '../../../shared/logger.js';
|
|
6
|
-
import '@dynamic-labs/iconic';
|
|
7
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
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 '../../../store/state/loadingAndLifecycle.js';
|
|
15
|
-
import '../../../shared/consts/index.js';
|
|
16
4
|
import { storeAuthTokenAndUser } from '../../../store/state/user/storeAuthTokenAndUser/storeAuthTokenAndUser.js';
|
|
17
5
|
import '../../../store/state/user/user.js';
|
|
18
6
|
import { sdkApi } from '../api.js';
|
|
7
|
+
import { logResponseError } from '../utils.js';
|
|
19
8
|
|
|
20
9
|
const externalAuthSignin = (_a) => __awaiter(void 0, [_a], void 0, function* ({ environmentId, externalJwt, sessionPublicKey, }) {
|
|
21
10
|
try {
|
|
@@ -29,8 +18,7 @@ const externalAuthSignin = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
29
18
|
return storeAuthTokenAndUser(response);
|
|
30
19
|
}
|
|
31
20
|
catch (e) {
|
|
32
|
-
const data = yield e
|
|
33
|
-
logger.error('Error signing in with external JWT', data);
|
|
21
|
+
const data = yield logResponseError(e, 'Error signing in with external JWT');
|
|
34
22
|
if (data.code === 'invalid_external_auth') {
|
|
35
23
|
throw new ExternalAuthError(data.code);
|
|
36
24
|
}
|
|
@@ -51,8 +39,7 @@ const externalAuthVerify = (_b) => __awaiter(void 0, [_b], void 0, function* ({
|
|
|
51
39
|
return storeAuthTokenAndUser(response);
|
|
52
40
|
}
|
|
53
41
|
catch (e) {
|
|
54
|
-
const data = yield e
|
|
55
|
-
logger.error('Error verifying external JWT', data);
|
|
42
|
+
const data = yield logResponseError(e, 'Error verifying external JWT');
|
|
56
43
|
if (data.code === 'invalid_external_auth') {
|
|
57
44
|
throw new ExternalAuthError(data.code);
|
|
58
45
|
}
|
|
@@ -5,19 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
8
|
-
var utils = require('@dynamic-labs/utils');
|
|
9
|
-
var logger = require('../../../shared/logger.cjs');
|
|
10
|
-
require('@dynamic-labs/iconic');
|
|
11
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
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('../../../store/state/loadingAndLifecycle.cjs');
|
|
19
|
-
require('../../../shared/consts/index.cjs');
|
|
8
|
+
var utils$1 = require('@dynamic-labs/utils');
|
|
20
9
|
var api = require('../api.cjs');
|
|
10
|
+
var utils = require('../utils.cjs');
|
|
21
11
|
|
|
22
12
|
const getUserMfaDevices = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ environmentId, }) {
|
|
23
13
|
try {
|
|
@@ -27,8 +17,7 @@ const getUserMfaDevices = (_a) => _tslib.__awaiter(void 0, [_a], void 0, functio
|
|
|
27
17
|
return devices;
|
|
28
18
|
}
|
|
29
19
|
catch (e) {
|
|
30
|
-
|
|
31
|
-
logger.logger.error(data.error);
|
|
20
|
+
yield utils.logResponseError(e, 'Error getting mfa devices');
|
|
32
21
|
return [];
|
|
33
22
|
}
|
|
34
23
|
});
|
|
@@ -43,8 +32,8 @@ const addMfaDevice = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({
|
|
|
43
32
|
throw new Error('Unsupported MFA device type');
|
|
44
33
|
}
|
|
45
34
|
catch (e) {
|
|
46
|
-
const
|
|
47
|
-
|
|
35
|
+
const responseError = yield utils.logResponseError(e, 'Error adding mfa device');
|
|
36
|
+
const message = e instanceof Error ? e.message : responseError.error;
|
|
48
37
|
throw new Error(message);
|
|
49
38
|
}
|
|
50
39
|
});
|
|
@@ -56,8 +45,7 @@ const updateUserMfaDevice = (_c) => _tslib.__awaiter(void 0, [_c], void 0, funct
|
|
|
56
45
|
});
|
|
57
46
|
}
|
|
58
47
|
catch (e) {
|
|
59
|
-
|
|
60
|
-
logger.logger.error(data.error);
|
|
48
|
+
yield utils.logResponseError(e, 'Error updating mfa device');
|
|
61
49
|
}
|
|
62
50
|
});
|
|
63
51
|
const deleteMfaDevice = (_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ environmentId, mfaDeviceId, mfaAuthToken, }) {
|
|
@@ -69,8 +57,7 @@ const deleteMfaDevice = (_d) => _tslib.__awaiter(void 0, [_d], void 0, function*
|
|
|
69
57
|
});
|
|
70
58
|
}
|
|
71
59
|
catch (e) {
|
|
72
|
-
|
|
73
|
-
logger.logger.error(data.error);
|
|
60
|
+
yield utils.logResponseError(e, 'Error delete mfa device');
|
|
74
61
|
}
|
|
75
62
|
});
|
|
76
63
|
// used when verifying a device added after the user is already logged in
|
|
@@ -91,8 +78,7 @@ const verifyMfaDevice = (_e) => _tslib.__awaiter(void 0, [_e], void 0, function*
|
|
|
91
78
|
throw new Error('Unsupported MFA device type');
|
|
92
79
|
}
|
|
93
80
|
catch (e) {
|
|
94
|
-
|
|
95
|
-
logger.logger.error(message);
|
|
81
|
+
yield utils.logResponseError(e, 'Error verify mfa device');
|
|
96
82
|
return undefined;
|
|
97
83
|
}
|
|
98
84
|
});
|
|
@@ -115,14 +101,13 @@ const authMfaDevice = (_f) => _tslib.__awaiter(void 0, [_f], void 0, function* (
|
|
|
115
101
|
throw new Error('Unsupported MFA device type');
|
|
116
102
|
}
|
|
117
103
|
catch (error) {
|
|
118
|
-
|
|
104
|
+
const responseError = yield utils.logResponseError(error, 'Error auth mfa devices');
|
|
119
105
|
if (error instanceof Response) {
|
|
120
|
-
const responseError = yield error.json();
|
|
121
106
|
if (responseError.code === 'mfa_invalid_code') {
|
|
122
|
-
throw new utils.MfaInvalidOtpError();
|
|
107
|
+
throw new utils$1.MfaInvalidOtpError();
|
|
123
108
|
}
|
|
124
109
|
if (responseError.code === 'mfa_rate_limited') {
|
|
125
|
-
throw new utils.MfaRateLimitedError();
|
|
110
|
+
throw new utils$1.MfaRateLimitedError();
|
|
126
111
|
}
|
|
127
112
|
}
|
|
128
113
|
throw error;
|
|
@@ -136,8 +121,7 @@ const getRecoveryCodes = (_g) => _tslib.__awaiter(void 0, [_g], void 0, function
|
|
|
136
121
|
return recoveryCodes;
|
|
137
122
|
}
|
|
138
123
|
catch (e) {
|
|
139
|
-
|
|
140
|
-
logger.logger.error(data.error);
|
|
124
|
+
yield utils.logResponseError(e, 'Error get mfa recovery codes');
|
|
141
125
|
return [];
|
|
142
126
|
}
|
|
143
127
|
});
|
|
@@ -149,8 +133,7 @@ const createNewRecoveryCodes = (_h) => _tslib.__awaiter(void 0, [_h], void 0, fu
|
|
|
149
133
|
return recoveryCodes;
|
|
150
134
|
}
|
|
151
135
|
catch (e) {
|
|
152
|
-
|
|
153
|
-
logger.logger.error(data.error);
|
|
136
|
+
yield utils.logResponseError(e, 'Error create mfa recovery codes');
|
|
154
137
|
return [];
|
|
155
138
|
}
|
|
156
139
|
});
|
|
@@ -168,11 +151,10 @@ const authMfaRecovery = (_j) => _tslib.__awaiter(void 0, [_j], void 0, function*
|
|
|
168
151
|
return response;
|
|
169
152
|
}
|
|
170
153
|
catch (error) {
|
|
171
|
-
|
|
154
|
+
const responseError = yield utils.logResponseError(error, 'Error mfa recovery');
|
|
172
155
|
if (error instanceof Response) {
|
|
173
|
-
const responseError = yield error.json();
|
|
174
156
|
if (responseError.code === 'mfa_invalid_code') {
|
|
175
|
-
throw new utils.MfaInvalidOtpError();
|
|
157
|
+
throw new utils$1.MfaInvalidOtpError();
|
|
176
158
|
}
|
|
177
159
|
}
|
|
178
160
|
throw error;
|