Installation
Package Manager
Install-Package Qredit.Client -Version 0.2.1
.NET CLI
dotnet add package Qredit.Client --version 0.2.1
Paket CLI
paket add Qredit.Client --version 0.2.1
Usage
Connections
using Qredit.Client;
ConnectionManager.Connect(new Connection<Two>("http://my-main.qredit.node:port/api/"))
ConnectionManager.Connect(new Connection<Two>("http://my-backup.qredit.node:port/api/", "backup"))
var response = null;
try {
response = ConnectionManager.Connection("main").Api.Accounts.Balance("DARiJqhogp2Lu6bxufUFQQMuMyZbxjCydN");
} catch (Exception e) {
response = ConnectionManager.Connection("backup").Api.Accounts.Balance("DARiJqhogp2Lu6bxufUFQQMuMyZbxjCydN");
}
if ((bool) response["success"]) {
Console.WriteLine(response["balance"]);
} else {
Console.WriteLine("Both the main and backup node did not respond.");
}
Initialization
using Qredit.Client;
// For V2
using Qredit.Client.API.Two;
static void Main(string[] args)
{
// For V2
var connection = new Connection<Two>("http://my.node.ip:port/api/");
...
}
Blocks V2
// ...
var response = connection.Api.Blocks.All();
Console.WriteLine(response);
... > Qredit.Client.API.Two.Response`1[System.Collections.Generic.List`1[Qredit.Client.API.Two.Models.Block]]
Delegates V2
// ...
var response = connection.Api.Delegates.All();
Console.WriteLine(response);
... > Qredit.Client.API.Two.Response`1[System.Collections.Generic.List`1[Qredit.Client.API.Two.Models.Delegates]]
Node – V2
// ...
var response = connection.Api.Node.Configuration();
Console.WriteLine(response);
... > Qredit.Client.API.Two.Response`1[Qredit.Client.API.Two.Models.NodeConfiguration]
Peers – V2
// ...
var response = connection.Api.Peers.All();
Console.WriteLine(response);
... > Qredit.Client.API.Two.Response`1[System.Collections.Generic.List`1[Qredit.Client.API.Two.Models.Peer]]
Transactions – V2
// ...
var response = connection.Api.Transactions.All();
Console.WriteLine(response);
... > Qredit.Client.API.Two.Response`1[System.Collections.Generic.List`1[Qredit.Client.API.Two.Models.Transaction]]
Votes – V2
// ...
var response = connection.Api.Votes.All();
Console.WriteLine(response);
... > Qredit.Client.API.Two.Response`1[System.Collections.Generic.List`1[Qredit.Client.API.Two.Models.Transaction]]
Wallets – V2
// ...
var response = connection.Api.Wallets.All();
Console.WriteLine(response);
... > Qredit.Client.API.Two.Response`1[System.Collections.Generic.List`1[Qredit.Client.