Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cellframe/python-cellframe
1 result
Show changes
Commits on Source (3)
Showing
with 861 additions and 81 deletions
......@@ -37,6 +37,7 @@ add_subdirectory(modules/dap-sdk/net/core)
add_subdirectory(modules/dap-sdk/net/client)
add_subdirectory(modules/dap-sdk/net/server/enc)
add_subdirectory(modules/dap-sdk/net/server/http)
add_subdirectory(modules/dap-sdk/net/server/json_rpc)
add_subdirectory(modules/cellframe-sdk/common)
add_subdirectory(modules/cellframe-sdk/net)
add_subdirectory(modules/cellframe-sdk/gdb)
......@@ -180,6 +181,7 @@ target_link_libraries(${PROJECT_NAME} cellframe-sdk dap_python_module
dap_chain_gdb_python_module
dap_app_cli_python_module
dap_chain_wallet_python_module
dap_server_json_rpc_python_module
${PYTHON_LIBRARIES}
)
......
......@@ -368,17 +368,20 @@ PyObject *python_cellframe_init(PyObject *self, PyObject *args){
PyMODINIT_FUNC PyInit_libCellFrame(void){
if ( PyType_Ready( &DapCoreObjectType ) < 0 ||
PyType_Ready( &g_crypto_type_py ) < 0 ||
PyType_Ready( &g_crypto_cert_type_py ) < 0 ||
PyType_Ready( &g_crypto_type_py ) < 0 ||
PyType_Ready( &g_crypto_cert_type_py ) < 0 ||
PyType_Ready( &ServerCore_ServerCoreType ) < 0 ||
PyType_Ready( &dapEvents_dapEventsType ) < 0 ||
PyType_Ready( &dapEventsSocket_dapEventsSocketType ) < 0 ||
PyType_Ready( &CryptoKeyTypeObjecy_CryptoKeyTypeObjecyType ) < 0 ||
PyType_Ready( &CryptoDataTypeObjecy_CryptoDataTypeObjecyType ) < 0 ||
PyType_Ready(&DapSignObject_DapSignObjectType) < 0 ||
PyType_Ready(&DapSignTypeObject_DapSignTypeObjectType) < 0 ||
// === Chain ===
PyType_Ready( &dapChainObject_dapChainType ) < 0 ||
PyType_Ready( &dapChainTypeObject_dapChainTypeType ) < 0 ||
PyType_Ready( &dapChainAtomPtr_dapChainAtomPtrType ) < 0 ||
PyType_Ready( &DapChainAtomIter_DapChainAtomIterType ) < 0 ||
PyType_Ready(&DapChainAtomPtr_DapChainAtomPtrType) < 0 ||
PyType_Ready( &DapChainCell_DapChainCellObjectType ) < 0 ||
// PyType_Ready(&ChainCommonObject_ChainCommonType) < 0 ||
......@@ -395,12 +398,22 @@ PyMODINIT_FUNC PyInit_libCellFrame(void){
PyType_Ready( &DapChainDatumObject_DapChainDatumObjectType) < 0 ||
PyType_Ready(&DapChainDatumIterObject_DapChainDatumIterObjectType) < 0 ||
PyType_Ready(&DapChainDatumToken_DapChainDatumTokenObjectType) < 0 ||
PyType_Ready(&DapChainTxTokenExt_DapChainTxTokenExtType) < 0 ||
PyType_Ready(&DapChainDatumTokenEmission_DapChainDatumTokenEmissionObjectType) < 0 ||
PyType_Ready(&DapChainTxItemObject_DapChainTxItemTypeObjectType) < 0 ||
PyType_Ready(&DapChainTxCondType_DapChainTxCondTypeObject) < 0 ||
PyType_Ready(&DapChainDatumTx_DapChainDatumTxObjectType) < 0 ||
PyType_Ready(&DapChainTxOutCond_DapChainTxOutCondObjectType) < 0 ||
PyType_Ready(&DapChainTxOutCond_DapChainTxOutCondType) < 0 ||
PyType_Ready(&DapChainTxOutCondSubTypeSrvPay_DapChainTxOutCondSubTypeSrvPayObject) < 0 ||
PyType_Ready(&DapChainTxOutCondSubTypeSrvStake_DapChainTxOutCondSubTypeSrvStakeObject) < 0 ||
PyType_Ready(&DapChainTxOutCondSubTypeSrvXchange_DapChainTxOutCondSubTypeSrvXchangeObject) < 0 ||
PyType_Ready(&DapChainLedger_DapChainLedgerType) < 0 ||
PyType_Ready(&DapChainTxInObject_DapChainTxInTypeObjectType) < 0 ||
PyType_Ready(&DapChainTxInCondObject_DapChainTxInCondTypeObjectType) < 0 ||
PyType_Ready(&DapChainTxOutObject_DapChainTxOutTypeObjectType) < 0 ||
PyType_Ready(&DapChainTxPkeyObject_DapChainTxPkeyTypeObjectType) < 0 ||
PyType_Ready(&DapChainTxReceiptObject_DapChainTxReceiptTypeObjectType) < 0 ||
PyType_Ready(&DapChainTxOutExtObject_DapChainTxOutExtTypeObjectType) < 0 ||
// =============
// === Chain net ===
PyType_Ready(&DapChainNetObject_DapChainNetObjectType) < 0 ||
......@@ -422,6 +435,8 @@ PyMODINIT_FUNC PyInit_libCellFrame(void){
PyType_Ready(&DapAppCli_dapAppCliType ) < 0 ||
PyType_Ready(&DapChainWallet_dapChainWalletType) < 0 ||
PyType_Ready(&HTTPCode_HTTPCodeType) < 0 ||
PyType_Ready(&DapJSONRPCRequest_DapJSONRPCRequestType) < 0 ||
PyType_Ready(&DapJSONRPCResponse_DapJSONRPCResponseType) < 0 ||
#ifdef DAP_SUPPORT_PYTHON_PLUGINS
PyType_Ready(&DapHTTPSimple_DapHTTPSimpleType) < 0 ||
PyType_Ready(&dapAppContext_dapAppContextType) < 0
......@@ -453,6 +468,8 @@ PyMODINIT_FUNC PyInit_libCellFrame(void){
PyModule_AddObject(module, "Crypto", (PyObject*)&g_crypto_type_py);
PyModule_AddObject(module, "Cert", (PyObject*)&g_crypto_cert_type_py);
PyModule_AddObject(module, "SignType", (PyObject*)&DapSignTypeObject_DapSignTypeObjectType);
PyModule_AddObject(module, "Sign", (PyObject*)&DapSignObject_DapSignObjectType);
PyModule_AddObject(module, "ServerCore", (PyObject*)&ServerCore_ServerCoreType);
PyModule_AddObject(module, "Events", (PyObject*)&dapEvents_dapEventsType);
......@@ -464,7 +481,8 @@ PyMODINIT_FUNC PyInit_libCellFrame(void){
// === Chain ===
PyModule_AddObject(module, "Chain", (PyObject*)&dapChainObject_dapChainType);
PyModule_AddObject(module, "ChainType", (PyObject*)&dapChainTypeObject_dapChainTypeType);
PyModule_AddObject(module, "ChainAtomIter", (PyObject*)&dapChainAtomPtr_dapChainAtomPtrType);
PyModule_AddObject(module, "ChainAtomIter", (PyObject*)&DapChainAtomIter_DapChainAtomIterType);
PyModule_AddObject(module, "ChainAtomPtr", (PyObject*)&DapChainAtomPtr_DapChainAtomPtrType);
PyModule_AddObject(module, "ChainCell", (PyObject*)&DapChainCell_DapChainCellObjectType);
// PyModule_AddObject(module, "ChainCommon", (PyObject*)&ChainCommonObject_ChainCommonType);
......@@ -482,15 +500,25 @@ PyMODINIT_FUNC PyInit_libCellFrame(void){
PyModule_AddObject(module, "ChainDatum", (PyObject*)&DapChainDatumObject_DapChainDatumObjectType);
PyModule_AddObject(module, "ChainDatumIter", (PyObject*)&DapChainDatumIterObject_DapChainDatumIterObjectType);
PyModule_AddObject(module, "ChainDatumToken", (PyObject*)&DapChainDatumToken_DapChainDatumTokenObjectType);
PyModule_AddObject(module, "ChainDatumTokenExt", (PyObject*)&DapChainTxTokenExt_DapChainTxTokenExtType);
PyModule_AddObject(module, "ChainDatumTokenEmisson", (PyObject*)&DapChainDatumTokenEmission_DapChainDatumTokenEmissionObjectType);
PyModule_AddObject(module, "ChainTxItemType", (PyObject*)&DapChainTxItemObject_DapChainTxItemTypeObjectType);
PyModule_AddObject(module, "ChainTxCondType", (PyObject*)&DapChainTxCondType_DapChainTxCondTypeObject);
PyModule_AddObject(module, "ChainDatumTx", (PyObject*)&DapChainDatumTx_DapChainDatumTxObjectType);
PyModule_AddObject(module, "ChainTxOutCond", (PyObject*)&DapChainTxOutCond_DapChainTxOutCondObjectType);
PyModule_AddObject(module, "ChainTxOutCond", (PyObject*)&DapChainTxOutCond_DapChainTxOutCondType);
PyModule_AddObject(module, "ChainTxOutCondSubtypeSrvPay", (PyObject*)&DapChainTxOutCondSubTypeSrvPay_DapChainTxOutCondSubTypeSrvPayObject);
PyModule_AddObject(module, "ChainTxOutCondSubtypeSrvStake", (PyObject*)&DapChainTxOutCondSubTypeSrvStake_DapChainTxOutCondSubTypeSrvStakeObject);
PyModule_AddObject(module, "ChainTxOutCondSubtypeSrvXchange", (PyObject*)&DapChainTxOutCondSubTypeSrvXchange_DapChainTxOutCondSubTypeSrvXchangeObject);
PyModule_AddObject(module, "ChainLedger", (PyObject*)&DapChainLedger_DapChainLedgerType);
PyModule_AddObject(module, "ChainTxIn", (PyObject*)&DapChainTxInObject_DapChainTxInTypeObjectType);
PyModule_AddObject(module, "ChainTxInCond", (PyObject*)&DapChainTxInCondObject_DapChainTxInCondTypeObjectType);
PyModule_AddObject(module, "ChainTxOut", (PyObject*)&DapChainTxOutObject_DapChainTxOutTypeObjectType);
PyModule_AddObject(module, "ChainTxPkey", (PyObject*)&DapChainTxPkeyObject_DapChainTxPkeyTypeObjectType);
PyModule_AddObject(module, "ChainTxReceipt", (PyObject*)&DapChainTxReceiptObject_DapChainTxReceiptTypeObjectType);
PyModule_AddObject(module, "ChainTxOutExt", (PyObject*)&DapChainTxOutExtObject_DapChainTxOutExtTypeObjectType);
// =============
// === Chain net ===
// PyModule_AddObject(module, "ChainNet", (PyObject*)&DapChainNetObject_DapChainNetObjectType);
PyModule_AddObject(module, "ChainNet", (PyObject*)&DapChainNetObject_DapChainNetObjectType);
PyModule_AddObject(module, "ChainNodeClient", (PyObject*)&DapChainNodeClientObject_DapChainNodeClientObjectType);
PyModule_AddObject(module, "ChainNodeInfo", (PyObject*)&DapChainNodeInfoObject_DapChainNodeInfoObjectType);
PyModule_AddObject(module, "ChainNetNode", (PyObject*)&DapChainNetNodeObject_DapChainNetNodeObjectType);
......@@ -514,6 +542,8 @@ PyMODINIT_FUNC PyInit_libCellFrame(void){
#ifdef DAP_SUPPORT_PYTHON_PLUGINS
PyModule_AddObject(module, "AppContext", (PyObject*)&dapAppContext_dapAppContextType);
#endif
PyModule_AddObject(module, "JSONRPCRequest", (PyObject*)&DapJSONRPCRequest_DapJSONRPCRequestType);
PyModule_AddObject(module, "JSONRPCResponse", (PyObject*)&DapJSONRPCResponse_DapJSONRPCResponseType);
return module;
}
......
......@@ -5,6 +5,7 @@
#include "libdap-server-core-python.h"
#include "libdap_crypto_key_type_python.h"
#include "libdap_crypto_data_type.h"
#include "wrapping_dap_sign.h"
// === CHAIN ==
#include "libdap-chain-python.h"
#include "libdap_chain_type_python.h"
......@@ -14,9 +15,20 @@
#include "wrapping_dap_chain_cs.h"
#include "wrapping_dap_chain_datum.h"
#include "wrapping_dap_chain_datum_token.h"
#include "wrapping_dap_chain_tx_token_ext.h"
#include "wrapping_dap_chain_datum_tx.h"
#include "wrapping_dap_chain_ledger.h"
#include "wrapping_dap_chain_datum_tx.h"
#include "wrapping_dap_chain_tx_in.h"
#include "wrapping_dap_chain_tx_in_cond.h"
#include "wrapping_dap_chain_tx_out.h"
#include "wrapping_dap_chain_tx_out_cond.h"
#include "wrapping_dap_chain_tx_out_cond_subtype_srv_pay.h"
#include "wrapping_dap_chain_tx_out_cond_subtype_srv_stake.h"
#include "wrapping_dap_chain_tx_out_cond_subtype_srv_xchange.h"
#include "wrapping_dap_chain_tx_pkey.h"
#include "wrapping_dap_chain_tx_receipt.h"
#include "wrapping_dap_chain_tx_out_ext.h"
// ============
// === Chain net ===
#include "libdap_chain_net_python.h"
......@@ -38,6 +50,7 @@
//#include "dap_http_client_simple.h"
//#include "dap_chain_wallet.h"
#include "dap_chain_cs.h"
#include "wrapping_dap_chain_atom_ptr.h"
//#include "dap_chain_cs_dag.h"
//#include "dap_chain_cs_dag_poa.h"
//#include "dap_chain_cs_dag_pos.h"
......@@ -61,6 +74,8 @@
#include "dap_common.h"
#include "dap_server.h"
#include "wrapping_json_rpc_request.h"
#include "wrapping_json_rpc_response.h"
#ifdef _WIN32
#include "Windows.h"
......
......@@ -8,6 +8,10 @@
#include "dap_chain_node_client.h"
#include "wrapping_dap_chain_ledger.h"
#include "wrapping_dap_chain_common.h"
#include "libdap_chain_atom_iter_python.h"
#include "wrapping_dap_chain_atom_ptr.h"
#include "wrapping_dap_chain_datum.h"
#include "wrapping_dap_chain_cell.h"
typedef struct PyDapChain{
......@@ -31,13 +35,21 @@ PyObject *dap_chain_load_from_cfg_py(PyObject *self, PyObject *args);
//PyObject *dap_chain_init_net_cfg_name_py(PyObject *self, PyObject *args); //dap_chain_init_net_cfg_name
//PyObject *dap_chain_close_py(PyObject *self, PyObject *args);
//PyObject *dap_chain_info_dump_log_py(PyObject *self, PyObject *args); //dap_chain_info_dump_log
PyObject *dap_chain_python_create_atom_iter(PyObject *self, PyObject *args);
PyObject *dap_chain_python_atom_iter_get_first(PyObject *self, PyObject *args);
PyObject *dap_chain_python_atom_get_datums(PyObject *self, PyObject *args);
PyObject *dap_chain_python_atom_iter_get_next(PyObject *self, PyObject *args);
static PyMethodDef DapChainMethods[] = {
{"findById", (PyCFunction)dap_chain_find_by_id_py, METH_VARARGS|METH_STATIC, ""},
{"loadFromCfg", (PyCFunction)dap_chain_has_file_store_py, METH_VARARGS|METH_STATIC, ""},
{"loadFromCfg", (PyCFunction)dap_chain_load_from_cfg_py, METH_VARARGS|METH_STATIC, ""},
{"hasFileStore", (PyCFunction)dap_chain_has_file_store_py, METH_NOARGS, ""},
{"saveAll", (PyCFunction)dap_chain_save_all, METH_NOARGS, ""},
{"saveAll", (PyCFunction) dap_chain_save_all_py, METH_NOARGS, ""},
{"loadAll", (PyCFunction)dap_chain_load_all_py, METH_NOARGS, ""},
{"createAtomItem", (PyCFunction) dap_chain_python_create_atom_iter, METH_VARARGS, ""},
{"atomIterGetFirst", (PyCFunction) dap_chain_python_atom_iter_get_first, METH_VARARGS, ""},
{"atomGetDatums", (PyCFunction) dap_chain_python_atom_get_datums, METH_VARARGS, ""},
{"atomIterGetNext", (PyCFunction)dap_chain_python_atom_iter_get_next, METH_VARARGS, ""},
//{"close", (PyCFunction)dap_chain_close_py, METH_NOARGS, ""},
{NULL, NULL, 0, NULL}
};
......
......@@ -7,7 +7,7 @@
extern "C" {
#endif
typedef struct PyChainAtomPtr{
typedef struct PyChainAtomIter{
PyObject_HEAD
dap_chain_atom_iter_t *atom_iter;
} PyChainAtomIterObject;
......@@ -16,7 +16,7 @@ static PyMethodDef DapChainAtomIterMethods[] = {
{NULL, NULL, 0, NULL}
};
static PyTypeObject dapChainAtomPtr_dapChainAtomPtrType = {
static PyTypeObject DapChainAtomIter_DapChainAtomIterType = {
PyVarObject_HEAD_INIT(NULL, 0)
"CellFrame.Chain.AtomIter", /* tp_name */
sizeof(PyChainAtomIterObject), /* tp_basicsize */
......@@ -59,6 +59,10 @@ static PyTypeObject dapChainAtomPtr_dapChainAtomPtrType = {
};
static bool PyDapChainAtomIter_Check(PyObject *obj){
return PyObject_TypeCheck(obj, &DapChainAtomIter_DapChainAtomIterType);
}
#ifdef __cplusplus
}
#endif
......
......@@ -29,7 +29,7 @@ static PyMethodDef DapChainTypeMethods[] = {
static PyTypeObject dapChainTypeObject_dapChainTypeType = {
PyVarObject_HEAD_INIT(NULL, 0)
"CellFrame.Chain.Type", /* tp_name */
"CellFrame.ChainType", /* tp_name */
sizeof(PyChainTypeObject), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
......
#pragma once
#include <Python.h>
#include "dap_chain.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct PyChainAtomPtr{
PyObject_HEAD
dap_chain_atom_ptr_t ptr;
}PyChainAtomPtrObject;
static PyMethodDef DapChainAtomPtrMethods[] = {
{NULL, NULL, 0, NULL}
};
static PyTypeObject DapChainAtomPtr_DapChainAtomPtrType = {
PyVarObject_HEAD_INIT(NULL, 0)
"CellFrame.Chain.AtomPtr", /* tp_name */
sizeof(PyChainAtomPtrObject), /* 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 atom ptr objects", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
DapChainAtomPtrMethods, /* 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 */
};
#ifdef __cplusplus
}
#endif
\ No newline at end of file
......@@ -72,6 +72,10 @@ static PyTypeObject DapChainCell_DapChainCellObjectType = {
PyType_GenericNew, /* tp_new */
};
static bool PyDapChainCell_Check(PyObject *self){
return PyObject_TypeCheck(self, &DapChainCell_DapChainCellObjectType);
}
/* ------------------------------------------- */
typedef struct PyDapChainCellDeclReq{
......
......@@ -8,6 +8,7 @@
#include "wrapping_dap_chain_datum_token.h"
#include "wrapping_dap_hash.h"
#include "libdap-python.h"
#include "wrapping_dap_chain_tx_out_cond.h"
#ifdef __cplusplus
......
......@@ -77,3 +77,91 @@ void PyDapChainObject_dealloc(PyDapChainObject* chain){
dap_chain_delete(chain->chain_t);
Py_TYPE(chain)->tp_free((PyObject*)chain);
}
PyObject *dap_chain_python_create_atom_iter(PyObject *self, PyObject *args){
PyObject *obj_cell_id;
if (!PyArg_ParseTuple(args, "O", &obj_cell_id)){
PyErr_SetString(PyExc_AttributeError, "This function takes one argument.");
return NULL;
}
if (!PyDapChainCell_Check(obj_cell_id)){
PyErr_SetString(PyExc_AttributeError, "The first argument to this function must be of type ChainCell.");
return NULL;
}
PyObject *obj_atom_iter = _PyObject_New(&DapChainAtomIter_DapChainAtomIterType);
PyObject_Init(obj_atom_iter, &DapChainAtomIter_DapChainAtomIterType);
PyObject_Dir(obj_atom_iter);
((PyChainAtomIterObject*)obj_atom_iter)->atom_iter =
((PyDapChainObject*)self)->chain_t->callback_atom_iter_create(
((PyDapChainObject*)self)->chain_t,
((PyDapChainCellObject*)obj_cell_id)->cell->id,
false);
return obj_atom_iter;
}
PyObject *dap_chain_python_atom_iter_get_first(PyObject *self, PyObject *args){
PyObject *obj_iter;
if (!PyArg_ParseTuple(args, "O", &obj_iter)){
PyErr_SetString(PyExc_AttributeError, "This function must take one argument.");
return NULL;
}
if (!PyDapChainAtomIter_Check(obj_iter)){
PyErr_SetString(PyExc_ValueError, "The type of the first argument is not valid. The first argument accepted by this function must be of type ChainAtomIter.");
return NULL;
}
PyObject *obj_atom_ptr = _PyObject_New(&DapChainAtomPtr_DapChainAtomPtrType);
obj_atom_ptr = PyObject_Init(obj_atom_ptr, &DapChainAtomPtr_DapChainAtomPtrType);
PyObject_Dir(obj_atom_ptr);
size_t l_atom_size = 0;
((PyChainAtomPtrObject*)obj_atom_ptr)->ptr = ((PyDapChainObject*)self)->chain_t->callback_atom_iter_get_first(
((PyChainAtomIterObject*)obj_iter)->atom_iter, &l_atom_size
);
if (((PyChainAtomPtrObject*)obj_atom_ptr)->ptr == NULL){
return Py_None;
}
return Py_BuildValue("On", obj_atom_ptr, l_atom_size);
}
PyObject *dap_chain_python_atom_get_datums(PyObject *self, PyObject *args){
PyObject *obj_atom = NULL;
size_t atom_size = 0;
if(!PyArg_ParseTuple(args, "On", &obj_atom, &atom_size)){
PyErr_SetString(PyExc_AttributeError, "The given function was passed incorrect arguments, it must accept an atom and its size.");
return NULL;
}
size_t datums_count = 0;
dap_chain_datum_t **l_datums = ((PyDapChainObject*)self)->chain_t->callback_atom_get_datums(((PyChainAtomPtrObject*)obj_atom)->ptr, atom_size, &datums_count);
PyObject *list_datums = PyList_New(datums_count);
for (int i=0; i < datums_count; i++){
PyObject *obj_datum = _PyObject_New(&DapChainDatumObject_DapChainDatumObjectType);
obj_datum = PyObject_Init(obj_datum, &DapChainDatumObject_DapChainDatumObjectType);
PyObject_Dir(obj_datum);
((PyDapChainDatumObject*)obj_datum)->datum = l_datums[i];
PyList_SetItem(list_datums, i, obj_datum);
}
return list_datums;
}
PyObject *dap_chain_python_atom_iter_get_next(PyObject *self, PyObject *args){
//
size_t atom_size = 0;
PyObject *atom_iter = NULL;
if(!PyArg_ParseTuple(args, "O", &atom_iter)){
PyErr_SetString(PyExc_AttributeError, "This function must take only one argument.");
return NULL;
}
if (!PyDapChainAtomIter_Check(atom_iter)){
PyErr_SetString(PyExc_AttributeError, "The first argument to this function must be of type ChainAtomIter.");
return NULL;
}
PyObject *obj_atom_ptr = _PyObject_New(&DapChainAtomPtr_DapChainAtomPtrType);
obj_atom_ptr = PyObject_Init(obj_atom_ptr, &DapChainAtomPtr_DapChainAtomPtrType);
PyObject_Dir(obj_atom_ptr);
((PyChainAtomPtrObject*)obj_atom_ptr)->ptr = ((PyDapChainObject*)self)->chain_t->callback_atom_iter_get_next(
((PyChainAtomIterObject*)atom_iter)->atom_iter,
&atom_size);
if (((PyChainAtomPtrObject*)obj_atom_ptr)->ptr == NULL){
return Py_BuildValue("On", Py_None, 0);
}
return Py_BuildValue("On", obj_atom_ptr, atom_size);
}
......@@ -90,14 +90,19 @@ PyObject *dap_chain_ledger_addr_get_token_ticker_all_py(PyObject *self, PyObject
}
PyObject *dap_chain_ledger_addr_get_token_ticker_all_fast_py(PyObject *self, PyObject *args){
PyObject *obj_addr;
PyObject *obj_tickers;
PyObject *obj_tickers_size;
if (!PyArg_ParseTuple(args, "O|O|O", &obj_addr, &obj_tickers, &obj_tickers_size))
if (!PyArg_ParseTuple(args, "O", &obj_addr)) {
PyErr_SetString(PyExc_AttributeError, "This function must take an object of type ChainAddr as its first argument. ");
return NULL;
char ***tickers = ListStringToArrayStringFormatChar(obj_tickers);
size_t *tickers_size = ListIntToSizeT(obj_tickers_size);
dap_chain_ledger_addr_get_token_ticker_all_fast(((PyDapChainLedgerObject*)self)->ledger, ((PyDapChainAddrObject*)obj_addr)->addr, tickers, tickers_size);
return PyLong_FromLong(0);
}
char **tickers = NULL;
size_t ticker_size = 0;
dap_chain_ledger_addr_get_token_ticker_all_fast(((PyDapChainLedgerObject*)self)->ledger, ((PyDapChainAddrObject*)obj_addr)->addr, &tickers, &ticker_size);
PyObject *obj_list = PyList_New(ticker_size);
for (int i=0; i < ticker_size;i++){
PyObject *str = PyUnicode_FromString(tickers[i]);
PyList_SetItem(obj_list, i, str);
}
return obj_list;
}
PyObject *dap_chain_ledger_tx_cache_check_py(PyObject *self, PyObject *args){
PyObject *obj_datum_tx;
......@@ -178,11 +183,14 @@ PyObject *dap_chain_ledger_calc_balance_py(PyObject *self, PyObject *args){
const char *token_ticker;
if (!PyArg_ParseTuple(args, "O|s", &addr, &token_ticker))
return NULL;
uint64_t res = dap_chain_uint256_to(
dap_chain_ledger_calc_balance(
((PyDapChainLedgerObject*)self)->ledger,
((PyDapChainAddrObject*)addr)->addr, token_ticker));
return Py_BuildValue("k", res);
uint256_t balance = dap_chain_ledger_calc_balance(
((PyDapChainLedgerObject*)self)->ledger,
((PyDapChainAddrObject*)addr)->addr,
token_ticker
);
char* coins = dap_chain_balance_to_coins(balance);
uint64_t res = dap_chain_uint256_to(balance);
return Py_BuildValue("sk", coins, res);
}
PyObject *dap_chain_ledger_calc_balance_full_py(PyObject *self, PyObject *args){
PyObject *addr;
......@@ -200,7 +208,13 @@ PyObject *dap_chain_ledger_tx_find_by_hash_py(PyObject *self, PyObject *args){
if (!PyArg_ParseTuple(args, "O", &h_fast))
return NULL;
PyObject *res = _PyObject_New(&DapChainDatumTx_DapChainDatumTxObjectType);
res = PyObject_Init(res, &DapChainDatumTx_DapChainDatumTxObjectType);
PyObject_Dir(res);
((PyDapChainDatumTxObject*)res)->datum_tx = dap_chain_ledger_tx_find_by_hash(((PyDapChainLedgerObject*)self)->ledger, ((PyDapHashFastObject*)h_fast)->hash_fast);
if (((PyDapChainDatumTxObject*)res)->datum_tx == NULL) {
PyObject_DEL(res);
return Py_None;
}
return Py_BuildValue("O", res);
}
PyObject *dap_chain_ledger_tx_find_by_addr_py(PyObject *self, PyObject *args){
......@@ -250,7 +264,7 @@ PyObject *dap_chain_ledger_tx_cache_get_out_cond_value_py(PyObject *self, PyObje
((PyDapChainAddrObject*)obj_addr)->addr,
out_conds);
uint64_t res64 = dap_chain_uint256_to(res);
PyObject *obj_out_conds = _PyObject_New(&DapChainTxOutCond_DapChainTxOutCondObjectType);
PyObject *obj_out_conds = _PyObject_New(&DapChainTxOutCond_DapChainTxOutCondType);
((PyDapChainTxOutCondObject*)obj_out_conds)->out_cond = *out_conds;
PyObject *obj_res = PyLong_FromUnsignedLongLong(res64);
return Py_BuildValue("OO", obj_res, obj_out_conds);
......
......@@ -208,7 +208,11 @@ add_library(${PROJECT_NAME} STATIC ${CHAIN_COMMON_PYTHON_SRCS} ${CHAIN_COMMON_PY
target_link_libraries(${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} dap_chain_common dap_core dap_crypto dap_crypto_python_module)
target_link_libraries(${PROJECT_NAME} dap_chain_common
dap_core
dap_crypto
dap_crypto_python_module
dap_chain_python_module)
target_include_directories(${PROJECT_NAME} PUBLIC include/ )
/*
* Authors:
* Alexey V. Stratulat <alexey.stratulat@demlabs.net>
* DeM Labs Inc. https://demlabs.net
* CellFrame https://cellframe.net
* Sources https://gitlab.demlabs.net/cellframe
* Copyright (c) 2017-2021
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WRAPPING_DAP_CHAIN_COMMON_
#define _WRAPPING_DAP_CHAIN_COMMON_
#include <Python.h>
#include "dap_chain_common.h"
#include "libdap_crypto_key_python.h"
#include "wrapping_dap_chain_ledger.h"
//#include "wrapping_dap_chain_ledger"
#ifdef __cplusplus
extern "C" {
......@@ -77,11 +104,16 @@ 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);
PyObject *dap_chain_addr_get_net_id_py(PyObject *self, PyObject *args);
PyObject *obj_addr_str(PyObject *self);
static 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, ""},
{"getNetId", (PyCFunction)dap_chain_addr_get_net_id_py, METH_NOARGS, ""},
{NULL, NULL, 0, NULL}
};
......@@ -101,7 +133,7 @@ static PyTypeObject DapChainAddrObject_DapChainAddrObjectType = {
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
obj_addr_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
......@@ -301,6 +333,8 @@ typedef struct PyDapChainID{
dap_chain_id_t *chain_id;
}PyDapChainIDObject;
PyObject *DapChainIdObject_str(PyObject *self);
static PyTypeObject DapChainIDObject_DapChainIDType = {
PyVarObject_HEAD_INIT(NULL, 0)
"CellFrame.ChainID" , /* tp_name */
......@@ -317,7 +351,7 @@ static PyTypeObject DapChainIDObject_DapChainIDType = {
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
DapChainIdObject_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
......
/*
* Authors:
* Alexey V. Stratulat <alexey.stratulat@demlabs.net>
* DeM Labs Inc. https://demlabs.net
* CellFrame https://cellframe.net
* Sources https://gitlab.demlabs.net/cellframe
* Copyright (c) 2017-2021
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WRAPPING_DAP_CHAIN_DATUM_
#define _WRAPPING_DAP_CHAIN_DATUM_
#include "Python.h"
#include "dap_chain_datum.h"
#include "datetime.h"
#include "wrapping_dap_chain_datum_tx.h"
#ifdef __cplusplus
extern "C" {
......@@ -64,12 +91,22 @@ typedef struct PyDapChainDatum{
//void PyDapChainDatumObject_dealloc(PyDapChainDatumObject* object);
PyObject *PyDapChainDatumObject_new(PyTypeObject *type_object, PyObject *args, PyObject *kwds);
PyObject *dap_chain_datum_size_py(PyObject *self, PyObject *args);
PyObject *dap_chain_datum_get_ts_created(PyObject *self, void* closure);
PyObject *dap_chain_datum_is_type_tx(PyObject *self, PyObject *args);
PyObject *wrapping_dap_chain_datum_get_datum_tx(PyObject *self, PyObject *args);
static PyMethodDef DapChainDatumMethods[] = {
{"size", dap_chain_datum_size_py, METH_VARARGS, ""},
{"isDatumTX", dap_chain_datum_is_type_tx, METH_NOARGS, ""},
{"getDatumTX", wrapping_dap_chain_datum_get_datum_tx, METH_NOARGS, ""},
{NULL, NULL, 0, NULL}
};
static PyGetSetDef DapChainDatumGetSet[] = {
{"tsCreated", (getter)dap_chain_datum_get_ts_created, NULL, NULL, NULL},
{NULL}
};
static PyTypeObject DapChainDatumObject_DapChainDatumObjectType = {
PyVarObject_HEAD_INIT(NULL, 0)
"CellFrame.Chain.Datum", /* tp_name */
......@@ -99,9 +136,9 @@ static PyTypeObject DapChainDatumObject_DapChainDatumObjectType = {
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
DapChainDatumMethods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
DapChainDatumGetSet, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
......
/*
* Authors:
* Alexey V. Stratulat <alexey.stratulat@demlabs.net>
* DeM Labs Inc. https://demlabs.net
* CellFrame https://cellframe.net
* Sources https://gitlab.demlabs.net/cellframe
* Copyright (c) 2017-2021
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WRAPPING_DAP_CHAIN_DATUM_TOKEN_
#define _WRAPPING_DAP_CHAIN_DATUM_TOKEN_
......
/*
* Authors:
* Alexey V. Stratulat <alexey.stratulat@demlabs.net>
* DeM Labs Inc. https://demlabs.net
* CellFrame https://cellframe.net
* Sources https://gitlab.demlabs.net/cellframe
* Copyright (c) 2017-2021
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WRAPPING_DAP_CHAIN_DATUM_TX_
#define _WRAPPING_DAP_CHAIN_DATUM_TX_
#include "Python.h"
#include "datetime.h"
#include "wrapping_dap_chain_common.h"
#include "libdap_crypto_key_python.h"
#include "dap_chain_datum_tx_out_cond.h"
#include "wrapping_dap_hash.h"
#include "dap_chain_datum_tx_items.h"
#include "wrapping_dap_hash.h"
#include "wrapping_dap_chain_tx_in.h"
#include "wrapping_dap_chain_tx_in_cond.h"
#include "wrapping_dap_chain_tx_out.h"
#include "wrapping_dap_chain_tx_out_cond.h"
#include "wrapping_dap_chain_tx_out_cond_subtype_srv_pay.h"
#include "wrapping_dap_chain_tx_out_cond_subtype_srv_stake.h"
#include "wrapping_dap_chain_tx_out_cond_subtype_srv_xchange.h"
#include "wrapping_dap_chain_tx_out_ext.h"
#include "wrapping_dap_chain_tx_pkey.h"
#include "wrapping_dap_chain_tx_sig.h"
#include "wrapping_dap_chain_tx_receipt.h"
#include "wrapping_dap_chain_tx_token.h"
#include "wrapping_dap_chain_tx_token_ext.h"
#ifdef __cplusplus
extern "C" {
......@@ -159,6 +199,17 @@ PyObject *dap_chain_datum_tx_add_out_cond_item_py(PyObject *self, PyObject *args
PyObject *dap_chain_datum_tx_add_sign_item_py(PyObject *self, PyObject *args);
PyObject *dap_chain_datum_tx_verify_sign_py(PyObject *self, PyObject *args);
PyObject *wrapping_dap_chain_datum_tx_get_items(PyObject *self, PyObject *args);
PyObject *wrapping_dap_chain_datum_tx_get_hash(PyObject *self, void* closure);
PyObject *wrapping_dap_chain_datum_tx_get_tsCreated(PyObject *self, void* closure);
static PyGetSetDef PyDaoChainDatumTxObjectGetsSets[] = {
{"hash", (getter) wrapping_dap_chain_datum_tx_get_hash, NULL, NULL, NULL},
{"dateCreated", (getter) wrapping_dap_chain_datum_tx_get_tsCreated, NULL, NULL, NULL},
{NULL}
};
static PyMethodDef PyDapChainDatumTxObjectMethods[] ={
{"getSize", (PyCFunction)dap_chain_datum_tx_get_size_py, METH_VARARGS, ""},
{"addItem", (PyCFunction)dap_chain_datum_tx_add_item_py, METH_VARARGS, ""},
......@@ -168,6 +219,7 @@ static PyMethodDef PyDapChainDatumTxObjectMethods[] ={
{"addOutCond", (PyCFunction)dap_chain_datum_tx_add_out_cond_item_py, METH_VARARGS, ""},
{"addSignItem", (PyCFunction)dap_chain_datum_tx_add_sign_item_py, METH_VARARGS, ""},
{"verifySign", (PyCFunction)dap_chain_datum_tx_verify_sign_py, METH_VARARGS, ""},
{"getItems", (PyCFunction)wrapping_dap_chain_datum_tx_get_items, METH_NOARGS, ""},
{NULL, NULL, 0, NULL}
};
......@@ -176,7 +228,7 @@ static PyTypeObject DapChainDatumTx_DapChainDatumTxObjectType = {
"CellFrame.Chain.DatumTx", /* tp_name */
sizeof(PyDapChainDatumTxObject), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)PyDapChainDatumTxObject_delete, /* tp_dealloc */
0,//(destructor)PyDapChainDatumTxObject_delete, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
......@@ -202,7 +254,7 @@ static PyTypeObject DapChainDatumTx_DapChainDatumTxObjectType = {
0, /* tp_iternext */
PyDapChainDatumTxObjectMethods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
PyDaoChainDatumTxObjectGetsSets, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
......@@ -215,55 +267,6 @@ static PyTypeObject DapChainDatumTx_DapChainDatumTxObjectType = {
/* -------------------------------------- */
typedef struct PyDapChainTxOutCond{
PyObject_HEAD
dap_chain_tx_out_cond_t *out_cond;
}PyDapChainTxOutCondObject;
static PyTypeObject DapChainTxOutCond_DapChainTxOutCondObjectType = {
PyVarObject_HEAD_INIT(NULL, 0)
"CellFrame.Chain.TxOutCond", /* tp_name */
sizeof(PyDapChainTxOutCondObject), /* 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 tx out cond object", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* 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 */
};
/* -------------------------------------- */
#ifdef __cplusplus
}
#endif
......
/*
* Authors:
* Alexey V. Stratulat <alexey.stratulat@demlabs.net>
* DeM Labs Inc. https://demlabs.net
* CellFrame https://cellframe.net
* Sources https://gitlab.demlabs.net/cellframe
* Copyright (c) 2017-2021
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WRAPPING_DAP_CHAIN_TX_IN_
#define _WRAPPING_DAP_CHAIN_TX_IN_
#include <Python.h>
#include "dap_chain_datum_tx_in.h"
#include "wrapping_dap_hash.h"
#ifdef __cplusplus
extern "C"{
#endif
typedef struct PyDapChainTXIn{
PyObject_HEAD
dap_chain_tx_in_t *tx_in;
}PyDapChainTXInObject;
PyObject *wrapping_dap_chain_tx_in_get_prev_hash(PyObject *self, void *closure);
PyObject *wrapping_dap_chain_tx_in_get_out_prev_idx(PyObject *self, void *closure);
static PyGetSetDef DapChainTxGetsSetsDef[] = {
{"prevHash", (getter)wrapping_dap_chain_tx_in_get_prev_hash, NULL, NULL, NULL},
{"prevIdx", (getter)wrapping_dap_chain_tx_in_get_out_prev_idx, NULL, NULL, NULL},
{NULL}
};
static PyTypeObject DapChainTxInObject_DapChainTxInTypeObjectType = {
PyVarObject_HEAD_INIT(NULL, 0)
"CellFrame.ChainTxIn", /* tp_name */
sizeof(PyDapChainTXInObject), /* 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 tx in object", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
DapChainTxGetsSetsDef, /* 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 */
};
#ifdef __cplusplus
extern "C"{
#endif
#endif //_WRAPPING_DAP_CHAIN_TX_IN_
\ No newline at end of file
/*
* Authors:
* Alexey V. Stratulat <alexey.stratulat@demlabs.net>
* DeM Labs Inc. https://demlabs.net
* CellFrame https://cellframe.net
* Sources https://gitlab.demlabs.net/cellframe
* Copyright (c) 2017-2021
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Python.h>
#include "dap_chain_datum_tx_in_cond.h"
#include "wrapping_dap_hash.h"
#ifdef __cplusplus
extern "C"{
#endif
typedef struct PyDapChainTXInCond{
PyObject_HEAD
dap_chain_tx_in_cond_t *tx_in_cond;
}PyDapChainTXInCondObject;
PyObject *wrapping_dap_chain_tx_in_cond_get_receipt_prev_idx(PyObject *self, void *closure);
PyObject *wrapping_dap_chain_tx_in_cond_get_prev_hash(PyObject *self, void *closure);
PyObject *wrapping_dap_chain_tx_in_cond_get_out_prev_idx(PyObject *self, void *closure);
static PyGetSetDef DapChainTxInCondGetsSetsDef[] = {
{"receiptPrevIdx",(getter)wrapping_dap_chain_tx_in_cond_get_receipt_prev_idx, NULL, NULL, NULL},
{"prevHash", (getter)wrapping_dap_chain_tx_in_cond_get_prev_hash, NULL, NULL, NULL},
{"outPrevIdx", (getter)wrapping_dap_chain_tx_in_cond_get_out_prev_idx, NULL, NULL, NULL},
{NULL}
};
static PyMethodDef DapChainTxInCondMethodsDef[] = {
{NULL, NULL, 0, NULL}
};
static PyTypeObject DapChainTxInCondObject_DapChainTxInCondTypeObjectType = {
PyVarObject_HEAD_INIT(NULL, 0)
"CellFrame.ChainTxInCond", /* tp_name */
sizeof(PyDapChainTXInCondObject), /* 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 tx in cond object", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
DapChainTxInCondMethodsDef, /* tp_methods */
0, /* tp_members */
DapChainTxInCondGetsSetsDef, /* 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 */
};
#ifdef __cplusplus
extern "C"{
#endif
\ No newline at end of file
/*
* Authors:
* Alexey V. Stratulat <alexey.stratulat@demlabs.net>
* DeM Labs Inc. https://demlabs.net
* CellFrame https://cellframe.net
* Sources https://gitlab.demlabs.net/cellframe
* Copyright (c) 2017-2021
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Python.h>
#include "dap_chain_datum_tx_out.h"
#include "wrapping_dap_chain_common.h"
//#ifdef __cplusplus
//extern "C"{
//#endif
typedef struct PyDapChainTXOut{
PyObject_HEAD
dap_chain_tx_out_t *tx_out;
}PyDapChainTXOutObject;
PyObject *wrapping_dap_chain_tx_out_get_addr(PyObject *self, void *closure);
PyObject *wrapping_dap_chain_tx_out_get_value(PyObject *self, void *closure);
static PyGetSetDef DapChainTxOutGetsSetsDef[] = {
{"addr", (getter)wrapping_dap_chain_tx_out_get_addr, NULL, NULL, NULL},
{"value", (getter)wrapping_dap_chain_tx_out_get_value, NULL, NULL, NULL},
{NULL}
};
static PyMethodDef PyDapChainTxOutObjectMethods[] ={
{NULL, NULL, 0, NULL}
};
static PyTypeObject DapChainTxOutObject_DapChainTxOutTypeObjectType = {
PyVarObject_HEAD_INIT(NULL, 0)
"CellFrame.ChainTxOut", /* tp_name */
sizeof(PyDapChainTXOutObject), /* 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 tx out object", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
PyDapChainTxOutObjectMethods, /* tp_methods */
0, /* tp_members */
DapChainTxOutGetsSetsDef, /* 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 */
};
//#ifdef __cplusplus
//extern "C"{
//#endif
/*
* Authors:
* Alexey V. Stratulat <alexey.stratulat@demlabs.net>
* DeM Labs Inc. https://demlabs.net
* CellFrame https://cellframe.net
* Sources https://gitlab.demlabs.net/cellframe
* Copyright (c) 2017-2021
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Python.h>
#include "dap_chain_datum_tx_out_cond.h"
#include "datetime.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct PyDapChainTxOutCond{
PyObject_HEAD
dap_chain_tx_out_cond_t *out_cond;
}PyDapChainTxOutCondObject;
PyObject *wrapping_dap_chain_tx_out_cond_get_ts_expires(PyObject *self, void *closure);
PyObject *wrapping_dap_chain_tx_out_cond_get_value(PyObject *self, void *closure);
PyObject *wrapping_dap_chain_tx_out_cond_get_type_subtype(PyObject *self, void *closure);
PyObject *wrapping_dap_chain_tx_out_cond_get_subtype(PyObject *self, void *closure);
static PyGetSetDef PyDapChainTxOutCondGetsSetsDef[] = {
{"tsExpires", (getter)wrapping_dap_chain_tx_out_cond_get_ts_expires, NULL, NULL, NULL},
{"value", (getter)wrapping_dap_chain_tx_out_cond_get_value, NULL, NULL, NULL},
{"typeSubtype", (getter)wrapping_dap_chain_tx_out_cond_get_type_subtype, NULL, NULL, NULL},
{"subtype", (getter)wrapping_dap_chain_tx_out_cond_get_subtype, NULL, NULL, NULL},
{NULL}
};
static PyTypeObject DapChainTxOutCond_DapChainTxOutCondType = {
PyVarObject_HEAD_INIT(NULL, 0)
"CellFrame.ChainTxOutCond", /* tp_name */
sizeof(PyDapChainTxOutCondObject), /* 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 tx out cond object", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
PyDapChainTxOutCondGetsSetsDef, /* 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 */
};
//============= DapChaTxOutCondSubtype
typedef struct PyDapChainTxOutCondSubType{
PyObject_HEAD
dap_chain_tx_out_cond_subtype_t *out_cond_subtype;
}PyDapChainTxOutCondSubTypeObject;
PyObject *PyDapChainTxOutCondSubType_str(PyObject *self);
static PyTypeObject DapChainTxOutCondSubType_DapChainTxOutCondSubTypeType = {
PyVarObject_HEAD_INIT(NULL, 0)
"CellFrame.ChainTxOutCondSubType", /* tp_name */
sizeof(PyDapChainTxOutCondSubTypeObject), /* 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 */
PyDapChainTxOutCondSubType_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT |
Py_TPFLAGS_BASETYPE, /* tp_flags */
"Chain tx out cond object", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* 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 */
};
#ifdef __cplusplus
}
#endif