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 TransactionVersion enum #413

Merged
merged 6 commits into from
Feb 15, 2024
Merged

Add TransactionVersion enum #413

merged 6 commits into from
Feb 15, 2024

Conversation

DelevoXDG
Copy link
Contributor

@DelevoXDG DelevoXDG commented Feb 9, 2024

Describe your changes

Related to #409

  • Add TransactionVersion enum
  • Use it instead of Felt in tx, tx payload dataclasses and related functions

Linked issues

Closes #412

Breaking changes

  • This issue contains breaking changes
  • version argument in TransactionFactory functions is now of type TransactionVersion instead of Felt
  • version argument in TransactionHashCalculator functions is now of type TransactionVersion instead of Felt
  • TransactionPayload.version is now of type TransactionVersion instead of Felt

@DelevoXDG DelevoXDG requested a review from THenry14 February 13, 2024 10:46
* Standard versions include [V0], [V1], [V2], and [V3]. These are utilized for regular transaction execution.
* Query versions [V1_QUERY], [V2_QUERY], and [V3_QUERY] should only be used for creating transactions to be used
* in queries that do not alter the chain state, as in methods like [Provider.simulateTransactions] and [Provider.getEstimateFee].
* Avoid using query versions for transactions intended for execution.
Copy link
Member

Choose a reason for hiding this comment

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

Avoid using query versions for transactions intended for execution.

I'm pretty sure this should not even be possible, and such tx would fail

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not, hence the warning 😅

Copy link
Member

@THenry14 THenry14 Feb 15, 2024

Choose a reason for hiding this comment

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

But the warning says "Avoid using query versions for transactions intended for execution.", which implies it is possible, but should be avoided :P

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which should convey to the user "it's possible from the SDK-side, but should not be done".
Should I rephrase it to:

Sending transaction with a query version for execution will result in a failure.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, explicit is better than implicit 👍

@DelevoXDG DelevoXDG requested a review from THenry14 February 15, 2024 10:12
@codecov-commenter
Copy link

codecov-commenter commented Feb 15, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (72ffcc8) 69.30% compared to head (94930d7) 69.23%.

Files Patch % Lines
...on/starknet/data/types/transactions/Transaction.kt 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #413      +/-   ##
==========================================
- Coverage   69.30%   69.23%   -0.08%     
==========================================
  Files          73       73              
  Lines        3131     3130       -1     
  Branches      315      308       -7     
==========================================
- Hits         2170     2167       -3     
- Misses        811      813       +2     
  Partials      150      150              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DelevoXDG DelevoXDG merged commit 4b67d12 into main Feb 15, 2024
2 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.

Use enums instead of Felt for tx versions
3 participants