@tezos-x/octez.connect-walletThis package is part of the @tezos-x/octez.connect-sdk project. Read more
Use this package in your wallet to instanciate a WalletClient object and communicate to dApps.
import { WalletClient } from '@tezos-x/octez.connect-wallet'
const walletClient = new WalletClient({ name: "Example Wallet" });
await walletClient.init();
walletClient.connect((message) => {
// Handle incoming messages from dApps
});
Check our documentation for more information. Documentation
The WalletClient maintains a persistent connection to Matrix relay servers via long-polling. Once connect() is called, the client polls the server every 30 seconds to receive messages from dApps.
For regular web pages, this is fine because closing the page naturally terminates the connection.
For browser extensions, this requires careful lifecycle management because background scripts persist indefinitely. Without proper management, your extension will continuously poll servers even when idle, wasting bandwidth and resources.
See the Chrome Extension Example for a complete reference implementation demonstrating:
destroy()