parent
0093d21bb6
commit
3422474811
@ -0,0 +1,15 @@
|
||||
from .nem_mosaics import mosaics
|
||||
|
||||
|
||||
def get_mosaic_definition(namespace_name: str, mosaic_name: str, network: int):
|
||||
for m in mosaics:
|
||||
if namespace_name == m["namespace"] and mosaic_name == m["mosaic"]:
|
||||
if ("networks" not in m) or (network in m["networks"]):
|
||||
return m
|
||||
return None
|
||||
|
||||
|
||||
def is_nem_xem_mosaic(namespace_name: str, mosaic_name: str):
|
||||
if namespace_name == "nem" and mosaic_name == "xem":
|
||||
return True
|
||||
return False
|
@ -0,0 +1,46 @@
|
||||
#!/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 = [
|
||||
'name',
|
||||
'ticker',
|
||||
'namespace',
|
||||
'mosaic',
|
||||
'divisibility',
|
||||
'levy',
|
||||
'fee',
|
||||
'levy_namespace',
|
||||
'levy_mosaic',
|
||||
'networks',
|
||||
]
|
||||
|
||||
mosaics = json.load(open('../../vendor/trezor-common/defs/nem/nem_mosaics.json', 'r'))
|
||||
|
||||
print('# generated using gen_nem_mosaics.py from trezor-common nem_mosaics.json - do not edit directly!')
|
||||
print('')
|
||||
print('mosaics = [')
|
||||
for m in mosaics:
|
||||
print(' {')
|
||||
for name in fields:
|
||||
if name in m:
|
||||
print(' %s: %s,' % (format_str(name), format_primitive(m[name])))
|
||||
# else:
|
||||
# print(' %s: None,' % format_str(name))
|
||||
print(' },')
|
||||
print(']')
|
Loading…
Reference in new issue