Skip to content

feat: show transactions from and to intelligent contracts#1010

Closed
Henadek wants to merge 4 commits intomainfrom
feat/show-transactions-from-and-to-intelligent-contracts-#988
Closed

feat: show transactions from and to intelligent contracts#1010
Henadek wants to merge 4 commits intomainfrom
feat/show-transactions-from-and-to-intelligent-contracts-#988

Conversation

@Henadek
Copy link
Copy Markdown
Contributor

@Henadek Henadek commented Mar 19, 2025

Fixes #988

What

  • show transactions made to external contracts
  • show transactions made by external contracts

Why

  • to give visibility to the user to see what transactions are made to other contracts

Testing done

  • tested the rpc endpoint to ensure related contract data is available

Decisions made

  • made a rpc endpoint to send a contract address to fetch the related transactions made from that contract

Checks

  • I have tested this code
  • I have reviewed my own PR
  • I have created an issue for this PR
  • I have set a descriptive PR title compliant with conventional commits

Reviewing tips

User facing release notes

  • added transactions made to and from external contracts

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 19, 2025

Codecov Report

Attention: Patch coverage is 0% with 47 lines in your changes missing coverage. Please review.

Project coverage is 16.73%. Comparing base (c883a78) to head (35f4f09).

Files with missing lines Patch % Lines
...tend/src/components/Simulator/TransactionsList.vue 0.00% 47 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1010      +/-   ##
==========================================
- Coverage   16.80%   16.73%   -0.08%     
==========================================
  Files         127      127              
  Lines       10119    10164      +45     
  Branches      253      253              
==========================================
  Hits         1701     1701              
- Misses       8333     8378      +45     
  Partials       85       85              

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@Henadek Henadek self-assigned this Mar 19, 2025
tx_processor = TransactionsProcessor(request_session)
multi_contract_trigger = []
for tx in current_contract:
tx_data = tx_processor.get_transaction_by_hash(tx.hash)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is this needed? tx is already the tx_data.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

resolved

.filter(
Transactions.type == TransactionType.RUN_CONTRACT,
Transactions.to_address == address,
Transactions.from_address.in_(contract_addresses),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need this check? Can't you write from_address or to_address == address?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we probably do not need the transactiontype check, that can be taken out, I think it helps readability when it is explicit

if (!contractAddress) return;

try {
const response = await rpcClient.call({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the RPC call should be moved to a dedicated service layer.

.filter(
Transactions.type == TransactionType.RUN_CONTRACT,
Transactions.to_address == address,
Transactions.from_address.in_(contract_addresses),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the terminal I see this warning. Can you solve this?

/app/backend/protocol_rpc/endpoints.py:747: SAWarning: Coercing Subquery object into a select() for use in IN(); please pass a select() construct explicitly
Transactions.from_address.in_(contract_addresses),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

resolved

},
(newAddress) => {
if (newAddress) {
fetchRelatedTransactions(newAddress);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see the related transactions in the transactions list when I switch to another contract and back. Is this expected? I thought it would show it without pressing on another gpy file.

@Henadek Henadek requested review from cristiam86 and removed request for cristiam86 April 3, 2025 12:53
}


def get_transactions_by_related_contract(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Henadek this method includes too many things that are not the responsibility of the endpoints layer. Here, we should only do validations and calls to the other services and processors.

@cristiam86 cristiam86 closed this Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: show transactions from and to intelligent contracts

3 participants