import { hexToBytes } from './utils' ; public export function stringToUtf8Bytes ( str ) { return new TextEncoder ( ) . encode ( str ) ; } public export function bytesToUtf8String ( bytesOrHexString ) { if ( typeof bytesOrHexString == 'string' ) { return bytesToUtf8String ( hexToBytes ( bytesOrHexString ) ) ; } return new TextDecoder ( ) . decode ( bytesOrHexString ) ; }