mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
* refactor: move database, navigator scripts to state package * feat: add Schema config for dwn * test: add unit tests for InitializeDatabase * feat: use templated index.html for the DWN frontend * feat: introduce templ generation for templ * chore(deps): update devbox.json to use latest packages * chore: update devbox to use bun * feat: introduce dwn config generation * feat: add motr.mjs for vault management * refactor: move front end from to (alert) * feat: implement devbox integration and devbox-based process management * feat: embed motr.mjs script for offline demo * refactor: embed motr.mjs data in embed.go * chore: update workflows to use actions/checkout@v4 * refactor: move process-compose.yaml to deploy directory * refactor: remove unnecessary JSON conversion
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
|
"github.com/onsonr/sonr/internal/cli/dexmodel"
|
|
"github.com/onsonr/sonr/internal/cli/txmodel"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func AddTUICmds(rootCmd *cobra.Command) {
|
|
rootCmd.AddCommand(newBuildTxnTUICmd())
|
|
rootCmd.AddCommand(newExplorerTUICmd())
|
|
}
|
|
|
|
func newBuildTxnTUICmd() *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "dash",
|
|
Short: "TUI for managing the local Sonr validator node",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
txBody, err := txmodel.RunBuildTxnTUI()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
interfaceRegistry := codectypes.NewInterfaceRegistry()
|
|
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
|
jsonBytes, err := marshaler.MarshalJSON(txBody)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to marshal tx body: %w", err)
|
|
}
|
|
|
|
fmt.Println("Generated Protobuf Message (JSON format):")
|
|
fmt.Println(string(jsonBytes))
|
|
|
|
return nil
|
|
},
|
|
}
|
|
}
|
|
|
|
func newExplorerTUICmd() *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "cosmos-explorer",
|
|
Short: "A terminal-based Cosmos blockchain explorer",
|
|
RunE: dexmodel.RunExplorerTUI,
|
|
}
|
|
}
|