From b73762acb6920e7649f81b55374fc27d565f1dad Mon Sep 17 00:00:00 2001 From: Aleksandr <44946855+Platonenkov@users.noreply.github.com> Date: Tue, 15 Sep 2026 19:27:23 +0000 Subject: [PATCH] fix(validation)!: validators throw on the calling thread, so BatchUtils.Build validates (#187) * fix(validation)!: validators throw on the calling thread, so BatchUtils.Build validates Validation.Validate and the 86 validators behind it were declared async Task without ever awaiting anything, and BatchUtils.Build called Validate without awaiting the result. An async method captures every exception into the task it returns, including the ones thrown before the first await, so a discarded task is a discarded verdict: ValidateBatch ran, decided the batch was malformed and reported it to nobody. A Batch built around a single inner transaction - which rippled answers with temARRAY_EMPTY - came back from Build looking well formed, and so did one with more than eight inners, with a Vault/Loan inner, with an inner missing tfInnerBatchTxn, or with an inner carrying a non-zero Fee. The compiler had been saying so as CS4014 since the method was written. The validators now return void and throw on the calling thread. Conditions, exception types and messages are unchanged; `await Validation.Validate(tx)` no longer compiles - drop the await. Making the signature honest is the fix rather than adding the missing await: Build is synchronous and public, so awaiting would have meant Task BuildAsync, and .GetAwaiter().GetResult() would have left the next caller the same trap. TestUCredentialsValidator wrapped the already-synchronous ValidateCredentialsList in Task.Run to fit the async assertion helper's Func. That worked while the helper awaited the task, and is exactly the shape that stops working once the assertion is synchronous, since Action accepts a lambda whose value is discarded. The nine tests call the validator directly now. Released as 11.5.1.0 rather than a major: the validators are opt-in, nothing inside the SDK calls them, and BatchUtils.Build - the one caller that did - is what this release fixes. CHANGES.md states the deviation for anyone calling Validation.* or Common.ValidateBaseTransaction directly. * docs(batch): say what ValidateBatch enforces, on the validator this release fixes --- CHANGES.md | 8 + .../transactions/TestIPermissionedDomain.cs | 6 +- Tests/Xrpl.Tests/Models/TestAMMBid.cs | 29 ++-- Tests/Xrpl.Tests/Models/TestAMMClawback.cs | 33 ++-- Tests/Xrpl.Tests/Models/TestAMMCreate.cs | 21 ++- Tests/Xrpl.Tests/Models/TestAMMDeposit.cs | 35 ++-- Tests/Xrpl.Tests/Models/TestAMMVote.cs | 21 ++- Tests/Xrpl.Tests/Models/TestAMMWithdraw.cs | 37 ++-- Tests/Xrpl.Tests/Models/TestAccountDelete.cs | 37 ++-- Tests/Xrpl.Tests/Models/TestAccountSet.cs | 53 +++--- .../Xrpl.Tests/Models/TestBaseTransaction.cs | 53 +++--- Tests/Xrpl.Tests/Models/TestCheckCancel.cs | 13 +- Tests/Xrpl.Tests/Models/TestCheckCash.cs | 31 ++-- Tests/Xrpl.Tests/Models/TestCheckCreate.cs | 45 +++-- Tests/Xrpl.Tests/Models/TestClawback.cs | 21 ++- .../Models/TestCredentialsValidator.cs | 55 +++--- Tests/Xrpl.Tests/Models/TestDIDDelete.cs | 7 +- Tests/Xrpl.Tests/Models/TestDIDSet.cs | 53 +++--- Tests/Xrpl.Tests/Models/TestDepositPreauth.cs | 63 ++++--- Tests/Xrpl.Tests/Models/TestEscrowCancel.cs | 23 ++- Tests/Xrpl.Tests/Models/TestEscrowCreate.cs | 51 +++--- Tests/Xrpl.Tests/Models/TestEscrowFinish.cs | 37 ++-- .../Xrpl.Tests/Models/TestMPTokenAuthorize.cs | 25 ++- .../Models/TestMPTokenIssuanceCreate.cs | 45 +++-- .../Models/TestMPTokenIssuanceDestroy.cs | 13 +- .../Models/TestMPTokenIssuanceSet.cs | 33 ++-- Tests/Xrpl.Tests/Models/TestModelUtils.cs | 5 +- .../Models/TestNFTokenAcceptOffer.cs | 41 +++-- Tests/Xrpl.Tests/Models/TestNFTokenBurn.cs | 9 +- .../Models/TestNFTokenCancelOffer.cs | 13 +- .../Models/TestNFTokenCreateOffer.cs | 45 +++-- Tests/Xrpl.Tests/Models/TestNFTokenMint.cs | 17 +- Tests/Xrpl.Tests/Models/TestOfferCancel.cs | 19 +-- Tests/Xrpl.Tests/Models/TestOfferCreate.cs | 43 +++-- Tests/Xrpl.Tests/Models/TestOracleDelete.cs | 19 +-- Tests/Xrpl.Tests/Models/TestOracleSet.cs | 43 +++-- Tests/Xrpl.Tests/Models/TestPayment.cs | 73 ++++---- .../Models/TestPaymentChannelClaim.cs | 45 +++-- .../Models/TestPaymentChannelCreate.cs | 51 +++--- .../Models/TestPaymentChannelFund.cs | 31 ++-- .../Models/TestPermissionedDomainDelete.cs | 15 +- .../Models/TestPermissionedDomainSet.cs | 53 +++--- Tests/Xrpl.Tests/Models/TestSetRegularKey.cs | 15 +- Tests/Xrpl.Tests/Models/TestSignerListSet.cs | 31 ++-- Tests/Xrpl.Tests/Models/TestTicketCreate.cs | 27 ++- Tests/Xrpl.Tests/Models/TestTrustSet.cs | 23 ++- Tests/Xrpl.Tests/Models/TestUBatchUtils.cs | 59 +++++++ .../Xrpl.Tests/Models/TestUConfidentialMPT.cs | 21 ++- Tests/Xrpl.Tests/Models/TestUModelTruth.cs | 4 +- .../Models/TestUProtocolCompleteness.cs | 29 ++-- .../Models/TestUTransactionProtocolFields.cs | 6 +- .../Models/TestUValidationNumericTypes.cs | 35 ++-- .../Xrpl.Tests/Wallet/TestUBatchCoSigning.cs | 25 ++- Xrpl/Models/Transactions/AMMBid.cs | 6 +- Xrpl/Models/Transactions/AMMClawBack.cs | 5 +- Xrpl/Models/Transactions/AMMCreate.cs | 6 +- Xrpl/Models/Transactions/AMMDelete.cs | 6 +- Xrpl/Models/Transactions/AMMDeposit.cs | 6 +- Xrpl/Models/Transactions/AMMVote.cs | 6 +- Xrpl/Models/Transactions/AMMWithdraw.cs | 5 +- Xrpl/Models/Transactions/AccountDelete.cs | 5 +- Xrpl/Models/Transactions/AccountSet.cs | 5 +- Xrpl/Models/Transactions/Batch.cs | 12 +- Xrpl/Models/Transactions/CheckCancel.cs | 5 +- Xrpl/Models/Transactions/CheckCash.cs | 5 +- Xrpl/Models/Transactions/CheckCreate.cs | 5 +- Xrpl/Models/Transactions/ClawBack.cs | 6 +- Xrpl/Models/Transactions/Common.cs | 6 +- Xrpl/Models/Transactions/ConfidentialMPT.cs | 35 ++-- Xrpl/Models/Transactions/CredentialAccept.cs | 5 +- Xrpl/Models/Transactions/CredentialCreate.cs | 5 +- Xrpl/Models/Transactions/CredentialDelete.cs | 5 +- Xrpl/Models/Transactions/DIDDelete.cs | 5 +- Xrpl/Models/Transactions/DIDSet.cs | 5 +- Xrpl/Models/Transactions/DelegateSet.cs | 5 +- Xrpl/Models/Transactions/DepositPreauth.cs | 5 +- Xrpl/Models/Transactions/EscrowCancel.cs | 5 +- Xrpl/Models/Transactions/EscrowCreate.cs | 5 +- Xrpl/Models/Transactions/EscrowFinish.cs | 5 +- Xrpl/Models/Transactions/LedgerStateFix.cs | 5 +- .../Transactions/LoanBrokerCoverClawback.cs | 5 +- .../Transactions/LoanBrokerCoverDeposit.cs | 5 +- .../Transactions/LoanBrokerCoverWithdraw.cs | 5 +- Xrpl/Models/Transactions/LoanBrokerDelete.cs | 5 +- Xrpl/Models/Transactions/LoanBrokerSet.cs | 5 +- Xrpl/Models/Transactions/LoanDelete.cs | 5 +- Xrpl/Models/Transactions/LoanManage.cs | 5 +- Xrpl/Models/Transactions/LoanPay.cs | 5 +- Xrpl/Models/Transactions/LoanSet.cs | 5 +- Xrpl/Models/Transactions/MPTokenAuthorize.cs | 5 +- .../Transactions/MPTokenIssuanceCreate.cs | 5 +- .../Transactions/MPTokenIssuanceDestroy.cs | 5 +- .../Models/Transactions/MPTokenIssuanceSet.cs | 5 +- .../Models/Transactions/NFTokenAcceptOffer.cs | 11 +- Xrpl/Models/Transactions/NFTokenBurn.cs | 6 +- .../Models/Transactions/NFTokenCancelOffer.cs | 6 +- .../Models/Transactions/NFTokenCreateOffer.cs | 13 +- Xrpl/Models/Transactions/NFTokenMint.cs | 5 +- Xrpl/Models/Transactions/NFTokenModify.cs | 5 +- Xrpl/Models/Transactions/OfferCancel.cs | 5 +- Xrpl/Models/Transactions/OfferCreate.cs | 5 +- Xrpl/Models/Transactions/OracleDelete.cs | 5 +- Xrpl/Models/Transactions/OracleSet.cs | 5 +- Xrpl/Models/Transactions/Payment.cs | 13 +- .../Transactions/PaymentChannelClaim.cs | 5 +- .../Transactions/PaymentChannelCreate.cs | 5 +- .../Models/Transactions/PaymentChannelFund.cs | 5 +- .../Transactions/PermissionedDomainDelete.cs | 5 +- .../Transactions/PermissionedDomainSet.cs | 5 +- Xrpl/Models/Transactions/SetRegularKey.cs | 5 +- Xrpl/Models/Transactions/SignerListSet.cs | 5 +- Xrpl/Models/Transactions/SponsorshipSet.cs | 5 +- .../Transactions/SponsorshipTransfer.cs | 5 +- Xrpl/Models/Transactions/TicketCreate.cs | 5 +- Xrpl/Models/Transactions/TrustSet.cs | 5 +- Xrpl/Models/Transactions/Validation.cs | 161 +++++++++--------- Xrpl/Models/Transactions/VaultClawback.cs | 5 +- Xrpl/Models/Transactions/VaultCreate.cs | 5 +- Xrpl/Models/Transactions/VaultDelete.cs | 5 +- Xrpl/Models/Transactions/VaultDeposit.cs | 5 +- Xrpl/Models/Transactions/VaultSet.cs | 5 +- Xrpl/Models/Transactions/VaultWithdraw.cs | 5 +- .../Transactions/XChainAccountCreateCommit.cs | 5 +- .../XChainAddAccountCreateAttestation.cs | 5 +- .../Transactions/XChainAddClaimAttestation.cs | 5 +- Xrpl/Models/Transactions/XChainClaim.cs | 5 +- Xrpl/Models/Transactions/XChainCommit.cs | 5 +- .../Models/Transactions/XChainCreateBridge.cs | 5 +- .../Transactions/XChainCreateClaimID.cs | 5 +- .../Models/Transactions/XChainModifyBridge.cs | 5 +- Xrpl/Models/Utils/BatchUtils.cs | 4 + Xrpl/Xrpl.csproj | 2 +- 132 files changed, 1102 insertions(+), 1158 deletions(-) create mode 100644 Tests/Xrpl.Tests/Models/TestUBatchUtils.cs diff --git a/CHANGES.md b/CHANGES.md index f8f9f229..a384feb0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,13 @@ # Changes +## 11.5.1.0 15/09/2026 + +* **Transaction validation is synchronous, and `BatchUtils.Build` validates what it assembles** (**breaking**). `Validation.Validate` and all 86 per-transaction validators behind it were declared `async Task` without ever awaiting anything - every one of them is straight-line field checking. Nothing in the SDK is measurably faster for it, but one caller paid for the disguise: `BatchUtils.Build` called `Validation.Validate(...)` and discarded the task. An `async` method captures **every** exception into the task it returns, including the ones thrown before the first `await`, so a discarded task is a discarded verdict: `ValidateBatch` ran, decided the batch was malformed, and reported it to nobody. A Batch built around a single inner transaction - which rippled answers with `temARRAY_EMPTY` - came back from `Build` looking well formed, and so did one with more than eight inners, with a `Vault`/`Loan` inner, with an inner missing `tfInnerBatchTxn`, or with an inner carrying a non-zero `Fee`. The compiler had been saying so since the method was written (CS4014). + * the validators now return `void` and throw on the calling thread. `await Validation.Validate(tx)` no longer compiles: drop the `await`. This is the whole migration - the exception type, the message and the conditions are unchanged, and a `try`/`catch` around the call keeps working as it is. + * **this is a breaking change released as a patch, deliberately.** Semver would call it a major: the return type is part of a method's signature in IL, so an assembly built against 11.5.0.0 meets a `MissingMethodException` on 11.5.1.0 even where it never wrote `await`, and its sources need the `await` dropped before they compile again. It is numbered a patch because the validators are opt-in - nothing inside the SDK calls them, and `BatchUtils.Build`, the one caller that did, is the method this release fixes. If you call `Validation.*` or `Common.ValidateBaseTransaction` directly, treat this upgrade as a major one: rebuild, and drop the `await`. + * making the signature honest is what fixes the defect, rather than adding the missing `await`: `Build` is synchronous and public, so awaiting would have meant `Task BuildAsync`, and `.GetAwaiter().GetResult()` would have left the next caller the same trap. A validator that cannot be forgotten is a validator that has no task to forget. + * `TestUCredentialsValidator` wrapped the already-synchronous `CredentialsValidator.ValidateCredentialsList` in `Task.Run` purely to fit the async assertion helper's `Func`. The wrapper worked, because the helper awaited the task - but it is exactly the shape that stops working the moment the assertion becomes synchronous, since `Action` accepts a lambda whose value is discarded. The nine tests call the validator directly now. + ## 11.5.0.0 13/09/2026 * **What happened to the connection is readable from the type, instead of the message text** (the follow-up to #179). 11.4.0 made the behaviour correct - one owner per transition, an operation that was overtaken says so - but gave the caller no way to read that answer. `NotConnectedException` carried five different events and `OperationCanceledException` two, so the only way to tell "the consumer disconnected the client" from "this endpoint is not answering" was to classify by message text - which the release notes of 11.3.2.0 told consumers not to do, while the library gave them no type capable of it. diff --git a/Tests/Xrpl.Tests/Integration/transactions/TestIPermissionedDomain.cs b/Tests/Xrpl.Tests/Integration/transactions/TestIPermissionedDomain.cs index 0228e765..23ff8aa7 100644 --- a/Tests/Xrpl.Tests/Integration/transactions/TestIPermissionedDomain.cs +++ b/Tests/Xrpl.Tests/Integration/transactions/TestIPermissionedDomain.cs @@ -488,7 +488,7 @@ public async Task TestOfferCreate_HybridFlag_WithoutDomainID_ShouldFail() try { - await Validation.ValidateOfferCreate(hybridOfferNoDoamin); + Validation.ValidateOfferCreate(hybridOfferNoDoamin); Assert.Fail("Should have thrown ValidationException for tfHybrid without DomainID"); } catch (ValidationException ex) @@ -512,7 +512,7 @@ public async Task TestOfferCreate_InvalidDomainID_ShouldFail() try { - await Validation.ValidateOfferCreate(invalidDomainIdOffer); + Validation.ValidateOfferCreate(invalidDomainIdOffer); Assert.Fail("Should have thrown ValidationException for invalid DomainID"); } catch (ValidationException ex) @@ -536,7 +536,7 @@ public async Task TestPayment_InvalidDomainID_ShouldFail() try { - await Validation.ValidatePayment(invalidDomainIdPayment); + Validation.ValidatePayment(invalidDomainIdPayment); Assert.Fail("Should have thrown ValidationException for invalid DomainID"); } catch (ValidationException ex) diff --git a/Tests/Xrpl.Tests/Models/TestAMMBid.cs b/Tests/Xrpl.Tests/Models/TestAMMBid.cs index a177b8da..8bae8c65 100644 --- a/Tests/Xrpl.Tests/Models/TestAMMBid.cs +++ b/Tests/Xrpl.Tests/Models/TestAMMBid.cs @@ -5,7 +5,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -63,36 +62,36 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid AMMBid - await Validation.Validate(bid); + Validation.Validate(bid); //throws w/ missing field Asset bid.Remove("Asset"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: missing field Asset"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: missing field Asset"); bid["Asset"] = new Dictionary() { { "currency", "XRP" } }; //throws w/ Asset must be an Issue bid["Asset"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: Asset must be an Issue"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: Asset must be an Issue"); bid["Asset"] = new Dictionary() { { "currency", "XRP" } }; //throws w/ missing field Asset2 bid.Remove("Asset2"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: missing field Asset2"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: missing field Asset2"); bid["Asset2"] = new Dictionary() { { "currency", "ETH" }, { "issuer", "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd" } }; //throws w/ Asset2 must be an Issue bid["Asset2"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: Asset2 must be an Issue"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: Asset2 must be an Issue"); bid["Asset2"] = new Dictionary() { { "currency", "ETH" }, { "issuer", "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd" } }; //throws w/ BidMin must be an Amount bid["BidMin"] = 5; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: BidMin must be an Amount"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: BidMin must be an Amount"); bid["BidMin"] = "5"; //throws w/ BidMax must be an Amount bid["BidMax"] = 10; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: BidMax must be an Amount"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: BidMax must be an Amount"); bid["BidMax"] = "10"; //throws w/ AuthAccounts length must not be greater than 4 @@ -130,11 +129,11 @@ public async Task TestVerifyValid() }} }, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: AuthAccounts length must not be greater than 4"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: AuthAccounts length must not be greater than 4"); //throws w/ AuthAccounts must be an AuthAccount array bid["AuthAccounts"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: AuthAccounts must be an AuthAccount array"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: AuthAccounts must be an AuthAccount array"); bid["AuthAccounts"] = new List>() { @@ -163,7 +162,7 @@ public async Task TestVerifyValid() }; //throws w/ invalid AuthAccounts when AuthAccount is undefined - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: invalid AuthAccounts"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: invalid AuthAccounts"); //throws w/ invalid AuthAccounts when AuthAccount is not an object bid["AuthAccounts"] = new List>() { @@ -190,7 +189,7 @@ public async Task TestVerifyValid() }} } }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: invalid AuthAccounts"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: invalid AuthAccounts"); // throws w/ invalid AuthAccounts when AuthAccount.Account is not a string bid["AuthAccounts"] = new List>() { @@ -220,7 +219,7 @@ public async Task TestVerifyValid() }} } }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: invalid AuthAccounts"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: invalid AuthAccounts"); //throws w/ AuthAccounts must not include sender's address bid["AuthAccounts"] = new List>() { @@ -250,7 +249,7 @@ public async Task TestVerifyValid() }} } }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(bid), "AMMBid: AuthAccounts must not include sender's address"); + Helper.ThrowsException(() => Validation.Validate(bid), "AMMBid: AuthAccounts must not include sender's address"); } } diff --git a/Tests/Xrpl.Tests/Models/TestAMMClawback.cs b/Tests/Xrpl.Tests/Models/TestAMMClawback.cs index 003629ff..07702d12 100644 --- a/Tests/Xrpl.Tests/Models/TestAMMClawback.cs +++ b/Tests/Xrpl.Tests/Models/TestAMMClawback.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -28,63 +27,63 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { - await Validation.Validate(ammClawback); + Validation.Validate(ammClawback); } [TestMethod] - public async Task TestThrowsMissingHolder() + public void TestThrowsMissingHolder() { var tx = new Dictionary(ammClawback); tx.Remove("Holder"); - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(tx), "AMMClawback: missing field Holder"); } [TestMethod] - public async Task TestThrowsMissingAsset() + public void TestThrowsMissingAsset() { var tx = new Dictionary(ammClawback); tx.Remove("Asset"); - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(tx), "AMMClawback: missing field Asset"); } [TestMethod] - public async Task TestThrowsAssetMustBeIssue() + public void TestThrowsAssetMustBeIssue() { var tx = new Dictionary(ammClawback); tx["Asset"] = 1234; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(tx), "AMMClawback: Asset must be an Issue"); } [TestMethod] - public async Task TestThrowsMissingAsset2() + public void TestThrowsMissingAsset2() { var tx = new Dictionary(ammClawback); tx.Remove("Asset2"); - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(tx), "AMMClawback: missing field Asset2"); } [TestMethod] - public async Task TestThrowsAsset2MustBeIssue() + public void TestThrowsAsset2MustBeIssue() { var tx = new Dictionary(ammClawback); tx["Asset2"] = 1234; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(tx), "AMMClawback: Asset2 must be an Issue"); } [TestMethod] - public async Task TestValidWithOptionalAmount() + public void TestValidWithOptionalAmount() { var tx = new Dictionary(ammClawback); tx["Amount"] = new Dictionary() @@ -93,15 +92,15 @@ public async Task TestValidWithOptionalAmount() {"issuer","rp6abvbTbjoce8ZDJkT6snvxTZSYMBCC9S"}, {"value","100"}, }; - await Validation.Validate(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestThrowsInvalidAmountXRP() + public void TestThrowsInvalidAmountXRP() { var tx = new Dictionary(ammClawback); tx["Amount"] = "1000000"; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(tx), "AMMClawback: invalid Amount"); } diff --git a/Tests/Xrpl.Tests/Models/TestAMMCreate.cs b/Tests/Xrpl.Tests/Models/TestAMMCreate.cs index bd72b13c..44d94cc8 100644 --- a/Tests/Xrpl.Tests/Models/TestAMMCreate.cs +++ b/Tests/Xrpl.Tests/Models/TestAMMCreate.cs @@ -3,7 +3,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -35,23 +34,23 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid AMMCreate - await Validation.Validate(ammCreate); + Validation.Validate(ammCreate); //throws w/ missing Amount ammCreate.Remove("Amount"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ammCreate), "AMMCreate: missing field Amount"); + Helper.ThrowsException(() => Validation.Validate(ammCreate), "AMMCreate: missing field Amount"); ammCreate["Amount"] = "1000"; //throws w/ Amount must be an Amount ammCreate["Amount"] = 1000; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ammCreate), "AMMCreate: Amount must be an Amount"); + Helper.ThrowsException(() => Validation.Validate(ammCreate), "AMMCreate: Amount must be an Amount"); ammCreate["Amount"] = "1000"; //throws w/ missing Amount2 ammCreate.Remove("Amount2"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ammCreate), "AMMCreate: missing field Amount2"); + Helper.ThrowsException(() => Validation.Validate(ammCreate), "AMMCreate: missing field Amount2"); ammCreate["Amount2"] = new Dictionary() { {"currency","USD"}, @@ -60,7 +59,7 @@ public async Task TestVerifyValid() }; //throws w/ Amount must be an Amount2 ammCreate["Amount2"] = 1000; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ammCreate), "AMMCreate: Amount2 must be an Amount"); + Helper.ThrowsException(() => Validation.Validate(ammCreate), "AMMCreate: Amount2 must be an Amount"); ammCreate["Amount2"] = new Dictionary() { {"currency","USD"}, @@ -69,20 +68,20 @@ public async Task TestVerifyValid() }; //throws w/ missing TradingFee ammCreate.Remove("TradingFee"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ammCreate), "AMMCreate: missing field TradingFee"); + Helper.ThrowsException(() => Validation.Validate(ammCreate), "AMMCreate: missing field TradingFee"); ammCreate["TradingFee"] = 12u; //throws w/ TradingFee must be a number ammCreate["TradingFee"] = "12"; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ammCreate), "AMMCreate: TradingFee must be a number"); + Helper.ThrowsException(() => Validation.Validate(ammCreate), "AMMCreate: TradingFee must be a number"); ammCreate["TradingFee"] = 12u; //throws when TradingFee is greater than 1000 ammCreate["TradingFee"] = 1001u; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ammCreate), "AMMCreate: TradingFee must be between 0 and 1000"); + Helper.ThrowsException(() => Validation.Validate(ammCreate), "AMMCreate: TradingFee must be between 0 and 1000"); ammCreate["TradingFee"] = 12u; //throws TradingFee must be a number ammCreate["TradingFee"] = -1; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ammCreate), "AMMCreate: TradingFee must be a number"); + Helper.ThrowsException(() => Validation.Validate(ammCreate), "AMMCreate: TradingFee must be a number"); ammCreate["TradingFee"] = 12u; } diff --git a/Tests/Xrpl.Tests/Models/TestAMMDeposit.cs b/Tests/Xrpl.Tests/Models/TestAMMDeposit.cs index dbd8d507..e85345c2 100644 --- a/Tests/Xrpl.Tests/Models/TestAMMDeposit.cs +++ b/Tests/Xrpl.Tests/Models/TestAMMDeposit.cs @@ -3,7 +3,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -37,12 +36,12 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid AMMDeposit with LPTokenOut deposit["LPTokenOut"] = LPTokenOut; deposit["Flags"] = AMMDepositFlags.tfLPToken; - await Validation.Validate(deposit); + Validation.Validate(deposit); deposit.Remove("LPTokenOut"); deposit["Flags"] = 0u; @@ -50,7 +49,7 @@ public async Task TestVerifyValid() //verifies valid AMMDeposit with Amount deposit["Amount"] = "1000"; deposit["Flags"] = AMMDepositFlags.tfSingleAsset; - await Validation.Validate(deposit); + Validation.Validate(deposit); deposit.Remove("Amount"); deposit["Flags"] = 0u; @@ -63,7 +62,7 @@ public async Task TestVerifyValid() {"value","2.5"}, }; deposit["Flags"] = AMMDepositFlags.tfTwoAsset; - await Validation.Validate(deposit); + Validation.Validate(deposit); deposit.Remove("Amount"); deposit.Remove("Amount2"); deposit["Flags"] = 0u; @@ -73,7 +72,7 @@ public async Task TestVerifyValid() deposit["Amount"] = "1000"; deposit["LPTokenOut"] = LPTokenOut; deposit["Flags"] = AMMDepositFlags.tfOneAssetLPToken; - await Validation.Validate(deposit); + Validation.Validate(deposit); deposit.Remove("Amount"); deposit.Remove("LPTokenOut"); deposit["Flags"] = 0u; @@ -82,31 +81,31 @@ public async Task TestVerifyValid() deposit["Amount"] = "1000"; deposit["EPrice"] = "25"; deposit["Flags"] = AMMDepositFlags.tfLimitLPToken; - await Validation.Validate(deposit); + Validation.Validate(deposit); deposit.Remove("Amount"); deposit.Remove("EPrice"); deposit["Flags"] = 0u; //throws w/ missing field Asset deposit.Remove("Asset"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(deposit), "AMMDeposit: missing field Asset"); + Helper.ThrowsException(() => Validation.Validate(deposit), "AMMDeposit: missing field Asset"); deposit["Asset"] = new Dictionary() { { "currency", "XRP" } }; //throws w/ Asset must be an Issue deposit["Asset"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(deposit), "AMMDeposit: Asset must be an Issue"); + Helper.ThrowsException(() => Validation.Validate(deposit), "AMMDeposit: Asset must be an Issue"); deposit["Asset"] = new Dictionary() { { "currency", "XRP" } }; //throws w/ missing field Asset deposit.Remove("Asset2"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(deposit), "AMMDeposit: missing field Asset2"); + Helper.ThrowsException(() => Validation.Validate(deposit), "AMMDeposit: missing field Asset2"); deposit["Asset2"] = new Dictionary() { { "currency", "XRP" } }; //throws w/ Asset must be an Issue deposit["Asset2"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(deposit), "AMMDeposit: Asset2 must be an Issue"); + Helper.ThrowsException(() => Validation.Validate(deposit), "AMMDeposit: Asset2 must be an Issue"); deposit["Asset2"] = new Dictionary() { { "currency", "ETH" }, { "issuer", "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd" } }; //throws w/ must set at least LPTokenOut or Amount - await Helper.ThrowsExceptionAsync(() => Validation.Validate(deposit), "AMMDeposit: must set at least LPTokenOut or Amount"); + Helper.ThrowsException(() => Validation.Validate(deposit), "AMMDeposit: must set at least LPTokenOut or Amount"); //throws w/ must set Amount with Amount2 deposit["Amount2"] = new Dictionary() @@ -115,35 +114,35 @@ public async Task TestVerifyValid() { "issuer", "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd" }, { "value", "2.5" }, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(deposit), "AMMDeposit: must set Amount with Amount2"); + Helper.ThrowsException(() => Validation.Validate(deposit), "AMMDeposit: must set Amount with Amount2"); deposit.Remove("Amount2"); //throws w/ must set Amount with EPrice deposit["EPrice"] = "25"; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(deposit), "AMMDeposit: must set Amount with EPrice"); + Helper.ThrowsException(() => Validation.Validate(deposit), "AMMDeposit: must set Amount with EPrice"); deposit.Remove("EPrice"); //throws w/ LPTokenOut must be an IssuedCurrencyAmount deposit["LPTokenOut"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(deposit), "AMMDeposit: LPTokenOut must be an IssuedCurrencyAmount"); + Helper.ThrowsException(() => Validation.Validate(deposit), "AMMDeposit: LPTokenOut must be an IssuedCurrencyAmount"); deposit.Remove("LPTokenOut"); //throws w/ Amount must be an Amount deposit["Amount"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(deposit), "AMMDeposit: Amount must be an Amount"); + Helper.ThrowsException(() => Validation.Validate(deposit), "AMMDeposit: Amount must be an Amount"); deposit.Remove("Amount"); //throws w/ Amount2 must be an Amount deposit["Amount"] = "1000"; deposit["Amount2"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(deposit), "AMMDeposit: Amount2 must be an Amount"); + Helper.ThrowsException(() => Validation.Validate(deposit), "AMMDeposit: Amount2 must be an Amount"); deposit.Remove("Amount"); deposit.Remove("Amount2"); //throws w/ EPrice must be an Amount deposit["Amount"] = "1000"; deposit["EPrice"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(deposit), "AMMDeposit: EPrice must be an Amount"); + Helper.ThrowsException(() => Validation.Validate(deposit), "AMMDeposit: EPrice must be an Amount"); deposit.Remove("Amount"); deposit.Remove("EPrice"); diff --git a/Tests/Xrpl.Tests/Models/TestAMMVote.cs b/Tests/Xrpl.Tests/Models/TestAMMVote.cs index 2536f6f4..4da27d9c 100644 --- a/Tests/Xrpl.Tests/Models/TestAMMVote.cs +++ b/Tests/Xrpl.Tests/Models/TestAMMVote.cs @@ -3,7 +3,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -30,45 +29,45 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid AMMVote - await Validation.Validate(vote); + Validation.Validate(vote); //throws w/ missing field Asset vote.Remove("Asset"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(vote), "AMMVote: missing field Asset"); + Helper.ThrowsException(() => Validation.Validate(vote), "AMMVote: missing field Asset"); vote["Asset"] = new Dictionary() { { "currency", "XRP" } }; //throws w/ Asset must be an Issue vote["Asset"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(vote), "AMMVote: Asset must be an Issue"); + Helper.ThrowsException(() => Validation.Validate(vote), "AMMVote: Asset must be an Issue"); vote["Asset"] = new Dictionary() { { "currency", "XRP" } }; //throws w/ missing field Asset vote.Remove("Asset2"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(vote), "AMMVote: missing field Asset2"); + Helper.ThrowsException(() => Validation.Validate(vote), "AMMVote: missing field Asset2"); vote["Asset2"] = new Dictionary() { { "currency", "XRP" } }; //throws w/ Asset must be an Issue vote["Asset2"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(vote), "AMMVote: Asset2 must be an Issue"); + Helper.ThrowsException(() => Validation.Validate(vote), "AMMVote: Asset2 must be an Issue"); vote["Asset2"] = new Dictionary() { { "currency", "ETH" }, { "issuer", "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd" } }; //throws w/ missing TradingFee vote.Remove("TradingFee"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(vote), "AMMVote: missing field TradingFee"); + Helper.ThrowsException(() => Validation.Validate(vote), "AMMVote: missing field TradingFee"); vote["TradingFee"] = 12u; //throws w/ TradingFee must be a number vote["TradingFee"] = "12"; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(vote), "AMMVote: TradingFee must be a number"); + Helper.ThrowsException(() => Validation.Validate(vote), "AMMVote: TradingFee must be a number"); vote["TradingFee"] = 12u; //throws when TradingFee is greater than 1000 vote["TradingFee"] = 1001u; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(vote), "AMMVote: TradingFee must be between 0 and 1000"); + Helper.ThrowsException(() => Validation.Validate(vote), "AMMVote: TradingFee must be between 0 and 1000"); vote["TradingFee"] = 12u; //throws TradingFee must be a number vote["TradingFee"] = -1; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(vote), "AMMVote: TradingFee must be a number"); + Helper.ThrowsException(() => Validation.Validate(vote), "AMMVote: TradingFee must be a number"); vote["TradingFee"] = 12u; } diff --git a/Tests/Xrpl.Tests/Models/TestAMMWithdraw.cs b/Tests/Xrpl.Tests/Models/TestAMMWithdraw.cs index 4785afbc..f4cc7387 100644 --- a/Tests/Xrpl.Tests/Models/TestAMMWithdraw.cs +++ b/Tests/Xrpl.Tests/Models/TestAMMWithdraw.cs @@ -3,7 +3,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -37,12 +36,12 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid AMMWithdraw with LPTokenIn withdraw["LPTokenIn"] = LPTokenIn; withdraw["Flags"] = AMMWithdrawFlags.tfLPToken; - await Validation.Validate(withdraw); + Validation.Validate(withdraw); withdraw.Remove("LPTokenIn"); withdraw["Flags"] = 0u; @@ -50,7 +49,7 @@ public async Task TestVerifyValid() //verifies valid AMMWithdraw with Amount withdraw["Amount"] = "1000"; withdraw["Flags"] = AMMWithdrawFlags.tfSingleAsset; - await Validation.Validate(withdraw); + Validation.Validate(withdraw); withdraw.Remove("Amount"); withdraw["Flags"] = 0u; @@ -63,7 +62,7 @@ public async Task TestVerifyValid() {"value","2.5"}, }; withdraw["Flags"] = AMMWithdrawFlags.tfTwoAsset; - await Validation.Validate(withdraw); + Validation.Validate(withdraw); withdraw.Remove("Amount"); withdraw.Remove("Amount2"); withdraw["Flags"] = 0u; @@ -73,7 +72,7 @@ public async Task TestVerifyValid() withdraw["Amount"] = "1000"; withdraw["LPTokenIn"] = LPTokenIn; withdraw["Flags"] = AMMWithdrawFlags.tfOneAssetLPToken; - await Validation.Validate(withdraw); + Validation.Validate(withdraw); withdraw.Remove("Amount"); withdraw.Remove("LPTokenIn"); withdraw["Flags"] = 0u; @@ -82,7 +81,7 @@ public async Task TestVerifyValid() withdraw["Amount"] = "1000"; withdraw["EPrice"] = "25"; withdraw["Flags"] = AMMWithdrawFlags.tfLimitLPToken; - await Validation.Validate(withdraw); + Validation.Validate(withdraw); withdraw.Remove("Amount"); withdraw.Remove("EPrice"); withdraw["Flags"] = 0u; @@ -90,32 +89,32 @@ public async Task TestVerifyValid() //verifies valid AMMWithdraw one asset withdraw all withdraw["Amount"] = "1000"; withdraw["Flags"] = AMMWithdrawFlags.tfOneAssetWithdrawAll; - await Validation.Validate(withdraw); + Validation.Validate(withdraw); withdraw.Remove("Amount"); withdraw["Flags"] = 0u; //verifies valid AMMWithdraw withdraw all withdraw["Flags"] = AMMWithdrawFlags.tfWithdrawAll; - await Validation.Validate(withdraw); + Validation.Validate(withdraw); withdraw["Flags"] = 0u; //throws w/ missing field Asset withdraw.Remove("Asset"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(withdraw), "AMMWithdraw: missing field Asset"); + Helper.ThrowsException(() => Validation.Validate(withdraw), "AMMWithdraw: missing field Asset"); withdraw["Asset"] = new Dictionary() { { "currency", "XRP" } }; //throws w/ Asset must be an Issue withdraw["Asset"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(withdraw), "AMMWithdraw: Asset must be an Issue"); + Helper.ThrowsException(() => Validation.Validate(withdraw), "AMMWithdraw: Asset must be an Issue"); withdraw["Asset"] = new Dictionary() { { "currency", "XRP" } }; //throws w/ missing field Asset2 withdraw.Remove("Asset2"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(withdraw), "AMMWithdraw: missing field Asset2"); + Helper.ThrowsException(() => Validation.Validate(withdraw), "AMMWithdraw: missing field Asset2"); withdraw["Asset2"] = new Dictionary() { { "currency", "XRP" } }; //throws w/ Asset must be an Issue withdraw["Asset2"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(withdraw), "AMMWithdraw: Asset2 must be an Issue"); + Helper.ThrowsException(() => Validation.Validate(withdraw), "AMMWithdraw: Asset2 must be an Issue"); withdraw["Asset2"] = new Dictionary() { { "currency", "ETH" }, { "issuer", "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd" } }; //throws w/ must set Amount with Amount2 @@ -125,35 +124,35 @@ public async Task TestVerifyValid() { "issuer", "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd" }, { "value", "2.5" }, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(withdraw), "AMMWithdraw: must set Amount with Amount2"); + Helper.ThrowsException(() => Validation.Validate(withdraw), "AMMWithdraw: must set Amount with Amount2"); withdraw.Remove("Amount2"); //throws w/ must set Amount with EPrice withdraw["EPrice"] = "25"; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(withdraw), "AMMWithdraw: must set Amount with EPrice"); + Helper.ThrowsException(() => Validation.Validate(withdraw), "AMMWithdraw: must set Amount with EPrice"); withdraw.Remove("EPrice"); //throws w/ LPTokenIn must be an IssuedCurrencyAmount withdraw["LPTokenIn"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(withdraw), "AMMWithdraw: LPTokenIn must be an IssuedCurrencyAmount"); + Helper.ThrowsException(() => Validation.Validate(withdraw), "AMMWithdraw: LPTokenIn must be an IssuedCurrencyAmount"); withdraw.Remove("LPTokenIn"); //throws w/ Amount must be an Amount withdraw["Amount"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(withdraw), "AMMWithdraw: Amount must be an Amount"); + Helper.ThrowsException(() => Validation.Validate(withdraw), "AMMWithdraw: Amount must be an Amount"); withdraw.Remove("Amount"); //throws w/ Amount2 must be an Amount withdraw["Amount"] = "1000"; withdraw["Amount2"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(withdraw), "AMMWithdraw: Amount2 must be an Amount"); + Helper.ThrowsException(() => Validation.Validate(withdraw), "AMMWithdraw: Amount2 must be an Amount"); withdraw.Remove("Amount"); withdraw.Remove("Amount2"); //throws w/ EPrice must be an Amount withdraw["Amount"] = "1000"; withdraw["EPrice"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(withdraw), "AMMWithdraw: EPrice must be an Amount"); + Helper.ThrowsException(() => Validation.Validate(withdraw), "AMMWithdraw: EPrice must be an Amount"); withdraw.Remove("Amount"); withdraw.Remove("EPrice"); diff --git a/Tests/Xrpl.Tests/Models/TestAccountDelete.cs b/Tests/Xrpl.Tests/Models/TestAccountDelete.cs index 9c896d15..a574c7c3 100644 --- a/Tests/Xrpl.Tests/Models/TestAccountDelete.cs +++ b/Tests/Xrpl.Tests/Models/TestAccountDelete.cs @@ -4,7 +4,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; using Xrpl.Models.Transactions; @@ -15,7 +14,7 @@ namespace XrplTests.Xrpl.Models public class TestUAccountDelete { [TestMethod] - public async Task TestVerify_Valid_AccountDelete() + public void TestVerify_Valid_AccountDelete() { var tx = new Dictionary { @@ -27,10 +26,10 @@ public async Task TestVerify_Valid_AccountDelete() {"Sequence", 2470665u}, { "Flags", 2147483648u}, }; - await Validation.ValidateAccountDelete(tx); + Validation.ValidateAccountDelete(tx); } [TestMethod] - public async Task TestVerify_InValid_missing_Destination() + public void TestVerify_InValid_missing_Destination() { var tx = new Dictionary { @@ -40,11 +39,11 @@ public async Task TestVerify_InValid_missing_Destination() {"Sequence", 2470665u}, { "Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountDelete(tx), "AccountDelete: missing field Destination"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "AccountDelete: missing field Destination"); + Helper.ThrowsException(() => Validation.ValidateAccountDelete(tx), "AccountDelete: missing field Destination"); + Helper.ThrowsException(() => Validation.Validate(tx), "AccountDelete: missing field Destination"); } [TestMethod] - public async Task TestVerify_Invalid_Destination() + public void TestVerify_Invalid_Destination() { var tx = new Dictionary { @@ -55,11 +54,11 @@ public async Task TestVerify_Invalid_Destination() {"Sequence", 2470665u}, { "Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountDelete(tx), "AccountDelete: invalid Destination"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "AccountDelete: invalid Destination"); + Helper.ThrowsException(() => Validation.ValidateAccountDelete(tx), "AccountDelete: invalid Destination"); + Helper.ThrowsException(() => Validation.Validate(tx), "AccountDelete: invalid Destination"); } [TestMethod] - public async Task TestVerify_Invalid_DestinationTag() + public void TestVerify_Invalid_DestinationTag() { var tx = new Dictionary { @@ -71,12 +70,12 @@ public async Task TestVerify_Invalid_DestinationTag() {"Sequence", 2470665u}, { "Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountDelete(tx), "AccountDelete: invalid DestinationTag"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "AccountDelete: invalid DestinationTag"); + Helper.ThrowsException(() => Validation.ValidateAccountDelete(tx), "AccountDelete: invalid DestinationTag"); + Helper.ThrowsException(() => Validation.Validate(tx), "AccountDelete: invalid DestinationTag"); } [TestMethod] - public async Task TestVerify_Valid_AccountDelete_WithCredentialIDs() + public void TestVerify_Valid_AccountDelete_WithCredentialIDs() { var tx = new Dictionary { @@ -87,12 +86,12 @@ public async Task TestVerify_Valid_AccountDelete_WithCredentialIDs() { "Sequence", 2470665u }, { "CredentialIDs", new List { "A1B2C3D4E5F6789012345678901234567890ABCDEF1234567890ABCDEF123456" } } }; - await Validation.ValidateAccountDelete(tx); - await Validation.Validate(tx); + Validation.ValidateAccountDelete(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Invalid_AccountDelete_CredentialIDsTooMany() + public void TestVerify_Invalid_AccountDelete_CredentialIDsTooMany() { List ids = new List(); for (int i = 0; i < 9; i++) @@ -109,13 +108,13 @@ public async Task TestVerify_Invalid_AccountDelete_CredentialIDsTooMany() { "Sequence", 2470665u }, { "CredentialIDs", ids } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateAccountDelete(tx), "AccountDelete: CredentialIDs cannot contain more than 8 elements"); } [TestMethod] - public async Task TestVerify_Invalid_AccountDelete_CredentialIDsNonHex() + public void TestVerify_Invalid_AccountDelete_CredentialIDsNonHex() { var tx = new Dictionary { @@ -126,7 +125,7 @@ public async Task TestVerify_Invalid_AccountDelete_CredentialIDsNonHex() { "Sequence", 2470665u }, { "CredentialIDs", new List { new string('Z', 64) } } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateAccountDelete(tx), "AccountDelete: CredentialIDs[0] must be a 64-character hexadecimal object ID"); } diff --git a/Tests/Xrpl.Tests/Models/TestAccountSet.cs b/Tests/Xrpl.Tests/Models/TestAccountSet.cs index 6e414193..18c13a47 100644 --- a/Tests/Xrpl.Tests/Models/TestAccountSet.cs +++ b/Tests/Xrpl.Tests/Models/TestAccountSet.cs @@ -5,7 +5,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -33,67 +32,67 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid AccountSet - await Validation.ValidateAccountSet(accountSet); - await Validation.Validate(accountSet); + Validation.ValidateAccountSet(accountSet); + Validation.Validate(accountSet); //throws w/ invalid SetFlag (out of range; 12 is a valid asf value and int is a valid representation) accountSet["SetFlag"] = 9999; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid SetFlag"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(accountSet), "AccountSet: invalid SetFlag"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid SetFlag"); + Helper.ThrowsException(() => Validation.Validate(accountSet), "AccountSet: invalid SetFlag"); //throws w/ invalid SetFlag (incorrect type) accountSet["SetFlag"] = "abc"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid SetFlag"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(accountSet), "AccountSet: invalid SetFlag"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid SetFlag"); + Helper.ThrowsException(() => Validation.Validate(accountSet), "AccountSet: invalid SetFlag"); accountSet["SetFlag"] = 5u; //throws w/ invalid ClearFlag (out of range) accountSet["ClearFlag"] = 9999; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid ClearFlag"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(accountSet), "AccountSet: invalid ClearFlag"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid ClearFlag"); + Helper.ThrowsException(() => Validation.Validate(accountSet), "AccountSet: invalid ClearFlag"); accountSet.Remove("ClearFlag"); //throws w/ invalid Domain accountSet["Domain"] = 6578616; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid Domain"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(accountSet), "AccountSet: invalid Domain"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid Domain"); + Helper.ThrowsException(() => Validation.Validate(accountSet), "AccountSet: invalid Domain"); accountSet["Domain"] = "6578616D706C652E636F6D"; //throws w/ invalid EmailHash accountSet["EmailHash"] = 6578656789876543; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid EmailHash"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(accountSet), "AccountSet: invalid EmailHash"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid EmailHash"); + Helper.ThrowsException(() => Validation.Validate(accountSet), "AccountSet: invalid EmailHash"); accountSet.Remove("EmailHash"); //throws w/ invalid MessageKey accountSet["MessageKey"] = 6578656789876543; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid MessageKey"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(accountSet), "AccountSet: invalid MessageKey"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid MessageKey"); + Helper.ThrowsException(() => Validation.Validate(accountSet), "AccountSet: invalid MessageKey"); accountSet["MessageKey"] = "03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB"; //throws w/ invalid TransferRate accountSet["TransferRate"] = "1000000001"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid TransferRate"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(accountSet), "AccountSet: invalid TransferRate"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid TransferRate"); + Helper.ThrowsException(() => Validation.Validate(accountSet), "AccountSet: invalid TransferRate"); accountSet.Remove("TransferRate"); //throws w/ invalid TickSize (non-numeric type; int/long are valid integral representations) accountSet["TickSize"] = "5"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid TickSize"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(accountSet), "AccountSet: invalid TickSize"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(accountSet), "AccountSet: invalid TickSize"); + Helper.ThrowsException(() => Validation.Validate(accountSet), "AccountSet: invalid TickSize"); //throws w/ invalid TickSize accountSet["TickSize"] = 20u; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(accountSet), "AccountSet: out of TickSize"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(accountSet), "AccountSet: out of TickSize"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(accountSet), "AccountSet: out of TickSize"); + Helper.ThrowsException(() => Validation.Validate(accountSet), "AccountSet: out of TickSize"); accountSet.Remove("TickSize"); } [TestMethod] - public async Task TestUAccountSet_ValidatesWalletFieldTypes() + public void TestUAccountSet_ValidatesWalletFieldTypes() { Dictionary tx = new Dictionary { @@ -106,17 +105,17 @@ public async Task TestUAccountSet_ValidatesWalletFieldTypes() // Same rule the SignerListSet validator already applies to WalletLocator in a SignerEntry. tx["WalletLocator"] = new string('A', 64); tx["WalletSize"] = 3u; - await Validation.ValidateAccountSet(tx); + Validation.ValidateAccountSet(tx); tx["WalletLocator"] = 12345; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(tx), "AccountSet: invalid WalletLocator"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(tx), "AccountSet: invalid WalletLocator"); tx["WalletLocator"] = "not a hash"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(tx), "AccountSet: invalid WalletLocator"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(tx), "AccountSet: invalid WalletLocator"); tx["WalletLocator"] = new string('A', 64); tx["WalletSize"] = "3"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateAccountSet(tx), "AccountSet: invalid WalletSize"); + Helper.ThrowsException(() => Validation.ValidateAccountSet(tx), "AccountSet: invalid WalletSize"); } } } diff --git a/Tests/Xrpl.Tests/Models/TestBaseTransaction.cs b/Tests/Xrpl.Tests/Models/TestBaseTransaction.cs index 9d72937a..820f467e 100644 --- a/Tests/Xrpl.Tests/Models/TestBaseTransaction.cs +++ b/Tests/Xrpl.Tests/Models/TestBaseTransaction.cs @@ -5,7 +5,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -18,7 +17,7 @@ public class TestUBaseTransaction // todo: ask ripple/xrplf This should actually fail. //[TestMethod] - //public async Task TestVerify_Valid_all_optional_BaseTransaction() + //public void TestVerify_Valid_all_optional_BaseTransaction() //{ // var tx = new Dictionary // { @@ -61,21 +60,21 @@ public class TestUBaseTransaction // {"TicketSequence",10u}, // {"TxnSignature","3045022100C6708538AE5A697895937C758E99A595B57A16393F370F11B8D4C032E80B532002207776A8E85BB9FAF460A92113B9C60F170CD964196B1F084E0DAB65BAEC368B66"}, // }; - // await Common.ValidateBaseTransaction(tx); + // Common.ValidateBaseTransaction(tx); //} [TestMethod] - public async Task TestVerify_Valid_only_required_BaseTransaction() + public void TestVerify_Valid_only_required_BaseTransaction() { var tx = new Dictionary { { "Account", "r97KeayHuEsDwyU1yPBVtMLLoQr79QcRFe" }, {"TransactionType", "Payment"}, }; - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); } [TestMethod] - public async Task TestVerify_Invalid_Fee() + public void TestVerify_Invalid_Fee() { var tx = new Dictionary { @@ -83,10 +82,10 @@ public async Task TestVerify_Invalid_Fee() {"TransactionType", "Payment"}, {"Fee", 1000}, }; - await Helper.ThrowsExceptionAsync(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid Fee"); + Helper.ThrowsException(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid Fee"); } [TestMethod] - public async Task TestVerify_Invalid_Sequence() + public void TestVerify_Invalid_Sequence() { var tx = new Dictionary { @@ -94,10 +93,10 @@ public async Task TestVerify_Invalid_Sequence() {"TransactionType", "Payment"}, {"Sequence", "145"}, }; - await Helper.ThrowsExceptionAsync(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid Sequence"); + Helper.ThrowsException(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid Sequence"); } [TestMethod] - public async Task TestVerify_Invalid_AccountTxnID() + public void TestVerify_Invalid_AccountTxnID() { var tx = new Dictionary { @@ -105,10 +104,10 @@ public async Task TestVerify_Invalid_AccountTxnID() {"TransactionType", "Payment"}, {"AccountTxnID",new List(){"WRONG"}}, }; - await Helper.ThrowsExceptionAsync(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid AccountTxnID"); + Helper.ThrowsException(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid AccountTxnID"); } [TestMethod] - public async Task TestVerify_Invalid_LastLedgerSequence() + public void TestVerify_Invalid_LastLedgerSequence() { var tx = new Dictionary { @@ -116,10 +115,10 @@ public async Task TestVerify_Invalid_LastLedgerSequence() {"TransactionType", "Payment"}, {"LastLedgerSequence","1000"}, }; - await Helper.ThrowsExceptionAsync(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid LastLedgerSequence"); + Helper.ThrowsException(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid LastLedgerSequence"); } [TestMethod] - public async Task TestVerify_Invalid_SourceTag() + public void TestVerify_Invalid_SourceTag() { var tx = new Dictionary { @@ -127,10 +126,10 @@ public async Task TestVerify_Invalid_SourceTag() {"TransactionType", "Payment"}, {"SourceTag",new List(){"ARRAY"}}, }; - await Helper.ThrowsExceptionAsync(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid SourceTag"); + Helper.ThrowsException(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid SourceTag"); } [TestMethod] - public async Task TestVerify_Invalid_SigningPubKey() + public void TestVerify_Invalid_SigningPubKey() { var tx = new Dictionary { @@ -138,10 +137,10 @@ public async Task TestVerify_Invalid_SigningPubKey() {"TransactionType", "Payment"}, {"SigningPubKey",1000}, }; - await Helper.ThrowsExceptionAsync(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid SigningPubKey"); + Helper.ThrowsException(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid SigningPubKey"); } [TestMethod] - public async Task TestVerify_Invalid_TicketSequence() + public void TestVerify_Invalid_TicketSequence() { var tx = new Dictionary { @@ -149,10 +148,10 @@ public async Task TestVerify_Invalid_TicketSequence() {"TransactionType", "Payment"}, {"TicketSequence","1000"}, }; - await Helper.ThrowsExceptionAsync(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid TicketSequence"); + Helper.ThrowsException(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid TicketSequence"); } [TestMethod] - public async Task TestVerify_Invalid_TxnSignature() + public void TestVerify_Invalid_TxnSignature() { var tx = new Dictionary { @@ -160,10 +159,10 @@ public async Task TestVerify_Invalid_TxnSignature() {"TransactionType", "Payment"}, {"TxnSignature",1000}, }; - await Helper.ThrowsExceptionAsync(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid TxnSignature"); + Helper.ThrowsException(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid TxnSignature"); } [TestMethod] - public async Task TestVerify_Invalid_Signers_1() + public void TestVerify_Invalid_Signers_1() { var tx = new Dictionary { @@ -171,10 +170,10 @@ public async Task TestVerify_Invalid_Signers_1() {"TransactionType", "Payment"}, {"Signers",new List() { }}, }; - await Helper.ThrowsExceptionAsync(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid Signers"); + Helper.ThrowsException(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid Signers"); } [TestMethod] - public async Task TestVerify_Invalid_Signers_2() + public void TestVerify_Invalid_Signers_2() { var tx = new Dictionary { @@ -189,10 +188,10 @@ public async Task TestVerify_Invalid_Signers_2() } }}, }; - await Helper.ThrowsExceptionAsync(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid Signers"); + Helper.ThrowsException(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid Signers"); } [TestMethod] - public async Task TestVerify_Invalid_Memo() + public void TestVerify_Invalid_Memo() { var tx = new Dictionary { @@ -207,7 +206,7 @@ public async Task TestVerify_Invalid_Memo() }, }}, }; - await Helper.ThrowsExceptionAsync(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid Memos"); + Helper.ThrowsException(() => Common.ValidateBaseTransaction(tx), "BaseTransaction: invalid Memos"); } } diff --git a/Tests/Xrpl.Tests/Models/TestCheckCancel.cs b/Tests/Xrpl.Tests/Models/TestCheckCancel.cs index b2e98bf4..1ca5e238 100644 --- a/Tests/Xrpl.Tests/Models/TestCheckCancel.cs +++ b/Tests/Xrpl.Tests/Models/TestCheckCancel.cs @@ -5,7 +5,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; @@ -17,7 +16,7 @@ namespace XrplTests.Xrpl.Models public class TestUCheckCancel { [TestMethod] - public async Task TestVerify_Valid_CheckCancel() + public void TestVerify_Valid_CheckCancel() { var tx = new Dictionary { @@ -25,11 +24,11 @@ public async Task TestVerify_Valid_CheckCancel() {"Account", "rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm"}, {"CheckID", "49647F0D748DC3FE26BDACBC57F251AADEFFF391403EC9BF87C97F67E9977FB0"}, }; - await Validation.ValidateCheckCancel(tx); - await Validation.Validate(tx); + Validation.ValidateCheckCancel(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_InValid_CheckID() + public void TestVerify_InValid_CheckID() { var tx = new Dictionary { @@ -37,8 +36,8 @@ public async Task TestVerify_InValid_CheckID() {"Account", "rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm" }, {"CheckID", 4964734566545678 }, //todo no check for CheckID size }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateCheckCancel(tx)); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx)); + Helper.ThrowsException(() => Validation.ValidateCheckCancel(tx)); + Helper.ThrowsException(() => Validation.Validate(tx)); } } diff --git a/Tests/Xrpl.Tests/Models/TestCheckCash.cs b/Tests/Xrpl.Tests/Models/TestCheckCash.cs index eced9741..4e6ea10a 100644 --- a/Tests/Xrpl.Tests/Models/TestCheckCash.cs +++ b/Tests/Xrpl.Tests/Models/TestCheckCash.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -17,7 +16,7 @@ namespace XrplTests.Xrpl.Models public class TestUCheckCash { [TestMethod] - public async Task TestVerify_Valid_CheckCash() + public void TestVerify_Valid_CheckCash() { var tx = new Dictionary { @@ -27,11 +26,11 @@ public async Task TestVerify_Valid_CheckCash() {"CheckID", "838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334"}, {"Fee", "12"}, }; - await Validation.ValidateCheckCash(tx); - await Validation.Validate(tx); + Validation.ValidateCheckCash(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_InValid_CheckID() + public void TestVerify_InValid_CheckID() { var tx = new Dictionary { @@ -40,11 +39,11 @@ public async Task TestVerify_InValid_CheckID() {"CheckID", 83876645678567890 }, {"Amount", "100000000"} }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateCheckCash(tx), "CheckCash: invalid CheckID"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "CheckCash: invalid CheckID"); + Helper.ThrowsException(() => Validation.ValidateCheckCash(tx), "CheckCash: invalid CheckID"); + Helper.ThrowsException(() => Validation.Validate(tx), "CheckCash: invalid CheckID"); } [TestMethod] - public async Task TestVerify_InValid_Amount() + public void TestVerify_InValid_Amount() { var tx = new Dictionary { @@ -53,11 +52,11 @@ public async Task TestVerify_InValid_Amount() {"CheckID", "838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334"}, {"Amount", 100000000} }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateCheckCash(tx), "CheckCash: invalid Amount"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "CheckCash: invalid Amount"); + Helper.ThrowsException(() => Validation.ValidateCheckCash(tx), "CheckCash: invalid Amount"); + Helper.ThrowsException(() => Validation.Validate(tx), "CheckCash: invalid Amount"); } [TestMethod] - public async Task TestVerify_InValid_having_both_Amount_and_DeliverMin() + public void TestVerify_InValid_having_both_Amount_and_DeliverMin() { var tx = new Dictionary { @@ -67,11 +66,11 @@ public async Task TestVerify_InValid_having_both_Amount_and_DeliverMin() {"Amount", "100000000"}, {"DeliverMin", 852156963} }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateCheckCash(tx), "CheckCash: cannot have both Amount and DeliverMin"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "CheckCash: cannot have both Amount and DeliverMin"); + Helper.ThrowsException(() => Validation.ValidateCheckCash(tx), "CheckCash: cannot have both Amount and DeliverMin"); + Helper.ThrowsException(() => Validation.Validate(tx), "CheckCash: cannot have both Amount and DeliverMin"); } [TestMethod] - public async Task TestVerify_InValid_DeliverMin() + public void TestVerify_InValid_DeliverMin() { var tx = new Dictionary { @@ -80,8 +79,8 @@ public async Task TestVerify_InValid_DeliverMin() {"CheckID", "838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334"}, {"DeliverMin", 852156963} }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateCheckCash(tx), "CheckCash: invalid DeliverMin"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "CheckCash: invalid DeliverMin"); + Helper.ThrowsException(() => Validation.ValidateCheckCash(tx), "CheckCash: invalid DeliverMin"); + Helper.ThrowsException(() => Validation.Validate(tx), "CheckCash: invalid DeliverMin"); } } diff --git a/Tests/Xrpl.Tests/Models/TestCheckCreate.cs b/Tests/Xrpl.Tests/Models/TestCheckCreate.cs index b895135a..44ad5c25 100644 --- a/Tests/Xrpl.Tests/Models/TestCheckCreate.cs +++ b/Tests/Xrpl.Tests/Models/TestCheckCreate.cs @@ -4,7 +4,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; using Xrpl.Models.Transactions; @@ -15,7 +14,7 @@ namespace XrplTests.Xrpl.Models public class TestUCheckCreate { [TestMethod] - public async Task TestVerify_Valid_CheckCreate() + public void TestVerify_Valid_CheckCreate() { var tx = new Dictionary { @@ -28,11 +27,11 @@ public async Task TestVerify_Valid_CheckCreate() {"DestinationTag", 1u}, {"Fee", "12"}, }; - await Validation.ValidateCheckCreate(tx); - await Validation.Validate(tx); + Validation.ValidateCheckCreate(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_InValid_Destination() + public void TestVerify_InValid_Destination() { var tx = new Dictionary { @@ -45,11 +44,11 @@ public async Task TestVerify_InValid_Destination() {"DestinationTag", 1u}, {"Fee", "12"}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateCheckCreate(tx), "CheckCreate: invalid Destination"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "CheckCreate: invalid Destination"); + Helper.ThrowsException(() => Validation.ValidateCheckCreate(tx), "CheckCreate: invalid Destination"); + Helper.ThrowsException(() => Validation.Validate(tx), "CheckCreate: invalid Destination"); } [TestMethod] - public async Task TestVerify_InValid_SendMax() + public void TestVerify_InValid_SendMax() { var tx = new Dictionary { @@ -62,11 +61,11 @@ public async Task TestVerify_InValid_SendMax() {"DestinationTag", 1u}, {"Fee", "12"}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateCheckCreate(tx), "CheckCreate: invalid SendMax"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "CheckCreate: invalid SendMax"); + Helper.ThrowsException(() => Validation.ValidateCheckCreate(tx), "CheckCreate: invalid SendMax"); + Helper.ThrowsException(() => Validation.Validate(tx), "CheckCreate: invalid SendMax"); } [TestMethod] - public async Task TestVerify_InValid_DestinationTag() + public void TestVerify_InValid_DestinationTag() { var tx = new Dictionary { @@ -79,11 +78,11 @@ public async Task TestVerify_InValid_DestinationTag() {"DestinationTag", "1"}, {"Fee", "12"}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateCheckCreate(tx), "CheckCreate: invalid DestinationTag"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "CheckCreate: invalid DestinationTag"); + Helper.ThrowsException(() => Validation.ValidateCheckCreate(tx), "CheckCreate: invalid DestinationTag"); + Helper.ThrowsException(() => Validation.Validate(tx), "CheckCreate: invalid DestinationTag"); } [TestMethod] - public async Task TestVerify_InValid_Expiration() + public void TestVerify_InValid_Expiration() { var tx = new Dictionary { @@ -96,11 +95,11 @@ public async Task TestVerify_InValid_Expiration() {"DestinationTag", 1u}, {"Fee", "12"}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateCheckCreate(tx), "CheckCreate: invalid Expiration"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "CheckCreate: invalid Expiration"); + Helper.ThrowsException(() => Validation.ValidateCheckCreate(tx), "CheckCreate: invalid Expiration"); + Helper.ThrowsException(() => Validation.Validate(tx), "CheckCreate: invalid Expiration"); } [TestMethod] - public async Task TestVerify_InValid_InvoiceID() + public void TestVerify_InValid_InvoiceID() { var tx = new Dictionary { @@ -113,8 +112,8 @@ public async Task TestVerify_InValid_InvoiceID() {"DestinationTag", 1u}, {"Fee", "12"}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateCheckCreate(tx), "CheckCreate: invalid InvoiceID"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "CheckCreate: invalid InvoiceID"); + Helper.ThrowsException(() => Validation.ValidateCheckCreate(tx), "CheckCreate: invalid InvoiceID"); + Helper.ThrowsException(() => Validation.Validate(tx), "CheckCreate: invalid InvoiceID"); } [TestMethod] @@ -143,7 +142,7 @@ public void TestUCheckCreate_InvoiceIDIsAHash256() } [TestMethod] - public async Task TestUCheckCreate_RejectsInvoiceIDThatIsNotA256BitHexValue() + public void TestUCheckCreate_RejectsInvoiceIDThatIsNotA256BitHexValue() { // sfInvoiceID is Hash256. A string of the wrong length or with non-hex characters is // malformed and must fail validation rather than blow up later inside the codec — @@ -168,14 +167,14 @@ public async Task TestUCheckCreate_RejectsInvoiceIDThatIsNotA256BitHexValue() { "Fee", "12" }, }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateCheckCreate(tx), "CheckCreate: invalid InvoiceID"); } } [TestMethod] - public async Task TestUCheckCreate_AcceptsA256BitHexInvoiceID() + public void TestUCheckCreate_AcceptsA256BitHexInvoiceID() { Dictionary tx = new Dictionary { @@ -187,7 +186,7 @@ public async Task TestUCheckCreate_AcceptsA256BitHexInvoiceID() { "Fee", "12" }, }; - await Validation.ValidateCheckCreate(tx); + Validation.ValidateCheckCreate(tx); } } diff --git a/Tests/Xrpl.Tests/Models/TestClawback.cs b/Tests/Xrpl.Tests/Models/TestClawback.cs index 7301c6c3..6cfbfc2c 100644 --- a/Tests/Xrpl.Tests/Models/TestClawback.cs +++ b/Tests/Xrpl.Tests/Models/TestClawback.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -31,33 +30,33 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { - await Validation.Validate(clawback); + Validation.Validate(clawback); } [TestMethod] - public async Task TestThrowsMissingAmount() + public void TestThrowsMissingAmount() { var tx = new Dictionary(clawback); tx.Remove("Amount"); - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(tx), "ClawBack: missing field Amount"); } [TestMethod] - public async Task TestThrowsInvalidAmountXRP() + public void TestThrowsInvalidAmountXRP() { var tx = new Dictionary(clawback); tx["Amount"] = "1000000"; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(tx), "ClawBack: invalid Amount"); } [TestMethod] - public async Task TestThrowsHolderSameAsAccount() + public void TestThrowsHolderSameAsAccount() { var tx = new Dictionary(clawback); tx["Amount"] = new Dictionary() @@ -66,17 +65,17 @@ public async Task TestThrowsHolderSameAsAccount() {"issuer","rp6abvbTbjoce8ZDJkT6snvxTZSYMBCC9S"}, {"value","100"}, }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(tx), "ClawBack: invalid holder Account"); } [TestMethod] - public async Task TestValidWithHolderForMPT() + public void TestValidWithHolderForMPT() { var tx = new Dictionary(clawback); tx["Holder"] = "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"; - await Validation.Validate(tx); + Validation.Validate(tx); } } } diff --git a/Tests/Xrpl.Tests/Models/TestCredentialsValidator.cs b/Tests/Xrpl.Tests/Models/TestCredentialsValidator.cs index d3004813..3009c5e0 100644 --- a/Tests/Xrpl.Tests/Models/TestCredentialsValidator.cs +++ b/Tests/Xrpl.Tests/Models/TestCredentialsValidator.cs @@ -3,7 +3,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -26,15 +25,15 @@ public void NullList_NoOp() } [TestMethod] - public async Task EmptyList_Throws() + public void EmptyList_Throws() { - await Helper.ThrowsExceptionAsync( - () => Task.Run(() => CredentialsValidator.ValidateCredentialsList(new List(), TxType, Field, isStringID: true)), + Helper.ThrowsException( + () => CredentialsValidator.ValidateCredentialsList(new List(), TxType, Field, isStringID: true), $"{TxType}: {Field} cannot be empty"); } [TestMethod] - public async Task TooManyItems_Throws() + public void TooManyItems_Throws() { List ids = new List(); for (int i = 0; i < 9; i++) @@ -42,35 +41,35 @@ public async Task TooManyItems_Throws() ids.Add(ValidId1.Substring(0, 60) + i.ToString("X4")); } - await Helper.ThrowsExceptionAsync( - () => Task.Run(() => CredentialsValidator.ValidateCredentialsList(ids, TxType, Field, isStringID: true)), + Helper.ThrowsException( + () => CredentialsValidator.ValidateCredentialsList(ids, TxType, Field, isStringID: true), $"{TxType}: {Field} cannot contain more than 8 elements"); } [TestMethod] - public async Task NonHex_Throws() + public void NonHex_Throws() { List ids = new List { new string('Z', 64) }; - await Helper.ThrowsExceptionAsync( - () => Task.Run(() => CredentialsValidator.ValidateCredentialsList(ids, TxType, Field, isStringID: true)), + Helper.ThrowsException( + () => CredentialsValidator.ValidateCredentialsList(ids, TxType, Field, isStringID: true), $"{TxType}: {Field}[0] must be a 64-character hexadecimal object ID"); } [TestMethod] - public async Task WrongLength_Throws() + public void WrongLength_Throws() { List ids = new List { "ABC123" }; - await Helper.ThrowsExceptionAsync( - () => Task.Run(() => CredentialsValidator.ValidateCredentialsList(ids, TxType, Field, isStringID: true)), + Helper.ThrowsException( + () => CredentialsValidator.ValidateCredentialsList(ids, TxType, Field, isStringID: true), $"{TxType}: {Field}[0] must be a 64-character hexadecimal object ID"); } [TestMethod] - public async Task DuplicateIds_Throws() + public void DuplicateIds_Throws() { List ids = new List { ValidId1, ValidId1.ToLowerInvariant() }; - await Helper.ThrowsExceptionAsync( - () => Task.Run(() => CredentialsValidator.ValidateCredentialsList(ids, TxType, Field, isStringID: true)), + Helper.ThrowsException( + () => CredentialsValidator.ValidateCredentialsList(ids, TxType, Field, isStringID: true), $"{TxType}: {Field} cannot contain duplicate credential IDs"); } @@ -100,19 +99,19 @@ public void ValidObjects_Pass() } [TestMethod] - public async Task ObjectMissingCredential_Throws() + public void ObjectMissingCredential_Throws() { List objs = new List { new Dictionary() }; - await Helper.ThrowsExceptionAsync( - () => Task.Run(() => CredentialsValidator.ValidateCredentialsList(objs, TxType, "AuthorizeCredentials", isStringID: false)), + Helper.ThrowsException( + () => CredentialsValidator.ValidateCredentialsList(objs, TxType, "AuthorizeCredentials", isStringID: false), $"{TxType}: AuthorizeCredentials[0] must be an object with a Credential field"); } [TestMethod] - public async Task ObjectMissingIssuer_Throws() + public void ObjectMissingIssuer_Throws() { List objs = new List { @@ -125,13 +124,13 @@ public async Task ObjectMissingIssuer_Throws() } } }; - await Helper.ThrowsExceptionAsync( - () => Task.Run(() => CredentialsValidator.ValidateCredentialsList(objs, TxType, "AuthorizeCredentials", isStringID: false)), + Helper.ThrowsException( + () => CredentialsValidator.ValidateCredentialsList(objs, TxType, "AuthorizeCredentials", isStringID: false), $"{TxType}: AuthorizeCredentials[0].Credential.Issuer is required and must be a string"); } [TestMethod] - public async Task ObjectNonHexCredentialType_Throws() + public void ObjectNonHexCredentialType_Throws() { List objs = new List { @@ -145,13 +144,13 @@ public async Task ObjectNonHexCredentialType_Throws() } } }; - await Helper.ThrowsExceptionAsync( - () => Task.Run(() => CredentialsValidator.ValidateCredentialsList(objs, TxType, "AuthorizeCredentials", isStringID: false)), + Helper.ThrowsException( + () => CredentialsValidator.ValidateCredentialsList(objs, TxType, "AuthorizeCredentials", isStringID: false), $"{TxType}: AuthorizeCredentials[0].Credential.CredentialType must be a hexadecimal string"); } [TestMethod] - public async Task ObjectDuplicateCredentials_Throws() + public void ObjectDuplicateCredentials_Throws() { Dictionary cred = new Dictionary { @@ -163,8 +162,8 @@ public async Task ObjectDuplicateCredentials_Throws() } }; List objs = new List { cred, cred }; - await Helper.ThrowsExceptionAsync( - () => Task.Run(() => CredentialsValidator.ValidateCredentialsList(objs, TxType, "AuthorizeCredentials", isStringID: false)), + Helper.ThrowsException( + () => CredentialsValidator.ValidateCredentialsList(objs, TxType, "AuthorizeCredentials", isStringID: false), $"{TxType}: AuthorizeCredentials cannot contain duplicate credentials"); } } diff --git a/Tests/Xrpl.Tests/Models/TestDIDDelete.cs b/Tests/Xrpl.Tests/Models/TestDIDDelete.cs index b3d51e1e..09bfd22a 100644 --- a/Tests/Xrpl.Tests/Models/TestDIDDelete.cs +++ b/Tests/Xrpl.Tests/Models/TestDIDDelete.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -12,7 +11,7 @@ namespace XrplTests.Xrpl.Models public class TestUDIDDelete { [TestMethod] - public async Task TestVerify_Valid_DIDDelete() + public void TestVerify_Valid_DIDDelete() { var tx = new Dictionary { @@ -21,8 +20,8 @@ public async Task TestVerify_Valid_DIDDelete() { "Fee", "12" }, { "Sequence", 1u } }; - await Validation.ValidateDIDDelete(tx); - await Validation.Validate(tx); + Validation.ValidateDIDDelete(tx); + Validation.Validate(tx); } } } diff --git a/Tests/Xrpl.Tests/Models/TestDIDSet.cs b/Tests/Xrpl.Tests/Models/TestDIDSet.cs index dcca1190..25e19dc9 100644 --- a/Tests/Xrpl.Tests/Models/TestDIDSet.cs +++ b/Tests/Xrpl.Tests/Models/TestDIDSet.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -12,7 +11,7 @@ namespace XrplTests.Xrpl.Models public class TestUDIDSet { [TestMethod] - public async Task TestVerify_Valid_WithData() + public void TestVerify_Valid_WithData() { var tx = new Dictionary { @@ -22,12 +21,12 @@ public async Task TestVerify_Valid_WithData() { "Sequence", 1u }, { "Data", "48656C6C6F" } }; - await Validation.ValidateDIDSet(tx); - await Validation.Validate(tx); + Validation.ValidateDIDSet(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Valid_WithDIDDocument() + public void TestVerify_Valid_WithDIDDocument() { var tx = new Dictionary { @@ -37,12 +36,12 @@ public async Task TestVerify_Valid_WithDIDDocument() { "Sequence", 1u }, { "DIDDocument", "48656C6C6F" } }; - await Validation.ValidateDIDSet(tx); - await Validation.Validate(tx); + Validation.ValidateDIDSet(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Valid_WithURI() + public void TestVerify_Valid_WithURI() { var tx = new Dictionary { @@ -52,12 +51,12 @@ public async Task TestVerify_Valid_WithURI() { "Sequence", 1u }, { "URI", "68747470733A2F2F6578616D706C652E636F6D" } }; - await Validation.ValidateDIDSet(tx); - await Validation.Validate(tx); + Validation.ValidateDIDSet(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Valid_WithAllFields() + public void TestVerify_Valid_WithAllFields() { var tx = new Dictionary { @@ -69,12 +68,12 @@ public async Task TestVerify_Valid_WithAllFields() { "DIDDocument", "48656C6C6F" }, { "URI", "68747470733A2F2F6578616D706C652E636F6D" } }; - await Validation.ValidateDIDSet(tx); - await Validation.Validate(tx); + Validation.ValidateDIDSet(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Invalid_MissingAllOptionalFields() + public void TestVerify_Invalid_MissingAllOptionalFields() { var tx = new Dictionary { @@ -83,13 +82,13 @@ public async Task TestVerify_Invalid_MissingAllOptionalFields() { "Fee", "12" }, { "Sequence", 1u } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateDIDSet(tx), "DIDSet: must include at least one of Data, DIDDocument, or URI"); } [TestMethod] - public async Task TestVerify_Invalid_EmptyData() + public void TestVerify_Invalid_EmptyData() { var tx = new Dictionary { @@ -99,13 +98,13 @@ public async Task TestVerify_Invalid_EmptyData() { "Sequence", 1u }, { "Data", "" } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateDIDSet(tx), "DIDSet: must include at least one of Data, DIDDocument, or URI"); } [TestMethod] - public async Task TestVerify_Invalid_NullData() + public void TestVerify_Invalid_NullData() { var tx = new Dictionary { @@ -115,13 +114,13 @@ public async Task TestVerify_Invalid_NullData() { "Sequence", 1u }, { "Data", null } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateDIDSet(tx), "DIDSet: must include at least one of Data, DIDDocument, or URI"); } [TestMethod] - public async Task TestVerify_Invalid_DataTooLong() + public void TestVerify_Invalid_DataTooLong() { var tx = new Dictionary { @@ -131,13 +130,13 @@ public async Task TestVerify_Invalid_DataTooLong() { "Sequence", 1u }, { "Data", new string('A', 514) } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateDIDSet(tx), "DIDSet: Data must not exceed 256 bytes (512 hex characters)"); } [TestMethod] - public async Task TestVerify_Invalid_DIDDocumentTooLong() + public void TestVerify_Invalid_DIDDocumentTooLong() { var tx = new Dictionary { @@ -147,13 +146,13 @@ public async Task TestVerify_Invalid_DIDDocumentTooLong() { "Sequence", 1u }, { "DIDDocument", new string('B', 514) } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateDIDSet(tx), "DIDSet: DIDDocument must not exceed 256 bytes (512 hex characters)"); } [TestMethod] - public async Task TestVerify_Invalid_URITooLong() + public void TestVerify_Invalid_URITooLong() { var tx = new Dictionary { @@ -163,13 +162,13 @@ public async Task TestVerify_Invalid_URITooLong() { "Sequence", 1u }, { "URI", new string('C', 514) } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateDIDSet(tx), "DIDSet: URI must not exceed 256 bytes (512 hex characters)"); } [TestMethod] - public async Task TestVerify_Valid_MaxLengthData() + public void TestVerify_Valid_MaxLengthData() { var tx = new Dictionary { @@ -179,7 +178,7 @@ public async Task TestVerify_Valid_MaxLengthData() { "Sequence", 1u }, { "Data", new string('A', 512) } }; - await Validation.ValidateDIDSet(tx); + Validation.ValidateDIDSet(tx); } } } diff --git a/Tests/Xrpl.Tests/Models/TestDepositPreauth.cs b/Tests/Xrpl.Tests/Models/TestDepositPreauth.cs index 19a4892e..bfd9b86d 100644 --- a/Tests/Xrpl.Tests/Models/TestDepositPreauth.cs +++ b/Tests/Xrpl.Tests/Models/TestDepositPreauth.cs @@ -5,7 +5,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -53,7 +52,7 @@ private static List> CreateValidCredentials(int count } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { depositPreauth.Remove("Authorize"); depositPreauth.Remove("Unauthorize"); @@ -61,43 +60,43 @@ public async Task TestVerifyValid() depositPreauth.Remove("UnauthorizeCredentials"); depositPreauth["Authorize"] = "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"; - await Validation.ValidateDepositPreauth(depositPreauth); - await Validation.Validate(depositPreauth); + Validation.ValidateDepositPreauth(depositPreauth); + Validation.Validate(depositPreauth); depositPreauth.Remove("Authorize"); depositPreauth["Unauthorize"] = "raKEEVSGnKSD9Zyvxu4z6Pqpm4ABH8FS6n"; - await Validation.ValidateDepositPreauth(depositPreauth); - await Validation.Validate(depositPreauth); + Validation.ValidateDepositPreauth(depositPreauth); + Validation.Validate(depositPreauth); depositPreauth.Remove("Unauthorize"); depositPreauth["Unauthorize"] = "raKEEVSGnKSD9Zyvxu4z6Pqpm4ABH8FS6n"; depositPreauth["Authorize"] = "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateDepositPreauth(depositPreauth), ExclusiveError); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(depositPreauth), ExclusiveError); + Helper.ThrowsException(() => Validation.ValidateDepositPreauth(depositPreauth), ExclusiveError); + Helper.ThrowsException(() => Validation.Validate(depositPreauth), ExclusiveError); depositPreauth.Remove("Authorize"); depositPreauth.Remove("Unauthorize"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateDepositPreauth(depositPreauth), MissingError); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(depositPreauth), MissingError); + Helper.ThrowsException(() => Validation.ValidateDepositPreauth(depositPreauth), MissingError); + Helper.ThrowsException(() => Validation.Validate(depositPreauth), MissingError); depositPreauth["Authorize"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateDepositPreauth(depositPreauth), "DepositPreauth: Authorize must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(depositPreauth), "DepositPreauth: Authorize must be a string"); + Helper.ThrowsException(() => Validation.ValidateDepositPreauth(depositPreauth), "DepositPreauth: Authorize must be a string"); + Helper.ThrowsException(() => Validation.Validate(depositPreauth), "DepositPreauth: Authorize must be a string"); depositPreauth.Remove("Authorize"); depositPreauth["Unauthorize"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateDepositPreauth(depositPreauth), "DepositPreauth: Unauthorize must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(depositPreauth), "DepositPreauth: Unauthorize must be a string"); + Helper.ThrowsException(() => Validation.ValidateDepositPreauth(depositPreauth), "DepositPreauth: Unauthorize must be a string"); + Helper.ThrowsException(() => Validation.Validate(depositPreauth), "DepositPreauth: Unauthorize must be a string"); depositPreauth.Remove("Unauthorize"); depositPreauth["Unauthorize"] = depositPreauth["Account"]; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateDepositPreauth(depositPreauth), "DepositPreauth: Account can't unauthorize its own address"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(depositPreauth), "DepositPreauth: Account can't unauthorize its own address"); + Helper.ThrowsException(() => Validation.ValidateDepositPreauth(depositPreauth), "DepositPreauth: Account can't unauthorize its own address"); + Helper.ThrowsException(() => Validation.Validate(depositPreauth), "DepositPreauth: Account can't unauthorize its own address"); depositPreauth.Remove("Unauthorize"); } [TestMethod] - public async Task TestVerifyValid_AuthorizeCredentials() + public void TestVerifyValid_AuthorizeCredentials() { Dictionary tx = new Dictionary { @@ -105,12 +104,12 @@ public async Task TestVerifyValid_AuthorizeCredentials() { "Account", "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo" }, { "AuthorizeCredentials", CreateValidCredentials(3) } }; - await Validation.ValidateDepositPreauth(tx); - await Validation.Validate(tx); + Validation.ValidateDepositPreauth(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerifyValid_UnauthorizeCredentials() + public void TestVerifyValid_UnauthorizeCredentials() { Dictionary tx = new Dictionary { @@ -118,12 +117,12 @@ public async Task TestVerifyValid_UnauthorizeCredentials() { "Account", "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo" }, { "UnauthorizeCredentials", CreateValidCredentials(8) } }; - await Validation.ValidateDepositPreauth(tx); - await Validation.Validate(tx); + Validation.ValidateDepositPreauth(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Invalid_TooManyCredentials() + public void TestVerify_Invalid_TooManyCredentials() { Dictionary tx = new Dictionary { @@ -131,13 +130,13 @@ public async Task TestVerify_Invalid_TooManyCredentials() { "Account", "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo" }, { "AuthorizeCredentials", CreateValidCredentials(9) } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateDepositPreauth(tx), "DepositPreauth: AuthorizeCredentials cannot contain more than 8 elements"); } [TestMethod] - public async Task TestVerify_Invalid_DuplicateAuthorizeCredentials() + public void TestVerify_Invalid_DuplicateAuthorizeCredentials() { List> credentials = new List> { @@ -167,13 +166,13 @@ public async Task TestVerify_Invalid_DuplicateAuthorizeCredentials() { "Account", "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo" }, { "AuthorizeCredentials", credentials } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateDepositPreauth(tx), "DepositPreauth: AuthorizeCredentials cannot contain duplicate credentials"); } [TestMethod] - public async Task TestVerify_Invalid_BothAuthorizeAndAuthorizeCredentials() + public void TestVerify_Invalid_BothAuthorizeAndAuthorizeCredentials() { Dictionary tx = new Dictionary { @@ -182,13 +181,13 @@ public async Task TestVerify_Invalid_BothAuthorizeAndAuthorizeCredentials() { "Authorize", "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW" }, { "AuthorizeCredentials", CreateValidCredentials(1) } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateDepositPreauth(tx), ExclusiveError); } [TestMethod] - public async Task TestVerify_Invalid_BothAuthorizeAndUnauthorizeCredentials() + public void TestVerify_Invalid_BothAuthorizeAndUnauthorizeCredentials() { Dictionary tx = new Dictionary { @@ -197,13 +196,13 @@ public async Task TestVerify_Invalid_BothAuthorizeAndUnauthorizeCredentials() { "AuthorizeCredentials", CreateValidCredentials(1) }, { "UnauthorizeCredentials", CreateValidCredentials(1) } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateDepositPreauth(tx), ExclusiveError); } [TestMethod] - public async Task TestVerify_Invalid_EmptyCredentialsList() + public void TestVerify_Invalid_EmptyCredentialsList() { Dictionary tx = new Dictionary { @@ -211,7 +210,7 @@ public async Task TestVerify_Invalid_EmptyCredentialsList() { "Account", "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo" }, { "AuthorizeCredentials", new List>() } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateDepositPreauth(tx), "DepositPreauth: AuthorizeCredentials cannot be empty"); } diff --git a/Tests/Xrpl.Tests/Models/TestEscrowCancel.cs b/Tests/Xrpl.Tests/Models/TestEscrowCancel.cs index 2cb75979..5fa04820 100644 --- a/Tests/Xrpl.Tests/Models/TestEscrowCancel.cs +++ b/Tests/Xrpl.Tests/Models/TestEscrowCancel.cs @@ -4,7 +4,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; using Xrpl.Models.Transactions; @@ -29,35 +28,35 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid EscrowCancel - await Validation.ValidateEscrowCancel(depositPreauth); - await Validation.Validate(depositPreauth); + Validation.ValidateEscrowCancel(depositPreauth); + Validation.Validate(depositPreauth); // valid EscrowCancel missing owner depositPreauth.Remove("Owner"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCancel(depositPreauth), "EscrowCancel: missing Owner"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(depositPreauth), "EscrowCancel: missing Owner"); + Helper.ThrowsException(() => Validation.ValidateEscrowCancel(depositPreauth), "EscrowCancel: missing Owner"); + Helper.ThrowsException(() => Validation.Validate(depositPreauth), "EscrowCancel: missing Owner"); depositPreauth["Owner"] = "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"; // valid EscrowCancel missing OfferSequence depositPreauth.Remove("OfferSequence"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCancel(depositPreauth), "EscrowCancel: missing OfferSequence"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(depositPreauth), "EscrowCancel: missing OfferSequence"); + Helper.ThrowsException(() => Validation.ValidateEscrowCancel(depositPreauth), "EscrowCancel: missing OfferSequence"); + Helper.ThrowsException(() => Validation.Validate(depositPreauth), "EscrowCancel: missing OfferSequence"); depositPreauth["OfferSequence"] = 7u; // Invalid owner depositPreauth["Owner"] = 10; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCancel(depositPreauth), "EscrowCancel: Owner must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(depositPreauth), "EscrowCancel: Owner must be a string"); + Helper.ThrowsException(() => Validation.ValidateEscrowCancel(depositPreauth), "EscrowCancel: Owner must be a string"); + Helper.ThrowsException(() => Validation.Validate(depositPreauth), "EscrowCancel: Owner must be a string"); depositPreauth["Owner"] = "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"; // Invalid OfferSequence depositPreauth["OfferSequence"] = "10"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCancel(depositPreauth), "EscrowCancel: OfferSequence must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(depositPreauth), "EscrowCancel: OfferSequence must be a number"); + Helper.ThrowsException(() => Validation.ValidateEscrowCancel(depositPreauth), "EscrowCancel: OfferSequence must be a number"); + Helper.ThrowsException(() => Validation.Validate(depositPreauth), "EscrowCancel: OfferSequence must be a number"); depositPreauth["OfferSequence"] = 7u; } } diff --git a/Tests/Xrpl.Tests/Models/TestEscrowCreate.cs b/Tests/Xrpl.Tests/Models/TestEscrowCreate.cs index fbbcf026..878bb5f9 100644 --- a/Tests/Xrpl.Tests/Models/TestEscrowCreate.cs +++ b/Tests/Xrpl.Tests/Models/TestEscrowCreate.cs @@ -4,7 +4,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; using Xrpl.Models.Transactions; @@ -34,35 +33,35 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid EscrowCreate - await Validation.ValidateEscrowCreate(escrowCreate); - await Validation.Validate(escrowCreate); + Validation.ValidateEscrowCreate(escrowCreate); + Validation.Validate(escrowCreate); // invalid EscrowCreate missing amount escrowCreate.Remove("Amount"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: missing field Amount"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowCreate), "EscrowCreate: missing field Amount"); + Helper.ThrowsException(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: missing field Amount"); + Helper.ThrowsException(() => Validation.Validate(escrowCreate), "EscrowCreate: missing field Amount"); escrowCreate["Amount"] = "10000"; // invalid EscrowCreate missing destination escrowCreate.Remove("Destination"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: missing field Destination"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowCreate), "EscrowCreate: missing field Destination"); + Helper.ThrowsException(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: missing field Destination"); + Helper.ThrowsException(() => Validation.Validate(escrowCreate), "EscrowCreate: missing field Destination"); escrowCreate["Destination"] = "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"; // Invalid Destination escrowCreate["Destination"] = 10; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: Destination must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowCreate), "EscrowCreate: Destination must be a string"); + Helper.ThrowsException(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: Destination must be a string"); + Helper.ThrowsException(() => Validation.Validate(escrowCreate), "EscrowCreate: Destination must be a string"); escrowCreate["Destination"] = "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"; // Invalid Amount escrowCreate["Amount"] = 1000; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: Amount must be a string (XRP) or object (IOU/MPT)"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowCreate), "EscrowCreate: Amount must be a string (XRP) or object (IOU/MPT)"); + Helper.ThrowsException(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: Amount must be a string (XRP) or object (IOU/MPT)"); + Helper.ThrowsException(() => Validation.Validate(escrowCreate), "EscrowCreate: Amount must be a string (XRP) or object (IOU/MPT)"); escrowCreate["Amount"] = "10000"; // Valid Amount as object (MPT/IOU - TokenEscrow amendment) @@ -71,47 +70,47 @@ public async Task TestVerifyValid() {"mpt_issuance_id", "00000001A407AF5856CEDA4CE40E27FC80A38EC23A1DEFCD"}, {"value", "1000"} }; - await Validation.ValidateEscrowCreate(escrowCreate); - await Validation.Validate(escrowCreate); + Validation.ValidateEscrowCreate(escrowCreate); + Validation.Validate(escrowCreate); escrowCreate["Amount"] = "10000"; // Invalid CancelAfter escrowCreate["CancelAfter"] = "100"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: CancelAfter must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowCreate), "EscrowCreate: CancelAfter must be a number"); + Helper.ThrowsException(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: CancelAfter must be a number"); + Helper.ThrowsException(() => Validation.Validate(escrowCreate), "EscrowCreate: CancelAfter must be a number"); escrowCreate["CancelAfter"] = 533257958u; // Invalid FinishAfter escrowCreate["FinishAfter"] = "100"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: FinishAfter must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowCreate), "EscrowCreate: FinishAfter must be a number"); + Helper.ThrowsException(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: FinishAfter must be a number"); + Helper.ThrowsException(() => Validation.Validate(escrowCreate), "EscrowCreate: FinishAfter must be a number"); escrowCreate["FinishAfter"] = 533171558u; // Invalid Condition escrowCreate["Condition"] = 0x141243; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: Condition must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowCreate), "EscrowCreate: Condition must be a string"); + Helper.ThrowsException(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: Condition must be a string"); + Helper.ThrowsException(() => Validation.Validate(escrowCreate), "EscrowCreate: Condition must be a string"); escrowCreate["Condition"] = "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100"; // Invalid DestinationTag escrowCreate["DestinationTag"] = "100"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: DestinationTag must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowCreate), "EscrowCreate: DestinationTag must be a number"); + Helper.ThrowsException(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: DestinationTag must be a number"); + Helper.ThrowsException(() => Validation.Validate(escrowCreate), "EscrowCreate: DestinationTag must be a number"); escrowCreate["DestinationTag"] = 23480u; // Missing both CancelAfter and FinishAfter escrowCreate.Remove("FinishAfter"); escrowCreate.Remove("CancelAfter"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: Either CancelAfter or FinishAfter must be specified"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowCreate), "EscrowCreate: Either CancelAfter or FinishAfter must be specified"); + Helper.ThrowsException(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: Either CancelAfter or FinishAfter must be specified"); + Helper.ThrowsException(() => Validation.Validate(escrowCreate), "EscrowCreate: Either CancelAfter or FinishAfter must be specified"); escrowCreate["FinishAfter"] = 533171558u; escrowCreate["CancelAfter"] = 533257958u; // Missing both Condition and FinishAfter escrowCreate.Remove("FinishAfter"); escrowCreate.Remove("Condition"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: Either Condition or FinishAfter must be specified"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowCreate), "EscrowCreate: Either Condition or FinishAfter must be specified"); + Helper.ThrowsException(() => Validation.ValidateEscrowCreate(escrowCreate), "EscrowCreate: Either Condition or FinishAfter must be specified"); + Helper.ThrowsException(() => Validation.Validate(escrowCreate), "EscrowCreate: Either Condition or FinishAfter must be specified"); escrowCreate["FinishAfter"] = 533171558u; escrowCreate["Condition"] = "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100"; } diff --git a/Tests/Xrpl.Tests/Models/TestEscrowFinish.cs b/Tests/Xrpl.Tests/Models/TestEscrowFinish.cs index 2afc02ba..43f09155 100644 --- a/Tests/Xrpl.Tests/Models/TestEscrowFinish.cs +++ b/Tests/Xrpl.Tests/Models/TestEscrowFinish.cs @@ -4,7 +4,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; using Xrpl.Models.Transactions; @@ -31,49 +30,49 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid EscrowFinish - await Validation.ValidateEscrowFinish(escrowFinish); - await Validation.Validate(escrowFinish); + Validation.ValidateEscrowFinish(escrowFinish); + Validation.Validate(escrowFinish); // verifies valid EscrowFinish w/o optional escrowFinish.Remove("Condition"); escrowFinish.Remove("Fulfillment"); - await Validation.ValidateEscrowFinish(escrowFinish); - await Validation.Validate(escrowFinish); + Validation.ValidateEscrowFinish(escrowFinish); + Validation.Validate(escrowFinish); escrowFinish["Condition"] = "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100"; escrowFinish["Fulfillment"] = "A0028000"; // throws w/ invalid Owner escrowFinish["Owner"] = 0x15415253; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowFinish(escrowFinish), "EscrowFinish: Owner must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowFinish), "EscrowFinish: Owner must be a string"); + Helper.ThrowsException(() => Validation.ValidateEscrowFinish(escrowFinish), "EscrowFinish: Owner must be a string"); + Helper.ThrowsException(() => Validation.Validate(escrowFinish), "EscrowFinish: Owner must be a string"); escrowFinish["Owner"] = "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"; // throws w/ invalid OfferSequence escrowFinish["OfferSequence"] = "10"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowFinish(escrowFinish), "EscrowFinish: OfferSequence must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowFinish), "EscrowFinish: OfferSequence must be a number"); + Helper.ThrowsException(() => Validation.ValidateEscrowFinish(escrowFinish), "EscrowFinish: OfferSequence must be a number"); + Helper.ThrowsException(() => Validation.Validate(escrowFinish), "EscrowFinish: OfferSequence must be a number"); escrowFinish["OfferSequence"] = 7u; // Invalid Condition escrowFinish["Condition"] = 10; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowFinish(escrowFinish), "EscrowFinish: Condition must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowFinish), "EscrowFinish: Condition must be a string"); + Helper.ThrowsException(() => Validation.ValidateEscrowFinish(escrowFinish), "EscrowFinish: Condition must be a string"); + Helper.ThrowsException(() => Validation.Validate(escrowFinish), "EscrowFinish: Condition must be a string"); escrowFinish["Condition"] = "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100"; // Invalid Fulfillment escrowFinish["Fulfillment"] = 0x142341; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateEscrowFinish(escrowFinish), "EscrowFinish: Fulfillment must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(escrowFinish), "EscrowFinish: Fulfillment must be a string"); + Helper.ThrowsException(() => Validation.ValidateEscrowFinish(escrowFinish), "EscrowFinish: Fulfillment must be a string"); + Helper.ThrowsException(() => Validation.Validate(escrowFinish), "EscrowFinish: Fulfillment must be a string"); escrowFinish["Fulfillment"] = "A0028000"; } [TestMethod] - public async Task TestVerify_Valid_EscrowFinish_WithCredentialIDs() + public void TestVerify_Valid_EscrowFinish_WithCredentialIDs() { Dictionary tx = new Dictionary { @@ -83,12 +82,12 @@ public async Task TestVerify_Valid_EscrowFinish_WithCredentialIDs() { "OfferSequence", 7u }, { "CredentialIDs", new List { "A1B2C3D4E5F6789012345678901234567890ABCDEF1234567890ABCDEF123456" } } }; - await Validation.ValidateEscrowFinish(tx); - await Validation.Validate(tx); + Validation.ValidateEscrowFinish(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Invalid_EscrowFinish_DuplicateCredentialIDs() + public void TestVerify_Invalid_EscrowFinish_DuplicateCredentialIDs() { string id = "A1B2C3D4E5F6789012345678901234567890ABCDEF1234567890ABCDEF123456"; Dictionary tx = new Dictionary @@ -99,7 +98,7 @@ public async Task TestVerify_Invalid_EscrowFinish_DuplicateCredentialIDs() { "OfferSequence", 7u }, { "CredentialIDs", new List { id, id.ToLowerInvariant() } } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateEscrowFinish(tx), "EscrowFinish: CredentialIDs cannot contain duplicate credential IDs"); } diff --git a/Tests/Xrpl.Tests/Models/TestMPTokenAuthorize.cs b/Tests/Xrpl.Tests/Models/TestMPTokenAuthorize.cs index 7ba3277c..472de8a4 100644 --- a/Tests/Xrpl.Tests/Models/TestMPTokenAuthorize.cs +++ b/Tests/Xrpl.Tests/Models/TestMPTokenAuthorize.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -26,52 +25,52 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { - await Validation.Validate(mpTokenAuthorize); + Validation.Validate(mpTokenAuthorize); } [TestMethod] - public async Task TestVerifyWithHolder() + public void TestVerifyWithHolder() { mpTokenAuthorize["Holder"] = "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"; - await Validation.Validate(mpTokenAuthorize); + Validation.Validate(mpTokenAuthorize); mpTokenAuthorize.Remove("Holder"); } [TestMethod] - public async Task TestVerifyWithUnauthorizeFlag() + public void TestVerifyWithUnauthorizeFlag() { mpTokenAuthorize["Flags"] = (uint)MPTokenAuthorizeFlags.tfMPTUnauthorize; - await Validation.Validate(mpTokenAuthorize); + Validation.Validate(mpTokenAuthorize); mpTokenAuthorize.Remove("Flags"); } [TestMethod] - public async Task TestThrowsWithMissingMPTokenIssuanceID() + public void TestThrowsWithMissingMPTokenIssuanceID() { mpTokenAuthorize.Remove("MPTokenIssuanceID"); - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenAuthorize), "MPTokenAuthorize: missing field MPTokenIssuanceID"); mpTokenAuthorize["MPTokenIssuanceID"] = "00000001A407AF5856CCF3C42619DAA925813FC955C72983"; } [TestMethod] - public async Task TestThrowsWithInvalidMPTokenIssuanceID() + public void TestThrowsWithInvalidMPTokenIssuanceID() { mpTokenAuthorize["MPTokenIssuanceID"] = 12345; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenAuthorize), "MPTokenAuthorize: MPTokenIssuanceID must be a string"); mpTokenAuthorize["MPTokenIssuanceID"] = "00000001A407AF5856CCF3C42619DAA925813FC955C72983"; } [TestMethod] - public async Task TestThrowsWithInvalidHolder() + public void TestThrowsWithInvalidHolder() { mpTokenAuthorize["Holder"] = 12345; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenAuthorize), "MPTokenAuthorize: Holder must be a string"); mpTokenAuthorize.Remove("Holder"); diff --git a/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceCreate.cs b/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceCreate.cs index c6aa9989..5e04425e 100644 --- a/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceCreate.cs +++ b/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceCreate.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -25,58 +24,58 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { - await Validation.Validate(mpTokenIssuanceCreate); + Validation.Validate(mpTokenIssuanceCreate); } [TestMethod] - public async Task TestVerifyWithAssetScale() + public void TestVerifyWithAssetScale() { mpTokenIssuanceCreate["AssetScale"] = (byte)2; - await Validation.Validate(mpTokenIssuanceCreate); + Validation.Validate(mpTokenIssuanceCreate); mpTokenIssuanceCreate.Remove("AssetScale"); } [TestMethod] - public async Task TestVerifyWithTransferFee() + public void TestVerifyWithTransferFee() { mpTokenIssuanceCreate["TransferFee"] = (ushort)1000; - await Validation.Validate(mpTokenIssuanceCreate); + Validation.Validate(mpTokenIssuanceCreate); mpTokenIssuanceCreate.Remove("TransferFee"); } [TestMethod] - public async Task TestVerifyWithMaximumAmount() + public void TestVerifyWithMaximumAmount() { mpTokenIssuanceCreate["MaximumAmount"] = "9223372036854775807"; - await Validation.Validate(mpTokenIssuanceCreate); + Validation.Validate(mpTokenIssuanceCreate); mpTokenIssuanceCreate.Remove("MaximumAmount"); } [TestMethod] - public async Task TestVerifyWithMPTokenMetadata() + public void TestVerifyWithMPTokenMetadata() { mpTokenIssuanceCreate["MPTokenMetadata"] = "48656C6C6F"; - await Validation.Validate(mpTokenIssuanceCreate); + Validation.Validate(mpTokenIssuanceCreate); mpTokenIssuanceCreate.Remove("MPTokenMetadata"); } [TestMethod] - public async Task TestThrowsWithTransferFeeOutOfRange() + public void TestThrowsWithTransferFeeOutOfRange() { mpTokenIssuanceCreate["TransferFee"] = (ushort)50001; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceCreate), "MPTokenIssuanceCreate: TransferFee must be between 0 and 50000"); mpTokenIssuanceCreate.Remove("TransferFee"); } [TestMethod] - public async Task TestThrowsWithAssetScaleOutOfRange() + public void TestThrowsWithAssetScaleOutOfRange() { mpTokenIssuanceCreate["AssetScale"] = (byte)11; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceCreate), "MPTokenIssuanceCreate: AssetScale must be between 0 and 10"); mpTokenIssuanceCreate.Remove("AssetScale"); @@ -85,14 +84,14 @@ await Helper.ThrowsExceptionAsync( private const string ValidDomainId = "77D6234D074E505024D39C04C3F262997B773719AB29ACFA83119E4210328776"; [TestMethod] - public async Task TestVerifyWithDomainIdAndRequireAuth() + public void TestVerifyWithDomainIdAndRequireAuth() { try { // rippled: DomainID implies a non-public issuance - tfMPTRequireAuth required mpTokenIssuanceCreate["DomainID"] = ValidDomainId; mpTokenIssuanceCreate["Flags"] = (uint)MPTokenIssuanceCreateFlags.tfMPTRequireAuth; - await Validation.Validate(mpTokenIssuanceCreate); + Validation.Validate(mpTokenIssuanceCreate); } finally { @@ -102,12 +101,12 @@ public async Task TestVerifyWithDomainIdAndRequireAuth() } [TestMethod] - public async Task TestThrowsWithDomainIdWithoutRequireAuth() + public void TestThrowsWithDomainIdWithoutRequireAuth() { try { mpTokenIssuanceCreate["DomainID"] = ValidDomainId; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceCreate), "MPTokenIssuanceCreate: DomainID requires the tfMPTRequireAuth flag"); } @@ -118,13 +117,13 @@ await Helper.ThrowsExceptionAsync( } [TestMethod] - public async Task TestThrowsWithMalformedDomainId() + public void TestThrowsWithMalformedDomainId() { try { mpTokenIssuanceCreate["DomainID"] = "NOT-A-HASH"; mpTokenIssuanceCreate["Flags"] = (uint)MPTokenIssuanceCreateFlags.tfMPTRequireAuth; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceCreate), "MPTokenIssuanceCreate: DomainID must be a 64-character hexadecimal string"); } @@ -136,13 +135,13 @@ await Helper.ThrowsExceptionAsync( } [TestMethod] - public async Task TestThrowsWithZeroDomainId() + public void TestThrowsWithZeroDomainId() { try { mpTokenIssuanceCreate["DomainID"] = new string('0', 64); mpTokenIssuanceCreate["Flags"] = (uint)MPTokenIssuanceCreateFlags.tfMPTRequireAuth; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceCreate), "MPTokenIssuanceCreate: DomainID must not be zero"); } diff --git a/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceDestroy.cs b/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceDestroy.cs index 2408f08c..81112353 100644 --- a/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceDestroy.cs +++ b/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceDestroy.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -26,26 +25,26 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { - await Validation.Validate(mpTokenIssuanceDestroy); + Validation.Validate(mpTokenIssuanceDestroy); } [TestMethod] - public async Task TestThrowsWithMissingMPTokenIssuanceID() + public void TestThrowsWithMissingMPTokenIssuanceID() { mpTokenIssuanceDestroy.Remove("MPTokenIssuanceID"); - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceDestroy), "MPTokenIssuanceDestroy: missing field MPTokenIssuanceID"); mpTokenIssuanceDestroy["MPTokenIssuanceID"] = "00000001A407AF5856CCF3C42619DAA925813FC955C72983"; } [TestMethod] - public async Task TestThrowsWithInvalidMPTokenIssuanceID() + public void TestThrowsWithInvalidMPTokenIssuanceID() { mpTokenIssuanceDestroy["MPTokenIssuanceID"] = 12345; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceDestroy), "MPTokenIssuanceDestroy: MPTokenIssuanceID must be a string"); mpTokenIssuanceDestroy["MPTokenIssuanceID"] = "00000001A407AF5856CCF3C42619DAA925813FC955C72983"; diff --git a/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceSet.cs b/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceSet.cs index ab4f1d34..5b8cb1d9 100644 --- a/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceSet.cs +++ b/Tests/Xrpl.Tests/Models/TestMPTokenIssuanceSet.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -26,67 +25,67 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { - await Validation.Validate(mpTokenIssuanceSet); + Validation.Validate(mpTokenIssuanceSet); } [TestMethod] - public async Task TestVerifyWithHolder() + public void TestVerifyWithHolder() { mpTokenIssuanceSet["Holder"] = "rPyfep3gcLzkosKC9XiE77Y8DZWG6iWDT9"; - await Validation.Validate(mpTokenIssuanceSet); + Validation.Validate(mpTokenIssuanceSet); mpTokenIssuanceSet.Remove("Holder"); } [TestMethod] - public async Task TestThrowsWithMissingMPTokenIssuanceID() + public void TestThrowsWithMissingMPTokenIssuanceID() { mpTokenIssuanceSet.Remove("MPTokenIssuanceID"); - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceSet), "MPTokenIssuanceSet: missing field MPTokenIssuanceID"); mpTokenIssuanceSet["MPTokenIssuanceID"] = "00000001A407AF5856CCF3C42619DAA925813FC955C72983"; } [TestMethod] - public async Task TestThrowsWithInvalidMPTokenIssuanceID() + public void TestThrowsWithInvalidMPTokenIssuanceID() { mpTokenIssuanceSet["MPTokenIssuanceID"] = 12345; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceSet), "MPTokenIssuanceSet: MPTokenIssuanceID must be a string"); mpTokenIssuanceSet["MPTokenIssuanceID"] = "00000001A407AF5856CCF3C42619DAA925813FC955C72983"; } [TestMethod] - public async Task TestThrowsWithInvalidHolder() + public void TestThrowsWithInvalidHolder() { mpTokenIssuanceSet["Holder"] = 12345; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceSet), "MPTokenIssuanceSet: Holder must be a string"); mpTokenIssuanceSet.Remove("Holder"); } [TestMethod] - public async Task TestThrowsWithBothLockAndUnlockFlags() + public void TestThrowsWithBothLockAndUnlockFlags() { mpTokenIssuanceSet["Flags"] = (uint)(MPTokenIssuanceSetFlags.tfMPTLock | MPTokenIssuanceSetFlags.tfMPTUnlock); - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceSet), "MPTokenIssuanceSet: cannot set both tfMPTLock and tfMPTUnlock flags"); mpTokenIssuanceSet.Remove("Flags"); } [TestMethod] - public async Task TestVerifyWithZeroDomainId() + public void TestVerifyWithZeroDomainId() { try { // rippled MPTokenIssuanceSet: a zero DomainID clears the domain - legal mpTokenIssuanceSet["DomainID"] = new string('0', 64); - await Validation.Validate(mpTokenIssuanceSet); + Validation.Validate(mpTokenIssuanceSet); } finally { @@ -95,12 +94,12 @@ public async Task TestVerifyWithZeroDomainId() } [TestMethod] - public async Task TestThrowsWithMalformedDomainId() + public void TestThrowsWithMalformedDomainId() { try { mpTokenIssuanceSet["DomainID"] = "1234"; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.Validate(mpTokenIssuanceSet), "MPTokenIssuanceSet: DomainID must be a 64-character hexadecimal string"); } diff --git a/Tests/Xrpl.Tests/Models/TestModelUtils.cs b/Tests/Xrpl.Tests/Models/TestModelUtils.cs index bf4c2dd5..1c756e65 100644 --- a/Tests/Xrpl.Tests/Models/TestModelUtils.cs +++ b/Tests/Xrpl.Tests/Models/TestModelUtils.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading.Tasks; using Xrpl.Models.Utils; @@ -24,7 +23,7 @@ public class TestUModelUtils { [TestMethod] - public async Task TestVerifyValid_isFlagEnabled() + public void TestVerifyValid_isFlagEnabled() { uint flags = 0x00000000; uint flag1 = 0x00010000; @@ -40,7 +39,7 @@ public async Task TestVerifyValid_isFlagEnabled() Assert.IsFalse(ModelUtils.IsFlagEnabled(flags, flag1)); } [TestMethod] - public async Task TestVerifyValid_setTransactionFlagsToNumber() + public void TestVerifyValid_setTransactionFlagsToNumber() { var offerCrete = new Dictionary { diff --git a/Tests/Xrpl.Tests/Models/TestNFTokenAcceptOffer.cs b/Tests/Xrpl.Tests/Models/TestNFTokenAcceptOffer.cs index f8fbdaf9..3bf33483 100644 --- a/Tests/Xrpl.Tests/Models/TestNFTokenAcceptOffer.cs +++ b/Tests/Xrpl.Tests/Models/TestNFTokenAcceptOffer.cs @@ -5,7 +5,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; @@ -27,7 +26,7 @@ public class TestUNFTokenAcceptOffer "AED08CC1F50DD5F23A1948AF86153A3F3B7593E5EC77D65A02BB1B29E05AB6AE"; [TestMethod] - public async Task TestVerify_Valid_NFTokenAcceptOffer_With_NFTokenBuyOffer() + public void TestVerify_Valid_NFTokenAcceptOffer_With_NFTokenBuyOffer() { var offer = new Dictionary { @@ -38,10 +37,10 @@ public async Task TestVerify_Valid_NFTokenAcceptOffer_With_NFTokenBuyOffer() {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Validation.Validate(offer); + Validation.Validate(offer); } [TestMethod] - public async Task TestVerify_Valid_NFTokenAcceptOffer_With_NFTokenSellOffer() + public void TestVerify_Valid_NFTokenAcceptOffer_With_NFTokenSellOffer() { var offer = new Dictionary { @@ -52,10 +51,10 @@ public async Task TestVerify_Valid_NFTokenAcceptOffer_With_NFTokenSellOffer() {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Validation.Validate(offer); + Validation.Validate(offer); } [TestMethod] - public async Task TestVerify_Invalid_missing_NFTokenSellOffer_and_NFTokenBuyOffer() + public void TestVerify_Invalid_missing_NFTokenSellOffer_and_NFTokenBuyOffer() { var offer = new Dictionary { @@ -65,10 +64,10 @@ public async Task TestVerify_Invalid_missing_NFTokenSellOffer_and_NFTokenBuyOffe {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenAcceptOffer: must set either NFTokenSellOffer or NFTokenBuyOffer"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenAcceptOffer: must set either NFTokenSellOffer or NFTokenBuyOffer"); } [TestMethod] - public async Task TestVerify_Invalid_missing_NFTokenSellOffer_and_present_NFTokenBrokerFee() + public void TestVerify_Invalid_missing_NFTokenSellOffer_and_present_NFTokenBrokerFee() { var offer = new Dictionary { @@ -80,10 +79,10 @@ public async Task TestVerify_Invalid_missing_NFTokenSellOffer_and_present_NFToke {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenAcceptOffer: both NFTokenSellOffer and NFTokenBuyOffer must be set if using brokered mode"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenAcceptOffer: both NFTokenSellOffer and NFTokenBuyOffer must be set if using brokered mode"); } [TestMethod] - public async Task TestVerify_Invalid_missing_NFTokenBuyOffer_and_present_NFTokenBrokerFee() + public void TestVerify_Invalid_missing_NFTokenBuyOffer_and_present_NFTokenBrokerFee() { var offer = new Dictionary { @@ -95,11 +94,11 @@ public async Task TestVerify_Invalid_missing_NFTokenBuyOffer_and_present_NFToken {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenAcceptOffer: both NFTokenSellOffer and NFTokenBuyOffer must be set if using brokered mode"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenAcceptOffer: both NFTokenSellOffer and NFTokenBuyOffer must be set if using brokered mode"); } [TestMethod] - public async Task TestVerify_Valid_NFTokenAcceptOffer_with_both_offers_and_no_NFTokenBrokerFee() + public void TestVerify_Valid_NFTokenAcceptOffer_with_both_offers_and_no_NFTokenBrokerFee() { var offer = new Dictionary { @@ -111,10 +110,10 @@ public async Task TestVerify_Valid_NFTokenAcceptOffer_with_both_offers_and_no_NF {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Validation.Validate(offer); + Validation.Validate(offer); } [TestMethod] - public async Task TestVerify_Valid_NFTokenAcceptOffer_with_NFTokenBrokerFee() + public void TestVerify_Valid_NFTokenAcceptOffer_with_NFTokenBrokerFee() { var offer = new Dictionary { @@ -127,11 +126,11 @@ public async Task TestVerify_Valid_NFTokenAcceptOffer_with_NFTokenBrokerFee() {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Validation.Validate(offer); + Validation.Validate(offer); } [TestMethod] - public async Task TestVerify_Invalid_NFTokenBrokerFee_Is_0() + public void TestVerify_Invalid_NFTokenBrokerFee_Is_0() { var offer = new Dictionary { @@ -144,10 +143,10 @@ public async Task TestVerify_Invalid_NFTokenBrokerFee_Is_0() {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenAcceptOffer: NFTokenBrokerFee must be greater than 0; omit if there is no fee"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenAcceptOffer: NFTokenBrokerFee must be greater than 0; omit if there is no fee"); } [TestMethod] - public async Task TestVerify_Invalid_NFTokenBrokerFee_less_0() + public void TestVerify_Invalid_NFTokenBrokerFee_less_0() { var offer = new Dictionary { @@ -160,11 +159,11 @@ public async Task TestVerify_Invalid_NFTokenBrokerFee_less_0() {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenAcceptOffer: NFTokenBrokerFee must be greater than 0; omit if there is no fee"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenAcceptOffer: NFTokenBrokerFee must be greater than 0; omit if there is no fee"); } [TestMethod] - public async Task TestVerify_Invalid_NFTokenBrokerFee() + public void TestVerify_Invalid_NFTokenBrokerFee() { var offer = new Dictionary { @@ -177,7 +176,7 @@ public async Task TestVerify_Invalid_NFTokenBrokerFee() {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenAcceptOffer: invalid NFTokenBrokerFee"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenAcceptOffer: invalid NFTokenBrokerFee"); } diff --git a/Tests/Xrpl.Tests/Models/TestNFTokenBurn.cs b/Tests/Xrpl.Tests/Models/TestNFTokenBurn.cs index 6590a975..65dc39b7 100644 --- a/Tests/Xrpl.Tests/Models/TestNFTokenBurn.cs +++ b/Tests/Xrpl.Tests/Models/TestNFTokenBurn.cs @@ -5,7 +5,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; @@ -24,7 +23,7 @@ public class TestUNFTokenBurn "00090032B5F762798A53D543A014CAF8B297CFF8F2F937E844B17C9E00000003"; [TestMethod] - public async Task TestVerify_Valid_NFTokenBurn() + public void TestVerify_Valid_NFTokenBurn() { var offer = new Dictionary { @@ -35,10 +34,10 @@ public async Task TestVerify_Valid_NFTokenBurn() {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Validation.Validate(offer); + Validation.Validate(offer); } [TestMethod] - public async Task TestVerify_Invalid_missing_NFTokenID() + public void TestVerify_Invalid_missing_NFTokenID() { var offer = new Dictionary { @@ -48,7 +47,7 @@ public async Task TestVerify_Invalid_missing_NFTokenID() {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenBurn: missing field NFTokenID"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenBurn: missing field NFTokenID"); } } } diff --git a/Tests/Xrpl.Tests/Models/TestNFTokenCancelOffer.cs b/Tests/Xrpl.Tests/Models/TestNFTokenCancelOffer.cs index 0732ac33..7cb2a232 100644 --- a/Tests/Xrpl.Tests/Models/TestNFTokenCancelOffer.cs +++ b/Tests/Xrpl.Tests/Models/TestNFTokenCancelOffer.cs @@ -3,7 +3,6 @@ // https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/test/models/NFTokenCancelOffer.ts using System.Collections.Generic; -using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; @@ -22,7 +21,7 @@ public class TestUNFTokenCancelOffer "AED08CC1F50DD5F23A1948AF86153A3F3B7593E5EC77D65A02BB1B29E05AB6AF"; [TestMethod] - public async Task TestVerify_Valid_NFTokenCancelOffer() + public void TestVerify_Valid_NFTokenCancelOffer() { var offer = new Dictionary { @@ -33,10 +32,10 @@ public async Task TestVerify_Valid_NFTokenCancelOffer() {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Validation.Validate(offer); + Validation.Validate(offer); } [TestMethod] - public async Task TestVerify_Invalid_missing_NFTokenOffers() + public void TestVerify_Invalid_missing_NFTokenOffers() { var offer = new Dictionary { @@ -46,10 +45,10 @@ public async Task TestVerify_Invalid_missing_NFTokenOffers() {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenCancelOffer: missing field NFTokenOffers"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenCancelOffer: missing field NFTokenOffers"); } [TestMethod] - public async Task TestVerify_Invalid_empty_NFTokenOffers() + public void TestVerify_Invalid_empty_NFTokenOffers() { var offer = new Dictionary { @@ -60,7 +59,7 @@ public async Task TestVerify_Invalid_empty_NFTokenOffers() {"Sequence", 2470665u}, {"Flags", 2147483648u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenCancelOffer: empty field NFTokenOffers"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenCancelOffer: empty field NFTokenOffers"); } } diff --git a/Tests/Xrpl.Tests/Models/TestNFTokenCreateOffer.cs b/Tests/Xrpl.Tests/Models/TestNFTokenCreateOffer.cs index eeca938e..a707182b 100644 --- a/Tests/Xrpl.Tests/Models/TestNFTokenCreateOffer.cs +++ b/Tests/Xrpl.Tests/Models/TestNFTokenCreateOffer.cs @@ -5,7 +5,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; @@ -25,7 +24,7 @@ public class TestUNFTokenCreateOffer [TestMethod] - public async Task TestVerify_Valid_NFTokenCreateOffer_buyside() + public void TestVerify_Valid_NFTokenCreateOffer_buyside() { var offer = new Dictionary { @@ -39,10 +38,10 @@ public async Task TestVerify_Valid_NFTokenCreateOffer_buyside() {"Fee", "5000000"}, {"Sequence", 2470665u}, }; - await Validation.Validate(offer); + Validation.Validate(offer); } [TestMethod] - public async Task TestVerify_Valid_NFTokenCreateOffer_sellside() + public void TestVerify_Valid_NFTokenCreateOffer_sellside() { var offer = new Dictionary { @@ -56,10 +55,10 @@ public async Task TestVerify_Valid_NFTokenCreateOffer_sellside() {"Fee", "5000000"}, {"Sequence", 2470665u}, }; - await Validation.Validate(offer); + Validation.Validate(offer); } [TestMethod] - public async Task TestVerify_Valid_0_Amount_NFTokenCreateOffer_sellside() + public void TestVerify_Valid_0_Amount_NFTokenCreateOffer_sellside() { var offer = new Dictionary { @@ -73,10 +72,10 @@ public async Task TestVerify_Valid_0_Amount_NFTokenCreateOffer_sellside() {"Fee", "5000000"}, {"Sequence", 2470665u}, }; - await Validation.Validate(offer); + Validation.Validate(offer); } [TestMethod] - public async Task TestVerify_Invalid_Account_is_Owner() + public void TestVerify_Invalid_Account_is_Owner() { var offer = new Dictionary { @@ -89,10 +88,10 @@ public async Task TestVerify_Invalid_Account_is_Owner() {"Fee", "5000000"}, {"Sequence", 2470665u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenCreateOffer: Owner and Account must not be equal"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenCreateOffer: Owner and Account must not be equal"); } [TestMethod] - public async Task TestVerify_Invalid_Account_is_Destination() + public void TestVerify_Invalid_Account_is_Destination() { var offer = new Dictionary { @@ -106,11 +105,11 @@ public async Task TestVerify_Invalid_Account_is_Destination() {"Fee", "5000000"}, {"Sequence", 2470665u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenCreateOffer: Destination and Account must not be equal"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenCreateOffer: Destination and Account must not be equal"); } [TestMethod] - public async Task TestVerify_Invalid_out_NFTokenID() + public void TestVerify_Invalid_out_NFTokenID() { var offer = new Dictionary { @@ -123,10 +122,10 @@ public async Task TestVerify_Invalid_out_NFTokenID() {"Fee", "5000000"}, {"Sequence", 2470665u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenCreateOffer: missing field NFTokenID"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenCreateOffer: missing field NFTokenID"); } [TestMethod] - public async Task TestVerify_Invalid_Amount() + public void TestVerify_Invalid_Amount() { var offer = new Dictionary { @@ -140,11 +139,11 @@ public async Task TestVerify_Invalid_Amount() {"Fee", "5000000"}, {"Sequence", 2470665u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenCreateOffer: invalid Amount"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenCreateOffer: invalid Amount"); } [TestMethod] - public async Task TestVerify_Invalid_Missing_Amount() + public void TestVerify_Invalid_Missing_Amount() { var offer = new Dictionary { @@ -157,10 +156,10 @@ public async Task TestVerify_Invalid_Missing_Amount() {"Fee", "5000000"}, {"Sequence", 2470665u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenCreateOffer: invalid Amount"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenCreateOffer: invalid Amount"); } [TestMethod] - public async Task TestVerify_Invalid_Owner_for_sell_offer() + public void TestVerify_Invalid_Owner_for_sell_offer() { var offer = new Dictionary { @@ -174,11 +173,11 @@ public async Task TestVerify_Invalid_Owner_for_sell_offer() {"Fee", "5000000"}, {"Sequence", 2470665u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenCreateOffer: Owner must not be present for sell offers"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenCreateOffer: Owner must not be present for sell offers"); } [TestMethod] - public async Task TestVerify_Invalid_out_Owner_for_buy_offer() + public void TestVerify_Invalid_out_Owner_for_buy_offer() { var offer = new Dictionary { @@ -190,11 +189,11 @@ public async Task TestVerify_Invalid_out_Owner_for_buy_offer() {"Fee", "5000000"}, {"Sequence", 2470665u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenCreateOffer: Owner must be present for buy offers"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenCreateOffer: Owner must be present for buy offers"); } [TestMethod] - public async Task TestVerify_Invalid_0_Amount_for_buy_offer() + public void TestVerify_Invalid_0_Amount_for_buy_offer() { var offer = new Dictionary { @@ -207,7 +206,7 @@ public async Task TestVerify_Invalid_0_Amount_for_buy_offer() {"Fee", "5000000"}, {"Sequence", 2470665u}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenCreateOffer: Amount must be greater than 0 for buy offers"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenCreateOffer: Amount must be greater than 0 for buy offers"); } diff --git a/Tests/Xrpl.Tests/Models/TestNFTokenMint.cs b/Tests/Xrpl.Tests/Models/TestNFTokenMint.cs index 690a6f99..c0114c59 100644 --- a/Tests/Xrpl.Tests/Models/TestNFTokenMint.cs +++ b/Tests/Xrpl.Tests/Models/TestNFTokenMint.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -22,7 +21,7 @@ namespace XrplTests.Xrpl.Models public class TestUNFTokenMint { [TestMethod] - public async Task TestVerify_Valid_NFTokenMint() + public void TestVerify_Valid_NFTokenMint() { var offer = new Dictionary { @@ -36,10 +35,10 @@ public async Task TestVerify_Valid_NFTokenMint() {"TransferFee", 1}, {"URI", "http://xrpl.org".ConvertStringToHex()}, }; - await Validation.Validate(offer); + Validation.Validate(offer); } [TestMethod] - public async Task TestVerify_InValid_missing_NFTokenTaxon() + public void TestVerify_InValid_missing_NFTokenTaxon() { var offer = new Dictionary { @@ -52,10 +51,10 @@ public async Task TestVerify_InValid_missing_NFTokenTaxon() {"TransferFee", 1}, {"URI", "http://xrpl.org".ConvertStringToHex()}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenMint: missing field NFTokenTaxon"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenMint: missing field NFTokenTaxon"); } [TestMethod] - public async Task TestVerify_Invalid_Account_is_Issuer() + public void TestVerify_Invalid_Account_is_Issuer() { var offer = new Dictionary { @@ -69,10 +68,10 @@ public async Task TestVerify_Invalid_Account_is_Issuer() {"TransferFee", 1}, {"URI", "http://xrpl.org".ConvertStringToHex()}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenMint: Issuer must not be equal to Account"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenMint: Issuer must not be equal to Account"); } [TestMethod] - public async Task TestVerify_Invalid_URI_not_in_hex_format() + public void TestVerify_Invalid_URI_not_in_hex_format() { var offer = new Dictionary { @@ -86,7 +85,7 @@ public async Task TestVerify_Invalid_URI_not_in_hex_format() {"TransferFee", 1}, {"URI", "http://xrpl.org"}, }; - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "NFTokenMint: URI must be in hex format"); + Helper.ThrowsException(() => Validation.Validate(offer), "NFTokenMint: URI must be in hex format"); } } diff --git a/Tests/Xrpl.Tests/Models/TestOfferCancel.cs b/Tests/Xrpl.Tests/Models/TestOfferCancel.cs index 463f7730..97b217a2 100644 --- a/Tests/Xrpl.Tests/Models/TestOfferCancel.cs +++ b/Tests/Xrpl.Tests/Models/TestOfferCancel.cs @@ -4,7 +4,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; using Xrpl.Models.Transactions; @@ -34,28 +33,28 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid OfferCancel - await Validation.ValidateOfferCancel(offer); - await Validation.Validate(offer); + Validation.ValidateOfferCancel(offer); + Validation.Validate(offer); // verifies valid OfferCancel with flags offer["Flags"] = 2147483648; - await Validation.ValidateOfferCancel(offer); - await Validation.Validate(offer); + Validation.ValidateOfferCancel(offer); + Validation.Validate(offer); // throws w/ OfferSequence must be a number offer["OfferSequence"] = "99"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateOfferCancel(offer), "OfferCancel: OfferSequence must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "OfferCancel: OfferSequence must be a number"); + Helper.ThrowsException(() => Validation.ValidateOfferCancel(offer), "OfferCancel: OfferSequence must be a number"); + Helper.ThrowsException(() => Validation.Validate(offer), "OfferCancel: OfferSequence must be a number"); offer["OfferSequence"] = 60797528u; // throws w/ missing OfferSequence offer.Remove("OfferSequence"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateOfferCancel(offer), "OfferCancel: missing field OfferSequence"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(offer), "OfferCancel: missing field OfferSequence"); + Helper.ThrowsException(() => Validation.ValidateOfferCancel(offer), "OfferCancel: missing field OfferSequence"); + Helper.ThrowsException(() => Validation.Validate(offer), "OfferCancel: missing field OfferSequence"); offer["OfferSequence"] = 60797528u; } diff --git a/Tests/Xrpl.Tests/Models/TestOfferCreate.cs b/Tests/Xrpl.Tests/Models/TestOfferCreate.cs index d2958038..221d7a63 100644 --- a/Tests/Xrpl.Tests/Models/TestOfferCreate.cs +++ b/Tests/Xrpl.Tests/Models/TestOfferCreate.cs @@ -5,7 +5,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; @@ -17,7 +16,7 @@ namespace XrplTests.Xrpl.Models public class TestUOfferCreate { [TestMethod] - public async Task TestVerify_Valid_OfferCreate1() + public void TestVerify_Valid_OfferCreate1() { var tx = new Dictionary { @@ -40,11 +39,11 @@ public async Task TestVerify_Valid_OfferCreate1() {"TxnSignature", "3045022100D874CDDD6BB24ED66E83B1D3574D3ECAC753A78F26DB7EBA89EAB8E7D72B95F802207C8CCD6CEA64E4AE2014E59EE9654E02CA8F03FE7FCE0539E958EAE182234D91"}, }; - await Validation.ValidateOfferCreate(tx); - await Validation.Validate(tx); + Validation.ValidateOfferCreate(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Valid_OfferCreate2() + public void TestVerify_Valid_OfferCreate2() { var tx = new Dictionary { @@ -65,11 +64,11 @@ public async Task TestVerify_Valid_OfferCreate2() {"TxnSignature", "3045022100D874CDDD6BB24ED66E83B1D3574D3ECAC753A78F26DB7EBA89EAB8E7D72B95F802207C8CCD6CEA64E4AE2014E59EE9654E02CA8F03FE7FCE0539E958EAE182234D91"}, }; - await Validation.ValidateOfferCreate(tx); - await Validation.Validate(tx); + Validation.ValidateOfferCreate(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Valid_OfferCreate3() + public void TestVerify_Valid_OfferCreate3() { var tx = new Dictionary { @@ -95,11 +94,11 @@ public async Task TestVerify_Valid_OfferCreate3() {"TxnSignature", "3045022100D874CDDD6BB24ED66E83B1D3574D3ECAC753A78F26DB7EBA89EAB8E7D72B95F802207C8CCD6CEA64E4AE2014E59EE9654E02CA8F03FE7FCE0539E958EAE182234D91"}, }; - await Validation.ValidateOfferCreate(tx); - await Validation.Validate(tx); + Validation.ValidateOfferCreate(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_InValid_Expiration() + public void TestVerify_InValid_Expiration() { var tx = new Dictionary { @@ -122,11 +121,11 @@ public async Task TestVerify_InValid_Expiration() {"TxnSignature", "3045022100D874CDDD6BB24ED66E83B1D3574D3ECAC753A78F26DB7EBA89EAB8E7D72B95F802207C8CCD6CEA64E4AE2014E59EE9654E02CA8F03FE7FCE0539E958EAE182234D91"}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateOfferCreate(tx), "OfferCreate: invalid Expiration"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "OfferCreate: invalid Expiration"); + Helper.ThrowsException(() => Validation.ValidateOfferCreate(tx), "OfferCreate: invalid Expiration"); + Helper.ThrowsException(() => Validation.Validate(tx), "OfferCreate: invalid Expiration"); } [TestMethod] - public async Task TestVerify_InValid_OfferSequence() + public void TestVerify_InValid_OfferSequence() { var tx = new Dictionary { @@ -149,11 +148,11 @@ public async Task TestVerify_InValid_OfferSequence() {"TxnSignature", "3045022100D874CDDD6BB24ED66E83B1D3574D3ECAC753A78F26DB7EBA89EAB8E7D72B95F802207C8CCD6CEA64E4AE2014E59EE9654E02CA8F03FE7FCE0539E958EAE182234D91"}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateOfferCreate(tx), "OfferCreate: invalid OfferSequence"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "OfferCreate: invalid OfferSequence"); + Helper.ThrowsException(() => Validation.ValidateOfferCreate(tx), "OfferCreate: invalid OfferSequence"); + Helper.ThrowsException(() => Validation.Validate(tx), "OfferCreate: invalid OfferSequence"); } [TestMethod] - public async Task TestVerify_InValid_TakerPays() + public void TestVerify_InValid_TakerPays() { var tx = new Dictionary { @@ -175,11 +174,11 @@ public async Task TestVerify_InValid_TakerPays() {"TransactionType", "OfferCreate"}, {"TxnSignature", "3045022100D874CDDD6BB24ED66E83B1D3574D3ECAC753A78F26DB7EBA89EAB8E7D72B95F802207C8CCD6CEA64E4AE2014E59EE9654E02CA8F03FE7FCE0539E958EAE182234D91"}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateOfferCreate(tx), "OfferCreate: invalid TakerPays"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "OfferCreate: invalid TakerPays"); + Helper.ThrowsException(() => Validation.ValidateOfferCreate(tx), "OfferCreate: invalid TakerPays"); + Helper.ThrowsException(() => Validation.Validate(tx), "OfferCreate: invalid TakerPays"); } [TestMethod] - public async Task TestVerify_InValid_TakerGets() + public void TestVerify_InValid_TakerGets() { var tx = new Dictionary { @@ -201,8 +200,8 @@ public async Task TestVerify_InValid_TakerGets() {"TransactionType", "OfferCreate"}, {"TxnSignature", "3045022100D874CDDD6BB24ED66E83B1D3574D3ECAC753A78F26DB7EBA89EAB8E7D72B95F802207C8CCD6CEA64E4AE2014E59EE9654E02CA8F03FE7FCE0539E958EAE182234D91"}, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateOfferCreate(tx), "OfferCreate: invalid TakerGets"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(tx), "OfferCreate: invalid TakerGets"); + Helper.ThrowsException(() => Validation.ValidateOfferCreate(tx), "OfferCreate: invalid TakerGets"); + Helper.ThrowsException(() => Validation.Validate(tx), "OfferCreate: invalid TakerGets"); } } diff --git a/Tests/Xrpl.Tests/Models/TestOracleDelete.cs b/Tests/Xrpl.Tests/Models/TestOracleDelete.cs index c7c3cc21..6bc6395f 100644 --- a/Tests/Xrpl.Tests/Models/TestOracleDelete.cs +++ b/Tests/Xrpl.Tests/Models/TestOracleDelete.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -20,7 +19,7 @@ public class TestUOracleDelete /// Tests that a valid OracleDelete transaction passes validation. /// [TestMethod] - public async Task TestVerify_Valid_OracleDelete() + public void TestVerify_Valid_OracleDelete() { var tx = new Dictionary { @@ -30,15 +29,15 @@ public async Task TestVerify_Valid_OracleDelete() { "Sequence", 1u }, { "OracleDocumentID", 1u } }; - await Validation.ValidateOracleDelete(tx); - await Validation.Validate(tx); + Validation.ValidateOracleDelete(tx); + Validation.Validate(tx); } /// /// Tests that OracleDelete without OracleDocumentID fails validation. /// [TestMethod] - public async Task TestVerify_Invalid_MissingOracleDocumentID() + public void TestVerify_Invalid_MissingOracleDocumentID() { var tx = new Dictionary { @@ -47,7 +46,7 @@ public async Task TestVerify_Invalid_MissingOracleDocumentID() { "Fee", "12" }, { "Sequence", 1u } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateOracleDelete(tx), "OracleDelete: missing field OracleDocumentID"); } @@ -56,7 +55,7 @@ await Helper.ThrowsExceptionAsync( /// Tests that OracleDelete with null OracleDocumentID fails validation. /// [TestMethod] - public async Task TestVerify_Invalid_NullOracleDocumentID() + public void TestVerify_Invalid_NullOracleDocumentID() { var tx = new Dictionary { @@ -66,7 +65,7 @@ public async Task TestVerify_Invalid_NullOracleDocumentID() { "Sequence", 1u }, { "OracleDocumentID", null } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateOracleDelete(tx), "OracleDelete: missing field OracleDocumentID"); } @@ -75,7 +74,7 @@ await Helper.ThrowsExceptionAsync( /// Tests that OracleDelete with zero OracleDocumentID passes validation. /// [TestMethod] - public async Task TestVerify_Valid_ZeroOracleDocumentID() + public void TestVerify_Valid_ZeroOracleDocumentID() { var tx = new Dictionary { @@ -85,7 +84,7 @@ public async Task TestVerify_Valid_ZeroOracleDocumentID() { "Sequence", 1u }, { "OracleDocumentID", 0u } }; - await Validation.ValidateOracleDelete(tx); + Validation.ValidateOracleDelete(tx); } } } diff --git a/Tests/Xrpl.Tests/Models/TestOracleSet.cs b/Tests/Xrpl.Tests/Models/TestOracleSet.cs index d87e4de7..0256a7fa 100644 --- a/Tests/Xrpl.Tests/Models/TestOracleSet.cs +++ b/Tests/Xrpl.Tests/Models/TestOracleSet.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Nodes; -using System.Threading.Tasks; using Xrpl.BinaryCodec.Types; using Xrpl.Client.Exceptions; @@ -30,7 +29,7 @@ public class TestUOracleSet /// Tests that a valid OracleSet transaction passes validation. /// [TestMethod] - public async Task TestVerify_Valid_OracleSet() + public void TestVerify_Valid_OracleSet() { var tx = new Dictionary { @@ -58,15 +57,15 @@ public async Task TestVerify_Valid_OracleSet() } } }; - await Validation.ValidateOracleSet(tx); - await Validation.Validate(tx); + Validation.ValidateOracleSet(tx); + Validation.Validate(tx); } /// /// Tests that a valid OracleSet with multiple PriceData objects passes validation. /// [TestMethod] - public async Task TestVerify_Valid_OracleSet_MultiplePriceData() + public void TestVerify_Valid_OracleSet_MultiplePriceData() { var tx = new Dictionary { @@ -105,14 +104,14 @@ public async Task TestVerify_Valid_OracleSet_MultiplePriceData() } } }; - await Validation.ValidateOracleSet(tx); + Validation.ValidateOracleSet(tx); } /// /// Tests that OracleSet without OracleDocumentID fails validation. /// [TestMethod] - public async Task TestVerify_Invalid_MissingOracleDocumentID() + public void TestVerify_Invalid_MissingOracleDocumentID() { var tx = new Dictionary { @@ -137,7 +136,7 @@ public async Task TestVerify_Invalid_MissingOracleDocumentID() } } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateOracleSet(tx), "OracleSet: missing field OracleDocumentID"); } @@ -146,7 +145,7 @@ await Helper.ThrowsExceptionAsync( /// Tests that OracleSet without LastUpdateTime fails validation. /// [TestMethod] - public async Task TestVerify_Invalid_MissingLastUpdateTime() + public void TestVerify_Invalid_MissingLastUpdateTime() { var tx = new Dictionary { @@ -171,7 +170,7 @@ public async Task TestVerify_Invalid_MissingLastUpdateTime() } } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateOracleSet(tx), "OracleSet: missing field LastUpdateTime"); } @@ -180,7 +179,7 @@ await Helper.ThrowsExceptionAsync( /// Tests that OracleSet without PriceDataSeries fails validation. /// [TestMethod] - public async Task TestVerify_Invalid_MissingPriceDataSeries() + public void TestVerify_Invalid_MissingPriceDataSeries() { var tx = new Dictionary { @@ -193,7 +192,7 @@ public async Task TestVerify_Invalid_MissingPriceDataSeries() { "Provider", "chainlink" }, { "AssetClass", "currency" } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateOracleSet(tx), "OracleSet: missing field PriceDataSeries"); } @@ -202,7 +201,7 @@ await Helper.ThrowsExceptionAsync( /// Tests that OracleSet with empty PriceDataSeries fails validation. /// [TestMethod] - public async Task TestVerify_Invalid_EmptyPriceDataSeries() + public void TestVerify_Invalid_EmptyPriceDataSeries() { var tx = new Dictionary { @@ -216,7 +215,7 @@ public async Task TestVerify_Invalid_EmptyPriceDataSeries() { "AssetClass", "currency" }, { "PriceDataSeries", new List() } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateOracleSet(tx), "OracleSet: PriceDataSeries must not be empty"); } @@ -225,7 +224,7 @@ await Helper.ThrowsExceptionAsync( /// Tests that OracleSet with more than 10 PriceData objects fails validation. /// [TestMethod] - public async Task TestVerify_Invalid_ExceedsMaxPriceDataSeries() + public void TestVerify_Invalid_ExceedsMaxPriceDataSeries() { var priceDataList = new List(); for (int i = 0; i < 11; i++) @@ -253,7 +252,7 @@ public async Task TestVerify_Invalid_ExceedsMaxPriceDataSeries() { "AssetClass", "currency" }, { "PriceDataSeries", priceDataList } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateOracleSet(tx), "OracleSet: PriceDataSeries must have at most 10 PriceData objects"); } @@ -262,7 +261,7 @@ await Helper.ThrowsExceptionAsync( /// Tests that OracleSet with Scale greater than 10 fails validation. /// [TestMethod] - public async Task TestVerify_Invalid_ScaleExceedsMax() + public void TestVerify_Invalid_ScaleExceedsMax() { var tx = new Dictionary { @@ -290,7 +289,7 @@ public async Task TestVerify_Invalid_ScaleExceedsMax() } } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateOracleSet(tx), "OracleSet: Scale must be in range 0-10"); } @@ -299,7 +298,7 @@ await Helper.ThrowsExceptionAsync( /// Tests that OracleSet with missing BaseAsset fails validation. /// [TestMethod] - public async Task TestVerify_Invalid_MissingBaseAsset() + public void TestVerify_Invalid_MissingBaseAsset() { var tx = new Dictionary { @@ -324,7 +323,7 @@ public async Task TestVerify_Invalid_MissingBaseAsset() } } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateOracleSet(tx), "OracleSet: PriceData must have a BaseAsset string"); } @@ -333,7 +332,7 @@ await Helper.ThrowsExceptionAsync( /// Tests that OracleSet with missing QuoteAsset fails validation. /// [TestMethod] - public async Task TestVerify_Invalid_MissingQuoteAsset() + public void TestVerify_Invalid_MissingQuoteAsset() { var tx = new Dictionary { @@ -358,7 +357,7 @@ public async Task TestVerify_Invalid_MissingQuoteAsset() } } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidateOracleSet(tx), "OracleSet: PriceData must have a QuoteAsset string"); } diff --git a/Tests/Xrpl.Tests/Models/TestPayment.cs b/Tests/Xrpl.Tests/Models/TestPayment.cs index b2a34426..1ba667e7 100644 --- a/Tests/Xrpl.Tests/Models/TestPayment.cs +++ b/Tests/Xrpl.Tests/Models/TestPayment.cs @@ -5,7 +5,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; @@ -46,19 +45,19 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid PaymentTransaction - await Validation.ValidatePayment(payment); - await Validation.Validate(payment); + Validation.ValidatePayment(payment); + Validation.Validate(payment); // Verifies memos correctly //payment["Memos"] = new List>(){new Dictionary() //{ // {"MemoData", "32324324"}, //}}; - //await Validation.Validate(payment); + //Validation.Validate(payment); //payment.Remove("Memos"); //// Verifies memos correctly @@ -67,43 +66,43 @@ public async Task TestVerifyValid() // {"MemoData", "32324324"}, // {"MemoType", 121221}, //}}; - //await Helper.ThrowsExceptionAsync(() => Validation.Validate(payment), "BaseTransaction: invalid Memos"); + //Helper.ThrowsException(() => Validation.Validate(payment), "BaseTransaction: invalid Memos"); //payment.Remove("Memos"); // throws when Amount is missing payment.Remove("Amount"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePayment(payment), "PaymentTransaction: missing field Amount"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(payment), "PaymentTransaction: missing field Amount"); + Helper.ThrowsException(() => Validation.ValidatePayment(payment), "PaymentTransaction: missing field Amount"); + Helper.ThrowsException(() => Validation.Validate(payment), "PaymentTransaction: missing field Amount"); payment["Amount"] = "1234"; // throws when Amount is invalid payment["Amount"] = 1234; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePayment(payment), "PaymentTransaction: invalid Amount"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(payment), "PaymentTransaction: invalid Amount"); + Helper.ThrowsException(() => Validation.ValidatePayment(payment), "PaymentTransaction: invalid Amount"); + Helper.ThrowsException(() => Validation.Validate(payment), "PaymentTransaction: invalid Amount"); payment["Amount"] = "1234"; // throws when Destination is missing payment.Remove("Destination"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePayment(payment), "PaymentTransaction: missing field Destination"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(payment), "PaymentTransaction: missing field Destination"); + Helper.ThrowsException(() => Validation.ValidatePayment(payment), "PaymentTransaction: missing field Destination"); + Helper.ThrowsException(() => Validation.Validate(payment), "PaymentTransaction: missing field Destination"); payment["Destination"] = "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy"; // throws when Destination is invalid payment["Destination"] = 7896214; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePayment(payment), "PaymentTransaction: invalid Destination"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(payment), "PaymentTransaction: invalid Destination"); + Helper.ThrowsException(() => Validation.ValidatePayment(payment), "PaymentTransaction: invalid Destination"); + Helper.ThrowsException(() => Validation.Validate(payment), "PaymentTransaction: invalid Destination"); payment["Destination"] = "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy"; // throws when DestinationTag is not a number payment["DestinationTag"] = "1"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePayment(payment), "PaymentTransaction: DestinationTag must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(payment), "PaymentTransaction: DestinationTag must be a number"); + Helper.ThrowsException(() => Validation.ValidatePayment(payment), "PaymentTransaction: DestinationTag must be a number"); + Helper.ThrowsException(() => Validation.Validate(payment), "PaymentTransaction: DestinationTag must be a number"); payment["DestinationTag"] = 1u; // throws when InvoiceID is not a string payment["InvoiceID"] = 19832; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePayment(payment), "PaymentTransaction: InvoiceID must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(payment), "PaymentTransaction: InvoiceID must be a string"); + Helper.ThrowsException(() => Validation.ValidatePayment(payment), "PaymentTransaction: InvoiceID must be a string"); + Helper.ThrowsException(() => Validation.Validate(payment), "PaymentTransaction: InvoiceID must be a string"); payment["InvoiceID"] = "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B"; // throws when Paths is invalid @@ -117,8 +116,8 @@ public async Task TestVerifyValid() } } }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePayment(payment), "PaymentTransaction: invalid Paths"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(payment), "PaymentTransaction: invalid Paths"); + Helper.ThrowsException(() => Validation.ValidatePayment(payment), "PaymentTransaction: invalid Paths"); + Helper.ThrowsException(() => Validation.Validate(payment), "PaymentTransaction: invalid Paths"); payment["Paths"] = new List>>() { new List>() @@ -133,15 +132,15 @@ public async Task TestVerifyValid() // throws when SendMax is invalid payment["SendMax"] = 100000000; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePayment(payment), "PaymentTransaction: invalid SendMax"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(payment), "PaymentTransaction: invalid SendMax"); + Helper.ThrowsException(() => Validation.ValidatePayment(payment), "PaymentTransaction: invalid SendMax"); + Helper.ThrowsException(() => Validation.Validate(payment), "PaymentTransaction: invalid SendMax"); payment["SendMax"] = "100000000"; // verifies valid DeliverMin with tfPartialPayment flag set as a number payment["DeliverMin"] = "10000"; payment["Flags"] = PaymentFlags.tfPartialPayment; - await Validation.ValidatePayment(payment); - await Validation.Validate(payment); + Validation.ValidatePayment(payment); + Validation.Validate(payment); payment["Flags"] = 2147483648u; payment.Remove("DeliverMin"); @@ -151,8 +150,8 @@ public async Task TestVerifyValid() { { "tfPartialPayment", true }, }; - await Validation.ValidatePayment(payment); - await Validation.Validate(payment); + Validation.ValidatePayment(payment); + Validation.Validate(payment); payment["Flags"] = 2147483648u; payment.Remove("DeliverMin"); @@ -162,20 +161,20 @@ public async Task TestVerifyValid() { { "tfPartialPayment", true }, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePayment(payment), "PaymentTransaction: invalid DeliverMin"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(payment), "PaymentTransaction: invalid DeliverMin"); + Helper.ThrowsException(() => Validation.ValidatePayment(payment), "PaymentTransaction: invalid DeliverMin"); + Helper.ThrowsException(() => Validation.Validate(payment), "PaymentTransaction: invalid DeliverMin"); payment["Flags"] = 2147483648u; payment.Remove("DeliverMin"); //throws when tfPartialPayment flag is missing with valid DeliverMin payment["DeliverMin"] = "10000"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePayment(payment), "PaymentTransaction: tfPartialPayment flag required with DeliverMin"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(payment), "PaymentTransaction: tfPartialPayment flag required with DeliverMin"); + Helper.ThrowsException(() => Validation.ValidatePayment(payment), "PaymentTransaction: tfPartialPayment flag required with DeliverMin"); + Helper.ThrowsException(() => Validation.Validate(payment), "PaymentTransaction: tfPartialPayment flag required with DeliverMin"); payment.Remove("DeliverMin"); } [TestMethod] - public async Task TestVerify_Valid_Payment_WithCredentialIDs() + public void TestVerify_Valid_Payment_WithCredentialIDs() { Dictionary tx = new Dictionary { @@ -185,12 +184,12 @@ public async Task TestVerify_Valid_Payment_WithCredentialIDs() { "Destination", "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy" }, { "CredentialIDs", new List { "A1B2C3D4E5F6789012345678901234567890ABCDEF1234567890ABCDEF123456" } } }; - await Validation.ValidatePayment(tx); - await Validation.Validate(tx); + Validation.ValidatePayment(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Invalid_Payment_CredentialIDsTooMany() + public void TestVerify_Invalid_Payment_CredentialIDsTooMany() { List ids = new List(); for (int i = 0; i < 9; i++) @@ -206,13 +205,13 @@ public async Task TestVerify_Invalid_Payment_CredentialIDsTooMany() { "Destination", "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy" }, { "CredentialIDs", ids } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePayment(tx), "PaymentTransaction: CredentialIDs cannot contain more than 8 elements"); } [TestMethod] - public async Task TestVerify_Invalid_Payment_CredentialIDsNonHex() + public void TestVerify_Invalid_Payment_CredentialIDsNonHex() { Dictionary tx = new Dictionary { @@ -222,7 +221,7 @@ public async Task TestVerify_Invalid_Payment_CredentialIDsNonHex() { "Destination", "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy" }, { "CredentialIDs", new List { new string('Z', 64) } } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePayment(tx), "PaymentTransaction: CredentialIDs[0] must be a 64-character hexadecimal object ID"); } diff --git a/Tests/Xrpl.Tests/Models/TestPaymentChannelClaim.cs b/Tests/Xrpl.Tests/Models/TestPaymentChannelClaim.cs index 2ddf24db..0a3a3a23 100644 --- a/Tests/Xrpl.Tests/Models/TestPaymentChannelClaim.cs +++ b/Tests/Xrpl.Tests/Models/TestPaymentChannelClaim.cs @@ -5,7 +5,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; @@ -34,20 +33,20 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid PaymentChannelClaim - await Validation.ValidatePaymentChannelClaim(channel); - await Validation.Validate(channel); + Validation.ValidatePaymentChannelClaim(channel); + Validation.Validate(channel); // verifies valid PaymentChannelClaim w/o optional channel.Remove("Balance"); channel.Remove("Amount"); channel.Remove("Signature"); channel.Remove("PublicKey"); - await Validation.ValidatePaymentChannelClaim(channel); - await Validation.Validate(channel); + Validation.ValidatePaymentChannelClaim(channel); + Validation.Validate(channel); channel["Balance"] = "1000000"; channel["Amount"] = "1000000"; channel["Signature"] = "30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1E721B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA3CD7B9B"; @@ -56,44 +55,44 @@ public async Task TestVerifyValid() // throws w/ missing Channel channel.Remove("Channel"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: missing field Channel"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelClaim: missing field Channel"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: missing field Channel"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelClaim: missing field Channel"); channel["Channel"] = "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198"; // throws w/ invalid Channel channel["Channel"] = 100; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: Channel must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelClaim: Channel must be a string"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: Channel must be a string"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelClaim: Channel must be a string"); channel["Channel"] = "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198"; // throws w/ invalid Balance channel["Balance"] = 100; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: Balance must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelClaim: Balance must be a string"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: Balance must be a string"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelClaim: Balance must be a string"); channel["Balance"] = "1000000"; // throws w/ invalid Amount channel["Amount"] = 100; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: Amount must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelClaim: Amount must be a string"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: Amount must be a string"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelClaim: Amount must be a string"); channel["Amount"] = "1000000"; // throws w/ invalid Signature channel["Signature"] = 1000; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: Signature must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelClaim: Signature must be a string"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: Signature must be a string"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelClaim: Signature must be a string"); channel["Signature"] = "30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1E721B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA3CD7B9B"; // throws w/ invalid PublicKey channel["PublicKey"] = new List() { "100000" }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: PublicKey must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelClaim: PublicKey must be a string"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelClaim(channel), "PaymentChannelClaim: PublicKey must be a string"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelClaim: PublicKey must be a string"); channel["PublicKey"] = "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A"; } [TestMethod] - public async Task TestVerify_Valid_PaymentChannelClaim_WithCredentialIDs() + public void TestVerify_Valid_PaymentChannelClaim_WithCredentialIDs() { Dictionary tx = new Dictionary { @@ -102,12 +101,12 @@ public async Task TestVerify_Valid_PaymentChannelClaim_WithCredentialIDs() { "Channel", "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198" }, { "CredentialIDs", new List { "A1B2C3D4E5F6789012345678901234567890ABCDEF1234567890ABCDEF123456" } } }; - await Validation.ValidatePaymentChannelClaim(tx); - await Validation.Validate(tx); + Validation.ValidatePaymentChannelClaim(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Invalid_PaymentChannelClaim_DuplicateCredentialIDs() + public void TestVerify_Invalid_PaymentChannelClaim_DuplicateCredentialIDs() { string id = "A1B2C3D4E5F6789012345678901234567890ABCDEF1234567890ABCDEF123456"; Dictionary tx = new Dictionary @@ -117,7 +116,7 @@ public async Task TestVerify_Invalid_PaymentChannelClaim_DuplicateCredentialIDs( { "Channel", "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198" }, { "CredentialIDs", new List { id, id } } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePaymentChannelClaim(tx), "PaymentChannelClaim: CredentialIDs cannot contain duplicate credential IDs"); } diff --git a/Tests/Xrpl.Tests/Models/TestPaymentChannelCreate.cs b/Tests/Xrpl.Tests/Models/TestPaymentChannelCreate.cs index 3c2a4c93..8f8af5de 100644 --- a/Tests/Xrpl.Tests/Models/TestPaymentChannelCreate.cs +++ b/Tests/Xrpl.Tests/Models/TestPaymentChannelCreate.cs @@ -4,7 +4,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; using Xrpl.Models.Transactions; @@ -34,19 +33,19 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid PaymentChannelCreate - await Validation.ValidatePaymentChannelCreate(channel); - await Validation.Validate(channel); + Validation.ValidatePaymentChannelCreate(channel); + Validation.Validate(channel); // verifies valid PaymentChannelCreate w/o optional channel.Remove("CancelAfter"); channel.Remove("DestinationTag"); channel.Remove("SourceTag"); - await Validation.ValidatePaymentChannelCreate(channel); - await Validation.Validate(channel); + Validation.ValidatePaymentChannelCreate(channel); + Validation.Validate(channel); channel["CancelAfter"] = 533171558u; channel["DestinationTag"] = 23480u; channel["SourceTag"] = 11747u; @@ -54,62 +53,62 @@ public async Task TestVerifyValid() // throws w/ missing Amount channel.Remove("Amount"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: missing field Amount"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelCreate: missing field Amount"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: missing field Amount"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelCreate: missing field Amount"); channel["Amount"] = "1000000"; // throws w/ missing Destination channel.Remove("Destination"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: missing field Destination"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelCreate: missing field Destination"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: missing field Destination"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelCreate: missing field Destination"); channel["Destination"] = "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"; // throws w/ SettleDelay must be a number channel.Remove("SettleDelay"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: missing field SettleDelay"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelCreate: missing field SettleDelay"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: missing field SettleDelay"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelCreate: missing field SettleDelay"); channel["SettleDelay"] = 86400u; // throws w/ missing PublicKey channel.Remove("PublicKey"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: missing field PublicKey"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelCreate: missing field PublicKey"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: missing field PublicKey"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelCreate: missing field PublicKey"); channel["PublicKey"] = "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A"; // throws w/ Amount must be a string channel["Amount"] = 1000000; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: Amount must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelCreate: Amount must be a string"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: Amount must be a string"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelCreate: Amount must be a string"); channel["Amount"] = "1000000"; // throws w/ Destination must be a string channel["Destination"] = 10; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: Destination must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelCreate: Destination must be a string"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: Destination must be a string"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelCreate: Destination must be a string"); channel["Destination"] = "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"; // throws w/ SettleDelay must be a string channel["SettleDelay"] = "10"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: SettleDelay must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelCreate: SettleDelay must be a number"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: SettleDelay must be a number"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelCreate: SettleDelay must be a number"); channel["SettleDelay"] = 86400u; // throws w/ PublicKey must be a string channel["PublicKey"] = 10; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: PublicKey must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelCreate: PublicKey must be a string"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: PublicKey must be a string"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelCreate: PublicKey must be a string"); channel["PublicKey"] = "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A"; // throws w/ DestinationTag must be a number channel["DestinationTag"] = true; // int/long are now valid integral representations - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: DestinationTag must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelCreate: DestinationTag must be a number"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: DestinationTag must be a number"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelCreate: DestinationTag must be a number"); channel["DestinationTag"] = 23480u; // throws w/ CancelAfter must be a number channel["CancelAfter"] = true; // int/long are now valid integral representations - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: CancelAfter must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelCreate: CancelAfter must be a number"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelCreate(channel), "PaymentChannelCreate: CancelAfter must be a number"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelCreate: CancelAfter must be a number"); channel["CancelAfter"] = 11747u; diff --git a/Tests/Xrpl.Tests/Models/TestPaymentChannelFund.cs b/Tests/Xrpl.Tests/Models/TestPaymentChannelFund.cs index 91edc4c1..af216cae 100644 --- a/Tests/Xrpl.Tests/Models/TestPaymentChannelFund.cs +++ b/Tests/Xrpl.Tests/Models/TestPaymentChannelFund.cs @@ -4,7 +4,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; using Xrpl.Models.Transactions; @@ -30,48 +29,48 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid PaymentChannelFund - await Validation.ValidatePaymentChannelFund(channel); - await Validation.Validate(channel); + Validation.ValidatePaymentChannelFund(channel); + Validation.Validate(channel); // verifies valid PaymentChannelFund w/o optional channel.Remove("Expiration"); - await Validation.ValidatePaymentChannelFund(channel); - await Validation.Validate(channel); + Validation.ValidatePaymentChannelFund(channel); + Validation.Validate(channel); channel["Expiration"] = 533171558u; // throws w/ missing Amount channel.Remove("Amount"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelFund(channel), "PaymentChannelFund: missing field Amount"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelFund: missing field Amount"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelFund(channel), "PaymentChannelFund: missing field Amount"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelFund: missing field Amount"); channel["Amount"] = "200000"; // throws w/ missing Channel channel.Remove("Channel"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelFund(channel), "PaymentChannelFund: missing field Channel"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelFund: missing field Channel"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelFund(channel), "PaymentChannelFund: missing field Channel"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelFund: missing field Channel"); channel["Channel"] = "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198"; // throws w/ Amount must be a string channel["Amount"] = 100; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelFund(channel), "PaymentChannelFund: Amount must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelFund: Amount must be a string"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelFund(channel), "PaymentChannelFund: Amount must be a string"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelFund: Amount must be a string"); channel["Amount"] = "1000000"; // throws w/ Channel must be a string channel["Channel"] = 1000; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelFund(channel), "PaymentChannelFund: Channel must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelFund: Channel must be a string"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelFund(channel), "PaymentChannelFund: Channel must be a string"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelFund: Channel must be a string"); channel["Channel"] = "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198"; // throws w/ Expiration must be a string channel["Expiration"] = "10"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidatePaymentChannelFund(channel), "PaymentChannelFund: Expiration must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(channel), "PaymentChannelFund: Expiration must be a number"); + Helper.ThrowsException(() => Validation.ValidatePaymentChannelFund(channel), "PaymentChannelFund: Expiration must be a number"); + Helper.ThrowsException(() => Validation.Validate(channel), "PaymentChannelFund: Expiration must be a number"); channel["Expiration"] = 543171558u; } diff --git a/Tests/Xrpl.Tests/Models/TestPermissionedDomainDelete.cs b/Tests/Xrpl.Tests/Models/TestPermissionedDomainDelete.cs index f8645bea..7a21e7cb 100644 --- a/Tests/Xrpl.Tests/Models/TestPermissionedDomainDelete.cs +++ b/Tests/Xrpl.Tests/Models/TestPermissionedDomainDelete.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -12,7 +11,7 @@ namespace XrplTests.Xrpl.Models public class TestUPermissionedDomainDelete { [TestMethod] - public async Task TestVerify_Valid_WithDomainID() + public void TestVerify_Valid_WithDomainID() { var tx = new Dictionary { @@ -22,12 +21,12 @@ public async Task TestVerify_Valid_WithDomainID() { "Sequence", 392u }, { "DomainID", "77D6234D074E505024D39C04C3F262997B773719AB29ACFA83119E4210328776" } }; - await Validation.ValidatePermissionedDomainDelete(tx); - await Validation.Validate(tx); + Validation.ValidatePermissionedDomainDelete(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Invalid_MissingDomainID() + public void TestVerify_Invalid_MissingDomainID() { var tx = new Dictionary { @@ -36,13 +35,13 @@ public async Task TestVerify_Invalid_MissingDomainID() { "Fee", "10" }, { "Sequence", 392u } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePermissionedDomainDelete(tx), "PermissionedDomainDelete: DomainID is required"); } [TestMethod] - public async Task TestVerify_Invalid_EmptyDomainID() + public void TestVerify_Invalid_EmptyDomainID() { var tx = new Dictionary { @@ -52,7 +51,7 @@ public async Task TestVerify_Invalid_EmptyDomainID() { "Sequence", 392u }, { "DomainID", "" } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePermissionedDomainDelete(tx), "PermissionedDomainDelete: DomainID is required"); } diff --git a/Tests/Xrpl.Tests/Models/TestPermissionedDomainSet.cs b/Tests/Xrpl.Tests/Models/TestPermissionedDomainSet.cs index ecd9af08..bfb3279f 100644 --- a/Tests/Xrpl.Tests/Models/TestPermissionedDomainSet.cs +++ b/Tests/Xrpl.Tests/Models/TestPermissionedDomainSet.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transactions; @@ -30,7 +29,7 @@ private static List> CreateValidCredentials(int count } [TestMethod] - public async Task TestVerify_Valid_CreateNewDomain() + public void TestVerify_Valid_CreateNewDomain() { var tx = new Dictionary { @@ -40,12 +39,12 @@ public async Task TestVerify_Valid_CreateNewDomain() { "Sequence", 390u }, { "AcceptedCredentials", CreateValidCredentials(1) } }; - await Validation.ValidatePermissionedDomainSet(tx); - await Validation.Validate(tx); + Validation.ValidatePermissionedDomainSet(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Valid_ModifyExistingDomain() + public void TestVerify_Valid_ModifyExistingDomain() { var tx = new Dictionary { @@ -56,12 +55,12 @@ public async Task TestVerify_Valid_ModifyExistingDomain() { "DomainID", "77D6234D074E505024D39C04C3F262997B773719AB29ACFA83119E4210328776" }, { "AcceptedCredentials", CreateValidCredentials(2) } }; - await Validation.ValidatePermissionedDomainSet(tx); - await Validation.Validate(tx); + Validation.ValidatePermissionedDomainSet(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Valid_MaxCredentials() + public void TestVerify_Valid_MaxCredentials() { var tx = new Dictionary { @@ -71,12 +70,12 @@ public async Task TestVerify_Valid_MaxCredentials() { "Sequence", 392u }, { "AcceptedCredentials", CreateValidCredentials(10) } }; - await Validation.ValidatePermissionedDomainSet(tx); - await Validation.Validate(tx); + Validation.ValidatePermissionedDomainSet(tx); + Validation.Validate(tx); } [TestMethod] - public async Task TestVerify_Invalid_MissingAcceptedCredentials() + public void TestVerify_Invalid_MissingAcceptedCredentials() { var tx = new Dictionary { @@ -85,13 +84,13 @@ public async Task TestVerify_Invalid_MissingAcceptedCredentials() { "Fee", "10" }, { "Sequence", 390u } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePermissionedDomainSet(tx), "PermissionedDomainSet: AcceptedCredentials is required"); } [TestMethod] - public async Task TestVerify_Invalid_EmptyAcceptedCredentials() + public void TestVerify_Invalid_EmptyAcceptedCredentials() { var tx = new Dictionary { @@ -101,13 +100,13 @@ public async Task TestVerify_Invalid_EmptyAcceptedCredentials() { "Sequence", 390u }, { "AcceptedCredentials", new List>() } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePermissionedDomainSet(tx), "PermissionedDomainSet: AcceptedCredentials must contain at least 1 credential"); } [TestMethod] - public async Task TestVerify_Invalid_TooManyCredentials() + public void TestVerify_Invalid_TooManyCredentials() { var tx = new Dictionary { @@ -117,13 +116,13 @@ public async Task TestVerify_Invalid_TooManyCredentials() { "Sequence", 390u }, { "AcceptedCredentials", CreateValidCredentials(11) } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePermissionedDomainSet(tx), "PermissionedDomainSet: AcceptedCredentials cannot contain more than 10 credentials"); } [TestMethod] - public async Task TestVerify_Invalid_MissingCredentialIssuer() + public void TestVerify_Invalid_MissingCredentialIssuer() { var credentials = new List> { @@ -144,13 +143,13 @@ public async Task TestVerify_Invalid_MissingCredentialIssuer() { "Sequence", 390u }, { "AcceptedCredentials", credentials } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePermissionedDomainSet(tx), "PermissionedDomainSet: Credential.Issuer is required"); } [TestMethod] - public async Task TestVerify_Invalid_MissingCredentialType() + public void TestVerify_Invalid_MissingCredentialType() { var credentials = new List> { @@ -171,13 +170,13 @@ public async Task TestVerify_Invalid_MissingCredentialType() { "Sequence", 390u }, { "AcceptedCredentials", credentials } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePermissionedDomainSet(tx), "PermissionedDomainSet: Credential.CredentialType is required"); } [TestMethod] - public async Task TestVerify_Invalid_CredentialTypeTooLong() + public void TestVerify_Invalid_CredentialTypeTooLong() { var longCredentialType = new string('A', 130); var credentials = new List> @@ -200,13 +199,13 @@ public async Task TestVerify_Invalid_CredentialTypeTooLong() { "Sequence", 390u }, { "AcceptedCredentials", credentials } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePermissionedDomainSet(tx), "PermissionedDomainSet: Credential.CredentialType cannot exceed 64 bytes (128 hex characters)"); } [TestMethod] - public async Task TestVerify_Invalid_DuplicateCredentials() + public void TestVerify_Invalid_DuplicateCredentials() { var credentials = new List> { @@ -237,13 +236,13 @@ public async Task TestVerify_Invalid_DuplicateCredentials() { "Sequence", 390u }, { "AcceptedCredentials", credentials } }; - await Helper.ThrowsExceptionAsync( + Helper.ThrowsException( () => Validation.ValidatePermissionedDomainSet(tx), "PermissionedDomainSet: AcceptedCredentials cannot contain duplicate credentials"); } [TestMethod] - public async Task TestVerify_Valid_UniqueCredentialsSameIssuerDifferentType() + public void TestVerify_Valid_UniqueCredentialsSameIssuerDifferentType() { var credentials = new List> { @@ -274,8 +273,8 @@ public async Task TestVerify_Valid_UniqueCredentialsSameIssuerDifferentType() { "Sequence", 390u }, { "AcceptedCredentials", credentials } }; - await Validation.ValidatePermissionedDomainSet(tx); - await Validation.Validate(tx); + Validation.ValidatePermissionedDomainSet(tx); + Validation.Validate(tx); } } } diff --git a/Tests/Xrpl.Tests/Models/TestSetRegularKey.cs b/Tests/Xrpl.Tests/Models/TestSetRegularKey.cs index 81f67ee3..6281084c 100644 --- a/Tests/Xrpl.Tests/Models/TestSetRegularKey.cs +++ b/Tests/Xrpl.Tests/Models/TestSetRegularKey.cs @@ -4,7 +4,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; using Xrpl.Models.Transactions; @@ -30,23 +29,23 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid SetRegularKey - await Validation.ValidateSetRegularKey(account); - await Validation.Validate(account); + Validation.ValidateSetRegularKey(account); + Validation.Validate(account); // verifies w/o SetRegularKey account.Remove("SetRegularKey"); - await Validation.ValidateSetRegularKey(account); - await Validation.Validate(account); + Validation.ValidateSetRegularKey(account); + Validation.Validate(account); account["SetRegularKey"] = "rAR8rR8sUkBoCZFawhkWzY4Y5YoyuznwD"; // throws w/ invalid RegularKey account["RegularKey"] = 12369846963; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateSetRegularKey(account), "SetRegularKey: RegularKey must be a string"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(account), "SetRegularKey: RegularKey must be a string"); + Helper.ThrowsException(() => Validation.ValidateSetRegularKey(account), "SetRegularKey: RegularKey must be a string"); + Helper.ThrowsException(() => Validation.Validate(account), "SetRegularKey: RegularKey must be a string"); account["RegularKey"] = "rAR8rR8sUkBoCZFawhkWzY4Y5YoyuznwD"; } } diff --git a/Tests/Xrpl.Tests/Models/TestSignerListSet.cs b/Tests/Xrpl.Tests/Models/TestSignerListSet.cs index 9463680b..f28c9755 100644 --- a/Tests/Xrpl.Tests/Models/TestSignerListSet.cs +++ b/Tests/Xrpl.Tests/Models/TestSignerListSet.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; @@ -70,23 +69,23 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid SignerListSet - await Validation.ValidateSignerListSet(signerListSetTx); - await Validation.Validate(signerListSetTx); + Validation.ValidateSignerListSet(signerListSetTx); + Validation.Validate(signerListSetTx); // throws w/ missing SignerQuorum signerListSetTx.Remove("SignerQuorum"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateSignerListSet(signerListSetTx), "SignerListSet: missing field SignerQuorum"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(signerListSetTx), "SignerListSet: missing field SignerQuorum"); + Helper.ThrowsException(() => Validation.ValidateSignerListSet(signerListSetTx), "SignerListSet: missing field SignerQuorum"); + Helper.ThrowsException(() => Validation.Validate(signerListSetTx), "SignerListSet: missing field SignerQuorum"); signerListSetTx["SignerQuorum"] = 3u; // throws w/ missing SignerEntries signerListSetTx["SignerEntries"] = new List(); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateSignerListSet(signerListSetTx), "SignerListSet: need at least 1 member in SignerEntries"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(signerListSetTx), "SignerListSet: need at least 1 member in SignerEntries"); + Helper.ThrowsException(() => Validation.ValidateSignerListSet(signerListSetTx), "SignerListSet: need at least 1 member in SignerEntries"); + Helper.ThrowsException(() => Validation.Validate(signerListSetTx), "SignerListSet: need at least 1 member in SignerEntries"); signerListSetTx["SignerEntries"] = new List() { new Dictionary() @@ -123,8 +122,8 @@ public async Task TestVerifyValid() // throws w/ missing SignerEntries signerListSetTx["SignerEntries"] = "khgfgyhujk"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateSignerListSet(signerListSetTx), "SignerListSet: invalid SignerEntries"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(signerListSetTx), "SignerListSet: invalid SignerEntries"); + Helper.ThrowsException(() => Validation.ValidateSignerListSet(signerListSetTx), "SignerListSet: invalid SignerEntries"); + Helper.ThrowsException(() => Validation.Validate(signerListSetTx), "SignerListSet: invalid SignerEntries"); signerListSetTx["SignerEntries"] = new List() { new Dictionary() @@ -211,8 +210,8 @@ public async Task TestVerifyValid() })); var error = "SignerListSet: maximum of 32 members allowed in SignerEntries"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateSignerListSet(signerListSetTx), error); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(signerListSetTx), error); + Helper.ThrowsException(() => Validation.ValidateSignerListSet(signerListSetTx), error); + Helper.ThrowsException(() => Validation.Validate(signerListSetTx), error); signerListSetTx["SignerEntries"] = new List() { new Dictionary() @@ -284,8 +283,8 @@ public async Task TestVerifyValid() }, } }; - await Validation.ValidateSignerListSet(signerListSetTx); - await Validation.Validate(signerListSetTx); + Validation.ValidateSignerListSet(signerListSetTx); + Validation.Validate(signerListSetTx); signerListSetTx["SignerEntries"] = new List() { new Dictionary() @@ -346,8 +345,8 @@ public async Task TestVerifyValid() }, }, }; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateSignerListSet(signerListSetTx), "SignerListSet: WalletLocator in SignerEntry must be a 256-bit (32-byte) hexadecimal value"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(signerListSetTx), "SignerListSet: WalletLocator in SignerEntry must be a 256-bit (32-byte) hexadecimal value"); + Helper.ThrowsException(() => Validation.ValidateSignerListSet(signerListSetTx), "SignerListSet: WalletLocator in SignerEntry must be a 256-bit (32-byte) hexadecimal value"); + Helper.ThrowsException(() => Validation.Validate(signerListSetTx), "SignerListSet: WalletLocator in SignerEntry must be a 256-bit (32-byte) hexadecimal value"); signerListSetTx["SignerEntries"] = new List() { new Dictionary() diff --git a/Tests/Xrpl.Tests/Models/TestTicketCreate.cs b/Tests/Xrpl.Tests/Models/TestTicketCreate.cs index d95c6c4b..d1259113 100644 --- a/Tests/Xrpl.Tests/Models/TestTicketCreate.cs +++ b/Tests/Xrpl.Tests/Models/TestTicketCreate.cs @@ -4,7 +4,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Transaction; using Xrpl.Models.Transactions; @@ -28,40 +27,40 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid TicketCreate - await Validation.ValidateTicketCreate(ticketCreate); - await Validation.Validate(ticketCreate); + Validation.ValidateTicketCreate(ticketCreate); + Validation.Validate(ticketCreate); // throws when TicketCount is missing ticketCreate.Remove("TicketCount"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateTicketCreate(ticketCreate), "TicketCreate: missing field TicketCount"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ticketCreate), "TicketCreate: missing field TicketCount"); + Helper.ThrowsException(() => Validation.ValidateTicketCreate(ticketCreate), "TicketCreate: missing field TicketCount"); + Helper.ThrowsException(() => Validation.Validate(ticketCreate), "TicketCreate: missing field TicketCount"); ticketCreate["TicketCount"] = 150u; // throws when TicketCount is not a number ticketCreate["TicketCount"] = "150"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateTicketCreate(ticketCreate), "TicketCreate: TicketCount must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ticketCreate), "TicketCreate: TicketCount must be a number"); + Helper.ThrowsException(() => Validation.ValidateTicketCreate(ticketCreate), "TicketCreate: TicketCount must be a number"); + Helper.ThrowsException(() => Validation.Validate(ticketCreate), "TicketCreate: TicketCount must be a number"); ticketCreate["TicketCount"] = 150u; // throws when TicketCount is not an uint ticketCreate["TicketCount"] = 12.5; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateTicketCreate(ticketCreate), "TicketCreate: TicketCount must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ticketCreate), "TicketCreate: TicketCount must be a number"); + Helper.ThrowsException(() => Validation.ValidateTicketCreate(ticketCreate), "TicketCreate: TicketCount must be a number"); + Helper.ThrowsException(() => Validation.Validate(ticketCreate), "TicketCreate: TicketCount must be a number"); ticketCreate["TicketCount"] = 150u; // throws when TicketCount is < 1 ticketCreate["TicketCount"] = 0u; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateTicketCreate(ticketCreate), "TicketCreate: TicketCount must be an integer from 1 to 250"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ticketCreate), "TicketCreate: TicketCount must be an integer from 1 to 250"); + Helper.ThrowsException(() => Validation.ValidateTicketCreate(ticketCreate), "TicketCreate: TicketCount must be an integer from 1 to 250"); + Helper.ThrowsException(() => Validation.Validate(ticketCreate), "TicketCreate: TicketCount must be an integer from 1 to 250"); ticketCreate["TicketCount"] = 150u; // throws when TicketCount is > 250 ticketCreate["TicketCount"] = 251u; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateTicketCreate(ticketCreate), "TicketCreate: TicketCount must be an integer from 1 to 250"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(ticketCreate), "TicketCreate: TicketCount must be an integer from 1 to 250"); + Helper.ThrowsException(() => Validation.ValidateTicketCreate(ticketCreate), "TicketCreate: TicketCount must be an integer from 1 to 250"); + Helper.ThrowsException(() => Validation.Validate(ticketCreate), "TicketCreate: TicketCount must be an integer from 1 to 250"); ticketCreate["TicketCount"] = 150u; } } diff --git a/Tests/Xrpl.Tests/Models/TestTrustSet.cs b/Tests/Xrpl.Tests/Models/TestTrustSet.cs index 58394f4f..280e5361 100644 --- a/Tests/Xrpl.Tests/Models/TestTrustSet.cs +++ b/Tests/Xrpl.Tests/Models/TestTrustSet.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -40,21 +39,21 @@ public static void MyClassInitialize(TestContext testContext) } [TestMethod] - public async Task TestVerifyValid() + public void TestVerifyValid() { //verifies valid TrustSet - await Validation.ValidateTrustSet(trustSet); - await Validation.Validate(trustSet); + Validation.ValidateTrustSet(trustSet); + Validation.Validate(trustSet); //throws when LimitAmount is missing trustSet.Remove("LimitAmount"); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateTrustSet(trustSet), "TrustSet: missing field LimitAmount"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(trustSet), "TrustSet: missing field LimitAmount"); + Helper.ThrowsException(() => Validation.ValidateTrustSet(trustSet), "TrustSet: missing field LimitAmount"); + Helper.ThrowsException(() => Validation.Validate(trustSet), "TrustSet: missing field LimitAmount"); //throws when LimitAmount is invalid trustSet.Add("LimitAmount", 1234); - await Helper.ThrowsExceptionAsync(() => Validation.ValidateTrustSet(trustSet), "TrustSet: invalid LimitAmount"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(trustSet), "TrustSet: invalid LimitAmount"); + Helper.ThrowsException(() => Validation.ValidateTrustSet(trustSet), "TrustSet: invalid LimitAmount"); + Helper.ThrowsException(() => Validation.Validate(trustSet), "TrustSet: invalid LimitAmount"); trustSet["LimitAmount"] = new Dictionary() { { "currency", "XRP" }, @@ -63,13 +62,13 @@ public async Task TestVerifyValid() }; //throws when QualityIn is not a number trustSet["QualityIn"] = "1234"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateTrustSet(trustSet), "TrustSet: QualityIn must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(trustSet), "TrustSet: QualityIn must be a number"); + Helper.ThrowsException(() => Validation.ValidateTrustSet(trustSet), "TrustSet: QualityIn must be a number"); + Helper.ThrowsException(() => Validation.Validate(trustSet), "TrustSet: QualityIn must be a number"); trustSet["QualityIn"] = 1234u; //throws when QualityOut is not a number trustSet["QualityOut"] = "4321"; - await Helper.ThrowsExceptionAsync(() => Validation.ValidateTrustSet(trustSet), "TrustSet: QualityOut must be a number"); - await Helper.ThrowsExceptionAsync(() => Validation.Validate(trustSet), "TrustSet: QualityOut must be a number"); + Helper.ThrowsException(() => Validation.ValidateTrustSet(trustSet), "TrustSet: QualityOut must be a number"); + Helper.ThrowsException(() => Validation.Validate(trustSet), "TrustSet: QualityOut must be a number"); trustSet["QualityOut"] = 4321u; } diff --git a/Tests/Xrpl.Tests/Models/TestUBatchUtils.cs b/Tests/Xrpl.Tests/Models/TestUBatchUtils.cs new file mode 100644 index 00000000..0c471e4a --- /dev/null +++ b/Tests/Xrpl.Tests/Models/TestUBatchUtils.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Xrpl.Models.Common; +using Xrpl.Models.Transactions; +using Xrpl.Models.Utils; + +namespace XrplTests.Xrpl.Models +{ + /// + /// Pins that BatchUtils.Build validates the batch it assembles. The validation call used to be + /// made without awaiting it, so every rule in ValidateBatch was reported into a task nobody + /// observed and a malformed batch left Build looking well formed. + /// + [TestClass] + public class TestUBatchUtils + { + private const string Account = "rMFMJsQaKEMEwwMRBHCoNXkFswJrWyNYLp"; + private const string Destination = "rJcvzBFCTcCrQdTLPZoRXJEboT9C3Wrd6H"; + + private static Payment Inner(uint sequence) => new Payment + { + Account = Account, + Destination = Destination, + Amount = new Currency { Value = "1" }, + Sequence = sequence, + }; + + private static List Inners(int count) => + Enumerable.Range(1, count).Select(i => (ITransactionRequest)Inner((uint)i)).ToList(); + + [TestMethod] + public void TestUBatchUtilsBuild_RejectsASingleInnerTransaction() + { + Helper.ThrowsException( + () => BatchUtils.Build(Account, Inners(1)), + "Batch: RawTransactions must contain at least 2 transactions (rippled answers temARRAY_EMPTY to a single inner)."); + } + + [TestMethod] + public void TestUBatchUtilsBuild_RejectsMoreThanEightInnerTransactions() + { + Helper.ThrowsException( + () => BatchUtils.Build(Account, Inners(9)), + "Batch: RawTransactions length must be <= 8."); + } + + [TestMethod] + public void TestUBatchUtilsBuild_AcceptsAWellFormedBatch() + { + Batch batch = BatchUtils.Build(Account, Inners(2)); + + Assert.AreEqual(2, batch.RawTransactions.Count); + } + } +} diff --git a/Tests/Xrpl.Tests/Models/TestUConfidentialMPT.cs b/Tests/Xrpl.Tests/Models/TestUConfidentialMPT.cs index 7ef287a6..f539531c 100644 --- a/Tests/Xrpl.Tests/Models/TestUConfidentialMPT.cs +++ b/Tests/Xrpl.Tests/Models/TestUConfidentialMPT.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Nodes; -using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -162,48 +161,48 @@ public void TestUSponsorship_BinaryRoundTrip() }; [TestMethod] - public async Task TestUValidateSponsorshipSet_ConflictingFlags_Throws() + public void TestUValidateSponsorshipSet_ConflictingFlags_Throws() { Dictionary tx = BaseTx("SponsorshipSet"); tx["Sponsee"] = Account2; tx["Flags"] = (uint)(SponsorshipSetFlags.tfSponsorshipSetRequireSignForFee | SponsorshipSetFlags.tfSponsorshipClearRequireSignForFee); - await Assert.ThrowsExactlyAsync(() => Validation.ValidateSponsorshipSet(tx)); + Assert.ThrowsExactly(() => Validation.ValidateSponsorshipSet(tx)); } [TestMethod] - public async Task TestUValidateSponsorshipTransfer_ModeRules() + public void TestUValidateSponsorshipTransfer_ModeRules() { // no mode flag Dictionary tx = BaseTx("SponsorshipTransfer"); - await Assert.ThrowsExactlyAsync(() => Validation.ValidateSponsorshipTransfer(tx)); + Assert.ThrowsExactly(() => Validation.ValidateSponsorshipTransfer(tx)); // create without Sponsor tx = BaseTx("SponsorshipTransfer"); tx["Flags"] = (uint)SponsorshipTransferFlags.tfSponsorshipCreate; - await Assert.ThrowsExactlyAsync(() => Validation.ValidateSponsorshipTransfer(tx)); + Assert.ThrowsExactly(() => Validation.ValidateSponsorshipTransfer(tx)); // create with Sponsor — valid tx["Sponsor"] = Account2; - await Validation.ValidateSponsorshipTransfer(tx); + Validation.ValidateSponsorshipTransfer(tx); // create with Sponsee — invalid tx["Sponsee"] = Account2; - await Assert.ThrowsExactlyAsync(() => Validation.ValidateSponsorshipTransfer(tx)); + Assert.ThrowsExactly(() => Validation.ValidateSponsorshipTransfer(tx)); // end with Sponsor — invalid tx = BaseTx("SponsorshipTransfer"); tx["Flags"] = (uint)SponsorshipTransferFlags.tfSponsorshipEnd; tx["Sponsor"] = Account2; - await Assert.ThrowsExactlyAsync(() => Validation.ValidateSponsorshipTransfer(tx)); + Assert.ThrowsExactly(() => Validation.ValidateSponsorshipTransfer(tx)); // end with neither field — valid (account-level self-sponsorship end) tx = BaseTx("SponsorshipTransfer"); tx["Flags"] = (uint)SponsorshipTransferFlags.tfSponsorshipEnd; - await Validation.ValidateSponsorshipTransfer(tx); + Validation.ValidateSponsorshipTransfer(tx); // end with Sponsee == Account — invalid tx["Sponsee"] = Account1; - await Assert.ThrowsExactlyAsync(() => Validation.ValidateSponsorshipTransfer(tx)); + Assert.ThrowsExactly(() => Validation.ValidateSponsorshipTransfer(tx)); } #endregion diff --git a/Tests/Xrpl.Tests/Models/TestUModelTruth.cs b/Tests/Xrpl.Tests/Models/TestUModelTruth.cs index 988d14a1..a396bfaa 100644 --- a/Tests/Xrpl.Tests/Models/TestUModelTruth.cs +++ b/Tests/Xrpl.Tests/Models/TestUModelTruth.cs @@ -134,7 +134,7 @@ public async System.Threading.Tasks.Task TestUTheSameOfferOnBothSidesIsRefused() { "NFTokenBuyOffer", offer }, }; - ValidationException error = await Assert.ThrowsExactlyAsync( + ValidationException error = Assert.ThrowsExactly( () => Validation.ValidateNFTokenAcceptOffer(tx)); StringAssert.Contains(error.Message, "different offers"); @@ -157,7 +157,7 @@ public async System.Threading.Tasks.Task TestUTwoDifferentOffersAreAccepted() { "NFTokenBuyOffer", "68CD1F6F906494EA08C9CB5CAFA64DFA90D4E834B7151899B73231DE5A0C3B77" }, }; - await Validation.ValidateNFTokenAcceptOffer(tx); + Validation.ValidateNFTokenAcceptOffer(tx); } /// diff --git a/Tests/Xrpl.Tests/Models/TestUProtocolCompleteness.cs b/Tests/Xrpl.Tests/Models/TestUProtocolCompleteness.cs index 5d62982c..9eba4359 100644 --- a/Tests/Xrpl.Tests/Models/TestUProtocolCompleteness.cs +++ b/Tests/Xrpl.Tests/Models/TestUProtocolCompleteness.cs @@ -2,7 +2,6 @@ using System.Linq; using System.Text.Json; using System.Text.Json.Nodes; -using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -36,7 +35,7 @@ public static void Init(TestContext _) } [TestMethod] - public async Task TestUNFTokenModify_DispatchesToOwnValidator() + public void TestUNFTokenModify_DispatchesToOwnValidator() { // Pre-fix the dispatcher routed NFTokenModify to ValidateNFTokenMint, // which rejects a valid Modify (no NFTokenTaxon present) @@ -46,7 +45,7 @@ public async Task TestUNFTokenModify_DispatchesToOwnValidator() ["Account"] = Account1, ["NFTokenID"] = new string('A', 64), }; - await Validation.Validate(tx); + Validation.Validate(tx); } [TestMethod] @@ -195,7 +194,7 @@ public void TestUUint64_FieldContext_RoundTrip() } [TestMethod] - public async Task TestUMPTokenIssuanceSet_PreflightRules() + public void TestUMPTokenIssuanceSet_PreflightRules() { // rippled MPTokenIssuanceSet::preflight rules pinned client-side Dictionary tx = new() @@ -208,31 +207,31 @@ public async Task TestUMPTokenIssuanceSet_PreflightRules() // A non-numeric Flags value must report as ValidationException like every other // malformed field here, not as a raw conversion exception callers do not catch. tx["Flags"] = "not-a-number"; - await Assert.ThrowsExactlyAsync(() => Validation.ValidateMPTokenIssuanceSet(tx)); + Assert.ThrowsExactly(() => Validation.ValidateMPTokenIssuanceSet(tx)); tx.Remove("Flags"); // ImmutableFlags: zero and out-of-mask values are temINVALID_FLAG tx["ImmutableFlags"] = 0u; - await Assert.ThrowsExactlyAsync(() => Validation.ValidateMPTokenIssuanceSet(tx)); + Assert.ThrowsExactly(() => Validation.ValidateMPTokenIssuanceSet(tx)); tx["ImmutableFlags"] = 0x1u; // outside tif* mask (0x2..0x80, 0x10000, 0x20000) - await Assert.ThrowsExactlyAsync(() => Validation.ValidateMPTokenIssuanceSet(tx)); + Assert.ThrowsExactly(() => Validation.ValidateMPTokenIssuanceSet(tx)); tx["ImmutableFlags"] = (uint)MPTokenIssuanceImmutableFlags.tifMPTCanHoldConfidentialBalance; - await Validation.ValidateMPTokenIssuanceSet(tx); + Validation.ValidateMPTokenIssuanceSet(tx); // Non-zero TransferFee combined with enabling confidential balances is temBAD_TRANSFER_FEE. // Since 3.3.0 the capability is enabled through a tf* flag, not through a separate field. tx.Remove("ImmutableFlags"); tx["Flags"] = (uint)MPTokenIssuanceSetFlags.tfMPTSetCanHoldConfidentialBalance; tx["TransferFee"] = 10u; - await Assert.ThrowsExactlyAsync(() => Validation.ValidateMPTokenIssuanceSet(tx)); + Assert.ThrowsExactly(() => Validation.ValidateMPTokenIssuanceSet(tx)); tx["TransferFee"] = 0u; - await Validation.ValidateMPTokenIssuanceSet(tx); + Validation.ValidateMPTokenIssuanceSet(tx); } [TestMethod] - public async Task TestUMPTokenIssuanceCreate_ImmutableFlagsMask() + public void TestUMPTokenIssuanceCreate_ImmutableFlagsMask() { Dictionary tx = new() { @@ -241,15 +240,15 @@ public async Task TestUMPTokenIssuanceCreate_ImmutableFlagsMask() }; tx["ImmutableFlags"] = 0u; - await Assert.ThrowsExactlyAsync(() => Validation.ValidateMPTokenIssuanceCreate(tx)); + Assert.ThrowsExactly(() => Validation.ValidateMPTokenIssuanceCreate(tx)); tx["ImmutableFlags"] = 0x100u; // outside tif* mask - await Assert.ThrowsExactlyAsync(() => Validation.ValidateMPTokenIssuanceCreate(tx)); + Assert.ThrowsExactly(() => Validation.ValidateMPTokenIssuanceCreate(tx)); tx["ImmutableFlags"] = (uint)(MPTokenIssuanceImmutableFlags.tifMPTMetadata | MPTokenIssuanceImmutableFlags.tifMPTTransferFee); - await Validation.ValidateMPTokenIssuanceCreate(tx); + Validation.ValidateMPTokenIssuanceCreate(tx); tx["DomainID"] = 12345; - await Assert.ThrowsExactlyAsync(() => Validation.ValidateMPTokenIssuanceCreate(tx)); + Assert.ThrowsExactly(() => Validation.ValidateMPTokenIssuanceCreate(tx)); } /// diff --git a/Tests/Xrpl.Tests/Models/TestUTransactionProtocolFields.cs b/Tests/Xrpl.Tests/Models/TestUTransactionProtocolFields.cs index 69dd7bfe..962b594e 100644 --- a/Tests/Xrpl.Tests/Models/TestUTransactionProtocolFields.cs +++ b/Tests/Xrpl.Tests/Models/TestUTransactionProtocolFields.cs @@ -250,15 +250,15 @@ public async System.Threading.Tasks.Task TestUBaseTransaction_ValidatesNewCommon tx["OperationLimit"] = 21337u; tx["Delegate"] = Destination; - await Xrpl.Models.Transactions.Common.ValidateBaseTransaction(tx); + Xrpl.Models.Transactions.Common.ValidateBaseTransaction(tx); tx["OperationLimit"] = "not a number"; - await Assert.ThrowsExactlyAsync( + Assert.ThrowsExactly( () => Xrpl.Models.Transactions.Common.ValidateBaseTransaction(tx)); tx["OperationLimit"] = 21337u; tx["Delegate"] = 12345; - await Assert.ThrowsExactlyAsync( + Assert.ThrowsExactly( () => Xrpl.Models.Transactions.Common.ValidateBaseTransaction(tx)); } diff --git a/Tests/Xrpl.Tests/Models/TestUValidationNumericTypes.cs b/Tests/Xrpl.Tests/Models/TestUValidationNumericTypes.cs index 8a21705b..828a2f9f 100644 --- a/Tests/Xrpl.Tests/Models/TestUValidationNumericTypes.cs +++ b/Tests/Xrpl.Tests/Models/TestUValidationNumericTypes.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -32,7 +31,7 @@ public static void Init(TestContext _) } [TestMethod] - public async Task TestUValidateBaseTransaction_FromToDictionary_Passes() + public void TestUValidateBaseTransaction_FromToDictionary_Passes() { Payment payment = new Payment { @@ -49,11 +48,11 @@ public async Task TestUValidateBaseTransaction_FromToDictionary_Passes() Dictionary tx = payment.ToDictionary(); Assert.IsInstanceOfType(tx["Sequence"], "Precondition: the converter materializes small numbers as int."); - await TxCommon.ValidateBaseTransaction(tx); + TxCommon.ValidateBaseTransaction(tx); } [TestMethod] - public async Task TestUValidateBaseTransaction_NegativeAndOutOfRange_Throw() + public void TestUValidateBaseTransaction_NegativeAndOutOfRange_Throw() { Dictionary tx = new() { @@ -61,18 +60,18 @@ public async Task TestUValidateBaseTransaction_NegativeAndOutOfRange_Throw() ["TransactionType"] = "Payment", ["SourceTag"] = -1, }; - await Assert.ThrowsExactlyAsync(() => TxCommon.ValidateBaseTransaction(tx)); + Assert.ThrowsExactly(() => TxCommon.ValidateBaseTransaction(tx)); tx.Remove("SourceTag"); tx["Sequence"] = (long)uint.MaxValue + 1; - await Assert.ThrowsExactlyAsync(() => TxCommon.ValidateBaseTransaction(tx)); + Assert.ThrowsExactly(() => TxCommon.ValidateBaseTransaction(tx)); tx["Sequence"] = "5"; - await Assert.ThrowsExactlyAsync(() => TxCommon.ValidateBaseTransaction(tx)); + Assert.ThrowsExactly(() => TxCommon.ValidateBaseTransaction(tx)); } [TestMethod] - public async Task TestUValidateAccountSet_SetFlagAsInt_NoInvalidCast() + public void TestUValidateAccountSet_SetFlagAsInt_NoInvalidCast() { AccountSet accountSet = new AccountSet { @@ -82,11 +81,11 @@ public async Task TestUValidateAccountSet_SetFlagAsInt_NoInvalidCast() Fee = new Currency { Value = "12" }, }; // Pre-fix this path threw InvalidCastException from the (uint)SetFlag unbox on a boxed int - await Validation.ValidateAccountSet(accountSet.ToDictionary()); + Validation.ValidateAccountSet(accountSet.ToDictionary()); } [TestMethod] - public async Task TestUValidateTicketCreate_CountAsInt_Passes() + public void TestUValidateTicketCreate_CountAsInt_Passes() { TicketCreate ticketCreate = new TicketCreate { @@ -95,11 +94,11 @@ public async Task TestUValidateTicketCreate_CountAsInt_Passes() Sequence = 1, Fee = new Currency { Value = "12" }, }; - await Validation.ValidateTicketCreate(ticketCreate.ToDictionary()); + Validation.ValidateTicketCreate(ticketCreate.ToDictionary()); } [TestMethod] - public async Task TestUValidateEscrowCreate_WithoutDestinationTag_Passes() + public void TestUValidateEscrowCreate_WithoutDestinationTag_Passes() { // Pre-fix the guard tested the required Destination instead of the optional // DestinationTag, so every escrow without a tag failed validation @@ -111,14 +110,14 @@ public async Task TestUValidateEscrowCreate_WithoutDestinationTag_Passes() ["Amount"] = "1000000", ["FinishAfter"] = 800000000u, }; - await Validation.ValidateEscrowCreate(tx); + Validation.ValidateEscrowCreate(tx); tx["DestinationTag"] = "not-a-number"; - await Assert.ThrowsExactlyAsync(() => Validation.ValidateEscrowCreate(tx)); + Assert.ThrowsExactly(() => Validation.ValidateEscrowCreate(tx)); } [TestMethod] - public async Task TestUValidateAccountSet_TickSizeZero_Clears() + public void TestUValidateAccountSet_TickSizeZero_Clears() { Dictionary tx = new() { @@ -127,11 +126,11 @@ public async Task TestUValidateAccountSet_TickSizeZero_Clears() ["TickSize"] = 0u, }; // 0 clears the tick size per rippled; must not be rejected as out of range - await Validation.ValidateAccountSet(tx); + Validation.ValidateAccountSet(tx); } [TestMethod] - public async Task TestUValidateSponsorshipTransfer_NonStringSponsor_TypeError() + public void TestUValidateSponsorshipTransfer_NonStringSponsor_TypeError() { Dictionary tx = new() { @@ -140,7 +139,7 @@ public async Task TestUValidateSponsorshipTransfer_NonStringSponsor_TypeError() ["Flags"] = (uint)SponsorshipTransferFlags.tfSponsorshipCreate, ["Sponsor"] = 123, }; - ValidationException ex = await Assert.ThrowsExactlyAsync(() => Validation.ValidateSponsorshipTransfer(tx)); + ValidationException ex = Assert.ThrowsExactly(() => Validation.ValidateSponsorshipTransfer(tx)); StringAssert.Contains(ex.Message, "invalid Sponsor"); } diff --git a/Tests/Xrpl.Tests/Wallet/TestUBatchCoSigning.cs b/Tests/Xrpl.Tests/Wallet/TestUBatchCoSigning.cs index cbb5cc8e..03e58486 100644 --- a/Tests/Xrpl.Tests/Wallet/TestUBatchCoSigning.cs +++ b/Tests/Xrpl.Tests/Wallet/TestUBatchCoSigning.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Nodes; -using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -139,17 +138,17 @@ public void TestUSign_OuterBatchSponsor_RoutesToSponsorSignature() } [TestMethod] - public async Task TestUValidateBatch_SingleInner_Throws() + public void TestUValidateBatch_SingleInner_Throws() { // rippled Batch::preflight answers temARRAY_EMPTY to fewer than two inners Dictionary batch = ToDict(OuterBatch(InnerPayment(Other.ClassicAddress))); - var ex = await Assert.ThrowsExactlyAsync(() => Validation.ValidateBatch(batch)); + var ex = Assert.ThrowsExactly(() => Validation.ValidateBatch(batch)); StringAssert.Contains(ex.Message, "at least 2"); } [TestMethod] - public async Task TestUValidateBatch_OuterReserveSponsorship_Throws() + public void TestUValidateBatch_OuterReserveSponsorship_Throws() { Dictionary batch = ToDict(OuterBatch( InnerPayment(Other.ClassicAddress), @@ -157,12 +156,12 @@ public async Task TestUValidateBatch_OuterReserveSponsorship_Throws() batch["Sponsor"] = Sponsor.ClassicAddress; batch["SponsorFlags"] = 2u; // spfSponsorReserve — forbidden on outer - var ex = await Assert.ThrowsExactlyAsync(() => Validation.ValidateBatch(batch)); + var ex = Assert.ThrowsExactly(() => Validation.ValidateBatch(batch)); StringAssert.Contains(ex.Message, "spfSponsorReserve"); } [TestMethod] - public async Task TestUValidateBatch_InnerFeeSponsorship_Throws() + public void TestUValidateBatch_InnerFeeSponsorship_Throws() { Dictionary batch = ToDict(OuterBatch( InnerPayment(Other.ClassicAddress, new JsonObject @@ -172,12 +171,12 @@ public async Task TestUValidateBatch_InnerFeeSponsorship_Throws() }), InnerPayment(Root.ClassicAddress, new JsonObject { ["Amount"] = "3000000" }))); - var ex = await Assert.ThrowsExactlyAsync(() => Validation.ValidateBatch(batch)); + var ex = Assert.ThrowsExactly(() => Validation.ValidateBatch(batch)); StringAssert.Contains(ex.Message, "spfSponsorFee"); } [TestMethod] - public async Task TestUValidateBatch_MarkerNotAnObject_Throws() + public void TestUValidateBatch_MarkerNotAnObject_Throws() { // a scalar marker can never serialize as an STObject — reject it // client-side instead of failing deep inside the binary codec @@ -190,12 +189,12 @@ public async Task TestUValidateBatch_MarkerNotAnObject_Throws() }), InnerPayment(Root.ClassicAddress, new JsonObject { ["Amount"] = "3000000" }))); - var ex = await Assert.ThrowsExactlyAsync(() => Validation.ValidateBatch(batch)); + var ex = Assert.ThrowsExactly(() => Validation.ValidateBatch(batch)); StringAssert.Contains(ex.Message, "must be an object"); } [TestMethod] - public async Task TestUValidateBatch_LoanOrVaultInner_Throws() + public void TestUValidateBatch_LoanOrVaultInner_Throws() { // rippled Batch::preflight kDisabledTxTypes: every Loan/Vault tx // type is rejected as an inner (temINVALID_INNER_BATCH), so @@ -210,12 +209,12 @@ public async Task TestUValidateBatch_LoanOrVaultInner_Throws() loanInner, InnerPayment(Other.ClassicAddress))); - var ex = await Assert.ThrowsExactlyAsync(() => Validation.ValidateBatch(batch)); + var ex = Assert.ThrowsExactly(() => Validation.ValidateBatch(batch)); StringAssert.Contains(ex.Message, "LoanSet"); } [TestMethod] - public async Task TestUValidateBatch_MarkerWithSignatureMaterial_Throws() + public void TestUValidateBatch_MarkerWithSignatureMaterial_Throws() { Dictionary batch = ToDict(OuterBatch( InnerPayment(Other.ClassicAddress, new JsonObject @@ -230,7 +229,7 @@ public async Task TestUValidateBatch_MarkerWithSignatureMaterial_Throws() }), InnerPayment(Root.ClassicAddress, new JsonObject { ["Amount"] = "3000000" }))); - var ex = await Assert.ThrowsExactlyAsync(() => Validation.ValidateBatch(batch)); + var ex = Assert.ThrowsExactly(() => Validation.ValidateBatch(batch)); StringAssert.Contains(ex.Message, "SponsorSignature"); } } diff --git a/Xrpl/Models/Transactions/AMMBid.cs b/Xrpl/Models/Transactions/AMMBid.cs index a5a652d1..7b1bc90b 100644 --- a/Xrpl/Models/Transactions/AMMBid.cs +++ b/Xrpl/Models/Transactions/AMMBid.cs @@ -1,6 +1,5 @@ #nullable enable using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -107,11 +106,10 @@ public partial class Validation /// Verify the form and type of an AMMBid at runtime. /// /// An AMMBid Transaction. - /// /// When the AMMBid is Malformed. - public static async Task ValidateAMMBid(Dictionary tx) + public static void ValidateAMMBid(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Asset", out var Asset1) || Asset1 is null) { diff --git a/Xrpl/Models/Transactions/AMMClawBack.cs b/Xrpl/Models/Transactions/AMMClawBack.cs index 4ede9b98..b06bd75f 100644 --- a/Xrpl/Models/Transactions/AMMClawBack.cs +++ b/Xrpl/Models/Transactions/AMMClawBack.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -104,9 +103,9 @@ public partial class Validation /// /// An AMMClawBack Transaction. /// When the AMMClawBack is malformed. - public static async Task ValidateAMMClawBack(Dictionary tx) + public static void ValidateAMMClawBack(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Holder", out var Holder) || Holder is null) { diff --git a/Xrpl/Models/Transactions/AMMCreate.cs b/Xrpl/Models/Transactions/AMMCreate.cs index f33f3667..de11e396 100644 --- a/Xrpl/Models/Transactions/AMMCreate.cs +++ b/Xrpl/Models/Transactions/AMMCreate.cs @@ -1,6 +1,5 @@ #nullable enable using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -81,11 +80,10 @@ public partial class Validation /// Verify the form and type of an AMMCreate at runtime. /// /// An AMMCreate Transaction. - /// /// When the AMMCreate is Malformed. - public static async Task ValidateAMMCreate(Dictionary tx) + public static void ValidateAMMCreate(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Amount", out var Amount1) || Amount1 is null) { diff --git a/Xrpl/Models/Transactions/AMMDelete.cs b/Xrpl/Models/Transactions/AMMDelete.cs index fc61792a..be7b5519 100644 --- a/Xrpl/Models/Transactions/AMMDelete.cs +++ b/Xrpl/Models/Transactions/AMMDelete.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -76,11 +75,10 @@ public partial class Validation /// Verify the form and type of an AMMDelete at runtime. /// /// An AMMDelete Transaction. - /// /// When the AMMDelete is Malformed. - public static async Task ValidateAMMDelete(Dictionary tx) + public static void ValidateAMMDelete(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Asset", out var Asset) || Asset is null) { diff --git a/Xrpl/Models/Transactions/AMMDeposit.cs b/Xrpl/Models/Transactions/AMMDeposit.cs index 4a9d7c45..428fd313 100644 --- a/Xrpl/Models/Transactions/AMMDeposit.cs +++ b/Xrpl/Models/Transactions/AMMDeposit.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using static Xrpl.Models.Common.Common; using Xrpl.Client.Exceptions; using Currency = Xrpl.Models.Common.Currency; @@ -195,11 +194,10 @@ public partial class Validation /// Verify the form and type of an AMMDeposit at runtime. /// /// An AMMDeposit Transaction. - /// /// When the AMMDeposit is Malformed. - public static async Task ValidateAMMDeposit(Dictionary tx) + public static void ValidateAMMDeposit(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Asset", out var Asset1) || Asset1 is null) { diff --git a/Xrpl/Models/Transactions/AMMVote.cs b/Xrpl/Models/Transactions/AMMVote.cs index 652bb06c..d2c1cc6d 100644 --- a/Xrpl/Models/Transactions/AMMVote.cs +++ b/Xrpl/Models/Transactions/AMMVote.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -67,11 +66,10 @@ public partial class Validation /// Verify the form and type of an AMMVote at runtime. /// /// An AMMVote Transaction. - /// /// When the AMMVote is Malformed. - public static async Task ValidateAMMVote(Dictionary tx) + public static void ValidateAMMVote(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); tx.TryGetValue("Asset", out var Asset); tx.TryGetValue("Asset2", out var Asset2); tx.TryGetValue("TradingFee", out var TradingFee); diff --git a/Xrpl/Models/Transactions/AMMWithdraw.cs b/Xrpl/Models/Transactions/AMMWithdraw.cs index 91151e7e..60acadaa 100644 --- a/Xrpl/Models/Transactions/AMMWithdraw.cs +++ b/Xrpl/Models/Transactions/AMMWithdraw.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -189,9 +188,9 @@ public partial class Validation /// /// An AMMWithdraw Transaction. /// When the AMMWithdraw is Malformed. - public static async Task ValidateAMMWithdraw(Dictionary tx) + public static void ValidateAMMWithdraw(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); tx.TryGetValue("Asset", out var Asset); tx.TryGetValue("Asset2", out var Asset2); diff --git a/Xrpl/Models/Transactions/AccountDelete.cs b/Xrpl/Models/Transactions/AccountDelete.cs index 9280e561..1932cd53 100644 --- a/Xrpl/Models/Transactions/AccountDelete.cs +++ b/Xrpl/Models/Transactions/AccountDelete.cs @@ -1,7 +1,6 @@ // https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/accountDelete.ts using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -79,9 +78,9 @@ public partial class Validation /// /// A AccountDelete Transaction. /// When the AccountDelete is malformed. - public static async Task ValidateAccountDelete(Dictionary tx) + public static void ValidateAccountDelete(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Destination", out var Destination) || Destination is null) throw new ValidationException("AccountDelete: missing field Destination"); if (Destination is not string { }) diff --git a/Xrpl/Models/Transactions/AccountSet.cs b/Xrpl/Models/Transactions/AccountSet.cs index 5c33795c..a3ba8e7f 100644 --- a/Xrpl/Models/Transactions/AccountSet.cs +++ b/Xrpl/Models/Transactions/AccountSet.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Enums; @@ -262,9 +261,9 @@ private static void ValidateAsfFlagField(Dictionary tx, string f /// /// A AccountSet Transaction. /// When the AccountSet is malformed. - public static async Task ValidateAccountSet(Dictionary tx) + public static void ValidateAccountSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); ValidateAsfFlagField(tx, "ClearFlag"); if (tx.TryGetValue("Domain", out var Domain) && Domain is not string { }) throw new ValidationException("AccountSet: invalid Domain"); diff --git a/Xrpl/Models/Transactions/Batch.cs b/Xrpl/Models/Transactions/Batch.cs index 5f3eeb45..53e3e0a0 100644 --- a/Xrpl/Models/Transactions/Batch.cs +++ b/Xrpl/Models/Transactions/Batch.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Xrpl.Client.Json.Converters; using Xrpl.Models.Enums; @@ -134,11 +133,18 @@ public partial class Validation "LoanSet", "LoanDelete", "LoanManage", "LoanPay", }; - public static async Task ValidateBatch(Dictionary tx) + /// + /// Verify the form and type of a Batch at runtime, following rippled's Batch::preflight: + /// between 2 and 8 inner transactions, no nested Batch, no type from kDisabledTxTypes, + /// and every inner carrying tfInnerBatchTxn with Fee "0" and an empty SigningPubKey. + /// + /// A Batch Transaction. + /// When the Batch is malformed. + public static void ValidateBatch(Dictionary tx) { if (tx == null) throw new ArgumentException("Batch: tx is null."); - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("TransactionType", out var transactionTypeObj) || transactionTypeObj is not string transactionType || diff --git a/Xrpl/Models/Transactions/CheckCancel.cs b/Xrpl/Models/Transactions/CheckCancel.cs index 48a5929f..a850fdc3 100644 --- a/Xrpl/Models/Transactions/CheckCancel.cs +++ b/Xrpl/Models/Transactions/CheckCancel.cs @@ -3,7 +3,6 @@ // https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/checkCancel.ts using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -48,9 +47,9 @@ public partial class Validation /// /// A CheckCancel Transaction. /// When the CheckCancel is malformed. - public static async Task ValidateCheckCancel(Dictionary tx) + public static void ValidateCheckCancel(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (tx.TryGetValue("CheckID", out var CheckID) && CheckID is not string {}) throw new ValidationException("CheckCancel: invalid CheckID"); } diff --git a/Xrpl/Models/Transactions/CheckCash.cs b/Xrpl/Models/Transactions/CheckCash.cs index 31110d11..05b29737 100644 --- a/Xrpl/Models/Transactions/CheckCash.cs +++ b/Xrpl/Models/Transactions/CheckCash.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -79,9 +78,9 @@ public partial class Validation /// /// A CheckCash Transaction. /// When the CheckCash is malformed. - public static async Task ValidateCheckCash(Dictionary tx) + public static void ValidateCheckCash(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); tx.TryGetValue("Amount", out var Amount); tx.TryGetValue("DeliverMin", out var DeliverMin); diff --git a/Xrpl/Models/Transactions/CheckCreate.cs b/Xrpl/Models/Transactions/CheckCreate.cs index 5ac6064a..86447ddb 100644 --- a/Xrpl/Models/Transactions/CheckCreate.cs +++ b/Xrpl/Models/Transactions/CheckCreate.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -90,9 +89,9 @@ public partial class Validation /// /// A CheckCreate Transaction. /// When the CheckCreate is malformed. - public static async Task ValidateCheckCreate(Dictionary tx) + public static void ValidateCheckCreate(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("SendMax", out var SendMax) || SendMax is null) throw new ValidationException("CheckCreate: missing field SendMax"); diff --git a/Xrpl/Models/Transactions/ClawBack.cs b/Xrpl/Models/Transactions/ClawBack.cs index e22843bf..79453e05 100644 --- a/Xrpl/Models/Transactions/ClawBack.cs +++ b/Xrpl/Models/Transactions/ClawBack.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json; @@ -78,11 +77,10 @@ public partial class Validation /// Verify the form and type of an ClawBack at runtime. /// /// An ClawBack Transaction. - /// /// When the ClawBack is Malformed. - public static async Task ValidateClawBack(Dictionary tx) + public static void ValidateClawBack(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Amount", out var Amount) || Amount is null) { diff --git a/Xrpl/Models/Transactions/Common.cs b/Xrpl/Models/Transactions/Common.cs index db2c657a..a128b814 100644 --- a/Xrpl/Models/Transactions/Common.cs +++ b/Xrpl/Models/Transactions/Common.cs @@ -5,7 +5,6 @@ using System.Security.Cryptography; using System.Text.Json; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Extensions; @@ -227,9 +226,8 @@ public static void ValidateDomainId(string value, string txLabel, bool allowZero /// This should be called any time a transaction will be verified. /// /// An interface w/ common transaction fields. - /// /// When the common param is malformed. - public static Task ValidateBaseTransaction(Dictionary tx) + public static void ValidateBaseTransaction(Dictionary tx) { if (!tx.TryGetValue("Account", out var Account) || Account is null) { @@ -338,7 +336,7 @@ public static Task ValidateBaseTransaction(Dictionary tx) { throw new ValidationException("BaseTransaction: invalid OperationLimit"); } - return Task.CompletedTask; + return; } } diff --git a/Xrpl/Models/Transactions/ConfidentialMPT.cs b/Xrpl/Models/Transactions/ConfidentialMPT.cs index 161f06fa..8b84965c 100644 --- a/Xrpl/Models/Transactions/ConfidentialMPT.cs +++ b/Xrpl/Models/Transactions/ConfidentialMPT.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -285,43 +284,43 @@ public class ConfidentialMPTClawbackResponse : TransactionResponse public partial class Validation { - private static Task ValidateConfidentialCommon(Dictionary tx, string txName) + private static void ValidateConfidentialCommon(Dictionary tx, string txName) { if (!tx.TryGetValue("MPTokenIssuanceID", out var issuance) || issuance is not string) throw new ValidationException($"{txName}: missing field MPTokenIssuanceID"); - return Task.CompletedTask; + return; } - public static async Task ValidateConfidentialMPTConvert(Dictionary tx) + public static void ValidateConfidentialMPTConvert(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); - await ValidateConfidentialCommon(tx, "ConfidentialMPTConvert"); + Common.ValidateBaseTransaction(tx); + ValidateConfidentialCommon(tx, "ConfidentialMPTConvert"); } - public static async Task ValidateConfidentialMPTMergeInbox(Dictionary tx) + public static void ValidateConfidentialMPTMergeInbox(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); - await ValidateConfidentialCommon(tx, "ConfidentialMPTMergeInbox"); + Common.ValidateBaseTransaction(tx); + ValidateConfidentialCommon(tx, "ConfidentialMPTMergeInbox"); } - public static async Task ValidateConfidentialMPTConvertBack(Dictionary tx) + public static void ValidateConfidentialMPTConvertBack(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); - await ValidateConfidentialCommon(tx, "ConfidentialMPTConvertBack"); + Common.ValidateBaseTransaction(tx); + ValidateConfidentialCommon(tx, "ConfidentialMPTConvertBack"); } - public static async Task ValidateConfidentialMPTSend(Dictionary tx) + public static void ValidateConfidentialMPTSend(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); - await ValidateConfidentialCommon(tx, "ConfidentialMPTSend"); + Common.ValidateBaseTransaction(tx); + ValidateConfidentialCommon(tx, "ConfidentialMPTSend"); if (!tx.TryGetValue("Destination", out var dest) || dest is not string) throw new ValidationException("ConfidentialMPTSend: missing field Destination"); } - public static async Task ValidateConfidentialMPTClawback(Dictionary tx) + public static void ValidateConfidentialMPTClawback(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); - await ValidateConfidentialCommon(tx, "ConfidentialMPTClawback"); + Common.ValidateBaseTransaction(tx); + ValidateConfidentialCommon(tx, "ConfidentialMPTClawback"); if (!tx.TryGetValue("Holder", out var holder) || holder is not string) throw new ValidationException("ConfidentialMPTClawback: missing field Holder"); } diff --git a/Xrpl/Models/Transactions/CredentialAccept.cs b/Xrpl/Models/Transactions/CredentialAccept.cs index 3bc842dd..d4806cf7 100644 --- a/Xrpl/Models/Transactions/CredentialAccept.cs +++ b/Xrpl/Models/Transactions/CredentialAccept.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -96,9 +95,9 @@ public partial class Validation /// /// A CredentialAccept transaction. /// When the CredentialAccept is malformed. - public static async Task ValidateCredentialAccept(Dictionary tx) + public static void ValidateCredentialAccept(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); tx.TryGetValue("Issuer", out var issuer); if (issuer is not string issuerStr || string.IsNullOrEmpty(issuerStr)) diff --git a/Xrpl/Models/Transactions/CredentialCreate.cs b/Xrpl/Models/Transactions/CredentialCreate.cs index 8c4afe9f..0833d496 100644 --- a/Xrpl/Models/Transactions/CredentialCreate.cs +++ b/Xrpl/Models/Transactions/CredentialCreate.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -157,9 +156,9 @@ public partial class Validation /// /// A CredentialCreate transaction. /// When the CredentialCreate is malformed. - public static async Task ValidateCredentialCreate(Dictionary tx) + public static void ValidateCredentialCreate(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); tx.TryGetValue("Subject", out var subject); if (subject is not string subjectStr || string.IsNullOrEmpty(subjectStr)) diff --git a/Xrpl/Models/Transactions/CredentialDelete.cs b/Xrpl/Models/Transactions/CredentialDelete.cs index fafec510..8cc94b13 100644 --- a/Xrpl/Models/Transactions/CredentialDelete.cs +++ b/Xrpl/Models/Transactions/CredentialDelete.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Utils; @@ -111,9 +110,9 @@ public partial class Validation /// /// A CredentialDelete transaction. /// When the CredentialDelete is malformed. - public static async Task ValidateCredentialDelete(Dictionary tx) + public static void ValidateCredentialDelete(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); tx.TryGetValue("Subject", out var subject); tx.TryGetValue("Issuer", out var issuer); diff --git a/Xrpl/Models/Transactions/DIDDelete.cs b/Xrpl/Models/Transactions/DIDDelete.cs index 96673839..de1d26f1 100644 --- a/Xrpl/Models/Transactions/DIDDelete.cs +++ b/Xrpl/Models/Transactions/DIDDelete.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -38,9 +37,9 @@ public partial class Validation /// /// A DIDDelete Transaction. /// When the DIDDelete is malformed. - public static async Task ValidateDIDDelete(Dictionary tx) + public static void ValidateDIDDelete(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); } } } diff --git a/Xrpl/Models/Transactions/DIDSet.cs b/Xrpl/Models/Transactions/DIDSet.cs index e768485d..1cfc0255 100644 --- a/Xrpl/Models/Transactions/DIDSet.cs +++ b/Xrpl/Models/Transactions/DIDSet.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -82,9 +81,9 @@ public partial class Validation /// /// A DIDSet Transaction. /// When the DIDSet is malformed. - public static async Task ValidateDIDSet(Dictionary tx) + public static void ValidateDIDSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); tx.TryGetValue("Data", out var data); tx.TryGetValue("DIDDocument", out var didDocument); diff --git a/Xrpl/Models/Transactions/DelegateSet.cs b/Xrpl/Models/Transactions/DelegateSet.cs index 0ab2aaea..cecd9c1d 100644 --- a/Xrpl/Models/Transactions/DelegateSet.cs +++ b/Xrpl/Models/Transactions/DelegateSet.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Text.Json; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Common; @@ -68,9 +67,9 @@ public partial class Validation private const int MaxPermissions = 10; - public static async Task ValidateDelegateSet(Dictionary tx) + public static void ValidateDelegateSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Authorize", out var auth) || auth is not string) throw new ValidationException("DelegateSet: missing field Authorize"); diff --git a/Xrpl/Models/Transactions/DepositPreauth.cs b/Xrpl/Models/Transactions/DepositPreauth.cs index cb911279..b615204c 100644 --- a/Xrpl/Models/Transactions/DepositPreauth.cs +++ b/Xrpl/Models/Transactions/DepositPreauth.cs @@ -3,7 +3,6 @@ // https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/depositPreauth.ts using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -98,9 +97,9 @@ public partial class Validation /// /// A DepositPreauth Transaction. /// When the DepositPreauth is malformed. - public static async Task ValidateDepositPreauth(Dictionary tx) + public static void ValidateDepositPreauth(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); tx.TryGetValue("Authorize", out var Authorize); tx.TryGetValue("Unauthorize", out var Unauthorize); diff --git a/Xrpl/Models/Transactions/EscrowCancel.cs b/Xrpl/Models/Transactions/EscrowCancel.cs index 58676fc1..8011f90f 100644 --- a/Xrpl/Models/Transactions/EscrowCancel.cs +++ b/Xrpl/Models/Transactions/EscrowCancel.cs @@ -2,7 +2,6 @@ // https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/escrowCancel.ts using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -55,9 +54,9 @@ public partial class Validation /// /// A EscrowCancel Transaction. /// When the EscrowCancel is malformed. - public static async Task ValidateEscrowCancel(Dictionary tx) + public static void ValidateEscrowCancel(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Owner", out var Owner) || Owner is null) throw new ValidationException("EscrowCancel: missing Owner"); if(Owner is not string {}) diff --git a/Xrpl/Models/Transactions/EscrowCreate.cs b/Xrpl/Models/Transactions/EscrowCreate.cs index ad10a3ba..94a426dc 100644 --- a/Xrpl/Models/Transactions/EscrowCreate.cs +++ b/Xrpl/Models/Transactions/EscrowCreate.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -112,9 +111,9 @@ public partial class Validation /// /// A EscrowCreate Transaction. /// When the EscrowCreate is malformed. - public static async Task ValidateEscrowCreate(Dictionary tx) + public static void ValidateEscrowCreate(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); tx.TryGetValue("Amount", out var Amount); if (Amount is null) diff --git a/Xrpl/Models/Transactions/EscrowFinish.cs b/Xrpl/Models/Transactions/EscrowFinish.cs index b306d54f..15b67a42 100644 --- a/Xrpl/Models/Transactions/EscrowFinish.cs +++ b/Xrpl/Models/Transactions/EscrowFinish.cs @@ -3,7 +3,6 @@ //https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/escrowFinish.ts using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -103,9 +102,9 @@ public partial class Validation /// /// A EscrowFinish Transaction. /// When the EscrowFinish is malformed. - public static async Task ValidateEscrowFinish(Dictionary tx) + public static void ValidateEscrowFinish(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Owner", out var Owner) || Owner is null) throw new ValidationException("EscrowFinish: missing field Owner"); diff --git a/Xrpl/Models/Transactions/LedgerStateFix.cs b/Xrpl/Models/Transactions/LedgerStateFix.cs index 26a6a8c5..a5f00fa9 100644 --- a/Xrpl/Models/Transactions/LedgerStateFix.cs +++ b/Xrpl/Models/Transactions/LedgerStateFix.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -62,9 +61,9 @@ public class LedgerStateFixResponse : TransactionResponse, ILedgerStateFix public partial class Validation { - public static async Task ValidateLedgerStateFix(Dictionary tx) + public static void ValidateLedgerStateFix(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("LedgerFixType", out var fixType) || fixType is null) throw new ValidationException("LedgerStateFix: missing field LedgerFixType"); diff --git a/Xrpl/Models/Transactions/LoanBrokerCoverClawback.cs b/Xrpl/Models/Transactions/LoanBrokerCoverClawback.cs index df5a7de0..dc8962a4 100644 --- a/Xrpl/Models/Transactions/LoanBrokerCoverClawback.cs +++ b/Xrpl/Models/Transactions/LoanBrokerCoverClawback.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -59,9 +58,9 @@ public class LoanBrokerCoverClawbackResponse : TransactionResponse, ILoanBrokerC public partial class Validation { - public static async Task ValidateLoanBrokerCoverClawback(Dictionary tx) + public static void ValidateLoanBrokerCoverClawback(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); bool hasLoanBrokerId = tx.TryGetValue("LoanBrokerID", out var loanBrokerId) && loanBrokerId is string; bool hasAmount = tx.TryGetValue("Amount", out var amount) && amount is not null; diff --git a/Xrpl/Models/Transactions/LoanBrokerCoverDeposit.cs b/Xrpl/Models/Transactions/LoanBrokerCoverDeposit.cs index e799fa79..c9efae0d 100644 --- a/Xrpl/Models/Transactions/LoanBrokerCoverDeposit.cs +++ b/Xrpl/Models/Transactions/LoanBrokerCoverDeposit.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -58,9 +57,9 @@ public class LoanBrokerCoverDepositResponse : TransactionResponse, ILoanBrokerCo public partial class Validation { - public static async Task ValidateLoanBrokerCoverDeposit(Dictionary tx) + public static void ValidateLoanBrokerCoverDeposit(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("LoanBrokerID", out var id) || id is not string) throw new ValidationException("LoanBrokerCoverDeposit: missing field LoanBrokerID"); diff --git a/Xrpl/Models/Transactions/LoanBrokerCoverWithdraw.cs b/Xrpl/Models/Transactions/LoanBrokerCoverWithdraw.cs index 100793e5..29995ac2 100644 --- a/Xrpl/Models/Transactions/LoanBrokerCoverWithdraw.cs +++ b/Xrpl/Models/Transactions/LoanBrokerCoverWithdraw.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -84,9 +83,9 @@ public class LoanBrokerCoverWithdrawResponse : TransactionResponse, ILoanBrokerC public partial class Validation { - public static async Task ValidateLoanBrokerCoverWithdraw(Dictionary tx) + public static void ValidateLoanBrokerCoverWithdraw(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("LoanBrokerID", out var id) || id is not string) throw new ValidationException("LoanBrokerCoverWithdraw: missing field LoanBrokerID"); diff --git a/Xrpl/Models/Transactions/LoanBrokerDelete.cs b/Xrpl/Models/Transactions/LoanBrokerDelete.cs index 3473e318..f8f65662 100644 --- a/Xrpl/Models/Transactions/LoanBrokerDelete.cs +++ b/Xrpl/Models/Transactions/LoanBrokerDelete.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -41,9 +40,9 @@ public class LoanBrokerDeleteResponse : TransactionResponse, ILoanBrokerDelete public partial class Validation { - public static async Task ValidateLoanBrokerDelete(Dictionary tx) + public static void ValidateLoanBrokerDelete(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("LoanBrokerID", out var id) || id is not string) throw new ValidationException("LoanBrokerDelete: missing field LoanBrokerID"); diff --git a/Xrpl/Models/Transactions/LoanBrokerSet.cs b/Xrpl/Models/Transactions/LoanBrokerSet.cs index 9c44961a..9a5236bd 100644 --- a/Xrpl/Models/Transactions/LoanBrokerSet.cs +++ b/Xrpl/Models/Transactions/LoanBrokerSet.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -130,9 +129,9 @@ public class LoanBrokerSetResponse : TransactionResponse, ILoanBrokerSet public partial class Validation { - public static async Task ValidateLoanBrokerSet(Dictionary tx) + public static void ValidateLoanBrokerSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("VaultID", out var vaultId) || vaultId is not string) throw new ValidationException("LoanBrokerSet: missing field VaultID"); diff --git a/Xrpl/Models/Transactions/LoanDelete.cs b/Xrpl/Models/Transactions/LoanDelete.cs index 6a784ff1..7a9c3126 100644 --- a/Xrpl/Models/Transactions/LoanDelete.cs +++ b/Xrpl/Models/Transactions/LoanDelete.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -41,9 +40,9 @@ public class LoanDeleteResponse : TransactionResponse, ILoanDelete public partial class Validation { - public static async Task ValidateLoanDelete(Dictionary tx) + public static void ValidateLoanDelete(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("LoanID", out var id) || id is not string) throw new ValidationException("LoanDelete: missing field LoanID"); diff --git a/Xrpl/Models/Transactions/LoanManage.cs b/Xrpl/Models/Transactions/LoanManage.cs index b80864fd..0aef31a1 100644 --- a/Xrpl/Models/Transactions/LoanManage.cs +++ b/Xrpl/Models/Transactions/LoanManage.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Enums; @@ -99,9 +98,9 @@ public partial class Validation (uint)LoanManageFlags.tfLoanImpair | (uint)LoanManageFlags.tfLoanUnimpair; - public static async Task ValidateLoanManage(Dictionary tx) + public static void ValidateLoanManage(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("LoanID", out var id) || id is not string loanId || string.IsNullOrWhiteSpace(loanId)) throw new ValidationException("LoanManage: missing field LoanID"); diff --git a/Xrpl/Models/Transactions/LoanPay.cs b/Xrpl/Models/Transactions/LoanPay.cs index de4f812c..e4fed288 100644 --- a/Xrpl/Models/Transactions/LoanPay.cs +++ b/Xrpl/Models/Transactions/LoanPay.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -108,9 +107,9 @@ public class LoanPayResponse : TransactionResponse, ILoanPay public partial class Validation { - public static async Task ValidateLoanPay(Dictionary tx) + public static void ValidateLoanPay(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("LoanID", out var id) || id is not string) throw new ValidationException("LoanPay: missing field LoanID"); diff --git a/Xrpl/Models/Transactions/LoanSet.cs b/Xrpl/Models/Transactions/LoanSet.cs index 45ce4f8e..d0b06356 100644 --- a/Xrpl/Models/Transactions/LoanSet.cs +++ b/Xrpl/Models/Transactions/LoanSet.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Enums; @@ -285,9 +284,9 @@ public class LoanSetResponse : TransactionResponse, ILoanSet public partial class Validation { - public static async Task ValidateLoanSet(Dictionary tx) + public static void ValidateLoanSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("LoanBrokerID", out var brokerId) || brokerId is not string) throw new ValidationException("LoanSet: missing field LoanBrokerID"); diff --git a/Xrpl/Models/Transactions/MPTokenAuthorize.cs b/Xrpl/Models/Transactions/MPTokenAuthorize.cs index 9aca7267..0fb44cda 100644 --- a/Xrpl/Models/Transactions/MPTokenAuthorize.cs +++ b/Xrpl/Models/Transactions/MPTokenAuthorize.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -100,9 +99,9 @@ public partial class Validation /// /// An MPTokenAuthorize Transaction. /// When the MPTokenAuthorize is Malformed. - public static async Task ValidateMPTokenAuthorize(Dictionary tx) + public static void ValidateMPTokenAuthorize(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("MPTokenIssuanceID", out var issuanceId) || issuanceId is null) { diff --git a/Xrpl/Models/Transactions/MPTokenIssuanceCreate.cs b/Xrpl/Models/Transactions/MPTokenIssuanceCreate.cs index 702acfe0..f860c0f3 100644 --- a/Xrpl/Models/Transactions/MPTokenIssuanceCreate.cs +++ b/Xrpl/Models/Transactions/MPTokenIssuanceCreate.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Xrpl.BinaryCodec.Types; using Xrpl.Client.Exceptions; @@ -257,9 +256,9 @@ public partial class Validation /// /// An MPTokenIssuanceCreate Transaction. /// When the MPTokenIssuanceCreate is Malformed. - public static async Task ValidateMPTokenIssuanceCreate(Dictionary tx) + public static void ValidateMPTokenIssuanceCreate(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (tx.TryGetValue("AssetScale", out var assetScale) && assetScale is not null) { diff --git a/Xrpl/Models/Transactions/MPTokenIssuanceDestroy.cs b/Xrpl/Models/Transactions/MPTokenIssuanceDestroy.cs index 51da785f..5d6c2e32 100644 --- a/Xrpl/Models/Transactions/MPTokenIssuanceDestroy.cs +++ b/Xrpl/Models/Transactions/MPTokenIssuanceDestroy.cs @@ -1,6 +1,5 @@ #nullable enable using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -57,9 +56,9 @@ public partial class Validation /// /// An MPTokenIssuanceDestroy Transaction. /// When the MPTokenIssuanceDestroy is Malformed. - public static async Task ValidateMPTokenIssuanceDestroy(Dictionary tx) + public static void ValidateMPTokenIssuanceDestroy(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("MPTokenIssuanceID", out var issuanceId) || issuanceId is null) { diff --git a/Xrpl/Models/Transactions/MPTokenIssuanceSet.cs b/Xrpl/Models/Transactions/MPTokenIssuanceSet.cs index b1c75a50..ea6dd7cc 100644 --- a/Xrpl/Models/Transactions/MPTokenIssuanceSet.cs +++ b/Xrpl/Models/Transactions/MPTokenIssuanceSet.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Utils; @@ -219,9 +218,9 @@ public partial class Validation /// /// An MPTokenIssuanceSet Transaction. /// When the MPTokenIssuanceSet is Malformed. - public static async Task ValidateMPTokenIssuanceSet(Dictionary tx) + public static void ValidateMPTokenIssuanceSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("MPTokenIssuanceID", out var issuanceId) || issuanceId is null) { diff --git a/Xrpl/Models/Transactions/NFTokenAcceptOffer.cs b/Xrpl/Models/Transactions/NFTokenAcceptOffer.cs index 85fedb69..6c59da37 100644 --- a/Xrpl/Models/Transactions/NFTokenAcceptOffer.cs +++ b/Xrpl/Models/Transactions/NFTokenAcceptOffer.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -94,7 +93,7 @@ public class NFTokenAcceptOfferResponse : TransactionResponse, INFTokenAcceptOff public partial class Validation { - public static Task ValidateNFTokenBrokerFee(Dictionary tx) + public static void ValidateNFTokenBrokerFee(Dictionary tx) { if (!tx.TryGetValue("NFTokenBrokerFee", out var NFTokenBrokerFee) || NFTokenBrokerFee is null) throw new ValidationException("NFTokenAcceptOffer: invalid NFTokenBrokerFee"); @@ -110,22 +109,22 @@ public static Task ValidateNFTokenBrokerFee(Dictionary tx) NFTokenSellOffer is null || NFTokenBuyOffer is null) throw new ValidationException("NFTokenAcceptOffer: both NFTokenSellOffer and NFTokenBuyOffer must be set if using brokered mode"); - return Task.CompletedTask; + return; } /// /// Verify the form and type of an NFTokenAcceptOffer at runtime. /// /// An NFTokenAcceptOffer Transaction. /// When the NFTokenAcceptOffer is Malformed. - public static async Task ValidateNFTokenAcceptOffer(Dictionary tx) + public static void ValidateNFTokenAcceptOffer(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); var can_get_value_NFTokenSellOffer = tx.TryGetValue("NFTokenSellOffer", out var NFTokenSellOffer); var can_get_value_NFTokenBuyOffer = tx.TryGetValue("NFTokenBuyOffer", out var NFTokenBuyOffer); if (tx.TryGetValue("NFTokenBrokerFee", out var NFTokenBrokerFee) && NFTokenBrokerFee is not null) - await ValidateNFTokenBrokerFee(tx); + ValidateNFTokenBrokerFee(tx); if ((!can_get_value_NFTokenSellOffer && !can_get_value_NFTokenBuyOffer) || (NFTokenSellOffer is null && NFTokenBuyOffer is null)) throw new ValidationException("NFTokenAcceptOffer: must set either NFTokenSellOffer or NFTokenBuyOffer"); diff --git a/Xrpl/Models/Transactions/NFTokenBurn.cs b/Xrpl/Models/Transactions/NFTokenBurn.cs index 02928291..9db260c9 100644 --- a/Xrpl/Models/Transactions/NFTokenBurn.cs +++ b/Xrpl/Models/Transactions/NFTokenBurn.cs @@ -3,7 +3,6 @@ // https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/NFTokenBurn.ts using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -61,11 +60,10 @@ public partial class Validation /// Verify the form and type of an NFTokenBurn at runtime. /// /// An NFTokenBurn Transaction. - /// /// When the NFTokenBurn is Malformed. - public static async Task ValidateNFTokenBurn(Dictionary tx) + public static void ValidateNFTokenBurn(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("NFTokenID", out var NFTokenID) || NFTokenID is null) throw new ValidationException("NFTokenBurn: missing field NFTokenID"); } diff --git a/Xrpl/Models/Transactions/NFTokenCancelOffer.cs b/Xrpl/Models/Transactions/NFTokenCancelOffer.cs index 1191bdbf..54ab0141 100644 --- a/Xrpl/Models/Transactions/NFTokenCancelOffer.cs +++ b/Xrpl/Models/Transactions/NFTokenCancelOffer.cs @@ -3,7 +3,6 @@ // https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/NFTokenCancelOffer.ts using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -49,11 +48,10 @@ public partial class Validation /// Verify the form and type of an NFTokenCancelOffer at runtime. /// /// An NFTokenCancelOffer Transaction. - /// /// When the NFTokenCancelOffer is Malformed. - public static async Task ValidateNFTokenCancelOffer(Dictionary tx) + public static void ValidateNFTokenCancelOffer(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("NFTokenOffers", out var NFTokenOffers) || NFTokenOffers is not List { } offers) throw new ValidationException("NFTokenCancelOffer: missing field NFTokenOffers"); diff --git a/Xrpl/Models/Transactions/NFTokenCreateOffer.cs b/Xrpl/Models/Transactions/NFTokenCreateOffer.cs index e80d744b..7cefb4b3 100644 --- a/Xrpl/Models/Transactions/NFTokenCreateOffer.cs +++ b/Xrpl/Models/Transactions/NFTokenCreateOffer.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -133,13 +132,13 @@ public class NFTokenCreateOfferResponse : TransactionResponse, INFTokenCreateOff public partial class Validation { //https://github.com/XRPLF/xrpl.js/blob/b40a519a0d949679a85bf442be29026b76c63a22/packages/xrpl/src/models/transactions/NFTokenCreateOffer.ts#L86 - public static Task ValidateNFTokenSellOfferCases(Dictionary tx) + public static void ValidateNFTokenSellOfferCases(Dictionary tx) { if (tx.TryGetValue("Owner", out var Owner) && Owner is not null) throw new ValidationException("NFTokenCreateOffer: Owner must not be present for sell offers"); - return Task.CompletedTask; + return; } - public static Task ValidateNFTokenBuyOfferCases(Dictionary tx) + public static void ValidateNFTokenBuyOfferCases(Dictionary tx) { if (!tx.TryGetValue("Owner", out var Owner) || Owner is null) throw new ValidationException("NFTokenCreateOffer: Owner must be present for buy offers"); @@ -147,7 +146,7 @@ public static Task ValidateNFTokenBuyOfferCases(Dictionary tx) if (!tx.TryGetValue("Amount", out var Amount) || Common.ParseAmountValue(Amount) <= 0) throw new ValidationException("NFTokenCreateOffer: Amount must be greater than 0 for buy offers"); - return Task.CompletedTask; + return; } /// /// Verify the form and type of an NFTokenCreateOffer at runtime. @@ -155,7 +154,7 @@ public static Task ValidateNFTokenBuyOfferCases(Dictionary tx) /// An NFTokenCreateOffer Transaction. /// When the NFTokenCreateOffer is Malformed. /// - public static Task ValidateNFTokenCreateOffer(Dictionary tx) + public static void ValidateNFTokenCreateOffer(Dictionary tx) { Common.ValidateBaseTransaction(tx); @@ -179,7 +178,7 @@ Flags is uint {} flags { ValidateNFTokenBuyOfferCases(tx); } - return Task.CompletedTask; + return; } } diff --git a/Xrpl/Models/Transactions/NFTokenMint.cs b/Xrpl/Models/Transactions/NFTokenMint.cs index 8c3fdde8..bb0269fb 100644 --- a/Xrpl/Models/Transactions/NFTokenMint.cs +++ b/Xrpl/Models/Transactions/NFTokenMint.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Enums; @@ -177,9 +176,9 @@ public partial class Validation /// /// An NFTokenMint Transaction. /// When the NFTokenMint is Malformed. - public static async Task ValidateNFTokenMint(Dictionary tx) + public static void ValidateNFTokenMint(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (tx.TryGetValue("Account", out var Account) && tx.TryGetValue("Issuer", out var Issuer) && Account == Issuer) throw new ValidationException("NFTokenMint: Issuer must not be equal to Account"); diff --git a/Xrpl/Models/Transactions/NFTokenModify.cs b/Xrpl/Models/Transactions/NFTokenModify.cs index 4c896be8..8410b0fe 100644 --- a/Xrpl/Models/Transactions/NFTokenModify.cs +++ b/Xrpl/Models/Transactions/NFTokenModify.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Utils; @@ -72,9 +71,9 @@ public partial class Validation /// /// An NFTokenModify Transaction. /// When the NFTokenModify is Malformed. - public static async Task ValidateNFTokenModify(Dictionary tx) + public static void ValidateNFTokenModify(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (tx.TryGetValue("URI", out var URI) && URI is string {} uri) { diff --git a/Xrpl/Models/Transactions/OfferCancel.cs b/Xrpl/Models/Transactions/OfferCancel.cs index ed3de503..fcbbd891 100644 --- a/Xrpl/Models/Transactions/OfferCancel.cs +++ b/Xrpl/Models/Transactions/OfferCancel.cs @@ -3,7 +3,6 @@ // https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/offerCancel.ts using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -49,9 +48,9 @@ public partial class Validation /// /// A OfferCancel Transaction. /// When the OfferCancel is malformed. - public static async Task ValidateOfferCancel(Dictionary tx) + public static void ValidateOfferCancel(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("OfferSequence", out var OfferSequence) || OfferSequence is null) throw new ValidationException("OfferCancel: missing field OfferSequence"); diff --git a/Xrpl/Models/Transactions/OfferCreate.cs b/Xrpl/Models/Transactions/OfferCreate.cs index 03fe9443..b6c28380 100644 --- a/Xrpl/Models/Transactions/OfferCreate.cs +++ b/Xrpl/Models/Transactions/OfferCreate.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -162,9 +161,9 @@ public partial class Validation /// /// A OfferCreate Transaction. /// When the OfferCreate is malformed. - public static async Task ValidateOfferCreate(Dictionary tx) + public static void ValidateOfferCreate(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("TakerGets", out var TakerGets) || TakerGets is null) throw new ValidationException("OfferCreate: missing field TakerGets"); diff --git a/Xrpl/Models/Transactions/OracleDelete.cs b/Xrpl/Models/Transactions/OracleDelete.cs index 04f9dff5..b844e69e 100644 --- a/Xrpl/Models/Transactions/OracleDelete.cs +++ b/Xrpl/Models/Transactions/OracleDelete.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -51,9 +50,9 @@ public partial class Validation /// /// An OracleDelete Transaction. /// When the OracleDelete is malformed. - public static async Task ValidateOracleDelete(Dictionary tx) + public static void ValidateOracleDelete(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("OracleDocumentID", out var oracleDocumentID) || oracleDocumentID is null) throw new ValidationException("OracleDelete: missing field OracleDocumentID"); diff --git a/Xrpl/Models/Transactions/OracleSet.cs b/Xrpl/Models/Transactions/OracleSet.cs index 1948286c..cc980c05 100644 --- a/Xrpl/Models/Transactions/OracleSet.cs +++ b/Xrpl/Models/Transactions/OracleSet.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -145,9 +144,9 @@ public partial class Validation /// /// An OracleSet Transaction. /// When the OracleSet is malformed. - public static async Task ValidateOracleSet(Dictionary tx) + public static void ValidateOracleSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("OracleDocumentID", out var oracleDocumentID) || oracleDocumentID is null) throw new ValidationException("OracleSet: missing field OracleDocumentID"); diff --git a/Xrpl/Models/Transactions/Payment.cs b/Xrpl/Models/Transactions/Payment.cs index b28aa3aa..039d52a5 100644 --- a/Xrpl/Models/Transactions/Payment.cs +++ b/Xrpl/Models/Transactions/Payment.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -361,9 +360,9 @@ public partial class Validation /// /// A Payment Transaction. /// When the Payment is malformed. - public static async Task ValidatePayment(Dictionary tx) + public static void ValidatePayment(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Amount", out var Amount) || Amount is null) throw new ValidationException("PaymentTransaction: missing field Amount"); @@ -400,13 +399,13 @@ public static async Task ValidatePayment(Dictionary tx) CredentialsValidator.ValidateCredentialsList(credentialIds, "PaymentTransaction", "CredentialIDs", isStringID: true); } - await CheckPartialPayment(tx); + CheckPartialPayment(tx); } - public static Task CheckPartialPayment(Dictionary tx) + public static void CheckPartialPayment(Dictionary tx) { if (!tx.TryGetValue("DeliverMin", out var DeliverMin)) - return Task.CompletedTask; + return; if (tx.TryGetValue("Flags", out var flags)) { @@ -424,7 +423,7 @@ public static Task CheckPartialPayment(Dictionary tx) if (!Common.IsAmount(DeliverMin)) throw new ValidationException("PaymentTransaction: invalid DeliverMin"); - return Task.CompletedTask; + return; } static bool CheckFlag(Dictionary flag, string type) where T : Enum { diff --git a/Xrpl/Models/Transactions/PaymentChannelClaim.cs b/Xrpl/Models/Transactions/PaymentChannelClaim.cs index 3cf5a422..3b2adf3a 100644 --- a/Xrpl/Models/Transactions/PaymentChannelClaim.cs +++ b/Xrpl/Models/Transactions/PaymentChannelClaim.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -170,9 +169,9 @@ public partial class Validation /// /// A PaymentChannelClaim Transaction. /// When the PaymentChannelClaim is malformed. - public static async Task ValidatePaymentChannelClaim(Dictionary tx) + public static void ValidatePaymentChannelClaim(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Channel", out var Channel) || Channel is null) diff --git a/Xrpl/Models/Transactions/PaymentChannelCreate.cs b/Xrpl/Models/Transactions/PaymentChannelCreate.cs index dab5f534..1074de2d 100644 --- a/Xrpl/Models/Transactions/PaymentChannelCreate.cs +++ b/Xrpl/Models/Transactions/PaymentChannelCreate.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -118,9 +117,9 @@ public partial class Validation /// /// A PaymentChannelCreate Transaction. /// When the PaymentChannelCreate is malformed. - public static async Task ValidatePaymentChannelCreate(Dictionary tx) + public static void ValidatePaymentChannelCreate(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Amount", out var Amount) || Amount is null) diff --git a/Xrpl/Models/Transactions/PaymentChannelFund.cs b/Xrpl/Models/Transactions/PaymentChannelFund.cs index e38983e4..7ae65e8d 100644 --- a/Xrpl/Models/Transactions/PaymentChannelFund.cs +++ b/Xrpl/Models/Transactions/PaymentChannelFund.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -76,9 +75,9 @@ public partial class Validation /// /// A PaymentChannelFund Transaction. /// When the PaymentChannelFund is malformed. - public static async Task ValidatePaymentChannelFund(Dictionary tx) + public static void ValidatePaymentChannelFund(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Channel", out var Channel) || Channel is null) diff --git a/Xrpl/Models/Transactions/PermissionedDomainDelete.cs b/Xrpl/Models/Transactions/PermissionedDomainDelete.cs index 42fe14a1..23292d23 100644 --- a/Xrpl/Models/Transactions/PermissionedDomainDelete.cs +++ b/Xrpl/Models/Transactions/PermissionedDomainDelete.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -57,9 +56,9 @@ public partial class Validation /// /// A PermissionedDomainDelete transaction. /// When the PermissionedDomainDelete is malformed. - public static async Task ValidatePermissionedDomainDelete(Dictionary tx) + public static void ValidatePermissionedDomainDelete(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue(nameof(IPermissionedDomainDelete.DomainID), out var domainId) || domainId == null || (domainId is not string domainIdStr || string.IsNullOrEmpty(domainIdStr))) { diff --git a/Xrpl/Models/Transactions/PermissionedDomainSet.cs b/Xrpl/Models/Transactions/PermissionedDomainSet.cs index 5c4a35b6..d967452c 100644 --- a/Xrpl/Models/Transactions/PermissionedDomainSet.cs +++ b/Xrpl/Models/Transactions/PermissionedDomainSet.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using System.Text.Json.Serialization; @@ -108,9 +107,9 @@ public partial class Validation /// /// A PermissionedDomainSet transaction. /// When the PermissionedDomainSet is malformed. - public static async Task ValidatePermissionedDomainSet(Dictionary tx) + public static void ValidatePermissionedDomainSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); tx.TryGetValue("AcceptedCredentials", out var acceptedCredentials); diff --git a/Xrpl/Models/Transactions/SetRegularKey.cs b/Xrpl/Models/Transactions/SetRegularKey.cs index ad32ed2f..42048f54 100644 --- a/Xrpl/Models/Transactions/SetRegularKey.cs +++ b/Xrpl/Models/Transactions/SetRegularKey.cs @@ -3,7 +3,6 @@ // https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/setRegularKey.ts using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -49,9 +48,9 @@ public partial class Validation /// /// A SetRegularKey Transaction. /// When the SetRegularKey is malformed. - public static async Task ValidateSetRegularKey(Dictionary tx) + public static void ValidateSetRegularKey(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (tx.TryGetValue("RegularKey", out var RegularKey) && RegularKey is not string) throw new ValidationException("SetRegularKey: RegularKey must be a string"); diff --git a/Xrpl/Models/Transactions/SignerListSet.cs b/Xrpl/Models/Transactions/SignerListSet.cs index 0509094c..bd0dfe04 100644 --- a/Xrpl/Models/Transactions/SignerListSet.cs +++ b/Xrpl/Models/Transactions/SignerListSet.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Text.RegularExpressions; using Xrpl.Client.Exceptions; -using System.Threading.Tasks; using Xrpl.Models.Ledger; @@ -60,9 +59,9 @@ public partial class Validation /// /// A SignerListSet Transaction. /// When the SignerListSet is malformed. - public static async Task ValidateSignerListSet(Dictionary tx) + public static void ValidateSignerListSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("SignerQuorum", out var SignerQuorum) || SignerQuorum is null) throw new ValidationException("SignerListSet: missing field SignerQuorum"); if (!Common.IsUInt32(SignerQuorum)) diff --git a/Xrpl/Models/Transactions/SponsorshipSet.cs b/Xrpl/Models/Transactions/SponsorshipSet.cs index d5ae4ff6..096c7812 100644 --- a/Xrpl/Models/Transactions/SponsorshipSet.cs +++ b/Xrpl/Models/Transactions/SponsorshipSet.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Globalization; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -172,9 +171,9 @@ public class SponsorshipSetResponse : TransactionResponse, ISponsorshipSet public partial class Validation { - public static async Task ValidateSponsorshipSet(Dictionary tx) + public static void ValidateSponsorshipSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); bool hasSponsee = tx.TryGetValue("Sponsee", out var sponsee) && sponsee is string; bool hasCounterpartySponsor = tx.TryGetValue("CounterpartySponsor", out var cps) && cps is string; diff --git a/Xrpl/Models/Transactions/SponsorshipTransfer.cs b/Xrpl/Models/Transactions/SponsorshipTransfer.cs index 93233ba5..1a02d3e9 100644 --- a/Xrpl/Models/Transactions/SponsorshipTransfer.cs +++ b/Xrpl/Models/Transactions/SponsorshipTransfer.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -99,9 +98,9 @@ public class SponsorshipTransferResponse : TransactionResponse, ISponsorshipTran public partial class Validation { - public static async Task ValidateSponsorshipTransfer(Dictionary tx) + public static void ValidateSponsorshipTransfer(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (tx.TryGetValue("ObjectID", out var objectId) && objectId is not string) throw new ValidationException("SponsorshipTransfer: invalid ObjectID"); diff --git a/Xrpl/Models/Transactions/TicketCreate.cs b/Xrpl/Models/Transactions/TicketCreate.cs index 052ee7b6..3e831379 100644 --- a/Xrpl/Models/Transactions/TicketCreate.cs +++ b/Xrpl/Models/Transactions/TicketCreate.cs @@ -2,7 +2,6 @@ // https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/ticketCreate.ts using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -48,9 +47,9 @@ public partial class Validation /// /// A TicketCreate Transaction. /// When the TicketCreate is malformed. - public static async Task ValidateTicketCreate(Dictionary tx) + public static void ValidateTicketCreate(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("TicketCount", out var TicketCount) || TicketCount is null) diff --git a/Xrpl/Models/Transactions/TrustSet.cs b/Xrpl/Models/Transactions/TrustSet.cs index badfa3df..e46bf21b 100644 --- a/Xrpl/Models/Transactions/TrustSet.cs +++ b/Xrpl/Models/Transactions/TrustSet.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -152,9 +151,9 @@ public partial class Validation /// /// A TrustSet Transaction. /// When the TrustSet is malformed. - public static async Task ValidateTrustSet(Dictionary tx) + public static void ValidateTrustSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("LimitAmount", out var LimitAmount) || LimitAmount is null) throw new ValidationException("TrustSet: missing field LimitAmount"); // TODO: Review this function diff --git a/Xrpl/Models/Transactions/Validation.cs b/Xrpl/Models/Transactions/Validation.cs index 474432c8..e0be0d6a 100644 --- a/Xrpl/Models/Transactions/Validation.cs +++ b/Xrpl/Models/Transactions/Validation.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Utils; @@ -13,7 +12,7 @@ public static partial class Validation /// /// A TrustSet Transaction. /// When the TrustSet is malformed. - public static async Task Validate(Dictionary tx) + public static void Validate(Dictionary tx) { tx.TryGetValue("TransactionType", out var type); @@ -30,270 +29,270 @@ public static async Task Validate(Dictionary tx) switch (type) { case "AccountDelete": - await ValidateAccountDelete(tx); + ValidateAccountDelete(tx); break; case "AccountSet": - await ValidateAccountSet(tx); + ValidateAccountSet(tx); break; case "CheckCancel": - await ValidateCheckCancel(tx); + ValidateCheckCancel(tx); break; case "CheckCash": - await ValidateCheckCash(tx); + ValidateCheckCash(tx); break; case "CheckCreate": - await ValidateCheckCreate(tx); + ValidateCheckCreate(tx); break; case "DepositPreauth": - await ValidateDepositPreauth(tx); + ValidateDepositPreauth(tx); break; case "EscrowCancel": - await ValidateEscrowCancel(tx); + ValidateEscrowCancel(tx); break; case "EscrowCreate": - await ValidateEscrowCreate(tx); + ValidateEscrowCreate(tx); break; case "EscrowFinish": - await ValidateEscrowFinish(tx); + ValidateEscrowFinish(tx); break; case "NFTokenAcceptOffer": - await ValidateNFTokenAcceptOffer(tx); + ValidateNFTokenAcceptOffer(tx); break; case "NFTokenBurn": - await ValidateNFTokenBurn(tx); + ValidateNFTokenBurn(tx); break; case "NFTokenCancelOffer": - await ValidateNFTokenCancelOffer(tx); + ValidateNFTokenCancelOffer(tx); break; case "NFTokenCreateOffer": - await ValidateNFTokenCreateOffer(tx); + ValidateNFTokenCreateOffer(tx); break; case "NFTokenMint": - await ValidateNFTokenMint(tx); + ValidateNFTokenMint(tx); break; case "NFTokenModify": - await ValidateNFTokenModify(tx); + ValidateNFTokenModify(tx); break; case "OfferCancel": - await ValidateOfferCancel(tx); + ValidateOfferCancel(tx); break; case "OfferCreate": - await ValidateOfferCreate(tx); + ValidateOfferCreate(tx); break; case "Payment": - await ValidatePayment(tx); + ValidatePayment(tx); break; case "PaymentChannelClaim": - await ValidatePaymentChannelClaim(tx); + ValidatePaymentChannelClaim(tx); break; case "PaymentChannelCreate": - await ValidatePaymentChannelCreate(tx); + ValidatePaymentChannelCreate(tx); break; case "PaymentChannelFund": - await ValidatePaymentChannelFund(tx); + ValidatePaymentChannelFund(tx); break; case "SetRegularKey": - await ValidateSetRegularKey(tx); + ValidateSetRegularKey(tx); break; case "SignerListSet": - await ValidateSignerListSet(tx); + ValidateSignerListSet(tx); break; case "TicketCreate": - await ValidateTicketCreate(tx); + ValidateTicketCreate(tx); break; case "TrustSet": - await ValidateTrustSet(tx); + ValidateTrustSet(tx); break; case "AMMBid": - await ValidateAMMBid(tx); + ValidateAMMBid(tx); break; case "AMMDeposit": - await ValidateAMMDeposit(tx); + ValidateAMMDeposit(tx); break; case "AMMCreate": - await ValidateAMMCreate(tx); + ValidateAMMCreate(tx); break; case "AMMDelete": - await ValidateAMMDelete(tx); + ValidateAMMDelete(tx); break; case "AMMVote": - await ValidateAMMVote(tx); + ValidateAMMVote(tx); break; case "AMMWithdraw": - await ValidateAMMWithdraw(tx); + ValidateAMMWithdraw(tx); break; case "Batch": - await ValidateBatch(tx); + ValidateBatch(tx); break; case "MPTokenIssuanceCreate": - await ValidateMPTokenIssuanceCreate(tx); + ValidateMPTokenIssuanceCreate(tx); break; case "MPTokenIssuanceDestroy": - await ValidateMPTokenIssuanceDestroy(tx); + ValidateMPTokenIssuanceDestroy(tx); break; case "MPTokenIssuanceSet": - await ValidateMPTokenIssuanceSet(tx); + ValidateMPTokenIssuanceSet(tx); break; case "MPTokenAuthorize": - await ValidateMPTokenAuthorize(tx); + ValidateMPTokenAuthorize(tx); break; case "OracleSet": - await ValidateOracleSet(tx); + ValidateOracleSet(tx); break; case "OracleDelete": - await ValidateOracleDelete(tx); + ValidateOracleDelete(tx); break; case "Clawback": - await ValidateClawBack(tx); + ValidateClawBack(tx); break; case "AMMClawback": - await ValidateAMMClawBack(tx); + ValidateAMMClawBack(tx); break; case "DIDSet": - await ValidateDIDSet(tx); + ValidateDIDSet(tx); break; case "DIDDelete": - await ValidateDIDDelete(tx); + ValidateDIDDelete(tx); break; case "PermissionedDomainSet": - await ValidatePermissionedDomainSet(tx); + ValidatePermissionedDomainSet(tx); break; case "PermissionedDomainDelete": - await ValidatePermissionedDomainDelete(tx); + ValidatePermissionedDomainDelete(tx); break; case "CredentialCreate": - await ValidateCredentialCreate(tx); + ValidateCredentialCreate(tx); break; case "CredentialAccept": - await ValidateCredentialAccept(tx); + ValidateCredentialAccept(tx); break; case "CredentialDelete": - await ValidateCredentialDelete(tx); + ValidateCredentialDelete(tx); break; case "XChainCreateBridge": - await ValidateXChainCreateBridge(tx); + ValidateXChainCreateBridge(tx); break; case "XChainModifyBridge": - await ValidateXChainModifyBridge(tx); + ValidateXChainModifyBridge(tx); break; case "XChainCreateClaimID": - await ValidateXChainCreateClaimID(tx); + ValidateXChainCreateClaimID(tx); break; case "XChainCommit": - await ValidateXChainCommit(tx); + ValidateXChainCommit(tx); break; case "XChainClaim": - await ValidateXChainClaim(tx); + ValidateXChainClaim(tx); break; case "XChainAccountCreateCommit": - await ValidateXChainAccountCreateCommit(tx); + ValidateXChainAccountCreateCommit(tx); break; case "XChainAddClaimAttestation": - await ValidateXChainAddClaimAttestation(tx); + ValidateXChainAddClaimAttestation(tx); break; case "XChainAddAccountCreateAttestation": - await ValidateXChainAddAccountCreateAttestation(tx); + ValidateXChainAddAccountCreateAttestation(tx); break; case "VaultCreate": - await ValidateVaultCreate(tx); + ValidateVaultCreate(tx); break; case "VaultSet": - await ValidateVaultSet(tx); + ValidateVaultSet(tx); break; case "VaultDelete": - await ValidateVaultDelete(tx); + ValidateVaultDelete(tx); break; case "VaultDeposit": - await ValidateVaultDeposit(tx); + ValidateVaultDeposit(tx); break; case "VaultWithdraw": - await ValidateVaultWithdraw(tx); + ValidateVaultWithdraw(tx); break; case "VaultClawback": - await ValidateVaultClawback(tx); + ValidateVaultClawback(tx); break; case "LoanBrokerSet": - await ValidateLoanBrokerSet(tx); + ValidateLoanBrokerSet(tx); break; case "LoanBrokerDelete": - await ValidateLoanBrokerDelete(tx); + ValidateLoanBrokerDelete(tx); break; case "LoanBrokerCoverDeposit": - await ValidateLoanBrokerCoverDeposit(tx); + ValidateLoanBrokerCoverDeposit(tx); break; case "LoanBrokerCoverWithdraw": - await ValidateLoanBrokerCoverWithdraw(tx); + ValidateLoanBrokerCoverWithdraw(tx); break; case "LoanBrokerCoverClawback": - await ValidateLoanBrokerCoverClawback(tx); + ValidateLoanBrokerCoverClawback(tx); break; case "LoanSet": - await ValidateLoanSet(tx); + ValidateLoanSet(tx); break; case "LoanDelete": - await ValidateLoanDelete(tx); + ValidateLoanDelete(tx); break; case "LoanManage": - await ValidateLoanManage(tx); + ValidateLoanManage(tx); break; case "LoanPay": - await ValidateLoanPay(tx); + ValidateLoanPay(tx); break; case "DelegateSet": - await ValidateDelegateSet(tx); + ValidateDelegateSet(tx); break; case "LedgerStateFix": - await ValidateLedgerStateFix(tx); + ValidateLedgerStateFix(tx); break; case "SponsorshipSet": - await ValidateSponsorshipSet(tx); + ValidateSponsorshipSet(tx); break; case "SponsorshipTransfer": - await ValidateSponsorshipTransfer(tx); + ValidateSponsorshipTransfer(tx); break; case "ConfidentialMPTConvert": - await ValidateConfidentialMPTConvert(tx); + ValidateConfidentialMPTConvert(tx); break; case "ConfidentialMPTMergeInbox": - await ValidateConfidentialMPTMergeInbox(tx); + ValidateConfidentialMPTMergeInbox(tx); break; case "ConfidentialMPTConvertBack": - await ValidateConfidentialMPTConvertBack(tx); + ValidateConfidentialMPTConvertBack(tx); break; case "ConfidentialMPTSend": - await ValidateConfidentialMPTSend(tx); + ValidateConfidentialMPTSend(tx); break; case "ConfidentialMPTClawback": - await ValidateConfidentialMPTClawback(tx); + ValidateConfidentialMPTClawback(tx); break; default: diff --git a/Xrpl/Models/Transactions/VaultClawback.cs b/Xrpl/Models/Transactions/VaultClawback.cs index 0da95369..4e490818 100644 --- a/Xrpl/Models/Transactions/VaultClawback.cs +++ b/Xrpl/Models/Transactions/VaultClawback.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -73,9 +72,9 @@ public class VaultClawbackResponse : TransactionResponse, IVaultClawback public partial class Validation { - public static async Task ValidateVaultClawback(Dictionary tx) + public static void ValidateVaultClawback(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("VaultID", out var vaultId) || vaultId is not string) throw new ValidationException("VaultClawback: missing field VaultID"); diff --git a/Xrpl/Models/Transactions/VaultCreate.cs b/Xrpl/Models/Transactions/VaultCreate.cs index 61f3f05c..d101dbf6 100644 --- a/Xrpl/Models/Transactions/VaultCreate.cs +++ b/Xrpl/Models/Transactions/VaultCreate.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -160,9 +159,9 @@ public class VaultCreateResponse : TransactionResponse, IVaultCreate public partial class Validation { - public static async Task ValidateVaultCreate(Dictionary tx) + public static void ValidateVaultCreate(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("Asset", out var asset) || asset is null) throw new ValidationException("VaultCreate: missing field Asset"); diff --git a/Xrpl/Models/Transactions/VaultDelete.cs b/Xrpl/Models/Transactions/VaultDelete.cs index df8635da..fc17aa4a 100644 --- a/Xrpl/Models/Transactions/VaultDelete.cs +++ b/Xrpl/Models/Transactions/VaultDelete.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -51,9 +50,9 @@ public class VaultDeleteResponse : TransactionResponse, IVaultDelete public partial class Validation { - public static async Task ValidateVaultDelete(Dictionary tx) + public static void ValidateVaultDelete(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("VaultID", out var vaultId) || vaultId is not string) throw new ValidationException("VaultDelete: missing field VaultID"); diff --git a/Xrpl/Models/Transactions/VaultDeposit.cs b/Xrpl/Models/Transactions/VaultDeposit.cs index ecfc9cf2..db2ec5f0 100644 --- a/Xrpl/Models/Transactions/VaultDeposit.cs +++ b/Xrpl/Models/Transactions/VaultDeposit.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Models.Common; @@ -57,9 +56,9 @@ public class VaultDepositResponse : TransactionResponse, IVaultDeposit public partial class Validation { - public static async Task ValidateVaultDeposit(Dictionary tx) + public static void ValidateVaultDeposit(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("VaultID", out var vaultId) || vaultId is not string) throw new ValidationException("VaultDeposit: missing field VaultID"); diff --git a/Xrpl/Models/Transactions/VaultSet.cs b/Xrpl/Models/Transactions/VaultSet.cs index 91d662c7..4e7151a0 100644 --- a/Xrpl/Models/Transactions/VaultSet.cs +++ b/Xrpl/Models/Transactions/VaultSet.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; @@ -83,9 +82,9 @@ public class VaultSetResponse : TransactionResponse, IVaultSet public partial class Validation { - public static async Task ValidateVaultSet(Dictionary tx) + public static void ValidateVaultSet(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("VaultID", out var vaultId) || vaultId is not string) throw new ValidationException("VaultSet: missing field VaultID"); diff --git a/Xrpl/Models/Transactions/VaultWithdraw.cs b/Xrpl/Models/Transactions/VaultWithdraw.cs index dfb3df93..1ad0f4b0 100644 --- a/Xrpl/Models/Transactions/VaultWithdraw.cs +++ b/Xrpl/Models/Transactions/VaultWithdraw.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -87,9 +86,9 @@ public class VaultWithdrawResponse : TransactionResponse, IVaultWithdraw public partial class Validation { - public static async Task ValidateVaultWithdraw(Dictionary tx) + public static void ValidateVaultWithdraw(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("VaultID", out var vaultId) || vaultId is not string vaultIdStr || !IsValidHash256(vaultIdStr)) diff --git a/Xrpl/Models/Transactions/XChainAccountCreateCommit.cs b/Xrpl/Models/Transactions/XChainAccountCreateCommit.cs index efeac546..4266ea07 100644 --- a/Xrpl/Models/Transactions/XChainAccountCreateCommit.cs +++ b/Xrpl/Models/Transactions/XChainAccountCreateCommit.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -91,9 +90,9 @@ public class XChainAccountCreateCommitResponse : TransactionResponse, IXChainAcc public partial class Validation { - public static async Task ValidateXChainAccountCreateCommit(Dictionary tx) + public static void ValidateXChainAccountCreateCommit(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("XChainBridge", out var bridge) || bridge is null) throw new ValidationException("XChainAccountCreateCommit: missing field XChainBridge"); diff --git a/Xrpl/Models/Transactions/XChainAddAccountCreateAttestation.cs b/Xrpl/Models/Transactions/XChainAddAccountCreateAttestation.cs index f1a614b7..e2f888f6 100644 --- a/Xrpl/Models/Transactions/XChainAddAccountCreateAttestation.cs +++ b/Xrpl/Models/Transactions/XChainAddAccountCreateAttestation.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -182,9 +181,9 @@ public class XChainAddAccountCreateAttestationResponse : TransactionResponse, IX public partial class Validation { - public static async Task ValidateXChainAddAccountCreateAttestation(Dictionary tx) + public static void ValidateXChainAddAccountCreateAttestation(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("XChainBridge", out var bridge) || bridge is null) throw new ValidationException("XChainAddAccountCreateAttestation: missing field XChainBridge"); diff --git a/Xrpl/Models/Transactions/XChainAddClaimAttestation.cs b/Xrpl/Models/Transactions/XChainAddClaimAttestation.cs index 65984486..5a1f596a 100644 --- a/Xrpl/Models/Transactions/XChainAddClaimAttestation.cs +++ b/Xrpl/Models/Transactions/XChainAddClaimAttestation.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -166,9 +165,9 @@ public class XChainAddClaimAttestationResponse : TransactionResponse, IXChainAdd public partial class Validation { - public static async Task ValidateXChainAddClaimAttestation(Dictionary tx) + public static void ValidateXChainAddClaimAttestation(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("XChainBridge", out var bridge) || bridge is null) throw new ValidationException("XChainAddClaimAttestation: missing field XChainBridge"); diff --git a/Xrpl/Models/Transactions/XChainClaim.cs b/Xrpl/Models/Transactions/XChainClaim.cs index 50d6b0d3..8cc28eb8 100644 --- a/Xrpl/Models/Transactions/XChainClaim.cs +++ b/Xrpl/Models/Transactions/XChainClaim.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -101,9 +100,9 @@ public class XChainClaimResponse : TransactionResponse, IXChainClaim public partial class Validation { - public static async Task ValidateXChainClaim(Dictionary tx) + public static void ValidateXChainClaim(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("XChainBridge", out var bridge) || bridge is null) throw new ValidationException("XChainClaim: missing field XChainBridge"); diff --git a/Xrpl/Models/Transactions/XChainCommit.cs b/Xrpl/Models/Transactions/XChainCommit.cs index 4813ecac..3ff8bb4f 100644 --- a/Xrpl/Models/Transactions/XChainCommit.cs +++ b/Xrpl/Models/Transactions/XChainCommit.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -90,9 +89,9 @@ public class XChainCommitResponse : TransactionResponse, IXChainCommit public partial class Validation { - public static async Task ValidateXChainCommit(Dictionary tx) + public static void ValidateXChainCommit(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("XChainBridge", out var bridge) || bridge is null) throw new ValidationException("XChainCommit: missing field XChainBridge"); diff --git a/Xrpl/Models/Transactions/XChainCreateBridge.cs b/Xrpl/Models/Transactions/XChainCreateBridge.cs index 5202a8d2..9d247dc3 100644 --- a/Xrpl/Models/Transactions/XChainCreateBridge.cs +++ b/Xrpl/Models/Transactions/XChainCreateBridge.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -76,9 +75,9 @@ public class XChainCreateBridgeResponse : TransactionResponse, IXChainCreateBrid public partial class Validation { - public static async Task ValidateXChainCreateBridge(Dictionary tx) + public static void ValidateXChainCreateBridge(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("XChainBridge", out var bridge) || bridge is null) throw new ValidationException("XChainCreateBridge: missing field XChainBridge"); diff --git a/Xrpl/Models/Transactions/XChainCreateClaimID.cs b/Xrpl/Models/Transactions/XChainCreateClaimID.cs index 2fcf5f2a..793669f9 100644 --- a/Xrpl/Models/Transactions/XChainCreateClaimID.cs +++ b/Xrpl/Models/Transactions/XChainCreateClaimID.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -75,9 +74,9 @@ public class XChainCreateClaimIDResponse : TransactionResponse, IXChainCreateCla public partial class Validation { - public static async Task ValidateXChainCreateClaimID(Dictionary tx) + public static void ValidateXChainCreateClaimID(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("XChainBridge", out var bridge) || bridge is null) throw new ValidationException("XChainCreateClaimID: missing field XChainBridge"); diff --git a/Xrpl/Models/Transactions/XChainModifyBridge.cs b/Xrpl/Models/Transactions/XChainModifyBridge.cs index 254ee21b..477d6089 100644 --- a/Xrpl/Models/Transactions/XChainModifyBridge.cs +++ b/Xrpl/Models/Transactions/XChainModifyBridge.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; using Xrpl.Client.Exceptions; using Xrpl.Client.Json.Converters; @@ -99,9 +98,9 @@ public class XChainModifyBridgeResponse : TransactionResponse, IXChainModifyBrid public partial class Validation { - public static async Task ValidateXChainModifyBridge(Dictionary tx) + public static void ValidateXChainModifyBridge(Dictionary tx) { - await Common.ValidateBaseTransaction(tx); + Common.ValidateBaseTransaction(tx); if (!tx.TryGetValue("XChainBridge", out var bridge) || bridge is null) throw new ValidationException("XChainModifyBridge: missing field XChainBridge"); diff --git a/Xrpl/Models/Utils/BatchUtils.cs b/Xrpl/Models/Utils/BatchUtils.cs index ba0c4a3c..2fb5200a 100644 --- a/Xrpl/Models/Utils/BatchUtils.cs +++ b/Xrpl/Models/Utils/BatchUtils.cs @@ -20,7 +20,11 @@ public static class BatchUtils /// /// Turns a list of ordinary transactions - your own C# models - into the inner RawTransactions /// a Batch needs (Fee = "0", SigningPubKey = "", + tfInnerBatchTxn; no TxnSignature/Signers/LastLedgerSequence). + /// The assembled batch is validated before it is returned. /// + /// When transactions is null. + /// When the assembled Batch is malformed - fewer than 2 or more than 8 inner + /// transactions, an inner type a Batch forbids, or an inner that is not shaped the way a Batch requires. public static Batch Build(string account, IEnumerable transactions, BatchFlags? mode = null, List? batchSigners = null) { if (transactions == null) throw new ArgumentNullException(nameof(transactions)); diff --git a/Xrpl/Xrpl.csproj b/Xrpl/Xrpl.csproj index d3e48208..232df4cf 100644 --- a/Xrpl/Xrpl.csproj +++ b/Xrpl/Xrpl.csproj @@ -14,7 +14,7 @@ Apache-2.0 https://github.com/StaticBit-io/XrplCSharp XrplCSharp - 11.5.0.0 + 11.5.1.0