Skip to content

Commit cd1f359

Browse files
Added support for ByteString in _restore_typed_primitive (#279)
* Added extended signing key support for cip8 * Fixed unused imports, flake8 checks pass. * Fixed mypy error for overloaded variable * Remove extraneous parameter for verify * Added ByteString to _restored_typed_primitive * Added type checking
1 parent af8afdc commit cd1f359

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pycardano/serialization.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,10 @@ def _restore_typed_primitive(
532532
if not isinstance(v, list):
533533
raise DeserializeException(f"Expected type list but got {type(v)}")
534534
return IndefiniteList([_restore_typed_primitive(t, w) for w in v])
535+
elif isclass(t) and t == ByteString:
536+
if not isinstance(v, bytes):
537+
raise DeserializeException(f"Expected type bytes but got {type(v)}")
538+
return ByteString(v)
535539
elif isclass(t) and issubclass(t, IndefiniteList):
536540
try:
537541
return IndefiniteList(v)

0 commit comments

Comments
 (0)