Documentation ¶
Index ¶
- Constants
- Variables
- func NewResponseCheckTx(code uint32, info string) types.ResponseCheckTx
- func NewResponseCheckTxError(code uint32, err error) types.ResponseCheckTx
- func NewResponseDeliverTx(code uint32, info string) types.ResponseDeliverTx
- func NewResponseDeliverTxError(code uint32, err error) types.ResponseDeliverTx
- 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 ReplayConfig
- type Server
- type TendermintConfig
Constants ¶
const ( ProviderNullChain = "nullchain" ProviderTendermint = "tendermint" )
const ( // AbciTxnValidationFailure ... AbciTxnValidationFailure uint32 = 51 // AbciTxnDecodingFailure code is returned when CheckTx or DeliverTx fail to decode the Txn. AbciTxnDecodingFailure uint32 = 60 // AbciTxnInternalError code is returned when CheckTx or DeliverTx fail to process the Txn. AbciTxnInternalError uint32 = 70 // AbciTxnPartialProcessingError code is return when a batch instruction partially fail. AbciTxnPartialProcessingError uint32 = 71 // AbciUnknownCommandError code is returned when the app doesn't know how to handle a given command. AbciUnknownCommandError uint32 = 80 // AbciSpamError code is returned when CheckTx or DeliverTx fail spam protection tests. AbciSpamError uint32 = 89 )
Variables ¶
var ErrClientNotReady = errors.New("tendermint client is not ready")
Functions ¶
func NewResponseCheckTx ¶ added in v0.56.0
func NewResponseCheckTx(code uint32, info string) types.ResponseCheckTx
func NewResponseCheckTxError ¶ added in v0.56.0
func NewResponseCheckTxError(code uint32, err error) types.ResponseCheckTx
func NewResponseDeliverTx ¶ added in v0.56.0
func NewResponseDeliverTx(code uint32, info string) types.ResponseDeliverTx
func NewResponseDeliverTxError ¶ added in v0.56.0
func NewResponseDeliverTxError(code uint32, err error) types.ResponseDeliverTx
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 }
nolint: interfacebloat
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)"` Replay ReplayConfig }
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 ReplayConfig ¶ added in v0.62.0
type ReplayConfig struct { Record bool `long:"record" description:"whether to record block data to a file to allow replaying"` Replay bool `long:"replay" description:"whether to replay any blockdata found in replay-file"` ReplayFile string `long:"replay-file" description:"path to file of which to write/read replay data"` }
type Server ¶
type Server struct { *Config // contains filtered or unexported fields }
Server abstraction for the abci server.
func NewServer ¶
func NewServer(log *logging.Logger, 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.