mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
Retire /ext/ endpoint prefix: /v1/ is THE endpoint
Route registration, client URL builders, and log lines all move to /v1/ (wallet primary api, chains/rpc handler_manager+chain_integration, xvm client+wallet_client, xsvm api client, multi-network example, manager logs). Zero /ext/ literals remain. One endpoint namespace, no transition alias. Co-authored-by: Hanzo Dev <dev@hanzo.ai>
This commit is contained in:
+1
-1
@@ -849,7 +849,7 @@ func (m *manager) createChain(chainParams ChainParameters) {
|
||||
chainBase := fmt.Sprintf("bc/%s", chainAlias)
|
||||
chainIDBase := fmt.Sprintf("bc/%s", chainParams.ID.String())
|
||||
|
||||
// AddRoute will build the full path as /ext/<base><endpoint>
|
||||
// AddRoute will build the full path as /v1/<base><endpoint>
|
||||
m.Server.AddRoute(handler, chainBase, endpoint)
|
||||
if chainAlias != chainParams.ID.String() {
|
||||
m.Server.AddRoute(handler, chainIDBase, endpoint)
|
||||
|
||||
@@ -150,7 +150,7 @@ func (r *ChainHandlerRegistrar) ValidateEndpoint(
|
||||
}
|
||||
|
||||
// Build the full URL
|
||||
fullURL := fmt.Sprintf("/ext/%s%s", info.Base, endpoint)
|
||||
fullURL := fmt.Sprintf("/v1/%s%s", info.Base, endpoint)
|
||||
|
||||
r.log.Info("Validating endpoint",
|
||||
log.Stringer("chainID", chainID),
|
||||
|
||||
@@ -111,7 +111,7 @@ func (m *HandlerManager) RegisterChainHandlers(
|
||||
log.Err(err))
|
||||
} else {
|
||||
m.log.Info("Handler registered successfully",
|
||||
log.String("route", fmt.Sprintf("/ext/%s%s", base, endpoint)),
|
||||
log.String("route", fmt.Sprintf("/v1/%s%s", base, endpoint)),
|
||||
log.Stringer("chainID", chainID))
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ func (m *HandlerManager) getFullRoutes(bases []string, endpoints []string) []str
|
||||
routes := []string{}
|
||||
for _, base := range bases {
|
||||
for _, endpoint := range endpoints {
|
||||
routes = append(routes, fmt.Sprintf("/ext/%s%s", base, endpoint))
|
||||
routes = append(routes, fmt.Sprintf("/v1/%s%s", base, endpoint))
|
||||
}
|
||||
}
|
||||
return routes
|
||||
|
||||
@@ -75,9 +75,9 @@ func NewMultiNetworkNode() *MultiNetworkNode {
|
||||
|
||||
// StartRPCServer starts the unified RPC server
|
||||
func (n *MultiNetworkNode) StartRPCServer(port int) {
|
||||
http.HandleFunc("/ext/crossnet/status", n.handleCrossNetStatus)
|
||||
http.HandleFunc("/ext/crossnet/validators", n.handleCrossNetValidators)
|
||||
http.HandleFunc("/ext/network/", n.handleNetworkSpecific)
|
||||
http.HandleFunc("/v1/crossnet/status", n.handleCrossNetStatus)
|
||||
http.HandleFunc("/v1/crossnet/validators", n.handleCrossNetValidators)
|
||||
http.HandleFunc("/v1/network/", n.handleNetworkSpecific)
|
||||
|
||||
fmt.Printf("🌐 Multi-Network RPC Server starting on port %d\n", port)
|
||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
|
||||
@@ -172,7 +172,7 @@ func (n *MultiNetworkNode) handleCrossNetValidators(w http.ResponseWriter, r *ht
|
||||
|
||||
// handleNetworkSpecific routes to network-specific handlers
|
||||
func (n *MultiNetworkNode) handleNetworkSpecific(w http.ResponseWriter, r *http.Request) {
|
||||
// Parse network ID from path: /ext/network/{networkID}/...
|
||||
// Parse network ID from path: /v1/network/{networkID}/...
|
||||
// This would route to the appropriate network's chain manager
|
||||
|
||||
response := fmt.Sprintf(`{
|
||||
@@ -251,9 +251,9 @@ func main() {
|
||||
}
|
||||
|
||||
fmt.Println("\n🌐 Starting Multi-Network RPC Server...")
|
||||
fmt.Println(" • Cross-network status: http://localhost:9650/ext/crossnet/status")
|
||||
fmt.Println(" • Cross-network validators: http://localhost:9650/ext/crossnet/validators")
|
||||
fmt.Println(" • Network-specific: http://localhost:9650/ext/network/{networkID}/...")
|
||||
fmt.Println(" • Cross-network status: http://localhost:9650/v1/crossnet/status")
|
||||
fmt.Println(" • Cross-network validators: http://localhost:9650/v1/crossnet/validators")
|
||||
fmt.Println(" • Network-specific: http://localhost:9650/v1/network/{networkID}/...")
|
||||
|
||||
// This would be replaced with actual RPC server
|
||||
node.StartRPCServer(9650)
|
||||
|
||||
@@ -21,7 +21,7 @@ const DefaultPollingInterval = 50 * time.Millisecond
|
||||
|
||||
func NewClient(uri, chain string) *Client {
|
||||
path := fmt.Sprintf(
|
||||
"%s/ext/%s/%s",
|
||||
"%s/v1/%s/%s",
|
||||
uri,
|
||||
constants.ChainAliasPrefix,
|
||||
chain,
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ type Client struct {
|
||||
// NewClient returns an Exchange VM client for interacting with the X-Chain
|
||||
func NewClient(uri, chain string) *Client {
|
||||
path := fmt.Sprintf(
|
||||
"%s/ext/%s/%s",
|
||||
"%s/v1/%s/%s",
|
||||
uri,
|
||||
constants.ChainAliasPrefix,
|
||||
chain,
|
||||
|
||||
@@ -29,7 +29,7 @@ type WalletClient struct {
|
||||
// `luxfi/node/wallet/chain/x.Wallet` utility.
|
||||
func NewWalletClient(uri, chain string) *WalletClient {
|
||||
path := fmt.Sprintf(
|
||||
"%s/ext/%s/%s/wallet",
|
||||
"%s/v1/%s/%s/wallet",
|
||||
uri,
|
||||
constants.ChainAliasPrefix,
|
||||
chain,
|
||||
|
||||
@@ -220,7 +220,7 @@ func FetchEthState(
|
||||
addrs set.Set[ethcommon.Address],
|
||||
) (*EthState, error) {
|
||||
path := fmt.Sprintf(
|
||||
"%s/ext/%s/C/rpc",
|
||||
"%s/v1/%s/C/rpc",
|
||||
uri,
|
||||
constants.ChainAliasPrefix,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user