@dynamic-labs/solana-core 4.7.2 → 4.8.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 CHANGED
@@ -1,4 +1,25 @@
1
1
 
2
+ ### [4.8.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.8.0...v4.8.1) (2025-02-25)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * wc redirect for safari inside iframe ([#8131](https://github.com/dynamic-labs/dynamic-auth/issues/8131)) ([8c74bea](https://github.com/dynamic-labs/dynamic-auth/commit/8c74beae505014eb85be4fd211909709d0a339dd))
8
+
9
+ ## [4.8.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.7.2...v4.8.0) (2025-02-25)
10
+
11
+
12
+ ### Features
13
+
14
+ * add support for network switching for SOL wallets ([#8095](https://github.com/dynamic-labs/dynamic-auth/issues/8095)) ([8997b39](https://github.com/dynamic-labs/dynamic-auth/commit/8997b399e1e5cd294aad8b719d39928eed5e911d))
15
+ * add support for solNetworks override ([#8138](https://github.com/dynamic-labs/dynamic-auth/issues/8138)) ([8c3f374](https://github.com/dynamic-labs/dynamic-auth/commit/8c3f374a9b2b451f984aed98e7ce506552e2a6c5))
16
+ * **react-native:** add account abstraction multi-chain ([#8132](https://github.com/dynamic-labs/dynamic-auth/issues/8132)) ([c64a26e](https://github.com/dynamic-labs/dynamic-auth/commit/c64a26e16943d913edf4683084f59592a9aeedfc))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * ensure zero dev network cache use project id ([#8133](https://github.com/dynamic-labs/dynamic-auth/issues/8133)) ([408c4ed](https://github.com/dynamic-labs/dynamic-auth/commit/408c4ed764a623b6d870cd24973320e5ca4a74c7))
22
+
2
23
  ### [4.7.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.7.1...v4.7.2) (2025-02-22)
3
24
 
4
25
  ### Features
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.7.2";
6
+ var version = "4.8.1";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.7.2";
2
+ var version = "4.8.1";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/solana-core",
3
- "version": "4.7.2",
3
+ "version": "4.8.1",
4
4
  "description": "Core package for utilities and types for solana",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -21,12 +21,12 @@
21
21
  "@dynamic-labs/sdk-api-core": "0.0.628",
22
22
  "@solana/web3.js": "1.92.1",
23
23
  "@solana/spl-token": "0.4.6",
24
- "@dynamic-labs/assert-package-version": "4.7.2",
25
- "@dynamic-labs/rpc-providers": "4.7.2",
26
- "@dynamic-labs/types": "4.7.2",
27
- "@dynamic-labs/utils": "4.7.2",
28
- "@dynamic-labs/wallet-book": "4.7.2",
29
- "@dynamic-labs/wallet-connector-core": "4.7.2",
24
+ "@dynamic-labs/assert-package-version": "4.8.1",
25
+ "@dynamic-labs/rpc-providers": "4.8.1",
26
+ "@dynamic-labs/types": "4.8.1",
27
+ "@dynamic-labs/utils": "4.8.1",
28
+ "@dynamic-labs/wallet-book": "4.8.1",
29
+ "@dynamic-labs/wallet-connector-core": "4.8.1",
30
30
  "eventemitter3": "5.0.1"
31
31
  },
32
32
  "peerDependencies": {}
@@ -9,9 +9,9 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
9
  var utils = require('@dynamic-labs/utils');
10
10
  var SolanaWallet = require('../wallet/SolanaWallet.cjs');
11
11
  var extractNonce = require('../utils/extractNonce/extractNonce.cjs');
12
- var getGenesisHashLSKey = require('../utils/getGenesisHashLSKey/getGenesisHashLSKey.cjs');
13
12
  var getOverrideRpcUrlForNetwork = require('../utils/getOverrideRpcUrlForNetwork/getOverrideRpcUrlForNetwork.cjs');
14
13
  require('@solana/spl-token');
14
+ var constants = require('../constants.cjs');
15
15
  var getBackwardsCompatibleSolNetworks = require('../utils/getBackwardsCompatibleSolNetworks/getBackwardsCompatibleSolNetworks.cjs');
16
16
 
17
17
  const MEMO_PROGRAM_ID = new web3_js.PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr');
@@ -29,37 +29,74 @@ class SolanaWalletConnector extends walletConnectorCore.WalletConnectorBase {
29
29
  this.connectionConfig = opts.connectionConfig;
30
30
  (_a = this.chainRpcProviders) === null || _a === void 0 ? void 0 : _a.registerSolanaProviders(this.connectionConfig);
31
31
  }
32
+ getNetworkId() {
33
+ var _a;
34
+ const defaultChainId = (_a = this.solNetworks[0]) === null || _a === void 0 ? void 0 : _a.networkId.toString();
35
+ const storedChainId = localStorage.getItem(constants.DYNAMIC_SVM_NETWORK_ID_LS_KEY);
36
+ return storedChainId !== null && storedChainId !== void 0 ? storedChainId : defaultChainId;
37
+ }
38
+ setNetworkId(networkId) {
39
+ if (!networkId) {
40
+ localStorage.removeItem(constants.DYNAMIC_SVM_NETWORK_ID_LS_KEY);
41
+ }
42
+ else {
43
+ localStorage.setItem(constants.DYNAMIC_SVM_NETWORK_ID_LS_KEY, networkId);
44
+ }
45
+ }
46
+ getSelectedNetwork() {
47
+ const selectedNetwork = this.solNetworks.find((network) => network.networkId.toString() === this.getNetworkId());
48
+ return selectedNetwork;
49
+ }
32
50
  /**
33
51
  * @param returnDynamicNetworkId - If true, the dynamic network ID will be returned instead of the network cluster
34
52
  * @returns The network cluster (e.g. 'mainnet', 'testnet', 'devnet') or dynamic network (used for switching networks)
35
53
  */
36
54
  getNetwork() {
37
55
  return _tslib.__awaiter(this, arguments, void 0, function* (returnDynamicNetworkId = false) {
38
- const provider = this.getWalletClient();
39
- let genesisHash = localStorage.getItem(getGenesisHashLSKey.getGenesisHashLSKey(provider.rpcEndpoint));
40
- if (!genesisHash) {
41
- genesisHash = yield provider.getGenesisHash();
42
- localStorage.setItem(getGenesisHashLSKey.getGenesisHashLSKey(provider.rpcEndpoint), genesisHash);
56
+ const network = this.getSelectedNetwork();
57
+ if (!network) {
58
+ return '';
43
59
  }
44
- genesisHash = genesisHash.substring(0, 32);
45
- // see: https://github.com/ChainAgnostic/namespaces/blob/main/solana/caip2.md
60
+ const { networkId, genesisHash } = network;
61
+ if (returnDynamicNetworkId) {
62
+ return networkId.toString();
63
+ }
64
+ // to keep backward compatibility with old network values
46
65
  if (genesisHash === '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp') {
47
- return returnDynamicNetworkId ? '101' : 'mainnet';
66
+ return 'mainnet';
67
+ }
68
+ if (genesisHash === '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2K') {
69
+ return 'testnet';
48
70
  }
49
71
  if (genesisHash === 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1') {
50
- return returnDynamicNetworkId ? '103' : 'devnet';
72
+ return 'devnet';
51
73
  }
52
- return returnDynamicNetworkId ? '102' : 'testnet';
74
+ // if it's not one of the main solana networks, return the network id
75
+ // this should be ok because we didn't have support for other SVM networks before
76
+ return networkId.toString();
77
+ });
78
+ }
79
+ switchNetwork(_a) {
80
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ networkChainId, }) {
81
+ if (!networkChainId)
82
+ return;
83
+ const networkIdString = networkChainId.toString();
84
+ const isNetworkIdValid = this.solNetworks.some((network) => network.networkId.toString() === networkIdString);
85
+ if (!isNetworkIdValid) {
86
+ return;
87
+ }
88
+ this.setNetworkId(networkIdString);
89
+ this.emit('chainChange', { chain: networkIdString });
53
90
  });
54
91
  }
55
92
  endSession() {
56
93
  return _tslib.__awaiter(this, void 0, void 0, function* () {
57
- localStorage.removeItem(getGenesisHashLSKey.getGenesisHashLSKey(this.getWalletClient().rpcEndpoint));
94
+ this.setNetworkId(null);
58
95
  });
59
96
  }
60
97
  getWalletClient() {
61
98
  var _a;
62
- const [network] = this.solNetworks;
99
+ const network = this.getSelectedNetwork();
63
100
  if (!network) {
64
101
  throw new utils.DynamicError('No enabled networks');
65
102
  }
@@ -69,8 +106,11 @@ class SolanaWalletConnector extends walletConnectorCore.WalletConnectorBase {
69
106
  getPublicClient() {
70
107
  return _tslib.__awaiter(this, void 0, void 0, function* () {
71
108
  var _a;
72
- if (this.solNetworks.length === 0)
109
+ const network = this.getSelectedNetwork();
110
+ if (!network) {
73
111
  return;
112
+ }
113
+ const networkId = network.networkId.toString();
74
114
  const configurations = {
75
115
  cosmos: [],
76
116
  evm: undefined,
@@ -80,7 +120,7 @@ class SolanaWalletConnector extends walletConnectorCore.WalletConnectorBase {
80
120
  if (!this.chainRpcProviders)
81
121
  return undefined;
82
122
  const providers = this.chainRpcProviders.getProviders(configurations);
83
- return (_a = this.chainRpcProviders.getSolanaProviderByChainId(providers, '101')) === null || _a === void 0 ? void 0 : _a.provider;
123
+ return (_a = this.chainRpcProviders.getSolanaProviderByChainId(providers, networkId)) === null || _a === void 0 ? void 0 : _a.provider;
84
124
  });
85
125
  }
86
126
  getBalance(address) {
@@ -173,12 +213,19 @@ class SolanaWalletConnector extends walletConnectorCore.WalletConnectorBase {
173
213
  }
174
214
  getBlockExplorerUrlsForCurrentNetwork() {
175
215
  return _tslib.__awaiter(this, void 0, void 0, function* () {
176
- return ['https://solscan.io/'];
216
+ const network = this.getSelectedNetwork();
217
+ if (!network) {
218
+ return [];
219
+ }
220
+ return network.blockExplorerUrls;
177
221
  });
178
222
  }
179
223
  getEnabledNetworks() {
180
224
  return this.solNetworks;
181
225
  }
226
+ supportsNetworkSwitching() {
227
+ return true;
228
+ }
182
229
  }
183
230
 
184
231
  exports.SolanaWalletConnector = SolanaWalletConnector;
@@ -6,6 +6,9 @@ import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
6
6
  import { IChainRpcProviders } from '../rpc';
7
7
  import { SolanaWallet } from '../wallet';
8
8
  import { ISolana, SolanaConnectionConfig } from '../types';
9
+ export type SwitchNetworkOps = {
10
+ networkChainId: number;
11
+ };
9
12
  export type SolanaWalletConnectorOpts = {
10
13
  chainRpcProviders: IChainRpcProviders;
11
14
  solNetworks: GenericNetwork[];
@@ -22,11 +25,15 @@ export declare abstract class SolanaWalletConnector extends WalletConnectorBase<
22
25
  connectedChain: Chain;
23
26
  protected connectionConfig: SolanaConnectionConfig | undefined;
24
27
  constructor(opts: SolanaWalletConnectorOpts);
28
+ getNetworkId(): string;
29
+ setNetworkId(networkId: string | null): void;
30
+ getSelectedNetwork(): GenericNetwork | undefined;
25
31
  /**
26
32
  * @param returnDynamicNetworkId - If true, the dynamic network ID will be returned instead of the network cluster
27
33
  * @returns The network cluster (e.g. 'mainnet', 'testnet', 'devnet') or dynamic network (used for switching networks)
28
34
  */
29
35
  getNetwork(returnDynamicNetworkId?: boolean): Promise<string>;
36
+ switchNetwork({ networkChainId, }: SwitchNetworkOps): Promise<void>;
30
37
  endSession(): Promise<void>;
31
38
  getWalletClient(): Connection;
32
39
  getPublicClient(): Promise<Connection | undefined>;
@@ -43,4 +50,5 @@ export declare abstract class SolanaWalletConnector extends WalletConnectorBase<
43
50
  isLedgerAddress(address: string): boolean;
44
51
  getBlockExplorerUrlsForCurrentNetwork(): Promise<string[]>;
45
52
  getEnabledNetworks(): GenericNetwork[];
53
+ supportsNetworkSwitching(): boolean;
46
54
  }
@@ -5,9 +5,9 @@ import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
5
5
  import { DynamicError, isLedgerAddressViaVerifiedCredentials, NotSupportedError } from '@dynamic-labs/utils';
6
6
  import { SolanaWallet } from '../wallet/SolanaWallet.js';
7
7
  import { extractNonce } from '../utils/extractNonce/extractNonce.js';
8
- import { getGenesisHashLSKey } from '../utils/getGenesisHashLSKey/getGenesisHashLSKey.js';
9
8
  import { getOverrideRpcUrlForNetwork } from '../utils/getOverrideRpcUrlForNetwork/getOverrideRpcUrlForNetwork.js';
10
9
  import '@solana/spl-token';
10
+ import { DYNAMIC_SVM_NETWORK_ID_LS_KEY } from '../constants.js';
11
11
  import { getBackwardsCompatibleSolNetworks } from '../utils/getBackwardsCompatibleSolNetworks/getBackwardsCompatibleSolNetworks.js';
12
12
 
13
13
  const MEMO_PROGRAM_ID = new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr');
@@ -25,37 +25,74 @@ class SolanaWalletConnector extends WalletConnectorBase {
25
25
  this.connectionConfig = opts.connectionConfig;
26
26
  (_a = this.chainRpcProviders) === null || _a === void 0 ? void 0 : _a.registerSolanaProviders(this.connectionConfig);
27
27
  }
28
+ getNetworkId() {
29
+ var _a;
30
+ const defaultChainId = (_a = this.solNetworks[0]) === null || _a === void 0 ? void 0 : _a.networkId.toString();
31
+ const storedChainId = localStorage.getItem(DYNAMIC_SVM_NETWORK_ID_LS_KEY);
32
+ return storedChainId !== null && storedChainId !== void 0 ? storedChainId : defaultChainId;
33
+ }
34
+ setNetworkId(networkId) {
35
+ if (!networkId) {
36
+ localStorage.removeItem(DYNAMIC_SVM_NETWORK_ID_LS_KEY);
37
+ }
38
+ else {
39
+ localStorage.setItem(DYNAMIC_SVM_NETWORK_ID_LS_KEY, networkId);
40
+ }
41
+ }
42
+ getSelectedNetwork() {
43
+ const selectedNetwork = this.solNetworks.find((network) => network.networkId.toString() === this.getNetworkId());
44
+ return selectedNetwork;
45
+ }
28
46
  /**
29
47
  * @param returnDynamicNetworkId - If true, the dynamic network ID will be returned instead of the network cluster
30
48
  * @returns The network cluster (e.g. 'mainnet', 'testnet', 'devnet') or dynamic network (used for switching networks)
31
49
  */
32
50
  getNetwork() {
33
51
  return __awaiter(this, arguments, void 0, function* (returnDynamicNetworkId = false) {
34
- const provider = this.getWalletClient();
35
- let genesisHash = localStorage.getItem(getGenesisHashLSKey(provider.rpcEndpoint));
36
- if (!genesisHash) {
37
- genesisHash = yield provider.getGenesisHash();
38
- localStorage.setItem(getGenesisHashLSKey(provider.rpcEndpoint), genesisHash);
52
+ const network = this.getSelectedNetwork();
53
+ if (!network) {
54
+ return '';
39
55
  }
40
- genesisHash = genesisHash.substring(0, 32);
41
- // see: https://github.com/ChainAgnostic/namespaces/blob/main/solana/caip2.md
56
+ const { networkId, genesisHash } = network;
57
+ if (returnDynamicNetworkId) {
58
+ return networkId.toString();
59
+ }
60
+ // to keep backward compatibility with old network values
42
61
  if (genesisHash === '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp') {
43
- return returnDynamicNetworkId ? '101' : 'mainnet';
62
+ return 'mainnet';
63
+ }
64
+ if (genesisHash === '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2K') {
65
+ return 'testnet';
44
66
  }
45
67
  if (genesisHash === 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1') {
46
- return returnDynamicNetworkId ? '103' : 'devnet';
68
+ return 'devnet';
47
69
  }
48
- return returnDynamicNetworkId ? '102' : 'testnet';
70
+ // if it's not one of the main solana networks, return the network id
71
+ // this should be ok because we didn't have support for other SVM networks before
72
+ return networkId.toString();
73
+ });
74
+ }
75
+ switchNetwork(_a) {
76
+ return __awaiter(this, arguments, void 0, function* ({ networkChainId, }) {
77
+ if (!networkChainId)
78
+ return;
79
+ const networkIdString = networkChainId.toString();
80
+ const isNetworkIdValid = this.solNetworks.some((network) => network.networkId.toString() === networkIdString);
81
+ if (!isNetworkIdValid) {
82
+ return;
83
+ }
84
+ this.setNetworkId(networkIdString);
85
+ this.emit('chainChange', { chain: networkIdString });
49
86
  });
50
87
  }
51
88
  endSession() {
52
89
  return __awaiter(this, void 0, void 0, function* () {
53
- localStorage.removeItem(getGenesisHashLSKey(this.getWalletClient().rpcEndpoint));
90
+ this.setNetworkId(null);
54
91
  });
55
92
  }
56
93
  getWalletClient() {
57
94
  var _a;
58
- const [network] = this.solNetworks;
95
+ const network = this.getSelectedNetwork();
59
96
  if (!network) {
60
97
  throw new DynamicError('No enabled networks');
61
98
  }
@@ -65,8 +102,11 @@ class SolanaWalletConnector extends WalletConnectorBase {
65
102
  getPublicClient() {
66
103
  return __awaiter(this, void 0, void 0, function* () {
67
104
  var _a;
68
- if (this.solNetworks.length === 0)
105
+ const network = this.getSelectedNetwork();
106
+ if (!network) {
69
107
  return;
108
+ }
109
+ const networkId = network.networkId.toString();
70
110
  const configurations = {
71
111
  cosmos: [],
72
112
  evm: undefined,
@@ -76,7 +116,7 @@ class SolanaWalletConnector extends WalletConnectorBase {
76
116
  if (!this.chainRpcProviders)
77
117
  return undefined;
78
118
  const providers = this.chainRpcProviders.getProviders(configurations);
79
- return (_a = this.chainRpcProviders.getSolanaProviderByChainId(providers, '101')) === null || _a === void 0 ? void 0 : _a.provider;
119
+ return (_a = this.chainRpcProviders.getSolanaProviderByChainId(providers, networkId)) === null || _a === void 0 ? void 0 : _a.provider;
80
120
  });
81
121
  }
82
122
  getBalance(address) {
@@ -169,12 +209,19 @@ class SolanaWalletConnector extends WalletConnectorBase {
169
209
  }
170
210
  getBlockExplorerUrlsForCurrentNetwork() {
171
211
  return __awaiter(this, void 0, void 0, function* () {
172
- return ['https://solscan.io/'];
212
+ const network = this.getSelectedNetwork();
213
+ if (!network) {
214
+ return [];
215
+ }
216
+ return network.blockExplorerUrls;
173
217
  });
174
218
  }
175
219
  getEnabledNetworks() {
176
220
  return this.solNetworks;
177
221
  }
222
+ supportsNetworkSwitching() {
223
+ return true;
224
+ }
178
225
  }
179
226
 
180
227
  export { SolanaWalletConnector };
package/src/constants.cjs CHANGED
@@ -4,5 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  const SOLANA_GENESIS_HASH = 'genesis-hash';
7
+ const DYNAMIC_SVM_NETWORK_ID_LS_KEY = 'dynamic_svm_network_id';
7
8
 
9
+ exports.DYNAMIC_SVM_NETWORK_ID_LS_KEY = DYNAMIC_SVM_NETWORK_ID_LS_KEY;
8
10
  exports.SOLANA_GENESIS_HASH = SOLANA_GENESIS_HASH;
@@ -1 +1,2 @@
1
1
  export declare const SOLANA_GENESIS_HASH = "genesis-hash";
2
+ export declare const DYNAMIC_SVM_NETWORK_ID_LS_KEY = "dynamic_svm_network_id";
package/src/constants.js CHANGED
@@ -1,4 +1,5 @@
1
1
  'use client'
2
2
  const SOLANA_GENESIS_HASH = 'genesis-hash';
3
+ const DYNAMIC_SVM_NETWORK_ID_LS_KEY = 'dynamic_svm_network_id';
3
4
 
4
- export { SOLANA_GENESIS_HASH };
5
+ export { DYNAMIC_SVM_NETWORK_ID_LS_KEY, SOLANA_GENESIS_HASH };
package/src/index.cjs CHANGED
@@ -41,6 +41,7 @@ exports.getBackwardsCompatibleSolNetworks = getBackwardsCompatibleSolNetworks.ge
41
41
  exports.SolanaWallet = SolanaWallet.SolanaWallet;
42
42
  exports.isSolanaWallet = isSolanaWallet.isSolanaWallet;
43
43
  exports.isLedgerSolanaWallet = isLedgerSolanaWallet.isLedgerSolanaWallet;
44
+ exports.DYNAMIC_SVM_NETWORK_ID_LS_KEY = constants.DYNAMIC_SVM_NETWORK_ID_LS_KEY;
44
45
  exports.SOLANA_GENESIS_HASH = constants.SOLANA_GENESIS_HASH;
45
46
  Object.keys(rpcProviders).forEach(function (k) {
46
47
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
package/src/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export * from './connector';
2
2
  export * from './rpc';
3
3
  export * from './utils';
4
4
  export * from './wallet';
5
- export { SOLANA_GENESIS_HASH } from './constants';
5
+ export { SOLANA_GENESIS_HASH, DYNAMIC_SVM_NETWORK_ID_LS_KEY, } from './constants';
6
6
  export type { ConnectionResult, ExtensionLocator, ISolana, IBackpackSolanaSigner, SignedMessage, ISolanaSigner, SolanaConnectionConfig, } from './types';
package/src/index.js CHANGED
@@ -18,6 +18,6 @@ export { getBackwardsCompatibleSolNetworks } from './utils/getBackwardsCompatibl
18
18
  export { SolanaWallet } from './wallet/SolanaWallet.js';
19
19
  export { isSolanaWallet } from './wallet/isSolanaWallet/isSolanaWallet.js';
20
20
  export { isLedgerSolanaWallet } from './wallet/isLedgerSolanaWallet/isLedgerSolanaWallet.js';
21
- export { SOLANA_GENESIS_HASH } from './constants.js';
21
+ export { DYNAMIC_SVM_NETWORK_ID_LS_KEY, SOLANA_GENESIS_HASH } from './constants.js';
22
22
 
23
23
  assertPackageVersion('@dynamic-labs/solana-core', version);
@@ -8,6 +8,7 @@ var getOverrideRpcUrlForNetwork = require('../getOverrideRpcUrlForNetwork/getOve
8
8
  const SOLANA_MAINNET_NETWORK = {
9
9
  blockExplorerUrls: ['https://explorer.solana.com'],
10
10
  chainId: '101',
11
+ cluster: 'mainnet-beta',
11
12
  genesisHash: '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
12
13
  iconUrls: ['https://app.dynamic.xyz/assets/networks/solana.svg'],
13
14
  name: 'Solana Mainnet',
@@ -25,6 +26,7 @@ const SOLANA_MAINNET_NETWORK = {
25
26
  const SOLANA_TESTNET_NETWORK = {
26
27
  blockExplorerUrls: ['https://explorer.solana.com/?cluster=testnet'],
27
28
  chainId: '102',
29
+ cluster: 'testnet',
28
30
  genesisHash: '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',
29
31
  iconUrls: ['https://app.dynamic.xyz/assets/networks/solana.svg'],
30
32
  name: 'Solana Testnet',
@@ -41,6 +43,7 @@ const SOLANA_TESTNET_NETWORK = {
41
43
  const SOLANA_DEVNET_NETWORK = {
42
44
  blockExplorerUrls: ['https://explorer.solana.com/?cluster=devnet'],
43
45
  chainId: '103',
46
+ cluster: 'devnet',
44
47
  genesisHash: 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG',
45
48
  iconUrls: ['https://app.dynamic.xyz/assets/networks/solana.svg'],
46
49
  name: 'Solana Devnet',
@@ -58,7 +61,10 @@ const getBackwardsCompatibleSolNetworks = (originalSolNetworks, connectionConfig
58
61
  if (!(originalSolNetworks === null || originalSolNetworks === void 0 ? void 0 : originalSolNetworks.length)) {
59
62
  return [];
60
63
  }
61
- if (originalSolNetworks.length > 1) {
64
+ // if we have more than one network or if the chainId is not 101,
65
+ // it means the correct rpc should have already been set in the dashboard
66
+ if (originalSolNetworks.length > 1 ||
67
+ originalSolNetworks[0].chainId !== '101') {
62
68
  return originalSolNetworks;
63
69
  }
64
70
  // because we didn't have multi-network support in the past,
@@ -4,6 +4,7 @@ import { getOverrideRpcUrlForNetwork } from '../getOverrideRpcUrlForNetwork/getO
4
4
  const SOLANA_MAINNET_NETWORK = {
5
5
  blockExplorerUrls: ['https://explorer.solana.com'],
6
6
  chainId: '101',
7
+ cluster: 'mainnet-beta',
7
8
  genesisHash: '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
8
9
  iconUrls: ['https://app.dynamic.xyz/assets/networks/solana.svg'],
9
10
  name: 'Solana Mainnet',
@@ -21,6 +22,7 @@ const SOLANA_MAINNET_NETWORK = {
21
22
  const SOLANA_TESTNET_NETWORK = {
22
23
  blockExplorerUrls: ['https://explorer.solana.com/?cluster=testnet'],
23
24
  chainId: '102',
25
+ cluster: 'testnet',
24
26
  genesisHash: '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',
25
27
  iconUrls: ['https://app.dynamic.xyz/assets/networks/solana.svg'],
26
28
  name: 'Solana Testnet',
@@ -37,6 +39,7 @@ const SOLANA_TESTNET_NETWORK = {
37
39
  const SOLANA_DEVNET_NETWORK = {
38
40
  blockExplorerUrls: ['https://explorer.solana.com/?cluster=devnet'],
39
41
  chainId: '103',
42
+ cluster: 'devnet',
40
43
  genesisHash: 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG',
41
44
  iconUrls: ['https://app.dynamic.xyz/assets/networks/solana.svg'],
42
45
  name: 'Solana Devnet',
@@ -54,7 +57,10 @@ const getBackwardsCompatibleSolNetworks = (originalSolNetworks, connectionConfig
54
57
  if (!(originalSolNetworks === null || originalSolNetworks === void 0 ? void 0 : originalSolNetworks.length)) {
55
58
  return [];
56
59
  }
57
- if (originalSolNetworks.length > 1) {
60
+ // if we have more than one network or if the chainId is not 101,
61
+ // it means the correct rpc should have already been set in the dashboard
62
+ if (originalSolNetworks.length > 1 ||
63
+ originalSolNetworks[0].chainId !== '101') {
58
64
  return originalSolNetworks;
59
65
  }
60
66
  // because we didn't have multi-network support in the past,