I have a solidity function :
struct PaperStuct {
uint256 id,
string url
}
mapping(uint256=>PaperStruct) public paperById;
function getPaper (
uint256 _tokenId
) public returns (PaperStruct[1] memory){
PaperStruct[1] memory paperGot;
paperGot[0] =paperById[_tokenId];
return paperGot;
}
so when I am calling it from the test file like so:
it('should get paper', async()=>{
await paper.getPaper(
1
);
const gotP = await paper.getPaper(1);
await console.log(gotP[0]);
})
I am getting an object like this:
{
tx: '0x..',
receipt: {
...
},
logs: []
}
I want to access the paperArray by it's id, but am unable to How can I get my Paper array?