@dynamic-labs/solana 1.1.0-alpha.1 → 1.1.0-alpha.11
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 +123 -0
- package/package.json +6 -6
- package/src/CoinbaseSolana.cjs +28 -34
- package/src/CoinbaseSolana.d.ts +5 -10
- package/src/CoinbaseSolana.js +28 -34
- package/src/Solflare.d.ts +4 -9
- package/src/index.cjs +3 -15
- package/src/index.d.ts +2 -5
- package/src/index.js +3 -13
- package/src/injected/BackpackSol.cjs +6 -21
- package/src/injected/BackpackSol.d.ts +3 -5
- package/src/injected/BackpackSol.js +6 -21
- package/src/injected/InjectedWalletBase.cjs +20 -16
- package/src/injected/InjectedWalletBase.d.ts +7 -2
- package/src/injected/InjectedWalletBase.js +20 -16
- package/src/injected/Phantom.cjs +23 -2
- package/src/injected/Phantom.d.ts +3 -0
- package/src/injected/Phantom.js +23 -2
- package/src/injected/PhantomLedger.cjs +4 -2
- package/src/injected/PhantomLedger.d.ts +2 -0
- package/src/injected/PhantomLedger.js +4 -2
- package/src/injected/fetchInjectedWalletConnectors.cjs +50 -0
- package/src/injected/fetchInjectedWalletConnectors.d.ts +6 -0
- package/src/injected/fetchInjectedWalletConnectors.js +45 -0
- package/src/injected/index.d.ts +1 -2
- package/src/solProviderHelper.cjs +99 -114
- package/src/solProviderHelper.d.ts +28 -29
- package/src/solProviderHelper.js +100 -115
- package/src/types.d.ts +5 -2
- package/src/Glow.cjs +0 -50
- package/src/Glow.d.ts +0 -12
- package/src/Glow.js +0 -46
- package/src/Solflare.cjs +0 -83
- package/src/Solflare.js +0 -79
- package/src/injected/BraveSol.cjs +0 -21
- package/src/injected/BraveSol.d.ts +0 -5
- package/src/injected/BraveSol.js +0 -17
- package/src/injected/ExodusSol.cjs +0 -14
- package/src/injected/ExodusSol.d.ts +0 -4
- package/src/injected/ExodusSol.js +0 -10
- package/src/injected/MagicEdenSol.cjs +0 -14
- package/src/injected/MagicEdenSol.d.ts +0 -4
- package/src/injected/MagicEdenSol.js +0 -10
- package/src/injected/index.cjs +0 -21
- package/src/injected/index.js +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,127 @@
|
|
|
1
1
|
|
|
2
|
+
## [1.1.0-alpha.11](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.10...v1.1.0-alpha.11) (2024-01-17)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add Leather wallet and BtcKit connector ([#4335](https://github.com/dynamic-labs/DynamicAuth/issues/4335)) ([fe3316b](https://github.com/dynamic-labs/DynamicAuth/commit/fe3316b5be9ef17eea885e99cf925ccd0f271da7))
|
|
8
|
+
* add solana injected wallet configuration to walletbook ([#4375](https://github.com/dynamic-labs/DynamicAuth/issues/4375)) ([3677ce5](https://github.com/dynamic-labs/DynamicAuth/commit/3677ce5ff40d0c00bfaf0daa0d5d67bc40706ee0))
|
|
9
|
+
* add support for unisat wallet ([#4355](https://github.com/dynamic-labs/DynamicAuth/issues/4355)) ([5b7d6b0](https://github.com/dynamic-labs/DynamicAuth/commit/5b7d6b0a9ea84811a8252b3cdf30a3a8e410180c))
|
|
10
|
+
* add walletbook configurations for solana injected wallets ([#4360](https://github.com/dynamic-labs/DynamicAuth/issues/4360)) ([cdc8e5f](https://github.com/dynamic-labs/DynamicAuth/commit/cdc8e5f4878cb84e26e5b33299aa8547b84b6667))
|
|
11
|
+
* passkey renaming frontend ([#4331](https://github.com/dynamic-labs/DynamicAuth/issues/4331)) ([4551013](https://github.com/dynamic-labs/DynamicAuth/commit/4551013d577c914cb3aedfe458ab9eaa018aceb4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* correctly update wallets connected flag after wallet switch ([#4397](https://github.com/dynamic-labs/DynamicAuth/issues/4397)) ([543a830](https://github.com/dynamic-labs/DynamicAuth/commit/543a830574f0d5a78fedbb9b18233e8dfbaddd86))
|
|
17
|
+
* export modal header ([#4401](https://github.com/dynamic-labs/DynamicAuth/issues/4401)) ([77cf016](https://github.com/dynamic-labs/DynamicAuth/commit/77cf016fc742458988864647870149a56e991ee4))
|
|
18
|
+
* trigger onAuthSuccess before embedded wallet creation ([4aa341a](https://github.com/dynamic-labs/DynamicAuth/commit/4aa341a1d08332a121daddb7c2dcb09a804a4de7))
|
|
19
|
+
* ui issues on react 17 ([#4373](https://github.com/dynamic-labs/DynamicAuth/issues/4373)) ([93096d6](https://github.com/dynamic-labs/DynamicAuth/commit/93096d6017816a4f0ed299bf618b130d90c81514))
|
|
20
|
+
|
|
21
|
+
## [1.1.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.9...v1.1.0-alpha.10) (2024-01-06)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* pass flow network to magic client ([#4322](https://github.com/dynamic-labs/DynamicAuth/issues/4322)) ([f3adccf](https://github.com/dynamic-labs/DynamicAuth/commit/f3adccf9f8d835f6b04e4767acd0fbd2ac238379))
|
|
27
|
+
* prevent error message when mobile wallet app is open ([#4301](https://github.com/dynamic-labs/DynamicAuth/issues/4301)) ([2a66dcf](https://github.com/dynamic-labs/DynamicAuth/commit/2a66dcfaf8100b3d910c559d35d8b731b1cb380e))
|
|
28
|
+
* turnkeyWalletConnector is not an email otp connector and uses dynamic otp ([#4313](https://github.com/dynamic-labs/DynamicAuth/issues/4313)) ([e4ea56f](https://github.com/dynamic-labs/DynamicAuth/commit/e4ea56f40fdf97b3f5440b016ebd95501089cebe))
|
|
29
|
+
|
|
30
|
+
## [1.1.0-alpha.9](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.8...v1.1.0-alpha.9) (2024-01-04)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* add solana magic support ([#4258](https://github.com/dynamic-labs/DynamicAuth/issues/4258)) ([da726aa](https://github.com/dynamic-labs/DynamicAuth/commit/da726aa78466c52ee3e1f18952e4351cde754cbc))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* edge case with unlinking wallet ([#4285](https://github.com/dynamic-labs/DynamicAuth/issues/4285)) ([1057fe4](https://github.com/dynamic-labs/DynamicAuth/commit/1057fe47599381f5d9dc39ce4cbeca2041c70319))
|
|
41
|
+
* remove normalizeWalletName from DynamicAuth ([5592817](https://github.com/dynamic-labs/DynamicAuth/commit/5592817b62e345319e04cca9a98276ffad87cfc2))
|
|
42
|
+
* **useFetchBalance:** ensure the latest wallet balance is fetched ([#4288](https://github.com/dynamic-labs/DynamicAuth/issues/4288)) ([25dd035](https://github.com/dynamic-labs/DynamicAuth/commit/25dd035cf8893b7cd28f550026134ba0eecda142))
|
|
43
|
+
|
|
44
|
+
## [1.1.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.7...v1.1.0-alpha.8) (2024-01-03)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* add new sdk view section for text ([#4280](https://github.com/dynamic-labs/DynamicAuth/issues/4280)) ([457ae38](https://github.com/dynamic-labs/DynamicAuth/commit/457ae38cd2be8dae078f40b54ffc4704299d4ed9))
|
|
50
|
+
* add new setShowLinkNewWalletModal method ([f46447a](https://github.com/dynamic-labs/DynamicAuth/commit/f46447ab606f4fdbf55e5fef21dd98f8f2650e90))
|
|
51
|
+
* add pk export for hd wallets ([#4266](https://github.com/dynamic-labs/DynamicAuth/issues/4266)) ([44aac69](https://github.com/dynamic-labs/DynamicAuth/commit/44aac69580ed44e66eab971f87cb6061a3fadc90))
|
|
52
|
+
* add starknet support for sopelia ([#4248](https://github.com/dynamic-labs/DynamicAuth/issues/4248)) ([f9a0980](https://github.com/dynamic-labs/DynamicAuth/commit/f9a0980c3cd2d6d95c5dd17b179fbd0931f08b1a))
|
|
53
|
+
* enable hardware wallet for solana wallets ([#4275](https://github.com/dynamic-labs/DynamicAuth/issues/4275)) ([704b380](https://github.com/dynamic-labs/DynamicAuth/commit/704b380186618a5a5793e88f36ccbe84b59a2e4a))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* phantom solana not connecting on mobile ([#4284](https://github.com/dynamic-labs/DynamicAuth/issues/4284)) ([6ad75f1](https://github.com/dynamic-labs/DynamicAuth/commit/6ad75f152896459f5cf658227f998c246b6a572b))
|
|
59
|
+
* use bitcoin payment address for onramp ([#4273](https://github.com/dynamic-labs/DynamicAuth/issues/4273)) ([a2f54e8](https://github.com/dynamic-labs/DynamicAuth/commit/a2f54e812a11a91ee488eca64f14b5eeea1a8874))
|
|
60
|
+
|
|
61
|
+
## [1.1.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.6...v1.1.0-alpha.7) (2023-12-28)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Features
|
|
65
|
+
|
|
66
|
+
* better coinbase deeplinking ux ([#4164](https://github.com/dynamic-labs/DynamicAuth/issues/4164)) ([5252608](https://github.com/dynamic-labs/DynamicAuth/commit/525260851900a33a52f129def338963400344205))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Bug Fixes
|
|
70
|
+
|
|
71
|
+
* don't prompt for connect when selecting bitcoin wallet if already connected ([#4265](https://github.com/dynamic-labs/DynamicAuth/issues/4265)) ([adef402](https://github.com/dynamic-labs/DynamicAuth/commit/adef402ef94270a17fab896a8585a7f2eacd3681))
|
|
72
|
+
|
|
73
|
+
## [1.1.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.5...v1.1.0-alpha.6) (2023-12-27)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Features
|
|
77
|
+
|
|
78
|
+
* add multi-wallet-prompts-widget ([#4166](https://github.com/dynamic-labs/DynamicAuth/issues/4166)) ([151e3d2](https://github.com/dynamic-labs/DynamicAuth/commit/151e3d2e7bebbf18448e4af8eecbf660f713cd3d))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Bug Fixes
|
|
82
|
+
|
|
83
|
+
* coinbase solana signMessage ([#4254](https://github.com/dynamic-labs/DynamicAuth/issues/4254)) ([f0300a9](https://github.com/dynamic-labs/DynamicAuth/commit/f0300a93ed6c9ba9dfab613820d8cedbe72abb87))
|
|
84
|
+
* make useConnectWithEmailOtp work cross views ([#4252](https://github.com/dynamic-labs/DynamicAuth/issues/4252)) ([a097119](https://github.com/dynamic-labs/DynamicAuth/commit/a097119556c38a22f338a783f79d512b99203cf5))
|
|
85
|
+
|
|
86
|
+
## [1.1.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.4...v1.1.0-alpha.5) (2023-12-21)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Features
|
|
90
|
+
|
|
91
|
+
* add support for xverse wallet ([#4245](https://github.com/dynamic-labs/DynamicAuth/issues/4245)) ([7b68546](https://github.com/dynamic-labs/DynamicAuth/commit/7b6854684412007bcb33896555900936395176df))
|
|
92
|
+
* **gvty-526:** add embedded reveal ([#4233](https://github.com/dynamic-labs/DynamicAuth/issues/4233)) ([c2d0f90](https://github.com/dynamic-labs/DynamicAuth/commit/c2d0f903f4a4646f86c71834540fd49d51a4a7ae))
|
|
93
|
+
|
|
94
|
+
## [1.1.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.3...v1.1.0-alpha.4) (2023-12-21)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Features
|
|
98
|
+
|
|
99
|
+
* add bitcoin integration ([#4216](https://github.com/dynamic-labs/DynamicAuth/issues/4216)) ([9584f1c](https://github.com/dynamic-labs/DynamicAuth/commit/9584f1cc3133835049ad1c53da980192263b8f21))
|
|
100
|
+
* add default footer to wallet list when tos and pp not enabled ([#4224](https://github.com/dynamic-labs/DynamicAuth/issues/4224)) ([0ad81c4](https://github.com/dynamic-labs/DynamicAuth/commit/0ad81c409bcb4aafb0dc565685525d620a95efce))
|
|
101
|
+
* adds useConnectWithEmailOtp ([#4234](https://github.com/dynamic-labs/DynamicAuth/issues/4234)) ([4a4e50a](https://github.com/dynamic-labs/DynamicAuth/commit/4a4e50ac8651c2a249d5125ae6bcf49aaf49be8c))
|
|
102
|
+
|
|
103
|
+
## [1.1.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.2...v1.1.0-alpha.3) (2023-12-19)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Features
|
|
107
|
+
|
|
108
|
+
* add Flow support in magic wallet connector ([#4158](https://github.com/dynamic-labs/DynamicAuth/issues/4158)) ([fbbaea7](https://github.com/dynamic-labs/DynamicAuth/commit/fbbaea76b36ceb693f6bd4f2404dfa1204e61492))
|
|
109
|
+
* add showDynamicUserProfile to DynamicContext ([#4214](https://github.com/dynamic-labs/DynamicAuth/issues/4214)) ([2aeb8e3](https://github.com/dynamic-labs/DynamicAuth/commit/2aeb8e3c45a3d9f87bd9196ea9b46927e02eb633))
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### Bug Fixes
|
|
113
|
+
|
|
114
|
+
* add shortname to braveevm to allow for lookups by name as well as key ([#4213](https://github.com/dynamic-labs/DynamicAuth/issues/4213)) ([969b089](https://github.com/dynamic-labs/DynamicAuth/commit/969b089be516fb57fcdc941f908c078998eb4ec0))
|
|
115
|
+
* solflare connect ([#4215](https://github.com/dynamic-labs/DynamicAuth/issues/4215)) ([9a4164e](https://github.com/dynamic-labs/DynamicAuth/commit/9a4164e53198f33ef7201cd4e1eff745a09e9701))
|
|
116
|
+
* wagmi attempt to connect to primary wallet first ([#4206](https://github.com/dynamic-labs/DynamicAuth/issues/4206)) ([9e5fc8e](https://github.com/dynamic-labs/DynamicAuth/commit/9e5fc8ef026628935ac32d3bb0c22bda35057e5d))
|
|
117
|
+
|
|
118
|
+
## [1.1.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.1...v1.1.0-alpha.2) (2023-12-18)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Bug Fixes
|
|
122
|
+
|
|
123
|
+
* increase timeout when fetching wallet network ([#4197](https://github.com/dynamic-labs/DynamicAuth/issues/4197)) ([bd43d45](https://github.com/dynamic-labs/DynamicAuth/commit/bd43d452dccf36f68bd012e5737480599b93c3b5))
|
|
124
|
+
|
|
2
125
|
## [1.1.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.0...v1.1.0-alpha.1) (2023-12-15)
|
|
3
126
|
|
|
4
127
|
## [1.1.0-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.14...v1.1.0-alpha.0) (2023-12-12)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.11",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@solana/web3.js": "1.70.1",
|
|
30
|
-
"@dynamic-labs/rpc-providers": "1.1.0-alpha.
|
|
31
|
-
"@dynamic-labs/types": "1.1.0-alpha.
|
|
32
|
-
"@dynamic-labs/utils": "1.1.0-alpha.
|
|
33
|
-
"@dynamic-labs/wallet-book": "1.1.0-alpha.
|
|
34
|
-
"@dynamic-labs/wallet-connector-core": "1.1.0-alpha.
|
|
30
|
+
"@dynamic-labs/rpc-providers": "1.1.0-alpha.11",
|
|
31
|
+
"@dynamic-labs/types": "1.1.0-alpha.11",
|
|
32
|
+
"@dynamic-labs/utils": "1.1.0-alpha.11",
|
|
33
|
+
"@dynamic-labs/wallet-book": "1.1.0-alpha.11",
|
|
34
|
+
"@dynamic-labs/wallet-connector-core": "1.1.0-alpha.11",
|
|
35
35
|
"eventemitter3": "5.0.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {}
|
package/src/CoinbaseSolana.cjs
CHANGED
|
@@ -3,49 +3,43 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../_virtual/_tslib.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var utils = require('@dynamic-labs/utils');
|
|
7
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
8
|
+
var InjectedWalletBase = require('./injected/InjectedWalletBase.cjs');
|
|
9
|
+
require('@solana/web3.js');
|
|
10
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
11
|
+
require('@dynamic-labs/rpc-providers');
|
|
12
|
+
require('./injected/PhantomLedger.cjs');
|
|
13
|
+
var isSignedMessage = require('./utils/isSignedMessage.cjs');
|
|
8
14
|
|
|
9
|
-
class CoinbaseSolana extends
|
|
10
|
-
constructor() {
|
|
11
|
-
super(
|
|
15
|
+
class CoinbaseSolana extends InjectedWalletBase.InjectedWalletBase {
|
|
16
|
+
constructor(opts) {
|
|
17
|
+
super(opts);
|
|
12
18
|
this.name = 'CoinbaseSolana';
|
|
13
|
-
|
|
14
|
-
setupEventListeners() {
|
|
15
|
-
solProviderHelper.SolProviderHelper._setupEventListeners(this, solProviderHelper.SolProviderHelper.findProvider(this.name));
|
|
16
|
-
}
|
|
17
|
-
teardownEventListeners() {
|
|
18
|
-
solProviderHelper.SolProviderHelper._teardownEventListeners(this.name);
|
|
19
|
-
}
|
|
20
|
-
connect() {
|
|
21
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
yield solProviderHelper.SolProviderHelper.connectWithName(this.name);
|
|
23
|
-
});
|
|
19
|
+
this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
|
|
24
20
|
}
|
|
25
21
|
getSigner() {
|
|
22
|
+
var _a;
|
|
26
23
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
return
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
isInstalledOnBrowser() {
|
|
31
|
-
return solProviderHelper.SolProviderHelper.isInstalledHelper(this.name);
|
|
32
|
-
}
|
|
33
|
-
fetchPublicAddress() {
|
|
34
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
if (this.isInstalledOnBrowser()) {
|
|
36
|
-
return solProviderHelper.SolProviderHelper.fetchPublicAddressWithName(this.name);
|
|
37
|
-
}
|
|
38
|
-
return;
|
|
24
|
+
return (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.connect();
|
|
39
25
|
});
|
|
40
26
|
}
|
|
41
27
|
signMessage(messageToSign) {
|
|
42
28
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
const walletAddress = yield this.fetchPublicAddress();
|
|
30
|
+
if (!walletAddress) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const provider = yield this.getSigner();
|
|
34
|
+
if (!provider) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const encodedMessage = new TextEncoder().encode(messageToSign);
|
|
38
|
+
const signedMessage = yield provider.signMessage(encodedMessage, walletAddress);
|
|
39
|
+
if (!signedMessage) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return utils.bufferToBase64(isSignedMessage.isSignedMessage(signedMessage) ? signedMessage.signature : signedMessage);
|
|
49
43
|
});
|
|
50
44
|
}
|
|
51
45
|
}
|
package/src/CoinbaseSolana.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare class CoinbaseSolana extends
|
|
1
|
+
import { SolWalletConnectorOpts } from './solWalletConnector';
|
|
2
|
+
import { InjectedWalletBase } from './injected/InjectedWalletBase';
|
|
3
|
+
export declare class CoinbaseSolana extends InjectedWalletBase {
|
|
4
4
|
name: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
connect(): Promise<void>;
|
|
8
|
-
getSigner(): Promise<ISolana | undefined>;
|
|
9
|
-
isInstalledOnBrowser(): boolean;
|
|
10
|
-
fetchPublicAddress(): Promise<string | undefined>;
|
|
5
|
+
constructor(opts: SolWalletConnectorOpts);
|
|
6
|
+
getSigner<ICoinbaseSolanaSigner>(): Promise<ICoinbaseSolanaSigner | undefined>;
|
|
11
7
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
12
|
-
getConnectedAccounts(): Promise<string[]>;
|
|
13
8
|
}
|
package/src/CoinbaseSolana.js
CHANGED
|
@@ -1,47 +1,41 @@
|
|
|
1
1
|
import { __awaiter } from '../_virtual/_tslib.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { bufferToBase64 } from '@dynamic-labs/utils';
|
|
3
|
+
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
4
|
+
import { InjectedWalletBase } from './injected/InjectedWalletBase.js';
|
|
5
|
+
import '@solana/web3.js';
|
|
6
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
7
|
+
import '@dynamic-labs/rpc-providers';
|
|
8
|
+
import './injected/PhantomLedger.js';
|
|
9
|
+
import { isSignedMessage } from './utils/isSignedMessage.js';
|
|
4
10
|
|
|
5
|
-
class CoinbaseSolana extends
|
|
6
|
-
constructor() {
|
|
7
|
-
super(
|
|
11
|
+
class CoinbaseSolana extends InjectedWalletBase {
|
|
12
|
+
constructor(opts) {
|
|
13
|
+
super(opts);
|
|
8
14
|
this.name = 'CoinbaseSolana';
|
|
9
|
-
|
|
10
|
-
setupEventListeners() {
|
|
11
|
-
SolProviderHelper._setupEventListeners(this, SolProviderHelper.findProvider(this.name));
|
|
12
|
-
}
|
|
13
|
-
teardownEventListeners() {
|
|
14
|
-
SolProviderHelper._teardownEventListeners(this.name);
|
|
15
|
-
}
|
|
16
|
-
connect() {
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
yield SolProviderHelper.connectWithName(this.name);
|
|
19
|
-
});
|
|
15
|
+
this.wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
20
16
|
}
|
|
21
17
|
getSigner() {
|
|
18
|
+
var _a;
|
|
22
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
return
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
isInstalledOnBrowser() {
|
|
27
|
-
return SolProviderHelper.isInstalledHelper(this.name);
|
|
28
|
-
}
|
|
29
|
-
fetchPublicAddress() {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
if (this.isInstalledOnBrowser()) {
|
|
32
|
-
return SolProviderHelper.fetchPublicAddressWithName(this.name);
|
|
33
|
-
}
|
|
34
|
-
return;
|
|
20
|
+
return (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.connect();
|
|
35
21
|
});
|
|
36
22
|
}
|
|
37
23
|
signMessage(messageToSign) {
|
|
38
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
25
|
+
const walletAddress = yield this.fetchPublicAddress();
|
|
26
|
+
if (!walletAddress) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const provider = yield this.getSigner();
|
|
30
|
+
if (!provider) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const encodedMessage = new TextEncoder().encode(messageToSign);
|
|
34
|
+
const signedMessage = yield provider.signMessage(encodedMessage, walletAddress);
|
|
35
|
+
if (!signedMessage) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
return bufferToBase64(isSignedMessage(signedMessage) ? signedMessage.signature : signedMessage);
|
|
45
39
|
});
|
|
46
40
|
}
|
|
47
41
|
}
|
package/src/Solflare.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare class Solflare extends
|
|
1
|
+
import { InjectedWalletBase } from './injected/InjectedWalletBase';
|
|
2
|
+
import { SolWalletConnectorOpts } from './solWalletConnector';
|
|
3
|
+
export declare class Solflare extends InjectedWalletBase {
|
|
4
4
|
name: string;
|
|
5
|
-
|
|
5
|
+
constructor(opts: SolWalletConnectorOpts);
|
|
6
6
|
fetchPublicAddress(): Promise<string | undefined>;
|
|
7
|
-
connect(): Promise<void>;
|
|
8
|
-
getSigner(): Promise<ISolana | undefined>;
|
|
9
7
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
10
|
-
getConnectedAccounts(): Promise<string[]>;
|
|
11
|
-
setupEventListeners(): void;
|
|
12
|
-
teardownEventListeners(): void;
|
|
13
8
|
}
|
package/src/index.cjs
CHANGED
|
@@ -2,28 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var Glow = require('./Glow.cjs');
|
|
7
|
-
var Slope = require('./Slope.cjs');
|
|
8
|
-
var Solflare = require('./Solflare.cjs');
|
|
9
|
-
var index = require('./injected/index.cjs');
|
|
10
|
-
var solWalletConnector = require('./solWalletConnector.cjs');
|
|
11
|
-
var solProviderHelper = require('./solProviderHelper.cjs');
|
|
5
|
+
var fetchInjectedWalletConnectors = require('./injected/fetchInjectedWalletConnectors.cjs');
|
|
12
6
|
var isSignedMessage = require('./utils/isSignedMessage.cjs');
|
|
13
7
|
var isBackpackSolanaSigner = require('./utils/isBackpackSolanaSigner.cjs');
|
|
14
8
|
|
|
15
9
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
16
10
|
const SolanaWalletConnectors = (props) => [
|
|
17
|
-
...
|
|
18
|
-
|
|
19
|
-
Glow.Glow,
|
|
20
|
-
Slope.Slope,
|
|
21
|
-
Solflare.Solflare,
|
|
11
|
+
...fetchInjectedWalletConnectors.injectedWalletOverrides,
|
|
12
|
+
...fetchInjectedWalletConnectors.fetchInjectedWalletConnectors(props),
|
|
22
13
|
];
|
|
23
14
|
|
|
24
|
-
exports.Solflare = Solflare.Solflare;
|
|
25
|
-
exports.SolWalletConnector = solWalletConnector.SolWalletConnector;
|
|
26
|
-
exports.SolProviderHelper = solProviderHelper.SolProviderHelper;
|
|
27
15
|
exports.isSignedMessage = isSignedMessage.isSignedMessage;
|
|
28
16
|
exports.isBackpackSolanaSigner = isBackpackSolanaSigner.isBackpackSolanaSigner;
|
|
29
17
|
exports.SolanaWalletConnectors = SolanaWalletConnectors;
|
package/src/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './solProviderHelper';
|
|
3
|
-
export * from './Solflare';
|
|
4
|
-
export declare const SolanaWalletConnectors: (props: any) => typeof import("./injected/BraveSol").BraveSol[];
|
|
1
|
+
export declare const SolanaWalletConnectors: (props: any) => import("dist/packages/wallet-connector-core/src").WalletConnectorConstructor[];
|
|
5
2
|
export { isSignedMessage } from './utils/isSignedMessage';
|
|
6
3
|
export { isBackpackSolanaSigner } from './utils/isBackpackSolanaSigner';
|
|
7
|
-
export type { ISolana, IBackpackSolanaSigner, SignedMessage, ISolanaSigner, } from './types';
|
|
4
|
+
export type { ISolana, IBackpackSolanaSigner, ICoinbaseSolanaSigner, SignedMessage, ISolanaSigner, } from './types';
|
package/src/index.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Glow } from './Glow.js';
|
|
3
|
-
import { Slope } from './Slope.js';
|
|
4
|
-
import { Solflare } from './Solflare.js';
|
|
5
|
-
export { Solflare } from './Solflare.js';
|
|
6
|
-
import { injectedWallets } from './injected/index.js';
|
|
7
|
-
export { SolWalletConnector } from './solWalletConnector.js';
|
|
8
|
-
export { SolProviderHelper } from './solProviderHelper.js';
|
|
1
|
+
import { injectedWalletOverrides, fetchInjectedWalletConnectors } from './injected/fetchInjectedWalletConnectors.js';
|
|
9
2
|
export { isSignedMessage } from './utils/isSignedMessage.js';
|
|
10
3
|
export { isBackpackSolanaSigner } from './utils/isBackpackSolanaSigner.js';
|
|
11
4
|
|
|
12
5
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
13
6
|
const SolanaWalletConnectors = (props) => [
|
|
14
|
-
...
|
|
15
|
-
|
|
16
|
-
Glow,
|
|
17
|
-
Slope,
|
|
18
|
-
Solflare,
|
|
7
|
+
...injectedWalletOverrides,
|
|
8
|
+
...fetchInjectedWalletConnectors(props),
|
|
19
9
|
];
|
|
20
10
|
|
|
21
11
|
export { SolanaWalletConnectors };
|
|
@@ -4,29 +4,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
6
|
var utils = require('@dynamic-labs/utils');
|
|
7
|
-
var
|
|
7
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
8
8
|
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
9
9
|
|
|
10
10
|
class BackpackSol extends InjectedWalletBase.InjectedWalletBase {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(
|
|
11
|
+
constructor(opts) {
|
|
12
|
+
super(opts);
|
|
13
13
|
this.name = 'BackpackSol';
|
|
14
|
-
|
|
15
|
-
setupEventListeners() {
|
|
16
|
-
const web3Provider = solProviderHelper.SolProviderHelper.findProvider(this.name);
|
|
17
|
-
if (!web3Provider)
|
|
18
|
-
return;
|
|
19
|
-
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('activeWalletDidChange', (publicKey) => solProviderHelper.SolProviderHelper.handleAccountChange(this, web3Provider, publicKey));
|
|
20
|
-
solProviderHelper.SolProviderHelper._setupEventListeners(this, web3Provider);
|
|
21
|
-
}
|
|
22
|
-
fetchPublicAddress() {
|
|
23
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
return solProviderHelper.SolProviderHelper.fetchPublicAddressWithName(this.name);
|
|
25
|
-
});
|
|
14
|
+
this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
|
|
26
15
|
}
|
|
27
16
|
getSigner() {
|
|
17
|
+
var _a;
|
|
28
18
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
return
|
|
19
|
+
return (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.connect();
|
|
30
20
|
});
|
|
31
21
|
}
|
|
32
22
|
signMessage(messageToSign) {
|
|
@@ -46,11 +36,6 @@ class BackpackSol extends InjectedWalletBase.InjectedWalletBase {
|
|
|
46
36
|
return utils.bufferToBase64(signedMessage);
|
|
47
37
|
});
|
|
48
38
|
}
|
|
49
|
-
getConnectedAccounts() {
|
|
50
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
return solProviderHelper.SolProviderHelper.getConnectedAccountsWithName(this.name);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
39
|
}
|
|
55
40
|
|
|
56
41
|
exports.BackpackSol = BackpackSol;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SolWalletConnectorOpts } from '../solWalletConnector';
|
|
2
2
|
import { InjectedWalletBase } from './InjectedWalletBase';
|
|
3
3
|
export declare class BackpackSol extends InjectedWalletBase {
|
|
4
4
|
name: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
getSigner(): Promise<IBackpackSolanaSigner | undefined>;
|
|
5
|
+
constructor(opts: SolWalletConnectorOpts);
|
|
6
|
+
getSigner<IBackpackSolanaSigner>(): Promise<IBackpackSolanaSigner | undefined>;
|
|
8
7
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
9
|
-
getConnectedAccounts(): Promise<string[]>;
|
|
10
8
|
}
|
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
2
|
import { bufferToBase64 } from '@dynamic-labs/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
4
4
|
import { InjectedWalletBase } from './InjectedWalletBase.js';
|
|
5
5
|
|
|
6
6
|
class BackpackSol extends InjectedWalletBase {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(
|
|
7
|
+
constructor(opts) {
|
|
8
|
+
super(opts);
|
|
9
9
|
this.name = 'BackpackSol';
|
|
10
|
-
|
|
11
|
-
setupEventListeners() {
|
|
12
|
-
const web3Provider = SolProviderHelper.findProvider(this.name);
|
|
13
|
-
if (!web3Provider)
|
|
14
|
-
return;
|
|
15
|
-
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('activeWalletDidChange', (publicKey) => SolProviderHelper.handleAccountChange(this, web3Provider, publicKey));
|
|
16
|
-
SolProviderHelper._setupEventListeners(this, web3Provider);
|
|
17
|
-
}
|
|
18
|
-
fetchPublicAddress() {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
return SolProviderHelper.fetchPublicAddressWithName(this.name);
|
|
21
|
-
});
|
|
10
|
+
this.wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
22
11
|
}
|
|
23
12
|
getSigner() {
|
|
13
|
+
var _a;
|
|
24
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
return
|
|
15
|
+
return (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.connect();
|
|
26
16
|
});
|
|
27
17
|
}
|
|
28
18
|
signMessage(messageToSign) {
|
|
@@ -42,11 +32,6 @@ class BackpackSol extends InjectedWalletBase {
|
|
|
42
32
|
return bufferToBase64(signedMessage);
|
|
43
33
|
});
|
|
44
34
|
}
|
|
45
|
-
getConnectedAccounts() {
|
|
46
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
return SolProviderHelper.getConnectedAccountsWithName(this.name);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
35
|
}
|
|
51
36
|
|
|
52
37
|
export { BackpackSol };
|
|
@@ -3,51 +3,55 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
|
-
var
|
|
6
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
7
|
var solProviderHelper = require('../solProviderHelper.cjs');
|
|
8
|
+
var solWalletConnector = require('../solWalletConnector.cjs');
|
|
8
9
|
|
|
9
10
|
class InjectedWalletBase extends solWalletConnector.SolWalletConnector {
|
|
11
|
+
getSolProviderHelper() {
|
|
12
|
+
if (!this.wallet) {
|
|
13
|
+
this.wallet = walletBook.getWalletBookWallet(this.walletBook, this.key);
|
|
14
|
+
}
|
|
15
|
+
if (!this.solProviderHelper) {
|
|
16
|
+
this.solProviderHelper = new solProviderHelper.SolProviderHelper(this.wallet);
|
|
17
|
+
}
|
|
18
|
+
// adding the forced typing below to avoid having to null check in other methods
|
|
19
|
+
return this.solProviderHelper;
|
|
20
|
+
}
|
|
10
21
|
setupEventListeners() {
|
|
11
|
-
|
|
22
|
+
this.getSolProviderHelper()._setupEventListeners(this);
|
|
12
23
|
}
|
|
13
24
|
teardownEventListeners() {
|
|
14
|
-
|
|
25
|
+
this.getSolProviderHelper()._teardownEventListeners();
|
|
15
26
|
}
|
|
16
27
|
connect() {
|
|
17
28
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
yield
|
|
29
|
+
yield this.getSolProviderHelper().connect();
|
|
19
30
|
});
|
|
20
31
|
}
|
|
21
32
|
getSigner() {
|
|
22
33
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
return
|
|
34
|
+
return this.getSolProviderHelper().connect();
|
|
24
35
|
});
|
|
25
36
|
}
|
|
26
37
|
isInstalledOnBrowser() {
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* When Glow wallet is installed and Phantom isn't, isPhantom will
|
|
30
|
-
* still be true. This added check is to return false in that scenario.
|
|
31
|
-
* It relies on the fact that if both Glow and Phantom are enabled,
|
|
32
|
-
* solana.isGlow will return false.
|
|
33
|
-
*/
|
|
34
|
-
return (solProviderHelper.SolProviderHelper.isInstalledHelper(this.name) && !((_a = window.solana) === null || _a === void 0 ? void 0 : _a.isGlow));
|
|
38
|
+
return this.getSolProviderHelper().isInstalledHelper();
|
|
35
39
|
}
|
|
36
40
|
fetchPublicAddress() {
|
|
37
41
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
38
42
|
if (!this.isInstalledOnBrowser())
|
|
39
43
|
return;
|
|
40
|
-
return
|
|
44
|
+
return this.getSolProviderHelper().fetchPublicAddress();
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
47
|
signMessage(messageToSign) {
|
|
44
48
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
return
|
|
49
|
+
return this.getSolProviderHelper().signMessage(messageToSign);
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
getConnectedAccounts() {
|
|
49
53
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
return
|
|
54
|
+
return this.getSolProviderHelper().getConnectedAccounts();
|
|
51
55
|
});
|
|
52
56
|
}
|
|
53
57
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WalletSchema } from '@dynamic-labs/wallet-book';
|
|
2
2
|
import { ISolana } from '../types';
|
|
3
|
+
import { SolProviderHelper } from '../solProviderHelper';
|
|
4
|
+
import { SolWalletConnector } from '../solWalletConnector';
|
|
3
5
|
export declare abstract class InjectedWalletBase extends SolWalletConnector {
|
|
6
|
+
solProviderHelper: SolProviderHelper | undefined;
|
|
7
|
+
wallet: WalletSchema | undefined;
|
|
8
|
+
getSolProviderHelper(): SolProviderHelper;
|
|
4
9
|
setupEventListeners(): void;
|
|
5
10
|
teardownEventListeners(): void;
|
|
6
11
|
connect(): Promise<void>;
|
|
7
|
-
getSigner(): Promise<
|
|
12
|
+
getSigner<T = ISolana>(): Promise<T | undefined>;
|
|
8
13
|
isInstalledOnBrowser(): boolean;
|
|
9
14
|
fetchPublicAddress(): Promise<string | undefined>;
|
|
10
15
|
signMessage(messageToSign: string): Promise<string | undefined>;
|