Exemplo n.º 1
0
        public static RestApiTransaction getTransaction(string uri, string network, string txid)
        {
            Task <string>      TaskResponseData = RestApiGetFunction(uri, network, bsvConfiguration_class.getTx, txid);
            RestApiTransaction Btx = JsonConvert.DeserializeObject <RestApiTransaction>(TaskResponseData.Result);

            return(Btx);
        }
Exemplo n.º 2
0
 public static byte[] getOpReturnFullData(string uri, string network, string txid)
 {
     if (txid != null)
     {
         RestApiTransaction tx    = getTransaction(uri, network, txid);
         byte[]             bytes = getOpReturnFullData(tx);
         return(bytes);
     }
     return(null);
 }
Exemplo n.º 3
0
        public static string getOpReturnData(RestApiTransaction tx, Encoding encoder)
        {
            string s = null;

            byte[] bytes = getOpReturnFullData(tx);
            if (bytes != null)
            {
                if (bytes.Length - 2 > 0)
                {
                    byte[] strBytes = bytes.Skip(2).ToArray();
                    s = encoder.GetString(strBytes);
                }
            }
            Console.WriteLine(s);
            return(s);
        }
Exemplo n.º 4
0
 public static byte[] getOpReturnFullData(RestApiTransaction tx)
 {
     if (tx != null)
     {
         if (tx.Outputs != null)
         {
             string opReturnHexStr = null;
             foreach (RestApiOutput output in tx.Outputs)
             {
                 opReturnHexStr = output.ScriptPubKey.Hex;
                 if (opReturnHexStr.Substring(0, 4) == "006a" ||
                     opReturnHexStr.Substring(0, 2) == "6a")
                 {
                     HexEncoder hexEncoder = new HexEncoder();
                     byte[]     bytes      = hexEncoder.DecodeData(opReturnHexStr);
                     return(bytes);
                 }
             }
         }
     }
     return(null);
 }