ape icon indicating copy to clipboard operation
ape copied to clipboard

Refactor: EcosystemAPI

Open NotPeopling2day opened this issue 3 years ago • 3 comments

Overview

Refactor EcosystemAPI and associated types

Specification

  • [ ] Use the Literal pydantic trick for indexing purposes https://github.com/ApeWorX/ape/pull/509#discussion_r814461074
  • [ ] TransactionAPI might be over-specified https://github.com/ApeWorX/ape/pull/509#discussion_r814461240
  • [ ] Transaction types, use .type member more smartly https://github.com/ApeWorX/ape/pull/509#discussion_r814461646

Dependencies

#509

NotPeopling2day avatar Mar 02 '22 14:03 NotPeopling2day

TransactionAPI might be over-specified : Care to elaborate on this one?

antazoey avatar Mar 05 '22 19:03 antazoey

TransactionAPI might be over-specified : Care to elaborate on this one?

We have max_fee and max_priority_fee in the core TransactionAPI type. Thinking more abstractly, there isn't really a need to have these txn types specify this data directly. Perhaps there is a smarter way where those fields are left out of TransactionAPI (and end up in their contract classes), and just keep an abstractmethod like max_total_fee that returns whatever the concrete implementation considers to be the maximum amount of ETH that would be spent. This is useful for other functions like detecting if a user has enough ETH to send the transaction.

If you want to query base_fee from the transaction, well that field wouldn't be available in TransactionAPI, you would have to be certain you are working with DynamicFeeTransaction concrete classes that implement this field in their data model.

fubuloubu avatar Mar 05 '22 19:03 fubuloubu

Thank you for adding this info!

I agree, those fields only matter during serialization and can be handled at the implementation level.

antazoey avatar Mar 05 '22 21:03 antazoey