From 462815ae56582d77daa65cec9c56fee7171564db Mon Sep 17 00:00:00 2001 From: "alexey.stratulat" <alexey.stratulat@demlabs.net> Date: Tue, 21 Apr 2020 12:48:40 +0700 Subject: [PATCH] [*] Completed the implementation of the createWithSeed function. --- include/dap_chain_wallet_python.h | 1 + src/dap_chain_wallet_python.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/dap_chain_wallet_python.h b/include/dap_chain_wallet_python.h index 8dffa4d..f08c586 100644 --- a/include/dap_chain_wallet_python.h +++ b/include/dap_chain_wallet_python.h @@ -6,6 +6,7 @@ #include "dap_chain_wallet.h" #include "wrapping_dap_chain_common.h" #include "libdap_crypto_key_python.h" +#include "wrapping_dap_sign.h" //#include "wrapping_dap_sign #ifdef __cplusplus diff --git a/src/dap_chain_wallet_python.c b/src/dap_chain_wallet_python.c index f9712b2..323ac6e 100644 --- a/src/dap_chain_wallet_python.c +++ b/src/dap_chain_wallet_python.c @@ -26,7 +26,16 @@ PyObject *dap_chain_wallet_create_with_seed_py(PyObject *self, PyObject *argv){ PyErr_SetString(PyExc_TypeError, "Fourth argument to not have a Bytes object type"); return NULL; } - return NULL;; + void *seed = (void *)PyBytes_AsString(obj_seed); + size_t seed_size = PyBytes_Size(obj_seed); + PyObject *obj_wallet = _PyObject_New(&DapChainWallet_dapChainWalletType); + ((PyDapChainWalletObject*)obj_wallet)->wallet = dap_chain_wallet_create_with_seed( + wallet_name, + path_wallets, + *((PyDapSignTypeObject*)obj_sig_type)->sign_type, + seed, + seed_size); + return Py_BuildValue("(O)", obj_wallet); } PyObject *dap_chain_wallet_open_file_py(PyObject *self, PyObject *argv){ (void)self; -- GitLab