Documentation ¶
Index ¶
- Constants
- Variables
- func GetOldestTimestamp(ctx context.Context, db *sql.DB, addresses []eth.Address) (timestamp int64, err error)
- func GetRecipients(ctx context.Context, db *sql.DB, offset int, limit int) (addresses []eth.Address, hasMore bool, err error)
- type Entry
- type ErrorCode
- type Filter
- type FilterDependencies
- type FilterResponse
- type GetOldestTimestampResponse
- type GetRecipientsResponse
- type PayloadType
- type Period
- type ReplacementPolicy
- type Scheduler
- type Service
- func (s *Service) FilterActivityAsync(ctx context.Context, addresses []common.Address, chainIDs []w_common.ChainID, ...)
- func (s *Service) GetOldestTimestampAsync(ctx context.Context, addresses []common.Address)
- func (s *Service) GetRecipientsAsync(ctx context.Context, offset int, limit int) bool
- func (s *Service) Stop()
- type Status
- type TaskType
- type Token
- type TokenID
- type TokenType
- type Type
Constants ¶
const ( // FilterResponse json is sent as a message in the EventActivityFilteringDone event EventActivityFilteringDone walletevent.EventType = "wallet-activity-filtering-done" EventActivityGetRecipientsDone walletevent.EventType = "wallet-activity-get-recipients-result" EventActivityGetOldestTimestampDone walletevent.EventType = "wallet-activity-get-oldest-timestamp-result" )
const NoLimitTimestampForPeriod = 0
Variables ¶
var ErrTaskOverwritten = errors.New("task overwritten")
var (
ZeroAddress = eth.Address{}
)
Functions ¶
func GetOldestTimestamp ¶ added in v0.159.6
Types ¶
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
func (*Entry) MarshalJSON ¶
func (*Entry) PayloadType ¶ added in v0.152.2
func (e *Entry) PayloadType() PayloadType
func (*Entry) UnmarshalJSON ¶
type Filter ¶
type Filter struct { Period Period `json:"period"` Types []Type `json:"types"` Statuses []Status `json:"statuses"` CounterpartyAddresses []eth.Address `json:"counterpartyAddresses"` // Tokens Assets []Token `json:"assets"` Collectibles []Token `json:"collectibles"` FilterOutAssets bool `json:"filterOutAssets"` FilterOutCollectibles bool `json:"filterOutCollectibles"` }
type FilterDependencies ¶ added in v0.159.2
type FilterDependencies struct {
// contains filtered or unexported fields
}
type FilterResponse ¶ added in v0.158.0
type GetOldestTimestampResponse ¶ added in v0.161.2
type GetRecipientsResponse ¶ added in v0.161.2
type PayloadType ¶
type PayloadType = int
const ( MultiTransactionPT PayloadType = iota + 1 SimpleTransactionPT PendingTransactionPT )
Beware: pleas update multiTransactionTypeToActivityType if changing this enum
type ReplacementPolicy ¶ added in v0.161.2
type ReplacementPolicy = int
const ( ReplacementPolicyCancelOld ReplacementPolicy = iota ReplacementPolicyIgnoreNew )
type Scheduler ¶ added in v0.161.2
type Scheduler struct {
// contains filtered or unexported fields
}
func NewScheduler ¶ added in v0.161.2
func NewScheduler() *Scheduler
func (*Scheduler) Enqueue ¶ added in v0.161.2
func (s *Scheduler) Enqueue(taskType TaskType, taskFn taskFunction, resFn resultFunction) (ignored bool)
Enqueue provides a queue of task types allowing only one task at a time of the corresponding type. The running task is the first one in the queue (s.queue.Oldest())
Schedule policy for new tasks
- pushed at the back of the queue (s.queue.PushBack()) if none of the same time already scheduled
- overwrite the queued one of the same type, depending on the policy
- In case of ReplacementPolicyIgnoreNew, the new task will be ignored
- In case of ReplacementPolicyCancelOld, the old running task will be canceled or if not yet run overwritten and the new one will be executed when its turn comes.
The task function (taskFn) might not be executed if
- the task is ignored
- the task is overwritten. The result function (resFn) will be called with ErrTaskOverwritten
The result function (resFn) will always be called if the task is not ignored
type Service ¶ added in v0.158.0
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶ added in v0.158.0
func (*Service) FilterActivityAsync ¶ added in v0.158.0
func (s *Service) FilterActivityAsync(ctx context.Context, addresses []common.Address, chainIDs []w_common.ChainID, filter Filter, offset int, limit int)
FilterActivityAsync allows only one filter task to run at a time and it cancels the current one if a new one is started All calls will trigger an EventActivityFilteringDone event with the result of the filtering
func (*Service) GetOldestTimestampAsync ¶ added in v0.161.2
func (*Service) GetRecipientsAsync ¶ added in v0.161.2
GetRecipientsAsync returns true if a task is already running or scheduled due to a previous call; meaning that this call won't receive an answer but client should rely on the answer from the previous call. If no task is already scheduled false will be returned
type TaskType ¶ added in v0.161.2
type TaskType struct { ID int Policy ReplacementPolicy }
type Token ¶ added in v0.159.2
type Token struct { TokenType TokenType `json:"tokenType"` // ChainID is used for TokenType.Native only to lookup the symbol, all chains will be included in the token filter ChainID common.ChainID `json:"chainId"` Address eth.Address `json:"address,omitempty"` TokenID TokenID `json:"tokenId,omitempty"` }
Token supports all tokens. Some fields might be optional, depending on the TokenType