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

[MultiversX]: Add support for relayed (V3) transactions #4243

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

andreibancioiu
Copy link
Contributor

Description

This PR brings some support for crafting relayed transactions. The so-called relayed transactions are transactions where the fee is paid by a relayer account (instead of being paid by the sender).

Applications that use wallet-core to create & sign transactions can benefit from these changes to support the use case of relayed transactions (e.g. this use case will be supported in xPortal).

  • The Transaction object has been extended to include a new field, called relayer.
  • The Serialization logic has been adjusted to include the the new relayer field.
  • If one creates a relayed transaction using the transfers-specific methods of the transactions factory, gas limit computation properly handles the extra gas limit needed for such transactions.
  • Unit tests have been extended.

Additional references:

How to test

Running the unit tests, and performing a smoke test (e.g. sending a regular transaction) upon integrating the updated wallet-core in the mobile application. The mobile application does not need to populate the newly added field.

Types of changes

  • New feature (non-breaking change which adds functionality)

Theoretically - non-breaking. Public methods not altered.

Checklist

  • Create pull request as draft initially, unless its complete.
  • Add tests to cover changes as needed.
  • Update documentation as needed.
  • If there is a related Issue, mention it in the description.

If you're adding a new blockchain

  • I have read the guidelines for adding a new blockchain.

Sorry, something went wrong.

Copy link
Collaborator

@satoshiotomakan satoshiotomakan left a comment

Choose a reason for hiding this comment

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

Thanks for the adding the feature to WalletCore!
Could you please take a look at one question below?

Comment on lines 47 to 49
uint32_t TransactionFactoryConfig::getExtraGasLimitForRelayedTransaction() const {
return this->minGasLimit;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't extraGasLimitForRelayedTransaction be returned here 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.

You are right, thank you 🙏

Thus, fixed getExtraGasLimitForRelayedTransaction and getExtraGasLimitForGuardedTransaction.

@satoshiotomakan satoshiotomakan merged commit df1843f into trustwallet:master Feb 3, 2025
12 checks passed
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.

None yet

2 participants