generated from kurtosis-tech/package-template-repo
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update bridge and chain command to use builder pattern
- Loading branch information
1 parent
79a0eff
commit be65fea
Showing
11 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package relays |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters