safe-apps-sdk
safe-apps-sdk copied to clipboard
SafeAppConnector from `@gnosis.pm/safe-apps-web3-react` provides outdated data
Description
import { SafeAppConnector } from '@gnosis.pm/safe-apps-web3-react'
We are using it as connector.getSafeInfo()
and got a problem. When we change an account in the wallet it keeps returning old data. For example, I connected as the owner of Safe and I'm not in readonly mode, then I switch to another account which is readonly, and getSafeInfo()
return the old data that says I'm not readonly.
Environment
- Browser: Chrome
- Wallet: MetaMask
- Chain: Rinkeby
Steps to reproduce
- Open https://gnosis-safe.io and connect an account that is owner of Safe
- Open the app in https://gnosis-safe.io
- Switch to another account in the wallet that is not the owner of Safe
- Request
connector.getSafeInfo()
from the app side
Expected result
connector.getSafeInfo()
returned isReadOnly
equals false
Obtained result
connector.getSafeInfo()
returned isReadOnly
equals true
Screenshots
The problem is the cached safeInfo: https://github.com/safe-global/safe-apps-sdk/blob/master/packages/safe-apps-web3-react/src/connector.ts#L25-L30
We need to update and release a new version of the SDK
Unexpected plot twist: we deprecated the web3-react connector because it's now available in the original web3-react package: https://github.com/Uniswap/web3-react