From cdf1a8e9582aded272ca9b7f89e302b12ddd359a Mon Sep 17 00:00:00 2001 From: Viacheslav Gonkivskyi Date: Thu, 3 Aug 2023 13:57:21 +0300 Subject: [PATCH] fixes --- cmd/celestia/blob.go | 21 ++++++++++++++++----- cmd/celestia/rpc.go | 1 - 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/cmd/celestia/blob.go b/cmd/celestia/blob.go index ad95ef773c..1f90f84346 100644 --- a/cmd/celestia/blob.go +++ b/cmd/celestia/blob.go @@ -17,6 +17,10 @@ type response struct { Result interface{} `json:"result"` } +func init() { + blobCmd.AddCommand(getCmd, getAllCmd, submitCmd, getProofCmd) +} + var blobCmd = &cobra.Command{ Use: "blob [command]", Short: "Allows to interact with the Blob Service via JSON-RPC", @@ -24,7 +28,7 @@ var blobCmd = &cobra.Command{ } var getCmd = &cobra.Command{ - Use: "get [params]", + Use: "get [height, namespace, commitment]", Args: cobra.ExactArgs(3), Short: "Returns the blob for the given namespace by commitment at a particular height.", RunE: func(cmd *cobra.Command, args []string) error { @@ -68,7 +72,7 @@ var getCmd = &cobra.Command{ } var getAllCmd = &cobra.Command{ - Use: "getAll [params]", + Use: "get-all [height, namespace]", Args: cobra.ExactArgs(2), Short: "Returns all blobs for the given namespace at a particular height.", RunE: func(cmd *cobra.Command, args []string) error { @@ -107,7 +111,7 @@ var getAllCmd = &cobra.Command{ } var submitCmd = &cobra.Command{ - Use: "submit [params]", + Use: "submit [namespace, blobData]", Args: cobra.ExactArgs(2), Short: "Submit the blob at the given namespace. Note: only one blob is allowed to submit through the RPC.", RunE: func(cmd *cobra.Command, args []string) error { @@ -134,7 +138,14 @@ var submitCmd = &cobra.Command{ return err } } else { - output, err = prepareOutput(height) + response := struct { + Height uint64 `json:"uint64"` + Commitment blob.Commitment `json:"commitment"` + }{ + Height: height, + Commitment: parsedBlob.Commitment, + } + output, err = prepareOutput(response) if err != nil { return err } @@ -146,7 +157,7 @@ var submitCmd = &cobra.Command{ } var getProofCmd = &cobra.Command{ - Use: "getProof [params]", + Use: "get-proof [height, namespace, commitment]", Args: cobra.ExactArgs(3), Short: "Retrieves the blob in the given namespaces at the given height by commitment and returns its Proof.", RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/celestia/rpc.go b/cmd/celestia/rpc.go index a1bdf9efaa..d493bbf5e4 100644 --- a/cmd/celestia/rpc.go +++ b/cmd/celestia/rpc.go @@ -64,7 +64,6 @@ func init() { false, "Print JSON-RPC request along with the response", ) - blobCmd.AddCommand(getCmd, getAllCmd, submitCmd, getProofCmd) rpcCmd.AddCommand(blobCmd) rootCmd.AddCommand(rpcCmd) }