| 90 | } |
| 91 | |
| 92 | static std::string ScriptToString(const CScript& Script, bool Long = false, bool Highlight = false, std::string hlClass = "hl") |
| 93 | { |
| 94 | if (Script.empty()) |
| 95 | return ""; |
| 96 | |
| 97 | CTxDestination Dest; |
| 98 | if (ExtractDestination(Script, Dest) && !Script.HasOpCall()) { |
| 99 | if (Highlight) |
| 100 | return "<span class=\"" + hlClass + "\">" + EncodeDestination(Dest) + "</span>"; |
| 101 | else |
| 102 | return makeHRef(EncodeDestination(Dest)); |
| 103 | } else if (Long) { |
| 104 | std::string out = FormatScript(Script); |
| 105 | // on SC create, can be very long, split data in multiple lines... |
| 106 | if (out.length() > 120) for (size_t p=79; p < out.length(); p += 80) { |
| 107 | out.insert(p, "\n"); |
| 108 | } |
| 109 | if (Script.HasOpCall()) out.insert(0, _("Call SC") + "<br/>"); |
| 110 | if (Script.HasOpCreate()) out.insert(0, _("Smart Contract") + "<br/>"); |
| 111 | return "<pre class=\"sc\">" + out + "</pre>"; |
| 112 | } else { |
| 113 | return _("unknown"); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | static std::string TimeToString(uint64_t Time) |
| 118 | { |
no test coverage detected