service

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package pkg comments for pkg block service 块相关数据封装

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCode

func CheckCode(email, code string) bool

CheckCode 验证码校验

func CheckEnv added in v0.0.3

func CheckEnv() error

func CheckSession

func CheckSession(token string) (*models.Account, error)

func CreateNode

func CreateNode(name, baseURL, nodeType, nodeVersion, secretKey string) error

func DeleteNodeByName

func DeleteNodeByName(name string) error

func Doctor added in v0.0.3

func Doctor() error

func Login

func Login(mail, password string) (*session, error)

func Logout

func Logout(uid int64) error

func QueryAccount added in v0.0.4

func QueryAccount(node *Node, addr string) (json.RawMessage, error)

func SendCode

func SendCode(mailSmtpServer, mailUser, mailPassword, email string) error

SendCode 发送短信验证码

Types

type Env added in v0.0.3

type Env struct {
	EmailSmtpServer string
	EmailUser       string
	EmailPassword   string
}

func GetEnv added in v0.0.3

func GetEnv() Env

type Genesis

type Genesis struct {
	ID          int64     `json:"id"`           // id
	ChainID     string    `json:"chain_id"`     // chain_id
	GenesisTime time.Time `json:"genesis_time"` // genesis_time
	Data        string    `json:"data"`         // data
	CreatedAt   time.Time `json:"created_at"`   // created_at
}

type NetworkSpider added in v0.0.4

type NetworkSpider struct {
	// contains filtered or unexported fields
}

func NewNetworkSpider added in v0.0.4

func NewNetworkSpider(chainID string, remote string) *NetworkSpider

func (*NetworkSpider) Check added in v0.0.4

func (ns *NetworkSpider) Check()

func (*NetworkSpider) Run added in v0.0.4

func (ns *NetworkSpider) Run()

func (*NetworkSpider) Save added in v0.0.4

func (ns *NetworkSpider) Save()

type Node

type Node struct {
	Name        string          `json:"name"`    // name
	BaseURL     string          `json:"baseUrl"` // base_url
	SecretKey   string          `json:"-"`       // secret_key
	ChanID      string          `json:"chanId"`
	NodeType    string          `json:"nodeType"`
	NodeVersion version.Version `json:"nodeVersion"`
	Routers     []Route         `json:"routers"`
}

func AllNodes

func AllNodes() ([]*Node, error)

func GetNodeByName

func GetNodeByName(name string) (*Node, error)

func (Node) AppState

func (n Node) AppState(cdc *amino.Codec) (*qbasetypes.GenesisState, error)

func (Node) Bech32PrefixConsPub added in v0.0.4

func (n Node) Bech32PrefixConsPub() string

func (Node) BlockTimeAvg added in v0.0.4

func (n Node) BlockTimeAvg(blockNum int) (time.Duration, error)

Search 最近N块平均打快时间

func (Node) BlockValidatorByAddress added in v0.0.4

func (n Node) BlockValidatorByAddress(address string, minHeight, maxHeight int64) ([]*types.BlockValidator, error)

ListBlockValidatorByAddress 查询

func (Node) BlockValidatorsByHeight added in v0.0.4

func (n Node) BlockValidatorsByHeight(height int64) ([]*types.BlockValidator, error)

ListBlockValidatorByHeight 查询

func (Node) Blocks added in v0.0.4

func (n Node) Blocks(minHeight, maxHeight, offset, limit int64) ([]*types.ResultBlockBase, error)

Search 块查询

func (Node) ChainStatus added in v0.0.4

func (n Node) ChainStatus(cached bool) (*types.ResultStatus, error)

func (Node) ConsensusState added in v0.0.4

func (n Node) ConsensusState() (*types.ResultConsensusState, error)

func (Node) CreateBlock added in v0.0.4

func (n Node) CreateBlock(b *types.Block) error

func (Node) CreateEvidence added in v0.0.4

func (n Node) CreateEvidence(b *types.Block) error

func (Node) CreatePeers added in v0.0.4

func (n Node) CreatePeers(peers []tmtypes.Peer) error

func (Node) CreateValidator added in v0.0.4

func (n Node) CreateValidator(vl types.Validator) error

func (Node) Evidences added in v0.0.4

func (n Node) Evidences(validator string) ([]*types.ResultEvidence, error)

Evidence evidence查询

func (Node) Fee added in v0.0.4

func (n Node) Fee(tx string) (*types.ResultFee, error)

Fee fee查询

func (Node) HasTxBlocks added in v0.0.4

func (n Node) HasTxBlocks(minHeight, maxHeight int64) ([]*types.ResultBlockBase, error)

HasTx 有交易的块

func (Node) InactiveValidator added in v0.0.4

func (n Node) InactiveValidator(address string, status int, inactiveHeight int64, inactiveTime time.Time) error

func (Node) LatestBlock added in v0.0.4

func (n Node) LatestBlock() (*types.ResultBlockBase, error)

Latest最新的块

func (Node) Missings added in v0.0.4

func (n Node) Missings(validator string) ([]*types.ResultMissing, error)

Missing missing查询

func (Node) NetworkSpider added in v0.0.4

func (n Node) NetworkSpider(ctx context.Context)

func (Node) Peers added in v0.0.4

func (n Node) Peers() (*types.ResultPeers, error)

Peers 查询所有peer

func (Node) RetrieveBlock added in v0.0.4

func (n Node) RetrieveBlock(height int64) (*types.ResultBlockBase, error)

Retrieve 块查询

func (Node) RetrieveBlockValidator added in v0.0.4

func (n Node) RetrieveBlockValidator(height int64, validatorAddress string) (*types.BlockValidator, error)

Search 单个查询

func (Node) RetrieveGenesis added in v0.0.4

func (n Node) RetrieveGenesis(chainID string) (*Genesis, error)

func (Node) RetrieveValidator added in v0.0.4

func (n Node) RetrieveValidator(address string) (*types.Validator, error)

RetrieveValidator 单个查询

func (Node) SaveBlockValidator added in v0.0.4

func (n Node) SaveBlockValidator(vars []*types.BlockValidator) error

func (Node) Tx added in v0.0.4

func (n Node) Tx(height, index int64) (*types.ResultTx, error)

Search 交易查询

func (Node) TxByHash added in v0.0.4

func (n Node) TxByHash(hash string) (*types.ResultTx, error)

Search 交易查询

func (Node) TxSend added in v0.0.4

func (n Node) TxSend(remote string, txData []byte) (*types.TxSendResult, error)

TxSend

func (Node) Txs added in v0.0.4

func (n Node) Txs(minHeight, maxHeight, offset, limit int64) ([]*types.ResultTx, error)

List 交易查询

func (Node) TxsByAddress added in v0.0.4

func (n Node) TxsByAddress(address string, tx string, minHeight, maxHeight int64, offset, limit int) ([]*types.ResultTx, error)

TxsByAddress 交易查询

func (Node) UpdateConsensusState added in v0.0.4

func (n Node) UpdateConsensusState(cs *tmctypes.ResultConsensusState) error

UpdateConsensusState 更新共识状态

func (Node) UpdateValidatorBlock added in v0.0.4

func (n Node) UpdateValidatorBlock(address string, height int64, t time.Time) error

func (Node) ValidNodes added in v0.0.4

func (n Node) ValidNodes() ([]*types.ChainNode, error)

func (Node) Validators added in v0.0.4

func (n Node) Validators() (types.Validators, error)

Validators 查询链所有的validator

type Route added in v0.0.4

type Route struct {
	Route  string `json:"route"`
	Hidden bool   `json:"hidden"`
}

Directories

Path Synopsis
Package pkg comments for pkg account account 管理后台相关功能
Package pkg comments for pkg account account 管理后台相关功能
Package pkg comments for pkg auth auth 请求鉴权
Package pkg comments for pkg auth auth 请求鉴权

Jump to

Keyboard shortcuts

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