Skip to content

Instantly share code, notes, and snippets.

View 0xtp's full-sized avatar
:octocat:
Devs can do something!

Taraka Prabhu 0xtp

:octocat:
Devs can do something!
View GitHub Profile
@CoolCatsNFTPublic
CoolCatsNFTPublic / estimatingGas.js
Last active December 30, 2021 20:50
Estimating gas for a transaction
// Get the estimated gas from the adopt method
try {
methodGasPrice = await this.contract.methods.adopt(adoptNum).estimateGas({
value: price,
from: account
});
} catch (err) {
console.log("ERROR Method Gas Price");
}
@CoolCatsNFTPublic
CoolCatsNFTPublic / snapShop.js
Created July 25, 2021 17:15
Snapshotting Opensea collections
async function snapShot(slug, address, totalTokens) {
const API_KEY = ""
// Step 1 - Pagination
const pages = Math.ceil(totalTokens / 50); // Paginate to account for OpenSea api call limits.
let offSet = 0;
let num = 0;
let totalOwned = 0;
let foundTokens = 0;
@CoolCatsNFTPublic
CoolCatsNFTPublic / getAllHolders.js
Last active July 27, 2021 09:35
Get all Cool Cat holders
// THE GIST CONTAINS A DELIBERATE ERROR FOR THE PURPOSES
// OF THE ARTICLE - DO NOT BLINDLY COPY AND PASTE
async getAllHolders() {
// Step 1 - Get the total population
const totalSupply = await this.contract.methods.totalSupply().call();
// Step 2 - Iterate over live tokens and log owners
const holder = {};
for(let i = 0; i < totalSupply; i++){