Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,7 @@ int main(int argc, char** argv) {
tx.to_ = contract_addr;
tx.amount = "0";
tx.nonce = nonce + 1;
tx.ou = parse_ou(body, "50000000");
tx.ou = parse_ou(body, "200000");
tx.timestamp = now_ts();
tx.op_type = "deploy";
tx.encrypted_data = bytecode;
Expand Down Expand Up @@ -2036,6 +2036,39 @@ int main(int argc, char** argv) {
res.set_content(r.result.dump(), "application/json");
});

svr.Post("/api/contract/view", [](const httplib::Request& req, httplib::Response& res) {
WALLET_GUARD
json body;
try { body = json::parse(req.body); } catch (...) {
res.status = 400;
res.set_content(err_json("invalid json").dump(), "application/json");
return;
}
std::string addr = body.value("address", "");
std::string method = body.value("method", "");
if (addr.empty() || method.empty()) {
res.status = 400;
res.set_content(err_json("address and method required").dump(), "application/json");
return;
}
json params = json::array();
if (body.contains("params")) {
params = body["params"];
if (!params.is_array()) {
res.status = 400;
res.set_content(err_json("params must be an array").dump(), "application/json");
return;
}
}
auto r = g_rpc.contract_call_view(addr, method, params, g_wallet.addr);
if (!r.ok) {
res.status = 400;
res.set_content(err_json(r.error).dump(), "application/json");
return;
}
res.set_content(r.result.dump(), "application/json");
});

svr.Post("/api/fhe/encrypt", [](const httplib::Request& req, httplib::Response& res) {
WALLET_GUARD
if (!g_pvac_ok) {
Expand Down Expand Up @@ -2374,4 +2407,4 @@ int main(int argc, char** argv) {
printf("octra_wallet listening on http://127.0.0.1:%d\n", port);
svr.listen("127.0.0.1", port);
return 0;
}
}
228 changes: 212 additions & 16 deletions static/bridge.html

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@
<div class="ide-picker-title">apps</div>
<div class="ide-picker-actions">
<button class="action-btn" onclick="window.open('bridge.html','_blank')"><span class="tpl-label">bridge</span><span class="tpl-desc">alpha version of the experimental bridge between octra &lt;&gt; eth</span></button>
<button class="action-btn" onclick="window.open('private-credit-score.html','_blank')"><span class="tpl-label">private credit score</span><span class="tpl-desc">encrypted scoring with local decrypt</span></button>
</div>
</div>

Expand Down Expand Up @@ -344,6 +345,7 @@
<option value="amm">Swap AMM</option>
<option value="escrow">Escrow</option>
<option value="multisig">Multisig</option>
<option value="private_credit">Private Credit Score</option>
</select>
</div>
<div id="ct-compile-result"></div>
Expand Down Expand Up @@ -550,4 +552,4 @@
</div>
<script src="wallet.js?v=10"></script>
</body>
</html>
</html>
Loading