-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path6_deploy_contract.js
34 lines (30 loc) · 987 Bytes
/
6_deploy_contract.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
// Import the libraries and load the environment variables.
const { SDK, Auth, TEMPLATES, Metadata } = require('@infura/sdk') ;
require('dotenv').config()
// Create Auth object
const auth = new Auth({
projectId: process.env.INFURA_API_KEY,
secretId: process.env.INFURA_API_KEY_SECRET,
privateKey: process.env.WALLET_PRIVATE_KEY,
privateKey: process.env.WALLET_PRIVATE_KEY,
rpcUrl: process.env.RPC_URL,
chainId: 11155111,
});
// Instantiate SDK
const sdk = new SDK(auth);
async function deployContract() {
try {
const newContract = await sdk.deploy({
template: TEMPLATES.ERC721Mintable,
params: {
name: 'Airplanes',
symbol: 'JET',
contractURI: 'https://gateway.pinata.cloud/ipfs/Qmbta8RRbdXjyvXwkuqmbsXkZ8ZRoMezNsP7g6n9Db1Mx1'
},
});
console.log('contract address: \n', newContract.contractAddress);
} catch (error) {
console.error('An error occurred:', error);
}
}
deployContract();