iexbase/tron-api-python

TRC10 SELL transaction for poloniex

OleksiiYe opened this issue · 6 comments

Hi I'm use this lib for work with polonium api and make transactions to exchange
every transactions is working except sell trc10 tokens

I.m use this code for make transaction

            order_symbol_Poloniex = 1002000

            buy_Trc10 = self.tron.transaction_builder.trigger_smart_contract(
                contract_address=trc10Contract,
                function_selector='sellOrder(trcToken,uint256,uint256,uint256)',
                fee_limit=10000000,
                token_id=1002000,
                token_value=0,
                parameters=[
                    {'type': 'int256', 'value': order_symbol_Poloniex},
                    {'type': 'int256', 'value': order_quantity_Poloniex},
                    {'type': 'int256', 'value': value_2symbol_Poloniex},
                    {'type': 'int256', 'value': order_price_Poloniex},])
            buy_Trc10_sign = buy_Trc10['transaction']
            buy_Trc10_signb = Trx(self.tron)
            buy_Trc10_signb.sign_and_broadcast(buy_Trc10_sign)
            return buy_Trc10 ```

but if token_id or token_value there then 0  I got exception


```File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tronapi/transactionbuilder.py", line 595, in trigger_smart_contract
    data.token_id = int(token_id)
AttributeError: 'dict' object has no attribute 'token_id'````

all transactions have fail status 

where is mistake?

#62

upgrade the package to 3.1.6

what package? tronapi?

thank you !!!

yes

sorry again but problem not resolved - same exception
data.token_id = int(token_id)
AttributeError: 'dict' object has no attribute 'token_id'

perhaps something wrong with my code?

resolved! Thanks a lot!!!!!!