Skip to content
Snippets Groups Projects

Update branch + fix regarding `update_proposal` operation

Merged Mariusz Trela requested to merge mt-update into master
Files
2
+ 27
26
@@ -8,7 +8,7 @@ from beemgraphenebase.types import (
Uint8, Int16, Uint16, Uint32, Uint64,
Varint32, Int64, String, Bytes, Void,
Array, PointInTime, Signature, Bool,
Set, Fixed_array, Optional, Static_variant,
Set, Fixed_array, Optional, Static_variant, Static_variantV2,
Map, Id
)
from beemgraphenebase.objects import GrapheneObject, isArgsThisClass
@@ -327,45 +327,46 @@ class CommentOptionExtensions(Static_variant):
class UpdateProposalEndDate(GrapheneObject):
def __init__(self, *args, **kwargs):
if isArgsThisClass(self, args):
self.data = args[0].data
""" Serialize date in Update proposal extensions.
"""
def __init__(self, o):
if isinstance(o, dict) and 'end_date' in o:
_end_date = o['end_date']
else:
if len(args) == 1 and len(kwargs) == 0:
kwargs = args[0]
super(UpdateProposalEndDate, self).__init__(
OrderedDict([
('end_date', PointInTime(kwargs['update_proposal_end_date'])),
]))
raise Exception("Unknown date in UpdateProposalEndDate")
super(UpdateProposalEndDate, self).__init__(
OrderedDict([
('end_date', PointInTime(_end_date))
]))
class UpdateProposalExtensions(Static_variant):
class UpdateProposalExtensions(Static_variantV2):
""" Serialize Update proposal extensions.
:param end_date: A static_variant containing the new end_date.
Example::
[1,
{'end_date': '2021-03-28T04:00:00'}
]
{
'type': 'update_proposal_end_date',
'value':
{
'end_date': '2021-04-05T13:39:48'
}
}
"""
def __init__(self, o):
if type(o) == dict and 'type' in o and 'value' in o:
if o['type'] == "end_date":
type_id = 1
else:
type_id = ~0
data = o['value']
else:
type_id, data = o
if isinstance(o, dict) and 'type' in o and 'value' in o:
if o['type'] == "update_proposal_end_date":
type_id = 1
else:
type_id = ~0
if type_id == 1:
data = (UpdateProposalEndDate(data))
data = UpdateProposalEndDate(o['value'])
else:
raise Exception("Unknown UpdateProposalExtension")
raise Exception("Unknown UpdateProposalExtension")
super(UpdateProposalExtensions, self).__init__(data, type_id)
Loading