-
Notifications
You must be signed in to change notification settings - Fork 215
Api faucet
syl edited this page Oct 31, 2020
·
6 revisions
pplx::task<web::http::http_response>
claim(const claim_request& claim_request);
Requests the faucet API to get test coins like RICK or MORTY. A task containing a http_response is returned. It takes a claim_request object as first parameter.
[[nodiscard]]
claim_result get_claim_result(const web::http::http_response& claim_response);
Returns a valid claim_result object corresponding to the response returned by the claim function.
std::string coin_name // Name of the test coin used for faucet claiming (e.g. "RICK")
std::string wallet_address // Address of the chosen test coin wallet
std::string message; // The message returned by the claim request.
std::string status; // The status returned by the claim request.
faucet::api::claim_request claim_request {.coin_name = coin_info.ticker,
.wallet_address = mm2_system.address(ticker, ec)};
faucet::api::claim(claim_request)
.then([this](web::http::http_response resp) {
auto claim_result = faucet::api::get_claim_result(resp);
spdlog::info("Faucet result is: \"{}\"", claim_result.message);
});