gbnode

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainNode

type ChainNode struct {
	Name               string `mapstructure:"name"`
	Client             *ethclient.Client
	WebsocketsEndpoint string `mapstructure:"url"`
}

ChainNode represents a w3 provider configuration.

func New

func New(endpoint string) (*ChainNode, error)

New returns a new gbnode if connection to the given endpoint succeeds.

func (ChainNode) GetCollectionMetadata

func (p ChainNode) GetCollectionMetadata(contractAddress common.Address) *CollectionMetadata

func (ChainNode) GetCollectionName

func (p ChainNode) GetCollectionName(contractAddress common.Address) string

func (ChainNode) GetTokenImageURI

func (p ChainNode) GetTokenImageURI(contractAddress common.Address, tokenID uint64) (string, error)

func (ChainNode) GetTokenMetadata

func (p ChainNode) GetTokenMetadata(tokenURI string) (*MetadataERC721, error)

func (ChainNode) GetTokenURI

func (p ChainNode) GetTokenURI(contractAddress common.Address, tokenID *big.Int) (string, error)

func (ChainNode) SubscribeToContract

func (p ChainNode) SubscribeToContract(ctx context.Context, queueLogs chan types.Log, contractAddress common.Address) (ethereum.Subscription, error)

func (ChainNode) SubscribeToOrdersMatched

func (p ChainNode) SubscribeToOrdersMatched(ctx context.Context, queueLogs chan types.Log) (ethereum.Subscription, error)

func (ChainNode) SubscribeToSingleTransfers

func (p ChainNode) SubscribeToSingleTransfers(ctx context.Context, queueLogs chan types.Log) (ethereum.Subscription, error)

func (ChainNode) SubscribeToSingleTransfersFor

func (p ChainNode) SubscribeToSingleTransfersFor(ctx context.Context, queueLogs chan types.Log, contractAddresses []common.Address) (ethereum.Subscription, error)

func (ChainNode) SubscribeToTransfers

func (p ChainNode) SubscribeToTransfers(ctx context.Context, queueLogs chan types.Log) (ethereum.Subscription, error)

func (ChainNode) SubscribeToTransfersFor

func (p ChainNode) SubscribeToTransfersFor(ctx context.Context, queueLogs chan types.Log, contractAddresses []common.Address) (ethereum.Subscription, error)

type CollectionMetadata

type CollectionMetadata struct {
	Name        string `json:"name"`
	OpenseaSlug string `mapstructure:"slug"`
	Symbol      string `mapstructure:"symbol"`
	TotalSupply uint64 `mapstructure:"total_supply"`
	TokenURI    string `mapstructure:"token_uri"`
}

type MetadataERC721

type MetadataERC721 struct {
	Image string `json:"image"`
}

type NodeCollection

type NodeCollection []*ChainNode

func GetNodesFromConfig

func GetNodesFromConfig(endpoints []string) *NodeCollection

GetNodesFromConfig reads the websockets endpoints slice from config, connects to them and returns a list with successfully connected nodes.

func (*NodeCollection) GetNodes

func (nc *NodeCollection) GetNodes() []*ChainNode

GetNodes returns all nodes as slice.

func (*NodeCollection) GetRandomNode

func (nc *NodeCollection) GetRandomNode() *ChainNode

GetRandomNode returns a random available ethereum node.

func (*NodeCollection) SubscribeToAllTransfers

func (nc *NodeCollection) SubscribeToAllTransfers(ctx context.Context, queueLogs chan types.Log)

type Topic

type Topic string
const (
	OrdersMatched  Topic = "0xc4109843e0b7d514e4c093114b863f8e7d8d9a458c372cd51bfe526b588006c9"
	Transfer       Topic = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
	TransferSingle Topic = "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62"
	ApprovalForAll Topic = "0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31"
)

func (Topic) String

func (t Topic) String() string

Jump to

Keyboard shortcuts

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