web3

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OTHER CONSTANTS
	MAX_SCAN_BLOCKS_PER_ITERATION           = 1000000
	MAX_SCAN_LOGS_PER_ITERATION             = 100000
	MAX_NEW_HOLDER_CANDIDATES_PER_ITERATION = 5000
	BLOCKS_TO_SCAN_AT_ONCE                  = uint64(2000)
	NULL_ADDRESS                            = "0"
)
View Source
const (
	// EVM LOG TOPICS
	LOG_TOPIC_ERC20_TRANSFER          = "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
	LOG_TOPIC_ERC1155_TRANSFER_SINGLE = "c3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62"
	LOG_TOPIC_ERC1155_TRANSFER_BATCH  = "4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb"
	LOG_TOPIC_FARCASTER_REGISTER      = "f2e19a901b0748d8b08e428d0468896a039ac751ec4fec49b44b7b9c28097e45"
	LOG_TOPIC_FARCASTER_ADDKEY        = "7d285df41058466977811345cd453c0c52e8d841ffaabc74fc050f277ad4de02"
	LOG_TOPIC_FARCASTER_REMOVEKEY     = "09e77066e0155f46785be12f6938a6b2e4be4381e59058129ce15f355cb96958"
)
View Source
const (
	DefaultMaxWeb3ClientRetries = 3
)
View Source
const (
	TimeLayout = "2006-01-02T15:04:05Z07:00"
)

Variables

View Source
var (
	ErrClientNotSet           = fmt.Errorf("client not set")
	ErrConnectingToWeb3Client = fmt.Errorf("client not set")
	ErrInitializingContract   = fmt.Errorf("error initializing token contract")
	ErrScanningTokenLogs      = fmt.Errorf("error scanning token logs")
	ErrTooManyRequests        = fmt.Errorf("web3 endpoint returns too many requests")
	ErrParsingTokenLogs       = fmt.Errorf("error parsing token logs")
	ErrGettingTotalSupply     = fmt.Errorf("error getting total supply")
)
View Source
var DefaultNetworkEndpoint = &NetworkEndpoint{
	ChainID:   5,
	Name:      "Goerli",
	ShortName: "gor",
	URIs:      []string{"https://eth-goerli.api.onfinality.io/public"},
}

Functions

func GetChainIDByURI

func GetChainIDByURI(ctx context.Context, uri string) (uint64, error)

GetChainIDByURI function returns the chainID of the web3 provider URI provided. It dials the URI and gets the chainID from the web3 endpoint, using the context provided and the GetClient method with the DefaultMaxWeb3ClientRetries value.

func RangeOfLogs

func RangeOfLogs(ctx context.Context, client *ethclient.Client, addr common.Address,
	fromBlock, lastBlock uint64, hexTopics ...string,
) ([]types.Log, uint64, bool, error)

RangeOfLogs function returns the logs of a token contract between the provided block numbers. It returns the logs, the last block scanned and an error if any. It filters the logs by the topic hash and for the token contract address provided.

Types

type ERC20HolderProvider

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

func (*ERC20HolderProvider) Address

func (p *ERC20HolderProvider) Address(_ []byte) common.Address

Address returns the address of the current token set in the provider.

func (*ERC20HolderProvider) BalanceAt

func (p *ERC20HolderProvider) BalanceAt(ctx context.Context, addr common.Address,
	_ []byte, blockNumber uint64,
) (*big.Int, error)

BalanceAt returns the balance of the given address for the current token at the given block number for the current token set in the provider. It gets the balance from the contract. It also receives an external ID but it is not used by the provider.

func (*ERC20HolderProvider) BalanceOf

func (p *ERC20HolderProvider) BalanceOf(addr common.Address, _ []byte) (*big.Int, error)

BalanceOf returns the balance of the given address for the current token set in the provider. It gets the balance from the contract. It also receives an external ID but it is not used by the provider.

func (*ERC20HolderProvider) BlockRootHash

func (p *ERC20HolderProvider) BlockRootHash(ctx context.Context, blockNumber uint64) ([]byte, error)

BlockRootHash returns the root hash of the given block number for the current token set in the provider. It gets the root hash from the client.

func (*ERC20HolderProvider) BlockTimestamp

func (p *ERC20HolderProvider) BlockTimestamp(ctx context.Context, blockNumber uint64) (string, error)

