Documentation
¶
Index ¶
- Constants
- Variables
- type AssetEquityBatchRsp
- type AssetEquityBatchRspMarshaling
- type CandidateInfo
- type CandidateListRes
- type DeputyNodeInfo
- type Node
- type PrivateAccountAPI
- type PublicAccountAPI
- func (a *PublicAccountAPI) GetAccount(LemoAddress string) (*types.AccountData, error)
- func (a *PublicAccountAPI) GetAsset(assetCode common.Hash) (*types.Asset, error)
- func (a *PublicAccountAPI) GetAssetEquity(LemoAddress string, index, limit int) (*AssetEquityBatchRsp, error)
- func (a *PublicAccountAPI) GetAssetEquityByAssetCode(LemoAddress string, assetCode common.Hash, index, limit int) (*AssetEquityBatchRsp, error)
- func (a *PublicAccountAPI) GetAssetEquityByAssetId(LemoAddress string, assetId common.Hash) (*types.AssetEquity, error)
- func (a *PublicAccountAPI) GetBalance(LemoAddress string) (string, error)
- func (a *PublicAccountAPI) GetMetaData(assetId common.Hash) (*database.MetaData, error)
- type PublicChainAPI
- func (c *PublicChainAPI) ChainID() uint16
- func (c *PublicChainAPI) CurrentBlock(withBody bool) *types.Block
- func (c *PublicChainAPI) GasPriceAdvice() *big.Int
- func (c *PublicChainAPI) Genesis() *types.Block
- func (c *PublicChainAPI) GetAllRewardValue() (coreParams.RewardsMap, error)
- func (c *PublicChainAPI) GetBlockByHash(hash string, withBody bool) *types.Block
- func (c *PublicChainAPI) GetBlockByHeight(height uint32, withBody bool) *types.Block
- func (c *PublicChainAPI) GetCandidateList(index, size int) (*CandidateListRes, error)
- func (c *PublicChainAPI) GetCandidateTop30() []*CandidateInfo
- func (c *PublicChainAPI) GetDeputyNodeList(onlyBlockSigner bool) []*DeputyNodeInfo
- func (c *PublicChainAPI) GetTermReward(height uint32) (*TermRewardInfo, error)
- func (c *PublicChainAPI) NodeVersion() string
- type PublicTxAPI
- func (t *PublicTxAPI) CreateAsset(prv string, category, decimals uint32, isReplenishable, isDivisible bool) (common.Hash, error)
- func (t *PublicTxAPI) GetAssetTxList(lemoAddress string, assetCodeOrId common.Hash, index int, size int) (*TxListRes, error)
- func (t *PublicTxAPI) GetTxByHash(hash string) (*store.VTransactionDetail, error)
- func (t *PublicTxAPI) GetTxListByAddress(lemoAddress string, index int, size int) (*TxListRes, error)
- func (t *PublicTxAPI) GetTxListByTimestamp(lemoAddress string, beginTime int64, endTime int64, index int, size int) (*TxListRes, error)
- func (t *PublicTxAPI) IssueAsset(prv string, receiver common.Address, assetCode common.Hash, amount *big.Int, ...) (common.Hash, error)
- func (t *PublicTxAPI) ModifyAsset(prv string, assetCode common.Hash) (common.Hash, error)
- func (t *PublicTxAPI) ReplenishAsset(prv string, receiver common.Address, assetCode, assetId common.Hash, ...) (common.Hash, error)
- func (t *PublicTxAPI) SendReimbursedGasTx(senderPrivate, gasPayerPrivate string, from, to, gasPayer common.Address, ...) (common.Hash, error)
- func (t *PublicTxAPI) SendTx(tx *types.Transaction) (common.Hash, error)
- func (t *PublicTxAPI) TransferAsset(prv string, to common.Address, assetCode, assetId common.Hash, amount *big.Int, ...) (common.Hash, error)
- type TermRewardInfo
- type TxListRes
Constants ¶
const ( MaxTxToNameLength = 100 MaxTxMessageLength = 1024 )
Variables ¶
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 AssetEquityBatchRsp ¶
type AssetEquityBatchRsp struct {
Equities []*types.AssetEquity `json:"equities" gencodec:"required"`
Total uint32 `json:"total" gencodec:"required"`
}
func (AssetEquityBatchRsp) MarshalJSON ¶ added in v1.2.0
func (a AssetEquityBatchRsp) MarshalJSON() ([]byte, error)
MarshalJSON marshals as JSON.
func (*AssetEquityBatchRsp) UnmarshalJSON ¶ added in v1.2.0
func (a *AssetEquityBatchRsp) UnmarshalJSON(input []byte) error
UnmarshalJSON unmarshals from JSON.
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 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) GetAssetEquity ¶
func (a *PublicAccountAPI) GetAssetEquity(LemoAddress string, index, limit int) (*AssetEquityBatchRsp, error)
func (*PublicAccountAPI) GetAssetEquityByAssetCode ¶
func (a *PublicAccountAPI) GetAssetEquityByAssetCode(LemoAddress string, assetCode common.Hash, index, limit int) (*AssetEquityBatchRsp, error)
func (*PublicAccountAPI) GetAssetEquityByAssetId ¶
func (a *PublicAccountAPI) GetAssetEquityByAssetId(LemoAddress string, assetId common.Hash) (*types.AssetEquity, error)
GetAssetEquity returns asset equity
func (*PublicAccountAPI) GetBalance ¶
func (a *PublicAccountAPI) GetBalance(LemoAddress string) (string, error)
GetBalance get balance in mo
func (*PublicAccountAPI) GetMetaData ¶
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) 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 (*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 ¶
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
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
MarshalJSON marshals as JSON.
func (*TxListRes) UnmarshalJSON ¶ added in v1.2.0
UnmarshalJSON unmarshals from JSON.