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

Relayed V3 #434

Merged
merged 18 commits into from
Sep 18, 2024
Merged

Relayed V3 #434

merged 18 commits into from
Sep 18, 2024

Conversation

popenta
Copy link
Contributor

@popenta popenta commented Jul 3, 2024

Added support for relayed V3 transactions.

Added the --relayer argument for specifying the relayer of the transaction.

Added the --inner-transactions-outfile argument for saving the created relayed transaction. If the file contains transactions it will append to the rest of the transactions.

Added the inner_transactions argument to specify the inner transactions that will be sent by the relayer.

@popenta popenta self-assigned this Jul 3, 2024
@popenta popenta marked this pull request as draft July 3, 2024 14:18
@andreibancioiu andreibancioiu self-requested a review July 3, 2024 14:35
requirements.txt Outdated
@@ -10,4 +10,4 @@ requests-cache
rich==13.3.4
argcomplete==3.2.2

multiversx-sdk>=0.9.2,<1.0.0
multiversx-sdk @ git+https://github.com/multiversx/mx-sdk-py@feat/next
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 (maybe even a fixed commit hash or tag)

@@ -93,6 +80,12 @@ def do_prepare_transaction(args: Any) -> Transaction:
if args.guardian:
tx.guardian = args.guardian

if args.relayer:
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

if args.relayer:
tx.relayer = Address.new_from_bech32(args.relayer).to_bech32()

if args.inner_transactions:
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

with_data: bool = True,
with_estimate_gas: bool = False,
with_guardian: bool = False,
with_relayed_v3: bool = True):
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can simplify the arguments of add_tx_args, with respect to its usage. E.g. we can drop with_relayed_v3 and with_guardian, since the defaults are not overridden (at least, not now, maybe never).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Removed with_guardian and with_relayed_v3. Arguments are now always present.

if transfers:
tx = factory.create_transaction_for_esdt_token_transfer(
# temporary workaround until proper fix in sdk-py
if native_amount or transfers:
Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, we can drop the if-else after the fix in sdk-py. Or keep this as it is, but then drop the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'll keep is as it is, at least for now. Removed the comment.


def load_inner_transactions_from_file(path: Path) -> List[Transaction]:
data_json = path.read_bytes()
Copy link
Contributor

Choose a reason for hiding this comment

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

read_text(), instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!



def check_relayer_transaction_with_data_field_for_relayed_v3(args: Any):
if hasattr(args, "inner_transactions") and args.inner_transactions and args.data:
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a double check - is this an invalid case (wrt. to the Protocol)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, we can't set data field for the relayer's transaction.

Base automatically changed from add-token-transfers-for-tx-new to feat/next July 8, 2024 10:09
@popenta popenta marked this pull request as ready for review September 17, 2024 07:56
andreibancioiu
andreibancioiu previously approved these changes Sep 17, 2024
pyproject.toml Outdated
Comment on lines 23 to 24
"toml>=0.10.2",
"requests",
"requests>=2.32.0,<3.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Since mxpy is an end-application, we can also have precise / fixed versions (for all, actually).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do this in future PRs.

@popenta popenta merged commit 325a71e into feat/next Sep 18, 2024
11 checks passed
@popenta popenta deleted the relayed-v3 branch September 18, 2024 09:11
@popenta popenta mentioned this pull request Sep 30, 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

Successfully merging this pull request may close these issues.

3 participants