watcher

package
v0.0.0-...-eea9bf4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BasicOrderFulfilled = common.HexToHash("0x9d9af8e38d66c62e2c12f0225249fd9d721c54b83f48d9352c97c6cacdcb6f31")
	ERC721InterfaceId   = common.BytesToHash([]byte("0x80ac58cd"))
	ERC1155InterfaceId  = common.BytesToHash([]byte("0xd9b67a26"))
	ChainlinkMaticPairs = "https://reference-data-directory.vercel.app/feeds-matic-mainnet.json"
)

Common variables

Functions

func LatestBlockNumber

func LatestBlockNumber(c *ethclient.Client, interval time.Duration) <-chan uint64

Helper function to get the latest block number from the node

func RequestTokenMetadata

func RequestTokenMetadata(INFURA_KEY string, INFURA_KEY_SECRET string, meta MetadataRequest) string

Function to request the NFT metadata from the infura nft api

func RequestTokenPrice

func RequestTokenPrice(c *ethclient.Client, contractAddress common.Address) (*big.Float, string)

Function to request pair price (if available) from the chainlink oracle

func Watcher

func Watcher(c *ethclient.Client, contractAddress common.Address, events chan<- WatcherEvent, infuraKey string, infuraSecret string)

Functor to initialize and watch events for the Seaport contract

Types

type ImageMetadata

type ImageMetadata struct {
	Token string `json:"image"`
}

type MetadataRequest

type MetadataRequest struct {
	ContractAddress string
	TokenID         string
	ChainID         string
}

type Pair

type Pair struct {
	CompareOffchain     string   `json:"compareOffchain"`
	ContractAddress     string   `json:"contractAddress"`
	ContractType        string   `json:"contractType"`
	ContractVersion     int      `json:"contractVersion"`
	DecimalPlaces       int      `json:"decimalPlaces"`
	Ens                 string   `json:"ens"`
	FormatDecimalPlaces int      `json:"formatDecimalPlaces"`
	HealthPrice         string   `json:"healthPrice"`
	Heartbeat           int      `json:"heartbeat"`
	History             bool     `json:"history"`
	Multiply            string   `json:"multiply"`
	Name                string   `json:"name"`
	Pair                []string `json:"pair"`
	Path                string   `json:"path"`
	ProxyAddress        string   `json:"proxyAddress"`
	Threshold           float64  `json:"threshold"`
	ValuePrefix         string   `json:"valuePrefix"`
	AssetName           string   `json:"assetName"`
	FeedCategory        string   `json:"feedCategory"`
	FeedType            string   `json:"feedType"`
	Docs                struct {
		AssetName    string `json:"assetName"`
		FeedCategory string `json:"feedCategory"`
		FeedType     string `json:"feedType"`
	} `json:"docs"`
	Decimals int `json:"decimals"`
}

type WatcherEvent

type WatcherEvent struct {
	UUID                 string `json:"uuid"`
	BlockNumber          uint64 `json:"blockNumber"`
	Event                string `json:"event"`
	SalePrice            string `json:"salePrice"`
	SaleCurrency         string `json:"saleCurrency"`
	TokenContractAddress string `json:"tokenContractAddress"`
	Image                string `json:"image"`
	Currency             string `json:"currency"`
	Symbol               string `json:"symbol"`
}

Struct to hold watcher event data

type WatcherEvents

type WatcherEvents struct {
	Block []WatcherEvent `json:"events"`
}

Struct to hold a collection of watcher events

Jump to

Keyboard shortcuts

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