public async static Task <RippleTransactionInfo> GetXrpTransactionDetails(ConnectionState connectionState, CancellationToken token, TlsClientProtocol tls) { byte[] apdu = { 0x80, 0xE0, 0x00, 0x00 }; byte[] response; try { response = await SendWrappedAPDU(apdu, 7, connectionState, token, tls); } catch (Non9000SwException) { throw new TransactionNotActiveException(); } RippleTransactionInfo transactionInfo = new RippleTransactionInfo(); if (response[0] != 0x00) { transactionInfo.transactionTooBigToDisplay = true; } else { transactionInfo.transactionTooBigToDisplay = false; } transactionInfo.currentOffset = Helper.MakeUint16(response, 1); transactionInfo.remainingTime = Helper.MakeUint32(response, 3); return(transactionInfo); }
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); }