proto.eth.params: add multiple_txhex mmcap
This commit is contained in:
parent
4785f2cd36
commit
7e442eadad
5 changed files with 18 additions and 13 deletions
|
|
@ -159,6 +159,15 @@ async def process_tx(tx):
|
|||
if tx.is_compat and not cfg.autosign:
|
||||
die(1, 'Sending XMR transaction via compatibility layer requires --autosign')
|
||||
|
||||
if cfg.txhex_idx:
|
||||
if not 'multiple_txhex' in tx.proto.mmcaps:
|
||||
die(1, f'--txhex-idx not supported for {tx.proto.name} protocol')
|
||||
if getattr(tx, 'coin_txid2', None):
|
||||
if cfg.txhex_idx not in ('1', '2'):
|
||||
die(1, f'{cfg.txhex_idx}: invalid parameter for --txhex-idx (must be 1 or 2)')
|
||||
else:
|
||||
die(1, '--txhex-idx not supported for transactions with only one part')
|
||||
|
||||
txcfg = Config({'_clone': cfg, 'proto': tx.proto, 'coin': tx.proto.coin})
|
||||
|
||||
if (not post_send_op) and cfg.tx_proxy:
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ class Status(TxBase.Status):
|
|||
msg(message)
|
||||
return exitval
|
||||
|
||||
assert idx == '', f'multiple txhex not supported for {self.tx.proto}'
|
||||
tx = self.tx
|
||||
|
||||
class r:
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class mainnet(CoinProtocol.DummyWIF, CoinProtocol.Secp256k1):
|
|||
chain_names = ['ethereum', 'foundation']
|
||||
sign_mode = 'standalone'
|
||||
caps = ('token',)
|
||||
mmcaps = ('rpc', 'rpc_init', 'tw', 'msg')
|
||||
mmcaps = ('rpc', 'rpc_init', 'tw', 'msg', 'multiple_txhex')
|
||||
base_proto = 'Ethereum'
|
||||
base_proto_coin = 'ETH'
|
||||
base_coin = 'ETH'
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
proto.eth.tx.online: Ethereum online signed transaction class
|
||||
"""
|
||||
|
||||
from ....util import msg, die
|
||||
from ....util import msg, ymsg, die
|
||||
from ....color import yellow, green, orange
|
||||
from ....tx import online as TxBase
|
||||
from .. import erigon_sleep
|
||||
|
|
@ -21,6 +21,11 @@ class OnlineSigned(Signed, TxBase.OnlineSigned):
|
|||
async def test_sendable(self, txhex):
|
||||
raise NotImplementedError('transaction testing not implemented for Ethereum')
|
||||
|
||||
def confirm_send(self, idxs):
|
||||
super().confirm_send(idxs)
|
||||
if len(idxs) > 1 and self.is_swap:
|
||||
ymsg('Warning: two transactions (approval and router) will be broadcast to the network')
|
||||
|
||||
async def send_checks(self):
|
||||
self.check_correct_chain()
|
||||
if not self.disable_fee_check and (self.fee > self.proto.max_tx_fee):
|
||||
|
|
|
|||
|
|
@ -67,8 +67,6 @@ class OnlineSigned(Signed):
|
|||
self.proto.network.upper()),
|
||||
expect = 'YES')
|
||||
msg('Sending transaction')
|
||||
if len(idxs) > 1 and getattr(self, 'coin_txid2', None) and self.is_swap:
|
||||
ymsg('Warning: two transactions (approval and router) will be broadcast to the network')
|
||||
|
||||
async def post_send(self, asi):
|
||||
from . import SentTX
|
||||
|
|
@ -90,14 +88,8 @@ class OnlineSigned(Signed):
|
|||
all_ok = True
|
||||
idxs = ['', '2']
|
||||
|
||||
if cfg.txhex_idx:
|
||||
if getattr(self, 'coin_txid2', None):
|
||||
if cfg.txhex_idx in ('1', '2'):
|
||||
idxs = ['' if cfg.txhex_idx == '1' else cfg.txhex_idx]
|
||||
else:
|
||||
die(1, f'{cfg.txhex_idx}: invalid parameter for --txhex-idx (must be 1 or 2)')
|
||||
else:
|
||||
die(1, 'Transaction has only one part, so --txhex-idx makes no sense')
|
||||
if cfg.txhex_idx and getattr(self, 'coin_txid2', None):
|
||||
idxs = ['' if cfg.txhex_idx == '1' else cfg.txhex_idx]
|
||||
|
||||
if not (cfg.status or cfg.receipt or cfg.dump_hex or cfg.test):
|
||||
self.confirm_send(idxs)
|
||||
|
|
|
|||
Loading…
Reference in a new issue