-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connecting to Safes via WalletConnect #127
Comments
Should either fix the WalletConnected Safe detection and make sure the |
Problem with fixing it now is there are probably people out there who have Safe Safe proxies who would suddenly appear to lose their stuff after a dapp updates to fixed logic. OTOH refusing to fix this means Safe WalletConnect users will never be able to create markets or add liquidity for example, or any other number of expensive actions that fulfill the criteria in this issue. WDYT @germartinez @rmeissner |
The WalletConnect Safe App will not work with the CPK because of multiple issue (this one for example: safe-global/safe-react-apps#56). Once these are solved it is trivial to implement support for
The legacy app should still work with this, right? |
I remember a report from Martin on iOS that the legacy app didn't use the direct route... |
Okay, so the app in question was Omen, and today for some reason I was able to WalletConnect to Omen via my Safe finally, which means I was able to finally dig into what's going on, and... it's kinda complicated. Right now, the CPK does a detection routine that makes an assumption that the provider passed into the Ethereum library (web3 or ethers) is just an instance of the However, that assumption is wrong when interacting with What happens with But then it gets weird, as there is one that looks like the right provider, but instead of the I think TL;DR: Gotta do detection via something like this: async function checkConnectedToSafe(provider: any): Promise<boolean> {
if (provider == null) return false
const wc = await provider.getWalletConnector?.() ||
await provider.connection?.getWalletConnector?.() ||
provider.wc ||
provider.connection?.wc
if (wc?.peerMeta?.name?.startsWith?.('Gnosis Safe')) {
return true
}
if (provider._providers) {
return (await Promise.all(provider._providers.map(checkConnectedToSafe))).includes(true)
}
return false
} |
Right now, connecting directly to a Safe via WalletConnect doesn't really work: https://github.com/gnosis/contract-proxy-kit#support-for-connection-to-a-gnosis-safe
This means that Safes will actually have their own proxy Safe, and attempt to
execTransaction
anexecTransaction
. The outer execTransaction will use the Safe's own gas estimation routines to supply thesafeTxGas
parameter. This causes large transactions to fail because the innerexecTransaction
will swallow reversions and return a success/fail flag if enough gas gets sent such that the 1/64 gas remaining from a call is enough to finish runningexecTransaction
, meaning Omen market's cannot be created via the Safe for example: https://etherscan.io/tx/0xbf5722dd28d8c53357eca924eb6a2dfc7d230595c99e2f9985d90a7553f06fc2The text was updated successfully, but these errors were encountered: