假设我的 Solidity 智能合约中有以下事件:
event Buy(address buyer, string itemName);
我正在尝试在web3j Java 库中构造相应的事件。这就是我所做的:
public static final Event BUY = new Event(
"Buy", Arrays.<TypeReference<?>>asList(
new TypeReference<Address>(false) {}, // address buyer
new TypeReference<String>(false) {}, // string itemName
)
);
但是,它给了我错误:
Bound mismatch: The type String is not a valid substitute for the bounded parameter <T extends Type> of the type TypeReference<T>
我应该使用哪种类型而不是String
?