From 8afb03e45a5ce061a46933c4c827f988caa6eb07 Mon Sep 17 00:00:00 2001 From: nelisky Date: Mon, 8 Apr 2013 23:36:26 +0100 Subject: [PATCH 1/4] implementing mksendmanytx A simple argument parsing change from mktx to allow passing multiple recipients --- electrum | 10 ++++++++++ lib/commands.py | 34 +++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/electrum b/electrum index 00ce71cc..2e88c205 100755 --- a/electrum +++ b/electrum @@ -325,6 +325,16 @@ if __name__ == '__main__': elif cmd in ['payto', 'mktx']: domain = [options.from_addr] if options.from_addr else None args = [ 'mktx', args[1], Decimal(args[2]), Decimal(options.tx_fee) if options.tx_fee else None, options.change_addr, domain ] + + elif cmd == 'mksendmanytx': + domain = [options.from_addr] if options.from_addr else None + outputs = [] + for i in range(1, len(args), 2): + if len(args) < i+2: + print_msg("Error: Mismatched arguments.") + exit(1) + outputs.append((args[i], Decimal(args[i+1]))) + args = [ 'mksendmanytx', outputs, Decimal(options.tx_fee) if options.tx_fee else None, options.change_addr, domain ] elif cmd == 'help': if len(args) < 2: diff --git a/lib/commands.py b/lib/commands.py index 245820b2..b84bc2da 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -59,6 +59,7 @@ register_command('importprivkey', 1, 1, True, True, 'Import a private k register_command('listaddresses', 3, 3, False, True, 'Returns your list of addresses.', '', listaddr_options) register_command('listunspent', 0, 0, False, True, 'Returns a list of unspent inputs in your wallet.') register_command('mktx', 5, 5, True, True, 'Create a signed transaction', 'mktx [label]', payto_options) +register_command('mksendmanytx', 4, 4, True, True, 'Create a signed transaction', 'mktx [ ...]', payto_options) register_command('payto', 5, 5, True, False, 'Create and broadcast a transaction.', "payto [label]\n can be a bitcoin address or a label", payto_options) register_command('password', 0, 0, True, True, 'Change your password') register_command('prioritize', 1, 1, False, True, 'Coins at prioritized addresses are spent first.', 'prioritize
') @@ -208,10 +209,11 @@ class Commands: return False - def _mktx(self, to_address, amount, fee = None, change_addr = None, domain = None): + def _mktx(self, outputs, fee = None, change_addr = None, domain = None): - if not is_valid(to_address): - raise BaseException("Invalid Bitcoin address", to_address) + for to_address, amount in outputs: + if not is_valid(to_address): + raise BaseException("Invalid Bitcoin address", to_address) if change_addr: if not is_valid(change_addr): @@ -226,25 +228,35 @@ class Commands: raise BaseException("address not in wallet", addr) for k, v in self.wallet.labels.items(): - if v == to_address: - to_address = k - print_msg("alias", to_address) - break if change_addr and v == change_addr: change_addr = k - amount = int(100000000*amount) + final_outputs = [] + for to_address, amount in outputs: + for k, v in self.wallet.labels.items(): + if v == to_address: + to_address = k + print_msg("alias", to_address) + break + + amount = int(100000000*amount) + final_outputs.append((to_address, amount)) + if fee: fee = int(100000000*fee) - return self.wallet.mktx( [(to_address, amount)], self.password, fee , change_addr, domain) + return self.wallet.mktx(final_outputs, self.password, fee , change_addr, domain) def mktx(self, to_address, amount, fee = None, change_addr = None, domain = None): - tx = self._mktx(to_address, amount, fee, change_addr, domain) + tx = self._mktx([(to_address, amount)], fee, change_addr, domain) + return tx.as_dict() + + def mksendmanytx(self, outputs, fee = None, change_addr = None, domain = None): + tx = self._mktx(outputs, fee, change_addr, domain) return tx.as_dict() def payto(self, to_address, amount, fee = None, change_addr = None, domain = None): - tx = self._mktx(to_address, amount, fee, change_addr, domain) + tx = self._mktx([(to_address, amount)], fee, change_addr, domain) r, h = self.wallet.sendtx( tx ) return h From 4bd4549fc0f1f54c420b3e5b2c49da0c64e2c732 Mon Sep 17 00:00:00 2001 From: nelisky Date: Mon, 8 Apr 2013 23:40:51 +0100 Subject: [PATCH 2/4] implementing paytomany (untested) Just like mktx/payto, this is only submitting the tx created in mksendmanytx --- electrum | 2 +- lib/commands.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/electrum b/electrum index 2e88c205..e44be220 100755 --- a/electrum +++ b/electrum @@ -326,7 +326,7 @@ if __name__ == '__main__': domain = [options.from_addr] if options.from_addr else None args = [ 'mktx', args[1], Decimal(args[2]), Decimal(options.tx_fee) if options.tx_fee else None, options.change_addr, domain ] - elif cmd == 'mksendmanytx': + elif cmd in ['paytomany', 'mksendmanytx']: domain = [options.from_addr] if options.from_addr else None outputs = [] for i in range(1, len(args), 2): diff --git a/lib/commands.py b/lib/commands.py index b84bc2da..1bed55a3 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -59,8 +59,9 @@ register_command('importprivkey', 1, 1, True, True, 'Import a private k register_command('listaddresses', 3, 3, False, True, 'Returns your list of addresses.', '', listaddr_options) register_command('listunspent', 0, 0, False, True, 'Returns a list of unspent inputs in your wallet.') register_command('mktx', 5, 5, True, True, 'Create a signed transaction', 'mktx [label]', payto_options) -register_command('mksendmanytx', 4, 4, True, True, 'Create a signed transaction', 'mktx [ ...]', payto_options) +register_command('mksendmanytx', 4, 4, True, True, 'Create a signed transaction', 'mksendmanytx [ ...]', payto_options) register_command('payto', 5, 5, True, False, 'Create and broadcast a transaction.', "payto [label]\n can be a bitcoin address or a label", payto_options) +register_command('paytomany', 4, 4, True, False, 'Create and broadcast a transaction.', "paytomany [ ...]\n can be a bitcoin address or a label", payto_options) register_command('password', 0, 0, True, True, 'Change your password') register_command('prioritize', 1, 1, False, True, 'Coins at prioritized addresses are spent first.', 'prioritize
') register_command('restore', 0, 0, False, False, 'Restore a wallet') @@ -260,6 +261,11 @@ class Commands: r, h = self.wallet.sendtx( tx ) return h + def paytomany(self, outputs, fee = None, change_addr = None, domain = None): + tx = self._mktx(outputs, fee, change_addr, domain) + r, h = self.wallet.sendtx( tx ) + return h + def history(self): import datetime From bcda5e35e710dc40c4305ac1e8592de2cce3c6af Mon Sep 17 00:00:00 2001 From: "Eagle[TM]" Date: Sun, 18 Aug 2013 20:24:36 +0200 Subject: [PATCH 3/4] Update default server list --- lib/interface.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/interface.py b/lib/interface.py index 9ae713aa..3a608465 100644 --- a/lib/interface.py +++ b/lib/interface.py @@ -28,19 +28,19 @@ DEFAULT_TIMEOUT = 5 DEFAULT_PORTS = {'t':'50001', 's':'50002', 'h':'8081', 'g':'8082'} DEFAULT_SERVERS = { - 'the9ull.homelinux.org': {'h': '8082', 't': '50001'}, + 'btcback.com': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, + 'electrum.bysh.me': {'h': '8081', 's': '51002', 't': '50001', 'g': '51001'}, + 'electrum.datemas.de': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, 'electrum.coinwallet.me': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, - 'electrum.dynaloop.net': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, - 'electrum.koh.ms': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, - 'electrum.novit.ro': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, - 'electrum.stepkrav.pw': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, - 'ecdsa.org': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, - 'electrum.mooo.com': {'h': '8081', 't': '50001'}, - 'electrum.bitcoins.sk': {'h': '8081', 's': '50002', 't': '50001', 'g': '8'}, + 'electrum.pdmc.net': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, 'electrum.no-ip.org': {'h': '80', 's': '50002', 't': '50001', 'g': '443'}, - 'electrum.drollette.com': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, + 'electrum.drollette.com': {'h': '5000', 's': '50002', 't': '50001', 'g': '8082'}, + 'electrum.stepkrav.pw': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, + 'electrum.novit.ro': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, + 'btc.medoix.com': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, + 'electrum.hachre.de': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, + 'ecdsa.org': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, 'btc.it-zone.org': {'h': '80', 's': '110', 't': '50001', 'g': '443'}, - 'electrum.yacoin.com': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'}, 'electrum.be': {'h': '8081', 's': '50002', 't': '50001', 'g': '8082'} } From 2eea8671d8446b2b831f515e83439c308dfdc72b Mon Sep 17 00:00:00 2001 From: invl Date: Thu, 22 Aug 2013 18:23:33 +0800 Subject: [PATCH 4/4] Fix blank trayicon on windows standalone build --- gui/gui_classic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/gui_classic.py b/gui/gui_classic.py index 0a7b0e31..b073d350 100644 --- a/gui/gui_classic.py +++ b/gui/gui_classic.py @@ -273,7 +273,7 @@ class ElectrumWindow(QMainWindow): self.config = config self.current_account = self.config.get("current_account", None) - self.icon = QIcon(os.getcwd() + '/icons/electrum.png') + self.icon = QIcon(':/icons/electrum.png') self.tray = QSystemTrayIcon(self.icon, self) self.tray.setToolTip('Electrum') self.tray.activated.connect(self.tray_activated)