-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Macro system for standardizing wasm attribute emission/parsing #1928
Comments
I have a similar problem/use case but only for the attribute emission part. Here the focus is to ensure stability for clients and avoid to easily break them because keys change. But what's not so clear to me is the parsing. I assume you are referring to Happy for any thoughts or use case descriptions. See also #1995 |
Ah sorry I wasn't clear. No, for my use case I would be parsing wasm events within a bot off chain. It's basically just a convenience feature for easily reconstructing these attributes.
|
Interesting, yeah that sounds more solid to me. Do you already have that approach implemented somewhere? Is it working well? Or do you strictly need cosmwasm-std support here? I wonder if this is more a best practice question or in scope of cosmwasm-std. |
I've posted this here because in my dream world, all smart contracts would use I currently have a prototype of this working, and if you're interested in including it I'd be happy to chat with you about what the api should look like, polish it up, and contribute. |
Right, but just like cw2 it can become something well established in the ecosystem but not necessarily in the standard library. cosmwasm-std is the slowest area in which we can innovate due to the extreme care required to ensure compiled contracts keep working. |
Yeah I totally get that! This derive wouldn't include any breaking changes so no need to worry about that. But I totally understand being hesitant to include changes like that. Ultimately your call, but I do think it would fit in nicely here ;) |
We should think about how to handle this with the new schema #2206 |
So I was recently banging my head against the wall trying to parse wasm attributes and I came up with an idea for making this process painless and convenient. It looks something like this right now but I'd be open to suggestions.
MsgAttr
derivesFrom<Vec<Attribute>>
andInto<Vec<Attribute>>
to make parsing extremely easy, andThen in the smart contract we can have
The
Attrs
macro the creates a new enum that looks like this:and we can access to a parsing function like this:
This could be made a little more robust by including wasm events as well but I haven't really thought that far ahead. Let me know what you think!
The text was updated successfully, but these errors were encountered: