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 ConvertibleToTransactionPayload interface #180

Closed
wants to merge 1 commit into from

Conversation

cptartur
Copy link
Member

@cptartur cptartur commented Nov 9, 2022

Describe your changes

This PR attempts to standardize the behavior of toPayload method in Transactions by adding ConvertibleToTransactionPayload (subject to change) interface that indicates if Transaction (or any object for that matter) is convertible to TransactionPayload object.

This PR is a suggestion, if the used approach is not preferred by other developers, it can be closed.

Linked issues

Closes

Breaking changes

  • This issue contains breaking changes

*
* @param T: Subclass of the TransactionPayload that will be returned by the conversion
*/
interface ConvertibleToTransactionPayload<T : TransactionPayload> {
Copy link
Member

Choose a reason for hiding this comment

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

👀

@codecov-commenter
Copy link

Codecov Report

Base: 62.67% // Head: 62.73% // Increases project coverage by +0.05% 🎉

Coverage data is based on head (c9dec65) compared to base (9ca1029).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #180      +/-   ##
==========================================
+ Coverage   62.67%   62.73%   +0.05%     
==========================================
  Files          50       50              
  Lines        1243     1245       +2     
  Branches       81       81              
==========================================
+ Hits          779      781       +2     
+ Misses        442      440       -2     
- Partials       22       24       +2     
Impacted Files Coverage Δ
...on/starknet/data/types/transactions/Transaction.kt 47.70% <100.00%> (ø)
...knet/data/types/transactions/TransactionPayload.kt 100.00% <100.00%> (ø)
...tlin/com/swmansion/starknet/crypto/NativeLoader.kt 29.03% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Solpatium
Copy link
Contributor

I think this would add additional cognitive overhead for users and I don't see the benefit.
If we want every tx to have toPayload fn then I suggest adding it as an abstract method to Transaction.

@cptartur cptartur closed this Nov 9, 2022
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.

None yet

4 participants