-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restore jsonrpc api consistency to display only TRX as value #5469
Conversation
I don't agree with this modification. It's not compatible with the data ago. And tronscan uses this value though it's not TRX. I think it's not necessary to do it. |
Thank you for the answer. Let me clarify some points: |
@317787106 Use |
@halibobo1205 |
@317787106 Help figure out what this field was used for before, or add a new field? |
Seems that |
Also I'm not quite sure with correctness of this part.
And this would be wrong for ShieldedTransaction, as the value can be either from or to, currently actual information for ShieldedTransaction types isn't displayed correctly for such a case. |
@alexqrid You are right, |
@alexqrid Any transaction's type in java-tron is 0x0. |
@alexqrid The reason that we use amount in TransferAssetContract and other contract is to be compatible with tronscan and trongrid api. You can look at this https://apilist.tronscanapi.com/api/transaction-info?hash=af1094b946e947795656a9df3da7fef311b790c6ee067b29251b13fd5463c510. There is column |
@alexqrid For compatibility reasons, no changes will be considered for now, cc @317787106 @jwrct . |
@317787106 @jwrct Please Take A Look |
I think this is a good idea, let's discuss it, maybe we could add a new field. @317787106 @jwrct |
@alexqrid There may be compatible problem with previous version. Let's suppose that one user has used this value (same as amount) of the api eth_getTransactionByHash, if your changes take effect, vaule will be zero except TRX related. If this user don't acquire this changes, the data will be wrong. If you only want value only related to TRX, you can use other api to get the ContractType. This is not time consuming. |
What does this PR do?
This PR restores consistency in JSON-RPC API. Previously
value
field inJSON-RPC
response displayed various currencies(TRC-10 or TRX) and this is incorrect.Why are these changes required?
As we can't distinguish the transaction type in
JSON-RPC
response it's weird to return various currencies amount invalue
field or vote amount.For instance, for transaction types
UnfreezeAssetContract
,TransferAssetContract
value
field indicates token amount, forVoteWitnessContract
it indicates vote count, forExchange*Contract
it indicates unknown currency at all as the currency depends on exchange.This PR has been tested by:
Follow up
System information
java-tron version:
GreatVoyage-v4.7.2
OS & Version: Linux
Expected behaviour
In order to keep consistent API,
value
field in JSON-RPC response should indicate TRX(TRON) amount, neither asset amount nor vote count.Actual behaviour
value
field indicates not only TRX(TRON) value but TRC-10 token value as well.Check for example transaction
64e594ccb2cb47b23ade85adbcb3404a501d2627291b09a0ed49364049c5abfa
:eth_getTransactionByHash response
Steps to reproduce the behaviour
Extra details
With this PR jsonrpc response is consistent and returns correct value of tron for the transacion above (
0x64e594ccb2cb47b23ade85adbcb3404a501d2627291b09a0ed49364049c5abfa
):