-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
155 lines (151 loc) · 6.02 KB
/
index.html
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<html>
<head>
<title>Add Million Token to MetaMask</title>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
img#logo {
height: 56px;
}
.b-example-divider {
height: 3rem;
background-color: rgba(0, 0, 0, .1);
border: solid rgba(0, 0, 0, .15);
border-width: 1px 0;
box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
}
@media (min-width: 992px) {
.rounded-lg-3 {
border-radius: .3rem;
}
}
</style>
<script>
async function addToken(tokenAddress) {
const tokenSymbol = 'MM';
const tokenDecimals = 18;
const tokenImage = 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/million.svg';
//Select / Change to desired chain -- unfortunately this is buggy in Firefox
/*
window.ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: chainId }] //Chain Id in hexadecimal
});
*/
// Add Token
try {
// wasAdded is a boolean. Like any RPC method, an error may be thrown.
const wasAdded = await ethereum.request({
method: 'wallet_watchAsset',
params: {
type: 'ERC20', // Initially only supports ERC20, but eventually more!
options: {
address: tokenAddress, // The address that the token is at.
symbol: tokenSymbol, // A ticker symbol or shorthand, up to 5 chars.
decimals: tokenDecimals, // The number of decimals in the token
image: tokenImage, // A string url of the token logo
},
},
});
if (wasAdded) {
console.log('Success!');
} else {
console.log('Rejected!');
}
} catch (error) {
console.log(error);
}
}
async function addPolygonNetwork() {
window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [{
chainId: '0x89',
chainName: 'Polygon MATIC',
nativeCurrency: {
name: 'MATIC',
symbol: 'MATIC',
decimals: 18
},
rpcUrls: ['https://polygon-rpc.com/'],
blockExplorerUrls: ['https://polygonscan.com/']
}]
});
}
window.addEventListener('load', async () => {
document.querySelector("#btn-addtokenEth").addEventListener("click", async () => {
addToken("0x6b4c7a5e3f0b99fcd83e9c089bddd6c7fce5c611");
});
document.querySelector("#btn-addtokenBSC").addEventListener("click", async () => {
addToken("0xbf05279f9bf1ce69bbfed670813b7e431142afa4");
});
document.querySelector("#btn-addtokenPolygon").addEventListener("click", async () => {
addToken("0x5647Fe4281F8F6F01E84BCE775AD4b828A7b8927");
});
document.querySelector("#btn-polygonnetwork").addEventListener("click", addPolygonNetwork);
});
</script>
</head>
<body>
<div class="px-4 py-5 my-5 text-center">
<img src="https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/million.svg" id="logo" />
<h1 class="display-5 fw-bold">Add Million Token to Metamask!</h1>
<div class="col-lg-6 mx-auto">
<p class="lead mb-4">Open Metamask, select the desired network and click in one of the buttons bellow to add it.</p>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
<button class="btn btn-primary" id="btn-addtokenEth"> Select Ethereum Wallet in Metamask and click on here to add MM to it </button>
</div>
<br />
<div>
<button class="btn btn-primary" id="btn-addtokenBSC"> Select Binance Smart Chain Wallet in Metamask and click on here to add MM to it </button>
</div>
<br />
<div>
<button class="btn btn-primary" id="btn-addtokenPolygon"> Select Polygon Matic Wallet in Metamask and click on here to add MM to it </button>
</div>
</div>
</div>
<div class="px-4 py-5 my-5 text-center">
<h1 class="display-5 fw-bold">Add Polygon MATIC Network to Metamask!</h1>
<div class="col-lg-6 mx-auto">
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
<button class="btn btn-primary" id="btn-polygonnetwork"> Just click here to add it! :) </button>
</div>
<div>
<p>This adds with the current recommended RPC, but MetaMask may say otherwise, this is being discussed at <a href="https://github.com/antonnell/networklist-org/issues/24">github.com/antonnell/networklist-org/issues/24</a>
</p>
</div>
</div>
</div>
<div class="px-4 py-5 my-5 text-center">
<div class="col-lg-6 mx-auto">
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
<p>We also have signature tools, <a href="sign.html">check it out here.</a>
</p>
</div>
</div>
</div>
<div class="px-4 py-5 my-5 text-center">
<div class="col-lg-6 mx-auto">
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
<p>To find out more, go to the official website at <a href="https://www.milliontoken.org/">milliontoken.org</a>
</p>
</div>
</div>
</div>
</body>
</html>