@dynamic-labs/solana 2.1.0-alpha.31 → 2.1.0-alpha.32
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 +16 -0
- package/package.json +8 -8
- package/src/injected/InjectedWalletBase.cjs +14 -3
- package/src/injected/InjectedWalletBase.js +14 -3
- package/src/solProviderHelper.cjs +11 -7
- package/src/solProviderHelper.d.ts +2 -2
- package/src/solProviderHelper.js +11 -7
- package/src/types.d.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.32](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.31...v2.1.0-alpha.32) (2024-06-04)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* favor base mainnet when using coinbase sdk ([#5834](https://github.com/dynamic-labs/DynamicAuth/issues/5834)) ([fee5294](https://github.com/dynamic-labs/DynamicAuth/commit/fee529461e6b033938d3ec044c139f5efcb24f6d))
|
|
8
|
+
* open OKX deep link for Bitcoin ([#5818](https://github.com/dynamic-labs/DynamicAuth/issues/5818)) ([c33e93c](https://github.com/dynamic-labs/DynamicAuth/commit/c33e93c81b384d8cd91b3bd0414dd9ea669405c4))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* change Bitget Wallet to Bitget ([#5824](https://github.com/dynamic-labs/DynamicAuth/issues/5824)) ([23b8813](https://github.com/dynamic-labs/DynamicAuth/commit/23b8813e233be07392f5a3e283226b238b9fd99b))
|
|
14
|
+
* coinbase isInstalled ([#5821](https://github.com/dynamic-labs/DynamicAuth/issues/5821)) ([d0e5a37](https://github.com/dynamic-labs/DynamicAuth/commit/d0e5a37c6dd0cb6b85a5704767c93d495aa22854))
|
|
15
|
+
* filter window.solana in solProviderHelper if no extensionLocators are set ([#5819](https://github.com/dynamic-labs/DynamicAuth/issues/5819)) ([ca098ad](https://github.com/dynamic-labs/DynamicAuth/commit/ca098adb787365f9969c1a1f853d3c65ddd40d54))
|
|
16
|
+
* only send ordinal address if only one address retrieved from btc wallet ([#5817](https://github.com/dynamic-labs/DynamicAuth/issues/5817)) ([d54cef4](https://github.com/dynamic-labs/DynamicAuth/commit/d54cef424368b804fde0a4e607fefce22877a304))
|
|
17
|
+
|
|
2
18
|
## [2.1.0-alpha.31](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.30...v2.1.0-alpha.31) (2024-05-31)
|
|
3
19
|
|
|
4
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.32",
|
|
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.0-alpha.
|
|
38
|
-
"@dynamic-labs/rpc-providers": "2.1.0-alpha.
|
|
39
|
-
"@dynamic-labs/turnkey": "2.1.0-alpha.
|
|
40
|
-
"@dynamic-labs/types": "2.1.0-alpha.
|
|
41
|
-
"@dynamic-labs/utils": "2.1.0-alpha.
|
|
42
|
-
"@dynamic-labs/wallet-book": "2.1.0-alpha.
|
|
43
|
-
"@dynamic-labs/wallet-connector-core": "2.1.0-alpha.
|
|
37
|
+
"@dynamic-labs/rpc-provider-solana": "2.1.0-alpha.32",
|
|
38
|
+
"@dynamic-labs/rpc-providers": "2.1.0-alpha.32",
|
|
39
|
+
"@dynamic-labs/turnkey": "2.1.0-alpha.32",
|
|
40
|
+
"@dynamic-labs/types": "2.1.0-alpha.32",
|
|
41
|
+
"@dynamic-labs/utils": "2.1.0-alpha.32",
|
|
42
|
+
"@dynamic-labs/wallet-book": "2.1.0-alpha.32",
|
|
43
|
+
"@dynamic-labs/wallet-connector-core": "2.1.0-alpha.32",
|
|
44
44
|
"eventemitter3": "5.0.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
7
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
8
|
+
var utils = require('@dynamic-labs/utils');
|
|
8
9
|
var solProviderHelper = require('../solProviderHelper.cjs');
|
|
9
10
|
var solWalletConnector = require('../solWalletConnector.cjs');
|
|
10
11
|
var SignMessageNotSupportedError = require('../errors/SignMessageNotSupportedError.cjs');
|
|
@@ -49,10 +50,20 @@ class InjectedWalletBase extends solWalletConnector.SolWalletConnector {
|
|
|
49
50
|
}
|
|
50
51
|
getAddress() {
|
|
51
52
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
var _a;
|
|
53
|
-
if (!this.isInstalledOnBrowser())
|
|
53
|
+
var _a, _b;
|
|
54
|
+
if (!this.isInstalledOnBrowser()) {
|
|
55
|
+
if (utils.isMobile() &&
|
|
56
|
+
((_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) &&
|
|
57
|
+
this.wallet.mobile.inAppBrowser) {
|
|
58
|
+
const inAppBrowserCompiledTemplate = utils.template(this.wallet.mobile.inAppBrowser);
|
|
59
|
+
const deepLink = inAppBrowserCompiledTemplate({
|
|
60
|
+
encodedDappURI: encodeURIComponent(window.location.toString()),
|
|
61
|
+
});
|
|
62
|
+
window.location.assign(deepLink);
|
|
63
|
+
}
|
|
54
64
|
return;
|
|
55
|
-
|
|
65
|
+
}
|
|
66
|
+
return (_b = this.getSolProviderHelper()) === null || _b === void 0 ? void 0 : _b.getAddress();
|
|
56
67
|
});
|
|
57
68
|
}
|
|
58
69
|
signMessage(messageToSign) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
3
|
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
4
|
+
import { isMobile, template } from '@dynamic-labs/utils';
|
|
4
5
|
import { SolProviderHelper } from '../solProviderHelper.js';
|
|
5
6
|
import { SolWalletConnector } from '../solWalletConnector.js';
|
|
6
7
|
import { SignMessageNotSupportedError } from '../errors/SignMessageNotSupportedError.js';
|
|
@@ -45,10 +46,20 @@ class InjectedWalletBase extends SolWalletConnector {
|
|
|
45
46
|
}
|
|
46
47
|
getAddress() {
|
|
47
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
var _a;
|
|
49
|
-
if (!this.isInstalledOnBrowser())
|
|
49
|
+
var _a, _b;
|
|
50
|
+
if (!this.isInstalledOnBrowser()) {
|
|
51
|
+
if (isMobile() &&
|
|
52
|
+
((_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) &&
|
|
53
|
+
this.wallet.mobile.inAppBrowser) {
|
|
54
|
+
const inAppBrowserCompiledTemplate = template(this.wallet.mobile.inAppBrowser);
|
|
55
|
+
const deepLink = inAppBrowserCompiledTemplate({
|
|
56
|
+
encodedDappURI: encodeURIComponent(window.location.toString()),
|
|
57
|
+
});
|
|
58
|
+
window.location.assign(deepLink);
|
|
59
|
+
}
|
|
50
60
|
return;
|
|
51
|
-
|
|
61
|
+
}
|
|
62
|
+
return (_b = this.getSolProviderHelper()) === null || _b === void 0 ? void 0 : _b.getAddress();
|
|
52
63
|
});
|
|
53
64
|
}
|
|
54
65
|
signMessage(messageToSign) {
|
|
@@ -33,11 +33,14 @@ class SolProviderHelper {
|
|
|
33
33
|
if (config.windowLocations) {
|
|
34
34
|
for (const windowLocation of config.windowLocations) {
|
|
35
35
|
const foundProviders = utils.getProvidersFromWindow(windowLocation);
|
|
36
|
-
if (foundProviders && foundProviders.length)
|
|
36
|
+
if (foundProviders && foundProviders.length) {
|
|
37
37
|
providers.push(...foundProviders);
|
|
38
|
+
}
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
// We should only include the `window.solana` provider
|
|
42
|
+
// when extensionLocators are provided
|
|
43
|
+
if (config.extensionLocators.length !== 0 && window.solana) {
|
|
41
44
|
if (!window.solana.providers) {
|
|
42
45
|
providers.push(window.solana);
|
|
43
46
|
}
|
|
@@ -47,13 +50,14 @@ class SolProviderHelper {
|
|
|
47
50
|
}
|
|
48
51
|
return providers;
|
|
49
52
|
}
|
|
50
|
-
installedProviderLookup(
|
|
53
|
+
installedProviderLookup(extensionLocators) {
|
|
51
54
|
const allInstalledProviders = this.installedProviders();
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
if (
|
|
55
|
+
// No need to search through the window.solana providers if the
|
|
56
|
+
// wallet doesn't have extensionLocators
|
|
57
|
+
if (extensionLocators.length === 0) {
|
|
55
58
|
return allInstalledProviders[0];
|
|
56
|
-
|
|
59
|
+
}
|
|
60
|
+
return walletConnectorCore.ProviderLookup(allInstalledProviders, extensionLocators);
|
|
57
61
|
}
|
|
58
62
|
findProvider() {
|
|
59
63
|
return this.getInstalledProvider();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WalletSchema } from '@dynamic-labs/wallet-book';
|
|
2
2
|
import { ProviderCondition, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
-
import { ISolana,
|
|
3
|
+
import { ISolana, ExtensionLocator as ExtensionLocator } from './types';
|
|
4
4
|
export declare class SolProviderHelper {
|
|
5
5
|
private wallet;
|
|
6
6
|
constructor(wallet: WalletSchema);
|
|
@@ -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<ExtensionLocator>>): ISolana | undefined;
|
|
23
23
|
findProvider(): ISolana | undefined;
|
|
24
24
|
isInstalledHelper(): boolean;
|
|
25
25
|
getAddress(): Promise<string | undefined>;
|
package/src/solProviderHelper.js
CHANGED
|
@@ -29,11 +29,14 @@ class SolProviderHelper {
|
|
|
29
29
|
if (config.windowLocations) {
|
|
30
30
|
for (const windowLocation of config.windowLocations) {
|
|
31
31
|
const foundProviders = getProvidersFromWindow(windowLocation);
|
|
32
|
-
if (foundProviders && foundProviders.length)
|
|
32
|
+
if (foundProviders && foundProviders.length) {
|
|
33
33
|
providers.push(...foundProviders);
|
|
34
|
+
}
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
// We should only include the `window.solana` provider
|
|
38
|
+
// when extensionLocators are provided
|
|
39
|
+
if (config.extensionLocators.length !== 0 && window.solana) {
|
|
37
40
|
if (!window.solana.providers) {
|
|
38
41
|
providers.push(window.solana);
|
|
39
42
|
}
|
|
@@ -43,13 +46,14 @@ class SolProviderHelper {
|
|
|
43
46
|
}
|
|
44
47
|
return providers;
|
|
45
48
|
}
|
|
46
|
-
installedProviderLookup(
|
|
49
|
+
installedProviderLookup(extensionLocators) {
|
|
47
50
|
const allInstalledProviders = this.installedProviders();
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
if (
|
|
51
|
+
// No need to search through the window.solana providers if the
|
|
52
|
+
// wallet doesn't have extensionLocators
|
|
53
|
+
if (extensionLocators.length === 0) {
|
|
51
54
|
return allInstalledProviders[0];
|
|
52
|
-
|
|
55
|
+
}
|
|
56
|
+
return ProviderLookup(allInstalledProviders, extensionLocators);
|
|
53
57
|
}
|
|
54
58
|
findProvider() {
|
|
55
59
|
return this.getInstalledProvider();
|
package/src/types.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export type SignedMessage = {
|
|
|
34
34
|
signature: Uint8Array;
|
|
35
35
|
};
|
|
36
36
|
export type ISolanaSigner = {
|
|
37
|
-
[key in
|
|
37
|
+
[key in ExtensionLocator]: boolean;
|
|
38
38
|
} & EventEmitter<ISolanaEvents> & {
|
|
39
39
|
publicKey?: {
|
|
40
40
|
toBytes(): Uint8Array;
|
|
@@ -63,6 +63,6 @@ export type ICoinbaseSolanaSigner = Omit<ISolanaSigner, 'signMessage'> & {
|
|
|
63
63
|
signMessage: (message: Uint8Array, publicKey?: string) => Promise<void | Uint8Array>;
|
|
64
64
|
};
|
|
65
65
|
export type ISolana = ISolanaSigner | IBackpackSolanaSigner | ICoinbaseSolanaSigner;
|
|
66
|
-
export type
|
|
67
|
-
export type EthProviderCondition = ProviderCondition<
|
|
66
|
+
export type ExtensionLocator = 'isBraveWallet' | 'isGlow' | 'isPhantom' | 'isSolflare' | 'isExodus' | 'isBackpack' | 'isMagicEden';
|
|
67
|
+
export type EthProviderCondition = ProviderCondition<ExtensionLocator>;
|
|
68
68
|
export {};
|