Closed mangas closed 2 years ago
The macro generates each component.
accounts
- is exposed via crate::accounts::<ix-name>{..}.to_account_metas()
data
- is exposed via crate::instruction::<ix-name>{..}.data()
It's already possible to use anchor
projects from Rust code.
You can use https://github.com/dtolnay/cargo-expand for exploration of what anchor
macros generate and how it's can be used.
Hi,
As a rust developer a much prefer writing test code in rust rather than typescript. I also think this would reduce friction between anchor and non anchor "standards" since this is how the current native contracts work.
883 also shows the confusion this causes for newcomers.
Essentially the following snippet was shared on the anchor discord as a way of achieve calls from rust to anchor contracts and as you can see it's quite verbose and not very practical.
I think it would be great to have these types of bindings generated along with the contract, I couldn't find it in the expanded macro code but if it already exists then would be great to point it out in the docs.
https://gist.github.com/bonedaddy/0a51ad0191856c4330f2fd8adff10990 Here's a copy for convenience