Documentation ¶
Index ¶
Constants ¶
View Source
const ( EventBalanceHistoryUpdateStarted walletevent.EventType = "wallet-balance-history-update-started" EventBalanceHistoryUpdateFinished walletevent.EventType = "wallet-balance-history-update-finished" EventBalanceHistoryUpdateFinishedWithError walletevent.EventType = "wallet-balance-history-update-finished-with-error" )
EventBalanceHistoryUpdateStarted and EventBalanceHistoryUpdateDone are used to notify the UI that balance history is being updated
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BalanceDB ¶
type BalanceDB struct {
// contains filtered or unexported fields
}
func NewBalanceDB ¶
type DataSource ¶
type DataSource interface { HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) ChainID() uint64 Currency() string TimeNow() int64 }
DataSource used as an abstraction to fetch required data from a specific blockchain
type Exchange ¶ added in v0.131.5
type Exchange struct {
// contains filtered or unexported fields
}
Exchange caches conversion rates in memory on a daily basis
func NewExchange ¶ added in v0.131.5
func NewExchange(cryptoCompare *thirdparty.CryptoCompare) *Exchange
func (*Exchange) FetchAndCacheMissingRates ¶ added in v0.131.5
fetchAndCacheRates fetches and in memory cache exchange rates for this and last year
func (*Exchange) GetExchangeRateForDay ¶ added in v0.131.5
func (e *Exchange) GetExchangeRateForDay(token tokenType, currency currencyType, date time.Time) (float32, error)
GetExchangeRate returns the exchange rate from token to currency in the day of the given date if none exists returns "missing <element>" error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) GetBalanceHistory ¶
func (s *Service) GetBalanceHistory(ctx context.Context, chainIDs []uint64, address common.Address, tokenSymbol string, currencySymbol string, endTimestamp int64, timeInterval TimeInterval) ([]*ValuePoint, error)
GetBalanceHistory returns token count balance
func (*Service) UpdateVisibleTokens ¶
type TimeInterval ¶
type TimeInterval int
const ( BalanceHistory7Days TimeInterval = iota + 1 BalanceHistory1Month BalanceHistory6Months BalanceHistory1Year BalanceHistoryAllTime )
Specific time intervals for which balance history can be fetched
Click to show internal directories.
Click to hide internal directories.