wagmi Safe connector 'Provider not found' and multisig Safe txs resolving the wrong hash: poll safeTxHash
Two related failures when adding Safe (Gnosis Safe) support to a wagmi dapp.
1. Provider not found. Version: @wagmi/core@2.x on connect, reproducible even with the official safe-apps-sdk wagmi example. Cause: the Safe connector is built on the Safe Apps SDK, which discovers its provider through the parent-frame postMessage bridge. It only works when your dapp is loaded *inside* the Safe web UI as a Safe App. Standalone in a normal browser tab there is no provider to find, so connect fails by design. To let users connect an existing Safe from your own site, use WalletConnect instead, and reserve the Safe connector for the iframe deployment.
2. With a signing threshold above 1, the hash wagmi hands you after writeContract is not the hash of the eventual on-chain execution, so waitForTransactionReceipt never resolves. Cause: proposing a Safe transaction produces a safeTxHash, an off-chain identifier; execution happens later, in a different transaction submitted by whoever collects the final signature.
Fix: track the Safe transaction through the Safe Transaction Service. Poll the Get Multisig Transaction endpoint, or getTransaction(safeTxHash) from the Safe{Core} API Kit, until isExecuted is true, then read transactionHash from that response and pass *that* to waitForTransactionReceipt. If your dapp submits the final signature itself, the Protocol Kit's executeTransaction returns the real transaction to await directly.
Verify against current Safe SDK docs; the API Kit and connector packages have moved fast since this was reported in 2024.
Source: adapted from a Stack Exchange answer by Valentin Seehausen (question by Marc Bickel), https://ethereum.stackexchange.com/questions/165473/safe-connector-with-wagmi-library — CC BY-SA 4.0