Skip to content

Conversation

@PeterChen13579
Copy link
Collaborator

@PeterChen13579 PeterChen13579 commented Dec 1, 2025

This PR adds the ability to filter account_tx results based on transaction delegation. This is useful for scenarios where one account (the delegatee) signs and submits a transaction on behalf of another account (the delegator).

New Request Parameter:

"delegate": {
     "delegate_filter": "delegatee" or "delegator",
     "counter_party": "account_address" 
}

Example: If User A submits a transaction to C on behalf of B:
User B (The account holder) can query with delegate_filter: "delegatee" to find transactions signed by others (like User A).
User A (The signer) can query with delegate_filter: "delegator" to find transactions they signed for others (like User B).
The counter_party field can be used in either case to filter by a specific valid address

@PeterChen13579 PeterChen13579 changed the title feat: add delegate filter param's to account_tx RPC feat: Add delegate filter param's to account_tx RPC Dec 1, 2025
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 95.06173% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.92%. Comparing base (2327e81) to head (eb83ca3).

Files with missing lines Patch % Lines
src/rpc/handlers/AccountTx.cpp 87.50% 1 Missing and 1 partial ⚠️
src/rpc/common/Validators.cpp 93.33% 0 Missing and 1 partial ⚠️
...rc/rpc/filters/impl/DelegateTransactionsFilter.cpp 95.45% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2827      +/-   ##
===========================================
+ Coverage    81.84%   81.92%   +0.07%     
===========================================
  Files          381      383       +2     
  Lines        14423    14504      +81     
  Branches      7933     7978      +45     
===========================================
+ Hits         11805    11882      +77     
- Misses        1447     1448       +1     
- Partials      1171     1174       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

if (delegateFilter.has_value()) {
resultTxns.reserve(txns.size());

for (auto& txn : txns) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like a good place to try and use ranges? 🙂


auto const& type = delegateType.as_string();

if (type == "delegator")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Magic strings everywhere 😃 these should either be JS(...) if possible or some sort of constants 🔢

* @brief A delegate type used in delegate filter
*/
enum class Role {
// This account is the *active* sender, acting on behalf of another party.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could be part of doxygen, perhaps with a trailing comment style

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.

2 participants