tx

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BroadcastTxRequest

func BroadcastTxRequest(cliCtx context.CLIContext, cdc *codec.Codec) http.HandlerFunc

BroadcastTxRequest implements a tx broadcasting handler that is responsible for broadcasting a valid and signed tx to a full node. The tx can be broadcasted via a sync|async|block mechanism.

func EncodeTxRequestHandlerFn

func EncodeTxRequestHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.HandlerFunc

EncodeTxRequestHandlerFn returns the encode tx REST handler. In particular, it takes a json-formatted transaction, encodes it to the Amino wire protocol, and responds with base64-encoded bytes.

func GetBroadcastCommand

func GetBroadcastCommand(codec *amino.Codec) *cobra.Command

GetBroadcastCommand returns the tx broadcast command.

func GetEncodeCommand

func GetEncodeCommand(codec *amino.Codec) *cobra.Command

GetEncodeCommand returns the encode command to take a JSONified transaction and turn it into Amino-serialized bytes

func QueryMempoolTxRequestHandlerFn added in v1.3.0

func QueryMempoolTxRequestHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.HandlerFunc

QueryTxRequestHandlerFn implements a REST handler that queries a transaction by hash in mempool, only queries the front 100 txs in mempool because of Tendermint limit.

func QueryMempoolTxsNumRequestHandlerFn added in v1.3.0

func QueryMempoolTxsNumRequestHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.HandlerFunc

QueryMempoolTxsNumRequestHandlerFn query mempool txs count

func QueryMempoolTxsRequestHandlerFn added in v1.3.0

func QueryMempoolTxsRequestHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.HandlerFunc

QueryMempoolTxRequestHandlerFn implements a REST handler that queries the front 100 transactions in mempool, only queries the front 100 txs in mempool because of Tendermint limit.

func QueryTxCmd

func QueryTxCmd(cdc *codec.Codec) *cobra.Command

QueryTxCmd implements the default command for a tx query.

func QueryTxRequestHandlerFn

func QueryTxRequestHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.HandlerFunc

QueryTxRequestHandlerFn implements a REST handler that queries a transaction by hash in a committed block.

func QueryTxsByTagsRequestHandlerFn

func QueryTxsByTagsRequestHandlerFn(cliCtx context.CLIContext, cdc *codec.Codec) http.HandlerFunc

QueryTxsByTagsRequestHandlerFn implements a REST handler that searches for transactions by tags.

func RegisterRoutes

func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec)

register REST routes

func SearchTxCmd

func SearchTxCmd(cdc *codec.Codec) *cobra.Command

SearchTxCmd returns a command to search through tagged transactions.

func SearchTxs

func SearchTxs(cliCtx context.CLIContext, cdc *codec.Codec, tags []string, page, limit int) ([]sdk.TxResponse, error)

SearchTxs performs a search for transactions for a given set of tags via Tendermint RPC. It returns a slice of Info object containing txs and metadata. An error is returned if the query fails.

func ValidateTxResult

func ValidateTxResult(cliCtx context.CLIContext, resTx *ctypes.ResultTx) error

ValidateTxResult performs transaction verification.

Types

type BroadcastReq

type BroadcastReq struct {
	Tx   auth.StdTx `json:"tx"`
	Mode string     `json:"mode"`
}

BroadcastReq defines a tx broadcasting request.

type EncodeReq

type EncodeReq struct {
	Tx auth.StdTx `json:"tx"`
}

EncodeReq defines a tx encoding request.

type EncodeResp

type EncodeResp struct {
	Tx string `json:"tx"`
}

EncodeResp defines a tx encoding response.

type MempoolTxNumResponse added in v1.3.0

type MempoolTxNumResponse struct {
	Total      int   `json:"mempool_txs_count"`
	TotalBytes int64 `json:"mempool_total_bytes"`
}

MempoolTxNumResponse for query mempool txs count

func NewMempoolTxNumResponse added in v1.3.0

func NewMempoolTxNumResponse(total int, totalBytes int64) MempoolTxNumResponse

type MempoolTxsResponse added in v1.3.0

type MempoolTxsResponse struct {
	TotalTxs   int              `json:"mempool_txs_count"`
	TotalBytes int64            `json:"mempool_total_bytes"`
	Count      int              `json:"txs_count"`
	MempoolTxs []sdk.TxResponse `json:"txs"`
}

MempoolTxsResponse for query mempool txs NOTE: because of Tendermint, the maximum count of quering is 100

func NewMempoolTxsResponse added in v1.3.0

func NewMempoolTxsResponse(totalTxs, count int, totalBytes int64, mempoolTxs []sdk.TxResponse) MempoolTxsResponse

func (MempoolTxsResponse) Empty added in v1.3.0

func (mp MempoolTxsResponse) Empty() bool

func (*MempoolTxsResponse) ParseUnconfirmedTxs added in v1.3.0

func (mp *MempoolTxsResponse) ParseUnconfirmedTxs(cdc *codec.Codec, result *ctypes.ResultUnconfirmedTxs) error

Jump to

Keyboard shortcuts

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