From 735ebc3eefe5a67fc7c2edf5dca18cfdc438afc5 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Thu, 23 May 2024 16:45:54 +0300 Subject: [PATCH] sep for cov --- .../ThirdwebTransaction.cs | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs b/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs index 19a2282..023ff3a 100644 --- a/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs +++ b/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs @@ -35,15 +35,28 @@ public static async Task Create(ThirdwebClient client, IThi var address = await wallet.GetAddress(); txInput.From ??= address; txInput.Data ??= "0x"; - return address != txInput.From - ? throw new ArgumentException("Transaction sender (from) must match wallet address") - : client == null - ? throw new ArgumentNullException(nameof(client)) - : wallet == null - ? throw new ArgumentNullException(nameof(wallet)) - : chainId == 0 - ? throw new ArgumentException("Invalid Chain ID") - : new ThirdwebTransaction(client, wallet, txInput, chainId); + + if (address != txInput.From) + { + throw new ArgumentException("Transaction sender (from) must match wallet address"); + } + + if (client == null) + { + throw new ArgumentNullException(nameof(client)); + } + + if (wallet == null) + { + throw new ArgumentNullException(nameof(wallet)); + } + + if (chainId == 0) + { + throw new ArgumentException("Invalid Chain ID"); + } + + return new ThirdwebTransaction(client, wallet, txInput, chainId); } public override string ToString()