Ethereum: How to check if transaction belongs to Uniswap using etherscan api?
Checking uniswap transactions with Etherscan API
As a Developer, IT is Essential to Prove the Credibility and Legitimacy of Transactions on the Ethereum Blockchain. One of these usage cases is to check that a particular transaction belongs to the uniswap replacement.
In this article, we show how to use etherscan api to filter out uniswap transactions to a particular address.
Prerequisites
- You have an account on etherscan and have access to api.
- The address you want to check is related to a uniswap account.
STEP 1: SET THE ETHERSCAN API Request

To use Etherscan API:
- Create a New API Request by clicking on “Settings” (Gear Icon) and Selecting “API -K”.
- Complete The Necessary Information:
* Name : Enter the API’s request unique name.
* Description : Letterly Describe What this API is Doing.
* Endpoint : Enter the Etherscan API Endpoint for the requested data that https: //api.etherscan.io/api? Module = account and action = tokens & address = 0x534A0076FB7C2B1F83FA21497429AD3BD7587.
* Filters : Set the filter to unniswap".
Step 2: Enter the Etherscan API Request code
Here's an Example of how to send an api request using javascript using the "fetch" api:
JavaScript
ASYNC Function Checkuniswaptransactions (Title) {
Const url = ' + Address;
Try {
Constille = Waiting for Fetch (URL);
if (! response.ok) {
Throw a New Error (Troubleshooting Transactions: $ {responsse.statural});
}
Consta data = Waiting for response.json ();
console.log (data);
} Catch (Error) {
Console.error (error.message);
}
}
Step 3: Send the API Request and Analyze the Answer
Replace “Checkuniswapp transections” with your own function:
`JavaScript
Checkuniswap transactions ('0x534A0076FB7C2B1F83FA21497429AD7AD3BD7587')
.Then ((transactions) => {{{
console.log (transactions);
})
.catch ((error) => {{{
Console.error (error.message);
});
Example output
API Returns an object with transaction data. For Example:
`Json
{{{
"Status": 1,
"Result": [
{{{
"From": "0x534A0076FB7C2B1F83FA21497429AD7AD7AD7AD7587",
"To": "0x1234567890abcdef",
"Value": 10000000,
"Gas": 2000000,
"GASPRICE": 20000
}
]
}
In this example, The Transactions are denoted “status” Equal to 1, Indicating Success. You can be the obtained data to filter and verify the authenticity of these transactions.
Tips and variations
- Change the API URL Accordingly to Filter the Specificated Device Types (Such as tokens or funds).
- You can add additional filters or parameters to Further Refine the search results.
- If you need to get a list of all transactions in a particular address, use the “geacount” endpoint.
By following thesis steps and experimenting with different approaches, you must be able to successful filter out uniswap transactions with ethers scan API.
Leave a Comment