Skip to content

quanggtoken/NeoModules

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NeoModules

Modular packages for C# devs to use on your NEO blockchain project.

Waiting for peer review. Use on main net at your own risk

Libraries (ready for use)

Project Source Nuget Package Description
NeoModules.RPC NuGet version RPC Class Library to interact with NEO RPC nodes
NeoModules.JsonRpc.Client NuGet version Base RPC client definition, used in NeoModules.RPC
NeoModules.Rest NuGet version Simple Rest client for https://neoscan.io public API

Libraries (in dev)

Project Source Nuget Package Description
NeoModules.Core NuGet version Core data types and methods used in NeoModules
NeoModules.NVM NuGet version Neo VM with only the necessary functions to support script construction and KeyPair/NEP6
NeoModules.KeyPairs NuGet version KeyPair project, has the crypto methods needed for KeyPair creation and KeyPair definition
NeoModules.NEP6 NuGet version NEP6 light wallet implementation

RPC client - Intro and Quick Start (Status - finished)

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

Contributing

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.9%
  • Smalltalk 0.1%