@dynamic-labs/sdk-react-core 0.18.100-viem.5 → 0.18.100-viem.7
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 +19 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/components/MenuList/Dropdown/Dropdown.cjs +1 -1
- package/src/lib/components/MenuList/Dropdown/Dropdown.js +1 -1
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.cjs +6 -2
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.d.ts +2 -1
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.js +6 -2
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +2 -2
- package/src/lib/components/OTPVerificationView/OTPVerificationView.d.ts +1 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +2 -2
- package/src/lib/components/Typography/Typography.cjs +1 -0
- package/src/lib/components/Typography/Typography.js +1 -0
- package/src/lib/components/Typography/Typography.types.d.ts +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +6 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +7 -2
- package/src/lib/context/DynamicContext/internalEvents/index.d.ts +2 -0
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.cjs +14 -0
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.d.ts +8 -0
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.js +6 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +4 -1
- package/src/lib/context/DynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext.js +2 -1
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.js +1 -1
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +2 -1
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +2 -1
- package/src/lib/shared/utils/hooks/usePreventPageScroll/usePreventPageScroll.cjs +28 -2
- package/src/lib/shared/utils/hooks/usePreventPageScroll/usePreventPageScroll.js +28 -2
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/index.d.ts +1 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.cjs +48 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.d.ts +18 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.js +43 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +8 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +9 -3
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +4 -0
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +4 -0
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +6 -2
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.d.ts +2 -1
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +6 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +50 -7
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.d.ts +5 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +50 -7
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +1 -1
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +1 -1
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +4 -10
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +4 -10
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +1 -0
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.js +1 -0
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +1 -1
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +1 -1
|
@@ -20,11 +20,15 @@ require('../../../shared/consts/index.cjs');
|
|
|
20
20
|
var primaryWalletIdValidator = require('../useWalletConnectors/utils/primaryWalletIdValidator/primaryWalletIdValidator.cjs');
|
|
21
21
|
require('@dynamic-labs/multi-wallet');
|
|
22
22
|
|
|
23
|
-
const usePrimaryWalletId = () => {
|
|
24
|
-
const [primaryWalletId, setPrimaryWalletIdState,
|
|
23
|
+
const usePrimaryWalletId = (internalEvents) => {
|
|
24
|
+
const [primaryWalletId, setPrimaryWalletIdState, clearPrimaryWalletIdStorage,] = useLocalStorage.useLocalStorage(localStorage.PRIMARY_WALLET_ID, undefined, primaryWalletIdValidator.primaryWalletIdValidator);
|
|
25
25
|
const setPrimaryWalletId = React.useCallback((walletId) => {
|
|
26
26
|
setPrimaryWalletIdState(walletId);
|
|
27
27
|
}, [setPrimaryWalletIdState]);
|
|
28
|
+
const clearPrimaryWalletId = () => {
|
|
29
|
+
clearPrimaryWalletIdStorage();
|
|
30
|
+
internalEvents.emit('clearPrimaryWallet');
|
|
31
|
+
};
|
|
28
32
|
return {
|
|
29
33
|
clearPrimaryWalletId,
|
|
30
34
|
primaryWalletId,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { InternalEventEmitter } from '../../../context/DynamicContext/internalEvents';
|
|
2
|
+
export declare const usePrimaryWalletId: (internalEvents: InternalEventEmitter) => {
|
|
2
3
|
clearPrimaryWalletId: () => void;
|
|
3
4
|
primaryWalletId: string | undefined;
|
|
4
5
|
setPrimaryWalletId: (walletId: string) => void;
|
|
@@ -16,11 +16,15 @@ import '../../../shared/consts/index.js';
|
|
|
16
16
|
import { primaryWalletIdValidator } from '../useWalletConnectors/utils/primaryWalletIdValidator/primaryWalletIdValidator.js';
|
|
17
17
|
import '@dynamic-labs/multi-wallet';
|
|
18
18
|
|
|
19
|
-
const usePrimaryWalletId = () => {
|
|
20
|
-
const [primaryWalletId, setPrimaryWalletIdState,
|
|
19
|
+
const usePrimaryWalletId = (internalEvents) => {
|
|
20
|
+
const [primaryWalletId, setPrimaryWalletIdState, clearPrimaryWalletIdStorage,] = useLocalStorage(PRIMARY_WALLET_ID, undefined, primaryWalletIdValidator);
|
|
21
21
|
const setPrimaryWalletId = useCallback((walletId) => {
|
|
22
22
|
setPrimaryWalletIdState(walletId);
|
|
23
23
|
}, [setPrimaryWalletIdState]);
|
|
24
|
+
const clearPrimaryWalletId = () => {
|
|
25
|
+
clearPrimaryWalletIdStorage();
|
|
26
|
+
internalEvents.emit('clearPrimaryWallet');
|
|
27
|
+
};
|
|
24
28
|
return {
|
|
25
29
|
clearPrimaryWalletId,
|
|
26
30
|
primaryWalletId,
|
|
@@ -41,13 +41,17 @@ const socialProviders = [
|
|
|
41
41
|
// pkce params are only required for twitter and break if added for other providers, like google
|
|
42
42
|
// so we should only add provider that support pkce to this list
|
|
43
43
|
const providersRequiringPkce = ['twitter', 'github'];
|
|
44
|
-
const
|
|
44
|
+
const providersWithoutWindowOpenerRefence = ['twitter'];
|
|
45
|
+
const useSocialAccounts = ({ sessionTimeout } = {
|
|
46
|
+
sessionTimeout: 10000,
|
|
47
|
+
}) => {
|
|
45
48
|
var _a;
|
|
46
49
|
const { environmentId, user, projectSettings, onboardingOnlyJwt } = useInternalDynamicContext.useInternalDynamicContext();
|
|
47
50
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
48
51
|
const [isProcessing, setIsProcessing] = React.useState(false);
|
|
49
52
|
const [error, setError] = React.useState();
|
|
50
53
|
const providersWaitingOauthMessages = React.useRef({});
|
|
54
|
+
const authWindowInterval = React.useRef();
|
|
51
55
|
const userJwt = (_a = getAuthToken.getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
52
56
|
const oauthProviders = index.getEnabledOAuthProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
53
57
|
const verifiedOAuthCredentialsMap = React.useMemo(() => {
|
|
@@ -116,6 +120,7 @@ const useSocialAccounts = () => {
|
|
|
116
120
|
};
|
|
117
121
|
const linkSocialAccount = (provider) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
118
122
|
var _b;
|
|
123
|
+
clearInterval(authWindowInterval.current);
|
|
119
124
|
setError(undefined);
|
|
120
125
|
setIsProcessing(true);
|
|
121
126
|
// invalid linking request
|
|
@@ -124,7 +129,13 @@ const useSocialAccounts = () => {
|
|
|
124
129
|
}
|
|
125
130
|
const state = randomString.randomString(8);
|
|
126
131
|
const verifier = randomString.randomString(43);
|
|
132
|
+
const clearListeners = () => {
|
|
133
|
+
removeOAuthIFrame();
|
|
134
|
+
window.removeEventListener('message', handleAuthWindowMessage);
|
|
135
|
+
providersWaitingOauthMessages.current = Object.assign(Object.assign({}, providersWaitingOauthMessages.current), { [provider]: false });
|
|
136
|
+
};
|
|
127
137
|
const handleAuthWindowMessage = (event) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
138
|
+
var _c;
|
|
128
139
|
const message = event.data;
|
|
129
140
|
const isAuthorizationMessage = (message === null || message === void 0 ? void 0 : message.type) === 'authorization_response';
|
|
130
141
|
if (isAuthorizationMessage) {
|
|
@@ -135,9 +146,11 @@ const useSocialAccounts = () => {
|
|
|
135
146
|
if (!isValidMessage) {
|
|
136
147
|
return;
|
|
137
148
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
if (!((_c = providersWaitingOauthMessages.current) === null || _c === void 0 ? void 0 : _c[provider])) {
|
|
150
|
+
handleError(`Linking ${provider} account session timeout.`);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
clearListeners();
|
|
141
154
|
const { code, error } = message;
|
|
142
155
|
if (error && error !== 'undefined') {
|
|
143
156
|
handleError(`Failed to link ${provider} social account: ${error}`);
|
|
@@ -183,10 +196,40 @@ const useSocialAccounts = () => {
|
|
|
183
196
|
window.addEventListener('message', handleAuthWindowMessage);
|
|
184
197
|
providersWaitingOauthMessages.current = Object.assign(Object.assign({}, providersWaitingOauthMessages.current), { [provider]: true });
|
|
185
198
|
}
|
|
186
|
-
window.open(oauthLoginUrl, '_blank', 'width=500,height=600');
|
|
199
|
+
const authWindow = window.open(oauthLoginUrl, '_blank', 'width=500,height=600');
|
|
200
|
+
if (!providersWithoutWindowOpenerRefence.includes(provider)) {
|
|
201
|
+
// For provider that support window.opener, we need to clear all states/listeners when the window is closed
|
|
202
|
+
authWindowInterval.current = setInterval(() => {
|
|
203
|
+
var _a;
|
|
204
|
+
if (!(authWindow === null || authWindow === void 0 ? void 0 : authWindow.closed)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
// window was closed by user, before completing oauth
|
|
208
|
+
if ((_a = providersWaitingOauthMessages.current) === null || _a === void 0 ? void 0 : _a[provider]) {
|
|
209
|
+
clearListeners();
|
|
210
|
+
handleError(`Linking ${provider} account window closed.`);
|
|
211
|
+
}
|
|
212
|
+
clearInterval(authWindowInterval.current);
|
|
213
|
+
setIsProcessing(false);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
// For provider that don't support window.opener, we need to use a timeout to try to detect when the
|
|
218
|
+
// window is closed
|
|
219
|
+
authWindowInterval.current = setInterval(() => {
|
|
220
|
+
var _a;
|
|
221
|
+
// user didn't complete oauth
|
|
222
|
+
if ((_a = providersWaitingOauthMessages.current) === null || _a === void 0 ? void 0 : _a[provider]) {
|
|
223
|
+
clearListeners();
|
|
224
|
+
handleError(`Linking ${provider} account window timeout.`);
|
|
225
|
+
}
|
|
226
|
+
setIsProcessing(false);
|
|
227
|
+
clearInterval(authWindowInterval.current);
|
|
228
|
+
}, sessionTimeout);
|
|
229
|
+
}
|
|
187
230
|
});
|
|
188
231
|
const unlinkSocialAccount = (provider) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
189
|
-
var
|
|
232
|
+
var _d;
|
|
190
233
|
setError(undefined);
|
|
191
234
|
setIsProcessing(true);
|
|
192
235
|
if (!checkValidProvider(provider)) {
|
|
@@ -200,7 +243,7 @@ const useSocialAccounts = () => {
|
|
|
200
243
|
try {
|
|
201
244
|
const jwt = yield api.unlinkOAuth({
|
|
202
245
|
environmentId,
|
|
203
|
-
verifiedCrentialId: (
|
|
246
|
+
verifiedCrentialId: (_d = verifiedCredential.id) !== null && _d !== void 0 ? _d : '',
|
|
204
247
|
}, String(userJwt));
|
|
205
248
|
if (!jwt) {
|
|
206
249
|
handleError(`Failed to unlink social account: ${provider} | ${verifiedCredential.id}`);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ProviderEnum } from '@dynamic-labs/sdk-api';
|
|
2
2
|
import { SocialAccountInformation } from '@dynamic-labs/types';
|
|
3
|
-
|
|
3
|
+
type UseSocialAccountsProps = {
|
|
4
|
+
sessionTimeout: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const useSocialAccounts: ({ sessionTimeout }?: UseSocialAccountsProps) => {
|
|
4
7
|
readonly error: string | undefined;
|
|
5
8
|
readonly getLinkedAccountInformation: (provider: ProviderEnum) => SocialAccountInformation | undefined;
|
|
6
9
|
readonly isLinked: (provider: ProviderEnum) => boolean;
|
|
@@ -8,3 +11,4 @@ export declare const useSocialAccounts: () => {
|
|
|
8
11
|
readonly linkSocialAccount: (provider: ProviderEnum) => Promise<void>;
|
|
9
12
|
readonly unlinkSocialAccount: (provider: ProviderEnum) => Promise<void>;
|
|
10
13
|
};
|
|
14
|
+
export {};
|
|
@@ -37,13 +37,17 @@ const socialProviders = [
|
|
|
37
37
|
// pkce params are only required for twitter and break if added for other providers, like google
|
|
38
38
|
// so we should only add provider that support pkce to this list
|
|
39
39
|
const providersRequiringPkce = ['twitter', 'github'];
|
|
40
|
-
const
|
|
40
|
+
const providersWithoutWindowOpenerRefence = ['twitter'];
|
|
41
|
+
const useSocialAccounts = ({ sessionTimeout } = {
|
|
42
|
+
sessionTimeout: 10000,
|
|
43
|
+
}) => {
|
|
41
44
|
var _a;
|
|
42
45
|
const { environmentId, user, projectSettings, onboardingOnlyJwt } = useInternalDynamicContext();
|
|
43
46
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
44
47
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
45
48
|
const [error, setError] = useState();
|
|
46
49
|
const providersWaitingOauthMessages = useRef({});
|
|
50
|
+
const authWindowInterval = useRef();
|
|
47
51
|
const userJwt = (_a = getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
48
52
|
const oauthProviders = getEnabledOAuthProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
49
53
|
const verifiedOAuthCredentialsMap = useMemo(() => {
|
|
@@ -112,6 +116,7 @@ const useSocialAccounts = () => {
|
|
|
112
116
|
};
|
|
113
117
|
const linkSocialAccount = (provider) => __awaiter(void 0, void 0, void 0, function* () {
|
|
114
118
|
var _b;
|
|
119
|
+
clearInterval(authWindowInterval.current);
|
|
115
120
|
setError(undefined);
|
|
116
121
|
setIsProcessing(true);
|
|
117
122
|
// invalid linking request
|
|
@@ -120,7 +125,13 @@ const useSocialAccounts = () => {
|
|
|
120
125
|
}
|
|
121
126
|
const state = randomString(8);
|
|
122
127
|
const verifier = randomString(43);
|
|
128
|
+
const clearListeners = () => {
|
|
129
|
+
removeOAuthIFrame();
|
|
130
|
+
window.removeEventListener('message', handleAuthWindowMessage);
|
|
131
|
+
providersWaitingOauthMessages.current = Object.assign(Object.assign({}, providersWaitingOauthMessages.current), { [provider]: false });
|
|
132
|
+
};
|
|
123
133
|
const handleAuthWindowMessage = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
134
|
+
var _c;
|
|
124
135
|
const message = event.data;
|
|
125
136
|
const isAuthorizationMessage = (message === null || message === void 0 ? void 0 : message.type) === 'authorization_response';
|
|
126
137
|
if (isAuthorizationMessage) {
|
|
@@ -131,9 +142,11 @@ const useSocialAccounts = () => {
|
|
|
131
142
|
if (!isValidMessage) {
|
|
132
143
|
return;
|
|
133
144
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
145
|
+
if (!((_c = providersWaitingOauthMessages.current) === null || _c === void 0 ? void 0 : _c[provider])) {
|
|
146
|
+
handleError(`Linking ${provider} account session timeout.`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
clearListeners();
|
|
137
150
|
const { code, error } = message;
|
|
138
151
|
if (error && error !== 'undefined') {
|
|
139
152
|
handleError(`Failed to link ${provider} social account: ${error}`);
|
|
@@ -179,10 +192,40 @@ const useSocialAccounts = () => {
|
|
|
179
192
|
window.addEventListener('message', handleAuthWindowMessage);
|
|
180
193
|
providersWaitingOauthMessages.current = Object.assign(Object.assign({}, providersWaitingOauthMessages.current), { [provider]: true });
|
|
181
194
|
}
|
|
182
|
-
window.open(oauthLoginUrl, '_blank', 'width=500,height=600');
|
|
195
|
+
const authWindow = window.open(oauthLoginUrl, '_blank', 'width=500,height=600');
|
|
196
|
+
if (!providersWithoutWindowOpenerRefence.includes(provider)) {
|
|
197
|
+
// For provider that support window.opener, we need to clear all states/listeners when the window is closed
|
|
198
|
+
authWindowInterval.current = setInterval(() => {
|
|
199
|
+
var _a;
|
|
200
|
+
if (!(authWindow === null || authWindow === void 0 ? void 0 : authWindow.closed)) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
// window was closed by user, before completing oauth
|
|
204
|
+
if ((_a = providersWaitingOauthMessages.current) === null || _a === void 0 ? void 0 : _a[provider]) {
|
|
205
|
+
clearListeners();
|
|
206
|
+
handleError(`Linking ${provider} account window closed.`);
|
|
207
|
+
}
|
|
208
|
+
clearInterval(authWindowInterval.current);
|
|
209
|
+
setIsProcessing(false);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
// For provider that don't support window.opener, we need to use a timeout to try to detect when the
|
|
214
|
+
// window is closed
|
|
215
|
+
authWindowInterval.current = setInterval(() => {
|
|
216
|
+
var _a;
|
|
217
|
+
// user didn't complete oauth
|
|
218
|
+
if ((_a = providersWaitingOauthMessages.current) === null || _a === void 0 ? void 0 : _a[provider]) {
|
|
219
|
+
clearListeners();
|
|
220
|
+
handleError(`Linking ${provider} account window timeout.`);
|
|
221
|
+
}
|
|
222
|
+
setIsProcessing(false);
|
|
223
|
+
clearInterval(authWindowInterval.current);
|
|
224
|
+
}, sessionTimeout);
|
|
225
|
+
}
|
|
183
226
|
});
|
|
184
227
|
const unlinkSocialAccount = (provider) => __awaiter(void 0, void 0, void 0, function* () {
|
|
185
|
-
var
|
|
228
|
+
var _d;
|
|
186
229
|
setError(undefined);
|
|
187
230
|
setIsProcessing(true);
|
|
188
231
|
if (!checkValidProvider(provider)) {
|
|
@@ -196,7 +239,7 @@ const useSocialAccounts = () => {
|
|
|
196
239
|
try {
|
|
197
240
|
const jwt = yield unlinkOAuth({
|
|
198
241
|
environmentId,
|
|
199
|
-
verifiedCrentialId: (
|
|
242
|
+
verifiedCrentialId: (_d = verifiedCredential.id) !== null && _d !== void 0 ? _d : '',
|
|
200
243
|
}, String(userJwt));
|
|
201
244
|
if (!jwt) {
|
|
202
245
|
handleError(`Failed to unlink social account: ${provider} | ${verifiedCredential.id}`);
|
|
@@ -65,7 +65,7 @@ const EmailWalletOTPVerificationView = () => {
|
|
|
65
65
|
const { data: isValid, isLoading, mutate: onSubmit, } = useMutation.useMutation((otp) => emailWalletConnector.verifyOneTimePassword(otp), {
|
|
66
66
|
onFailure: (error) => setError(error),
|
|
67
67
|
});
|
|
68
|
-
return (jsxRuntime.jsx(OTPVerificationView.OTPVerificationView, { email: email, error: error, onClickBack: handleBackClick, isLoading: isLoading, onPinComplete: onSubmit, isValid: isValid === true, onPinChange: () => setError(undefined), onClickClose: handleOnClickClose, onClickEditEmail: handleBackClick, displayPoweredByDynamic: true }));
|
|
68
|
+
return (jsxRuntime.jsx(OTPVerificationView.OTPVerificationView, { email: email, error: error, onClickBack: handleBackClick, isLoading: isLoading, onPinComplete: onSubmit, isValid: isValid === true, onPinChange: () => setError(undefined), onClickClose: handleOnClickClose, onClickEditEmail: handleBackClick, displayPoweredByDynamic: true, successBannerText: 'Sign in to access your email based wallet' }));
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
exports.EmailWalletOTPVerificationView = EmailWalletOTPVerificationView;
|
|
@@ -61,7 +61,7 @@ const EmailWalletOTPVerificationView = () => {
|
|
|
61
61
|
const { data: isValid, isLoading, mutate: onSubmit, } = useMutation((otp) => emailWalletConnector.verifyOneTimePassword(otp), {
|
|
62
62
|
onFailure: (error) => setError(error),
|
|
63
63
|
});
|
|
64
|
-
return (jsx(OTPVerificationView, { email: email, error: error, onClickBack: handleBackClick, isLoading: isLoading, onPinComplete: onSubmit, isValid: isValid === true, onPinChange: () => setError(undefined), onClickClose: handleOnClickClose, onClickEditEmail: handleBackClick, displayPoweredByDynamic: true }));
|
|
64
|
+
return (jsx(OTPVerificationView, { email: email, error: error, onClickBack: handleBackClick, isLoading: isLoading, onPinComplete: onSubmit, isValid: isValid === true, onPinChange: () => setError(undefined), onClickClose: handleOnClickClose, onClickEditEmail: handleBackClick, displayPoweredByDynamic: true, successBannerText: 'Sign in to access your email based wallet' }));
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
export { EmailWalletOTPVerificationView };
|
|
@@ -19,6 +19,7 @@ require('viem');
|
|
|
19
19
|
require('../../../../shared/consts/index.cjs');
|
|
20
20
|
require('@dynamic-labs/multi-wallet');
|
|
21
21
|
var isMagicConnector = require('../../../../utils/functions/isMagicConnector/isMagicConnector.cjs');
|
|
22
|
+
var sendTransactionWithAutoNonce = require('../../../../utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.cjs');
|
|
22
23
|
require('@dynamic-labs/rpc-providers');
|
|
23
24
|
require('../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
24
25
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
@@ -55,19 +56,12 @@ const TransactionStage = (_a) => {
|
|
|
55
56
|
provider,
|
|
56
57
|
transaction,
|
|
57
58
|
});
|
|
58
|
-
return (jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
return (jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => sendTransactionWithAutoNonce.sendTransactionWithAutoNonce(walletConnector, transactionWithGasPrice, (transaction) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
59
60
|
walletUiUtils.disabledConfirmationOnce();
|
|
60
61
|
const signer = yield walletConnector.getSigner();
|
|
61
|
-
const sentTransaction = yield signer.sendTransaction({
|
|
62
|
-
account: transactionWithGasPrice.from,
|
|
63
|
-
chain: null,
|
|
64
|
-
gasPrice: transactionWithGasPrice.gasPrice,
|
|
65
|
-
to: transactionWithGasPrice.to,
|
|
66
|
-
type: 'eip2930',
|
|
67
|
-
value: transactionWithGasPrice.value,
|
|
68
|
-
});
|
|
62
|
+
const sentTransaction = yield signer.sendTransaction(Object.assign(Object.assign({}, transaction), { account: transaction.from, chain: null }));
|
|
69
63
|
return sentTransaction;
|
|
70
|
-
}) }, rest)));
|
|
64
|
+
})) }, rest)));
|
|
71
65
|
};
|
|
72
66
|
|
|
73
67
|
exports.TransactionStage = TransactionStage;
|
|
@@ -15,6 +15,7 @@ import 'viem';
|
|
|
15
15
|
import '../../../../shared/consts/index.js';
|
|
16
16
|
import '@dynamic-labs/multi-wallet';
|
|
17
17
|
import { isMagicConnector } from '../../../../utils/functions/isMagicConnector/isMagicConnector.js';
|
|
18
|
+
import { sendTransactionWithAutoNonce } from '../../../../utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.js';
|
|
18
19
|
import '@dynamic-labs/rpc-providers';
|
|
19
20
|
import '../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
20
21
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
@@ -51,19 +52,12 @@ const TransactionStage = (_a) => {
|
|
|
51
52
|
provider,
|
|
52
53
|
transaction,
|
|
53
54
|
});
|
|
54
|
-
return (jsx(TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
return (jsx(TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => sendTransactionWithAutoNonce(walletConnector, transactionWithGasPrice, (transaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
56
|
walletUiUtils.disabledConfirmationOnce();
|
|
56
57
|
const signer = yield walletConnector.getSigner();
|
|
57
|
-
const sentTransaction = yield signer.sendTransaction({
|
|
58
|
-
account: transactionWithGasPrice.from,
|
|
59
|
-
chain: null,
|
|
60
|
-
gasPrice: transactionWithGasPrice.gasPrice,
|
|
61
|
-
to: transactionWithGasPrice.to,
|
|
62
|
-
type: 'eip2930',
|
|
63
|
-
value: transactionWithGasPrice.value,
|
|
64
|
-
});
|
|
58
|
+
const sentTransaction = yield signer.sendTransaction(Object.assign(Object.assign({}, transaction), { account: transaction.from, chain: null }));
|
|
65
59
|
return sentTransaction;
|
|
66
|
-
}) }, rest)));
|
|
60
|
+
})) }, rest)));
|
|
67
61
|
};
|
|
68
62
|
|
|
69
63
|
export { TransactionStage };
|
|
@@ -13,6 +13,7 @@ require('@dynamic-labs/wallet-book');
|
|
|
13
13
|
var getWalletListItemLabel = require('../../../../shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.cjs');
|
|
14
14
|
require('viem');
|
|
15
15
|
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
16
|
+
require('@dynamic-labs/utils');
|
|
16
17
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
17
18
|
var stroke = require('../../../../shared/assets/stroke.cjs');
|
|
18
19
|
require('../../../../shared/consts/index.cjs');
|
|
@@ -9,6 +9,7 @@ import '@dynamic-labs/wallet-book';
|
|
|
9
9
|
import { getWalletListItemLabel } from '../../../../shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.js';
|
|
10
10
|
import 'viem';
|
|
11
11
|
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
12
|
+
import '@dynamic-labs/utils';
|
|
12
13
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
13
14
|
import { ReactComponent as SvgStroke } from '../../../../shared/assets/stroke.js';
|
|
14
15
|
import '../../../../shared/consts/index.js';
|
|
@@ -16,11 +16,11 @@ require('@dynamic-labs/wallet-connector-core');
|
|
|
16
16
|
var getWalletListItemLabel = require('../../../shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.cjs');
|
|
17
17
|
require('viem');
|
|
18
18
|
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
|
+
require('@dynamic-labs/utils');
|
|
19
20
|
require('../../../shared/consts/index.cjs');
|
|
20
21
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
21
22
|
require('../../../utils/constants/colors.cjs');
|
|
22
23
|
require('@dynamic-labs/multi-wallet');
|
|
23
|
-
require('@dynamic-labs/utils');
|
|
24
24
|
var pixelToRem = require('../../../utils/functions/pixelToRem/pixelToRem.cjs');
|
|
25
25
|
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
26
26
|
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
@@ -12,11 +12,11 @@ import '@dynamic-labs/wallet-connector-core';
|
|
|
12
12
|
import { getWalletListItemLabel } from '../../../shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.js';
|
|
13
13
|
import 'viem';
|
|
14
14
|
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
15
|
+
import '@dynamic-labs/utils';
|
|
15
16
|
import '../../../shared/consts/index.js';
|
|
16
17
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
17
18
|
import '../../../utils/constants/colors.js';
|
|
18
19
|
import '@dynamic-labs/multi-wallet';
|
|
19
|
-
import '@dynamic-labs/utils';
|
|
20
20
|
import { pixelToRem } from '../../../utils/functions/pixelToRem/pixelToRem.js';
|
|
21
21
|
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
22
22
|
import '../../../context/ThemeContext/ThemeContext.js';
|