def sign_tx_file(txfile): try: init_coin(mmgen.tx.MMGenTX(txfile, coin_sym_only=True).coin) reload(sys.modules['mmgen.tx']) tx = mmgen.tx.MMGenTX(txfile) if tx.coin not in no_daemon_coins: rpc_init(reinit=True) txsign(tx, wfs, None, None) tx.write_to_file(ask_write=False) return True except: return False
async def sign_tx_file(txfile, signed_txs): try: g.proto = init_proto('BTC', testnet=False) tmp_tx = mmgen.tx.MMGenTX(txfile, metadata_only=True) g.proto = init_proto(tmp_tx.coin) if tmp_tx.chain != 'mainnet': if tmp_tx.chain == 'testnet' or ( hasattr(g.proto, 'chain_name') and tmp_tx.chain != g.proto.chain_name): g.proto = init_proto(tmp_tx.coin, testnet=True) if hasattr(g.proto, 'chain_name'): if tmp_tx.chain != g.proto.chain_name: die( 2, f'Chains do not match! tx file: {tmp_tx.chain}, proto: {g.proto.chain_name}' ) g.chain = tmp_tx.chain g.token = tmp_tx.dcoin g.proto.dcoin = tmp_tx.dcoin or g.proto.coin tx = mmgen.tx.MMGenTxForSigning(txfile) if g.proto.sign_mode == 'daemon': if g.test_suite: g.proto.daemon_data_dir = 'test/daemons/' + g.coin.lower() g.rpc_port = CoinDaemon(get_network_id(g.coin, g.proto.testnet), test_suite=True).rpc_port await rpc_init() if await txsign(tx, wfs, None, None): tx.write_to_file(ask_write=False) signed_txs.append(tx) return True else: return False except Exception as e: msg(f'An error occurred: {e.args[0]}') if g.debug or g.traceback: print_stack_trace(f'AUTOSIGN {txfile}') return False except: return False
def sign_tx_file(txfile): try: g.testnet = False g.coin = 'BTC' tmp_tx = mmgen.tx.MMGenTX(txfile, metadata_only=True) init_coin(tmp_tx.coin) if tmp_tx.chain != 'mainnet': if tmp_tx.chain == 'testnet' or ( hasattr(g.proto, 'chain_name') and tmp_tx.chain != g.proto.chain_name): g.testnet = True init_coin(tmp_tx.coin) if hasattr(g.proto, 'chain_name'): m = 'Chains do not match! tx file: {}, proto: {}' assert tmp_tx.chain == g.proto.chain_name, m.format( tmp_tx.chain, g.proto.chain_name) g.chain = tmp_tx.chain g.token = tmp_tx.dcoin g.dcoin = tmp_tx.dcoin or g.coin reload(sys.modules['mmgen.tx']) if g.proto.base_coin == 'ETH': reload(sys.modules['mmgen.altcoins.eth.tx']) tx = mmgen.tx.MMGenTX(txfile) if g.proto.sign_mode == 'daemon': rpc_init(reinit=True) if txsign(tx, wfs, None, None): tx.write_to_file(ask_write=False) return True else: return False except Exception as e: msg(u'An error occurred: {}'.format(e.message)) return False except: return False
def sign_tx_file(txfile, signed_txs): try: g.testnet = False g.coin = 'BTC' tmp_tx = mmgen.tx.MMGenTX(txfile, metadata_only=True) init_coin(tmp_tx.coin) if tmp_tx.chain != 'mainnet': if tmp_tx.chain == 'testnet' or ( hasattr(g.proto, 'chain_name') and tmp_tx.chain != g.proto.chain_name): g.testnet = True init_coin(tmp_tx.coin) if hasattr(g.proto, 'chain_name'): m = 'Chains do not match! tx file: {}, proto: {}' assert tmp_tx.chain == g.proto.chain_name, m.format( tmp_tx.chain, g.proto.chain_name) g.chain = tmp_tx.chain g.token = tmp_tx.dcoin g.dcoin = tmp_tx.dcoin or g.coin tx = mmgen.tx.MMGenTX(txfile) if g.proto.sign_mode == 'daemon': rpc_init(reinit=True) if txsign(tx, wfs, None, None): tx.write_to_file(ask_write=False) signed_txs.append(tx) return True else: return False except Exception as e: msg('An error occurred: {}'.format(e.args[0])) return False except: return False
def sign_tx_file(txfile,signed_txs): try: g.testnet = False g.coin = 'BTC' tmp_tx = mmgen.tx.MMGenTX(txfile,metadata_only=True) init_coin(tmp_tx.coin) if tmp_tx.chain != 'mainnet': if tmp_tx.chain == 'testnet' or ( hasattr(g.proto,'chain_name') and tmp_tx.chain != g.proto.chain_name): g.testnet = True init_coin(tmp_tx.coin) if hasattr(g.proto,'chain_name'): m = 'Chains do not match! tx file: {}, proto: {}' assert tmp_tx.chain == g.proto.chain_name,m.format(tmp_tx.chain,g.proto.chain_name) g.chain = tmp_tx.chain g.token = tmp_tx.dcoin g.dcoin = tmp_tx.dcoin or g.coin tx = mmgen.tx.MMGenTX(txfile) if g.proto.sign_mode == 'daemon': rpc_init(reinit=True) if txsign(tx,wfs,None,None): tx.write_to_file(ask_write=False) signed_txs.append(tx) return True else: return False except Exception as e: msg('An error occurred: {}'.format(e.args[0])) return False except: return False
-v, --verbose Produce more verbose output """ } cmd_args = opts.init(opts_data) if g.coin != 'BTC': die(1, "This program must be run with --coin set to 'BTC'") if len(cmd_args) != 1: opts.usage() import mmgen.tx tx = mmgen.tx.MMGenTX(cmd_args[0]) if opt.verbose: gmsg('Original transaction is in {} format'.format(g.coin)) from mmgen.protocol import init_coin init_coin('BCH') reload(sys.modules['mmgen.tx']) if opt.verbose: gmsg('Converting transaction to {} format'.format(g.coin)) tx.inputs.convert_coin(verbose=opt.verbose) tx.outputs.convert_coin(verbose=opt.verbose) tx.desc = 'converted transaction' tx.write_to_file(ask_write=False, ask_overwrite=False)
--, --longhelp Print help message for long options (common options) -v, --verbose Produce more verbose output """ } } cmd_args = opts.init(opts_data) if g.coin != 'BTC': die(1,"This program must be run with --coin set to 'BTC'") if len(cmd_args) != 1: opts.usage() import mmgen.tx tx = mmgen.tx.MMGenTX(cmd_args[0]) if opt.verbose: gmsg('Original transaction is in {} format'.format(g.coin)) from mmgen.protocol import init_coin init_coin('BCH') if opt.verbose: gmsg('Converting transaction to {} format'.format(g.coin)) tx.inputs.convert_coin(verbose=opt.verbose) tx.outputs.convert_coin(verbose=opt.verbose) tx.desc = 'converted transaction' tx.write_to_file(ask_write=False,ask_overwrite=False)