mirror of
git://holbrook.no/eth-address-index
synced 2026-04-26 02:37:14 +02:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c71c9d6c0b
|
||
|
|
cdb7bdd777
|
||
|
|
243f0e325c
|
||
|
|
aab2107efc
|
||
|
|
aa99032d00 | ||
| 0d2ec53b69 | |||
| d68995329c |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,3 +4,5 @@ dist/
|
|||||||
__pycache__
|
__pycache__
|
||||||
*.pyc
|
*.pyc
|
||||||
gmon.out
|
gmon.out
|
||||||
|
.idea
|
||||||
|
venv
|
||||||
|
|||||||
58
.gitlab-ci.yml
Normal file
58
.gitlab-ci.yml
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
stages:
|
||||||
|
- test
|
||||||
|
- run-coverage
|
||||||
|
- slither-analyzer
|
||||||
|
|
||||||
|
|
||||||
|
variables:
|
||||||
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
||||||
|
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- .cache/pip
|
||||||
|
- .venv/
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- python -V # Print out python version for debugging
|
||||||
|
- pip install virtualenv
|
||||||
|
- virtualenv venv
|
||||||
|
- source venv/bin/activate
|
||||||
|
|
||||||
|
test:
|
||||||
|
image: registry.gitlab.com/grassrootseconomics/cic-base-images/ci-solc-python:latest
|
||||||
|
script:
|
||||||
|
# install test dependencies
|
||||||
|
- cd python
|
||||||
|
- export PYTHONPATH=.
|
||||||
|
- pip install --extra-index-url https://pip.grassrootseconomics.net
|
||||||
|
--extra-index-url https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple
|
||||||
|
-r requirements.txt -r test_requirements.txt
|
||||||
|
# run tests
|
||||||
|
- bash run_tests.sh
|
||||||
|
|
||||||
|
run-coverage:
|
||||||
|
stage: test
|
||||||
|
image: registry.gitlab.com/grassrootseconomics/cic-base-images/ci-solc-python:latest
|
||||||
|
script:
|
||||||
|
- cd python
|
||||||
|
- export PYTHONPATH=.
|
||||||
|
- pip install --extra-index-url https://pip.grassrootseconomics.net
|
||||||
|
--extra-index-url https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple
|
||||||
|
-r requirements.txt -r test_requirements.txt
|
||||||
|
- pip install pytest pytest-cov
|
||||||
|
- coverage run -m pytest
|
||||||
|
- coverage html
|
||||||
|
- coverage report --fail-under=90
|
||||||
|
|
||||||
|
coverage: '/^TOTAL.+?(\d+\%)$/'
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
cobertura: python/htmlcov/index.html
|
||||||
|
|
||||||
|
slither-analyzer:
|
||||||
|
image: registry.gitlab.com/grassrootseconomics/cic-base-images/ci-solc-python:latest
|
||||||
|
allow_failure: true
|
||||||
|
script:
|
||||||
|
- cd solidity
|
||||||
|
- slither AddressDeclarator.sol
|
||||||
|
- slither AddressDeclarator.sol --print human-summary
|
||||||
BIN
python/.coverage
Normal file
BIN
python/.coverage
Normal file
Binary file not shown.
7
python/.coveragerc
Normal file
7
python/.coveragerc
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[run]
|
||||||
|
branch = True
|
||||||
|
[report]
|
||||||
|
omit = .venv/*
|
||||||
|
**/runnable/*.py
|
||||||
|
[html]
|
||||||
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
"""Adds a new Address declaration
|
"""Adds a new Address declaration
|
||||||
|
|
||||||
.. moduleauthor:: Louis Holbrook <dev@holbrook.no>
|
.. moduleauthor:: Louis Holbrook <dev@holbrook.no>
|
||||||
.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||||
|
|
||||||
@@ -7,8 +6,6 @@
|
|||||||
|
|
||||||
# standard imports
|
# standard imports
|
||||||
import os
|
import os
|
||||||
import json
|
|
||||||
import argparse
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# external imports
|
# external imports
|
||||||
@@ -21,6 +18,19 @@ from hexathon import (
|
|||||||
add_0x,
|
add_0x,
|
||||||
strip_0x,
|
strip_0x,
|
||||||
)
|
)
|
||||||
|
from chainlib.eth.cli.arg import (
|
||||||
|
Arg,
|
||||||
|
ArgFlag,
|
||||||
|
process_args,
|
||||||
|
)
|
||||||
|
from chainlib.eth.cli.config import (
|
||||||
|
Config,
|
||||||
|
process_config,
|
||||||
|
)
|
||||||
|
from chainlib.eth.cli.log import process_log
|
||||||
|
from chainlib.eth.settings import process_settings
|
||||||
|
from chainlib.settings import ChainSettings
|
||||||
|
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from eth_address_declarator.declarator import AddressDeclarator
|
from eth_address_declarator.declarator import AddressDeclarator
|
||||||
@@ -28,58 +38,57 @@ from eth_address_declarator.declarator import AddressDeclarator
|
|||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
script_dir = os.path.dirname(__file__)
|
|
||||||
data_dir = os.path.join(script_dir, '..', 'data')
|
|
||||||
|
|
||||||
arg_flags = chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC
|
def process_config_local(config, arg, args, flags):
|
||||||
argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
|
hsh = strip_0x(config.get('_POSARG'))
|
||||||
argparser.add_argument('-a', '--address', type=str, help='Address to add declaration for')
|
if len(hsh) != 64:
|
||||||
argparser.add_positional('declaration', type=str, help='SHA256 sum of endorsement data to add')
|
raise ValueError('declaration hash must be 32 bytes')
|
||||||
|
config.add(hsh, '_DECLARATION')
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
arg_flags = ArgFlag()
|
||||||
|
arg = Arg(arg_flags)
|
||||||
|
flags = arg_flags.STD_WRITE | arg_flags.WALLET | arg_flags.EXEC
|
||||||
|
|
||||||
|
argparser = chainlib.eth.cli.ArgumentParser()
|
||||||
|
argparser = process_args(argparser, arg, flags)
|
||||||
|
argparser.add_argument('declaration', type=str, help='SHA256 sum of endorsement data to add')
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
|
||||||
extra_args = {
|
logg = process_log(args, logg)
|
||||||
'address': None,
|
|
||||||
'declaration': None,
|
|
||||||
}
|
|
||||||
config = chainlib.eth.cli.Config.from_args(args, arg_flags, extra_args=extra_args, default_fee_limit=AddressDeclarator.gas())
|
|
||||||
|
|
||||||
wallet = chainlib.eth.cli.Wallet()
|
config = Config()
|
||||||
wallet.from_config(config)
|
config = process_config(config, arg, args, flags, positional_name='declaration')
|
||||||
|
config = process_config_local(config, arg, args, flags)
|
||||||
|
logg.debug('config loaded:\n{}'.format(config))
|
||||||
|
|
||||||
rpc = chainlib.eth.cli.Rpc(wallet=wallet)
|
settings = ChainSettings()
|
||||||
conn = rpc.connect_by_config(config)
|
settings = process_settings(settings, config)
|
||||||
|
logg.debug('settings loaded:\n{}'.format(settings))
|
||||||
chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
signer = rpc.get_signer()
|
conn = settings.get('CONN')
|
||||||
signer_address = rpc.get_sender_address()
|
c = AddressDeclarator(
|
||||||
|
settings.get('CHAIN_SPEC'),
|
||||||
|
signer=settings.get('SIGNER'),
|
||||||
|
gas_oracle=settings.get('FEE_ORACLE'),
|
||||||
|
nonce_oracle=settings.get('NONCE_ORACLE'),
|
||||||
|
)
|
||||||
|
subject_address = to_checksum_address(settings.get('RECIPIENT'))
|
||||||
|
contract_address = to_checksum_address(settings.get('EXEC'))
|
||||||
|
|
||||||
gas_oracle = rpc.get_gas_oracle()
|
(tx_hash_hex, o) = c.add_declaration(
|
||||||
nonce_oracle = rpc.get_nonce_oracle()
|
settings.get('EXEC'),
|
||||||
|
settings.get('SENDER_ADDRESS'),
|
||||||
|
settings.get('RECIPIENT'),
|
||||||
|
add_0x(config.get('_DECLARATION')),
|
||||||
|
)
|
||||||
|
|
||||||
c = AddressDeclarator(chain_spec, signer=signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
|
if settings.get('RPC_SEND'):
|
||||||
|
|
||||||
subject_address = to_checksum_address(config.get('_ADDRESS'))
|
|
||||||
if not config.true('_UNSAFE') and subject_address != add_0x(config.get('_ADDRESS')):
|
|
||||||
raise ValueError('invalid checksum address for subject_address')
|
|
||||||
|
|
||||||
contract_address = to_checksum_address(config.get('_EXEC_ADDRESS'))
|
|
||||||
if not config.true('_UNSAFE') and contract_address != add_0x(config.get('_EXEC_ADDRESS')):
|
|
||||||
raise ValueError('invalid checksum address for contract')
|
|
||||||
|
|
||||||
declaration = config.get('_DECLARATION')
|
|
||||||
declaration_bytes = bytes.fromhex(strip_0x(declaration))
|
|
||||||
if len(declaration_bytes) != 32:
|
|
||||||
raise ValueError('declaration hash must be 32 bytes')
|
|
||||||
declaration = add_0x(declaration)
|
|
||||||
|
|
||||||
(tx_hash_hex, o) = c.add_declaration(contract_address, signer_address, subject_address, declaration)
|
|
||||||
|
|
||||||
if config.get('_RPC_SEND'):
|
|
||||||
conn.do(o)
|
conn.do(o)
|
||||||
if config.get('_WAIT'):
|
if config.true('_WAIT'):
|
||||||
r = conn.wait(tx_hash_hex)
|
r = conn.wait(tx_hash_hex)
|
||||||
if r['status'] == 0:
|
if r['status'] == 0:
|
||||||
sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you')
|
sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you')
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
"""Deploys address declaration contract
|
|
||||||
|
|
||||||
.. moduleauthor:: Louis Holbrook <dev@holbrook.no>
|
|
||||||
.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
# standard imports
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
import argparse
|
|
||||||
import logging
|
|
||||||
from hexathon import (
|
|
||||||
add_0x,
|
|
||||||
strip_0x,
|
|
||||||
)
|
|
||||||
|
|
||||||
# external imports
|
|
||||||
import chainlib.eth.cli
|
|
||||||
from chainlib.chain import ChainSpec
|
|
||||||
from chainlib.eth.connection import EthHTTPConnection
|
|
||||||
from chainlib.eth.tx import receipt
|
|
||||||
|
|
||||||
# local imports
|
|
||||||
from eth_address_declarator.declarator import AddressDeclarator
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
|
||||||
logg = logging.getLogger()
|
|
||||||
|
|
||||||
arg_flags = chainlib.eth.cli.argflag_std_write
|
|
||||||
argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
|
|
||||||
argparser.add_argument('owner_description_hash', type=str, help='SHA256 of description metadata of contract deployer')
|
|
||||||
args = argparser.parse_args()
|
|
||||||
|
|
||||||
extra_args = {
|
|
||||||
'owner_description_hash': None,
|
|
||||||
}
|
|
||||||
config = chainlib.eth.cli.Config.from_args(args, arg_flags, extra_args=extra_args, default_fee_limit=AddressDeclarator.gas())
|
|
||||||
|
|
||||||
wallet = chainlib.eth.cli.Wallet()
|
|
||||||
wallet.from_config(config)
|
|
||||||
|
|
||||||
rpc = chainlib.eth.cli.Rpc(wallet=wallet)
|
|
||||||
conn = rpc.connect_by_config(config)
|
|
||||||
|
|
||||||
chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
signer = rpc.get_signer()
|
|
||||||
signer_address = rpc.get_sender_address()
|
|
||||||
|
|
||||||
gas_oracle = rpc.get_gas_oracle()
|
|
||||||
nonce_oracle = rpc.get_nonce_oracle()
|
|
||||||
|
|
||||||
c = AddressDeclarator(chain_spec, signer=signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
|
|
||||||
|
|
||||||
owner_description_hash = config.get('_OWNER_DESCRIPTION_HASH')
|
|
||||||
owner_description_hash_bytes = bytes.fromhex(strip_0x(owner_description_hash))
|
|
||||||
if len(owner_description_hash_bytes) != 32:
|
|
||||||
raise ValueError('chain config hash must be 32 bytes')
|
|
||||||
owner_description_hash = add_0x(owner_description_hash)
|
|
||||||
|
|
||||||
(tx_hash_hex, o) = c.constructor(signer_address, owner_description_hash)
|
|
||||||
if config.get('_RPC_SEND'):
|
|
||||||
conn.do(o)
|
|
||||||
if config.get('_WAIT'):
|
|
||||||
r = conn.wait(tx_hash_hex)
|
|
||||||
if r['status'] == 0:
|
|
||||||
sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you')
|
|
||||||
sys.exit(1)
|
|
||||||
# TODO: pass through translator for keys (evm tester uses underscore instead of camelcase)
|
|
||||||
address = r['contractAddress']
|
|
||||||
|
|
||||||
print(address)
|
|
||||||
else:
|
|
||||||
print(tx_hash_hex)
|
|
||||||
else:
|
|
||||||
print(o)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
108
python/eth_address_declarator/runnable/publish.py
Normal file
108
python/eth_address_declarator/runnable/publish.py
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
"""Deploys address declaration contract
|
||||||
|
|
||||||
|
.. moduleauthor:: Louis Holbrook <dev@holbrook.no>
|
||||||
|
.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# standard imports
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import logging
|
||||||
|
from hexathon import (
|
||||||
|
add_0x,
|
||||||
|
strip_0x,
|
||||||
|
)
|
||||||
|
|
||||||
|
# external imports
|
||||||
|
import chainlib.eth.cli
|
||||||
|
from chainlib.chain import ChainSpec
|
||||||
|
from chainlib.eth.connection import EthHTTPConnection
|
||||||
|
from chainlib.eth.tx import receipt
|
||||||
|
from chainlib.eth.cli.arg import (
|
||||||
|
Arg,
|
||||||
|
ArgFlag,
|
||||||
|
process_args,
|
||||||
|
)
|
||||||
|
from chainlib.eth.cli.config import (
|
||||||
|
Config,
|
||||||
|
process_config,
|
||||||
|
)
|
||||||
|
from chainlib.eth.cli.log import process_log
|
||||||
|
from chainlib.eth.settings import process_settings
|
||||||
|
from chainlib.settings import ChainSettings
|
||||||
|
from chainlib.eth.constant import ZERO_CONTENT
|
||||||
|
|
||||||
|
# local imports
|
||||||
|
from eth_address_declarator.declarator import AddressDeclarator
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.WARNING)
|
||||||
|
logg = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
|
def process_config_local(config, arg, args, flags):
|
||||||
|
hsh = args.owner_description_hash
|
||||||
|
if hsh == None:
|
||||||
|
hsh = ZERO_CONTENT
|
||||||
|
hsh = add_0x(hsh)
|
||||||
|
config.add(hsh, '_OWNER_DESCRIPTION_HASH')
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
arg_flags = ArgFlag()
|
||||||
|
arg = Arg(arg_flags)
|
||||||
|
flags = arg_flags.STD_WRITE
|
||||||
|
|
||||||
|
argparser = chainlib.eth.cli.ArgumentParser()
|
||||||
|
argparser = process_args(argparser, arg, flags)
|
||||||
|
argparser.add_argument('--owner-description-hash', type=str, help='SHA256 of description metadata of contract deployer')
|
||||||
|
args = argparser.parse_args()
|
||||||
|
|
||||||
|
logg = process_log(args, logg)
|
||||||
|
|
||||||
|
config = Config()
|
||||||
|
config = process_config(config, arg, args, flags)
|
||||||
|
config = process_config_local(config, arg, args, flags)
|
||||||
|
logg.debug('config loaded:\n{}'.format(config))
|
||||||
|
|
||||||
|
settings = ChainSettings()
|
||||||
|
settings = process_settings(settings, config)
|
||||||
|
logg.debug('settings loaded:\n{}'.format(settings))
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
conn = settings.get('CONN')
|
||||||
|
c = AddressDeclarator(
|
||||||
|
settings.get('CHAIN_SPEC'),
|
||||||
|
signer=settings.get('SIGNER'),
|
||||||
|
gas_oracle=settings.get('FEE_ORACLE'),
|
||||||
|
nonce_oracle=settings.get('NONCE_ORACLE'),
|
||||||
|
)
|
||||||
|
owner_description_hash = config.get('_OWNER_DESCRIPTION_HASH')
|
||||||
|
owner_description_hash_bytes = bytes.fromhex(strip_0x(owner_description_hash))
|
||||||
|
if len(owner_description_hash_bytes) != 32:
|
||||||
|
raise ValueError('chain config hash must be 32 bytes')
|
||||||
|
|
||||||
|
(tx_hash_hex, o) = c.constructor(
|
||||||
|
settings.get('SENDER_ADDRESS'),
|
||||||
|
owner_description_hash,
|
||||||
|
)
|
||||||
|
if settings.get('RPC_SEND'):
|
||||||
|
conn.do(o)
|
||||||
|
if config.true('_WAIT'):
|
||||||
|
r = conn.wait(tx_hash_hex)
|
||||||
|
if r['status'] == 0:
|
||||||
|
sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you')
|
||||||
|
sys.exit(1)
|
||||||
|
# TODO: pass through translator for keys (evm tester uses underscore instead of camelcase)
|
||||||
|
address = r['contractAddress']
|
||||||
|
|
||||||
|
print(address)
|
||||||
|
else:
|
||||||
|
print(tx_hash_hex)
|
||||||
|
else:
|
||||||
|
print(o)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -6,10 +6,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# standard imports
|
# standard imports
|
||||||
import urllib
|
|
||||||
import os
|
import os
|
||||||
import json
|
|
||||||
import argparse
|
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -22,6 +19,19 @@ from hexathon import (
|
|||||||
add_0x,
|
add_0x,
|
||||||
strip_0x,
|
strip_0x,
|
||||||
)
|
)
|
||||||
|
from chainlib.eth.cli.arg import (
|
||||||
|
Arg,
|
||||||
|
ArgFlag,
|
||||||
|
process_args,
|
||||||
|
)
|
||||||
|
from chainlib.eth.cli.config import (
|
||||||
|
Config,
|
||||||
|
process_config,
|
||||||
|
)
|
||||||
|
from chainlib.eth.cli.log import process_log
|
||||||
|
from chainlib.eth.settings import process_settings
|
||||||
|
from chainlib.settings import ChainSettings
|
||||||
|
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from eth_address_declarator import Declarator
|
from eth_address_declarator import Declarator
|
||||||
@@ -30,27 +40,38 @@ from eth_address_declarator.declarator import AddressDeclarator
|
|||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
#argparser.add_argument('--resolve', action='store_true', help='Attempt to resolve the hashes to actual content')
|
|
||||||
#argparser.add_argument('--resolve-http', dest='resolve_http', type=str, help='Base url to look up content hashes')
|
def process_config_local(config, arg, args, flags):
|
||||||
arg_flags = chainlib.eth.cli.argflag_std_read | chainlib.eth.cli.Flag.EXEC | chainlib.eth.cli.Flag.WALLET
|
a = strip_0x(config.get('_POSARG'))
|
||||||
argparser = chainlib.eth.cli.ArgumentParser(arg_flags, arg_long={'-a': '--declarator-address'})
|
ac = to_checksum_address(a)
|
||||||
argparser.add_positional('address', type=str, help='Ethereum declaration address to look up')
|
if config.true('_UNSAFE'):
|
||||||
|
a = ac
|
||||||
|
else:
|
||||||
|
if a != ac:
|
||||||
|
raise ValueError('declarator is not a valid checksum address')
|
||||||
|
config.add(a, '_DECLARATOR')
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
arg_flags = ArgFlag()
|
||||||
|
arg = Arg(arg_flags)
|
||||||
|
flags = arg_flags.STD_WRITE | arg_flags.WALLET | arg_flags.EXEC
|
||||||
|
|
||||||
|
argparser = chainlib.eth.cli.ArgumentParser()
|
||||||
|
argparser = process_args(argparser, arg, flags)
|
||||||
|
argparser.add_argument('declarator', type=str, help='Ethereum declaration address to look up')
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
|
||||||
extra_args = {
|
logg = process_log(args, logg)
|
||||||
'address': None,
|
|
||||||
}
|
|
||||||
config = chainlib.eth.cli.Config.from_args(args, arg_flags, extra_args=extra_args, default_fee_limit=AddressDeclarator.gas())
|
|
||||||
|
|
||||||
wallet = chainlib.eth.cli.Wallet()
|
config = Config()
|
||||||
wallet.from_config(config)
|
config = process_config(config, arg, args, flags, positional_name='declarator')
|
||||||
|
config = process_config_local(config, arg, args, flags)
|
||||||
|
logg.debug('config loaded:\n{}'.format(config))
|
||||||
|
|
||||||
rpc = chainlib.eth.cli.Rpc()
|
settings = ChainSettings()
|
||||||
conn = rpc.connect_by_config(config)
|
settings = process_settings(settings, config)
|
||||||
|
logg.debug('settings loaded:\n{}'.format(settings))
|
||||||
chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
|
|
||||||
|
|
||||||
declarator_address = config.get('_WALLET_ADDRESS')
|
|
||||||
|
|
||||||
|
|
||||||
def out_element(e, w=sys.stdout):
|
def out_element(e, w=sys.stdout):
|
||||||
@@ -68,41 +89,20 @@ def ls(ifc, conn, contract_address, declarator_address, subject_address, w=sys.s
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
c = Declarator(chain_spec)
|
c = Declarator(
|
||||||
|
settings.get('CHAIN_SPEC')
|
||||||
|
)
|
||||||
|
|
||||||
contract_address = to_checksum_address(config.get('_EXEC_ADDRESS'))
|
ls(
|
||||||
if not config.true('_UNSAFE') and contract_address != add_0x(config.get('_EXEC_ADDRESS')):
|
c,
|
||||||
raise ValueError('invalid checksum address for contract')
|
settings.get('CONN'),
|
||||||
|
settings.get('EXEC'),
|
||||||
|
config.get('_DECLARATOR'),
|
||||||
declarator_address = to_checksum_address(config.get('_DECLARATOR_ADDRESS'))
|
settings.get('RECIPIENT'),
|
||||||
if not config.true('_UNSAFE') and declarator_address != add_0x(config.get('_DECLARATOR_ADDRESS')):
|
)
|
||||||
raise ValueError('invalid checksum address for declarator')
|
|
||||||
|
|
||||||
subject_address = to_checksum_address(config.get('_ADDRESS'))
|
|
||||||
if not config.true('_UNSAFE') and subject_address != add_0x(config.get('_ADDRESS')):
|
|
||||||
raise ValueError('invalid checksum address for subject')
|
|
||||||
|
|
||||||
ls(c, conn, contract_address, declarator_address, subject_address)
|
|
||||||
|
|
||||||
declarations = []
|
declarations = []
|
||||||
|
|
||||||
# for d in declarations:
|
|
||||||
# if not args.resolve:
|
|
||||||
# print(d.hex())
|
|
||||||
# continue
|
|
||||||
# if args.resolve_http:
|
|
||||||
# try:
|
|
||||||
# r = try_sha256(d)
|
|
||||||
# print(r)
|
|
||||||
# continue
|
|
||||||
# except urllib.error.HTTPError:
|
|
||||||
# pass
|
|
||||||
# try:
|
|
||||||
# print(try_utf8(d))
|
|
||||||
# except UnicodeDecodeError:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
confini~=0.6.0
|
confini~=0.6.0
|
||||||
chainlib-eth>=0.1.0b1,<0.2.0
|
chainlib-eth~=0.4.7
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = eth-address-index
|
name = eth-address-index
|
||||||
version = 0.5.0
|
version = 0.6.0
|
||||||
description = Signed metadata declarations for ethereum addresses
|
description = Signed metadata declarations for ethereum addresses
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
@@ -36,6 +36,6 @@ packages =
|
|||||||
|
|
||||||
[options.entry_points]
|
[options.entry_points]
|
||||||
console_scripts =
|
console_scripts =
|
||||||
eth-address-declarator-deploy = eth_address_declarator.runnable.deploy:main
|
eth-address-declarator-publish = eth_address_declarator.runnable.publish:main
|
||||||
eth-address-declarator-add = eth_address_declarator.runnable.add:main
|
eth-address-declarator-add = eth_address_declarator.runnable.add:main
|
||||||
eth-address-declarator-view = eth_address_declarator.runnable.view:main
|
eth-address-declarator-view = eth_address_declarator.runnable.view:main
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
eth-tester==0.5.0b3
|
eth-tester==0.5.0b3
|
||||||
py-evm==0.3.0a20
|
py-evm==0.3.0a20
|
||||||
eth-accounts-index~=0.1.3
|
eth-accounts-index~=0.3.4
|
||||||
eth_erc20~=0.1.5
|
eth_erc20~=0.5.0
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user