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
const hre = require("hardhat"); | |
async function main() { | |
try { | |
const Contract = await hre.ethers.getContractFactory("AvalancheNFTDrop"); | |
const contract = await Contract.attach( | |
"YOUR CONTRACT ADDRESS" // The deployed contract address | |
); | |
let overrides = { |
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
const hre = require("hardhat"); | |
const BASE_URI = "ipfs://YOUR_METADATA_FOLDER_CID"; | |
const TOKEN_NAME = "YOUR TOKEN NAME"; | |
const TOKEN_SYMBOL = "YOUR TOKEN SYMBOL"; | |
const PRICE = "500000000000000000" // 0.5 AVAX - use whatever price you want, but the denomiation is in WEI | |
async function main() { | |
try { | |
const Contract = await hre.ethers.getContractFactory("AvalancheNFTDrop"); | |
const contract = await Contract.deploy(BASE_URI, PRICE, TOKEN_NAME, TOKEN_SYMBOL); |
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
//SPDX-License-Identifier: Unlicense | |
pragma solidity ^0.8.0; | |
import "hardhat/console.sol"; | |
import "@openzeppelin/contracts/utils/Counters.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
import "@openzeppelin/contracts/utils/Strings.sol"; | |
contract AvalancheNFTDrop is ERC721Enumerable, Ownable { |
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
const findContent = await ky(`https://managed.mypinata.cloud/api/v1/content?cidContains=${cid}`, { | |
method: "GET", | |
headers: { | |
'x-api-key': API KEY | |
}, | |
}); | |
const results = await findContent.json(); | |
const item = results.items[0]; |
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
const { Readable } = require("stream"); | |
const FormData = require("form-data"); | |
const axios = require("axios"); | |
(async () => { | |
try { | |
const base64 = "BASE64 FILE STRING; | |
const imgBuffer = Buffer.from(base64, "base64"); | |
const stream = Readable.from(imgBuffer); |
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
const pinataSDK = require("@pinata/sdk"); | |
const pinata = pinataSDK( | |
"Pinata API Key", | |
"Pinata API Secret" | |
); | |
const { fs, vol } = require("memfs"); | |
(async () => { | |
try { | |
const base64 = "base64 file string"; |
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
const fs = require("fs"); | |
const FormData = require("form-data"); | |
const rfs = require("recursive-fs"); | |
const basePathConverter = require("base-path-converter"); | |
const got = require('got'); | |
const pinDirectoryToPinata = async () => { | |
const url = `https://api.pinata.cloud/pinning/pinFileToIPFS`; | |
const src = "RELATIVE PATH TO DIRECTORY TO UPLOAD"; | |
var status = 0; |
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
const editly = require('editly'); | |
const randomHex = require('random-hex'); | |
const short = require('short-uuid'); | |
const pathToFile = 'PATH TO FILE IN YOUR WORKING DIRECTORY'; | |
const totalSupply = 5000; | |
const run = async () => { | |
for(i = 0; i < totalSupply; i++) { | |
console.log("generating image: ", i); | |
const options = { |
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
const http = require('https'); | |
const fs = require('fs'); | |
const file = fs.createWriteStream("FILE_NAME"); | |
const request = http.get("GATEWAY_URL_FOR_FILE_IN_DIRECTORY", function(response) { | |
response.pipe(file); | |
}); |
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
<?php | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => 'https://manage.pinata.cloud/api/v1/content', | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => '', | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, |