def _jadeRpc(self, method, params=None, inputid=None, http_request_fn=None, long_timeout=False):
        """
        Helper to make a request/reply rpc call over the underlying transport interface.
        NOTE: interface must be 'connected'.

        If the call returns an 'http_request' structure, this is handled here and the http
        call is made, and the result is passed into the rpc method given in 'on reply', by
        calling this function recursively.

        Parameters
        ----------
        method : str
            rpc method to invoke

        params : dict, optional
            any parameters to pass to the rpc method
            Defaults to None.

        inputid : str, optional
            Any specific 'id' to use in the rpc message.
            Defaults to a using a pseudo-random id generated in-situ.

        http_request_fn : function, optional
            A function which accepts a dict (containing a description of the http request), makes
            the described http call, and returns the body data in an element called 'body'.
            Defaults to _http_request() above.

        long_timeout : bool, optional
            Whether the rpc call should use an indefinitely long timeout, rather than that set on
            construction.
            (Useful if the call involves a non-trivial user interaction with the device.)
            Defaults to False.

        Returns
        -------
        dict
            The reply from the rpc call.
            NOTE: will return the last/final reply after a sequence of calls, where 'http_request'
            was returned and remote data was fetched and passed into s subsequent call.
        """
        newid = inputid if inputid else str(random.randint(100000, 999999))
        request = self.jade.build_request(newid, method, params)
        reply = self.jade.make_rpc_call(request, long_timeout)
        result = self._get_result_or_raise_error(reply)

        # The Jade can respond with a request for interaction with a remote
        # http server. This is used for interaction with the pinserver but the
        # code below acts as a dumb proxy and simply makes the http request and
        # forwards the response back to the Jade.
        # Note: the function called to make the http-request can be passed in,
        # or it can default to the simple _http_request() function above, if available.
        if isinstance(result, collections.abc.Mapping) and 'http_request' in result:
            this_module = sys.modules[__name__]
            make_http_request = http_request_fn or getattr(this_module, '_http_request', None)
            assert make_http_request, 'Default _http_request() function not available'

            http_request = result['http_request']
            http_response = make_http_request(http_request['params'])
            return self._jadeRpc(
                http_request['on-reply'],
                http_response['body'],
                http_request_fn=make_http_request,
                long_timeout=long_timeout)

        return result

        Helper to make a request/reply rpc call over the underlying transport interface.
        NOTE: interface must be 'connected'.

        If the call returns an 'http_request' structure, this is handled here and the http
        call is made, and the result is passed into the rpc method given in 'on reply', by
        calling this function recursively.

        Parameters
        ----------
        method : str
            rpc method to invoke

        params : dict, optional
            any parameters to pass to the rpc method
            Defaults to None.

        inputid : str, optional
            Any specific 'id' to use in the rpc message.
            Defaults to a using a pseudo-random id generated in-situ.

        http_request_fn : function, optional
            A function which accepts a dict (containing a description of the http request), makes
            the described http call, and returns the body data in an element called 'body'.
            Defaults to _http_request() above.

        long_timeout : bool, optional
            Whether the rpc call should use an indefinitely long timeout, rather than that set on
            construction.
            (Useful if the call involves a non-trivial user interaction with the device.)
            Defaults to False.

        Returns
        -------
        dict
            The reply from the rpc call.
            NOTE: will return the last/final reply after a sequence of calls, where 'http_request'
            was returned and remote data was fetched and passed into s subsequent call.
        
electrum/plugins/jade/jadepy/jade.py