mirror of
https://github.com/luxfi/coreth.git
synced 2026-10-30 17:00:51 +00:00
luxd serves chain routes under /v1/chain, and the node, cli and sdk releases already ship it. The deployed gateways still answer the old prefix, so remote reads break until they are redeployed; the estate moves together rather than sitting half converted. Lines that record an observation - a probe, a status code, a past release - keep the prefix they were written against, as do URLs on hosts that are not ours. Avalanche endpoints move to /ext/bc, which is the path that host serves. Co-authored-by: Hanzo Dev <[email protected]>
34 lines
897 B
Go
34 lines
897 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 + "/v1/chain/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))
|
|
}
|