@bit-buccaneers/wallet-abstraction 0.0.31 → 0.0.32

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/dev.js CHANGED
@@ -505,12 +505,41 @@ var connectWalletConnect = async (options) => {
505
505
  return currentSession;
506
506
  };
507
507
  var disconnectWalletConnect = async () => {
508
- if (!signClient || !currentSession) return;
509
- await signClient.disconnect({
510
- topic: currentSession.topic,
511
- reason: { code: 6e3, message: "User disconnected" }
512
- });
508
+ if (!signClient) return;
509
+ const sessions = signClient.session.values;
510
+ for (const session of sessions) {
511
+ try {
512
+ await signClient.disconnect({
513
+ topic: session.topic,
514
+ reason: { code: 6e3, message: "User disconnected" }
515
+ });
516
+ } catch {
517
+ }
518
+ }
519
+ const pairings = signClient.core.pairing.pairings.values;
520
+ for (const pairing of pairings) {
521
+ try {
522
+ await signClient.core.pairing.disconnect({ topic: pairing.topic });
523
+ } catch {
524
+ }
525
+ }
513
526
  currentSession = null;
527
+ notifySessionChange(null);
528
+ await cleanupWalletConnectStorage();
529
+ };
530
+ var cleanupWalletConnectStorage = async () => {
531
+ if (typeof window.indexedDB !== "undefined") {
532
+ try {
533
+ const databases = await window.indexedDB.databases();
534
+ for (const db of databases) {
535
+ if (db.name?.startsWith("WALLET_CONNECT")) {
536
+ window.indexedDB.deleteDatabase(db.name);
537
+ }
538
+ }
539
+ } catch {
540
+ }
541
+ }
542
+ Object.keys(window.localStorage).filter((key) => key.startsWith("wc@")).forEach((key) => window.localStorage.removeItem(key));
514
543
  };
