import * as crypto from "crypto" ; import * as encoding from "@walletconnect/encoding" ; export function assertType ( obj , key , type = "string" ) { if ( ! obj [ key ] || typeof obj [ key ] !== type ) { throw new Error ( `Missing or invalid "${ key }" param` ) ; } } export function generateRandomBytes32 ( ) { return encoding . bufferToHex ( crypto . randomBytes ( 32 ) ) ; } export function sha256 ( data ) { return crypto . createHash ( "sha256" ) . update ( data ) . digest ( "hex" ) ; } export function isFloat ( num ) { return num % 1 != 0 ; }