Files
coreth/plugin/evm/customethclient/example_test.go
zeekay 23ce60ab84 Update coreth for v0.15.3 release
- Updated dependencies to latest luxfi packages
- Fixed imports across test files
- Added api_migrate for migration support
- Updated customrawdb, factory components
- Clean up and fixes
2025-12-13 09:54:03 +00:00

34 lines
895 B
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package customethclient
import (
"context"
"fmt"
"github.com/luxfi/coreth/plugin/evm/customtypes"
)
const TestnetAPIURI = "https://api.lux-test.network"
func ExampleClient() {
ethC, err := Dial(TestnetAPIURI + "/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.GetBlockVersion(bc))
}