This is the error from metamask directly:
This is the error I get once after I submit the information to IPFS:
My Smart Contract:
pragma solidity 0.5.3;
//Imports for safe math operations
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol";
//Defining contract name lika class name
contract IPFSPosting{
using SafeMath for uint256;
//This struct is for the properties of a post
struct Post{
//Address of owner's Post
address owner;
//Hash of an image
string imgHash;
//Hash of a image caption
string textHash;
}
//A Mapping list post from Post struct.
mapping(uint256 => Post) post;
//A counter for the posts mapping list.
uint256 postCtr;
event NewPost();
//img and text hashes are sent to IPFS and stored
function sendHash(string memory _img, string memory _text)
public {
postCtr = postCtr.add(1);
Post storage posting = post[postCtr];
posting.owner = msg.sender;
posting.imgHash = _img;
posting.textHash = _text;
emit NewPost();
}
// Function that gets the img and text hashes
// _index number from total post iteration
// returns stored images and text hashes
function getHash(uint256 _index)
public view returns (string memory img, string memory text, address owner)
{
owner = post[_index].owner;
img = post[_index].imgHash;
text = post[_index].textHash;
}
//Gets the total length of total posts
// Returns the total count of post
function getCounter() public view returns(uint256){ return postCtr;}
}
Contract Instantiation
import web3 from './web3';
const address = "0xb8ce805b2f346ead5fa5ea1d9756b10ff46642b8";
const abi =[
{
"constant": false,
"inputs": [
{
"name": "_img",
"type": "string"
},
{
"name": "_text",
"type": "string"
}
],
"name": "sendHash",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_index",
"type": "uint256"
}
],
"name": "getHash",
"outputs": [
{
"name": "img",
"type": "string"
},
{
"name": "text",
"type": "string"
},
{
"name": "owner",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getCounter",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"anonymous": false,
"inputs": [],
"name": "NewPost",
"type": "event"
}
]
export default new web3.eth.Contract(abi, address);
I am using this tutorial as a guide for this smart contract. Mostly everything is similar. Github Guide
If there's anything else you need I can provide more code, but this seems where most of the trouble is being caused. If anyone could help me to figure out what's wrong that'll be great!