diff --git a/pkg/contract/chain.go b/pkg/contract/chain.go index 3b423d3dc..584667dd0 100644 --- a/pkg/contract/chain.go +++ b/pkg/contract/chain.go @@ -99,18 +99,7 @@ func GetBlockchainEndpoints( rpcEndpoint string wsEndpoint string ) - switch { - case chainSpec.CChain: - rpcEndpoint = network.CChainEndpoint() - wsEndpoint = network.CChainWSEndpoint() - case network.Kind == models.Local || network.Kind == models.Devnet: - blockchainID, err := GetBlockchainID(app, network, chainSpec) - if err != nil { - return "", "", err - } - rpcEndpoint = network.BlockchainEndpoint(blockchainID.String()) - wsEndpoint = network.BlockchainWSEndpoint(blockchainID.String()) - case chainSpec.BlockchainName != "": + if chainSpec.BlockchainName != "" { sc, err := app.LoadSidecar(chainSpec.BlockchainName) if err != nil { return "", "", fmt.Errorf("failed to load sidecar: %w", err) @@ -125,6 +114,20 @@ func GetBlockchainEndpoints( wsEndpoint = sc.Networks[network.Name()].WSEndpoints[0] } } + if rpcEndpoint == "" { + switch { + case chainSpec.CChain: + rpcEndpoint = network.CChainEndpoint() + wsEndpoint = network.CChainWSEndpoint() + case network.Kind == models.Local: + blockchainID, err := GetBlockchainID(app, network, chainSpec) + if err != nil { + return "", "", err + } + rpcEndpoint = network.BlockchainEndpoint(blockchainID.String()) + wsEndpoint = network.BlockchainWSEndpoint(blockchainID.String()) + } + } blockchainDesc, err := GetBlockchainDesc(chainSpec) if err != nil { return "", "", err