activity

package
v0.160.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FilterResponse json is sent as a message in the EventActivityFilteringDone event
	EventActivityFilteringDone walletevent.EventType = "wallet-activity-filtering-done"
)
View Source
const NoLimitTimestampForPeriod = 0

Variables

View Source
var (
	ZeroAddress = eth.Address{}
)

Functions

func GetOldestTimestamp added in v0.159.6

func GetOldestTimestamp(ctx context.Context, db *sql.DB, addresses []eth.Address) (timestamp int64, err error)

func GetRecipients added in v0.159.2

func GetRecipients(ctx context.Context, db *sql.DB, offset int, limit int) (addresses []eth.Address, hasMore bool, err error)

Types

type Entry

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

func NewActivityEntryWithMultiTransaction

func NewActivityEntryWithMultiTransaction(id transfer.MultiTransactionIDType, timestamp int64, activityType Type, activityStatus Status, amountIn *hexutil.Big, amountOut *hexutil.Big, tokenOut *Token, tokenIn *Token) Entry

func (*Entry) MarshalJSON

func (e *Entry) MarshalJSON() ([]byte, error)

func (*Entry) PayloadType added in v0.152.2

func (e *Entry) PayloadType() PayloadType

func (*Entry) UnmarshalJSON

func (e *Entry) UnmarshalJSON(data []byte) error

type ErrorCode added in v0.158.0

type ErrorCode = int
const (
	ErrorCodeSuccess ErrorCode = iota + 1
	ErrorCodeFilterCanceled
	ErrorCodeFilterFailed
)

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 FilterResponse struct {
	Activities []Entry `json:"activities"`
	Offset     int     `json:"offset"`
	// Used to indicate that there might be more entries that were not returned
	// based on a simple heuristic
	HasMore   bool      `json:"hasMore"`
	ErrorCode ErrorCode `json:"errorCode"`
}

type PayloadType

type PayloadType = int
const (
	MultiTransactionPT PayloadType = iota + 1
	SimpleTransactionPT
	PendingTransactionPT
)

Beware: pleas update multiTransactionTypeToActivityType if changing this enum

type Period

type Period struct {
	StartTimestamp int64 `json:"startTimestamp"`
	EndTimestamp   int64 `json:"endTimestamp"`
}

type Service added in v0.158.0

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

func NewService added in v0.158.0

func NewService(db *sql.DB, tokenManager *token.Manager, eventFeed *event.Feed) *Service

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) error

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) Stop added in v0.158.0

func (s *Service) Stop()

type Status

type Status int
const (
	FailedAS    Status = iota // failed status or at least one failed transaction for multi-transactions
	PendingAS                 // in pending DB or at least one transaction in pending for multi-transactions
	CompleteAS                // success status
	FinalizedAS               // all multi-transactions have success status
)

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

type TokenID added in v0.159.2

type TokenID *hexutil.Big

type TokenType

type TokenType int
const (
	Native TokenType = iota
	Erc20
	Erc721
	Erc1155
)

type Type

type Type int
const (
	SendAT Type = iota
	ReceiveAT
	BuyAT
	SwapAT
	BridgeAT
)

Jump to

Keyboard shortcuts

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