2018-05-02 14:47:24 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import json
|
|
|
|
|
|
|
|
|
|
|
|
def format_str(value):
|
|
|
|
return '"' + value + '"'
|
|
|
|
|
|
|
|
|
|
|
|
def format_primitive(value):
|
|
|
|
if isinstance(value, int):
|
|
|
|
return value
|
|
|
|
elif isinstance(value, str):
|
|
|
|
return format_str(value)
|
|
|
|
elif isinstance(value, list):
|
|
|
|
return value
|
|
|
|
else:
|
|
|
|
raise TypeError
|
|
|
|
|
|
|
|
|
|
|
|
fields = [
|
2018-07-31 09:35:09 +00:00
|
|
|
"name",
|
|
|
|
"ticker",
|
|
|
|
"namespace",
|
|
|
|
"mosaic",
|
|
|
|
"divisibility",
|
|
|
|
"levy",
|
|
|
|
"fee",
|
|
|
|
"levy_namespace",
|
|
|
|
"levy_mosaic",
|
|
|
|
"networks",
|
2018-05-02 14:47:24 +00:00
|
|
|
]
|
|
|
|
|
2018-07-31 09:35:09 +00:00
|
|
|
mosaics = json.load(open("../../vendor/trezor-common/defs/nem/nem_mosaics.json", "r"))
|
2018-05-02 14:47:24 +00:00
|
|
|
|
2018-07-31 09:35:09 +00:00
|
|
|
print(
|
|
|
|
"# generated using gen_nem_mosaics.py from trezor-common nem_mosaics.json - do not edit directly!"
|
|
|
|
)
|
|
|
|
print("")
|
|
|
|
print("mosaics = [")
|
2018-05-02 14:47:24 +00:00
|
|
|
for m in mosaics:
|
2018-07-31 09:35:09 +00:00
|
|
|
print(" {")
|
2018-05-02 14:47:24 +00:00
|
|
|
for name in fields:
|
|
|
|
if name in m:
|
2018-07-31 09:35:09 +00:00
|
|
|
print(" %s: %s," % (format_str(name), format_primitive(m[name])))
|
2018-05-02 14:47:24 +00:00
|
|
|
# else:
|
|
|
|
# print(' %s: None,' % format_str(name))
|
2018-07-31 09:35:09 +00:00
|
|
|
print(" },")
|
|
|
|
print("]")
|