@hashgraph/hedera-wallet-connect 1.4.3-canary.881a3d5.0 → 1.4.4-canary.b020e62.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.
@@ -3,7 +3,7 @@ import type { CoreTypes, ISignClient } from '@walletconnect/types';
|
|
3
3
|
import { LogLevel } from '../shared/logger';
|
4
4
|
export declare class DAppSigner implements Signer {
|
5
5
|
private readonly accountId;
|
6
|
-
|
6
|
+
readonly signClient: ISignClient;
|
7
7
|
readonly topic: string;
|
8
8
|
private readonly ledgerId;
|
9
9
|
readonly extensionId?: string | undefined;
|
@@ -78,11 +78,15 @@ export class DAppSigner {
|
|
78
78
|
}
|
79
79
|
if (this.extensionId)
|
80
80
|
extensionOpen(this.extensionId);
|
81
|
-
|
81
|
+
const dAppRequest = {
|
82
82
|
topic: this.topic,
|
83
83
|
request,
|
84
84
|
chainId: ledgerIdToCAIPChainId(this.ledgerId),
|
85
|
-
|
85
|
+
// hardcode expiry to 5 minutes
|
86
|
+
expiry: 300,
|
87
|
+
};
|
88
|
+
this.logger.debug('Sending request to wallet', dAppRequest);
|
89
|
+
return this.signClient.request(dAppRequest);
|
86
90
|
}
|
87
91
|
getAccountId() {
|
88
92
|
return this.accountId;
|
package/dist/lib/dapp/index.js
CHANGED
@@ -111,6 +111,10 @@ export class DAppConnector {
|
|
111
111
|
this.signers = existingSessions.flatMap((session) => this.createSigners(session));
|
112
112
|
else
|
113
113
|
this.checkIframeConnect();
|
114
|
+
// Validate and refresh signers every 10 seconds
|
115
|
+
setInterval(() => {
|
116
|
+
this.validateAndRefreshSigners();
|
117
|
+
}, 10000);
|
114
118
|
this.walletConnectClient.on('session_event', this.handleSessionEvent.bind(this));
|
115
119
|
this.walletConnectClient.on('session_update', this.handleSessionUpdate.bind(this));
|
116
120
|
this.walletConnectClient.on('session_delete', this.handleSessionDelete.bind(this));
|
@@ -231,19 +235,30 @@ export class DAppConnector {
|
|
231
235
|
return false;
|
232
236
|
}
|
233
237
|
const session = this.walletConnectClient.session.get(topic);
|
234
|
-
const
|
238
|
+
const signer = this.signers.find((signer) => signer.topic === topic);
|
235
239
|
if (!session) {
|
236
240
|
// If session doesn't exist but we have a signer for it, clean up
|
237
|
-
if (
|
241
|
+
if (Boolean(signer)) {
|
238
242
|
this.logger.warn(`Signer exists but no session found for topic: ${topic}`);
|
239
243
|
this.handleSessionDelete({ topic });
|
240
244
|
}
|
241
245
|
return false;
|
242
246
|
}
|
243
|
-
if (!
|
247
|
+
if (!Boolean(signer)) {
|
244
248
|
this.logger.warn(`Session exists but no signer found for topic: ${topic}`);
|
245
249
|
return false;
|
246
250
|
}
|
251
|
+
this.logger.info(`Session validated for topic: ${topic} - will extend expiry`);
|
252
|
+
this.walletConnectClient
|
253
|
+
.extend({
|
254
|
+
topic: topic,
|
255
|
+
})
|
256
|
+
.then(() => {
|
257
|
+
this.logger.info(`Session extended for topic: ${topic}`);
|
258
|
+
})
|
259
|
+
.catch((e) => {
|
260
|
+
this.logger.error('Error extending session:', e);
|
261
|
+
});
|
247
262
|
return true;
|
248
263
|
}
|
249
264
|
catch (e) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hashgraph/hedera-wallet-connect",
|
3
|
-
"version": "1.4.
|
3
|
+
"version": "1.4.4-canary.b020e62.0",
|
4
4
|
"description": "A library to facilitate integrating Hedera with WalletConnect",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -23,8 +23,8 @@
|
|
23
23
|
"@types/node": "^22.5.0",
|
24
24
|
"@types/react-dom": "^18.2.21",
|
25
25
|
"@walletconnect/modal": "^2.7.0",
|
26
|
-
"@walletconnect/sign-client": "^2.17.
|
27
|
-
"@walletconnect/types": "^2.17.
|
26
|
+
"@walletconnect/sign-client": "^2.17.3",
|
27
|
+
"@walletconnect/types": "^2.17.3",
|
28
28
|
"concurrently": "^9.0.1",
|
29
29
|
"esbuild": "^0.24.0",
|
30
30
|
"esbuild-plugin-copy": "^2.1.1",
|
@@ -36,8 +36,8 @@
|
|
36
36
|
"long": "^5.2.3",
|
37
37
|
"nodemon": "^3.0.3",
|
38
38
|
"prettier": "^3.2.4",
|
39
|
-
"react": "^
|
40
|
-
"react-dom": "^
|
39
|
+
"react": "^19.0.0",
|
40
|
+
"react-dom": "^19.0.0",
|
41
41
|
"rimraf": "^5.0.5",
|
42
42
|
"ts-node": "^10.9.2",
|
43
43
|
"typedoc": "^0.26.3",
|