From 43cf099f0c4f02954bcd29ba457958c65a968711 Mon Sep 17 00:00:00 2001 From: hugo Date: Thu, 3 Jun 2021 22:43:23 +0100 Subject: [PATCH] Implementing getVoteAccounts rpc method (#47) * Implementing getVoteAccounts rpc method --- src/Solnet.Examples/SolnetRpcTester.cs | 23 ++-- src/Solnet.Rpc/IRpcClient.cs | 32 ++++-- src/Solnet.Rpc/Models/VoteAccount.cs | 71 ++++++++++++ src/Solnet.Rpc/SolanaRpcClient.cs | 105 +++++++++++++----- .../Http/GetVoteAccountsRequest.json | 1 + .../Http/GetVoteAccountsResponse.json | 33 ++++++ test/Solnet.Rpc.Test/SolanaRpcClientTest.cs | 44 ++++++++ test/Solnet.Rpc.Test/Solnet.Rpc.Test.csproj | 6 + 8 files changed, 272 insertions(+), 43 deletions(-) create mode 100644 src/Solnet.Rpc/Models/VoteAccount.cs create mode 100644 test/Solnet.Rpc.Test/Resources/Http/GetVoteAccountsRequest.json create mode 100644 test/Solnet.Rpc.Test/Resources/Http/GetVoteAccountsResponse.json diff --git a/src/Solnet.Examples/SolnetRpcTester.cs b/src/Solnet.Examples/SolnetRpcTester.cs index e435f58f..a6a32b17 100644 --- a/src/Solnet.Examples/SolnetRpcTester.cs +++ b/src/Solnet.Examples/SolnetRpcTester.cs @@ -20,18 +20,23 @@ static void Main(string[] args) //var blockTime = c.GetBlockTime(78561320); - var cn = c.GetClusterNodes(); - var bh = c.GetBlockHeight(); - Console.WriteLine(bh.Result); - var identity = c.GetIdentity(); - Console.WriteLine(identity.Result.Identity); + //var cn = c.GetClusterNodes(); + //var bh = c.GetBlockHeight(); + //Console.WriteLine(bh.Result); + //var identity = c.GetIdentity(); + //Console.WriteLine(identity.Result.Identity); - var inflationGov = c.GetInflationGovernor(); - Console.WriteLine(inflationGov.Result.Terminal); + //var inflationGov = c.GetInflationGovernor(); + //Console.WriteLine(inflationGov.Result.Terminal); - var inflationRate = c.GetInflationRate(); - Console.WriteLine(inflationRate.Result.Total); + //var inflationRate = c.GetInflationRate(); + //Console.WriteLine(inflationRate.Result.Total); + var va = c.GetVoteAccounts(); + + Console.WriteLine(va.Result.Current.Length); + Console.WriteLine(va.Result.Delinquent.Length); + /* Large accounts for Token Mint PubKey var largeAccounts = c.GetTokenLargestAccounts("7ugkvt26sFjMdiFQFP5AQX8m8UkxWaW7rk2nBk4R6Gf2"); diff --git a/src/Solnet.Rpc/IRpcClient.cs b/src/Solnet.Rpc/IRpcClient.cs index 0a3c3c9e..0da55cb6 100644 --- a/src/Solnet.Rpc/IRpcClient.cs +++ b/src/Solnet.Rpc/IRpcClient.cs @@ -110,7 +110,7 @@ public interface IRpcClient /// RequestResult GetGenesisHash(); - + /// /// Gets the identity pubkey for the current node. /// @@ -119,7 +119,7 @@ public interface IRpcClient /// RequestResult GetIdentity(); - + /// /// Gets the current inflation governor. /// @@ -128,7 +128,7 @@ public interface IRpcClient /// RequestResult GetInflationGovernor(); - + /// /// Gets the specific inflation values for the current epoch. /// @@ -137,7 +137,7 @@ public interface IRpcClient /// RequestResult GetInflationRate(); - + /// /// Gets the inflation reward for a list of addresses for an epoch. /// @@ -223,6 +223,15 @@ RequestResult> GetTokenAccountsByOwner( /// RequestResult GetTransactionCount(); + /// + /// Gets the account info and associated stake for all voting accounts in the current bank. + /// + /// A task which may return a request result and information about the vote accounts. + Task> GetVoteAccountsAsync(); + + /// + RequestResult GetVoteAccounts(); + /// /// Gets the lowest slot that the node has information about in its ledger. /// @@ -245,10 +254,12 @@ RequestResult> GetTokenAccountsByOwner( /// The amount of lamports to request. /// The block commitment used to retrieve block hashes and verify success. /// A task which may return a request result and the transaction signature of the airdrop, as base-58 encoded string.. - Task> RequestAirdropAsync(string pubKey, ulong lamports, Commitment commitment = Commitment.Finalized); + Task> RequestAirdropAsync(string pubKey, ulong lamports, + Commitment commitment = Commitment.Finalized); /// - RequestResult RequestAirdrop(string pubKey, ulong lamports, Commitment commitment = Commitment.Finalized); + RequestResult RequestAirdrop(string pubKey, ulong lamports, + Commitment commitment = Commitment.Finalized); /// /// Sends a transaction. @@ -258,7 +269,8 @@ RequestResult> GetTokenAccountsByOwner( /// /// A task which may return a request result and the first transaction signature embedded in the transaction, as base-58 encoded string. /// - Task> SendTransactionAsync(string transaction, BinaryEncoding encoding = BinaryEncoding.Base64); + Task> SendTransactionAsync(string transaction, + BinaryEncoding encoding = BinaryEncoding.Base64); /// RequestResult SendTransaction(string transaction, BinaryEncoding encoding = BinaryEncoding.Base64); @@ -280,10 +292,12 @@ RequestResult> GetTokenAccountsByOwner( /// /// A task which may return a request result and the transaction status. /// - Task>> SimulateTransactionAsync(string transaction, BinaryEncoding encoding = BinaryEncoding.Base64); + Task>> SimulateTransactionAsync(string transaction, + BinaryEncoding encoding = BinaryEncoding.Base64); /// - RequestResult> SimulateTransaction(string transaction, BinaryEncoding encoding = BinaryEncoding.Base64); + RequestResult> SimulateTransaction(string transaction, + BinaryEncoding encoding = BinaryEncoding.Base64); /// /// Simulate sending a transaction. diff --git a/src/Solnet.Rpc/Models/VoteAccount.cs b/src/Solnet.Rpc/Models/VoteAccount.cs new file mode 100644 index 00000000..ff735e49 --- /dev/null +++ b/src/Solnet.Rpc/Models/VoteAccount.cs @@ -0,0 +1,71 @@ +using System.Text.Json.Serialization; + +namespace Solnet.Rpc.Models +{ + /// + /// Represents the account info and associated stake for all the voting accounts in the current bank. + /// + public class VoteAccount + { + /// + /// The root slot for this vote account. + /// + public ulong RootSlot { get; set; } + + /// + /// The vote account address, as a base-58 encoded string. + /// + [JsonPropertyName("votePubkey")] + public string VotePublicKey { get; set; } + + /// + /// The validator identity, as a base-58 encoded string. + /// + [JsonPropertyName("nodePubkey")] + public string NodePublicKey { get; set; } + + /// + /// The stake, in lamports, delegated to this vote account and active in this epoch. + /// + public ulong ActivatedStake { get; set; } + + /// + /// Whether the vote account is staked for this epoch. + /// + public bool EpochVoteAccount { get; set; } + + /// + /// Percentage of rewards payout owed to the vote account. + /// + public decimal Commission { get; set; } + + /// + /// Most recent slot voted on by this vote account. + /// + public ulong LastVote { get; set; } + + /// + /// History of how many credits earned by the end of the each epoch. + /// + /// Each array contains [epoch, credits, previousCredits]; + /// + /// + public ulong[][] EpochCredits { get; set; } + } + + /// + /// Represents the vote accounts. + /// + public class VoteAccounts + { + /// + /// Current vote accounts. + /// + public VoteAccount[] Current { get; set; } + + /// + /// Delinquent vote accounts. + /// + public VoteAccount[] Delinquent { get; set; } + } +} \ No newline at end of file diff --git a/src/Solnet.Rpc/SolanaRpcClient.cs b/src/Solnet.Rpc/SolanaRpcClient.cs index 5dddf674..5fc43cd5 100644 --- a/src/Solnet.Rpc/SolanaRpcClient.cs +++ b/src/Solnet.Rpc/SolanaRpcClient.cs @@ -27,11 +27,13 @@ public class SolanaRpcClient : JsonRpcClient, IRpcClient /// The url of the node exposing the JSON RPC API. /// The logger to use. /// An http client. - internal SolanaRpcClient(string url, ILogger logger, HttpClient httpClient = default) : base(url, logger, httpClient) + internal SolanaRpcClient(string url, ILogger logger, HttpClient httpClient = default) : base(url, logger, + httpClient) { } #region RequestBuilder + /// /// Build the request for the passed RPC method and parameters. /// @@ -77,7 +79,7 @@ private async Task> SendRequestAsync(string method, IListA task which may return a request result. private async Task> SendRequestAsync( string method, IList parameters, Dictionary configurationObject - ) + ) { var newList = parameters.ToList(); @@ -96,13 +98,14 @@ private async Task> SendRequestAsync( newList.Add(new Dictionary { - { key, value} + {key, value} }); } var req = BuildRequest(method, newList); return await SendRequest(req); } + #endregion /// @@ -114,7 +117,7 @@ public async Task>> GetAccountInfoAsync { return await SendRequestAsync>( "getAccountInfo", - new List { pubKey }, + new List {pubKey}, new Dictionary { { @@ -122,6 +125,7 @@ public async Task>> GetAccountInfoAsync } }); } + /// public RequestResult> GetAccountInfo(string pubKey) => GetAccountInfoAsync(pubKey).Result; @@ -133,8 +137,9 @@ public RequestResult> GetAccountInfo(string pubKey) /// A task which may return a request result holding the context and address balance. public async Task>> GetBalanceAsync(string pubKey) { - return await SendRequestAsync>("getBalance", new List { pubKey }); + return await SendRequestAsync>("getBalance", new List {pubKey}); } + /// public RequestResult> GetBalance(string pubKey) => GetBalanceAsync(pubKey).Result; @@ -147,6 +152,7 @@ public async Task> GetBlockHeightAsync() { return await SendRequestAsync("getBlockHeight"); } + /// public RequestResult GetBlockHeight() => GetBlockHeightAsync().Result; @@ -158,8 +164,9 @@ public RequestResult GetBlockHeight() /// A task which may return a request result and block commitment information. public async Task> GetBlockCommitmentAsync(ulong slot) { - return await SendRequestAsync("getBlockCommitment", new List { slot }); + return await SendRequestAsync("getBlockCommitment", new List {slot}); } + /// public RequestResult GetBlockCommitment(ulong slot) => GetBlockCommitmentAsync(slot).Result; @@ -171,8 +178,9 @@ public RequestResult GetBlockCommitment(ulong slot) /// A task which may return a request result and block production time as Unix timestamp (seconds since Epoch). public async Task> GetBlockTimeAsync(ulong slot) { - return await SendRequestAsync("getBlockTime", new List { slot }); + return await SendRequestAsync("getBlockTime", new List {slot}); } + /// public RequestResult GetBlockTime(ulong slot) => GetBlockTimeAsync(slot).Result; @@ -185,6 +193,7 @@ public async Task> GetClusterNodesAsync() { return await SendRequestAsync("getClusterNodes"); } + /// public RequestResult GetClusterNodes() => GetClusterNodesAsync().Result; @@ -195,8 +204,9 @@ public RequestResult GetClusterNodes() /// A task which may return a request result and information about the nodes participating in the cluster. public async Task> GetConfirmedBlockAsync(ulong slot) { - return await SendRequestAsync("getConfirmedBlock", new List { slot }); + return await SendRequestAsync("getConfirmedBlock", new List {slot}); } + /// public RequestResult GetConfirmedBlock(ulong slot) => GetConfirmedBlockAsync(slot).Result; @@ -209,6 +219,7 @@ public async Task>> GetRecentBlockHashAsy { return await SendRequestAsync>("getRecentBlockhash"); } + /// public RequestResult> GetRecentBlockHash() => GetRecentBlockHashAsync().Result; @@ -219,8 +230,10 @@ public RequestResult> GetRecentBlockHash() /// A task which may return a request result and the rent exemption value. public async Task> GetMinimumBalanceForRentExemptionAsync(long accountDataSize) { - return await SendRequestAsync("getMinimumBalanceForRentExemption", new List { accountDataSize }); + return await SendRequestAsync("getMinimumBalanceForRentExemption", + new List {accountDataSize}); } + /// public RequestResult GetMinimumBalanceForRentExemption(long accountDataSize) => GetMinimumBalanceForRentExemptionAsync(accountDataSize).Result; @@ -233,6 +246,7 @@ public async Task> GetGenesisHashAsync() { return await SendRequestAsync("getGenesisHash"); } + /// public RequestResult GetGenesisHash() => GetGenesisHashAsync().Result; @@ -245,6 +259,7 @@ public async Task> GetIdentityAsync() { return await SendRequestAsync("getIdentity"); } + /// public RequestResult GetIdentity() => GetIdentityAsync().Result; @@ -257,6 +272,7 @@ public async Task> GetInflationGovernorAsync() { return await SendRequestAsync("getInflationGovernor"); } + /// public RequestResult GetInflationGovernor() => GetInflationGovernorAsync().Result; @@ -281,8 +297,9 @@ public RequestResult GetInflationRate() public async Task> GetInflationRewardAsync(string[] addresses, ulong epoch = 0) { if (epoch != 0) - return await SendRequestAsync("getInflationReward", new List { addresses, epoch }); - return await SendRequestAsync("getInflationReward", new List { addresses }); + return await SendRequestAsync("getInflationReward", + new List {addresses, epoch}); + return await SendRequestAsync("getInflationReward", new List {addresses}); } /// @@ -299,6 +316,7 @@ public async Task>> GetSupplyAsync() { return await SendRequestAsync>("getSupply"); } + /// public RequestResult> GetSupply() => GetSupplyAsync().Result; @@ -308,10 +326,13 @@ public RequestResult> GetSupply() /// /// Public key of Token account to query, as base-58 encoded string. /// A task which may return a request result and information about largest accounts. - public async Task>> GetTokenAccountBalanceAsync(string splTokenAccountPublicKey) + public async Task>> GetTokenAccountBalanceAsync( + string splTokenAccountPublicKey) { - return await SendRequestAsync>("getTokenAccountBalance", new List { splTokenAccountPublicKey }); + return await SendRequestAsync>("getTokenAccountBalance", + new List {splTokenAccountPublicKey}); } + /// public RequestResult> GetTokenAccountBalance(string splTokenAccountPublicKey) => GetTokenAccountBalanceAsync(splTokenAccountPublicKey).Result; @@ -332,8 +353,10 @@ public async Task>> GetTokenAccounts if (!string.IsNullOrWhiteSpace(tokenMintPubKey)) options.Add("mint", tokenMintPubKey); if (!string.IsNullOrWhiteSpace(tokenProgramId)) options.Add("programId", tokenProgramId); return await SendRequestAsync>( - "getTokenAccountsByDelegate", new List { ownerPubKey, options, new Dictionary { { "encoding", "jsonParsed" } } }); + "getTokenAccountsByDelegate", + new List {ownerPubKey, options, new Dictionary {{"encoding", "jsonParsed"}}}); } + /// public RequestResult> GetTokenAccountsByDelegate( string ownerPubKey, string tokenMintPubKey = "", string tokenProgramId = "") @@ -355,8 +378,10 @@ public async Task>> GetTokenAccounts if (!string.IsNullOrWhiteSpace(tokenMintPubKey)) options.Add("mint", tokenMintPubKey); if (!string.IsNullOrWhiteSpace(tokenProgramId)) options.Add("programId", tokenProgramId); return await SendRequestAsync>( - "getTokenAccountsByOwner", new List { ownerPubKey, options, new Dictionary { { "encoding", "jsonParsed" } } }); + "getTokenAccountsByOwner", + new List {ownerPubKey, options, new Dictionary {{"encoding", "jsonParsed"}}}); } + /// public RequestResult> GetTokenAccountsByOwner( string ownerPubKey, string tokenMintPubKey = "", string tokenProgramId = "") @@ -367,10 +392,13 @@ public RequestResult> GetTokenAccountsByOwner( /// /// Public key of Token Mint to query, as base-58 encoded string. /// A task which may return a request result and information about largest accounts. - public async Task>> GetTokenLargestAccountsAsync(string tokenMintPubKey) + public async Task>> GetTokenLargestAccountsAsync( + string tokenMintPubKey) { - return await SendRequestAsync>("getTokenLargestAccounts", new List { tokenMintPubKey }); + return await SendRequestAsync>("getTokenLargestAccounts", + new List {tokenMintPubKey}); } + /// public RequestResult> GetTokenLargestAccounts(string tokenMintPubKey) => GetTokenLargestAccountsAsync(tokenMintPubKey).Result; @@ -382,8 +410,10 @@ public RequestResult> GetTokenLargestAccounts(stri /// A task which may return a request result and information about the supply. public async Task>> GetTokenSupplyAsync(string tokenMintPubKey) { - return await SendRequestAsync>("getTokenSupply", new List { tokenMintPubKey }); + return await SendRequestAsync>("getTokenSupply", + new List {tokenMintPubKey}); } + /// public RequestResult> GetTokenSupply(string tokenMintPubKey) => GetTokenSupplyAsync(tokenMintPubKey).Result; @@ -398,10 +428,24 @@ public async Task> GetTransactionCountAsync() { return await SendRequestAsync("getTransactionCount"); } + /// public RequestResult GetTransactionCount() => GetTransactionCountAsync().Result; + /// + /// Gets the account info and associated stake for all voting accounts in the current bank. + /// + /// A task which may return a request result and information about the vote accounts. + public async Task> GetVoteAccountsAsync() + { + return await SendRequestAsync("getVoteAccounts"); + } + + /// + public RequestResult GetVoteAccounts() + => GetVoteAccountsAsync().Result; + /// /// Gets the lowest slot that the node has information about in its ledger. /// @@ -413,6 +457,7 @@ public async Task> GetMinimumLedgerSlotAsync() { return await SendRequestAsync("minimumLedgerSlot"); } + /// public RequestResult GetMinimumLedgerSlot() => GetMinimumLedgerSlotAsync().Result; @@ -427,12 +472,15 @@ public RequestResult GetMinimumLedgerSlot() /// The amount of lamports to request. /// The block commitment used to retrieve block hashes and verify success. /// A task which may return a request result and the transaction signature of the airdrop, as base-58 encoded string.. - public async Task> RequestAirdropAsync(string pubKey, ulong lamports, Commitment commitment = Commitment.Finalized) + public async Task> RequestAirdropAsync(string pubKey, ulong lamports, + Commitment commitment = Commitment.Finalized) { - return await SendRequestAsync("requestAirdrop", new List { pubKey, lamports, commitment }); + return await SendRequestAsync("requestAirdrop", new List {pubKey, lamports, commitment}); } + /// - public RequestResult RequestAirdrop(string pubKey, ulong lamports, Commitment commitment = Commitment.Finalized) + public RequestResult RequestAirdrop(string pubKey, ulong lamports, + Commitment commitment = Commitment.Finalized) => RequestAirdropAsync(pubKey, lamports, commitment).Result; #region Transactions @@ -445,7 +493,8 @@ public RequestResult RequestAirdrop(string pubKey, ulong lamports, Commi /// /// A task which may return a request result and the first transaction signature embedded in the transaction, as base-58 encoded string. /// - public async Task> SendTransactionAsync(string transaction, BinaryEncoding encoding = BinaryEncoding.Base64) + public async Task> SendTransactionAsync(string transaction, + BinaryEncoding encoding = BinaryEncoding.Base64) { return await SendRequestAsync("sendTransaction", new List @@ -459,8 +508,10 @@ public async Task> SendTransactionAsync(string transaction } }); } + /// - public RequestResult SendTransaction(string transaction, BinaryEncoding encoding = BinaryEncoding.Base64) + public RequestResult SendTransaction(string transaction, + BinaryEncoding encoding = BinaryEncoding.Base64) => SendTransactionAsync(transaction, encoding).Result; /// @@ -481,7 +532,8 @@ public RequestResult SendTransaction(byte[] transaction) /// /// A task which may return a request result and the transaction status. /// - public async Task>> SimulateTransactionAsync(string transaction, BinaryEncoding encoding = BinaryEncoding.Base64) + public async Task>> SimulateTransactionAsync(string transaction, + BinaryEncoding encoding = BinaryEncoding.Base64) { return await SendRequestAsync>("simulateTransaction", new List @@ -494,9 +546,12 @@ public async Task>> SimulateTransact } }); } + /// - public RequestResult> SimulateTransaction(string transaction, BinaryEncoding encoding = BinaryEncoding.Base64) + public RequestResult> SimulateTransaction(string transaction, + BinaryEncoding encoding = BinaryEncoding.Base64) => SimulateTransactionAsync(transaction, encoding).Result; + /// /// Simulate sending a transaction. /// diff --git a/test/Solnet.Rpc.Test/Resources/Http/GetVoteAccountsRequest.json b/test/Solnet.Rpc.Test/Resources/Http/GetVoteAccountsRequest.json new file mode 100644 index 00000000..35ca5832 --- /dev/null +++ b/test/Solnet.Rpc.Test/Resources/Http/GetVoteAccountsRequest.json @@ -0,0 +1 @@ +{"method":"getVoteAccounts","jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/GetVoteAccountsResponse.json b/test/Solnet.Rpc.Test/Resources/Http/GetVoteAccountsResponse.json new file mode 100644 index 00000000..8d72a66f --- /dev/null +++ b/test/Solnet.Rpc.Test/Resources/Http/GetVoteAccountsResponse.json @@ -0,0 +1,33 @@ +{ + "jsonrpc": "2.0", + "result": { + "current": [ + { + "commission": 0, + "epochVoteAccount": true, + "epochCredits": [ + [ 1, 64, 0 ], + [ 2, 192, 64 ] + ], + "rootSlot": 81274518, + "nodePubkey": "B97CCUW3AEZFGy6uUg6zUdnNYvnVq5VG8PUtb2HayTDD", + "lastVote": 147, + "activatedStake": 42, + "votePubkey": "3ZT31jkAGhUaw8jsy4bTknwBMP8i4Eueh52By4zXcsVw" + } + ], + "delinquent": [ + { + "commission": 127, + "epochVoteAccount": false, + "epochCredits": [], + "rootSlot": 1234, + "nodePubkey": "6ZPxeQaDo4bkZLRsdNrCzchNQr5LN9QMc9sipXv9Kw8f", + "lastVote": 0, + "activatedStake": 0, + "votePubkey": "CmgCk4aMS7KW1SHX3s9K5tBJ6Yng2LBaC8MFov4wx9sm" + } + ] + }, + "id": 0 +} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/SolanaRpcClientTest.cs b/test/Solnet.Rpc.Test/SolanaRpcClientTest.cs index fac4e2c0..13527476 100644 --- a/test/Solnet.Rpc.Test/SolanaRpcClientTest.cs +++ b/test/Solnet.Rpc.Test/SolanaRpcClientTest.cs @@ -640,6 +640,50 @@ public void TestGetMinimumLedgerSlot() FinishTest(messageHandlerMock, TestnetUri); } + + [TestMethod] + public void TestGetVoteAccounts() + { + var responseData = File.ReadAllText("Resources/Http/GetVoteAccountsResponse.json"); + var requestData = File.ReadAllText("Resources/Http/GetVoteAccountsRequest.json"); + var sentMessage = string.Empty; + var messageHandlerMock = SetupTest( + (s => sentMessage = s), responseData); + + var httpClient = new HttpClient(messageHandlerMock.Object) + { + BaseAddress = TestnetUri, + }; + + var sut = new SolanaRpcClient(TestnetUrl, null, httpClient); + var result = sut.GetVoteAccounts(); + + Assert.AreEqual(requestData, sentMessage); + Assert.IsNotNull(result.Result); + Assert.IsTrue(result.WasSuccessful); + Assert.AreEqual(1, result.Result.Current.Length); + Assert.AreEqual(1, result.Result.Delinquent.Length); + + Assert.AreEqual(81274518UL, result.Result.Current[0].RootSlot); + Assert.AreEqual("3ZT31jkAGhUaw8jsy4bTknwBMP8i4Eueh52By4zXcsVw", result.Result.Current[0].VotePublicKey); + Assert.AreEqual("B97CCUW3AEZFGy6uUg6zUdnNYvnVq5VG8PUtb2HayTDD", result.Result.Current[0].NodePublicKey); + Assert.AreEqual(42UL, result.Result.Current[0].ActivatedStake); + Assert.AreEqual(0, result.Result.Current[0].Commission); + Assert.AreEqual(147UL, result.Result.Current[0].LastVote); + Assert.AreEqual(true, result.Result.Current[0].EpochVoteAccount); + Assert.AreEqual(2, result.Result.Current[0].EpochCredits.Length); + + Assert.AreEqual(1234UL, result.Result.Delinquent[0].RootSlot); + Assert.AreEqual("CmgCk4aMS7KW1SHX3s9K5tBJ6Yng2LBaC8MFov4wx9sm", result.Result.Delinquent[0].VotePublicKey); + Assert.AreEqual("6ZPxeQaDo4bkZLRsdNrCzchNQr5LN9QMc9sipXv9Kw8f", result.Result.Delinquent[0].NodePublicKey); + Assert.AreEqual(0UL, result.Result.Delinquent[0].ActivatedStake); + Assert.AreEqual(false, result.Result.Delinquent[0].EpochVoteAccount); + Assert.AreEqual(127UL, result.Result.Delinquent[0].Commission); + Assert.AreEqual(0UL, result.Result.Delinquent[0].LastVote); + Assert.AreEqual(0, result.Result.Delinquent[0].EpochCredits.Length); + + FinishTest(messageHandlerMock, TestnetUri); + } [TestMethod] public void TestGetTransactionCount() diff --git a/test/Solnet.Rpc.Test/Solnet.Rpc.Test.csproj b/test/Solnet.Rpc.Test/Solnet.Rpc.Test.csproj index 4560878e..29580ab1 100644 --- a/test/Solnet.Rpc.Test/Solnet.Rpc.Test.csproj +++ b/test/Solnet.Rpc.Test/Solnet.Rpc.Test.csproj @@ -228,6 +228,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest +