api

package
v1.2.1-lite-1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: MIT Imports: 30 Imported by: 4

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,include_stakes"),
	"candidate":              rpcserver.NewRPCFunc(Candidate, "pub_key,height"),
	"validators":             rpcserver.NewRPCFunc(Validators, "height"),
	"address":                rpcserver.NewRPCFunc(Address, "address,height"),
	"addresses":              rpcserver.NewRPCFunc(Addresses, "addresses,height"),
	"send_transaction":       rpcserver.NewRPCFunc(SendTransaction, "tx"),
	"transaction":            rpcserver.NewRPCFunc(Transaction, "hash"),
	"transactions":           rpcserver.NewRPCFunc(Transactions, "query,page,perPage"),
	"block":                  rpcserver.NewRPCFunc(Block, "height"),
	"events":                 rpcserver.NewRPCFunc(Events, "height"),
	"net_info":               rpcserver.NewRPCFunc(NetInfo, ""),
	"coin_info":              rpcserver.NewRPCFunc(CoinInfo, "symbol,id,height"),
	"estimate_coin_sell":     rpcserver.NewRPCFunc(EstimateCoinSell, "coin_to_sell,coin_to_buy,value_to_sell,height"),
	"estimate_coin_sell_all": rpcserver.NewRPCFunc(EstimateCoinSellAll, "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"),
	"max_gas":                rpcserver.NewRPCFunc(MaxGas, "height"),
	"min_gas_price":          rpcserver.NewRPCFunc(MinGasPrice, ""),
	"genesis":                rpcserver.NewRPCFunc(Genesis, ""),
	"missed_blocks":          rpcserver.NewRPCFunc(MissedBlocks, "pub_key,height"),
	"waitlist":               rpcserver.NewRPCFunc(Waitlist, "pub_key,address,height"),
}

Functions

func Addresses added in v0.14.1

func Addresses(addresses []types.Address, height int) (*[]AddressesResponse, error)

func Candidates added in v0.8.0

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

func Genesis added in v0.16.0

func Genesis() (*core_types.ResultGenesis, error)

func GetStateForHeight added in v0.8.0

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

func Handler added in v0.8.0

func Handler(h http.Handler) http.Handler

func MaxGas added in v0.9.0

func MaxGas(height int) (*uint64, error)

func MinGasPrice added in v0.10.0

func MinGasPrice() (uint64, error)

func NetInfo added in v0.1.2

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

func RunAPI added in v0.14.0

func RunAPI(codec *amino.Codec, b *minter.Blockchain, tmRPC *rpc.Local, cfg *config.Config, logger log.Logger)

RunAPI start

func SendTransaction

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

func Transaction

func Transaction(hash []byte) (json.RawMessage, error)

func Transactions

func Transactions(query string, page, perPage int) (*[]json.RawMessage, 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          []BalanceItem `json:"balances"`
	TransactionCount uint64        `json:"transaction_count"`
}

func Address added in v0.8.0

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

type AddressesResponse added in v0.14.1

type AddressesResponse struct {
	Address          string        `json:"address"`
	Balance          []BalanceItem `json:"balance"`
	TransactionCount uint64        `json:"transaction_count"`
}

type BalanceItem added in v1.2.0

type BalanceItem struct {
	CoinID uint32 `json:"coin_id"`
	Symbol string `json:"symbol"`
	Value  string `json:"value"`
}

type BlockResponse

