You are viewing a single comment's thread from:

RE: LUV breakdown

in LUVHBIT Community7 months ago (edited)

the account that you are trying to read the balance for has never had any LUV in their account ever, so Hive-engine will not give an amount, not even 0.

oh, that is a good point, depending on how you access the wallet balance/stake this might be it.

I get around that problem by using the Wallet class (iirc the pizza bot does it this way as well, my source is mostly built on pizza bot):

    wallet_token_info = Wallet(user).get_token(TOKEN_NAME)

    if not wallet_token_info:
        liquid = 0
        stake = 0
    else:
        liquid = float(wallet_token_info['balance'])
        stake = float(wallet_token_info['stake'])

    to_Debug(f'User {user} has balance:{liquid} and stake:{stake}')

In worst case (either user or token not found) the object is empty and the first if triggers setting the variables to zero.

But does the hbit bot check balances? Does not need to, does it?

Sort:  

I get around that problem by using the Wallet class (iirc the pizza bot does it this way as well, my source is mostly built on pizza bot)

Maybe that was added to pizzabot after I forked it, alivebot is also based on that, when I ran into this issue I added an exception for no valid balances.

But does the hbit bot check balances?

I don't know, but I would think not.

!ALIVE

@hannes-stoffel! You Are Alive so I just staked 0.1 $ALIVE to your account on behalf of @ flaxz. (14/20)

The tip has been paid for by the We Are Alive Tribe through the earnings on @alive.chat, feel free to swing by our daily chat any time you want, plus you can win Hive Power (2x 50 HP) and Alive Power (2x 500 AP) delegations (4 weeks), and Ecency Points (4x 50 EP), in our chat every day.