electrum

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

commit f90ca2684e3b366c7267a98cdfc5cc3cf78fc2fa
parent 0371a3dc32350c1923348c216ee2c2f8eee2d4d1
Author: ThomasV <thomasv@electrum.org>
Date:   Wed,  9 Sep 2015 08:47:30 +0200

change paytomany syntax: accept json data instead of csv file

Diffstat:
Mlib/commands.py | 17++---------------
1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/lib/commands.py b/lib/commands.py @@ -411,18 +411,6 @@ class Commands: self.wallet.sign_transaction(tx, self.password) return tx - def _read_csv(self, csvpath): - import csv - outputs = [] - with open(csvpath, 'rb') as csvfile: - csvReader = csv.reader(csvfile, delimiter=',') - for row in csvReader: - address, amount = row - assert bitcoin.is_address(address) - amount = Decimal(amount) - outputs.append((address, amount)) - return outputs - @command('wp') def payto(self, destination, amount, tx_fee=None, from_addr=None, change_addr=None, nocheck=False, unsigned=False, deserialized=False, broadcast=False): """Create a transaction. """ @@ -435,10 +423,9 @@ class Commands: return tx.deserialize() if deserialized else tx @command('wp') - def paytomany(self, csv_file, tx_fee=None, from_addr=None, change_addr=None, nocheck=False, unsigned=False, deserialized=False, broadcast=False): + def paytomany(self, outputs, tx_fee=None, from_addr=None, change_addr=None, nocheck=False, unsigned=False, deserialized=False, broadcast=False): """Create a multi-output transaction. """ domain = [from_addr] if from_addr else None - outputs = self._read_csv(csv_file) tx = self._mktx(outputs, tx_fee, change_addr, domain, nocheck, unsigned) if broadcast: r, h = self.wallet.sendtx(tx) @@ -629,7 +616,7 @@ param_descriptions = { 'encrypted': 'Encrypted message', 'amount': 'Amount to be sent (in BTC). Type \'!\' to send the maximum available.', 'requested_amount': 'Requested amount (in BTC).', - 'csv_file': 'CSV file of recipient, amount', + 'outputs': 'list of ["address", amount]', } command_options = {