Example #1
0
        public static bool TryGetTarget(Transaction transaction, IOpReturnDataReader opReturnDataReader, out bool conversion, out string targetAddress, out int targetChain)
        {
            conversion  = false;
            targetChain = 0 /* DestinationChain.STRAX */;

            // Check the common case first.
            if (!opReturnDataReader.TryGetTargetAddress(transaction, out targetAddress))
            {
                byte[] opReturnBytes = OpReturnDataReader.SelectBytesContentFromOpReturn(transaction).FirstOrDefault();

                if (opReturnBytes != null && InterFluxOpReturnEncoder.TryDecode(opReturnBytes, out int destinationChain, out targetAddress))
                {
                    targetChain = destinationChain;
                }
                else
                {
                    return(false);
                }

                conversion = true;
            }
        public static bool TryGetTarget(Transaction transaction, IOpReturnDataReader opReturnDataReader, out bool conversion, out string targetAddress, out int targetChain)
        {
            conversion  = false;
            targetChain = 0 /* DestinationChain.STRAX */;

            // First check cross chain transfers from the STRAX to Cirrus network or vice versa.
            if (!opReturnDataReader.TryGetTargetAddress(transaction, out targetAddress))
            {
                // Else try and validate the destination adress by the destination chain.
                byte[] opReturnBytes = OpReturnDataReader.SelectBytesContentFromOpReturn(transaction).FirstOrDefault();

                if (opReturnBytes != null && InterFluxOpReturnEncoder.TryDecode(opReturnBytes, out int destinationChain, out targetAddress))
                {
                    targetChain = destinationChain;
                }
                else
                {
                    return(false);
                }

                conversion = true;
            }