String 在web3上使用字符串作为参数进行搜索
我试图在事件中使用字符串值作为参数进行搜索,但没有得到任何结果。这是我在web3上尝试过的:String 在web3上使用字符串作为参数进行搜索,string,search,solidity,web3,String,Search,Solidity,Web3,我试图在事件中使用字符串值作为参数进行搜索,但没有得到任何结果。这是我在web3上尝试过的: const result = contract.getPastEvents( 'Event', { filter: { Name: web3.utils.sha3('Smith') }, fromBlock: 0, toBlock: 'latest' }, function(error, e
const result = contract.getPastEvents(
'Event',
{
filter: {
Name: web3.utils.sha3('Smith')
},
fromBlock: 0,
toBlock: 'latest'
}, function(error, event){
console.log(error);
}
)
.then(function(event){
$("#result").html(event[0].returnValues.Name);
});
我怎样才能做到这一点?我能够解决它。复制的