I have written a smart contract and deployed to ropsten testnet but I can only interact with one function
see my smart contract functions
CreatePost Function
function createPost(string memory ipfsHash, string memory text) public{
address user = msg.sender;
Post memory newPost = Post(nextPostId, ipfsHash,text,user);
posts.push(newPost);
nextPostId += 1;
emit PostCreated(nextPostId -1, ipfsHash, text, user);
}
GetPosts Function
function getPosts() public view returns(Post[] memory){
return posts;
}
When I interact with CreatePost Works I pass parameters
front-end code to interact with create post function
async function post(){
const options = {
abi: myABI,
contractAddress:'0xAbEd40f031918D090c11a3ac4Bee9af76fB35cD4',
functionName: "createPost",
params: {
ipfsHash: myIpfs,
text: textComment,
userName: account,
},
}
await contractProcessor.fetch({
params: options
})
}
Bu when I interact with getPosts function nothing happen
no error no success no metamask popup
front-end code to interact with getPosts function
async function getNewPosts(){
let options = {
abi : myABI,
contractAddress:'0xAbEd40f031918D090c11a3ac4Bee9af76fB35cD4',
functionName: "getPosts",
}
await contractProcessor.fetch({
params: options
})
}
I did not include the parameter because it is a view function