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 support (from the legacy sdk-py-* libraries to this unified library) #41

Open
popenta opened this issue May 23, 2024 · 6 comments

Comments

@popenta
Copy link
Collaborator

popenta commented May 23, 2024

Here, we describe the main steps for migrating from the previous multiversx-sdk-* python packages to the new one.

As previously stated, this is not a completely new package, the main change is that we unified multiversx-sdk-core, multiversx-sdk-wallet and multiversx-sdk-network-providers into a single package.

If you have any questions about the migration, feel free to leave a comment.

References:

@popenta
Copy link
Collaborator Author

popenta commented May 23, 2024

Message & MessageComputer

While this is not a breaking change, there are some changes made to the constructor of the Message class.

There are three new fields added to the class: address(the address of the signer), version(the version of the message, defaults to 1), signer(what was used to sign the message, defaults to sdk-py).

For the MessageComputer class, two new methods have been added: pack_message and unpack_message.

@popenta
Copy link
Collaborator Author

popenta commented May 23, 2024

TransactionComputer

Previously, the TransactionComputer class was located in the transaction.py module, but now it's been moved to a separate module called transaction_computer.py. This may be a little breaking change for some, depending on the way it was imported.

While absolute imports can still be used, one can simply do:

from multiversx_sdk import TransactionComputer

@popenta
Copy link
Collaborator Author

popenta commented May 23, 2024

Breaking Change

SmartContractTransactionsFactory & TransferTransactionsFactory

Previously, when instantiating a SmartContractTransactionsFactory object, besides the config: IConfig parameter, an additional parameter token_computer: ITokenComputer was needed.

Now, the token_computer: ITokenComputer parameter has been removed.

The same applies for the TransferTransactionsFactory class.

@popenta
Copy link
Collaborator Author

popenta commented May 23, 2024

Breaking Change

TokenManagementTransactionsFactory

On the method create_transaction_for_setting_special_role_on_fungible_token a new parameter called add_role_esdt_transfer_role: bool has been added, since it was missing in the previous implementation.

This is more of a "fixing change", but nevertheless breaking.

@popenta
Copy link
Collaborator Author

popenta commented May 23, 2024

SmartContractQueriesController

Previously, we used the ContractQueryBuilder to create a query, and then we needed a network provider to run the query. We have now implemented a SmartContractQueriesController that can be used to create and run the query.

Reference:

@popenta
Copy link
Collaborator Author

popenta commented May 23, 2024

Transactions Outcome Parsers

Previouslty, we only had a single transaction parser, TokenOperationsOutcomeParser, used for parsing token management transactions. This parser is still available, but we encourage you to use the new one, TokenManagementTransactionsOutcomeParser.

In addition to this one, we now have parser for smart contract transactions (SmartContractTransactionsOutcomeParser) and delegation transactions(DelegationTransactionsOutcomeParser). These transactions parsers have also been aligned with the sdk-specs.

@andreibancioiu andreibancioiu changed the title Migration Support Migration support (from the sdk-py-* libraries to the unified library) Jun 4, 2024
@andreibancioiu andreibancioiu changed the title Migration support (from the sdk-py-* libraries to the unified library) Migration support (from the sdk-py-* libraries to this unified library) Jun 4, 2024
@andreibancioiu andreibancioiu changed the title Migration support (from the sdk-py-* libraries to this unified library) Migration support (from the legacy sdk-py-* libraries to this unified library) Jun 4, 2024
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

No branches or pull requests

1 participant