Open nambrot opened 1 year ago
Hmm, there's maybe some value in integrating more deeply with Wagmi, but it's not really necessary. Wagmi's core functions and react hooks (which just map 1:1 to core functions) are very modular. You can pick and choose the ones you need, as we do in the warp UI. Note, Wagmi, it does already have some multi-chain capabilities but it's crude: https://wagmi.sh/core/actions/getProvider#chainid-optional
Here are two relevant bits to show you how the warp UI is managing providers / interacting with Wagmi: https://github.com/hyperlane-xyz/hyperlane-warp-ui-template/blob/main/src/features/transfer/useTokenTransfer.ts#L61 https://github.com/hyperlane-xyz/hyperlane-warp-ui-template/blob/main/src/features/providers.ts#L14-L15
We could definitely use the MultiProvider in providers.ts
above but I opted not to because it would complicate the types without simplifying anything IMHO. Wanted to keep it obvious for forkability.
My current feeling is that the best thing we could do (for now) is just keep our tooling mostly agnostic by keeping to the de facto standard building blocks (ethers providers, typechain factories, etc.). But this topic merits more thought/discussion, happy to dive deeper.
Yeah I guess this was ultimately prompted by the gas payment work. I think @yorhodes commented that ideally the hyperlane/multichain logic is abstracted in the current abstraction HyperlaneApp
, but IIUC right now, a developer building a UI would still need to implement said logic themselves outside our SDK and wagmi?
It could be implemented in HyperlaneApp
, yes. One could gather signers from Wagmi, manually construct a Multiprovider with them, and then let HyperlaneApp
handle this. But IMO that wouldn't be a UI dev's first choice for 3 reasons: 1) finer grained control for UI feedback, 2) preference for using ethers/typechain/wagmi as they're already used to, 3) difficulty of instantiating/typing current SDK classes.
Wagmi is a popular library that is being used in the warp route ui template. IIUC, the integration is very light in that the provider(s) are managed by wagmi which means it cannot be easily used by tooling that uses multiprovider. There is a world where there can be a tighter integration. It came up as @yorhodes was trying to support gas payments at the sdk level for warp routes.
@jmrossy not sure if that actually makes sense or is easy to do, so looking for your take on this