@dynamic-labs/sdk-react-core 2.0.0-alpha.10 → 2.0.0-alpha.11
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 +27 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +1 -4
- package/src/lib/components/NetworkPicker/NetworkPicker.js +1 -4
- package/src/lib/components/UserAddress/UserAddress.cjs +1 -1
- package/src/lib/components/UserAddress/UserAddress.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +6 -7
- package/src/lib/context/DynamicContext/DynamicContext.js +6 -7
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +0 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +0 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +0 -1
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +4 -0
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +4 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +2 -3
- package/src/lib/context/DynamicContext/useCustomerCallbacks/types.d.ts +2 -3
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +2 -11
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +2 -11
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +1 -2
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +1 -2
- package/src/lib/context/ErrorContext/ErrorContext.cjs +3 -0
- package/src/lib/context/ErrorContext/ErrorContext.js +3 -0
- package/src/lib/context/PhantomRedirectContext/PhantomRedirectContext.cjs +11 -3
- package/src/lib/context/PhantomRedirectContext/PhantomRedirectContext.js +11 -3
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +8 -1
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.d.ts +1 -0
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +8 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +1 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +1 -1
- package/src/lib/events/dynamicEvents.d.ts +2 -1
- package/src/lib/locale/en/translation.cjs +2 -0
- package/src/lib/locale/en/translation.d.ts +2 -0
- package/src/lib/locale/en/translation.js +2 -0
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.js +1 -1
- package/src/lib/shared/types/connectionAndSignature.d.ts +2 -2
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.d.ts +2 -2
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/index.d.ts +1 -0
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.d.ts +1 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.d.ts +3 -3
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +4 -4
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.d.ts +4 -4
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +4 -4
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.d.ts +3 -3
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +2 -2
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +3 -3
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +2 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +3 -3
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +2 -6
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +2 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +7 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +7 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useTurnkey/useTurnkey.cjs +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useTurnkey/useTurnkey.js +1 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +83 -90
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.d.ts +2 -9
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +86 -91
- package/src/lib/utils/hooks/usePromise/usePromise.cjs +1 -1
- package/src/lib/utils/hooks/usePromise/usePromise.js +1 -1
- package/src/lib/utils/hooks/useSendDynamicProps/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSendDynamicProps/useSendDynamicProps.cjs +84 -0
- package/src/lib/utils/hooks/useSendDynamicProps/useSendDynamicProps.d.ts +11 -0
- package/src/lib/utils/hooks/useSendDynamicProps/useSendDynamicProps.js +78 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +4 -4
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +4 -4
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.cjs +7 -4
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.js +7 -4
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +1 -1
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +1 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +0 -32
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +1 -6
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +1 -33
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +1 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +1 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +7 -5
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +7 -5
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +4 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +4 -1
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs +9 -11
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.js +9 -11
- package/src/lib/views/WalletList/WalletList.cjs +9 -1
- package/src/lib/views/WalletList/WalletList.js +9 -1
|
@@ -120,7 +120,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
120
120
|
if (!userCancelled)
|
|
121
121
|
setIsVerificationInProgress(false);
|
|
122
122
|
};
|
|
123
|
-
return ({ walletConnector,
|
|
123
|
+
return ({ walletConnector, getAddressOpts = undefined }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
124
124
|
var _a;
|
|
125
125
|
// Raise verification ongoing flag
|
|
126
126
|
setIsVerificationInProgress(true);
|
|
@@ -134,7 +134,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
134
134
|
setView('wait-for-email-confirmation-view');
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
const connectionResult = yield connectWallet(walletConnector,
|
|
137
|
+
const connectionResult = yield connectWallet(walletConnector, getAddressOpts, {
|
|
138
138
|
applyOnBeforeConnectSuccessConfirmation: shouldCallCallback,
|
|
139
139
|
raiseOnConnect: true,
|
|
140
140
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GetAddressOpts, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
2
|
type Props = {
|
|
3
|
-
|
|
3
|
+
getAddressOpts?: GetAddressOpts;
|
|
4
4
|
walletConnector: WalletConnector;
|
|
5
5
|
};
|
|
6
6
|
export declare const useConnectAndSign: ({ shouldUpdateWallets, shouldCallCallback, }?: {
|
|
7
7
|
shouldUpdateWallets?: boolean | undefined;
|
|
8
8
|
shouldCallCallback?: boolean | undefined;
|
|
9
|
-
}) => ({ walletConnector,
|
|
9
|
+
}) => ({ walletConnector, getAddressOpts }: Props) => Promise<void>;
|
|
10
10
|
export {};
|
|
@@ -116,7 +116,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
116
116
|
if (!userCancelled)
|
|
117
117
|
setIsVerificationInProgress(false);
|
|
118
118
|
};
|
|
119
|
-
return ({ walletConnector,
|
|
119
|
+
return ({ walletConnector, getAddressOpts = undefined }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
120
|
var _a;
|
|
121
121
|
// Raise verification ongoing flag
|
|
122
122
|
setIsVerificationInProgress(true);
|
|
@@ -130,7 +130,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
130
130
|
setView('wait-for-email-confirmation-view');
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
const connectionResult = yield connectWallet(walletConnector,
|
|
133
|
+
const connectionResult = yield connectWallet(walletConnector, getAddressOpts, {
|
|
134
134
|
applyOnBeforeConnectSuccessConfirmation: shouldCallCallback,
|
|
135
135
|
raiseOnConnect: true,
|
|
136
136
|
});
|
|
@@ -109,13 +109,13 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
109
109
|
// It's used when we want to connect and sign in two separate steps
|
|
110
110
|
// For example on mobile when we want to sign on button click
|
|
111
111
|
// or in Dapper
|
|
112
|
-
const onlyConnectUser = ({ walletConnector,
|
|
112
|
+
const onlyConnectUser = ({ walletConnector, getAddressOpts = undefined, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
113
113
|
var _a;
|
|
114
114
|
// Raise verification ongoing flag
|
|
115
115
|
setIsVerificationInProgress(true);
|
|
116
116
|
yield showPendingConnectView.showPendingConnectView(walletConnector, setView);
|
|
117
117
|
try {
|
|
118
|
-
yield connectWallet(walletConnector,
|
|
118
|
+
yield connectWallet(walletConnector, getAddressOpts, {
|
|
119
119
|
raiseOnConnect: true,
|
|
120
120
|
});
|
|
121
121
|
if (isConnectOnly.isConnectOnly(user, authMode)) {
|
|
@@ -143,11 +143,11 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
143
143
|
});
|
|
144
144
|
// This method is similar to useConnectAndSign, but it does not call showPendingConnectView
|
|
145
145
|
// This is because we already called it in onlyConnectUser and now we just want to sign
|
|
146
|
-
const signAlreadyConnectedUser = ({ walletConnector,
|
|
146
|
+
const signAlreadyConnectedUser = ({ walletConnector, getAddressOpts = undefined, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
147
147
|
// Raise verification ongoing flag
|
|
148
148
|
setIsVerificationInProgress(true);
|
|
149
149
|
try {
|
|
150
|
-
const connectionResult = yield connectWallet(walletConnector,
|
|
150
|
+
const connectionResult = yield connectWallet(walletConnector, getAddressOpts);
|
|
151
151
|
if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.address)) {
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GetAddressOpts, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
2
|
type Props = {
|
|
3
|
-
|
|
3
|
+
getAddressOpts?: GetAddressOpts;
|
|
4
4
|
walletConnector: WalletConnector;
|
|
5
5
|
};
|
|
6
6
|
export declare const useConnectAndSignSplitSteps: () => {
|
|
7
|
-
onlyConnectUser: ({ walletConnector,
|
|
8
|
-
signAlreadyConnectedUser: ({ walletConnector,
|
|
7
|
+
onlyConnectUser: ({ walletConnector, getAddressOpts, }: Props) => Promise<void>;
|
|
8
|
+
signAlreadyConnectedUser: ({ walletConnector, getAddressOpts, }: Props) => Promise<void>;
|
|
9
9
|
};
|
|
10
10
|
export {};
|
|
@@ -105,13 +105,13 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
105
105
|
// It's used when we want to connect and sign in two separate steps
|
|
106
106
|
// For example on mobile when we want to sign on button click
|
|
107
107
|
// or in Dapper
|
|
108
|
-
const onlyConnectUser = ({ walletConnector,
|
|
108
|
+
const onlyConnectUser = ({ walletConnector, getAddressOpts = undefined, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
109
109
|
var _a;
|
|
110
110
|
// Raise verification ongoing flag
|
|
111
111
|
setIsVerificationInProgress(true);
|
|
112
112
|
yield showPendingConnectView(walletConnector, setView);
|
|
113
113
|
try {
|
|
114
|
-
yield connectWallet(walletConnector,
|
|
114
|
+
yield connectWallet(walletConnector, getAddressOpts, {
|
|
115
115
|
raiseOnConnect: true,
|
|
116
116
|
});
|
|
117
117
|
if (isConnectOnly(user, authMode)) {
|
|
@@ -139,11 +139,11 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
139
139
|
});
|
|
140
140
|
// This method is similar to useConnectAndSign, but it does not call showPendingConnectView
|
|
141
141
|
// This is because we already called it in onlyConnectUser and now we just want to sign
|
|
142
|
-
const signAlreadyConnectedUser = ({ walletConnector,
|
|
142
|
+
const signAlreadyConnectedUser = ({ walletConnector, getAddressOpts = undefined, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
143
143
|
// Raise verification ongoing flag
|
|
144
144
|
setIsVerificationInProgress(true);
|
|
145
145
|
try {
|
|
146
|
-
const connectionResult = yield connectWallet(walletConnector,
|
|
146
|
+
const connectionResult = yield connectWallet(walletConnector, getAddressOpts);
|
|
147
147
|
if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.address)) {
|
|
148
148
|
return;
|
|
149
149
|
}
|
package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs
CHANGED
|
@@ -86,7 +86,7 @@ const useSignConnectOnlyUser = () => {
|
|
|
86
86
|
projectSettings,
|
|
87
87
|
setIsSingleWalletAccount,
|
|
88
88
|
});
|
|
89
|
-
return ({ walletConnector,
|
|
89
|
+
return ({ walletConnector, getAddressOpts = undefined }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
90
90
|
try {
|
|
91
91
|
if (walletConnectorCore.isEmbeddedConnector(walletConnector) &&
|
|
92
92
|
!walletConnectorCore.isBloctoConnector(walletConnector)) {
|
|
@@ -101,7 +101,7 @@ const useSignConnectOnlyUser = () => {
|
|
|
101
101
|
setShowAuthFlow(true);
|
|
102
102
|
// Wallet should be already connected at this point
|
|
103
103
|
// We just need to verify it
|
|
104
|
-
const connectionResult = yield connectWallet(walletConnector,
|
|
104
|
+
const connectionResult = yield connectWallet(walletConnector, getAddressOpts);
|
|
105
105
|
if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.address)) {
|
|
106
106
|
return;
|
|
107
107
|
}
|
package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GetAddressOpts, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
2
|
type Props = {
|
|
3
|
-
|
|
3
|
+
getAddressOpts?: GetAddressOpts;
|
|
4
4
|
walletConnector: WalletConnector;
|
|
5
5
|
};
|
|
6
|
-
export declare const useSignConnectOnlyUser: () => ({ walletConnector,
|
|
6
|
+
export declare const useSignConnectOnlyUser: () => ({ walletConnector, getAddressOpts }: Props) => Promise<void>;
|
|
7
7
|
export {};
|
package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js
CHANGED
|
@@ -82,7 +82,7 @@ const useSignConnectOnlyUser = () => {
|
|
|
82
82
|
projectSettings,
|
|
83
83
|
setIsSingleWalletAccount,
|
|
84
84
|
});
|
|
85
|
-
return ({ walletConnector,
|
|
85
|
+
return ({ walletConnector, getAddressOpts = undefined }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
86
|
try {
|
|
87
87
|
if (isEmbeddedConnector(walletConnector) &&
|
|
88
88
|
!isBloctoConnector(walletConnector)) {
|
|
@@ -97,7 +97,7 @@ const useSignConnectOnlyUser = () => {
|
|
|
97
97
|
setShowAuthFlow(true);
|
|
98
98
|
// Wallet should be already connected at this point
|
|
99
99
|
// We just need to verify it
|
|
100
|
-
const connectionResult = yield connectWallet(walletConnector,
|
|
100
|
+
const connectionResult = yield connectWallet(walletConnector, getAddressOpts);
|
|
101
101
|
if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.address)) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
@@ -47,3 +47,4 @@ export { useEmbeddedWalletPassword } from './useEmbeddedWalletPassword';
|
|
|
47
47
|
export { useSetWalletConnectorFetchers } from './useSetWalletConnectorFetchers';
|
|
48
48
|
export { useNetworkDataFromWallet } from './useNetworkDataFromWallet';
|
|
49
49
|
export { useDynamicModals } from './useDynamicModals';
|
|
50
|
+
export { useSendDynamicProps } from './useSendDynamicProps';
|
|
@@ -182,7 +182,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
182
182
|
if (shouldManuallyReconnectOnRefresh.shouldManuallyReconnectOnRefresh(walletConnector)) {
|
|
183
183
|
yield walletConnector.connect();
|
|
184
184
|
}
|
|
185
|
-
const currentWalletConnectorAddress = yield walletConnector.
|
|
185
|
+
const currentWalletConnectorAddress = yield walletConnector.getAddress();
|
|
186
186
|
if (currentWalletConnectorAddress && onBeforeConnectSuccessConfirmation) {
|
|
187
187
|
const shouldProceedWithConnection = yield onBeforeConnectSuccessConfirmation({
|
|
188
188
|
address: currentWalletConnectorAddress,
|
|
@@ -203,9 +203,9 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
205
|
const shouldSkipCreatingVisit = authMode === 'connect-only' && !enableVisitTrackingOnConnectOnly;
|
|
206
|
-
const connectWallet = (walletConnector,
|
|
206
|
+
const connectWallet = (walletConnector, getAddressOpts, options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
207
207
|
const { applyOnBeforeConnectSuccessConfirmation = true, raiseOnConnect = false, } = options !== null && options !== void 0 ? options : {};
|
|
208
|
-
const walletAddress = yield walletConnector.
|
|
208
|
+
const walletAddress = yield walletConnector.getAddress(getAddressOpts);
|
|
209
209
|
if (!walletAddress) {
|
|
210
210
|
throw new utils.MissingPublicAddressError();
|
|
211
211
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Chain,
|
|
1
|
+
import { Chain, GetAddressOpts, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
2
|
import { SetShowAuthFlow } from '../../../context/DynamicContext/hooks';
|
|
3
3
|
import { ConnectWalletResult } from '../../../context/DynamicContext/types';
|
|
4
4
|
import { AuthModeType, OnBeforeConnectSuccessConfirmation, UserProfile, Wallet, WalletOption } from '../../../shared';
|
|
@@ -34,7 +34,7 @@ export type ConnectWalletOptions = {
|
|
|
34
34
|
raiseOnConnect?: boolean;
|
|
35
35
|
};
|
|
36
36
|
type UseConnectWalletValue = {
|
|
37
|
-
connectWallet: (walletConnector: WalletConnector,
|
|
37
|
+
connectWallet: (walletConnector: WalletConnector, getAddressOpts?: GetAddressOpts, options?: ConnectWalletOptions) => Promise<ConnectWalletResult | undefined>;
|
|
38
38
|
connectedWallets: Wallet[];
|
|
39
39
|
connectedWalletsInfo: ConnectedWalletConnectorType[];
|
|
40
40
|
getConnectedWalletById: (walletId: string) => Wallet | undefined;
|
|
@@ -178,7 +178,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
178
178
|
if (shouldManuallyReconnectOnRefresh(walletConnector)) {
|
|
179
179
|
yield walletConnector.connect();
|
|
180
180
|
}
|
|
181
|
-
const currentWalletConnectorAddress = yield walletConnector.
|
|
181
|
+
const currentWalletConnectorAddress = yield walletConnector.getAddress();
|
|
182
182
|
if (currentWalletConnectorAddress && onBeforeConnectSuccessConfirmation) {
|
|
183
183
|
const shouldProceedWithConnection = yield onBeforeConnectSuccessConfirmation({
|
|
184
184
|
address: currentWalletConnectorAddress,
|
|
@@ -199,9 +199,9 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
199
199
|
});
|
|
200
200
|
});
|
|
201
201
|
const shouldSkipCreatingVisit = authMode === 'connect-only' && !enableVisitTrackingOnConnectOnly;
|
|
202
|
-
const connectWallet = (walletConnector,
|
|
202
|
+
const connectWallet = (walletConnector, getAddressOpts, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
203
203
|
const { applyOnBeforeConnectSuccessConfirmation = true, raiseOnConnect = false, } = options !== null && options !== void 0 ? options : {};
|
|
204
|
-
const walletAddress = yield walletConnector.
|
|
204
|
+
const walletAddress = yield walletConnector.getAddress(getAddressOpts);
|
|
205
205
|
if (!walletAddress) {
|
|
206
206
|
throw new MissingPublicAddressError();
|
|
207
207
|
}
|
|
@@ -110,14 +110,13 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
110
110
|
/** It's not authenticated if it's a turnkey wallet that still hasn't created a passkey */
|
|
111
111
|
const authenticated = Boolean((_e = turnkeyVerifiedCredentials === null || turnkeyVerifiedCredentials === void 0 ? void 0 : turnkeyVerifiedCredentials.walletProperties) === null || _e === void 0 ? void 0 : _e.isAuthenticatorAttached);
|
|
112
112
|
const passkeyWallet = {
|
|
113
|
-
address: (yield walletConnector.
|
|
113
|
+
address: (yield walletConnector.getAddress()) || '',
|
|
114
114
|
authenticated,
|
|
115
115
|
chain: walletConnector.connectedChain || '',
|
|
116
116
|
connected: true,
|
|
117
117
|
connector: walletConnector,
|
|
118
118
|
id: embeddedWalletVerifiedCredential.id,
|
|
119
119
|
};
|
|
120
|
-
dynamicEvents.dynamicEvents.emit('embeddedWalletCreated', passkeyWallet);
|
|
121
120
|
const smartWallet$1 = smartWallet.findSmartWallet(embeddedWalletVerifiedCredential, updatedDecodedJwt.verifiedCredentials);
|
|
122
121
|
if (smartWallet$1) {
|
|
123
122
|
yield smartWallet.initializeSmartWallet({
|
|
@@ -133,10 +132,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
133
132
|
index.storeAuthToken(jwt);
|
|
134
133
|
setUser(createUserProfile.createUserProfile(updatedDecodedJwt));
|
|
135
134
|
setShowAuthFlow(false, { performMultiWalletChecks: false });
|
|
136
|
-
|
|
137
|
-
email: (turnkeyVerifiedCredentials === null || turnkeyVerifiedCredentials === void 0 ? void 0 : turnkeyVerifiedCredentials.email) || '',
|
|
138
|
-
verifiedCredential: turnkeyVerifiedCredentials,
|
|
139
|
-
});
|
|
135
|
+
dynamicEvents.dynamicEvents.emit('embeddedWalletCreated', passkeyWallet, turnkeyVerifiedCredentials);
|
|
140
136
|
}
|
|
141
137
|
catch (err) {
|
|
142
138
|
setError(err);
|
|
@@ -106,14 +106,13 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
106
106
|
/** It's not authenticated if it's a turnkey wallet that still hasn't created a passkey */
|
|
107
107
|
const authenticated = Boolean((_e = turnkeyVerifiedCredentials === null || turnkeyVerifiedCredentials === void 0 ? void 0 : turnkeyVerifiedCredentials.walletProperties) === null || _e === void 0 ? void 0 : _e.isAuthenticatorAttached);
|
|
108
108
|
const passkeyWallet = {
|
|
109
|
-
address: (yield walletConnector.
|
|
109
|
+
address: (yield walletConnector.getAddress()) || '',
|
|
110
110
|
authenticated,
|
|
111
111
|
chain: walletConnector.connectedChain || '',
|
|
112
112
|
connected: true,
|
|
113
113
|
connector: walletConnector,
|
|
114
114
|
id: embeddedWalletVerifiedCredential.id,
|
|
115
115
|
};
|
|
116
|
-
dynamicEvents.emit('embeddedWalletCreated', passkeyWallet);
|
|
117
116
|
const smartWallet = findSmartWallet(embeddedWalletVerifiedCredential, updatedDecodedJwt.verifiedCredentials);
|
|
118
117
|
if (smartWallet) {
|
|
119
118
|
yield initializeSmartWallet({
|
|
@@ -129,10 +128,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
129
128
|
storeAuthToken(jwt);
|
|
130
129
|
setUser(createUserProfile(updatedDecodedJwt));
|
|
131
130
|
setShowAuthFlow(false, { performMultiWalletChecks: false });
|
|
132
|
-
|
|
133
|
-
email: (turnkeyVerifiedCredentials === null || turnkeyVerifiedCredentials === void 0 ? void 0 : turnkeyVerifiedCredentials.email) || '',
|
|
134
|
-
verifiedCredential: turnkeyVerifiedCredentials,
|
|
135
|
-
});
|
|
131
|
+
dynamicEvents.emit('embeddedWalletCreated', passkeyWallet, turnkeyVerifiedCredentials);
|
|
136
132
|
}
|
|
137
133
|
catch (err) {
|
|
138
134
|
setError(err);
|
|
@@ -91,7 +91,7 @@ const useCoinbaseMPC = () => {
|
|
|
91
91
|
connector.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
92
92
|
setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
93
93
|
const coinbaseMPCWallet = {
|
|
94
|
-
address: (yield (connector === null || connector === void 0 ? void 0 : connector.
|
|
94
|
+
address: (yield (connector === null || connector === void 0 ? void 0 : connector.getAddress())) || '',
|
|
95
95
|
authenticated: true,
|
|
96
96
|
chain: (connector === null || connector === void 0 ? void 0 : connector.connectedChain) || '',
|
|
97
97
|
connected: true,
|
|
@@ -104,7 +104,7 @@ const useCoinbaseMPC = () => {
|
|
|
104
104
|
const nonce = consumeNonce();
|
|
105
105
|
if (nonce === undefined)
|
|
106
106
|
throw new utils.DynamicError('Missing nonce');
|
|
107
|
-
const address = yield connector.
|
|
107
|
+
const address = yield connector.getAddress();
|
|
108
108
|
if (!address)
|
|
109
109
|
throw new utils.DynamicError('Missing address');
|
|
110
110
|
const verifyArgs = yield getVerifyArgs.getVerifyArgs({
|
|
@@ -133,7 +133,7 @@ const useCoinbaseMPC = () => {
|
|
|
133
133
|
index.storeAuthToken(updatedJwt);
|
|
134
134
|
setUser(user);
|
|
135
135
|
connector.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
136
|
-
return newSelectedCredentialWallet
|
|
136
|
+
return newSelectedCredentialWallet;
|
|
137
137
|
}), [
|
|
138
138
|
appName,
|
|
139
139
|
consumeNonce,
|
|
@@ -152,7 +152,7 @@ const useCoinbaseMPC = () => {
|
|
|
152
152
|
: sdkApi.PasswordSourceTypeEnum.Dynamic;
|
|
153
153
|
try {
|
|
154
154
|
const backupCode = yield connector.generateWallet(source, initialWalletPassword);
|
|
155
|
-
const
|
|
155
|
+
const jwtVerifiedCredential = yield linkCoinbaseMPCWallet({
|
|
156
156
|
backupCode,
|
|
157
157
|
connector,
|
|
158
158
|
jwt,
|
|
@@ -160,13 +160,14 @@ const useCoinbaseMPC = () => {
|
|
|
160
160
|
source,
|
|
161
161
|
});
|
|
162
162
|
const coinbaseMPCWallet = {
|
|
163
|
-
address: (yield (connector === null || connector === void 0 ? void 0 : connector.
|
|
163
|
+
address: (yield (connector === null || connector === void 0 ? void 0 : connector.getAddress())) || '',
|
|
164
164
|
authenticated: true,
|
|
165
165
|
chain: (connector === null || connector === void 0 ? void 0 : connector.connectedChain) || '',
|
|
166
166
|
connected: true,
|
|
167
167
|
connector,
|
|
168
|
-
id:
|
|
168
|
+
id: jwtVerifiedCredential.id,
|
|
169
169
|
};
|
|
170
|
+
dynamicEvents.dynamicEvents.emit('embeddedWalletCreated', coinbaseMPCWallet, jwtVerifiedCredential);
|
|
170
171
|
return coinbaseMPCWallet;
|
|
171
172
|
}
|
|
172
173
|
catch (error) {
|
|
@@ -87,7 +87,7 @@ const useCoinbaseMPC = () => {
|
|
|
87
87
|
connector.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
88
88
|
setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
89
89
|
const coinbaseMPCWallet = {
|
|
90
|
-
address: (yield (connector === null || connector === void 0 ? void 0 : connector.
|
|
90
|
+
address: (yield (connector === null || connector === void 0 ? void 0 : connector.getAddress())) || '',
|
|
91
91
|
authenticated: true,
|
|
92
92
|
chain: (connector === null || connector === void 0 ? void 0 : connector.connectedChain) || '',
|
|
93
93
|
connected: true,
|
|
@@ -100,7 +100,7 @@ const useCoinbaseMPC = () => {
|
|
|
100
100
|
const nonce = consumeNonce();
|
|
101
101
|
if (nonce === undefined)
|
|
102
102
|
throw new DynamicError('Missing nonce');
|
|
103
|
-
const address = yield connector.
|
|
103
|
+
const address = yield connector.getAddress();
|
|
104
104
|
if (!address)
|
|
105
105
|
throw new DynamicError('Missing address');
|
|
106
106
|
const verifyArgs = yield getVerifyArgs({
|
|
@@ -129,7 +129,7 @@ const useCoinbaseMPC = () => {
|
|
|
129
129
|
storeAuthToken(updatedJwt);
|
|
130
130
|
setUser(user);
|
|
131
131
|
connector.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
132
|
-
return newSelectedCredentialWallet
|
|
132
|
+
return newSelectedCredentialWallet;
|
|
133
133
|
}), [
|
|
134
134
|
appName,
|
|
135
135
|
consumeNonce,
|
|
@@ -148,7 +148,7 @@ const useCoinbaseMPC = () => {
|
|
|
148
148
|
: PasswordSourceTypeEnum.Dynamic;
|
|
149
149
|
try {
|
|
150
150
|
const backupCode = yield connector.generateWallet(source, initialWalletPassword);
|
|
151
|
-
const
|
|
151
|
+
const jwtVerifiedCredential = yield linkCoinbaseMPCWallet({
|
|
152
152
|
backupCode,
|
|
153
153
|
connector,
|
|
154
154
|
jwt,
|
|
@@ -156,13 +156,14 @@ const useCoinbaseMPC = () => {
|
|
|
156
156
|
source,
|
|
157
157
|
});
|
|
158
158
|
const coinbaseMPCWallet = {
|
|
159
|
-
address: (yield (connector === null || connector === void 0 ? void 0 : connector.
|
|
159
|
+
address: (yield (connector === null || connector === void 0 ? void 0 : connector.getAddress())) || '',
|
|
160
160
|
authenticated: true,
|
|
161
161
|
chain: (connector === null || connector === void 0 ? void 0 : connector.connectedChain) || '',
|
|
162
162
|
connected: true,
|
|
163
163
|
connector,
|
|
164
|
-
id:
|
|
164
|
+
id: jwtVerifiedCredential.id,
|
|
165
165
|
};
|
|
166
|
+
dynamicEvents.emit('embeddedWalletCreated', coinbaseMPCWallet, jwtVerifiedCredential);
|
|
166
167
|
return coinbaseMPCWallet;
|
|
167
168
|
}
|
|
168
169
|
catch (error) {
|
|
@@ -148,7 +148,7 @@ const useTurnkey = () => {
|
|
|
148
148
|
/** It's not authenticated if it still hasn't created a passkey */
|
|
149
149
|
const authenticated = Boolean((_b = embeddedWalletVerifiedCredential.walletProperties) === null || _b === void 0 ? void 0 : _b.isAuthenticatorAttached);
|
|
150
150
|
const passkeyWallet = {
|
|
151
|
-
address: (yield ((_c = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _c === void 0 ? void 0 : _c.
|
|
151
|
+
address: (yield ((_c = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _c === void 0 ? void 0 : _c.getAddress())) || '',
|
|
152
152
|
authenticated,
|
|
153
153
|
chain: ((_d = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _d === void 0 ? void 0 : _d.connectedChain) || '',
|
|
154
154
|
connected: true,
|
|
@@ -144,7 +144,7 @@ const useTurnkey = () => {
|
|
|
144
144
|
/** It's not authenticated if it still hasn't created a passkey */
|
|
145
145
|
const authenticated = Boolean((_b = embeddedWalletVerifiedCredential.walletProperties) === null || _b === void 0 ? void 0 : _b.isAuthenticatorAttached);
|
|
146
146
|
const passkeyWallet = {
|
|
147
|
-
address: (yield ((_c = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _c === void 0 ? void 0 : _c.
|
|
147
|
+
address: (yield ((_c = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _c === void 0 ? void 0 : _c.getAddress())) || '',
|
|
148
148
|
authenticated,
|
|
149
149
|
chain: ((_d = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _d === void 0 ? void 0 : _d.connectedChain) || '',
|
|
150
150
|
connected: true,
|