-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathindex.html
More file actions
96 lines (92 loc) · 2.6 KB
/
index.html
File metadata and controls
96 lines (92 loc) · 2.6 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>BaseLegend Mint</title>
<script src="https://cdn.jsdelivr.net/npm/ethers@5.7.2/dist/ethers.umd.min.js"></script>
<style>
body {
font-family: sans-serif;
background-color: #f0f4ff;
text-align: center;
padding: 40px;
}
h1 {
color: #0052FF;
}
.card-container {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 40px;
margin-top: 40px;
}
.card {
background: white;
padding: 20px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
width: 250px;
}
.card img {
width: 100%;
border-radius: 12px;
}
button {
margin-top: 15px;
padding: 10px 16px;
background: #0052FF;
color: white;
border: none;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
}
</style>
</head>
<body>
<h1>🎮 Mint your BaseLegend NFT Cards</h1>
<p>Connect your wallet and mint one of the legendary on-chain cards below (0.0005 ETH each).</p>
<div class="card-container">
<div class="card">
<img src="images/pyron.png" alt="Pyron"/>
<button onclick="mintCard(1)">Mint Pyron</button>
</div>
<div class="card">
<img src="images/lightning-strike.png" alt="Lightning Strike"/>
<button onclick="mintCard(2)">Mint Lightning Strike</button>
</div>
<div class="card">
<img src="images/ancient-sword.png" alt="Ancient Sword"/>
<button onclick="mintCard(3)">Mint Ancient Sword</button>
</div>
</div>
<script>
const contractAddress = "0x440ae3c873dDa6120419dFa2F6Af6c097cbf1F4f";
const abi = [
"function mintNFT(uint256 tokenId) public payable returns (uint256)"
];
async function mintCard(tokenId) {
if (typeof window.ethereum === "undefined") {
alert("Please install MetaMask!");
return;
}
await ethereum.request({ method: 'eth_requestAccounts' });
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const contract = new ethers.Contract(contractAddress, abi, signer);
try {
const tx = await contract.mintNFT(tokenId, {
value: ethers.utils.parseEther("0.0005")
});
await tx.wait();
alert("Mint successful!");
} catch (error) {
console.error(error);
alert("Mint failed: " + (error?.message || "unknown error"));
}
}
</script>
</body>
</html>