forked from cerc-io/ipld-eth-server
d1ee501f12
* Use transformer factory for Bite - introduces separate transformer factory for non-LogNote events - converter includes `ToEntities` for events defined via ABI * Updates after rebasing with staging
27 lines
746 B
Go
27 lines
746 B
Go
package mocks
|
|
|
|
import (
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
)
|
|
|
|
type MockConverter struct {
|
|
ToEntitiesError error
|
|
ToModelsError error
|
|
ContractAbi string
|
|
LogsToConvert []types.Log
|
|
EntitiesToConvert []interface{}
|
|
EntitiesToReturn []interface{}
|
|
ModelsToReturn []interface{}
|
|
}
|
|
|
|
func (converter *MockConverter) ToEntities(contractAbi string, ethLogs []types.Log) ([]interface{}, error) {
|
|
converter.ContractAbi = contractAbi
|
|
converter.LogsToConvert = ethLogs
|
|
return converter.EntitiesToReturn, converter.ToEntitiesError
|
|
}
|
|
|
|
func (converter *MockConverter) ToModels(entities []interface{}) ([]interface{}, error) {
|
|
converter.EntitiesToConvert = entities
|
|
return converter.ModelsToReturn, converter.ToModelsError
|
|
}
|