fix currencies and LBRYFeeFormat
This commit is contained in:
parent
a53e911a0c
commit
a5374cb876
2 changed files with 10 additions and 12 deletions
|
@ -48,9 +48,8 @@ DEFAULT_CACHE_TIME = 3600
|
|||
DEFAULT_UI_BRANCH = "master"
|
||||
|
||||
SOURCE_TYPES = ['lbry_sd_hash', 'url', 'btih']
|
||||
CURRENCIES = [
|
||||
{'BTC': {'type': 'crypto'}},
|
||||
{'LBC': {'type': 'crypto'}},
|
||||
{'USD': {'type': 'fiat'}},
|
||||
|
||||
]
|
||||
CURRENCIES = {
|
||||
'BTC': {'type': 'crypto'},
|
||||
'LBC': {'type': 'crypto'},
|
||||
'USD': {'type': 'fiat'},
|
||||
}
|
||||
|
|
|
@ -88,18 +88,17 @@ class LBRYFeeFormat(dict):
|
|||
for currency in fee_dict:
|
||||
assert currency in CURRENCIES, "Unsupported currency: %s" % str(currency)
|
||||
self.update({currency: {}})
|
||||
|
||||
for version in FEE_REVISIONS:
|
||||
for k in FEE_REVISIONS[version]['required']:
|
||||
assert k in fee_dict, "Missing required fee field: %s" % k
|
||||
self[currency].update({k: f.pop(k)})
|
||||
assert k in fee_dict[currency], "Missing required fee field: %s" % k
|
||||
self[currency].update({k: f[currency].pop(k)})
|
||||
for k in FEE_REVISIONS[version]['optional']:
|
||||
if k in fee_dict:
|
||||
self[currency].update({k: f.pop(k)})
|
||||
if k in fee_dict[currency]:
|
||||
self[currency].update({k: f[currency].pop(k)})
|
||||
if not len(f):
|
||||
self.fee_version = version
|
||||
break
|
||||
assert f == {}, "Unknown fee keys: %s" % json.dumps(f.keys())
|
||||
assert f[currency] == {}, "Unknown fee keys: %s" % json.dumps(f.keys())
|
||||
|
||||
|
||||
class Metadata(dict):
|
||||
|
|
Loading…
Add table
Reference in a new issue