tokens

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: AGPL-3.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEndpoint = errs.Class("tokens endpoint")

ErrEndpoint - tokens endpoint error class.

View Source
var ErrService = errs.Class("tokens service")

ErrService - tokens service error class.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoints string `` /* 395-byte string literal not displayed */
}

Config holds tokens service configuration.

type Endpoint

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

Endpoint for querying ERC20 token information from ethereum chain.

architecture: Endpoint

func NewEndpoint

func NewEndpoint(log *zap.Logger, service *Service) *Endpoint

NewEndpoint creates new payments endpoint instance.

func (*Endpoint) AllPayments

func (endpoint *Endpoint) AllPayments(w http.ResponseWriter, r *http.Request)

AllPayments endpoint retrieves all ERC20 token payments claimed by one satellite starting from particular block for ethereum address.

func (*Endpoint) Payments

func (endpoint *Endpoint) Payments(w http.ResponseWriter, r *http.Request)

Payments endpoint retrieves all ERC20 token payments of one specific wallet, starting from particular block for ethereum address.

func (*Endpoint) Register

func (endpoint *Endpoint) Register(router *mux.Router)

Register registers endpoint methods on API server subroute.

type LatestPayments

type LatestPayments struct {
	LatestBlocks []blockchain.Header
	Payments     []Payment
}

LatestPayments contains latest payments and latest chain block header.

type Payment

type Payment struct {
	ChainID     int64
	From        common.Address
	To          common.Address
	TokenValue  currency.Amount
	USDValue    currency.Amount
	BlockHash   common.Hash
	BlockNumber int64
	Transaction common.Hash
	LogIndex    int
	Timestamp   time.Time
}

Payment is on chain payment made for particular contract and deposit wallet.

type Service

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

Service for querying ERC20 token information from ethereum chain.

architecture: Service

func NewService

func NewService(
	log *zap.Logger,
	endpoints []common.EthEndpoint,
	headersCache *blockchain.HeadersCache,
	events *events.Service,
	tokenPrice *tokenprice.Service) *Service

NewService creates new token service instance.

func (*Service) AllPayments

func (service *Service) AllPayments(ctx context.Context, satelliteID string, from map[int64]int64) (_ LatestPayments, err error)

AllPayments returns all the payments across all configured endpoints starting from a particular block per chain associated with the current satellite.

func (*Service) GetChainIds added in v1.0.5

func (service *Service) GetChainIds(ctx context.Context) (chainIds map[int64]string, err error)

GetChainIds returns the chain ids of the currently configured endpoints.

func (*Service) GetEndpoints added in v1.0.6

func (service *Service) GetEndpoints() []common.EthEndpoint

GetEndpoints returns the currently configured endpoints.

func (*Service) Payments

func (service *Service) Payments(ctx context.Context, address common.Address, from map[int64]int64) (_ LatestPayments, err error)

Payments retrieves all ERC20 token payments across all configured endpoints starting from a particular block per chain for ethereum address.

func (*Service) PingAll added in v1.0.5

func (service *Service) PingAll(ctx context.Context) (err error)

PingAll checks if configured blockchain services are available for use.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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