Documentation
¶
Index ¶
- func InitUnmarshalData(info TokenInfo)
- type AccountBalance
- type AccountIdentity
- type AccountInfo
- type CandidatePoolEntry
- type Client
- func (c *Client) FetchAccountInfo(address string) (AccountInfo, error)
- func (c *Client) FetchCollatorBlocks(address string, round uint32, blockHash types.Hash) (uint32, error)
- func (c *Client) FetchCollatorHistory(address string, historyRounds uint32) (map[uint32]CollatorHistory, error)
- func (c *Client) FetchCollatorInfo(address string, selected bool, rank uint32, cfg config.CollatorsPoolConfig) (CollatorInfo, error)
- func (c *Client) FetchCollatorPool(poolConfig config.CollatorsPoolConfig) (CollatorPool, error)
- func (c *Client) FetchSelectedCandidates(blockHash types.Hash) ([]string, error)
- func (c *Client) FetchSortedCandidatePool(blockHash types.Hash) ([]CandidatePoolEntry, error)
- func (c *Client) GetBlockNumber(hash types.Hash) (uint64, error)
- func (c *Client) GetCandidateBondLessDelay() (uint32, error)
- func (c *Client) GetConstantValue(pallet string, method string, typeString string, targetValue any) error
- func (c *Client) GetRoundEndHash(round uint32) (types.Hash, error)
- func (c *Client) GetRoundStartHash(round uint32) (types.Hash, error)
- func (c *Client) GetStorage(pallet string, method string, target interface{}, args ...[]byte) (ok bool, err error)
- func (c *Client) GetStorageAt(pallet string, method string, target interface{}, blockHash types.Hash, ...) (ok bool, err error)
- func (c *Client) GetStorageRaw(pallet string, method string, typeString string, targetValue any, ...) error
- func (c *Client) GetStorageRawAt(pallet string, method string, typeString string, blockHash types.Hash, ...) error
- func (c *Client) GetStorageRawWithTtl(pallet string, method string, typeString string, cacheTtl time.Duration, ...) error
- type CollatorHistory
- type CollatorInfo
- type CollatorPool
- type DelegatorState
- type RevokeRound
- type ScaleEnum
- type Snap
- type SnapBlock
- type SnapRound
- type SnapStaking
- type TokenAmount
- type TokenBalance
- type TokenInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitUnmarshalData ¶
func InitUnmarshalData(info TokenInfo)
Types ¶
type AccountBalance ¶
type AccountBalance struct {
Free TokenBalance `json:"free"`
Reserved TokenBalance `json:"reserved"`
Frozen TokenBalance `json:"frozen"`
}
func (*AccountBalance) GetTransferableBalance ¶ added in v0.0.16
func (ab *AccountBalance) GetTransferableBalance() *TokenBalance
type AccountIdentity ¶
type AccountIdentity struct {
Display string `json:"display,omitempty"`
}
type AccountInfo ¶
type AccountInfo struct {
Address string `json:"address"`
Balance AccountBalance `json:"balance"`
Identity AccountIdentity `json:"identity,omitempty"`
}
type CandidatePoolEntry ¶
type CandidatePoolEntry struct {
Owner string
Amount TokenAmount
}
type Client ¶
type Client struct {
RpcUrl string `json:"endpoint"`
Chain string `json:"chain"`
SpecVersion int `json:"spec"`
SnapBlock SnapBlock `json:"block"`
SnapRound SnapRound `json:"round"`
SnapStaking SnapStaking `json:"candidate_pool"`
TokenInfo TokenInfo `json:"token"`
// contains filtered or unexported fields
}
func NewClientWithExternalCache ¶
func NewClientWithExternalCache(cfg config.ChainConfig, cache *mcache.CacheDriver) (*Client, error)
func (*Client) FetchAccountInfo ¶
func (c *Client) FetchAccountInfo(address string) (AccountInfo, error)
func (*Client) FetchCollatorBlocks ¶
func (*Client) FetchCollatorHistory ¶
func (*Client) FetchCollatorInfo ¶
func (c *Client) FetchCollatorInfo( address string, selected bool, rank uint32, cfg config.CollatorsPoolConfig, ) (CollatorInfo, error)
func (*Client) FetchCollatorPool ¶
func (c *Client) FetchCollatorPool(poolConfig config.CollatorsPoolConfig) (CollatorPool, error)
func (*Client) FetchSelectedCandidates ¶
FetchSelectedCandidates returns a list of addresses currently selected
func (*Client) FetchSortedCandidatePool ¶
func (c *Client) FetchSortedCandidatePool(blockHash types.Hash) ([]CandidatePoolEntry, error)
FetchSortedCandidatePool returns the full list of candidates with bonded amount
func (*Client) GetCandidateBondLessDelay ¶
GetCandidateBondLessDelay will fetch current bond delay
func (*Client) GetConstantValue ¶
func (c *Client) GetConstantValue( pallet string, method string, typeString string, targetValue any, ) error
GetConstantValue will fetch a constant value and Marshal it as JSON
func (*Client) GetRoundStartHash ¶
func (*Client) GetStorage ¶
func (*Client) GetStorageAt ¶
func (*Client) GetStorageRaw ¶
func (c *Client) GetStorageRaw( pallet string, method string, typeString string, targetValue any, args ...[]byte, ) error
GetStorageRaw will fetch storage at client snap block with minimum cache TTL (since we have no block reference)
type CollatorHistory ¶
type CollatorHistory struct {
Rank uint32 `json:"rank"`
Blocks uint32 `json:"blocks"`
Counted TokenBalance `json:"counted"`
}
type CollatorInfo ¶
type CollatorInfo struct {
Address string `json:"address"`
Selected bool `json:"selected"`
Rank uint32 `json:"rank"`
Blocks uint32 `json:"blocks"`
Counted TokenBalance `json:"counted"`
MinBond TokenBalance `json:"min_bond"`
Balance AccountBalance `json:"balance"`
Display string `json:"display"`
History map[uint32]CollatorHistory `json:"history,omitempty"`
Delegations []DelegatorState `json:"-"`
Revokes map[uint32]RevokeRound `json:"revokes,omitempty"`
}
func (*CollatorInfo) AverageBlocks ¶
func (ci *CollatorInfo) AverageBlocks() float32
func (*CollatorInfo) DisplayName ¶
func (ci *CollatorInfo) DisplayName() string
func (*CollatorInfo) RevokeAt ¶
func (ci *CollatorInfo) RevokeAt(round uint32) *RevokeRound
type CollatorPool ¶
type CollatorPool struct {
SelectedSize uint32 `json:"selected_size"`
RoundNumber uint32 `json:"round_number"`
Collators []CollatorInfo `json:"collators"`
}
func (*CollatorPool) CollatorInfoByAddress ¶
func (cp *CollatorPool) CollatorInfoByAddress(address string) (CollatorInfo, bool)
type DelegatorState ¶
type DelegatorState struct {
Address string `json:"address"`
Amount TokenBalance `json:"amount"`
RevokeAmount TokenBalance `json:"revoke_amount,omitempty"`
RevokeReason string `json:"revoke_reason,omitempty"`
RevokeRound uint32 `json:"revoke_round,omitempty"`
}
type RevokeRound ¶
type RevokeRound struct {
Rank uint32 `json:"rank"`
Counted TokenBalance `json:"counted"`
Amount TokenBalance `json:"amount"`
}
type Snap ¶
type Snap struct {
Block SnapBlock
Round SnapRound
Staking SnapStaking
}
type SnapStaking ¶
type TokenAmount ¶
type TokenAmount struct {
// contains filtered or unexported fields
}
func (*TokenAmount) AsBalance ¶
func (b *TokenAmount) AsBalance(info *TokenInfo) TokenBalance
func (*TokenAmount) AsBigInt ¶
func (b *TokenAmount) AsBigInt() *big.Int
func (*TokenAmount) Cmp ¶
func (b *TokenAmount) Cmp(y *TokenAmount) int
func (*TokenAmount) MarshalJSON ¶
func (b *TokenAmount) MarshalJSON() ([]byte, error)
func (*TokenAmount) UnmarshalJSON ¶
func (b *TokenAmount) UnmarshalJSON(p []byte) error
type TokenBalance ¶
type TokenBalance struct {
Balance *TokenAmount `json:"balance"`
// contains filtered or unexported fields
}
func TokenBalanceU128 ¶
func TokenBalanceU128(c *Client, u128 types.U128) TokenBalance
func (*TokenBalance) Float64 ¶
func (tb *TokenBalance) Float64() float64
func (TokenBalance) MarshalJSON ¶
func (tb TokenBalance) MarshalJSON() ([]byte, error)
func (*TokenBalance) UnmarshalJSON ¶
func (tb *TokenBalance) UnmarshalJSON(p []byte) error
Click to show internal directories.
Click to hide internal directories.