MCPcopy
hub / github.com/canopy-network/canopy / txToGetLogsResp

Method txToGetLogsResp

cmd/rpc/eth.go:970–987  ·  view source on GitHub ↗

txToGetLogsResp() converts a send message into an ethGetLogsResponse

(blockHash []byte, tx *lib.TxResult)

Source from the content-addressed store, hash-verified

968
969// txToGetLogsResp() converts a send message into an ethGetLogsResponse
970func (s *Server) txToGetLogsResp(blockHash []byte, tx *lib.TxResult) (ethGetLogsResponse, error) {
971 sendMessage, err := msgToSend(tx.Transaction.Msg)
972 if err != nil {
973 return ethGetLogsResponse{}, err
974 }
975 return ethGetLogsResponse{
976 LogIndex: fmt.Sprintf("0x%x", tx.Index),
977 BlockNumber: fmt.Sprintf("0x%x", tx.Height),
978 BlockHash: fmt.Sprintf("0x%s", lib.BytesToString(blockHash)),
979 TransactionHash: fmt.Sprintf("0x%s", tx.TxHash),
980 TransactionIndex: fmt.Sprintf("0x%x", tx.Index),
981 PseudoContractAddress: strings.ToLower(fsm.CNPYContractAddress),
982 Amount: fmt.Sprintf("0x%x", sendMessage.Amount),
983 Topics: []string{transferEventFilterHash,
984 fmt.Sprintf("0x%064s", lib.BytesToString(sendMessage.FromAddress)),
985 fmt.Sprintf("0x%064s", lib.BytesToString(sendMessage.ToAddress))},
986 }, nil
987}
988
989// passesAddressFilter() ensures the address is in the slice (nil slice means all)
990func (s *Server) passesAddressFilter(addr []byte, addresses []string) (ok bool) {

Callers 1

ethGetLogsMethod · 0.95

Calls 2

BytesToStringFunction · 0.92
msgToSendFunction · 0.85

Tested by

no test coverage detected