commit ea96b7999740a4d1dde42f734dba60d2e7d5fe79
parent 75d2fbcd748bb7ccfe1da3a60d52fdfef871a08c
Author: thomasv <thomasv@gitorious>
Date: Wed, 27 Feb 2013 18:11:45 +0100
use json format
Diffstat:
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/electrum b/electrum
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
-import sys, os, time, ast
+import sys, os, time, json
import optparse
import platform
@@ -364,13 +364,14 @@ if __name__ == '__main__':
args = [ cmd, address, signature, message]
elif cmd == 'signrawtransaction':
- args = [ cmd, args[1], ast.literal_eval(args[2]) if len(args)>2 else [], ast.literal_eval(args[3]) if len(args)>3 else []]
+ import json
+ args = [ cmd, args[1], json.loads(args[2]) if len(args)>2 else [], json.loads(args[3]) if len(args)>3 else []]
elif cmd == 'createmultisig':
- args = [ cmd, int(args[1]), ast.literal_eval(args[2])]
+ args = [ cmd, int(args[1]), json.loads(args[2])]
elif cmd == 'createrawtransaction':
- args = [ cmd, ast.literal_eval(args[1]), ast.literal_eval(args[2])]
+ args = [ cmd, json.loads(args[1]), json.loads(args[2])]
elif cmd=='addresses':
args = [cmd, options.show_all]
diff --git a/lib/bitcoin.py b/lib/bitcoin.py
@@ -735,7 +735,7 @@ class Transaction:
"complete":self.is_complete
}
if not self.is_complete and self.input_info:
- out['input_info'] = repr(self.input_info).replace(' ','')
+ out['input_info'] = json.dumps(self.input_info).replace(' ','')
return out