diff --git a/src/CoiniumServ/CoiniumServ.csproj b/src/CoiniumServ/CoiniumServ.csproj index 4726af002..e0fd373ba 100644 --- a/src/CoiniumServ/CoiniumServ.csproj +++ b/src/CoiniumServ/CoiniumServ.csproj @@ -9,7 +9,7 @@ Properties CoiniumServ CoiniumServ - v4.7 + v4.5.2 512 @@ -149,6 +149,13 @@ + + + + + + + diff --git a/src/CoiniumServ/Daemon/DaemonClient.cs b/src/CoiniumServ/Daemon/DaemonClient.cs index 5f4014115..0fdf43f4b 100644 --- a/src/CoiniumServ/Daemon/DaemonClient.cs +++ b/src/CoiniumServ/Daemon/DaemonClient.cs @@ -337,7 +337,48 @@ public decimal GetHashesPerSec() /// An object containing some general information. public Info GetInfo() { - return MakeRequest("getinfo", null); + Info rval = new Info(); + try + { + rval = MakeRequest("getinfo", null); + } + catch (Exception) // fixme - should only catch if api doesn't exist || if vertcoin. - SCSLATER + { + // VertCoin decided to break protocol - yay! + // -The deprecated RPC `getinfo` was removed. It is recommended that the more specific RPCs are used: + // * `getblockchaininfo` + // * `getnetworkinfo` + // * `getwalletinfo` + // * `getmininginfo` + } + return rval; + } + + private Info GetVertCoinInfo() + { + Info rval = new Info(); + try + { + BlockChainInfo BCInfo = MakeRequest("getblockchaininfo", null); + NetworkInfo netInfo = MakeRequest("getnetworkinfo", null); + WalletInfo wallInfo = MakeRequest("getwalletinfo", null); + MiningInfoData miningData = MakeRequest("getmininginfo", null); + + rval.Version = Convert.ToString(netInfo.version); + rval.ProtocolVersion = netInfo.protocolversion; + rval.WalletVersion = wallInfo.walletversion; + rval.Balance = wallInfo.balance; + rval.Blocks = BCInfo.blocks; + rval.TimeOffset = netInfo.timeoffset; + rval.Connections = netInfo.connections; + rval.Difficulty = BCInfo.difficulty; + rval.KeyPoolEldest = wallInfo.keypoololdest; + rval.KeyPoolSize = wallInfo.keypoolsize; + rval.PayTxFee = wallInfo.paytxfee; + } + catch (Exception) // fixme - should only catch if api doesn't exist || if vertcoin. - SCSLATER + { } + return rval; } [Obsolete("Replaced in v0.7.0 with getblocktemplate, submitblock, getrawmempool")] diff --git a/src/CoiniumServ/Daemon/Responses/BIP9Softforks.cs b/src/CoiniumServ/Daemon/Responses/BIP9Softforks.cs new file mode 100644 index 000000000..8c7831def --- /dev/null +++ b/src/CoiniumServ/Daemon/Responses/BIP9Softforks.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoiniumServ.Daemon.Responses +{ + public class BIP9Softforks + { + public SoftForksData csv { get; set; } + public SoftForksData segwit { get; set; } + public SoftForksData nversionbips { get; set; } + + } +} diff --git a/src/CoiniumServ/Daemon/Responses/BlockChainInfo.cs b/src/CoiniumServ/Daemon/Responses/BlockChainInfo.cs new file mode 100644 index 000000000..0e3ce18ed --- /dev/null +++ b/src/CoiniumServ/Daemon/Responses/BlockChainInfo.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace CoiniumServ.Daemon.Responses +{ + class BlockChainInfo + { + public string chain { get; set; } + public long blocks { get; set; } + public long headers { get; set; } + public string bestblockhash { get; set; } + public double difficulty { get; set; } + public long mediantime { get; set; } + public double verificationprogress { get; set; } + public bool initialblockdownload { get; set; } + public string chainwork { get; set; } + public long size_on_disk { get; set; } + public bool pruned { get; set; } + public BIP9Softforks bip9_softforks { get; set; } + public string warnings { get; set; } + } +} diff --git a/src/CoiniumServ/Daemon/Responses/MiningInfoData.cs b/src/CoiniumServ/Daemon/Responses/MiningInfoData.cs new file mode 100644 index 000000000..cfed00d0c --- /dev/null +++ b/src/CoiniumServ/Daemon/Responses/MiningInfoData.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoiniumServ.Daemon.Responses +{ + public class MiningInfoData + { + public long blocks { get; set; } + public long currentblockweight { get; set; } + public long currentblocktx { get; set; } + public double difficulty { get; set; } + public double networkhashps { get; set; } + public long pooledtx { get; set; } + public string chain { get; set; } + public string warnings { get; set; } + } +} diff --git a/src/CoiniumServ/Daemon/Responses/NetworkData.cs b/src/CoiniumServ/Daemon/Responses/NetworkData.cs new file mode 100644 index 000000000..9fecaecea --- /dev/null +++ b/src/CoiniumServ/Daemon/Responses/NetworkData.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoiniumServ.Daemon.Responses +{ + public class NetworkData + { + public string name { get; set; } + public bool limited { get; set; } + public bool reachable { get; set; } + public string proxy { get; set; } + public bool proxy_randomize_credentials { get; set; } + } +} diff --git a/src/CoiniumServ/Daemon/Responses/NetworkInfo.cs b/src/CoiniumServ/Daemon/Responses/NetworkInfo.cs new file mode 100644 index 000000000..9f110a18c --- /dev/null +++ b/src/CoiniumServ/Daemon/Responses/NetworkInfo.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoiniumServ.Daemon.Responses +{ + public class NetworkInfo + { + public long version { get; set; } + public string subversion { get; set; } + public int protocolversion { get; set; } + public string localservices { get; set; } + public bool localrelay { get; set; } + public long timeoffset { get; set; } + public long networkactive { get; set; } + public long connections { get; set; } + public NetworkData[] networks {get; set;} + } +} diff --git a/src/CoiniumServ/Daemon/Responses/SoftForksData.cs b/src/CoiniumServ/Daemon/Responses/SoftForksData.cs new file mode 100644 index 000000000..da57ed4b5 --- /dev/null +++ b/src/CoiniumServ/Daemon/Responses/SoftForksData.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoiniumServ.Daemon.Responses +{ + public class SoftForksData + { + public string status { get; set; } + public long startTime { get; set; } + public long timeout { get; set; } + public long since { get; set; } + } +} diff --git a/src/CoiniumServ/Daemon/Responses/WalletInfo.cs b/src/CoiniumServ/Daemon/Responses/WalletInfo.cs new file mode 100644 index 000000000..0d5765ee7 --- /dev/null +++ b/src/CoiniumServ/Daemon/Responses/WalletInfo.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoiniumServ.Daemon.Responses +{ + public class WalletInfo + { + public string walletname { get; set; } + public int walletversion { get; set; } + public decimal balance { get; set; } + public double unconfirmed_balance { get; set; } + public double immature_balance { get; set; } + public long txcount { get; set; } + public long keypoololdest { get; set; } + public long keypoolsize { get; set; } + public long keypoolsize_hd_internal { get; set; } + public decimal paytxfee { get; set; } + public string hdmasterkeyid { get; set; } + } +}