Skip to content

cogi-technology/nemoapi-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nemoapi

NEMO API implemented in C++ for both synchronous and asynchronous way.

REST API

Examples

Synchronous example

#include <nemoapi/nemoapi.h>

using namespace nemoapi;

int main(int argc, char* argv[]){
    std::string prv = '...';
    std::string account = '...';

    curl_global_init(CURL_GLOBAL_ALL);
    eddsa dsa(prv);
    rest::client_sync client(endpoint, dsa, access_key_id);
    rest::nft nft(client);
    client.balance(account, [=](status_e status, rest::err_t&& err, rest::hotwallet_balance_t&& res){
        //
    });
    curl_global_cleanup();
    return 0;
}

Asynchronous example

#include <nemoapi/nemoapi.h>

using namespace nemoapi;

int main(int argc, char* argv[]){
    std::string prv = '...';
    std::string account = '...';

    curl_global_init(CURL_GLOBAL_ALL);
    uv_loop_t* loop = uv_default_loop();

    eddsa dsa(prv);
    uv::http_client_pool_ptr pool(new uv::http_client(256, loop));
    rest::client_async client(endpoint, dsa, access_key_id, pool);
    rest::nft nft(client);
    client.balance(account, [=](status_e status, rest::err_t&& err, rest::hotwallet_balance_t&& res){
        //
    });
    uv_run(loop, UV_RUN_DEFAULT);
    uv_loop_close(loop);
    curl_global_cleanup();
    return 0;
}

More examples

Please see the source code in examples.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •