Documentation ¶
Index ¶
- Constants
- Variables
- func NameHash(name string) (hash [32]byte, err error)
- func Normalize(input string) (output string, err error)
- func ResolveEnsAddress(ctx context.Context, ens string, provider *Provider) (common.Address, bool, error)
- func WaitForTxnReceipt(ctx context.Context, provider *Provider, txHash common.Hash) (*types.Receipt, error)
- type Config
- type Network
- type NodeConfig
- type Provider
- func (s *Provider) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (s *Provider) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (s *Provider) ChainID(ctx context.Context) (*big.Int, error)
- func (s *Provider) Dial() error
- func (s *Provider) QueryContract(ctx context.Context, contractAddress string, ...) ([]string, error)
- func (s *Provider) SendRawTransaction(ctx context.Context, signedTxHex string) (common.Hash, error)
- func (s *Provider) SetHttpClient(httpClient *http.Client)
- func (s *Provider) TransactionDetails(ctx context.Context, txnHash common.Hash) (bool, *types.Receipt, *types.Transaction, string, error)
Constants ¶
View Source
const ENSContractAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
Variables ¶
View Source
var Networks = map[uint64]Network{
1: {
Name: "mainnet",
ChainID: 1,
NumBlocksToFinality: 20,
},
3: {
Name: "ropsten",
ChainID: 3,
NumBlocksToFinality: 20,
},
4: {
Name: "rinkeby",
ChainID: 4,
NumBlocksToFinality: 20,
},
5: {
Name: "goerli",
ChainID: 5,
NumBlocksToFinality: 20,
},
42: {
Name: "kovan",
ChainID: 42,
NumBlocksToFinality: 20,
},
137: {
Name: "polygon",
ChainID: 137,
NumBlocksToFinality: 100,
},
80001: {
Name: "polygon-mumbai",
ChainID: 80001,
NumBlocksToFinality: 100,
},
56: {
Name: "bsc",
ChainID: 56,
NumBlocksToFinality: 50,
},
97: {
Name: "bsc-testnet",
ChainID: 97,
NumBlocksToFinality: 50,
},
10: {
Name: "optimism",
ChainID: 10,
NumBlocksToFinality: 50,
},
69: {
Name: "optimism-testnet",
ChainID: 69,
NumBlocksToFinality: 50,
},
42161: {
Name: "arbitrum",
ChainID: 42161,
NumBlocksToFinality: 50,
},
421613: {
Name: "arbitrum-testnet",
ChainID: 421613,
NumBlocksToFinality: 50,
},
42170: {
Name: "arbitrum-nova",
ChainID: 42170,
NumBlocksToFinality: 50,
},
43114: {
Name: "avalanche",
ChainID: 43114,
NumBlocksToFinality: 50,
},
43113: {
Name: "avalanche-testnet",
ChainID: 43113,
NumBlocksToFinality: 50,
},
250: {
Name: "fantom",
ChainID: 250,
NumBlocksToFinality: 100,
},
4002: {
Name: "fantom-testnet",
ChainID: 4002,
NumBlocksToFinality: 100,
},
100: {
Name: "gnosis",
ChainID: 100,
NumBlocksToFinality: 100,
},
1313161554: {
Name: "aurora",
ChainID: 1313161554,
NumBlocksToFinality: 50,
},
1313161556: {
Name: "aurora-testnet",
ChainID: 1313161556,
NumBlocksToFinality: 50,
},
}
Functions ¶
func NameHash ¶ added in v1.17.8
NameHash generates a hash from a name that can be used to look up the name in ENS
func ResolveEnsAddress ¶ added in v1.17.8
Types ¶
type Config ¶
type Config struct { Nodes []NodeConfig ChaindID int // expected ChainID so we confirm on connect.. TestMode bool }
func (*Config) AddNode ¶
func (c *Config) AddNode(nodeConfig NodeConfig)
type NodeConfig ¶
type Provider ¶
type Provider struct { *ethclient.Client Config *Config RPC *rpc.Client // contains filtered or unexported fields }
func NewProviderWithConfig ¶
func (*Provider) BlockByHash ¶ added in v1.1.7
func (*Provider) BlockByNumber ¶
func (*Provider) QueryContract ¶ added in v1.3.4
func (s *Provider) QueryContract(ctx context.Context, contractAddress string, inputAbiExpr, outputAbiExpr string, args interface{}) ([]string, error)
ie, QueryContext(context.Background(), "0xabcdef..", "balanceOf(uint256)", "uint256", []string{"1"}) TODO: add common methods in helpers util, and also use generics to convert the return for us
func (*Provider) SendRawTransaction ¶ added in v1.3.6
func (*Provider) SetHttpClient ¶ added in v1.14.4
Click to show internal directories.
Click to hide internal directories.