-
Notifications
You must be signed in to change notification settings - Fork 87
Add dataclasses for transactions #649
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 dataclasses for transactions #649
Conversation
…d-dataclasses-for-transactions
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## refactor/remove-cairo-lang-dependency #649 +/- ##
========================================================================
Coverage ? 97.49%
========================================================================
Files ? 57
Lines ? 2796
Branches ? 0
========================================================================
Hits ? 2726
Misses ? 70
Partials ? 0 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to address the issue with our typing currently requiring casts in multiple places. Otherwise looks mostly good.
* Remove usages of `CastableToHash` (#587) * Remove CastableToHash import * Change hash to int * Replace `FIELD_PRIME` in felt.py (#588) * Add FIELD_PRIME constant * Change FIELD_PRIME to hex * Replace `get_random_private_key` (#597) * Replace get_random_private_key * Change key generation method * Move func to test utils * Add comment * Replace `get_selector_from_name` and `get_storage_var_address` implementations (#586) * Remove uses of starkware.starknet.public.api * Add eth-utils dependency * Change import path * Apply review * Move functions to separate files * Fix path in cairo-lang comment * Add unit tests * Remove `ContractAddressSalt.get_random_value()` usages (#596) * add custom `get_random_value` * fix imports * rename to `get_random_salt` * move `get_random_salt` to deployer.py * make it private * do not use private `get_random_salt` * Replace `compute_hash_on_elements` (#602) * replace compute_hash_on_elements * replace calculate_contract_address_from_hash * remove unused PREFIX_TRANSACTION * add tests * fix pyright * add type for data * Update starknet_py/utils/crypto/facade.py Co-authored-by: Kamil Jankowski <[email protected]> * move to constants * remove unnecessary function * remove `hash_call_with` function & `hash_func` parameter * fix the imports Co-authored-by: Kamil Jankowski <[email protected]> * Replace transaction hash calculation (#621) * add functions to compute transaction hashes * replace usages from starkware * deprecate compute_invoke_hash * add tests * rename to compute_transaction_hash * fix error * add docstrings * replace 0 with DEFAULT_ENTRY_POINT_SELECTOR * modify test case * update lock * fixes after merge * update lock * fix imports in the `fmt: off` files * fix import * Add dataclasses for transactions (#649) * `Declare` is working :o * format * [wip] adding transactions * it is working! * format * remove QUERY_VERSION_BASE and change TransactionType to own implementation * change `general_config` to `chain_id` * [wip] bulk * format * repair bulk * remove unused blockIdentifier * bring DEFAULT_DECLARE_SENDER_ADDRESS to constants * fix import * add tx_type as @classmethod * DEFAULT_DECLARE_SENDER_ADDRESS = 1 * post-merge fixes * fix typing errors * format * resolve last typing issues * format * remove unnecessary file * update docstrings and comments in transaction.py * format * Update starknet_py/net/account/account_client.py Co-authored-by: Kamil Jankowski <[email protected]> * rename `InvokeFunction` to `Invoke` * apply part of the review changes. The biggest one: remove SignableTransaction and replace it with AccountTransaction * tx_type as a property * fix docs * rename `tx_type` to `type` remove unnecessary `post_dump` method * format * remove comment * make `_remove_entry_point_selector` private * remove duplicated TransactionType * NoneFelt docstring * fix docs * review suggestions * _prepare_invoke_function -> _prepare_invoke * add marshmallow-dataclass as dependency * InvokeFunction -> Invoke in the docstring * update typing * Revert "add marshmallow-dataclass as dependency" This reverts commit 7e0a163. * change marshmallow-dataclass version * remove casting * remove types.py * move `pylint:disable` Co-authored-by: Kamil Jankowski <[email protected]> * Replace compress and decompress program (#683) * Use own compress and decompress program * Fix lint * Fix typing * Inline `_compress_program` * Add basic Declare test * Fix tests typing * Remove `_contract_attribute_name` * remove unused imports * update lock * rename function * add ABC to the AccountTransaction * update base signer interface * update comment * move MASK_250 * Migration guide (remove cairo lang) (#670) * migration guide v1 * add `the` * add info about imports * formatting * Update docs/migration_guide.rst Co-authored-by: Artur Michałek <[email protected]> * add `Transaction's dataclasses` section * fix bullet list * remove unnecessary line * suggested changes * Update docs/migration_guide.rst Co-authored-by: Artur Michałek <[email protected]> * review suggestions Co-authored-by: Artur Michałek <[email protected]> * clean after merge * update lock * format * aftermerge fixes * fix types * fix failing docs * add tests for `Transaction.calculate_hash` * Replace`StarkErrorCode` (#737) * remove usage of StarknetErrorCode * one last usage of `get_selector_from_name` from cairo lang * Support calculating class_hash (#660) * Add compute_class_hash * Add tests * Add tests * Remove pre-0.10.0 class_hash calculation * Fix sorted keys in serialized class * Remove else branch * Remove else branch * Hash module (#677) * Create hash module * Format * Fix docs build * Add docstrings * Add pedersen_hash tests * Format * Fix test * Replace ContractClass (#686) * Rename DeclaredContract to ContractClass * Replace ContractClass * Restore class hash < 0.10.0 [WIP] * Use re.sub * Remove int casting * Add tests * Add compute_class_hash * Remove pre-0.10.0 class_hash calculation * Fix sorted keys in serialized class * Remove else branch * Remove else branch * Hash module (#677) * Create hash module * Format * Fix docs build * Add docstrings * Add pedersen_hash tests * Format * Fix test * Replace ContractClass (#686) * Rename DeclaredContract to ContractClass * Replace ContractClass * Restore class hash < 0.10.0 [WIP] * Use re.sub * Remove int casting * Post merge fixes * Rename contract_class module * Update starknet_py/hash/class_hash.py * Add create_contract_class to compiler module * Apply review * Apply suggestions from code review Co-authored-by: Artur Michałek <[email protected]> * Add CompiledContract (#708) * Add CompiledContract * Review * Add suggestions from review * Remove factory method * Fix ci * Default abi to empty list * Post merge * Fix circular import * Remove annotations import --------- Co-authored-by: Artur Michałek <[email protected]> Co-authored-by: war-in <[email protected]> * Add comment about default_factory * Fix lock * Validate class_hash with cairo-lang * Replace imports of already implemented methods * Update migration guide * Change deprecation version * Circular imports detection (#760) * Add circular.py * Fix circular imports * Remove import * Update circular.py Co-authored-by: war-in <[email protected]> * Add circular check to CI * Fix CI --------- Co-authored-by: war-in <[email protected]> * Fix lock * Fix lint * Final changes * Fix docs --------- Co-authored-by: Kamil Jankowski <[email protected]> Co-authored-by: Artur Michałek <[email protected]>
Closes #640
Closes #634
Closes #662
Introduced changes
QUERY_VERSION_BASE
is removed