2018-09-17 17:13:30 -03:00
|
|
|
from copy import deepcopy
|
|
|
|
|
2018-09-17 17:31:44 -03:00
|
|
|
from lbrynet.schema.schema.schema import Schema
|
2019-02-26 18:26:15 -03:00
|
|
|
from lbrynet.schema.proto2 import fee_pb2 as fee_pb
|
2018-09-17 17:31:44 -03:00
|
|
|
from lbrynet.schema.schema import VERSION_MAP, 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)
|