BlockTimestamp returns the timestamp of the given block number for the current token set in the provider. It gets the timestamp from the client.

func (*ERC20HolderProvider) CensusKeys

func (p *ERC20HolderProvider) CensusKeys(data map[common.Address]*big.Int) (map[common.Address]*big.Int, error)

CensusKeys method returns the holders and balances provided transformed. The ERC20 provider does not need to transform the holders and balances, so it returns the data as is.

func (*ERC20HolderProvider) ChainID

func (p *ERC20HolderProvider) ChainID() uint64

ChainID returns the chain ID of the current token set in the provider.

func (*ERC20HolderProvider) Close

func (p *ERC20HolderProvider) Close() error

Close method is not implemented for ERC20 tokens.

func (*ERC20HolderProvider) CreationBlock

func (p *ERC20HolderProvider) CreationBlock(ctx context.Context, _ []byte) (uint64, error)

CreationBlock returns the creation block of the current token set in the provider. It gets the creation block from the client. It also receives an external ID but it is not used by the provider. It uses the creationBlock function to calculate the creation block of a web3 provider contract.

func (*ERC20HolderProvider) Decimals

func (p *ERC20HolderProvider) Decimals(_ []byte) (uint64, error)

Decimals returns the decimals of the current token set in the provider. It gets the decimals from the contract. It also receives an external ID but it is not used by the provider.

func (*ERC20HolderProvider) HoldersBalances

func (p *ERC20HolderProvider) HoldersBalances(ctx context.Context, _ []byte, fromBlock uint64) (
	map[common.Address]*big.Int, uint64, uint64, bool, *big.Int, error,
)

HoldersBalances returns the balances of the token holders for the current defined token (using SetRef method). It returns the balances of the holders for this token from the block number provided to the latest posible block number (chosen between the last block number of the network and the maximun number of blocks to scan). It calls to rangeOfLogs to get the logs of the token transfers in the range of blocks and then it iterates the logs to calculate the balances of the holders. It returns the balances, the number of new transfers, the last block scanned, if the provider is synced and an error if it exists.

func (*ERC20HolderProvider) IconURI

func (p *ERC20HolderProvider) IconURI(_ []byte) (string, error)

IconURI method is not implemented for ERC20 tokens.

func (*ERC20HolderProvider) Init

func (p *ERC20HolderProvider) Init(iconf any) error

func (*ERC20HolderProvider) IsExternal

func (p *ERC20HolderProvider) IsExternal() bool

IsExternal returns false because the provider is not an external API.

func (*ERC20HolderProvider) IsSynced

func (p *ERC20HolderProvider) IsSynced(_ []byte) bool

IsSynced returns true if the current state of the provider is synced. It also receives an external ID but it is not used by the provider.

func (*ERC20HolderProvider) LatestBlockNumber

func (p *ERC20HolderProvider) LatestBlockNumber(ctx context.Context, _ []byte) (uint64, error)

LatestBlockNumber returns the latest block number of the current token set in the provider. It gets the latest block number from the client. It also receives an external ID but it is not used by the provider.

func (*ERC20HolderProvider) Name

func (p *ERC20HolderProvider) Name(_ []byte) (string, error)

Name returns the name of the current token set in the provider. It gets the name from the contract. It also receives an external ID but it is not used by the provider.

func (*ERC20HolderProvider) SetLastBalances

func (p *ERC20HolderProvider) SetLastBalances(_ context.Context, _ []byte,
	_ map[common.Address]*big.Int, _ uint64,
) error

SetLastBalances method is not implemented for ERC20 tokens, they already calculate the partial balances from logs without comparing with the previous balances.

func (*ERC20HolderProvider) SetLastBlockNumber

func (p *ERC20HolderProvider) SetLastBlockNumber(blockNumber uint64)

SetLastBlockNumber sets the last block number of the token set in the provider. It is used to calculate the delta balances in the next call to HoldersBalances from the given from point in time. It helps to avoid GetBlockNumber calls to the provider.

func (*ERC20HolderProvider) SetRef

func (p *ERC20HolderProvider) SetRef(iref any) error

SetRef sets the reference of the token desired to use to the provider. It receives a Web3ProviderRef struct with the address and chainID of the token to use. It connects to the endpoint and initializes the contract.

