.config
index.js
Packager files
package-lock.json
package.json
Config files
.replit
replit.nix
// Imports the Alchemy SDK
const { Alchemy, Network } = require("alchemy-sdk");
// Configures the Alchemy SDK
const config = {
apiKey: "demo", // Replace with your API key
network: Network.ETH_MAINNET, // Replace with your network
};
// Creates an Alchemy object instance with the config to use for making requests
const alchemy = new Alchemy(config);
// Example of using the new getTransfersForContract method
const main = async () => {
// The nft contract address to get transfers for
let contractAddress = "0x1F02bF9dDe7C79137a08B2Dd4FC964BfD2499734";
// Additional options for the request. (Optional)
let options = {
/** Starting block (inclusive) to get transfers from. */
fromBlock: 16564734,
/** Ending block (inclusive) to get transfers from. */
toBlock: 16567427,
/**
* Whether to return results in ascending or descending order by block number.
* Defaults to ascending if omitted.
*/
order: "desc",
};
// Calling the getTransfersForContract method
let transfers = await alchemy.nft.getTransfersForContract(
contractAddress,
options
);
// Logging the response to the console
console.log(transfers);
};
main();