diff --git a/README.md b/README.md index f41328dc..5c3592f0 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ var fromAccount = wallet.GetAccount(0); // Get the destination account var toAccount = wallet.GetAccount(1); // Get a recent block hash to include in the transaction -var blockHash = rpcClient.GetRecentBlockHash(); +var blockHash = rpcClient.GetLatestBlockHash(); // Initialize a transaction builder and chain as many instructions as you want before building the message var tx = new TransactionBuilder(). @@ -228,7 +228,7 @@ var firstSig = rpcClient.SendTransaction(tx); ```c# var wallet = new Wallet.Wallet(MnemonicWords); -var blockHash = rpcClient.GetRecentBlockHash(); +var blockHash = rpcClient.GetLatestBlockHash(); var minBalanceForExemptionAcc = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.TokenAccountDataSize).Result; var minBalanceForExemptionMint =rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.MintAccountDataSize).Result; @@ -277,7 +277,7 @@ var tx = new TransactionBuilder(). var rpcClient = ClientFactory.GetClient(Cluster.MainNet); var wallet = new Wallet(); -var blockHash = rpcClient.GetRecentBlockHash(); +var blockHash = rpcClient.GetLatestBlockHash(); var minBalanceForExemptionAcc = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.TokenAccountDataSize).Result; diff --git a/src/Solnet.Examples/AssociatedTokenAccountsExample.cs b/src/Solnet.Examples/AssociatedTokenAccountsExample.cs index 49ad172d..e6f0d996 100644 --- a/src/Solnet.Examples/AssociatedTokenAccountsExample.cs +++ b/src/Solnet.Examples/AssociatedTokenAccountsExample.cs @@ -32,7 +32,7 @@ public void Run() #region Create and Initialize a token Mint Account - RequestResult> blockHash = RpcClient.GetRecentBlockHash(); + RequestResult> blockHash = RpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionAcc = RpcClient.GetMinimumBalanceForRentExemption(TokenProgram.TokenAccountDataSize).Result; diff --git a/src/Solnet.Examples/HelloWorldExample.cs b/src/Solnet.Examples/HelloWorldExample.cs index f8688700..cc978a6c 100644 --- a/src/Solnet.Examples/HelloWorldExample.cs +++ b/src/Solnet.Examples/HelloWorldExample.cs @@ -42,7 +42,7 @@ public void Run() var memoInstruction = MemoProgram.NewMemoV2("Hello Solana World, using Solnet :)"); - var recentHash = rpcClient.GetRecentBlockHash(); + var recentHash = rpcClient.GetLatestBlockHash(); var tx = new TransactionBuilder().AddInstruction(memoInstruction).SetFeePayer(wallet.Account) .SetRecentBlockHash(recentHash.Result.Value.Blockhash).Build(wallet.Account); diff --git a/src/Solnet.Examples/InstructionDecoderExample.cs b/src/Solnet.Examples/InstructionDecoderExample.cs index 46535031..39f416f6 100644 --- a/src/Solnet.Examples/InstructionDecoderExample.cs +++ b/src/Solnet.Examples/InstructionDecoderExample.cs @@ -25,7 +25,7 @@ public void Run() var fromAccount = wallet.GetAccount(10); var toAccount = wallet.GetAccount(8); - var blockHash = rpcClient.GetRecentBlockHash(); + var blockHash = rpcClient.GetLatestBlockHash(); Console.WriteLine($"BlockHash >> {blockHash.Result.Value.Blockhash}"); var msgBytes = new TransactionBuilder() diff --git a/src/Solnet.Examples/MultisigExamples.cs b/src/Solnet.Examples/MultisigExamples.cs index a25bfcb2..f5ba6d56 100644 --- a/src/Solnet.Examples/MultisigExamples.cs +++ b/src/Solnet.Examples/MultisigExamples.cs @@ -26,7 +26,7 @@ public void Run() { Wallet.Wallet wallet = new(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionMultiSig = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.MultisigAccountDataSize).Result; @@ -91,7 +91,7 @@ public void Run() string createMultiSigAndMintSignature = Examples.SubmitTxSendAndLog(txBytes); Examples.PollConfirmedTx(createMultiSigAndMintSignature); - blockHash = rpcClient.GetRecentBlockHash(); + blockHash = rpcClient.GetLatestBlockHash(); msgData = new TransactionBuilder().SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(ownerAccount) @@ -154,7 +154,7 @@ public void Run() { Wallet.Wallet wallet = new(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionMultiSig = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.MultisigAccountDataSize).Result; @@ -227,7 +227,7 @@ public void Run() { Wallet.Wallet wallet = new(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionMultiSig = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.MultisigAccountDataSize).Result; @@ -359,7 +359,7 @@ public void Run() { Wallet.Wallet wallet = new(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionMultiSig = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.MultisigAccountDataSize).Result; @@ -427,7 +427,7 @@ public void Run() string signature = Examples.SubmitTxSendAndLog(txBytes); Examples.PollConfirmedTx(signature); - blockHash = rpcClient.GetRecentBlockHash(); + blockHash = rpcClient.GetLatestBlockHash(); // Then we create an account which will be the token's mint authority @@ -479,7 +479,7 @@ public void Run() signature = Examples.SubmitTxSendAndLog(txBytes); Examples.PollConfirmedTx(signature); - blockHash = rpcClient.GetRecentBlockHash(); + blockHash = rpcClient.GetLatestBlockHash(); // Here we mint tokens to an account using the mint authority multi sig msgData = new TransactionBuilder().SetRecentBlockHash(blockHash.Result.Value.Blockhash) @@ -526,7 +526,7 @@ public void Run() signature = Examples.SubmitTxSendAndLog(txBytes); Examples.PollConfirmedTx(signature); - blockHash = rpcClient.GetRecentBlockHash(); + blockHash = rpcClient.GetLatestBlockHash(); // After doing this, we freeze the account to which we just minted tokens // Notice how the signers used are different, because the `freezeAuthority` has different signers @@ -563,7 +563,7 @@ public void Run() signature = Examples.SubmitTxSendAndLog(txBytes); Examples.PollConfirmedTx(signature); - blockHash = rpcClient.GetRecentBlockHash(); + blockHash = rpcClient.GetLatestBlockHash(); // Because we're actually cool people, we now thaw that same account and then set the authority to nothing msgData = new TransactionBuilder().SetRecentBlockHash(blockHash.Result.Value.Blockhash) @@ -627,7 +627,7 @@ public void Run() { Wallet.Wallet wallet = new(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionMultiSig = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.MultisigAccountDataSize).Result; @@ -703,7 +703,7 @@ public void Run() string signature = Examples.SubmitTxSendAndLog(txBytes); Examples.PollConfirmedTx(signature); - blockHash = rpcClient.GetRecentBlockHash(); + blockHash = rpcClient.GetLatestBlockHash(); msgData = new TransactionBuilder().SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(ownerAccount) @@ -749,7 +749,7 @@ public void Run() signature = Examples.SubmitTxSendAndLog(txBytes); Examples.PollConfirmedTx(signature); - blockHash = rpcClient.GetRecentBlockHash(); + blockHash = rpcClient.GetLatestBlockHash(); msgData = new TransactionBuilder().SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(ownerAccount) @@ -786,7 +786,7 @@ public void Run() signature = Examples.SubmitTxSendAndLog(txBytes); Examples.PollConfirmedTx(signature); - blockHash = rpcClient.GetRecentBlockHash(); + blockHash = rpcClient.GetLatestBlockHash(); msgData = new TransactionBuilder().SetRecentBlockHash(blockHash.Result.Value.Blockhash) @@ -845,7 +845,7 @@ public void Run() { Wallet.Wallet wallet = new(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionMultiSig = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.MultisigAccountDataSize).Result; @@ -946,7 +946,7 @@ public void Run() { Wallet.Wallet wallet = new(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionMultiSig = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.MultisigAccountDataSize).Result; diff --git a/src/Solnet.Examples/NameServiceProgramExamples.cs b/src/Solnet.Examples/NameServiceProgramExamples.cs index 3e5dda3e..4c7db345 100644 --- a/src/Solnet.Examples/NameServiceProgramExamples.cs +++ b/src/Solnet.Examples/NameServiceProgramExamples.cs @@ -52,7 +52,7 @@ public void Run() { var wallet = new Wallet.Wallet(MnemonicWords); - var blockHash = rpcClient.GetRecentBlockHash(); + var blockHash = rpcClient.GetLatestBlockHash(); var minBalanceForExemptionNameAcc = rpcClient.GetMinimumBalanceForRentExemption(NameServiceProgram.NameAccountSize + 96).Result; diff --git a/src/Solnet.Examples/StakeExample.cs b/src/Solnet.Examples/StakeExample.cs index 96a26c68..fcb70d69 100644 --- a/src/Solnet.Examples/StakeExample.cs +++ b/src/Solnet.Examples/StakeExample.cs @@ -28,7 +28,7 @@ public void Run() { var wallet = new Wallet.Wallet(new Mnemonic(MnemonicWords)); rpcClient.RequestAirdrop(wallet.Account.PublicKey, 100_000_000); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalance = rpcClient.GetMinimumBalanceForRentExemption(StakeProgram.StakeAccountDataSize).Result; Account fromAccount = wallet.Account; PublicKey.TryCreateWithSeed(fromAccount.PublicKey, "yrdy1", StakeProgram.ProgramIdKey, out PublicKey stakeAccount); @@ -68,7 +68,7 @@ public void Run() var b58 = new Base58Encoder(); string f = b58.EncodeData(seed); rpcClient.RequestAirdrop(wallet.Account.PublicKey, 100_000_000); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minbalanceforexception = rpcClient.GetMinimumBalanceForRentExemption(StakeProgram.StakeAccountDataSize).Result; Account fromAccount = wallet.Account; Account toAccount = wallet.GetAccount(1); @@ -109,7 +109,7 @@ public void Run() { var wallet = new Wallet.Wallet(new Mnemonic(MnemonicWords)); rpcClient.RequestAirdrop(wallet.Account.PublicKey, 100_000_000); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); Account fromAccount = wallet.Account; Account toAccount = wallet.GetAccount(1); @@ -146,7 +146,7 @@ public void Run() { var wallet = new Wallet.Wallet(new Mnemonic(MnemonicWords)); rpcClient.RequestAirdrop(wallet.Account.PublicKey, 100_000_000); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minbalanceforexception = rpcClient.GetMinimumBalanceForRentExemption(StakeProgram.StakeAccountDataSize).Result; Account fromAccount = wallet.Account; PublicKey.TryCreateWithSeed(fromAccount.PublicKey, "dog5", StakeProgram.ProgramIdKey, out PublicKey stakeAccount); @@ -201,7 +201,7 @@ public void Run() { var wallet = new Wallet.Wallet(new Mnemonic(MnemonicWords)); rpcClient.RequestAirdrop(wallet.Account.PublicKey, 100_000_000); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minbalanceforexception = rpcClient.GetMinimumBalanceForRentExemption(StakeProgram.StakeAccountDataSize).Result; Account fromAccount = wallet.Account; Account stakeAccount = wallet.GetAccount(22); @@ -254,7 +254,7 @@ public void Run() { var wallet = new Wallet.Wallet(new Mnemonic(MnemonicWords)); rpcClient.RequestAirdrop(wallet.Account.PublicKey, 100_000_000); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalance = rpcClient.GetMinimumBalanceForRentExemption(StakeProgram.StakeAccountDataSize).Result; Account a6 = wallet.GetAccount(6); diff --git a/src/Solnet.Examples/TokenSwapExample.cs b/src/Solnet.Examples/TokenSwapExample.cs index e04e9e59..65c2ade4 100644 --- a/src/Solnet.Examples/TokenSwapExample.cs +++ b/src/Solnet.Examples/TokenSwapExample.cs @@ -36,7 +36,7 @@ public void Run() var tokenBUserAccount = new Account(); //setup some mints and tokens owned by wallet - RequestResult> blockHash = RpcClient.GetRecentBlockHash(); + RequestResult> blockHash = RpcClient.GetLatestBlockHash(); var tx = new TransactionBuilder() .SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(wallet.Account) @@ -112,7 +112,7 @@ public void Run() var swapTokenBAccount = new Account(); //init the swap authority's token accounts - blockHash = RpcClient.GetRecentBlockHash(); + blockHash = RpcClient.GetLatestBlockHash(); tx = new TransactionBuilder() .SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(wallet.Account) @@ -161,7 +161,7 @@ public void Run() var poolFeeAccount = new Account(); //create the pool mint and the user and fee pool token accounts - blockHash = RpcClient.GetRecentBlockHash(); + blockHash = RpcClient.GetLatestBlockHash(); tx = new TransactionBuilder() .SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(wallet.Account) @@ -206,7 +206,7 @@ public void Run() Examples.PollConfirmedTx(txSig); //create the swap - blockHash = RpcClient.GetRecentBlockHash(); + blockHash = RpcClient.GetLatestBlockHash(); tx = new TransactionBuilder() .SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(wallet.Account) @@ -247,7 +247,7 @@ public void Run() Examples.PollConfirmedTx(txSig); //now a user can swap in the pool - blockHash = RpcClient.GetRecentBlockHash(); + blockHash = RpcClient.GetLatestBlockHash(); tx = new TransactionBuilder() .SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(wallet.Account) @@ -268,7 +268,7 @@ public void Run() Examples.PollConfirmedTx(txSig); //user can add liq - blockHash = RpcClient.GetRecentBlockHash(); + blockHash = RpcClient.GetLatestBlockHash(); tx = new TransactionBuilder() .SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(wallet.Account) @@ -289,7 +289,7 @@ public void Run() Examples.PollConfirmedTx(txSig); //user can remove liq - blockHash = RpcClient.GetRecentBlockHash(); + blockHash = RpcClient.GetLatestBlockHash(); tx = new TransactionBuilder() .SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(wallet.Account) @@ -311,7 +311,7 @@ public void Run() Examples.PollConfirmedTx(txSig); //user can deposit single - blockHash = RpcClient.GetRecentBlockHash(); + blockHash = RpcClient.GetLatestBlockHash(); tx = new TransactionBuilder() .SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(wallet.Account) @@ -330,7 +330,7 @@ public void Run() Examples.PollConfirmedTx(txSig); //user can withdraw single - blockHash = RpcClient.GetRecentBlockHash(); + blockHash = RpcClient.GetLatestBlockHash(); tx = new TransactionBuilder() .SetRecentBlockHash(blockHash.Result.Value.Blockhash) .SetFeePayer(wallet.Account) diff --git a/src/Solnet.Examples/TransactionBuilderExample.cs b/src/Solnet.Examples/TransactionBuilderExample.cs index 9f873d5c..5d3df97c 100644 --- a/src/Solnet.Examples/TransactionBuilderExample.cs +++ b/src/Solnet.Examples/TransactionBuilderExample.cs @@ -26,7 +26,7 @@ public void Run() Account fromAccount = wallet.GetAccount(10); Account toAccount = wallet.GetAccount(8); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); Console.WriteLine($"BlockHash >> {blockHash.Result.Value.Blockhash}"); byte[] tx = new TransactionBuilder() @@ -57,7 +57,7 @@ public void Run() { Wallet.Wallet wallet = new Wallet.Wallet(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionAcc = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.TokenAccountDataSize).Result; Console.WriteLine($"MinBalanceForRentExemption Account >> {minBalanceForExemptionAcc}"); @@ -127,7 +127,7 @@ public void Run() { Wallet.Wallet wallet = new Wallet.Wallet(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionAcc = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.TokenAccountDataSize).Result; Console.WriteLine($"MinBalanceForRentExemption Account >> {minBalanceForExemptionAcc}"); @@ -176,7 +176,7 @@ public void Run() { Wallet.Wallet wallet = new Wallet.Wallet(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionAcc = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.TokenAccountDataSize).Result; Console.WriteLine($"MinBalanceForRentExemption Account >> {minBalanceForExemptionAcc}"); @@ -232,7 +232,7 @@ public void Run() { Wallet.Wallet wallet = new Wallet.Wallet(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionAcc = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.TokenAccountDataSize).Result; Console.WriteLine($"MinBalanceForRentExemption Account >> {minBalanceForExemptionAcc}"); @@ -293,7 +293,7 @@ public void Run() { Wallet.Wallet wallet = new Wallet.Wallet(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionAcc = rpcClient.GetMinimumBalanceForRentExemption(NonceAccount.AccountDataSize).Result; @@ -398,7 +398,7 @@ public void Run() { Wallet.Wallet wallet = new(MnemonicWords); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionMultiSig = rpcClient.GetMinimumBalanceForRentExemption(TokenProgram.MultisigAccountDataSize).Result; @@ -452,7 +452,7 @@ public void Run() Account fromAccount = wallet.GetAccount(10); Account toAccount = wallet.GetAccount(8); - RequestResult> blockHash = rpcClient.GetRecentBlockHash(); + RequestResult> blockHash = rpcClient.GetLatestBlockHash(); Console.WriteLine($"BlockHash >> {blockHash.Result.Value.Blockhash}"); TransactionBuilder txBuilder = new TransactionBuilder() diff --git a/src/Solnet.Examples/TransactionDecodingExample.cs b/src/Solnet.Examples/TransactionDecodingExample.cs index 5a4f0824..2d27e920 100644 --- a/src/Solnet.Examples/TransactionDecodingExample.cs +++ b/src/Solnet.Examples/TransactionDecodingExample.cs @@ -26,7 +26,7 @@ public void Run() { var wallet = new Wallet.Wallet(MnemonicWords); - RequestResult> blockHash = RpcClient.GetRecentBlockHash(); + RequestResult> blockHash = RpcClient.GetLatestBlockHash(); ulong minBalanceForExemptionAcc = RpcClient.GetMinimumBalanceForRentExemption(TokenProgram.TokenAccountDataSize).Result; ulong minBalanceForExemptionMint = diff --git a/src/Solnet.Extensions/ITokenWalletRpcProxy.cs b/src/Solnet.Extensions/ITokenWalletRpcProxy.cs index cd171cb2..69880dc1 100644 --- a/src/Solnet.Extensions/ITokenWalletRpcProxy.cs +++ b/src/Solnet.Extensions/ITokenWalletRpcProxy.cs @@ -43,7 +43,7 @@ Task>>> GetTokenAccountsByOwnerAs /// /// The state commitment to consider when querying the ledger state. /// Returns a task that holds the asynchronous operation result and state. - Task>> GetRecentBlockHashAsync(Commitment commitment = Commitment.Finalized); + Task>> GetLatestBlockHashAsync(Commitment commitment = Commitment.Finalized); /// /// Sends a transaction. diff --git a/src/Solnet.Extensions/TokenMintResolver.cs b/src/Solnet.Extensions/TokenMintResolver.cs index c75ff115..6e8cab41 100644 --- a/src/Solnet.Extensions/TokenMintResolver.cs +++ b/src/Solnet.Extensions/TokenMintResolver.cs @@ -1,9 +1,7 @@ using Solnet.Extensions.TokenMint; using System; using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Text; +using System.Net.Http; using System.Text.Json; using System.Threading.Tasks; @@ -87,9 +85,9 @@ public static async Task LoadAsync() /// A task that will result in an instance of the TokenMintResolver populated with Solana token list definitions. public static async Task LoadAsync(string url) { - using (var wc = new WebClient()) + using (var wc = new HttpClient()) { - var json = await wc.DownloadStringTaskAsync(url); + var json = await wc.GetStringAsync(url); return ParseTokenList(json); } } diff --git a/src/Solnet.Extensions/TokenWallet.cs b/src/Solnet.Extensions/TokenWallet.cs index 6c114b92..91ec0be2 100644 --- a/src/Solnet.Extensions/TokenWallet.cs +++ b/src/Solnet.Extensions/TokenWallet.cs @@ -499,7 +499,7 @@ public async Task> SendAsync(TokenWalletAccount source, de TokenWallet destWallet = await TokenWallet.LoadAsync(RpcClient, MintResolver, destination); // get recent block hash - var blockHash = await RpcClient.GetRecentBlockHashAsync(); + var blockHash = await RpcClient.GetLatestBlockHashAsync(); // prepare transaction var builder = new TransactionBuilder(); diff --git a/src/Solnet.Extensions/TokenWalletRpcProxy.cs b/src/Solnet.Extensions/TokenWalletRpcProxy.cs index a6fe1960..56b8c45b 100644 --- a/src/Solnet.Extensions/TokenWalletRpcProxy.cs +++ b/src/Solnet.Extensions/TokenWalletRpcProxy.cs @@ -50,9 +50,9 @@ public async Task>> GetBalanceAsync(string pu /// /// The state commitment to consider when querying the ledger state. /// Returns a task that holds the asynchronous operation result and state. - public async Task>> GetRecentBlockHashAsync(Commitment commitment = Commitment.Finalized) + public async Task>> GetLatestBlockHashAsync(Commitment commitment = Commitment.Finalized) { - return await _client.GetRecentBlockHashAsync(commitment); + return await _client.GetLatestBlockHashAsync(commitment); } /// diff --git a/src/Solnet.KeyStore/Crypto/IRandomBytesGenerator.cs b/src/Solnet.KeyStore/Crypto/IRandomBytesGenerator.cs index 631f1923..f4c4370b 100644 --- a/src/Solnet.KeyStore/Crypto/IRandomBytesGenerator.cs +++ b/src/Solnet.KeyStore/Crypto/IRandomBytesGenerator.cs @@ -1,7 +1,10 @@ +#pragma warning disable CS1591 namespace Solnet.KeyStore.Crypto { public interface IRandomBytesGenerator { + + byte[] GenerateRandomInitializationVector(); byte[] GenerateRandomSalt(); } diff --git a/src/Solnet.KeyStore/Crypto/KeyStoreCrypto.cs b/src/Solnet.KeyStore/Crypto/KeyStoreCrypto.cs index 1ae0e800..aa8cb3a3 100644 --- a/src/Solnet.KeyStore/Crypto/KeyStoreCrypto.cs +++ b/src/Solnet.KeyStore/Crypto/KeyStoreCrypto.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Digests; using Org.BouncyCastle.Crypto.Generators; diff --git a/src/Solnet.KeyStore/Crypto/RandomBytesGenerator.cs b/src/Solnet.KeyStore/Crypto/RandomBytesGenerator.cs index 42be6cf0..6e68482e 100644 --- a/src/Solnet.KeyStore/Crypto/RandomBytesGenerator.cs +++ b/src/Solnet.KeyStore/Crypto/RandomBytesGenerator.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using Org.BouncyCastle.Security; namespace Solnet.KeyStore.Crypto diff --git a/src/Solnet.KeyStore/Crypto/Scrypt.cs b/src/Solnet.KeyStore/Crypto/Scrypt.cs index 1c7a0be9..78119192 100644 --- a/src/Solnet.KeyStore/Crypto/Scrypt.cs +++ b/src/Solnet.KeyStore/Crypto/Scrypt.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Digests; using Org.BouncyCastle.Crypto.Generators; diff --git a/src/Solnet.KeyStore/Exceptions/DecryptionException.cs b/src/Solnet.KeyStore/Exceptions/DecryptionException.cs index 6c879a87..fe3730c5 100644 --- a/src/Solnet.KeyStore/Exceptions/DecryptionException.cs +++ b/src/Solnet.KeyStore/Exceptions/DecryptionException.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using System; namespace Solnet.KeyStore.Exceptions diff --git a/src/Solnet.KeyStore/Exceptions/InvalidKdfException.cs b/src/Solnet.KeyStore/Exceptions/InvalidKdfException.cs index 2898eadc..81b4b877 100644 --- a/src/Solnet.KeyStore/Exceptions/InvalidKdfException.cs +++ b/src/Solnet.KeyStore/Exceptions/InvalidKdfException.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using System; namespace Solnet.KeyStore.Exceptions diff --git a/src/Solnet.KeyStore/Model/CipherParams.cs b/src/Solnet.KeyStore/Model/CipherParams.cs index 99efde12..9f433a30 100644 --- a/src/Solnet.KeyStore/Model/CipherParams.cs +++ b/src/Solnet.KeyStore/Model/CipherParams.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using System.Text.Json.Serialization; namespace Solnet.KeyStore.Model diff --git a/src/Solnet.KeyStore/Model/CryptoInfo.cs b/src/Solnet.KeyStore/Model/CryptoInfo.cs index f1c8231c..bd42417b 100644 --- a/src/Solnet.KeyStore/Model/CryptoInfo.cs +++ b/src/Solnet.KeyStore/Model/CryptoInfo.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using System.Text.Json.Serialization; namespace Solnet.KeyStore.Model diff --git a/src/Solnet.KeyStore/Model/KdfParams.cs b/src/Solnet.KeyStore/Model/KdfParams.cs index 72a20bde..047dbf41 100644 --- a/src/Solnet.KeyStore/Model/KdfParams.cs +++ b/src/Solnet.KeyStore/Model/KdfParams.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using System.Text.Json.Serialization; namespace Solnet.KeyStore.Model diff --git a/src/Solnet.KeyStore/Model/KdfType.cs b/src/Solnet.KeyStore/Model/KdfType.cs index 76172f5c..3a9fd26d 100644 --- a/src/Solnet.KeyStore/Model/KdfType.cs +++ b/src/Solnet.KeyStore/Model/KdfType.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 namespace Solnet.KeyStore.Model { public enum KdfType diff --git a/src/Solnet.KeyStore/Model/KeyStore.cs b/src/Solnet.KeyStore/Model/KeyStore.cs index 413c12f3..ef19bbcc 100644 --- a/src/Solnet.KeyStore/Model/KeyStore.cs +++ b/src/Solnet.KeyStore/Model/KeyStore.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using System.Text.Json.Serialization; namespace Solnet.KeyStore.Model diff --git a/src/Solnet.KeyStore/Model/Pbkdf2Params.cs b/src/Solnet.KeyStore/Model/Pbkdf2Params.cs index 7fcea6d6..8b3690d6 100644 --- a/src/Solnet.KeyStore/Model/Pbkdf2Params.cs +++ b/src/Solnet.KeyStore/Model/Pbkdf2Params.cs @@ -1,4 +1,4 @@ - +#pragma warning disable CS1591 using System.Text.Json.Serialization; namespace Solnet.KeyStore.Model diff --git a/src/Solnet.KeyStore/Model/ScryptParams.cs b/src/Solnet.KeyStore/Model/ScryptParams.cs index f037778f..fa6362a1 100644 --- a/src/Solnet.KeyStore/Model/ScryptParams.cs +++ b/src/Solnet.KeyStore/Model/ScryptParams.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using System.Text.Json.Serialization; namespace Solnet.KeyStore.Model diff --git a/src/Solnet.KeyStore/SecretKeyStoreService.cs b/src/Solnet.KeyStore/SecretKeyStoreService.cs index 82be9b8d..ceb242e9 100644 --- a/src/Solnet.KeyStore/SecretKeyStoreService.cs +++ b/src/Solnet.KeyStore/SecretKeyStoreService.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using Solnet.KeyStore.Model; using Solnet.KeyStore.Services; using System; diff --git a/src/Solnet.KeyStore/Serialization/JsonKeyStorePbkdf2Serializer.cs b/src/Solnet.KeyStore/Serialization/JsonKeyStorePbkdf2Serializer.cs index 229ee3d6..e8af1f12 100644 --- a/src/Solnet.KeyStore/Serialization/JsonKeyStorePbkdf2Serializer.cs +++ b/src/Solnet.KeyStore/Serialization/JsonKeyStorePbkdf2Serializer.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using Solnet.KeyStore.Model; namespace Solnet.KeyStore.Serialization diff --git a/src/Solnet.KeyStore/Serialization/JsonKeyStoreScryptSerializer.cs b/src/Solnet.KeyStore/Serialization/JsonKeyStoreScryptSerializer.cs index 68f59999..039d479b 100644 --- a/src/Solnet.KeyStore/Serialization/JsonKeyStoreScryptSerializer.cs +++ b/src/Solnet.KeyStore/Serialization/JsonKeyStoreScryptSerializer.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using Solnet.KeyStore.Model; namespace Solnet.KeyStore.Serialization diff --git a/src/Solnet.KeyStore/Services/ISecretKeyStore.cs b/src/Solnet.KeyStore/Services/ISecretKeyStore.cs index 81d57b41..7af75ebe 100644 --- a/src/Solnet.KeyStore/Services/ISecretKeyStore.cs +++ b/src/Solnet.KeyStore/Services/ISecretKeyStore.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using Solnet.KeyStore.Model; namespace Solnet.KeyStore.Services diff --git a/src/Solnet.KeyStore/Services/KeyStorePbkdf2Service.cs b/src/Solnet.KeyStore/Services/KeyStorePbkdf2Service.cs index ba15b7c1..ab7281cc 100644 --- a/src/Solnet.KeyStore/Services/KeyStorePbkdf2Service.cs +++ b/src/Solnet.KeyStore/Services/KeyStorePbkdf2Service.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using Solnet.KeyStore.Crypto; using Solnet.KeyStore.Model; using Solnet.KeyStore.Serialization; diff --git a/src/Solnet.KeyStore/Services/KeyStoreScryptService.cs b/src/Solnet.KeyStore/Services/KeyStoreScryptService.cs index af65f60a..3f9e73c5 100644 --- a/src/Solnet.KeyStore/Services/KeyStoreScryptService.cs +++ b/src/Solnet.KeyStore/Services/KeyStoreScryptService.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using Solnet.KeyStore.Crypto; using Solnet.KeyStore.Model; using Solnet.KeyStore.Serialization; diff --git a/src/Solnet.KeyStore/Services/KeyStoreServiceBase.cs b/src/Solnet.KeyStore/Services/KeyStoreServiceBase.cs index b682edac..918c5307 100644 --- a/src/Solnet.KeyStore/Services/KeyStoreServiceBase.cs +++ b/src/Solnet.KeyStore/Services/KeyStoreServiceBase.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using Solnet.KeyStore.Crypto; using Solnet.KeyStore.Model; using System; diff --git a/src/Solnet.KeyStore/Utils.cs b/src/Solnet.KeyStore/Utils.cs index f6f7a1de..e3a08c65 100644 --- a/src/Solnet.KeyStore/Utils.cs +++ b/src/Solnet.KeyStore/Utils.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS1591 using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Solnet.Programs/Abstract/BaseClient.cs b/src/Solnet.Programs/Abstract/BaseClient.cs index cd1b9828..9ca6a86b 100644 --- a/src/Solnet.Programs/Abstract/BaseClient.cs +++ b/src/Solnet.Programs/Abstract/BaseClient.cs @@ -167,17 +167,5 @@ protected async Task SubscribeAccount(string accountAddres return res; } - - /// - /// Confirms a transaction - same method as web3.js. - /// - /// The hash of the transaction. - /// The last valid block height of the blockhash used in the transaction. - /// The state commitment to consider when querying the ledger state. - /// Returns null if the transaction wasn't confirmed, otherwise returns the confirmation slot and possible transaction error. - public async Task> ConfirmTransaction(string hash, ulong validBlockHeight, Commitment commitment = Commitment.Finalized) - { - return await TransactionConfirmationUtils.ConfirmTransaction(this.RpcClient, this.StreamingRpcClient, hash, validBlockHeight, commitment); - } } } \ No newline at end of file diff --git a/src/Solnet.Programs/Abstract/TransactionalBaseClient.cs b/src/Solnet.Programs/Abstract/TransactionalBaseClient.cs index ab2091ef..e671ec32 100644 --- a/src/Solnet.Programs/Abstract/TransactionalBaseClient.cs +++ b/src/Solnet.Programs/Abstract/TransactionalBaseClient.cs @@ -57,7 +57,7 @@ protected async Task> SignAndSendTransaction(TransactionIn TransactionBuilder tb = new TransactionBuilder(); tb.AddInstruction(instruction); - var recentHash = await RpcClient.GetRecentBlockHashAsync(); + var recentHash = await RpcClient.GetLatestBlockHashAsync(); tb.SetRecentBlockHash(recentHash.Result.Value.Blockhash); tb.SetFeePayer(feePayer); diff --git a/src/Solnet.Programs/SysVars.cs b/src/Solnet.Programs/SysVars.cs index c12139f2..59c1f316 100644 --- a/src/Solnet.Programs/SysVars.cs +++ b/src/Solnet.Programs/SysVars.cs @@ -15,20 +15,31 @@ public static class SysVars /// /// The public key of the Recent Block Hashes System Variable. /// - public static readonly PublicKey - RecentBlockHashesKey = new("SysvarRecentB1ockHashes11111111111111111111"); + public static readonly PublicKey RecentBlockHashesKey = new("SysvarRecentB1ockHashes11111111111111111111"); /// /// The public key of the Rent System Variable. /// public static readonly PublicKey RentKey = new("SysvarRent111111111111111111111111111111111"); + /// /// The public key of the Clock System Variable. /// public static readonly PublicKey ClockKey = new("SysvarC1ock11111111111111111111111111111111"); + /// /// The public key of the Stake History System Variable. /// public static readonly PublicKey StakeHistoryKey = new("SysvarStakeHistory1111111111111111111111111"); + + /// + /// The public key of the Slot Hashes Systen Variable + /// + public static readonly PublicKey SlotHashesKey = new("SysvarS1otHashes111111111111111111111111111"); + + /// + /// The public key of the Instructions System Variable + /// + public static readonly PublicKey InstructionsKey = new("Sysvar1nstructions1111111111111111111111111"); } } diff --git a/src/Solnet.Rpc/Builders/VersionedMessageBuilder.cs b/src/Solnet.Rpc/Builders/VersionedMessageBuilder.cs index dcaa93de..3a1134a6 100644 --- a/src/Solnet.Rpc/Builders/VersionedMessageBuilder.cs +++ b/src/Solnet.Rpc/Builders/VersionedMessageBuilder.cs @@ -20,6 +20,9 @@ public class VersionedMessageBuilder : MessageBuilder /// Address Table Lookups /// public List AddressTableLookups { get; set; } + /// + /// Account Keys + /// public IList AccountKeys { get; internal set; } /// diff --git a/src/Solnet.Rpc/IRpcClient.cs b/src/Solnet.Rpc/IRpcClient.cs index 391b0c1c..7f626ed4 100644 --- a/src/Solnet.Rpc/IRpcClient.cs +++ b/src/Solnet.Rpc/IRpcClient.cs @@ -131,35 +131,11 @@ RequestResult> GetAccountInfo(string pubKey, Commitme /// The state commitment to consider when querying the ledger state. /// The level of transaction detail to return, see . /// Whether to populate the rewards array, the default includes rewards. + /// Transaction Version /// Returns a task that holds the asynchronous operation result and state. Task> GetBlockAsync(ulong slot, Commitment commitment = Commitment.Finalized, TransactionDetailsFilterType transactionDetails = TransactionDetailsFilterType.Full, bool blockRewards = false, int maxSupportedTransactionVersion = 0); - /// - /// Returns identity and transaction information about a confirmed block in the ledger. - /// - /// - /// The commitment parameter is optional, is not supported, - /// the default value is not sent. - /// - /// - /// The transactionDetails parameter is optional, the default value is not sent. - /// - /// - /// The blockRewards parameter is optional, the default value, false, is not sent. - /// - /// - /// - /// The slot. - /// The state commitment to consider when querying the ledger state. - /// The level of transaction detail to return, see . - /// Whether to populate the rewards array, the default includes rewards. - /// Max supported transaction version either LEGACY or 1 - /// Returns a task that holds the asynchronous operation result and state. - [Obsolete("Please use GetBlockAsync whenever possible instead. This method is expected to be removed in solana-core v1.8.")] - Task> GetConfirmedBlockAsync(ulong slot, Commitment commitment = Commitment.Finalized, - TransactionDetailsFilterType transactionDetails = TransactionDetailsFilterType.Full, bool blockRewards = false, int maxSupportedTransactionVersion = 0); - /// /// Returns identity and transaction information about a block in the ledger. /// @@ -184,31 +160,6 @@ Task> GetConfirmedBlockAsync(ulong slot, Commitment com RequestResult GetBlock(ulong slot, Commitment commitment = Commitment.Finalized, TransactionDetailsFilterType transactionDetails = TransactionDetailsFilterType.Full, bool blockRewards = false, int maxSupportedTransactionVersion = 0); - /// - /// Returns identity and transaction information about a confirmed block in the ledger. - /// - /// - /// The commitment parameter is optional, is not supported, - /// the default value is not sent. - /// - /// - /// The transactionDetails parameter is optional, the default value is not sent. - /// - /// - /// The blockRewards parameter is optional, the default value, false, is not sent. - /// - /// - /// - /// The slot. - /// The state commitment to consider when querying the ledger state. - /// The level of transaction detail to return, see . - /// Whether to populate the rewards array, the default includes rewards. - /// Max supported transaction version either LEGACY or 1 - /// Returns an object that wraps the result along with possible errors with the request. - [Obsolete("Please use GetBlock whenever possible instead. This method is expected to be removed in solana-core v1.8.")] - RequestResult GetConfirmedBlock(ulong slot, Commitment commitment = Commitment.Finalized, - TransactionDetailsFilterType transactionDetails = TransactionDetailsFilterType.Full, bool blockRewards = false, int maxSupportedTransactionVersion = 0); - /// /// Gets the block commitment of a certain block, identified by slot. /// @@ -275,22 +226,6 @@ RequestResult> GetBlockProduction(string iden Task>> GetBlocksAsync(ulong startSlot, ulong endSlot = 0, Commitment commitment = Commitment.Finalized); - /// - /// Returns a list of confirmed blocks between two slots. - /// - /// - /// - /// The commitment parameter is optional, is not supported, - /// the default value is not sent. - /// - /// - /// The start slot (inclusive). - /// The start slot (inclusive and optional). - /// The state commitment to consider when querying the ledger state. - /// Returns a task that holds the asynchronous operation result and state. - [Obsolete("Please use GetBlocksAsync whenever possible instead. This method is expected to be removed in solana-core v1.8.")] - Task>> GetConfirmedBlocksAsync(ulong startSlot, ulong endSlot = 0, Commitment commitment = Commitment.Finalized); - /// /// Returns a list of blocks between two slots. /// @@ -301,22 +236,6 @@ Task>> GetBlocksAsync(ulong startSlot, ulong endSlot = RequestResult> GetBlocks(ulong startSlot, ulong endSlot = 0, Commitment commitment = Commitment.Finalized); - /// - /// Returns a list of confirmed blocks between two slots. - /// - /// - /// - /// The commitment parameter is optional, is not supported, - /// the default value is not sent. - /// - /// - /// The start slot (inclusive). - /// The start slot (inclusive and optional). - /// The state commitment to consider when querying the ledger state. - /// Returns an object that wraps the result along with possible errors with the request. - [Obsolete("Please use GetBlocks whenever possible instead. This method is expected to be removed in solana-core v1.8.")] - RequestResult> GetConfirmedBlocks(ulong startSlot, ulong endSlot = 0, Commitment commitment = Commitment.Finalized); - /// /// Returns a list of confirmed blocks starting at the given slot. /// @@ -327,16 +246,6 @@ RequestResult> GetBlocks(ulong startSlot, ulong endSlot = 0, Task>> GetBlocksWithLimitAsync(ulong startSlot, ulong limit, Commitment commitment = Commitment.Finalized); - /// - /// Returns a list of confirmed blocks starting at the given slot. - /// - /// The start slot (inclusive). - /// The max number of blocks to return. - /// The state commitment to consider when querying the ledger state. - /// Returns a task that holds the asynchronous operation result and state. - [Obsolete("Please use GetBlocksWithLimitAsync whenever possible instead. This method is expected to be removed in solana-core v1.8.")] - Task>> GetConfirmedBlocksWithLimitAsync(ulong startSlot, - ulong limit, Commitment commitment = Commitment.Finalized); /// /// Returns a list of confirmed blocks starting at the given slot. @@ -348,17 +257,6 @@ Task>> GetConfirmedBlocksWithLimitAsync(ulong startSlo RequestResult> GetBlocksWithLimit(ulong startSlot, ulong limit, Commitment commitment = Commitment.Finalized); - /// - /// Returns a list of confirmed blocks starting at the given slot. - /// - /// The start slot (inclusive). - /// The max number of blocks to return. - /// The state commitment to consider when querying the ledger state. - /// Returns a task that holds the asynchronous operation result and state. - [Obsolete("Please use GetBlocksWithLimit whenever possible instead. This method is expected to be removed in solana-core v1.8.")] - RequestResult> GetConfirmedBlocksWithLimit(ulong startSlot, - ulong limit, Commitment commitment = Commitment.Finalized); - /// /// Gets the estimated production time for a certain block, identified by slot. /// @@ -411,52 +309,6 @@ RequestResult> GetConfirmedBlocksWithLimit(ulong startSlot, /// Returns an object that wraps the result along with possible errors with the request. RequestResult GetEpochSchedule(); - /// - /// Gets the fee calculator associated with the query blockhash, or null if the blockhash has expired. - /// - /// The blockhash to query, as base-58 encoded string. - /// The state commitment to consider when querying the ledger state. - /// Returns a task that holds the asynchronous operation result and state. - Task>> GetFeeCalculatorForBlockhashAsync( - string blockhash, Commitment commitment = Commitment.Finalized); - - /// - /// Gets the fee calculator associated with the query blockhash, or null if the blockhash has expired. - /// - /// The blockhash to query, as base-58 encoded string. - /// The state commitment to consider when querying the ledger state. - /// Returns an object that wraps the result along with possible errors with the request. - RequestResult> GetFeeCalculatorForBlockhash(string blockhash, - Commitment commitment = Commitment.Finalized); - - /// - /// Gets the fee rate governor information from the root bank. - /// - /// Returns a task that holds the asynchronous operation result and state. - Task>> GetFeeRateGovernorAsync(); - - /// - /// Gets the fee rate governor information from the root bank. - /// - /// Returns an object that wraps the result along with possible errors with the request. - RequestResult> GetFeeRateGovernor(); - - /// - /// Gets a recent block hash from the ledger, a fee schedule that can be used to compute the - /// cost of submitting a transaction using it, and the last slot in which the blockhash will be valid. - /// - /// The state commitment to consider when querying the ledger state. - /// Returns a task that holds the asynchronous operation result and state. - Task>> GetFeesAsync(Commitment commitment = Commitment.Finalized); - - /// - /// Gets a recent block hash from the ledger, a fee schedule that can be used to compute the - /// cost of submitting a transaction using it, and the last slot in which the blockhash will be valid. - /// - /// The state commitment to consider when querying the ledger state. - /// Returns an object that wraps the result along with possible errors with the request. - RequestResult> GetFees(Commitment commitment = Commitment.Finalized); - /// /// Get the fee the network will charge for a particular Message. /// @@ -713,22 +565,6 @@ Task>> GetProgramAccountsAsync(string pubKey, RequestResult> GetProgramAccounts(string pubKey, Commitment commitment = Commitment.Finalized, int? dataSize = null, IList memCmpList = null); - /// - /// Gets a recent block hash. - /// - /// The state commitment to consider when querying the ledger state. - /// Returns a task that holds the asynchronous operation result and state. - [Obsolete("DEPRECATED: Please use GetLatestBlockHashAsync instead. This method is expected to be removed in solana-core v2.0")] - Task>> GetRecentBlockHashAsync(Commitment commitment = Commitment.Finalized); - - /// - /// Gets a recent block hash. - /// - /// The state commitment to consider when querying the ledger state. - /// Returns an object that wraps the result along with possible errors with the request. - [Obsolete("DEPRECATED: Please use GetLatestBlockHash instead. This method is expected to be removed in solana-core v2.0")] - RequestResult> GetRecentBlockHash(Commitment commitment = Commitment.Finalized); - /// /// Gets the latest block hash. /// @@ -794,22 +630,6 @@ RequestResult> GetProgramAccounts(string pubKey, Commitment Task>> GetSignaturesForAddressAsync(string accountPubKey, ulong limit = 1000, string before = null, string until = null, Commitment commitment = Commitment.Finalized); - /// - /// Gets confirmed signatures for transactions involving the address. - /// - /// Unless searchTransactionHistory is included, this method only searches the recent status cache of signatures. - /// - /// - /// The account address as base-58 encoded string. - /// Maximum transaction signatures to return, between 1-1000. Default is 1000. - /// Start searching backwards from this transaction signature. - /// Search until this transaction signature, if found before limit is reached. - /// The state commitment to consider when querying the ledger state. - /// Returns a task that holds the asynchronous operation result and state. - [Obsolete("Please use GetSignaturesForAddressAsync whenever possible instead. This method is expected to be removed in solana-core v1.8.")] - Task>> GetConfirmedSignaturesForAddress2Async(string accountPubKey, ulong limit = 1000, - string before = null, string until = null, Commitment commitment = Commitment.Finalized); - /// /// Gets signatures with the given commitment for transactions involving the address. /// @@ -825,21 +645,6 @@ Task>> GetConfirmedSignaturesForAddress2 RequestResult> GetSignaturesForAddress(string accountPubKey, ulong limit = 1000, string before = null, string until = null, Commitment commitment = Commitment.Finalized); - /// - /// Gets confirmed signatures for transactions involving the address. - /// - /// Unless searchTransactionHistory is included, this method only searches the recent status cache of signatures. - /// - /// - /// The account address as base-58 encoded string. - /// Maximum transaction signatures to return, between 1-1000. Default is 1000. - /// Start searching backwards from this transaction signature. - /// Search until this transaction signature, if found before limit is reached. - /// The state commitment to consider when querying the ledger state. - /// Returns an object that wraps the result along with possible errors with the request. - [Obsolete("Please use GetSignaturesForAddress whenever possible instead. This method is expected to be removed in solana-core v1.8.")] - RequestResult> GetConfirmedSignaturesForAddress2(string accountPubKey, ulong limit = 1000, - string before = null, string until = null, Commitment commitment = Commitment.Finalized); /// /// Gets the status of a list of signatures. @@ -912,18 +717,6 @@ Task>> GetSlotLeadersAsync(ulong start, ulong limit, /// Returns an object that wraps the result along with possible errors with the request. RequestResult> GetSlotLeaders(ulong start, ulong limit, Commitment commitment = Commitment.Finalized); - /// - /// Gets the highest slot that the node has a snapshot for. - /// - /// Returns a task that holds the asynchronous operation result and state. - Task> GetSnapshotSlotAsync(); - - /// - /// Gets the highest slot that the node has a snapshot for. - /// - /// Returns an object that wraps the result along with possible errors with the request. - RequestResult GetSnapshotSlot(); - /// /// Gets the highest slot that the node has a snapshot for. /// @@ -936,26 +729,6 @@ Task>> GetSlotLeadersAsync(ulong start, ulong limit, /// Returns an object that wraps the result along with possible errors with the request. RequestResult GetHighestSnapshotSlot(); - /// - /// Gets the epoch activation information for a stake account. - /// - /// Public key of account to query, as base-58 encoded string - /// Epoch for which to calculate activation details. - /// The state commitment to consider when querying the ledger state. - /// Returns a task that holds the asynchronous operation result and state. - Task> GetStakeActivationAsync(string publicKey, ulong epoch = 0, - Commitment commitment = Commitment.Finalized); - - /// - /// Gets the epoch activation information for a stake account. - /// - /// Public key of account to query, as base-58 encoded string - /// Epoch for which to calculate activation details. - /// The state commitment to consider when querying the ledger state. - /// Returns an object that wraps the result along with possible errors with the request. - RequestResult GetStakeActivation(string publicKey, ulong epoch = 0, - Commitment commitment = Commitment.Finalized); - /// /// Gets information about the current supply. /// @@ -1083,22 +856,6 @@ Task>> GetTokenSupplyAsync(string toke Task> GetTransactionAsync(string signature, Commitment commitment = Commitment.Finalized, int maxSupportedTransactionVersion = 0); - /// - /// Returns transaction details for a confirmed transaction. - /// - /// - /// The commitment parameter is optional, is not supported, - /// the default value is not sent. - /// - /// - /// - /// Transaction signature as base-58 encoded string. - /// The state commitment to consider when querying the ledger state. - /// Max supported transaction version either LEGACY or 1 - /// Returns an object that wraps the result along with possible errors with the request. - [Obsolete("Please use GetTransactionAsync whenever possible instead. This method is expected to be removed in solana-core v1.8.")] - Task> GetConfirmedTransactionAsync(string signature, Commitment commitment = Commitment.Finalized, int maxSupportedTransactionVersion = 0); - /// /// Returns transaction details for a confirmed transaction. /// @@ -1114,22 +871,6 @@ Task> GetTransactionAsync(string signatur /// Returns an object that wraps the result along with possible errors with the request. RequestResult GetTransaction(string signature, Commitment commitment = Commitment.Finalized, int maxSupportedTransactionVersion = 0); - /// - /// Returns transaction details for a confirmed transaction. - /// - /// - /// The commitment parameter is optional, is not supported, - /// the default value is not sent. - /// - /// - /// - /// Transaction signature as base-58 encoded string. - /// The state commitment to consider when querying the ledger state. - /// Max supported transaction version either LEGACY or 1 - /// Returns an object that wraps the result along with possible errors with the request. - [Obsolete("Please use GetTransaction whenever possible instead. This method is expected to be removed in solana-core v1.8.")] - RequestResult GetConfirmedTransaction(string signature, Commitment commitment = Commitment.Finalized, int maxSupportedTransactionVersion = 0); - /// /// Gets the total transaction count of the ledger. /// diff --git a/src/Solnet.Rpc/IStreamingRpcClient.cs b/src/Solnet.Rpc/IStreamingRpcClient.cs index 3a1ccbb1..fd938ac5 100644 --- a/src/Solnet.Rpc/IStreamingRpcClient.cs +++ b/src/Solnet.Rpc/IStreamingRpcClient.cs @@ -167,13 +167,12 @@ SubscriptionState SubscribeSignature(string transactionSignature, Action /// Subscribes asynchronously to changes to a given program account data. /// - /// - /// The commitment parameter is optional, the default value is not sent. - /// - /// The program pubkey. - /// The callback to handle data notifications. - /// The state commitment to consider when querying the ledger state. - /// The task object representing the asynchronous operation. + /// + /// + /// + /// + /// + /// Task SubscribeProgramAsync(string programPubkey, Action> callback, Commitment commitment = Commitment.Finalized, int? dataSize = null, IList memCmpList = null); @@ -186,6 +185,8 @@ Task SubscribeProgramAsync(string programPubkey, ActionThe program pubkey. /// The callback to handle data notifications. /// The state commitment to consider when querying the ledger state. + /// + /// /// Returns an object representing the state of the subscription. SubscriptionState SubscribeProgram(string programPubkey, Action> callback, Commitment commitment = Commitment.Finalized, int? dataSize = null, IList memCmpList = null); diff --git a/src/Solnet.Rpc/Models/Message.cs b/src/Solnet.Rpc/Models/Message.cs index f4a2cd35..8ac5e540 100644 --- a/src/Solnet.Rpc/Models/Message.cs +++ b/src/Solnet.Rpc/Models/Message.cs @@ -251,6 +251,9 @@ public static Message Deserialize(string data) return Deserialize(decodedBytes); } + /// + /// Versioned Message + /// public class VersionedMessage : Message { /// diff --git a/src/Solnet.Rpc/SolanaRpcBatchWithCallbacks.cs b/src/Solnet.Rpc/SolanaRpcBatchWithCallbacks.cs index 72328f70..df4a6d22 100644 --- a/src/Solnet.Rpc/SolanaRpcBatchWithCallbacks.cs +++ b/src/Solnet.Rpc/SolanaRpcBatchWithCallbacks.cs @@ -134,40 +134,6 @@ public void GetSignaturesForAddress(string accountPubKey, ulong limit = 1000, _composer.AddRequest("getSignaturesForAddress", parameters, callback); } - - /// - /// Gets confirmed signatures for transactions involving the address. - /// - /// Unless searchTransactionHistory is included, this method only searches the recent status cache of signatures. - /// - /// - /// The account address as base-58 encoded string. - /// Maximum transaction signatures to return, between 1-1000. Default is 1000. - /// Start searching backwards from this transaction signature. - /// Search until this transaction signature, if found before limit is reached. - /// The state commitment to consider when querying the ledger state. - /// The callback to handle the result. - [Obsolete("Please use GetSignaturesForAddressAsync whenever possible instead. This method is expected to be removed in solana-core v1.8.")] - public void GetConfirmedSignaturesForAddress2(string accountPubKey, ulong limit = 1000, - string before = null, string until = null, - Commitment commitment = Commitment.Finalized, - Action, Exception> callback = null) - { - if (commitment == Commitment.Processed) - throw new ArgumentException("Commitment.Processed is not supported for this method."); - - var parameters = Parameters.Create( - accountPubKey, - ConfigObject.Create( - KeyValue.Create("limit", limit != 1000 ? limit : null), - KeyValue.Create("before", before), - KeyValue.Create("until", until), - HandleCommitment(commitment))); - - _composer.AddRequest("getConfirmedSignaturesForAddress2", parameters, callback); - } - - /// /// Returns all accounts owned by the provided program Pubkey. /// Accounts must meet all filter criteria to be included in the results. diff --git a/src/Solnet.Rpc/SolanaRpcClient.cs b/src/Solnet.Rpc/SolanaRpcClient.cs index af53de30..20d8970a 100644 --- a/src/Solnet.Rpc/SolanaRpcClient.cs +++ b/src/Solnet.Rpc/SolanaRpcClient.cs @@ -248,80 +248,17 @@ public async Task>> GetBlocksAsync(ulong startSlot, ul ConfigObject.Create(HandleCommitment(commitment)))); } - /// - public async Task> GetConfirmedBlockAsync(ulong slot, - Commitment commitment = Commitment.Finalized, - TransactionDetailsFilterType transactionDetails = TransactionDetailsFilterType.Full, - bool blockRewards = false, int maxSupportedTransactionVersion = 0) - { - if (commitment == Commitment.Processed) - { - throw new ArgumentException("Commitment.Processed is not supported for this method."); - } - - return await SendRequestAsync("getConfirmedBlock", - Parameters.Create(slot, ConfigObject.Create( - KeyValue.Create("encoding", "json"), - KeyValue.Create("maxSupportedTransactionVersion", maxSupportedTransactionVersion), - HandleTransactionDetails(transactionDetails), - KeyValue.Create("rewards", blockRewards ? blockRewards : null), - HandleCommitment(commitment)))); - } - - /// - public RequestResult GetConfirmedBlock(ulong slot, Commitment commitment = Commitment.Finalized, - TransactionDetailsFilterType transactionDetails = TransactionDetailsFilterType.Full, - bool blockRewards = false, int maxSupportedTransactionVersion = 0) - => GetConfirmedBlockAsync(slot, commitment, transactionDetails, blockRewards).Result; - /// public RequestResult> GetBlocks(ulong startSlot, ulong endSlot = 0, Commitment commitment = Commitment.Finalized) => GetBlocksAsync(startSlot, endSlot, commitment).Result; - /// - public async Task>> GetConfirmedBlocksAsync(ulong startSlot, ulong endSlot = 0, - Commitment commitment = Commitment.Finalized) - { - if (commitment == Commitment.Processed) - { - throw new ArgumentException("Commitment.Processed is not supported for this method."); - } - - return await SendRequestAsync>("getConfirmedBlocks", - Parameters.Create(startSlot, endSlot > 0 ? endSlot : null, - ConfigObject.Create(HandleCommitment(commitment)))); - } - - /// - public RequestResult> GetConfirmedBlocks(ulong startSlot, ulong endSlot = 0, - Commitment commitment = Commitment.Finalized) - => GetConfirmedBlocksAsync(startSlot, endSlot, commitment).Result; - - /// - public async Task>> GetConfirmedBlocksWithLimitAsync(ulong startSlot, ulong limit, - Commitment commitment = Commitment.Finalized) - { - if (commitment == Commitment.Processed) - { - throw new ArgumentException("Commitment.Processed is not supported for this method."); - } - - return await SendRequestAsync>("getConfirmedBlocksWithLimit", - Parameters.Create(startSlot, limit, ConfigObject.Create(HandleCommitment(commitment)))); - } - /// public RequestResult> GetBlocksWithLimit(ulong startSlot, ulong limit, Commitment commitment = Commitment.Finalized) => GetBlocksWithLimitAsync(startSlot, limit, commitment).Result; - /// - public RequestResult> GetConfirmedBlocksWithLimit(ulong startSlot, ulong limit, - Commitment commitment = Commitment.Finalized) - => GetConfirmedBlocksWithLimitAsync(startSlot, limit, commitment).Result; - /// public async Task>> GetBlocksWithLimitAsync(ulong startSlot, ulong limit, Commitment commitment = Commitment.Finalized) @@ -434,25 +371,12 @@ public async Task> GetTransactionAsync(st ConfigObject.Create(KeyValue.Create("encoding", "json"), HandleCommitment(commitment), KeyValue.Create("maxSupportedTransactionVersion", maxSupportedTransactionVersion)))); } - /// - public async Task> GetConfirmedTransactionAsync(string signature, - Commitment commitment = Commitment.Finalized, int maxSupportedTransactionVersion = 0) - { - return await SendRequestAsync("getConfirmedTransaction", - Parameters.Create(signature, - ConfigObject.Create(KeyValue.Create("encoding", "json"), HandleCommitment(commitment), KeyValue.Create("maxSupportedTransactionVersion", maxSupportedTransactionVersion)))); - } - /// public RequestResult GetTransaction(string signature, Commitment commitment = Commitment.Finalized, int maxSupportedTransactionVersion = 0) => GetTransactionAsync(signature, commitment, maxSupportedTransactionVersion).Result; - /// - public RequestResult GetConfirmedTransaction(string signature, - Commitment commitment = Commitment.Finalized, int maxSupportedTransactionVersion = 0) => - GetConfirmedTransactionAsync(signature, commitment, maxSupportedTransactionVersion).Result; - + /// public async Task> GetBlockHeightAsync(Commitment commitment = Commitment.Finalized) { @@ -513,43 +437,6 @@ public async Task> GetEpochScheduleAsync() /// public RequestResult GetEpochSchedule() => GetEpochScheduleAsync().Result; - - - /// - public async Task>> GetFeeCalculatorForBlockhashAsync( - string blockhash, Commitment commitment = Commitment.Finalized) - { - List parameters = Parameters.Create(blockhash, ConfigObject.Create(HandleCommitment(commitment))); - - return await SendRequestAsync>("getFeeCalculatorForBlockhash", parameters); - } - - /// - public RequestResult> GetFeeCalculatorForBlockhash(string blockhash, - Commitment commitment = Commitment.Finalized) => - GetFeeCalculatorForBlockhashAsync(blockhash, commitment).Result; - - /// - public async Task>> GetFeeRateGovernorAsync() - { - return await SendRequestAsync>("getFeeRateGovernor"); - } - - /// - public RequestResult> GetFeeRateGovernor() - => GetFeeRateGovernorAsync().Result; - - /// - public async Task>> GetFeesAsync( - Commitment commitment = Commitment.Finalized) - { - return await SendRequestAsync>("getFees", - Parameters.Create(ConfigObject.Create(HandleCommitment(commitment)))); - } - - /// - public RequestResult> GetFees(Commitment commitment = Commitment.Finalized) - => GetFeesAsync(commitment).Result; /// public async Task>> GetFeeForMessageAsync( @@ -564,14 +451,6 @@ public RequestResult> GetFeeForMessage(string message, Commitment commitment = Commitment.Finalized) => GetFeeForMessageAsync(message, commitment).Result; - /// - public async Task>> GetRecentBlockHashAsync( - Commitment commitment = Commitment.Finalized) - { - return await SendRequestAsync>("getRecentBlockhash", - Parameters.Create(ConfigObject.Create(HandleCommitment(commitment)))); - } - /// public RequestResult> GetLatestBlockHash(Commitment commitment = Commitment.Finalized) => GetLatestBlockHashAsync(commitment).Result; @@ -595,10 +474,6 @@ public async Task>> IsBlockHashValidAsync(stri public RequestResult> IsBlockHashValid(string blockHash, Commitment commitment = Commitment.Finalized) => IsBlockHashValidAsync(blockHash, commitment).Result; - /// - public RequestResult> GetRecentBlockHash(Commitment commitment = Commitment.Finalized) - => GetRecentBlockHashAsync(commitment).Result; - /// public async Task> GetMaxRetransmitSlotAsync() { @@ -708,15 +583,6 @@ public RequestResult>> GetLargestAccounts(Accou Commitment commitment = Commitment.Finalized) => GetLargestAccountsAsync(filter, commitment).Result; - /// - public async Task> GetSnapshotSlotAsync() - { - return await SendRequestAsync("getSnapshotSlot"); - } - - /// - public RequestResult GetSnapshotSlot() => GetSnapshotSlotAsync().Result; - /// public async Task> GetHighestSnapshotSlotAsync() { @@ -754,36 +620,12 @@ public async Task>> GetSignaturesForAddr HandleCommitment(commitment)))); } - /// - public async Task>> GetConfirmedSignaturesForAddress2Async( - string accountPubKey, ulong limit = 1000, string before = null, string until = null, - Commitment commitment = Commitment.Finalized) - { - if (commitment == Commitment.Processed) - throw new ArgumentException("Commitment.Processed is not supported for this method."); - - return await SendRequestAsync>("getConfirmedSignaturesForAddress2", - Parameters.Create( - accountPubKey, - ConfigObject.Create( - KeyValue.Create("limit", limit != 1000 ? limit : null), - KeyValue.Create("before", before), - KeyValue.Create("until", until), - HandleCommitment(commitment)))); - } - /// public RequestResult> GetSignaturesForAddress(string accountPubKey, ulong limit = 1000, string before = null, string until = null, Commitment commitment = Commitment.Finalized) => GetSignaturesForAddressAsync(accountPubKey, limit, before, until, commitment).Result; - /// - public RequestResult> GetConfirmedSignaturesForAddress2(string accountPubKey, - ulong limit = 1000, string before = null, - string until = null, Commitment commitment = Commitment.Finalized) - => GetConfirmedSignaturesForAddress2Async(accountPubKey, limit, before, until, commitment).Result; - /// public async Task>>> GetSignatureStatusesAsync( List transactionHashes, @@ -840,23 +682,6 @@ public RequestResult> GetSlotLeaders(ulong start, ulong limit, #region Token Supply and Balances - /// - public async Task> GetStakeActivationAsync(string publicKey, ulong epoch = 0, - Commitment commitment = Commitment.Finalized) - { - return await SendRequestAsync("getStakeActivation", - Parameters.Create( - publicKey, - ConfigObject.Create( - HandleCommitment(commitment), - KeyValue.Create("epoch", epoch > 0 ? epoch : null)))); - } - - /// - public RequestResult GetStakeActivation(string publicKey, ulong epoch = 0, - Commitment commitment = Commitment.Finalized) => - GetStakeActivationAsync(publicKey, epoch, commitment).Result; - /// public async Task>> GetSupplyAsync( Commitment commitment = Commitment.Finalized) diff --git a/src/Solnet.Rpc/SolanaStreamingRpcClient.cs b/src/Solnet.Rpc/SolanaStreamingRpcClient.cs index 02ba191d..f31a0aec 100644 --- a/src/Solnet.Rpc/SolanaStreamingRpcClient.cs +++ b/src/Solnet.Rpc/SolanaStreamingRpcClient.cs @@ -441,7 +441,15 @@ public SubscriptionState SubscribeSignature(string transactionSignature, Action< #endregion #region Program - /// + /// + /// Subscribe Program + /// + /// + /// + /// + /// + /// + /// public async Task SubscribeProgramAsync(string programPubkey, Action> callback, Commitment commitment = Commitment.Finalized, int? dataSize = null, IList memCmpList = null) @@ -468,7 +476,15 @@ public async Task SubscribeProgramAsync(string programPubkey, return await Subscribe(sub, msg).ConfigureAwait(false); } - /// + /// + /// Subscribe Program + /// + /// + /// + /// + /// + /// + /// public SubscriptionState SubscribeProgram(string programPubkey, Action> callback, Commitment commitment = Commitment.Finalized, int? dataSize = null, IList memCmpList = null) => SubscribeProgramAsync(programPubkey, callback, commitment, dataSize, memCmpList).Result; diff --git a/src/Solnet.Rpc/TransactionUtils.cs b/src/Solnet.Rpc/TransactionUtils.cs deleted file mode 100644 index 55fa1f64..00000000 --- a/src/Solnet.Rpc/TransactionUtils.cs +++ /dev/null @@ -1,95 +0,0 @@ -using Solnet.Rpc.Messages; -using Solnet.Rpc.Models; -using Solnet.Rpc.Types; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Solnet.Rpc -{ - /// - /// Utilities to check transaction confirmation status. - /// - public static class TransactionConfirmationUtils - { - /// - /// Confirms a transaction - same method as web3.js. - /// - /// The rpc client instance. - /// The streaming rpc client instance. - /// The hash of the transaction. - /// The last valid block height of the blockhash used in the transaction. - /// The state commitment to consider when querying the ledger state. - /// Returns null if the transaction wasn't confirmed, otherwise returns the confirmation slot and possible transaction error. - public static async Task> ConfirmTransaction(IRpcClient rpc, IStreamingRpcClient streamingRpcClient, - string hash, ulong validBlockHeight, Commitment commitment = Commitment.Finalized) - { - TaskCompletionSource t = new(); - ResponseValue result = null; - - var s = await streamingRpcClient.SubscribeSignatureAsync(hash, (s, e) => - { - result = e; - t.SetResult(); - }, - commitment); - - var checkTask = Task.Run(async () => - { - var currHeight = await rpc.GetBlockHeightAsync(commitment); - while (currHeight.Result < validBlockHeight) - { - await Task.Delay(1000); - currHeight = await rpc.GetBlockHeightAsync(commitment); - } - }); - - - Task.WaitAny(t.Task, checkTask); - - if (!t.Task.IsCompleted) - { - await s.UnsubscribeAsync(); - } - - return result; - } - - /// - /// Confirms a transaction - old web3.js using constant timeout based on commitment parameter. - /// - /// The rpc client instance. - /// The streaming rpc client instance. - /// The hash of the transaction. - /// The state commitment to consider when querying the ledger state. - /// Returns null if the transaction wasn't confirmed, otherwise returns the confirmation slot and possible transaction error. - public static async Task> ConfirmTransaction(IRpcClient rpc, IStreamingRpcClient streamingRpcClient, - string hash, Commitment commitment = Commitment.Finalized) - { - TaskCompletionSource t = new(); - ResponseValue result = null; - - var s = await streamingRpcClient.SubscribeSignatureAsync(hash, (s, e) => - { - result = e; - t.SetResult(); - }, - commitment); - - var timeout = commitment == Commitment.Finalized ? TimeSpan.FromSeconds(60) : TimeSpan.FromSeconds(30); - var delay = Task.Delay(timeout); - - Task.WaitAny(t.Task, delay); - - if (!t.Task.IsCompleted) - { - await s.UnsubscribeAsync(); - } - - return result; - } - - } -} diff --git a/src/Solnet.Wallet/Bip39/Mnemonic.cs b/src/Solnet.Wallet/Bip39/Mnemonic.cs index 51927553..1132c9dd 100644 --- a/src/Solnet.Wallet/Bip39/Mnemonic.cs +++ b/src/Solnet.Wallet/Bip39/Mnemonic.cs @@ -6,6 +6,7 @@ using System.Collections; using System.Diagnostics; using System.Linq; +using System.Security.Cryptography; using System.Text; namespace Solnet.Wallet.Bip39 @@ -195,9 +196,10 @@ public byte[] DeriveSeed(string passphrase = null) /// The derived key. private static byte[] GenerateSeed(byte[] password, byte[] salt) { - Pkcs5S2ParametersGenerator gen = new(new Sha512Digest()); - gen.Init(password, salt, 2048); - return ((KeyParameter)gen.GenerateDerivedParameters(512)).GetKey(); + using (var pbkdf2 = new Rfc2898DeriveBytes(password, salt, 2048, HashAlgorithmName.SHA512)) + { + return pbkdf2.GetBytes(64); + } } /// diff --git a/test/Solnet.Extensions.Test/MockTokenWalletRpc.cs b/test/Solnet.Extensions.Test/MockTokenWalletRpc.cs index 84e796db..b25ec29b 100644 --- a/test/Solnet.Extensions.Test/MockTokenWalletRpc.cs +++ b/test/Solnet.Extensions.Test/MockTokenWalletRpc.cs @@ -111,9 +111,9 @@ public async Task>> GetBalanceAsync(string pu return await MockResponseValue(); } - public async Task>> GetRecentBlockHashAsync(Commitment commitment = Commitment.Finalized) + public async Task>> GetLatestBlockHashAsync(Commitment commitment = Commitment.Finalized) { - return await MockResponseValue(); + return await MockResponseValue(); } public async Task>>> GetTokenAccountsByOwnerAsync(string ownerPubKey, string tokenMintPubKey = null, string tokenProgramId = null, Commitment commitment = Commitment.Finalized) diff --git a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetBlocksWithLimitConfirmedRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetBlocksWithLimitConfirmedRequest.json deleted file mode 100644 index dc78dece..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetBlocksWithLimitConfirmedRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getBlocksWithLimit","params":[79699950,2,{"commitment":"confirmed"}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlockConfirmedRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlockConfirmedRequest.json deleted file mode 100644 index 37835143..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlockConfirmedRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedBlock","params":[79662905,{"encoding":"json","maxSupportedTransactionVersion":0,"commitment":"confirmed"}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlockRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlockRequest.json deleted file mode 100644 index d7d6d32c..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlockRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedBlock","params":[79662905,{"encoding":"json","maxSupportedTransactionVersion":0}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksConfirmedRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksConfirmedRequest.json deleted file mode 100644 index 7bb1f80e..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksConfirmedRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedBlocks","params":[79499950,79500000,{"commitment":"confirmed"}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksRequest.json deleted file mode 100644 index 4777414a..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedBlocks","params":[79499950,79500000],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksWithLimitConfirmedRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksWithLimitConfirmedRequest.json deleted file mode 100644 index 3ef7d06d..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksWithLimitConfirmedRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedBlocksWithLimit","params":[79699950,2,{"commitment":"confirmed"}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksWithLimitRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksWithLimitRequest.json deleted file mode 100644 index 8814ca7a..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Blocks/GetConfirmedBlocksWithLimitRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedBlocksWithLimit","params":[79699950,2],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeCalculatorForBlockhashConfirmedRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeCalculatorForBlockhashConfirmedRequest.json deleted file mode 100644 index 9aca27d1..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeCalculatorForBlockhashConfirmedRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getFeeCalculatorForBlockhash","params":["GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ",{"commitment":"confirmed"}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeCalculatorForBlockhashRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeCalculatorForBlockhashRequest.json deleted file mode 100644 index 8f561900..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeCalculatorForBlockhashRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getFeeCalculatorForBlockhash","params":["GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ"],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeCalculatorForBlockhashResponse.json b/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeCalculatorForBlockhashResponse.json deleted file mode 100644 index 1fc84b05..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeCalculatorForBlockhashResponse.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 221 - }, - "value": { - "feeCalculator": { - "lamportsPerSignature": 5000 - } - } - }, - "id": 0 -} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeRateGovernorRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeRateGovernorRequest.json deleted file mode 100644 index b79009eb..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeRateGovernorRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getFeeRateGovernor","jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeRateGovernorResponse.json b/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeRateGovernorResponse.json deleted file mode 100644 index bcdc4d03..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeeRateGovernorResponse.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 54 - }, - "value": { - "feeRateGovernor": { - "burnPercent": 50, - "maxLamportsPerSignature": 100000, - "minLamportsPerSignature": 5000, - "targetLamportsPerSignature": 10000, - "targetSignaturesPerSlot": 20000 - } - } - }, - "id": 0 -} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeesConfirmedRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeesConfirmedRequest.json deleted file mode 100644 index a9fd13d1..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeesConfirmedRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getFees","params":[{"commitment":"confirmed"}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeesRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeesRequest.json deleted file mode 100644 index 99807c4f..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeesRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getFees","jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeesResponse.json b/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeesResponse.json deleted file mode 100644 index 3c1b3980..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Fees/GetFeesResponse.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1 - }, - "value": { - "blockhash": "CSymwgTNX1j3E4qhKfJAUE41nBWEwXufoYryPbkde5RR", - "feeCalculator": { - "lamportsPerSignature": 5000 - }, - "lastValidSlot": 297, - "lastValidBlockHeight": 296 - } - }, - "id": 0 -} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/GetSnapshotSlotRequest.json b/test/Solnet.Rpc.Test/Resources/Http/GetSnapshotSlotRequest.json deleted file mode 100644 index cd37bd11..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/GetSnapshotSlotRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getSnapshotSlot","jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/GetSnapshotSlotResponse.json b/test/Solnet.Rpc.Test/Resources/Http/GetSnapshotSlotResponse.json deleted file mode 100644 index 2af75886..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/GetSnapshotSlotResponse.json +++ /dev/null @@ -1 +0,0 @@ -{"jsonrpc":"2.0","result":100,"id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationRequest.json b/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationRequest.json deleted file mode 100644 index a4e17885..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getStakeActivation","params":["CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT"],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationResponse.json b/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationResponse.json deleted file mode 100644 index c5e14760..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationResponse.json +++ /dev/null @@ -1 +0,0 @@ -{"jsonrpc":"2.0","result":{"active":197717120,"inactive":0,"state":"active"},"id":1} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationWithEpochProcessedRequest.json b/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationWithEpochProcessedRequest.json deleted file mode 100644 index 010cedf2..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationWithEpochProcessedRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getStakeActivation","params":["CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT",{"commitment":"processed","epoch":4}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationWithEpochRequest.json b/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationWithEpochRequest.json deleted file mode 100644 index 127a4730..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationWithEpochRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getStakeActivation","params":["CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT",{"epoch":4}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationWithEpochResponse.json b/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationWithEpochResponse.json deleted file mode 100644 index 87af6d83..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/GetStakeActivationWithEpochResponse.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "jsonrpc": "2.0", - "result": { - "active": 124429280, - "inactive": 73287840, - "state": "activating" - }, - "id": 1 -} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2BeforeConfirmedRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2BeforeConfirmedRequest.json deleted file mode 100644 index b2ab0bed..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2BeforeConfirmedRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedSignaturesForAddress2","params":["Vote111111111111111111111111111111111111111",{"limit":1,"before":"Vote111111111111111111111111111111111111111","commitment":"confirmed"}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2BeforeRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2BeforeRequest.json deleted file mode 100644 index 77de74fb..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2BeforeRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedSignaturesForAddress2","params":["Vote111111111111111111111111111111111111111",{"limit":1,"before":"Vote111111111111111111111111111111111111111"}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2Request.json b/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2Request.json deleted file mode 100644 index 22d1188c..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2Request.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedSignaturesForAddress2","params":["4Rf9mGD7FeYknun5JczX5nGLTfQuS1GRjNVfkEMKE92b",{"limit":3}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2UntilRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2UntilRequest.json deleted file mode 100644 index bbb2572c..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Signatures/GetConfirmedSignaturesForAddress2UntilRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedSignaturesForAddress2","params":["Vote111111111111111111111111111111111111111",{"limit":1,"until":"Vote111111111111111111111111111111111111111"}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Transaction/GetConfirmedTransactionProcessedRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Transaction/GetConfirmedTransactionProcessedRequest.json deleted file mode 100644 index 66cf3975..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Transaction/GetConfirmedTransactionProcessedRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedTransaction","params":["5as3w4KMpY23MP5T1nkPVksjXjN7hnjHKqiDxRMxUNcw5XsCGtStayZib1kQdyR2D9w8dR11Ha9Xk38KP3kbAwM1",{"encoding":"json","commitment":"processed","maxSupportedTransactionVersion":0}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Transaction/GetConfirmedTransactionRequest.json b/test/Solnet.Rpc.Test/Resources/Http/Transaction/GetConfirmedTransactionRequest.json deleted file mode 100644 index 8d531c08..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Transaction/GetConfirmedTransactionRequest.json +++ /dev/null @@ -1 +0,0 @@ -{"method":"getConfirmedTransaction","params":["5as3w4KMpY23MP5T1nkPVksjXjN7hnjHKqiDxRMxUNcw5XsCGtStayZib1kQdyR2D9w8dR11Ha9Xk38KP3kbAwM1",{"encoding":"json","commitment":"confirmed","maxSupportedTransactionVersion":0}],"jsonrpc":"2.0","id":0} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/Resources/Http/Transaction/GetConfirmedTransactionResponse.json b/test/Solnet.Rpc.Test/Resources/Http/Transaction/GetConfirmedTransactionResponse.json deleted file mode 100644 index 8ad974f9..00000000 --- a/test/Solnet.Rpc.Test/Resources/Http/Transaction/GetConfirmedTransactionResponse.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "jsonrpc": "2.0", - "result": { - "blockTime": 1622655364, - "meta": { - "err": null, - "fee": 5000, - "innerInstructions": [], - "logMessages": [ "Program Vote111111111111111111111111111111111111111 invoke [1]", "Program Vote111111111111111111111111111111111111111 success" ], - "postBalances": [ 395383573380, 7282661174070, 1, 1, 1 ], - "postTokenBalances": [], - "preBalances": [ 395383578380, 7282661174070, 1, 1, 1 ], - "preTokenBalances": [], - "rewards": [], - "status": { "Ok": null } - }, - "slot": 79700345, - "transaction": { - "message": { - "accountKeys": [ "EvVrzsxoj118sxxSTrcnc9u3fRdQfCc7d4gRzzX6TSqj", "6iuQJhi7Qqzg9LsyFBQpcS1uttP2sZ49pYMprL5GGy2Z", "SysvarS1otHashes111111111111111111111111111", "SysvarC1ock11111111111111111111111111111111", "Vote111111111111111111111111111111111111111" ], - "header": { - "numReadonlySignedAccounts": 0, - "numReadonlyUnsignedAccounts": 3, - "numRequiredSignatures": 1 - }, - "instructions": [ - { - "accounts": [ 1, 2, 3, 0 ], - "data": "2kr3BYaDkghC7rvHsQYnBNoB4dhXrUmzgYMM4kbHSG7ALa3qsMPxfC9cJTFDKyJaC8VYSjrey9pvyRivtESUJrC3qzr89pvS2o6MQhyRVxmh3raQStxFFYwZ6WyKFNoQXvcchBwy8uQGfhhUqzuLNREwRmZ5U2VgTjFWX8Vikqya6iyzvALQNZEvqz7ZoGEyRtJ6AzNyWbkUyEo63rZ5w3wnxmhr3Uood", - "programIdIndex": 4 - } - ], - "recentBlockhash": "6XGYfEJ5CGGBA5E8E7Gw4ToyDLDNNAyUCb7CJj1rLk21" - }, - "signatures": [ "5as3w4KMpY23MP5T1nkPVksjXjN7hnjHKqiDxRMxUNcw5XsCGtStayZib1kQdyR2D9w8dR11Ha9Xk38KP3kbAwM1" ] - } - }, - "id": 0 -} \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/SolanaRpcClientBatchTests.cs b/test/Solnet.Rpc.Test/SolanaRpcClientBatchTests.cs index 6640188b..37b83670 100644 --- a/test/Solnet.Rpc.Test/SolanaRpcClientBatchTests.cs +++ b/test/Solnet.Rpc.Test/SolanaRpcClientBatchTests.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +#pragma warning disable CS0618 +using Microsoft.VisualStudio.TestTools.UnitTesting; using Solnet.Programs; using Solnet.Rpc.Core.Http; using Solnet.Rpc.Messages; @@ -21,36 +22,8 @@ namespace Solnet.Rpc.Test [TestClass] public class SolanaRpcClientBatchTests { -#pragma warning disable CS0618 // Type or member is obsolete - [TestMethod] - public void TestCreateAndSerializeBatchRequest() - { - - // compose a new batch of requests - var unusedRpcClient = ClientFactory.GetClient(Cluster.MainNet); - var batch = new SolanaRpcBatchWithCallbacks(unusedRpcClient); - batch.GetBalance("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5"); - batch.GetTokenAccountsByOwner("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5", null, TokenProgram.ProgramIdKey); - - batch.GetConfirmedSignaturesForAddress2("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5", 200, null, null); - batch.GetConfirmedSignaturesForAddress2("88ocFjrLgHEMQRMwozC7NnDBQUsq2UoQaqREFZoDEex", 200, null, null); - batch.GetConfirmedSignaturesForAddress2("4NSREK36nAr32vooa3L9z8tu6JWj5rY3k4KnsqTgynvm", 200, null, null); - - // how many requests in batch? - Assert.AreEqual(5, batch.Composer.Count); - - // serialize - var reqs = batch.Composer.CreateJsonRequests(); - Assert.IsNotNull(reqs); - Assert.AreEqual(5, reqs.Count); - - // serialize and check we're good - var serializerOptions = CreateJsonOptions(); - var json = JsonSerializer.Serialize(reqs, serializerOptions); - var expected = File.ReadAllText("Resources/Http/Batch/SampleBatchRequest.json"); - Assert.AreEqual(expected, json); - - } + // Type or member is obsolete + [TestMethod] public void TestCreateAndSerializeBatchTokenMintInfoRequest() @@ -98,55 +71,6 @@ public void TestDeserializeBatchTokenMintInfoResponse() Assert.AreEqual(2, res.Count); } - [TestMethod] - public void TestCreateAndProcessBatchCallbacks() - { - - var expected_requests = File.ReadAllText("Resources/Http/Batch/SampleBatchRequest.json"); - var expected_responses = File.ReadAllText("Resources/Http/Batch/SampleBatchResponse.json"); - - ulong found_lamports = 0; - decimal found_balance = 0M; - int sig_callback_count = 0; - - // compose a new batch of requests - var unusedRpcClient = ClientFactory.GetClient(Cluster.MainNet); - var batch = new SolanaRpcBatchWithCallbacks(unusedRpcClient); - batch.GetBalance("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5", - callback: (x, ex) => found_lamports = x.Value); - batch.GetTokenAccountsByOwner("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5", null, TokenProgram.ProgramIdKey, - callback: (x, ex) => found_balance = x.Value[0].Account.Data.Parsed.Info.TokenAmount.AmountDecimal); - batch.GetConfirmedSignaturesForAddress2("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5", 200, null, null, - callback: (x, ex) => sig_callback_count += x.Count); - batch.GetConfirmedSignaturesForAddress2("88ocFjrLgHEMQRMwozC7NnDBQUsq2UoQaqREFZoDEex", 200, null, null, - callback: (x, ex) => sig_callback_count += x.Count); - batch.GetConfirmedSignaturesForAddress2("4NSREK36nAr32vooa3L9z8tu6JWj5rY3k4KnsqTgynvm", 200, null, null, - callback: (x, ex) => sig_callback_count += x.Count); - - // how many requests in batch? - Assert.AreEqual(5, batch.Composer.Count); - - // serialize and check we're good - var reqs = batch.Composer.CreateJsonRequests(); - var serializerOptions = CreateJsonOptions(); - var json = JsonSerializer.Serialize(reqs, serializerOptions); - Assert.IsNotNull(reqs); - Assert.AreEqual(5, reqs.Count); - Assert.AreEqual(expected_requests, json); - - // fake RPC response - var resp = CreateMockRequestResult(expected_requests, expected_responses, HttpStatusCode.OK); - Assert.IsNotNull(resp.Result); - Assert.AreEqual(5, resp.Result.Count); - - // process and invoke callbacks - batch.Composer.ProcessBatchResponse(resp); - Assert.AreEqual((ulong)237543960, found_lamports); - Assert.AreEqual(12.5M, found_balance); - Assert.AreEqual(3, sig_callback_count); - - } - [TestMethod] public void TestAutoExecuteMode() { @@ -172,11 +96,11 @@ public void TestAutoExecuteMode() callback: (x, ex) => found_lamports = x.Value); batch.GetTokenAccountsByOwner("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5", null, TokenProgram.ProgramIdKey, callback: (x, ex) => found_balance = x.Value[0].Account.Data.Parsed.Info.TokenAmount.AmountDecimal); - batch.GetConfirmedSignaturesForAddress2("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5", 200, null, null, + batch.GetSignaturesForAddress("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5", 200, null, null, callback: (x, ex) => sig_callback_count += x.Count); - batch.GetConfirmedSignaturesForAddress2("88ocFjrLgHEMQRMwozC7NnDBQUsq2UoQaqREFZoDEex", 200, null, null, + batch.GetSignaturesForAddress("88ocFjrLgHEMQRMwozC7NnDBQUsq2UoQaqREFZoDEex", 200, null, null, callback: (x, ex) => sig_callback_count += x.Count); - batch.GetConfirmedSignaturesForAddress2("4NSREK36nAr32vooa3L9z8tu6JWj5rY3k4KnsqTgynvm", 200, null, null, + batch.GetSignaturesForAddress("4NSREK36nAr32vooa3L9z8tu6JWj5rY3k4KnsqTgynvm", 200, null, null, callback: (x, ex) => sig_callback_count += x.Count); // run through any remaining requests in batch @@ -272,11 +196,11 @@ public void TestBatchFailed() callback: (x, ex) => exceptions_encountered += ex != null ? 1 : 0); batch.GetTokenAccountsByOwner("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5", null, TokenProgram.ProgramIdKey, callback: (x, ex) => exceptions_encountered += ex != null ? 1 : 0); - batch.GetConfirmedSignaturesForAddress2("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5", 200, null, null, + batch.GetSignaturesForAddress("9we6kjtbcZ2vy3GSLLsZTEhbAqXPTRvEyoxa8wxSqKp5", 200, null, null, callback: (x, ex) => exceptions_encountered += ex != null ? 1 : 0); - batch.GetConfirmedSignaturesForAddress2("88ocFjrLgHEMQRMwozC7NnDBQUsq2UoQaqREFZoDEex", 200, null, null, + batch.GetSignaturesForAddress("88ocFjrLgHEMQRMwozC7NnDBQUsq2UoQaqREFZoDEex", 200, null, null, callback: (x, ex) => exceptions_encountered += ex != null ? 1 : 0); - batch.GetConfirmedSignaturesForAddress2("4NSREK36nAr32vooa3L9z8tu6JWj5rY3k4KnsqTgynvm", 200, null, null, + batch.GetSignaturesForAddress("4NSREK36nAr32vooa3L9z8tu6JWj5rY3k4KnsqTgynvm", 200, null, null, callback: (x, ex) => { Assert.IsInstanceOfType(ex, typeof(BatchRequestException)); diff --git a/test/Solnet.Rpc.Test/SolanaRpcClientBlockTests.cs b/test/Solnet.Rpc.Test/SolanaRpcClientBlockTests.cs index 76c766a4..c1934aad 100644 --- a/test/Solnet.Rpc.Test/SolanaRpcClientBlockTests.cs +++ b/test/Solnet.Rpc.Test/SolanaRpcClientBlockTests.cs @@ -87,144 +87,6 @@ public void TestGetBlock() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetConfirmedBlock() - { - var responseData = File.ReadAllText("Resources/Http/Blocks/GetBlockResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Blocks/GetConfirmedBlockRequest.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 res = sut.GetConfirmedBlock(79662905); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(res.Result); - Assert.AreEqual(2, res.Result.Transactions.Length); - - Assert.AreEqual(66130135, res.Result.BlockHeight); - Assert.AreEqual(1622632900, res.Result.BlockTime); - Assert.AreEqual(79662904UL, res.Result.ParentSlot); - Assert.AreEqual("5wLhsKAH9SCPbRZc4qWf3GBiod9CD8sCEZfMiU25qW8", res.Result.Blockhash); - Assert.AreEqual("CjJ97j84mUq3o67CEqzEkTifXpHLBCD8GvmfBYLz4Zdg", res.Result.PreviousBlockhash); - Assert.AreEqual(0, res.Result.maxSupportedTransactionVersion); - Assert.AreEqual(1, res.Result.Rewards.Length); - var rewards = res.Result.Rewards[0]; - - Assert.AreEqual(1785000, rewards.Lamports); - Assert.AreEqual(365762267923UL, rewards.PostBalance); - Assert.AreEqual("9zkU8suQBdhZVax2DSGNAnyEhEzfEELvA25CJhy5uwnW", rewards.Pubkey); - Assert.AreEqual(RewardType.Fee, rewards.RewardType); - - TransactionMetaInfo first = res.Result.Transactions[0]; - - Assert.IsNotNull(first.Meta.Error); - Assert.AreEqual(TransactionErrorType.InstructionError, first.Meta.Error.Type); - Assert.IsNotNull(first.Meta.Error.InstructionError); - Assert.AreEqual(InstructionErrorType.Custom, first.Meta.Error.InstructionError.Type); - Assert.AreEqual(0u, first.Meta.Error.InstructionError.CustomError); - - Assert.AreEqual(5000UL, first.Meta.Fee); - Assert.AreEqual(0, first.Meta.InnerInstructions.Length); - Assert.AreEqual(2, first.Meta.LogMessages.Length); - Assert.AreEqual(5, first.Meta.PostBalances.Length); - Assert.AreEqual(35132731759UL, first.Meta.PostBalances[0]); - Assert.AreEqual(5, first.Meta.PreBalances.Length); - Assert.AreEqual(35132736759UL, first.Meta.PreBalances[0]); - Assert.AreEqual(0, first.Meta.PostTokenBalances.Length); - Assert.AreEqual(0, first.Meta.PreTokenBalances.Length); - - Assert.AreEqual(1, first.Transaction.Signatures.Length); - Assert.AreEqual("2Hh35eZPP1wZLYQ1HHv8PqGoRo73XirJeKFpBVc19msi6qeJHk3yUKqS1viRtqkdb545CerTWeywPFXxjKEhDWTK", first.Transaction.Signatures[0]); - - Assert.AreEqual(5, first.Transaction.Message.AccountKeys.Length); - Assert.AreEqual("DjuMPGThkGdyk2vDvDDYjTFSyxzTumdapnDNbvVZbYQE", first.Transaction.Message.AccountKeys[0]); - - Assert.AreEqual(0, first.Transaction.Message.Header.NumReadonlySignedAccounts); - Assert.AreEqual(3, first.Transaction.Message.Header.NumReadonlyUnsignedAccounts); - Assert.AreEqual(1, first.Transaction.Message.Header.NumRequiredSignatures); - - Assert.AreEqual(1, first.Transaction.Message.Instructions.Length); - Assert.AreEqual(4, first.Transaction.Message.Instructions[0].Accounts.Length); - Assert.AreEqual("2ZjTR1vUs2pHXyTLxtFDhN2tsm2HbaH36cAxzJcwaXf8y5jdTESsGNBLFaxGuWENxLa2ZL3cX9foNJcWbRq", first.Transaction.Message.Instructions[0].Data); - Assert.AreEqual(4, first.Transaction.Message.Instructions[0].ProgramIdIndex); - - Assert.AreEqual("D8qh6AeX4KaTe6ZBpsZDdntTQUyPy7x6Xjp7NnEigCWH", first.Transaction.Message.RecentBlockhash); - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetBlockConfirmed() - { - - var responseData = File.ReadAllText("Resources/Http/Blocks/GetBlockResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Blocks/GetBlockConfirmedRequest.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 res = sut.GetBlock(79662905, Commitment.Confirmed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(res.Result); - Assert.AreEqual(2, res.Result.Transactions.Length); - // everything else was already validated above - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetConfirmedBlockConfirmed() - { - - var responseData = File.ReadAllText("Resources/Http/Blocks/GetBlockResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Blocks/GetConfirmedBlockConfirmedRequest.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 res = sut.GetConfirmedBlock(79662905, Commitment.Confirmed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(res.Result); - Assert.AreEqual(2, res.Result.Transactions.Length); - // everything else was already validated above - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetConfirmedBlockInvalid() - { - var sut = new SolanaRpcClient(TestnetUrl, null); - - try - { - var res = sut.GetBlock(79662905, Commitment.Processed); - Assert.Fail("Should throw exception before here."); - } - catch (Exception e) - { - Assert.AreEqual(typeof(ArgumentException), e.InnerException.GetType()); - } - } - [TestMethod] public void TestGetBlockInvalid() { @@ -383,88 +245,6 @@ public void TestGetBlockProductionIdentityRange() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetConfirmedTransaction() - { - var responseData = File.ReadAllText("Resources/Http/Transaction/GetConfirmedTransactionResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Transaction/GetConfirmedTransactionRequest.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 res = sut.GetConfirmedTransaction("5as3w4KMpY23MP5T1nkPVksjXjN7hnjHKqiDxRMxUNcw5XsCGtStayZib1kQdyR2D9w8dR11Ha9Xk38KP3kbAwM1", Commitment.Confirmed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(res.Result); - Assert.AreEqual(79700345UL, res.Result.Slot); - - Assert.AreEqual(1622655364, res.Result.BlockTime); - - TransactionMetaInfo first = res.Result; - - Assert.IsNull(first.Meta.Error); - - Assert.AreEqual(5000UL, first.Meta.Fee); - Assert.AreEqual(0, first.Meta.InnerInstructions.Length); - Assert.AreEqual(2, first.Meta.LogMessages.Length); - Assert.AreEqual(5, first.Meta.PostBalances.Length); - Assert.AreEqual(395383573380UL, first.Meta.PostBalances[0]); - Assert.AreEqual(5, first.Meta.PreBalances.Length); - Assert.AreEqual(395383578380UL, first.Meta.PreBalances[0]); - Assert.AreEqual(0, first.Meta.PostTokenBalances.Length); - Assert.AreEqual(0, first.Meta.PreTokenBalances.Length); - - Assert.AreEqual(1, first.Transaction.Signatures.Length); - Assert.AreEqual("5as3w4KMpY23MP5T1nkPVksjXjN7hnjHKqiDxRMxUNcw5XsCGtStayZib1kQdyR2D9w8dR11Ha9Xk38KP3kbAwM1", first.Transaction.Signatures[0]); - - Assert.AreEqual(5, first.Transaction.Message.AccountKeys.Length); - Assert.AreEqual("EvVrzsxoj118sxxSTrcnc9u3fRdQfCc7d4gRzzX6TSqj", first.Transaction.Message.AccountKeys[0]); - - Assert.AreEqual(0, first.Transaction.Message.Header.NumReadonlySignedAccounts); - Assert.AreEqual(3, first.Transaction.Message.Header.NumReadonlyUnsignedAccounts); - Assert.AreEqual(1, first.Transaction.Message.Header.NumRequiredSignatures); - - Assert.AreEqual(1, first.Transaction.Message.Instructions.Length); - Assert.AreEqual(4, first.Transaction.Message.Instructions[0].Accounts.Length); - Assert.AreEqual("2kr3BYaDkghC7rvHsQYnBNoB4dhXrUmzgYMM4kbHSG7ALa3qsMPxfC9cJTFDKyJaC8VYSjrey9pvyRivtESUJrC3qzr89pvS2o6MQ" - + "hyRVxmh3raQStxFFYwZ6WyKFNoQXvcchBwy8uQGfhhUqzuLNREwRmZ5U2VgTjFWX8Vikqya6iyzvALQNZEvqz7ZoGEyRtJ6AzNyWbkUyEo63rZ5w3wnxmhr3Uood", - first.Transaction.Message.Instructions[0].Data); - - Assert.AreEqual(4, first.Transaction.Message.Instructions[0].ProgramIdIndex); - - Assert.AreEqual("6XGYfEJ5CGGBA5E8E7Gw4ToyDLDNNAyUCb7CJj1rLk21", first.Transaction.Message.RecentBlockhash); - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetConfirmedTransactionProcessed() - { - - var responseData = File.ReadAllText("Resources/Http/Transaction/GetTransactionResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Transaction/GetConfirmedTransactionProcessedRequest.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 res = sut.GetConfirmedTransaction("5as3w4KMpY23MP5T1nkPVksjXjN7hnjHKqiDxRMxUNcw5XsCGtStayZib1kQdyR2D9w8dR11Ha9Xk38KP3kbAwM1", Commitment.Processed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(res.Result); - FinishTest(messageHandlerMock, TestnetUri); - } - [TestMethod] public void TestGetTransaction() { @@ -605,33 +385,6 @@ public void TestGetBlocks() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetConfirmedBlocks() - { - - var responseData = File.ReadAllText("Resources/Http/Blocks/GetBlocksResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Blocks/GetConfirmedBlocksRequest.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 res = sut.GetConfirmedBlocks(79_499_950, 79_500_000); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(res.Result); - Assert.AreEqual(39, res.Result.Count); - Assert.AreEqual(79499950UL, res.Result[0]); - Assert.AreEqual(79500000UL, res.Result[38]); - - FinishTest(messageHandlerMock, TestnetUri); - } - [TestMethod] public void TestGetBlocksInvalidCommitment() { @@ -647,75 +400,6 @@ public void TestGetBlocksInvalidCommitment() } } - [TestMethod] - public void TestGetConfirmedBlocksInvalidCommitment() - { - var sut = new SolanaRpcClient(TestnetUrl, null); - try - { - var res = sut.GetConfirmedBlocks(79_499_950, 79_500_000, Commitment.Processed); - Assert.Fail("Should throw exception before here."); - } - catch (Exception e) - { - Assert.AreEqual(typeof(ArgumentException), e.InnerException.GetType()); - } - } - - [TestMethod] - public void TestGetBlocksConfirmed() - { - - var responseData = File.ReadAllText("Resources/Http/Blocks/GetBlocksResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Blocks/GetBlocksConfirmedRequest.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 res = sut.GetBlocks(79_499_950, 79_500_000, Commitment.Confirmed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(res.Result); - Assert.AreEqual(39, res.Result.Count); - Assert.AreEqual(79499950UL, res.Result[0]); - Assert.AreEqual(79500000UL, res.Result[38]); - - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetConfirmedBlocksConfirmed() - { - - var responseData = File.ReadAllText("Resources/Http/Blocks/GetBlocksResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Blocks/GetConfirmedBlocksConfirmedRequest.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 res = sut.GetConfirmedBlocks(79_499_950, 79_500_000, Commitment.Confirmed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(res.Result); - Assert.AreEqual(39, res.Result.Count); - Assert.AreEqual(79499950UL, res.Result[0]); - Assert.AreEqual(79500000UL, res.Result[38]); - - FinishTest(messageHandlerMock, TestnetUri); - } - [TestMethod] public void TestGetBlocksWithLimit() { @@ -743,86 +427,6 @@ public void TestGetBlocksWithLimit() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetConfirmedBlocksWithLimit() - { - - var responseData = File.ReadAllText("Resources/Http/Blocks/GetBlocksWithLimitResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Blocks/GetConfirmedBlocksWithLimitRequest.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 res = sut.GetConfirmedBlocksWithLimit(79_699_950, 2); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(res.Result); - Assert.AreEqual(2, res.Result.Count); - Assert.AreEqual(79699950UL, res.Result[0]); - Assert.AreEqual(79699951UL, res.Result[1]); - - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetBlocksWithLimitConfirmed() - { - - var responseData = File.ReadAllText("Resources/Http/Blocks/GetBlocksWithLimitResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Blocks/GetBlocksWithLimitConfirmedRequest.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 res = sut.GetBlocksWithLimit(79_699_950, 2, Commitment.Confirmed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(res.Result); - Assert.AreEqual(2, res.Result.Count); - Assert.AreEqual(79699950UL, res.Result[0]); - Assert.AreEqual(79699951UL, res.Result[1]); - - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetConfirmedBlocksWithLimitConfirmed() - { - - var responseData = File.ReadAllText("Resources/Http/Blocks/GetBlocksWithLimitResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Blocks/GetConfirmedBlocksWithLimitConfirmedRequest.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 res = sut.GetConfirmedBlocksWithLimit(79_699_950, 2, Commitment.Confirmed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(res.Result); - Assert.AreEqual(2, res.Result.Count); - Assert.AreEqual(79699950UL, res.Result[0]); - Assert.AreEqual(79699951UL, res.Result[1]); - - FinishTest(messageHandlerMock, TestnetUri); - } [TestMethod] public void TestGetBlocksWithLimitBadCommitment() @@ -840,22 +444,6 @@ public void TestGetBlocksWithLimitBadCommitment() } } - [TestMethod] - public void TestGetConfirmedBlocksWithLimitBadCommitment() - { - var sut = new SolanaRpcClient(TestnetUrl, null); - - try - { - var res = sut.GetConfirmedBlocksWithLimit(79_699_950, 2, Commitment.Processed); - Assert.Fail("Should throw exception before here."); - } - catch (Exception e) - { - Assert.AreEqual(typeof(ArgumentException), e.InnerException.GetType()); - } - } - [TestMethod] public void TestGetFirstAvailableBlock() { @@ -984,33 +572,6 @@ public void TestGetBlockTime() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetRecentBlockHash() - { - var responseData = File.ReadAllText("Resources/Http/GetRecentBlockhashResponse.json"); - var requestData = File.ReadAllText("Resources/Http/GetRecentBlockhashRequest.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.GetRecentBlockHash(); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(79206433UL, result.Result.Context.Slot); - Assert.AreEqual("FJGZeJiYkwCZCnFbGujHxfVGnFgrgZiomczHr247Tn2p", result.Result.Value.Blockhash); - Assert.AreEqual(5000UL, result.Result.Value.FeeCalculator.LamportsPerSignature); - - FinishTest(messageHandlerMock, TestnetUri); - } - [TestMethod] public void TestGetLatestBlockHash() { @@ -1064,31 +625,5 @@ public void TestIsBlockhashValid() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetRecentBlockHashProcessed() - { - var responseData = File.ReadAllText("Resources/Http/GetRecentBlockhashResponse.json"); - var requestData = File.ReadAllText("Resources/Http/GetRecentBlockhashProcessedRequest.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.GetRecentBlockHash(Commitment.Processed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(79206433UL, result.Result.Context.Slot); - Assert.AreEqual("FJGZeJiYkwCZCnFbGujHxfVGnFgrgZiomczHr247Tn2p", result.Result.Value.Blockhash); - Assert.AreEqual(5000UL, result.Result.Value.FeeCalculator.LamportsPerSignature); - - FinishTest(messageHandlerMock, TestnetUri); - } } } \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/SolanaRpcClientFeeTests.cs b/test/Solnet.Rpc.Test/SolanaRpcClientFeeTests.cs index c61fc03d..3ae95362 100644 --- a/test/Solnet.Rpc.Test/SolanaRpcClientFeeTests.cs +++ b/test/Solnet.Rpc.Test/SolanaRpcClientFeeTests.cs @@ -14,66 +14,6 @@ namespace Solnet.Rpc.Test public class SolanaRpcClientFeeTest : SolanaRpcClientTestBase { - - [TestMethod] - public void TestGetFeeRateGovernor() - { - var responseData = File.ReadAllText("Resources/Http/Fees/GetFeeRateGovernorResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Fees/GetFeeRateGovernorRequest.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.GetFeeRateGovernor(); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(54UL, result.Result.Context.Slot); - Assert.AreEqual(50, result.Result.Value.FeeRateGovernor.BurnPercent); - Assert.AreEqual(100000UL, result.Result.Value.FeeRateGovernor.MaxLamportsPerSignature); - Assert.AreEqual(5000UL, result.Result.Value.FeeRateGovernor.MinLamportsPerSignature); - Assert.AreEqual(10000UL, result.Result.Value.FeeRateGovernor.TargetLamportsPerSignature); - Assert.AreEqual(20000UL, result.Result.Value.FeeRateGovernor.TargetSignaturesPerSlot); - - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetFees() - { - var responseData = File.ReadAllText("Resources/Http/Fees/GetFeesResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Fees/GetFeesRequest.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.GetFees(); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(1UL, result.Result.Context.Slot); - Assert.AreEqual("CSymwgTNX1j3E4qhKfJAUE41nBWEwXufoYryPbkde5RR", result.Result.Value.Blockhash); - Assert.AreEqual(5000UL, result.Result.Value.FeeCalculator.LamportsPerSignature); - Assert.AreEqual(297UL, result.Result.Value.LastValidSlot); - Assert.AreEqual(296UL, result.Result.Value.LastValidBlockHeight); - - FinishTest(messageHandlerMock, TestnetUri); - } - [TestMethod] public void TestGetFeeForMessage() { @@ -99,86 +39,5 @@ public void TestGetFeeForMessage() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetFeesConfirmed() - { - var responseData = File.ReadAllText("Resources/Http/Fees/GetFeesResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Fees/GetFeesConfirmedRequest.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.GetFees(Commitment.Confirmed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(1UL, result.Result.Context.Slot); - Assert.AreEqual("CSymwgTNX1j3E4qhKfJAUE41nBWEwXufoYryPbkde5RR", result.Result.Value.Blockhash); - Assert.AreEqual(5000UL, result.Result.Value.FeeCalculator.LamportsPerSignature); - Assert.AreEqual(297UL, result.Result.Value.LastValidSlot); - Assert.AreEqual(296UL, result.Result.Value.LastValidBlockHeight); - - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetFeeCalculatorForBlockhash() - { - var responseData = File.ReadAllText("Resources/Http/Fees/GetFeeCalculatorForBlockhashResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Fees/GetFeeCalculatorForBlockhashRequest.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.GetFeeCalculatorForBlockhash("GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ"); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(221UL, result.Result.Context.Slot); - Assert.AreEqual(5000UL, result.Result.Value.FeeCalculator.LamportsPerSignature); - - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetFeeCalculatorForBlockhashConfirmed() - { - var responseData = File.ReadAllText("Resources/Http/Fees/GetFeeCalculatorForBlockhashResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Fees/GetFeeCalculatorForBlockhashConfirmedRequest.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.GetFeeCalculatorForBlockhash("GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ", Commitment.Confirmed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(221UL, result.Result.Context.Slot); - Assert.AreEqual(5000UL, result.Result.Value.FeeCalculator.LamportsPerSignature); - - FinishTest(messageHandlerMock, TestnetUri); - } - } } \ No newline at end of file diff --git a/test/Solnet.Rpc.Test/SolanaRpcClientSignaturesTest.cs b/test/Solnet.Rpc.Test/SolanaRpcClientSignaturesTest.cs index 9209e7ec..c89e9050 100644 --- a/test/Solnet.Rpc.Test/SolanaRpcClientSignaturesTest.cs +++ b/test/Solnet.Rpc.Test/SolanaRpcClientSignaturesTest.cs @@ -47,36 +47,6 @@ public void TestGetSignaturesForAddress() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetSignaturesForAddress2() - { - var responseData = File.ReadAllText("Resources/Http/Signatures/GetSignaturesForAddressResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Signatures/GetConfirmedSignaturesForAddress2Request.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.GetConfirmedSignaturesForAddress2("4Rf9mGD7FeYknun5JczX5nGLTfQuS1GRjNVfkEMKE92b", limit: 3); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(3, result.Result.Count); - Assert.AreEqual(1616245823UL, result.Result[0].BlockTime); - Assert.AreEqual(68710495UL, result.Result[0].Slot); - Assert.AreEqual("5Jofwx5JcPT1dMsgo6DkyT6x61X5chS9K7hM7huGKAnUq8xxHwGKuDnnZmPGoapWVZcN4cPvQtGNCicnWZfPHowr", result.Result[0].Signature); - Assert.AreEqual(null, result.Result[0].Memo); - Assert.AreEqual(null, result.Result[0].Error); - - FinishTest(messageHandlerMock, TestnetUri); - } - [TestMethod] public void TestGetSignaturesForAddress_InvalidCommitment() { @@ -95,24 +65,6 @@ public void TestGetSignaturesForAddress_InvalidCommitment() } - [TestMethod] - public void TestGetSignaturesForAddress2_InvalidCommitment() - { - - var sut = new SolanaRpcClient(TestnetUrl, null); - - try - { - var res = sut.GetConfirmedSignaturesForAddress2("4Rf9mGD7FeYknun5JczX5nGLTfQuS1GRjNVfkEMKE92b", commitment: Types.Commitment.Processed); - Assert.Fail("Should throw exception before here."); - } - catch (Exception e) - { - Assert.AreEqual(typeof(ArgumentException), e.InnerException.GetType()); - } - - } - [TestMethod] public void TestGetSignaturesForAddressUntil() { @@ -145,38 +97,6 @@ public void TestGetSignaturesForAddressUntil() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetSignaturesForAddress2Until() - { - var responseData = File.ReadAllText("Resources/Http/Signatures/GetSignaturesForAddressUntilResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Signatures/GetConfirmedSignaturesForAddress2UntilRequest.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.GetConfirmedSignaturesForAddress2( - "Vote111111111111111111111111111111111111111", - 1, until: "Vote111111111111111111111111111111111111111"); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(1, result.Result.Count); - Assert.AreEqual(null, result.Result[0].BlockTime); - Assert.AreEqual(114UL, result.Result[0].Slot); - Assert.AreEqual("5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", result.Result[0].Signature); - Assert.AreEqual(null, result.Result[0].Memo); - Assert.AreEqual(null, result.Result[0].Error); - - FinishTest(messageHandlerMock, TestnetUri); - } - [TestMethod] public void TestGetSignaturesForAddressBefore() { @@ -209,38 +129,6 @@ public void TestGetSignaturesForAddressBefore() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetSignaturesForAddress2Before() - { - var responseData = File.ReadAllText("Resources/Http/Signatures/GetSignaturesForAddressBeforeResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Signatures/GetConfirmedSignaturesForAddress2BeforeRequest.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.GetConfirmedSignaturesForAddress2( - "Vote111111111111111111111111111111111111111", - 1, before: "Vote111111111111111111111111111111111111111"); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(1, result.Result.Count); - Assert.AreEqual(null, result.Result[0].BlockTime); - Assert.AreEqual(114UL, result.Result[0].Slot); - Assert.AreEqual("5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", result.Result[0].Signature); - Assert.AreEqual(null, result.Result[0].Memo); - Assert.AreEqual(null, result.Result[0].Error); - - FinishTest(messageHandlerMock, TestnetUri); - } - [TestMethod] public void TestGetSignaturesForAddressBeforeConfirmed() { @@ -273,37 +161,6 @@ public void TestGetSignaturesForAddressBeforeConfirmed() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetSignaturesForAddress2BeforeConfirmed() - { - var responseData = File.ReadAllText("Resources/Http/Signatures/GetSignaturesForAddressBeforeResponse.json"); - var requestData = File.ReadAllText("Resources/Http/Signatures/GetConfirmedSignaturesForAddress2BeforeConfirmedRequest.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.GetConfirmedSignaturesForAddress2( - "Vote111111111111111111111111111111111111111", - 1, before: "Vote111111111111111111111111111111111111111", commitment: Types.Commitment.Confirmed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(1, result.Result.Count); - Assert.AreEqual(null, result.Result[0].BlockTime); - Assert.AreEqual(114UL, result.Result[0].Slot); - Assert.AreEqual("5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", result.Result[0].Signature); - Assert.AreEqual(null, result.Result[0].Memo); - Assert.AreEqual(null, result.Result[0].Error); - - FinishTest(messageHandlerMock, TestnetUri); - } [TestMethod] public void TestGetSignatureStatuses() diff --git a/test/Solnet.Rpc.Test/SolanaRpcClientTest.cs b/test/Solnet.Rpc.Test/SolanaRpcClientTest.cs index c0ac0526..d7e40442 100644 --- a/test/Solnet.Rpc.Test/SolanaRpcClientTest.cs +++ b/test/Solnet.Rpc.Test/SolanaRpcClientTest.cs @@ -604,31 +604,6 @@ public void TestGetRecentPerformanceSamples() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetSnapshotSlot() - { - var responseData = File.ReadAllText("Resources/Http/GetSnapshotSlotResponse.json"); - var requestData = File.ReadAllText("Resources/Http/GetSnapshotSlotRequest.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.GetSnapshotSlot(); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(100UL, result.Result); - - FinishTest(messageHandlerMock, TestnetUri); - } - [TestMethod] public void TestGetHighestSnapshotSlot() { @@ -711,88 +686,6 @@ public void TestGetSupplyProcessed() FinishTest(messageHandlerMock, TestnetUri); } - [TestMethod] - public void TestGetStakeActivation() - { - var responseData = File.ReadAllText("Resources/Http/GetStakeActivationResponse.json"); - var requestData = File.ReadAllText("Resources/Http/GetStakeActivationRequest.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.GetStakeActivation("CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT"); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(197717120UL, result.Result.Active); - Assert.AreEqual(0UL, result.Result.Inactive); - Assert.AreEqual("active", result.Result.State); - - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetStakeActivationWithEpoch() - { - var responseData = File.ReadAllText("Resources/Http/GetStakeActivationWithEpochResponse.json"); - var requestData = File.ReadAllText("Resources/Http/GetStakeActivationWithEpochRequest.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.GetStakeActivation("CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT", 4); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(124429280UL, result.Result.Active); - Assert.AreEqual(73287840UL, result.Result.Inactive); - Assert.AreEqual("activating", result.Result.State); - - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] - public void TestGetStakeActivationWithEpochProcessed() - { - var responseData = File.ReadAllText("Resources/Http/GetStakeActivationWithEpochResponse.json"); - var requestData = File.ReadAllText("Resources/Http/GetStakeActivationWithEpochProcessedRequest.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.GetStakeActivation("CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT", 4, Commitment.Processed); - - Assert.AreEqual(requestData, sentMessage); - Assert.IsNotNull(result.Result); - Assert.IsTrue(result.WasSuccessful); - Assert.AreEqual(124429280UL, result.Result.Active); - Assert.AreEqual(73287840UL, result.Result.Inactive); - Assert.AreEqual("activating", result.Result.State); - - FinishTest(messageHandlerMock, TestnetUri); - } - - [TestMethod] public void TestGetMinimumLedgerSlot() { diff --git a/test/Solnet.Rpc.Test/Solnet.Rpc.Test.csproj b/test/Solnet.Rpc.Test/Solnet.Rpc.Test.csproj index d9cd4ef9..bb1d6c85 100644 --- a/test/Solnet.Rpc.Test/Solnet.Rpc.Test.csproj +++ b/test/Solnet.Rpc.Test/Solnet.Rpc.Test.csproj @@ -198,12 +198,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -219,12 +213,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -579,12 +567,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -599,40 +581,10 @@ PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - + PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -671,50 +623,11 @@ PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - + + PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - + + PreserveNewest