@dynamic-labs/solana 2.2.0-alpha.4 → 2.2.0

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,44 +1,78 @@
1
1
 
2
- ## [2.2.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0-alpha.3...v2.2.0-alpha.4) (2024-06-06)
2
+ ## [2.2.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.5...v2.2.0) (2024-06-16)
3
+
4
+
5
+ ### Features
6
+
7
+ * add useSwitchNetwork ([#6027](https://github.com/dynamic-labs/DynamicAuth/issues/6027)) ([671310a](https://github.com/dynamic-labs/DynamicAuth/commit/671310a98aaeca12e02443c824d5d7cad2cdc769))
8
+ * add walletAdded to useDynamicEvents ([#6026](https://github.com/dynamic-labs/DynamicAuth/issues/6026)) ([8b784b7](https://github.com/dynamic-labs/DynamicAuth/commit/8b784b702e242ca279aafae657a076a51d397627))
9
+ * expose selectedTabState and deprecate setDefaultSelectedTab ([#6028](https://github.com/dynamic-labs/DynamicAuth/issues/6028)) ([eb71787](https://github.com/dynamic-labs/DynamicAuth/commit/eb717877cb6604504d10802a3aecc6055f95caa0))
10
+
11
+ ### [2.1.5](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.4...v2.1.5) (2024-06-16)
12
+
13
+ * Improve handling of unknown wallets, css fixes and copy updates in multi wallet experience
14
+
15
+ ### [2.1.4](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.3...v2.1.4) (2024-06-14)
3
16
 
4
17
 
5
18
  ### Bug Fixes
6
19
 
7
- * btc getBalance should use ordinal address if payment not available ([#5882](https://github.com/dynamic-labs/DynamicAuth/issues/5882)) ([803a055](https://github.com/dynamic-labs/DynamicAuth/commit/803a05518ae9d2353d50f51b29047dff01136710))
8
- * connect prompt when switching to xverse ([#5888](https://github.com/dynamic-labs/DynamicAuth/issues/5888)) ([181a7c4](https://github.com/dynamic-labs/DynamicAuth/commit/181a7c4af8217dab7ed2776d56ec2e3725a0ee6a))
20
+ * close sign modal when signing in with a wallet when embedded wallet is enabled ([#6012](https://github.com/dynamic-labs/DynamicAuth/issues/6012)) ([d473cc8](https://github.com/dynamic-labs/DynamicAuth/commit/d473cc83ac378b7bc43e2546020c02a297d4595b))
21
+ * display custom network name in network picker even if it doesn't have a valid icon ([#6020](https://github.com/dynamic-labs/DynamicAuth/issues/6020)) ([5e1539e](https://github.com/dynamic-labs/DynamicAuth/commit/5e1539e1e6920fb1fdbf96c938f40e785b3ee680))
9
22
 
10
- ## [2.2.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0-alpha.2...v2.2.0-alpha.3) (2024-06-05)
23
+ ### [2.1.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.2...v2.1.3) (2024-06-14)
11
24
 
12
25
 
13
26
  ### Features
14
27
 
15
- * farcaster linking ([#5869](https://github.com/dynamic-labs/DynamicAuth/issues/5869)) ([191d1d2](https://github.com/dynamic-labs/DynamicAuth/commit/191d1d29e436e7d453d533c9c330ac5cef2e2a1c))
28
+ * add in-app browser navigation support for sats-connect ([#5990](https://github.com/dynamic-labs/DynamicAuth/issues/5990)) ([7ea15b9](https://github.com/dynamic-labs/DynamicAuth/commit/7ea15b93d1864164acb82c1e73aae7f9130e1d44))
16
29
 
17
30
 
18
31
  ### Bug Fixes
19
32
 
20
- * phone number in kyc step ([#5875](https://github.com/dynamic-labs/DynamicAuth/issues/5875)) ([d73f3b1](https://github.com/dynamic-labs/DynamicAuth/commit/d73f3b158e794727e7bed5d558a43d937951ce56))
33
+ * cache getGenesisHash call to prevent over calling ([#5966](https://github.com/dynamic-labs/DynamicAuth/issues/5966)) ([#5970](https://github.com/dynamic-labs/DynamicAuth/issues/5970)) ([b624b2e](https://github.com/dynamic-labs/DynamicAuth/commit/b624b2ea5b398bf464d3098e7d81d83c7b5bf659))
34
+ * improvements to embedded solana wallet ([#6001](https://github.com/dynamic-labs/DynamicAuth/issues/6001)) ([a6437c9](https://github.com/dynamic-labs/DynamicAuth/commit/a6437c93e1946bca609d3d99d282123275022376)) ([#5815](https://github.com/dynamic-labs/DynamicAuth/issues/5815)) ([#5978](https://github.com/dynamic-labs/DynamicAuth/issues/5978)) ([dd92973](https://github.com/dynamic-labs/DynamicAuth/commit/dd9297365f0ccbee1217325328e173ae7ee9a922))
35
+ * show linked wallets with unavailable providers in user wallets list ([#6005](https://github.com/dynamic-labs/DynamicAuth/issues/6005)) ([79796d1](https://github.com/dynamic-labs/DynamicAuth/commit/79796d1b73670265ca9897314252b620afaa2e8a))
36
+ * close switch network modal after switching to a supported network ([#5987](https://github.com/dynamic-labs/DynamicAuth/issues/5987)) ([a7e762e](https://github.com/dynamic-labs/DynamicAuth/commit/a7e762ef63a72492d0c083a344111589a6fbc455))
21
37
 
22
- ## [2.2.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0-alpha.1...v2.2.0-alpha.2) (2024-06-05)
38
+ ### [2.1.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.2-alpha.1...v2.1.2) (2024-06-10)
23
39
 
24
40
 
25
41
  ### Features
26
42
 
27
- * display enabled countries in phone number field ([#5825](https://github.com/dynamic-labs/DynamicAuth/issues/5825)) ([a1ea0e1](https://github.com/dynamic-labs/DynamicAuth/commit/a1ea0e1ac1cf48ec348a243fd986991361b3b54f))
43
+ * hide wallets from wallet list that can't have multiple accounts linked ([#5935](https://github.com/dynamic-labs/DynamicAuth/issues/5935)) ([20f9b15](https://github.com/dynamic-labs/DynamicAuth/commit/20f9b15b145cbc57519155691b3640149eec3689))
28
44
 
29
45
 
30
46
  ### Bug Fixes
31
47
 
32
- * bump @solana/web3.js containing new version of rpc-websockets ([#5853](https://github.com/dynamic-labs/DynamicAuth/issues/5853)) ([dd5bc12](https://github.com/dynamic-labs/DynamicAuth/commit/dd5bc121c35d86dca52f5574ebc30ab30f35b626)), closes [solana-labs/solana-web3.js#2762](https://github.com/solana-labs/solana-web3.js/issues/2762)
48
+ * ensure sign message will not show 2 times ([#5938](https://github.com/dynamic-labs/DynamicAuth/issues/5938)) ([#5941](https://github.com/dynamic-labs/DynamicAuth/issues/5941)) ([2c5a156](https://github.com/dynamic-labs/DynamicAuth/commit/2c5a156ead565bd25067b3bc2b23cbc704f9b314))
49
+ * improve logic related to embedded wallets and emailVerifcation ([#5947](https://github.com/dynamic-labs/DynamicAuth/issues/5947)) ([b885a14](https://github.com/dynamic-labs/DynamicAuth/commit/b885a14dcf200f05233e4ab42b8b518d877d291a))
50
+ * init coinbase provider adhoc ([#5907](https://github.com/dynamic-labs/DynamicAuth/issues/5907)) ([#5933](https://github.com/dynamic-labs/DynamicAuth/issues/5933)) ([2fa1f52](https://github.com/dynamic-labs/DynamicAuth/commit/2fa1f528b27113ee108252ee874ee7f5ead88329))
51
+ * remove force consent and account selection even for returning google users ([#5912](https://github.com/dynamic-labs/DynamicAuth/issues/5912)) ([26a07f2](https://github.com/dynamic-labs/DynamicAuth/commit/26a07f29bdb8bf32a080396906a21d8b084c202f))
52
+ * resolve the default phone country based on enabled countries ([#5](https://github.com/dynamic-labs/DynamicAuth/issues/5)… ([#5916](https://github.com/dynamic-labs/DynamicAuth/issues/5916)) ([8f27c00](https://github.com/dynamic-labs/DynamicAuth/commit/8f27c0082edb77b964b8402cfa75c6a896b061d3)), closes [#5910](https://github.com/dynamic-labs/DynamicAuth/issues/5910)
53
+ * versioned tx needs address lookup table ([#5909](https://github.com/dynamic-labs/DynamicAuth/issues/5909)) ([#5919](https://github.com/dynamic-labs/DynamicAuth/issues/5919)) ([22e3ca2](https://github.com/dynamic-labs/DynamicAuth/commit/22e3ca2d0b27d15efb50e3092a7bc3a0c0d255a5))
54
+
55
+ ### [2.1.2-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.2-alpha.0...v2.1.2-alpha.1) (2024-06-07)
33
56
 
34
- ## [2.2.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0-alpha.0...v2.2.0-alpha.1) (2024-06-04)
35
57
 
36
- ## [2.2.0-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0...v2.2.0-alpha.0) (2024-06-04)
58
+ ### Bug Fixes
59
+
60
+ * find phantom solana provider when opening dapp on new tab ([#5902](https://github.com/dynamic-labs/DynamicAuth/issues/5902)) ([99daf87](https://github.com/dynamic-labs/DynamicAuth/commit/99daf87f17caed870a76e4f89a257a14da37c7ab)), closes [#5895](https://github.com/dynamic-labs/DynamicAuth/issues/5895) [#5896](https://github.com/dynamic-labs/DynamicAuth/issues/5896) [#5897](https://github.com/dynamic-labs/DynamicAuth/issues/5897)
61
+
62
+ ### [2.1.2-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.1...v2.1.2-alpha.0) (2024-06-07)
37
63
 
38
64
 
39
65
  ### Features
40
66
 
41
- * add multi-asset wallet header ([#5608](https://github.com/dynamic-labs/DynamicAuth/issues/5608)) ([47998b1](https://github.com/dynamic-labs/DynamicAuth/commit/47998b1999ddf786bf88b86248c79fc92f278331)), closes [#5655](https://github.com/dynamic-labs/DynamicAuth/issues/5655) [#5643](https://github.com/dynamic-labs/DynamicAuth/issues/5643) [#5673](https://github.com/dynamic-labs/DynamicAuth/issues/5673) [#5762](https://github.com/dynamic-labs/DynamicAuth/issues/5762) [#5766](https://github.com/dynamic-labs/DynamicAuth/issues/5766) [#5777](https://github.com/dynamic-labs/DynamicAuth/issues/5777)
67
+ * display enabled countries in phone number field ([#5825](https://github.com/dynamic-labs/DynamicAuth/issues/5825)) ([#5868](https://github.com/dynamic-labs/DynamicAuth/issues/5868)) ([640a4a7](https://github.com/dynamic-labs/DynamicAuth/commit/640a4a77c994390ceed759faf186717b38f393a4))
68
+
69
+
70
+ ### Bug Fixes
71
+
72
+ * btc getBalance should use ordinal address if payment not available ([#5883](https://github.com/dynamic-labs/DynamicAuth/issues/5883)) ([bc5ac55](https://github.com/dynamic-labs/DynamicAuth/commit/bc5ac5589e90193d41282d23ce037db360dd23e6))
73
+ * phone number in kyc step ([#5875](https://github.com/dynamic-labs/DynamicAuth/issues/5875)) ([#5879](https://github.com/dynamic-labs/DynamicAuth/issues/5879)) ([3d8a5be](https://github.com/dynamic-labs/DynamicAuth/commit/3d8a5bef35d4a13a1068aaf80d2c39e795b097cd))
74
+
75
+ ### [2.1.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0...v2.1.1) (2024-06-04)
42
76
 
43
77
  ## [2.1.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.32...v2.1.0) (2024-06-04)
44
78
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/solana",
3
- "version": "2.2.0-alpha.4",
3
+ "version": "2.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -34,13 +34,13 @@
34
34
  "@wallet-standard/experimental-features": "0.1.1",
35
35
  "bs58": "5.0.0",
36
36
  "tweetnacl": "1.0.3",
37
- "@dynamic-labs/rpc-provider-solana": "2.2.0-alpha.4",
38
- "@dynamic-labs/rpc-providers": "2.2.0-alpha.4",
39
- "@dynamic-labs/turnkey": "2.2.0-alpha.4",
40
- "@dynamic-labs/types": "2.2.0-alpha.4",
41
- "@dynamic-labs/utils": "2.2.0-alpha.4",
42
- "@dynamic-labs/wallet-book": "2.2.0-alpha.4",
43
- "@dynamic-labs/wallet-connector-core": "2.2.0-alpha.4",
37
+ "@dynamic-labs/rpc-provider-solana": "2.2.0",
38
+ "@dynamic-labs/rpc-providers": "2.2.0",
39
+ "@dynamic-labs/turnkey": "2.2.0",
40
+ "@dynamic-labs/types": "2.2.0",
41
+ "@dynamic-labs/utils": "2.2.0",
42
+ "@dynamic-labs/wallet-book": "2.2.0",
43
+ "@dynamic-labs/wallet-connector-core": "2.2.0",
44
44
  "eventemitter3": "5.0.1"
45
45
  },
46
46
  "peerDependencies": {}
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const SOLANA_GENESIS_HASH = 'genesis-hash';
7
+
8
+ exports.SOLANA_GENESIS_HASH = SOLANA_GENESIS_HASH;
@@ -0,0 +1 @@
1
+ export declare const SOLANA_GENESIS_HASH = "genesis-hash";
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ const SOLANA_GENESIS_HASH = 'genesis-hash';
3
+
4
+ export { SOLANA_GENESIS_HASH };
package/src/index.cjs CHANGED
@@ -7,6 +7,7 @@ var turnkey = require('@dynamic-labs/turnkey');
7
7
  var Phantom = require('./Phantom.cjs');
8
8
  var fetchInjectedWalletConnectors = require('./injected/fetchInjectedWalletConnectors.cjs');
9
9
  var UnknownInjected = require('./injected/UnknownInjected.cjs');
10
+ var FallbackSolanaConnector = require('./injected/FallbackSolanaConnector.cjs');
10
11
  var isSignedMessage = require('./utils/isSignedMessage.cjs');
11
12
  var isBackpackSolanaSigner = require('./utils/isBackpackSolanaSigner.cjs');
12
13
 
@@ -17,6 +18,7 @@ const SolanaWalletConnectors = (props) => [
17
18
  ...turnkey.TurnkeySolanaWalletConnectors(props),
18
19
  Phantom.Phantom,
19
20
  UnknownInjected.UnknownInjected,
21
+ FallbackSolanaConnector.FallbackSolanaConnector,
20
22
  ];
21
23
 
22
24
  exports.isSignedMessage = isSignedMessage.isSignedMessage;
package/src/index.js CHANGED
@@ -3,6 +3,7 @@ import { TurnkeySolanaWalletConnectors } from '@dynamic-labs/turnkey';
3
3
  import { Phantom } from './Phantom.js';
4
4
  import { injectedWalletOverrides, fetchInjectedWalletConnectors } from './injected/fetchInjectedWalletConnectors.js';
5
5
  import { UnknownInjected } from './injected/UnknownInjected.js';
6
+ import { FallbackSolanaConnector } from './injected/FallbackSolanaConnector.js';
6
7
  export { isSignedMessage } from './utils/isSignedMessage.js';
7
8
  export { isBackpackSolanaSigner } from './utils/isBackpackSolanaSigner.js';
8
9
 
@@ -13,6 +14,7 @@ const SolanaWalletConnectors = (props) => [
13
14
  ...TurnkeySolanaWalletConnectors(props),
14
15
  Phantom,
15
16
  UnknownInjected,
17
+ FallbackSolanaConnector,
16
18
  ];
17
19
 
18
20
  export { SolanaWalletConnectors };
@@ -0,0 +1,22 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var walletBook = require('@dynamic-labs/wallet-book');
7
+ var InjectedWalletBase = require('./InjectedWalletBase.cjs');
8
+
9
+ class FallbackSolanaConnector extends InjectedWalletBase.InjectedWalletBase {
10
+ constructor(opts) {
11
+ super(opts);
12
+ this.name = 'Fallback Connector';
13
+ this.overrideKey = 'fallbackconnector';
14
+ this.isAvailable = false;
15
+ this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
16
+ }
17
+ isInstalledOnBrowser() {
18
+ return false;
19
+ }
20
+ }
21
+
22
+ exports.FallbackSolanaConnector = FallbackSolanaConnector;
@@ -0,0 +1,9 @@
1
+ import { SolWalletConnectorOpts } from '../solWalletConnector';
2
+ import { InjectedWalletBase } from './InjectedWalletBase';
3
+ export declare class FallbackSolanaConnector extends InjectedWalletBase {
4
+ name: string;
5
+ overrideKey: string;
6
+ isAvailable: boolean;
7
+ constructor(opts: SolWalletConnectorOpts);
8
+ isInstalledOnBrowser(): boolean;
9
+ }
@@ -0,0 +1,18 @@
1
+ 'use client'
2
+ import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
3
+ import { InjectedWalletBase } from './InjectedWalletBase.js';
4
+
5
+ class FallbackSolanaConnector extends InjectedWalletBase {
6
+ constructor(opts) {
7
+ super(opts);
8
+ this.name = 'Fallback Connector';
9
+ this.overrideKey = 'fallbackconnector';
10
+ this.isAvailable = false;
11
+ this.wallet = findWalletBookWallet(this.walletBook, this.key);
12
+ }
13
+ isInstalledOnBrowser() {
14
+ return false;
15
+ }
16
+ }
17
+
18
+ export { FallbackSolanaConnector };
@@ -1,2 +1,3 @@
1
1
  export * from './fetchInjectedWalletConnectors';
2
2
  export * from './UnknownInjected';
3
+ export * from './FallbackSolanaConnector';
@@ -7,6 +7,7 @@ var _tslib = require('../_virtual/_tslib.cjs');
7
7
  var utils = require('@dynamic-labs/utils');
8
8
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
9
  var isSignedMessage = require('./utils/isSignedMessage.cjs');
10
+ var findWalletProviderFromWalletStandard = require('./utils/findWalletProviderFromWalletStandard/findWalletProviderFromWalletStandard.cjs');
10
11
 
11
12
  class SolProviderHelper {
12
13
  constructor(wallet) {
@@ -26,6 +27,7 @@ class SolProviderHelper {
26
27
  return this.installedProviderLookup(config.extensionLocators);
27
28
  }
28
29
  installedProviders() {
30
+ var _a, _b;
29
31
  const config = this.getInjectedConfig();
30
32
  if (!config)
31
33
  return [];
@@ -48,6 +50,12 @@ class SolProviderHelper {
48
50
  window.solana.providers.forEach((provider) => providers.push(provider));
49
51
  }
50
52
  }
53
+ if (((_b = (_a = config.walletStandardLocators) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) {
54
+ const walletStandardProvider = findWalletProviderFromWalletStandard.findWalletProviderFromWalletStandard(config);
55
+ if (walletStandardProvider) {
56
+ providers.push(walletStandardProvider);
57
+ }
58
+ }
51
59
  return providers;
52
60
  }
53
61
  installedProviderLookup(extensionLocators) {
@@ -15,6 +15,10 @@ export declare class SolProviderHelper {
15
15
  features: string[];
16
16
  name: string;
17
17
  } | undefined;
18
+ walletStandardLocators?: {
19
+ name: string;
20
+ locator: string;
21
+ }[] | undefined;
18
22
  windowLocations?: string[] | undefined;
19
23
  } | undefined;
20
24
  getInstalledProvider(): ISolana | undefined;
@@ -3,6 +3,7 @@ import { __awaiter } from '../_virtual/_tslib.js';
3
3
  import { getProvidersFromWindow, bufferToBase64 } from '@dynamic-labs/utils';
4
4
  import { ProviderLookup } from '@dynamic-labs/wallet-connector-core';
5
5
  import { isSignedMessage } from './utils/isSignedMessage.js';
6
+ import { findWalletProviderFromWalletStandard } from './utils/findWalletProviderFromWalletStandard/findWalletProviderFromWalletStandard.js';
6
7
 
7
8
  class SolProviderHelper {
8
9
  constructor(wallet) {
@@ -22,6 +23,7 @@ class SolProviderHelper {
22
23
  return this.installedProviderLookup(config.extensionLocators);
23
24
  }
24
25
  installedProviders() {
26
+ var _a, _b;
25
27
  const config = this.getInjectedConfig();
26
28
  if (!config)
27
29
  return [];
@@ -44,6 +46,12 @@ class SolProviderHelper {
44
46
  window.solana.providers.forEach((provider) => providers.push(provider));
45
47
  }
46
48
  }
49
+ if (((_b = (_a = config.walletStandardLocators) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) {
50
+ const walletStandardProvider = findWalletProviderFromWalletStandard(config);
51
+ if (walletStandardProvider) {
52
+ providers.push(walletStandardProvider);
53
+ }
54
+ }
47
55
  return providers;
48
56
  }
49
57
  installedProviderLookup(extensionLocators) {
@@ -9,6 +9,7 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
9
  var utils = require('@dynamic-labs/utils');
10
10
  var walletBook = require('@dynamic-labs/wallet-book');
11
11
  var extractNonce = require('./utils/extractNonce.cjs');
12
+ var getGenesisHashLSKey = require('./utils/getGenesisHashLSKey.cjs');
12
13
 
13
14
  const MEMO_PROGRAM_ID = new web3_js.PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr');
14
15
  class SolWalletConnector extends walletConnectorCore.WalletConnectorBase {
@@ -16,7 +17,6 @@ class SolWalletConnector extends walletConnectorCore.WalletConnectorBase {
16
17
  var _a;
17
18
  super(opts);
18
19
  this.isHardwareWalletEnabled = false;
19
- this._network = undefined;
20
20
  this.verifiedCredentials = [];
21
21
  this.supportedChains = ['SOL'];
22
22
  this.connectedChain = 'SOL';
@@ -26,11 +26,12 @@ class SolWalletConnector extends walletConnectorCore.WalletConnectorBase {
26
26
  }
27
27
  getNetwork() {
28
28
  return _tslib.__awaiter(this, void 0, void 0, function* () {
29
- if (this._network) {
30
- return this._network;
31
- }
32
29
  const provider = this.getWalletClient();
33
- let genesisHash = yield provider.getGenesisHash();
30
+ let genesisHash = localStorage.getItem(getGenesisHashLSKey.getGenesisHashLSKey(provider.rpcEndpoint));
31
+ if (!genesisHash) {
32
+ genesisHash = yield provider.getGenesisHash();
33
+ localStorage.setItem(getGenesisHashLSKey.getGenesisHashLSKey(provider.rpcEndpoint), genesisHash);
34
+ }
34
35
  genesisHash = genesisHash.substring(0, 32);
35
36
  // see: https://github.com/ChainAgnostic/namespaces/blob/main/solana/caip2.md
36
37
  let network;
@@ -43,10 +44,14 @@ class SolWalletConnector extends walletConnectorCore.WalletConnectorBase {
43
44
  else {
44
45
  network = 'testnet';
45
46
  }
46
- this._network = network;
47
47
  return network;
48
48
  });
49
49
  }
50
+ endSession() {
51
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
52
+ localStorage.removeItem(getGenesisHashLSKey.getGenesisHashLSKey(this.getWalletClient().rpcEndpoint));
53
+ });
54
+ }
50
55
  getWalletClient() {
51
56
  var _a;
52
57
  const [network] = this.solNetworks;
@@ -10,16 +10,15 @@ export type SolWalletConnectorOpts = {
10
10
  solNetworks: GenericNetwork[];
11
11
  walletBook: WalletBookSchema;
12
12
  };
13
- type SolanaNetwork = 'mainnet' | 'devnet' | 'testnet';
14
13
  export declare abstract class SolWalletConnector extends WalletConnectorBase implements IHardwareWalletConnector {
15
14
  isHardwareWalletEnabled: boolean;
16
- _network: SolanaNetwork | undefined;
17
15
  verifiedCredentials: JwtVerifiedCredential[];
18
16
  solNetworks: GenericNetwork[];
19
17
  supportedChains: Chain[];
20
18
  connectedChain: Chain;
21
19
  constructor(opts: SolWalletConnectorOpts);
22
20
  getNetwork(): Promise<string>;
21
+ endSession(): Promise<void>;
23
22
  getWalletClient(): Connection;
24
23
  getPublicClient(): Promise<Connection | undefined>;
25
24
  abstract getSigner(): Promise<ISolana | undefined>;
@@ -34,4 +33,3 @@ export declare abstract class SolWalletConnector extends WalletConnectorBase imp
34
33
  setVerifiedCredentials(verifiedCredentials: JwtVerifiedCredential[]): void;
35
34
  isLedgerAddress(address: string): boolean;
36
35
  }
37
- export {};
@@ -5,6 +5,7 @@ import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
5
5
  import { DynamicError, NotSupportedError, isLedgerAddressViaVerifiedCredentials } from '@dynamic-labs/utils';
6
6
  import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
7
7
  import { extractNonce } from './utils/extractNonce.js';
8
+ import { getGenesisHashLSKey } from './utils/getGenesisHashLSKey.js';
8
9
 
9
10
  const MEMO_PROGRAM_ID = new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr');
10
11
  class SolWalletConnector extends WalletConnectorBase {
@@ -12,7 +13,6 @@ class SolWalletConnector extends WalletConnectorBase {
12
13
  var _a;
13
14
  super(opts);
14
15
  this.isHardwareWalletEnabled = false;
15
- this._network = undefined;
16
16
  this.verifiedCredentials = [];
17
17
  this.supportedChains = ['SOL'];
18
18
  this.connectedChain = 'SOL';
@@ -22,11 +22,12 @@ class SolWalletConnector extends WalletConnectorBase {
22
22
  }
23
23
  getNetwork() {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
- if (this._network) {
26
- return this._network;
27
- }
28
25
  const provider = this.getWalletClient();
29
- let genesisHash = yield provider.getGenesisHash();
26
+ let genesisHash = localStorage.getItem(getGenesisHashLSKey(provider.rpcEndpoint));
27
+ if (!genesisHash) {
28
+ genesisHash = yield provider.getGenesisHash();
29
+ localStorage.setItem(getGenesisHashLSKey(provider.rpcEndpoint), genesisHash);
30
+ }
30
31
  genesisHash = genesisHash.substring(0, 32);
31
32
  // see: https://github.com/ChainAgnostic/namespaces/blob/main/solana/caip2.md
32
33
  let network;
@@ -39,10 +40,14 @@ class SolWalletConnector extends WalletConnectorBase {
39
40
  else {
40
41
  network = 'testnet';
41
42
  }
42
- this._network = network;
43
43
  return network;
44
44
  });
45
45
  }
46
+ endSession() {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ localStorage.removeItem(getGenesisHashLSKey(this.getWalletClient().rpcEndpoint));
49
+ });
50
+ }
46
51
  getWalletClient() {
47
52
  var _a;
48
53
  const [network] = this.solNetworks;
@@ -0,0 +1,29 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var app = require('@wallet-standard/app');
7
+ var utils = require('@dynamic-labs/utils');
8
+
9
+ const findWalletProviderFromWalletStandard = (injectConfig) => {
10
+ const { walletStandardLocators } = injectConfig;
11
+ if (!walletStandardLocators || walletStandardLocators.length === 0) {
12
+ return undefined;
13
+ }
14
+ const wallets = app.getWallets().get();
15
+ return walletStandardLocators.reduce((provider, walletStandardLocator) => {
16
+ /**
17
+ * Return early if the provider is already found
18
+ */
19
+ if (provider) {
20
+ return provider;
21
+ }
22
+ const wallet = wallets.find((w) => w.name === walletStandardLocator.name);
23
+ if (!wallet)
24
+ return undefined;
25
+ return utils.get(wallet, walletStandardLocator.locator);
26
+ }, undefined);
27
+ };
28
+
29
+ exports.findWalletProviderFromWalletStandard = findWalletProviderFromWalletStandard;
@@ -0,0 +1,3 @@
1
+ import { WalletSchema } from '@dynamic-labs/wallet-book';
2
+ import { ISolana } from '../../types';
3
+ export declare const findWalletProviderFromWalletStandard: (injectConfig: NonNullable<WalletSchema['injectedConfig']>[number]) => ISolana | undefined;
@@ -0,0 +1,25 @@
1
+ 'use client'
2
+ import { getWallets } from '@wallet-standard/app';
3
+ import { get } from '@dynamic-labs/utils';
4
+
5
+ const findWalletProviderFromWalletStandard = (injectConfig) => {
6
+ const { walletStandardLocators } = injectConfig;
7
+ if (!walletStandardLocators || walletStandardLocators.length === 0) {
8
+ return undefined;
9
+ }
10
+ const wallets = getWallets().get();
11
+ return walletStandardLocators.reduce((provider, walletStandardLocator) => {
12
+ /**
13
+ * Return early if the provider is already found
14
+ */
15
+ if (provider) {
16
+ return provider;
17
+ }
18
+ const wallet = wallets.find((w) => w.name === walletStandardLocator.name);
19
+ if (!wallet)
20
+ return undefined;
21
+ return get(wallet, walletStandardLocator.locator);
22
+ }, undefined);
23
+ };
24
+
25
+ export { findWalletProviderFromWalletStandard };
@@ -0,0 +1 @@
1
+ export { findWalletProviderFromWalletStandard } from './findWalletProviderFromWalletStandard';
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var contants = require('../contants.cjs');
7
+
8
+ const getGenesisHashLSKey = (rpcEndpoint) => `${rpcEndpoint}_${contants.SOLANA_GENESIS_HASH}`;
9
+
10
+ exports.getGenesisHashLSKey = getGenesisHashLSKey;
@@ -0,0 +1 @@
1
+ export declare const getGenesisHashLSKey: (rpcEndpoint: string) => string;
@@ -0,0 +1,6 @@
1
+ 'use client'
2
+ import { SOLANA_GENESIS_HASH } from '../contants.js';
3
+
4
+ const getGenesisHashLSKey = (rpcEndpoint) => `${rpcEndpoint}_${SOLANA_GENESIS_HASH}`;
5
+
6
+ export { getGenesisHashLSKey };