mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-17 01:52:02 +00:00
tools: simplify coins-gen.py
This commit is contained in:
parent
3015045df6
commit
105b9c8167
@ -1,16 +1,23 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json
|
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'))
|
coins = json.load(open('../../trezor-common/coins.json', 'r'))
|
||||||
|
|
||||||
print('_coins = [')
|
print('_coins = [')
|
||||||
for c in 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(')
|
print(' CoinType(')
|
||||||
for k in d:
|
for n in fields:
|
||||||
print(' %s=%s,' % (k, repr(d[k])))
|
print(' %s=%s,' % (n, repr(c[n])))
|
||||||
print(' ),')
|
print(' ),')
|
||||||
print(']\n')
|
print(']\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user