public static string[] GetAllRelatedAddresses(this Transaction tx, TransactionReceipt receipt) { if (tx == null) { return new string[] { } } ; var uniqueAddresses = new UniqueAddressList() { tx.From }; if (tx.To.IsNotAnEmptyAddress()) { uniqueAddresses.Add(tx.To); } if (receipt != null) { if (receipt.ContractAddress.IsNotAnEmptyAddress()) { uniqueAddresses.Add(receipt.ContractAddress); } foreach (var log in tx.GetTransactionLogs(receipt)) { if (log.Address.IsNotAnEmptyAddress()) { uniqueAddresses.Add(log.Address); } } } return(uniqueAddresses.ToArray()); } }
public FilterLogVO(Transaction transaction, TransactionReceipt receipt, FilterLog log) { Transaction = transaction; Receipt = receipt; Log = log; }
public virtual bool HasLogs() { return(TransactionReceipt?.HasLogs() ?? false); }
public static bool IsForContractCreation( this Transaction transaction, TransactionReceipt transactionReceipt) { return(transaction.To.IsAnEmptyAddress() && transactionReceipt.ContractAddress.IsNotAnEmptyAddress()); }
public static IEnumerable <FilterLogVO> GetTransactionLogs(this Transaction transaction, TransactionReceipt receipt) { for (var i = 0; i < receipt.Logs?.Count; i++) { if (receipt.Logs[i] is JObject log) { var typedLog = log.ToObject <FilterLog>(); yield return (new FilterLogVO(transaction, receipt, typedLog)); } } }
public static bool IsContractAddressEmptyOrEqual(this TransactionReceipt receipt, string contractAddress) { return(receipt.ContractAddress.IsEmptyOrEqualsAddress(contractAddress)); }
public static bool HasLogs(this TransactionReceipt receipt) { return(receipt.Logs?.Count > 0); }
public static bool Failed(this TransactionReceipt receipt, bool treatNullStatusAsFailure = TREAT_NULL_STATUS_AS_FAILURE) { return(receipt.HasErrors() ?? treatNullStatusAsFailure); }
public static bool Succeeded(this TransactionReceipt receipt, bool treatNullStatusAsFailure = TREAT_NULL_STATUS_AS_FAILURE) { return(!receipt.Failed(treatNullStatusAsFailure)); }
public static bool IsContractAddressEqual(this TransactionReceipt receipt, string address) { return(receipt.ContractAddress.IsTheSameAddress(address)); }