Establish Connection

Connect with Blocto from the web app.

Before you interact with Blocto, you have to establish a connection first. The connection will prompt the user for permission to share their public key, or it returns public key directly if the user has approved the account access permission.

Connection

window.solana.connect()

When the user has approved the request to connect, the provider will emit a connect event. And you may access useful properties of the provider.

window.solana.on("connect", () => console.log("connected"))

window.solana.publicKey // wallet's publicKey
window.solana.connected // true or false
window.solana.network // mainnet-beta or testnet

Disconnection

Similar with connection, calling disconnection will emit a disconnect event.

window.solana.disconnect()

window.solana.on("disconnect", () => console.log("disconnected"))

Last updated

Change request #370: docs: add web sdk v0.5.0 ERC-4337 docs