@dynamic-labs/solana 1.2.1 → 1.3.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 +10 -1
- package/package.json +7 -7
- package/src/phantomRedirect/PhantomRedirect.cjs +19 -7
- package/src/phantomRedirect/PhantomRedirect.js +20 -8
- package/src/phantomRedirect/storage.cjs +6 -0
- package/src/phantomRedirect/storage.d.ts +1 -0
- package/src/phantomRedirect/storage.js +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
### [1.
|
|
2
|
+
### [1.3.1](https://github.com/dynamic-labs/DynamicAuth/compare/v1.3.0...v1.3.1) (2024-03-08)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* pass account and chain to walletClient ([#4865](https://github.com/dynamic-labs/DynamicAuth/issues/4865)) ([#4905](https://github.com/dynamic-labs/DynamicAuth/issues/4905)) ([0f4e79f](https://github.com/dynamic-labs/DynamicAuth/commit/0f4e79ff36f8a3ef63c59bb9f80429cdefbe7307))
|
|
8
|
+
* update btckit network conversion for signpsbt to use correct network ([#4882](https://github.com/dynamic-labs/DynamicAuth/issues/4882)) ([3c14f55](https://github.com/dynamic-labs/DynamicAuth/commit/3c14f55f6e37718a095752d0e04bfbac45fee75c))
|
|
9
|
+
* better auth state handling when logged in with disabled wallets ([#4862](https://github.com/dynamic-labs/DynamicAuth/issues/4862)) ([8cc2a1c](https://github.com/dynamic-labs/DynamicAuth/commit/8cc2a1c4f31cf6acb61d814a3410c5e77da21c50))
|
|
10
|
+
|
|
11
|
+
## [1.3.0](https://github.com/dynamic-labs/DynamicAuth/compare/v1.2.0...v1.3.0) (2024-03-05)
|
|
3
12
|
|
|
4
13
|
|
|
5
14
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"@dynamic-labs/sdk-api": "0.0.363",
|
|
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.3.1",
|
|
34
|
+
"@dynamic-labs/turnkey": "1.3.1",
|
|
35
|
+
"@dynamic-labs/types": "1.3.1",
|
|
36
|
+
"@dynamic-labs/utils": "1.3.1",
|
|
37
|
+
"@dynamic-labs/wallet-book": "1.3.1",
|
|
38
|
+
"@dynamic-labs/wallet-connector-core": "1.3.1",
|
|
39
39
|
"eventemitter3": "5.0.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {}
|
|
@@ -116,13 +116,25 @@ class PhantomRedirect extends solWalletConnector.SolWalletConnector {
|
|
|
116
116
|
}
|
|
117
117
|
endSession() {
|
|
118
118
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
|
|
120
|
-
storage.storage.
|
|
121
|
-
storage.storage.
|
|
122
|
-
storage.storage.
|
|
123
|
-
storage
|
|
124
|
-
storage.
|
|
125
|
-
|
|
119
|
+
const address = storage.storage.address.get();
|
|
120
|
+
const session = storage.storage.session.get();
|
|
121
|
+
const sharedSecret = storage.storage.sharedSecret.get();
|
|
122
|
+
const encryptionPublicKey = storage.storage.encryptionPublicKey.get();
|
|
123
|
+
// Clear all local storage in case of any stale state
|
|
124
|
+
storage.clearStorage();
|
|
125
|
+
// if there is no session/encrytion keys, then we don't need to disconnect
|
|
126
|
+
if (!address || !session || !encryptionPublicKey || !sharedSecret)
|
|
127
|
+
return;
|
|
128
|
+
const payload = { session };
|
|
129
|
+
const [nonce, encryptedPayload] = utils.encryptPayload(payload, sharedSecret);
|
|
130
|
+
const params = new URLSearchParams({
|
|
131
|
+
dapp_encryption_public_key: bs58__default["default"].encode(encryptionPublicKey),
|
|
132
|
+
nonce: bs58__default["default"].encode(nonce),
|
|
133
|
+
payload: bs58__default["default"].encode(encryptedPayload),
|
|
134
|
+
redirect_link: window.location.href,
|
|
135
|
+
});
|
|
136
|
+
const url = utils.buildUrl('disconnect', params);
|
|
137
|
+
window.location.href = url;
|
|
126
138
|
});
|
|
127
139
|
}
|
|
128
140
|
/**
|
|
@@ -4,7 +4,7 @@ import bs58 from 'bs58';
|
|
|
4
4
|
import { PublicKey } from '@solana/web3.js';
|
|
5
5
|
import { SolWalletConnector } from '../solWalletConnector.js';
|
|
6
6
|
import { buildUrl, decryptPayload, encryptPayload } from './utils.js';
|
|
7
|
-
import { storage } from './storage.js';
|
|
7
|
+
import { storage, clearStorage } from './storage.js';
|
|
8
8
|
|
|
9
9
|
class PhantomRedirect extends SolWalletConnector {
|
|
10
10
|
constructor(props) {
|
|
@@ -107,13 +107,25 @@ class PhantomRedirect extends SolWalletConnector {
|
|
|
107
107
|
}
|
|
108
108
|
endSession() {
|
|
109
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
|
|
111
|
-
storage.
|
|
112
|
-
storage.
|
|
113
|
-
storage.
|
|
114
|
-
storage
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
const address = storage.address.get();
|
|
111
|
+
const session = storage.session.get();
|
|
112
|
+
const sharedSecret = storage.sharedSecret.get();
|
|
113
|
+
const encryptionPublicKey = storage.encryptionPublicKey.get();
|
|
114
|
+
// Clear all local storage in case of any stale state
|
|
115
|
+
clearStorage();
|
|
116
|
+
// if there is no session/encrytion keys, then we don't need to disconnect
|
|
117
|
+
if (!address || !session || !encryptionPublicKey || !sharedSecret)
|
|
118
|
+
return;
|
|
119
|
+
const payload = { session };
|
|
120
|
+
const [nonce, encryptedPayload] = encryptPayload(payload, sharedSecret);
|
|
121
|
+
const params = new URLSearchParams({
|
|
122
|
+
dapp_encryption_public_key: bs58.encode(encryptionPublicKey),
|
|
123
|
+
nonce: bs58.encode(nonce),
|
|
124
|
+
payload: bs58.encode(encryptedPayload),
|
|
125
|
+
redirect_link: window.location.href,
|
|
126
|
+
});
|
|
127
|
+
const url = buildUrl('disconnect', params);
|
|
128
|
+
window.location.href = url;
|
|
117
129
|
});
|
|
118
130
|
}
|
|
119
131
|
/**
|