api

package
v0.8.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2018 License: MIT Imports: 31 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Routes = map[string]*rpcserver.RPCFunc{
	"status":                 rpcserver.NewRPCFunc(Status, ""),
	"candidates":             rpcserver.NewRPCFunc(Candidates, "height"),
	"candidate":              rpcserver.NewRPCFunc(Candidate, "pubkey,height"),
	"validators":             rpcserver.NewRPCFunc(Validators, "height"),
	"address":                rpcserver.NewRPCFunc(Address, "address,height"),
	"send_transaction":       rpcserver.NewRPCFunc(SendTransaction, "tx"),
	"transaction":            rpcserver.NewRPCFunc(Transaction, "hash"),
	"transactions":           rpcserver.NewRPCFunc(Transactions, "query"),
	"block":                  rpcserver.NewRPCFunc(Block, "height"),
	"events":                 rpcserver.NewRPCFunc(Events, "height"),
	"net_info":               rpcserver.NewRPCFunc(NetInfo, ""),
	"coin_info":              rpcserver.NewRPCFunc(CoinInfo, "symbol,height"),
	"estimate_coin_sell":     rpcserver.NewRPCFunc(EstimateCoinSell, "coin_to_sell,coin_to_buy,value_to_sell,height"),
	"estimate_coin_buy":      rpcserver.NewRPCFunc(EstimateCoinBuy, "coin_to_sell,coin_to_buy,value_to_buy,height"),
	"estimate_tx_commission": rpcserver.NewRPCFunc(EstimateTxCommission, "tx,height"),
	"unconfirmed_txs":        rpcserver.NewRPCFunc(UnconfirmedTxs, "limit"),
}

Functions

func Candidates added in v0.8.0

func Candidates(height int) (*[]CandidateResponse, error)

func GetStateForHeight added in v0.8.0

func GetStateForHeight(height int) (*state.StateDB, error)

func Handler added in v0.8.0

func Handler(h http.Handler) http.Handler

func NetInfo added in v0.1.2

func NetInfo() (*core_types.ResultNetInfo, error)

func RegisterCryptoAmino added in v0.8.0

func RegisterCryptoAmino(cdc *amino.Codec)

RegisterAmino registers all crypto related types in the given (amino) codec.

func RunApi

func RunApi(b *minter.Blockchain, tmRPC *rpc.Local)

func SendTransaction

func SendTransaction(tx []byte) (*core_types.ResultBroadcastTx, error)

func Transactions

func Transactions(query string) (*[]TransactionResponse, error)

func UnconfirmedTxs added in v0.8.0

func UnconfirmedTxs(limit int) (*core_types.ResultUnconfirmedTxs, error)

Types

type AddressResponse added in v0.8.0

type AddressResponse struct {
	Balance          map[string]*big.Int `json:"balance"`
	TransactionCount uint64              `json:"transaction_count"`
}

func Address added in v0.8.0

func Address(address types.Address, height int) (*AddressResponse, error)

type BlockResponse

type BlockResponse struct {
	Hash         common.HexBytes            `json:"hash"`
	Height       int64                      `json:"height"`
	Time         time.Time                  `json:"time"`
	NumTxs       int64                      `json:"num_txs"`
	TotalTxs     int64                      `json:"total_txs"`
	Transactions []BlockTransactionResponse `json:"transactions"`
	BlockReward  *big.Int                   `json:"block_reward"`
	Size         int                        `json:"size"`
	Proposer     types.Pubkey               `json:"proposer"`
	Validators   []BlockValidatorResponse   `json:"validators"`
}

func Block

func Block(height int64) (*BlockResponse, error)

type BlockTransactionResponse

type BlockTransactionResponse struct {
	Hash        string            `json:"hash"`
	RawTx       string            `json:"raw_tx"`
	From        string            `json:"from"`
	Nonce       uint64            `json:"nonce"`
	GasPrice    *big.Int          `json:"gas_price"`
	Type        byte              `json:"type"`
	Data        json.RawMessage   `json:"data"`
	Payload     []byte            `json:"payload"`
	ServiceData []byte            `json:"service_data"`
	Gas         int64             `json:"gas"`
	GasCoin     types.CoinSymbol  `json:"gas_coin"`
	GasUsed     int64             `json:"gas_used"`
	Tags        map[string]string `json:"tags"`
	Code        uint32            `json:"code,omitempty"`
	Log         string            `json:"log,omitempty"`
}

type BlockValidatorResponse added in v0.8.0

type BlockValidatorResponse struct {
	Pubkey string `json:"pubkey"`
	Signed bool   `json:"signed"`
}

type CandidateResponse added in v0.8.0

