api

package
v0.0.0-...-c04c664 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: MIT Imports: 37 Imported by: 0

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,page,perPage"),
	"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,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,gas_price,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"),
	"btc_deposit_address":       rpcserver.NewRPCFunc(BtcDepositAddress, "height"),
	"mnt_deposit_address":       rpcserver.NewRPCFunc(MntDepositAddress, "height"),
	"unsigned_btc_utxos":        rpcserver.NewRPCFunc(UnsignedBtcUtxos, "pub_key"),
	"unsigned_mnt_checkpoint":   rpcserver.NewRPCFunc(UnsignedMntCheckpoint, "pub_key"),
	"last_finalized_checkpoint": rpcserver.NewRPCFunc(LastFinalizedCheckpoint, "net"),
	"last_header":               rpcserver.NewRPCFunc(LastHeaderCheckpoint, "net"),
}

Functions

func Addresses

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

func Candidates

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

func Genesis

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

func GetStateForHeight

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

func Handler

func Handler(h http.Handler) http.Handler

func MaxGas

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

func MinGasPrice

func MinGasPrice() (uint64, error)

func NetInfo

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

func RegisterCryptoAmino

func RegisterCryptoAmino(cdc *amino.Codec)

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

func RegisterEvidenceMessages

func RegisterEvidenceMessages(cdc *amino.Codec)

func RunAPI

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

func SendTransaction

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

func Transactions

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

func UnconfirmedTxs

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

Types

type AddressResponse

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

func Address

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

type AddressesResponse

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

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

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

type BtcAddress

type BtcAddress struct {
	Address string `json:"address"`
	Data    string `json:"data"`
}

type BtcDepositAddressResponse

type BtcDepositAddressResponse struct {
	Addresses []BtcAddress `json:"addresses"`
}

func BtcDepositAddress

func BtcDepositAddress(height int) (*BtcDepositAddressResponse, error)

type CandidateResponse

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

func Candidate

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

type CoinInfoResponse

type CoinInfoResponse struct {
	Symbol string `json:"symbol"`
	Volume string `json:"volume"`
}

func CoinInfo

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

type EstimateCoinBuyResponse

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

func EstimateCoinBuy

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

type EstimateCoinSellAllResponse

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

func EstimateCoinSellAll

func EstimateCoinSellAll(
	coinToSellString string, coinToBuyString string, valueToSell *big.Int, gasPrice uint64, height int) (*EstimateCoinSellAllResponse,
	error)

type EstimateCoinSellResponse

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

func EstimateCoinSell

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

type EventsResponse

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

func Events

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

type LastFinalizedCheckpointResponse

type LastFinalizedCheckpointResponse struct {
	Checkpoint string `json:"checkpoint"`
	Height     uint64 `json:"height"`
}

func LastFinalizedCheckpoint

func LastFinalizedCheckpoint(net string) (*LastFinalizedCheckpointResponse, error)

type LastHeaderResponse

type LastHeaderResponse struct {
	Hash string `json:"hash"`
}

func LastHeaderCheckpoint

func LastHeaderCheckpoint(net string) (*LastHeaderResponse, error)

type MissedBlocksResponse

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

func MissedBlocks

func MissedBlocks(pubkey types.Pubkey, height int) (*MissedBlocksResponse, error)

type MntDepositAddressResponse

type MntDepositAddressResponse struct {
	Address string `json:"address"`
}

func MntDepositAddress

func MntDepositAddress(height int) (*MntDepositAddressResponse, error)

type Response

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

type ResponseValidators

type ResponseValidators []ValidatorResponse

func Validators

func Validators(height uint64, page, perPage int) (*ResponseValidators, error)

type ResultTxSearch

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

type Stake

type Stake struct {
	Owner    string `json:"owner"`
	Coin     string `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  string            `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"`
}

func Transaction

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

type TxCommissionResponse

type TxCommissionResponse struct {
	Commission string `json:"commission"`
}

func EstimateTxCommission

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

type UnsignedBtcUtxosResponse

type UnsignedBtcUtxosResponse struct {
	Hashes []string `json:"hashes"`
}

func UnsignedBtcUtxos

func UnsignedBtcUtxos(pubkey types.SignatoryPubkey) (*UnsignedBtcUtxosResponse, error)

type UnsignedMntCheckpointResponse

type UnsignedMntCheckpointResponse struct {
	Hash string `json:"hash"`
}

type Utxo

type Utxo struct {
	Txid string `json:"txid"`
	Vout uint32 `json:"vout"`
}

type ValidatorResponse

type ValidatorResponse struct {
	Pubkey      string `json:"pub_key"`
	VotingPower int64  `json:"voting_power"`
}

Directories

Path Synopsis
v2

Jump to

Keyboard shortcuts

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