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

1
window.solana.connect()
Copied!
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.
1
window.solana.on("connect", () => console.log("connected"))
2
3
window.solana.publicKey // wallet's publicKey
4
window.solana.connected // true or false
5
window.solana.network // mainnet-beta or testnet
Copied!

Disconnection

Similar with connection, calling disconnection will emit a disconnect event.
1
window.solana.disconnect()
2
3
window.solana.on("disconnect", () => console.log("disconnected"))
Copied!
Last modified 8mo ago
Copy link