You are viewing a single comment's thread from:

RE: Could not find method get_block_range

in #hive-dev3 years ago

You were using method:call which is pre-appbase style of calling stuff (should be deprecated in 2018 or so),
In link that you have provided: https://developers.hive.io/apidefinitions/#block_api.get_block_range
Examples are working one, take a look this:

curl -s --data '{"jsonrpc":"2.0", "method":"block_api.get_block_range", "params":{"starting_block_num": 1, "count": 3}, "id":42}' https://gtg.openhive.network
Sort:  

Believe it or not: I spent the whole morning looking at that example, trying to figure out how I could make that work for me.

Thanks for nothing.

For future reference - jsonrpc is basically a POST request with JSON body, so anytime you want to port those examples from curl to fetch, axios, or whatever request library you're using, just copy the body from example:

I.e change this:

curl -s --data '{"jsonrpc":"2.0", "method":"block_api.get_block_range", "params":{"starting_block_num": 1, "count": 3}, "id":42}' https://api.openhive.network

Into this:

<html>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
axios.post('https://api.openhive.network', {"jsonrpc":"2.0", "method":"block_api.get_block_range", "params":{"starting_block_num": 1, "count": 3}, "id":42}).then((result) => console.log(result.data))    
</script>
</html>

You can also use hive-js or dhive (although I'm not sure they support get_block_range request out-of-the-box).

hive-js and dhive do not support get_block_range, otherwise, I would not be in this mess.
I am not trying to build my own library, but I kinda have to.

...everything's working for now. Thanks!

I am not trying to build my own library, but I kinda have to.

Consider contributing to hive-js or dhive with appropriate changes.

As you have seen my coding skills above, I'd rather not.
Half of what's going on in those libs, I do not understand.

If I ever was going to work on a lib, I would make sure, I got paid for it, before I even started.

You seem like someone who'd have a much easier time fixing those libs.
I'd support a proposal.