@bit-buccaneers/wallet-abstraction 0.0.31 → 0.0.33

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
@@ -16,7 +16,11 @@ var config = null;
16
16
  var configuredChains = [mainnet];
17
17
  var createEvmConfig = (chains) => {
18
18
  if (chains) configuredChains = chains;
19
- const connectors = [injected(), metaMask(), coinbaseWallet({ appName: "Wallet Abstraction" })];
19
+ const connectors = [
20
+ injected(),
21
+ metaMask(),
22
+ coinbaseWallet({ appName: "Wallet Abstraction", preference: "eoaOnly" })
23
+ ];
20
24
  const transports = {};
21
25
  for (const chain of configuredChains) {
22
26
  transports[chain.id] = http();
@@ -505,12 +509,41 @@ var connectWalletConnect = async (options) => {
505
509
  return currentSession;
506
510
  };
507
511
  var disconnectWalletConnect = async () => {
508
- if (!signClient || !currentSession) return;
509
- await signClient.disconnect({
510
- topic: currentSession.topic,
511
- reason: { code: 6e3, message: "User disconnected" }
512
- });
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
+ }
513
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));
514
547
  };
515
548
  var requestWalletConnect = async (method, params, chainId) => {
516
549
  if (!signClient || !currentSession) {
package/dist/dev.jsx CHANGED
@@ -7,7 +7,11 @@ var config = null;
7
7
  var configuredChains = [mainnet];
8
8
  var createEvmConfig = (chains) => {
9
9
  if (chains) configuredChains = chains;
10
- const connectors = [injected(), metaMask(), coinbaseWallet({ appName: "Wallet Abstraction" })];
10
+ const connectors = [
11
+ injected(),
12
+ metaMask(),
13
+ coinbaseWallet({ appName: "Wallet Abstraction", preference: "eoaOnly" })
14
+ ];
11
15
  const transports = {};
12
16
  for (const chain of configuredChains) {
13
17
  transports[chain.id] = http();
@@ -509,12 +513,41 @@ var connectWalletConnect = async (options) => {
509
513
  return currentSession;
510
514
  };
511
515
  var disconnectWalletConnect = async () => {
512
- if (!signClient || !currentSession) return;
513
- await signClient.disconnect({
514
- topic: currentSession.topic,
515
- reason: { code: 6e3, message: "User disconnected" }
516
- });
516
+ if (!signClient) return;
517
+ const sessions = signClient.session.values;
518
+ for (const session of sessions) {
519
+ try {
520
+ await signClient.disconnect({
521
+ topic: session.topic,
522
+ reason: { code: 6e3, message: "User disconnected" }
523
+ });
524
+ } catch {
525
+ }
526
+ }
527
+ const pairings = signClient.core.pairing.pairings.values;
528
+ for (const pairing of pairings) {
529
+ try {
530
+ await signClient.core.pairing.disconnect({ topic: pairing.topic });
531
+ } catch {
532
+ }
533
+ }
517
534
  currentSession = null;
535
+ notifySessionChange(null);
536
+ await cleanupWalletConnectStorage();
537
+ };
538
+ var cleanupWalletConnectStorage = async () => {
539
+ if (typeof window.indexedDB !== "undefined") {
540
+ try {
541
+ const databases = await window.indexedDB.databases();
542
+ for (const db of databases) {
543
+ if (db.name?.startsWith("WALLET_CONNECT")) {
544
+ window.indexedDB.deleteDatabase(db.name);
545
+ }
546
+ }
547
+ } catch {
548
+ }
549
+ }
550
+ Object.keys(window.localStorage).filter((key) => key.startsWith("wc@")).forEach((key) => window.localStorage.removeItem(key));
518
551
  };
519
552
  var requestWalletConnect = async (method, params, chainId) => {
520
553
  if (!signClient || !currentSession) {
package/dist/index.js CHANGED
@@ -16,7 +16,11 @@ var config = null;
16
16
  var configuredChains = [mainnet];
17
17
  var createEvmConfig = (chains) => {
18
18
  if (chains) configuredChains = chains;
19
- const connectors = [injected(), metaMask(), coinbaseWallet({ appName: "Wallet Abstraction" })];
19
+ const connectors = [
20
+ injected(),
21
+ metaMask(),
22
+ coinbaseWallet({ appName: "Wallet Abstraction", preference: "eoaOnly" })
23
+ ];
20
24
  const transports = {};
21
25
  for (const chain of configuredChains) {
22
26
  transports[chain.id] = http();
@@ -505,12 +509,41 @@ var connectWalletConnect = async (options) => {
505
509
  return currentSession;
506
510
  };
507
511
  var disconnectWalletConnect = async () => {
508
- if (!signClient || !currentSession) return;
509
- await signClient.disconnect({
510
- topic: currentSession.topic,
511
- reason: { code: 6e3, message: "User disconnected" }
512
- });
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
+ }
513
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));
514
547
  };
515
548
  var requestWalletConnect = async (method, params, chainId) => {
516
549
  if (!signClient || !currentSession) {
package/dist/index.jsx CHANGED
@@ -7,7 +7,11 @@ var config = null;
7
7
  var configuredChains = [mainnet];
8
8
  var createEvmConfig = (chains) => {
9
9
  if (chains) configuredChains = chains;
10
- const connectors = [injected(), metaMask(), coinbaseWallet({ appName: "Wallet Abstraction" })];
10
+ const connectors = [
11
+ injected(),
12
+ metaMask(),
13
+ coinbaseWallet({ appName: "Wallet Abstraction", preference: "eoaOnly" })
14
+ ];
11
15
  const transports = {};
12
16
  for (const chain of configuredChains) {
13
17
  transports[chain.id] = http();
@@ -509,12 +513,41 @@ var connectWalletConnect = async (options) => {
509
513
  return currentSession;
510
514
  };
511
515
  var disconnectWalletConnect = async () => {
512
- if (!signClient || !currentSession) return;
513
- await signClient.disconnect({
514
- topic: currentSession.topic,
515
- reason: { code: 6e3, message: "User disconnected" }
516
- });
516
+ if (!signClient) return;
517
+ const sessions = signClient.session.values;
518
+ for (const session of sessions) {
519
+ try {
520
+ await signClient.disconnect({
521
+ topic: session.topic,
522
+ reason: { code: 6e3, message: "User disconnected" }
523
+ });
524
+ } catch {
525
+ }
526
+ }
527
+ const pairings = signClient.core.pairing.pairings.values;
528
+ for (const pairing of pairings) {
529
+ try {
530
+ await signClient.core.pairing.disconnect({ topic: pairing.topic });
531
+ } catch {
532
+ }
533
+ }
517
534
  currentSession = null;
535
+ notifySessionChange(null);
536
+ await cleanupWalletConnectStorage();
537
+ };
538
+ var cleanupWalletConnectStorage = async () => {
539
+ if (typeof window.indexedDB !== "undefined") {
540
+ try {
541
+ const databases = await window.indexedDB.databases();
542
+ for (const db of databases) {
543
+ if (db.name?.startsWith("WALLET_CONNECT")) {
544
+ window.indexedDB.deleteDatabase(db.name);
545
+ }
546
+ }
547
+ } catch {
548
+ }
549
+ }
550
+ Object.keys(window.localStorage).filter((key) => key.startsWith("wc@")).forEach((key) => window.localStorage.removeItem(key));
518
551
  };
519
552
  var requestWalletConnect = async (method, params, chainId) => {
520
553
  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.33",
4
4
  "description": "Solid.js web3 wallet abstraction for EVM and Solana",
5
5
  "license": "MIT",
6
6
  "author": "Bit Buccaneers",