here is my code:
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
mapping(uint => ProductWithBids) public internalProducts;
struct SecretBids {
uint values;
bool fake;
string secret;
}
struct ProductWithBids {
uint id;
string name;
uint price;
address payable owner;
address payable beneficiary;
bool purchased;
mapping(address => Bid[]) bids;
mapping(address => SecretBids[]) nakedBids;
// Allowed withdrawals of previous bids
mapping(address => uint) pendingReturns;
uint bidsCount;
bool ended;
uint biddingEnd;
uint revealEnd;
address highestBidder;
uint highestBid;
}
function getNakedBids(uint _id)
public
view
returns(SecretBids[] memory product) {
ProductWithBids storage selectedProduct = internalProducts[_id];
return selectedProduct.nakedBids;
}
i need to return the nakedBids but i get the following error : TypeError: Return argument type mapping(address => struct eShop.SecretBids storage ref[] storage ref) is not implicitly convertible to expected type (type of first return variable) struct eShop.SecretBids memory[] memory. return selectedProduct.nakedBids;
I get what the error means, i think i have tried everything and looked everywhere. From what i have found is that solidity doesn't support at all this action .Does anyone has any idea what i can try next? If i missed any other important code parts let me know. Thanks in advance.
I also tried :
returns(mapping(address => SecretBids[]) memory nakedBids)
but then i get the following error: Types containing (nested) mappings can only be parameters or return variables of internal or library functions. returns(mapping(address => SecretBids[]) memory nakedBids) { ^-----------------------------------------------^ ,TypeError: Type mapping(address => struct eShop.SecretBids[]) is only valid in storage because it contains a (nested) mapping. returns(mapping(address => SecretBids[]) memory nakedBids)
ps: if i change it to storage it complains that Data location must be memory.