Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
format_crypto_units(
input_quantity=unsigned_tx['tx']['fees'],
input_type='satoshi',
output_type=UNIT_CHOICE,
coin_symbol=coin_symbol,
print_cs=True,
),
round(100.0 * unsigned_tx['tx']['fees'] / dest_satoshis_to_display, 4),
)
puts(CONF_TEXT)
if not confirm(user_prompt=DEFAULT_PROMPT, default=True):
puts(colored.red('Transaction Not Broadcast!'))
return
broadcasted_tx = broadcast_signed_transaction(
unsigned_tx=unsigned_tx,
signatures=tx_signatures,
pubkeys=pubkeyhex_list,
coin_symbol=coin_symbol,
api_key=BLOCKCYPHER_API_KEY,
)
verbose_print('Broadcast TX Details:')
verbose_print(broadcasted_tx)
if 'errors' in broadcasted_tx:
puts(colored.red('TX Error(s): Tx May NOT Have Been Broadcast'))
for error in broadcasted_tx['errors']:
puts(colored.red(error['error']))
return
tx_hash = broadcasted_tx['tx']['hash']
format_crypto_units(
input_quantity=unsigned_tx['tx']['fees'],
input_type='satoshi',
output_type=UNIT_CHOICE,
coin_symbol=coin_symbol,
print_cs=True,
),
round(100.0 * unsigned_tx['tx']['fees'] / dest_satoshis_to_display, 4),
)
puts(CONF_TEXT)
if not confirm(user_prompt=DEFAULT_PROMPT, default=True):
puts(colored.red('Transaction Not Broadcast!'))
return
broadcasted_tx = broadcast_signed_transaction(
unsigned_tx=unsigned_tx,
signatures=tx_signatures,
pubkeys=pubkeyhex_list,
coin_symbol=coin_symbol,
api_key=BLOCKCYPHER_API_KEY,
)
verbose_print('Broadcast TX Details:')
verbose_print(broadcasted_tx)
if 'errors' in broadcasted_tx:
puts(colored.red('TX Error(s): Tx May NOT Have Been Broadcast'))
for error in broadcasted_tx['errors']:
puts(colored.red(error['error']))
return
tx_hash = broadcasted_tx['tx']['hash']
pubkeyhex_list.append(wif_obj.get_public_key().get_key(
compressed=True))
verbose_print('Private Key List: %s' % privkeyhex_list)
verbose_print('Public Key List: %s' % pubkeyhex_list)
# sign locally
tx_signatures = make_tx_signatures(
txs_to_sign=unsigned_tx['tosign'],
privkey_list=privkeyhex_list,
pubkey_list=pubkeyhex_list,
)
verbose_print('TX Signatures: %s' % tx_signatures)
# TODO: add final confirmation before broadcast
broadcasted_tx = broadcast_signed_transaction(
unsigned_tx=unsigned_tx,
signatures=tx_signatures,
pubkeys=pubkeyhex_list,
coin_symbol=coin_symbol,
api_key=BLOCKCYPHER_API_KEY,
)
verbose_print('Broadcasted TX')
verbose_print(broadcasted_tx)
tx_hash = broadcasted_tx['tx']['hash']
puts(colored.green('TX Broadcast: %s' % tx_hash))
tx_url = get_tx_url(
tx_hash=tx_hash,
coin_symbol=coin_symbol,
)
puts(colored.blue(tx_url))
pubkeyhex_list.append(wif_obj.get_public_key().get_key(
compressed=True))
verbose_print('Private Key List: %s' % privkeyhex_list)
verbose_print('Public Key List: %s' % pubkeyhex_list)
# sign locally
tx_signatures = make_tx_signatures(
txs_to_sign=unsigned_tx['tosign'],
privkey_list=privkeyhex_list,
pubkey_list=pubkeyhex_list,
)
verbose_print('TX Signatures: %s' % tx_signatures)
# TODO: add final confirmation before broadcast
broadcasted_tx = broadcast_signed_transaction(
unsigned_tx=unsigned_tx,
signatures=tx_signatures,
pubkeys=pubkeyhex_list,
coin_symbol=coin_symbol,
api_key=BLOCKCYPHER_API_KEY,
)
verbose_print('Broadcasted TX')
verbose_print(broadcasted_tx)
tx_hash = broadcasted_tx['tx']['hash']
puts(colored.green('TX Broadcast: %s' % tx_hash))
tx_url = get_tx_url(
tx_hash=tx_hash,
coin_symbol=coin_symbol,
)
puts(colored.blue(tx_url))