diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f4c0e67 --- /dev/null +++ b/.gitignore @@ -0,0 +1,44 @@ +# Compiled binary files +air-zk + +# Configuration files +config + + +# Log files +evm-chain +cosmwasm-chain +solana-chain + +/dos/farf/ +/farf/ +/solana-release/ +/solana-release.tar.bz2 +/solana-metrics/ +/solana-metrics.tar.bz2 +/target/ +/test-ledger/ + +**/*.rs.bk +.cargo + +/config/ + +.cache + +# log files +*.log +log-*.txt + +# intellij files +.idea/ +/solana.iml +/.vscode/ + +# fetch-spl.sh artifacts +/spl-genesis-args.sh +/spl_*.so + +.DS_Store +# scripts that may be generated by cargo *-bpf commands +**/cargo-*-bpf-child-script-*.sh \ No newline at end of file diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..840a67d --- /dev/null +++ b/AUTHORS @@ -0,0 +1,7 @@ +Co-authored-by: Shobhit Sharma +Co-authored-by: Kritarth Agrawal +Co-authored-by: Shubham Sharma +Co-authored-by: Uddesh Jaiswal +Co-authored-by: Rahul Singh Maraskole +Co-authored-by: Aakash Singh Rajput + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..909db6b --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +# Makefile for installing dependencies + +.PHONY: deps + +deps: + @echo "Installing dependencies..." + diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..e69de29 diff --git a/client/cosmwasm.go b/client/cosmwasm.go new file mode 100644 index 0000000..bbead9b --- /dev/null +++ b/client/cosmwasm.go @@ -0,0 +1,195 @@ +package client + +import ( + "airchains/utils" + "airchains/utils/cosmwasm" + "fmt" + "os" + "strings" + + "github.com/manifoldco/promptui" +) + +func CosmWasmInitialiazation() { + data := map[string]interface{}{ + "chainInfo": CosmWasmChainInfo(), + "daInfo": cosmwasmDAType(), + "sequencerInfo": cosmwasmSequencerType(), + } + utils.CreateFolderAndJSONFile(data, "config", "config.json") + daType := data["daInfo"].(map[string]interface{})["daSelected"].(string) + daTypetoLower := strings.ToLower(daType) + daTypeSend := "http://localhost:5050/" + daTypetoLower + fmt.Println(daTypeSend) + utils.ENVSetup("cosmwasm-sequencer-node", "26657", daTypetoLower) + +} + +func CosmWasmChainInfo() map[string]interface{} { + var chainInfoKeyValue map[string]interface{} + + // First question + validate1 := func(input string) error { + trimmedInput := strings.TrimSpace(input) + + if len(trimmedInput) == 0 { + return fmt.Errorf("input cannot be empty") + } + + if len(trimmedInput) < 3 { + return fmt.Errorf("input must be at least 3 characters") + } + + if trimmedInput == "dummyname" { + return fmt.Errorf("please provide a custom account name other than dummyname") + } + + return nil + } + + prompt1 := promptui.Prompt{ + Label: fmt.Sprintf("What do you want your account name to be? (e.g., %s)", "dummyname"), + Validate: validate1, + } + accountName, err := prompt1.Run() + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + os.Exit(1) + } + + // Second question + validate2 := func(input string) error { + trimmedInput := strings.TrimSpace(input) + + if len(trimmedInput) == 0 { + return fmt.Errorf("input cannot be empty") + } + + if len(trimmedInput) < 3 { + return fmt.Errorf("input must be at least 3 characters") + } + + if trimmedInput == "dummyname" { + return fmt.Errorf("please provide a custom account name other than dummyname") + } + + return nil + } + prompt2 := promptui.Prompt{ + Label: fmt.Sprintf("What is the chain ID of your chain? (e.g., %s)", "aircosmic_5501-1107"), + Validate: validate2, + } + chainID, err := prompt2.Run() + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + os.Exit(1) + } + + // Third question + validate3 := func(input string) error { + trimmedInput := strings.TrimSpace(input) + + if len(trimmedInput) == 0 { + return fmt.Errorf("input cannot be empty") + } + + if len(trimmedInput) < 3 { + return fmt.Errorf("input must be at least 3 characters") + } + + if trimmedInput == "My Chain" { + return fmt.Errorf("please provide a custom account name other than dummyname") + } + + return nil + + } + prompt3 := promptui.Prompt{ + Label: fmt.Sprintf("What do you want the name of your chain? (e.g., %s)", "dummyname"), + Validate: validate3, + } + chainName, err := prompt3.Run() + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + os.Exit(1) + } + + chainInfoKeyValue = map[string]interface{}{ + + "key": accountName, + "chainID": chainID, + "moniker": chainName, + } + utils.DelayLoader() + + return chainInfoKeyValue +} + +func cosmwasmDAType() map[string]interface{} { + var chainInfoKeyValue map[string]interface{} + + prompt := promptui.Select{ + Label: "Select your DA type : ", + Items: []string{"Celestia", "Avail", "Eigen Layer"}, + Templates: &promptui.SelectTemplates{ + Label: "{{ . | cyan }}", + Active: "\U000025B6 {{ if eq . \"Eigen Layer\" }}{{ . | red | cyan }} (Coming Soon){{ else }}{{ . | green }}{{ end }}", + Inactive: " {{ . | black }}", + Selected: "\U000025B6 {{ . | cyan | cyan }}", + }, + } + _, daTech, err := prompt.Run() + + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + return evmDAType() + } + if daTech == "Eigen Layer" { + fmt.Printf("Eigen Layer is coming soon. Please select other DAs for now\n") + evmDAType() + } else { + fmt.Printf("You selected %s\n", daTech) + utils.DaRPC() + utils.SettlementRPC() + } + + chainInfoKeyValue = map[string]interface{}{ + "daSelected": daTech, + } + + utils.DelayLoader() + return chainInfoKeyValue +} + +func cosmwasmSequencerType() map[string]interface{} { + var sequencerKeyValue map[string]interface{} + prompt := promptui.Select{ + Label: "Select your sequencer type : ", + Items: []string{"Air Sequencer", "Espresso Sequencer"}, + Templates: &promptui.SelectTemplates{ + Label: "{{ . | cyan }}", + Active: "\U000025B6 {{ if eq . \"Espresso Sequencer\" }}{{ . | red | cyan }} (Coming Soon){{ else }}{{ . | green }}{{ end }}", + Inactive: " {{ . | black }}", + Selected: "\U000025B6 {{ . | cyan | cyan }}", + }, + } + _, sequencerValue, err := prompt.Run() + + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + evmSequencerType() + } + if sequencerValue == "Espresso Sequencer" { + fmt.Printf("Espresso Sequencer is coming soon. Only air sequencer is available for now\n") + evmSequencerType() + } else { + fmt.Printf("You selected %s\n", sequencerValue) + cosmwasm.CosmwasmSequencerClone() + } + sequencerKeyValue = map[string]interface{}{ + "sequencerType": sequencerValue, + } + + utils.DelayLoader() + return sequencerKeyValue +} diff --git a/client/evm.go b/client/evm.go new file mode 100644 index 0000000..4a78bfb --- /dev/null +++ b/client/evm.go @@ -0,0 +1,195 @@ +package client + +import ( + "airchains/utils" + "airchains/utils/evm" + "fmt" + "os" + "strings" + + "github.com/manifoldco/promptui" +) + +func EVMInitialiazation() { + data := map[string]interface{}{ + "chainInfo": EVMChainInfo(), + "daInfo": evmDAType(), + "sequencerInfo": evmSequencerType(), + } + utils.CreateFolderAndJSONFile(data, "config", "config.json") + + daType := data["daInfo"].(map[string]interface{})["daSelected"].(string) + daTypetoLower := strings.ToLower(daType) + daTypeSend := "http://localhost:5050/" + daTypetoLower + fmt.Println(daTypeSend) + utils.ENVSetup("evm-sequencer-node", "8545", daTypetoLower) + +} + +func EVMChainInfo() map[string]interface{} { + var chainInfoKeyValue map[string]interface{} + + // First question + validate1 := func(input string) error { + trimmedInput := strings.TrimSpace(input) + + if len(trimmedInput) == 0 { + return fmt.Errorf("input cannot be empty") + } + + if len(trimmedInput) < 3 { + return fmt.Errorf("input must be at least 3 characters") + } + + if trimmedInput == "dummyname" { + return fmt.Errorf("please provide a custom account name other than dummyname") + } + + return nil + } + + prompt1 := promptui.Prompt{ + Label: fmt.Sprintf("What do you want your account name to be? (e.g., %s)", "dummyname"), + Validate: validate1, + } + accountName, err := prompt1.Run() + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + os.Exit(1) + } + + // Second question + validate2 := func(input string) error { + trimmedInput := strings.TrimSpace(input) + + if len(trimmedInput) == 0 { + return fmt.Errorf("input cannot be empty") + } + + if len(trimmedInput) < 3 { + return fmt.Errorf("input must be at least 3 characters") + } + + if trimmedInput == "dummyname" || trimmedInput == "dummyName" { + return fmt.Errorf("please provide a custom account name other than dummyname") + } + + return nil + } + prompt2 := promptui.Prompt{ + Label: fmt.Sprintf("What is the chain ID of your chain? (e.g., %s)", "aircosmic_5526-1107"), + Validate: validate2, + } + chainID, err := prompt2.Run() + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + os.Exit(1) + } + + // Third question + validate3 := func(input string) error { + trimmedInput := strings.TrimSpace(input) + + if len(trimmedInput) == 0 { + return fmt.Errorf("input cannot be empty") + } + + if len(trimmedInput) < 3 { + return fmt.Errorf("input must be at least 3 characters") + } + + if trimmedInput == "dummyname" { + return fmt.Errorf("please provide a custom account name other than dummyname") + } + + return nil + + } + prompt3 := promptui.Prompt{ + Label: fmt.Sprintf("What do you want the name of your chain? (e.g., %s)", "dummyname"), + Validate: validate3, + } + chainName, err := prompt3.Run() + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + os.Exit(1) + } + + chainInfoKeyValue = map[string]interface{}{ + + "key": accountName, + "chainID": chainID, + "moniker": chainName, + } + utils.DelayLoader() + + return chainInfoKeyValue +} + +func evmDAType() map[string]interface{} { + var chainInfoKeyValue map[string]interface{} + + prompt := promptui.Select{ + Label: "Select your DA type : ", + Items: []string{"Celestia", "Avail", "Eigen Layer"}, + Templates: &promptui.SelectTemplates{ + Label: "{{ . | cyan }}", + Active: "\U000025B6 {{ if eq . \"Eigen Layer\" }}{{ . | red | cyan }} (Coming Soon){{ else }}{{ . | green }}{{ end }}", + Inactive: " {{ . | black }}", + Selected: "\U000025B6 {{ . | cyan | cyan }}", + }, + } + _, daTech, err := prompt.Run() + + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + return evmDAType() + } + if daTech == "Eigen Layer" { + fmt.Printf("Eigen Layer is coming soon. Please select other DAs for now\n") + evmDAType() + } else { + fmt.Printf("You selected %s\n", daTech) + utils.DaRPC() + utils.SettlementRPC() + } + + chainInfoKeyValue = map[string]interface{}{ + "daSelected": daTech, + } + + utils.DelayLoader() + return chainInfoKeyValue +} + +func evmSequencerType() map[string]interface{} { + var sequencerKeyValue map[string]interface{} + prompt := promptui.Select{ + Label: "Select your sequencer type : ", + Items: []string{"Air Sequencer", "Espresso Sequencer"}, + Templates: &promptui.SelectTemplates{ + Label: "{{ . | cyan }}", + Active: "\U000025B6 {{ if eq . \"Espresso Sequencer\" }}{{ . | red | cyan }} (Coming Soon){{ else }}{{ . | green }}{{ end }}", + Inactive: " {{ . | black }}", + Selected: "\U000025B6 {{ . | cyan | cyan }}", + }, + } + _, sequencerValue, err := prompt.Run() + + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + evmSequencerType() + } + if sequencerValue == "Espresso Sequencer" { + fmt.Printf("Espresso Sequencer is coming soon. Only air sequencer is available for now\n") + evmSequencerType() + } else { + fmt.Printf("You selected %s\n", sequencerValue) + evm.EvmSequencerClone() + } + sequencerKeyValue = map[string]interface{}{ + "sequencerType": sequencerValue, + } + utils.DelayLoader() + return sequencerKeyValue +} diff --git a/client/multinode/evm.go b/client/multinode/evm.go new file mode 100644 index 0000000..8efafcd --- /dev/null +++ b/client/multinode/evm.go @@ -0,0 +1,137 @@ +package multinode + +import ( + "airchains/utils" + "fmt" + "os" + "strings" + + "github.com/manifoldco/promptui" +) + +func MultiNodeEVMInitialiazation() { + data := map[string]interface{}{ + "chainInfo": EVMChainInfo(), + } + utils.CreateFolderAndJSONFile(data, "config", "multinode-config.json") +} + +func EVMChainInfo() map[string]interface{} { + var chainInfoKeyValue map[string]interface{} + + // First question + validate1 := func(input string) error { + trimmedInput := strings.TrimSpace(input) + + if len(trimmedInput) == 0 { + return fmt.Errorf("input cannot be empty") + } + + if len(trimmedInput) < 3 { + return fmt.Errorf("input must be at least 3 characters") + } + + return nil + } + + prompt1 := promptui.Prompt{ + Label: fmt.Sprintf("What is the IP Address of the chain? (e.g., %s)", "192.168.1.1"), + Validate: validate1, + } + ipAddress, err := prompt1.Run() + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + os.Exit(1) + } + + // Second question + validate2 := func(input string) error { + trimmedInput := strings.TrimSpace(input) + + if len(trimmedInput) == 0 { + return fmt.Errorf("input cannot be empty") + } + + if len(trimmedInput) < 3 { + return fmt.Errorf("input must be at least 3 characters") + } + return nil + } + prompt2 := promptui.Prompt{ + Label: fmt.Sprintf("What is the chain ID of your chain? (e.g., %s)", "aircosmic_5501-1107"), + Validate: validate2, + } + chainID, err := prompt2.Run() + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + os.Exit(1) + } + + // Third question + validate3 := func(input string) error { + trimmedInput := strings.TrimSpace(input) + + if len(trimmedInput) == 0 { + return fmt.Errorf("input cannot be empty") + } + + if len(trimmedInput) < 3 { + return fmt.Errorf("input must be at least 3 characters") + } + return nil + + } + prompt3 := promptui.Prompt{ + Label: fmt.Sprintf("What is the node ID of your chain? (e.g., %s)", "d27015f43a1b5de64ecda0f99ac00a0de34f3d95"), + Validate: validate3, + } + nodeID, err := prompt3.Run() + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + os.Exit(1) + } + + // Second question + validate4 := func(input string) error { + trimmedInput := strings.TrimSpace(input) + + if len(trimmedInput) == 0 { + return fmt.Errorf("input cannot be empty") + } + + if len(trimmedInput) < 3 { + return fmt.Errorf("input must be at least 3 characters") + } + + return nil + } + prompt4 := promptui.Prompt{ + Label: fmt.Sprintf("What do you want to name your node? (e.g., %s)", "aircosmic-node-1"), + Validate: validate4, + } + nodeName, err := prompt4.Run() + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + os.Exit(1) + } + prompt5 := promptui.Prompt{ + Label: fmt.Sprintf("More Info at https://docs.airchains.io Paste the seed node genesis.json at evm-chain/seed-genesis.json. Type Done and Press Enter to continue"), + Validate: validate4, + } + genesisFile, err := prompt5.Run() + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + os.Exit(1) + } + + chainInfoKeyValue = map[string]interface{}{ + "ipAddress": ipAddress, + "chainID": chainID, + "nodeID": nodeID, + "nodeName": nodeName, + "genesis": genesisFile, + } + utils.DelayLoader() + + return chainInfoKeyValue +} diff --git a/client/svm.go b/client/svm.go new file mode 100644 index 0000000..44e0c7f --- /dev/null +++ b/client/svm.go @@ -0,0 +1,90 @@ +package client + +import ( + "airchains/utils" + "airchains/utils/svm" + "fmt" + "strings" + + "github.com/manifoldco/promptui" +) + +func SVMInitialiazation() { + data := map[string]interface{}{ + "daInfo": svmDAType(), + "sequencerInfo": svmSequencerType(), + } + utils.CreateFolderAndJSONFile(data, "config", "solana_config.json") + daType := data["daInfo"].(map[string]interface{})["daSelected"].(string) + daTypetoLower := strings.ToLower(daType) + utils.ENVSetup("svm-sequencer-node", "8899", daTypetoLower) + +} + +func svmDAType() map[string]interface{} { + var chainInfoKeyValue map[string]interface{} + + prompt := promptui.Select{ + Label: "Select your DA type : ", + Items: []string{"Celestia", "Avail", "Eigen Layer"}, + Templates: &promptui.SelectTemplates{ + Label: "{{ . | cyan }}", + Active: "\U000025B6 {{ if eq . \"Eigen Layer\" }}{{ . | red | cyan }} (Coming Soon){{ else }}{{ . | green }}{{ end }}", + Inactive: " {{ . | black }}", + Selected: "\U000025B6 {{ . | cyan | cyan }}", + }, + } + _, daTech, err := prompt.Run() + + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + return svmDAType() + } + if daTech == "Eigen Layer" { + fmt.Printf("Eigen Layer is coming soon. Please select other DAs for now\n") + svmDAType() + } else { + fmt.Printf("You selected %s\n", daTech) + utils.DaRPC() + utils.SettlementRPC() + + } + + chainInfoKeyValue = map[string]interface{}{ + "daSelected": daTech, + } + + utils.DelayLoader() + return chainInfoKeyValue +} + +func svmSequencerType() map[string]interface{} { + var sequencerKeyValue map[string]interface{} + prompt := promptui.Select{ + Label: "Select your sequencer type : ", + Items: []string{"Air Sequencer", "Espresso Sequencer"}, + Templates: &promptui.SelectTemplates{ + Label: "{{ . | cyan }}", + Active: "\U000025B6 {{ if eq . \"Espresso Sequencer\" }}{{ . | red | cyan }} (Coming Soon){{ else }}{{ . | green }}{{ end }}", + Inactive: " {{ . | black }}", + Selected: "\U000025B6 {{ . | cyan | cyan }}", + }, + } + _, sequencerValue, err := prompt.Run() + + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + svmSequencerType() + } + if sequencerValue == "Espresso Sequencer" { + fmt.Printf("Espresso Sequencer is coming soon. Only air sequencer is available for now\n") + svmSequencerType() + } else { + svm.SolanaSequencerClone() + } + sequencerKeyValue = map[string]interface{}{ + "sequencerType": sequencerValue, + } + utils.DelayLoader() + return sequencerKeyValue +} diff --git a/commands/init.go b/commands/init.go new file mode 100644 index 0000000..b51320d --- /dev/null +++ b/commands/init.go @@ -0,0 +1,55 @@ +package commands + +import ( + "airchains/client" + "airchains/utils" + "airchains/utils/cosmwasm" + "airchains/utils/evm" + "airchains/utils/svm" + "fmt" + + "github.com/manifoldco/promptui" +) + +func InitFunction() { + prompt := promptui.Select{ + Label: "Select your chain type : ", + Items: []string{"EVM", "COSMWASM", "SVM"}, + Templates: &promptui.SelectTemplates{ + Label: "{{ . | cyan }}", + Active: "\U000025B6 {{ . | green }}", + Inactive: " {{ . | black }}", + Selected: "\U000025B6 {{ . | cyan | cyan }}", + }, + } + + _, chainTypeSelected, err := prompt.Run() + + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + return + } + + if chainTypeSelected == "EVM" { + evm.EVMChainClone() + utils.DelayLoader() + client.EVMInitialiazation() + utils.ChainSetup("rollup-evm") + evm.RunEVMChain() + } + + if chainTypeSelected == "SVM" { + svm.SolanaChainClone() + utils.DelayLoader() + client.SVMInitialiazation() + svm.RunSVMChain() + } + + if chainTypeSelected == "COSMWASM" { + cosmwasm.CosmosChainClone() + utils.DelayLoader() + client.CosmWasmInitialiazation() + utils.ChainSetup("rollup-cosmwasm") + cosmwasm.RunCosmosChain() + } +} diff --git a/commands/multi-node.go b/commands/multi-node.go new file mode 100644 index 0000000..53d2b7a --- /dev/null +++ b/commands/multi-node.go @@ -0,0 +1,37 @@ +package commands + +import ( + "airchains/client/multinode" + "airchains/utils" + "airchains/utils/evm" + "fmt" + + "github.com/manifoldco/promptui" +) + +func RunNonValidatorNode() { + prompt := promptui.Select{ + Label: "Select your chain type : ", + Items: []string{"EVM", "COSMWASM", "SVM"}, + Templates: &promptui.SelectTemplates{ + Label: "{{ . | cyan }}", + Active: "\U000025B6 {{ . | green }}", + Inactive: " {{ . | black }}", + Selected: "\U000025B6 {{ . | cyan | cyan }}", + }, + } + + _, chainTypeSelected, err := prompt.Run() + + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + return + } + + if chainTypeSelected == "EVM" { + evm.EVMChainClone() + utils.DelayLoader() + multinode.MultiNodeEVMInitialiazation() + evm.RunMultiNodeEVMChain() + } +} diff --git a/commands/start.go b/commands/start.go new file mode 100644 index 0000000..918eb38 --- /dev/null +++ b/commands/start.go @@ -0,0 +1,42 @@ +package commands + +import ( + "airchains/utils" + "fmt" + + "github.com/manifoldco/promptui" +) + +func StartType() { + prompt := promptui.Select{ + Label: "Select your chain type : ", + Items: []string{"Start a new chain", "Run a non validator node", "Run a validator node"}, + Templates: &promptui.SelectTemplates{ + Label: "{{ . | cyan }}", + Active: "\U000025B6 {{ . | green }}", + Inactive: " {{ . | black }}", + Selected: "\U000025B6 {{ . | cyan | cyan }}", + }, + } + + _, selectedStartType, err := prompt.Run() + + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + return + } + + if selectedStartType == "Start a new chain" { + fmt.Println("Starting a new chain...") + utils.DelayLoader() + InitFunction() + + } + + if selectedStartType == "Run a non validator node" { + fmt.Println("Running a non validator node...") + fmt.Println("Please refer to the documentation at https://docs.airchains.io for more information") + utils.DelayLoader() + RunNonValidatorNode() + } +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..196d740 --- /dev/null +++ b/go.mod @@ -0,0 +1,35 @@ +module airchains + +go 1.21 + +require ( + github.com/briandowns/spinner v1.23.0 + github.com/ethereum/go-ethereum v1.13.6 + github.com/manifoldco/promptui v0.9.0 + github.com/spf13/cobra v1.8.0 +) + +require ( + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/chzyer/readline v1.5.1 // indirect + github.com/deckarep/golang-set/v2 v2.5.0 // indirect + github.com/fatih/color v1.16.0 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect + github.com/gorilla/websocket v1.5.1 // indirect + github.com/holiman/uint256 v1.2.4 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/shirou/gopsutil v3.21.11+incompatible // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/tklauser/go-sysconf v0.3.13 // indirect + github.com/tklauser/numcpus v0.7.0 // indirect + github.com/yusufpapurcu/wmi v1.2.3 // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.15.0 // indirect + golang.org/x/tools v0.16.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..df5d0bf --- /dev/null +++ b/go.sum @@ -0,0 +1,202 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0/go.mod h1:+6KLcKIVgxoBDMqMO/Nvy7bZ9a0nbU3I1DtFQK3YvB4= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= +github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= +github.com/aws/aws-sdk-go-v2 v1.21.2/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM= +github.com/aws/aws-sdk-go-v2/config v1.18.45/go.mod h1:ZwDUgFnQgsazQTnWfeLWk5GjeqTQTL8lMkoE1UXzxdE= +github.com/aws/aws-sdk-go-v2/credentials v1.13.43/go.mod h1:zWJBz1Yf1ZtX5NGax9ZdNjhhI4rgjfgsyk6vTY1yfVg= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13/go.mod h1:f/Ib/qYjhV2/qdsf79H3QP/eRE4AkVyEf6sk7XfZ1tg= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43/go.mod h1:auo+PiyLl0n1l8A0e8RIeR8tOzYPfZZH/JNlrJ8igTQ= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37/go.mod h1:Qe+2KtKml+FEsQF/DHmDV+xjtche/hwoF75EG4UlHW8= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45/go.mod h1:lD5M20o09/LCuQ2mE62Mb/iSdSlCNuj6H5ci7tW7OsE= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37/go.mod h1:vBmDnwWXWxNPFRMmG2m/3MKOe+xEcMDo1tanpaWCcck= +github.com/aws/aws-sdk-go-v2/service/route53 v1.30.2/go.mod h1:TQZBt/WaQy+zTHoW++rnl8JBrmZ0VO6EUbVua1+foCA= +github.com/aws/aws-sdk-go-v2/service/sso v1.15.2/go.mod h1:gsL4keucRCgW+xA85ALBpRFfdSLH4kHOVSnLMSuBECo= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3/go.mod h1:a7bHA82fyUXOm+ZSWKU6PIoBxrjSprdLoM8xPYvzYVg= +github.com/aws/aws-sdk-go-v2/service/sts v1.23.2/go.mod h1:Eows6e1uQEsc4ZaHANmsPRzAKcVDrcmjjWiih2+HUUQ= +github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88= +github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/briandowns/spinner v1.23.0 h1:alDF2guRWqa/FOZZYWjlMIx2L6H0wyewPxo/CH4Pt2A= +github.com/briandowns/spinner v1.23.0/go.mod h1:rPG4gmXeN3wQV/TsAY4w8lPdIM6RX3yqeBQJSrbXjuE= +github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= +github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= +github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= +github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= +github.com/cloudflare/cloudflare-go v0.79.0/go.mod h1:gkHQf9xEubaQPEuerBuoinR9P8bf8a05Lq0X6WKy1Oc= +github.com/cockroachdb/errors v1.8.1/go.mod h1:qGwQn6JmZ+oMjuLwjWzUNqblqk0xl4CVV3SQbGwK7Ac= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593/go.mod h1:6hk1eMY/u5t+Cf18q5lFMUA1Rc+Sm5I6Ra1QuPyxXCo= +github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= +github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= +github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= +github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= +github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set/v2 v2.5.0 h1:hn6cEZtQ0h3J8kFrHR/NrzyOoTnjgW1+FmNJzQ7y/sA= +github.com/deckarep/golang-set/v2 v2.5.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= +github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= +github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/go-ethereum v1.13.6 h1:TMlJ4t3TLVcnAMo2S8q+WocDLB6z496cYtkRyJJNNKQ= +github.com/ethereum/go-ethereum v1.13.6/go.mod h1:kcRZmuzRn1lVejiFNTz4l4W7imnpq1bDAnuKS/RyhbQ= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= +github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267/go.mod h1:h1nSAbGFqGVzn6Jyl1R/iCcBUHN4g+gW1u9CoBTrb9E= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= +github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= +github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= +github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= +github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7/go.mod h1:IToEjHuttnUzwZI5KBSM/LOOW3qLbbrHOEfp3SbECGY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= +github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= +github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= +github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= +github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4= +github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= +github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 h1:qCEDpW1G+vcj3Y7Fy52pEM1AWm3abj8WimGYejI3SC4= +golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/main b/main new file mode 100755 index 0000000..3fc4b73 Binary files /dev/null and b/main differ diff --git a/main.go b/main.go new file mode 100644 index 0000000..73bb2e5 --- /dev/null +++ b/main.go @@ -0,0 +1,36 @@ +package main + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" + + commands "airchains/commands" +) + +var rootCmd = &cobra.Command{ + Use: "airchains", + Short: "Command line tool for interacting with the Air-ZK application.", +} + +var startCMD = &cobra.Command{ + Use: "start", + Short: "Starts the Airchains ZK-Rollup SDK by asking the user a series of questions.", + Run: start, +} + +func start(cmd *cobra.Command, args []string) { + commands.StartType() +} + +func init() { + rootCmd.AddCommand(startCMD) +} + +func main() { + if err := rootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} diff --git a/runprogram.sh b/runprogram.sh new file mode 100644 index 0000000..fa5130b --- /dev/null +++ b/runprogram.sh @@ -0,0 +1,3 @@ +/usr/local/go/bin/go build + +./air-zk start \ No newline at end of file diff --git a/utils/cosmwasm/cosmwasm.go b/utils/cosmwasm/cosmwasm.go new file mode 100644 index 0000000..0c5bbeb --- /dev/null +++ b/utils/cosmwasm/cosmwasm.go @@ -0,0 +1,22 @@ +package cosmwasm + +import ( + "airchains/utils" + "fmt" +) + +func RunCosmosChain() { + chainFolderName := "rollup-cosmwasm" + chainInit := "start-chain.sh" + + seqFolderName := "cosmwasm-sequencer-node" + seqInit := "scripts/test.sh" + + if err := utils.RunChainSeq(chainFolderName, chainInit); err != nil { + fmt.Printf("Error: %v\n", err) + } + + if err := utils.RunChainSeq(seqFolderName, seqInit); err != nil { + fmt.Printf("Error: %v\n", err) + } +} diff --git a/utils/cosmwasm/cosmwasmChain.go b/utils/cosmwasm/cosmwasmChain.go new file mode 100644 index 0000000..d5579dc --- /dev/null +++ b/utils/cosmwasm/cosmwasmChain.go @@ -0,0 +1,16 @@ +package cosmwasm + +import ( + "airchains/utils" + "fmt" + "path/filepath" +) + +func CosmosChainClone() { + repoURL := "https://github.com/airchains-network/rollup-cosmwasm.git" + destinationFolder := "rollup-cosmwasm" + destinationPath := filepath.Join(".", destinationFolder) + if err := utils.ChainRepoCloner(repoURL, destinationPath, "SVM"); err != nil { + fmt.Printf("Error: %v\n", err) + } +} diff --git a/utils/cosmwasm/cosmwasmSequencer.go b/utils/cosmwasm/cosmwasmSequencer.go new file mode 100644 index 0000000..64a9e13 --- /dev/null +++ b/utils/cosmwasm/cosmwasmSequencer.go @@ -0,0 +1,15 @@ +package cosmwasm + +import ( + "airchains/utils" + "fmt" + "path/filepath" +) + +func CosmwasmSequencerClone() { + repoURL := "https://github.com/airchains-network/cosmwasm-sequencer-node.git" + destinationPath := filepath.Join(".", "cosmwasm-sequencer-node") + if err := utils.ChainRepoCloner(repoURL, destinationPath, "SVM-Sequencer"); err != nil { + fmt.Printf("Error: %v\n", err) + } +} diff --git a/utils/createFile.go b/utils/createFile.go new file mode 100644 index 0000000..3d8543c --- /dev/null +++ b/utils/createFile.go @@ -0,0 +1,103 @@ +// fileutil.go +package utils + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "os" + "path/filepath" +) + +// CreateFolderAndJSONFile creates a folder and a JSON file with the provided data. +func CreateFolderAndJSONFile(data map[string]interface{}, folderName, fileName string) { + // Check if the folder exists; create it if not + if _, err := os.Stat(folderName); os.IsNotExist(err) { + if err := os.Mkdir(folderName, 0755); err != nil { + fmt.Printf("Error creating folder: %v\n", err) + os.Exit(1) + } + } + + // Combine folder and file paths + jsonFilePath := filepath.Join(folderName, fileName) + + // Check if the JSON file exists + if _, err := os.Stat(jsonFilePath); os.IsNotExist(err) { + // Create a new JSON file + createNewJSONFile(data, jsonFilePath) + } else { + // Update the existing JSON file + updateExistingJSONFile(data, jsonFilePath) + } + + fmt.Printf("Data has been saved into config.json: %s\n", jsonFilePath) +} + +func createNewJSONFile(data map[string]interface{}, filename string) { + jsonData, err := json.MarshalIndent(data, "", " ") + if err != nil { + fmt.Printf("Error encoding JSON: %v\n", err) + os.Exit(1) + } + + if err := ioutil.WriteFile(filename, jsonData, 0644); err != nil { + fmt.Printf("Error writing JSON file: %v\n", err) + os.Exit(1) + } +} + +func updateExistingJSONFile(data map[string]interface{}, filename string) { + // Read the existing JSON file + existingData, err := ioutil.ReadFile(filename) + if err != nil { + fmt.Printf("Error reading existing JSON file: %v\n", err) + os.Exit(1) + } + + // Unmarshal the existing JSON data + var existingMap map[string]interface{} + if err := json.Unmarshal(existingData, &existingMap); err != nil { + fmt.Printf("Error decoding existing JSON data: %v\n", err) + os.Exit(1) + } + + // Update the existing map with new data + for key, value := range data { + existingMap[key] = value + } + + // Encode the updated data and write it back to the file + updatedData, err := json.MarshalIndent(existingMap, "", " ") + if err != nil { + fmt.Printf("Error encoding updated JSON: %v\n", err) + os.Exit(1) + } + + if err := ioutil.WriteFile(filename, updatedData, 0644); err != nil { + fmt.Printf("Error writing updated JSON file: %v\n", err) + os.Exit(1) + } +} + +func CreateENV(data string, folderName, fileName string) { + + jsonFilePath := filepath.Join(folderName, fileName) + + fmt.Printf("Data has been saved into .env: %s\n", jsonFilePath) +} + +func ENVSetup(filePath string, exePort string, daTypeSend string) { + ExecutionClientRPC := fmt.Sprintf("http://localhost:%s", exePort) + ExecutionClientTRPC := "http://localhost:1317" + ExecutionClientJsonRPC := "http://localhost:26657" + DaClientRPC := fmt.Sprintf("http://localhost:5050/%s", daTypeSend) + SettlementClientRPC := "http://localhost:8080" + + envFileData := []byte(fmt.Sprintf("ExecutionClientRPC=%s\nExecutionClientTRPC=%s\nExecutionClientJsonRPC=%s\nDaClientRPC=%s\nSettlementClientRPC=%s\n", ExecutionClientRPC, ExecutionClientTRPC, ExecutionClientJsonRPC, DaClientRPC, SettlementClientRPC)) + filePathRoot := fmt.Sprintf("%s/.env", filePath) + envWriteErr := os.WriteFile(filePathRoot, envFileData, 0666) + if envWriteErr != nil { + fmt.Println("Error writing to .env file:", envWriteErr) + } +} diff --git a/utils/daRPC.go b/utils/daRPC.go new file mode 100644 index 0000000..cfbc425 --- /dev/null +++ b/utils/daRPC.go @@ -0,0 +1,15 @@ +package utils + +import ( + "fmt" + "path/filepath" +) + +func DaRPC() { + repoURL := "https://github.com/airchains-network/da-client" + destinationFolder := "da-rpc" + destinationPath := filepath.Join(".", destinationFolder) + if err := ChainRepoCloner(repoURL, destinationPath, "SVM"); err != nil { + fmt.Printf("Error: %v\n", err) + } +} diff --git a/utils/evm/ChainSequencerStart.go b/utils/evm/ChainSequencerStart.go new file mode 100644 index 0000000..e998e55 --- /dev/null +++ b/utils/evm/ChainSequencerStart.go @@ -0,0 +1 @@ +package evm diff --git a/utils/evm/evm.go b/utils/evm/evm.go new file mode 100644 index 0000000..3cc93cf --- /dev/null +++ b/utils/evm/evm.go @@ -0,0 +1,22 @@ +package evm + +import ( + "airchains/utils" + "fmt" +) + +func RunEVMChain() { + chainFolderName := "rollup-evm" + chainInit := "start-chain.sh" + + seqFolderName := "evm-sequencer-node" + seqInit := "scripts/test.sh" + + if err := utils.RunChainSeq(chainFolderName, chainInit); err != nil { + fmt.Printf("Error: %v\n", err) + } + + if err := utils.RunChainSeq(seqFolderName, seqInit); err != nil { + fmt.Printf("Error: %v\n", err) + } +} diff --git a/utils/evm/evmChain.go b/utils/evm/evmChain.go new file mode 100644 index 0000000..4266f68 --- /dev/null +++ b/utils/evm/evmChain.go @@ -0,0 +1,15 @@ +package evm + +import ( + "airchains/utils" + "fmt" + "path/filepath" +) + +func EVMChainClone() { + repoURL := "https://github.com/airchains-network/rollup-evm.git" + destinationPath := filepath.Join(".", "rollup-evm") + if err := utils.ChainRepoCloner(repoURL, destinationPath, "EVM"); err != nil { + fmt.Printf("Error: %v\n", err) + } +} diff --git a/utils/evm/evmMultiNode.go b/utils/evm/evmMultiNode.go new file mode 100644 index 0000000..13f23e0 --- /dev/null +++ b/utils/evm/evmMultiNode.go @@ -0,0 +1,40 @@ +package evm + +import ( + "fmt" + "os" + "os/exec" +) + +func runMultiNodeEVMShellScript(folderPath, scriptName string) error { + // Change to the specified folder + if err := os.Chdir(folderPath); err != nil { + return fmt.Errorf("failed to change directory: %v", err) + } + + // Run the shell script + cmd := exec.Command("sh", scriptName) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + + fmt.Printf("Running shell script %s in folder %s\n", scriptName, folderPath) + + if err := cmd.Run(); err != nil { + return fmt.Errorf("failed to run shell script: %v", err) + } + + fmt.Println("Shell script executed successfully") + + return nil +} + +func RunMultiNodeEVMChain() { + // Specify the folder path and script name + folderPath := "evm-chain" + scriptName := "multi-node.sh" + + // Call the function to run the shell script + if err := runMultiNodeEVMShellScript(folderPath, scriptName); err != nil { + fmt.Printf("Error: %v\n", err) + } +} diff --git a/utils/evm/evmSequencer.go b/utils/evm/evmSequencer.go new file mode 100644 index 0000000..82baef0 --- /dev/null +++ b/utils/evm/evmSequencer.go @@ -0,0 +1,15 @@ +package evm + +import ( + "airchains/utils" + "fmt" + "path/filepath" +) + +func EvmSequencerClone() { + repoURL := "https://github.com/airchains-network/evm-sequencer-node.git" + destinationPath := filepath.Join(".", "evm-sequencer-node") + if err := utils.ChainRepoCloner(repoURL, destinationPath, "EVM-Sequencer"); err != nil { + fmt.Printf("Error: %v\n", err) + } +} diff --git a/utils/gitCloner.go b/utils/gitCloner.go new file mode 100644 index 0000000..0dec012 --- /dev/null +++ b/utils/gitCloner.go @@ -0,0 +1,31 @@ +package utils + +import ( + "fmt" + "os" + "os/exec" +) + +func ChainRepoCloner(repoURL, destinationPath string, ChainType string) error { + fmt.Printf("Cloning %s Chain ⏱️\n", ChainType) + + if err := os.RemoveAll(destinationPath); err != nil { + return fmt.Errorf("error removing existing destination directory: %v", err) + } + + // Use "git clone" command to clone the GitHub repository + cmd := exec.Command("git", "clone", repoURL, destinationPath) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + + fmt.Printf("Cloning GitHub repository: %s to %s\n", repoURL, destinationPath) + + if err := cmd.Run(); err != nil { + return fmt.Errorf("failed to clone repository: %v", err) + } + + fmt.Println("Repository cloned successfully") + + return nil + +} diff --git a/utils/loader.go b/utils/loader.go new file mode 100644 index 0000000..77d0f64 --- /dev/null +++ b/utils/loader.go @@ -0,0 +1,14 @@ +package utils + +import ( + "time" + + "github.com/briandowns/spinner" +) + +func DelayLoader() { + s := spinner.New(spinner.CharSets[14], 100*time.Millisecond) // Build our new spinner + s.Start() // Start the spinner + time.Sleep(1 * time.Second) // Run for some time to simulate work + s.Stop() // Stop the spinner +} diff --git a/utils/runChainSeq.go b/utils/runChainSeq.go new file mode 100644 index 0000000..1ce1742 --- /dev/null +++ b/utils/runChainSeq.go @@ -0,0 +1,48 @@ +package utils + +import ( + "fmt" + "os" + "os/exec" + "path/filepath" +) + +func RunChainSeq(folderPath, scriptName string) error { + // Get the absolute path of the specified folder + absFolderPath, err := filepath.Abs(folderPath) + if err != nil { + return fmt.Errorf("failed to get absolute path: %v", err) + } + + // Check if the directory exists + if _, err := os.Stat(absFolderPath); os.IsNotExist(err) { + return fmt.Errorf("directory does not exist: %v", absFolderPath) + } + + // Change to the specified folder + if err := os.Chdir(absFolderPath); err != nil { + return fmt.Errorf("failed to change directory: %v", err) + } + + pm2Args := []string{"start", scriptName} + + // Run the shell script + cmd := exec.Command("pm2", pm2Args...) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + + fmt.Printf("Running shell script %s in folder %s\n", scriptName, absFolderPath) + + if err := cmd.Run(); err != nil { + return fmt.Errorf("failed to run shell script: %v", err) + } + + err = os.Chdir("../") + if err != nil { + return fmt.Errorf("failed to change directory: %v", err) + } + + fmt.Println("Shell script executed successfully") + + return nil +} diff --git a/utils/settlementRPC.go b/utils/settlementRPC.go new file mode 100644 index 0000000..054d436 --- /dev/null +++ b/utils/settlementRPC.go @@ -0,0 +1,15 @@ +package utils + +import ( + "fmt" + "path/filepath" +) + +func SettlementRPC() { + repoURL := "https://github.com/airchains-network/settlement_layer_calls_api" + destinationFolder := "dsettlement-rpc" + destinationPath := filepath.Join(".", destinationFolder) + if err := ChainRepoCloner(repoURL, destinationPath, "SVM"); err != nil { + fmt.Printf("Error: %v\n", err) + } +} diff --git a/utils/setupChain.go b/utils/setupChain.go new file mode 100644 index 0000000..ea5f7c7 --- /dev/null +++ b/utils/setupChain.go @@ -0,0 +1,33 @@ +package utils + +import ( + "fmt" + "os" + "os/exec" +) + +func ChainSetup(folderPath string) { + // Specify the folder path and script name + scriptName := "setup.sh" + if err := os.Chdir(folderPath); err != nil { + fmt.Printf("Error: %v\n", err) + } + + // Run the shell script + cmd := exec.Command("sh", scriptName) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + + fmt.Printf("Running shell script %s in folder %s\n", scriptName, folderPath) + + if err := cmd.Run(); err != nil { + fmt.Printf("Error: %v\n", err) + } + + err := os.Chdir("../") + if err != nil { + fmt.Printf("Error: %v\n", err) + } + + fmt.Println("Chain Built Successfully") +} diff --git a/utils/svm/svm.go b/utils/svm/svm.go new file mode 100644 index 0000000..e869612 --- /dev/null +++ b/utils/svm/svm.go @@ -0,0 +1,22 @@ +package svm + +import ( + "airchains/utils" + "fmt" +) + +func RunSVMChain() { + chainFolderName := "rollup-svm" + chainInit := "start-chain.sh" + + seqFolderName := "svm-sequencer-node" + seqInit := "scripts/test.sh" + + if err := utils.RunChainSeq(chainFolderName, chainInit); err != nil { + fmt.Printf("Error: %v\n", err) + } + + if err := utils.RunChainSeq(seqFolderName, seqInit); err != nil { + fmt.Printf("Error: %v\n", err) + } +} diff --git a/utils/svm/svmChain.go b/utils/svm/svmChain.go new file mode 100644 index 0000000..a7cac48 --- /dev/null +++ b/utils/svm/svmChain.go @@ -0,0 +1,17 @@ +package svm + +import ( + "airchains/utils" + "fmt" + "path/filepath" +) + +func SolanaChainClone() { + repoURL := "https://github.com/airchains-network/rollup-svm.git" + destinationFolder := "rollup-svm" + destinationPath := filepath.Join(".", destinationFolder) + if err := utils.ChainRepoCloner(repoURL, destinationPath, "SVM"); err != nil { + fmt.Printf("Error: %v\n", err) + } + utils.ChainSetup(destinationFolder) +} diff --git a/utils/svm/svmSequencer.go b/utils/svm/svmSequencer.go new file mode 100644 index 0000000..cbef135 --- /dev/null +++ b/utils/svm/svmSequencer.go @@ -0,0 +1,15 @@ +package svm + +import ( + "airchains/utils" + "fmt" + "path/filepath" +) + +func SolanaSequencerClone() { + repoURL := "https://github.com/airchains-network/svm-sequencer-node.git" + destinationPath := filepath.Join(".", "svm-sequencer-node") + if err := utils.ChainRepoCloner(repoURL, destinationPath, "SVM-Sequencer"); err != nil { + fmt.Printf("Error: %v\n", err) + } +}