Compare commits
7 Commits
lash/fix-d
...
lash/debia
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f38ece7c2b | ||
| 7deeee2c84 | |||
|
|
6a94208c68
|
||
|
|
becd6744f6
|
||
|
|
06c6b2562a
|
||
|
|
1067c8494e
|
||
|
|
39478d9c3c
|
17
.bluto/bluto.deb.ini
Normal file
17
.bluto/bluto.deb.ini
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
[main:deb]
|
||||||
|
standards_version=3.8.5
|
||||||
|
priority=optional
|
||||||
|
engine=9
|
||||||
|
|
||||||
|
[dep:deb-build]
|
||||||
|
debhelper=>=9
|
||||||
|
python3=>=3.8
|
||||||
|
python3-setuptools=0
|
||||||
|
dh-python=0
|
||||||
|
|
||||||
|
[dep:deb-install]
|
||||||
|
dpkg=0
|
||||||
|
python3=>=3.8
|
||||||
|
|
||||||
|
[dep:deb-exec]
|
||||||
|
make=0
|
||||||
18
.bluto/bluto.ini
Normal file
18
.bluto/bluto.ini
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[main]
|
||||||
|
name = chainlib
|
||||||
|
version = 0.0.12
|
||||||
|
summary = Generic blockchain access library and tooling
|
||||||
|
|
||||||
|
[author:lash]
|
||||||
|
name = Louis Holbrook
|
||||||
|
email = dev@holbrook.no
|
||||||
|
pgp=0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||||
|
|
||||||
|
[locate:git]
|
||||||
|
url = https://gitlab.com/chaintools/chainlib
|
||||||
|
|
||||||
|
[locate:lash]
|
||||||
|
url=https://holbrook.no
|
||||||
|
|
||||||
|
[license]
|
||||||
|
GPL=3+
|
||||||
6
.bluto/bluto.py.ini
Normal file
6
.bluto/bluto.py.ini
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[main:py]
|
||||||
|
include_data = 1
|
||||||
|
packages = chainlib,chainlib.cli
|
||||||
|
|
||||||
|
[dep:py-exec]
|
||||||
|
python=>=3.6
|
||||||
11
.bluto/bluto.tag
Normal file
11
.bluto/bluto.tag
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
dlt
|
||||||
|
blockchain
|
||||||
|
cryptocurrency
|
||||||
|
Programming Language :: Python :: 3
|
||||||
|
Operating System :: OS Independent
|
||||||
|
Development Status :: 3 - Alpha
|
||||||
|
Topic :: Software Development :: Libraries
|
||||||
|
Environment :: Console
|
||||||
|
Intended Audience :: Developers
|
||||||
|
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
||||||
|
Topic :: Internet
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
- 0.0.5-pending
|
- 0.0.14
|
||||||
|
* Add option to skip ssl verification on rpc
|
||||||
|
- 0.0.5
|
||||||
* Move eth code to separate package
|
* Move eth code to separate package
|
||||||
- 0.0.4-unreleased
|
- 0.0.4-unreleased
|
||||||
* Add pack tx from already signed tx struct
|
* Add pack tx from already signed tx struct
|
||||||
|
|||||||
@@ -186,10 +186,17 @@ class ChainSpec:
|
|||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def as_string(self, skip_optional=False):
|
||||||
s = '{}:{}:{}'.format(self.o['arch'], self.o['fork'], self.o['network_id'])
|
s = '{}:{}:{}'.format(self.o['arch'], self.o['fork'], self.o['network_id'])
|
||||||
|
if skip_optional:
|
||||||
|
return s
|
||||||
|
|
||||||
if self.o.get('common_name'):
|
if self.o.get('common_name'):
|
||||||
s += ':' + self.o['common_name']
|
s += ':' + self.o['common_name']
|
||||||
if self.o.get('custom'):
|
if self.o.get('custom'):
|
||||||
s += ':' + ':'.join(self.o['custom'])
|
s += ':' + ':'.join(self.o['custom'])
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.as_string()
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ class ArgumentParser(argparse.ArgumentParser):
|
|||||||
if arg_flags & Flag.CONFIG:
|
if arg_flags & Flag.CONFIG:
|
||||||
self.add_argument('-c', '--config', type=str, default=env.get('CONFINI_DIR'), help='Configuration directory')
|
self.add_argument('-c', '--config', type=str, default=env.get('CONFINI_DIR'), help='Configuration directory')
|
||||||
self.add_argument('-n', '--namespace', type=str, help='Configuration namespace')
|
self.add_argument('-n', '--namespace', type=str, help='Configuration namespace')
|
||||||
self.add_argument('--dumpconfig', action='store_true', help='Output configuration and quit. Use with --raw to omit values and output schema only.')
|
self.add_argument('--dumpconfig', type=str, choices=['env', 'ini'], help='Output configuration and quit. Use with --raw to omit values and output schema only.')
|
||||||
if arg_flags & Flag.WAIT:
|
if arg_flags & Flag.WAIT:
|
||||||
self.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed')
|
self.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed')
|
||||||
self.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed')
|
self.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed')
|
||||||
|
|||||||
@@ -239,18 +239,26 @@ class Config(confini.Config):
|
|||||||
logg.debug('added {} to {}'.format(r, v))
|
logg.debug('added {} to {}'.format(r, v))
|
||||||
|
|
||||||
if getattr(args, 'dumpconfig', None):
|
if getattr(args, 'dumpconfig', None):
|
||||||
config_keys = config.all()
|
if args.dumpconfig == 'ini':
|
||||||
with_values = not config.get('_RAW')
|
from confini.export import ConfigExporter
|
||||||
for k in config_keys:
|
exporter = ConfigExporter(config, target=sys.stdout, doc=False)
|
||||||
if k[0] == '_':
|
exporter.export(exclude_sections=['config'])
|
||||||
continue
|
elif args.dumpconfig == 'env':
|
||||||
s = k + '='
|
from confini.env import export_env
|
||||||
if with_values:
|
export_env(config)
|
||||||
v = config.get(k)
|
|
||||||
if v != None:
|
# config_keys = config.all()
|
||||||
s += str(v)
|
# with_values = not config.get('_RAW')
|
||||||
s += '\n'
|
# for k in config_keys:
|
||||||
dump_writer.write(s)
|
# if k[0] == '_':
|
||||||
|
# continue
|
||||||
|
# s = k + '='
|
||||||
|
# if with_values:
|
||||||
|
# v = config.get(k)
|
||||||
|
# if v != None:
|
||||||
|
# s += str(v)
|
||||||
|
# s += '\n'
|
||||||
|
# dump_writer.write(s)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if load_callback != None:
|
if load_callback != None:
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class Rpc:
|
|||||||
self.id_generator = IntSequenceGenerator()
|
self.id_generator = IntSequenceGenerator()
|
||||||
|
|
||||||
self.chain_spec = config.get('CHAIN_SPEC')
|
self.chain_spec = config.get('CHAIN_SPEC')
|
||||||
self.conn = self.constructor(url=config.get('RPC_PROVIDER'), chain_spec=self.chain_spec, auth=auth)
|
self.conn = self.constructor(url=config.get('RPC_PROVIDER'), chain_spec=self.chain_spec, auth=auth, verify_identity=config.true('RPC_VERIFY'))
|
||||||
|
|
||||||
return self.conn
|
return self.conn
|
||||||
|
|
||||||
|
|||||||
@@ -102,10 +102,13 @@ class RPCConnection:
|
|||||||
}
|
}
|
||||||
__constructors_for_chains = {}
|
__constructors_for_chains = {}
|
||||||
|
|
||||||
def __init__(self, url=None, chain_spec=None, auth=None):
|
def __init__(self, url=None, chain_spec=None, auth=None, verify_identity=True):
|
||||||
self.chain_spec = chain_spec
|
self.chain_spec = chain_spec
|
||||||
self.location = None
|
self.location = None
|
||||||
self.basic = None
|
self.basic = None
|
||||||
|
self.verify_identity = verify_identity
|
||||||
|
if not self.verify_identity:
|
||||||
|
logg.warning('RPC host identity verification is OFF. Beware, you will be easy to cheat')
|
||||||
if url == None:
|
if url == None:
|
||||||
return
|
return
|
||||||
self.auth = auth
|
self.auth = auth
|
||||||
@@ -287,6 +290,11 @@ class JSONRPCHTTPConnection(HTTPConnection):
|
|||||||
:returns: Result value part of JSON RPC response
|
:returns: Result value part of JSON RPC response
|
||||||
:todo: Invalid response exception from invalid json response
|
:todo: Invalid response exception from invalid json response
|
||||||
"""
|
"""
|
||||||
|
ssl_ctx = None
|
||||||
|
if not self.verify_identity:
|
||||||
|
import ssl
|
||||||
|
ssl_ctx = ssl.SSLContext()
|
||||||
|
ssl_ctx.verify_mode = ssl.CERT_NONE
|
||||||
req = Request(
|
req = Request(
|
||||||
self.location,
|
self.location,
|
||||||
method='POST',
|
method='POST',
|
||||||
@@ -313,7 +321,11 @@ class JSONRPCHTTPConnection(HTTPConnection):
|
|||||||
install_opener(ho)
|
install_opener(ho)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = urlopen(req, data=data.encode('utf-8'))
|
r = urlopen(
|
||||||
|
req,
|
||||||
|
data=data.encode('utf-8'),
|
||||||
|
context=ssl_ctx,
|
||||||
|
)
|
||||||
except URLError as e:
|
except URLError as e:
|
||||||
raise RPCException(e)
|
raise RPCException(e)
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ auth =
|
|||||||
credentials =
|
credentials =
|
||||||
dialect = default
|
dialect = default
|
||||||
scheme = http
|
scheme = http
|
||||||
|
verify = 1
|
||||||
|
|
||||||
[chain]
|
[chain]
|
||||||
spec =
|
spec =
|
||||||
|
|||||||
29
setup.cfg
29
setup.cfg
@@ -1,10 +1,16 @@
|
|||||||
|
; Config::Simple 4.59
|
||||||
|
; Mon Nov 8 05:19:17 2021
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
name = chainlib
|
name=chainlib
|
||||||
version = 0.0.10
|
license=WTFPL2
|
||||||
description = Generic blockchain access library and tooling
|
author_email=dev@holbrook.no
|
||||||
author = Louis Holbrook
|
description=Generic blockchain access library and tooling
|
||||||
author_email = dev@holbrook.no
|
version=0.0.14
|
||||||
url = https://gitlab.com/chaintools/chainlib
|
url=https://gitlab.com/chaintools/chainlib
|
||||||
|
author=Louis Holbrook
|
||||||
|
|
||||||
|
|
||||||
keywords =
|
keywords =
|
||||||
dlt
|
dlt
|
||||||
blockchain
|
blockchain
|
||||||
@@ -18,14 +24,3 @@ classifiers =
|
|||||||
Intended Audience :: Developers
|
Intended Audience :: Developers
|
||||||
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
||||||
Topic :: Internet
|
Topic :: Internet
|
||||||
license = GPL3
|
|
||||||
licence_files =
|
|
||||||
LICENSE.txt
|
|
||||||
|
|
||||||
|
|
||||||
[options]
|
|
||||||
python_requires = >= 3.6
|
|
||||||
include_package_data = True
|
|
||||||
packages =
|
|
||||||
chainlib
|
|
||||||
chainlib.cli
|
|
||||||
|
|||||||
9
setup.py
9
setup.py
@@ -16,5 +16,12 @@ setup(
|
|||||||
install_requires=requirements,
|
install_requires=requirements,
|
||||||
extras_require={
|
extras_require={
|
||||||
'xdg': "pyxdg~=0.27",
|
'xdg': "pyxdg~=0.27",
|
||||||
}
|
},
|
||||||
|
license_files= ('LICENSE.txt',),
|
||||||
|
python_requires = '>=3.8',
|
||||||
|
include_package_data = True,
|
||||||
|
packages = [
|
||||||
|
'chainlib',
|
||||||
|
'chainlib.cli',
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user