Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a more elaborate help message on `tx create` #6

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@stevenroose
Copy link
Owner

stevenroose commented Mar 13, 2019

Addresses #5.

@sgeisler
Copy link

sgeisler left a comment

That would solve the problem. But maybe you should define a structure with the example data and serialize it to automatically stay in sync with changes to the data structures? Otherwise the documentation might diverge.

@stevenroose

This comment has been minimized.

Copy link
Owner Author

stevenroose commented Mar 13, 2019

@sgeisler
Copy link

sgeisler left a comment

I don't think you can put owned strings into there though.

You are right, clap's API is a PITA. [1 rant moved to end of text]

Having spent some hours trying to solve this problem I'd say this PR is good enough in principle. I actually tried out the example and it complained about some trailing commas but works if one removes them. After that is fixed I'd ACK.

The following version works for me:

{
  "version": 1,
  "locktime": 0,
  "inputs": [
    {
      "prevout": "78a0f5b35b73f1f6e054274aa3904867774600f09bd194e97e7a0fd953b27c54:6",
      "script_sig": {
        "hex": 
"483045022100fad8d9b44d1d3a86bd9719ef642b32ed0a1c8f4e3de4e2009936988f73f12ad702207a2204cbdfd166d099cbb08e6c7886db5b986ef4fdfee383c1b8fc4df82ecea80121030a696d89d161c086586cf0de7d98fb97181a1ee0265130f7ddbecd17d616c780"
      },
      "sequence": 4294967295
    },
    {
      "txid": "c182fa9182957c5b906fd2b339d7a01dd110340bced99e049e2bd2c135f4513a",
      "vout": 1,
      "script_sig": {
        "hex": "220020fa28dc1e5eb222055e90f8cade9bcd13ca9ddab7a5ed029e27d41a736f7455ce"
      },
      "sequence": 4294967294,
      "witness": [
        "",
        "30440220725e1c098d85013166fae52794811f6531ff3962ea6bc3228ecfdd4699ae669b022064d5c88f2b838968a345681bbfeb2c09f0433ece511bc4d139c4805adf59d74601",
        "3044022055aa0f675bf0c21e113527f838b93d5922143ae6e52b094416d44551ff6d236202205ef3773cc9a7fe2076310c92adc73670747309265ecedb0cffe194885a89863601",
        
"5221027111c0d6cbc3a40c6e6197ed234bd6e59f277c88094fd33297b1e0a3787a5b7d2102e71711c9840d68e6401d4bd5df78f1850e25ae41f082f4b38ceec37d60cab5442103eeae18900c0d12046f644b960a1ef84589f7f4f71d07914006d550bf85c576e153ae"
      ]
    }
  ],
  "outputs": [
    {
      "value": 500000,
      "script_pub_key": {
        "hex": "a91405394a3a5dedce4f945ed9f650fa9ff23f011d4687"
      }
    },
    {
      "value": 2590000,
      "script_pub_key": {
        "address": "34nFYcfPNTuWCV76YrwdVc4MyXmeVMMpsZ"
      }
    }
  ]
}

[1] Why did they choose S: Into<&'a str>? That makes no sense, that means since Into defines fn into(self) -> &T that S can never own the underlying string object, it always has to already have a reference with lifetime 'a. They really should have chosen S: AsRef<str> or built it around Cow.

@stevenroose

This comment has been minimized.

Copy link
Owner Author

stevenroose commented Mar 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.