node

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: LGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxTxToNameLength  = 100
	MaxTxMessageLength = 1024
)

Variables

View Source
var (
	ErrToName         = errors.New("the length of toName field in transaction is out of max length limit")
	ErrTxMessage      = errors.New("the length of message field in transaction is out of max length limit")
	ErrCreateContract = errors.New("the data of create contract transaction can't be null")
	ErrSpecialTx      = errors.New("the data of special transaction can't be null")
	ErrTxType         = errors.New("the transaction type does not exit")
)

Functions

This section is empty.

Types

type CandidateInfo

type CandidateInfo struct {
	CandidateAddress string            `json:"address" gencodec:"required"`
	Votes            string            `json:"votes" gencodec:"required"`
	Profile          map[string]string `json:"profile"  gencodec:"required"`
}

func (CandidateInfo) MarshalJSON

func (c CandidateInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*CandidateInfo) UnmarshalJSON

func (c *CandidateInfo) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type CandidateListRes

type CandidateListRes struct {
	CandidateList []*CandidateInfo `json:"candidateList" gencodec:"required"`
	Total         uint32           `json:"total" gencodec:"required"`
}

func (CandidateListRes) MarshalJSON

func (c CandidateListRes) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*CandidateListRes) UnmarshalJSON

func (c *CandidateListRes) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type DeputyNodeInfo added in v1.2.0

type DeputyNodeInfo struct {
	MinerAddress  common.Address `json:"minerAddress"   gencodec:"required"` // candidate account address
	IncomeAddress common.Address `json:"incomeAddress" gencodec:"required"`
	NodeID        []byte         `json:"nodeID"         gencodec:"required"`
	Rank          uint32         `json:"rank"           gencodec:"required"` // start from 0
	Votes         *big.Int       `json:"votes"          gencodec:"required"`
	Host          string         `json:"host"          gencodec:"required"`
	Port          string         `json:"port"          gencodec:"required"`
	DepositAmount string         `json:"depositAmount"  gencodec:"required"` // 质押金额
	Introduction  string         `json:"introduction"  gencodec:"required"`  // 节点介绍
	P2pUri        string         `json:"p2pUri"  gencodec:"required"`        // p2p 连接用的定位符
}

func (DeputyNodeInfo) MarshalJSON added in v1.2.0

func (d DeputyNodeInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*DeputyNodeInfo) UnmarshalJSON added in v1.2.0

func (d *DeputyNodeInfo) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type EquityListRsp added in v1.2.2

type EquityListRsp struct {
	Equities []*types.AssetEquity `json:"equities" gencodec:"required"`
	Total    uint32               `json:"total" gencodec:"required"`
}

func (EquityListRsp) MarshalJSON added in v1.2.2

func (e EquityListRsp) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*EquityListRsp) UnmarshalJSON added in v1.2.2

func (e *EquityListRsp) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type EquityListRspMarshaling added in v1.2.2

type EquityListRspMarshaling struct {
	Total hexutil.Uint32
}

type Node

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

func New

func New(cfg *config.Config) (*Node, error)

func (*Node) Start

func (n *Node) Start() error

func (*Node) Stop

func (n *Node) Stop() error

type PrivateAccountAPI

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

Private

func NewPrivateAccountAPI

func NewPrivateAccountAPI(node *Node) *PrivateAccountAPI

NewPrivateAccountAPI

func (*PrivateAccountAPI) NewKeyPair

func (a *PrivateAccountAPI) NewKeyPair() (*crypto.AccountKey, error)

NewAccount get lemo address api

type PublicAccountAPI

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

PublicAccountAPI API for access to account information

func NewPublicAccountAPI

func NewPublicAccountAPI(node *Node) *PublicAccountAPI

NewPublicAccountAPI

func (*PublicAccountAPI) GetAccount

func (a *PublicAccountAPI) GetAccount(LemoAddress string) (*types.AccountData, error)

GetAccount return the struct of the &AccountData{}

func (*PublicAccountAPI) GetAsset

func (a *PublicAccountAPI) GetAsset(assetCode common.Hash) (*types.Asset, error)

func (*PublicAccountAPI) GetAssetToken added in v1.2.2

func (a *PublicAccountAPI) GetAssetToken(assetId common.Hash) (*database.AssetToken, error)

func (*PublicAccountAPI) GetBalance

func (a *PublicAccountAPI) GetBalance(LemoAddress string) (string, error)

GetBalance get balance in mo

func (*PublicAccountAPI) GetEquity added in v1.2.2

func (a *PublicAccountAPI) GetEquity(LemoAddress string, assetId common.Hash) (*types.AssetEquity, error)

GetEquity returns asset equity

func (*PublicAccountAPI) GetEquityList added in v1.2.2

func (a *PublicAccountAPI) GetEquityList(LemoAddress string, index, limit int) (*EquityListRsp, error)

func (*PublicAccountAPI) GetEquityListByAssetCode added in v1.2.2

func (a *PublicAccountAPI) GetEquityListByAssetCode(LemoAddress string, assetCode common.Hash, index, limit int) (*EquityListRsp, error)

type PublicChainAPI

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

ChainAPI

func NewPublicChainAPI

func NewPublicChainAPI(node *Node) *PublicChainAPI

NewChainAPI API for access to chain information

func (*PublicChainAPI) ChainID

func (c *PublicChainAPI) ChainID() uint16

ChainID get chain id

func (*PublicChainAPI) CurrentBlock

func (c *PublicChainAPI) CurrentBlock(withBody bool) *types.Block

CurrentBlock get the current latest block

func (*PublicChainAPI) GasPriceAdvice

func (c *PublicChainAPI) GasPriceAdvice() *big.Int

GasPriceAdvice get suggest gas price

func (*PublicChainAPI) Genesis

func (c *PublicChainAPI) Genesis() *types.Block

Genesis get the creation block

func (*PublicChainAPI) GetAllRewardValue added in v1.2.0

func (c *PublicChainAPI) GetAllRewardValue() (coreParams.RewardsMap, error)

GetAllRewardValue get the value for each bonus

func (*PublicChainAPI) GetBlockByHash

func (c *PublicChainAPI) GetBlockByHash(hash string, withBody bool) *types.Block

GetBlockByHash get block information by hash

func (*PublicChainAPI) GetBlockByHeight

func (c *PublicChainAPI) GetBlockByHeight(height uint32, withBody bool) *types.Block

GetBlockByNumber get block information by height

func (*PublicChainAPI) GetCandidateList

func (c *PublicChainAPI) GetCandidateList(index, size int) (*CandidateListRes, error)

// GetCandidateNodeList get all candidate node list information and return total candidate node

func (*PublicChainAPI) GetCandidateTop30

func (c *PublicChainAPI) GetCandidateTop30() []*CandidateInfo

GetCandidateTop30 get top 30 candidate node

func (*PublicChainAPI) GetDeputyNodeList

func (c *PublicChainAPI) GetDeputyNodeList(onlyBlockSigner bool) []*DeputyNodeInfo

GetDeputyNodeList get deputy nodes who are in charge

func (*PublicChainAPI) GetTermReward added in v1.2.0

func (c *PublicChainAPI) GetTermReward(height uint32) (*TermRewardInfo, error)

func (*PublicChainAPI) NodeVersion added in v1.2.0

func (c *PublicChainAPI) NodeVersion() string

GetServerVersion

type PublicTxAPI

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

TXAPI

func NewPublicTxAPI

func NewPublicTxAPI(node *Node) *PublicTxAPI

NewTxAPI API for send a transaction

func (*PublicTxAPI) CreateAsset

func (t *PublicTxAPI) CreateAsset(prv string, category, decimals uint32, isReplenishable, isDivisible bool) (common.Hash, error)

CreateAsset 创建资产

func (*PublicTxAPI) GetAssetTxList added in v1.2.0

func (t *PublicTxAPI) GetAssetTxList(lemoAddress string, assetCodeOrId common.Hash, index int, size int) (*TxListRes, error)

GetAssetTxList 通过assetCode或者assetId获取与此地址相关的交易列表

func (*PublicTxAPI) GetTxByHash

func (t *PublicTxAPI) GetTxByHash(hash string) (*store.VTransactionDetail, error)

// GetTxByHash pull the specified transaction through a transaction hash

func (*PublicTxAPI) GetTxListByAddress

func (t *PublicTxAPI) GetTxListByAddress(lemoAddress string, index int, size int) (*TxListRes, error)

// GetTxListByAddress pull the list of transactions

func (*PublicTxAPI) GetTxListByTimestamp

func (t *PublicTxAPI) GetTxListByTimestamp(lemoAddress string, beginTime int64, endTime int64, index int, size int) (*TxListRes, error)

func (*PublicTxAPI) GetTxListByType added in v1.2.2

func (t *PublicTxAPI) GetTxListByType(lemoAddress string, txType uint16, index int, size int) (*TxListRes, error)

GetTxListByType 通过交易类型获取与此地址相关的交易列表

func (*PublicTxAPI) IssueAsset

func (t *PublicTxAPI) IssueAsset(prv string, receiver common.Address, assetCode common.Hash, amount *big.Int, metaData string) (common.Hash, error)

发行资产

func (*PublicTxAPI) ModifyAsset

func (t *PublicTxAPI) ModifyAsset(prv string, assetCode common.Hash) (common.Hash, error)

ModifyAsset 修改资产信息

func (*PublicTxAPI) ReplenishAsset

func (t *PublicTxAPI) ReplenishAsset(prv string, receiver common.Address, assetCode, assetId common.Hash, amount *big.Int) (common.Hash, error)

增发资产

func (*PublicTxAPI) SendReimbursedGasTx

func (t *PublicTxAPI) SendReimbursedGasTx(senderPrivate, gasPayerPrivate string, from, to, gasPayer common.Address, amount int64, data []byte, txType uint16, toName, message string) (common.Hash, error)

SendReimbursedGasTx gas代付交易 todo 测试使用

func (*PublicTxAPI) SendTx

func (t *PublicTxAPI) SendTx(tx *types.Transaction) (common.Hash, error)

Send send a transaction

func (*PublicTxAPI) TransferAsset added in v1.2.0

func (t *PublicTxAPI) TransferAsset(prv string, to common.Address, assetCode, assetId common.Hash, amount *big.Int, input []byte) (common.Hash, error)

交易资产

type TermRewardInfo added in v1.2.0

type TermRewardInfo struct {
	Term         uint32   `json:"term" gencodec:"required"`
	Value        *big.Int `json:"value" gencodec:"required"`
	RewardHeight uint32   `json:"rewardHeight" gencodec:"required"`
}

func (TermRewardInfo) MarshalJSON added in v1.2.0

func (t TermRewardInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*TermRewardInfo) UnmarshalJSON added in v1.2.0

func (t *TermRewardInfo) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type TxListRes

type TxListRes struct {
	VTransactions []*store.VTransaction `json:"txList" gencodec:"required"`
	Total         uint32                `json:"total" gencodec:"required"`
}

func (TxListRes) MarshalJSON added in v1.2.0

func (t TxListRes) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*TxListRes) UnmarshalJSON added in v1.2.0

func (t *TxListRes) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

Jump to

Keyboard shortcuts

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