Querying the Chainstack Covalent SDK to return a list of contracts deployed by a specified address.
Overview
Environment setup
npm install web3
Additionally, install the Chainstack Covalent SDK:
npm install chainstack-covalent-sdk
Get your Chainstack API key and endpoint
ChainstackApi
constructor.Remember you will need to purchase the Chainstack-Covalent integration from the Chainstack Marketplace.
web3
.Initializing the parameters
chainName
and walletAddress
.chainName
should be formatted as ‘chain-network’, with chain referring to the name of the blockchain in question, and network referring to the mainnet, testnet, etc. For example, ‘eth-sepolia’, or ‘base-mainnet’walletAddress
should be defined as a string containing the address of the wallet you’d like to query the contract deployments of.Creating the handler function
getTransactionReceipt
request on the provided transaction hash.Calling the method and printing the response
main()
function. This function will contain the fetchContractDeploymentTransactions
call to the Chainstack Covalent SDK. Within this call, we’ll pass in the parameters defined earlier.This will result in a response containing a list of relevant transactions, in which we’ll then parse through in the for
loop. For each transaction, we’ll run it through the handler, getContractDeploymentDetails
, then print out the hash & contract address.Understanding the response
tx
”, then “Contract Address: address
”.The transaction hash will directly point to the transaction in which the contract was deployed, and the contract address refers to the address of the deployed contract itself.Due to the computationally intensive nature of this method, responses may take a few seconds.