You are viewing a single comment's thread from:

RE: Fetching Hive-Engine Liquidity Pools Just Got Better!

in #hive • 2 months ago

It was tougher, but after getting what the fetch_token_details function was doing (at first I was like: "before there were 2 requests, now there are 3... why? Help!!" 🤣), I finally succeded in understading it!

Oc I didn't see any bugs - it's already enough if I understand how it works ahaha - but there's a question I'd like to ask you, if I can:

  • how did you built the call? For example, this one:
payload = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "find",
            "params": {
                "contract": "tokens",
                "table": "tokens",
                "query": {"symbol": symbol},
                "limit": 1
            }
        }

Is there some documentation in the Hive API I can read to find it out? Because untill now I thought one had always to use something like the block_api, or condenser_api, or something similar, but here I can't see them!

Sort:  
 2 months ago (edited) 

For quite a long time I wasn't able to find any good documentation on the Hive-Engine API calls, so I had to read the side-chain transactions via the HE-blockexplorer and then through trial and errors find out what works and what doesn't. But it all got a bit easier when I accidentally stumbled into the Hive Smart Contracts Wiki. It's frankly a treasure trove.

Hope it helps! :)

EDIT: I almost forgot, the call itself is a standard JSON call, you can learn about those in the Python documentation: json — JSON encoder and decoder.
EDIT #2: This is a bit embarrassing. I wasn't strictly correct when I called the JSON part "standard JSON", because it's actually not JSON yet. It's a Python object (a library), that will eventually be converted into a JSON string by either json.dumps(), or the requests module like I did here. A little brain fart on my part I guess, stands to show I'm not a pro-coder yet.

!WINE

Ahahah don't worry, I have no idea what's the right name for 99% of code related stuff 🤣 so I would have never noticed your mistake !LOL

It's impressive that before finding those docs you were basically reverse engineering Hive-Engine... wow! I bookmarked the site, many thanks :)

Hotel receptionists are creepy.
They spend all day checking people out.

Credit: reddit
@gamer00, I sent you an $LOLZ on behalf of arc7icwolf

(2/10)

PLAY & EARN $DOOM

This guy said it best, learning to code is a bit like trying to understand a visual illusion. In his case he mentioned the Elephant picture where you can't figure out where its legs begin and end. I tend to agree, sometimes the code itself looks like it couldn't be more complex. Then when you do figure it out it becomes clear, until the next time you go through the code and it's more confusing than ever.

A little bit earlier in the video he tells how he writes comments on just about every line, just so that he can explain the stuff to his future self. I guess that's the correct way to learn. If you can teach yourself (or others) something effectively, it means you've at least understood it (at one point at least).

That's so true and it's the exact feeling I get everytime I look at some code - even mine!

At first I'm like "what the fu*k I'm looking at? 🤣", than "ah ok, I got it!" and sometimes later "There's no way I'll ever become decent at this 😭".

Maybe I'm going to try to add more comments in the future, as this could also help others who may like to give me some suggestions to better understand my code and find where I may have made mistakes or stuff like that.