[Python] Send all account balance TRX using Tronpy

Discussão em 'Python' iniciado por Stack, Fevereiro 8, 2025.

  1. Stack

    Stack Membro Participativo

    I use tronpy to make TRX and TRC20 transactions. I wonder if there is any way to send the whole balance. Right now I only found a way how to send usual transaction:

    priv_key = PrivateKey(bytes.fromhex(private_key))

    txn = (
    client.trx.transfer(address_from, address_to, amount)
    .memo(memo)
    .build()
    .sign(priv_key)
    )
    result = broadcast_transaction(txn)


    Should I add here any option to make it send the whole balance considering the fee? Right now I'm calculating and subtracting the end amount following this example, but it may be imprecise sometimes

    Continue reading...

Compartilhe esta Página