parent
8f30934220
commit
6e68fb425a
@ -63,7 +63,7 @@ module ContractAlias = struct
|
|||||||
let alias_param ?(name = "name") ?(desc = "existing contract alias") next =
|
let alias_param ?(name = "name") ?(desc = "existing contract alias") next =
|
||||||
let desc =
|
let desc =
|
||||||
desc ^ "\n"
|
desc ^ "\n"
|
||||||
^ "can be an contract alias or a key alias (autodetected in this order)\n\
|
^ "can be a contract alias or a key alias (autodetected in this order)\n\
|
||||||
use 'key:name' to force the later" in
|
use 'key:name' to force the later" in
|
||||||
Cli_entries.(
|
Cli_entries.(
|
||||||
param ~name ~desc
|
param ~name ~desc
|
||||||
@ -97,7 +97,8 @@ module ContractAlias = struct
|
|||||||
| Error k_errs ->
|
| Error k_errs ->
|
||||||
ContractEntity.of_source cctxt s >>= function
|
ContractEntity.of_source cctxt s >>= function
|
||||||
| Ok v -> return (s, v)
|
| Ok v -> return (s, v)
|
||||||
| Error c_errs -> Lwt.return (Error (k_errs @ c_errs))
|
| Error c_errs ->
|
||||||
|
Lwt.return (Error (k_errs @ c_errs))
|
||||||
end)))
|
end)))
|
||||||
next
|
next
|
||||||
|
|
||||||
|
@ -214,14 +214,16 @@ module MakeEncodings(E: sig
|
|||||||
l p enc.encoded_length
|
l p enc.encoded_length
|
||||||
|
|
||||||
let decode ?alphabet s =
|
let decode ?alphabet s =
|
||||||
let rec find s = function
|
try
|
||||||
| [] -> None
|
let rec find s = function
|
||||||
| Encoding { prefix ; of_raw ; wrap } :: encodings ->
|
| [] -> None
|
||||||
match remove_prefix ~prefix s with
|
| Encoding { prefix ; of_raw ; wrap } :: encodings ->
|
||||||
| None -> find s encodings
|
match remove_prefix ~prefix s with
|
||||||
| Some msg -> of_raw msg |> Utils.map_option ~f:wrap in
|
| None -> find s encodings
|
||||||
let s = safe_decode ?alphabet s in
|
| Some msg -> of_raw msg |> Utils.map_option ~f:wrap in
|
||||||
find s !encodings
|
let s = safe_decode ?alphabet s in
|
||||||
|
find s !encodings
|
||||||
|
with Invalid_argument _ -> None
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user