You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to write a transaction broadcasting system that has a similar interface to the Viem wallet actions. Internally it could perform multiple operations like building a serialized view of the transactions (prepareTransactionRequest), simulating it (simulateContract), writing it (writeContract), along with application specific error handling, data persistence, error handling, etc.
We've run into troubles trying to get type checking to work. The simplified example below demonstrates the basic problem. We don't necessarily care about gasPrice rather it just served as a simple example demonstrating the issue we hit.
I'm hoping this discussion can uncover:
alternative / better ways to accomplish the general problem of writing generic extensions like this
short-term work arounds
potential long-term improvements to type inference
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We are trying to write a transaction broadcasting system that has a similar interface to the Viem wallet actions. Internally it could perform multiple operations like building a serialized view of the transactions (prepareTransactionRequest), simulating it (simulateContract), writing it (writeContract), along with application specific error handling, data persistence, error handling, etc.
We've run into troubles trying to get type checking to work. The simplified example below demonstrates the basic problem. We don't necessarily care about gasPrice rather it just served as a simple example demonstrating the issue we hit.
I'm hoping this discussion can uncover:
TSPlayground
We would expect the addition of the gasPrice property to type check correctly in transactionBroadcasterB, but it doesn't.
Related:
#238
#586
Beta Was this translation helpful? Give feedback.
All reactions