base_proto.ethereum.tx.new: move __init__ from base class
This commit is contained in:
parent
a81ff33f08
commit
cda6e2c3ce
2 changed files with 15 additions and 17 deletions
|
|
@ -17,7 +17,7 @@ import json
|
|||
import mmgen.tx.new as TxBase
|
||||
from .base import Base,TokenBase
|
||||
from ....opts import opt
|
||||
from ....obj import Int,ETHNonce,MMGenTxID,Str
|
||||
from ....obj import Int,ETHNonce,MMGenTxID,Str,HexStr
|
||||
from ....amt import ETHAmt
|
||||
from ....util import msg,line_input,is_int,is_hex_str,make_chksum_6
|
||||
from ....tw.ctl import TrackingWallet
|
||||
|
|
@ -31,6 +31,19 @@ class New(Base,TxBase.New):
|
|||
usr_fee_prompt = 'Enter transaction fee or gas price: '
|
||||
hexdata_type = 'hex'
|
||||
|
||||
def __init__(self,*args,**kwargs):
|
||||
|
||||
super().__init__(*args,**kwargs)
|
||||
|
||||
if opt.tx_gas:
|
||||
self.tx_gas = self.start_gas = ETHAmt(int(opt.tx_gas),'wei')
|
||||
if opt.contract_data:
|
||||
m = "'--contract-data' option may not be used with token transaction"
|
||||
assert not 'Token' in type(self).__name__, m
|
||||
with open(opt.contract_data) as fp:
|
||||
self.usr_contract_data = HexStr(fp.read().strip())
|
||||
self.disable_fee_check = True
|
||||
|
||||
async def get_nonce(self):
|
||||
return ETHNonce(int(await self.rpc.call('eth_getTransactionCount','0x'+self.inputs[0].addr,'pending'),16))
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ from ..globalvars import *
|
|||
from ..opts import opt
|
||||
from .base import Base
|
||||
from ..color import pink
|
||||
from ..obj import get_obj,HexStr
|
||||
from ..obj import get_obj
|
||||
from ..util import msg,qmsg,fmt,die,suf,remove_dups,get_extension,keypress_confirm,do_license_msg,line_input
|
||||
from ..addr import is_mmgen_id,CoinAddr,is_coin_addr
|
||||
|
||||
|
|
@ -69,21 +69,6 @@ class New(Base):
|
|||
only one output, specify a single output address with no {} amount
|
||||
"""
|
||||
|
||||
def __init__(self,*args,**kwargs):
|
||||
|
||||
super().__init__(*args,**kwargs)
|
||||
|
||||
if self.proto.base_proto == 'Ethereum':
|
||||
if opt.tx_gas:
|
||||
from ..amt import ETHAmt
|
||||
self.tx_gas = self.start_gas = ETHAmt(int(opt.tx_gas),'wei')
|
||||
if opt.contract_data:
|
||||
m = "'--contract-data' option may not be used with token transaction"
|
||||
assert not 'Token' in type(self).__name__, m
|
||||
with open(opt.contract_data) as fp:
|
||||
self.usr_contract_data = HexStr(fp.read().strip())
|
||||
self.disable_fee_check = True
|
||||
|
||||
def update_output_amt(self,idx,amt):
|
||||
o = self.outputs[idx]._asdict()
|
||||
o['amt'] = amt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue