@unicitylabs/sphere-sdk 0.6.12 → 0.6.13-dev.2

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/dist/index.js CHANGED
@@ -1427,6 +1427,9 @@ var NostrTransportProvider = class _NostrTransportProvider {
1427
1427
  onReconnected: (url) => {
1428
1428
  logger.debug("Nostr", "NostrClient reconnected to relay:", url);
1429
1429
  this.emitEvent({ type: "transport:connected", timestamp: Date.now() });
1430
+ this.subscribeToEvents().catch((err) => {
1431
+ logger.error("Nostr", "Failed to re-subscribe after reconnect:", err);
1432
+ });
1430
1433
  }
1431
1434
  });
1432
1435
  await Promise.race([
@@ -2995,6 +2998,9 @@ var MultiAddressTransportMux = class {
2995
2998
  onReconnected: (url) => {
2996
2999
  logger.debug("Mux", "Reconnected to relay:", url);
2997
3000
  this.emitEvent({ type: "transport:connected", timestamp: Date.now() });
3001
+ this.updateSubscriptions().catch((err) => {
3002
+ logger.error("Mux", "Failed to re-subscribe after reconnect:", err);
3003
+ });
2998
3004
  }
2999
3005
  });
3000
3006
  await Promise.race([
@@ -3082,7 +3088,7 @@ var MultiAddressTransportMux = class {
3082
3088
  * Called whenever addresses are added/removed.
3083
3089
  */
3084
3090
  async updateSubscriptions() {
3085
- if (!this.nostrClient || this.addresses.size === 0) return;
3091
+ if (!this.nostrClient) return;
3086
3092
  if (this.walletSubscriptionId) {
3087
3093
  this.nostrClient.unsubscribe(this.walletSubscriptionId);
3088
3094
  this.walletSubscriptionId = null;
@@ -3091,6 +3097,7 @@ var MultiAddressTransportMux = class {
3091
3097
  this.nostrClient.unsubscribe(this.chatSubscriptionId);
3092
3098
  this.chatSubscriptionId = null;
3093
3099
  }
3100
+ if (this.addresses.size === 0) return;
3094
3101
  const allPubkeys = [];
3095
3102
  for (const entry of this.addresses.values()) {
3096
3103
  allPubkeys.push(entry.nostrPubkey);