Skip to content
Snippets Groups Projects
Commit d47fc417 authored by alexey.stratulat's avatar alexey.stratulat
Browse files

[+] Creating based for wrapping libdap-chain-wallet.

parent 64b6ac57
No related branches found
No related tags found
1 merge request!1Features 2773
project(dap_chain_wallet_python_module C)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_COLOR_MAKEFILE ON)
set(CMAKE_C_STANDARD 11)
add_definitions("-fpic")
add_definitions("-DDAP_LOG_MT")
file(GLOB CHAIN_WALLET_PYTHON_SRCS src/*.c)
file(GLOB CHAIN_WALLET_PYTHON_HEADERS include/*.h)
set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4)
find_package (PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIR} include/)
add_library(${PROJECT_NAME} STATIC ${CHAIN_WALLET_PYTHON_SRCS} ${CHAIN_WALLET_PYTHON_HEADERS})
target_link_libraries(${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} dap_core dap_crypto dap_chain dap_chain_crypto dap_chain_net dap_chain_wallet )
target_include_directories(${PROJECT_NAME} PUBLIC include/ )
#ifndef _DAP_CHAIN_WALLET_PYTHON_
#define _DAP_CHAIN_WALLET_PYTHON_
#include <Python.h>
#include "dap_common.h"
#include "dap_chain_wallet.h"
#ifdef __cplusplus
extern "C"{
#endif
#undef LOG_TAG
#define LOG_TAG "dap_chain_wallet_python"
typedef struct PyDapChainWallet{
PyObject_HEAD
dap_chain_wallet_t *wallet;
}PyDapChainWalletObject;
int dap_chain_wallet_init_py(void);
void dap_chain_wallet_deinit_py(void);
PyObject *dap_chain_wallet_get_path_py(PyObject *self, PyObject *argv);
PyObject *dap_chain_wallet_create_with_seed_py(PyObject *self, PyObject *argv);
PyObject *dap_chain_wallet_create_py(PyObject *self, PyObject *argv);
PyObject *dap_chain_wallet_open_file_py(PyObject *self, PyObject *argv);
PyObject *dap_chain_wallet_open_py(PyObject *self, PyObject *argv);
PyObject *dap_chain_wallet_save_py(PyObject *self, PyObject *argv);
PyObject *dap_chain_wallet_close_py(PyObject *self, PyObject *argv);
PyObject *dap_cert_to_addr_py(PyObject *self, PyObject *argv);
PyObject *dap_chain_wallet_get_addr_py(PyObject *self, PyObject *argv);
PyObject *dap_chain_wallet_get_certs_number_py(PyObject *self, PyObject *argv);
PyObject *dap_chain_wallet_get_pkey_py(PyObject *self, PyObject *argv);
PyObject *dap_chain_wallet_get_key_p(PyObject *self, PyObject *argv);
PyObject *dap_chain_wallet_save_file_py(PyObject *self, PyObject *argv);
static PyMethodDef ChainWalletMethods[] = {
{NULL, NULL, 0, NULL}
};
static PyTypeObject DapChainWallet_dapChainWalletType = {
PyVarObject_HEAD_INIT(NULL, 0)
"ChainWallet", /* tp_name */
sizeof(PyDapChainWalletObject), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT |
Py_TPFLAGS_BASETYPE, /* tp_flags */
"Chain wallet object", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ChainWalletMethods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
PyType_GenericNew, /* tp_new */
0, /* tp_free */
0, /* tp_is_gc*/
0, /* tp_bases*/
0, /* tp_mro */
0, /* tp_cache */
0, /* tp_subclasses */
0, /* tp_weaklist */
0, /* tp_del */
0, /* tp_version_tag*/
0, /* tp_finalize*/
};
#ifdef __cplusplus
}
#endif
#endif // _DAP_CHAIN_WALLET_PYTHON_
#include "dap_chain_wallet_python.h"
int dap_chain_wallet_init_py(void){
return dap_chain_wallet_init();
}
void dap_chain_wallet_deinit_py(void){
dap_chain_wallet_deinit();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment