api

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2020 License: MIT Imports: 40 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MaxNotifyBlocks = 100
)
View Source
const (
	MaxNotifyPovBlocks = 100
)

Variables

View Source
var (
	ErrIdentity  = errors.New("identity authentication failed")
	ErrMark      = errors.New("config is being modified by someone else")
	ErrOperation = errors.New("nothing has been modified")
)
View Source
var (
	ErrParameterNil = errors.New("parameter is nil")
)

Functions

func CreatePovSubscription added in v1.3.0

func CreatePovSubscription(ctx context.Context,
	fn func(notifier *rpc.Notifier, subscription *rpc.Subscription)) (*rpc.Subscription, error)

Types

type APIAccount added in v0.0.5

type APIAccount struct {
	Address        types.Address   `json:"account"`
	CoinBalance    *types.Balance  `json:"coinBalance,omitempty"`
	CoinVote       *types.Balance  `json:"vote,omitempty"`
	CoinNetwork    *types.Balance  `json:"network,omitempty"`
	CoinStorage    *types.Balance  `json:"storage,omitempty"`
	CoinOracle     *types.Balance  `json:"oracle,omitempty"`
	Representative *types.Address  `json:"representative,omitempty"`
	Tokens         []*APITokenMeta `json:"tokens"`
}

type APIAccountBalance added in v0.0.9

type APIAccountBalance struct {
	Address types.Address `json:"address"`
	Balance types.Balance `json:"balance"`
}

type APIAccountsBalance added in v1.2.3

type APIAccountsBalance struct {
	Balance types.Balance  `json:"balance"`
	Vote    *types.Balance `json:"vote,omitempty"`
	Network *types.Balance `json:"network,omitempty"`
	Storage *types.Balance `json:"storage,omitempty"`
	Oracle  *types.Balance `json:"oracle,omitempty"`
	Pending types.Balance  `json:"pending"`
}

type APIBalance added in v1.2.3

type APIBalance struct {
	*big.Float
}

func (*APIBalance) MarshalText added in v1.2.3

func (b *APIBalance) MarshalText() ([]byte, error)

func (*APIBalance) String added in v1.2.3

func (b *APIBalance) String() string

type APIBlock

type APIBlock struct {
	*types.StateBlock
	TokenName string        `json:"tokenName"`
	Amount    types.Balance `json:"amount"`
	Hash      types.Hash    `json:"hash"`

	PovConfirmHeight uint64 `json:"povConfirmHeight"`
	PovConfirmCount  uint64 `json:"povConfirmCount"`
}

type APIPending added in v0.0.5

type APIPending struct {
	*types.PendingKey
	*types.PendingInfo
	TokenName string `json:"tokenName"`
	Timestamp int64  `json:"timestamp"`

	BlockType types.BlockType `json:"blockType"`
}

type APIPendingInfo added in v1.3.0

type APIPendingInfo struct {
	*types.PendingKey
	*types.PendingInfo
	TokenName string `json:"tokenName"`
	Timestamp int64  `json:"timestamp"`
	Used      bool   `json:"used"`
}

type APIRepresentative added in v0.0.5

type APIRepresentative struct {
	Address types.Address `json:"address"`
	Balance types.Balance `json:"balance"`
	Vote    types.Balance `json:"vote"`
	Network types.Balance `json:"network"`
	Storage types.Balance `json:"storage"`
	Oracle  types.Balance `json:"oracle"`
	Total   types.Balance `json:"total"`
}

type APISendBlockPara added in v0.0.5

type APISendBlockPara struct {
	From      types.Address `json:"from"`
	TokenName string        `json:"tokenName"`
	To        types.Address `json:"to"`
	Amount    types.Balance `json:"amount"`
	Sender    string        `json:"sender"`
	Receiver  string        `json:"receiver"`
	Message   types.Hash    `json:"message"`
}

type APITokenMeta added in v0.0.5

type APITokenMeta struct {
	*types.TokenMeta
	TokenName string        `json:"tokenName"`
	Pending   types.Balance `json:"pending"`
}

type APIUncheckBlock added in v1.2.3

type APIUncheckBlock struct {
	Block       *types.StateBlock      `json:"block"`
	Hash        types.Hash             `json:"hash"`
	Link        types.Hash             `json:"link"`
	UnCheckType string                 `json:"uncheckType"`
	SyncType    types.SynchronizedKind `json:"syncType"`
	Height      uint64                 `json:"povHeight"`
}

type AccountApi added in v0.0.5

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

func NewAccountApi added in v0.0.5

func NewAccountApi() *AccountApi

func (*AccountApi) Create added in v0.0.5

func (a *AccountApi) Create(seedStr string, i *uint32) (map[string]string, error)

func (*AccountApi) ForPublicKey added in v0.0.5

func (a *AccountApi) ForPublicKey(pubStr string) (types.Address, error)

func (*AccountApi) NewAccounts added in v1.2.2

func (a *AccountApi) NewAccounts(count *uint32) ([]*Accounts, error)

func (*AccountApi) NewSeed added in v1.1.0

func (a *AccountApi) NewSeed() (string, error)

func (*AccountApi) PublicKey added in v0.0.5

func (a *AccountApi) PublicKey(addr types.Address) string

func (*AccountApi) Validate added in v0.0.5

func (a *AccountApi) Validate(addr string) bool

type Accounts added in v1.2.2

type Accounts struct {
	Seed       string `json:"seed"`
	PrivateKey string `json:"privateKey"`
	PublicKey  string `json:"publicKey"`
	Address    string `json:"address"`
}

type ApiTokenInfo added in v0.0.9

type ApiTokenInfo struct {
	types.TokenInfo
}

type BlackHoleApi added in v1.3.0

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

func NewBlackHoleApi added in v1.3.0

func NewBlackHoleApi(l *ledger.Ledger, eb event.EventBus) *BlackHoleApi

func (*BlackHoleApi) GetDestroyInfoDetail added in v1.3.0

func (b *BlackHoleApi) GetDestroyInfoDetail(addr *types.Address) ([]*cabi.DestroyInfo, error)

func (*BlackHoleApi) GetRewardsBlock added in v1.3.0

func (b *BlackHoleApi) GetRewardsBlock(send *types.Hash) (*types.StateBlock, error)

func (*BlackHoleApi) GetSendBlock added in v1.3.0

func (b *BlackHoleApi) GetSendBlock(param *cabi.DestroyParam) (*types.StateBlock, error)

func (*BlackHoleApi) GetTotalDestroyInfo added in v1.3.0

func (b *BlackHoleApi) GetTotalDestroyInfo(addr *types.Address) (types.Balance, error)

func (*BlackHoleApi) OnPovSyncState added in v1.3.0

func (b *BlackHoleApi) OnPovSyncState(state common.SyncState)

type BlockSubscriber added in v1.3.0

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

type BlockSubscription added in v1.3.0

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

BlockSubscription subscript event from chain, and deliver to every connected websocket

func NewBlockSubscription added in v1.3.0

func NewBlockSubscription(ctx context.Context, eb event.EventBus) *BlockSubscription

type ChainApi added in v1.3.0

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

func NewChainApi added in v1.3.0

func NewChainApi(l *ledger.Ledger) *ChainApi

func (*ChainApi) LedgerSize added in v1.3.0

func (c *ChainApi) LedgerSize() (map[string]int64, error)

func (*ChainApi) Version added in v1.3.0

func (c *ChainApi) Version() (map[string]string, error)

type ConfigApi added in v1.3.0

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

func NewConfigApi added in v1.3.0

func NewConfigApi(cfgFile string) *ConfigApi

func (*ConfigApi) Commit added in v1.3.0

func (c *ConfigApi) Commit(token string, mark string) (bool, error)

func (*ConfigApi) CurrentConfig added in v1.3.0

func (c *ConfigApi) CurrentConfig(token string) (*config.Config, error)

func (*ConfigApi) Difference added in v1.3.0

func (c *ConfigApi) Difference(token string, mark string) (string, error)

func (*ConfigApi) Save added in v1.3.0

func (c *ConfigApi) Save(token string, mark string) (bool, error)

func (*ConfigApi) Update added in v1.3.0

func (c *ConfigApi) Update(params []string, token string, mark string) (*config.Config, error)

type ContractApi added in v0.0.9

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

func NewContractApi added in v0.0.9

func NewContractApi(ledger *ledger.Ledger) *ContractApi

func (*ContractApi) ContractAddressList added in v1.2.0

func (c *ContractApi) ContractAddressList() []types.Address

func (*ContractApi) GetAbiByContractAddress added in v1.3.0

func (c *ContractApi) GetAbiByContractAddress(address types.Address) (string, error)

func (*ContractApi) PackContractData added in v0.0.9

func (c *ContractApi) PackContractData(abiStr string, methodName string, params []string) ([]byte, error)

type DebugApi added in v1.2.3

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

func NewDebugApi added in v1.2.3

func NewDebugApi(l *ledger.Ledger, eb event.EventBus) *DebugApi

func (*DebugApi) AccountPending added in v1.3.0

func (l *DebugApi) AccountPending(address types.Address, hash types.Hash) (*APIPendingInfo, error)

func (*DebugApi) Action added in v1.3.0

func (l *DebugApi) Action(t ledger.ActionType) (string, error)

func (*DebugApi) BlockCacheCount added in v1.2.3

func (l *DebugApi) BlockCacheCount() (map[string]uint64, error)

func (*DebugApi) BlockCaches added in v1.3.0

func (l *DebugApi) BlockCaches() ([]types.Hash, error)
func (l *DebugApi) BlockLink(hash types.Hash) (map[string]types.Hash, error)

func (*DebugApi) BlocksCountByType added in v1.3.0

func (l *DebugApi) BlocksCountByType(typ string) (map[string]int64, error)

func (*DebugApi) ContractCount added in v1.3.0

func (l *DebugApi) ContractCount() (map[string]int64, error)

func (*DebugApi) GetConsInfo added in v1.3.0

func (l *DebugApi) GetConsInfo() (map[string]interface{}, error)

func (*DebugApi) GetOnlineInfo added in v1.3.0

func (l *DebugApi) GetOnlineInfo() (map[uint64]*dpos.RepOnlinePeriod, error)

func (*DebugApi) GetPovInfo added in v1.3.0

func (l *DebugApi) GetPovInfo() (map[string]interface{}, error)

func (*DebugApi) GetSyncBlockNum added in v1.3.0

func (l *DebugApi) GetSyncBlockNum() (map[string]uint64, error)

func (*DebugApi) NewBlock added in v1.3.0

func (l *DebugApi) NewBlock(ctx context.Context) (*rpc.Subscription, error)

func (*DebugApi) PendingsAmount added in v1.3.0

func (l *DebugApi) PendingsAmount() (map[types.Address]map[string]types.Balance, error)

func (*DebugApi) PendingsCount added in v1.3.0

func (l *DebugApi) PendingsCount() (int, error)

func (*DebugApi) Representative added in v1.3.0

func (l *DebugApi) Representative(address types.Address) (*APIRepresentative, error)

func (*DebugApi) Representatives added in v1.3.0

func (l *DebugApi) Representatives(address *types.Address) (map[types.Address]map[string]*types.Benefit, error)

func (*DebugApi) SyncCacheBlocks added in v1.3.0

func (l *DebugApi) SyncCacheBlocks() ([]types.Hash, error)

func (*DebugApi) SyncCacheBlocksCount added in v1.3.0

func (l *DebugApi) SyncCacheBlocksCount() (int64, error)

func (*DebugApi) UncheckBlocks added in v1.2.3

func (l *DebugApi) UncheckBlocks() ([]*APIUncheckBlock, error)

type LedgerApi added in v0.0.5

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

func NewLedgerApi added in v0.0.5

func NewLedgerApi(l *ledger.Ledger, r *relation.Relation, eb event.EventBus, ctx context.Context) *LedgerApi

func (*LedgerApi) AccountBlocksCount added in v0.0.5

func (l *LedgerApi) AccountBlocksCount(addr types.Address) (int64, error)

func (*LedgerApi) AccountHistoryTopn added in v0.0.5

func (l *LedgerApi) AccountHistoryTopn(address types.Address, count int, offset *int) ([]*APIBlock, error)

AccountHistoryTopn returns blocks of the account, blocks count of each token in the account up to n

func (*LedgerApi) AccountInfo added in v0.0.5

func (l *LedgerApi) AccountInfo(address types.Address) (*APIAccount, error)

func (*LedgerApi) AccountRepresentative added in v0.0.5

func (l *LedgerApi) AccountRepresentative(addr types.Address) (types.Address, error)

func (*LedgerApi) AccountVotingWeight added in v0.0.5

func (l *LedgerApi) AccountVotingWeight(addr types.Address) (types.Balance, error)

func (*LedgerApi) Accounts added in v0.0.9

func (l *LedgerApi) Accounts(count int, offset *int) ([]*types.Address, error)

func (*LedgerApi) AccountsBalance added in v0.0.9

func (l *LedgerApi) AccountsBalance(addresses []types.Address) (map[types.Address]map[string]*APIAccountsBalance, error)

func (*LedgerApi) AccountsCount added in v0.0.5

func (l *LedgerApi) AccountsCount() (uint64, error)

func (*LedgerApi) AccountsFrontiers added in v0.0.5

func (l *LedgerApi) AccountsFrontiers(addresses []types.Address) (map[types.Address]map[string]types.Hash, error)

func (*LedgerApi) AccountsPending added in v0.0.5

func (l *LedgerApi) AccountsPending(addresses []types.Address, n int) (map[types.Address][]*APIPending, error)

func (*LedgerApi) BalanceChange added in v1.3.0

func (l *LedgerApi) BalanceChange(ctx context.Context, address types.Address) (*rpc.Subscription, error)

func (*LedgerApi) BlockAccount added in v0.0.5

func (l *LedgerApi) BlockAccount(hash types.Hash) (types.Address, error)

func (*LedgerApi) BlockConfirmedStatus added in v1.2.3

func (l *LedgerApi) BlockConfirmedStatus(hash types.Hash) (bool, error)

func (*LedgerApi) BlockHash added in v0.0.5

func (l *LedgerApi) BlockHash(block types.StateBlock) types.Hash

func (*LedgerApi) Blocks added in v0.0.9

func (l *LedgerApi) Blocks(count int, offset *int) ([]*APIBlock, error)

func (*LedgerApi) BlocksCount added in v0.0.5

func (l *LedgerApi) BlocksCount() (map[string]uint64, error)

BlocksCount returns the number of blocks (include smartcontrant block) in the ctx and unchecked synchronizing blocks

func (*LedgerApi) BlocksCount2 added in v1.1.1

func (l *LedgerApi) BlocksCount2() (map[string]uint64, error)

func (*LedgerApi) BlocksCountByType added in v0.0.5

func (l *LedgerApi) BlocksCountByType() (map[string]uint64, error)

BlocksCountByType reports the number of blocks in the ctx by type (send, receive, open, change)

func (*LedgerApi) BlocksInfo added in v0.0.5

func (l *LedgerApi) BlocksInfo(hash []types.Hash) ([]*APIBlock, error)

func (*LedgerApi) Chain added in v0.0.5

func (l *LedgerApi) Chain(hash types.Hash, n int) ([]types.Hash, error)

Chain returns a consecutive list of block hashes in the account chain starting at block up to count

func (*LedgerApi) ConfirmedAccountInfo added in v1.2.3

func (l *LedgerApi) ConfirmedAccountInfo(address types.Address) (*APIAccount, error)

func (*LedgerApi) ConfirmedBlocksInfo added in v1.3.0

func (l *LedgerApi) ConfirmedBlocksInfo(hash []types.Hash) ([]*APIBlock, error)

func (*LedgerApi) Delegators added in v0.0.5

func (l *LedgerApi) Delegators(hash types.Address) ([]*APIAccountBalance, error)

Delegators returns a list of pairs of delegator names given account a representative and its balance

func (*LedgerApi) DelegatorsCount added in v0.0.5

func (l *LedgerApi) DelegatorsCount(hash types.Address) (int64, error)

DelegatorsCount gets number of delegators for a specific representative account

func (*LedgerApi) GenerateChangeBlock added in v0.0.5

func (l *LedgerApi) GenerateChangeBlock(account types.Address, representative types.Address, prkStr *string) (*types.StateBlock, error)

func (*LedgerApi) GenerateReceiveBlock added in v0.0.5

func (l *LedgerApi) GenerateReceiveBlock(sendBlock *types.StateBlock, prkStr *string) (*types.StateBlock, error)

func (*LedgerApi) GenerateReceiveBlockByHash added in v1.3.0

func (l *LedgerApi) GenerateReceiveBlockByHash(sendHash types.Hash, prkStr *string) (*types.StateBlock, error)

func (*LedgerApi) GenerateSendBlock added in v0.0.5

func (l *LedgerApi) GenerateSendBlock(para *APISendBlockPara, prkStr *string) (*types.StateBlock, error)

func (*LedgerApi) GetAccountOnlineBlock added in v1.3.0

func (l *LedgerApi) GetAccountOnlineBlock(account types.Address) ([]*types.StateBlock, error)

func (*LedgerApi) NewAccountBlock added in v1.3.0

func (l *LedgerApi) NewAccountBlock(ctx context.Context, address types.Address) (*rpc.Subscription, error)

func (*LedgerApi) NewBlock added in v1.3.0

func (l *LedgerApi) NewBlock(ctx context.Context) (*rpc.Subscription, error)

func (*LedgerApi) NewPending added in v1.3.0

func (l *LedgerApi) NewPending(ctx context.Context, address types.Address) (*rpc.Subscription, error)

func (*LedgerApi) OnPovSyncState added in v1.3.0

func (l *LedgerApi) OnPovSyncState(state common.SyncState)

func (*LedgerApi) Pendings added in v1.1.0

func (l *LedgerApi) Pendings() ([]*APIPending, error)

func (*LedgerApi) Performance added in v0.0.9

func (l *LedgerApi) Performance() ([]*types.PerformanceTime, error)

func (*LedgerApi) Process added in v0.0.5

func (l *LedgerApi) Process(block *types.StateBlock) (types.Hash, error)

func (*LedgerApi) Representatives added in v0.0.5

func (l *LedgerApi) Representatives(sorting *bool) ([]*APIRepresentative, error)

Representatives returns a list of pairs of representative and its voting weight

func (*LedgerApi) TokenInfoById added in v1.0.0

func (l *LedgerApi) TokenInfoById(tokenId types.Hash) (*ApiTokenInfo, error)

func (*LedgerApi) TokenInfoByName added in v1.0.0

func (l *LedgerApi) TokenInfoByName(tokenName string) (*ApiTokenInfo, error)

func (*LedgerApi) Tokens added in v0.0.5

func (l *LedgerApi) Tokens() ([]*types.TokenInfo, error)

func (*LedgerApi) TransactionsCount added in v0.0.5

func (l *LedgerApi) TransactionsCount() (map[string]uint64, error)

BlocksCount returns the number of blocks (not include smartcontrant block) in the ctx and unchecked synchronizing blocks

type MetricsApi added in v1.3.0

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

func NewMetricsApi added in v1.3.0

func NewMetricsApi() *MetricsApi

func (*MetricsApi) DiskInfo added in v1.3.0

func (m *MetricsApi) DiskInfo() (*disk.UsageStat, error)

DiskInfo get disk info

func (*MetricsApi) GetAllCPUTimeStats added in v1.3.0

func (m *MetricsApi) GetAllCPUTimeStats() ([]cpu.TimesStat, error)

GetAllCPUTimeStats get total CPU time status

func (*MetricsApi) GetCPUInfo added in v1.3.0

func (m *MetricsApi) GetCPUInfo() ([]cpu.InfoStat, error)

GetCPUInfo get cpu info by core

func (*MetricsApi) GetCPUTimeStats added in v1.3.0

func (m *MetricsApi) GetCPUTimeStats() ([]cpu.TimesStat, error)

GetCPUTimeStats get CPU time status per core

func (*MetricsApi) GetNetworkInterfaces added in v1.3.0

func (m *MetricsApi) GetNetworkInterfaces() ([]net.IOCountersStat, error)

GetNetworkInterfaces get network interface info

type MinerApi added in v1.2.3

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

func NewMinerApi added in v1.2.3

func NewMinerApi(cfg *config.Config, ledger *ledger.Ledger) *MinerApi

func (*MinerApi) GetAvailRewardInfo added in v1.2.3

func (m *MinerApi) GetAvailRewardInfo(coinbase types.Address) (*MinerAvailRewardInfo, error)

func (*MinerApi) GetRewardData added in v1.2.3

func (m *MinerApi) GetRewardData(param *RewardParam) ([]byte, error)

func (*MinerApi) GetRewardHistory added in v1.3.0

func (m *MinerApi) GetRewardHistory(coinbase types.Address) (*MinerHistoryRewardInfo, error)

func (*MinerApi) GetRewardRecvBlock added in v1.2.3

func (m *MinerApi) GetRewardRecvBlock(input *types.StateBlock) (*types.StateBlock, error)

func (*MinerApi) GetRewardRecvBlockBySendHash added in v1.2.3

func (m *MinerApi) GetRewardRecvBlockBySendHash(sendHash types.Hash) (*types.StateBlock, error)

func (*MinerApi) GetRewardSendBlock added in v1.2.3

func (m *MinerApi) GetRewardSendBlock(param *RewardParam) (*types.StateBlock, error)

func (*MinerApi) UnpackRewardData added in v1.3.0

func (m *MinerApi) UnpackRewardData(data []byte) (*RewardParam, error)

type MinerAvailRewardInfo added in v1.2.3

type MinerAvailRewardInfo struct {
	LastEndHeight     uint64        `json:"lastEndHeight"`
	LatestBlockHeight uint64        `json:"latestBlockHeight"`
	NodeRewardHeight  uint64        `json:"nodeRewardHeight"`
	AvailStartHeight  uint64        `json:"availStartHeight"`
	AvailEndHeight    uint64        `json:"availEndHeight"`
	AvailRewardBlocks uint64        `json:"availRewardBlocks"`
	AvailRewardAmount types.Balance `json:"availRewardAmount"`
	NeedCallReward    bool          `json:"needCallReward"`
}

type MinerHistoryRewardInfo added in v1.2.3

type MinerHistoryRewardInfo struct {
	LastEndHeight  uint64        `json:"lastEndHeight"`
	RewardBlocks   uint64        `json:"rewardBlocks"`
	RewardAmount   types.Balance `json:"rewardAmount"`
	LastRewardTime int64         `json:"lastRewardTime"`
}

type MintageApi added in v0.0.9

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

func NewMintageApi added in v0.0.9

func NewMintageApi(l *ledger.Ledger, eb event.EventBus) *MintageApi

func (*MintageApi) GetMintageBlock added in v0.0.9

func (m *MintageApi) GetMintageBlock(param *MintageParams) (*types.StateBlock, error)

func (*MintageApi) GetMintageData added in v0.0.9

func (m *MintageApi) GetMintageData(param *MintageParams) ([]byte, error)

func (*MintageApi) GetRewardBlock added in v0.0.9

func (m *MintageApi) GetRewardBlock(input *types.StateBlock) (*types.StateBlock, error)

func (*MintageApi) GetWithdrawMintageBlock added in v1.1.0

func (m *MintageApi) GetWithdrawMintageBlock(param *WithdrawParams) (*types.StateBlock, error)

func (*MintageApi) GetWithdrawMintageData added in v0.0.9

func (m *MintageApi) GetWithdrawMintageData(tokenId types.Hash) ([]byte, error)

func (*MintageApi) GetWithdrawRewardBlock added in v1.1.0

func (m *MintageApi) GetWithdrawRewardBlock(input *types.StateBlock) (*types.StateBlock, error)

func (*MintageApi) OnPovSyncState added in v1.3.0

func (m *MintageApi) OnPovSyncState(state common.SyncState)

func (*MintageApi) ParseTokenInfo added in v1.3.2

func (p *MintageApi) ParseTokenInfo(data []byte) (*types.TokenInfo, error)

type MintageParams added in v0.0.9

type MintageParams struct {
	SelfAddr    types.Address `json:"selfAddr"`
	PrevHash    types.Hash    `json:"prevHash"`
	TokenName   string        `json:"tokenName"`
	TokenSymbol string        `json:"tokenSymbol"`
	TotalSupply string        `json:"totalSupply"`
	Decimals    uint8         `json:"decimals"`
	Beneficial  types.Address `json:"beneficial"`
	NEP5TxId    string        `json:"nep5TxId"`
}

type NEP5PledgeApi added in v1.1.0

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

func NewNEP5PledgeApi added in v1.1.0

func NewNEP5PledgeApi(l *ledger.Ledger, eb event.EventBus) *NEP5PledgeApi

func (*NEP5PledgeApi) GetAllPledgeInfo added in v1.1.0

func (p *NEP5PledgeApi) GetAllPledgeInfo() ([]*NEP5PledgeInfo, error)

search all pledge info

func (*NEP5PledgeApi) GetBeneficialPledgeInfos added in v1.1.0

func (p *NEP5PledgeApi) GetBeneficialPledgeInfos(beneficial types.Address, pType string) (*PledgeInfos, error)

get pledge info by beneficial,pType ,return PledgeInfos

func (*NEP5PledgeApi) GetBeneficialPledgeInfosByAddress added in v1.1.0

func (p *NEP5PledgeApi) GetBeneficialPledgeInfosByAddress(beneficial types.Address) *PledgeInfos

get pledge info by beneficial,pType ,return PledgeInfos

func (*NEP5PledgeApi) GetPledgeBeneficialAmount added in v1.1.0

func (p *NEP5PledgeApi) GetPledgeBeneficialAmount(beneficial types.Address, pType string) (*big.Int, error)

search pledge info by beneficial address,pType,return total amount

func (*NEP5PledgeApi) GetPledgeBeneficialTotalAmount added in v1.1.0

func (p *NEP5PledgeApi) GetPledgeBeneficialTotalAmount(addr types.Address) (*big.Int, error)

get pledge total amount by beneficial address ,return total amount

func (*NEP5PledgeApi) GetPledgeBlock added in v1.1.0

func (p *NEP5PledgeApi) GetPledgeBlock(param *PledgeParam) (*types.StateBlock, error)

func (*NEP5PledgeApi) GetPledgeData added in v1.1.0

func (p *NEP5PledgeApi) GetPledgeData(param *PledgeParam) ([]byte, error)

func (*NEP5PledgeApi) GetPledgeInfo added in v1.1.0

func (p *NEP5PledgeApi) GetPledgeInfo(param *WithdrawPledgeParam) ([]*NEP5PledgeInfo, error)

search pledge info by Beneficial,amount pType

func (*NEP5PledgeApi) GetPledgeInfoWithNEP5TxId added in v1.1.2

func (p *NEP5PledgeApi) GetPledgeInfoWithNEP5TxId(param *WithdrawPledgeParam) (*NEP5PledgeInfo, error)

search pledge info by nep5Txid

func (*NEP5PledgeApi) GetPledgeInfoWithTimeExpired added in v1.1.0

func (p *NEP5PledgeApi) GetPledgeInfoWithTimeExpired(param *WithdrawPledgeParam) ([]*NEP5PledgeInfo, error)

search pledge info by Beneficial,amount pType

func (*NEP5PledgeApi) GetPledgeInfosByPledgeAddress added in v1.1.0

func (p *NEP5PledgeApi) GetPledgeInfosByPledgeAddress(addr types.Address) *PledgeInfos

get pledge info by pledge address ,return pledgeinfos

func (*NEP5PledgeApi) GetPledgeRewardBlock added in v1.1.0

func (p *NEP5PledgeApi) GetPledgeRewardBlock(input *types.StateBlock) (*types.StateBlock, error)

func (*NEP5PledgeApi) GetPledgeRewardBlockBySendHash added in v1.3.0

func (p *NEP5PledgeApi) GetPledgeRewardBlockBySendHash(sendHash types.Hash) (*types.StateBlock, error)

func (*NEP5PledgeApi) GetTotalPledgeAmount added in v1.2.0

func (p *NEP5PledgeApi) GetTotalPledgeAmount() (*big.Int, error)

GetTotalPledgeAmount get all pledge amount

func (*NEP5PledgeApi) GetWithdrawPledgeBlock added in v1.1.0

func (p *NEP5PledgeApi) GetWithdrawPledgeBlock(param *WithdrawPledgeParam) (*types.StateBlock, error)

func (*NEP5PledgeApi) GetWithdrawPledgeData added in v1.1.0

func (p *NEP5PledgeApi) GetWithdrawPledgeData(param *WithdrawPledgeParam) ([]byte, error)

func (*NEP5PledgeApi) GetWithdrawRewardBlock added in v1.1.0

func (p *NEP5PledgeApi) GetWithdrawRewardBlock(input *types.StateBlock) (*types.StateBlock, error)

func (*NEP5PledgeApi) GetWithdrawRewardBlockBySendHash added in v1.3.0

func (p *NEP5PledgeApi) GetWithdrawRewardBlockBySendHash(sendHash types.Hash) (*types.StateBlock, error)

func (*NEP5PledgeApi) OnPovSyncState added in v1.3.0

func (p *NEP5PledgeApi) OnPovSyncState(state common.SyncState)

func (*NEP5PledgeApi) ParsePledgeInfo added in v1.3.2

func (p *NEP5PledgeApi) ParsePledgeInfo(data []byte) (*cabi.NEP5PledgeInfo, error)

type NEP5PledgeInfo added in v1.1.0

type NEP5PledgeInfo struct {
	PType         string
	Amount        *big.Int
	WithdrawTime  string
	Beneficial    types.Address
	PledgeAddress types.Address
	NEP5TxId      string
}

type NetApi added in v0.0.5

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

func NewNetApi added in v0.0.5

func NewNetApi(l *ledger.Ledger, eb event.EventBus) *NetApi

func (*NetApi) ConnectPeersInfo added in v1.1.1

func (q *NetApi) ConnectPeersInfo(count int, offset *int) ([]*types.PeerInfo, error)

func (*NetApi) GetAllPeersInfo added in v1.3.1

func (q *NetApi) GetAllPeersInfo(count int, offset *int) ([]*types.PeerInfo, error)

func (*NetApi) GetBandwidthStats added in v1.3.0

func (q *NetApi) GetBandwidthStats() *p2pmetrics.Stats

func (*NetApi) GetOnlinePeersInfo added in v1.3.1

func (q *NetApi) GetOnlinePeersInfo(count int, offset *int) ([]*types.PeerInfo, error)

func (*NetApi) OnlineRepresentatives added in v0.0.5

func (q *NetApi) OnlineRepresentatives() []types.Address

func (*NetApi) OnlineRepsInfo added in v1.2.3

func (q *NetApi) OnlineRepsInfo() *OnlineRepTotal

func (*NetApi) PeersCount added in v1.3.1

func (q *NetApi) PeersCount() (map[string]uint64, error)

func (*NetApi) Syncing added in v1.2.2

func (q *NetApi) Syncing() bool

type OnlineRepInfo added in v1.2.3

type OnlineRepInfo struct {
	Account types.Address
	Vote    types.Balance
}

type OnlineRepTotal added in v1.2.3

type OnlineRepTotal struct {
	Reps              []*OnlineRepInfo
	ValidVotes        types.Balance
	ValidVotesPercent string
}

type PledgeInfos added in v1.1.0

type PledgeInfos struct {
	PledgeInfo   []*NEP5PledgeInfo
	TotalAmounts *big.Int
}

type PledgeParam added in v1.1.0

type PledgeParam struct {
	Beneficial    types.Address
	PledgeAddress types.Address
	Amount        types.Balance
	PType         string
	NEP5TxId      string
}

type PovApi added in v1.2.3

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

func NewPovApi added in v1.2.3

func NewPovApi(cfg *config.Config, l *ledger.Ledger, eb event.EventBus, ctx context.Context) *PovApi

func (*PovApi) BatchGetHeadersByHeight added in v1.2.3

func (api *PovApi) BatchGetHeadersByHeight(height uint64, count uint64, asc bool) (*PovApiBatchHeader, error)

func (*PovApi) CheckAllAccountStates added in v1.3.3

func (api *PovApi) CheckAllAccountStates() (*PovApiCheckStateRsp, error)

func (*PovApi) DumpBlockState added in v1.2.3

func (api *PovApi) DumpBlockState(blockHash types.Hash) (*PovApiDumpState, error)

func (*PovApi) GetAccountState added in v1.2.3

func (api *PovApi) GetAccountState(address types.Address, stateHash types.Hash) (*PovApiState, error)

func (*PovApi) GetAccountStateByBlockHash added in v1.2.3

func (api *PovApi) GetAccountStateByBlockHash(address types.Address, blockHash types.Hash) (*PovApiState, error)

func (*PovApi) GetAccountStateByBlockHeight added in v1.2.3

func (api *PovApi) GetAccountStateByBlockHeight(address types.Address, height uint64) (*PovApiState, error)

func (*PovApi) GetAllOnlineRepStates added in v1.3.0

func (api *PovApi) GetAllOnlineRepStates(header *types.PovHeader) []*types.PovRepState

func (*PovApi) GetAllRepStatesByBlockHash added in v1.3.0

func (api *PovApi) GetAllRepStatesByBlockHash(blockHash types.Hash) (*PovApiRepState, error)

func (*PovApi) GetAllRepStatesByBlockHeight added in v1.3.0

func (api *PovApi) GetAllRepStatesByBlockHeight(blockHeight uint64) (*PovApiRepState, error)

func (*PovApi) GetAllRepStatesByStateHash added in v1.3.0

func (api *PovApi) GetAllRepStatesByStateHash(stateHash types.Hash) (*PovApiRepState, error)

func (*PovApi) GetBlockByHash added in v1.2.3

func (api *PovApi) GetBlockByHash(blockHash types.Hash, txOffset uint32, txLimit uint32) (*PovApiBlock, error)

func (*PovApi) GetBlockByHeight added in v1.2.3

func (api *PovApi) GetBlockByHeight(height uint64, txOffset uint32, txLimit uint32) (*PovApiBlock, error)

func (*PovApi) GetBlockTDByHash added in v1.3.0

func (api *PovApi) GetBlockTDByHash(blockHash types.Hash) (*PovApiTD, error)

func (*PovApi) GetBlockTDByHeight added in v1.3.0

func (api *PovApi) GetBlockTDByHeight(height uint64) (*PovApiTD, error)

func (*PovApi) GetDiffDayStat added in v1.3.1

func (api *PovApi) GetDiffDayStat(dayIndex uint32) (*types.PovDiffDayStat, error)

func (*PovApi) GetDiffDayStatByHeight added in v1.3.1

func (api *PovApi) GetDiffDayStatByHeight(height uint64) (*types.PovDiffDayStat, error)

func (*PovApi) GetFittestHeader added in v1.2.3

func (api *PovApi) GetFittestHeader(gap uint64) (*PovApiHeader, error)

func (*PovApi) GetHashInfo added in v1.3.0

func (api *PovApi) GetHashInfo(height uint64, lookup uint64) (*PovApiHashInfo, error)

func (*PovApi) GetHeaderByHash added in v1.2.3

func (api *PovApi) GetHeaderByHash(blockHash types.Hash) (*PovApiHeader, error)

func (*PovApi) GetHeaderByHeight added in v1.2.3

func (api *PovApi) GetHeaderByHeight(height uint64) (*PovApiHeader, error)

func (*PovApi) GetLastNHourInfo added in v1.3.0

func (api *PovApi) GetLastNHourInfo(endHeight uint64, timeSpan uint32) (*PovApiGetLastNHourInfo, error)

func (*PovApi) GetLatestAccountState added in v1.2.3

func (api *PovApi) GetLatestAccountState(address types.Address) (*PovApiState, error)

func (*PovApi) GetLatestBlock added in v1.2.3

