From 105b9c816750031ff89924c443527f3b962395d9 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 9 Nov 2016 14:52:43 +0100 Subject: [PATCH] tools: simplify coins-gen.py --- tools/coins-gen.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/coins-gen.py b/tools/coins-gen.py index 2f6c8177d9..6208f72f53 100755 --- a/tools/coins-gen.py +++ b/tools/coins-gen.py @@ -1,16 +1,23 @@ #!/usr/bin/env python3 import json -from collections import OrderedDict + +fields = [ + 'coin_name', + 'coin_shortcut', + 'address_type', + 'maxfee_kb', + 'address_type_p2sh', + 'address_type_p2wpkh', + 'address_type_p2wsh', + 'signed_message_header', +] coins = json.load(open('../../trezor-common/coins.json', 'r')) print('_coins = [') for c in coins: - d = OrderedDict() - for n in ['coin_name', 'coin_shortcut', 'address_type', 'maxfee_kb', 'address_type_p2sh', 'address_type_p2wpkh', 'address_type_p2wsh', 'signed_message_header']: - d[n] = c[n] print(' CoinType(') - for k in d: - print(' %s=%s,' % (k, repr(d[k]))) + for n in fields: + print(' %s=%s,' % (n, repr(c[n]))) print(' ),') print(']\n')