import { hexStrToBuf , remove0x } from '../misc' ; param obj returns export const serializeObject = ( obj ) : string => { return JSON . stringify ( obj ) ; } ; param obj returns export const deserializeObject = ( obj ) : { } => { return JSON . parse ( obj ) ; } ; param obj returns export const serializeObjectAsHexString = ( obj ) : string => { const stringified = JSON . stringify ( obj ) ; const asHexString = '0x' + Buffer . from ( stringified ) . toString ( 'hex' ) ; return asHexString ; } ; param obj returns export const deserializeObjectAsHexString = ( obj ) : { } => { const asBuffer = hexStrToBuf ( remove0x ( obj ) ) ; return JSON . parse ( asBuffer . toString ( ) ) ; } ; param obj returns export const objectToBuffer = ( obj ) : Buffer => { return Buffer . from ( serializeObject ( obj ) ) ; } ;