@dynamic-labs/sdk-react-core 4.67.1 → 4.67.2
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 +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/client/extension/functions/getExpiresAt/getExpiresAt.cjs +10 -0
- package/src/lib/client/extension/functions/getExpiresAt/getExpiresAt.js +6 -0
- package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +1 -1
- package/src/lib/components/IconWithSpinner/IconWithSpinner.js +1 -1
- package/src/lib/utils/constants/values.cjs +5 -0
- package/src/lib/utils/constants/values.js +5 -0
- package/src/lib/utils/functions/compareChains/compareChains.cjs +6 -0
- package/src/lib/utils/functions/compareChains/compareChains.js +6 -0
- package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.cjs +18 -5
- package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.js +18 -5
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +9 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.67.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.67.1...v4.67.2) (2026-03-13)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* add fallback connectors for all chains and fix wallet.chain mismatch for SUI wallets ([#10629](https://github.com/dynamic-labs/dynamic-auth/issues/10629)) ([dcdf5fc](https://github.com/dynamic-labs/dynamic-auth/commit/dcdf5fc5c424379cde2eecfd2d3b14fb6fe3819b))
|
|
8
|
+
|
|
2
9
|
### [4.67.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.67.0...v4.67.1) (2026-03-10)
|
|
3
10
|
|
|
4
11
|
|
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.67.
|
|
3
|
+
"version": "4.67.2",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.881",
|
|
6
6
|
"@dynamic-labs-sdk/client": "0.14.0",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"yup": "0.32.11",
|
|
17
17
|
"react-international-phone": "4.5.0",
|
|
18
18
|
"bs58": "5.0.0",
|
|
19
|
-
"@dynamic-labs/assert-package-version": "4.67.
|
|
20
|
-
"@dynamic-labs/iconic": "4.67.
|
|
21
|
-
"@dynamic-labs/locale": "4.67.
|
|
22
|
-
"@dynamic-labs/logger": "4.67.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "4.67.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "4.67.
|
|
25
|
-
"@dynamic-labs/store": "4.67.
|
|
26
|
-
"@dynamic-labs/types": "4.67.
|
|
27
|
-
"@dynamic-labs/utils": "4.67.
|
|
28
|
-
"@dynamic-labs/wallet-book": "4.67.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "4.67.
|
|
19
|
+
"@dynamic-labs/assert-package-version": "4.67.2",
|
|
20
|
+
"@dynamic-labs/iconic": "4.67.2",
|
|
21
|
+
"@dynamic-labs/locale": "4.67.2",
|
|
22
|
+
"@dynamic-labs/logger": "4.67.2",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "4.67.2",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "4.67.2",
|
|
25
|
+
"@dynamic-labs/store": "4.67.2",
|
|
26
|
+
"@dynamic-labs/types": "4.67.2",
|
|
27
|
+
"@dynamic-labs/utils": "4.67.2",
|
|
28
|
+
"@dynamic-labs/wallet-book": "4.67.2",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "4.67.2",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
7
|
+
|
|
8
|
+
const getExpiresAt = () => { var _a, _b; return (_b = (_a = client.getDefaultClient().sessionExpiresAt) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : null; };
|
|
9
|
+
|
|
10
|
+
exports.getExpiresAt = getExpiresAt;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { getDefaultClient } from '@dynamic-labs-sdk/client';
|
|
3
|
+
|
|
4
|
+
const getExpiresAt = () => { var _a, _b; return (_b = (_a = getDefaultClient().sessionExpiresAt) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : null; };
|
|
5
|
+
|
|
6
|
+
export { getExpiresAt };
|
|
@@ -43,7 +43,7 @@ const IconWithSpinner = ({ iconSize = 24, Icon, isSpinning = false, className, s
|
|
|
43
43
|
return (jsxRuntime.jsxs("div", { className: effectiveContainerClassName, style: Object.assign({ height: pixelToRem.pixelToRem(iconSize), width: pixelToRem.pixelToRem(iconSize) }, style), children: [Icon && (jsxRuntime.jsxs("div", { style: {
|
|
44
44
|
height: pixelToRem.pixelToRem(realIconSize),
|
|
45
45
|
width: pixelToRem.pixelToRem(realIconSize),
|
|
46
|
-
}, className: 'icon-with-spinner__icon-container', children: [treatAsFunctionComponent || typeof Icon === 'function' ? (jsxRuntime.jsx(IconAsFC, { height: realIconSize, width: realIconSize })) : (Icon), indicator && jsxRuntime.jsx(Indicator.Indicator, { indicator: indicator, iconSize: iconSize })] })), isSpinning && !utils.isLegacySafari() && (jsxRuntime.jsx("div", { className: 'icon-with-spinner__spinner-container icon-with-spinner__animation',
|
|
46
|
+
}, className: 'icon-with-spinner__icon-container', children: [treatAsFunctionComponent || typeof Icon === 'function' ? (jsxRuntime.jsx(IconAsFC, { height: realIconSize, width: realIconSize })) : (Icon), indicator && jsxRuntime.jsx(Indicator.Indicator, { indicator: indicator, iconSize: iconSize })] })), isSpinning && !utils.isLegacySafari() && (jsxRuntime.jsx("div", { className: 'icon-with-spinner__spinner-container icon-with-spinner__animation', style: {
|
|
47
47
|
height: pixelToRem.pixelToRem(iconSize),
|
|
48
48
|
width: pixelToRem.pixelToRem(iconSize),
|
|
49
49
|
}, children: jsxRuntime.jsx(Spinner.Spinner, { className: 'icon-with-spinner__spinner', customSpinnerColor: customSpinnerColor, size: spinnerIconSize }) }))] }));
|
|
@@ -39,7 +39,7 @@ const IconWithSpinner = ({ iconSize = 24, Icon, isSpinning = false, className, s
|
|
|
39
39
|
return (jsxs("div", { className: effectiveContainerClassName, style: Object.assign({ height: pixelToRem(iconSize), width: pixelToRem(iconSize) }, style), children: [Icon && (jsxs("div", { style: {
|
|
40
40
|
height: pixelToRem(realIconSize),
|
|
41
41
|
width: pixelToRem(realIconSize),
|
|
42
|
-
}, className: 'icon-with-spinner__icon-container', children: [treatAsFunctionComponent || typeof Icon === 'function' ? (jsx(IconAsFC, { height: realIconSize, width: realIconSize })) : (Icon), indicator && jsx(Indicator, { indicator: indicator, iconSize: iconSize })] })), isSpinning && !isLegacySafari() && (jsx("div", { className: 'icon-with-spinner__spinner-container icon-with-spinner__animation',
|
|
42
|
+
}, className: 'icon-with-spinner__icon-container', children: [treatAsFunctionComponent || typeof Icon === 'function' ? (jsx(IconAsFC, { height: realIconSize, width: realIconSize })) : (Icon), indicator && jsx(Indicator, { indicator: indicator, iconSize: iconSize })] })), isSpinning && !isLegacySafari() && (jsx("div", { className: 'icon-with-spinner__spinner-container icon-with-spinner__animation', style: {
|
|
43
43
|
height: pixelToRem(iconSize),
|
|
44
44
|
width: pixelToRem(iconSize),
|
|
45
45
|
}, children: jsx(Spinner, { className: 'icon-with-spinner__spinner', customSpinnerColor: customSpinnerColor, size: spinnerIconSize }) }))] }));
|
|
@@ -12,6 +12,7 @@ const DEFAULT_NUMBER_OF_WALLETS_TO_SHOW = 10;
|
|
|
12
12
|
const ChainEnumToVerifiedCredentialName = {
|
|
13
13
|
ALEO: 'aleo',
|
|
14
14
|
ALGO: 'algorand',
|
|
15
|
+
APTOS: 'aptos',
|
|
15
16
|
BTC: 'bip122', // see: https://namespaces.chainagnostic.org/bip122/caip2
|
|
16
17
|
COSMOS: 'cosmos',
|
|
17
18
|
ETH: 'eip155',
|
|
@@ -20,11 +21,14 @@ const ChainEnumToVerifiedCredentialName = {
|
|
|
20
21
|
SOL: 'solana',
|
|
21
22
|
STARK: 'starknet',
|
|
22
23
|
STELLAR: 'stellar',
|
|
24
|
+
SUI: 'sui',
|
|
23
25
|
TON: 'ton',
|
|
26
|
+
TRON: 'tron',
|
|
24
27
|
};
|
|
25
28
|
const VerifiedCredentialNameToChainEnum = {
|
|
26
29
|
aleo: sdkApiCore.ChainEnum.Aleo,
|
|
27
30
|
algorand: sdkApiCore.ChainEnum.Algo,
|
|
31
|
+
aptos: sdkApiCore.ChainEnum.Aptos,
|
|
28
32
|
bip122: sdkApiCore.ChainEnum.Btc,
|
|
29
33
|
cosmos: sdkApiCore.ChainEnum.Cosmos,
|
|
30
34
|
eip155: sdkApiCore.ChainEnum.Evm,
|
|
@@ -34,6 +38,7 @@ const VerifiedCredentialNameToChainEnum = {
|
|
|
34
38
|
stellar: sdkApiCore.ChainEnum.Stellar,
|
|
35
39
|
sui: sdkApiCore.ChainEnum.Sui,
|
|
36
40
|
ton: sdkApiCore.ChainEnum.Ton,
|
|
41
|
+
tron: sdkApiCore.ChainEnum.Tron,
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
exports.ChainEnumToVerifiedCredentialName = ChainEnumToVerifiedCredentialName;
|
|
@@ -8,6 +8,7 @@ const DEFAULT_NUMBER_OF_WALLETS_TO_SHOW = 10;
|
|
|
8
8
|
const ChainEnumToVerifiedCredentialName = {
|
|
9
9
|
ALEO: 'aleo',
|
|
10
10
|
ALGO: 'algorand',
|
|
11
|
+
APTOS: 'aptos',
|
|
11
12
|
BTC: 'bip122', // see: https://namespaces.chainagnostic.org/bip122/caip2
|
|
12
13
|
COSMOS: 'cosmos',
|
|
13
14
|
ETH: 'eip155',
|
|
@@ -16,11 +17,14 @@ const ChainEnumToVerifiedCredentialName = {
|
|
|
16
17
|
SOL: 'solana',
|
|
17
18
|
STARK: 'starknet',
|
|
18
19
|
STELLAR: 'stellar',
|
|
20
|
+
SUI: 'sui',
|
|
19
21
|
TON: 'ton',
|
|
22
|
+
TRON: 'tron',
|
|
20
23
|
};
|
|
21
24
|
const VerifiedCredentialNameToChainEnum = {
|
|
22
25
|
aleo: ChainEnum.Aleo,
|
|
23
26
|
algorand: ChainEnum.Algo,
|
|
27
|
+
aptos: ChainEnum.Aptos,
|
|
24
28
|
bip122: ChainEnum.Btc,
|
|
25
29
|
cosmos: ChainEnum.Cosmos,
|
|
26
30
|
eip155: ChainEnum.Evm,
|
|
@@ -30,6 +34,7 @@ const VerifiedCredentialNameToChainEnum = {
|
|
|
30
34
|
stellar: ChainEnum.Stellar,
|
|
31
35
|
sui: ChainEnum.Sui,
|
|
32
36
|
ton: ChainEnum.Ton,
|
|
37
|
+
tron: ChainEnum.Tron,
|
|
33
38
|
};
|
|
34
39
|
|
|
35
40
|
export { ChainEnumToVerifiedCredentialName, DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, VerifiedCredentialNameToChainEnum };
|
|
@@ -5,13 +5,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
const synonyms = {
|
|
7
7
|
aleo: 'ALEO',
|
|
8
|
+
algorand: 'ALGO',
|
|
9
|
+
aptos: 'APTOS',
|
|
8
10
|
bip122: 'BTC',
|
|
9
11
|
bitcoin: 'BTC',
|
|
12
|
+
cosmos: 'COSMOS',
|
|
10
13
|
eip155: 'EVM',
|
|
14
|
+
flow: 'FLOW',
|
|
11
15
|
solana: 'SOL',
|
|
16
|
+
starknet: 'STARK',
|
|
12
17
|
stellar: 'STELLAR',
|
|
13
18
|
sui: 'SUI',
|
|
14
19
|
ton: 'TON',
|
|
20
|
+
tron: 'TRON',
|
|
15
21
|
};
|
|
16
22
|
for (const chain in synonyms)
|
|
17
23
|
synonyms[synonyms[chain]] = chain;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
const synonyms = {
|
|
3
3
|
aleo: 'ALEO',
|
|
4
|
+
algorand: 'ALGO',
|
|
5
|
+
aptos: 'APTOS',
|
|
4
6
|
bip122: 'BTC',
|
|
5
7
|
bitcoin: 'BTC',
|
|
8
|
+
cosmos: 'COSMOS',
|
|
6
9
|
eip155: 'EVM',
|
|
10
|
+
flow: 'FLOW',
|
|
7
11
|
solana: 'SOL',
|
|
12
|
+
starknet: 'STARK',
|
|
8
13
|
stellar: 'STELLAR',
|
|
9
14
|
sui: 'SUI',
|
|
10
15
|
ton: 'TON',
|
|
16
|
+
tron: 'TRON',
|
|
11
17
|
};
|
|
12
18
|
for (const chain in synonyms)
|
|
13
19
|
synonyms[synonyms[chain]] = chain;
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
7
8
|
require('@dynamic-labs-sdk/client/core');
|
|
8
9
|
require('@dynamic-labs/sdk-api-core');
|
|
9
10
|
require('../../../../client/client.cjs');
|
|
10
11
|
require('react');
|
|
11
|
-
require('@dynamic-labs-sdk/client');
|
|
12
12
|
require('../../../../config/ApiEndpoint.cjs');
|
|
13
13
|
require('@dynamic-labs/iconic');
|
|
14
14
|
require('@dynamic-labs/wallet-connector-core');
|
|
15
15
|
require('react/jsx-runtime');
|
|
16
16
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
17
|
-
require('../../../../shared/logger.cjs');
|
|
17
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
18
18
|
require('@dynamic-labs/wallet-book');
|
|
19
19
|
require('@dynamic-labs/utils');
|
|
20
20
|
require('../../../constants/colors.cjs');
|
|
@@ -29,7 +29,8 @@ var primaryWalletId = require('../../../../store/state/primaryWalletId/primaryWa
|
|
|
29
29
|
var connectedWalletsInfo = require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
30
30
|
require('../../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
31
31
|
require('../../../../events/dynamicEvents.cjs');
|
|
32
|
-
var
|
|
32
|
+
var getMinAuthToken = require('../../../../client/extension/functions/getMinAuthToken/getMinAuthToken.cjs');
|
|
33
|
+
var getExpiresAt = require('../../../../client/extension/functions/getExpiresAt/getExpiresAt.cjs');
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* Detects mismatch between wallet info.
|
|
@@ -41,12 +42,24 @@ const handleWalletInfoOutOfSync = (_a) => _tslib.__awaiter(void 0, [_a], void 0,
|
|
|
41
42
|
if (!primaryWalletId$1) {
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
|
-
const user =
|
|
45
|
+
const { user } = client.getDefaultClient();
|
|
45
46
|
const connectedWallets = connectedWalletsInfo.getConnectedWalletsInfo();
|
|
47
|
+
const token = getMinAuthToken.getMinAuthToken();
|
|
48
|
+
const sessionExpiresAt = getExpiresAt.getExpiresAt();
|
|
49
|
+
const isTokenExpired = sessionExpiresAt !== null && sessionExpiresAt <= Date.now();
|
|
50
|
+
logger.logger.debug('[handleWalletInfoOutOfSync] validation check', {
|
|
51
|
+
connectedWalletsCount: connectedWallets.length,
|
|
52
|
+
hasClientUser: Boolean(user),
|
|
53
|
+
hasToken: Boolean(token),
|
|
54
|
+
isTokenExpired,
|
|
55
|
+
primaryWalletId: primaryWalletId$1,
|
|
56
|
+
sessionExpiresAt,
|
|
57
|
+
});
|
|
46
58
|
if (user || connectedWallets.length > 0) {
|
|
47
59
|
return;
|
|
48
60
|
}
|
|
49
|
-
|
|
61
|
+
const reason = token && !isTokenExpired ? 'wallet info is out of sync' : 'session expired';
|
|
62
|
+
yield logout(reason, {
|
|
50
63
|
connectedWallets,
|
|
51
64
|
primaryWalletId: primaryWalletId$1,
|
|
52
65
|
user,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { getDefaultClient } from '@dynamic-labs-sdk/client';
|
|
3
4
|
import '@dynamic-labs-sdk/client/core';
|
|
4
5
|
import '@dynamic-labs/sdk-api-core';
|
|
5
6
|
import '../../../../client/client.js';
|
|
6
7
|
import 'react';
|
|
7
|
-
import '@dynamic-labs-sdk/client';
|
|
8
8
|
import '../../../../config/ApiEndpoint.js';
|
|
9
9
|
import '@dynamic-labs/iconic';
|
|
10
10
|
import '@dynamic-labs/wallet-connector-core';
|
|
11
11
|
import 'react/jsx-runtime';
|
|
12
12
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
13
|
-
import '../../../../shared/logger.js';
|
|
13
|
+
import { logger } from '../../../../shared/logger.js';
|
|
14
14
|
import '@dynamic-labs/wallet-book';
|
|
15
15
|
import '@dynamic-labs/utils';
|
|
16
16
|
import '../../../constants/colors.js';
|
|
@@ -25,7 +25,8 @@ import { getPrimaryWalletId } from '../../../../store/state/primaryWalletId/prim
|
|
|
25
25
|
import { getConnectedWalletsInfo } from '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
26
26
|
import '../../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
27
27
|
import '../../../../events/dynamicEvents.js';
|
|
28
|
-
import {
|
|
28
|
+
import { getMinAuthToken } from '../../../../client/extension/functions/getMinAuthToken/getMinAuthToken.js';
|
|
29
|
+
import { getExpiresAt } from '../../../../client/extension/functions/getExpiresAt/getExpiresAt.js';
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Detects mismatch between wallet info.
|
|
@@ -37,12 +38,24 @@ const handleWalletInfoOutOfSync = (_a) => __awaiter(void 0, [_a], void 0, functi
|
|
|
37
38
|
if (!primaryWalletId) {
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
|
-
const user =
|
|
41
|
+
const { user } = getDefaultClient();
|
|
41
42
|
const connectedWallets = getConnectedWalletsInfo();
|
|
43
|
+
const token = getMinAuthToken();
|
|
44
|
+
const sessionExpiresAt = getExpiresAt();
|
|
45
|
+
const isTokenExpired = sessionExpiresAt !== null && sessionExpiresAt <= Date.now();
|
|
46
|
+
logger.debug('[handleWalletInfoOutOfSync] validation check', {
|
|
47
|
+
connectedWalletsCount: connectedWallets.length,
|
|
48
|
+
hasClientUser: Boolean(user),
|
|
49
|
+
hasToken: Boolean(token),
|
|
50
|
+
isTokenExpired,
|
|
51
|
+
primaryWalletId,
|
|
52
|
+
sessionExpiresAt,
|
|
53
|
+
});
|
|
42
54
|
if (user || connectedWallets.length > 0) {
|
|
43
55
|
return;
|
|
44
56
|
}
|
|
45
|
-
|
|
57
|
+
const reason = token && !isTokenExpired ? 'wallet info is out of sync' : 'session expired';
|
|
58
|
+
yield logout(reason, {
|
|
46
59
|
connectedWallets,
|
|
47
60
|
primaryWalletId,
|
|
48
61
|
user,
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
7
7
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
|
+
var values = require('../../../../constants/values.cjs');
|
|
8
9
|
var findWalletOptionFor = require('../../../../functions/findWalletOptionFor/findWalletOptionFor.cjs');
|
|
9
10
|
var shouldManuallyReconnectOnRefresh = require('../../../../functions/shouldManuallyReconnectOnRefresh/shouldManuallyReconnectOnRefresh.cjs');
|
|
10
11
|
var convertLegacyPhantomLedgerConnector = require('../convertLegacyPhantomLedgerConnector/convertLegacyPhantomLedgerConnector.cjs');
|
|
@@ -50,10 +51,17 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
|
|
|
50
51
|
walletConnectorOptions,
|
|
51
52
|
});
|
|
52
53
|
}
|
|
54
|
+
// Prefer the chain from the account's verified credential over the
|
|
55
|
+
// connector's connectedChain. When a wallet falls back to a connector
|
|
56
|
+
// for a different chain (e.g. FallbackSolanaConnector for a SUI
|
|
57
|
+
// wallet), the connector's chain would be wrong.
|
|
58
|
+
const accountChain = account.chain
|
|
59
|
+
? values.VerifiedCredentialNameToChainEnum[account.chain]
|
|
60
|
+
: undefined;
|
|
53
61
|
return wallet.walletConnector.createWallet({
|
|
54
62
|
additionalAddresses: account.walletAdditionalAddresses,
|
|
55
63
|
address: account.address,
|
|
56
|
-
chain: wallet.walletConnector.connectedChain,
|
|
64
|
+
chain: accountChain !== null && accountChain !== void 0 ? accountChain : wallet.walletConnector.connectedChain,
|
|
57
65
|
connector: wallet.walletConnector,
|
|
58
66
|
id: account.id,
|
|
59
67
|
isAuthenticated: true,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { HardwareWalletEnum, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
3
3
|
import { isHardwareWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
+
import { VerifiedCredentialNameToChainEnum } from '../../../../constants/values.js';
|
|
4
5
|
import { findWalletOptionFor } from '../../../../functions/findWalletOptionFor/findWalletOptionFor.js';
|
|
5
6
|
import { shouldManuallyReconnectOnRefresh } from '../../../../functions/shouldManuallyReconnectOnRefresh/shouldManuallyReconnectOnRefresh.js';
|
|
6
7
|
import { convertLegacyPhantomLedgerConnector } from '../convertLegacyPhantomLedgerConnector/convertLegacyPhantomLedgerConnector.js';
|
|
@@ -46,10 +47,17 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
|
|
|
46
47
|
walletConnectorOptions,
|
|
47
48
|
});
|
|
48
49
|
}
|
|
50
|
+
// Prefer the chain from the account's verified credential over the
|
|
51
|
+
// connector's connectedChain. When a wallet falls back to a connector
|
|
52
|
+
// for a different chain (e.g. FallbackSolanaConnector for a SUI
|
|
53
|
+
// wallet), the connector's chain would be wrong.
|
|
54
|
+
const accountChain = account.chain
|
|
55
|
+
? VerifiedCredentialNameToChainEnum[account.chain]
|
|
56
|
+
: undefined;
|
|
49
57
|
return wallet.walletConnector.createWallet({
|
|
50
58
|
additionalAddresses: account.walletAdditionalAddresses,
|
|
51
59
|
address: account.address,
|
|
52
|
-
chain: wallet.walletConnector.connectedChain,
|
|
60
|
+
chain: accountChain !== null && accountChain !== void 0 ? accountChain : wallet.walletConnector.connectedChain,
|
|
53
61
|
connector: wallet.walletConnector,
|
|
54
62
|
id: account.id,
|
|
55
63
|
isAuthenticated: true,
|