txToGetLogsResp() converts a send message into an ethGetLogsResponse
(blockHash []byte, tx *lib.TxResult)
| 968 | |
| 969 | // txToGetLogsResp() converts a send message into an ethGetLogsResponse |
| 970 | func (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) |
| 990 | func (s *Server) passesAddressFilter(addr []byte, addresses []string) (ok bool) { |
no test coverage detected