public void CanDecodeMetaBinary() { var meta = "201C00000000F8E511006125004D1B5655AB8953C6EFD2EBDD5D6314CE0DAFF4CA5B180AE1792B47468ECA5EC5AED28CA45698430F87624433A745D429635D1B2B982EF22AC7E4112ACF43DA97AEF258DC76E6624000000254C5E530E1E7220000000024000000022D00000000624000000254D527708114A2D0815DD52160FF1979A60C50B00C09ECD669D4E1E1E511006125004D1B5655AB8953C6EFD2EBDD5D6314CE0DAFF4CA5B180AE1792B47468ECA5EC5AED28CA456CECECAD86B8E831AA8DB7C8AE259D7D5C1B85C6A5FB9A4341CF560DFB8242F10E624000000126240000002534F23B0E1E7220000000024000000132D000000016240000002533FE1668114656CFDA8B366CAFE7EDC195A6DE87921FB70C231E1E1F1031000"; StObject obj = StObject.FromHex(meta); Assert.IsNotNull(obj); }
public void CanDeserializeEscrowTransaction() { string binary = "1200012280000000240000001C201B0055E830202421E4C840202521E376C061400000000098968068400000000000000C7321024B1C46885AD9DEEE7A413026D74BA6161C2F68FA9BD621022CF34CA00FB6FAEC7446304402201E931F36789387DF59058D34345D5EEBF2BD18159FEB8A8601E495054D4065F802200EBD2738EA138BA7C0D5AC07E02B950A84F563EF1AC94F8B4BCAA99595B402A48114656CFDA8B366CAFE7EDC195A6DE87921FB70C2318314A2D0815DD52160FF1979A60C50B00C09ECD669D4"; StObject stObject = StObject.FromHex(binary); Assert.IsNotNull(stObject); }
public void CanDecodeBinary() { string binary = "1100722200210000250178D1CA37000000000000000038000000000000028355C0C37CE200B509E0A529880634F7841A9EF4CB65F03C12E6004CFAD9718D66946280000000000000000000000000000000000000004743420000000000000000000000000000000000000000000000000166D6071AFD498D000000000000000000000000000047434200000000002599D1D255BCA61189CA64C84528F2FCBE4BFC3867800000000000000000000000000000000000000047434200000000006EEBB1D1852CE667876A0B3630861FB6C6AB358E"; var obj = StObject.FromHex(binary); Assert.IsNotNull(obj); }
public static void AssertRecycles(string jsonKey, string binaryKey, JToken test) { var json = test[jsonKey]; var binary = test[binaryKey]; string expectedHex = binary.ToString(); var fromHex = StObject.FromHex(expectedHex); AssertDeepEqual(json, fromHex.ToJson(), test); StObject o = json; var actualHex = o.ToHex(); Assert.AreEqual(expectedHex, actualHex, $"{test}"); }
public void DataDrivenTransactionSerialisationTest() { var obj = GetTestsJson(); foreach (var whole in obj["whole_objects"]) { StObject txn = whole["tx_json"]; Assert.AreEqual(whole["blob_with_no_signing"], txn.ToHex()); AssertDeepEqual(whole["tx_json"], txn.ToJson(), null); var txnFromBinary = StObject.FromHex($"{whole["blob_with_no_signing"]}"); AssertDeepEqual(whole["tx_json"], txnFromBinary.ToJson(), null); } }
public static List <string> ParseRippleTransaction(RippleTransactionInfo info, byte[] transaction, ref uint timeout) { string htmlOutput = ""; string htmlOutputWithDetails = ""; if (info.transactionTooBigToDisplay == true) { throw new XrpParserException("Transaction too big to display."); } string transactionString = BitConverter.ToString(transaction).Replace("-", "").ToLower(); var tx = StObject.FromHex(transactionString); JToken fullTxJson = tx.ToJson(); if (!(fullTxJson is JObject)) { throw new XrpParserException("Invalid transaction."); } JToken mainFieldsJson = fullTxJson.DeepClone(); foreach (JProperty element in fullTxJson.Children()) { string name = (element).Name; if ((name.ToLower() == "maxledgerversion") || (name.ToLower() == "maxledgerversionoffset") || (name.ToLower() == "flags") || (name.ToLower() == "sequence") || (name.ToLower() == "signingpubkey") || (name.ToLower() == "account")) { ((JObject)mainFieldsJson).Property(name).Remove(); } } htmlOutput += ParseElement((JContainer)mainFieldsJson, 0); htmlOutputWithDetails += ParseElement((JContainer)fullTxJson, 0); List <string> retVal = new List <string>(); retVal.Add(htmlOutput); retVal.Add(htmlOutputWithDetails); timeout = (info.remainingTime / 1000); return(retVal); }