@dynamic-labs/sdk-react-core 4.29.1 → 4.29.3
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 +14 -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 -0
- package/src/index.js +1 -0
- package/src/lib/Main.cjs +1 -1
- package/src/lib/Main.js +1 -1
- package/src/lib/client/extension/user/useOnboardingCompleteUser/useOnboardingCompleteUser.js +1 -1
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.cjs +11 -13
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.d.ts +2 -1
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.js +11 -13
- package/src/lib/components/TransactionCard/TransactionCard.cjs +8 -11
- package/src/lib/components/TransactionCard/TransactionCard.js +8 -11
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +2 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +2 -2
- package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.cjs +2 -2
- package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.js +2 -2
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useConnectUnifiedForFunding/useConnectUnifiedForFunding.cjs +201 -0
- package/src/lib/utils/hooks/useConnectUnifiedForFunding/useConnectUnifiedForFunding.js +197 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +5 -2
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +1 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +5 -2
- package/src/lib/utils/hooks/usePayWithDynamic/index.d.ts +1 -1
- package/src/lib/utils/hooks/usePayWithDynamic/usePayWithDynamic.cjs +284 -0
- package/src/lib/utils/hooks/usePayWithDynamic/usePayWithDynamic.js +280 -0
- package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.cjs +1 -0
- package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.d.ts +2 -0
- package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.js +1 -0
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +2 -2
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +2 -2
|
@@ -66,6 +66,8 @@ require('../../store/state/tokenBalances.cjs');
|
|
|
66
66
|
require('../../store/state/multichainBalances.cjs');
|
|
67
67
|
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
68
68
|
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
69
|
+
require('../../context/OnrampContext/OnrampContext.cjs');
|
|
70
|
+
require('../../../index.cjs');
|
|
69
71
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
70
72
|
require('../../components/IconButton/IconButton.cjs');
|
|
71
73
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
@@ -93,13 +95,11 @@ require('../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
|
93
95
|
require('../../context/FooterAnimationContext/index.cjs');
|
|
94
96
|
require('../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.cjs');
|
|
95
97
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
96
|
-
require('../../context/OnrampContext/OnrampContext.cjs');
|
|
97
98
|
require('../../store/state/sendBalances.cjs');
|
|
98
99
|
require('../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
99
100
|
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
100
101
|
require('../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
101
102
|
require('../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
102
|
-
require('../../../index.cjs');
|
|
103
103
|
require('../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
104
104
|
var useConfirmationPortal = require('../../utils/hooks/useConfirmationPortal/useConfirmationPortal.cjs');
|
|
105
105
|
var SyncWalletView = require('../../views/SyncWalletView/SyncWalletView.cjs');
|
|
@@ -62,6 +62,8 @@ import '../../store/state/tokenBalances.js';
|
|
|
62
62
|
import '../../store/state/multichainBalances.js';
|
|
63
63
|
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
64
64
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
65
|
+
import '../../context/OnrampContext/OnrampContext.js';
|
|
66
|
+
import '../../../index.js';
|
|
65
67
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
66
68
|
import '../../components/IconButton/IconButton.js';
|
|
67
69
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
@@ -89,13 +91,11 @@ import '../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
|
89
91
|
import '../../context/FooterAnimationContext/index.js';
|
|
90
92
|
import '../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.js';
|
|
91
93
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
92
|
-
import '../../context/OnrampContext/OnrampContext.js';
|
|
93
94
|
import '../../store/state/sendBalances.js';
|
|
94
95
|
import '../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
95
96
|
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
96
97
|
import '../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
97
98
|
import '../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
98
|
-
import '../../../index.js';
|
|
99
99
|
import '../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
100
100
|
import { useConfirmationPortal } from '../../utils/hooks/useConfirmationPortal/useConfirmationPortal.js';
|
|
101
101
|
import { SyncWalletView } from '../../views/SyncWalletView/SyncWalletView.js';
|
|
@@ -81,6 +81,7 @@ export { useExchangeAccounts } from './useExchangeAccounts';
|
|
|
81
81
|
export { useConnectExchangeForFunding } from './useConnectExchangeForFunding';
|
|
82
82
|
export { useClientSessionKeys } from './useClientSessionKeys';
|
|
83
83
|
export { usePromptAmountAndFundWithExchange } from './usePromptAndFundWithExchange';
|
|
84
|
+
export { usePayWithDynamic, type PayWithDynamicProps, } from './usePayWithDynamic';
|
|
84
85
|
export { useSubmitExchangeFunding } from './useSubmitExchangeFunding';
|
|
85
86
|
export { useGetPasskeys } from './useGetPasskeys';
|
|
86
87
|
export { useRegisterPasskey } from './useRegisterPasskey';
|
|
@@ -0,0 +1,201 @@
|
|
|
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
|
+
var utils = require('@dynamic-labs/utils');
|
|
9
|
+
require('../../../../index.cjs');
|
|
10
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
11
|
+
require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
12
|
+
require('@dynamic-labs/sdk-api-core');
|
|
13
|
+
require('../../../shared/logger.cjs');
|
|
14
|
+
require('@dynamic-labs/iconic');
|
|
15
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
16
|
+
require('react/jsx-runtime');
|
|
17
|
+
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
18
|
+
require('@dynamic-labs/wallet-book');
|
|
19
|
+
require('../../constants/colors.cjs');
|
|
20
|
+
require('../../constants/values.cjs');
|
|
21
|
+
require('../../../shared/consts/index.cjs');
|
|
22
|
+
var useDynamicEvents = require('../events/useDynamicEvents/useDynamicEvents.cjs');
|
|
23
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
24
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
25
|
+
require('@dynamic-labs/multi-wallet');
|
|
26
|
+
require('react-international-phone');
|
|
27
|
+
require('../../../store/state/nonce/nonce.cjs');
|
|
28
|
+
require('@dynamic-labs-sdk/client/core');
|
|
29
|
+
require('../../../client/client.cjs');
|
|
30
|
+
require('@dynamic-labs-sdk/client');
|
|
31
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
32
|
+
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
33
|
+
require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
34
|
+
require('../../../locale/locale.cjs');
|
|
35
|
+
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
36
|
+
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
37
|
+
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
38
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
39
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
40
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
41
|
+
require('../../../store/state/authMode/authMode.cjs');
|
|
42
|
+
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
43
|
+
require('react-dom');
|
|
44
|
+
require('../../functions/compareChains/compareChains.cjs');
|
|
45
|
+
require('../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
46
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
47
|
+
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
48
|
+
require('bs58');
|
|
49
|
+
require('@dynamic-labs/types');
|
|
50
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
51
|
+
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
52
|
+
require('../../../context/WalletContext/WalletContext.cjs');
|
|
53
|
+
require('../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
54
|
+
require('yup');
|
|
55
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
56
|
+
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
57
|
+
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
58
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
59
|
+
require('@dynamic-labs/rpc-providers');
|
|
60
|
+
require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
61
|
+
require('react-i18next');
|
|
62
|
+
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
63
|
+
require('../../../components/Alert/Alert.cjs');
|
|
64
|
+
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
65
|
+
require('../../../components/IconButton/IconButton.cjs');
|
|
66
|
+
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
67
|
+
require('../../../components/Input/Input.cjs');
|
|
68
|
+
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
69
|
+
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
70
|
+
require('../../../components/OverlayCard/OverlayCard.cjs');
|
|
71
|
+
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
72
|
+
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
73
|
+
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
74
|
+
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
75
|
+
require('../../../components/Popper/Popper/Popper.cjs');
|
|
76
|
+
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
77
|
+
require('react-focus-lock');
|
|
78
|
+
require('qrcode');
|
|
79
|
+
require('formik');
|
|
80
|
+
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
81
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
82
|
+
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
83
|
+
require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
84
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
85
|
+
require('@hcaptcha/react-hcaptcha');
|
|
86
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
87
|
+
require('../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
88
|
+
require('../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
89
|
+
require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
90
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
91
|
+
require('../../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.cjs');
|
|
92
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
93
|
+
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
94
|
+
require('../../../store/state/sendBalances.cjs');
|
|
95
|
+
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
96
|
+
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
97
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
98
|
+
require('../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
99
|
+
require('../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
100
|
+
var resolvePromiseRef = require('../../functions/resolvePromiseRef/resolvePromiseRef.cjs');
|
|
101
|
+
var rejectPromiseRef = require('../../functions/rejectPromiseRef/rejectPromiseRef.cjs');
|
|
102
|
+
var useFundingHelpers = require('../useFundingHelpers/useFundingHelpers.cjs');
|
|
103
|
+
require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
104
|
+
require('../../../store/state/tokenBalances.cjs');
|
|
105
|
+
require('../../../store/state/multichainBalances.cjs');
|
|
106
|
+
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
107
|
+
var useFundingExchangeHelpers = require('../useFundingExchangeHelpers/useFundingExchangeHelpers.cjs');
|
|
108
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
109
|
+
|
|
110
|
+
const useConnectUnifiedForFunding = () => {
|
|
111
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
112
|
+
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
113
|
+
const { initiatedByWidgetRef, getWalletAddress, resetWalletConnectSession } = useFundingHelpers.useFundingHelpers();
|
|
114
|
+
const { selectExchangeConfig } = useFundingExchangeHelpers.useFundingExchangeHelpers();
|
|
115
|
+
const promiseRef = React.useRef(null);
|
|
116
|
+
useDynamicEvents.useInternalDynamicEvents('authFlowClose', () => {
|
|
117
|
+
rejectPromiseRef.rejectPromiseRef(promiseRef, new utils.DynamicError('User cancelled'));
|
|
118
|
+
});
|
|
119
|
+
const openList = React.useCallback((initiatedByWidget) => {
|
|
120
|
+
const { onSelectExchange } = selectExchangeConfig({
|
|
121
|
+
initiatedByWidget,
|
|
122
|
+
promiseRef,
|
|
123
|
+
resultBuilder: (exchange) => ({
|
|
124
|
+
exchange,
|
|
125
|
+
kind: 'exchange',
|
|
126
|
+
}),
|
|
127
|
+
});
|
|
128
|
+
clearStackAndPush('unified-wallet-exchange-list', {
|
|
129
|
+
onSelectExchange,
|
|
130
|
+
onSelectOnRamp: (onramp) => {
|
|
131
|
+
if (!promiseRef.current)
|
|
132
|
+
return;
|
|
133
|
+
try {
|
|
134
|
+
initiatedByWidgetRef.current = initiatedByWidget;
|
|
135
|
+
resolvePromiseRef.resolvePromiseRef(promiseRef, {
|
|
136
|
+
kind: 'onramp',
|
|
137
|
+
onramp,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
rejectPromiseRef.rejectPromiseRef(promiseRef, err);
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
setShowAuthFlow(false);
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
onSelectWallet: (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ walletConnector, }) {
|
|
148
|
+
if (!promiseRef.current)
|
|
149
|
+
return;
|
|
150
|
+
try {
|
|
151
|
+
initiatedByWidgetRef.current = initiatedByWidget;
|
|
152
|
+
const walletAddress = yield getWalletAddress(walletConnector);
|
|
153
|
+
if (!walletAddress) {
|
|
154
|
+
rejectPromiseRef.rejectPromiseRef(promiseRef, new utils.DynamicError('No wallet address found'));
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const wallet = walletConnector.createWallet({
|
|
158
|
+
address: walletAddress,
|
|
159
|
+
chain: walletConnector.connectedChain,
|
|
160
|
+
connector: walletConnector,
|
|
161
|
+
id: 'external-funding-wallet',
|
|
162
|
+
isAuthenticated: false,
|
|
163
|
+
key: walletConnector.key,
|
|
164
|
+
});
|
|
165
|
+
resolvePromiseRef.resolvePromiseRef(promiseRef, { kind: 'wallet', wallet });
|
|
166
|
+
dynamicEvents.publicDynamicEvents.emit('walletConnectedForFunding', {
|
|
167
|
+
initiatedByWidget,
|
|
168
|
+
isPhantomRedirect: false,
|
|
169
|
+
wallet,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
rejectPromiseRef.rejectPromiseRef(promiseRef, error);
|
|
174
|
+
}
|
|
175
|
+
}),
|
|
176
|
+
showDefaultFooter: true,
|
|
177
|
+
});
|
|
178
|
+
}, [
|
|
179
|
+
clearStackAndPush,
|
|
180
|
+
getWalletAddress,
|
|
181
|
+
initiatedByWidgetRef,
|
|
182
|
+
selectExchangeConfig,
|
|
183
|
+
setShowAuthFlow,
|
|
184
|
+
]);
|
|
185
|
+
return React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ initiatedByWidget }) {
|
|
186
|
+
if (promiseRef.current)
|
|
187
|
+
return promiseRef.current.promise;
|
|
188
|
+
resetWalletConnectSession();
|
|
189
|
+
promiseRef.current = new utils.DeferredPromise();
|
|
190
|
+
openList(initiatedByWidget);
|
|
191
|
+
setShowAuthFlow(true, {
|
|
192
|
+
emitCancelAuth: false,
|
|
193
|
+
ignoreIfIsEmbeddedWidget: true,
|
|
194
|
+
initializeWalletConnect: true,
|
|
195
|
+
performMultiWalletChecks: false,
|
|
196
|
+
});
|
|
197
|
+
return promiseRef.current.promise;
|
|
198
|
+
}), [openList, resetWalletConnectSession, setShowAuthFlow]);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
exports.useConnectUnifiedForFunding = useConnectUnifiedForFunding;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useRef, useCallback } from 'react';
|
|
4
|
+
import { DynamicError, DeferredPromise } from '@dynamic-labs/utils';
|
|
5
|
+
import '../../../../index.js';
|
|
6
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
7
|
+
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
8
|
+
import '@dynamic-labs/sdk-api-core';
|
|
9
|
+
import '../../../shared/logger.js';
|
|
10
|
+
import '@dynamic-labs/iconic';
|
|
11
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
12
|
+
import 'react/jsx-runtime';
|
|
13
|
+
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
14
|
+
import '@dynamic-labs/wallet-book';
|
|
15
|
+
import '../../constants/colors.js';
|
|
16
|
+
import '../../constants/values.js';
|
|
17
|
+
import '../../../shared/consts/index.js';
|
|
18
|
+
import { useInternalDynamicEvents } from '../events/useDynamicEvents/useDynamicEvents.js';
|
|
19
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
20
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
21
|
+
import '@dynamic-labs/multi-wallet';
|
|
22
|
+
import 'react-international-phone';
|
|
23
|
+
import '../../../store/state/nonce/nonce.js';
|
|
24
|
+
import '@dynamic-labs-sdk/client/core';
|
|
25
|
+
import '../../../client/client.js';
|
|
26
|
+
import '@dynamic-labs-sdk/client';
|
|
27
|
+
import '../../../config/ApiEndpoint.js';
|
|
28
|
+
import { publicDynamicEvents } from '../../../events/dynamicEvents.js';
|
|
29
|
+
import '../../../store/state/projectSettings/projectSettings.js';
|
|
30
|
+
import '../../../locale/locale.js';
|
|
31
|
+
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
32
|
+
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
33
|
+
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
34
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
35
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
36
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
37
|
+
import '../../../store/state/authMode/authMode.js';
|
|
38
|
+
import '../../../context/VerificationContext/VerificationContext.js';
|
|
39
|
+
import 'react-dom';
|
|
40
|
+
import '../../functions/compareChains/compareChains.js';
|
|
41
|
+
import '../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
42
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
43
|
+
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
44
|
+
import 'bs58';
|
|
45
|
+
import '@dynamic-labs/types';
|
|
46
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
47
|
+
import '../../../context/LoadingContext/LoadingContext.js';
|
|
48
|
+
import '../../../context/WalletContext/WalletContext.js';
|
|
49
|
+
import '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
50
|
+
import 'yup';
|
|
51
|
+
import '../../../context/MockContext/MockContext.js';
|
|
52
|
+
import '../../../views/CollectUserDataView/useFields.js';
|
|
53
|
+
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
54
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
55
|
+
import '@dynamic-labs/rpc-providers';
|
|
56
|
+
import '../../../store/state/walletOptions/walletOptions.js';
|
|
57
|
+
import 'react-i18next';
|
|
58
|
+
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
59
|
+
import '../../../components/Alert/Alert.js';
|
|
60
|
+
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
61
|
+
import '../../../components/IconButton/IconButton.js';
|
|
62
|
+
import '../../../components/InlineWidget/InlineWidget.js';
|
|
63
|
+
import '../../../components/Input/Input.js';
|
|
64
|
+
import '../../../components/IsBrowser/IsBrowser.js';
|
|
65
|
+
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
66
|
+
import '../../../components/OverlayCard/OverlayCard.js';
|
|
67
|
+
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
68
|
+
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
69
|
+
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
70
|
+
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
71
|
+
import '../../../components/Popper/Popper/Popper.js';
|
|
72
|
+
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
73
|
+
import 'react-focus-lock';
|
|
74
|
+
import 'qrcode';
|
|
75
|
+
import 'formik';
|
|
76
|
+
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
77
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
78
|
+
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
79
|
+
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
80
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
81
|
+
import '@hcaptcha/react-hcaptcha';
|
|
82
|
+
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
83
|
+
import '../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
84
|
+
import '../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
85
|
+
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
86
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
87
|
+
import '../../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.js';
|
|
88
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
89
|
+
import '../../../context/OnrampContext/OnrampContext.js';
|
|
90
|
+
import '../../../store/state/sendBalances.js';
|
|
91
|
+
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
92
|
+
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
93
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
94
|
+
import '../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
95
|
+
import '../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
96
|
+
import { resolvePromiseRef } from '../../functions/resolvePromiseRef/resolvePromiseRef.js';
|
|
97
|
+
import { rejectPromiseRef } from '../../functions/rejectPromiseRef/rejectPromiseRef.js';
|
|
98
|
+
import { useFundingHelpers } from '../useFundingHelpers/useFundingHelpers.js';
|
|
99
|
+
import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
100
|
+
import '../../../store/state/tokenBalances.js';
|
|
101
|
+
import '../../../store/state/multichainBalances.js';
|
|
102
|
+
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
103
|
+
import { useFundingExchangeHelpers } from '../useFundingExchangeHelpers/useFundingExchangeHelpers.js';
|
|
104
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
105
|
+
|
|
106
|
+
const useConnectUnifiedForFunding = () => {
|
|
107
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
108
|
+
const { clearStackAndPush } = useViewContext();
|
|
109
|
+
const { initiatedByWidgetRef, getWalletAddress, resetWalletConnectSession } = useFundingHelpers();
|
|
110
|
+
const { selectExchangeConfig } = useFundingExchangeHelpers();
|
|
111
|
+
const promiseRef = useRef(null);
|
|
112
|
+
useInternalDynamicEvents('authFlowClose', () => {
|
|
113
|
+
rejectPromiseRef(promiseRef, new DynamicError('User cancelled'));
|
|
114
|
+
});
|
|
115
|
+
const openList = useCallback((initiatedByWidget) => {
|
|
116
|
+
const { onSelectExchange } = selectExchangeConfig({
|
|
117
|
+
initiatedByWidget,
|
|
118
|
+
promiseRef,
|
|
119
|
+
resultBuilder: (exchange) => ({
|
|
120
|
+
exchange,
|
|
121
|
+
kind: 'exchange',
|
|
122
|
+
}),
|
|
123
|
+
});
|
|
124
|
+
clearStackAndPush('unified-wallet-exchange-list', {
|
|
125
|
+
onSelectExchange,
|
|
126
|
+
onSelectOnRamp: (onramp) => {
|
|
127
|
+
if (!promiseRef.current)
|
|
128
|
+
return;
|
|
129
|
+
try {
|
|
130
|
+
initiatedByWidgetRef.current = initiatedByWidget;
|
|
131
|
+
resolvePromiseRef(promiseRef, {
|
|
132
|
+
kind: 'onramp',
|
|
133
|
+
onramp,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
rejectPromiseRef(promiseRef, err);
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
setShowAuthFlow(false);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
onSelectWallet: (_a) => __awaiter(void 0, [_a], void 0, function* ({ walletConnector, }) {
|
|
144
|
+
if (!promiseRef.current)
|
|
145
|
+
return;
|
|
146
|
+
try {
|
|
147
|
+
initiatedByWidgetRef.current = initiatedByWidget;
|
|
148
|
+
const walletAddress = yield getWalletAddress(walletConnector);
|
|
149
|
+
if (!walletAddress) {
|
|
150
|
+
rejectPromiseRef(promiseRef, new DynamicError('No wallet address found'));
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const wallet = walletConnector.createWallet({
|
|
154
|
+
address: walletAddress,
|
|
155
|
+
chain: walletConnector.connectedChain,
|
|
156
|
+
connector: walletConnector,
|
|
157
|
+
id: 'external-funding-wallet',
|
|
158
|
+
isAuthenticated: false,
|
|
159
|
+
key: walletConnector.key,
|
|
160
|
+
});
|
|
161
|
+
resolvePromiseRef(promiseRef, { kind: 'wallet', wallet });
|
|
162
|
+
publicDynamicEvents.emit('walletConnectedForFunding', {
|
|
163
|
+
initiatedByWidget,
|
|
164
|
+
isPhantomRedirect: false,
|
|
165
|
+
wallet,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
rejectPromiseRef(promiseRef, error);
|
|
170
|
+
}
|
|
171
|
+
}),
|
|
172
|
+
showDefaultFooter: true,
|
|
173
|
+
});
|
|
174
|
+
}, [
|
|
175
|
+
clearStackAndPush,
|
|
176
|
+
getWalletAddress,
|
|
177
|
+
initiatedByWidgetRef,
|
|
178
|
+
selectExchangeConfig,
|
|
179
|
+
setShowAuthFlow,
|
|
180
|
+
]);
|
|
181
|
+
return useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ initiatedByWidget }) {
|
|
182
|
+
if (promiseRef.current)
|
|
183
|
+
return promiseRef.current.promise;
|
|
184
|
+
resetWalletConnectSession();
|
|
185
|
+
promiseRef.current = new DeferredPromise();
|
|
186
|
+
openList(initiatedByWidget);
|
|
187
|
+
setShowAuthFlow(true, {
|
|
188
|
+
emitCancelAuth: false,
|
|
189
|
+
ignoreIfIsEmbeddedWidget: true,
|
|
190
|
+
initializeWalletConnect: true,
|
|
191
|
+
performMultiWalletChecks: false,
|
|
192
|
+
});
|
|
193
|
+
return promiseRef.current.promise;
|
|
194
|
+
}), [openList, resetWalletConnectSession, setShowAuthFlow]);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export { useConnectUnifiedForFunding };
|
|
@@ -189,7 +189,7 @@ const useDynamicWaas = () => {
|
|
|
189
189
|
]);
|
|
190
190
|
// If no chain names are provided, filter out chains that already have a wallet
|
|
191
191
|
// and make a wallet for each enabled chain
|
|
192
|
-
const createWalletAccount = React.useCallback((chainNames) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
192
|
+
const createWalletAccount = React.useCallback((chainNames, password) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
193
193
|
if (!(enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length)) {
|
|
194
194
|
throw new utils.DynamicError(constants.NO_ENABLED_CHAINS_ERROR);
|
|
195
195
|
}
|
|
@@ -202,7 +202,10 @@ const useDynamicWaas = () => {
|
|
|
202
202
|
const walletConnector = getWalletConnector(chain);
|
|
203
203
|
if (!walletConnector)
|
|
204
204
|
throw new Error('No connector');
|
|
205
|
-
const account = yield walletConnector.createWalletAccount(
|
|
205
|
+
const account = yield walletConnector.createWalletAccount({
|
|
206
|
+
password,
|
|
207
|
+
thresholdSignatureScheme: 'TWO_OF_TWO',
|
|
208
|
+
});
|
|
206
209
|
return Object.assign(Object.assign({}, account), { chainName: chain });
|
|
207
210
|
})));
|
|
208
211
|
const failedChains = [];
|
|
@@ -13,7 +13,7 @@ export declare const configWaasWalletConnector: ({ walletConnector, environmentI
|
|
|
13
13
|
}) => Promise<string | undefined>;
|
|
14
14
|
}) => IDynamicWaasConnector;
|
|
15
15
|
export declare const useDynamicWaas: () => {
|
|
16
|
-
createWalletAccount: (chainNames: ChainEnum[]) => Promise<({
|
|
16
|
+
createWalletAccount: (chainNames: ChainEnum[], password?: string) => Promise<({
|
|
17
17
|
chainName: ChainEnum;
|
|
18
18
|
accountAddress: string;
|
|
19
19
|
publicKeyHex: string;
|
|
@@ -185,7 +185,7 @@ const useDynamicWaas = () => {
|
|
|
185
185
|
]);
|
|
186
186
|
// If no chain names are provided, filter out chains that already have a wallet
|
|
187
187
|
// and make a wallet for each enabled chain
|
|
188
|
-
const createWalletAccount = useCallback((chainNames) => __awaiter(void 0, void 0, void 0, function* () {
|
|
188
|
+
const createWalletAccount = useCallback((chainNames, password) => __awaiter(void 0, void 0, void 0, function* () {
|
|
189
189
|
if (!(enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length)) {
|
|
190
190
|
throw new DynamicError(NO_ENABLED_CHAINS_ERROR);
|
|
191
191
|
}
|
|
@@ -198,7 +198,10 @@ const useDynamicWaas = () => {
|
|
|
198
198
|
const walletConnector = getWalletConnector(chain);
|
|
199
199
|
if (!walletConnector)
|
|
200
200
|
throw new Error('No connector');
|
|
201
|
-
const account = yield walletConnector.createWalletAccount(
|
|
201
|
+
const account = yield walletConnector.createWalletAccount({
|
|
202
|
+
password,
|
|
203
|
+
thresholdSignatureScheme: 'TWO_OF_TWO',
|
|
204
|
+
});
|
|
202
205
|
return Object.assign(Object.assign({}, account), { chainName: chain });
|
|
203
206
|
})));
|
|
204
207
|
const failedChains = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { usePayWithDynamic } from './usePayWithDynamic';
|
|
1
|
+
export { usePayWithDynamic, type PayWithDynamicProps, } from './usePayWithDynamic';
|