func (*ERC20HolderProvider) Symbol

func (p *ERC20HolderProvider) Symbol(_ []byte) (string, error)

Symbol returns the symbol of the current token set in the provider. It gets the symbol from the contract. It also receives an external ID but it is not used by the provider.

func (*ERC20HolderProvider) TotalSupply

func (p *ERC20HolderProvider) TotalSupply(_ []byte) (*big.Int, error)

TotalSupply returns the total supply of the current token set in the provider. It gets the total supply from the contract. It also receives an external ID but it is not used by the provider.

func (*ERC20HolderProvider) Type

func (p *ERC20HolderProvider) Type() uint64

Type returns the type of the current token set in the provider.

func (*ERC20HolderProvider) TypeName

func (p *ERC20HolderProvider) TypeName() string

TypeName returns the type name of the current token set in the provider.

type ERC721HolderProvider

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

func (*ERC721HolderProvider) Address

func (p *ERC721HolderProvider) Address(_ []byte) common.Address

Address returns the address of the current token set in the provider.

func (*ERC721HolderProvider) BalanceAt

func (p *ERC721HolderProvider) BalanceAt(ctx context.Context, addr common.Address,
	_ []byte, blockNumber uint64,
) (*big.Int, error)

BalanceAt returns the balance of the given address for the current token at the given block number for the current token set in the provider. It also receives an external ID but it is not used by the provider. It calls to the contract to get the balance.

func (*ERC721HolderProvider) BalanceOf

func (p *ERC721HolderProvider) BalanceOf(addr common.Address, _ []byte) (*big.Int, error)

BalanceOf returns the balance of the given address for the current token set in the provider. It also receives an external ID but it is not used by the provider. It calls to the contract to get the balance.

func (*ERC721HolderProvider) BlockRootHash

func (p *ERC721HolderProvider) BlockRootHash(ctx context.Context, blockNumber uint64) ([]byte, error)

BlockRootHash returns the root hash of the given block number for the current token set in the provider. It calls to the client to get the block header and then it returns the root hash.

func (*ERC721HolderProvider) BlockTimestamp

func (p *ERC721HolderProvider) BlockTimestamp(ctx context.Context, blockNumber uint64) (string, error)

BlockTimestamp returns the timestamp of the given block number for the current token set in the provider. It calls to the client to get the block header and then it returns the timestamp.

func (*ERC721HolderProvider) CensusKeys

func (p *ERC721HolderProvider) CensusKeys(data map[common.Address]*big.Int) (map[common.Address]*big.Int, error)

CensusKeys method returns the holders and balances provided transformed. The ERC721 provider does not need to transform the holders and balances, so it returns the data as is.

func (*ERC721HolderProvider) ChainID

func (p *ERC721HolderProvider) ChainID() uint64

ChainID returns the chain ID of the current token set in the provider.

func (*ERC721HolderProvider) Close

func (p *ERC721HolderProvider) Close() error

Close method is not implemented for ERC721 tokens.

func (*ERC721HolderProvider) CreationBlock

func (p *ERC721HolderProvider) CreationBlock(ctx context.Context, _ []byte) (uint64, error)

CreationBlock returns the creation block of the current token set in the provider. It gets the creation block from the client. It also receives an external ID but it is not used by the provider. It uses the creationBlockInRange function to calculate the creation block in the range of blocks.

func (*ERC721HolderProvider) Decimals

func (p *ERC721HolderProvider) Decimals(_ []byte) (uint64, error)

Decimals returns the decimals of the current token set in the provider. It also receives an external ID but it is not used by the provider. It calls to the contract to get the decimals.

func (*ERC721HolderProvider) HoldersBalances

func (p *ERC721HolderProvider) HoldersBalances(ctx context.Context, _ []byte, fromBlock uint64) (
	map[common.Address]*big.Int, uint64, uint64, bool, *big.Int, error,
)

HoldersBalances returns the balances of the token holders for the current defined token (using SetRef method). It returns the balances of the holders for this token from the block number provided to the latest posible block number (chosen between the last block number of the network and the maximun number of blocks to scan). It calls to rangeOfLogs to get the logs of the token transfers in the range of blocks and then it iterates the logs to calculate the balances of the holders. It returns the balances, the number of new transfers, the last block scanned, if the provider is synced and an error if it exists.

