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

Convert transaction method hashes to names w/ OpenChain API #338

Closed
MexicanAce opened this issue Dec 1, 2024 · 0 comments · Fixed by #339
Closed

Convert transaction method hashes to names w/ OpenChain API #338

MexicanAce opened this issue Dec 1, 2024 · 0 comments · Fixed by #339
Assignees
Labels
feature-request frontend Task requires changes to the frontend implementation

Comments

@MexicanAce
Copy link
Contributor

🌟 Feature Request

📝 Description

Currently, viewing transactions has mostly the transaction function selector hex value and not the human-readable function name.

🤔 Rationale

I propose that we make a request to the OpenChain API to attempt to convert these function selectors even if the contact is not verified, so that people can more easily see what's going on.

BEFORE

image

AFTER

image

📋 Additional Context

Here's a link to the OpenChain.xyz API docs: https://docs.openchain.xyz/#/default/get_signature_database_v1_search

The endpoint to use would be: https://api.openchain.xyz/signature-database/v1/lookup where you pass in a comma-delimited list of function selectors as follows:

https://api.openchain.xyz/signature-database/v1/lookup?function=0xb1dc65a4%2C0x782661bc%2C0xa9059cbb%2C0x3161b7f6&filter=true

Example response:

{
  "ok": true,
  "result": {
    "event": {},
    "function": {
      "0x3161b7f6": [
        {
          "name": "setPrice((uint32,(uint128,uint64,uint32))[])",
          "filtered": false
        }
      ],
      "0x782661bc": [
        {
          "name": "setPrices(address[],uint256[],uint256)",
          "filtered": false
        }
      ],
      "0xa9059cbb": [
        {
          "name": "transfer(address,uint256)",
          "filtered": false
        }
      ],
      "0xb1dc65a4": [
        {
          "name": "transmit(bytes32[3],bytes,bytes32[],bytes32[],bytes32)",
          "filtered": false
        }
      ]
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request frontend Task requires changes to the frontend implementation
Projects
None yet
2 participants