()
| 31 | ) |
| 32 | |
| 33 | func buildRootCmd() *cobra.Command { |
| 34 | // see cmd/sifnoded/cmd/root.go:37 ; we need to do the |
| 35 | // same thing in ebrelayer |
| 36 | encodingConfig := sifapp.MakeTestEncodingConfig() |
| 37 | initClientCtx := client.Context{}. |
| 38 | WithCodec(encodingConfig.Marshaler). |
| 39 | WithInterfaceRegistry(encodingConfig.InterfaceRegistry). |
| 40 | WithTxConfig(encodingConfig.TxConfig). |
| 41 | WithLegacyAmino(encodingConfig.Amino). |
| 42 | WithInput(os.Stdin). |
| 43 | WithAccountRetriever(types.AccountRetriever{}). |
| 44 | WithBroadcastMode(flags.BroadcastBlock). |
| 45 | WithHomeDir(sifapp.DefaultNodeHome) |
| 46 | |
| 47 | rootCmd := &cobra.Command{ |
| 48 | Use: "ebrelayer", |
| 49 | Short: "Streams live events from Ethereum and Cosmos and relays event information to the opposite chain", |
| 50 | PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { |
| 51 | if err := cmd.Flags().Set(flags.FlagSkipConfirmation, "true"); err != nil { |
| 52 | return err |
| 53 | } |
| 54 | if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { |
| 55 | return err |
| 56 | } |
| 57 | return server.InterceptConfigsPreRunHandler(cmd, "", nil) |
| 58 | }, |
| 59 | } |
| 60 | |
| 61 | log.SetFlags(log.Lshortfile) |
| 62 | |
| 63 | sifapp.SetConfig(true) |
| 64 | |
| 65 | // Add --chain-id to persistent flags and mark it required |
| 66 | rootCmd.PersistentFlags().String(flags.FlagChainID, "", "Chain ID of tendermint node") |
| 67 | rootCmd.PersistentFlags().String(flags.FlagGas, "gas", fmt.Sprintf( |
| 68 | "gas limit to set per-transaction; set to %q to calculate required gas automatically (default %d)", |
| 69 | flags.GasFlagAuto, flags.DefaultGasLimit, |
| 70 | )) |
| 71 | rootCmd.PersistentFlags().String(flags.FlagGasPrices, "", "Gas prices to determine the transaction fee (e.g. 10uatom)") |
| 72 | rootCmd.PersistentFlags().Float64(flags.FlagGasAdjustment, flags.DefaultGasAdjustment, "gas adjustment") |
| 73 | rootCmd.PersistentFlags().String( |
| 74 | ebrelayertypes.FlagSymbolTranslatorFile, |
| 75 | "", |
| 76 | "Path to a json file containing an array of sifchain denom => Ethereum symbol pairs", |
| 77 | ) |
| 78 | rootCmd.PersistentFlags().String( |
| 79 | ebrelayertypes.FlagRelayerDbPath, |
| 80 | "./relayerdb", |
| 81 | "Path to the relayerdb directory", |
| 82 | ) |
| 83 | // Construct Root Command |
| 84 | rootCmd.AddCommand( |
| 85 | rpc.StatusCommand(), |
| 86 | initRelayerCmd(), |
| 87 | generateBindingsCmd(), |
| 88 | replayEthereumCmd(), |
| 89 | replayCosmosCmd(), |
| 90 | listMissedCosmosEventCmd(), |
no test coverage detected