I currently use the code below to extract the ERC721 Token ID from Transfer Event Logs:
txHash := newLog.TxHash.Hex()
hexString := common.BytesToAddress(newLog.Topics[3].Bytes()).Hex()
flowerNum, _ := strconv.ParseUint(hexString, 0, 10)
flowerNumInt := int64(flowerNum)
flowerNumInt
is 1023
, even though txHash
linked below references FLOWER #1133
. Moreso, FLOWER #1023
has no transfer events at all, and does not appear in the tx linked below.
https://etherscan.io/tx/0xe330601b05c54116da3b06dd17cf483ab3106fb969989458c8587aac1c34fbf3
Am I doing something wrong during the conversion?
0x000000000000000000000000000000000000000000000000000000000000046d
which is1133
. not sure why you're converting the topic bytes to a common.Address type. Just convert it to abig.Int