store

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountDetail

type AccountDetail struct {
	Address string `json:"Address"`

	Name string `json:"Name"`

	Monitored bool `json:"Monitored,omitempty"`
}

func (AccountDetail) String

func (d AccountDetail) String() string

type Store

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

func NewStore

func NewStore(db db.KeyValueReaderWriter) *Store

NewStore creates a new Store with the given db.

func (*Store) GetAccountDetail

func (s *Store) GetAccountDetail(address string) (*AccountDetail, error)

GetAccountDetail retrieves the detail of an Account given its address.

func (*Store) GetAllAccountDetails

func (s *Store) GetAllAccountDetails() ([]AccountDetail, error)

GetAllAccountDetails retrieves all saved account details.

func (*Store) GetAllMonitoredAccounts

func (s *Store) GetAllMonitoredAccounts() (map[string]*AccountDetail, error)

GetAllMonitoredAccounts retrieves all monitored account.

func (*Store) GetAllTokenDetails

func (s *Store) GetAllTokenDetails() (map[string]TokenDetail, error)

func (*Store) GetLastBlock

func (s *Store) GetLastBlock(chainID uint8) (*big.Int, error)

GetLastBlock retrieves the latest block for a given chainID from the db.

func (*Store) GetTokenDetail

func (s *Store) GetTokenDetail(tokenAddress string) TokenDetail

func (*Store) Init

func (s *Store) Init() error

func (*Store) IsAccountMonitored

func (s *Store) IsAccountMonitored(address string) (bool, error)

IsAccountMonitored checks if the given address is monitored.

func (*Store) IsTxProcessed

func (s *Store) IsTxProcessed(txHash []byte) (bool, error)

IsTxProcessed checks if the given txHash has been processed.

func (*Store) StoreAccountDetail

func (s *Store) StoreAccountDetail(detail AccountDetail) error

StoreAccountDetail stores the given AccountDetail to db.

func (*Store) StoreLastBlock

func (s *Store) StoreLastBlock(blk *big.Int, chainID uint8) error

StoreLastBlock stores the latest block for a given chainID to the db.

func (*Store) StoreProcessedTx

func (s *Store) StoreProcessedTx(txHash []byte) error

StoreProcessedTx marks the given txHash as processed.

func (*Store) UpdateTokenDetail

func (s *Store) UpdateTokenDetail(d TokenDetail) error

type TokenDetail

type TokenDetail struct {
	// TokenName is the name of the token.
	TokenName string `json:"TokenName,omitempty" binding:"required"`

	// TokenAddress is the EVM address of the token.
	TokenAddress string `json:"TokenAddress" binding:"required"`

	// Decimals is the number of decimal places of the token.
	Decimals int `json:"Decimals" binding:"required"`

	// WhaleDefinition is the amount to trigger the whale alerts.
	WhaleDefinition float64 `json:"WhaleDefinition,omitempty"`
}

Jump to

Keyboard shortcuts

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