Documentation ¶
Index ¶
- Constants
- func AssetToProtoAccountBalance(asset *OwnedAsset) *pbtokenmeta.AccountBalance
- func SortTokensByHolderCount(tokens []*pbtokenmeta.Token, order SortingOrder) []*pbtokenmeta.Token
- func SortTokensByMarketCap(tokens []*pbtokenmeta.Token, order SortingOrder) []*pbtokenmeta.Token
- func SortTokensBySymbolAlpha(tokens []*pbtokenmeta.Token, order SortingOrder) []*pbtokenmeta.Token
- type AccountBalanceOption
- type Block
- type Cache
- type DefaultCache
- func (c *DefaultCache) AccountBalances(account eos.AccountName, opts ...AccountBalanceOption) (ownedAssets []*OwnedAsset)
- func (c *DefaultCache) Apply(mutationsBatch *MutationsBatch, processedBlock bstream.BlockRef) (errors []error)
- func (c *DefaultCache) AtBlockRef() bstream.BlockRef
- func (c *DefaultCache) IsTokenContract(contract eos.AccountName) bool
- func (c *DefaultCache) SaveToFile() error
- func (c *DefaultCache) TokenBalances(contract eos.AccountName, opts ...TokenBalanceOption) (tokenBalances []*OwnedAsset)
- func (c *DefaultCache) TokenContract(contract eos.AccountName, code eos.SymbolCode) *pbtokenmeta.Token
- func (c *DefaultCache) Tokens() (tokens []*pbtokenmeta.Token)
- type EOSStake
- type EOSStakeEntry
- type Mutation
- type MutationType
- type MutationsBatch
- func (m *MutationsBatch) Mutations() []*Mutation
- func (m *MutationsBatch) RemoveBalance(bal *pbtokenmeta.AccountBalance)
- func (m *MutationsBatch) SetBalance(bal *pbtokenmeta.AccountBalance)
- func (m *MutationsBatch) SetStake(stake *EOSStakeEntry)
- func (m *MutationsBatch) SetToken(token *pbtokenmeta.Token)
- type OwnedAsset
- func ProtoEOSAccountBalanceToOwnedAsset(bal *pbtokenmeta.AccountBalance) *OwnedAsset
- func SortOwnedAssetByAccountAlpha(assets []*OwnedAsset, order SortingOrder) []*OwnedAsset
- func SortOwnedAssetBySymbolAlpha(assets []*OwnedAsset, order SortingOrder) []*OwnedAsset
- func SortOwnedAssetByTokenAmount(assets []*OwnedAsset, order SortingOrder) []*OwnedAsset
- func SortOwnedAssetByTokenMarketValue(assets []*OwnedAsset, order SortingOrder) []*OwnedAsset
- type OwnedAssetSorter
- type SortingOrder
- type TokenBalanceOption
Constants ¶
View Source
const EOSTokenContract = eos.AccountName("eosio.token")
Variables ¶
This section is empty.
Functions ¶
func AssetToProtoAccountBalance ¶
func AssetToProtoAccountBalance(asset *OwnedAsset) *pbtokenmeta.AccountBalance
func SortTokensByHolderCount ¶
func SortTokensByHolderCount(tokens []*pbtokenmeta.Token, order SortingOrder) []*pbtokenmeta.Token
func SortTokensByMarketCap ¶
func SortTokensByMarketCap(tokens []*pbtokenmeta.Token, order SortingOrder) []*pbtokenmeta.Token
TODO: implement me
func SortTokensBySymbolAlpha ¶
func SortTokensBySymbolAlpha(tokens []*pbtokenmeta.Token, order SortingOrder) []*pbtokenmeta.Token
Types ¶
type AccountBalanceOption ¶
type AccountBalanceOption int
const (
EOSIncludeStakedAccOpt AccountBalanceOption = iota
)
type Cache ¶
type Cache interface { Tokens() []*pbtokenmeta.Token IsTokenContract(contract eos.AccountName) bool TokenContract(contract eos.AccountName, code eos.SymbolCode) *pbtokenmeta.Token AccountBalances(account eos.AccountName, opts ...AccountBalanceOption) []*OwnedAsset TokenBalances(contract eos.AccountName, opts ...TokenBalanceOption) []*OwnedAsset Apply(mutationsBatch *MutationsBatch, processedBlock bstream.BlockRef) []error SaveToFile() error AtBlockRef() bstream.BlockRef }
type DefaultCache ¶
type DefaultCache struct { // eosio.token -> [WAX, EOS] TokensInContract map[eos.AccountName][]*pbtokenmeta.Token `json:"tokens_in_contract"` // tokencontract-centric: eosio.token -> eoscanadadad -> [23 WAX, 22 EOS] Balances map[eos.AccountName]map[eos.AccountName][]*OwnedAsset `json:"balances"` AtBlock *Block `json:"at_block"` EOSStake map[eos.AccountName]*EOSStake `json:"eos_stake"` // contains filtered or unexported fields }
func LoadDefaultCacheFromFile ¶
func LoadDefaultCacheFromFile(filename string) (*DefaultCache, error)
func NewDefaultCache ¶
func NewDefaultCache(cacheFilePath string) *DefaultCache
func NewDefaultCacheWithData ¶
func NewDefaultCacheWithData(tokensInContract []*pbtokenmeta.Token, tokenBalances []*pbtokenmeta.AccountBalance, stakedEntries []*EOSStakeEntry, startBlock bstream.BlockRef, cacheFilePath string) *DefaultCache
func (*DefaultCache) AccountBalances ¶
func (c *DefaultCache) AccountBalances(account eos.AccountName, opts ...AccountBalanceOption) (ownedAssets []*OwnedAsset)
func (*DefaultCache) Apply ¶
func (c *DefaultCache) Apply(mutationsBatch *MutationsBatch, processedBlock bstream.BlockRef) (errors []error)
func (*DefaultCache) AtBlockRef ¶
func (c *DefaultCache) AtBlockRef() bstream.BlockRef
func (*DefaultCache) IsTokenContract ¶
func (c *DefaultCache) IsTokenContract(contract eos.AccountName) bool
func (*DefaultCache) SaveToFile ¶
func (c *DefaultCache) SaveToFile() error
func (*DefaultCache) TokenBalances ¶
func (c *DefaultCache) TokenBalances(contract eos.AccountName, opts ...TokenBalanceOption) (tokenBalances []*OwnedAsset)
func (*DefaultCache) TokenContract ¶
func (c *DefaultCache) TokenContract(contract eos.AccountName, code eos.SymbolCode) *pbtokenmeta.Token
func (*DefaultCache) Tokens ¶
func (c *DefaultCache) Tokens() (tokens []*pbtokenmeta.Token)
type EOSStake ¶
type EOSStake struct { TotalNet eos.Int64 `json:"total_net"` TotalCpu eos.Int64 `json:"total_cpu"` Entries map[eos.AccountName]*EOSStakeEntry `json:"stake_entries"` }
type EOSStakeEntry ¶
type EOSStakeEntry struct { To eos.AccountName `json:"to"` From eos.AccountName `json:"from"` Net eos.Int64 `json:"net"` Cpu eos.Int64 `json:"cpu"` }
type Mutation ¶
type Mutation struct { Type MutationType Args []interface{} }
type MutationType ¶
type MutationType int
const ( SetBalanceMutation MutationType = iota RemoveBalanceMutation SetTokenMutation SetStakeMutation )
type MutationsBatch ¶
type MutationsBatch struct {
// contains filtered or unexported fields
}
func (*MutationsBatch) Mutations ¶
func (m *MutationsBatch) Mutations() []*Mutation
func (*MutationsBatch) RemoveBalance ¶
func (m *MutationsBatch) RemoveBalance(bal *pbtokenmeta.AccountBalance)
TODO THIS IS NEVER CALLED, so holders do not decrement.. RemoveBalance removes a 0-value and decrements holders
func (*MutationsBatch) SetBalance ¶
func (m *MutationsBatch) SetBalance(bal *pbtokenmeta.AccountBalance)
func (*MutationsBatch) SetStake ¶
func (m *MutationsBatch) SetStake(stake *EOSStakeEntry)
func (*MutationsBatch) SetToken ¶
func (m *MutationsBatch) SetToken(token *pbtokenmeta.Token)
SetToken should be called when you change maximumSupply or Supply. It ignores the `holders` attribute from token param
type OwnedAsset ¶
type OwnedAsset struct { Owner eos.AccountName // ex: eoscanadadad Asset *eos.ExtendedAsset // ex: 1.23 EOS (eosio.token) }
func ProtoEOSAccountBalanceToOwnedAsset ¶
func ProtoEOSAccountBalanceToOwnedAsset(bal *pbtokenmeta.AccountBalance) *OwnedAsset
func SortOwnedAssetByAccountAlpha ¶
func SortOwnedAssetByAccountAlpha(assets []*OwnedAsset, order SortingOrder) []*OwnedAsset
func SortOwnedAssetBySymbolAlpha ¶
func SortOwnedAssetBySymbolAlpha(assets []*OwnedAsset, order SortingOrder) []*OwnedAsset
func SortOwnedAssetByTokenAmount ¶
func SortOwnedAssetByTokenAmount(assets []*OwnedAsset, order SortingOrder) []*OwnedAsset
func SortOwnedAssetByTokenMarketValue ¶
func SortOwnedAssetByTokenMarketValue(assets []*OwnedAsset, order SortingOrder) []*OwnedAsset
type OwnedAssetSorter ¶
type OwnedAssetSorter func([]*OwnedAsset, SortingOrder) []*OwnedAsset
type TokenBalanceOption ¶
type TokenBalanceOption int
const (
EOSIncludeStakedTokOpt TokenBalanceOption = iota
)
Click to show internal directories.
Click to hide internal directories.