[#145] sdk/object: Implement Object deserialization function

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-09-16 14:23:09 +03:00 committed by Stanislav Bogatyrev
parent 1ac6f2eeeb
commit 0b9ddd10f8

View file

@ -37,3 +37,14 @@ func (o *Object) ToV2() *object.Object {
return nil
}
// FromBytes restores Object instance from a binary representation.
func FromBytes(data []byte) (*Object, error) {
oV2 := new(object.Object)
if err := oV2.StableUnmarshal(data); err != nil {
return nil, err
}
return NewFromV2(oV2), nil
}