Getting receipts in wagmi / viem for a transaction issued with Safe on walletconnect #3105
Unanswered
elmariachi111
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a duplicate of this question that I just asked on sx:
https://ethereum.stackexchange.com/questions/155384/how-to-get-receipt-in-wagmi-viem-for-a-transaction-issued-with-safe-on-walletc
Our dapp is using wagmi 1.4 / viem 1.15 and a plain httpProvider. I'm connecting it to a Safe (1/1) using WalletConnect v2. When I dispatch a contract transaction, viem yields a transaction response like
{ hash: 0x...}
. In contrast to transactions dispatched via an injected wallet / provider this hash is not a transaction hash but represents the Safe'ssafeTx
(that will be signed, relayed and finally executed on the Safe's side). We can resolve the execution result eg by using API Kit (like in https://docs.safe.global/reference/api-kit#gettransaction) or requesting the Transaction Service API directly.From a DX/UX perspective there's a problem: our frontend (or wagmi for that matter) doesn't know that it's connected to a Safe/AA wallet, so we can't trivially determine whether we must resolve the safetx on our side. The ideal DX would be to extend a viem wallet provider so that it transparently checks and resolves the transaction response as if it were issued by an EOA. Clearly, AA transactions can take very long so that response should still carry the safeTx, or even its current execution state.
I'm wondering if there's any integration available for viem/wagmi already.
To illustrate the case I've assembled a quite unclean and naive demo that checks whether the connected account is a contract (surely not every contract is a Safe ;) ) and issues queries to the Safe Transaction API until it finds the actual transaction hash: https://github.com/moleculeprotocol/test-wagmi-safe-privy (demo: https://moleculeprotocol.github.io/test-wagmi-safe-privy/ should work with injected providers & Safe)
Beta Was this translation helpful? Give feedback.
All reactions