Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client wraps the ethclient.Client interface to provide extra data types (in header, block body). If you want to use the standardized Ethereum RPC functionality without extra types, use ethclient.Client instead.
Example ¶
package main import ( "context" "fmt" "github.com/ava-labs/coreth/plugin/evm/customtypes" ) const FujiAPIURI = "https://api.avax-test.network" func main() { ethC, err := Dial(FujiAPIURI + "/ext/bc/C/rpc") if err != nil { panic(err) } bc, err := ethC.BlockByNumber(context.Background(), nil) if err != nil { panic(err) } extData := customtypes.GetHeaderExtra(bc.Header()) // Header extra data fmt.Printf("Block Gas Cost: %d\n", extData.BlockGasCost) fmt.Printf("Extra data hash: %x\n", extData.ExtDataHash) fmt.Printf("Extra data gas used: %d\n", extData.ExtDataGasUsed) // Block Body extra data fmt.Printf("Block Extra Data: %x\n", customtypes.BlockExtData(bc)) fmt.Printf("Block Version: %d\n", customtypes.BlockVersion(bc)) }
func DialContext ¶
DialContext connects a client to the given URL with context.
Click to show internal directories.
Click to hide internal directories.