@dynamic-labs/solana 2.1.2-alpha.0 → 2.1.2-alpha.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,11 @@
1
1
 
2
+ ### [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)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * 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)
8
+
2
9
  ### [2.1.2-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.1...v2.1.2-alpha.0) (2024-06-07)
3
10
 
4
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/solana",
3
- "version": "2.1.2-alpha.0",
3
+ "version": "2.1.2-alpha.1",
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.1.2-alpha.0",
38
- "@dynamic-labs/rpc-providers": "2.1.2-alpha.0",
39
- "@dynamic-labs/turnkey": "2.1.2-alpha.0",
40
- "@dynamic-labs/types": "2.1.2-alpha.0",
41
- "@dynamic-labs/utils": "2.1.2-alpha.0",
42
- "@dynamic-labs/wallet-book": "2.1.2-alpha.0",
43
- "@dynamic-labs/wallet-connector-core": "2.1.2-alpha.0",
37
+ "@dynamic-labs/rpc-provider-solana": "2.1.2-alpha.1",
38
+ "@dynamic-labs/rpc-providers": "2.1.2-alpha.1",
39
+ "@dynamic-labs/turnkey": "2.1.2-alpha.1",
40
+ "@dynamic-labs/types": "2.1.2-alpha.1",
41
+ "@dynamic-labs/utils": "2.1.2-alpha.1",
42
+ "@dynamic-labs/wallet-book": "2.1.2-alpha.1",
43
+ "@dynamic-labs/wallet-connector-core": "2.1.2-alpha.1",
44
44
  "eventemitter3": "5.0.1"
45
45
  },
46
46
  "peerDependencies": {}
@@ -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) {
@@ -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';