diff --git a/modules/cellframe-sdk/net/include/libdap_chain_net_python.h b/modules/cellframe-sdk/net/include/libdap_chain_net_python.h index d6bf30b29fef57a72b4176029e2a69859ea9d3c3..36c62ceb9d7c44e047199db6bf0ae28af9cd22ea 100644 --- a/modules/cellframe-sdk/net/include/libdap_chain_net_python.h +++ b/modules/cellframe-sdk/net/include/libdap_chain_net_python.h @@ -77,6 +77,7 @@ PyObject *dap_chain_net_get_chain_by_chain_type_py(PyObject *self, PyObject *arg PyObject *dap_chain_net_get_ledger_py(PyObject *self, PyObject *args); PyObject *dap_chain_net_get_name_py(PyObject *self, PyObject *args); PyObject *dap_chain_net_get_tx_by_hash_py(PyObject *self, PyObject *args); +PyObject *dap_chain_net_python_get_id(PyObject *self, void *closure); static PyMethodDef DapChainNetMethods[] = { {"loadAll", dap_chain_net_load_all_py, METH_NOARGS | METH_STATIC, ""}, @@ -105,6 +106,11 @@ static PyMethodDef DapChainNetMethods[] = { {NULL, NULL, 0, NULL} }; +static PyGetSetDef DapChainNetGetsSetsDef[] = { + {"id", (getter)dap_chain_net_python_get_id, NULL, NULL, NULL}, + {NULL} +}; + static PyTypeObject DapChainNetObject_DapChainNetObjectType = { PyVarObject_HEAD_INIT(NULL, 0) "CellFrame.ChainNet", /* tp_name */ @@ -134,9 +140,9 @@ static PyTypeObject DapChainNetObject_DapChainNetObjectType = { 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - DapChainNetMethods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ + DapChainNetMethods, /* tp_methods */ + 0, /* tp_members */ + DapChainNetGetsSetsDef, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ diff --git a/modules/cellframe-sdk/net/src/libdap_chain_net_python.c b/modules/cellframe-sdk/net/src/libdap_chain_net_python.c index 3f81f3f6c6768137b18d858622374ea0b88959fe..5d1a0c8d97d7bd6137adcefe3ee77344c6d7d6f2 100644 --- a/modules/cellframe-sdk/net/src/libdap_chain_net_python.c +++ b/modules/cellframe-sdk/net/src/libdap_chain_net_python.c @@ -183,3 +183,11 @@ PyObject *dap_chain_net_get_tx_by_hash_py(PyObject *self, PyObject *args){ } return (PyObject*)obj_tx; } + +PyObject *dap_chain_net_python_get_id(PyObject *self, void *closure){ + (void)closure; + PyDapChainNetIdObject *obj_net_id = PyObject_New(PyDapChainNetObject, &DapChainNetIdObject_DapChainNetIdObjectType); + PyObject_Dir((PyObject*)obj_net_id); + obj_net_id->net_id = ((PyDapChainNetObject*)self)->chain_net->pub.id; + return (PyObject*)obj_net_id; +}