Closed JoeHowarth closed 2 years ago
Hmm, is the do_something
method an instruction or just a regular method? Seems like something's off in the IDL.
The do_something is an instruction.
Yeah I could definitely see the argument that idl generation should not emit the Box at all. Currently I run a regex on the idl to remove the box and that seems to work.
Right, I was thrown off by the fact that you don't have a ctx argument in the snippet you posted (if I'm not mistaken you have to have ctx as the first argument in an anchor instruction).
So yea I managed to reproduce it. This is definitely an issue with the IDL generation. For example, when you have an Box<bool>
arg it will generate this:
I don't think Box should be generated in the IDL as this is specific to rust memory management and should otherwise work transparently.
Could you open an issue about this in the anchor repo?
In the meantime your workaround seems good to me. I don't think it's worthwhile to handle this in the client generator as it will get resolved in the IDL generation.
Ahh, yeah I wrote the snippet rather than copy my actual code, should definitely have a ctx 😅
Thanks for opening the issue, I'll keep the workaround for now 👍
Problem:
Currently the above fails with the following error:
Proposal:
Disregard the
Box
and just look forMyType