|
|
@ -10,7 +10,7 @@ const web3 = createAlchemyWeb3(API_URL); |
|
|
|
import contractABI from './MoonbirdPunks.json' assert { type: 'json' } |
|
|
|
// console.log(JSON.stringify(contract.abi));
|
|
|
|
|
|
|
|
const contractAddress = "0x7d82a88Efb60Bb83B3f1665757c20D07E5C0f3ED"; |
|
|
|
const contractAddress = "0x90Bc839511e1a8b32e2ba27f37c7632D12E872B6"; |
|
|
|
const nftContract = new web3.eth.Contract(contractABI.abi, contractAddress); |
|
|
|
|
|
|
|
async function mintOwnerNFT() { |
|
|
@ -35,6 +35,29 @@ async function mintOwnerNFT() { |
|
|
|
console.log(`Transaction receipt: ${JSON.stringify(transactionReceipt)}`); |
|
|
|
} |
|
|
|
|
|
|
|
async function mintPunk() { |
|
|
|
const nonce = await web3.eth.getTransactionCount(process.env.PUBLIC_KEY, 'latest'); //get latest nonce
|
|
|
|
|
|
|
|
//the transaction
|
|
|
|
const tx = { |
|
|
|
'from': process.env.PUBLIC_KEY, |
|
|
|
'to': contractAddress, |
|
|
|
'value': .001 * Math.pow(10, 18) * 2, |
|
|
|
'nonce': nonce, |
|
|
|
'gas': 150000, |
|
|
|
'maxFeePerGasGwei': 40, |
|
|
|
// 'maxPriorityFeePerGas': 1000000000,
|
|
|
|
'maxPriorityFeePerGasGwei': 1, |
|
|
|
'data': nftContract.methods.mintPunk(2).encodeABI() |
|
|
|
}; |
|
|
|
|
|
|
|
const signedTx = await web3.eth.accounts.signTransaction(tx, process.env.PRIVATE_KEY); |
|
|
|
console.log("Minting punk...") |
|
|
|
const transactionReceipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction); |
|
|
|
|
|
|
|
console.log(`Transaction receipt: ${JSON.stringify(transactionReceipt)}`); |
|
|
|
} |
|
|
|
|
|
|
|
// const fs = require('fs')
|
|
|
|
// const base64 = require('base-64');
|
|
|
|
|
|
|
@ -47,4 +70,5 @@ async function mintOwnerNFT() { |
|
|
|
// // mintNFT("data:application/json;base64," + base64.encode(data))
|
|
|
|
// })
|
|
|
|
|
|
|
|
mintOwnerNFT() |
|
|
|
// mintOwnerNFT()
|
|
|
|
mintPunk() |