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 Chain.get_transaction/1 #1189

Merged
merged 4 commits into from
Jul 28, 2023

Conversation

bchamagne
Copy link
Contributor

@bchamagne bchamagne commented Jul 26, 2023

Description

Implement Chain.get_transaction/1
Fixes #1167

  • Add mock on the SCPlayground
  • Documentation

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Unit tested

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@bchamagne bchamagne added the smart contracts Involve smart contracts label Jul 26, 2023
Constants.from_transaction(tx)

{:error, _} ->
nil
Copy link
Member

Choose a reason for hiding this comment

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

Currently other Chain functions raise an error if the result is invalid. In this case you are returning nil which is not coherent with other functions.
We should have an unified way to return error.

Copy link
Contributor Author

@bchamagne bchamagne Jul 26, 2023

Choose a reason for hiding this comment

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

  • Update all Chain functions to return nil instead of crashing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • expect instead of stub

@Neylix Neylix added this to the 1.3.0 milestone Jul 26, 2023
@Neylix Neylix merged commit f0c7660 into archethic-foundation:develop Jul 28, 2023
Neylix pushed a commit to Neylix/archethic-node that referenced this pull request Aug 1, 2023
* Add Chain.get_transaction/1

* Chain functions return nil instead of crashing

* Add mocks to the unit tests

* use Mock.expect instead of Mock.stub
@Neylix Neylix added the feature New feature request label Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request smart contracts Involve smart contracts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Being able to fetch transaction from smart contract
2 participants