connect
connect copied to clipboard
Add ability for app to listen network changing and get network info
We have our own testnet instance and we hope our app can alert users that they are using an unexpected network in their stacks wallet
So we hope @stacks/connect can provide some API to make the app able to know which network users are using, just like connect
event and chainChanged
event of MetaMask
Maybe we can do it like this:
interface NetworkInfo {
networkAddress: string
}
interface UserSession {
// other properties ...
// return network info, or throw an error if users not signed in
getNetworkInfo(): Promise<NetworkInfo>
}
interface AuthOptions {
// other properties ...
onNetworkChanged: () => void
}
Related issues:
- https://github.com/hirosystems/stacks-wallet-web/issues/2535
- https://github.com/hirosystems/stacks-wallet-web/issues/1281