@hashgraphonline/hashinal-wc 1.0.91 → 1.0.92-canary-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.
@@ -2419,7 +2419,7 @@ function pfGlobalThisOrFallback() {
2419
2419
  const qt = /* @__PURE__ */ getDefaultExportFromCjs$1(browser$1);
2420
2420
  const c = { level: "info" }, n = "custom_context";
2421
2421
  var x$1 = Object.defineProperty, S$1 = Object.defineProperties, _ = Object.getOwnPropertyDescriptors, p = Object.getOwnPropertySymbols, T = Object.prototype.hasOwnProperty, z$1 = Object.prototype.propertyIsEnumerable, f = (r, e, t) => e in r ? x$1(r, e, { enumerable: true, configurable: true, writable: true, value: t }) : r[e] = t, i = (r, e) => {
2422
- for (var t in e || (e = {})) T.call(e, t) && f(r, t, e[t]);
2422
+ for (var t in e) T.call(e, t) && f(r, t, e[t]);
2423
2423
  if (p) for (var t of p(e)) z$1.call(e, t) && f(r, t, e[t]);
2424
2424
  return r;
2425
2425
  }, g = (r, e) => S$1(r, _(e));
@@ -4880,11 +4880,16 @@ class DAppSigner {
4880
4880
  }
4881
4881
  if (this.extensionId)
4882
4882
  extensionOpen(this.extensionId);
4883
- return this.signClient.request({
4883
+ const currentDate = Date.now();
4884
+ const dAppRequest = {
4884
4885
  topic: this.topic,
4885
4886
  request,
4886
- chainId: ledgerIdToCAIPChainId(this.ledgerId)
4887
- });
4887
+ chainId: ledgerIdToCAIPChainId(this.ledgerId),
4888
+ // hardcode expiry to 5 minutes
4889
+ expiry: currentDate + 300
4890
+ };
4891
+ this.logger.debug("Sending request to wallet", dAppRequest);
4892
+ return this.signClient.request(dAppRequest);
4888
4893
  }
4889
4894
  getAccountId() {
4890
4895
  return this.accountId;
@@ -5177,6 +5182,9 @@ class DAppConnector {
5177
5182
  this.signers = existingSessions.flatMap((session) => this.createSigners(session));
5178
5183
  else
5179
5184
  this.checkIframeConnect();
5185
+ setInterval(() => {
5186
+ this.validateAndRefreshSigners();
5187
+ }, 1e4);
5180
5188
  this.walletConnectClient.on("session_event", this.handleSessionEvent.bind(this));
5181
5189
  this.walletConnectClient.on("session_update", this.handleSessionUpdate.bind(this));
5182
5190
  this.walletConnectClient.on("session_delete", this.handleSessionDelete.bind(this));
@@ -5292,18 +5300,26 @@ class DAppConnector {
5292
5300
  return false;
5293
5301
  }
5294
5302
  const session = this.walletConnectClient.session.get(topic);
5295
- const hasSigner = this.signers.some((signer) => signer.topic === topic);
5303
+ const signer = this.signers.find((signer2) => signer2.topic === topic);
5296
5304
  if (!session) {
5297
- if (hasSigner) {
5305
+ if (Boolean(signer)) {
5298
5306
  this.logger.warn(`Signer exists but no session found for topic: ${topic}`);
5299
5307
  this.handleSessionDelete({ topic });
5300
5308
  }
5301
5309
  return false;
5302
5310
  }
5303
- if (!hasSigner) {
5311
+ if (!Boolean(signer)) {
5304
5312
  this.logger.warn(`Session exists but no signer found for topic: ${topic}`);
5305
5313
  return false;
5306
5314
  }
5315
+ this.logger.info(`Session validated for topic: ${topic} - will extend expiry`);
5316
+ this.walletConnectClient.extend({
5317
+ topic
5318
+ }).then(() => {
5319
+ this.logger.info(`Session extended for topic: ${topic}`);
5320
+ }).catch((e) => {
5321
+ this.logger.error("Error extending session:", e);
5322
+ });
5307
5323
  return true;
5308
5324
  } catch (e) {
5309
5325
  this.logger.error("Error validating session:", e);