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

[+] Added wrapping functions dap_chain_addr_fill and dap_chain_addr_check_sum

parent caac44a9
No related branches found
No related tags found
1 merge request!26Support 3689
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define _WRAPPING_DAP_CHAIN_COMMON_ #define _WRAPPING_DAP_CHAIN_COMMON_
#include <Python.h> #include <Python.h>
#include "dap_chain_common.h" #include "dap_chain_common.h"
#include "libdap_crypto_key_python.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -73,10 +74,14 @@ typedef struct PyDapChainAddr{ ...@@ -73,10 +74,14 @@ typedef struct PyDapChainAddr{
PyObject *dap_chain_addr_to_str_py(PyObject *self, PyObject *args); 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_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[] = { PyMethodDef DapChainAddrMethods[] = {
{"toStr", (PyCFunction)dap_chain_addr_to_str_py, METH_VARARGS, ""}, {"toStr", (PyCFunction)dap_chain_addr_to_str_py, METH_VARARGS, ""},
{"fromStr", (PyCFunction)dap_chain_addr_from_str_py, METH_VARARGS | METH_STATIC, ""}, {"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} {NULL, NULL, 0, NULL}
}; };
......
...@@ -28,6 +28,19 @@ PyObject *dap_chain_addr_from_str_py(PyObject *self, PyObject *args){ ...@@ -28,6 +28,19 @@ PyObject *dap_chain_addr_from_str_py(PyObject *self, PyObject *args){
return Py_BuildValue("O", obj); 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){ PyObject *dap_chain_net_id_from_str_py(PyObject *self, PyObject *args){
const char *str; const char *str;
if (!PyArg_ParseTuple(args, "s", &str)) if (!PyArg_ParseTuple(args, "s", &str))
......
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