/// <inheritdoc /> public string GetStringFromOpReturn(Transaction transaction, out OpReturnDataType opReturnDataType) { string address = GetDestinationFromOpReturn(transaction); if (address != null) { opReturnDataType = OpReturnDataType.Address; return(address); } int blockHeight = GetBlockHeightFromOpReturn(transaction); if (blockHeight != -1) { opReturnDataType = OpReturnDataType.BlockHeight; return(blockHeight.ToString()); } string hash = GetHashFromOpReturn(transaction); if (hash != null) { opReturnDataType = OpReturnDataType.Hash; return(hash); } opReturnDataType = OpReturnDataType.Unknown; return(null); }
/// <summary> /// Interprets the inbound OP_RETURN data and tells us what type it is. /// </summary> /// <param name="logger">The logger to use for diagnostic purposes.</param> /// <param name="network">The network we are monitoring.</param> /// <param name="transaction">The transaction we are examining.</param> /// <param name="opReturnDataType">Returns information about how the data was interpreted.</param> /// <returns>The relevant string or null of the type is Unknown.</returns> public static string GetStringFromOpReturn(ILogger logger, Network network, Transaction transaction, out OpReturnDataType opReturnDataType) { string address = GetDestinationFromOpReturn(logger, network, transaction); if (address != null) { opReturnDataType = OpReturnDataType.Address; return(address); } //string hash = GetHashFromOpReturn(logger, transaction); //if (hash != null) //{ // opReturnDataType = OpReturnDataType.Hash; // return hash; //} int blockHeight = GetBlockHeightFromOpReturn(logger, transaction); if (blockHeight != -1) { opReturnDataType = OpReturnDataType.BlockHeight; return(blockHeight.ToString()); } opReturnDataType = OpReturnDataType.Unknown; return(null); }