I'm trying to interact with the smart contract that I have created. At the moment I deploy the contract on GANACHE. Adding new items into contract works.
This is the part that doesn't work, and it looks like this:
function getCarEvents(
string memory vin
) external view returns (CarEvent[] memory) {
require(
bytes(allCars[vin].id).length > 0,
"Car with this VIN does not exist"
);
return carEvents[vin];
}
struct CarEvent {
string id; //equal to VIN
bool isAdditionalEntry;
uint256 milage;
uint256 eventCode;
uint256 dealershipId;
}
and my code in .NET
public class CarEvent
{
public bool IsAdditionalEntry { get; set; }
public BigInteger Milage { get; set; }
public BigInteger EventCode { get; set; }
public BigInteger DealershipId { get; set; }
}
public async Task<Car> GetCarAsync(string vin)
{
...
var getCarFunction = contract.GetFunction("getCar");
var queryResult = await getCarFunction.CallAsync<CarEvent[]>(vin);
...
}
EDIT: I left only the important part
I have found the issue...at the moment I'm trying to get CarEvent[]
from the smart contract function...but the Nethereum library has difficulties with getting an array and deserializing it to C# objects...
I'm not sure how to solve this, any suggestions are more than welcome.