Bump registry

This commit is contained in:
nolash 2021-02-17 10:13:22 +01:00
parent 7838244a90
commit 0c43d17816
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
4 changed files with 18 additions and 7 deletions

View File

@ -16,7 +16,7 @@ import argparse
import logging
# third-party imports
from chainlib.eth.tx import unpack_signed
from chainlib.eth.tx import unpack
logging.basicConfig(level=logging.WARNING)
@ -42,7 +42,7 @@ def main():
if tx_raw[:2] == '0x':
tx_raw = tx_raw[2:]
tx_raw_bytes = bytes.fromhex(tx_raw)
tx = unpack_signed(tx_raw_bytes, int(chain_id))
tx = unpack(tx_raw_bytes, int(chain_id))
for k in tx.keys():
print('{}: {}'.format(k, tx[k]))

View File

@ -39,7 +39,7 @@ field_debugs = [
's',
]
def unpack_signed(tx_raw_bytes, chain_id=1):
def unpack(tx_raw_bytes, chain_id=1):
d = rlp_decode(tx_raw_bytes)
logg.debug('decoding using chain id {}'.format(chain_id))
@ -94,6 +94,13 @@ def unpack_signed(tx_raw_bytes, chain_id=1):
}
def receipt(hsh):
o = jsonrpc_template()
o['method'] = 'eth_getTransactionReceipt'
o['params'].append(hsh)
return o
class TxFactory:
def __init__(self, signer=None, gas_oracle=None, nonce_oracle=None, chain_id=1):
@ -103,12 +110,16 @@ class TxFactory:
self.signer = signer
def build(self, tx):
def build_raw(self, tx):
txe = EIP155Transaction(tx, tx['nonce'], tx['chainId'])
self.signer.signTransaction(txe)
tx_raw = txe.rlp_serialize()
tx_raw_hex = add_0x(tx_raw.hex())
tx_hash_hex = add_0x(keccak256_hex_to_hex(tx_raw_hex))
return (tx_hash_hex, tx_raw_hex)
def build(self, tx):
(tx_hash_hex, tx_raw_hex) = self.build_raw(tx)
o = jsonrpc_template()
o['method'] = 'eth_sendRawTransaction'

View File

@ -1,8 +1,8 @@
cryptocurrency-cli-tools==0.0.4
cryptocurrency-cli-tools~=0.0.4
faker==4.17.1
crypto-dev-signer~=0.4.13rc2
pysha3==1.0.2
hexathon==0.0.1a2
hexathon~=0.0.1a3
eth-abi==2.1.1
eth-keys==0.3.3
websocket-client==0.57.0

View File

@ -1,6 +1,6 @@
[metadata]
name = chainlib
version = 0.0.1a11
version = 0.0.1a12
description = Generic blockchain access library and tooling
author = Louis Holbrook
author_email = dev@holbrook.no