2018-05-28 10:18:54 +00:00
|
|
|
from apps.common.coininfo import COINS
|
2016-10-20 14:40:46 +00:00
|
|
|
|
2016-11-08 17:49:58 +00:00
|
|
|
|
2016-10-20 14:40:46 +00:00
|
|
|
def by_shortcut(shortcut):
|
2016-11-11 10:26:38 +00:00
|
|
|
for c in COINS:
|
2016-11-09 13:46:59 +00:00
|
|
|
if c.coin_shortcut == shortcut:
|
2016-10-20 14:40:46 +00:00
|
|
|
return c
|
2016-11-15 10:57:18 +00:00
|
|
|
raise ValueError('Unknown coin shortcut "%s"' % shortcut)
|
2016-10-20 14:40:46 +00:00
|
|
|
|
2016-11-08 17:49:58 +00:00
|
|
|
|
2016-10-20 14:40:46 +00:00
|
|
|
def by_name(name):
|
2016-11-11 10:26:38 +00:00
|
|
|
for c in COINS:
|
2016-11-09 13:46:59 +00:00
|
|
|
if c.coin_name == name:
|
2016-10-20 14:40:46 +00:00
|
|
|
return c
|
2016-11-15 10:57:18 +00:00
|
|
|
raise ValueError('Unknown coin name "%s"' % name)
|
2016-10-20 14:40:46 +00:00
|
|
|
|
2016-11-08 17:49:58 +00:00
|
|
|
|
2018-06-21 11:58:57 +00:00
|
|
|
def by_slip44(slip44):
|
|
|
|
for c in COINS:
|
|
|
|
if c.slip44 == slip44:
|
|
|
|
return c
|
2018-07-03 14:20:58 +00:00
|
|
|
raise ValueError("Unknown coin slip44 index %d" % slip44)
|