thegraph

package
v0.0.0-...-3f52ee8 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NFT

type NFT struct {
	Contract  string
	TokenID   int
	CreatedAt int64
	Symbol    string

	Name        string
	Description string
	Image       string
}

func Unpack

func Unpack(b []byte) (*NFT, error)

func (*NFT) ID

func (n *NFT) ID() string

func (*NFT) Pack

func (n *NFT) Pack() ([]byte, error)

type NFTMeta

type NFTMeta struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Image       string `json:"image"`
}

type NFTQuery

type NFTQuery struct {
	NFTContracts []struct {
		ID        string `graphql:"id"`
		CreatedAt string `graphql:"createdAt"`
		Name      string `graphql:"name"`
		Symbol    string `graphql:"symbol"`
		NFTs      []struct {
			TokenURI string `graphql:"tokenURI"`
			TokenID  string `graphql:"tokenID"`
		} `graphql:"nfts"`
	} `graphql:"nftContracts(first: 10, orderBy:createdAt, orderDirection:asc, where:{createdAt_gt: $timestamp})"`
}

type TheGraphClient

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

func New

func New(
	ipfsAddress string,
	shouldSkip func(contract string) (bool, error),
	failed func(contract string) error,
) *TheGraphClient

func (*TheGraphClient) Cat

func (c *TheGraphClient) Cat(ctx context.Context, path string) (io.ReadCloser, error)

Cat the content at the given path. Callers need to drain and close the returned reader after usage. Inspired by: https://github.com/ipfs/go-ipfs-api/blob/cb1fca1e60b1fb653ad10dd77f10c48b55fea867/shell.go#L162

func (*TheGraphClient) Fetch

func (c *TheGraphClient) Fetch(
	ctx context.Context,
	timestamp int64,
) (map[string][]*NFT, int64, error)

Jump to

Keyboard shortcuts

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