diff --git a/green_cli/param_types.py b/green_cli/param_types.py index a5feb90..bac391d 100644 --- a/green_cli/param_types.py +++ b/green_cli/param_types.py @@ -32,6 +32,10 @@ def convert(self, value, param, ctx): # level. gdk only allows one addressee with send all ctx.params['details']['send_all'] = True value = 0 + elif value == "change": + # Explicit change output + ctx.params['details']['addressees'][-1]['is_change'] = True + value = 0 else: value = self.value2sat(value) diff --git a/green_cli/tx.py b/green_cli/tx.py index 03f190a..e8954fe 100644 --- a/green_cli/tx.py +++ b/green_cli/tx.py @@ -129,6 +129,8 @@ def __exit__(self, type, value, traceback): if self.recreate: self._tx = _create_tx(self._tx) self._tx = _save_tx(self._tx) + if self._tx['error']: + click.echo(f"ERROR: {self._tx['error']}", err=True) return False @tx.command() @@ -167,9 +169,9 @@ def outputs(ctx, session, **options): if ctx.invoked_subcommand: return - tx = _load_tx(allow_errors=True) - for output in tx['transaction_outputs']: - _print_tx_output(options, output) + with Tx(allow_errors=True) as tx: + for output in tx['transaction_outputs']: + _print_tx_output(options, output) @outputs.command(name='add') @click.argument('address', type=Address(), expose_value=False) @@ -217,8 +219,8 @@ def _filter_utxos(utxo_filter, utxos): if address and address == utxo.get('address', None): selected.append(utxo) continue - if txhash == '*' or txhash == utxo['txhash']: - if not pt_idx or pt_idx == '*' or int(pt_idx) == utxo['pt_idx']: + if txhash == '*' or txhash == 'all' or txhash == utxo['txhash']: + if not pt_idx or pt_idx == 'all' or pt_idx == '*' or int(pt_idx) == utxo['pt_idx']: selected.append(utxo) return selected