-
Notifications
You must be signed in to change notification settings - Fork 13
/
txprocessor.go
37 lines (30 loc) · 1.5 KB
/
txprocessor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package relay
import (
"context"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
neutrontypes "github.com/neutron-org/neutron/x/interchainqueries/types"
)
// Transaction represents single searched tx with height
type Transaction struct {
Tx *neutrontypes.TxValue
Height uint64
}
// TXQuerier fetches transactions from a remote chain with specified txFilter
type TXQuerier interface {
// SearchTransactions searches for transactions from remote chain.
// the returned transactions channel can be closed due to one of the following cases:
// a) All transactions from an RPC call preprocessed successfully
// b) error encountered during the SearchTransactions method (the error will be written into the returned errs channel)
// After a txs channel is closed, it's necessary to check the errs channel for a possible errors in a SearchTransactions goroutine
SearchTransactions(ctx context.Context, query string) (<-chan Transaction, <-chan error)
}
// ChainClient is a minimal interface for tendermint client
type ChainClient interface {
BlockResults(ctx context.Context, height *int64) (*ctypes.ResultBlockResults, error)
TxSearch(ctx context.Context, query string, prove bool, page, perPage *int, orderBy string) (*ctypes.ResultTxSearch, error)
}
// TXProcessor precesses transactions from a remote chain and sends them to the neutron
type TXProcessor interface {
ProcessAndSubmit(ctx context.Context, queryID uint64, tx Transaction) error
GetSubmitNotificationChannel() <-chan PendingSubmittedTxInfo
}