515
544
  var requestWalletConnect = async (method, params, chainId) => {
516
545
  if (!signClient || !currentSession) {
package/dist/dev.jsx CHANGED
@@ -509,12 +509,41 @@ var connectWalletConnect = async (options) => {
509
509
  return currentSession;
510
510
  };
511
511
  var disconnectWalletConnect = async () => {
512
- if (!signClient || !currentSession) return;
513
- await signClient.disconnect({
514
- topic: currentSession.topic,
515
- reason: { code: 6e3, message: "User disconnected" }
516
- });
512
+ if (!signClient) return;
513
+ const sessions = signClient.session.values;
514
+ for (const session of sessions) {
515
+ try {
516
+ await signClient.disconnect({
517
+ topic: session.topic,
518
+ reason: { code: 6e3, message: "User disconnected" }
519
+ });
520
+ } catch {
521
+ }
522
+ }
523
+ const pairings = signClient.core.pairing.pairings.values;
524
+ for (const pairing of pairings) {
525
+ try {
526
+ await signClient.core.pairing.disconnect({ topic: pairing.topic });
527
+ } catch {
528
+ }
529
+ }
517
530
  currentSession = null;
531
+ notifySessionChange(null);
532
+ await cleanupWalletConnectStorage();
533
+ };
534
+ var cleanupWalletConnectStorage = async () => {
535
+ if (typeof window.indexedDB !== "undefined") {
536
+ try {
537
+ const databases = await window.indexedDB.databases();
538
+ for (const db of databases) {
539
+ if (db.name?.startsWith("WALLET_CONNECT")) {
540
+ window.indexedDB.deleteDatabase(db.name);
541
+ }
542
+ }
543
+ } catch {
544
+ }
545
+ }
546
+ Object.keys(window.localStorage).filter((key) => key.startsWith("wc@")).forEach((key) => window.localStorage.removeItem(key));
518
547
  };
519
548
  var requestWalletConnect = async (method, params, chainId) => {
520
549
  if (!signClient || !currentSession) {
package/dist/index.js CHANGED
@@ -505,12 +505,41 @@ var connectWalletConnect = async (options) => {
505
505
  return currentSession;
506
506
  };
507
507
  var disconnectWalletConnect = async () => {
508
- if (!signClient || !currentSession) return;
509
- await signClient.disconnect({
510
- topic: currentSession.topic,
511
- reason: { code: 6e3, message: "User disconnected" }
512
- });
508
+ if (!signClient) return;
509
+ const sessions = signClient.session.values;
510
+ for (const session of sessions) {
511
+ try {
512
+ await signClient.disconnect({
513
+ topic: session.topic,
514
+ reason: { code: 6e3, message: "User disconnected" }
515
+ });
516
+ } catch {
517
+ }
518
+ }
519
+ const pairings = signClient.core.pairing.pairings.values;
520
+ for (const pairing of pairings) {
521
+ try {
522
+ await signClient.core.pairing.disconnect({ topic: pairing.topic });
523
+ } catch {
524
+ }
525
+ }
513
526
  currentSession = null;
527
+ notifySessionChange(null);
528
+ await cleanupWalletConnectStorage();
529
+ };
530
+ var cleanupWalletConnectStorage = async () => {
531
+ if (typeof window.indexedDB !== "undefined") {
532
+ try {
533
+ const databases = await window.indexedDB.databases();
534
+ for (const db of databases) {
535
+ if (db.name?.startsWith("WALLET_CONNECT")) {
536
+ window.indexedDB.deleteDatabase(db.name);
537
+ }
538
+ }
539
+ } catch {
540
+ }
541
+ }
542
+ Object.keys(window.localStorage).filter((key) => key.startsWith("wc@")).forEach((key) => window.localStorage.removeItem(key));
514
543
  };
515
544
  var requestWalletConnect = async (method, params, chainId) => {
516
545
  if (!signClient || !currentSession) {
package/dist/index.jsx CHANGED
@@ -509,12 +509,41 @@ var connectWalletConnect = async (options) => {
509
509
  return currentSession;
510
510
  };
511
511
  var disconnectWalletConnect = async () => {
512
- if (!signClient || !currentSession) return;
513
- await signClient.disconnect({
514
- topic: currentSession.topic,
515
- reason: { code: 6e3, message: "User disconnected" }
516
- });
512
+ if (!signClient) return;
513
+ const sessions = signClient.session.values;
514
+ for (const session of sessions) {
515
+ try {
516
+ await signClient.disconnect({
517
+ topic: session.topic,
518
+ reason: { code: 6e3, message: "User disconnected" }
519
+ });
520
+ } catch {
521
+ }
522
+ }
523
+ const pairings = signClient.core.pairing.pairings.values;
524
+ for (const pairing of pairings) {
525
+ try {
526
+ await signClient.core.pairing.disconnect({ topic: pairing.topic });
527
+ } catch {
528
+ }
529
+ }
517
530
  currentSession = null;
531
+ notifySessionChange(null);
532
+ await cleanupWalletConnectStorage();
533
+ };
534
+ var cleanupWalletConnectStorage = async () => {
535
+ if (typeof window.indexedDB !== "undefined") {
536
+ try {
537
+ const databases = await window.indexedDB.databases();
538
+ for (const db of databases) {
539
+ if (db.name?.startsWith("WALLET_CONNECT")) {
540
+ window.indexedDB.deleteDatabase(db.name);
541
+ }
542
+ }
543
+ } catch {
544
+ }
545
+ }
546
+ Object.keys(window.localStorage).filter((key) => key.startsWith("wc@")).forEach((key) => window.localStorage.removeItem(key));
518
547
  };
519
548
  var requestWalletConnect = async (method, params, chainId) => {
520
549
  if (!signClient || !currentSession) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-buccaneers/wallet-abstraction",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "Solid.js web3 wallet abstraction for EVM and Solana",
5
5
  "license": "MIT",
6
6
  "author": "Bit Buccaneers",