xeroc / piston-lib

Python Library for Steem
MIT License
40 stars 33 forks source link

Wrong VESTS_SYMBOL in golos network in withdraw_vesting() #60

Closed bitphage closed 6 years ago

bitphage commented 6 years ago

When using piston-lib for GOLOS network, VESTS_SYMBOL should be GESTS instead of VESTS

from piston import Steem
golos = Steem(node=node, keys=keys)
golos.withdraw_vesting(10000, account='foo')

error:

Traceback (most recent call last):
  File "/home/vvk/devel/golos/piston/venv/lib/python3.4/site-packages/pistonapi/steemnoderpc.py", line 124, in rpcexec
    return super(SteemNodeRPC, self).rpcexec(payload)
  File "/home/vvk/devel/golos/piston/venv/lib/python3.4/site-packages/grapheneapi/graphenewsrpc.py", line 160, in rpcexec
    raise RPCError(ret['error']['message'])
grapheneapi.graphenewsrpc.RPCError: 10 assert_exception: Assert Exception
is_asset_type(vesting_shares, VESTS_SYMBOL): Amount must be VESTS
    {}
    th_a  steem_operations.cpp:132 validate

I quickly hacked the problem by changing VESTS to GESTS in steem.py:

        op = operations.Withdraw_vesting(
            **{"account": account,
               "vesting_shares": '{:.{prec}f} {asset}'.format(
                   float(amount),
                   prec=6,
                   asset="GESTS"
               ),
               }
        )