You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static class ItemParam extends DynamicStruct {
public Utf8String rarity;
public Uint256 price;
public Address beneficiary;
public Utf8String metadata;
public ItemParam(Utf8String rarity, Uint256 price, Address beneficiary, Utf8String metadata) {
super(rarity, price, beneficiary, metadata);
this.rarity = rarity;
this.price = price;
this.beneficiary = beneficiary;
this.metadata = metadata;
}
}
The Initialize function generated:
public RemoteFunctionCall<TransactionReceipt> initialize(Utf8String _name, Utf8String _symbol, Utf8String _baseURI, Address _creator, Bool _shouldComplete, Bool _isApproved, Address _rarities, List<ItemParam> _items) {
final Function function = new Function(
FUNC_INITIALIZE,
Arrays.<Type>asList(_name, _symbol, _baseURI, _creator, _shouldComplete, _isApproved, _rarities, _items),
Collections.<TypeReference<?>>emptyList());
return executeRemoteCallTransaction(function);
}
Observations:
Your example looks very similar, but the obvious differences are that
1/ my struct is defined in an Interface
2/ my generated ItemParam class extends DynamicStruct, whereas your generated Pair class extends StaticStruct
3/ the generated Initialize method does not convert the Java List in the method signature to a type compatible with Arrays.asList so I end up with a build error: IERC721CollectionV2.java:75: error: method asList in class Arrays cannot be applied to given types; Arrays.<Type>asList(_name, _symbol, _baseURI, _creator, _shouldComplete, _isApproved, _rarities, _items), ^ required: T[] found: Utf8String,Utf8String,Utf8String,Address,Bool,Bool,Address,List<ItemParam> reason: varargs mismatch; List<ItemParam> cannot be converted to Type where T is a type-variable: T extends Object declared in method <T>asList(T...)
The text was updated successfully, but these errors were encountered:
I still have an issue with Array of Structs parameter on a method defined in an interface as reported and closed here:
#1723
The generated code does not match what is created by your example. I am using 4.10.3
Solidity:
The ItemParam class generated:
The Initialize function generated:
Observations:
Your example looks very similar, but the obvious differences are that
1/ my struct is defined in an Interface
2/ my generated ItemParam class extends DynamicStruct, whereas your generated Pair class extends StaticStruct
3/ the generated Initialize method does not convert the Java List in the method signature to a type compatible with Arrays.asList so I end up with a build error:
IERC721CollectionV2.java:75: error: method asList in class Arrays cannot be applied to given types; Arrays.<Type>asList(_name, _symbol, _baseURI, _creator, _shouldComplete, _isApproved, _rarities, _items), ^ required: T[] found: Utf8String,Utf8String,Utf8String,Address,Bool,Bool,Address,List<ItemParam> reason: varargs mismatch; List<ItemParam> cannot be converted to Type where T is a type-variable: T extends Object declared in method <T>asList(T...)
The text was updated successfully, but these errors were encountered: