MCPcopy Create free account
hub / github.com/LUX-Core/lux / ScriptToString

Function ScriptToString

src/qt/blockexplorer.cpp:92–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92static 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
117static std::string TimeToString(uint64_t Time)
118{

Callers 2

TxToRowFunction · 0.85
TxToStringFunction · 0.85

Calls 10

ExtractDestinationFunction · 0.85
EncodeDestinationFunction · 0.85
makeHRefFunction · 0.85
FormatScriptFunction · 0.85
_Function · 0.85
HasOpCallMethod · 0.80
HasOpCreateMethod · 0.80
emptyMethod · 0.45
lengthMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected