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 name in enum payload #185

Merged
merged 4 commits into from
Jan 22, 2025

Conversation

EtienneWallet
Copy link
Contributor

Context

When a user do a query while providing an ABI and expectes an enum as a result, he will receive the discriminant of the variant of the Enum. This is not very user friendly as the variant are originally defined by name.

Proposed Changes

When the names_to_discriminants dict is available in the EnumValue prototype, return also the name of the variant in the payload.

This allow to go from {__discriminant__=43, e=5, f=6} to {__discriminant__=43, __name__="TypeC", e=5, f=6}

@EtienneWallet
Copy link
Contributor Author

the test test_should_parse_relayed_success fails locally on my side, even on the feat/next branch. Is it an expected behavior?

@popenta
Copy link
Collaborator

popenta commented Jan 21, 2025

the test test_should_parse_relayed_success fails locally on my side, even on the feat/next branch. Is it an expected behavior?

Generally speaking, you can run all tests without the mainnet ones by running pytes -m "not mainnet". Indeed, the test fails. We'll have a look.

@EtienneWallet EtienneWallet force-pushed the add-name-in-enum-payload branch from 0ca100e to 1683bb5 Compare January 21, 2025 17:12
@EtienneWallet
Copy link
Contributor Author

the branch add-name-in-enum-payload was forced pushed due to a rebase on the target branch feat/next

Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  multiversx_sdk/abi
  enum_value.py
  multiversx_sdk/smart_contracts
  smart_contract_transactions_outcome_parser.py 155, 199
Project Total  

This report was generated by python-coverage-comment-action

@popenta popenta merged commit a694e0b into multiversx:feat/next Jan 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants