public static JObject Web3Trie(IDictionary <ulong, IHashTrieNode> trie) { var jsonTrie = new JObject { }; foreach (var item in trie) { var version = item.Key; var node = item.Value; jsonTrie[Web3Number(version)] = Web3DataFormatUtils.Web3Node(node); } return(jsonTrie); }
public JObject GetChildrenByVersion(string versionTag) { var version = GetVersionNumberByTag(versionTag); if (version == null) { return new JObject { } } ; var node = _nodeRetrieval.TryGetNode((ulong)version); if (node == null) { return new JObject { } } ; JArray children = new JArray { }; if (node.Type == NodeType.Internal) { foreach (var childId in node.Children) { var child = _nodeRetrieval.TryGetNode(childId); if (child == null) { return new JObject { } } ; children.Add(Web3DataFormatUtils.Web3Node(child)); } } JObject nodeWithChildren = new JObject { }; nodeWithChildren[Web3DataFormatUtils.Web3Number((ulong)version)] = children; return(nodeWithChildren); }
public JObject GetNodeByVersion(string versionTag) { var version = GetVersionNumberByTag(versionTag); if (version == null) { return new JObject { } } ; var node = _nodeRetrieval.TryGetNode((ulong)version); if (node == null) { return new JObject { } } ; return(Web3DataFormatUtils.Web3Node(node)); }