Allow encode without nonce when not tx, add rcpt src to tx
This commit is contained in:
parent
b59eebe181
commit
c954f4d1b4
@ -1,3 +1,6 @@
|
|||||||
|
- 0.1.0:
|
||||||
|
* Allow nonce ommission in encode when not tx mode
|
||||||
|
* Add rcpt src to tx object
|
||||||
- 0.0.27:
|
- 0.0.27:
|
||||||
* Add man pages with chainlib man page generator helper
|
* Add man pages with chainlib man page generator helper
|
||||||
* Remove redundant arg flags from runnables: get
|
* Remove redundant arg flags from runnables: get
|
||||||
|
@ -11,8 +11,7 @@ import urllib
|
|||||||
import sha3
|
import sha3
|
||||||
|
|
||||||
# external imports
|
# external imports
|
||||||
import chainlib.eth.cli
|
from chainlib.cli import flag_reset
|
||||||
from chainlib.eth.cli.encode import CLIEncoder
|
|
||||||
from funga.eth.signer import EIP155Signer
|
from funga.eth.signer import EIP155Signer
|
||||||
from funga.eth.keystore.dict import DictKeystore
|
from funga.eth.keystore.dict import DictKeystore
|
||||||
from hexathon import (
|
from hexathon import (
|
||||||
@ -21,6 +20,8 @@ from hexathon import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
|
import chainlib.eth.cli
|
||||||
|
from chainlib.eth.cli.encode import CLIEncoder
|
||||||
from chainlib.eth.constant import ZERO_ADDRESS
|
from chainlib.eth.constant import ZERO_ADDRESS
|
||||||
from chainlib.eth.address import to_checksum
|
from chainlib.eth.address import to_checksum
|
||||||
from chainlib.eth.connection import EthHTTPConnection
|
from chainlib.eth.connection import EthHTTPConnection
|
||||||
@ -47,6 +48,7 @@ config_dir = os.path.join(script_dir, '..', 'data', 'config')
|
|||||||
|
|
||||||
|
|
||||||
arg_flags = chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC | chainlib.eth.cli.Flag.FEE | chainlib.eth.cli.Flag.FMT_HUMAN | chainlib.eth.cli.Flag.FMT_WIRE | chainlib.eth.cli.Flag.FMT_RPC
|
arg_flags = chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC | chainlib.eth.cli.Flag.FEE | chainlib.eth.cli.Flag.FMT_HUMAN | chainlib.eth.cli.Flag.FMT_WIRE | chainlib.eth.cli.Flag.FMT_RPC
|
||||||
|
arg_flags = flag_reset(arg_flags, chainlib.cli.Flag.NO_TARGET)
|
||||||
argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
|
argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
|
||||||
argparser.add_argument('--mode', type=str, choices=['tx', 'call', 'arg'], help='Mode of operation')
|
argparser.add_argument('--mode', type=str, choices=['tx', 'call', 'arg'], help='Mode of operation')
|
||||||
argparser.add_argument('--signature', type=str, help='Method signature to encode')
|
argparser.add_argument('--signature', type=str, help='Method signature to encode')
|
||||||
@ -131,9 +133,10 @@ def main():
|
|||||||
if not config.get('_FEE_LIMIT'):
|
if not config.get('_FEE_LIMIT'):
|
||||||
config.add(limit, '_FEE_LIMIT')
|
config.add(limit, '_FEE_LIMIT')
|
||||||
|
|
||||||
if not config.get('_NONCE'):
|
if mode == 'tx':
|
||||||
nonce_oracle = rpc.get_nonce_oracle()
|
if not config.get('_NONCE'):
|
||||||
config.add(nonce_oracle.get_nonce(), '_NONCE')
|
nonce_oracle = rpc.get_nonce_oracle()
|
||||||
|
config.add(nonce_oracle.get_nonce(), '_NONCE')
|
||||||
else:
|
else:
|
||||||
for arg in [
|
for arg in [
|
||||||
'_FEE_PRICE',
|
'_FEE_PRICE',
|
||||||
|
@ -571,11 +571,12 @@ class Tx(BaseTx):
|
|||||||
try:
|
try:
|
||||||
self.wire = src['raw']
|
self.wire = src['raw']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logg.warning('no inline raw tx src, and no raw rendering implemented, field will be "None"')
|
logg.debug('no inline raw tx src, and no raw rendering implemented, field will be "None"')
|
||||||
|
|
||||||
self.status = Status.PENDING
|
self.status = Status.PENDING
|
||||||
self.logs = None
|
self.logs = None
|
||||||
|
|
||||||
|
self.tx_rcpt_src = None
|
||||||
if rcpt != None:
|
if rcpt != None:
|
||||||
self.apply_receipt(rcpt, strict=strict)
|
self.apply_receipt(rcpt, strict=strict)
|
||||||
|
|
||||||
@ -620,6 +621,10 @@ class Tx(BaseTx):
|
|||||||
return self.src()
|
return self.src()
|
||||||
|
|
||||||
|
|
||||||
|
def rcpt_src(self):
|
||||||
|
return self.tx_rcpt_src
|
||||||
|
|
||||||
|
|
||||||
def apply_receipt(self, rcpt, strict=False):
|
def apply_receipt(self, rcpt, strict=False):
|
||||||
"""Apply receipt data to transaction object.
|
"""Apply receipt data to transaction object.
|
||||||
|
|
||||||
@ -630,6 +635,7 @@ class Tx(BaseTx):
|
|||||||
"""
|
"""
|
||||||
rcpt = self.src_normalize(rcpt)
|
rcpt = self.src_normalize(rcpt)
|
||||||
logg.debug('rcpt {}'.format(rcpt))
|
logg.debug('rcpt {}'.format(rcpt))
|
||||||
|
self.tx_rcpt_src = rcpt
|
||||||
|
|
||||||
tx_hash = add_0x(rcpt['transaction_hash'])
|
tx_hash = add_0x(rcpt['transaction_hash'])
|
||||||
if rcpt['transaction_hash'] != add_0x(self.hash):
|
if rcpt['transaction_hash'] != add_0x(self.hash):
|
||||||
@ -647,7 +653,7 @@ class Tx(BaseTx):
|
|||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
if strict:
|
if strict:
|
||||||
raise(e)
|
raise(e)
|
||||||
logg.warning('setting "sucess" status on missing status property for {}'.format(self.hash))
|
logg.debug('setting "success" status on missing status property for {}'.format(self.hash))
|
||||||
status_number = 1
|
status_number = 1
|
||||||
|
|
||||||
if rcpt['block_number'] == None:
|
if rcpt['block_number'] == None:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = chainlib-eth
|
name = chainlib-eth
|
||||||
version = 0.0.27
|
version = 0.1.0b2
|
||||||
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