如何解码 Polygon 网络中智能合约的函数名?

How to decode function name of smart contract in Polygon network?

我已经部署了合约(不是我的),没有提供abi。

交易中使用的输入数据:

0xd1700e6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

谁能帮忙,如何直接从web3调用这个函数?或者如何找出它的名字。据我了解,当您调用合约函数时,您会写:contract.methods.func().send()。但是,如果我只有 methodId,如何 call/send 发挥作用?

txid:https://polygonscan.com/tx/0x165f8d6e2b5a75a4daad8950444e2c31bba027da0b8c1b21ac760a954e69af88

您可以在 data 字段中创建一个包含函数选择器(以及函数参数)的原始交易,对其进行签名,然后将其发送给您的节点提供商以将其广播到网络。

// the sender private key needs to be added to web3 `accounts.wallet`
// see the blue "note" card in the docs for more details

await web3.eth.sendTransaction({
    from: senderAddress,
    to: contractAddress,
    data: "0xd1700e6c..."
});

文档:https://web3js.readthedocs.io/en/v1.7.0/web3-eth.html#sendtransaction