diff --git a/pkg/loop/internal/types/types.go b/pkg/loop/internal/types/types.go index 9e3f50e39..58ea70302 100644 --- a/pkg/loop/internal/types/types.go +++ b/pkg/loop/internal/types/types.go @@ -44,6 +44,7 @@ type OCR3CapabilityProvider interface { // Relayer is like types.Relayer, but with a dynamic NewPluginProvider method. type Relayer interface { types.ChainService + types.ChainReader // NewChainWriter returns a new ChainWriter. // The format of config depends on the implementation. diff --git a/pkg/types/relayer.go b/pkg/types/relayer.go index ea87f1d17..64feb6a70 100644 --- a/pkg/types/relayer.go +++ b/pkg/types/relayer.go @@ -78,33 +78,34 @@ type NodeStatus struct { State string } -// ChainService is a sub-interface that encapsulates the explicit interactions with a chain, rather than through a provider. -type ChainService interface { - Service - +type ChainReader interface { + // NewContractReader returns a new ContractReader. + // The format of contractReaderConfig depends on the implementation. + NewContractReader(ctx context.Context, contractReaderConfig []byte) (ContractReader, error) // LatestHead returns the latest head for the underlying chain. LatestHead(ctx context.Context) (Head, error) // GetChainStatus returns the ChainStatus for this Relayer. GetChainStatus(ctx context.Context) (ChainStatus, error) // ListNodeStatuses returns the status of RPC nodes. ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []NodeStatus, nextPageToken string, total int, err error) +} + +// ChainService is a sub-interface that encapsulates the explicit interactions with a chain, rather than through a provider. +type ChainService interface { + Service // Transact submits a transaction to transfer tokens. // If balanceCheck is true, the balance will be checked before submitting. Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error } -// Relayer extends ChainService with providers for each product. +// Relayer extends ChainService and ChainReader with providers for each product. type Relayer interface { ChainService - + ChainReader // NewChainWriter returns a new ChainWriter. // The format of config depends on the implementation. NewChainWriter(ctx context.Context, config []byte) (ChainWriter, error) - // NewContractReader returns a new ContractReader. - // The format of contractReaderConfig depends on the implementation. - NewContractReader(ctx context.Context, contractReaderConfig []byte) (ContractReader, error) - NewConfigProvider(ctx context.Context, rargs RelayArgs) (ConfigProvider, error) NewMedianProvider(ctx context.Context, rargs RelayArgs, pargs PluginArgs) (MedianProvider, error)