You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.3 KiB

# Wownero C++ Library
A C++ library for creating Wownero applications using native bindings to Wownero.
* Supports fully client-side wallets by wrapping wallet2.
* Supports multisig, view-only, and offline wallets.
* Query wallet transactions, transfers, and outputs by their properties.
* Receive notifications when wallets sync, send, or receive.
* Unit tests
Forked from [monero-cpp](https://github.com/woodser/monero-cpp) and modified, credits
go to the original author.
## Example usage
Install the following into, for example, `/usr/local/`:
5 years ago
1. [wownero-ng](https://git.wownero.com/dsc/wownero-ng/)
2. This repository
Install commands:
```bash
cmake -Bbuild .
make -Cbuild -j8 install
```
Then in your own project:
```cmake
find_package(wownero_cpp REQUIRED)
add_executable(test main.cpp)
target_link_libraries(test PUBLIC wownero_cpp)
```
5 years ago
```cpp
#include <iostream>
#include "wallet/wownero_wallet_full.h"
#include "utils/wownero_utils.h"
using namespace std;
wownero_wallet* wallet_restored = nullptr;
int main() {
// create a wallet from a seed phrase into /tmp/test.keys
wownero_wallet_config wallet_config;
wallet_config.m_seed = "afar industrial unafraid input ulcers innocent aggravate pulp insult sawmill ankle smash niece hydrogen mouth issued unusual pride fully identity fever hatchet knife knowledge issued";
wallet_config.m_path = "/tmp/test";
wallet_config.m_password = "";
wallet_config.m_network_type = wownero_network_type::MAINNET;
// configure your own remote node here
wallet_config.m_server = wownero_rpc_connection("http://10.1.0.10:34568", "", "");
wallet_config.m_restore_height = 610000;
wallet_config.m_seed_offset = "";
wallet_restored = wownero_wallet_full::create_wallet(wallet_config);
wallet_restored->save();
// synchronize the wallet and receive progress notifications
struct : wownero_wallet_listener {
void on_sync_progress(uint64_t height, uint64_t start_height, uint64_t end_height, double percent_done, const string& message) {
// feed a progress bar?
printf("%f", percent_done);
wallet_restored->save();
}
} my_sync_listener;
wallet_restored->sync(my_sync_listener);
// start syncing the wallet continuously in the background
wallet_restored->start_syncing();
return 0;
}
```