如何使用围棋接收回复消息?
receipt, err := bind.WaitMined(context.Background(), client, tx)
if err != nil {
fmt.Errorf(err)
}
fmt.Println(receipt.Status)现在我只能得到地位了。我使用abigen来调用智能契约方法。
发布于 2020-10-05 08:42:58
我使用类似的方法,它将事务重做为一个调用,这样您就可以得到失败的消息。
func GetFailingMessage(client ethclient.Client, hash common.Hash) (string, error) {
tx, _, err := client.TransactionByHash(context.Background(), hash)
if err != nil {
return "", err
}
from, err := types.Sender(types.NewEIP155Signer(tx.ChainId()), tx)
if err != nil {
return "", err
}
msg := ethereum.CallMsg{
From: from,
To: tx.To(),
Gas: tx.Gas(),
GasPrice: tx.GasPrice(),
Value: tx.Value(),
Data: tx.Data(),
}
res, err := client.CallContract(context.Background(), msg, nil)
if err != nil {
return "", err
}
return string(res), nil
}https://ethereum.stackexchange.com/questions/87631
复制相似问题