Allow fee settings for read
This commit is contained in:
parent
5d7c5556d4
commit
6b5628cf28
@ -1,5 +1,6 @@
|
|||||||
# standard imports
|
# standard imports
|
||||||
import os
|
import os
|
||||||
|
import logging
|
||||||
|
|
||||||
# external imports
|
# external imports
|
||||||
from chainlib.cli import (
|
from chainlib.cli import (
|
||||||
@ -25,6 +26,9 @@ from chainlib.eth.nonce import (
|
|||||||
OverrideNonceOracle,
|
OverrideNonceOracle,
|
||||||
RPCNonceOracle,
|
RPCNonceOracle,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
logg = logging.getLogger(__name__)
|
||||||
|
|
||||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
|
||||||
@ -57,8 +61,6 @@ class Rpc(BaseRpc):
|
|||||||
|
|
||||||
if self.can_sign():
|
if self.can_sign():
|
||||||
nonce = None
|
nonce = None
|
||||||
fee_price = None
|
|
||||||
fee_limit = None
|
|
||||||
try:
|
try:
|
||||||
nonce = config.get('_NONCE')
|
nonce = config.get('_NONCE')
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -68,18 +70,22 @@ class Rpc(BaseRpc):
|
|||||||
else:
|
else:
|
||||||
self.nonce_oracle = RPCNonceOracle(self.get_sender_address(), self.conn, id_generator=self.id_generator)
|
self.nonce_oracle = RPCNonceOracle(self.get_sender_address(), self.conn, id_generator=self.id_generator)
|
||||||
|
|
||||||
try:
|
fee_price = None
|
||||||
fee_price = config.get('_FEE_PRICE')
|
fee_limit = None
|
||||||
except KeyError:
|
try:
|
||||||
pass
|
fee_price = config.get('_FEE_PRICE')
|
||||||
try:
|
except KeyError:
|
||||||
fee_limit = config.get('_FEE_LIMIT')
|
pass
|
||||||
except KeyError:
|
|
||||||
pass
|
try:
|
||||||
if fee_price != None or fee_limit != None:
|
fee_limit = config.get('_FEE_LIMIT')
|
||||||
self.fee_oracle = OverrideGasOracle(price=fee_price, limit=fee_limit, conn=self.conn, id_generator=self.id_generator)
|
except KeyError:
|
||||||
else:
|
pass
|
||||||
self.fee_oracle = RPCGasOracle(self.conn, id_generator=self.id_generator)
|
|
||||||
|
if fee_price != None or fee_limit != None:
|
||||||
|
self.fee_oracle = OverrideGasOracle(price=fee_price, limit=fee_limit, conn=self.conn, id_generator=self.id_generator)
|
||||||
|
else:
|
||||||
|
self.fee_oracle = RPCGasOracle(self.conn, id_generator=self.id_generator)
|
||||||
|
|
||||||
error_parser = None
|
error_parser = None
|
||||||
if config.get('RPC_DIALECT') == 'openethereum':
|
if config.get('RPC_DIALECT') == 'openethereum':
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
[rpc]
|
[rpc]
|
||||||
http_provider = http://localhost:8545
|
http_provider = http://localhost:8545
|
||||||
http_authentication =
|
provider =
|
||||||
http_username =
|
auth =
|
||||||
http_password =
|
credentials =
|
||||||
dialect = default
|
dialect = default
|
||||||
|
scheme = http
|
||||||
|
|
||||||
[chain]
|
[chain]
|
||||||
spec = evm:ethereum:1
|
spec = evm:ethereum:1
|
||||||
|
@ -133,7 +133,8 @@ def main():
|
|||||||
elif not is_checksum_address(address):
|
elif not is_checksum_address(address):
|
||||||
raise ValueError('invalid checksum address: {}'.format(address))
|
raise ValueError('invalid checksum address: {}'.format(address))
|
||||||
r = get_address(conn, address, rpc.id_generator, config.get('_HEIGHT'))
|
r = get_address(conn, address, rpc.id_generator, config.get('_HEIGHT'))
|
||||||
print(r)
|
if r != None:
|
||||||
|
print(r)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -110,22 +110,22 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return
|
return
|
||||||
|
|
||||||
elif signer_address != None:
|
if signer_address != None:
|
||||||
if chain_spec == None:
|
if chain_spec == None:
|
||||||
raise ValueError('chain spec must be specified')
|
raise ValueError('chain spec must be specified')
|
||||||
g = TxFactory(chain_spec, signer=rpc.get_signer(), gas_oracle=rpc.get_gas_oracle(), nonce_oracle=rpc.get_nonce_oracle())
|
g = TxFactory(chain_spec, signer=rpc.get_signer(), gas_oracle=rpc.get_gas_oracle(), nonce_oracle=rpc.get_nonce_oracle())
|
||||||
tx = g.template(signer_address, recipient, use_nonce=True)
|
tx = g.template(signer_address, exec_address, use_nonce=True)
|
||||||
if args.data != None:
|
if args.data != None:
|
||||||
tx = g.set_code(tx, add_0x(args.data))
|
tx = g.set_code(tx, add_0x(args.data))
|
||||||
|
|
||||||
(tx_hash_hex, o) = g.finalize(tx, id_generator=rpc.id_generator)
|
(tx_hash_hex, o) = g.finalize(tx, id_generator=rpc.id_generator)
|
||||||
|
|
||||||
if send:
|
if send:
|
||||||
r = conn.do(o)
|
r = conn.do(o)
|
||||||
print(r)
|
print(r)
|
||||||
else:
|
else:
|
||||||
print(o)
|
print(o)
|
||||||
print(tx_hash_hex)
|
print(tx_hash_hex)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
o = raw(args.data, id_generator=rpc.id_generator)
|
o = raw(args.data, id_generator=rpc.id_generator)
|
||||||
|
@ -3,5 +3,5 @@ pysha3==1.0.2
|
|||||||
hexathon~=0.0.1a8
|
hexathon~=0.0.1a8
|
||||||
websocket-client==0.57.0
|
websocket-client==0.57.0
|
||||||
potaahto~=0.0.1a1
|
potaahto~=0.0.1a1
|
||||||
chainlib==0.0.9a3
|
chainlib==0.0.9a6
|
||||||
confini>=0.4.1a1,<0.5.0
|
confini>=0.4.1a1,<0.5.0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = chainlib-eth
|
name = chainlib-eth
|
||||||
version = 0.0.9a7
|
version = 0.0.9a9
|
||||||
description = Ethereum implementation of the chainlib interface
|
description = Ethereum implementation of the chainlib interface
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user