-
Notifications
You must be signed in to change notification settings - Fork 36
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
Relayed V3 #434
Conversation
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 |
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.
👍 (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: |
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.
👍
if args.relayer: | ||
tx.relayer = Address.new_from_bech32(args.relayer).to_bech32() | ||
|
||
if args.inner_transactions: |
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.
👍
multiversx_sdk_cli/cli_shared.py
Outdated
with_data: bool = True, | ||
with_estimate_gas: bool = False, | ||
with_guardian: bool = False, | ||
with_relayed_v3: bool = True): |
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.
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).
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.
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: |
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.
Indeed, we can drop the if-else after the fix in sdk-py. Or keep this as it is, but then drop the comment.
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.
We'll keep is as it is, at least for now. Removed the comment.
multiversx_sdk_cli/transactions.py
Outdated
|
||
def load_inner_transactions_from_file(path: Path) -> List[Transaction]: | ||
data_json = path.read_bytes() |
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.
read_text(), instead?
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.
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: |
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.
Just a double check - is this an invalid case (wrt. to the Protocol)?
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.
Indeed, we can't set data field for the relayer's transaction.
pyproject.toml
Outdated
"toml>=0.10.2", | ||
"requests", | ||
"requests>=2.32.0,<3.0.0", |
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.
Since mxpy is an end-application, we can also have precise / fixed versions (for all, actually).
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.
will do this in future PRs.
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.