@dynamic-labs/solana 1.3.1 → 1.4.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 +16 -0
- package/package.json +8 -8
- package/src/CoinbaseSolana.cjs +0 -1
- package/src/CoinbaseSolana.js +0 -1
- package/src/Solflare.cjs +73 -0
- package/src/Solflare.d.ts +1 -0
- package/src/Solflare.js +69 -0
- package/src/index.cjs +1 -2
- package/src/index.js +2 -3
- package/src/injected/fetchInjectedWalletConnectors.cjs +3 -0
- package/src/injected/fetchInjectedWalletConnectors.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
## [1.4.0](https://github.com/dynamic-labs/DynamicAuth/compare/v1.3.1...v1.4.0) (2024-03-21)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add sign-in with farcaster ([#5059](https://github.com/dynamic-labs/DynamicAuth/issues/5059)) ([83245aa](https://github.com/dynamic-labs/DynamicAuth/commit/83245aa9f973ca349abcbaccf5d150b4a31beb0e)), closes [#4947](https://github.com/dynamic-labs/DynamicAuth/issues/4947)
|
|
8
|
+
* add prop to hide embedded wallet transaction UIs ([#4928](https://github.com/dynamic-labs/DynamicAuth/issues/4928)) ([b0ad954](https://github.com/dynamic-labs/DynamicAuth/commit/b0ad95494ebf991e61f09a23999c3526498f2db9)), closes [#4924](https://github.com/dynamic-labs/DynamicAuth/issues/4924)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* multiple wallet improvements
|
|
14
|
+
* multiple ui/ux improvements
|
|
15
|
+
* miscellaneous copy and localization updates
|
|
16
|
+
* add missing css variables for DynamicConnectButton
|
|
17
|
+
|
|
2
18
|
### [1.3.1](https://github.com/dynamic-labs/DynamicAuth/compare/v1.3.0...v1.3.1) (2024-03-08)
|
|
3
19
|
|
|
4
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@solana/web3.js": "1.70.1",
|
|
30
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
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.
|
|
34
|
-
"@dynamic-labs/turnkey": "1.
|
|
35
|
-
"@dynamic-labs/types": "1.
|
|
36
|
-
"@dynamic-labs/utils": "1.
|
|
37
|
-
"@dynamic-labs/wallet-book": "1.
|
|
38
|
-
"@dynamic-labs/wallet-connector-core": "1.
|
|
33
|
+
"@dynamic-labs/rpc-providers": "1.4.0",
|
|
34
|
+
"@dynamic-labs/turnkey": "1.4.0",
|
|
35
|
+
"@dynamic-labs/types": "1.4.0",
|
|
36
|
+
"@dynamic-labs/utils": "1.4.0",
|
|
37
|
+
"@dynamic-labs/wallet-book": "1.4.0",
|
|
38
|
+
"@dynamic-labs/wallet-connector-core": "1.4.0",
|
|
39
39
|
"eventemitter3": "5.0.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {}
|
package/src/CoinbaseSolana.cjs
CHANGED
|
@@ -6,7 +6,6 @@ var _tslib = require('../_virtual/_tslib.cjs');
|
|
|
6
6
|
var utils = require('@dynamic-labs/utils');
|
|
7
7
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
8
8
|
require('@dynamic-labs/turnkey');
|
|
9
|
-
require('@dynamic-labs/sdk-api');
|
|
10
9
|
require('./solWalletConnector.cjs');
|
|
11
10
|
require('tweetnacl');
|
|
12
11
|
require('bs58');
|
package/src/CoinbaseSolana.js
CHANGED
|
@@ -2,7 +2,6 @@ import { __awaiter } from '../_virtual/_tslib.js';
|
|
|
2
2
|
import { bufferToBase64 } from '@dynamic-labs/utils';
|
|
3
3
|
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
4
4
|
import '@dynamic-labs/turnkey';
|
|
5
|
-
import '@dynamic-labs/sdk-api';
|
|
6
5
|
import './solWalletConnector.js';
|
|
7
6
|
import 'tweetnacl';
|
|
8
7
|
import 'bs58';
|
package/src/Solflare.cjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../_virtual/_tslib.cjs');
|
|
6
|
+
var utils = require('@dynamic-labs/utils');
|
|
7
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
8
|
+
var InjectedWalletBase = require('./injected/InjectedWalletBase.cjs');
|
|
9
|
+
|
|
10
|
+
class Solflare extends InjectedWalletBase.InjectedWalletBase {
|
|
11
|
+
constructor(opts) {
|
|
12
|
+
super(opts);
|
|
13
|
+
this.name = 'Solflare';
|
|
14
|
+
this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
|
|
15
|
+
}
|
|
16
|
+
fetchPublicAddress() {
|
|
17
|
+
var _a, _b, _c, _d, _e;
|
|
18
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
/**
|
|
20
|
+
* It should redirect to in-app browser if on mobile and if not in the in-app browser,
|
|
21
|
+
* this checks if it is not in the in-app browser by checking if the provider is not available.
|
|
22
|
+
*/
|
|
23
|
+
if (utils.isMobile() && !this.isInstalledOnBrowser()) {
|
|
24
|
+
utils.handleMobileWalletRedirect({
|
|
25
|
+
nativeLink: ((_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) === null || _b === void 0 ? void 0 : _b.native) || 'solflare://ul/v1/browse',
|
|
26
|
+
universalLink: ((_d = (_c = this.wallet) === null || _c === void 0 ? void 0 : _c.mobile) === null || _d === void 0 ? void 0 : _d.universal) || 'https://solflare.com/ul/v1/browse',
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
return (_e = this.getSolProviderHelper()) === null || _e === void 0 ? void 0 : _e.fetchPublicAddress();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
signMessage(messageToSign) {
|
|
34
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const walletAddress = yield this.fetchPublicAddress();
|
|
36
|
+
if (!walletAddress) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
const provider = yield this.getSigner();
|
|
40
|
+
if (!provider) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
const encodedMessage = new TextEncoder().encode(messageToSign);
|
|
44
|
+
const isSignedMessage = (value) => value.signature !== undefined;
|
|
45
|
+
yield provider.connect();
|
|
46
|
+
/**
|
|
47
|
+
* TODO: Remove the sleep once problem is fixed on Solflare's extension.
|
|
48
|
+
* Tracked in DYN-442
|
|
49
|
+
*/
|
|
50
|
+
yield new Promise((resolve) => {
|
|
51
|
+
setTimeout(resolve, 100);
|
|
52
|
+
});
|
|
53
|
+
const rawMessage = yield provider.signMessage(encodedMessage, 'utf8');
|
|
54
|
+
return isSignedMessage(rawMessage)
|
|
55
|
+
? utils.bufferToBase64(rawMessage.signature)
|
|
56
|
+
: undefined;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
getConnectedAccounts() {
|
|
60
|
+
var _a;
|
|
61
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const provider = yield this.getSigner();
|
|
63
|
+
if (!provider)
|
|
64
|
+
return [];
|
|
65
|
+
const publicKey = (_a = provider.publicKey) === null || _a === void 0 ? void 0 : _a.toString();
|
|
66
|
+
if (publicKey)
|
|
67
|
+
return [publicKey];
|
|
68
|
+
return [];
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
exports.Solflare = Solflare;
|
package/src/Solflare.d.ts
CHANGED
package/src/Solflare.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { __awaiter } from '../_virtual/_tslib.js';
|
|
2
|
+
import { isMobile, handleMobileWalletRedirect, bufferToBase64 } from '@dynamic-labs/utils';
|
|
3
|
+
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
4
|
+
import { InjectedWalletBase } from './injected/InjectedWalletBase.js';
|
|
5
|
+
|
|
6
|
+
class Solflare extends InjectedWalletBase {
|
|
7
|
+
constructor(opts) {
|
|
8
|
+
super(opts);
|
|
9
|
+
this.name = 'Solflare';
|
|
10
|
+
this.wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
11
|
+
}
|
|
12
|
+
fetchPublicAddress() {
|
|
13
|
+
var _a, _b, _c, _d, _e;
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
/**
|
|
16
|
+
* It should redirect to in-app browser if on mobile and if not in the in-app browser,
|
|
17
|
+
* this checks if it is not in the in-app browser by checking if the provider is not available.
|
|
18
|
+
*/
|
|
19
|
+
if (isMobile() && !this.isInstalledOnBrowser()) {
|
|
20
|
+
handleMobileWalletRedirect({
|
|
21
|
+
nativeLink: ((_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) === null || _b === void 0 ? void 0 : _b.native) || 'solflare://ul/v1/browse',
|
|
22
|
+
universalLink: ((_d = (_c = this.wallet) === null || _c === void 0 ? void 0 : _c.mobile) === null || _d === void 0 ? void 0 : _d.universal) || 'https://solflare.com/ul/v1/browse',
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
return (_e = this.getSolProviderHelper()) === null || _e === void 0 ? void 0 : _e.fetchPublicAddress();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
signMessage(messageToSign) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const walletAddress = yield this.fetchPublicAddress();
|
|
32
|
+
if (!walletAddress) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const provider = yield this.getSigner();
|
|
36
|
+
if (!provider) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
const encodedMessage = new TextEncoder().encode(messageToSign);
|
|
40
|
+
const isSignedMessage = (value) => value.signature !== undefined;
|
|
41
|
+
yield provider.connect();
|
|
42
|
+
/**
|
|
43
|
+
* TODO: Remove the sleep once problem is fixed on Solflare's extension.
|
|
44
|
+
* Tracked in DYN-442
|
|
45
|
+
*/
|
|
46
|
+
yield new Promise((resolve) => {
|
|
47
|
+
setTimeout(resolve, 100);
|
|
48
|
+
});
|
|
49
|
+
const rawMessage = yield provider.signMessage(encodedMessage, 'utf8');
|
|
50
|
+
return isSignedMessage(rawMessage)
|
|
51
|
+
? bufferToBase64(rawMessage.signature)
|
|
52
|
+
: undefined;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
getConnectedAccounts() {
|
|
56
|
+
var _a;
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const provider = yield this.getSigner();
|
|
59
|
+
if (!provider)
|
|
60
|
+
return [];
|
|
61
|
+
const publicKey = (_a = provider.publicKey) === null || _a === void 0 ? void 0 : _a.toString();
|
|
62
|
+
if (publicKey)
|
|
63
|
+
return [publicKey];
|
|
64
|
+
return [];
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { Solflare };
|
package/src/index.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var turnkey = require('@dynamic-labs/turnkey');
|
|
6
|
-
var sdkApi = require('@dynamic-labs/sdk-api');
|
|
7
6
|
var Phantom = require('./Phantom.cjs');
|
|
8
7
|
var fetchInjectedWalletConnectors = require('./injected/fetchInjectedWalletConnectors.cjs');
|
|
9
8
|
var isSignedMessage = require('./utils/isSignedMessage.cjs');
|
|
@@ -13,7 +12,7 @@ var isBackpackSolanaSigner = require('./utils/isBackpackSolanaSigner.cjs');
|
|
|
13
12
|
const SolanaWalletConnectors = (props) => [
|
|
14
13
|
...fetchInjectedWalletConnectors.injectedWalletOverrides,
|
|
15
14
|
...fetchInjectedWalletConnectors.fetchInjectedWalletConnectors(props),
|
|
16
|
-
...turnkey.
|
|
15
|
+
...turnkey.TurnkeySolanaWalletConnectors(props),
|
|
17
16
|
Phantom.Phantom,
|
|
18
17
|
];
|
|
19
18
|
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ChainEnum } from '@dynamic-labs/sdk-api';
|
|
1
|
+
import { TurnkeySolanaWalletConnectors } from '@dynamic-labs/turnkey';
|
|
3
2
|
import { Phantom } from './Phantom.js';
|
|
4
3
|
import { injectedWalletOverrides, fetchInjectedWalletConnectors } from './injected/fetchInjectedWalletConnectors.js';
|
|
5
4
|
export { isSignedMessage } from './utils/isSignedMessage.js';
|
|
@@ -9,7 +8,7 @@ export { isBackpackSolanaSigner } from './utils/isBackpackSolanaSigner.js';
|
|
|
9
8
|
const SolanaWalletConnectors = (props) => [
|
|
10
9
|
...injectedWalletOverrides,
|
|
11
10
|
...fetchInjectedWalletConnectors(props),
|
|
12
|
-
...
|
|
11
|
+
...TurnkeySolanaWalletConnectors(props),
|
|
13
12
|
Phantom,
|
|
14
13
|
];
|
|
15
14
|
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var CoinbaseSolana = require('../CoinbaseSolana.cjs');
|
|
6
6
|
var Slope = require('../Slope.cjs');
|
|
7
|
+
var Solflare = require('../Solflare.cjs');
|
|
7
8
|
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
8
9
|
var BackpackSol = require('./BackpackSol.cjs');
|
|
9
10
|
|
|
@@ -11,6 +12,7 @@ const injectedWalletOverrides = [
|
|
|
11
12
|
CoinbaseSolana.CoinbaseSolana,
|
|
12
13
|
Slope.Slope,
|
|
13
14
|
BackpackSol.BackpackSol,
|
|
15
|
+
Solflare.Solflare,
|
|
14
16
|
];
|
|
15
17
|
const filteredInjectedWalletKeysOverrides = [
|
|
16
18
|
'coinbasesolana',
|
|
@@ -18,6 +20,7 @@ const filteredInjectedWalletKeysOverrides = [
|
|
|
18
20
|
'phantom',
|
|
19
21
|
'phantomledger',
|
|
20
22
|
'backpacksol',
|
|
23
|
+
'solflare',
|
|
21
24
|
];
|
|
22
25
|
const fetchInjectedWalletConnectors = ({ walletBook, }) => {
|
|
23
26
|
var _a;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CoinbaseSolana } from '../CoinbaseSolana.js';
|
|
2
2
|
import { Slope } from '../Slope.js';
|
|
3
|
+
import { Solflare } from '../Solflare.js';
|
|
3
4
|
import { InjectedWalletBase } from './InjectedWalletBase.js';
|
|
4
5
|
import { BackpackSol } from './BackpackSol.js';
|
|
5
6
|
|
|
@@ -7,6 +8,7 @@ const injectedWalletOverrides = [
|
|
|
7
8
|
CoinbaseSolana,
|
|
8
9
|
Slope,
|
|
9
10
|
BackpackSol,
|
|
11
|
+
Solflare,
|
|
10
12
|
];
|
|
11
13
|
const filteredInjectedWalletKeysOverrides = [
|
|
12
14
|
'coinbasesolana',
|
|
@@ -14,6 +16,7 @@ const filteredInjectedWalletKeysOverrides = [
|
|
|
14
16
|
'phantom',
|
|
15
17
|
'phantomledger',
|
|
16
18
|
'backpacksol',
|
|
19
|
+
'solflare',
|
|
17
20
|
];
|
|
18
21
|
const fetchInjectedWalletConnectors = ({ walletBook, }) => {
|
|
19
22
|
var _a;
|