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

Allow multiple outpoints for list subcommand and introduce longform flag for list #522

Closed
wants to merge 1 commit into from
Closed

Allow multiple outpoints for list subcommand and introduce longform flag for list #522

wants to merge 1 commit into from

Conversation

veryordinally
Copy link
Collaborator

@veryordinally veryordinally commented Sep 12, 2022

  • Allow multiple outpoints for list subcommand
  • Introduce longform flag for list subcommand, with following output format:
    For each output, we
    1. Print outpoint and oldest sat contained
    2. Followed by each ordinal range, indented by two spaces, and the size of the range

So an example output for running ord list -l 59b726ae47b86e7aa512a56590427bf512b4486449f71495611d1a80f935dd0f:0 a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0 (current leading submission to ordinals bounty 1 at http://ordinals.com/bounties and a random unspent recent coinbase output):

59b726ae47b86e7aa512a56590427bf512b4486449f71495611d1a80f935dd0f:0 2317234675546
  [2317234675546,2317234676101) <555>
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0 18102122814452
  [1912498125000000,1912498750000000) <625000000>
  [1620797051291245,1620797051325925) <34680>
  [1594563279555990,1594563279592863) <36873>
  [1011026980945471,1011026980965471) <20000>
  [1513920605064311,1513920605075633) <11322>
  [1673929501375221,1673929501384149) <8928>
  [1654916672313606,1654916672317064) <3458>
  ...
  [1129605685531348,1129605685531459) <111>
  [1894361844736252,1894361844736393) <141>
  [1534978183583197,1534978183583496) <299>
  [964653666886123,964653666886362) <239>

Will probably iterate on this format, but this is easily human readable and allows finding the oldest ordinal given a list of outputs in my-outputs.txt with one simple command line:

xargs ord list -l < my-outputs.txt | grep -v '^  ' | sort -n +1 | head -1

If you have an Electrum wallet, you can easily get a list of all the outputs you control by running

for o in map(lambda x:x.get('prevout_hash')+':'+str(x.get('prevout_n')), listunspent()):
  print(o)

- Introduce `longform` flag for `list` subcommand, with following output format:
  For each output, we
    1. Print outpoint and oldest sat contained
    2. Followed by each ordinal range, indented by two spaces, and the size of the range
@casey
Copy link
Collaborator

casey commented Sep 21, 2022

I think maybe the long form output is kind of a messy compromise between something that's human readable, and something that's machine readable. I think we should consider either having a simpler output that's very amenable to unit tools like cut/grep/etc, or JSON, which can be manipulated with jq.

For the former, maybe just tab-separated columns would be the way to go:

59b726ae47b86e7aa512a56590427bf512b4486449f71495611d1a80f935dd0f:0	2317234675546	555
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0	1912498125000000	625000000
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0	1620797051291245	34680
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0	1594563279555990	36873
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0	1011026980945471	20000
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0	1513920605064311	11322
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0	1673929501375221	8928
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0	1654916672313606	3458
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0	1129605685531348	111
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0	1894361844736252	141
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0	1534978183583197	299
a7bbee795740d9d5218e82891eca7cf90fd4a394e5aebf29fe8bb68f30086ece:0	964653666886123		239

That would be super easy to deal with with cut and friends.

This could be list --table, or even a separate table subcommand.

@casey
Copy link
Collaborator

casey commented Oct 3, 2022

This is pretty out of date, so closing. But feel free to reopen! We added ord wallet list and ord list should probably use the same output style, which is very machine-readable friendly.

@casey casey closed this Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants