mirror of
https://github.com/rjNemo/epicNFT
synced 2026-06-10 03:36:40 +00:00
mint NFT from client
This commit is contained in:
parent
e222193365
commit
25f0e40cc8
2 changed files with 396 additions and 2 deletions
|
|
@ -1,7 +1,8 @@
|
|||
import "./App.css";
|
||||
import {} from "ethers";
|
||||
import { providers, Contract } from "ethers";
|
||||
import { useEffect, useState } from "react";
|
||||
import { withEth } from "./lib/eth";
|
||||
import epicNFT from "./lib/epicNFT.json";
|
||||
|
||||
function App() {
|
||||
const [currentAccount, setCurrentAccount] = useState("");
|
||||
|
|
@ -20,7 +21,18 @@ function App() {
|
|||
setCurrentAccount(accounts[0]);
|
||||
});
|
||||
|
||||
const mintNFT = withEth(async (ethereum) => {});
|
||||
const mintNFT = withEth(async (ethereum) => {
|
||||
const contractAddress = process.env.REACT_APP_STAGING_CONTRACT_ADDRESS;
|
||||
const contractABI = epicNFT.abi;
|
||||
|
||||
const signer = new providers.Web3Provider(ethereum).getSigner();
|
||||
const contract = new Contract(contractAddress, contractABI, signer);
|
||||
|
||||
const txn = await contract.mint();
|
||||
console.log(`Mining ${txn.hash}…`);
|
||||
await txn.wait();
|
||||
console.log(`Minted. See transaction: https://rinkeby.etherscan.io/tx/${txn.hash}`);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
checkIfWalletConnected();
|
||||
|
|
|
|||
382
client/src/lib/epicNFT.json
Normal file
382
client/src/lib/epicNFT.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue