setStoreData function
Implementation
TTGraphData setStoreData(TTGraphData graph) {
if (InitStorage.hiveOpenBox == null ||
InitStorage.hiveOpenBox!.isOpen == false) {
throw ("Initialize TipTool storage using: `await initializeTTStore()`");
}
final TTGraphData unpackedGraph = graph;
for (final soul in graph.keys) {
TTNode? node;
if (InitStorage.hiveOpenBox!.containsKey(soul)) {
TTNode tempNode =
TTNode.fromJson(jsonDecode(InitStorage.hiveOpenBox?.get(soul)));
node = mergeTTNodes(tempNode, graph[soul]);
node?.nodeMetaData = graph[soul]?.nodeMetaData;
} else {
node = graph[soul];
}
InitStorage.hiveOpenBox?.put(soul, jsonEncode(node));
unpackedGraph[soul] = node;
}
return unpackedGraph;
}