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

[+] Added wrapping function dap_chain_node_addr_by_alias of dap_chain_node_cli_cmd

parent b245c75c
No related branches found
No related tags found
1 merge request!26Support 3689
......@@ -4,6 +4,9 @@
#include <Python.h>
#include "dap_config.h"
#include "dap_chain_node_cli.h"
#include "dap_chain_node_cli_cmd.h"
#include "wrapping_dap_chain_common_objects.h"
#include "wrapping_dap_chain_net_node.h"
#ifdef __cplusplus
extern "C"{
......@@ -23,9 +26,12 @@ PyObject *DapChainNodeCliObject_new(PyTypeObject *type_object, PyObject *args, P
PyObject *dap_chain_node_cli_cmd_item_create_py(PyObject *self, PyObject *args);
PyObject *dap_chain_node_cli_set_reply_text_py(PyObject *self, PyObject *args);
PyObject *dap_chain_node_addr_get_by_alias_py(PyObject *self, PyObject *args);
static PyMethodDef DapChainNodeCliMethods[] = {
{"cmdItemCreate", dap_chain_node_cli_cmd_item_create_py, METH_VARARGS, ""},
{"setReplyText", dap_chain_node_cli_set_reply_text_py, METH_VARARGS, ""},
{"getByAlias", dap_chain_node_addr_get_by_alias_py, METH_VARARGS | METH_STATIC, ""},
{NULL, NULL, 0, NULL}
};
......
......@@ -59,6 +59,16 @@ PyObject *dap_chain_node_cli_set_reply_text_py(PyObject *self, PyObject *args){
return PyLong_FromLong(0);
}
PyObject *dap_chain_node_addr_get_by_alias_py(PyObject *self, PyObject *args){
PyObject *chain_net;
const char *alias;
if (!PyArg_ParseTuple(args, "O|s", &chain_net, &alias))
return NULL;
PyObject *obj_node_addr = _PyObject_New(&DapChainNodeAddrObject_DapChainNodeAddrObjectType);
((PyDapChainNodeAddrObject*)obj_node_addr)->node_addr = dap_chain_node_addr_get_by_alias(((PyDapChainNetObject*)chain_net)->chain_net, alias);
return Py_BuildValue("O", obj_node_addr);
}
char **PyListToString(PyObject *list){
Py_ssize_t size = PyList_Size(list);
char **res = calloc(sizeof(char**), (size_t)size);
......
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