Stake2.0
Last updated
Last updated
When generating stake 2.0 transactions for DApps, for transactions of the DelegateResourceContract
or UnDelegateResourceContract
type, in order to display the estimated results during signature using the Tronlink extension, it is necessary to add the "__options" field to the transaction body.
Inside "__options", there are two values: estimatedBandwidth and estimatedEnergy, which correspond to the estimated energy and bandwidth of the delegate and reclaim operations, respectively.
When generating stake 2.0 transactions using a non-tronlink extension injected tronweb, in order to display the corresponding type of resource for DelegateResourceContract
or UnDelegateResourceContract
type transactions during signature, the "__resource" field needs to be added to the transaction body. (Adding “resource” is only necessary for tronWeb that is not injected by a tronlink extension. TronWeb that is injected by tronlink extension does not require.)
The "__resource" field corresponds to the values "BANDWIDTH" and "ENERGY".
For example:
The specific calculation logic of estimatedEnergy and estimatedBandwidth can be found in the last chapter of the "Stake 2.0 Adaptation FAQ": "How to convert resource share to amount?"