Skip to content

Commit

Permalink
Specify values in Value object format, ie '0.1 mBTC'
Browse files Browse the repository at this point in the history
  • Loading branch information
mccwdev committed Jan 20, 2024
1 parent 38ecfa4 commit aaa51fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bitcoinlib/tools/clw.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def create_wallet(wallet_name, args, db_uri, output_to):


def create_transaction(wlt, send_args, args):
output_arr = [(address, int(value)) for [address, value] in send_args]
output_arr = [(address, value) for [address, value] in send_args]
return wlt.transaction_create(output_arr=output_arr, network=args.network, fee=args.fee, min_confirms=0,
input_key_id=args.input_key_id,
number_of_change_outputs=args.number_of_change_outputs)
Expand Down
5 changes: 4 additions & 1 deletion bitcoinlib/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ def value_to_satoshi(value, network=None):
:return int:
"""
if isinstance(value, str):
value = Value(value)
if network:
value = Value(value, network=network)
else:
value = Value(value)
if isinstance(value, Value):
if network and value.network != network:
raise ValueError("Value uses different network (%s) then supplied network: %s" % (value.network.name, network))
Expand Down

0 comments on commit aaa51fc

Please sign in to comment.