diff --git a/cli/cmd/bridge/bridge.go b/cli/cmd/bridge/bridge.go new file mode 100644 index 00000000..ab6650f4 --- /dev/null +++ b/cli/cmd/bridge/bridge.go @@ -0,0 +1,19 @@ +package bridge + +import ( + "github.com/hugobyte/dive-core/cli/cmd/bridge/relays" + "github.com/hugobyte/dive-core/cli/common" + "github.com/spf13/cobra" +) + +var BridgeCmd = common.NewDiveCommandBuilder(). + SetUse("bridge"). + SetShort("Command for cross chain communication between two different chains"). + SetLong(`To connect two different chains using any of the supported cross chain communication protocols. +This will create an relay to connect two different chains and pass any messages between them.`). + SetRun(bridge). + AddCommand(relays.BtpRelayCmd). + AddCommand(relays.IbcRelayCmd). + Build() + +func bridge(cmd *cobra.Command, args []string) {} diff --git a/cli/cmd/bridge/relays/btp.go b/cli/cmd/bridge/relays/btp.go new file mode 100644 index 00000000..3b1c0cee --- /dev/null +++ b/cli/cmd/bridge/relays/btp.go @@ -0,0 +1,15 @@ +package relays + +import ( + "github.com/hugobyte/dive-core/cli/common" + "github.com/spf13/cobra" +) + +var BtpRelayCmd = common.NewDiveCommandBuilder(). + SetUse("btp"). + SetShort("Starts BTP Relay to bridge between ChainA and ChainB"). + SetLong("Setup and Starts BTP Relay between ChainA and ChainB a"). + SetRun(btpRelay). + Build() + +func btpRelay(cmd *cobra.Command, args []string) {} diff --git a/cli/cmd/bridge/relays/common.go b/cli/cmd/bridge/relays/common.go new file mode 100644 index 00000000..ed71b5fb --- /dev/null +++ b/cli/cmd/bridge/relays/common.go @@ -0,0 +1 @@ +package relays diff --git a/cli/cmd/bridge/relays/ibc.go b/cli/cmd/bridge/relays/ibc.go new file mode 100644 index 00000000..94013461 --- /dev/null +++ b/cli/cmd/bridge/relays/ibc.go @@ -0,0 +1,16 @@ +package relays + +import ( + "github.com/hugobyte/dive-core/cli/common" + "github.com/spf13/cobra" +) + +var IbcRelayCmd = common.NewDiveCommandBuilder(). + SetUse("ibc"). + SetShort("Start connection between Cosmos based chainA and ChainB and initiate communication between them"). + SetLong(`This Command deploy , initialize the contracts and make it ready for ibc. +Along with that setup and starts the ibc relayer to establish communication between chains specified`). + SetRun(ibcRelay). + Build() + +func ibcRelay(cmd *cobra.Command, args []string) {} diff --git a/cli/cmd/chains/chain/archway.go b/cli/cmd/chains/chain/archway.go new file mode 100644 index 00000000..04003454 --- /dev/null +++ b/cli/cmd/chains/chain/archway.go @@ -0,0 +1,15 @@ +package chain + +import ( + "github.com/hugobyte/dive-core/cli/common" + "github.com/spf13/cobra" +) + +var ArchwayCmd = common.NewDiveCommandBuilder(). + SetUse("archway"). + SetShort("Build, initialize and start a archway node"). + SetLong("The command starts the archway network and allows node in executing contracts"). + SetRun(archway). + Build() + +func archway(cmd *cobra.Command, args []string) {} diff --git a/cli/cmd/chains/chain/eth.go b/cli/cmd/chains/chain/eth.go new file mode 100644 index 00000000..cfaeae33 --- /dev/null +++ b/cli/cmd/chains/chain/eth.go @@ -0,0 +1,16 @@ +package chain + +import ( + "github.com/hugobyte/dive-core/cli/common" + "github.com/spf13/cobra" +) + +var EthCmd = common.NewDiveCommandBuilder(). + SetUse("eth"). + SetShort("Build, initialize and start a eth node."). + SetLong(`The command starts an Ethereum node, initiating the process of setting up and launching a local Ethereum network. +It establishes a connection to the Ethereum network and allows the node in executing smart contracts and maintaining the decentralized ledger.`). + SetRun(eth). + Build() + +func eth(cmd *cobra.Command, args []string) {} diff --git a/cli/cmd/chains/chain/hardhat.go b/cli/cmd/chains/chain/hardhat.go new file mode 100644 index 00000000..46be863b --- /dev/null +++ b/cli/cmd/chains/chain/hardhat.go @@ -0,0 +1,16 @@ +package chain + +import ( + "github.com/hugobyte/dive-core/cli/common" + "github.com/spf13/cobra" +) + +var HardhatCmd = common.NewDiveCommandBuilder(). + SetUse("hardhat"). + SetShort("Build, initialize and start a hardhat node."). + SetLong(`The command starts an hardhat node, initiating the process of setting up and launching a local hardhat network. +It establishes a connection to the hardhat network and allows the node in executing smart contracts and maintaining the decentralized ledger.`). + SetRun(hardhat). + Build() + +func hardhat(cmd *cobra.Command, args []string) {} diff --git a/cli/cmd/chains/chain/icon.go b/cli/cmd/chains/chain/icon.go new file mode 100644 index 00000000..4caf06b7 --- /dev/null +++ b/cli/cmd/chains/chain/icon.go @@ -0,0 +1,16 @@ +package chain + +import ( + "github.com/hugobyte/dive-core/cli/common" + "github.com/spf13/cobra" +) + +var IconCmd = common.NewDiveCommandBuilder(). + SetUse("icon"). + SetShort("Build, initialize and start a icon node."). + SetLong(`The command starts an Icon node, initiating the process of setting up and launching a local Icon network. +It establishes a connection to the Icon network and allows the node in executing smart contracts and maintaining the decentralized ledger.`). + SetRun(icon). + Build() + +func icon(cmd *cobra.Command, args []string) {} diff --git a/cli/cmd/chains/chain/neutron.go b/cli/cmd/chains/chain/neutron.go new file mode 100644 index 00000000..44f62689 --- /dev/null +++ b/cli/cmd/chains/chain/neutron.go @@ -0,0 +1,15 @@ +package chain + +import ( + "github.com/hugobyte/dive-core/cli/common" + "github.com/spf13/cobra" +) + +var NeutronCmd = common.NewDiveCommandBuilder(). + SetUse("neutron"). + SetShort("Build, initialize and start a neutron node"). + SetLong("The command starts the neutron network and allows node in executing contracts"). + SetRun(neutron). + Build() + +func neutron(cmd *cobra.Command, args []string) {} diff --git a/cli/cmd/chains/chains.go b/cli/cmd/chains/chains.go new file mode 100644 index 00000000..489fb9e3 --- /dev/null +++ b/cli/cmd/chains/chains.go @@ -0,0 +1,44 @@ +package chains + +import ( + "os" + "slices" + + "github.com/hugobyte/dive-core/cli/cmd/chains/chain" + "github.com/hugobyte/dive-core/cli/common" + "github.com/spf13/cobra" +) + +var ChainCmd = common.NewDiveCommandBuilder(). + SetUse("chain"). + SetShort("Build, initialize and start a given blockchain node"). + SetLong(`The command builds, initializes, and starts a specified blockchain node, providing a seamless setup process. +It encompasses compiling and configuring the necessary dependencies and components required for the blockchain network. +By executing this command, the node is launched, enabling network participation, transaction processing, and ledger +maintenance within the specified blockchain ecosystem.`, + ). + AddCommand(chain.IconCmd). + AddCommand(chain.EthCmd). + AddCommand(chain.HardhatCmd). + AddCommand(chain.ArchwayCmd). + AddCommand(chain.NeutronCmd). + SetRun(chains). + Build() + +func chains(cmd *cobra.Command, args []string) { + + validArgs := cmd.ValidArgs + for _, c := range cmd.Commands() { + validArgs = append(validArgs, c.Name()) + } + cmd.ValidArgs = validArgs + + if len(args) == 0 { + cmd.Help() + + } else if !slices.Contains(cmd.ValidArgs, args[0]) { + + cmd.Usage() + os.Exit(1) + } +} diff --git a/cli/cmd/root.go b/cli/cmd/root.go index 6d1ac325..871d4745 100644 --- a/cli/cmd/root.go +++ b/cli/cmd/root.go @@ -3,6 +3,8 @@ package cmd import ( "os" + "github.com/hugobyte/dive-core/cli/cmd/bridge" + "github.com/hugobyte/dive-core/cli/cmd/chains" "github.com/hugobyte/dive-core/cli/cmd/social" "github.com/hugobyte/dive-core/cli/cmd/utility" "github.com/hugobyte/dive-core/cli/common" @@ -19,6 +21,8 @@ var rootCmd = common.NewDiveCommandBuilder(). AddCommand(utility.VersionCmd). AddCommand(social.DiscordCmd). AddCommand(social.TwitterCmd). + AddCommand(chains.ChainCmd). + AddCommand(bridge.BridgeCmd). AddBoolPersistentFlag(&common.DiveLogs, "verbose", false, "Prints out logs to Stdout"). SetRunE(run). Build()