Skip to content

SarahIsWeird/libduco

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libduco

libduco is an easy-to-use C interface to the Duinocoin API. It's written in pure C89 for maximum compatibility! libduco makes use of native Windows/Linux API calls. Less dependencies, more speed!

Wrapping DUCO isn't supported, and it will never be, unless there is high demand for it.

License

libduco, Copyright (c) 2021 Sarah Klocke

This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the LICENSE.md file for more details.

Prebuilt binaries

Please check the Releases page for prebuilt binaries. There are Windows and Linux binaries available.

Building from source

Prerequisites:

  • a C compiler (gcc/clang preferred, MSVC should work too)
  • make

Building should be simple.

git clone github.com/SarahIsWeird/libduco.git
make

Installing (Linux only)

There are installation/uninstallation targets available.

sudo make install

This will install libduco to /usr/lib/libduco.so and /usr/include/duco.h. If you want to uninstall libduco, just run this:

sudo make uninstall

Features

This is a list of the current implementation status of various features. For more information about any specific function, please check the docstrings either through your IDE or in the header file.

  • Account-related features
    • Logging in (duco_login())
    • Registering a new user (duco_register())
    • Changing the password (duco_change_password())
  • Balance-related features
    • Getting the current balance (duco_get_balance())
    • Sending Duinocoin to another user (duco_send_balance())
  • Other features
    • Getting a list of past transactions (duco_get_transactions() or duco_get_transactions_from())
    • Native Windows support

Usage example

This example program can be compiled with gcc -o example example.c -lduco.

#include <stdio.h>
#include <duco.h>

int main(int argc, char** argv) {
    duco_connection_t* conn = duco_connect(DUCO_POOL_ADDR, DUCO_POOL_PORT);

    duco_login(conn, "user", "123");

    double balance = duco_get_balance(conn);

    if (balance == -1) {
        duco_perror("Couldn't get the balance");
        return 1;
    }

    printf("%s's current balance: %f", conn->username, balance);

    duco_disconnect(conn);

    return 0;
}

About

An easy-to-use C interface to the Duinocoin API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published