gofer

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(
	origin string,
	wp query.WorkerPool,
	cli pkgEthereum.Client,
	baseURL string,
	params json.RawMessage) (origins.Handler, error)

Types

type ErrCyclicReference

type ErrCyclicReference struct {
	Pair gofer.Pair
	Path []nodes.Node
}

func (ErrCyclicReference) Error

func (e ErrCyclicReference) Error() string

type Gofer

type Gofer struct {
	RPC         RPC                   `json:"rpc"`
	EthRPC      string                `json:"ethRpc"`
	Origins     map[string]Origin     `json:"origins"`
	PriceModels map[string]PriceModel `json:"priceModels"`
}

func (*Gofer) ConfigureGofer

func (c *Gofer) ConfigureGofer(
	ctx context.Context,
	cli pkgEthereum.Client,
	logger log.Logger,
	noRPC bool) (gofer.Gofer, error)

func (*Gofer) ConfigureRPCAgent

func (c *Gofer) ConfigureRPCAgent(ctx context.Context, cli pkgEthereum.Client, logger log.Logger) (*rpc.Agent, error)

ConfigureRPCAgent returns a new rpc.Agent instance.

type MedianPriceModel

type MedianPriceModel struct {
	MinSourceSuccess int `json:"minimumSuccessfulSources"`
}

type Origin

type Origin struct {
	Type   string          `json:"type"`
	Name   string          `json:"name"`
	URL    string          `json:"url"`
	Params json.RawMessage `json:"params"`
}

type PriceModel

type PriceModel struct {
	Method  string          `json:"method"`
	Sources [][]Source      `json:"sources"`
	Params  json.RawMessage `json:"params"`
	TTL     int             `json:"ttl"`
}

type RPC

type RPC struct {
	Address string `json:"address"`
}

type Source

type Source struct {
	Origin string `json:"origin"`
	Pair   string `json:"pair"`
	TTL    int    `json:"ttl"`
}

Jump to

Keyboard shortcuts

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