func (api *PovApi) GetLatestBlock(txOffset uint32, txLimit uint32) (*PovApiBlock, error)

func (*PovApi) GetLatestHeader added in v1.2.3

func (api *PovApi) GetLatestHeader() (*PovApiHeader, error)

func (*PovApi) GetLedgerStats added in v1.2.3

func (api *PovApi) GetLedgerStats() (*PovLedgerStats, error)

func (*PovApi) GetMinerDayStat added in v1.3.1

func (api *PovApi) GetMinerDayStat(dayIndex uint32) (*types.PovMinerDayStat, error)

func (*PovApi) GetMinerDayStatByHeight added in v1.3.1

func (api *PovApi) GetMinerDayStatByHeight(height uint64) (*types.PovMinerDayStat, error)

func (*PovApi) GetMinerStats added in v1.2.3

func (api *PovApi) GetMinerStats(addrs []types.Address) (*PovMinerStats, error)

func (*PovApi) GetMiningInfo added in v1.3.0

func (api *PovApi) GetMiningInfo() (*PovApiGetMiningInfo, error)

func (*PovApi) GetPovStatus added in v1.2.3

func (api *PovApi) GetPovStatus() (*PovStatus, error)

func (*PovApi) GetRepStatesByHeightAndAccount added in v1.3.1

func (api *PovApi) GetRepStatesByHeightAndAccount(header *types.PovHeader, acc types.Address) *types.PovRepState

func (*PovApi) GetRepStats added in v1.3.0

func (api *PovApi) GetRepStats(addrs []types.Address) (*PovRepStats, error)

func (*PovApi) GetTransaction added in v1.2.3

func (api *PovApi) GetTransaction(txHash types.Hash) (*PovApiTxLookup, error)

func (*PovApi) GetTransactionByBlockHashAndIndex added in v1.2.3

func (api *PovApi) GetTransactionByBlockHashAndIndex(blockHash types.Hash, index uint32) (*PovApiTxLookup, error)

func (*PovApi) GetTransactionByBlockHeightAndIndex added in v1.2.3

func (api *PovApi) GetTransactionByBlockHeightAndIndex(height uint64, index uint32) (*PovApiTxLookup, error)

func (*PovApi) GetWork added in v1.3.0

func (api *PovApi) GetWork(minerAddr types.Address, algoName string) (*PovApiGetWork, error)

func (*PovApi) NewBlock added in v1.3.0

func (api *PovApi) NewBlock(ctx context.Context) (*rpc.Subscription, error)

func (*PovApi) OnPovSyncState added in v1.2.3

func (api *PovApi) OnPovSyncState(state common.SyncState)

func (*PovApi) SubmitWork added in v1.3.0

func (api *PovApi) SubmitWork(work *PovApiSubmitWork) error

type PovApiBatchHeader added in v1.2.3

type PovApiBatchHeader struct {
	Count   int             `json:"count"`
	Headers []*PovApiHeader `json:"headers"`
}

type PovApiBlock added in v1.2.3

type PovApiBlock struct {
	*types.PovBlock
	AlgoName       string  `json:"algoName"`
	AlgoEfficiency uint    `json:"algoEfficiency"`
	NormBits       uint32  `json:"normBits"`
	NormDifficulty float64 `json:"normDifficulty"`
	AlgoDifficulty float64 `json:"algoDifficulty"`
}

type PovApiCheckStateRsp added in v1.3.3

type PovApiCheckStateRsp struct {
	AccountStates map[types.Address]*types.PovAccountState
	AccountMetas  map[types.Address]*types.AccountMeta
	RepStates     map[types.Address]*types.PovRepState
	RepMetas      map[types.Address]*types.Benefit
}

type PovApiDumpState added in v1.2.3

type PovApiDumpState struct {
	StateHash types.Hash                               `json:"stateHash"`
	Accounts  map[types.Address]*types.PovAccountState `json:"accounts"`
	Reps      map[types.Address]*types.PovRepState     `json:"reps"`
}

type PovApiGetLastNHourInfo added in v1.3.0

type PovApiGetLastNHourInfo struct {
	MaxTxPerBlock uint32
	MinTxPerBlock uint32
	AvgTxPerBlock uint32

	MaxTxPerHour uint32
	MinTxPerHour uint32
	AvgTxPerHour uint32

	MaxBlockPerHour uint32
	MinBlockPerHour uint32
	AvgBlockPerHour uint32

	AllBlockNum uint32
	AllTxNum    uint32

	Sha256dBlockNum uint32
	X11BlockNum     uint32
	ScryptBlockNum  uint32
	AuxBlockNum     uint32

	HourItemList []*PovApiGetLastNHourItem
}

type PovApiGetLastNHourItem added in v1.3.0

type PovApiGetLastNHourItem struct {
	Hour uint32

	AllBlockNum    uint32
	AllTxNum       uint32
	AllMinerReward types.Balance
	AllRepReward   types.Balance

	Sha256dBlockNum uint32
	X11BlockNum     uint32
	ScryptBlockNum  uint32
	AuxBlockNum     uint32

	MaxTxPerBlock uint32
	MinTxPerBlock uint32
	AvgTxPerBlock uint32
}

type PovApiGetMiningInfo added in v1.3.0

type PovApiGetMiningInfo struct {
	SyncState          int               `json:"syncState"`
	SyncStateStr       string            `json:"syncStateStr"`
	CurrentBlockHeight uint64            `json:"currentBlockHeight"`
	CurrentBlockHash   types.Hash        `json:"currentBlockHash"`
	CurrentBlockSize   uint32            `json:"currentBlockSize"`
	CurrentBlockTx     uint32            `json:"currentBlockTx"`
	CurrentBlockAlgo   types.PovAlgoType `json:"currentBlockAlgo"`
	PooledTx           uint32            `json:"pooledTx"`
	Difficulty         float64           `json:"difficulty"`
	HashInfo           *PovApiHashInfo   `json:"hashInfo"`
}

type PovApiGetWork added in v1.3.0

type PovApiGetWork struct {
	WorkHash      types.Hash     `json:"workHash"`
	Version       uint32         `json:"version"`
	Previous      types.Hash     `json:"previous"`
	Bits          uint32         `json:"bits"`
	Height        uint64         `json:"height"`
	MinTime       uint32         `json:"minTime"`
	MerkleBranch  []*types.Hash  `json:"merkleBranch"`
	CoinBaseData1 types.HexBytes `json:"coinbaseData1"`
	CoinBaseData2 types.HexBytes `json:"coinbaseData2"`
}

type PovApiHashInfo added in v1.3.0

type PovApiHashInfo struct {
	ChainHashPS   uint64 `json:"chainHashPS"`
	Sha256dHashPS uint64 `json:"sha256dHashPS"`
	ScryptHashPS  uint64 `json:"scryptHashPS"`
	X11HashPS     uint64 `json:"x11HashPS"`
}

type PovApiHeader added in v1.2.3

type PovApiHeader struct {
	*types.PovHeader
	AlgoName       string  `json:"algoName"`
	AlgoEfficiency uint    `json:"algoEfficiency"`
	NormBits       uint32  `json:"normBits"`
	NormDifficulty float64 `json:"normDifficulty"`
	AlgoDifficulty float64 `json:"algoDifficulty"`
}

type PovApiRepState added in v1.3.0

