MCPcopy Create free account
hub / github.com/DNAProject/DNA / showTx

Function showTx

cmd/info_cmd.go:171–194  ·  view source on GitHub ↗
(ctx *cli.Context)

Source from the content-addressed store, hash-verified

169}
170
171func showTx(ctx *cli.Context) error {
172 SetRpcPort(ctx)
173 if ctx.NArg() < 1 {
174 PrintErrorMsg("Missing raw tx argument.")
175 cli.ShowSubcommandHelp(ctx)
176 return nil
177 }
178 rawTx := ctx.Args().First()
179 txData, err := hex.DecodeString(rawTx)
180 if err != nil {
181 return fmt.Errorf("RawTx hex decode error:%s", err)
182 }
183 tx, err := types.TransactionFromRawBytes(txData)
184 if err != nil {
185 return fmt.Errorf("TransactionFromRawBytes error:%s", err)
186 }
187 txInfo := httpcom.TransArryByteToHexString(tx)
188
189 txHash := tx.Hash()
190 height, _ := utils.GetTxHeight(txHash.ToHexString())
191 txInfo.Height = height
192 PrintJsonObject(txInfo)
193 return nil
194}

Callers

nothing calls this directly

Calls 9

TransactionFromRawBytesFunction · 0.92
GetTxHeightFunction · 0.92
SetRpcPortFunction · 0.85
PrintErrorMsgFunction · 0.85
PrintJsonObjectFunction · 0.85
ErrorfMethod · 0.80
FirstMethod · 0.65
HashMethod · 0.65
ToHexStringMethod · 0.45

Tested by

no test coverage detected