chaind-eth

Queue server for ethereum
Info | Log | Files | Refs | README | LICENSE

gas.py (1045B)


      1 # external imports
      2 from chainlib.eth.gas import Gas
      3 from hexathon import strip_0x
      4 
      5 # local imports
      6 from chaind.eth.token import BaseTokenResolver
      7 
      8 
      9 class GasTokenResolver(BaseTokenResolver):
     10 
     11     def __init__(self, chain_spec, sender, signer, gas_oracle, nonce_oracle):
     12         super(GasTokenResolver, self).__init__(chain_spec, sender, signer, gas_oracle, nonce_oracle, advance_nonce=True)
     13         self.factory = Gas(self.chain_spec, signer=self.signer, gas_oracle=self.gas_oracle, nonce_oracle=self.nonce_oracle)
     14 
     15 
     16     def create(self, conn, recipient, gas_value, data=None, token_value=0, executable_address=None, passphrase=None):
     17 
     18         (gas_value, token_value, nonce) = self.get_values(gas_value, token_value, executable_address=executable_address)
     19 
     20         tx = {
     21             'from': self.sender,
     22             'to': recipient,
     23             'value': gas_value,
     24             'data': data,
     25             'nonce': nonce,
     26             'gasPrice': self.gas_price_start,
     27             'gas': self.gas_limit_start,
     28                 }
     29 
     30         return tx