Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 在web3上使用字符串作为参数进行搜索_String_Search_Solidity_Web3 - Fatal编程技术网

String 在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

我试图在事件中使用字符串值作为参数进行搜索,但没有得到任何结果。这是我在web3上尝试过的:

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);
});

我怎样才能做到这一点?

我能够解决它。复制的