Skip to content
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

Implement MirrorNodeClient.queryTransaction #26

Open
11 tasks
hendrikebbers opened this issue Aug 24, 2024 · 11 comments
Open
11 tasks

Implement MirrorNodeClient.queryTransaction #26

hendrikebbers opened this issue Aug 24, 2024 · 11 comments
Assignees
Labels
good first issue Reserved for newcomers 🐣 hacktoberfest Reserved for Hacktoberfest contribution (see https://hacktoberfest.com) 🚀👾🧑🏽‍💻 help wanted External contribution or help is welcome 🧑‍💻🧑🏾‍💻

Comments

@hendrikebbers
Copy link
Member

hendrikebbers commented Aug 24, 2024

🆕🐥 First Timers Only

This issue is reserved for people who have never contributed to this project or any open source project in general.
We know that creating a pull request (PR) is a major barrier for new contributors.
The goal of this issue and all other issues labeled by 'good first issue' is to help you make your first contribution.

👾 Description of the issue

The interface MirrorNodeClient provides the method Optional<TransactionInfo> queryTransaction(@NonNull String transactionId). The implementation of the method in MirrorNodeClientImpl calls the Mirror Node REST API but do not use the result of that call. Instead, only a record containing the transactionId as String is returned (see TransactionInfo).

When doing a call against the REST API way more information about a transaction are returned as you can see in the following sample

Query:

curl -X 'GET' \
  'https://testnet.mirrornode.hedera.com/api/v1/transactions/0.0.4457569-1724503621-738000000?nonce=0' \
  -H 'accept: application/json'

Result:

{
  "transactions": [
    {
      "bytes": null,
      "charged_tx_fee": 66529172,
      "consensus_timestamp": "1724503632.496534574",
      "entity_id": "0.0.4738897",
      "max_fee": "1000000000",
      "memo_base64": "",
      "name": "TOKENMINT",
      "nft_transfers": [
        {
          "is_approval": false,
          "receiver_account_id": "0.0.4457569",
          "sender_account_id": null,
          "serial_number": 1,
          "token_id": "0.0.4738897"
        },
        {
          "is_approval": false,
          "receiver_account_id": "0.0.4457569",
          "sender_account_id": null,
          "serial_number": 2,
          "token_id": "0.0.4738897"
        }
      ],
      "node": "0.0.7",
      "nonce": 0,
      "parent_consensus_timestamp": null,
      "result": "SUCCESS",
      "scheduled": false,
      "staking_reward_transfers": [],
      "token_transfers": [],
      "transaction_hash": "VwgHwtzwU23H2mNaX0hl9lo1ZZQ+6VqGOrzqIzfz6D2KHUHgmGfzmTwStFAS2eza",
      "transaction_id": "0.0.4457569-1724503621-738000000",
      "transfers": [
        {
          "account": "0.0.7",
          "amount": 13305834,
          "is_approval": false
        },
        {
          "account": "0.0.98",
          "amount": 47901005,
          "is_approval": false
        },
        {
          "account": "0.0.800",
          "amount": 5322333,
          "is_approval": false
        },
        {
          "account": "0.0.4457569",
          "amount": -66529172,
          "is_approval": false
        }
      ],
      "valid_duration_seconds": "120",
      "valid_start_timestamp": "1724503621.738000000"
    }
  ]
}

The additional information should be added to the TransactionInfo record.

Suggestion for solving the issue

In the MirrorNodeClientImpl class you can already find several samples on how a JSON response of a REST call is parsed and transfered in a custom method return type. The same should be done in the Optional<TransactionInfo> queryTransaction(@NonNull String transactionId) method and TransactionInfo should become a rich object that is based on all the information coming from JSON.

Additional information

Information about the rest api of the mirror node can be found here. The API can be accessed by Swagger UI. The Swagger UI frontend for testnet can be found here.

📋 Step by step guide to do a contribution

If you have never contributed to an open source project at GitHub, the following step-by-step guide will introduce you to the workflow.
A more detailed general documentation of the GitHub PR workflow can be found here.

  • Claim this issue: Comment below that you are interested in working on the issue
  • Wait for assignment: A community member with the given rights will add you as an assignee of the issue
  • Fork the repository: You can do that in GitHub (by simply clicking the 'fork' button).
  • Check out the forked repository
  • Create a feature branch for the issue. We do not have a hard naming definition for branches but it is best practice to prefix the branch name with the issue id.
  • Solve the issue in your branch.
  • Commit your changes: to your branch
  • Start a Pull Request (PR): in the hedera-enterprise repository
  • Check GitHub Actions: Several GitHub Actions will be triggered automatically for each PR. If a GitHub Action fails and you do not understand the cause of that error do not hesitate to add a comment to the PR and ask the community for support.
  • Wait for reviews: Members of the community will review your PR. If a reviewer finds any missing pieces or a problem, he or she will start a discussion with you and describe the next steps for solving the problem.
  • You did it 🎉: We will merge the fix in the develop branch. Thanks for being part of our community as an open-source contributor ❤️

🎉 Contribute to Hacktoberfest

Solve this issue as part of the Hacktoberfest event and get a chance to receive cool goodies like a T-Shirt. 🎽

🤔 Additional informantion

If you have any questions, just ask us directly in this issue by adding a comment. You can join the Hedera community chat at Discord. A general manual about open-source contributions can be found here.

@toficzak
Copy link

Hey, seems like an easy introduction task :) I would gladly try my best to solve this.

