andelf / tronpy

TRON Python Client Library.
MIT License
212 stars 96 forks source link

Adding a set_expiration function to TransactionBuilder #46

Closed Dsthdragon closed 1 year ago

Dsthdragon commented 2 years ago

Had an Issue were I was getting Transaction Expired when creating a transaction. After going through the documentation I had to modify the TransactionBuilder class by addding set_expiration below:


    def set_expiration(self, expiration: int) -> "TransactionBuilder":
        self._raw_data['expiration'] = current_timestamp() + expiration
        return self

Is there a reason why the option to set expiration was added?

MrNaif2018 commented 1 year ago

Added expiration() function in cb9977288a27c84adc30ddefa1cde57d64e902fb

But in general transaction shouldn't expire if you act fast. If I'm not mistaken it's valid for a minute, so you have to craft a transaction and do nothing for 1 minute?

Though I remember this error too, I made some changes in AsyncTransactionBuilder at least which helped me before