Only output valid JSON upon transaction submit result
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- haskell
- Domain
- blockchain, cli
Research direction
Start at the cardano-cli conway transaction submit entry point and compare the successful and failed output examples in this issue. Define the JSON output for both outcomes, including the transaction hash on success and error information on failure, and verify that each result is valid JSON suitable for jq.
Written by the indexing model from the issue text.
Description
When one successfully submits a transaction:
% cardano-cli conway transaction submit --tx-file build/mint-scopes.tx.signed.json --testnet-magic 1
the output is:
Transaction successfully submitted. Transaction hash is:
{"txhash":"bdaa860ac0422ad83e67f8957ab230a7f4586d3050a7ab987ed5e40aa79a3fe6"}
which cannot be directly piped into eg. a jq script as it's not valid JSON. It seems to me a single JSON object would be much more useful as part of scriptable process, something like:
{ "result": "success", "success": true, "txhash":"bdaa860ac0422ad83e67f8957ab230a7f4586d3050a7ab987ed5e40aa79a3fe6"}
result: a descriptive string or object in case of failuressuccess: a boolean telling whether or not the tx was accepted by the nodetxhash: the transaction hash ifsuccess: true
Upon failure, instead of
% cardano-cli conway transaction submit --tx-file build/mint-scopes.tx.signed.json --testnet-magic 1
Command failed: transaction submit
Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraConway (ApplyTxError (ConwayUtxowFailure (UtxoFailure (UtxosFailure (CollectErrors [BadTranslation (BabbageContextError (AlonzoContextError (TranslationLogicMissingInput (TxIn (TxId {unTxId = SafeHash "2178565983a3125c608f7dea381d5b70d064be6b21879de86d4765e8ad3361f1"}) (TxIx {unTxIx = 0})))))]))) :| [ConwayUtxowFailure (UtxoFailure (ValueNotConservedUTxO (Mismatch {mismatchSupplied = MaryValue (Coin 0) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash "dd15ae2bafb5528ab7146630a40095468363b903b3cbd8c967eddcec"},fromList [("616d6172752073636f706573",1)])])), mismatchExpected = MaryValue (Coin 8730146) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash "dd15ae2bafb5528ab7146630a40095468363b903b3cbd8c967eddcec"},fromList [("616d6172752073636f706573",1)])]))}))),ConwayUtxowFailure (UtxoFailure (BadInputsUTxO (fromList [TxIn (TxId {unTxId = SafeHash "2178565983a3125c608f7dea381d5b70d064be6b21879de86d4765e8ad3361f1"}) (TxIx {unTxIx = 0})]))),ConwayUtxowFailure (UtxoFailure NoCollateralInputs),ConwayUtxowFailure (UtxoFailure (IncorrectTotalCollateralField (DeltaCoin (-8270846)) (Coin 459300))),ConwayUtxowFailure (UtxoFailure (InsufficientCollateral (DeltaCoin (-8270846)) (Coin 459300)))]))
one would have
% cardano-cli conway transaction submit --tx-file build/mint-scopes.tx.signed.json --testnet-magic 1
{"success":false, "result": "Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraConway (ApplyTxError (ConwayUtxowFailure (UtxoFailure (UtxosFailure (CollectErrors [BadTranslation (BabbageContextError (AlonzoContextError (TranslationLogicMissingInput (TxIn (TxId {unTxId = SafeHash \"2178565983a3125c608f7dea381d5b70d064be6b21879de86d4765e8ad3361f1\"}) (TxIx {unTxIx = 0})))))]))) :| [ConwayUtxowFailure (UtxoFailure (ValueNotConservedUTxO (Mismatch {mismatchSupplied = MaryValue (Coin 0) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash \"dd15ae2bafb5528ab7146630a40095468363b903b3cbd8c967eddcec\"},fromList [(\"616d6172752073636f706573\",1)])])), mismatchExpected = MaryValue (Coin 8730146) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash \"dd15ae2bafb5528ab7146630a40095468363b903b3cbd8c967eddcec\"},fromList [(\"616d6172752073636f706573\",1)])]))}))),ConwayUtxowFailure (UtxoFailure (BadInputsUTxO (fromList [TxIn (TxId {unTxId = SafeHash \"2178565983a3125c608f7dea381d5b70d064be6b21879de86d4765e8ad3361f1\"}) (TxIx {unTxIx = 0})]))),ConwayUtxowFailure (UtxoFailure NoCollateralInputs),ConwayUtxowFailure (UtxoFailure (IncorrectTotalCollateralField (DeltaCoin (-8270846)) (Coin 459300))),ConwayUtxowFailure (UtxoFailure (InsufficientCollateral (DeltaCoin (-8270846)) (Coin 459300)))]))"}
or even better: A JSON representation of the error .
- Dominant language
- Haskell
- Stars
- 71
- Forks
- 24
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 9
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from IntersectMBO/cardano-cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
IntersectMBO/cardano-cli#1306 · 2 comments ·
Maintainers usually reply within 1 day
-
Ensure Plutus V4 scripts can be deserialised by cardano-cliPossibly taken @carbolymer claimed this 6 days ago. Open
IntersectMBO/cardano-cli#1448 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Upstream non-Leios commits from the Leios integration branch to masterMay be free again @palas claimed this 48 days ago, and no pull request is open. Openrefactor
IntersectMBO/cardano-cli#1414 · 1 assignee ·
Maintainers usually reply within 1 day
-
Add `transaction validate` command (online phase 1 + phase 2)May be free again @palas claimed this 134 days ago, and no pull request is open. Openenhancement epic
IntersectMBO/cardano-cli#1380 · 4 comments · 1 reaction · 1 assignee ·
Maintainers usually reply within 1 day
-
Investigate incorporating cquisitor-style local tx validation (phase 1 + phase 2) into cardano-cliMay be free again @palas claimed this 155 days ago, and no pull request is open. OpenStale
IntersectMBO/cardano-cli#1367 · 6 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in IntersectMBO/cardano-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/phino#1600 ·
Maintainers usually reply within 1 day