Some companies want to interact with prebuilt c# code. Is there a more high level interface than writing lots of p-invokes?
-
I suppose you've probably seen this one github.com/ajuna-network/SubstrateNetApi and are looking for something more up-to-date and refined? I'd like to see that too– tarrballFeb 15, 2022 at 2:54
-
Yes, there's also github.com/usetech-llc/polkadot_api_dotnet but both have not been updated in a while. I suspect upgrading to making the most use of the metadata might be non-trivial but extremely worthwhile.– SquirrelFeb 19, 2022 at 13:57
2 Answers
AFAIK there is currently no "production-grade" .NET library which will dynamically generate API code from the chain metadata.
Fortunately there seems to be work happening on it. There is now Ajuna.NetApi (which is a fork/rewrite of SubstrateNetApi), and it focuses on generating API code from chain metadata. It seems to still be in development and documentation is scarce. I don't have any experience with any of these libraries so can't personally vouch for them.
Yes, there is a .NET library that is dynamically generated from your node's metadata. The current name is a little bit misleading as it is a generic toolchain that works for all substrate-based nodes and is not specific to a project.
Substrate C# Toolchain that generates a NET API and more https://github.com/ajuna-network/Ajuna.SDK
And has a lot of tutorials and was showcased at the Sub0 in Lisabon. Ajuna sub0 Talk: Substrate .NET Toolchain & Unity
And can also be used for Unity or Maui https://substrate.stackexchange.com/a/5565/707