-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.js
36 lines (26 loc) · 991 Bytes
/
deploy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require('dotenv').config();
const HDWalletProvider = require('@truffle/hdwallet-provider');
const truffleContract = require('truffle-contract');
const nftArtifacts = require('./build/contracts/NFT.json');
const Web3 = require('web3');
const web3 = new Web3(new HDWalletProvider(
process.env.MNEMONIC,
`https://polygon-rpc.com/`
));
const Nft = truffleContract(nftArtifacts);
Nft.setProvider(web3.currentProvider);
const test = async () => {
const accounts = await web3.eth.getAccounts();
// change the arguments to this function to be the name of your NFT, and the token symbol respectively
const nft = await Nft.new('NFT', 'NFT', {from: accounts[0]});
console.log(nft.address)
// how to mint an NFT - add new lines and update the token id to mint more
await nft.mint(
1, // this is the token id
'QmSWm14gsoEExihXfkbQ55VwCc9VY3c71LeuTmNAr1v6jF/metadata.json',
{from: accounts[0]}
);
console.log('done');
process.exit();
}
test();