electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 999adc80afd3c530818a7d4892a155457c40033f
parent 96d459ab887757610d825670e567733a39cbfb5b
Author: thomasv <thomasv@gitorious>
Date:   Tue, 26 Feb 2013 16:11:19 +0100

move 'addresses' command

Diffstat:
Melectrum | 29++++-------------------------
Mlib/commands.py | 12++++++++++++
2 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/electrum b/electrum @@ -449,11 +449,10 @@ if __name__ == '__main__': args = [ cmd, ast.literal_eval(args[1]), ast.literal_eval(args[2])] elif cmd == 'dumpprivkeys': - if options.show_all: - addresses = wallet.all_addresses() - else: - addresses = wallet.addresses + wallet.imported_keys.keys() - args = [cmd, addresses] + args = [cmd, wallet.all_addresses() if options.show_all else wallet.addresses + wallet.imported_keys.keys() ] + + elif cmd=='addresses': + args = [cmd, options.show_all] elif cmd == 'setlabel': try: @@ -553,26 +552,6 @@ if __name__ == '__main__': else: print_msg(False) - elif cmd in [ 'addresses']: - for addr in wallet.all_addresses(): - if options.show_all or not wallet.is_change(addr): - - flags = wallet.get_address_flags(addr) - label = wallet.labels.get(addr,'') - - if label: label = "\"%s\""%label - - if options.show_balance: - h = wallet.history.get(addr,[]) - #ni = no = 0 - #for item in h: - # if item['is_input']: ni += 1 - # else: no += 1 - b = format_satoshis(wallet.get_addr_balance(addr)[0]) - else: b='' - m_addr = "%34s"%addr - print_msg(flags, m_addr, b, label) - elif cmd == 'password': new_password = prompt_password('New password:') diff --git a/lib/commands.py b/lib/commands.py @@ -254,3 +254,15 @@ class Commands: c[addr] = self.wallet.labels.get(addr) print_json(c) + + def addresses(self, show_all): + for addr in self.wallet.all_addresses(): + if show_all or not self.wallet.is_change(addr): + + flags = self.wallet.get_address_flags(addr) + label = self.wallet.labels.get(addr,'') + if label: label = "\"%s\""%label + b = format_satoshis(self.wallet.get_addr_balance(addr)[0]) + m_addr = "%34s"%addr + print_msg(flags, m_addr, b, label) +