Add jsonrpc adapter
Make sure the JS method is invoked with the correct receiver
Reformat the code