how to call smart contract function from javascript