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

Add decode data method in Tx Service Api #1007

Merged
merged 7 commits into from
Jun 3, 2024

Conversation

falvaradorodriguez
Copy link
Contributor

Closes #1006

@falvaradorodriguez falvaradorodriguez self-assigned this May 30, 2024
@falvaradorodriguez falvaradorodriguez requested a review from a team as a code owner May 30, 2024 14:33
@coveralls
Copy link

Pull Request Test Coverage Report for Build 9304382134

Details

  • 16 of 17 (94.12%) changed or added relevant lines in 2 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.02%) to 93.499%

Changes Missing Coverage Covered Lines Changed/Added Lines %
gnosis/safe/api/transaction_service_api/transaction_service_api.py 7 8 87.5%
Files with Coverage Reduction New Missed Lines %
gnosis/eth/ethereum_client.py 1 86.16%
gnosis/safe/tests/utils.py 1 60.0%
Totals Coverage Status
Change from base Build 9302424802: -0.02%
Covered Lines: 8068
Relevant Lines: 8629

💛 - Coveralls

@coveralls
Copy link

coveralls commented May 30, 2024

Pull Request Test Coverage Report for Build 9345962607

Details

  • 112 of 112 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.08%) to 93.599%

Totals Coverage Status
Change from base Build 9317946988: 0.08%
Covered Lines: 8160
Relevant Lines: 8718

💛 - Coveralls


:param data: tx data as a 0x prefixed hexadecimal string.
:param to_address: address of the receiving contract
:return:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are you returning? Maybe you can define a TypedDict (inside a file entities.py on the transaction_service_api/ folder) to make clear what's the return value. And we should do the same for other functions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I did this by looking at the other methods, but it is not the right thing to do. I will try to update the other method signatures.

"0x095ea7b3000000000000000000000000e6fc577e87f7c977c4393300417dcc592d90acf8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
)
to_address = "0x4127839cdf4F73d9fC9a2C2861d8d1799e9DF40C"
self.transaction_service_api.decode_data(data, to_address)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are not checking the function is returning anything. I could change return response.json() in decode_data function to return None at the end and this test will pass. You should also mock the result and check the function is returning what you expect.

Copy link
Member

@Uxio0 Uxio0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job

@falvaradorodriguez falvaradorodriguez merged commit a0b66d6 into main Jun 3, 2024
7 checks passed
@falvaradorodriguez falvaradorodriguez deleted the add_decode_data_method branch June 3, 2024 08:26
@github-actions github-actions bot locked and limited conversation to collaborators Jun 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add method to decode transaction data in Tx Service API
3 participants