public JObject ToJObject() { return(new JObject { ["hash"] = Hash.ToJson(), ["ledger_index"] = LedgerIndex.ToJson(), ["meta"] = Meta.ToJson(), ["tx_json"] = Tx.ToJson(), }); }
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); } }
private static ShaMap ParseAccountState(JArray state) { var stateMap = new ShaMap(); var entries = state.Select((t) => { StObject so = t["json"]; Assert.AreEqual(t["binary"].ToString(), so.ToHex(), t.ToString() + " " + so.ToJson()); return(new LedgerEntry(so)); }); foreach (var ledgerEntry in entries) { stateMap.AddItem(ledgerEntry.Index(), ledgerEntry); } return(stateMap); }