Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python-cellframe
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
python-cellframe
Commits
6846a891
Commit
6846a891
authored
4 years ago
by
alexey.stratulat
Browse files
Options
Downloads
Patches
Plain Diff
[+] Added functions getPKey, certToAddr. Added constructor for object ChainWallet.
parent
462815ae
No related branches found
No related tags found
1 merge request
!26
Support 3689
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/dap_chain_wallet_python.h
+6
-3
6 additions, 3 deletions
include/dap_chain_wallet_python.h
src/dap_chain_wallet_python.c
+37
-1
37 additions, 1 deletion
src/dap_chain_wallet_python.c
with
43 additions
and
4 deletions
include/dap_chain_wallet_python.h
+
6
−
3
View file @
6846a891
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
#include
"wrapping_dap_chain_common.h"
#include
"wrapping_dap_chain_common.h"
#include
"libdap_crypto_key_python.h"
#include
"libdap_crypto_key_python.h"
#include
"wrapping_dap_sign.h"
#include
"wrapping_dap_sign.h"
//#include "wrapping_dap_sign
#include
"wrapping_dap_pkey.h"
#include
"wrapping_cert.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -27,7 +28,7 @@ void dap_chain_wallet_deinit_py(void);
...
@@ -27,7 +28,7 @@ void dap_chain_wallet_deinit_py(void);
PyObject
*
dap_chain_wallet_get_path_py
(
PyObject
*
self
,
PyObject
*
argv
);
PyObject
*
dap_chain_wallet_get_path_py
(
PyObject
*
self
,
PyObject
*
argv
);
PyObject
*
dap_chain_wallet_create_with_seed_py
(
PyObject
*
self
,
PyObject
*
argv
);
PyObject
*
dap_chain_wallet_create_with_seed_py
(
PyObject
*
self
,
PyObject
*
argv
);
PyObject
*
dap_chain_wallet_create_py
(
PyObject
*
self
,
PyObject
*
argv
);
PyObject
*
dap_chain_wallet_create_py
(
Py
Type
Object
*
type
,
PyObject
*
argv
,
PyObject
*
kwds
);
PyObject
*
dap_chain_wallet_open_file_py
(
PyObject
*
self
,
PyObject
*
argv
);
PyObject
*
dap_chain_wallet_open_file_py
(
PyObject
*
self
,
PyObject
*
argv
);
PyObject
*
dap_chain_wallet_open_py
(
PyObject
*
self
,
PyObject
*
argv
);
PyObject
*
dap_chain_wallet_open_py
(
PyObject
*
self
,
PyObject
*
argv
);
PyObject
*
dap_chain_wallet_save_py
(
PyObject
*
self
,
PyObject
*
argv
);
PyObject
*
dap_chain_wallet_save_py
(
PyObject
*
self
,
PyObject
*
argv
);
...
@@ -49,8 +50,10 @@ static PyMethodDef ChainWalletMethods[] = {
...
@@ -49,8 +50,10 @@ static PyMethodDef ChainWalletMethods[] = {
{
"openFile"
,
(
PyCFunction
)
dap_chain_wallet_open_file_py
,
METH_VARARGS
|
METH_STATIC
,
""
},
{
"openFile"
,
(
PyCFunction
)
dap_chain_wallet_open_file_py
,
METH_VARARGS
|
METH_STATIC
,
""
},
{
"open"
,
(
PyCFunction
)
dap_chain_wallet_open_py
,
METH_VARARGS
|
METH_STATIC
,
""
},
{
"open"
,
(
PyCFunction
)
dap_chain_wallet_open_py
,
METH_VARARGS
|
METH_STATIC
,
""
},
{
"save"
,
(
PyCFunction
)
dap_chain_wallet_save_py
,
METH_NOARGS
,
""
},
{
"save"
,
(
PyCFunction
)
dap_chain_wallet_save_py
,
METH_NOARGS
,
""
},
{
"certToAddr"
,
(
PyCFunction
)
dap_cert_to_addr_py
,
METH_VARARGS
|
METH_STATIC
,
""
},
{
"getAddr"
,
(
PyCFunction
)
dap_chain_wallet_get_addr_py
,
METH_VARARGS
,
""
},
{
"getAddr"
,
(
PyCFunction
)
dap_chain_wallet_get_addr_py
,
METH_VARARGS
,
""
},
{
"getCertsNumber"
,
(
PyCFunction
)
dap_chain_wallet_get_certs_number_py
,
METH_NOARGS
,
""
},
{
"getCertsNumber"
,
(
PyCFunction
)
dap_chain_wallet_get_certs_number_py
,
METH_NOARGS
,
""
},
{
"getPKey"
,
(
PyCFunction
)
dap_chain_wallet_get_pkey_py
,
METH_VARARGS
,
""
},
{
"getKey"
,
(
PyCFunction
)
dap_chain_wallet_get_key_py
,
METH_VARARGS
,
""
},
{
"getKey"
,
(
PyCFunction
)
dap_chain_wallet_get_key_py
,
METH_VARARGS
,
""
},
{
NULL
,
NULL
,
0
,
NULL
}
{
NULL
,
NULL
,
0
,
NULL
}
};
};
...
@@ -94,7 +97,7 @@ static PyTypeObject DapChainWallet_dapChainWalletType = {
...
@@ -94,7 +97,7 @@ static PyTypeObject DapChainWallet_dapChainWalletType = {
0
,
/* tp_dictoffset */
0
,
/* tp_dictoffset */
0
,
/* tp_init */
0
,
/* tp_init */
0
,
/* tp_alloc */
0
,
/* tp_alloc */
PyType_GenericNew
,
/* tp_new */
dap_chain_wallet_create_py
,
/* tp_new */
0
,
/* tp_free */
0
,
/* tp_free */
0
,
/* tp_is_gc*/
0
,
/* tp_is_gc*/
0
,
/* tp_bases*/
0
,
/* tp_bases*/
...
...
This diff is collapsed.
Click to expand it.
src/dap_chain_wallet_python.c
+
37
−
1
View file @
6846a891
...
@@ -37,6 +37,24 @@ PyObject *dap_chain_wallet_create_with_seed_py(PyObject *self, PyObject *argv){
...
@@ -37,6 +37,24 @@ PyObject *dap_chain_wallet_create_with_seed_py(PyObject *self, PyObject *argv){
seed_size
);
seed_size
);
return
Py_BuildValue
(
"(O)"
,
obj_wallet
);
return
Py_BuildValue
(
"(O)"
,
obj_wallet
);
}
}
PyObject
*
dap_chain_wallet_create_py
(
PyTypeObject
*
type
,
PyObject
*
argv
,
PyObject
*
kwds
){
(
void
)
kwds
;
PyDapChainWalletObject
*
self
;
const
char
*
wallet_name
;
const
char
*
path_wallets
;
PyObject
*
obj_sign_type
;
if
(
!
PyArg_ParseTuple
(
argv
,
"ssO"
,
&
wallet_name
,
&
path_wallets
,
&
obj_sign_type
))
return
NULL
;
self
=
(
PyDapChainWalletObject
*
)
type
->
tp_alloc
(
type
,
0
);
if
(
self
!=
NULL
){
self
->
wallet
=
dap_chain_wallet_create
(
wallet_name
,
path_wallets
,
*
((
PyDapSignTypeObject
*
)
obj_sign_type
)
->
sign_type
);
if
(
self
->
wallet
==
NULL
){
Py_XDECREF
(
self
);
return
NULL
;
}
}
return
(
PyObject
*
)
self
;
}
PyObject
*
dap_chain_wallet_open_file_py
(
PyObject
*
self
,
PyObject
*
argv
){
PyObject
*
dap_chain_wallet_open_file_py
(
PyObject
*
self
,
PyObject
*
argv
){
(
void
)
self
;
(
void
)
self
;
const
char
*
file_path
;
const
char
*
file_path
;
...
@@ -69,7 +87,16 @@ void dap_chain_wallet_close_py(PyDapChainWalletObject *self){
...
@@ -69,7 +87,16 @@ void dap_chain_wallet_close_py(PyDapChainWalletObject *self){
PyObject
*
dap_cert_to_addr_py
(
PyObject
*
self
,
PyObject
*
argv
){
PyObject
*
dap_cert_to_addr_py
(
PyObject
*
self
,
PyObject
*
argv
){
(
void
)
self
;
(
void
)
self
;
return
NULL
;
PyObject
*
obj_cert
;
PyObject
*
obj_net_id
;
if
(
!
PyArg_ParseTuple
(
argv
,
"OO"
,
&
obj_cert
,
&
obj_net_id
))
return
NULL
;
PyObject
*
obj_addr
=
_PyObject_New
(
&
DapChainAddrObject_DapChainAddrObjectType
);
((
PyDapChainAddrObject
*
)
obj_addr
)
->
addr
=
dap_cert_to_addr
(
((
PyCryptoCertObject
*
)
obj_cert
)
->
cert
,
((
PyDapChainNetIdObject
*
)
obj_net_id
)
->
net_id
);
return
Py_BuildValue
(
"(O)"
,
obj_addr
);
}
}
PyObject
*
dap_chain_wallet_get_addr_py
(
PyObject
*
self
,
PyObject
*
argv
){
PyObject
*
dap_chain_wallet_get_addr_py
(
PyObject
*
self
,
PyObject
*
argv
){
...
@@ -88,6 +115,15 @@ PyObject *dap_chain_wallet_get_certs_number_py(PyObject *self, PyObject *argv){
...
@@ -88,6 +115,15 @@ PyObject *dap_chain_wallet_get_certs_number_py(PyObject *self, PyObject *argv){
size_t
result
=
dap_chain_wallet_get_certs_number
(((
PyDapChainWalletObject
*
)
self
)
->
wallet
);
size_t
result
=
dap_chain_wallet_get_certs_number
(((
PyDapChainWalletObject
*
)
self
)
->
wallet
);
return
PyLong_FromLong
(
result
);
return
PyLong_FromLong
(
result
);
}
}
PyObject
*
dap_chain_wallet_get_pkey_py
(
PyObject
*
self
,
PyObject
*
argv
){
uint32_t
key_idx
;
if
(
!
PyArg_ParseTuple
(
argv
,
"I"
,
&
key_idx
))
return
NULL
;
PyObject
*
obj_pkey
=
_PyObject_New
(
&
DapPkeyObject_DapPkeyObjectType
);
((
PyDapPkeyObject
*
)
obj_pkey
)
->
pkey
=
dap_chain_wallet_get_pkey
(((
PyDapChainWalletObject
*
)
self
)
->
wallet
,
key_idx
);
return
Py_BuildValue
(
"(O)"
,
obj_pkey
);
}
PyObject
*
dap_chain_wallet_get_key_py
(
PyObject
*
self
,
PyObject
*
argv
){
PyObject
*
dap_chain_wallet_get_key_py
(
PyObject
*
self
,
PyObject
*
argv
){
uint32_t
key_idx
;
uint32_t
key_idx
;
if
(
!
PyArg_ParseTuple
(
argv
,
"I"
,
&
key_idx
))
if
(
!
PyArg_ParseTuple
(
argv
,
"I"
,
&
key_idx
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment