@dynamic-labs/solana 1.4.11 → 1.4.13
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,19 @@
|
|
|
1
1
|
|
|
2
|
+
### [1.4.13](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.12...v1.4.13) (2024-06-05)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* bump @solana/web3.js containing new version of rpc-websockets ([#5864](https://github.com/dynamic-labs/DynamicAuth/issues/5864)) ([562ff9b](https://github.com/dynamic-labs/DynamicAuth/commit/562ff9b706c8be62812ace08bcaef96e26dcd841))
|
|
8
|
+
* wallet improvements
|
|
9
|
+
|
|
10
|
+
### [1.4.12](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.11...v1.4.12) (2024-05-22)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* init ethers web3provider without a network if selected network is unsupported ([#5658](https://github.com/dynamic-labs/DynamicAuth/issues/5658)) ([9973af8](https://github.com/dynamic-labs/DynamicAuth/commit/9973af8fa6bc3f45095f4b830fe480ff2ed58a77))
|
|
16
|
+
|
|
2
17
|
### [1.4.11](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.10...v1.4.11) (2024-04-26)
|
|
3
18
|
|
|
4
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.13",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@solana/web3.js": "1.
|
|
29
|
+
"@solana/web3.js": "1.92.1",
|
|
30
30
|
"@dynamic-labs/sdk-api": "0.0.387",
|
|
31
31
|
"bs58": "^5.0.0",
|
|
32
32
|
"tweetnacl": "^1.0.3",
|
|
33
|
-
"@dynamic-labs/rpc-providers": "1.4.
|
|
34
|
-
"@dynamic-labs/turnkey": "1.4.
|
|
35
|
-
"@dynamic-labs/types": "1.4.
|
|
36
|
-
"@dynamic-labs/utils": "1.4.
|
|
37
|
-
"@dynamic-labs/wallet-book": "1.4.
|
|
38
|
-
"@dynamic-labs/wallet-connector-core": "1.4.
|
|
33
|
+
"@dynamic-labs/rpc-providers": "1.4.13",
|
|
34
|
+
"@dynamic-labs/turnkey": "1.4.13",
|
|
35
|
+
"@dynamic-labs/types": "1.4.13",
|
|
36
|
+
"@dynamic-labs/utils": "1.4.13",
|
|
37
|
+
"@dynamic-labs/wallet-book": "1.4.13",
|
|
38
|
+
"@dynamic-labs/wallet-connector-core": "1.4.13",
|
|
39
39
|
"eventemitter3": "5.0.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
6
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
+
var utils = require('@dynamic-labs/utils');
|
|
7
8
|
var solProviderHelper = require('../solProviderHelper.cjs');
|
|
8
9
|
var solWalletConnector = require('../solWalletConnector.cjs');
|
|
9
10
|
var SignMessageNotSupportedError = require('../errors/SignMessageNotSupportedError.cjs');
|
|
@@ -48,10 +49,20 @@ class InjectedWalletBase extends solWalletConnector.SolWalletConnector {
|
|
|
48
49
|
}
|
|
49
50
|
fetchPublicAddress() {
|
|
50
51
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
var _a;
|
|
52
|
-
if (!this.isInstalledOnBrowser())
|
|
52
|
+
var _a, _b;
|
|
53
|
+
if (!this.isInstalledOnBrowser()) {
|
|
54
|
+
if (utils.isMobile() &&
|
|
55
|
+
((_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) &&
|
|
56
|
+
this.wallet.mobile.inAppBrowser) {
|
|
57
|
+
const inAppBrowserCompiledTemplate = utils.template(this.wallet.mobile.inAppBrowser);
|
|
58
|
+
const deepLink = inAppBrowserCompiledTemplate({
|
|
59
|
+
encodedDappURI: encodeURIComponent(window.location.toString()),
|
|
60
|
+
});
|
|
61
|
+
window.location.assign(deepLink);
|
|
62
|
+
}
|
|
53
63
|
return;
|
|
54
|
-
|
|
64
|
+
}
|
|
65
|
+
return (_b = this.getSolProviderHelper()) === null || _b === void 0 ? void 0 : _b.fetchPublicAddress();
|
|
55
66
|
});
|
|
56
67
|
}
|
|
57
68
|
signMessage(messageToSign) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
2
|
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
3
|
+
import { isMobile, template } from '@dynamic-labs/utils';
|
|
3
4
|
import { SolProviderHelper } from '../solProviderHelper.js';
|
|
4
5
|
import { SolWalletConnector } from '../solWalletConnector.js';
|
|
5
6
|
import { SignMessageNotSupportedError } from '../errors/SignMessageNotSupportedError.js';
|
|
@@ -44,10 +45,20 @@ class InjectedWalletBase extends SolWalletConnector {
|
|
|
44
45
|
}
|
|
45
46
|
fetchPublicAddress() {
|
|
46
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
var _a;
|
|
48
|
-
if (!this.isInstalledOnBrowser())
|
|
48
|
+
var _a, _b;
|
|
49
|
+
if (!this.isInstalledOnBrowser()) {
|
|
50
|
+
if (isMobile() &&
|
|
51
|
+
((_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) &&
|
|
52
|
+
this.wallet.mobile.inAppBrowser) {
|
|
53
|
+
const inAppBrowserCompiledTemplate = template(this.wallet.mobile.inAppBrowser);
|
|
54
|
+
const deepLink = inAppBrowserCompiledTemplate({
|
|
55
|
+
encodedDappURI: encodeURIComponent(window.location.toString()),
|
|
56
|
+
});
|
|
57
|
+
window.location.assign(deepLink);
|
|
58
|
+
}
|
|
49
59
|
return;
|
|
50
|
-
|
|
60
|
+
}
|
|
61
|
+
return (_b = this.getSolProviderHelper()) === null || _b === void 0 ? void 0 : _b.fetchPublicAddress();
|
|
51
62
|
});
|
|
52
63
|
}
|
|
53
64
|
signMessage(messageToSign) {
|
|
@@ -32,11 +32,14 @@ class SolProviderHelper {
|
|
|
32
32
|
if (config.windowLocations) {
|
|
33
33
|
for (const windowLocation of config.windowLocations) {
|
|
34
34
|
const foundProviders = utils.getProvidersFromWindow(windowLocation);
|
|
35
|
-
if (foundProviders && foundProviders.length)
|
|
35
|
+
if (foundProviders && foundProviders.length) {
|
|
36
36
|
providers.push(...foundProviders);
|
|
37
|
+
}
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
+
// We should only include the `window.solana` provider
|
|
41
|
+
// when extensionLocators are provided
|
|
42
|
+
if (config.extensionLocators.length !== 0 && window.solana) {
|
|
40
43
|
if (!window.solana.providers) {
|
|
41
44
|
providers.push(window.solana);
|
|
42
45
|
}
|
|
@@ -46,13 +49,14 @@ class SolProviderHelper {
|
|
|
46
49
|
}
|
|
47
50
|
return providers;
|
|
48
51
|
}
|
|
49
|
-
installedProviderLookup(
|
|
52
|
+
installedProviderLookup(extensionLocators) {
|
|
50
53
|
const allInstalledProviders = this.installedProviders();
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
if (
|
|
54
|
+
// No need to search through the window.solana providers if the
|
|
55
|
+
// wallet doesn't have extensionLocators
|
|
56
|
+
if (extensionLocators.length === 0) {
|
|
54
57
|
return allInstalledProviders[0];
|
|
55
|
-
|
|
58
|
+
}
|
|
59
|
+
return walletConnectorCore.ProviderLookup(allInstalledProviders, extensionLocators);
|
|
56
60
|
}
|
|
57
61
|
findProvider() {
|
|
58
62
|
return this.getInstalledProvider();
|
|
@@ -19,7 +19,7 @@ export declare class SolProviderHelper {
|
|
|
19
19
|
} | undefined;
|
|
20
20
|
getInstalledProvider(): ISolana | undefined;
|
|
21
21
|
installedProviders(): (import("./types").ISolanaSigner | import("./types").IBackpackSolanaSigner | import("./types").ICoinbaseSolanaSigner)[];
|
|
22
|
-
installedProviderLookup(
|
|
22
|
+
installedProviderLookup(extensionLocators: Array<ProviderCondition<ProviderFlag>>): ISolana | undefined;
|
|
23
23
|
findProvider(): ISolana | undefined;
|
|
24
24
|
isInstalledHelper(): boolean;
|
|
25
25
|
fetchPublicAddress(): Promise<string | undefined>;
|
package/src/solProviderHelper.js
CHANGED
|
@@ -28,11 +28,14 @@ class SolProviderHelper {
|
|
|
28
28
|
if (config.windowLocations) {
|
|
29
29
|
for (const windowLocation of config.windowLocations) {
|
|
30
30
|
const foundProviders = getProvidersFromWindow(windowLocation);
|
|
31
|
-
if (foundProviders && foundProviders.length)
|
|
31
|
+
if (foundProviders && foundProviders.length) {
|
|
32
32
|
providers.push(...foundProviders);
|
|
33
|
+
}
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
// We should only include the `window.solana` provider
|
|
37
|
+
// when extensionLocators are provided
|
|
38
|
+
if (config.extensionLocators.length !== 0 && window.solana) {
|
|
36
39
|
if (!window.solana.providers) {
|
|
37
40
|
providers.push(window.solana);
|
|
38
41
|
}
|
|
@@ -42,13 +45,14 @@ class SolProviderHelper {
|
|
|
42
45
|
}
|
|
43
46
|
return providers;
|
|
44
47
|
}
|
|
45
|
-
installedProviderLookup(
|
|
48
|
+
installedProviderLookup(extensionLocators) {
|
|
46
49
|
const allInstalledProviders = this.installedProviders();
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
if (
|
|
50
|
+
// No need to search through the window.solana providers if the
|
|
51
|
+
// wallet doesn't have extensionLocators
|
|
52
|
+
if (extensionLocators.length === 0) {
|
|
50
53
|
return allInstalledProviders[0];
|
|
51
|
-
|
|
54
|
+
}
|
|
55
|
+
return ProviderLookup(allInstalledProviders, extensionLocators);
|
|
52
56
|
}
|
|
53
57
|
findProvider() {
|
|
54
58
|
return this.getInstalledProvider();
|