Skip to content

Commit

Permalink
Adapt js_bindings.cpp to API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Jul 18, 2022
1 parent ca67548 commit 51f017c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions js_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@ std::string Props(const miniscript::NodeRef<std::string>& node, std::string in)
std::string Analyze(const miniscript::NodeRef<std::string>& node) {
switch (node->fragment) {
case miniscript::Fragment::PK_K: {
std::string str;
COMPILER_CTX.ToString(node->keys[0], str);
return Props(node, "pk_k(" + std::move(str) + ")");
return Props(node, "pk_k(" + (*COMPILER_CTX.ToString(node->keys[0])) + ")");
}
case miniscript::Fragment::PK_H: {
std::string str;
COMPILER_CTX.ToString(node->keys[0], str);
return Props(node, "pk_h(" + std::move(str) + ")");
return Props(node, "pk_h(" + (*COMPILER_CTX.ToString(node->keys[0])) + ")");
}
case miniscript::Fragment::MULTI: return Props(node, "multi(" + std::to_string(node->k) + " of " + std::to_string(node->keys.size()) + ")");
case miniscript::Fragment::AFTER: return Props(node, "after(" + std::to_string(node->k) + ")");
Expand Down Expand Up @@ -101,8 +97,7 @@ void miniscript_compile(const char* desc, char* msout, int msoutlen, char* costo
Output("[compile error]", asmout, asmoutlen);
return;
}
ret->ToString(COMPILER_CTX, str);
Output(Abbreviate(std::move(str)), msout, msoutlen);
Output(Abbreviate(*(ret->ToString(COMPILER_CTX))), msout, msoutlen);
std::string coststr = "<ul><li>Script: " + std::to_string(ret->ScriptSize()) + " WU</li><li>Input: " + std::to_string(avgcost) + " WU</li><li>Total: " + std::to_string(ret->ScriptSize() + avgcost) + " WU</li></ul>";
Output(coststr, costout, costoutlen);
Output(Disassemble(ret->ToScript(COMPILER_CTX)), asmout, asmoutlen);
Expand Down

0 comments on commit 51f017c

Please sign in to comment.