From my understanding, I should:

  • update TransactionInfo with all information that returned from api call,
  • write proper mapper, so that json object would change into new TransactionInfo,
  • create simple test to prove it works,
    right?

@hendrikebbers
Copy link
Member Author

agree :)

@hendrikebbers hendrikebbers added good first issue Reserved for newcomers 🐣 help wanted External contribution or help is welcome 🧑‍💻🧑🏾‍💻 and removed hacktoberfest labels Aug 27, 2024
@toficzak toficzak removed their assignment Sep 6, 2024
@toficzak
Copy link

toficzak commented Sep 6, 2024

My situation changed, I do not have time right now to participate in any project. Sorry for inconvenience.

@Ashleycodesseo
Copy link

Hey @hendrikebbers do you need help with any REST API documentation? I'm looking to get some experience documenting so if you need help please let me know! Thank you

@hendrikebbers hendrikebbers added the hacktoberfest Reserved for Hacktoberfest contribution (see https://hacktoberfest.com) 🚀👾🧑🏽‍💻 label Oct 1, 2024
@Ndacyayisenga-droid
Copy link
Member

@Ashleycodesseo did you mean you are interested on working on this issue?

@Ariho-Seth
Copy link
Contributor

Hello @Ndacyayisenga-droid can you please assign me this issue, if no one has worked on it.

@Ariho-Seth
Copy link
Contributor

Hello @hendrikebbers I worked on this issue and was able to finish all the possible suggestions but when I try running the mvn clean install , it yields a BUILD FAILURE due to some failed tests in some other module of which I didn't edit any file in that module.
So am trying to follow up those issues that why I haven't submitted the PR
If you can offer any help or prepare a zoom meeting together to help me debug my code , I will be happy
Thanks🙏

@Ariho-Seth
Copy link
Contributor

Hello @Ndacyayisenga-droid please help me here

@Ndacyayisenga-droid
Copy link
Member

Ndacyayisenga-droid commented Oct 17, 2024

Hello @Ndacyayisenga-droid please help me here

@Ariho-Seth I think you dont have enough HBARs on your testnet account to run all tests in this repo. You can use mvn clean install -DskipTests. For testing, run individual tests in your ide

@Ndacyayisenga-droid
Copy link
Member

Alternatively, you can test your code in your fork using the current github workflow since github has enough HBARs for that. Like we did last time we had a call

@Ariho-Seth
Copy link
Contributor

Hello @hendrikebbers and @Ndacyayisenga-droid, Am facing issues when I try running any tests in the entire repo
This is what am facing
issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Reserved for newcomers 🐣 hacktoberfest Reserved for Hacktoberfest contribution (see https://hacktoberfest.com) 🚀👾🧑🏽‍💻 help wanted External contribution or help is welcome 🧑‍💻🧑🏾‍💻
Projects
None yet
Development

No branches or pull requests

5 participants