diff --git a/include/wrapping_dap_chain_common.h b/include/wrapping_dap_chain_common.h index 7feec9c36fdc987611c0422b2529acccabe93f0a..d73dede947bd83066b62b1d05192f6ef6ca880f5 100644 --- a/include/wrapping_dap_chain_common.h +++ b/include/wrapping_dap_chain_common.h @@ -2,6 +2,7 @@ #define _WRAPPING_DAP_CHAIN_COMMON_ #include <Python.h> #include "dap_chain_common.h" +#include "libdap_crypto_key_python.h" #ifdef __cplusplus extern "C" { @@ -73,10 +74,14 @@ typedef struct PyDapChainAddr{ PyObject *dap_chain_addr_to_str_py(PyObject *self, PyObject *args); PyObject *dap_chain_addr_from_str_py(PyObject *self, PyObject *args); +PyObject *dap_chain_addr_fill_py(PyObject *self, PyObject *args); +PyObject *dap_chain_addr_check_sum_py(PyObject *self, PyObject *args); PyMethodDef DapChainAddrMethods[] = { {"toStr", (PyCFunction)dap_chain_addr_to_str_py, METH_VARARGS, ""}, {"fromStr", (PyCFunction)dap_chain_addr_from_str_py, METH_VARARGS | METH_STATIC, ""}, + {"fill", (PyCFunction)dap_chain_addr_fill_py, METH_VARARGS, ""}, + {"checkSum", (PyCFunction)dap_chain_addr_check_sum_py, METH_VARARGS, ""}, {NULL, NULL, 0, NULL} }; diff --git a/src/wrapping_dap_chain_common.c b/src/wrapping_dap_chain_common.c index 21cf5647f80433645cc3de95525440edf64d5eac..9bb16e5d4ff20de9b1d9531a677f5e24e517f541 100644 --- a/src/wrapping_dap_chain_common.c +++ b/src/wrapping_dap_chain_common.c @@ -28,6 +28,19 @@ PyObject *dap_chain_addr_from_str_py(PyObject *self, PyObject *args){ return Py_BuildValue("O", obj); } +PyObject *dap_chain_addr_fill_py(PyObject *self, PyObject *args){ + PyObject *key; + PyObject *net_id; + if (!PyArg_ParseTuple(args, "O|O", &key, &net_id)) + return NULL; + dap_chain_addr_fill(((PyDapChainAddrObject*)self)->addr, ((PyCryptoKeyObject*)key)->key, &(((PyDapChainNetIdObject*)net_id)->net_id)); +} + +PyObject *dap_chain_addr_check_sum_py(PyObject *self, PyObject *args){ + int res = dap_chain_addr_check_sum(((PyDapChainAddrObject*)self)->addr); + return PyLong_FromLong(res); +} + PyObject *dap_chain_net_id_from_str_py(PyObject *self, PyObject *args){ const char *str; if (!PyArg_ParseTuple(args, "s", &str))