gofer

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 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 provider.Pair
	Path []nodes.Node
}

func (ErrCyclicReference) Error

func (e ErrCyclicReference) Error() string

type Gofer

type Gofer struct {
	RPC           RPC                   `json:"rpc"` // Old configuration format, to remove in the future.
	RPCListenAddr string                `json:"rpcListenAddr"`
	Origins       map[string]Origin     `json:"origins"`
	PriceModels   map[string]PriceModel `json:"priceModels"`
}

func (*Gofer) ConfigureAsyncGofer

func (c *Gofer) ConfigureAsyncGofer(cli ethereum.Client, logger log.Logger) (provider.Provider, error)

ConfigureAsyncGofer returns a new async gofer instance.

func (*Gofer) ConfigureGofer

func (c *Gofer) ConfigureGofer(cli ethereum.Client, logger log.Logger, noRPC bool) (provider.Provider, error)

ConfigureGofer returns a new async gofer instance.

func (*Gofer) ConfigurePriceHook

func (c *Gofer) ConfigurePriceHook(ctx context.Context, cli ethereum.Client) (provider.PriceHook, error)

func (*Gofer) ConfigureRPCAgent

func (c *Gofer) ConfigureRPCAgent(cli ethereum.Client, gof provider.Provider, logger log.Logger) (*rpc.Agent, error)

ConfigureRPCAgent returns a new rpc.Agent instance.

type MedianPriceModel

type MedianPriceModel struct {
	MinSourceSuccess int                    `json:"minimumSuccessfulSources"`
	PostPriceHook    map[string]interface{} `json:"postPriceHook"`
}

type Origin

type Origin struct {
	Type   string          `json:"type"`
	URL    string          `json:"url"` // TODO: Move it to the params field.
	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