blockchain

package
v0.0.0-...-cd1f6ea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2024 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRespID

func CheckRespID(idSent, idReceived int) error

CheckRespID verifies if the ID sent is the same as received.

func New

func New(rpc, grpc string) (native.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.

Types

type Conn

type Conn struct {
	AddrRPC string
	// contains filtered or unexported fields
}

Conn stores the connections needed to index events and transactions.

func NewConn

func NewConn(rpc, gRPC string) (*Conn, error)

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

func (*Conn) Close

func (c *Conn) Close(ctx context.Context) error

Close ends the connections open.

func (*Conn) Start

func (c *Conn) Start() error

Start initiate the websocket to be able to subscribe to events.

type RPCRespChainID

type RPCRespChainID struct {
	ID     int `json:"id"`
	Result struct {
		Block struct {
			Header struct {
				ChainID string `json:"chain_id"`
				Height  string `json:"height"`
			} `json:"header"`
		} `json:"block"`
	} `json:"result"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL