@dynamic-labs/sdk-react-core 4.5.3 → 4.6.0
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 +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +3 -1
- package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +1 -0
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +2 -1
- package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.cjs +2 -1
- package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.js +2 -1
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +31 -4
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +31 -4
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.cjs +2 -1
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.js +3 -2
- package/src/lib/data/api/user/user.cjs +10 -0
- package/src/lib/data/api/user/user.d.ts +1 -0
- package/src/lib/data/api/user/user.js +10 -1
- package/src/lib/store/state/projectSettings/projectSettings.cjs +1 -0
- package/src/lib/store/state/projectSettings/projectSettings.d.ts +3 -1
- package/src/lib/store/state/projectSettings/projectSettings.js +1 -0
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.cjs +6 -4
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.d.ts +6 -3
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.js +6 -4
- package/src/lib/utils/hooks/useDeleteUserAccount/index.d.ts +1 -0
- package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.cjs +119 -0
- package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.d.ts +7 -0
- package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.js +115 -0
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.cjs +9 -3
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.js +10 -4
- package/src/lib/utils/hooks/useFundWithWallet/utils/FilterWalletsForExternalFunding.cjs +27 -0
- package/src/lib/utils/hooks/useFundWithWallet/utils/FilterWalletsForExternalFunding.d.ts +2 -0
- package/src/lib/utils/hooks/useFundWithWallet/utils/FilterWalletsForExternalFunding.js +23 -0
- package/src/lib/utils/hooks/useFundWithWallet/utils/index.d.ts +1 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +2 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.cjs +14 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.js +14 -1
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/getPromptAmountParams.cjs +25 -0
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/getPromptAmountParams.d.ts +7 -0
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/getPromptAmountParams.js +21 -0
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/useStartExternalWalletFunding.cjs +5 -23
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/useStartExternalWalletFunding.js +5 -23
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
require('@dynamic-labs/utils');
|
|
9
|
+
require('@dynamic-labs/sdk-api-core');
|
|
10
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
11
|
+
require('../../constants/values.cjs');
|
|
12
|
+
require('@dynamic-labs/multi-wallet');
|
|
13
|
+
require('../../../shared/logger.cjs');
|
|
14
|
+
require('../../constants/colors.cjs');
|
|
15
|
+
require('react-international-phone');
|
|
16
|
+
require('@dynamic-labs/iconic');
|
|
17
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
18
|
+
require('react/jsx-runtime');
|
|
19
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
20
|
+
require('@dynamic-labs/wallet-book');
|
|
21
|
+
require('../../../shared/consts/index.cjs');
|
|
22
|
+
require('../../../store/state/nonce/nonce.cjs');
|
|
23
|
+
require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
24
|
+
var dynamicContextProps = require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
25
|
+
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
26
|
+
require('../../../store/state/user/user.cjs');
|
|
27
|
+
require('../../../locale/locale.cjs');
|
|
28
|
+
var user = require('../../../data/api/user/user.cjs');
|
|
29
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
30
|
+
require('../../../events/dynamicEvents.cjs');
|
|
31
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
32
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
33
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
34
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
35
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
36
|
+
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
37
|
+
require('react-dom');
|
|
38
|
+
require('../../functions/compareChains/compareChains.cjs');
|
|
39
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
40
|
+
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
41
|
+
require('bs58');
|
|
42
|
+
require('@dynamic-labs/types');
|
|
43
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
44
|
+
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
45
|
+
require('../../../context/WalletContext/WalletContext.cjs');
|
|
46
|
+
require('../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
47
|
+
require('yup');
|
|
48
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
49
|
+
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
50
|
+
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
51
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
52
|
+
require('@dynamic-labs/rpc-providers');
|
|
53
|
+
require('../../../store/state/loadingAndLifecycle.cjs');
|
|
54
|
+
require('@dynamic-labs/store');
|
|
55
|
+
require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
56
|
+
require('react-i18next');
|
|
57
|
+
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
58
|
+
require('../../../components/Alert/Alert.cjs');
|
|
59
|
+
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
60
|
+
require('../../../components/IconButton/IconButton.cjs');
|
|
61
|
+
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
62
|
+
require('../../../components/Input/Input.cjs');
|
|
63
|
+
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
64
|
+
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
65
|
+
require('../../../components/OverlayCard/OverlayCard.cjs');
|
|
66
|
+
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
67
|
+
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
68
|
+
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
69
|
+
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
70
|
+
require('../../../components/Popper/Popper/Popper.cjs');
|
|
71
|
+
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
72
|
+
require('react-focus-lock');
|
|
73
|
+
require('qrcode');
|
|
74
|
+
require('formik');
|
|
75
|
+
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
76
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
77
|
+
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
78
|
+
require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
79
|
+
require('../../../context/ConnectWithOtpContext/constants.cjs');
|
|
80
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
81
|
+
require('@hcaptcha/react-hcaptcha');
|
|
82
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
83
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
84
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
85
|
+
require('../../../store/state/sendBalances.cjs');
|
|
86
|
+
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
87
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
88
|
+
require('../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
89
|
+
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
90
|
+
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
91
|
+
require('../../../widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.cjs');
|
|
92
|
+
require('../../../../index.cjs');
|
|
93
|
+
require('../../../store/state/tokenBalances.cjs');
|
|
94
|
+
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
95
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
96
|
+
|
|
97
|
+
const useDeleteUserAccount = () => {
|
|
98
|
+
const environmentId = dynamicContextProps.useEnvironmentId();
|
|
99
|
+
const { handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
|
|
100
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
101
|
+
const [error, setError] = React.useState(null);
|
|
102
|
+
const deleteUser = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
103
|
+
try {
|
|
104
|
+
setIsLoading(true);
|
|
105
|
+
setError(null);
|
|
106
|
+
yield user.hardDeleteUser(environmentId);
|
|
107
|
+
yield handleLogOut();
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
setError(err);
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
setIsLoading(false);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return { deleteUser, error, isLoading };
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
exports.useDeleteUserAccount = useDeleteUserAccount;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import '@dynamic-labs/utils';
|
|
5
|
+
import '@dynamic-labs/sdk-api-core';
|
|
6
|
+
import '../../../config/ApiEndpoint.js';
|
|
7
|
+
import '../../constants/values.js';
|
|
8
|
+
import '@dynamic-labs/multi-wallet';
|
|
9
|
+
import '../../../shared/logger.js';
|
|
10
|
+
import '../../constants/colors.js';
|
|
11
|
+
import 'react-international-phone';
|
|
12
|
+
import '@dynamic-labs/iconic';
|
|
13
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
14
|
+
import 'react/jsx-runtime';
|
|
15
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
16
|
+
import '@dynamic-labs/wallet-book';
|
|
17
|
+
import '../../../shared/consts/index.js';
|
|
18
|
+
import '../../../store/state/nonce/nonce.js';
|
|
19
|
+
import '../../../store/state/projectSettings/projectSettings.js';
|
|
20
|
+
import { useEnvironmentId } from '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
21
|
+
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
22
|
+
import '../../../store/state/user/user.js';
|
|
23
|
+
import '../../../locale/locale.js';
|
|
24
|
+
import { hardDeleteUser } from '../../../data/api/user/user.js';
|
|
25
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
26
|
+
import '../../../events/dynamicEvents.js';
|
|
27
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
28
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
29
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
30
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
31
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
32
|
+
import '../../../context/VerificationContext/VerificationContext.js';
|
|
33
|
+
import 'react-dom';
|
|
34
|
+
import '../../functions/compareChains/compareChains.js';
|
|
35
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
36
|
+
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
37
|
+
import 'bs58';
|
|
38
|
+
import '@dynamic-labs/types';
|
|
39
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
40
|
+
import '../../../context/LoadingContext/LoadingContext.js';
|
|
41
|
+
import '../../../context/WalletContext/WalletContext.js';
|
|
42
|
+
import '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
43
|
+
import 'yup';
|
|
44
|
+
import '../../../context/MockContext/MockContext.js';
|
|
45
|
+
import '../../../views/CollectUserDataView/useFields.js';
|
|
46
|
+
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
47
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
48
|
+
import '@dynamic-labs/rpc-providers';
|
|
49
|
+
import '../../../store/state/loadingAndLifecycle.js';
|
|
50
|
+
import '@dynamic-labs/store';
|
|
51
|
+
import '../../../store/state/walletOptions/walletOptions.js';
|
|
52
|
+
import 'react-i18next';
|
|
53
|
+
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
54
|
+
import '../../../components/Alert/Alert.js';
|
|
55
|
+
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
56
|
+
import '../../../components/IconButton/IconButton.js';
|
|
57
|
+
import '../../../components/InlineWidget/InlineWidget.js';
|
|
58
|
+
import '../../../components/Input/Input.js';
|
|
59
|
+
import '../../../components/IsBrowser/IsBrowser.js';
|
|
60
|
+
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
61
|
+
import '../../../components/OverlayCard/OverlayCard.js';
|
|
62
|
+
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
63
|
+
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
64
|
+
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
65
|
+
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
66
|
+
import '../../../components/Popper/Popper/Popper.js';
|
|
67
|
+
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
68
|
+
import 'react-focus-lock';
|
|
69
|
+
import 'qrcode';
|
|
70
|
+
import 'formik';
|
|
71
|
+
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
72
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
73
|
+
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
74
|
+
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
75
|
+
import '../../../context/ConnectWithOtpContext/constants.js';
|
|
76
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
77
|
+
import '@hcaptcha/react-hcaptcha';
|
|
78
|
+
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
79
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
80
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
81
|
+
import '../../../store/state/sendBalances.js';
|
|
82
|
+
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
83
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
84
|
+
import '../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
85
|
+
import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
86
|
+
import '../../../context/OnrampContext/OnrampContext.js';
|
|
87
|
+
import '../../../widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.js';
|
|
88
|
+
import '../../../../index.js';
|
|
89
|
+
import '../../../store/state/tokenBalances.js';
|
|
90
|
+
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
91
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
92
|
+
|
|
93
|
+
const useDeleteUserAccount = () => {
|
|
94
|
+
const environmentId = useEnvironmentId();
|
|
95
|
+
const { handleLogOut } = useInternalDynamicContext();
|
|
96
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
97
|
+
const [error, setError] = useState(null);
|
|
98
|
+
const deleteUser = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
99
|
+
try {
|
|
100
|
+
setIsLoading(true);
|
|
101
|
+
setError(null);
|
|
102
|
+
yield hardDeleteUser(environmentId);
|
|
103
|
+
yield handleLogOut();
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
setError(err);
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
setIsLoading(false);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return { deleteUser, error, isLoading };
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export { useDeleteUserAccount };
|
|
@@ -93,6 +93,7 @@ require('../../../../context/OnrampContext/OnrampContext.cjs');
|
|
|
93
93
|
var rejectPromiseRef = require('../../../functions/rejectPromiseRef/rejectPromiseRef.cjs');
|
|
94
94
|
var resolvePromiseRef = require('../../../functions/resolvePromiseRef/resolvePromiseRef.cjs');
|
|
95
95
|
var useWalletOptions = require('../../useWalletOptions/useWalletOptions.cjs');
|
|
96
|
+
var FilterWalletsForExternalFunding = require('../utils/FilterWalletsForExternalFunding.cjs');
|
|
96
97
|
require('../../../../widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.cjs');
|
|
97
98
|
require('../../../../../index.cjs');
|
|
98
99
|
require('../../../../store/state/tokenBalances.cjs');
|
|
@@ -107,6 +108,13 @@ const useConnectWalletForFunding = () => {
|
|
|
107
108
|
const internalConnectionPromiseRef = React.useRef(null);
|
|
108
109
|
const connectWalletPromiseRef = React.useRef(null);
|
|
109
110
|
const handleWalletMethod = React.useCallback((props) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
+
// This is for phantom redirect: store the reason for this connection
|
|
112
|
+
// so we don't lose the flow when redirected back
|
|
113
|
+
const connectionType = {
|
|
114
|
+
connectorConsumed: false,
|
|
115
|
+
type: 'external-wallet-funding',
|
|
116
|
+
};
|
|
117
|
+
utils.StorageService.setItem(utils.PHANTOM_REDIRECT_CONNECTION_TYPE_KEY, connectionType);
|
|
110
118
|
const address = yield props.walletConnector.getAddress(props.getAddressOpts);
|
|
111
119
|
if (!address) {
|
|
112
120
|
rejectPromiseRef.rejectPromiseRef(internalConnectionPromiseRef, new utils.DynamicError('No wallet address found'));
|
|
@@ -182,9 +190,7 @@ const useConnectWalletForFunding = () => {
|
|
|
182
190
|
}
|
|
183
191
|
}),
|
|
184
192
|
showDefaultFooter: true,
|
|
185
|
-
viewWalletsFilter: (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain)
|
|
186
|
-
? index.FilterChain(primaryWallet.chain)
|
|
187
|
-
: undefined,
|
|
193
|
+
viewWalletsFilter: utils.pipe(FilterWalletsForExternalFunding.FilterWalletsForExternalFunding).pipe(index.FilterChain(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain)),
|
|
188
194
|
});
|
|
189
195
|
setShowAuthFlow(true, {
|
|
190
196
|
emitCancelAuth: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useRef, useCallback } from 'react';
|
|
4
|
-
import { DynamicError, DeferredPromise } from '@dynamic-labs/utils';
|
|
4
|
+
import { StorageService, PHANTOM_REDIRECT_CONNECTION_TYPE_KEY, DynamicError, DeferredPromise, pipe } from '@dynamic-labs/utils';
|
|
5
5
|
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
6
6
|
import '@dynamic-labs/sdk-api-core';
|
|
7
7
|
import '../../../../shared/logger.js';
|
|
@@ -89,6 +89,7 @@ import '../../../../context/OnrampContext/OnrampContext.js';
|
|
|
89
89
|
import { rejectPromiseRef } from '../../../functions/rejectPromiseRef/rejectPromiseRef.js';
|
|
90
90
|
import { resolvePromiseRef } from '../../../functions/resolvePromiseRef/resolvePromiseRef.js';
|
|
91
91
|
import { useWalletOptions } from '../../useWalletOptions/useWalletOptions.js';
|
|
92
|
+
import { FilterWalletsForExternalFunding } from '../utils/FilterWalletsForExternalFunding.js';
|
|
92
93
|
import '../../../../widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.js';
|
|
93
94
|
import '../../../../../index.js';
|
|
94
95
|
import '../../../../store/state/tokenBalances.js';
|
|
@@ -103,6 +104,13 @@ const useConnectWalletForFunding = () => {
|
|
|
103
104
|
const internalConnectionPromiseRef = useRef(null);
|
|
104
105
|
const connectWalletPromiseRef = useRef(null);
|
|
105
106
|
const handleWalletMethod = useCallback((props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
+
// This is for phantom redirect: store the reason for this connection
|
|
108
|
+
// so we don't lose the flow when redirected back
|
|
109
|
+
const connectionType = {
|
|
110
|
+
connectorConsumed: false,
|
|
111
|
+
type: 'external-wallet-funding',
|
|
112
|
+
};
|
|
113
|
+
StorageService.setItem(PHANTOM_REDIRECT_CONNECTION_TYPE_KEY, connectionType);
|
|
106
114
|
const address = yield props.walletConnector.getAddress(props.getAddressOpts);
|
|
107
115
|
if (!address) {
|
|
108
116
|
rejectPromiseRef(internalConnectionPromiseRef, new DynamicError('No wallet address found'));
|
|
@@ -178,9 +186,7 @@ const useConnectWalletForFunding = () => {
|
|
|
178
186
|
}
|
|
179
187
|
}),
|
|
180
188
|
showDefaultFooter: true,
|
|
181
|
-
viewWalletsFilter: (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain)
|
|
182
|
-
? FilterChain(primaryWallet.chain)
|
|
183
|
-
: undefined,
|
|
189
|
+
viewWalletsFilter: pipe(FilterWalletsForExternalFunding).pipe(FilterChain(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain)),
|
|
184
190
|
});
|
|
185
191
|
setShowAuthFlow(true, {
|
|
186
192
|
emitCancelAuth: false,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var utils = require('@dynamic-labs/utils');
|
|
7
|
+
|
|
8
|
+
const SPECIFIC_WALLETS_WITHOUT_REDIRECTS = [
|
|
9
|
+
'coinbase',
|
|
10
|
+
'phantomevm',
|
|
11
|
+
'magiceden',
|
|
12
|
+
];
|
|
13
|
+
const FilterWalletsForExternalFunding = (wallets) => {
|
|
14
|
+
if (!utils.isMobile()) {
|
|
15
|
+
return wallets;
|
|
16
|
+
}
|
|
17
|
+
return wallets.filter((wallet) => {
|
|
18
|
+
if (SPECIFIC_WALLETS_WITHOUT_REDIRECTS.includes(wallet.key)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const mobileCondition = wallet.walletConnector.isWalletConnect ||
|
|
22
|
+
wallet.walletConnector.mobileExperience !== 'in-app-browser';
|
|
23
|
+
return mobileCondition;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.FilterWalletsForExternalFunding = FilterWalletsForExternalFunding;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { isMobile } from '@dynamic-labs/utils';
|
|
3
|
+
|
|
4
|
+
const SPECIFIC_WALLETS_WITHOUT_REDIRECTS = [
|
|
5
|
+
'coinbase',
|
|
6
|
+
'phantomevm',
|
|
7
|
+
'magiceden',
|
|
8
|
+
];
|
|
9
|
+
const FilterWalletsForExternalFunding = (wallets) => {
|
|
10
|
+
if (!isMobile()) {
|
|
11
|
+
return wallets;
|
|
12
|
+
}
|
|
13
|
+
return wallets.filter((wallet) => {
|
|
14
|
+
if (SPECIFIC_WALLETS_WITHOUT_REDIRECTS.includes(wallet.key)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const mobileCondition = wallet.walletConnector.isWalletConnect ||
|
|
18
|
+
wallet.walletConnector.mobileExperience !== 'in-app-browser';
|
|
19
|
+
return mobileCondition;
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { FilterWalletsForExternalFunding };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FilterWalletsForExternalFunding } from './FilterWalletsForExternalFunding';
|
|
@@ -114,6 +114,8 @@ const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLa
|
|
|
114
114
|
provider: sdkApiCore.ProviderEnum.Farcaster,
|
|
115
115
|
type: 'social',
|
|
116
116
|
}, 'user-cancelled');
|
|
117
|
+
// Navigate back to the initial login view.
|
|
118
|
+
clearStackAndPushInitialView();
|
|
117
119
|
},
|
|
118
120
|
}),
|
|
119
121
|
onSettled: () => {
|
|
@@ -110,6 +110,8 @@ const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLa
|
|
|
110
110
|
provider: ProviderEnum.Farcaster,
|
|
111
111
|
type: 'social',
|
|
112
112
|
}, 'user-cancelled');
|
|
113
|
+
// Navigate back to the initial login view.
|
|
114
|
+
clearStackAndPushInitialView();
|
|
113
115
|
},
|
|
114
116
|
}),
|
|
115
117
|
onSettled: () => {
|
|
@@ -42,6 +42,7 @@ require('../../../../../utils/functions/compareChains/compareChains.cjs');
|
|
|
42
42
|
require('../../../../../context/ThemeContext/ThemeContext.cjs');
|
|
43
43
|
require('../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
44
44
|
require('bs58');
|
|
45
|
+
var usePromise = require('../../../../../utils/hooks/usePromise/usePromise.cjs');
|
|
45
46
|
require('@dynamic-labs/types');
|
|
46
47
|
require('../../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
47
48
|
require('../../../../../context/LoadingContext/LoadingContext.cjs');
|
|
@@ -91,6 +92,7 @@ require('../../../../../context/ConnectWithOtpContext/constants.cjs');
|
|
|
91
92
|
require('../../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
92
93
|
require('@hcaptcha/react-hcaptcha');
|
|
93
94
|
require('../../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
95
|
+
var useWalletConnectorNetwork = require('../../../../../utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.cjs');
|
|
94
96
|
require('../../../../../store/state/tokenBalances.cjs');
|
|
95
97
|
require('../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
96
98
|
require('../../../../../components/InlineWidget/InlineWidget.cjs');
|
|
@@ -115,9 +117,20 @@ const getNameIfNoIcon = (wallet) => {
|
|
|
115
117
|
const ActiveWalletAddress = ({ wallet, nameServiceName, menuOption, fullWidth = false, isLoading = false, }) => {
|
|
116
118
|
const { showAlert } = PasskeyContext.usePasskeyContext();
|
|
117
119
|
const header = nameServiceName || getNameIfNoIcon(wallet);
|
|
120
|
+
const { network } = useWalletConnectorNetwork.useWalletConnectorNetwork(wallet === null || wallet === void 0 ? void 0 : wallet.connector);
|
|
121
|
+
const { data: address } = usePromise.usePromise(() => {
|
|
122
|
+
// COSMOS wallet address changes based on which network is selected
|
|
123
|
+
if ((wallet === null || wallet === void 0 ? void 0 : wallet.connector.connectedChain) === 'COSMOS') {
|
|
124
|
+
return wallet === null || wallet === void 0 ? void 0 : wallet.connector.getAddress();
|
|
125
|
+
}
|
|
126
|
+
return wallet === null || wallet === void 0 ? void 0 : wallet.address;
|
|
127
|
+
}, {
|
|
128
|
+
deps: [wallet, network],
|
|
129
|
+
enabled: Boolean(wallet),
|
|
130
|
+
});
|
|
118
131
|
return (jsxRuntime.jsxs("div", { className: 'active-wallet-information__address-container', children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Typography.Typography, { className: fullWidth
|
|
119
132
|
? 'active-wallet-information__handle--full-width'
|
|
120
|
-
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: header }), jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress.shortenWalletAddress(
|
|
133
|
+
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', "data-testid": 'header-text', children: header }), jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress.shortenWalletAddress(address, 4, 4)) })] }), jsxRuntime.jsx(DotsMenu.DotsMenu, { "data-testid": 'dots-menu', options: menuOption, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu', iconOverride: showAlert() ? (jsxRuntime.jsx(IconWithStatus.IconWithStatus, { Icon: () => jsxRuntime.jsx(gear.ReactComponent, { width: 16, height: 16 }), variant: 'yellow' })) : (jsxRuntime.jsx(gear.ReactComponent, { width: 16, height: 16 })) })] }));
|
|
121
134
|
};
|
|
122
135
|
|
|
123
136
|
exports.ActiveWalletAddress = ActiveWalletAddress;
|
|
@@ -38,6 +38,7 @@ import '../../../../../utils/functions/compareChains/compareChains.js';
|
|
|
38
38
|
import '../../../../../context/ThemeContext/ThemeContext.js';
|
|
39
39
|
import '../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
40
40
|
import 'bs58';
|
|
41
|
+
import { usePromise } from '../../../../../utils/hooks/usePromise/usePromise.js';
|
|
41
42
|
import '@dynamic-labs/types';
|
|
42
43
|
import '../../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
43
44
|
import '../../../../../context/LoadingContext/LoadingContext.js';
|
|
@@ -87,6 +88,7 @@ import '../../../../../context/ConnectWithOtpContext/constants.js';
|
|
|
87
88
|
import '../../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
88
89
|
import '@hcaptcha/react-hcaptcha';
|
|
89
90
|
import '../../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
91
|
+
import { useWalletConnectorNetwork } from '../../../../../utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.js';
|
|
90
92
|
import '../../../../../store/state/tokenBalances.js';
|
|
91
93
|
import '../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
92
94
|
import '../../../../../components/InlineWidget/InlineWidget.js';
|
|
@@ -111,9 +113,20 @@ const getNameIfNoIcon = (wallet) => {
|
|
|
111
113
|
const ActiveWalletAddress = ({ wallet, nameServiceName, menuOption, fullWidth = false, isLoading = false, }) => {
|
|
112
114
|
const { showAlert } = usePasskeyContext();
|
|
113
115
|
const header = nameServiceName || getNameIfNoIcon(wallet);
|
|
116
|
+
const { network } = useWalletConnectorNetwork(wallet === null || wallet === void 0 ? void 0 : wallet.connector);
|
|
117
|
+
const { data: address } = usePromise(() => {
|
|
118
|
+
// COSMOS wallet address changes based on which network is selected
|
|
119
|
+
if ((wallet === null || wallet === void 0 ? void 0 : wallet.connector.connectedChain) === 'COSMOS') {
|
|
120
|
+
return wallet === null || wallet === void 0 ? void 0 : wallet.connector.getAddress();
|
|
121
|
+
}
|
|
122
|
+
return wallet === null || wallet === void 0 ? void 0 : wallet.address;
|
|
123
|
+
}, {
|
|
124
|
+
deps: [wallet, network],
|
|
125
|
+
enabled: Boolean(wallet),
|
|
126
|
+
});
|
|
114
127
|
return (jsxs("div", { className: 'active-wallet-information__address-container', children: [jsxs("div", { children: [jsx(Typography, { className: fullWidth
|
|
115
128
|
? 'active-wallet-information__handle--full-width'
|
|
116
|
-
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: header }), jsx(Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsx(Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress(
|
|
129
|
+
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', "data-testid": 'header-text', children: header }), jsx(Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsx(Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress(address, 4, 4)) })] }), jsx(DotsMenu, { "data-testid": 'dots-menu', options: menuOption, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu', iconOverride: showAlert() ? (jsx(IconWithStatus, { Icon: () => jsx(SvgGear, { width: 16, height: 16 }), variant: 'yellow' })) : (jsx(SvgGear, { width: 16, height: 16 })) })] }));
|
|
117
130
|
};
|
|
118
131
|
|
|
119
132
|
export { ActiveWalletAddress, getNameIfNoIcon };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var utils = require('@dynamic-labs/utils');
|
|
7
|
+
var projectSettings = require('../../../../../../../store/state/projectSettings/projectSettings.cjs');
|
|
8
|
+
|
|
9
|
+
const getPromptAmountParams = ({ externalWallet, }) => {
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
11
|
+
const walletChain = externalWallet.connector.connectedChain;
|
|
12
|
+
const chainSettings = (_e = (_d = (_c = (_b = (_a = projectSettings.getProjectSettings()) === null || _a === void 0 ? void 0 : _a.sdk.funding) === null || _b === void 0 ? void 0 : _b.externalWallets) === null || _c === void 0 ? void 0 : _c.defaultSettings) === null || _d === void 0 ? void 0 : _d.chainSettings) === null || _e === void 0 ? void 0 : _e.find(({ chain }) => chain === walletChain);
|
|
13
|
+
// This is always supposed to be present, otherwise there's some backend error
|
|
14
|
+
if (!((_f = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _f === void 0 ? void 0 : _f.value) || !((_g = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _g === void 0 ? void 0 : _g.rule))
|
|
15
|
+
throw new utils.DynamicError(`No external wallet funding chain settings found for chain ${walletChain}`);
|
|
16
|
+
return {
|
|
17
|
+
externalWallet,
|
|
18
|
+
token: {
|
|
19
|
+
rule: chainSettings.token.rule,
|
|
20
|
+
value: chainSettings.token.value,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.getPromptAmountParams = getPromptAmountParams;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Wallet } from '../../../../../../../shared/types/wallets';
|
|
2
|
+
import { ReceiveExternalWalletFundsProps } from '../../../../ReceiveExternalWalletFunds/types';
|
|
3
|
+
type GetPromptAmountParamsProps = {
|
|
4
|
+
externalWallet: Wallet;
|
|
5
|
+
};
|
|
6
|
+
export declare const getPromptAmountParams: ({ externalWallet, }: GetPromptAmountParamsProps) => ReceiveExternalWalletFundsProps;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
3
|
+
import { getProjectSettings } from '../../../../../../../store/state/projectSettings/projectSettings.js';
|
|
4
|
+
|
|
5
|
+
const getPromptAmountParams = ({ externalWallet, }) => {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
7
|
+
const walletChain = externalWallet.connector.connectedChain;
|
|
8
|
+
const chainSettings = (_e = (_d = (_c = (_b = (_a = getProjectSettings()) === null || _a === void 0 ? void 0 : _a.sdk.funding) === null || _b === void 0 ? void 0 : _b.externalWallets) === null || _c === void 0 ? void 0 : _c.defaultSettings) === null || _d === void 0 ? void 0 : _d.chainSettings) === null || _e === void 0 ? void 0 : _e.find(({ chain }) => chain === walletChain);
|
|
9
|
+
// This is always supposed to be present, otherwise there's some backend error
|
|
10
|
+
if (!((_f = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _f === void 0 ? void 0 : _f.value) || !((_g = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _g === void 0 ? void 0 : _g.rule))
|
|
11
|
+
throw new DynamicError(`No external wallet funding chain settings found for chain ${walletChain}`);
|
|
12
|
+
return {
|
|
13
|
+
externalWallet,
|
|
14
|
+
token: {
|
|
15
|
+
rule: chainSettings.token.rule,
|
|
16
|
+
value: chainSettings.token.value,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { getPromptAmountParams };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getPromptAmountParams';
|
|
@@ -5,39 +5,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var utils = require('@dynamic-labs/utils');
|
|
9
|
-
var projectSettings = require('../../../../../../store/state/projectSettings/projectSettings.cjs');
|
|
10
8
|
var useFundWithWallet = require('../../../../../../utils/hooks/useFundWithWallet/useFundWithWallet.cjs');
|
|
9
|
+
var getPromptAmountParams = require('./getPromptAmountParams/getPromptAmountParams.cjs');
|
|
11
10
|
|
|
12
11
|
const useStartExternalWalletFunding = () => {
|
|
13
|
-
var _a, _b, _c;
|
|
14
12
|
const { connectWalletForFunding, promptAmountAndFund } = useFundWithWallet.useFundWithWallet();
|
|
15
|
-
const settings = projectSettings.useProjectSettings();
|
|
16
13
|
return React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
var _d, _e, _f, _g, _h, _j;
|
|
18
14
|
try {
|
|
19
15
|
const externalWallet = yield connectWalletForFunding();
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
// This is always supposed to be present, otherwise there's some backend error
|
|
23
|
-
if (!((_h = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _h === void 0 ? void 0 : _h.value) || !((_j = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _j === void 0 ? void 0 : _j.rule))
|
|
24
|
-
throw new utils.DynamicError(`No external wallet funding chain settings found for chain ${walletChain}`);
|
|
25
|
-
promptAmountAndFund({
|
|
26
|
-
externalWallet,
|
|
27
|
-
token: {
|
|
28
|
-
rule: chainSettings.token.rule,
|
|
29
|
-
value: chainSettings.token.value,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
16
|
+
const props = getPromptAmountParams.getPromptAmountParams({ externalWallet });
|
|
17
|
+
promptAmountAndFund(props);
|
|
32
18
|
}
|
|
33
|
-
catch (
|
|
19
|
+
catch (_a) {
|
|
34
20
|
/* empty */
|
|
35
21
|
}
|
|
36
|
-
}), [
|
|
37
|
-
connectWalletForFunding,
|
|
38
|
-
promptAmountAndFund,
|
|
39
|
-
(_c = (_b = (_a = settings === null || settings === void 0 ? void 0 : settings.sdk.funding) === null || _a === void 0 ? void 0 : _a.externalWallets) === null || _b === void 0 ? void 0 : _b.defaultSettings) === null || _c === void 0 ? void 0 : _c.chainSettings,
|
|
40
|
-
]);
|
|
22
|
+
}), [connectWalletForFunding, promptAmountAndFund]);
|
|
41
23
|
};
|
|
42
24
|
|
|
43
25
|
exports.useStartExternalWalletFunding = useStartExternalWalletFunding;
|