func (*ERC721HolderProvider) IconURI

func (p *ERC721HolderProvider) IconURI(_ []byte) (string, error)

IconURI method is not implemented for ERC721 tokens.

func (*ERC721HolderProvider) Init

func (p *ERC721HolderProvider) Init(iconf any) error

func (*ERC721HolderProvider) IsExternal

func (p *ERC721HolderProvider) IsExternal() bool

IsExternal returns false because ERC721 tokens are not external APIs.

func (*ERC721HolderProvider) IsSynced

func (p *ERC721HolderProvider) IsSynced(_ []byte) bool

IsSynced returns true if the current state of the provider is synced. It also receives an external ID but it is not used by the provider.

func (*ERC721HolderProvider) LatestBlockNumber

func (p *ERC721HolderProvider) LatestBlockNumber(ctx context.Context, _ []byte) (uint64, error)

LatestBlockNumber returns the latest block number of the current token set in the provider. It calls to the client to get the latest block header and then it returns the block number. It also receives an external ID but it is not used by the provider.

func (*ERC721HolderProvider) Name

func (p *ERC721HolderProvider) Name(_ []byte) (string, error)

Name returns the name of the current token set in the provider. It also receives an external ID but it is not used by the provider. It calls to the contract to get the name.

func (*ERC721HolderProvider) SetLastBalances

func (p *ERC721HolderProvider) SetLastBalances(_ context.Context, _ []byte,
	_ map[common.Address]*big.Int, _ uint64,
) error

SetLastBalances method is not implemented for ERC721 tokens, they already calculate the partial balances from logs without comparing with the previous balances.

func (*ERC721HolderProvider) SetLastBlockNumber

func (p *ERC721HolderProvider) SetLastBlockNumber(blockNumber uint64)

SetLastBlockNumber sets the last block number of the token set in the provider. It is used to calculate the delta balances in the next call to HoldersBalances from the given from point in time. It helps to avoid GetBlockNumber calls to the provider.

func (*ERC721HolderProvider) SetRef

func (p *ERC721HolderProvider) SetRef(iref any) error

SetRef sets the reference of the token desired to use to the provider. It receives a Web3ProviderRef struct with the address and chainID of the token to use. It connects to the endpoint and initializes the contract.

func (*ERC721HolderProvider) Symbol

func (p *ERC721HolderProvider) Symbol(_ []byte) (string, error)

Symbol returns the symbol of the current token set in the provider. It also receives an external ID to be used if it is required by the provider. It calls to the contract to get the symbol.

func (*ERC721HolderProvider) TotalSupply

func (p *ERC721HolderProvider) TotalSupply(_ []byte) (*big.Int, error)

TotalSupply method is not implemented for ERC721 tokens.

func (*ERC721HolderProvider) Type

func (p *ERC721HolderProvider) Type() uint64

Type returns the type of the current token set in the provider.

func (*ERC721HolderProvider) TypeName

func (p *ERC721HolderProvider) TypeName() string

TypeName returns the type name of the current token set in the provider.

type ERC777HolderProvider

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

func (*ERC777HolderProvider) Address

func (p *ERC777HolderProvider) Address(_ []byte) common.Address

Address returns the address of the current token set in the provider.

func (*ERC777HolderProvider) BalanceAt

func (p *ERC777HolderProvider) BalanceAt(ctx context.Context, addr common.Address,
	_ []byte, blockNumber uint64,
) (*big.Int, error)

BalanceAt returns the balance of the given address for the current token at the given block number for the current token set in the provider. It also receives an external ID but it is not used by the provider. It calls to the contract to get the balance.

func (*ERC777HolderProvider) BalanceOf

func (p *ERC777HolderProvider) BalanceOf(addr common.Address, _ []byte) (*big.Int, error)

BalanceOf returns the balance of the given address for the current token set in the provider. It also receives an external ID but it is not used by the provider. It calls to the contract to get the balance.

func (*ERC777HolderProvider) BlockRootHash

func (p *ERC777HolderProvider) BlockRootHash(ctx context.Context, blockNumber uint64) ([]byte, error)

BlockRootHash returns the root hash of the given block number for the current token set in the provider. It calls to the client to get the block header and then it returns the root hash.

func (*ERC777HolderProvider) BlockTimestamp

