@hashgraphonline/hashinal-wc 1.0.92 → 1.0.94
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/README.md +1 -0
- package/dist/es/hashinal-wc.es.js +24 -9
- package/dist/es/hashinal-wc.es.js.map +1 -1
- package/dist/es/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/umd/hashinal-wc.umd.js +8 -8
- package/dist/umd/hashinal-wc.umd.js.map +1 -1
- package/dist/umd/index.d.ts +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -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
|
|
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,15 @@ class DAppSigner {
|
|
|
4880
4880
|
}
|
|
4881
4881
|
if (this.extensionId)
|
|
4882
4882
|
extensionOpen(this.extensionId);
|
|
4883
|
-
|
|
4883
|
+
const dAppRequest = {
|
|
4884
4884
|
topic: this.topic,
|
|
4885
4885
|
request,
|
|
4886
|
-
chainId: ledgerIdToCAIPChainId(this.ledgerId)
|
|
4887
|
-
|
|
4886
|
+
chainId: ledgerIdToCAIPChainId(this.ledgerId),
|
|
4887
|
+
// hardcode expiry to 5 minutes
|
|
4888
|
+
expiry: 300
|
|
4889
|
+
};
|
|
4890
|
+
this.logger.debug("Sending request to wallet", dAppRequest);
|
|
4891
|
+
return this.signClient.request(dAppRequest);
|
|
4888
4892
|
}
|
|
4889
4893
|
getAccountId() {
|
|
4890
4894
|
return this.accountId;
|
|
@@ -5177,6 +5181,9 @@ class DAppConnector {
|
|
|
5177
5181
|
this.signers = existingSessions.flatMap((session) => this.createSigners(session));
|
|
5178
5182
|
else
|
|
5179
5183
|
this.checkIframeConnect();
|
|
5184
|
+
setInterval(() => {
|
|
5185
|
+
this.validateAndRefreshSigners();
|
|
5186
|
+
}, 1e4);
|
|
5180
5187
|
this.walletConnectClient.on("session_event", this.handleSessionEvent.bind(this));
|
|
5181
5188
|
this.walletConnectClient.on("session_update", this.handleSessionUpdate.bind(this));
|
|
5182
5189
|
this.walletConnectClient.on("session_delete", this.handleSessionDelete.bind(this));
|
|
@@ -5292,18 +5299,26 @@ class DAppConnector {
|
|
|
5292
5299
|
return false;
|
|
5293
5300
|
}
|
|
5294
5301
|
const session = this.walletConnectClient.session.get(topic);
|
|
5295
|
-
const
|
|
5302
|
+
const signer = this.signers.find((signer2) => signer2.topic === topic);
|
|
5296
5303
|
if (!session) {
|
|
5297
|
-
if (
|
|
5304
|
+
if (Boolean(signer)) {
|
|
5298
5305
|
this.logger.warn(`Signer exists but no session found for topic: ${topic}`);
|
|
5299
5306
|
this.handleSessionDelete({ topic });
|
|
5300
5307
|
}
|
|
5301
5308
|
return false;
|
|
5302
5309
|
}
|
|
5303
|
-
if (!
|
|
5310
|
+
if (!Boolean(signer)) {
|
|
5304
5311
|
this.logger.warn(`Session exists but no signer found for topic: ${topic}`);
|
|
5305
5312
|
return false;
|
|
5306
5313
|
}
|
|
5314
|
+
this.logger.info(`Session validated for topic: ${topic} - will extend expiry`);
|
|
5315
|
+
this.walletConnectClient.extend({
|
|
5316
|
+
topic
|
|
5317
|
+
}).then(() => {
|
|
5318
|
+
this.logger.info(`Session extended for topic: ${topic}`);
|
|
5319
|
+
}).catch((e) => {
|
|
5320
|
+
this.logger.error("Error extending session:", e);
|
|
5321
|
+
});
|
|
5307
5322
|
return true;
|
|
5308
5323
|
} catch (e) {
|
|
5309
5324
|
this.logger.error("Error validating session:", e);
|
|
@@ -5986,9 +6001,9 @@ class HashinalsWalletConnectSDK {
|
|
|
5986
6001
|
let transaction = await new TokenMintTransaction().setTokenId(tokenId).setMetadata([Buffer$1.from(metadata, "utf-8")]).sign(supplyKey);
|
|
5987
6002
|
return this.executeTransaction(transaction);
|
|
5988
6003
|
}
|
|
5989
|
-
async getMessages(topicId, lastTimestamp, disableTimestampFilter = false) {
|
|
6004
|
+
async getMessages(topicId, lastTimestamp, disableTimestampFilter = false, network) {
|
|
5990
6005
|
var _a, _b;
|
|
5991
|
-
const networkPrefix = this.getNetworkPrefix();
|
|
6006
|
+
const networkPrefix = network || this.getNetworkPrefix();
|
|
5992
6007
|
const baseUrl = `https://${networkPrefix}.mirrornode.hedera.com`;
|
|
5993
6008
|
const timestampQuery = Number(lastTimestamp) > 0 && !disableTimestampFilter ? `×tamp=gt:${lastTimestamp}` : "";
|
|
5994
6009
|
const url = `${baseUrl}/api/v1/topics/${topicId}/messages?limit=200${timestampQuery}`;
|