Documentation ¶
Index ¶
- Constants
- Variables
- type ChainClientImpl
- type ChainServerImpl
- type Client
- func (c *Client) CheckRawTransaction(ctx context.Context, tx []byte) (*tmctypes.ResultCheckTx, error)
- func (c *Client) CheckTransaction(ctx context.Context, tx *commandspb.Transaction) (*tmctypes.ResultCheckTx, error)
- func (c *Client) GenesisValidators() ([]*tmtypes.Validator, error)
- func (c *Client) GetChainID(ctx context.Context) (chainID string, err error)
- func (c *Client) GetGenesisTime(ctx context.Context) (genesisTime time.Time, err error)
- func (c *Client) GetNetworkInfo(ctx context.Context) (netInfo *tmctypes.ResultNetInfo, err error)
- func (c *Client) GetStatus(ctx context.Context) (status *tmctypes.ResultStatus, err error)
- func (c *Client) GetUnconfirmedTxCount(ctx context.Context) (count int, err error)
- func (c *Client) Health() (*tmctypes.ResultHealth, error)
- func (c *Client) Set(clt ChainClientImpl)
- func (c *Client) Start() error
- func (c *Client) SubmitRawTransactionAsync(ctx context.Context, tx []byte) (*tmctypes.ResultBroadcastTx, error)
- func (c *Client) SubmitRawTransactionCommit(ctx context.Context, tx []byte) (*tmctypes.ResultBroadcastTxCommit, error)
- func (c *Client) SubmitRawTransactionSync(ctx context.Context, tx []byte) (*tmctypes.ResultBroadcastTx, error)
- func (c *Client) SubmitTransactionAsync(ctx context.Context, tx *commandspb.Transaction) (*tmctypes.ResultBroadcastTx, error)
- func (c *Client) SubmitTransactionCommit(ctx context.Context, tx *commandspb.Transaction) (*tmctypes.ResultBroadcastTxCommit, error)
- func (c *Client) SubmitTransactionSync(ctx context.Context, tx *commandspb.Transaction) (*tmctypes.ResultBroadcastTx, error)
- func (c *Client) Subscribe(ctx context.Context, fn func(tmctypes.ResultEvent) error, queries ...string) error
- func (c *Client) Validators(height *int64) ([]*tmtypes.Validator, error)
- type Config
- type NullChainConfig
- type Server
- type TendermintConfig
Constants ¶
const ( ProviderNullChain = "nullchain" ProviderTendermint = "tendermint" )
Variables ¶
var ErrClientNotReady = errors.New("tendermint client is not ready")
Functions ¶
This section is empty.
Types ¶
type ChainClientImpl ¶
type ChainClientImpl interface { GetGenesisTime(context.Context) (time.Time, error) GetChainID(context.Context) (string, error) GetStatus(context.Context) (*tmctypes.ResultStatus, error) GetNetworkInfo(context.Context) (*tmctypes.ResultNetInfo, error) GetUnconfirmedTxCount(context.Context) (int, error) Health(context.Context) (*tmctypes.ResultHealth, error) SendTransactionAsync(context.Context, []byte) (*tmctypes.ResultBroadcastTx, error) SendTransactionSync(context.Context, []byte) (*tmctypes.ResultBroadcastTx, error) CheckTransaction(context.Context, []byte) (*tmctypes.ResultCheckTx, error) SendTransactionCommit(context.Context, []byte) (*tmctypes.ResultBroadcastTxCommit, error) GenesisValidators(context.Context) ([]*tmtypes.Validator, error) Validators(context.Context, *int64) ([]*tmtypes.Validator, error) Subscribe(context.Context, func(tmctypes.ResultEvent) error, ...string) error Start() error }
type ChainServerImpl ¶
type Client ¶
type Client struct { *Config // contains filtered or unexported fields }
Client abstract all communication to the blockchain.
func NewClientWithImpl ¶
func NewClientWithImpl(clt ChainClientImpl) *Client
func (*Client) CheckRawTransaction ¶
func (*Client) CheckTransaction ¶
func (c *Client) CheckTransaction(ctx context.Context, tx *commandspb.Transaction) (*tmctypes.ResultCheckTx, error)
func (*Client) GenesisValidators ¶
func (*Client) GetChainID ¶
GetChainID retrieves the chainID from the blockchain.
func (*Client) GetGenesisTime ¶
GetGenesisTime retrieves the genesis time from the blockchain.
func (*Client) GetNetworkInfo ¶
GetNetworkInfo return information of the current network.
func (*Client) GetUnconfirmedTxCount ¶
GetUnconfirmedTxCount return the current count of unconfirmed transactions.
func (*Client) Health ¶
func (c *Client) Health() (*tmctypes.ResultHealth, error)
Health returns the result of the health endpoint of the chain.
func (*Client) Set ¶
func (c *Client) Set(clt ChainClientImpl)
func (*Client) SubmitRawTransactionAsync ¶
func (*Client) SubmitRawTransactionCommit ¶
func (*Client) SubmitRawTransactionSync ¶
func (*Client) SubmitTransactionAsync ¶
func (c *Client) SubmitTransactionAsync(ctx context.Context, tx *commandspb.Transaction) (*tmctypes.ResultBroadcastTx, error)
func (*Client) SubmitTransactionCommit ¶
func (c *Client) SubmitTransactionCommit(ctx context.Context, tx *commandspb.Transaction) (*tmctypes.ResultBroadcastTxCommit, error)
func (*Client) SubmitTransactionSync ¶
func (c *Client) SubmitTransactionSync(ctx context.Context, tx *commandspb.Transaction) (*tmctypes.ResultBroadcastTx, error)
type Config ¶
type Config struct { Level encoding.LogLevel `long:"log-level"` LogTimeDebug bool `long:"log-time-debug"` LogOrderSubmitDebug bool `long:"log-order-submit-debug"` LogOrderAmendDebug bool `long:"log-order-amend-debug"` LogOrderCancelDebug bool `long:"log-order-cancel-debug"` ChainProvider string `long:"chain-provider"` Tendermint TendermintConfig `group:"Tendermint" namespace:"tendermint"` Null NullChainConfig `group:"NullChain" namespace:"nullchain"` }
Config represent the configuration of the blockchain package.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.
type NullChainConfig ¶
type NullChainConfig struct { Level encoding.LogLevel `long:"log-level"` BlockDuration encoding.Duration `long:"block-duration" description:"(default 1s)"` TransactionsPerBlock uint64 `long:"transactions-per-block" description:"(default 10)"` GenesisFile string `long:"genesis-file" description:"path to a tendermint genesis file"` IP string `long:"ip" description:"time-forwarding IP (default localhost)"` Port int `long:"port" description:"time-forwarding port (default 3009)"` }
func NewDefaultNullChainConfig ¶
func NewDefaultNullChainConfig() NullChainConfig
NewDefaultNullChainConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.
type Server ¶
type Server struct { *Config // contains filtered or unexported fields }
Server abstraction for the abci server.
func NewServer ¶
func NewServer(srv ChainServerImpl) *Server
NewServer instantiate a new blockchain server.
func (*Server) ReloadConf ¶
type TendermintConfig ¶
type TendermintConfig struct { Level encoding.LogLevel `long:"log-level" description:" "` RPCAddr string `long:"rpc-addr" description:"address of the tendermint rpc"` }
func NewDefaultTendermintConfig ¶
func NewDefaultTendermintConfig() TendermintConfig
NewDefaultTendermintConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.