type PovApiRepState struct {
	StateHash types.Hash                           `json:"stateHash"`
	Reps      map[types.Address]*types.PovRepState `json:"reps"`
}

type PovApiState added in v1.2.3

type PovApiState struct {
	AccountState *types.PovAccountState `json:"accountState"`
	RepState     *types.PovRepState     `json:"repState"`
}

type PovApiSubmitWork added in v1.3.0

type PovApiSubmitWork struct {
	WorkHash  types.Hash `json:"workHash"`
	BlockHash types.Hash `json:"blockHash"`

	MerkleRoot    types.Hash     `json:"merkleRoot"`
	Timestamp     uint32         `json:"timestamp"`
	Nonce         uint32         `json:"nonce"`
	CoinbaseExtra types.HexBytes `json:"coinbaseExtra"`
	CoinbaseHash  types.Hash     `json:"coinbaseHash"`

	AuxPow *types.PovAuxHeader `json:"auxPow"`
}

type PovApiTD added in v1.2.3

type PovApiTD struct {
	Header *types.PovHeader `json:"header"`
	TD     *types.PovTD     `json:"td"`
}

type PovApiTxLookup added in v1.2.3

type PovApiTxLookup struct {
	TxHash   types.Hash         `json:"txHash"`
	TxLookup *types.PovTxLookup `json:"txLookup"`

	CoinbaseTx *types.PovCoinBaseTx `json:"coinbaseTx"`
	AccountTx  *types.StateBlock    `json:"accountTx"`
}

type PovLedgerStats added in v1.2.3

type PovLedgerStats struct {
	PovBlockCount   uint64 `json:"povBlockCount"`
	PovBestCount    uint64 `json:"povBestCount"`
	PovAllTxCount   uint64 `json:"povAllTxCount"`
	PovCbTxCount    uint64 `json:"povCbTxCount"`
	PovStateTxCount uint64 `json:"povStateTxCount"`
	StateBlockCount uint64 `json:"stateBlockCount"`
}

type PovMinerStatItem added in v1.2.3

type PovMinerStatItem struct {
	Account            types.Address `json:"account"`
	MainBlockNum       uint32        `json:"mainBlockNum"`
	MainRewardAmount   types.Balance `json:"mainRewardAmount"`
	StableBlockNum     uint32        `json:"stableBlockNum"`
	StableRewardAmount types.Balance `json:"stableRewardAmount"`
	FirstBlockTime     time.Time     `json:"firstBlockTime"`
	LastBlockTime      time.Time     `json:"lastBlockTime"`
	FirstBlockHeight   uint64        `json:"firstBlockHeight"`
	LastBlockHeight    uint64        `json:"lastBlockHeight"`
	IsHourOnline       bool          `json:"isHourOnline"`
	IsDayOnline        bool          `json:"isDayOnline"`
}

type PovMinerStats added in v1.2.3

type PovMinerStats struct {
	MinerCount      int `json:"minerCount"`
	HourOnlineCount int `json:"hourOnlineCount"`
	DayOnlineCount  int `json:"dayOnlineCount"`

	MinerStats map[types.Address]*PovMinerStatItem `json:"minerStats"`

	TotalBlockNum     uint32        `json:"totalBlockNum"`
	TotalRewardAmount types.Balance `json:"totalRewardAmount"`
	TotalMinerReward  types.Balance `json:"totalMinerReward"`
	TotalRepReward    types.Balance `json:"totalRepReward"`
	LatestBlockHeight uint64        `json:"latestBlockHeight"`
}

type PovRepStatItem added in v1.3.1

type PovRepStatItem struct {
	MainBlockNum       uint32        `json:"mainBlockNum"`
	MainRewardAmount   types.Balance `json:"mainRewardAmount"`
	MainOnlinePeriod   uint32        `json:"mainOnlinePeriod"`
	StableBlockNum     uint32        `json:"stableBlockNum"`
	StableRewardAmount types.Balance `json:"stableRewardAmount"`
	StableOnlinePeriod uint32        `json:"stableOnlinePeriod"`
	LastOnlineTime     time.Time     `json:"lastOnlineTime"`
	LastOnlineHeight   uint64        `json:"lastOnlineHeight"`
	IsOnline           bool          `json:"isOnline"`
}

type PovRepStats added in v1.3.0

type PovRepStats struct {
	RepCount          uint32                            `json:"repCount"`
	RepStats          map[types.Address]*PovRepStatItem `json:"repStats"`
	TotalBlockNum     uint32                            `json:"totalBlockNum"`
	TotalPeriod       uint32                            `json:"totalPeriod"`
	TotalRewardAmount types.Balance                     `json:"totalRewardAmount"`
	LatestBlockHeight uint64                            `json:"latestBlockHeight"`
}

type PovStatus added in v1.2.3

type PovStatus struct {
	PovEnabled   bool   `json:"povEnabled"`
	SyncState    int    `json:"syncState"`
	SyncStateStr string `json:"syncStateStr"`
}

type PovSubscriber added in v1.3.0

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

type PovSubscription added in v1.3.0

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

PovSubscription subscript event from chain, and deliver to every connected websocket

func NewPovSubscription added in v1.3.0

func NewPovSubscription(ctx context.Context, eb event.EventBus) *PovSubscription

type RepApi added in v1.3.0

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

func NewRepApi added in v1.3.0

func NewRepApi(cfg *config.Config, ledger *ledger.Ledger) *RepApi

func (*RepApi) GetAvailRewardInfo added in v1.3.0

func (r *RepApi) GetAvailRewardInfo(account types.Address) (*RepAvailRewardInfo, error)

func (*RepApi) GetRepStateWithHeight added in v1.3.0

func (r *RepApi) GetRepStateWithHeight(params *RepStateParams) (*types.PovRepState, error)

func (*RepApi) GetRewardData added in v1.3.0

func (r *RepApi) GetRewardData(param *RepRewardParam) ([]byte, error)

func (*RepApi) GetRewardHistory added in v1.3.0

func (r *RepApi) GetRewardHistory(account types.Address) (*RepHistoryRewardInfo, error)

func (*RepApi) GetRewardRecvBlock added in v1.3.0

func (r *RepApi) GetRewardRecvBlock(input *types.StateBlock) (*types.StateBlock, error)

func (*RepApi) GetRewardRecvBlockBySendHash added in v1.3.0

func (r *RepApi) GetRewardRecvBlockBySendHash(sendHash types.Hash) (*types.StateBlock, error)

func (*RepApi) GetRewardSendBlock added in v1.3.0

func (r *RepApi) GetRewardSendBlock(param *RepRewardParam) (*types.StateBlock, error)

func (*RepApi) UnpackRewardData added in v1.3.0

func (r *RepApi) UnpackRewardData(data []byte) (*RepRewardParam, error)

type RepAvailRewardInfo added in v1.3.0

type RepAvailRewardInfo struct {
	LastEndHeight     uint64        `json:"lastEndHeight"`
	LatestBlockHeight uint64        `json:"latestBlockHeight"`
	NodeRewardHeight  uint64        `json:"nodeRewardHeight"`
	AvailStartHeight  uint64        `json:"availStartHeight"`
	AvailEndHeight    uint64        `json:"availEndHeight"`
	AvailRewardBlocks uint64        `json:"availRewardBlocks"`
	AvailRewardAmount types.Balance `json:"availRewardAmount"`
	NeedCallReward    bool          `json:"needCallReward"`
}

