fc53f3b233
Base48 was fun but... hell yeah... let's stay standard. Public encoding of hash: ``` Block: "B..." (len: 51) Operation: "o..." (len: 51) Protocol: "P..." (len: 51) Ed25519: "tz1.." (len: 36) Contract: "TZ1.." (len: 36) NetworkdId: "id.." (len: 30) ``` Other internal prefixes (in the RPC): ``` Hash of Michelson's expression: "expr..." (len: 54) Ed25519 public key: "edpk..." (len: 54) Ed25519 secret key: "edsk..." (len: 98) Ed25519 signature: "edsig.." (len: 99) Hash of a random seed nonce: "nce...." (len: 53) Random seed: "rng...." (len: 53) ```
39 lines
1.5 KiB
OCaml
39 lines
1.5 KiB
OCaml
(**************************************************************************)
|
|
(* *)
|
|
(* Copyright (c) 2014 - 2016. *)
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
(* *)
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
(* *)
|
|
(**************************************************************************)
|
|
|
|
open Client_config
|
|
|
|
let unique = ref false
|
|
let unique_arg =
|
|
"-unique",
|
|
Arg.Set unique,
|
|
"Fail when there is more than one possible completion."
|
|
|
|
let commands () = Cli_entries.[
|
|
command
|
|
~desc: "Lookup for the possible completion of a \
|
|
given prefix of Base58Check-encoded hash. This actually \
|
|
works only for blocks, operations, public key and contract \
|
|
identifiers."
|
|
~args: [unique_arg]
|
|
(prefixes [ "complete" ] @@
|
|
string
|
|
~name: "prefix"
|
|
~desc: "the prefix of the Base58Check-encoded hash to be completed" @@
|
|
stop)
|
|
(fun prefix cctxt ->
|
|
Client_node_rpcs.complete cctxt ~block:(block ()) prefix >>= fun completions ->
|
|
match completions with
|
|
| [] -> Pervasives.exit 3
|
|
| _ :: _ :: _ when !unique -> Pervasives.exit 3
|
|
| completions ->
|
|
List.iter print_endline completions ;
|
|
Lwt.return_unit)
|
|
]
|