Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
c_bind.cpp
Go to the documentation of this file.
1#include "c_bind.hpp"
6#ifndef NO_MULTITHREADING
7#include <mutex>
8#endif
9
10namespace bb::bbapi {
11
12// Global BBApiRequest object in anonymous namespace
13namespace {
14// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
15BBApiRequest global_request;
16} // namespace
17
25{
26#ifndef BB_NO_EXCEPTIONS
27 try {
28#endif
29 // Execute the command using the global request and return the response
30 return execute(global_request, std::move(command));
31#ifndef BB_NO_EXCEPTIONS
32 } catch (const std::exception& e) {
33 return ErrorResponse{ .message = e.what() };
34 }
35#endif
36}
37
38} // namespace bb::bbapi
39
40// Use CBIND macro to export the bbapi function for WASM
Shared type definitions for the Barretenberg RPC API.
A wrapper around std::variant that provides msgpack serialization based on type names.
#define CBIND_NOSCHEMA(cname, func)
CommandResponse execute(BBApiRequest &request, Command &&command)
Executes a command by visiting a variant of all possible commands.
CommandResponse bbapi(Command &&command)
Main API function that processes commands and returns responses.
Definition c_bind.cpp:24
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Error response returned when a command fails.