dethcrypto / dethcrypto/TypeChain
Could not parse type with internal type: undefined for custom structure
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 376
- PR merge metrics
- No merged PRs in 30d
Description
I have some contracts using a library structure data storage, compiled using an older version of Solidity, but which throw an error asking me to make a report here.
In the `libraryType.sol` contract I have something like this:
```solidity
library PersonLib {
struct Data {
bool isActive;
bytes hashOfData;
string handle;
}
function handle(Data storage self) public view returns (string) {
return self.handle;
}
function markActive(Data storage self) internal {
self.isActive = true;
}
//other getters & setters omitted
}
```
In other contracts, the library contract is imported and the type of a variable or struct member might be `PersonLib.Data` - sometimes, there are more than one of the same type in the same file (e.g. a `Requester` and a `Contributor` with wrapper functions similar to this:
```solidity
function requesterHandle() public view returns (string) {
return requester.handle;
}
function updateRequesterHandle(string newHandle) public {
emit RequesterHandleUpdated(newHandle);
PersonLib.updateHandle(requester, newHandle);
}
```
That works fine in Solidity, but when trying to generate types with TypeChain, that triggers an error like this:
>Could not parse type: PersonLib.Data storage with internal type: undefined.
>
>Please submit a GitHub Issue to the TypeChain team with the failing contract/library.
This error report is hereby filed per request.
Hopefully I haven't missed something important when attempting to make it a minimal example for the report.
Contributor guide
Assessment
This issue has not been assessed yet.