type CandidateResponse struct {
	CandidateAddress types.Address `json:"candidate_address"`
	TotalStake       *big.Int      `json:"total_stake"`
	PubKey           types.Pubkey  `json:"pubkey"`
	Commission       uint          `json:"commission"`
	Stakes           []Stake       `json:"stakes,omitempty"`
	CreatedAtBlock   uint          `json:"created_at_block"`
	Status           byte          `json:"status"`
}

func Candidate

func Candidate(pubkey []byte, height int) (*CandidateResponse, error)

type CoinInfoResponse

type CoinInfoResponse struct {
	Name           string           `json:"name"`
	Symbol         types.CoinSymbol `json:"symbol"`
	Volume         *big.Int         `json:"volume"`
	Crr            uint             `json:"crr"`
	ReserveBalance *big.Int         `json:"reserve_balance"`
}

func CoinInfo added in v0.8.0

func CoinInfo(coinSymbol string, height int) (*CoinInfoResponse, error)

type EstimateCoinBuyResponse added in v0.1.2

type EstimateCoinBuyResponse struct {
	WillPay    *big.Int `json:"will_pay"`
	Commission *big.Int `json:"commission"`
}

func EstimateCoinBuy added in v0.0.6

func EstimateCoinBuy(coinToSellString string, coinToBuyString string, valueToBuy *big.Int, height int) (*EstimateCoinBuyResponse, error)

type EstimateCoinSellResponse added in v0.1.2

type EstimateCoinSellResponse struct {
	WillGet    *big.Int `json:"will_get"`
	Commission *big.Int `json:"commission"`
}

func EstimateCoinSell added in v0.0.6

func EstimateCoinSell(coinToSellString string, coinToBuyString string, valueToSell *big.Int, height int) (*EstimateCoinSellResponse, error)

type EventsResponse added in v0.8.0

type EventsResponse struct {
	Events eventsdb.Events `json:"events"`
}

func Events added in v0.8.0

func Events(height int64) (*EventsResponse, error)

type Response

type Response struct {
	Code   uint32      `json:"code"`
	Result interface{} `json:"result,omitempty"`
	Log    string      `json:"log,omitempty"`
}

type ResponseValidators added in v0.8.0

type ResponseValidators []ValidatorResponse

func Validators added in v0.8.0

func Validators(height int64) (*ResponseValidators, error)

type ResultTxSearch

type ResultTxSearch struct {
	Txs        []*core_types.ResultTx `json:"txs"`
	TotalCount int                    `json:"total_count"`
}

type Stake added in v0.2.0

type Stake struct {
	Owner    types.Address    `json:"owner"`
	Coin     types.CoinSymbol `json:"coin"`
	Value    string           `json:"value"`
	BipValue string           `json:"bip_value"`
}

type StatusResponse

type StatusResponse struct {
	MinterVersion     string                   `json:"version"`
	LatestBlockHash   string                   `json:"latest_block_hash"`
	LatestAppHash     string                   `json:"latest_app_hash"`
	LatestBlockHeight int64                    `json:"latest_block_height"`
	LatestBlockTime   time.Time                `json:"latest_block_time"`
	TmStatus          *core_types.ResultStatus `json:"tm_status"`
}

func Status

func Status() (*StatusResponse, error)

type TransactionResponse

type TransactionResponse struct {
	Hash     common.HexBytes   `json:"hash"`
	RawTx    string            `json:"raw_tx"`
	Height   int64             `json:"height"`
	Index    uint32            `json:"index"`
	From     string            `json:"from"`
	Nonce    uint64            `json:"nonce"`
	GasPrice *big.Int          `json:"gas_price"`
	GasCoin  types.CoinSymbol  `json:"gas_coin"`
	GasUsed  int64             `json:"gas_used"`
	Type     byte              `json:"type"`
	Data     json.RawMessage   `json:"data"`
	Payload  []byte            `json:"payload"`
	Tags     map[string]string `json:"tags"`
	Code     uint32            `json:"code,omitempty"`
	Log      string            `json:"log,omitempty"`
}

func Transaction

func Transaction(hash []byte) (*TransactionResponse, error)

type TxCommissionResponse added in v0.8.0

type TxCommissionResponse struct {
	Commission *big.Int `json:"commission"`
}

func EstimateTxCommission added in v0.2.0

func EstimateTxCommission(tx []byte, height int) (*TxCommissionResponse, error)

type ValidatorResponse added in v0.8.0

type ValidatorResponse struct {
	Pubkey      types.Pubkey `json:"pubkey"`
	VotingPower int64        `json:"voting_power"`
}

Jump to

Keyboard shortcuts

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