mirror of
https://github.com/luxfi/sdk.git
synced 2026-10-30 15:19:23 +00:00
The node moved every chain route from /v1/bc/<alias> to /v1/chain/<alias> and deleted the old prefix, so every call this SDK made against a current node was a 404. The segment is constants.ChainAliasPrefix, which went from "bc" to "chain" in luxfi/constants v1.6.4. Call sites that already went through constants.Chain moved with the pin. These nine spelled the prefix out longhand instead of asking the composer, so they stayed behind: five endpoint helpers in models, the default APIEndpoint in config, the two URLs ux prints, and two doc examples that would have sent a reader at a deleted route. The wallet's test double mounted /v1/bc/P and /v1/bc/X, so it answered the route the node had dropped and would have gone on passing against a node that no longer exists. It now serves what the node serves, and the assertion that the SDK must not touch X in P-only mode checks the live path -- against the old one it could never fire again. That file has not compiled since the X/C opt-in decomplect removed isXChainNotEnabled, so none of these tests were running. Its test went with the function it covered. Chain() no longer claims the node answers both spellings. It does not. Co-authored-by: Hanzo Dev <[email protected]>
67 lines
1.6 KiB
Go
67 lines
1.6 KiB
Go
// Copyright (C) 2020-2025, Lux Industries Inc All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
// Package config provides SDK configuration structures and utilities.
|
|
package config
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
"github.com/luxfi/sdk/constants"
|
|
)
|
|
|
|
// Config represents the SDK configuration
|
|
type Config struct {
|
|
LogLevel string
|
|
DataDir string
|
|
Network *NetworkConfig
|
|
}
|
|
|
|
// NetworkConfig represents network configuration
|
|
type NetworkConfig struct {
|
|
NetrunnerEndpoint string
|
|
NodeEndpoint string
|
|
NetworkID uint32
|
|
APIEndpoint string
|
|
P2PPort int
|
|
HTTPPort int
|
|
StakingPort int
|
|
LogLevel string
|
|
DataDir string
|
|
DBType string
|
|
GenesisFile string
|
|
StakeAmount uint64
|
|
}
|
|
|
|
// ChainID returns a big.Int representation of the NetworkID
|
|
func (nc *NetworkConfig) ChainID() *big.Int {
|
|
return big.NewInt(int64(nc.NetworkID))
|
|
}
|
|
|
|
// Default returns a default configuration
|
|
func Default() *Config {
|
|
return &Config{
|
|
LogLevel: "info",
|
|
DataDir: "~/.luxd",
|
|
Network: DefaultNetworkConfig(),
|
|
}
|
|
}
|
|
|
|
// DefaultNetworkConfig returns default network configuration
|
|
func DefaultNetworkConfig() *NetworkConfig {
|
|
return &NetworkConfig{
|
|
NetrunnerEndpoint: "localhost:8080",
|
|
NodeEndpoint: "http://localhost:9650",
|
|
NetworkID: 12345, // Local network ID
|
|
APIEndpoint: constants.Chain("", "C") + "/rpc",
|
|
P2PPort: 9651,
|
|
HTTPPort: 9650,
|
|
StakingPort: 9652,
|
|
LogLevel: "info",
|
|
DataDir: "~/.luxd",
|
|
DBType: "badgerdb",
|
|
GenesisFile: "",
|
|
StakeAmount: 2000,
|
|
}
|
|
}
|