type RepHistoryRewardInfo added in v1.3.0

type RepHistoryRewardInfo struct {
	LastEndHeight  uint64        `json:"lastEndHeight"`
	RewardBlocks   uint64        `json:"rewardBlocks"`
	RewardAmount   types.Balance `json:"rewardAmount"`
	LastRewardTime int64         `json:"lastRewardTime"`
}

type RepRewardParam added in v1.3.0

type RepRewardParam struct {
	Account      types.Address `json:"account"`
	Beneficial   types.Address `json:"beneficial"`
	StartHeight  uint64        `json:"startHeight"`
	EndHeight    uint64        `json:"endHeight"`
	RewardBlocks uint64        `json:"rewardBlocks"`
	RewardAmount *big.Int      `json:"rewardAmount"`
}

type RepStateParams added in v1.3.0

type RepStateParams struct {
	Account types.Address
	Height  uint64
}

type RewardParam added in v1.2.3

type RewardParam struct {
	Coinbase     types.Address `json:"coinbase"`
	Beneficial   types.Address `json:"beneficial"`
	StartHeight  uint64        `json:"startHeight"`
	EndHeight    uint64        `json:"endHeight"`
	RewardBlocks uint64        `json:"rewardBlocks"`
	RewardAmount *big.Int      `json:"rewardAmount"`
}

type RewardsApi added in v1.2.0

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

func NewRewardsApi added in v1.2.0

func NewRewardsApi(l *ledger.Ledger, eb event.EventBus) *RewardsApi

func (*RewardsApi) GetConfidantRewards added in v1.2.0

func (r *RewardsApi) GetConfidantRewards(confidant types.Address) (map[string]*big.Int, error)

func (*RewardsApi) GetConfidantRewordsDetail added in v1.2.1

func (r *RewardsApi) GetConfidantRewordsDetail(confidant types.Address) (map[string][]*cabi.RewardsInfo, error)

func (*RewardsApi) GetReceiveRewardBlock added in v1.2.0

func (r *RewardsApi) GetReceiveRewardBlock(send *types.Hash) (*types.StateBlock, error)

func (*RewardsApi) GetRewardsDetail added in v1.2.1

func (r *RewardsApi) GetRewardsDetail(txId string) ([]*cabi.RewardsInfo, error)

func (*RewardsApi) GetSendConfidantBlock added in v1.2.0

func (r *RewardsApi) GetSendConfidantBlock(param *RewardsParam, sign *types.Signature) (*types.StateBlock, error)

func (*RewardsApi) GetSendRewardBlock added in v1.2.0

func (r *RewardsApi) GetSendRewardBlock(param *RewardsParam, sign *types.Signature) (*types.StateBlock, error)

func (*RewardsApi) GetTotalRewards added in v1.2.0

func (r *RewardsApi) GetTotalRewards(txId string) (*big.Int, error)

func (*RewardsApi) GetUnsignedConfidantData added in v1.2.0

func (r *RewardsApi) GetUnsignedConfidantData(param *RewardsParam) (types.Hash, error)

func (*RewardsApi) GetUnsignedRewardData added in v1.2.0

func (r *RewardsApi) GetUnsignedRewardData(param *RewardsParam) (types.Hash, error)

func (*RewardsApi) IsAirdropRewards added in v1.2.0

func (r *RewardsApi) IsAirdropRewards(data []byte) bool

func (*RewardsApi) OnPovSyncState added in v1.3.0

func (r *RewardsApi) OnPovSyncState(state common.SyncState)

type RewardsParam added in v1.2.0

type RewardsParam struct {
	Id     string        `json:"Id"`
	Amount types.Balance `json:"amount"`
	Self   types.Address `json:"self"`
	To     types.Address `json:"to"`
}

type SMSApi added in v0.0.9

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

func NewSMSApi added in v0.0.9

func NewSMSApi(ledger *ledger.Ledger, relation *relation.Relation) *SMSApi

func (*SMSApi) MessageBlocks added in v1.0.1

func (s *SMSApi) MessageBlocks(hash types.Hash) ([]*APIBlock, error)

func (*SMSApi) MessageHash added in v0.0.9

func (s *SMSApi) MessageHash(message string) (types.Hash, error)

func (*SMSApi) MessageInfo added in v0.0.9

func (s *SMSApi) MessageInfo(mHash types.Hash) (string, error)

func (*SMSApi) MessageStore added in v0.0.9

func (s *SMSApi) MessageStore(message string) (types.Hash, error)

func (*SMSApi) PhoneBlocks added in v0.0.9

func (s *SMSApi) PhoneBlocks(sender string) (map[string][]*APIBlock, error)

type UtilApi added in v0.0.5

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

func NewUtilApi added in v0.0.5

func NewUtilApi(l *ledger.Ledger) *UtilApi

func (*UtilApi) BalanceToRaw added in v0.0.5

func (u *UtilApi) BalanceToRaw(balance types.Balance, unit string, tokenName *string) (types.Balance, error)

func (*UtilApi) Decrypt added in v0.0.5

func (u *UtilApi) Decrypt(cryptograph string, passphrase string) (string, error)

func (*UtilApi) Encrypt added in v0.0.5

func (u *UtilApi) Encrypt(raw string, passphrase string) (string, error)

func (*UtilApi) RawToBalance added in v0.0.5

func (u *UtilApi) RawToBalance(balance types.Balance, unit string, tokenName *string) (*APIBalance, error)

type WalletApi added in v0.0.5

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

func NewWalletApi added in v0.0.5

func NewWalletApi(l *ledger.Ledger, wallet *wallet.WalletStore) *WalletApi

func (*WalletApi) ChangePassword added in v0.0.9

func (w *WalletApi) ChangePassword(addr types.Address, pwd string, newPwd string) error

func (*WalletApi) GetBalances added in v0.0.5

func (w *WalletApi) GetBalances(address types.Address, passphrase string) (map[string]types.Balance, error)

GetBalance returns balance for each token of the wallet

func (*WalletApi) GetRawKey added in v0.0.5

func (w *WalletApi) GetRawKey(address types.Address, passphrase string) (map[string]string, error)

func (*WalletApi) List added in v0.0.9

func (w *WalletApi) List() ([]types.Address, error)

func (*WalletApi) NewSeed added in v0.0.5

func (w *WalletApi) NewSeed() (string, error)

NewSeed generates new seed

func (*WalletApi) NewWallet added in v0.0.5

func (w *WalletApi) NewWallet(passphrase string, seed *string) (types.Address, error)

NewWallet creates wallet from hex seed string and passphrase , seed string it is a optional parameter, if not set, will create seed randomly

func (*WalletApi) Remove added in v0.0.9

func (w *WalletApi) Remove(addr types.Address) error

type WithdrawParams added in v1.1.0

type WithdrawParams struct {
	SelfAddr types.Address `json:"selfAddr"`
	TokenId  types.Hash    `json:"tokenId"`
}

type WithdrawPledgeParam added in v1.1.0

type WithdrawPledgeParam struct {
	Beneficial types.Address `json:"beneficial"`
	Amount     types.Balance `json:"amount"`
	PType      string        `json:"pType"`
	NEP5TxId   string        `json:"nep5TxId"`
}

Jump to

Keyboard shortcuts

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