-
-
Save stonegao/42e7123e29d9700cad42411f24c7761d to your computer and use it in GitHub Desktop.
check-settlement.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
1. Run `npm init` in a new folder | |
2. Install ethers.js with `npm i ethers` | |
3. Create a file called `check-settlement.js` | |
4. Copy the script below and save it in the file you create | |
5. In your terminal, run `node check-settlement.js` | |
*/ | |
require("dotenv").config(); | |
const ethers = require("ethers"); | |
const axios = require('axios').default; | |
const provider = new ethers.providers.JsonRpcProvider(`https://eth-mainnet.alchemyapi.io/v2/${process.env.NEXT_PUBLIC_ALCHEMY_API_KEY}`); | |
const settlements = new ethers.Contract( | |
"0xdEcC60000ba66700a009b8F9F7D82676B5cfA88A", | |
// need the contract abi | |
provider | |
); | |
let wallet; | |
let nonce; | |
async function checkSettlementOwner(tokenId) { | |
const settlementsConnected = settlements.connect(wallet); | |
let result = await settlementsConnected.ownerOf(tokenId); | |
console.log(result); | |
} | |
(async () => { | |
wallet = ethers.Wallet.createRandom().connect(provider); | |
nonce = await provider.getTransactionCount(wallet.address); | |
for(let i = 1; i < 9901; i++) { // max is 7777; set to 7778 | |
try { | |
await checkSettlementOwner(ethers.utils.hexlify(i)); | |
} catch (error) { | |
console.error(error); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment