Modular packages for C# devs to use on your NEO blockchain project.
Waiting for peer review. Use on main net at your own risk
Project Source | Nuget Package | Description |
---|---|---|
NeoModules.RPC | RPC Class Library to interact with NEO RPC nodes | |
NeoModules.JsonRpc.Client | Base RPC client definition, used in NeoModules.RPC | |
NeoModules.Rest | Simple Rest client for https://neoscan.io public API |
Project Source | Nuget Package | Description |
---|---|---|
NeoModules.Core | Core data types and methods used in NeoModules | |
NeoModules.NVM | Neo VM with only the necessary functions to support script construction and KeyPair/NEP6 | |
NeoModules.KeyPairs | KeyPair project, has the crypto methods needed for KeyPair creation and KeyPair definition | |
NeoModules.NEP6 | NEP6 light wallet implementation |
Develop with decoupling in mind to make maintenance and new RPC methods implemented more quickly:
- Client base and RPC client implementation - NeoModules.JsonRpc.Client project
- DTO'S, Services, Helpers - NeoModules.RPC (main project)
- Tests - NeoModules.RPC.Tests
- Demo - Simple demonstration project
Setup the rpc client node
var rpcClient = new RpcClient(new Uri("http://seed5.neo.org:10332"));
var NeoApiService = new NeoApiService(rpcClient);
With NeoApiService you have all the methods available, organized by: Accounts, Assets, Block, Contract, Node, Transaction
Then you just need to choose the wanted service, call SendRequestAsync()
and pass the necessary parameters if needed.
e.g.
var accountsService = NeoApiService.Accounts;
var state = accountsService.GetAccountState.SendRequestAsync("ADDRESS HERE");
If you don't need all the services, you can simply create an instance of the desired service.
var blockService = new NeoApiBlockService(new RpcClient(new Uri("http://seed5.neo.org:10332")));
var bestBlockHash = await blockService.GetBestBlockHash.SendRequestAsync();
All rpc calls return a DTO or a simple type like string or int.
You can also create a service to query NEP5 tokens. Note For the results to be human readable, these methods do not return the original result from the rpc node.
var client = new RpcClient(new Uri("http://seed5.neo.org:10332"));
var scriptHash = "08e8c4400f1af2c20c28e0018f29535eb85d15b6"; //TNC token
var nep5Service = new NeoNep5Service(client, scriptHash);
var name = await nep5Service.GetName();
var decimals = await nep5Service.GetDecimals();
var totalsupply = await nep5Service.GetTotalSupply(decimals);
var symbol = await nep5Service.GetSymbol();
var balance = await nep5Service.GetBalance("0x0ff9070d64d19076d08947ba4a82b72709f30baf", decimals);
Token info:
Name: Trinity Network Credit
Symbol: TNC
Decimals: 8
TotalSupply: 1000000000
Balance: 1457.82
- Bruno Freitas - BrunoFreitasgit
- Neo
- Neo-lux
- Multiple base code is taken/inspired from Nethereum project
This project is licensed under the MIT License - see the LICENSE.md file for details