Iโm getting this error.
POST https://speedy-nodes-nyc.moralis.io/2b1......85/avalanche/testnet 401
s.send @ index.js:106
u.send @ index.js:161
s @ index.js:624
(anonymous) @ index.js:647
Promise.then (async)
n @ index.js:633
y._executeMethod @ index.js:882
(anonymous) @ web3-connector-moralis.js:291
dispatch @ jquery.min.js?ver=3.6.0:2
v.handle @ jquery.min.js?ver=3.6.0:2
web3-connector-moralis.js:302 Error: Invalid JSON RPC response: "Unauthorized"
at Object.InvalidResponse (errors.js:43:16)
at XMLHttpRequest.i.onreadystatechange (index.js:95:32)
I havenโt been using this node for like more than a week. Below is my code. Iโ m trying to write to my smart contract.
const account = web3.eth.accounts;
//Get the current MetaMask selected/active wallet
const walletAddress = account.givenProvider.selectedAddress;
smartContract.methods.createToken(tokenUriValue).send(
{
from: walletAddress,
gasLimit: 4700000,
// if payable, specify value
// value: web3js.toWei(value, 'ether')
},
function (err, transactionHash) {
if (!err) {
console.log("Transaction hash: " + transaction.hash);
} else {
console.log(err);
}
}
);