andelf / tronpy

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

delegate_resource cannot be used #119

Closed MaGua-Bishop closed 11 months ago

MaGua-Bishop commented 11 months ago

My code:

tron = config.client
private_key = PrivateKey(bytes.fromhex('xxxxx'))

a = (tron.trx.delegate_resource(
    receiver='TDYjXKmzH3XwPHnEBsWvWTFLkberEvJ7E8',
    owner='TGftqC5nEQXGz6w5qXW7pDUAo6NtAQyy1f',
    balance=1000,
    resource='ENERGY',
).build().sign(private_key))

print(a.broadcast().wait())

Both address the TRX, TGftqC5nEQXGz6w5qXW7pDUAo6NtAQyy1f also has the energy

Tips: tronpy.exceptions.ValidationError: Contract validate error : delegateBalance must be greater than or equal to 1 TRX

MaGua-Bishop commented 11 months ago

Resolved, balance is charged in trx,

For example, the approximate balance value of the energy transferred to 32000 is 2200*tronpy.TRX