From 9ae230f69f113ff67835b12134305a14d3fe90db Mon Sep 17 00:00:00 2001 From: abhiyana Date: Mon, 15 Jan 2024 12:50:37 +0530 Subject: [PATCH] feat: implement automate opening of polkadot explorer UI when explorer flag is given --- cli/cmd/chains/kusama/run.go | 8 ++++++++ cli/cmd/chains/polkadot/run.go | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/cli/cmd/chains/kusama/run.go b/cli/cmd/chains/kusama/run.go index 830d74a1..e38b63ae 100644 --- a/cli/cmd/chains/kusama/run.go +++ b/cli/cmd/chains/kusama/run.go @@ -13,6 +13,7 @@ import ( const ( localChain = "local" + polkadotJUrl = "http://127.0.0.1:80" ) func RunKusama(cli *common.Cli) (*common.DiveMultipleServiceResponse, error) { @@ -164,6 +165,13 @@ func startRelayAndParaChain(cli *common.Cli, enclaveContext *enclaves.EnclaveCon return nil, err } finalResult = finalResult.ConcatenateDiveResults(explorerResult) + + cli.Logger().Info("Redirecting to Polkadot explorer UI...") + if err := common.OpenFile(polkadotJUrl); err != nil { + cli.Logger().Fatalf(common.CodeOf(err), "Failed to open HugoByte Polkadot explorer UI with error %v", err) + } + + } return finalResult, nil diff --git a/cli/cmd/chains/polkadot/run.go b/cli/cmd/chains/polkadot/run.go index 2bb6ef5c..5d78e74e 100644 --- a/cli/cmd/chains/polkadot/run.go +++ b/cli/cmd/chains/polkadot/run.go @@ -13,6 +13,7 @@ import ( const ( localChain = "local" + polkadotJUrl = "http://127.0.0.1:80" ) func RunPolkadot(cli *common.Cli) (*common.DiveMultipleServiceResponse, error) { @@ -164,6 +165,11 @@ func startRelayAndParaChain(cli *common.Cli, enclaveContext *enclaves.EnclaveCon return nil, err } finalResult = finalResult.ConcatenateDiveResults(explorerResult) + + cli.Logger().Info("Redirecting to Polkadote explorer UI...") + if err := common.OpenFile(polkadotJUrl); err != nil { + cli.Logger().Fatalf(common.CodeOf(err), "Failed to open HugoByte Polkadot explorer UI with error %v", err) + } } return finalResult, nil