func (p *ERC777HolderProvider) BlockTimestamp(ctx context.Context, blockNumber uint64) (string, error)

BlockTimestamp returns the timestamp of the given block number for the current token set in the provider. It calls to the client to get the block header and then it returns the timestamp.

func (*ERC777HolderProvider) CensusKeys

func (p *ERC777HolderProvider) CensusKeys(data map[common.Address]*big.Int) (map[common.Address]*big.Int, error)

CensusKeys method returns the holders and balances provided transformed. The ERC777 provider does not need to transform the holders and balances, so it returns the data as is.

func (*ERC777HolderProvider) ChainID

func (p *ERC777HolderProvider) ChainID() uint64

ChainID returns the chain ID of the current token set in the provider.

func (*ERC777HolderProvider) Close

func (p *ERC777HolderProvider) Close() error

Close method is not implemented for ERC777 tokens.

func (*ERC777HolderProvider) CreationBlock

func (p *ERC777HolderProvider) CreationBlock(ctx context.Context, _ []byte) (uint64, error)

CreationBlock returns the creation block of the current token set in the provider. It gets the creation block from the client. It also receives an external ID but it is not used by the provider. It uses the creationBlockInRange function to calculate the creation block in the range of blocks.

func (*ERC777HolderProvider) Decimals

func (p *ERC777HolderProvider) Decimals(_ []byte) (uint64, error)

Decimals returns the decimals of the current token set in the provider. It also receives an external ID but it is not used by the provider. It calls to the contract to get the decimals.

func (*ERC777HolderProvider) HoldersBalances

func (p *ERC777HolderProvider) HoldersBalances(ctx context.Context, _ []byte, fromBlock uint64) (
	map[common.Address]*big.Int, uint64, uint64, bool, *big.Int, error,
)

HoldersBalances returns the balances of the token holders for the current defined token (using SetRef method). It returns the balances of the holders for this token from the block number provided to the latest posible block number (chosen between the last block number of the network and the maximun number of blocks to scan). It calls to rangeOfLogs to get the logs of the token transfers in the range of blocks and then it iterates the logs to calculate the balances of the holders. It returns the balances, the number of new transfers, the last block scanned, if the provider is synced and an error if it exists.

func (*ERC777HolderProvider) IconURI

func (p *ERC777HolderProvider) IconURI(_ []byte) (string, error)

IconURI method is not implemented for ERC777 tokens.

func (*ERC777HolderProvider) Init

func (p *ERC777HolderProvider) Init(iconf any) error

func (*ERC777HolderProvider) IsExternal

func (p *ERC777HolderProvider) IsExternal() bool

IconURI method is not implemented for ERC777 tokens.

func (*ERC777HolderProvider) IsSynced

func (p *ERC777HolderProvider) IsSynced(_ []byte) bool

IsSynced returns true if the current state of the provider is synced. It also receives an external ID but it is not used by the provider.

func (*ERC777HolderProvider) LatestBlockNumber

func (p *ERC777HolderProvider) LatestBlockNumber(ctx context.Context, _ []byte) (uint64, error)

LatestBlockNumber returns the latest block number of the current token set in the provider. It calls to the client to get the latest block header and then it returns the block number. It also receives an external ID but it is not used by the provider.

func (*ERC777HolderProvider) Name

func (p *ERC777HolderProvider) Name(_ []byte) (string, error)

Name returns the name of the current token set in the provider. It also receives an external ID but it is not used by the provider. It calls to the contract to get the name.

func (*ERC777HolderProvider) SetLastBalances

func (p *ERC777HolderProvider) SetLastBalances(_ context.Context, _ []byte,
	_ map[common.Address]*big.Int, _ uint64,
) error

SetLastBalances method is not implemented for ERC777 tokens, they already calculate the partial balances from logs without comparing with the previous balances.

func (*ERC777HolderProvider) SetLastBlockNumber

func (p *ERC777HolderProvider) SetLastBlockNumber(blockNumber uint64)

SetLastBlockNumber sets the last block number of the token set in the provider. It is used to calculate the delta balances in the next call to HoldersBalances from the given from point in time. It helps to avoid GetBlockNumber calls to the provider.

func (*ERC777HolderProvider) SetRef

func (p *ERC777HolderProvider) SetRef(iref any) error