type BlockResponse struct {
	Hash         string                     `json:"hash"`
	Height       int64                      `json:"height"`
	Time         time.Time                  `json:"time"`
	NumTxs       int64                      `json:"num_txs"`
	Transactions []BlockTransactionResponse `json:"transactions"`
	BlockReward  string                     `json:"block_reward"`
	Size         int                        `json:"size"`
	Proposer     *string                    `json:"proposer,omitempty"`
	Validators   []BlockValidatorResponse   `json:"validators,omitempty"`
	Evidence     tmTypes.EvidenceData       `json:"evidence,omitempty"`
}

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    uint32            `json:"gas_price"`
	Type        uint8             `json:"type"`
	Data        json.RawMessage   `json:"data"`
	Payload     []byte            `json:"payload"`
	ServiceData []byte            `json:"service_data"`
	Gas         int64             `json:"gas"`
	GasCoin     string            `json:"gas_coin"`
	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:"pub_key"`
	Signed bool   `json:"signed"`
}

type CandidateResponse added in v0.8.0

type CandidateResponse struct {
	RewardAddress string  `json:"reward_address"`
	OwnerAddress  string  `json:"owner_address"`
	TotalStake    string  `json:"total_stake"`
	PubKey        string  `json:"pub_key"`
	Commission    uint32  `json:"commission"`
	Stakes        []Stake `json:"stakes,omitempty"`
	Status        byte    `json:"status"`
}

func Candidate

func Candidate(pubkey types.Pubkey, height int) (*CandidateResponse, error)

type Coin added in v1.2.0

type Coin struct {
	ID     uint32 `json:"id"`
	Symbol string `json:"symbol"`
}

type CoinInfoResponse

type CoinInfoResponse struct {
	ID             uint32  `json:"id"`
	Name           string  `json:"name"`
	Symbol         string  `json:"symbol"`
	Volume         string  `json:"volume"`
	Crr            uint32  `json:"crr"`
	ReserveBalance string  `json:"reserve_balance"`
	MaxSupply      string  `json:"max_supply"`
	OwnerAddress   *string `json:"owner_address"`
}

func CoinInfo added in v0.8.0

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

type EstimateCoinBuyResponse added in v0.1.2

type EstimateCoinBuyResponse struct {
	WillPay    string `json:"will_pay"`
	Commission string `json:"commission"`
}

EstimateCoinBuyResponse returns an estimate of buy coin transaction

func EstimateCoinBuy added in v0.0.6

func EstimateCoinBuy(coinToSell, coinToBuy string, valueToBuy *big.Int, height int) (*EstimateCoinBuyResponse, error)

EstimateCoinBuy returns an estimate of buy coin transaction

type EstimateCoinSellAllResponse added in v0.18.0

type EstimateCoinSellAllResponse struct {
	WillGet string `json:"will_get"`
}

EstimateCoinSellAllResponse returns an of sell all coin transaction

func EstimateCoinSellAll added in v0.18.0

func EstimateCoinSellAll(coinToSell, coinToBuy string, valueToSell *big.Int, height int) (*EstimateCoinSellAllResponse,
	error)

EstimateCoinSellAll returns an estimate of sell all coin transaction

type EstimateCoinSellResponse added in v0.1.2

type EstimateCoinSellResponse struct {
	WillGet    string `json:"will_get"`
	Commission string `json:"commission"`
}

EstimateCoinSellResponse returns an estimate of sell coin transaction

func EstimateCoinSell added in v0.0.6

func EstimateCoinSell(coinToSell, coinToBuy string, valueToSell *big.Int, height int) (*EstimateCoinSellResponse, error)

EstimateCoinSell returns an estimate of sell coin transaction

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 uint64) (*EventsResponse, error)

type MissedBlocksResponse added in v1.0.2

type MissedBlocksResponse struct {
	MissedBlocks      *types.BitArray `json:"missed_blocks"`
	MissedBlocksCount int             `json:"missed_blocks_count"`
}

func MissedBlocks added in v1.0.2

func MissedBlocks(pubkey types.Pubkey, height int) (*MissedBlocksResponse, 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 uint64) (*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    string `json:"owner"`
	Coin     Coin   `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"`
	KeepLastStates    int64                    `json:"keep_last_states"`
	TmStatus          *core_types.ResultStatus `json:"tm_status"`
}

func Status

func Status() (*StatusResponse, error)

type TransactionResponse

type TransactionResponse struct {
	Hash     string            `json:"hash"`
	RawTx    string            `json:"raw_tx"`
	Height   int64             `json:"height"`
	Index    uint32            `json:"index"`
	From     string            `json:"from"`
	Nonce    uint64            `json:"nonce"`
	Gas      int64             `json:"gas"`
	GasPrice uint32            `json:"gas_price"`
	GasCoin  Coin              `json:"gas_coin"`
	Type     uint8             `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"`
}

type TxCommissionResponse added in v0.8.0

type TxCommissionResponse struct {
	Commission string `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      string `json:"pub_key"`
	VotingPower int64  `json:"voting_power"`
}

type Wait added in v1.2.0

type Wait struct {
	Coin  Coin   `json:"coin"`
	Value string `json:"value"`
}

type WaitlistResponse added in v1.2.0

type WaitlistResponse struct {
	List []*Wait `json:"list"`
}

func Waitlist added in v1.2.0

func Waitlist(pubkey types.Pubkey, address types.Address, height int) (*WaitlistResponse, error)

Directories

Path Synopsis
v2

Jump to

Keyboard shortcuts

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