@dynamic-labs/sdk-react-core 4.3.0 → 4.3.1
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 +9 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/SignMessagePreview/SignMessagePreview.cjs +2 -1
- package/src/lib/components/SignMessagePreview/SignMessagePreview.js +2 -1
- package/src/lib/components/SignMessagePreview/utils/safeJsonParse/index.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/utils/safeJsonParse/safeJsonParse.cjs +21 -0
- package/src/lib/components/SignMessagePreview/utils/safeJsonParse/safeJsonParse.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/utils/safeJsonParse/safeJsonParse.js +17 -0
- package/src/lib/context/UserWalletsContext/UserWalletsContext.cjs +19 -14
- package/src/lib/context/UserWalletsContext/UserWalletsContext.js +20 -15
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/data/api/wallets/wallets.cjs +3 -0
- package/src/lib/data/api/wallets/wallets.js +4 -1
- package/src/lib/locale/en/translation.cjs +4 -0
- package/src/lib/locale/en/translation.d.ts +4 -0
- package/src/lib/locale/en/translation.js +4 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getWalletUniqueId/getWalletUniqueId.cjs +13 -0
- package/src/lib/utils/functions/getWalletUniqueId/getWalletUniqueId.d.ts +10 -0
- package/src/lib/utils/functions/getWalletUniqueId/getWalletUniqueId.js +9 -0
- package/src/lib/utils/functions/getWalletUniqueId/index.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +6 -13
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +6 -13
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +4 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +4 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +5 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +6 -1
- package/src/lib/views/WalletAlreadyExistsView/WalletAlreadyExistsView.cjs +109 -0
- package/src/lib/views/WalletAlreadyExistsView/WalletAlreadyExistsView.d.ts +2 -0
- package/src/lib/views/WalletAlreadyExistsView/WalletAlreadyExistsView.js +105 -0
- package/src/lib/views/WalletAlreadyExistsView/index.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs +8 -6
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js +8 -6
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +10 -4
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.d.ts +3 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.3.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.3.0...v4.3.1) (2025-01-23)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* correctly parse message to sign when it has unscaped new line character ([#7850](https://github.com/dynamic-labs/dynamic-auth/issues/7850)) ([156c144](https://github.com/dynamic-labs/dynamic-auth/commit/156c1440989ef7cb9a9066491e8670bc1737eb68))
|
|
8
|
+
* ensure user wallets state has been updated before emitting walletAdded/walletRemoved events ([#7863](https://github.com/dynamic-labs/dynamic-auth/issues/7863)) ([2bf61db](https://github.com/dynamic-labs/dynamic-auth/commit/2bf61dbace85d93c8fb684a9c7304fe562a85395))
|
|
9
|
+
* ensure zerodev simulation has correct gas limit and initCode data ([#7861](https://github.com/dynamic-labs/dynamic-auth/issues/7861)) ([88c2588](https://github.com/dynamic-labs/dynamic-auth/commit/88c2588256a2421907c0d9f0f724a8708cf9a54a))
|
|
10
|
+
|
|
2
11
|
## [4.3.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.2.3...v4.3.0) (2025-01-21)
|
|
3
12
|
|
|
4
13
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.586",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"react-i18next": "13.5.0",
|
|
14
14
|
"yup": "0.32.11",
|
|
15
15
|
"react-international-phone": "4.2.5",
|
|
16
|
-
"@dynamic-labs/assert-package-version": "4.3.
|
|
17
|
-
"@dynamic-labs/iconic": "4.3.
|
|
18
|
-
"@dynamic-labs/logger": "4.3.
|
|
19
|
-
"@dynamic-labs/multi-wallet": "4.3.
|
|
20
|
-
"@dynamic-labs/rpc-providers": "4.3.
|
|
21
|
-
"@dynamic-labs/store": "4.3.
|
|
22
|
-
"@dynamic-labs/types": "4.3.
|
|
23
|
-
"@dynamic-labs/utils": "4.3.
|
|
24
|
-
"@dynamic-labs/wallet-book": "4.3.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "4.3.
|
|
16
|
+
"@dynamic-labs/assert-package-version": "4.3.1",
|
|
17
|
+
"@dynamic-labs/iconic": "4.3.1",
|
|
18
|
+
"@dynamic-labs/logger": "4.3.1",
|
|
19
|
+
"@dynamic-labs/multi-wallet": "4.3.1",
|
|
20
|
+
"@dynamic-labs/rpc-providers": "4.3.1",
|
|
21
|
+
"@dynamic-labs/store": "4.3.1",
|
|
22
|
+
"@dynamic-labs/types": "4.3.1",
|
|
23
|
+
"@dynamic-labs/utils": "4.3.1",
|
|
24
|
+
"@dynamic-labs/wallet-book": "4.3.1",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "4.3.1",
|
|
26
26
|
"bs58": "5.0.0",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
@@ -11,11 +11,12 @@ var isSignTypedData = require('./utils/isSignTypedData/isSignTypedData.cjs');
|
|
|
11
11
|
var isRawMessage = require('./utils/isRawMessage/isRawMessage.cjs');
|
|
12
12
|
var SignTypedDataPreview = require('./components/SignTypedDataPreview/SignTypedDataPreview.cjs');
|
|
13
13
|
var containsSpecialCharacters = require('./utils/containsSpecialCharacters/containsSpecialCharacters.cjs');
|
|
14
|
+
var safeJsonParse = require('./utils/safeJsonParse/safeJsonParse.cjs');
|
|
14
15
|
|
|
15
16
|
const SignMessagePreview = ({ message, }) => {
|
|
16
17
|
const jsonMessage = React.useMemo(() => {
|
|
17
18
|
try {
|
|
18
|
-
const json =
|
|
19
|
+
const json = safeJsonParse.safeJsonParse(message);
|
|
19
20
|
return json;
|
|
20
21
|
}
|
|
21
22
|
catch (e) {
|
|
@@ -7,11 +7,12 @@ import { isSignTypedData } from './utils/isSignTypedData/isSignTypedData.js';
|
|
|
7
7
|
import { isRawMessage } from './utils/isRawMessage/isRawMessage.js';
|
|
8
8
|
import { SignTypedDataPreview } from './components/SignTypedDataPreview/SignTypedDataPreview.js';
|
|
9
9
|
import { containsSpecialCharacters } from './utils/containsSpecialCharacters/containsSpecialCharacters.js';
|
|
10
|
+
import { safeJsonParse } from './utils/safeJsonParse/safeJsonParse.js';
|
|
10
11
|
|
|
11
12
|
const SignMessagePreview = ({ message, }) => {
|
|
12
13
|
const jsonMessage = useMemo(() => {
|
|
13
14
|
try {
|
|
14
|
-
const json =
|
|
15
|
+
const json = safeJsonParse(message);
|
|
15
16
|
return json;
|
|
16
17
|
}
|
|
17
18
|
catch (e) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { safeJsonParse } from './safeJsonParse';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const safeJsonParse = (message) => {
|
|
7
|
+
try {
|
|
8
|
+
// First attempt a direct parse
|
|
9
|
+
return JSON.parse(message);
|
|
10
|
+
}
|
|
11
|
+
catch (e) {
|
|
12
|
+
if (message.includes('raw')) {
|
|
13
|
+
// If that fails, attempt to fix newlines, then parse
|
|
14
|
+
const fixed = message.replace(/\n/g, '\\n');
|
|
15
|
+
return JSON.parse(fixed);
|
|
16
|
+
}
|
|
17
|
+
throw e;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.safeJsonParse = safeJsonParse;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const safeJsonParse: (message: string) => any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const safeJsonParse = (message) => {
|
|
3
|
+
try {
|
|
4
|
+
// First attempt a direct parse
|
|
5
|
+
return JSON.parse(message);
|
|
6
|
+
}
|
|
7
|
+
catch (e) {
|
|
8
|
+
if (message.includes('raw')) {
|
|
9
|
+
// If that fails, attempt to fix newlines, then parse
|
|
10
|
+
const fixed = message.replace(/\n/g, '\\n');
|
|
11
|
+
return JSON.parse(fixed);
|
|
12
|
+
}
|
|
13
|
+
throw e;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { safeJsonParse };
|
|
@@ -11,28 +11,33 @@ var dynamicEvents = require('../../events/dynamicEvents.cjs');
|
|
|
11
11
|
const UserWalletsContext = React.createContext(undefined);
|
|
12
12
|
const UserWalletsProvider = ({ children }) => {
|
|
13
13
|
const [userWallets, _setUserWallets] = React.useState([]);
|
|
14
|
+
const prevUserWallets = React.useRef([]);
|
|
14
15
|
const addedWalletsIds = React.useRef([]);
|
|
15
16
|
const removedWalletsIds = React.useRef([]);
|
|
16
17
|
const setUserWallets = React.useCallback((returnUpdatedWallets) => {
|
|
17
18
|
_setUserWallets((prevWallets) => {
|
|
19
|
+
prevUserWallets.current = prevWallets;
|
|
18
20
|
const updatedWallets = returnUpdatedWallets(prevWallets);
|
|
19
|
-
addedWalletsIds.current.forEach((walletId) => {
|
|
20
|
-
const wallet = updatedWallets.find(({ id }) => id === walletId);
|
|
21
|
-
if (!wallet)
|
|
22
|
-
return;
|
|
23
|
-
dynamicEvents.dynamicEvents.emit('walletAdded', wallet, updatedWallets);
|
|
24
|
-
});
|
|
25
|
-
removedWalletsIds.current.forEach((walletId) => {
|
|
26
|
-
const wallet = prevWallets.find(({ id }) => id === walletId);
|
|
27
|
-
if (!wallet)
|
|
28
|
-
return;
|
|
29
|
-
dynamicEvents.dynamicEvents.emit('walletRemoved', wallet, updatedWallets);
|
|
30
|
-
});
|
|
31
|
-
addedWalletsIds.current = [];
|
|
32
|
-
removedWalletsIds.current = [];
|
|
33
21
|
return updatedWallets;
|
|
34
22
|
});
|
|
35
23
|
}, []);
|
|
24
|
+
// it's an useEffect because it needs to be called after the userWallets state is updated
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
addedWalletsIds.current.forEach((walletId) => {
|
|
27
|
+
const wallet = userWallets.find(({ id }) => id === walletId);
|
|
28
|
+
if (!wallet)
|
|
29
|
+
return;
|
|
30
|
+
dynamicEvents.dynamicEvents.emit('walletAdded', wallet, userWallets);
|
|
31
|
+
});
|
|
32
|
+
removedWalletsIds.current.forEach((walletId) => {
|
|
33
|
+
const wallet = prevUserWallets.current.find(({ id }) => id === walletId);
|
|
34
|
+
if (!wallet)
|
|
35
|
+
return;
|
|
36
|
+
dynamicEvents.dynamicEvents.emit('walletRemoved', wallet, userWallets);
|
|
37
|
+
});
|
|
38
|
+
addedWalletsIds.current = [];
|
|
39
|
+
removedWalletsIds.current = [];
|
|
40
|
+
}, [userWallets]);
|
|
36
41
|
return (jsxRuntime.jsx(UserWalletsContext.Provider, { value: {
|
|
37
42
|
addedWalletsIds,
|
|
38
43
|
registerUserWallet: (newWallet) => setUserWallets((userWallets) => [...userWallets, newWallet]),
|
|
@@ -1,34 +1,39 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { createContext, useContext, useState, useRef, useCallback } from 'react';
|
|
3
|
+
import { createContext, useContext, useState, useRef, useCallback, useEffect } from 'react';
|
|
4
4
|
import { dynamicEvents } from '../../events/dynamicEvents.js';
|
|
5
5
|
|
|
6
6
|
/** Context for accessing the current user/session's wallets */
|
|
7
7
|
const UserWalletsContext = createContext(undefined);
|
|
8
8
|
const UserWalletsProvider = ({ children }) => {
|
|
9
9
|
const [userWallets, _setUserWallets] = useState([]);
|
|
10
|
+
const prevUserWallets = useRef([]);
|
|
10
11
|
const addedWalletsIds = useRef([]);
|
|
11
12
|
const removedWalletsIds = useRef([]);
|
|
12
13
|
const setUserWallets = useCallback((returnUpdatedWallets) => {
|
|
13
14
|
_setUserWallets((prevWallets) => {
|
|
15
|
+
prevUserWallets.current = prevWallets;
|
|
14
16
|
const updatedWallets = returnUpdatedWallets(prevWallets);
|
|
15
|
-
addedWalletsIds.current.forEach((walletId) => {
|
|
16
|
-
const wallet = updatedWallets.find(({ id }) => id === walletId);
|
|
17
|
-
if (!wallet)
|
|
18
|
-
return;
|
|
19
|
-
dynamicEvents.emit('walletAdded', wallet, updatedWallets);
|
|
20
|
-
});
|
|
21
|
-
removedWalletsIds.current.forEach((walletId) => {
|
|
22
|
-
const wallet = prevWallets.find(({ id }) => id === walletId);
|
|
23
|
-
if (!wallet)
|
|
24
|
-
return;
|
|
25
|
-
dynamicEvents.emit('walletRemoved', wallet, updatedWallets);
|
|
26
|
-
});
|
|
27
|
-
addedWalletsIds.current = [];
|
|
28
|
-
removedWalletsIds.current = [];
|
|
29
17
|
return updatedWallets;
|
|
30
18
|
});
|
|
31
19
|
}, []);
|
|
20
|
+
// it's an useEffect because it needs to be called after the userWallets state is updated
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
addedWalletsIds.current.forEach((walletId) => {
|
|
23
|
+
const wallet = userWallets.find(({ id }) => id === walletId);
|
|
24
|
+
if (!wallet)
|
|
25
|
+
return;
|
|
26
|
+
dynamicEvents.emit('walletAdded', wallet, userWallets);
|
|
27
|
+
});
|
|
28
|
+
removedWalletsIds.current.forEach((walletId) => {
|
|
29
|
+
const wallet = prevUserWallets.current.find(({ id }) => id === walletId);
|
|
30
|
+
if (!wallet)
|
|
31
|
+
return;
|
|
32
|
+
dynamicEvents.emit('walletRemoved', wallet, userWallets);
|
|
33
|
+
});
|
|
34
|
+
addedWalletsIds.current = [];
|
|
35
|
+
removedWalletsIds.current = [];
|
|
36
|
+
}, [userWallets]);
|
|
32
37
|
return (jsx(UserWalletsContext.Provider, { value: {
|
|
33
38
|
addedWalletsIds,
|
|
34
39
|
registerUserWallet: (newWallet) => setUserWallets((userWallets) => [...userWallets, newWallet]),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { viewToComponentMap } from '../../../views/viewToComponentMap';
|
|
3
|
-
export type ViewType = 'access-blocked' | 'select-hardware-wallet' | 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'deposit-view' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'verify-email' | 'verify-sms' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'external-funding-wallet-list' | 'sandbox-maximum-threshold-reached' | 'multi-wallet-wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'merge-user-accounts-conflicts' | 'merge-user-accounts-with-same-email' | 'mfa-choose-device' | 'mfa-recovery' | 'mfa-secure-device' | 'mfa-secure-device-help' | 'mfa-verification' | 'mfa-display-backup-codes' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-add-email' | 'global-wallet-confirm' | 'global-wallet-malicious' | 'global-wallet-info' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'embedded-delete-view' | 'embedded-reveal-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'create-password-view' | 'wallet-claim-intro' | 'mobile-wallet-redirect-view' | 'farcaster-connect-view';
|
|
3
|
+
export type ViewType = 'access-blocked' | 'select-hardware-wallet' | 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'deposit-view' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'verify-email' | 'verify-sms' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'external-funding-wallet-list' | 'sandbox-maximum-threshold-reached' | 'multi-wallet-wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'merge-user-accounts-conflicts' | 'merge-user-accounts-with-same-email' | 'mfa-choose-device' | 'mfa-recovery' | 'mfa-secure-device' | 'mfa-secure-device-help' | 'mfa-verification' | 'mfa-display-backup-codes' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-add-email' | 'global-wallet-confirm' | 'global-wallet-malicious' | 'global-wallet-info' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'embedded-delete-view' | 'embedded-reveal-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'create-password-view' | 'wallet-claim-intro' | 'mobile-wallet-redirect-view' | 'farcaster-connect-view' | 'embedded-wallet-exists';
|
|
4
4
|
export type ViewMapConstraint = Record<ViewType, FC<any>>;
|
|
5
5
|
type ComponentProps<T extends FC<any>> = T extends FC<infer P> ? P : never;
|
|
6
6
|
export type ViewMap = typeof viewToComponentMap;
|
|
@@ -51,6 +51,9 @@ const linkWallet = (environmentId_1, _b) => _tslib.__awaiter(void 0, [environmen
|
|
|
51
51
|
}
|
|
52
52
|
catch (e) {
|
|
53
53
|
const data = yield utils.logResponseError(e, 'Error linkWallet');
|
|
54
|
+
if (data.code === 'embedded_wallet_address_already_linked') {
|
|
55
|
+
throw new utils$1.EmbeddedWalletExistsError(data.code);
|
|
56
|
+
}
|
|
54
57
|
if (data.code === 'reassign_wallet_confirm' ||
|
|
55
58
|
data.code === 'reassign_wallet_error') {
|
|
56
59
|
throw new utils$1.WalletUsedError(data.code);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { VerifyRequestFromJSON } from '@dynamic-labs/sdk-api-core';
|
|
4
|
-
import { WalletUsedError, MergeAccountsConfirmationError, SandboxMaximumThresholdReachedError, DynamicError, WalletNotDeployedError, ChainalysisError, GateBlockedError, NoAccessError, AccountExistsError } from '@dynamic-labs/utils';
|
|
4
|
+
import { EmbeddedWalletExistsError, WalletUsedError, MergeAccountsConfirmationError, SandboxMaximumThresholdReachedError, DynamicError, WalletNotDeployedError, ChainalysisError, GateBlockedError, NoAccessError, AccountExistsError } from '@dynamic-labs/utils';
|
|
5
5
|
import { sdkApi } from '../api.js';
|
|
6
6
|
import { storeAuthTokenAndUser } from '../../../store/state/user/storeAuthTokenAndUser/storeAuthTokenAndUser.js';
|
|
7
7
|
import '../../../store/state/user/user.js';
|
|
@@ -47,6 +47,9 @@ const linkWallet = (environmentId_1, _b) => __awaiter(void 0, [environmentId_1,
|
|
|
47
47
|
}
|
|
48
48
|
catch (e) {
|
|
49
49
|
const data = yield logResponseError(e, 'Error linkWallet');
|
|
50
|
+
if (data.code === 'embedded_wallet_address_already_linked') {
|
|
51
|
+
throw new EmbeddedWalletExistsError(data.code);
|
|
52
|
+
}
|
|
50
53
|
if (data.code === 'reassign_wallet_confirm' ||
|
|
51
54
|
data.code === 'reassign_wallet_error') {
|
|
52
55
|
throw new WalletUsedError(data.code);
|
|
@@ -2099,6 +2099,10 @@ const translation = {
|
|
|
2099
2099
|
},
|
|
2100
2100
|
log_out_button: 'Log out',
|
|
2101
2101
|
title: 'Transfer this wallet?',
|
|
2102
|
+
already_exists: {
|
|
2103
|
+
title: 'Wallet Already Linked',
|
|
2104
|
+
description: 'This wallet is already used as an embedded wallet. You cannot link it unless you delete the existing embedded wallet.',
|
|
2105
|
+
},
|
|
2102
2106
|
},
|
|
2103
2107
|
/**
|
|
2104
2108
|
* @description copy keys for connecting wallets list view
|
|
@@ -2095,6 +2095,10 @@ export declare const translation: {
|
|
|
2095
2095
|
};
|
|
2096
2096
|
log_out_button: string;
|
|
2097
2097
|
title: string;
|
|
2098
|
+
already_exists: {
|
|
2099
|
+
title: string;
|
|
2100
|
+
description: string;
|
|
2101
|
+
};
|
|
2098
2102
|
};
|
|
2099
2103
|
/**
|
|
2100
2104
|
* @description copy keys for connecting wallets list view
|
|
@@ -2095,6 +2095,10 @@ const translation = {
|
|
|
2095
2095
|
},
|
|
2096
2096
|
log_out_button: 'Log out',
|
|
2097
2097
|
title: 'Transfer this wallet?',
|
|
2098
|
+
already_exists: {
|
|
2099
|
+
title: 'Wallet Already Linked',
|
|
2100
|
+
description: 'This wallet is already used as an embedded wallet. You cannot link it unless you delete the existing embedded wallet.',
|
|
2101
|
+
},
|
|
2098
2102
|
},
|
|
2099
2103
|
/**
|
|
2100
2104
|
* @description copy keys for connecting wallets list view
|