I have deployed my ERC721 contract to Rinkeby TestNet. The contract has been deployed successfully. I unable to invoke transactions with MetaMask. Spent the whole day looking to resolve this issue. Found some answers stating it the issue with localhosted files or the web3.js doesn't work with MetaMask.
<script>
if (typeof web3 != 'undefined') {
web3 = new Web3(web3.currentProvider) // what Metamask injected
console.log("existing web3: provider " + typeof web3);
} else {
// Instantiate and set Ganache as your provider
web3 = new Web3(new Web3.providers.HttpProvider("https://rinkeby.infura.io/v3/api-key"));
console.log("new provider " + web3);
web3.eth.defaultAccount = web3.eth.accounts[0]
}
// The interface definition for your smart contract (the ABI)
var StarNotary = web3.eth.contract(
[contract-abi]
)
const starNotary = StarNotary.at('0x7cfAD6E80D992599d989166aABf536b21215544C')
function claimStar() {
web3.eth.getAccounts(function(error, accounts) {
if (error) {
hotsnackbar(false, error);
return
}
Uncaught Error: invalid address at u (web3.min.js:1) at inputTransactionFormatter (web3.min.js:1) at web3.min.js:1 at Array.map () at i.formatInput (web3.min.js:1) at i.toPayload (web3.min.js:1) at _.e [as sendTransaction] (web3.min.js:1) at c.sendTransaction (web3.min.js:1) at index.html:589 at web3.min.js:1