File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -478,7 +478,32 @@ def from_primitive(
478478class DrepCredential (StakeCredential ):
479479 """DRep credential is identical to StakeCredential in structure."""
480480
481- pass
481+ _CODE : int = field (init = False , default = 16 )
482+
483+ drep_credential : StakeCredential
484+ coin : int
485+ anchor : Optional [Anchor ]
486+
487+ def __post_init__ (self ):
488+ self ._CODE = 16
489+
490+
491+ @classmethod
492+ @limit_primitive_type (list )
493+ def from_primitive (
494+ cls : Type [DrepCredential ], values : Union [list , tuple ]
495+ ) -> DrepCredential :
496+ if values [0 ] == 16 :
497+ return cls (
498+ drep_credential = StakeCredential .from_primitive (values [1 ]),
499+ coin = values [2 ],
500+ anchor = (
501+ Anchor .from_primitive (values [3 ]) if values [3 ] is not None else None
502+ ),
503+ )
504+ else :
505+ raise DeserializeException (f"Invalid DrepCredential type { values [0 ]} " )
506+
482507
483508
484509@dataclass (repr = False )
You can’t perform that action at this time.
0 commit comments