forked from toncenter/ton-http-api-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjson.cpp
More file actions
40 lines (33 loc) · 1.05 KB
/
Copy pathjson.cpp
File metadata and controls
40 lines (33 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <unistd.h>
#include "td/utils/logging.h"
#include "tonlib-multiclient/multi_client.h"
#include "tonlib-multiclient/request.h"
#include "tonlib/Logging.h"
int main(int argc, char* argv[]) {
tonlib::Logging::set_verbosity_level(3);
multiclient::MultiClient client(
multiclient::MultiClientConfig{
.global_config_path = std::filesystem::path("/tmp/global-config.json"),
.key_store_root = std::filesystem::path("/tmp/keystore"),
.scheduler_threads = 6,
}
);
sleep(5);
while (true) {
sleep(5);
LOG(INFO) << "send request";
auto resp = client.send_request_json(
multiclient::RequestJson{
.parameters = {.mode = multiclient::RequestMode::Broadcast},
.request =
R"({"@type":"getAccountState","account_address":{"@type":"accountAddress","account_address":"UQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqEBI"}})",
}
);
if (resp.is_error()) {
LOG(ERROR) << "resp: " << resp.error();
continue;
}
LOG(INFO) << "result: " << resp.move_as_ok();
}
return 0;
}