@dynamic-labs/solana 4.41.0 → 4.42.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 +20 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/walletConnect/SolanaWalletConnectConnector/SolanaWalletConnectConnector.cjs +64 -55
- package/src/walletConnect/SolanaWalletConnectConnector/SolanaWalletConnectConnector.d.ts +16 -1
- package/src/walletConnect/SolanaWalletConnectConnector/SolanaWalletConnectConnector.js +64 -55
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.42.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.41.1...v4.42.0) (2025-11-04)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add support for send balance in React Native ([#9807](https://github.com/dynamic-labs/dynamic-auth/issues/9807)) ([40cab11](https://github.com/dynamic-labs/dynamic-auth/commit/40cab119f23d0b2efa5d6b161294bc682f1c0031))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* don't override mfa token on non-mfa related state updates ([#9817](https://github.com/dynamic-labs/dynamic-auth/issues/9817)) ([76dfbb9](https://github.com/dynamic-labs/dynamic-auth/commit/76dfbb9f5012709c6c400c1d51b8a20b2b99c3db))
|
|
13
|
+
|
|
14
|
+
### [4.41.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.41.0...v4.41.1) (2025-10-30)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* aptos login with petra keyless accounts ([#9795](https://github.com/dynamic-labs/dynamic-auth/issues/9795)) ([99dc34b](https://github.com/dynamic-labs/dynamic-auth/commit/99dc34b95d1ec23d168c9e092e2d735b1d50a71d))
|
|
20
|
+
* backpack aptos login due to invalid public key ([#9806](https://github.com/dynamic-labs/dynamic-auth/issues/9806)) ([ec8b761](https://github.com/dynamic-labs/dynamic-auth/commit/ec8b76181acff7906fd92c77c2fca42ce52010ae))
|
|
21
|
+
|
|
2
22
|
## [4.41.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.40.2...v4.41.0) (2025-10-29)
|
|
3
23
|
|
|
4
24
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.42.0",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/wallet-connect": "4.
|
|
21
|
+
"@dynamic-labs/wallet-connect": "4.42.0",
|
|
22
22
|
"@solana/web3.js": "1.98.1",
|
|
23
23
|
"@wallet-standard/app": "1.0.1",
|
|
24
24
|
"@wallet-standard/base": "1.0.1",
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"@walletconnect/sign-client": "2.21.5",
|
|
30
30
|
"@walletconnect/utils": "2.21.5",
|
|
31
31
|
"@walletconnect/types": "2.21.5",
|
|
32
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
33
|
-
"@dynamic-labs/embedded-wallet-solana": "4.
|
|
34
|
-
"@dynamic-labs/logger": "4.
|
|
35
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
36
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
37
|
-
"@dynamic-labs/solana-core": "4.
|
|
38
|
-
"@dynamic-labs/types": "4.
|
|
39
|
-
"@dynamic-labs/utils": "4.
|
|
40
|
-
"@dynamic-labs/waas-svm": "4.
|
|
41
|
-
"@dynamic-labs/wallet-book": "4.
|
|
42
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
32
|
+
"@dynamic-labs/assert-package-version": "4.42.0",
|
|
33
|
+
"@dynamic-labs/embedded-wallet-solana": "4.42.0",
|
|
34
|
+
"@dynamic-labs/logger": "4.42.0",
|
|
35
|
+
"@dynamic-labs/rpc-providers": "4.42.0",
|
|
36
|
+
"@dynamic-labs/sdk-api-core": "0.0.818",
|
|
37
|
+
"@dynamic-labs/solana-core": "4.42.0",
|
|
38
|
+
"@dynamic-labs/types": "4.42.0",
|
|
39
|
+
"@dynamic-labs/utils": "4.42.0",
|
|
40
|
+
"@dynamic-labs/waas-svm": "4.42.0",
|
|
41
|
+
"@dynamic-labs/wallet-book": "4.42.0",
|
|
42
|
+
"@dynamic-labs/wallet-connector-core": "4.42.0",
|
|
43
43
|
"eventemitter3": "5.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {}
|
|
@@ -137,6 +137,23 @@ class SolanaWalletConnectConnector extends solanaCore.SolanaWalletConnector {
|
|
|
137
137
|
throw new Error('Connect method not implemented.');
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
+
static globalInit(args) {
|
|
141
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
var _a, _b;
|
|
143
|
+
SolanaWalletConnectConnector.signClientPromise = walletConnect.getSignClientSingleton({
|
|
144
|
+
appIcon: (_a = args.appLogoUrl) !== null && _a !== void 0 ? _a : '',
|
|
145
|
+
appName: (_b = args.appName) !== null && _b !== void 0 ? _b : '',
|
|
146
|
+
projectId: args.projectId,
|
|
147
|
+
});
|
|
148
|
+
SolanaWalletConnectConnector.signClientReference =
|
|
149
|
+
yield SolanaWalletConnectConnector.signClientPromise;
|
|
150
|
+
SolanaWalletConnectConnector.signClientReference.on('session_event', (event) => {
|
|
151
|
+
SolanaWalletConnectConnector.sessionEventListeners.forEach((listener) => {
|
|
152
|
+
listener(event);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
}
|
|
140
157
|
init() {
|
|
141
158
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
142
159
|
if (this.isInitialized) {
|
|
@@ -149,65 +166,58 @@ class SolanaWalletConnectConnector extends solanaCore.SolanaWalletConnector {
|
|
|
149
166
|
this.setupWCEventListeners();
|
|
150
167
|
return;
|
|
151
168
|
}
|
|
152
|
-
|
|
153
|
-
SolanaWalletConnectConnector.signClientPromise = walletConnect.getSignClientSingleton({
|
|
154
|
-
appIcon: appLogoUrl !== null && appLogoUrl !== void 0 ? appLogoUrl : '',
|
|
155
|
-
appName: appName !== null && appName !== void 0 ? appName : '',
|
|
156
|
-
projectId,
|
|
157
|
-
});
|
|
158
|
-
SolanaWalletConnectConnector.signClientReference =
|
|
159
|
-
yield SolanaWalletConnectConnector.signClientPromise;
|
|
169
|
+
yield SolanaWalletConnectConnector.globalInit(this.constructorProps);
|
|
160
170
|
this.setupWCEventListeners();
|
|
161
171
|
});
|
|
162
172
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
chainId =
|
|
179
|
-
(_b = (_a = this.solNetworks
|
|
180
|
-
.find((network) => network.genesisHash === chainHash)) === null || _a === void 0 ? void 0 : _a.networkId.toString()) !== null && _b !== void 0 ? _b : chainParam;
|
|
181
|
-
}
|
|
182
|
-
logger.logger.debug('[SolanaWalletConnect] onChainChange', { chainId });
|
|
183
|
-
if (chainId === this.getNetworkId()) {
|
|
184
|
-
logger.logger.debug(`[SolanaWalletConnect] onChainChange - ignoring chainChanged event with same chain id as current chain id: ${chainId}`);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
// This will already emit an event so no need to call this.emit('chainChange', { chain: chainId });
|
|
188
|
-
this.switchNetwork({ networkChainId: parseInt(String(chainId)) });
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
if (event.name === 'accountsChanged') {
|
|
192
|
-
const accountsParam = event.data;
|
|
193
|
-
const accounts = utils.filterDuplicates(accountsParam.map((account) => {
|
|
194
|
-
// Handle potentially CAIP-10 format
|
|
195
|
-
if (account.startsWith('solana:')) {
|
|
196
|
-
return account.split(':')[2];
|
|
197
|
-
}
|
|
198
|
-
return account;
|
|
199
|
-
}));
|
|
200
|
-
logger.logger.debug('[SolanaWalletConnect] onAccountChanged', { accounts });
|
|
201
|
-
this.emit('accountChange', { accounts });
|
|
202
|
-
return;
|
|
173
|
+
handleSessionEvent({ params: { event }, topic }) {
|
|
174
|
+
var _a, _b;
|
|
175
|
+
// Ignore events for wallets other than the one we are connected to
|
|
176
|
+
if (!this.session || topic !== this.session.topic) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (event.name === 'chainChanged') {
|
|
180
|
+
const chainParam = event.data;
|
|
181
|
+
let chainId = chainParam;
|
|
182
|
+
// Handle potentially CAIP-2 format
|
|
183
|
+
if (typeof chainParam === 'string' && chainParam.startsWith('solana:')) {
|
|
184
|
+
const chainHash = chainParam.split(':')[1];
|
|
185
|
+
chainId =
|
|
186
|
+
(_b = (_a = this.solNetworks
|
|
187
|
+
.find((network) => network.genesisHash === chainHash)) === null || _a === void 0 ? void 0 : _a.networkId.toString()) !== null && _b !== void 0 ? _b : chainParam;
|
|
203
188
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
this.endSession();
|
|
189
|
+
logger.logger.debug('[SolanaWalletConnect] onChainChange', { chainId });
|
|
190
|
+
if (chainId === this.getNetworkId()) {
|
|
191
|
+
logger.logger.debug(`[SolanaWalletConnect] onChainChange - ignoring chainChanged event with same chain id as current chain id: ${chainId}`);
|
|
208
192
|
return;
|
|
209
193
|
}
|
|
210
|
-
|
|
194
|
+
// This will already emit an event so no need to call this.emit('chainChange', { chain: chainId });
|
|
195
|
+
this.switchNetwork({ networkChainId: parseInt(String(chainId)) });
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (event.name === 'accountsChanged') {
|
|
199
|
+
const accountsParam = event.data;
|
|
200
|
+
const accounts = utils.filterDuplicates(accountsParam.map((account) => {
|
|
201
|
+
// Handle potentially CAIP-10 format
|
|
202
|
+
if (account.startsWith('solana:')) {
|
|
203
|
+
return account.split(':')[2];
|
|
204
|
+
}
|
|
205
|
+
return account;
|
|
206
|
+
}));
|
|
207
|
+
logger.logger.debug('[SolanaWalletConnect] onAccountChanged', { accounts });
|
|
208
|
+
this.emit('accountChange', { accounts });
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (event.name === 'disconnected') {
|
|
212
|
+
logger.logger.debug('[SolanaWalletConnect] onDisconnect');
|
|
213
|
+
this.emit('disconnect');
|
|
214
|
+
this.endSession();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
setupWCEventListeners() {
|
|
219
|
+
logger.logger.debug('[SolanaWalletConnect] setupWCEventListeners');
|
|
220
|
+
SolanaWalletConnectConnector.sessionEventListeners.push((event) => this.handleSessionEvent(event));
|
|
211
221
|
}
|
|
212
222
|
endSession() {
|
|
213
223
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -476,8 +486,6 @@ class SolanaWalletConnectConnector extends solanaCore.SolanaWalletConnector {
|
|
|
476
486
|
deepLinks: this.metadata.deepLinks,
|
|
477
487
|
mode: 'regular',
|
|
478
488
|
preference: this.deepLinkPreference,
|
|
479
|
-
// TODO: verify whether we need the uri
|
|
480
|
-
// uri: provider.signer.uri,
|
|
481
489
|
});
|
|
482
490
|
logger.logger.logVerboseTroubleshootingMessage('[SolanaWalletConnect] getDeepLink - deepLink', deepLink);
|
|
483
491
|
if (!deepLink) {
|
|
@@ -523,5 +531,6 @@ class SolanaWalletConnectConnector extends solanaCore.SolanaWalletConnector {
|
|
|
523
531
|
});
|
|
524
532
|
}
|
|
525
533
|
}
|
|
534
|
+
SolanaWalletConnectConnector.sessionEventListeners = [];
|
|
526
535
|
|
|
527
536
|
exports.SolanaWalletConnectConnector = SolanaWalletConnectConnector;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SendOptions, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
2
|
import SignClient from '@walletconnect/sign-client';
|
|
3
|
-
import type { SessionTypes } from '@walletconnect/types';
|
|
3
|
+
import type { SessionTypes, SignClientTypes } from '@walletconnect/types';
|
|
4
4
|
import { ISolanaSigner, SolanaWalletConnector, SolanaWalletConnectorOpts } from '@dynamic-labs/solana-core';
|
|
5
5
|
import { DeepLinkVariant, GetAddressOpts, ISendBalanceWalletConnector, IWalletConnectConnector } from '@dynamic-labs/wallet-connector-core';
|
|
6
6
|
import { IUITransaction } from '@dynamic-labs/types';
|
|
@@ -12,10 +12,18 @@ export type SolanaWalletConnectConnectorOpts = SolanaWalletConnectorOpts & {
|
|
|
12
12
|
appName?: string;
|
|
13
13
|
overrideKey?: string;
|
|
14
14
|
};
|
|
15
|
+
type SessionEventArgs = SignClientTypes.BaseEventArgs<{
|
|
16
|
+
event: {
|
|
17
|
+
name: string;
|
|
18
|
+
data: any;
|
|
19
|
+
};
|
|
20
|
+
chainId: string;
|
|
21
|
+
}>;
|
|
15
22
|
export declare class SolanaWalletConnectConnector extends SolanaWalletConnector implements IWalletConnectConnector, ISendBalanceWalletConnector {
|
|
16
23
|
name: string;
|
|
17
24
|
static signClientReference: SignClient | undefined;
|
|
18
25
|
static signClientPromise: Promise<SignClient> | undefined;
|
|
26
|
+
static sessionEventListeners: ((args: SessionEventArgs) => void)[];
|
|
19
27
|
/**
|
|
20
28
|
* When a WalletConnect connection is initiated, we store the connection URI
|
|
21
29
|
* so we can use it to handle the URI for wallet app connection and still have
|
|
@@ -44,7 +52,13 @@ export declare class SolanaWalletConnectConnector extends SolanaWalletConnector
|
|
|
44
52
|
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
45
53
|
getSigner(): Promise<ISolanaSigner>;
|
|
46
54
|
connect(): Promise<void>;
|
|
55
|
+
static globalInit(args: {
|
|
56
|
+
appLogoUrl: string;
|
|
57
|
+
appName: string;
|
|
58
|
+
projectId: string;
|
|
59
|
+
}): Promise<void>;
|
|
47
60
|
init(): Promise<void>;
|
|
61
|
+
handleSessionEvent({ params: { event }, topic }: SessionEventArgs): void;
|
|
48
62
|
private setupWCEventListeners;
|
|
49
63
|
endSession(): Promise<void>;
|
|
50
64
|
private displayUri;
|
|
@@ -66,3 +80,4 @@ export declare class SolanaWalletConnectConnector extends SolanaWalletConnector
|
|
|
66
80
|
getConnectionUri(): string | undefined;
|
|
67
81
|
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
68
82
|
}
|
|
83
|
+
export {};
|
|
@@ -128,6 +128,23 @@ class SolanaWalletConnectConnector extends SolanaWalletConnector {
|
|
|
128
128
|
throw new Error('Connect method not implemented.');
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
+
static globalInit(args) {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
var _a, _b;
|
|
134
|
+
SolanaWalletConnectConnector.signClientPromise = getSignClientSingleton({
|
|
135
|
+
appIcon: (_a = args.appLogoUrl) !== null && _a !== void 0 ? _a : '',
|
|
136
|
+
appName: (_b = args.appName) !== null && _b !== void 0 ? _b : '',
|
|
137
|
+
projectId: args.projectId,
|
|
138
|
+
});
|
|
139
|
+
SolanaWalletConnectConnector.signClientReference =
|
|
140
|
+
yield SolanaWalletConnectConnector.signClientPromise;
|
|
141
|
+
SolanaWalletConnectConnector.signClientReference.on('session_event', (event) => {
|
|
142
|
+
SolanaWalletConnectConnector.sessionEventListeners.forEach((listener) => {
|
|
143
|
+
listener(event);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
131
148
|
init() {
|
|
132
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
150
|
if (this.isInitialized) {
|
|
@@ -140,65 +157,58 @@ class SolanaWalletConnectConnector extends SolanaWalletConnector {
|
|
|
140
157
|
this.setupWCEventListeners();
|
|
141
158
|
return;
|
|
142
159
|
}
|
|
143
|
-
|
|
144
|
-
SolanaWalletConnectConnector.signClientPromise = getSignClientSingleton({
|
|
145
|
-
appIcon: appLogoUrl !== null && appLogoUrl !== void 0 ? appLogoUrl : '',
|
|
146
|
-
appName: appName !== null && appName !== void 0 ? appName : '',
|
|
147
|
-
projectId,
|
|
148
|
-
});
|
|
149
|
-
SolanaWalletConnectConnector.signClientReference =
|
|
150
|
-
yield SolanaWalletConnectConnector.signClientPromise;
|
|
160
|
+
yield SolanaWalletConnectConnector.globalInit(this.constructorProps);
|
|
151
161
|
this.setupWCEventListeners();
|
|
152
162
|
});
|
|
153
163
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
chainId =
|
|
170
|
-
(_b = (_a = this.solNetworks
|
|
171
|
-
.find((network) => network.genesisHash === chainHash)) === null || _a === void 0 ? void 0 : _a.networkId.toString()) !== null && _b !== void 0 ? _b : chainParam;
|
|
172
|
-
}
|
|
173
|
-
logger.debug('[SolanaWalletConnect] onChainChange', { chainId });
|
|
174
|
-
if (chainId === this.getNetworkId()) {
|
|
175
|
-
logger.debug(`[SolanaWalletConnect] onChainChange - ignoring chainChanged event with same chain id as current chain id: ${chainId}`);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
// This will already emit an event so no need to call this.emit('chainChange', { chain: chainId });
|
|
179
|
-
this.switchNetwork({ networkChainId: parseInt(String(chainId)) });
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
if (event.name === 'accountsChanged') {
|
|
183
|
-
const accountsParam = event.data;
|
|
184
|
-
const accounts = filterDuplicates(accountsParam.map((account) => {
|
|
185
|
-
// Handle potentially CAIP-10 format
|
|
186
|
-
if (account.startsWith('solana:')) {
|
|
187
|
-
return account.split(':')[2];
|
|
188
|
-
}
|
|
189
|
-
return account;
|
|
190
|
-
}));
|
|
191
|
-
logger.debug('[SolanaWalletConnect] onAccountChanged', { accounts });
|
|
192
|
-
this.emit('accountChange', { accounts });
|
|
193
|
-
return;
|
|
164
|
+
handleSessionEvent({ params: { event }, topic }) {
|
|
165
|
+
var _a, _b;
|
|
166
|
+
// Ignore events for wallets other than the one we are connected to
|
|
167
|
+
if (!this.session || topic !== this.session.topic) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (event.name === 'chainChanged') {
|
|
171
|
+
const chainParam = event.data;
|
|
172
|
+
let chainId = chainParam;
|
|
173
|
+
// Handle potentially CAIP-2 format
|
|
174
|
+
if (typeof chainParam === 'string' && chainParam.startsWith('solana:')) {
|
|
175
|
+
const chainHash = chainParam.split(':')[1];
|
|
176
|
+
chainId =
|
|
177
|
+
(_b = (_a = this.solNetworks
|
|
178
|
+
.find((network) => network.genesisHash === chainHash)) === null || _a === void 0 ? void 0 : _a.networkId.toString()) !== null && _b !== void 0 ? _b : chainParam;
|
|
194
179
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this.endSession();
|
|
180
|
+
logger.debug('[SolanaWalletConnect] onChainChange', { chainId });
|
|
181
|
+
if (chainId === this.getNetworkId()) {
|
|
182
|
+
logger.debug(`[SolanaWalletConnect] onChainChange - ignoring chainChanged event with same chain id as current chain id: ${chainId}`);
|
|
199
183
|
return;
|
|
200
184
|
}
|
|
201
|
-
|
|
185
|
+
// This will already emit an event so no need to call this.emit('chainChange', { chain: chainId });
|
|
186
|
+
this.switchNetwork({ networkChainId: parseInt(String(chainId)) });
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (event.name === 'accountsChanged') {
|
|
190
|
+
const accountsParam = event.data;
|
|
191
|
+
const accounts = filterDuplicates(accountsParam.map((account) => {
|
|
192
|
+
// Handle potentially CAIP-10 format
|
|
193
|
+
if (account.startsWith('solana:')) {
|
|
194
|
+
return account.split(':')[2];
|
|
195
|
+
}
|
|
196
|
+
return account;
|
|
197
|
+
}));
|
|
198
|
+
logger.debug('[SolanaWalletConnect] onAccountChanged', { accounts });
|
|
199
|
+
this.emit('accountChange', { accounts });
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (event.name === 'disconnected') {
|
|
203
|
+
logger.debug('[SolanaWalletConnect] onDisconnect');
|
|
204
|
+
this.emit('disconnect');
|
|
205
|
+
this.endSession();
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
setupWCEventListeners() {
|
|
210
|
+
logger.debug('[SolanaWalletConnect] setupWCEventListeners');
|
|
211
|
+
SolanaWalletConnectConnector.sessionEventListeners.push((event) => this.handleSessionEvent(event));
|
|
202
212
|
}
|
|
203
213
|
endSession() {
|
|
204
214
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -467,8 +477,6 @@ class SolanaWalletConnectConnector extends SolanaWalletConnector {
|
|
|
467
477
|
deepLinks: this.metadata.deepLinks,
|
|
468
478
|
mode: 'regular',
|
|
469
479
|
preference: this.deepLinkPreference,
|
|
470
|
-
// TODO: verify whether we need the uri
|
|
471
|
-
// uri: provider.signer.uri,
|
|
472
480
|
});
|
|
473
481
|
logger.logVerboseTroubleshootingMessage('[SolanaWalletConnect] getDeepLink - deepLink', deepLink);
|
|
474
482
|
if (!deepLink) {
|
|
@@ -514,5 +522,6 @@ class SolanaWalletConnectConnector extends SolanaWalletConnector {
|
|
|
514
522
|
});
|
|
515
523
|
}
|
|
516
524
|
}
|
|
525
|
+
SolanaWalletConnectConnector.sessionEventListeners = [];
|
|
517
526
|
|
|
518
527
|
export { SolanaWalletConnectConnector };
|