Documentation ¶
Index ¶
- Constants
- Variables
- func BlockchainEventFactory(name string) interface{}
- func CreateEventMapper(eventFactory EventFactory, abi *abi.ABI) func(log types.Log) (interface{}, error)
- func UnpackLog(out interface{}, event string, log types.Log, ab *abi.ABI) error
- func WatchContractEvents(ctx context.Context, client EthereumClient, contractAddr common.Address, ...) (*lib.Subscription, error)
- type CloseListererFunc
- type DataAccess
- type EthereumClient
- type EventFactory
- type EventMapper
Constants ¶
View Source
const RECONNECT_TIMEOUT = 2 * time.Second
Variables ¶
View Source
var ( ErrNoEventSignature = errors.New("no event signature") ErrEventSignatureMismatch = errors.New("event signature mismatch") )
View Source
var (
ErrUnknownEvent = errors.New("unknown event")
)
Functions ¶
func BlockchainEventFactory ¶
func BlockchainEventFactory(name string) interface{}
func CreateEventMapper ¶
func UnpackLog ¶
UnpackLog unpacks the log into the provided struct, copied from go-ethereum implementation
func WatchContractEvents ¶
func WatchContractEvents(ctx context.Context, client EthereumClient, contractAddr common.Address, mapper EventMapper, log lib.ILogger) (*lib.Subscription, error)
WatchContractEvents watches for all events from the contract and converts them to the concrete type, using mapper
Types ¶
type CloseListererFunc ¶
type CloseListererFunc = func()
type DataAccess ¶
type DataAccess interface { // string used as address cause different blockchains may return different type of addresses GetContractsIDs() ([]string, error) GetContract(contractID string) (interface{}, error) CloseContract(contractID string, meta interface{}) error OnNewContract(func(contractID string)) CloseListererFunc OnContractUpdated(contractID string, cb func()) CloseListererFunc OnContractClosed(contractID string, cb func()) CloseListererFunc }
type EthereumClient ¶
type EthereumClient interface { bind.ContractBackend bind.DeployBackend ChainID(ctx context.Context) (*big.Int, error) BalanceAt(ctx context.Context, addr common.Address, blockNumber *big.Int) (*big.Int, error) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error) }
type EventFactory ¶
type EventFactory func(name string) interface{}
type EventMapper ¶
Click to show internal directories.
Click to hide internal directories.