SetRef sets the reference of the token desired to use to the provider. It receives a Web3ProviderRef struct with the address and chainID of the token to use. It connects to the endpoint and initializes the contract.

func (*ERC777HolderProvider) Symbol

func (p *ERC777HolderProvider) Symbol(_ []byte) (string, error)

Symbol returns the symbol of the current token set in the provider. It also receives an external ID to be used if it is required by the provider. It calls to the contract to get the symbol.

func (*ERC777HolderProvider) TotalSupply

func (p *ERC777HolderProvider) TotalSupply(_ []byte) (*big.Int, error)

IconURI method is not implemented for ERC777 tokens.

func (*ERC777HolderProvider) Type

func (p *ERC777HolderProvider) Type() uint64

Type returns the type of the current token set in the provider.

func (*ERC777HolderProvider) TypeName

func (p *ERC777HolderProvider) TypeName() string

TypeName returns the type name of the current token set in the provider.

type NetworkEndpoint

type NetworkEndpoint struct {
	ChainID   uint64 `json:"chainId"`
	Name      string `json:"name"`
	ShortName string `json:"shortName"`
	URIs      []string
}

NetworkEndpoint struct contains all the required information about a web3 provider based on its URI. It includes its chain ID, its name (and shortName) and the URI.

func TestNetworkEndpoint

func TestNetworkEndpoint() (*NetworkEndpoint, error)

TestNetworkEndpoint function returns a NetworkEndpoint for testing purposes. It checks if the WEB3_URI environment variable is set, and if so, it uses its value to initialize a NetworkEndpoint. If not, it returns the DefaultNetworkEndpoint.

func (*NetworkEndpoint) GetClient

func (n *NetworkEndpoint) GetClient(maxRetries int) (*ethclient.Client, error)

GetClient method returns a web3 client for the first URI that can be dialed.

type NetworkEndpoints

type NetworkEndpoints map[uint64]*NetworkEndpoint

NetworkEndpoints type envolves a map of uint64-NetworkEndpoint, used to index the configured web3 providers by the chainID.

func InitNetworkEndpoints

func InitNetworkEndpoints(providersURIs []string) (NetworkEndpoints, error)

InitNetworkEndpoints function initializes a NetworkEndpoints list checking the web3 enpoint URI's provided as argument. It checks if the URI's are valid, getting its chain ID's and then query to shortNameSourceURI endpoint to get the chain name and short name. If more than one URI is provided for the same chainID, the URIs are grouped in the same NetworkEndpoint. If no valid URIs are provided, an error is returned.

func (NetworkEndpoints) ChainAddress

func (nps NetworkEndpoints) ChainAddress(chainID uint64, hexAddress string) (string, bool)

ChainAddress method returns a prefixed string of the hex address provided, with the short name of the networkEndpoint identified by the chain id provided. Read more here: https://eips.ethereum.org/EIPS/eip-3770

func (NetworkEndpoints) ChainIDByShortName

func (nps NetworkEndpoints) ChainIDByShortName(shortName string) (uint64, bool)

ChainIDByShortName method returns the chainID configured for the networkEndpoint short name provided.

func (NetworkEndpoints) CurrentBlockNumbers

func (nps NetworkEndpoints) CurrentBlockNumbers(ctx context.Context) (map[uint64]uint64, error)

CurrentBlockNumbers method returns a map of uint64-uint64, where the key is the chainID and the value is the current block number of the network.

func (NetworkEndpoints) EndpointByChainID

func (nps NetworkEndpoints) EndpointByChainID(chainID uint64) (*NetworkEndpoint, bool)

EndpointByChainID method returns the NetworkEndpoint configured for the chainID provided.

func (NetworkEndpoints) String

func (nps NetworkEndpoints) String() string

String method returns a string representation of the NetworkEndpoints list.

func (NetworkEndpoints) URIsByChainID

func (nps NetworkEndpoints) URIsByChainID(chainID uint64) ([]string, bool)

URIByChainID method returns the URI configured for the chainID provided.

type Web3ProviderConfig

type Web3ProviderConfig struct {
	Web3ProviderRef
	Endpoints NetworkEndpoints
	DB        *db.Database
}

type Web3ProviderRef

type Web3ProviderRef struct {
	HexAddress string
	ChainID    uint64
}

Jump to

Keyboard shortcuts

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