@dynamic-labs/sdk-react-core 4.91.3 → 4.91.4
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 +8 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/client/client.cjs +1 -1
- package/src/lib/client/client.js +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +4 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +4 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +3 -0
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +3 -0
- package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.cjs +1 -1
- package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.js +1 -1
- package/src/lib/context/DynamicContext/types/SettingsOverrides.d.ts +13 -1
- package/src/lib/context/OnrampContext/OnrampContext.cjs +1 -1
- package/src/lib/context/OnrampContext/OnrampContext.js +1 -1
- package/src/lib/context/SendBalanceContext/SendBalanceContext.errors.cjs +2 -2
- package/src/lib/context/SendBalanceContext/SendBalanceContext.errors.js +2 -2
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +3 -3
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +3 -3
- package/src/lib/data/api/email/email.cjs +6 -3
- package/src/lib/data/api/email/email.js +6 -3
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +5 -5
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +5 -5
- package/src/lib/data/api/exchangeAccounts/exchangeAccounts.cjs +3 -3
- package/src/lib/data/api/exchangeAccounts/exchangeAccounts.js +3 -3
- package/src/lib/data/api/oauth/oauth.cjs +3 -2
- package/src/lib/data/api/oauth/oauth.js +3 -2
- package/src/lib/data/api/session/session.cjs +3 -3
- package/src/lib/data/api/session/session.js +3 -3
- package/src/lib/data/api/sms/sms.cjs +4 -1
- package/src/lib/data/api/sms/sms.js +4 -1
- package/src/lib/data/api/user/user.cjs +4 -4
- package/src/lib/data/api/user/user.js +4 -4
- package/src/lib/data/api/wallets/wallets.cjs +15 -13
- package/src/lib/data/api/wallets/wallets.js +15 -13
- package/src/lib/store/state/nonce/nonce.cjs +1 -1
- package/src/lib/store/state/nonce/nonce.js +1 -1
- package/src/lib/utils/functions/generateMessages/index.cjs +3 -3
- package/src/lib/utils/functions/generateMessages/index.js +3 -3
- package/src/lib/utils/functions/getEmbeddedWalletAuthHandler/getEmbeddedWalletAuthHandler.cjs +1 -1
- package/src/lib/utils/functions/getEmbeddedWalletAuthHandler/getEmbeddedWalletAuthHandler.js +1 -1
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.cjs +30 -0
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.d.ts +17 -0
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.js +29 -1
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.cjs +13 -1
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.d.ts +2 -1
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.js +14 -2
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.cjs +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.js +2 -2
- package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.cjs +2 -2
- package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.js +2 -2
- package/src/lib/utils/hooks/useConfirmationPortal/useConfirmationPortal.cjs +1 -1
- package/src/lib/utils/hooks/useConfirmationPortal/useConfirmationPortal.js +1 -1
- package/src/lib/utils/hooks/useConnectExchangeForFunding/useConnectExchangeForFunding.cjs +1 -1
- package/src/lib/utils/hooks/useConnectExchangeForFunding/useConnectExchangeForFunding.js +1 -1
- package/src/lib/utils/hooks/useConnectUnifiedForFunding/useConnectUnifiedForFunding.cjs +2 -2
- package/src/lib/utils/hooks/useConnectUnifiedForFunding/useConnectUnifiedForFunding.js +2 -2
- package/src/lib/utils/hooks/useConnectWallet/HandleConnectWalletRejectionError.cjs +1 -1
- package/src/lib/utils/hooks/useConnectWallet/HandleConnectWalletRejectionError.js +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -1
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/errors/ConnectorSetupError.cjs +1 -1
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/errors/ConnectorSetupError.js +1 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +8 -8
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +8 -8
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +4 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +4 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +9 -9
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +9 -9
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.cjs +2 -2
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.js +2 -2
- package/src/lib/utils/hooks/useFundingHelpers/useFundingHelpers.cjs +2 -2
- package/src/lib/utils/hooks/useFundingHelpers/useFundingHelpers.js +2 -2
- package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.cjs +1 -1
- package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.js +1 -1
- package/src/lib/utils/hooks/useSignEip7702Authorization/useSignEip7702Authorization.cjs +2 -2
- package/src/lib/utils/hooks/useSignEip7702Authorization/useSignEip7702Authorization.js +2 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +2 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +2 -2
- package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.cjs +2 -2
- package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.js +2 -2
- package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.cjs +3 -3
- package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.js +3 -3
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +1 -1
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +1 -1
- package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.cjs +1 -1
- package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.js +1 -1
- package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.cjs +3 -3
- package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.js +3 -3
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs +1 -1
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -2
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -2
- package/src/lib/utils/hooks/useViewSettings/useViewSettings.d.ts +5 -1
- 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/useWalletOptions/useWalletOptions.cjs +1 -1
- package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.js +1 -1
- package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.cjs +1 -1
- package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.js +1 -1
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +2 -2
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +2 -2
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.cjs +2 -2
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.js +2 -2
- package/src/lib/views/ExportSharesView/ExportSharesView.cjs +2 -2
- package/src/lib/views/ExportSharesView/ExportSharesView.js +2 -2
- package/src/lib/views/LoginView/useLoginView/useLoginView.cjs +1 -1
- package/src/lib/views/LoginView/useLoginView/useLoginView.js +1 -1
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.cjs +1 -1
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.js +1 -1
- package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +2 -2
- package/src/lib/views/MfaVerificationView/MfaVerificationView.js +2 -2
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js +1 -1
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.cjs +3 -3
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.js +3 -3
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +14 -14
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +14 -14
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +2 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.js +2 -2
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +1 -1
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +1 -1
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.cjs +1 -1
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/getPromptAmountParams/getPromptAmountParams.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/getPromptAmountParams/getPromptAmountParams.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/utils/useSubmitWalletFunding/useSubmitWalletFunding.cjs +10 -1
- package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/utils/useSubmitWalletFunding/useSubmitWalletFunding.js +10 -1
package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.cjs
CHANGED
|
@@ -39,7 +39,7 @@ const createEmbeddedWalletRequest = (_a) => _tslib.__awaiter(void 0, [_a], void
|
|
|
39
39
|
throw new utils.InvalidPrimaryWalletOrConnectorError();
|
|
40
40
|
}
|
|
41
41
|
if (!user) {
|
|
42
|
-
throw new utils.DynamicError('User is not defined');
|
|
42
|
+
throw new utils.DynamicError('User is not defined', 'user_is_not_defined');
|
|
43
43
|
}
|
|
44
44
|
walletConnector.setEmail(user.email);
|
|
45
45
|
let authenticatorBody;
|
|
@@ -58,12 +58,12 @@ const createEmbeddedWalletRequest = (_a) => _tslib.__awaiter(void 0, [_a], void
|
|
|
58
58
|
environmentId,
|
|
59
59
|
sessionPublicKey }, authenticatorBody));
|
|
60
60
|
if (!updatedUser) {
|
|
61
|
-
throw new utils.DynamicError('Failed to create embedded wallet');
|
|
61
|
+
throw new utils.DynamicError('Failed to create embedded wallet', 'create_embedded_wallet');
|
|
62
62
|
}
|
|
63
63
|
const primaryChain = walletConnector.connectedChain;
|
|
64
64
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(updatedUser, [primaryChain]);
|
|
65
65
|
if (!embeddedWalletVerifiedCredential) {
|
|
66
|
-
throw new utils.DynamicError('EmbeddedWalletVerifiedCredential not found');
|
|
66
|
+
throw new utils.DynamicError('EmbeddedWalletVerifiedCredential not found', 'embeddedwalletverifiedcredential_not_found');
|
|
67
67
|
}
|
|
68
68
|
walletConnector.setVerifiedCredentials(updatedUser.verifiedCredentials);
|
|
69
69
|
return {
|
package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.js
CHANGED
|
@@ -35,7 +35,7 @@ const createEmbeddedWalletRequest = (_a) => __awaiter(void 0, [_a], void 0, func
|
|
|
35
35
|
throw new InvalidPrimaryWalletOrConnectorError();
|
|
36
36
|
}
|
|
37
37
|
if (!user) {
|
|
38
|
-
throw new DynamicError('User is not defined');
|
|
38
|
+
throw new DynamicError('User is not defined', 'user_is_not_defined');
|
|
39
39
|
}
|
|
40
40
|
walletConnector.setEmail(user.email);
|
|
41
41
|
let authenticatorBody;
|
|
@@ -54,12 +54,12 @@ const createEmbeddedWalletRequest = (_a) => __awaiter(void 0, [_a], void 0, func
|
|
|
54
54
|
environmentId,
|
|
55
55
|
sessionPublicKey }, authenticatorBody));
|
|
56
56
|
if (!updatedUser) {
|
|
57
|
-
throw new DynamicError('Failed to create embedded wallet');
|
|
57
|
+
throw new DynamicError('Failed to create embedded wallet', 'create_embedded_wallet');
|
|
58
58
|
}
|
|
59
59
|
const primaryChain = walletConnector.connectedChain;
|
|
60
60
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(updatedUser, [primaryChain]);
|
|
61
61
|
if (!embeddedWalletVerifiedCredential) {
|
|
62
|
-
throw new DynamicError('EmbeddedWalletVerifiedCredential not found');
|
|
62
|
+
throw new DynamicError('EmbeddedWalletVerifiedCredential not found', 'embeddedwalletverifiedcredential_not_found');
|
|
63
63
|
}
|
|
64
64
|
walletConnector.setVerifiedCredentials(updatedUser.verifiedCredentials);
|
|
65
65
|
return {
|
|
@@ -41,7 +41,7 @@ var constants = require('../../PasskeyRecovery/constants.cjs');
|
|
|
41
41
|
const initEmbeddedWalletSession = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ authenticatorType, iframeContainer, iframeElementId, environmentId, user, wallet, sessionExpiration, }) {
|
|
42
42
|
var _b;
|
|
43
43
|
if (!user) {
|
|
44
|
-
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
44
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
45
45
|
}
|
|
46
46
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
47
47
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -59,7 +59,7 @@ const initEmbeddedWalletSession = (_a) => _tslib.__awaiter(void 0, [_a], void 0,
|
|
|
59
59
|
}
|
|
60
60
|
const publicKey = yield turnkeyRecoveryHandler.initRecovery(authenticatorType, iframeContainer, iframeElementId, sessionExpiration);
|
|
61
61
|
if (!publicKey) {
|
|
62
|
-
throw new utils.DynamicError('Something went wrong');
|
|
62
|
+
throw new utils.DynamicError('Something went wrong', 'recovery_init_failed');
|
|
63
63
|
}
|
|
64
64
|
const response = yield embeddedWallets.initEmbeddedWalletSession({
|
|
65
65
|
authenticatorType,
|
|
@@ -76,7 +76,7 @@ const initEmbeddedWalletSession = (_a) => _tslib.__awaiter(void 0, [_a], void 0,
|
|
|
76
76
|
const passkeyRecoveryBundleValidation = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ user, bundleInput, wallet, }) {
|
|
77
77
|
var _d, _e, _f, _g, _h;
|
|
78
78
|
if (!bundleInput) {
|
|
79
|
-
throw new utils.DynamicError('Code must be informed');
|
|
79
|
+
throw new utils.DynamicError('Code must be informed', 'code_must_be_informed');
|
|
80
80
|
}
|
|
81
81
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
82
82
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -84,7 +84,7 @@ const passkeyRecoveryBundleValidation = (_c) => _tslib.__awaiter(void 0, [_c], v
|
|
|
84
84
|
throw new utils.InvalidPrimaryWalletOrConnectorError();
|
|
85
85
|
}
|
|
86
86
|
if (!user) {
|
|
87
|
-
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
87
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
88
88
|
}
|
|
89
89
|
const organizationId = (_g = (_f = (_e = (_d = user.verifiedCredentials) === null || _d === void 0 ? void 0 : _d.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _e === void 0 ? void 0 : _e.walletProperties) === null || _f === void 0 ? void 0 : _f.turnkeySubOrganizationId) !== null && _g !== void 0 ? _g : undefined;
|
|
90
90
|
const turnkeyRecoveryHandler = (_h = wallet.connector) === null || _h === void 0 ? void 0 : _h.getAuthenticatorHandler();
|
|
@@ -99,7 +99,7 @@ const passkeyRecoveryBundleValidation = (_c) => _tslib.__awaiter(void 0, [_c], v
|
|
|
99
99
|
const resentRecoveryEmail = (_j) => _tslib.__awaiter(void 0, [_j], void 0, function* ({ authenticatorType, user, environmentId, wallet, }) {
|
|
100
100
|
var _k;
|
|
101
101
|
if (!user) {
|
|
102
|
-
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
102
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
103
103
|
}
|
|
104
104
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
105
105
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -108,7 +108,7 @@ const resentRecoveryEmail = (_j) => _tslib.__awaiter(void 0, [_j], void 0, funct
|
|
|
108
108
|
}
|
|
109
109
|
const publicKey = (_k = wallet.connector) === null || _k === void 0 ? void 0 : _k.getAuthenticatorHandler().publicKey;
|
|
110
110
|
if (!publicKey) {
|
|
111
|
-
throw new utils.DynamicError('Could not proceed with your request. Please restart the process.');
|
|
111
|
+
throw new utils.DynamicError('Could not proceed with your request. Please restart the process.', 'missing_public_key');
|
|
112
112
|
}
|
|
113
113
|
return embeddedWallets.initEmbeddedWalletSession({
|
|
114
114
|
authenticatorType,
|
|
@@ -142,7 +142,7 @@ const addNewPasskeyAuthenticator = (_m) => _tslib.__awaiter(void 0, [_m], void 0
|
|
|
142
142
|
const recoverTurnkeyWallet = (_o) => _tslib.__awaiter(void 0, [_o], void 0, function* ({ wallet, user, environmentId, addPasskeyAuthenticator, }) {
|
|
143
143
|
var _p, _q, _r;
|
|
144
144
|
if (!user) {
|
|
145
|
-
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
145
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
146
146
|
}
|
|
147
147
|
if (!wallet ||
|
|
148
148
|
!wallet.connector ||
|
|
@@ -154,7 +154,7 @@ const recoverTurnkeyWallet = (_o) => _tslib.__awaiter(void 0, [_o], void 0, func
|
|
|
154
154
|
connector.setEmail(user.email);
|
|
155
155
|
const turnkeySubOrganizationId = (_r = (_q = (_p = user.verifiedCredentials) === null || _p === void 0 ? void 0 : _p.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _q === void 0 ? void 0 : _q.walletProperties) === null || _r === void 0 ? void 0 : _r.turnkeySubOrganizationId;
|
|
156
156
|
if (!turnkeySubOrganizationId) {
|
|
157
|
-
throw new utils.DynamicError('The authentication token is invalid - turnkeySubOrganizationId is missing');
|
|
157
|
+
throw new utils.DynamicError('The authentication token is invalid - turnkeySubOrganizationId is missing', 'missing_turnkey_sub_organization_id');
|
|
158
158
|
}
|
|
159
159
|
const turnkeyRecoveryHandler = wallet.connector.getAuthenticatorHandler();
|
|
160
160
|
const { attestation, challenge } = yield connector.getWebAuthnAttestation();
|
|
@@ -179,12 +179,12 @@ const recoverTurnkeyWallet = (_o) => _tslib.__awaiter(void 0, [_o], void 0, func
|
|
|
179
179
|
walletId: wallet.id,
|
|
180
180
|
});
|
|
181
181
|
if (!updatedUser) {
|
|
182
|
-
throw new utils.DynamicError('No user returned from passkey recovery');
|
|
182
|
+
throw new utils.DynamicError('No user returned from passkey recovery', 'no_user_returned_from_passkey_recovery');
|
|
183
183
|
}
|
|
184
184
|
const chain = connector.connectedChain;
|
|
185
185
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(updatedUser, [chain]);
|
|
186
186
|
if (!embeddedWalletVerifiedCredential) {
|
|
187
|
-
throw new utils.DynamicError('EmbeddedWalletVerifiedCredential not found');
|
|
187
|
+
throw new utils.DynamicError('EmbeddedWalletVerifiedCredential not found', 'embeddedwalletverifiedcredential_not_found');
|
|
188
188
|
}
|
|
189
189
|
connector.setVerifiedCredentials(updatedUser.verifiedCredentials);
|
|
190
190
|
return {
|
|
@@ -213,7 +213,7 @@ const canRestoreEmbeddedWalletSession = (sessionExpirationTime) => {
|
|
|
213
213
|
const restoreEmbeddedWalletSession = (_s) => _tslib.__awaiter(void 0, [_s], void 0, function* ({ user, iframeContainer, iframeElementId, wallet, sessionExpiration, }) {
|
|
214
214
|
var _t, _u, _v, _w, _x;
|
|
215
215
|
if (!user) {
|
|
216
|
-
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
216
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
217
217
|
}
|
|
218
218
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
219
219
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -227,7 +227,7 @@ const restoreEmbeddedWalletSession = (_s) => _tslib.__awaiter(void 0, [_s], void
|
|
|
227
227
|
}
|
|
228
228
|
const publicKey = yield turnkeyRecoveryHandler.initRecovery('email', iframeContainer, iframeElementId, sessionExpiration);
|
|
229
229
|
if (!publicKey) {
|
|
230
|
-
throw new utils.DynamicError('Could not open embedded wallet connection communication');
|
|
230
|
+
throw new utils.DynamicError('Could not open embedded wallet connection communication', 'embedded_wallet_connection_failed');
|
|
231
231
|
}
|
|
232
232
|
turnkeyRecoveryHandler.recoveryUserId = sessionSettings.userId;
|
|
233
233
|
const organizationId = (_x = (_w = (_v = (_u = user.verifiedCredentials) === null || _u === void 0 ? void 0 : _u.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _v === void 0 ? void 0 : _v.walletProperties) === null || _w === void 0 ? void 0 : _w.turnkeySubOrganizationId) !== null && _x !== void 0 ? _x : undefined;
|
|
@@ -237,7 +237,7 @@ const restoreEmbeddedWalletSession = (_s) => _tslib.__awaiter(void 0, [_s], void
|
|
|
237
237
|
const addEmailRecovery = (_y) => _tslib.__awaiter(void 0, [_y], void 0, function* ({ user: user$1, environmentId, wallet, }) {
|
|
238
238
|
var _z, _0;
|
|
239
239
|
if (!(user$1 === null || user$1 === void 0 ? void 0 : user$1.email)) {
|
|
240
|
-
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
240
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
241
241
|
}
|
|
242
242
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
243
243
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -247,7 +247,7 @@ const addEmailRecovery = (_y) => _tslib.__awaiter(void 0, [_y], void 0, function
|
|
|
247
247
|
}
|
|
248
248
|
const { turnkeySubOrganizationId, turnkeyUserId } = (_0 = (_z = user$1.verifiedCredentials) === null || _z === void 0 ? void 0 : _z.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _0 === void 0 ? void 0 : _0.walletProperties;
|
|
249
249
|
if (!turnkeySubOrganizationId || !turnkeyUserId) {
|
|
250
|
-
throw new utils.DynamicError('The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing');
|
|
250
|
+
throw new utils.DynamicError('The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing', 'missing_turnkey_credentials');
|
|
251
251
|
}
|
|
252
252
|
const turnkeyRecoveryHandler = wallet.connector.getAuthenticatorHandler();
|
|
253
253
|
const { signedRequest } = (yield turnkeyRecoveryHandler.addEmailRecovery({
|
|
@@ -37,7 +37,7 @@ import { iframeElementId } from '../../PasskeyRecovery/constants.js';
|
|
|
37
37
|
const initEmbeddedWalletSession = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authenticatorType, iframeContainer, iframeElementId, environmentId, user, wallet, sessionExpiration, }) {
|
|
38
38
|
var _b;
|
|
39
39
|
if (!user) {
|
|
40
|
-
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
40
|
+
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
41
41
|
}
|
|
42
42
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
43
43
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -55,7 +55,7 @@ const initEmbeddedWalletSession = (_a) => __awaiter(void 0, [_a], void 0, functi
|
|
|
55
55
|
}
|
|
56
56
|
const publicKey = yield turnkeyRecoveryHandler.initRecovery(authenticatorType, iframeContainer, iframeElementId, sessionExpiration);
|
|
57
57
|
if (!publicKey) {
|
|
58
|
-
throw new DynamicError('Something went wrong');
|
|
58
|
+
throw new DynamicError('Something went wrong', 'recovery_init_failed');
|
|
59
59
|
}
|
|
60
60
|
const response = yield initEmbeddedWalletSession$1({
|
|
61
61
|
authenticatorType,
|
|
@@ -72,7 +72,7 @@ const initEmbeddedWalletSession = (_a) => __awaiter(void 0, [_a], void 0, functi
|
|
|
72
72
|
const passkeyRecoveryBundleValidation = (_c) => __awaiter(void 0, [_c], void 0, function* ({ user, bundleInput, wallet, }) {
|
|
73
73
|
var _d, _e, _f, _g, _h;
|
|
74
74
|
if (!bundleInput) {
|
|
75
|
-
throw new DynamicError('Code must be informed');
|
|
75
|
+
throw new DynamicError('Code must be informed', 'code_must_be_informed');
|
|
76
76
|
}
|
|
77
77
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
78
78
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -80,7 +80,7 @@ const passkeyRecoveryBundleValidation = (_c) => __awaiter(void 0, [_c], void 0,
|
|
|
80
80
|
throw new InvalidPrimaryWalletOrConnectorError();
|
|
81
81
|
}
|
|
82
82
|
if (!user) {
|
|
83
|
-
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
83
|
+
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
84
84
|
}
|
|
85
85
|
const organizationId = (_g = (_f = (_e = (_d = user.verifiedCredentials) === null || _d === void 0 ? void 0 : _d.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _e === void 0 ? void 0 : _e.walletProperties) === null || _f === void 0 ? void 0 : _f.turnkeySubOrganizationId) !== null && _g !== void 0 ? _g : undefined;
|
|
86
86
|
const turnkeyRecoveryHandler = (_h = wallet.connector) === null || _h === void 0 ? void 0 : _h.getAuthenticatorHandler();
|
|
@@ -95,7 +95,7 @@ const passkeyRecoveryBundleValidation = (_c) => __awaiter(void 0, [_c], void 0,
|
|
|
95
95
|
const resentRecoveryEmail = (_j) => __awaiter(void 0, [_j], void 0, function* ({ authenticatorType, user, environmentId, wallet, }) {
|
|
96
96
|
var _k;
|
|
97
97
|
if (!user) {
|
|
98
|
-
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
98
|
+
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
99
99
|
}
|
|
100
100
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
101
101
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -104,7 +104,7 @@ const resentRecoveryEmail = (_j) => __awaiter(void 0, [_j], void 0, function* ({
|
|
|
104
104
|
}
|
|
105
105
|
const publicKey = (_k = wallet.connector) === null || _k === void 0 ? void 0 : _k.getAuthenticatorHandler().publicKey;
|
|
106
106
|
if (!publicKey) {
|
|
107
|
-
throw new DynamicError('Could not proceed with your request. Please restart the process.');
|
|
107
|
+
throw new DynamicError('Could not proceed with your request. Please restart the process.', 'missing_public_key');
|
|
108
108
|
}
|
|
109
109
|
return initEmbeddedWalletSession$1({
|
|
110
110
|
authenticatorType,
|
|
@@ -138,7 +138,7 @@ const addNewPasskeyAuthenticator = (_m) => __awaiter(void 0, [_m], void 0, funct
|
|
|
138
138
|
const recoverTurnkeyWallet = (_o) => __awaiter(void 0, [_o], void 0, function* ({ wallet, user, environmentId, addPasskeyAuthenticator, }) {
|
|
139
139
|
var _p, _q, _r;
|
|
140
140
|
if (!user) {
|
|
141
|
-
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
141
|
+
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
142
142
|
}
|
|
143
143
|
if (!wallet ||
|
|
144
144
|
!wallet.connector ||
|
|
@@ -150,7 +150,7 @@ const recoverTurnkeyWallet = (_o) => __awaiter(void 0, [_o], void 0, function* (
|
|
|
150
150
|
connector.setEmail(user.email);
|
|
151
151
|
const turnkeySubOrganizationId = (_r = (_q = (_p = user.verifiedCredentials) === null || _p === void 0 ? void 0 : _p.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _q === void 0 ? void 0 : _q.walletProperties) === null || _r === void 0 ? void 0 : _r.turnkeySubOrganizationId;
|
|
152
152
|
if (!turnkeySubOrganizationId) {
|
|
153
|
-
throw new DynamicError('The authentication token is invalid - turnkeySubOrganizationId is missing');
|
|
153
|
+
throw new DynamicError('The authentication token is invalid - turnkeySubOrganizationId is missing', 'missing_turnkey_sub_organization_id');
|
|
154
154
|
}
|
|
155
155
|
const turnkeyRecoveryHandler = wallet.connector.getAuthenticatorHandler();
|
|
156
156
|
const { attestation, challenge } = yield connector.getWebAuthnAttestation();
|
|
@@ -175,12 +175,12 @@ const recoverTurnkeyWallet = (_o) => __awaiter(void 0, [_o], void 0, function* (
|
|
|
175
175
|
walletId: wallet.id,
|
|
176
176
|
});
|
|
177
177
|
if (!updatedUser) {
|
|
178
|
-
throw new DynamicError('No user returned from passkey recovery');
|
|
178
|
+
throw new DynamicError('No user returned from passkey recovery', 'no_user_returned_from_passkey_recovery');
|
|
179
179
|
}
|
|
180
180
|
const chain = connector.connectedChain;
|
|
181
181
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(updatedUser, [chain]);
|
|
182
182
|
if (!embeddedWalletVerifiedCredential) {
|
|
183
|
-
throw new DynamicError('EmbeddedWalletVerifiedCredential not found');
|
|
183
|
+
throw new DynamicError('EmbeddedWalletVerifiedCredential not found', 'embeddedwalletverifiedcredential_not_found');
|
|
184
184
|
}
|
|
185
185
|
connector.setVerifiedCredentials(updatedUser.verifiedCredentials);
|
|
186
186
|
return {
|
|
@@ -209,7 +209,7 @@ const canRestoreEmbeddedWalletSession = (sessionExpirationTime) => {
|
|
|
209
209
|
const restoreEmbeddedWalletSession = (_s) => __awaiter(void 0, [_s], void 0, function* ({ user, iframeContainer, iframeElementId, wallet, sessionExpiration, }) {
|
|
210
210
|
var _t, _u, _v, _w, _x;
|
|
211
211
|
if (!user) {
|
|
212
|
-
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
212
|
+
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
213
213
|
}
|
|
214
214
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
215
215
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -223,7 +223,7 @@ const restoreEmbeddedWalletSession = (_s) => __awaiter(void 0, [_s], void 0, fun
|
|
|
223
223
|
}
|
|
224
224
|
const publicKey = yield turnkeyRecoveryHandler.initRecovery('email', iframeContainer, iframeElementId, sessionExpiration);
|
|
225
225
|
if (!publicKey) {
|
|
226
|
-
throw new DynamicError('Could not open embedded wallet connection communication');
|
|
226
|
+
throw new DynamicError('Could not open embedded wallet connection communication', 'embedded_wallet_connection_failed');
|
|
227
227
|
}
|
|
228
228
|
turnkeyRecoveryHandler.recoveryUserId = sessionSettings.userId;
|
|
229
229
|
const organizationId = (_x = (_w = (_v = (_u = user.verifiedCredentials) === null || _u === void 0 ? void 0 : _u.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _v === void 0 ? void 0 : _v.walletProperties) === null || _w === void 0 ? void 0 : _w.turnkeySubOrganizationId) !== null && _x !== void 0 ? _x : undefined;
|
|
@@ -233,7 +233,7 @@ const restoreEmbeddedWalletSession = (_s) => __awaiter(void 0, [_s], void 0, fun
|
|
|
233
233
|
const addEmailRecovery = (_y) => __awaiter(void 0, [_y], void 0, function* ({ user, environmentId, wallet, }) {
|
|
234
234
|
var _z, _0;
|
|
235
235
|
if (!(user === null || user === void 0 ? void 0 : user.email)) {
|
|
236
|
-
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
236
|
+
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
237
237
|
}
|
|
238
238
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
239
239
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -243,7 +243,7 @@ const addEmailRecovery = (_y) => __awaiter(void 0, [_y], void 0, function* ({ us
|
|
|
243
243
|
}
|
|
244
244
|
const { turnkeySubOrganizationId, turnkeyUserId } = (_0 = (_z = user.verifiedCredentials) === null || _z === void 0 ? void 0 : _z.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _0 === void 0 ? void 0 : _0.walletProperties;
|
|
245
245
|
if (!turnkeySubOrganizationId || !turnkeyUserId) {
|
|
246
|
-
throw new DynamicError('The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing');
|
|
246
|
+
throw new DynamicError('The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing', 'missing_turnkey_credentials');
|
|
247
247
|
}
|
|
248
248
|
const turnkeyRecoveryHandler = wallet.connector.getAuthenticatorHandler();
|
|
249
249
|
const { signedRequest } = (yield turnkeyRecoveryHandler.addEmailRecovery({
|
|
@@ -167,10 +167,10 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
167
167
|
includeNativeBalance: true,
|
|
168
168
|
});
|
|
169
169
|
if (!primaryWallet) {
|
|
170
|
-
throw new utils.DynamicError('Primary wallet is not available, send balance cannot be displayed');
|
|
170
|
+
throw new utils.DynamicError('Primary wallet is not available, send balance cannot be displayed', 'no_primary_wallet');
|
|
171
171
|
}
|
|
172
172
|
if (walletConnector && !walletConnectorCore.isSendBalanceWalletConnector(walletConnector)) {
|
|
173
|
-
throw new utils.DynamicError('Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector');
|
|
173
|
+
throw new utils.DynamicError('Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector', 'invalid_wallet_connector');
|
|
174
174
|
}
|
|
175
175
|
const [transaction, setTransaction] = React.useState(null);
|
|
176
176
|
React.useEffect(() => {
|
|
@@ -163,10 +163,10 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
163
163
|
includeNativeBalance: true,
|
|
164
164
|
});
|
|
165
165
|
if (!primaryWallet) {
|
|
166
|
-
throw new DynamicError('Primary wallet is not available, send balance cannot be displayed');
|
|
166
|
+
throw new DynamicError('Primary wallet is not available, send balance cannot be displayed', 'no_primary_wallet');
|
|
167
167
|
}
|
|
168
168
|
if (walletConnector && !isSendBalanceWalletConnector(walletConnector)) {
|
|
169
|
-
throw new DynamicError('Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector');
|
|
169
|
+
throw new DynamicError('Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector', 'invalid_wallet_connector');
|
|
170
170
|
}
|
|
171
171
|
const [transaction, setTransaction] = useState(null);
|
|
172
172
|
useEffect(() => {
|
|
@@ -113,7 +113,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
113
113
|
});
|
|
114
114
|
const { mutate: handleDelegateWallets, isLoading, error, data: isSuccess, } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
115
115
|
if (selectedWallets.size === 0) {
|
|
116
|
-
throw new utils.DynamicError('No wallets selected for delegation');
|
|
116
|
+
throw new utils.DynamicError('No wallets selected for delegation', 'no_wallets_selected_for_delegation');
|
|
117
117
|
}
|
|
118
118
|
const selectedWalletObjects = waasWallets.filter((wallet) => selectedWallets.has(wallet.id));
|
|
119
119
|
// Prepare delegation array
|
|
@@ -109,7 +109,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
109
109
|
});
|
|
110
110
|
const { mutate: handleDelegateWallets, isLoading, error, data: isSuccess, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
111
|
if (selectedWallets.size === 0) {
|
|
112
|
-
throw new DynamicError('No wallets selected for delegation');
|
|
112
|
+
throw new DynamicError('No wallets selected for delegation', 'no_wallets_selected_for_delegation');
|
|
113
113
|
}
|
|
114
114
|
const selectedWalletObjects = waasWallets.filter((wallet) => selectedWallets.has(wallet.id));
|
|
115
115
|
// Prepare delegation array
|
|
@@ -173,7 +173,7 @@ const WalletUpgradeFlowView = ({ wallets, method, onComplete, onCancel, }) => {
|
|
|
173
173
|
}, []);
|
|
174
174
|
const { mutate: handleUpgradeWallet, isLoading: isUpgrading, error: upgradeError, } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
175
175
|
if (!privateKeyInput.trim()) {
|
|
176
|
-
throw new utils.DynamicError('Private key is required');
|
|
176
|
+
throw new utils.DynamicError('Private key is required', 'private_key_is_required');
|
|
177
177
|
}
|
|
178
178
|
yield upgradeToDynamicWaas({
|
|
179
179
|
privateKey: privateKeyInput.trim(),
|
|
@@ -169,7 +169,7 @@ const WalletUpgradeFlowView = ({ wallets, method, onComplete, onCancel, }) => {
|
|
|
169
169
|
}, []);
|
|
170
170
|
const { mutate: handleUpgradeWallet, isLoading: isUpgrading, error: upgradeError, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
171
171
|
if (!privateKeyInput.trim()) {
|
|
172
|
-
throw new DynamicError('Private key is required');
|
|
172
|
+
throw new DynamicError('Private key is required', 'private_key_is_required');
|
|
173
173
|
}
|
|
174
174
|
yield upgradeToDynamicWaas({
|
|
175
175
|
privateKey: privateKeyInput.trim(),
|
|
@@ -38,7 +38,7 @@ const getPromptAmountParams = ({ wallet, }) => {
|
|
|
38
38
|
const chainSettings = (_e = (_d = (_c = (_b = (_a = getProjectSettings.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);
|
|
39
39
|
// This is always supposed to be present, otherwise there's some backend error
|
|
40
40
|
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))
|
|
41
|
-
throw new utils.DynamicError(`No wallet funding chain settings found for chain ${walletChain}
|
|
41
|
+
throw new utils.DynamicError(`No wallet funding chain settings found for chain ${walletChain}`, 'missing_funding_chain_settings');
|
|
42
42
|
return {
|
|
43
43
|
token: {
|
|
44
44
|
rule: chainSettings.token.rule,
|
|
@@ -34,7 +34,7 @@ const getPromptAmountParams = ({ wallet, }) => {
|
|
|
34
34
|
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);
|
|
35
35
|
// This is always supposed to be present, otherwise there's some backend error
|
|
36
36
|
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))
|
|
37
|
-
throw new DynamicError(`No wallet funding chain settings found for chain ${walletChain}
|
|
37
|
+
throw new DynamicError(`No wallet funding chain settings found for chain ${walletChain}`, 'missing_funding_chain_settings');
|
|
38
38
|
return {
|
|
39
39
|
token: {
|
|
40
40
|
rule: chainSettings.token.rule,
|
|
@@ -12,12 +12,14 @@ var logger = require('../../../../../../shared/logger.cjs');
|
|
|
12
12
|
var getTransactionLink = require('../../../../../../utils/functions/getTransactionLink/getTransactionLink.cjs');
|
|
13
13
|
var pixelToRem = require('../../../../../../utils/functions/pixelToRem/pixelToRem.cjs');
|
|
14
14
|
var useFundWithWallet = require('../../../../../../utils/hooks/useFundWithWallet/useFundWithWallet.cjs');
|
|
15
|
+
var useViewSettings = require('../../../../../../utils/hooks/useViewSettings/useViewSettings.cjs');
|
|
15
16
|
var DynamicWidgetContext = require('../../../../context/DynamicWidgetContext.cjs');
|
|
16
17
|
|
|
17
18
|
const useSubmitWalletFunding = () => {
|
|
18
19
|
const { fund } = useFundWithWallet.useInternalFundWithWallet();
|
|
19
20
|
const { goToInitialDynamicWidgetView, setHeaderAlert } = DynamicWidgetContext.useWidgetContext();
|
|
20
21
|
const { t } = reactI18next.useTranslation();
|
|
22
|
+
const txConfirmationSettings = useViewSettings.useViewSettings('transaction-confirmation');
|
|
21
23
|
return React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ tokenAmount, wallet, tokenSymbol, tokenBalances, toWallet, }) {
|
|
22
24
|
var _b;
|
|
23
25
|
if (!tokenAmount)
|
|
@@ -40,6 +42,7 @@ const useSubmitWalletFunding = () => {
|
|
|
40
42
|
if (txId) {
|
|
41
43
|
txLink = yield getTransactionLink.getTransactionLink({
|
|
42
44
|
transactionHash: txId,
|
|
45
|
+
userOpSupportedExplorers: txConfirmationSettings === null || txConfirmationSettings === void 0 ? void 0 : txConfirmationSettings.userOpSupportedExplorers,
|
|
43
46
|
walletConnector: wallet.connector,
|
|
44
47
|
});
|
|
45
48
|
}
|
|
@@ -58,7 +61,13 @@ const useSubmitWalletFunding = () => {
|
|
|
58
61
|
catch (error) {
|
|
59
62
|
logger.logger.error('Failed to fund with wallet', error);
|
|
60
63
|
}
|
|
61
|
-
}), [
|
|
64
|
+
}), [
|
|
65
|
+
fund,
|
|
66
|
+
goToInitialDynamicWidgetView,
|
|
67
|
+
setHeaderAlert,
|
|
68
|
+
t,
|
|
69
|
+
txConfirmationSettings,
|
|
70
|
+
]);
|
|
62
71
|
};
|
|
63
72
|
|
|
64
73
|
exports.useSubmitWalletFunding = useSubmitWalletFunding;
|
|
@@ -8,12 +8,14 @@ import { logger } from '../../../../../../shared/logger.js';
|
|
|
8
8
|
import { getTransactionLink } from '../../../../../../utils/functions/getTransactionLink/getTransactionLink.js';
|
|
9
9
|
import { pixelToRem } from '../../../../../../utils/functions/pixelToRem/pixelToRem.js';
|
|
10
10
|
import { useInternalFundWithWallet } from '../../../../../../utils/hooks/useFundWithWallet/useFundWithWallet.js';
|
|
11
|
+
import { useViewSettings } from '../../../../../../utils/hooks/useViewSettings/useViewSettings.js';
|
|
11
12
|
import { useWidgetContext } from '../../../../context/DynamicWidgetContext.js';
|
|
12
13
|
|
|
13
14
|
const useSubmitWalletFunding = () => {
|
|
14
15
|
const { fund } = useInternalFundWithWallet();
|
|
15
16
|
const { goToInitialDynamicWidgetView, setHeaderAlert } = useWidgetContext();
|
|
16
17
|
const { t } = useTranslation();
|
|
18
|
+
const txConfirmationSettings = useViewSettings('transaction-confirmation');
|
|
17
19
|
return useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ tokenAmount, wallet, tokenSymbol, tokenBalances, toWallet, }) {
|
|
18
20
|
var _b;
|
|
19
21
|
if (!tokenAmount)
|
|
@@ -36,6 +38,7 @@ const useSubmitWalletFunding = () => {
|
|
|
36
38
|
if (txId) {
|
|
37
39
|
txLink = yield getTransactionLink({
|
|
38
40
|
transactionHash: txId,
|
|
41
|
+
userOpSupportedExplorers: txConfirmationSettings === null || txConfirmationSettings === void 0 ? void 0 : txConfirmationSettings.userOpSupportedExplorers,
|
|
39
42
|
walletConnector: wallet.connector,
|
|
40
43
|
});
|
|
41
44
|
}
|
|
@@ -54,7 +57,13 @@ const useSubmitWalletFunding = () => {
|
|
|
54
57
|
catch (error) {
|
|
55
58
|
logger.error('Failed to fund with wallet', error);
|
|
56
59
|
}
|
|
57
|
-
}), [
|
|
60
|
+
}), [
|
|
61
|
+
fund,
|
|
62
|
+
goToInitialDynamicWidgetView,
|
|
63
|
+
setHeaderAlert,
|
|
64
|
+
t,
|
|
65
|
+
txConfirmationSettings,
|
|
66
|
+
]);
|
|
58
67
|
};
|
|
59
68
|
|
|
60
69
|
export { useSubmitWalletFunding };
|