zingolib icon indicating copy to clipboard operation
zingolib copied to clipboard

Add option to get structured or JSON responses from non-interactive mode

Open pacu opened this issue 1 year ago • 0 comments

When running zingo-cli in non-interactive mode it responds human readable messages. It would be good to have an output formatter that can let developers create and then choose different formats of this output.

example:

Currently when restoring a wallet with a wrong seed

zingo-cli --nosync seed --seed "still chimichurri [redacted]" --birthday 663150 --data-dir /var/folders/zd/zss_3kv112337jq_8hm28j540000gn/T/:1677416452427_walletdir --server localhost:9067

response

Seed: still chimichurri [redacted]
hrp_view: zxviews
Error during startup:Error parsing phrase: mnemonic contains an unknown word: chimichurri
If you repeatedly run into this issue, you might have to restore your wallet from your seed phrase.

Possible JSON response


{
    status: "Error",
    command: {
        // original command
    },
    response: { //this would be a dictionary with the response
        seed: "still chimichurri [redacted]",
        hrp_view: "zxviews",
        error_message: "Error during startup:Error parsing phrase: mnemonic contains an unknown word: chimichurri",
        recovery_tip: "If you repeatedly run into this issue, you might have to restore your wallet from your seed phrase."
    }
}

pacu avatar Feb 26 '23 13:02 pacu