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
The current implementation makes two restrictive decisions:
The only way to create a wrapper is to pass function pointers (can't pass closures or any ol impl Fn)
All the fields are private
The internal new() creator is able to create a closure from the passed-in function pointer, but the current setup disallows the caller to do this too. e.g. it may want to wrap functions before passing them in.
Suggestion: change the new() functions to accept anyimpl Fn
edit: the Contract trait is pub so making the fields on ContractWrapper wouldn't add much. The real blocker is using the simple new() methods with closures being passed in
The text was updated successfully, but these errors were encountered:
dakom
changed the title
cw_multi_test: make fields pub
cw_multi_test: accept closures in new()
Jul 17, 2022
The problem is that implementation if ContractWrapper is not trivial, it would require it to be generic over passed handlers types (right now it is generic over magic internals). I think it is doable, I will take a look at it next week, but personally I would suggest just implementing your custom type implementing Contract instead of using ContractWrapper.
Yup! totally agree @hashedone - looks like it would require adding more generics everywhere, which would be painful on the library side (but would make the API nicer for users)
Also agree, implementing our own custom type is totally workable, the issue here should be thought of more as improving developer experience rather than actually blocking anything important.
I would put a deep refactor of multi-test before this should be approached (or fix this as part of a refactor). We may be able to simplify the traits and generics if some big brains spend several days focused on it.
uint
transferred this issue from CosmWasm/cw-plus
Nov 1, 2022
The current implementation makes two restrictive decisions:
impl Fn
)The internal
new()
creator is able to create a closure from the passed-in function pointer, but the current setup disallows the caller to do this too. e.g. it may want to wrap functions before passing them in.Suggestion: change the
new()
functions to accept anyimpl Fn
edit: the Contract trait is
pub
so making the fields onContractWrapper
wouldn't add much. The real blocker is using the simplenew()
methods with closures being passed inThe text was updated successfully, but these errors were encountered: