@dynamic-labs/sdk-react-core 0.17.26 → 0.17.28
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 +8 -8
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +4 -4
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +2 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +4 -4
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +3 -3
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +3 -3
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +10 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +10 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +2 -0
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/isMagicConnector/index.d.ts +1 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.cjs +10 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.d.ts +2 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.js +6 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/index.d.ts +1 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.cjs +41 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.d.ts +32 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.js +37 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs +21 -5
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.d.ts +8 -4
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js +21 -5
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +20 -19
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.d.ts +4 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +20 -19
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +3 -3
- package/src/lib/utils/hooks/useWallets/useWallets.d.ts +3 -3
- package/src/lib/utils/hooks/useWallets/useWallets.js +3 -3
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +10 -3
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +10 -3
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +9 -16
- package/src/lib/views/SendBalanceView/SendBalanceView.js +9 -16
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +63 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.d.ts +8 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +59 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/index.d.ts +1 -0
- package/src/lib/views/SendBalanceView/components/index.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +2 -2
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +2 -2
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.cjs +21 -8
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.d.ts +4 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.js +21 -8
|
@@ -4,22 +4,26 @@ export declare const useUserUpdateRequestInternal: ({ validationSchemaStripUnkno
|
|
|
4
4
|
validationSchemaStripUnknown: boolean;
|
|
5
5
|
}) => {
|
|
6
6
|
updateUser: (userFields: UpdateUserFieldsArg, userEnvironmentId?: string) => Promise<{
|
|
7
|
-
isEmailVerificationRequired:
|
|
7
|
+
isEmailVerificationRequired: boolean;
|
|
8
|
+
missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
|
|
8
9
|
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
9
10
|
verifyEmailFn?: undefined;
|
|
10
11
|
} | {
|
|
11
|
-
isEmailVerificationRequired:
|
|
12
|
+
isEmailVerificationRequired: boolean;
|
|
13
|
+
missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
|
|
12
14
|
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
13
15
|
verifyEmailFn: (verificationToken: string) => Promise<import("@dynamic-labs/sdk-api").UpdateSelfResponse>;
|
|
14
16
|
}>;
|
|
15
17
|
};
|
|
16
18
|
export declare const useUserUpdateRequest: () => {
|
|
17
19
|
updateUser: (userFields: UpdateUserFieldsArg, userEnvironmentId?: string) => Promise<{
|
|
18
|
-
isEmailVerificationRequired:
|
|
20
|
+
isEmailVerificationRequired: boolean;
|
|
21
|
+
missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
|
|
19
22
|
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
20
23
|
verifyEmailFn?: undefined;
|
|
21
24
|
} | {
|
|
22
|
-
isEmailVerificationRequired:
|
|
25
|
+
isEmailVerificationRequired: boolean;
|
|
26
|
+
missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
|
|
23
27
|
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
24
28
|
verifyEmailFn: (verificationToken: string) => Promise<import("@dynamic-labs/sdk-api").UpdateSelfResponse>;
|
|
25
29
|
}>;
|
|
@@ -7,6 +7,17 @@ import { isEmailVerificationRequired } from '../../functions/authenication/isEma
|
|
|
7
7
|
import { useEmailVerificationContext } from '../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
8
8
|
import { useEmailVerificationRequest } from '../authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js';
|
|
9
9
|
import { useUpdateUserProfileByJWTCallback } from '../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
10
|
+
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
11
|
+
import '../../../shared/logger.js';
|
|
12
|
+
import '../../../config/LSSuffix.js';
|
|
13
|
+
import '@dynamic-labs/iconic';
|
|
14
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
15
|
+
import 'react/jsx-runtime';
|
|
16
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
17
|
+
import '@dynamic-labs/utils';
|
|
18
|
+
import '../../constants/colors.js';
|
|
19
|
+
import 'ethers';
|
|
20
|
+
import '../../../shared/consts/index.js';
|
|
10
21
|
|
|
11
22
|
// User Fields Schema without captchaToken and policiesConsent properties
|
|
12
23
|
const userFieldsSchema = object().shape({
|
|
@@ -29,23 +40,27 @@ const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
|
|
|
29
40
|
const { verifyEmail: verifyEmailFn } = useEmailVerificationRequest();
|
|
30
41
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
31
42
|
const updateUser = useCallback((userFields, userEnvironmentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
-
var _a, _b;
|
|
43
|
+
var _a, _b, _c;
|
|
33
44
|
const validatedUserFields = yield userFieldsSchema.validate(userFields, {
|
|
34
45
|
stripUnknown: validationSchemaStripUnknown,
|
|
35
46
|
});
|
|
36
47
|
const updateUserProfileResponse = yield updateUserProfileFields(jwtToken, userEnvironmentId || environmentId, validatedUserFields);
|
|
48
|
+
// check if decoded JWT still somehow has missing fields, we can't proceed if it does
|
|
49
|
+
const decodedJwt = decodeJwt(updateUserProfileResponse.jwt);
|
|
50
|
+
const missingFields = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : [];
|
|
37
51
|
const _isEmailVerificationRequired = isEmailVerificationRequired(updateUserProfileResponse);
|
|
38
52
|
if (!_isEmailVerificationRequired) {
|
|
39
53
|
// If email verification is not needed then we can update the user profile immediately.
|
|
40
54
|
updateUserProfileByJWT(updateUserProfileResponse.jwt);
|
|
41
55
|
return {
|
|
42
|
-
isEmailVerificationRequired:
|
|
56
|
+
isEmailVerificationRequired: false,
|
|
57
|
+
missingFields,
|
|
43
58
|
updateUserProfileResponse,
|
|
44
59
|
};
|
|
45
60
|
}
|
|
46
61
|
// We update EmailContext to use this information in the Email Verification view
|
|
47
|
-
setEmail((
|
|
48
|
-
setVerificationUUID((
|
|
62
|
+
setEmail((_b = updateUserProfileResponse.emailVerification) === null || _b === void 0 ? void 0 : _b.email);
|
|
63
|
+
setVerificationUUID((_c = updateUserProfileResponse.emailVerification) === null || _c === void 0 ? void 0 : _c.verificationUUID);
|
|
49
64
|
// DYN-2046 - Customers have the opportunity to programmatically use our email verification and profile editing.
|
|
50
65
|
// VerifyEmailFN was scoped to bypass the problem with memoization of the state at the beginning of Promise.
|
|
51
66
|
// setEmail and setVerificationUUID in the above lines will are not visible in this promise.
|
|
@@ -54,7 +69,8 @@ const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
|
|
|
54
69
|
return verifyEmailFn(verificationToken, (_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.verificationUUID);
|
|
55
70
|
};
|
|
56
71
|
return {
|
|
57
|
-
isEmailVerificationRequired:
|
|
72
|
+
isEmailVerificationRequired: true,
|
|
73
|
+
missingFields,
|
|
58
74
|
updateUserProfileResponse,
|
|
59
75
|
verifyEmailFn: scopedVerifyEmailFn,
|
|
60
76
|
};
|
|
@@ -58,27 +58,28 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
58
58
|
}
|
|
59
59
|
return true;
|
|
60
60
|
}, [confirmationStateRef]);
|
|
61
|
-
const
|
|
62
|
-
if (!shouldConfirmAction()) {
|
|
63
|
-
return handler(message);
|
|
64
|
-
}
|
|
65
|
-
return openSignMessage((resolve, reject) => (jsxRuntime.jsx(SignMessageConfirmationModal.SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
66
|
-
}, [appLogoUrl, appName, getAppOrigin, openSignMessage, shouldConfirmAction]);
|
|
67
|
-
const sendTransaction = React.useCallback(({ transaction, handler, provider }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
if (!shouldConfirmAction()) {
|
|
69
|
-
return handler(transaction);
|
|
70
|
-
}
|
|
71
|
-
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
72
|
-
}), [openSendTransaction, shouldConfirmAction]);
|
|
73
|
-
const disabledConfirmationOnce = React.useCallback(() => {
|
|
61
|
+
const disableConfirmationOnce = React.useCallback(() => {
|
|
74
62
|
confirmationStateRef.current = 'disabled';
|
|
75
63
|
}, []);
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
64
|
+
const createWalletUiUtils = React.useCallback((walletConnector) => ({
|
|
65
|
+
sendTransaction: ({ transaction, handler, provider }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
if (!shouldConfirmAction()) {
|
|
67
|
+
return handler(transaction);
|
|
68
|
+
}
|
|
69
|
+
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider, walletConnector: walletConnector })));
|
|
70
|
+
}),
|
|
71
|
+
signMessage: ({ message, handler }) => {
|
|
72
|
+
if (!shouldConfirmAction()) {
|
|
73
|
+
return handler(message);
|
|
74
|
+
}
|
|
75
|
+
return openSignMessage((resolve, reject) => (jsxRuntime.jsx(SignMessageConfirmationModal.SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
76
|
+
},
|
|
77
|
+
}), [shouldConfirmAction]);
|
|
78
|
+
return React.useMemo(() => [
|
|
79
|
+
modal || sendTransactionModal,
|
|
80
|
+
createWalletUiUtils,
|
|
81
|
+
{ disableConfirmationOnce },
|
|
82
|
+
], [modal, sendTransactionModal, createWalletUiUtils, disableConfirmationOnce]);
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
exports.useWalletUiUtils = useWalletUiUtils;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { WalletUiUtils } from '@dynamic-labs/types';
|
|
3
|
+
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
4
|
import { WalletUiUtilsHookProps } from './useWalletUiUtils.types';
|
|
4
|
-
export declare const useWalletUiUtils: ({ appLogoUrl, appName, getAppOrigin, }: WalletUiUtilsHookProps) => [ReactNode
|
|
5
|
+
export declare const useWalletUiUtils: ({ appLogoUrl, appName, getAppOrigin, }: WalletUiUtilsHookProps) => [ReactNode, (connector: WalletConnector) => WalletUiUtils, {
|
|
6
|
+
disableConfirmationOnce: () => void;
|
|
7
|
+
}];
|
|
@@ -54,27 +54,28 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
54
54
|
}
|
|
55
55
|
return true;
|
|
56
56
|
}, [confirmationStateRef]);
|
|
57
|
-
const
|
|
58
|
-
if (!shouldConfirmAction()) {
|
|
59
|
-
return handler(message);
|
|
60
|
-
}
|
|
61
|
-
return openSignMessage((resolve, reject) => (jsx(SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
62
|
-
}, [appLogoUrl, appName, getAppOrigin, openSignMessage, shouldConfirmAction]);
|
|
63
|
-
const sendTransaction = useCallback(({ transaction, handler, provider }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
-
if (!shouldConfirmAction()) {
|
|
65
|
-
return handler(transaction);
|
|
66
|
-
}
|
|
67
|
-
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
68
|
-
}), [openSendTransaction, shouldConfirmAction]);
|
|
69
|
-
const disabledConfirmationOnce = useCallback(() => {
|
|
57
|
+
const disableConfirmationOnce = useCallback(() => {
|
|
70
58
|
confirmationStateRef.current = 'disabled';
|
|
71
59
|
}, []);
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
const createWalletUiUtils = useCallback((walletConnector) => ({
|
|
61
|
+
sendTransaction: ({ transaction, handler, provider }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
+
if (!shouldConfirmAction()) {
|
|
63
|
+
return handler(transaction);
|
|
64
|
+
}
|
|
65
|
+
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider, walletConnector: walletConnector })));
|
|
66
|
+
}),
|
|
67
|
+
signMessage: ({ message, handler }) => {
|
|
68
|
+
if (!shouldConfirmAction()) {
|
|
69
|
+
return handler(message);
|
|
70
|
+
}
|
|
71
|
+
return openSignMessage((resolve, reject) => (jsx(SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
72
|
+
},
|
|
73
|
+
}), [shouldConfirmAction]);
|
|
74
|
+
return useMemo(() => [
|
|
75
|
+
modal || sendTransactionModal,
|
|
76
|
+
createWalletUiUtils,
|
|
77
|
+
{ disableConfirmationOnce },
|
|
78
|
+
], [modal, sendTransactionModal, createWalletUiUtils, disableConfirmationOnce]);
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
export { useWalletUiUtils };
|
|
@@ -5,31 +5,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var data = require('../../../views/WalletList/data.cjs');
|
|
7
7
|
|
|
8
|
-
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge,
|
|
8
|
+
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge, createWalletUiUtils, walletConnectorsProp, }) => {
|
|
9
9
|
const wallets = React.useMemo(() => {
|
|
10
10
|
if (!projectSettings)
|
|
11
11
|
return [];
|
|
12
12
|
const installedWallets = data.getInstalledWallets(projectSettings, {
|
|
13
13
|
appLogoUrl,
|
|
14
14
|
appName,
|
|
15
|
+
createWalletUiUtils,
|
|
15
16
|
customerApiProviders: projectSettings.providers || [],
|
|
16
17
|
flowNetwork,
|
|
17
18
|
networkConfigurations,
|
|
18
19
|
skipMemo: true,
|
|
19
20
|
walletConnectV1Bridge,
|
|
20
21
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
21
|
-
walletUiUtils,
|
|
22
22
|
});
|
|
23
23
|
const notInstalledWallets = data.getNotInstalledWallets(projectSettings, {
|
|
24
24
|
appLogoUrl,
|
|
25
25
|
appName,
|
|
26
|
+
createWalletUiUtils,
|
|
26
27
|
customerApiProviders: projectSettings.providers || [],
|
|
27
28
|
flowNetwork,
|
|
28
29
|
networkConfigurations,
|
|
29
30
|
skipMemo: true,
|
|
30
31
|
walletConnectV1Bridge,
|
|
31
32
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
32
|
-
walletUiUtils,
|
|
33
33
|
});
|
|
34
34
|
return [...installedWallets, ...notInstalledWallets];
|
|
35
35
|
// Cannot include walletUiUtils in the dependency array because it will cause an infinite loop
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProjectSettings } from '@dynamic-labs/sdk-api';
|
|
2
2
|
import { NetworkConfigurationMap, WalletUiUtils } from '@dynamic-labs/types';
|
|
3
|
-
import { WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { WalletConnector, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
type Props = {
|
|
5
5
|
appLogoUrl?: string;
|
|
6
6
|
appName?: string;
|
|
@@ -9,9 +9,9 @@ type Props = {
|
|
|
9
9
|
projectSettings: ProjectSettings | undefined;
|
|
10
10
|
walletConnectV1Bridge?: string;
|
|
11
11
|
walletConnectorsProp?: WalletConnectorsMethod[];
|
|
12
|
-
|
|
12
|
+
createWalletUiUtils: (connector: WalletConnector) => WalletUiUtils;
|
|
13
13
|
};
|
|
14
|
-
export declare const useWallets: ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge,
|
|
14
|
+
export declare const useWallets: ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge, createWalletUiUtils, walletConnectorsProp, }: Props) => {
|
|
15
15
|
wallets: import("../../../shared").WalletOption[];
|
|
16
16
|
};
|
|
17
17
|
export {};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { getInstalledWallets, getNotInstalledWallets } from '../../../views/WalletList/data.js';
|
|
3
3
|
|
|
4
|
-
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge,
|
|
4
|
+
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge, createWalletUiUtils, walletConnectorsProp, }) => {
|
|
5
5
|
const wallets = useMemo(() => {
|
|
6
6
|
if (!projectSettings)
|
|
7
7
|
return [];
|
|
8
8
|
const installedWallets = getInstalledWallets(projectSettings, {
|
|
9
9
|
appLogoUrl,
|
|
10
10
|
appName,
|
|
11
|
+
createWalletUiUtils,
|
|
11
12
|
customerApiProviders: projectSettings.providers || [],
|
|
12
13
|
flowNetwork,
|
|
13
14
|
networkConfigurations,
|
|
14
15
|
skipMemo: true,
|
|
15
16
|
walletConnectV1Bridge,
|
|
16
17
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
17
|
-
walletUiUtils,
|
|
18
18
|
});
|
|
19
19
|
const notInstalledWallets = getNotInstalledWallets(projectSettings, {
|
|
20
20
|
appLogoUrl,
|
|
21
21
|
appName,
|
|
22
|
+
createWalletUiUtils,
|
|
22
23
|
customerApiProviders: projectSettings.providers || [],
|
|
23
24
|
flowNetwork,
|
|
24
25
|
networkConfigurations,
|
|
25
26
|
skipMemo: true,
|
|
26
27
|
walletConnectV1Bridge,
|
|
27
28
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
28
|
-
walletUiUtils,
|
|
29
29
|
});
|
|
30
30
|
return [...installedWallets, ...notInstalledWallets];
|
|
31
31
|
// Cannot include walletUiUtils in the dependency array because it will cause an infinite loop
|
|
@@ -46,17 +46,24 @@ var useUserDataForm = require('../../../utils/hooks/useUserDataForm/useUserDataF
|
|
|
46
46
|
|
|
47
47
|
const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
48
48
|
const { policiesConsentInnerComponent, onboardingOnlyJwt, setShowAuthFlow, setCallback, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
49
|
-
const { setView } = ViewContext.useViewContext();
|
|
49
|
+
const { setView, view } = ViewContext.useViewContext();
|
|
50
50
|
const decodedJwt = decodeJwt.decodeJwt(onboardingOnlyJwt);
|
|
51
51
|
const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
|
|
52
52
|
validationSchemaStripUnknown: false,
|
|
53
53
|
});
|
|
54
54
|
const onSubmit = React.useCallback((formValues) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
const { isEmailVerificationRequired } = yield updateUser(formValues);
|
|
56
|
-
if (isEmailVerificationRequired
|
|
55
|
+
const { isEmailVerificationRequired, missingFields } = yield updateUser(formValues);
|
|
56
|
+
if (isEmailVerificationRequired &&
|
|
57
|
+
missingFields.map((field) => field.name).toString() === 'email') {
|
|
57
58
|
setView('verify-email');
|
|
58
59
|
return;
|
|
59
60
|
}
|
|
61
|
+
else if (missingFields.length > 0) {
|
|
62
|
+
// make sure we capture the fields that are required and still missing!
|
|
63
|
+
// do not change the view, just use the current one
|
|
64
|
+
setView(view);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
60
67
|
setShowAuthFlow(false);
|
|
61
68
|
setCallback('authSuccess');
|
|
62
69
|
}), [setCallback, setShowAuthFlow, setView, updateUser]);
|
|
@@ -42,17 +42,24 @@ import { useUserDataForm } from '../../../utils/hooks/useUserDataForm/useUserDat
|
|
|
42
42
|
|
|
43
43
|
const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
44
44
|
const { policiesConsentInnerComponent, onboardingOnlyJwt, setShowAuthFlow, setCallback, } = useInternalDynamicContext();
|
|
45
|
-
const { setView } = useViewContext();
|
|
45
|
+
const { setView, view } = useViewContext();
|
|
46
46
|
const decodedJwt = decodeJwt(onboardingOnlyJwt);
|
|
47
47
|
const { updateUser } = useUserUpdateRequestInternal({
|
|
48
48
|
validationSchemaStripUnknown: false,
|
|
49
49
|
});
|
|
50
50
|
const onSubmit = useCallback((formValues) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
-
const { isEmailVerificationRequired } = yield updateUser(formValues);
|
|
52
|
-
if (isEmailVerificationRequired
|
|
51
|
+
const { isEmailVerificationRequired, missingFields } = yield updateUser(formValues);
|
|
52
|
+
if (isEmailVerificationRequired &&
|
|
53
|
+
missingFields.map((field) => field.name).toString() === 'email') {
|
|
53
54
|
setView('verify-email');
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
57
|
+
else if (missingFields.length > 0) {
|
|
58
|
+
// make sure we capture the fields that are required and still missing!
|
|
59
|
+
// do not change the view, just use the current one
|
|
60
|
+
setView(view);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
56
63
|
setShowAuthFlow(false);
|
|
57
64
|
setCallback('authSuccess');
|
|
58
65
|
}), [setCallback, setShowAuthFlow, setView, updateUser]);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var ethers = require('ethers');
|
|
@@ -39,9 +38,9 @@ require('../../components/Popper/Popper/Popper.cjs');
|
|
|
39
38
|
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
40
39
|
var SendBalancePageLayout = require('../../components/SendBalancePageLayout/SendBalancePageLayout.cjs');
|
|
41
40
|
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
42
|
-
var TransactionConfirmationView = require('../TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
43
|
-
var TransactionStatusLayout = require('../../components/TransactionStatusLayout/TransactionStatusLayout.cjs');
|
|
44
41
|
var useFetchCurrency = require('../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.cjs');
|
|
42
|
+
var TransactionStatusLayout = require('../../components/TransactionStatusLayout/TransactionStatusLayout.cjs');
|
|
43
|
+
var TransactionStage = require('./components/TransactionStage/TransactionStage.cjs');
|
|
45
44
|
require('../../context/MockContext/MockContext.cjs');
|
|
46
45
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
47
46
|
var usePromise = require('../../utils/hooks/usePromise/usePromise.cjs');
|
|
@@ -49,18 +48,17 @@ require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
|
49
48
|
|
|
50
49
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
51
50
|
const [stage, setStage] = React.useState('form');
|
|
52
|
-
const { primaryWallet,
|
|
51
|
+
const { primaryWallet, network } = useInternalDynamicContext.useInternalDynamicContext();
|
|
53
52
|
const [value, setValue] = React.useState(initialValue !== null && initialValue !== void 0 ? initialValue : null);
|
|
54
53
|
const [recipientAddress, setRecipientAddress] = React.useState(initialRecipientAddress);
|
|
55
54
|
const transactionRef = React.useRef(null);
|
|
56
55
|
if (!primaryWallet) {
|
|
57
56
|
throw new utils.DynamicError('Primary wallet is not available, send balance cannot be displayed');
|
|
58
57
|
}
|
|
59
|
-
const
|
|
60
|
-
const { data:
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
[];
|
|
58
|
+
const walletConnector = primaryWallet.connector;
|
|
59
|
+
const { data: balance } = usePromise.usePromise(() => walletConnector.getBalance(), [walletConnector]);
|
|
60
|
+
const { data: provider } = usePromise.usePromise(() => walletConnector.getWeb3Provider(), [walletConnector]);
|
|
61
|
+
const evmNetworks = (walletConnector && walletConnector.evmNetworks) || [];
|
|
64
62
|
const evmNetwork = evmNetworks.find((evmNetwork) => evmNetwork.chainId === network);
|
|
65
63
|
const networkIcon = evmNetwork && (jsxRuntime.jsx("img", { src: evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.iconUrls[0], alt: `${evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.name} icon` }));
|
|
66
64
|
const networkName = (evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.vanityName) || (evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.name);
|
|
@@ -85,16 +83,11 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
85
83
|
to: recipientAddress,
|
|
86
84
|
value,
|
|
87
85
|
};
|
|
88
|
-
return (jsxRuntime.jsx(
|
|
86
|
+
return (jsxRuntime.jsx(TransactionStage.TransactionStage, { walletConnector: walletConnector, provider: provider, transaction: transaction, title: 'Confirm transaction', onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (transaction) => {
|
|
89
87
|
transactionRef.current = transaction;
|
|
90
88
|
setStage('success');
|
|
91
89
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(transactionRef.current);
|
|
92
|
-
}
|
|
93
|
-
walletUiUtils.disabledConfirmationOnce();
|
|
94
|
-
const signer = provider.getSigner();
|
|
95
|
-
const sentTransaction = yield signer.sendTransaction(transaction);
|
|
96
|
-
return sentTransaction;
|
|
97
|
-
}) }));
|
|
90
|
+
} }));
|
|
98
91
|
};
|
|
99
92
|
const buildSuccessState = () => {
|
|
100
93
|
var _a;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
2
1
|
import { jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { useState, useRef } from 'react';
|
|
4
3
|
import { utils } from 'ethers';
|
|
@@ -35,9 +34,9 @@ import '../../components/Popper/Popper/Popper.js';
|
|
|
35
34
|
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
36
35
|
import { SendBalancePageLayout } from '../../components/SendBalancePageLayout/SendBalancePageLayout.js';
|
|
37
36
|
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
38
|
-
import { TransactionConfirmationView } from '../TransactionConfirmationView/TransactionConfirmationView.js';
|
|
39
|
-
import { TransactionStatusLayout } from '../../components/TransactionStatusLayout/TransactionStatusLayout.js';
|
|
40
37
|
import { useFetchCurrency } from '../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.js';
|
|
38
|
+
import { TransactionStatusLayout } from '../../components/TransactionStatusLayout/TransactionStatusLayout.js';
|
|
39
|
+
import { TransactionStage } from './components/TransactionStage/TransactionStage.js';
|
|
41
40
|
import '../../context/MockContext/MockContext.js';
|
|
42
41
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
43
42
|
import { usePromise } from '../../utils/hooks/usePromise/usePromise.js';
|
|
@@ -45,18 +44,17 @@ import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
|
45
44
|
|
|
46
45
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
47
46
|
const [stage, setStage] = useState('form');
|
|
48
|
-
const { primaryWallet,
|
|
47
|
+
const { primaryWallet, network } = useInternalDynamicContext();
|
|
49
48
|
const [value, setValue] = useState(initialValue !== null && initialValue !== void 0 ? initialValue : null);
|
|
50
49
|
const [recipientAddress, setRecipientAddress] = useState(initialRecipientAddress);
|
|
51
50
|
const transactionRef = useRef(null);
|
|
52
51
|
if (!primaryWallet) {
|
|
53
52
|
throw new DynamicError('Primary wallet is not available, send balance cannot be displayed');
|
|
54
53
|
}
|
|
55
|
-
const
|
|
56
|
-
const { data:
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
[];
|
|
54
|
+
const walletConnector = primaryWallet.connector;
|
|
55
|
+
const { data: balance } = usePromise(() => walletConnector.getBalance(), [walletConnector]);
|
|
56
|
+
const { data: provider } = usePromise(() => walletConnector.getWeb3Provider(), [walletConnector]);
|
|
57
|
+
const evmNetworks = (walletConnector && walletConnector.evmNetworks) || [];
|
|
60
58
|
const evmNetwork = evmNetworks.find((evmNetwork) => evmNetwork.chainId === network);
|
|
61
59
|
const networkIcon = evmNetwork && (jsx("img", { src: evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.iconUrls[0], alt: `${evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.name} icon` }));
|
|
62
60
|
const networkName = (evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.vanityName) || (evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.name);
|
|
@@ -81,16 +79,11 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
81
79
|
to: recipientAddress,
|
|
82
80
|
value,
|
|
83
81
|
};
|
|
84
|
-
return (jsx(
|
|
82
|
+
return (jsx(TransactionStage, { walletConnector: walletConnector, provider: provider, transaction: transaction, title: 'Confirm transaction', onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (transaction) => {
|
|
85
83
|
transactionRef.current = transaction;
|
|
86
84
|
setStage('success');
|
|
87
85
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(transactionRef.current);
|
|
88
|
-
}
|
|
89
|
-
walletUiUtils.disabledConfirmationOnce();
|
|
90
|
-
const signer = provider.getSigner();
|
|
91
|
-
const sentTransaction = yield signer.sendTransaction(transaction);
|
|
92
|
-
return sentTransaction;
|
|
93
|
-
}) }));
|
|
86
|
+
} }));
|
|
94
87
|
};
|
|
95
88
|
const buildSuccessState = () => {
|
|
96
89
|
var _a;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
require('react');
|
|
8
|
+
require('@dynamic-labs/utils');
|
|
9
|
+
require('@dynamic-labs/sdk-api');
|
|
10
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
11
|
+
require('../../../../shared/logger.cjs');
|
|
12
|
+
require('../../../../config/LSSuffix.cjs');
|
|
13
|
+
require('@dynamic-labs/iconic');
|
|
14
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
15
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
16
|
+
require('../../../../utils/constants/colors.cjs');
|
|
17
|
+
require('ethers');
|
|
18
|
+
require('../../../../shared/consts/index.cjs');
|
|
19
|
+
require('@dynamic-labs/multi-wallet');
|
|
20
|
+
var isMagicConnector = require('../../../../utils/functions/isMagicConnector/isMagicConnector.cjs');
|
|
21
|
+
require('@dynamic-labs/rpc-providers');
|
|
22
|
+
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
23
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
24
|
+
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
25
|
+
require('react-dom');
|
|
26
|
+
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
27
|
+
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
28
|
+
require('react-focus-lock');
|
|
29
|
+
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
30
|
+
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
31
|
+
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
32
|
+
require('../../../../components/IconButton/IconButton.cjs');
|
|
33
|
+
require('../../../../components/Alert/Alert.cjs');
|
|
34
|
+
require('@dynamic-labs/wallet-book');
|
|
35
|
+
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
36
|
+
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
37
|
+
require('formik');
|
|
38
|
+
require('yup');
|
|
39
|
+
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
40
|
+
var TransactionConfirmationView = require('../../../TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
41
|
+
require('../../../../context/MockContext/MockContext.cjs');
|
|
42
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
43
|
+
require('../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
44
|
+
var useTransactionWithGasPrice = require('../../../../utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.cjs');
|
|
45
|
+
|
|
46
|
+
const TransactionStage = (_a) => {
|
|
47
|
+
var { transaction, provider, walletConnector } = _a, rest = _tslib.__rest(_a, ["transaction", "provider", "walletConnector"]);
|
|
48
|
+
const { disableWalletConfirmationOnce } = useInternalDynamicContext.useInternalDynamicContext();
|
|
49
|
+
const transactionWithGasPrice = useTransactionWithGasPrice.useTransactionWithGasPrice({
|
|
50
|
+
enabled: isMagicConnector.isMagicConnector(walletConnector),
|
|
51
|
+
increasePercentage: 5,
|
|
52
|
+
provider,
|
|
53
|
+
transaction,
|
|
54
|
+
});
|
|
55
|
+
return (jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
disableWalletConfirmationOnce();
|
|
57
|
+
const signer = provider.getSigner();
|
|
58
|
+
const sentTransaction = yield signer.sendTransaction(transactionWithGasPrice);
|
|
59
|
+
return sentTransaction;
|
|
60
|
+
}) }, rest)));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.TransactionStage = TransactionStage;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { TransactionConfirmationViewProps } from '../../../TransactionConfirmationView';
|
|
4
|
+
type TransactionStageProps = Omit<TransactionConfirmationViewProps, 'mutation'> & {
|
|
5
|
+
walletConnector: WalletConnector;
|
|
6
|
+
};
|
|
7
|
+
export declare const TransactionStage: FC<TransactionStageProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { __rest, __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import 'react';
|
|
4
|
+
import '@dynamic-labs/utils';
|
|
5
|
+
import '@dynamic-labs/sdk-api';
|
|
6
|
+
import '../../../../config/ApiEndpoint.js';
|
|
7
|
+
import '../../../../shared/logger.js';
|
|
8
|
+
import '../../../../config/LSSuffix.js';
|
|
9
|
+
import '@dynamic-labs/iconic';
|
|
10
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
11
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
12
|
+
import '../../../../utils/constants/colors.js';
|
|
13
|
+
import 'ethers';
|
|
14
|
+
import '../../../../shared/consts/index.js';
|
|
15
|
+
import '@dynamic-labs/multi-wallet';
|
|
16
|
+
import { isMagicConnector } from '../../../../utils/functions/isMagicConnector/isMagicConnector.js';
|
|
17
|
+
import '@dynamic-labs/rpc-providers';
|
|
18
|
+
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
19
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
20
|
+
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
21
|
+
import 'react-dom';
|
|
22
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
23
|
+
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
24
|
+
import 'react-focus-lock';
|
|
25
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
26
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
27
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
28
|
+
import '../../../../components/IconButton/IconButton.js';
|
|
29
|
+
import '../../../../components/Alert/Alert.js';
|
|
30
|
+
import '@dynamic-labs/wallet-book';
|
|
31
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
32
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
33
|
+
import 'formik';
|
|
34
|
+
import 'yup';
|
|
35
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
36
|
+
import { TransactionConfirmationView } from '../../../TransactionConfirmationView/TransactionConfirmationView.js';
|
|
37
|
+
import '../../../../context/MockContext/MockContext.js';
|
|
38
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
39
|
+
import '../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
40
|
+
import { useTransactionWithGasPrice } from '../../../../utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.js';
|
|
41
|
+
|
|
42
|
+
const TransactionStage = (_a) => {
|
|
43
|
+
var { transaction, provider, walletConnector } = _a, rest = __rest(_a, ["transaction", "provider", "walletConnector"]);
|
|
44
|
+
const { disableWalletConfirmationOnce } = useInternalDynamicContext();
|
|
45
|
+
const transactionWithGasPrice = useTransactionWithGasPrice({
|
|
46
|
+
enabled: isMagicConnector(walletConnector),
|
|
47
|
+
increasePercentage: 5,
|
|
48
|
+
provider,
|
|
49
|
+
transaction,
|
|
50
|
+
});
|
|
51
|
+
return (jsx(TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
disableWalletConfirmationOnce();
|
|
53
|
+
const signer = provider.getSigner();
|
|
54
|
+
const sentTransaction = yield signer.sendTransaction(transactionWithGasPrice);
|
|
55
|
+
return sentTransaction;
|
|
56
|
+
}) }, rest)));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { TransactionStage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TransactionStage } from './TransactionStage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TransactionStage';
|