Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRespID ¶
CheckRespID verifies if the ID sent is the same as received.
Types ¶
type Blockchain ¶
type Blockchain interface {
Close(ctx context.Context) error
ChainID() string
ChainHeader() (chainID string, height uint64, err error)
SetChainHeader(*tmtypes.Block)
DecodeTx(tx tmtypes.Tx) (sdktypes.Tx, error)
SubscribeNewBlock(ctx context.Context) (<-chan *tmtypes.Block, error)
Block(ctx context.Context, height int64) (blk *tmtypes.Block, minimumBlkHeight int, err error)
CheckTx(ctx context.Context, tx tmtypes.Tx) error
LightProvider() provtypes.Provider
}
Blockchain is the expected blockchain interface the indexer needs to store data in the database.
func New ¶
func New(rpc, grpc string) (Blockchain, error)
New returns a new blockchain structure with a RPC connection stablish, it errors out if the connection is not setup properly. rpcEndpoint ex.: tcp://0.0.0.0:26657 grpcEndpoint ex.: 127.0.0.1:9090.
type Conn ¶
type Conn struct {
AddrRPC string
// contains filtered or unexported fields
}
Conn stores the connections needed to index events and transactions.
func NewConn ¶
NewConn returns a new pointer to the connection structure. examples of rpc endpoints are: tcp://0.0.0.0:26657 examples of grpc endpoints are: 127.0.0.1:9090
type RPCRespChainID ¶
type RPCRespChainID struct {
Result struct {
Block struct {
Header struct {
ChainID string `json:"chain_id"`
Height string `json:"height"`
} `json:"header"`
} `json:"block"`
} `json:"result"`
ID int `json:"id"`
}
RPCRespChainID represents the response struct for a chain ID call.
func (RPCRespChainID) CheckRespID ¶
func (r RPCRespChainID) CheckRespID(idSent int) error
CheckRespID checks if the ID sent matches.