From 57b3d6ff490bc23e0c0f90852a65f51fbe39c33b Mon Sep 17 00:00:00 2001 From: Viacheslav Gonkivskyi Date: Mon, 18 Sep 2023 16:32:27 +0300 Subject: [PATCH] move cmds to nodebuilder --- .../internal/rpc => nodebuilder/blob/cmds}/blob.go | 5 ++++- {cmd/celestia/internal/rpc => nodebuilder/das/cmds}/das.go | 0 .../internal/rpc => nodebuilder/header/cmds}/header.go | 0 .../internal/admin => nodebuilder/node/cmds}/admin.go | 0 {cmd/celestia/internal/rpc => nodebuilder/p2p/cmds}/p2p.go | 0 .../internal/rpc => nodebuilder/share/cmds}/share.go | 0 .../internal/rpc => nodebuilder/state/cmds}/state.go | 7 +++++-- 7 files changed, 9 insertions(+), 3 deletions(-) rename {cmd/celestia/internal/rpc => nodebuilder/blob/cmds}/blob.go (97%) rename {cmd/celestia/internal/rpc => nodebuilder/das/cmds}/das.go (100%) rename {cmd/celestia/internal/rpc => nodebuilder/header/cmds}/header.go (100%) rename {cmd/celestia/internal/admin => nodebuilder/node/cmds}/admin.go (100%) rename {cmd/celestia/internal/rpc => nodebuilder/p2p/cmds}/p2p.go (100%) rename {cmd/celestia/internal/rpc => nodebuilder/share/cmds}/share.go (100%) rename {cmd/celestia/internal/rpc => nodebuilder/state/cmds}/state.go (99%) diff --git a/cmd/celestia/internal/rpc/blob.go b/nodebuilder/blob/cmds/blob.go similarity index 97% rename from cmd/celestia/internal/rpc/blob.go rename to nodebuilder/blob/cmds/blob.go index 236cc75b67..2c98113150 100644 --- a/cmd/celestia/internal/rpc/blob.go +++ b/nodebuilder/blob/cmds/blob.go @@ -2,6 +2,7 @@ package rpc import ( "encoding/base64" + "encoding/hex" "fmt" "reflect" "strconv" @@ -112,7 +113,9 @@ var getAllCmd = &cobra.Command{ } blobs, err := internal.RPCClient.Blob.GetAll(cmd.Context(), height, []share.Namespace{namespace}) - + fmt.Println(hex.EncodeToString(blobs[0].Namespace().ID())) + fmt.Println(blobs[0].Namespace().ID()) + fmt.Println(blobs[0].Namespace()) formatter := formatData if base64Flag || err != nil { formatter = nil diff --git a/cmd/celestia/internal/rpc/das.go b/nodebuilder/das/cmds/das.go similarity index 100% rename from cmd/celestia/internal/rpc/das.go rename to nodebuilder/das/cmds/das.go diff --git a/cmd/celestia/internal/rpc/header.go b/nodebuilder/header/cmds/header.go similarity index 100% rename from cmd/celestia/internal/rpc/header.go rename to nodebuilder/header/cmds/header.go diff --git a/cmd/celestia/internal/admin/admin.go b/nodebuilder/node/cmds/admin.go similarity index 100% rename from cmd/celestia/internal/admin/admin.go rename to nodebuilder/node/cmds/admin.go diff --git a/cmd/celestia/internal/rpc/p2p.go b/nodebuilder/p2p/cmds/p2p.go similarity index 100% rename from cmd/celestia/internal/rpc/p2p.go rename to nodebuilder/p2p/cmds/p2p.go diff --git a/cmd/celestia/internal/rpc/share.go b/nodebuilder/share/cmds/share.go similarity index 100% rename from cmd/celestia/internal/rpc/share.go rename to nodebuilder/share/cmds/share.go diff --git a/cmd/celestia/internal/rpc/state.go b/nodebuilder/state/cmds/state.go similarity index 99% rename from cmd/celestia/internal/rpc/state.go rename to nodebuilder/state/cmds/state.go index 24ed96a24c..eff2f487c3 100644 --- a/cmd/celestia/internal/rpc/state.go +++ b/nodebuilder/state/cmds/state.go @@ -1,6 +1,7 @@ package rpc import ( + "encoding/hex" "fmt" "strconv" @@ -121,13 +122,15 @@ var submitTxCmd = &cobra.Command{ Short: "Submits the given transaction/message to the Celestia network and blocks until the tx is included in a block.", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - rawTx, err := internal.DecodeToBytes(args[0]) + decoded, err := hex.DecodeString(args[0]) if err != nil { return fmt.Errorf("failed to decode tx: %v", err) } + + fmt.Println(args[0]) txResponse, err := internal.RPCClient.State.SubmitTx( cmd.Context(), - rawTx, + decoded, ) return internal.PrintOutput(txResponse, err, nil) },