|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<meta charset="utf-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|
<title>Connect to Proxy</title> |
|
|
|
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> |
|
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script> |
|
</head> |
|
<body> |
|
<div class="container mt-5"> |
|
<div class="row"> |
|
<div class="col-6 offset-3"> |
|
<div id="beforeconnect"> |
|
<button class="btn btn-primary mt-3" id="connect">connect</button> |
|
</div> |
|
<div id="afterconnect"> |
|
<div> |
|
<button class="btn btn-primary mt-3" id="mint">mint</button> |
|
</div> |
|
|
|
<div> |
|
<button class="btn btn-primary mt-3" id="current">Get Current Value</button> |
|
<h3>Current Value: <span id="currentVal"></span></h3> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<script type="text/javascript"> |
|
document.getElementById('afterconnect').hidden = true |
|
var account = null; |
|
var contract = null; |
|
const connect = async () => { |
|
if (window.ethereum) { |
|
await window.ethereum.send('eth_requestAccounts'); |
|
window.web3 = new Web3(window.ethereum); |
|
|
|
var accounts = await web3.eth.getAccounts(); |
|
account = accounts[0]; |
|
contract = new web3.eth.Contract(ABI, ADDRESS); |
|
|
|
document.getElementById('beforeconnect').hidden = true |
|
document.getElementById('afterconnect').hidden = false |
|
|
|
document.getElementById('current').onclick = current; |
|
document.getElementById('mint').onclick = mint; |
|
|
|
await current() |
|
} else { |
|
alert('Metamask not detected') |
|
} |
|
} |
|
|
|
const mint = async () => { |
|
if (contract) { |
|
await contract.methods.safeMint(account).send({ from: account }); |
|
await current() |
|
} |
|
} |
|
|
|
const current = async () => { |
|
if (contract) { |
|
var count = await contract.methods.count().call() |
|
document.getElementById('currentVal').innerHTML = count; |
|
} |
|
} |
|
|
|
document.getElementById('connect').onclick = connect; |
|
|
|
var ADDRESS = '0x5FC8d32690cc91D4c39d9d3abcBD16989F875707' |
|
|
|
var ABI = [ |
|
{ |
|
"inputs": [], |
|
"stateMutability": "nonpayable", |
|
"type": "constructor" |
|
}, |
|
{ |
|
"anonymous": false, |
|
"inputs": [ |
|
{ |
|
"indexed": false, |
|
"internalType": "address", |
|
"name": "previousAdmin", |
|
"type": "address" |
|
}, |
|
{ |
|
"indexed": false, |
|
"internalType": "address", |
|
"name": "newAdmin", |
|
"type": "address" |
|
} |
|
], |
|
"name": "AdminChanged", |
|
"type": "event" |
|
}, |
|
{ |
|
"anonymous": false, |
|
"inputs": [ |
|
{ |
|
"indexed": true, |
|
"internalType": "address", |
|
"name": "owner", |
|
"type": "address" |
|
}, |
|
{ |
|
"indexed": true, |
|
"internalType": "address", |
|
"name": "approved", |
|
"type": "address" |
|
}, |
|
{ |
|
"indexed": true, |
|
"internalType": "uint256", |
|
"name": "tokenId", |
|
"type": "uint256" |
|
} |
|
], |
|
"name": "Approval", |
|
"type": "event" |
|
}, |
|
{ |
|
"anonymous": false, |
|
"inputs": [ |
|
{ |
|
"indexed": true, |
|
"internalType": "address", |
|
"name": "owner", |
|
"type": "address" |
|
}, |
|
{ |
|
"indexed": true, |
|
"internalType": "address", |
|
"name": "operator", |
|
"type": "address" |
|
}, |
|
{ |
|
"indexed": false, |
|
"internalType": "bool", |
|
"name": "approved", |
|
"type": "bool" |
|
} |
|
], |
|
"name": "ApprovalForAll", |
|
"type": "event" |
|
}, |
|
{ |
|
"anonymous": false, |
|
"inputs": [ |
|
{ |
|
"indexed": true, |
|
"internalType": "address", |
|
"name": "beacon", |
|
"type": "address" |
|
} |
|
], |
|
"name": "BeaconUpgraded", |
|
"type": "event" |
|
}, |
|
{ |
|
"anonymous": false, |
|
"inputs": [ |
|
{ |
|
"indexed": false, |
|
"internalType": "uint8", |
|
"name": "version", |
|
"type": "uint8" |
|
} |
|
], |
|
"name": "Initialized", |
|
"type": "event" |
|
}, |
|
{ |
|
"anonymous": false, |
|
"inputs": [ |
|
{ |
|
"indexed": true, |
|
"internalType": "address", |
|
"name": "previousOwner", |
|
"type": "address" |
|
}, |
|
{ |
|
"indexed": true, |
|
"internalType": "address", |
|
"name": "newOwner", |
|
"type": "address" |
|
} |
|
], |
|
"name": "OwnershipTransferred", |
|
"type": "event" |
|
}, |
|
{ |
|
"anonymous": false, |
|
"inputs": [ |
|
{ |
|
"indexed": true, |
|
"internalType": "address", |
|
"name": "from", |
|
"type": "address" |
|
}, |
|
{ |
|
"indexed": true, |
|
"internalType": "address", |
|
"name": "to", |
|
"type": "address" |
|
}, |
|
{ |
|
"indexed": true, |
|
"internalType": "uint256", |
|
"name": "tokenId", |
|
"type": "uint256" |
|
} |
|
], |
|
"name": "Transfer", |
|
"type": "event" |
|
}, |
|
{ |
|
"anonymous": false, |
|
"inputs": [ |
|
{ |
|
"indexed": true, |
|
"internalType": "address", |
|
"name": "implementation", |
|
"type": "address" |
|
} |
|
], |
|
"name": "Upgraded", |
|
"type": "event" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "to", |
|
"type": "address" |
|
}, |
|
{ |
|
"internalType": "uint256", |
|
"name": "tokenId", |
|
"type": "uint256" |
|
} |
|
], |
|
"name": "approve", |
|
"outputs": [], |
|
"stateMutability": "nonpayable", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "owner", |
|
"type": "address" |
|
} |
|
], |
|
"name": "balanceOf", |
|
"outputs": [ |
|
{ |
|
"internalType": "uint256", |
|
"name": "", |
|
"type": "uint256" |
|
} |
|
], |
|
"stateMutability": "view", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [], |
|
"name": "count", |
|
"outputs": [ |
|
{ |
|
"internalType": "uint256", |
|
"name": "", |
|
"type": "uint256" |
|
} |
|
], |
|
"stateMutability": "view", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "uint256", |
|
"name": "tokenId", |
|
"type": "uint256" |
|
} |
|
], |
|
"name": "getApproved", |
|
"outputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "", |
|
"type": "address" |
|
} |
|
], |
|
"stateMutability": "view", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [], |
|
"name": "initialize", |
|
"outputs": [], |
|
"stateMutability": "nonpayable", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "owner", |
|
"type": "address" |
|
}, |
|
{ |
|
"internalType": "address", |
|
"name": "operator", |
|
"type": "address" |
|
} |
|
], |
|
"name": "isApprovedForAll", |
|
"outputs": [ |
|
{ |
|
"internalType": "bool", |
|
"name": "", |
|
"type": "bool" |
|
} |
|
], |
|
"stateMutability": "view", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [], |
|
"name": "name", |
|
"outputs": [ |
|
{ |
|
"internalType": "string", |
|
"name": "", |
|
"type": "string" |
|
} |
|
], |
|
"stateMutability": "view", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [], |
|
"name": "owner", |
|
"outputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "", |
|
"type": "address" |
|
} |
|
], |
|
"stateMutability": "view", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "uint256", |
|
"name": "tokenId", |
|
"type": "uint256" |
|
} |
|
], |
|
"name": "ownerOf", |
|
"outputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "", |
|
"type": "address" |
|
} |
|
], |
|
"stateMutability": "view", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [], |
|
"name": "proxiableUUID", |
|
"outputs": [ |
|
{ |
|
"internalType": "bytes32", |
|
"name": "", |
|
"type": "bytes32" |
|
} |
|
], |
|
"stateMutability": "view", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [], |
|
"name": "renounceOwnership", |
|
"outputs": [], |
|
"stateMutability": "nonpayable", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "to", |
|
"type": "address" |
|
} |
|
], |
|
"name": "safeMint", |
|
"outputs": [], |
|
"stateMutability": "nonpayable", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "from", |
|
"type": "address" |
|
}, |
|
{ |
|
"internalType": "address", |
|
"name": "to", |
|
"type": "address" |
|
}, |
|
{ |
|
"internalType": "uint256", |
|
"name": "tokenId", |
|
"type": "uint256" |
|
} |
|
], |
|
"name": "safeTransferFrom", |
|
"outputs": [], |
|
"stateMutability": "nonpayable", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "from", |
|
"type": "address" |
|
}, |
|
{ |
|
"internalType": "address", |
|
"name": "to", |
|
"type": "address" |
|
}, |
|
{ |
|
"internalType": "uint256", |
|
"name": "tokenId", |
|
"type": "uint256" |
|
}, |
|
{ |
|
"internalType": "bytes", |
|
"name": "_data", |
|
"type": "bytes" |
|
} |
|
], |
|
"name": "safeTransferFrom", |
|
"outputs": [], |
|
"stateMutability": "nonpayable", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "operator", |
|
"type": "address" |
|
}, |
|
{ |
|
"internalType": "bool", |
|
"name": "approved", |
|
"type": "bool" |
|
} |
|
], |
|
"name": "setApprovalForAll", |
|
"outputs": [], |
|
"stateMutability": "nonpayable", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "bytes4", |
|
"name": "interfaceId", |
|
"type": "bytes4" |
|
} |
|
], |
|
"name": "supportsInterface", |
|
"outputs": [ |
|
{ |
|
"internalType": "bool", |
|
"name": "", |
|
"type": "bool" |
|
} |
|
], |
|
"stateMutability": "view", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [], |
|
"name": "symbol", |
|
"outputs": [ |
|
{ |
|
"internalType": "string", |
|
"name": "", |
|
"type": "string" |
|
} |
|
], |
|
"stateMutability": "view", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "uint256", |
|
"name": "tokenId", |
|
"type": "uint256" |
|
} |
|
], |
|
"name": "tokenURI", |
|
"outputs": [ |
|
{ |
|
"internalType": "string", |
|
"name": "", |
|
"type": "string" |
|
} |
|
], |
|
"stateMutability": "view", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "from", |
|
"type": "address" |
|
}, |
|
{ |
|
"internalType": "address", |
|
"name": "to", |
|
"type": "address" |
|
}, |
|
{ |
|
"internalType": "uint256", |
|
"name": "tokenId", |
|
"type": "uint256" |
|
} |
|
], |
|
"name": "transferFrom", |
|
"outputs": [], |
|
"stateMutability": "nonpayable", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "newOwner", |
|
"type": "address" |
|
} |
|
], |
|
"name": "transferOwnership", |
|
"outputs": [], |
|
"stateMutability": "nonpayable", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "newImplementation", |
|
"type": "address" |
|
} |
|
], |
|
"name": "upgradeTo", |
|
"outputs": [], |
|
"stateMutability": "nonpayable", |
|
"type": "function" |
|
}, |
|
{ |
|
"inputs": [ |
|
{ |
|
"internalType": "address", |
|
"name": "newImplementation", |
|
"type": "address" |
|
}, |
|
{ |
|
"internalType": "bytes", |
|
"name": "data", |
|
"type": "bytes" |
|
} |
|
], |
|
"name": "upgradeToAndCall", |
|
"outputs": [], |
|
"stateMutability": "payable", |
|
"type": "function" |
|
} |
|
] |
|
</script> |
|
<style type="text/css"> |
|
|
|
</style> |
|
</body> |
|
</html> |