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

Migration Issue: v0 to v1 #179

Open
popenta opened this issue Jan 15, 2025 · 10 comments
Open

Migration Issue: v0 to v1 #179

popenta opened this issue Jan 15, 2025 · 10 comments
Assignees
Labels
Migration Migration support

Comments

@popenta
Copy link
Collaborator

popenta commented Jan 15, 2025

This major update brings significant enhancements, including new features, a streamlined and simplified API, and a focus on improved usability. Please note that v1 introduces breaking changes from v0.19, reflecting our commitment to delivering a cleaner and more robust development experience. We recommend reviewing the updated documentation and migration guide to make the transition as smooth as possible.

@popenta popenta added the Migration Migration support label Jan 15, 2025
@popenta popenta self-assigned this Jan 15, 2025
@popenta
Copy link
Collaborator Author

popenta commented Jan 15, 2025

Removed interfaces

We've figured that while interfaces are good for decoupling components they introduced to much complexity and overhead, so we've decided to get rid of most of them.

IAddress

Wherever IAddress was used, it has been replaced with Address.

IConfig

The IConfig interface was used when creating transaction factories. Now, the factories simply expect an object of type TransactionsFactoryConfig.

IValidatorPublicKey

This interface has also been removed. Wherever this interface was expected an object of type ValidatorPublicKey can be provided.

IAbi

This interface has also been removed. Wherever this interface was expected an object of type Abi can be provided.

@popenta
Copy link
Collaborator Author

popenta commented Jan 15, 2025

Address type changed from str to Address

Previously, when an address was expected it should have been the bech32 representation of the address. Being of type str it could create confusion not knowing if the bech32 or hex representation was expected. This has been changed now, wherever an address is expected (e.g. transaction sender), an object of type Address should be provided.

PR:

@popenta
Copy link
Collaborator Author

popenta commented Jan 15, 2025

Smart Contract Queries

The way we query contracts has been simplified quite a lot. The SmartContractQueriesController and QueryRunnerAdapter have been removed and the logic has been moved to the SmartContractController class. The API has not been modified, the query, create_query and run_query methods are still available.

The classes ContractQuery and ContractQueryBuilder have been removed.

For more details on how to execute contract queries check out the Cookbook.

PR:

@popenta
Copy link
Collaborator Author

popenta commented Jan 15, 2025

Removed converters subpackage

The converters subpackage was not needed anymore and it has been removed. The methods to_dictionary() and new_from_dictionary() have been moved on the Transaction class.

PR:

@popenta
Copy link
Collaborator Author

popenta commented Jan 15, 2025

Removed TransactionOutcome

Previously, in order to parse the outcome of a transaction, we used to fetch it from the network and then using TransactionConverter we had to convert it to an object of type TransactionOutcome and only then the transaction could have been parsed. This is no longer the case. The TransactionOnNetwork class now uses the same TransactionEvent, TransactionLogs and SmartContractResult as the old TransactionOutcome.

PR:

@popenta
Copy link
Collaborator Author

popenta commented Jan 15, 2025

TransactionStatus

The TransactionStatus has been changed, the methods have been removed. Now, the class has a property called status: str and two boolean properties: is_completed and is_successful. The booleans are set upon initialization based on the status.

TransactionOnNetwork

The class has been slightly modified, the type property has been removed. The is_completed field has been removed, but the property with the same name from the TransactionStatus can be used to achieve the same result.

The raw_response property has been renamed to raw.

Some other properties like hash, signature, block_hash and miniblock_hash have been changed from the type str to bytes.

@popenta
Copy link
Collaborator Author

popenta commented Jan 15, 2025

TransactionBuilders && TransactionParsers

The transaction builders and transaction parsers have been deprecated for some time and have been deleted in v1. These have been replaced with the transaction factories and transaction outcome parsers.

PR:

@popenta
Copy link
Collaborator Author

popenta commented Jan 15, 2025

TokenPayment

The TokenPayment class has been removed. Token and TokenTransfer should be used instead.

TransactionPayload

The TransactionPayload class has been removed. Transaction data is of type bytes.

@popenta
Copy link
Collaborator Author

popenta commented Jan 15, 2025

AccountNonceHolder

We've figured that the AccountNonceHolder class had to little utility so we've deleted it. The same functionality can be achieved using an account (Account, LedgerAccount).

@popenta
Copy link
Collaborator Author

popenta commented Jan 15, 2025

NetworkProviders

The network providers have been completely redesigned and refactored. Both the Api and the Proxy share a common interface, which means they can be used interchangeably to an extent. For more details check out the cookbook and the sdk-specs.

PRs:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Migration Migration support
Projects
None yet
Development

No branches or pull requests

1 participant