CoinProtocol.Base: new tx_amt_arg_required attr
This commit is contained in:
parent
32af0c4a0b
commit
96fcc4958c
6 changed files with 19 additions and 0 deletions
|
|
@ -41,6 +41,7 @@ class mainnet(CoinProtocol.RPC, CoinProtocol.DummyWIF, CoinProtocol.Base):
|
|||
sign_mode = 'standalone'
|
||||
has_usr_fee = False
|
||||
address_reuse_ok = False
|
||||
tx_amt_arg_required = True
|
||||
|
||||
coin_cfg_opts = (
|
||||
'ignore_daemon_version',
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ class CoinProtocol(MMGenObject):
|
|||
is_vm = False
|
||||
is_evm = False
|
||||
has_chg = False
|
||||
tx_amt_arg_required = False
|
||||
has_usr_fee = True
|
||||
coin_amt = None
|
||||
max_tx_fee = None
|
||||
|
|
|
|||
|
|
@ -262,6 +262,9 @@ class New(Base):
|
|||
is_chg = not a.amt,
|
||||
is_vault = a.is_vault)
|
||||
|
||||
if self.proto.tx_amt_arg_required and not self.sum_outputs():
|
||||
die(1, f'send amount is required for protocol {self.proto.name}')
|
||||
|
||||
self.check_dup_addrs('outputs')
|
||||
|
||||
if self.is_compat:
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ class NewSwap(BaseSwapMethods, New):
|
|||
UniAmt(arg) # throw exception on decimal overflow
|
||||
args.send_amt = self.proto.coin_amt(arg)
|
||||
arg = get_arg()
|
||||
elif self.proto.tx_amt_arg_required: # not optional in this case
|
||||
die(1, f'send amount is required for protocol {self.proto.name}')
|
||||
|
||||
# arg 3: optional chg_spec (change address spec, requires amt)
|
||||
if self.proto.has_chg and args.send_amt and not arg in sa.recv: # is change arg
|
||||
|
|
|
|||
|
|
@ -543,6 +543,7 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|||
('user_twview_chk1', 'viewing user’s tracking wallets (check balances)'),
|
||||
('user_listaddresses_sort', 'listing user’s addresses (sort options)'),
|
||||
('wait_loop_start_compat', 'starting autosign wait loop in XMR compat mode [--coins=xmr]'),
|
||||
('user_txcreate1_bad', 'creating a transaction (bad, no amount)'),
|
||||
('user_txcreate1', 'creating a transaction'),
|
||||
('user_txabort1', 'aborting the transaction'),
|
||||
('user_txcreate2', 'recreating the transaction'),
|
||||
|
|
@ -816,6 +817,9 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|||
def wait_loop_start_ltc(self):
|
||||
return self.wait_loop_start(opts=['--xmrwallet-compat', '--coins=ltc,xmr'])
|
||||
|
||||
def user_txcreate1_bad(self):
|
||||
return self._user_txops('txcreate', [self.burn_addr], acct_num=1, exit_val=1, expect_str='amount is required')
|
||||
|
||||
def user_txcreate1(self):
|
||||
return self._user_txops('txcreate', [f'{self.burn_addr},0.012345'], acct_num=1)
|
||||
|
||||
|
|
|
|||
|
|
@ -210,8 +210,10 @@ class CmdTestXMRSwap(CmdTestXMRSwapMethods, CmdTestSwap):
|
|||
'xmr_swap': (
|
||||
'swap operations (XMR -> LTC)',
|
||||
('remote_get_refnum_xmr', 'getting the reference number'),
|
||||
('swaptxcreate_refreq7_bad', 'creating an XMR->LTC registration transaction (bad, no amount)'),
|
||||
('swaptxcreate_refreq7', 'creating an XMR->LTC registration transaction (auto chg, auto dest)'),
|
||||
('swaptxsend_refreq7', 'sending the transaction'),
|
||||
('swaptxcreate_refnum7_bad', 'creating an XMR->LTC swap transaction (bad, no amount)'),
|
||||
('swaptxcreate_refnum7', 'creating an XMR->LTC swap transaction (auto chg, auto dest)'),
|
||||
('swaptxsend_refnum7', 'sending the transaction'),
|
||||
('xmr_mine_blocks_10', ''),
|
||||
|
|
@ -309,6 +311,9 @@ class CmdTestXMRSwap(CmdTestXMRSwapMethods, CmdTestSwap):
|
|||
def remote_get_refnum_xmr(self):
|
||||
return self._remote_get_refnum(self.refreq_txid_xmr)
|
||||
|
||||
def swaptxcreate_refreq7_bad(self):
|
||||
return self._swaptxcreate_refreq_xmr(['XMR', 'LTC'], exit_val=1)
|
||||
|
||||
def swaptxcreate_refreq7(self):
|
||||
return self._swaptxcreate_refreq_xmr(['XMR', '0.2345', 'LTC'])
|
||||
|
||||
|
|
@ -323,6 +328,9 @@ class CmdTestXMRSwap(CmdTestXMRSwapMethods, CmdTestSwap):
|
|||
def swaptxsend_refreq7(self):
|
||||
return self._user_txsend('bob', need_rbf=True)
|
||||
|
||||
def swaptxcreate_refnum7_bad(self):
|
||||
return self._swaptxcreate_refnum_xmr(['XMR', 'LTC'], exit_val=1)
|
||||
|
||||
def swaptxcreate_refnum7(self):
|
||||
return self._swaptxcreate_refnum_xmr(['XMR', '0.2345', 'LTC'])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue