@bit-buccaneers/wallet-abstraction 0.0.30 → 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 +40 -5
- package/dist/dev.jsx +40 -5
- package/dist/index.js +40 -5
- package/dist/index.jsx +40 -5
- package/dist/lib/context/WalletContext.d.ts +1 -0
- package/package.json +1 -1
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
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
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) {
|
|
@@ -1695,6 +1724,11 @@ var WalletProvider = (props) => {
|
|
|
1695
1724
|
evm.setEvmConnection(null);
|
|
1696
1725
|
}
|
|
1697
1726
|
};
|
|
1727
|
+
const logout = async () => {
|
|
1728
|
+
await Promise.allSettled([disconnectEvm(), disconnectSolana()]);
|
|
1729
|
+
evm.setEvmConnection(null);
|
|
1730
|
+
solana.setSolanaConnection(null);
|
|
1731
|
+
};
|
|
1698
1732
|
const disconnectSolana = async () => {
|
|
1699
1733
|
if (solana.connectedSolanaConnector()) {
|
|
1700
1734
|
await solana.disconnectSolana();
|
|
@@ -1752,6 +1786,7 @@ var WalletProvider = (props) => {
|
|
|
1752
1786
|
disconnectEvm,
|
|
1753
1787
|
connectSolana: solana.connectSolana,
|
|
1754
1788
|
disconnectSolana,
|
|
1789
|
+
logout,
|
|
1755
1790
|
signMessage,
|
|
1756
1791
|
evmTx
|
|
1757
1792
|
};
|
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
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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) {
|
|
@@ -1744,6 +1773,11 @@ var WalletProvider = (props) => {
|
|
|
1744
1773
|
evm.setEvmConnection(null);
|
|
1745
1774
|
}
|
|
1746
1775
|
};
|
|
1776
|
+
const logout = async () => {
|
|
1777
|
+
await Promise.allSettled([disconnectEvm(), disconnectSolana()]);
|
|
1778
|
+
evm.setEvmConnection(null);
|
|
1779
|
+
solana.setSolanaConnection(null);
|
|
1780
|
+
};
|
|
1747
1781
|
const disconnectSolana = async () => {
|
|
1748
1782
|
if (solana.connectedSolanaConnector()) {
|
|
1749
1783
|
await solana.disconnectSolana();
|
|
@@ -1801,6 +1835,7 @@ var WalletProvider = (props) => {
|
|
|
1801
1835
|
disconnectEvm,
|
|
1802
1836
|
connectSolana: solana.connectSolana,
|
|
1803
1837
|
disconnectSolana,
|
|
1838
|
+
logout,
|
|
1804
1839
|
signMessage,
|
|
1805
1840
|
evmTx
|
|
1806
1841
|
};
|
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
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
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) {
|
|
@@ -1695,6 +1724,11 @@ var WalletProvider = (props) => {
|
|
|
1695
1724
|
evm.setEvmConnection(null);
|
|
1696
1725
|
}
|
|
1697
1726
|
};
|
|
1727
|
+
const logout = async () => {
|
|
1728
|
+
await Promise.allSettled([disconnectEvm(), disconnectSolana()]);
|
|
1729
|
+
evm.setEvmConnection(null);
|
|
1730
|
+
solana.setSolanaConnection(null);
|
|
1731
|
+
};
|
|
1698
1732
|
const disconnectSolana = async () => {
|
|
1699
1733
|
if (solana.connectedSolanaConnector()) {
|
|
1700
1734
|
await solana.disconnectSolana();
|
|
@@ -1752,6 +1786,7 @@ var WalletProvider = (props) => {
|
|
|
1752
1786
|
disconnectEvm,
|
|
1753
1787
|
connectSolana: solana.connectSolana,
|
|
1754
1788
|
disconnectSolana,
|
|
1789
|
+
logout,
|
|
1755
1790
|
signMessage,
|
|
1756
1791
|
evmTx
|
|
1757
1792
|
};
|
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
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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) {
|
|
@@ -1744,6 +1773,11 @@ var WalletProvider = (props) => {
|
|
|
1744
1773
|
evm.setEvmConnection(null);
|
|
1745
1774
|
}
|
|
1746
1775
|
};
|
|
1776
|
+
const logout = async () => {
|
|
1777
|
+
await Promise.allSettled([disconnectEvm(), disconnectSolana()]);
|
|
1778
|
+
evm.setEvmConnection(null);
|
|
1779
|
+
solana.setSolanaConnection(null);
|
|
1780
|
+
};
|
|
1747
1781
|
const disconnectSolana = async () => {
|
|
1748
1782
|
if (solana.connectedSolanaConnector()) {
|
|
1749
1783
|
await solana.disconnectSolana();
|
|
@@ -1801,6 +1835,7 @@ var WalletProvider = (props) => {
|
|
|
1801
1835
|
disconnectEvm,
|
|
1802
1836
|
connectSolana: solana.connectSolana,
|
|
1803
1837
|
disconnectSolana,
|
|
1838
|
+
logout,
|
|
1804
1839
|
signMessage,
|
|
1805
1840
|
evmTx
|
|
1806
1841
|
};
|
|
@@ -14,6 +14,7 @@ export interface WalletContextValue {
|
|
|
14
14
|
disconnectEvm: () => Promise<void>;
|
|
15
15
|
connectSolana: (connector: SolanaWalletConnector) => Promise<ConnectResult>;
|
|
16
16
|
disconnectSolana: () => Promise<void>;
|
|
17
|
+
logout: () => Promise<void>;
|
|
17
18
|
signMessage: (chainType: ChainType, message: string) => Promise<string>;
|
|
18
19
|
evmTx: UseEvmTransactionsReturn;
|
|
19
20
|
}
|