2018-09-17 17:13:30 -03:00
|
|
|
from copy import deepcopy
|
|
|
|
|
2019-02-26 18:26:15 -03:00
|
|
|
from lbrynet.schema.proto2 import fee_pb2 as fee_pb
|
2019-03-05 23:37:44 -03:00
|
|
|
from lbrynet.schema.baseschema import Schema
|
2019-02-28 18:54:37 -03:00
|
|
|
from lbrynet.schema.legacy_schema_v1 import VERSION_MAP
|
|
|
|
from lbrynet.schema.constants import CURRENCY_MAP
|
2018-09-17 17:13:30 -03:00
|
|
|
|
|
|
|
|
|
|
|
class Fee(Schema):
|
|
|
|
@classmethod
|
|
|
|
def load(cls, message):
|
|
|
|
_fee = deepcopy(message)
|
|
|
|
currency = CURRENCY_MAP[_fee.pop('currency')]
|
|
|
|
_message_pb = fee_pb.Fee()
|
|
|
|
_message_pb.version = VERSION_MAP[_fee.pop("version")]
|
|
|
|
_message_pb.currency = currency
|
|
|
|
_message_pb.address = _fee.pop('address')
|
|
|
|
return cls._load(_fee, _message_pb)
|