Client: use source_param instead of alias_param

This commit is contained in:
Milo Davis 2018-04-12 15:17:57 -04:00 committed by Benjamin Canou
parent 3765c39477
commit 19843b96b0
5 changed files with 17 additions and 17 deletions

View File

@ -21,7 +21,7 @@ let commands () =
(args5 max_priority_arg endorsement_delay_arg (args5 max_priority_arg endorsement_delay_arg
Daemon.baking_switch Daemon.endorsement_switch Daemon.denunciation_switch) Daemon.baking_switch Daemon.endorsement_switch Daemon.denunciation_switch)
(prefixes [ "launch" ; "daemon" ] (prefixes [ "launch" ; "daemon" ]
@@ seq_of_param Client_keys.Public_key_hash.alias_param) @@ seq_of_param Client_keys.Public_key_hash.source_param)
(fun (max_priority, endorsement_delay, baking, endorsement, denunciation) delegates cctxt -> (fun (max_priority, endorsement_delay, baking, endorsement, denunciation) delegates cctxt ->
let (endorsement, baking, denunciation) = let (endorsement, baking, denunciation) =
if (not endorsement) && (not baking) && (not denunciation) if (not endorsement) && (not baking) && (not denunciation)
@ -31,18 +31,18 @@ let commands () =
command ~group ~desc: "Forge and inject an endorsement operation." command ~group ~desc: "Forge and inject an endorsement operation."
(args1 max_priority_arg) (args1 max_priority_arg)
(prefixes [ "endorse"; "for" ] (prefixes [ "endorse"; "for" ]
@@ Client_keys.Public_key_hash.alias_param @@ Client_keys.Public_key_hash.source_param
~name:"baker" ~desc: "name of the delegate owning the endorsement right" ~name:"baker" ~desc: "name of the delegate owning the endorsement right"
@@ stop) @@ stop)
(fun max_priority (_, delegate) cctxt -> (fun max_priority delegate cctxt ->
endorse_block cctxt ?max_priority delegate) ; endorse_block cctxt ?max_priority delegate) ;
command ~group ~desc: "Forge and inject block using the delegate rights." command ~group ~desc: "Forge and inject block using the delegate rights."
(args3 max_priority_arg force_switch free_baking_switch) (args3 max_priority_arg force_switch free_baking_switch)
(prefixes [ "bake"; "for" ] (prefixes [ "bake"; "for" ]
@@ Client_keys.Public_key_hash.alias_param @@ Client_keys.Public_key_hash.source_param
~name:"baker" ~desc: "name of the delegate owning the baking right" ~name:"baker" ~desc: "name of the delegate owning the baking right"
@@ stop) @@ stop)
(fun (max_priority, force, free_baking) (_, delegate) cctxt -> (fun (max_priority, force, free_baking) delegate cctxt ->
bake_block cctxt cctxt#block bake_block cctxt cctxt#block
~force ?max_priority ~free_baking delegate) ; ~force ?max_priority ~free_baking delegate) ;
command ~group ~desc: "Forge and inject a seed-nonce revelation operation." command ~group ~desc: "Forge and inject a seed-nonce revelation operation."

View File

@ -105,4 +105,4 @@ let run_daemon cctxt ?max_priority ~endorsement_delay delegates ~endorsement ~ba
~delay:endorsement_delay ~delay:endorsement_delay
~min_date:((Time.add (Time.now ()) (Int64.neg 1800L))) ~min_date:((Time.add (Time.now ()) (Int64.neg 1800L)))
~endorsement ~baking ~denunciation ~endorsement ~baking ~denunciation
(List.map snd delegates) delegates

View File

@ -51,7 +51,7 @@ val run_daemon:
#Proto_alpha.full -> #Proto_alpha.full ->
?max_priority:int -> ?max_priority:int ->
endorsement_delay:int -> endorsement_delay:int ->
('a * public_key_hash) list -> public_key_hash list ->
endorsement:bool -> endorsement:bool ->
baking:bool -> baking:bool ->
denunciation:bool -> denunciation:bool ->

View File

@ -187,17 +187,17 @@ let commands () =
@@ RawContractAlias.fresh_alias_param @@ RawContractAlias.fresh_alias_param
~name: "new" ~desc: "name of the new contract" ~name: "new" ~desc: "name of the new contract"
@@ prefix "for" @@ prefix "for"
@@ Public_key_hash.alias_param @@ Public_key_hash.source_param
~name: "mgr" ~desc: "manager of the new contract" ~name: "mgr" ~desc: "manager of the new contract"
@@ prefix "transferring" @@ prefix "transferring"
@@ tez_param @@ tez_param
~name: "qty" ~desc: "amount taken from source" ~name: "qty" ~desc: "amount taken from source"
@@ prefix "from" @@ prefix "from"
@@ ContractAlias.alias_param @@ ContractAlias.destination_param
~name:"src" ~desc: "name of the source contract" ~name:"src" ~desc: "name of the source contract"
@@ stop) @@ stop)
begin fun (fee, delegate, delegatable, force) begin fun (fee, delegate, delegatable, force)
new_contract (_, manager_pkh) balance (_, source) (cctxt : Proto_alpha.full) -> new_contract manager_pkh balance (_, source) (cctxt : Proto_alpha.full) ->
RawContractAlias.of_fresh cctxt force new_contract >>=? fun alias_name -> RawContractAlias.of_fresh cctxt force new_contract >>=? fun alias_name ->
source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) -> source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) ->
originate_account originate_account
@ -224,13 +224,13 @@ let commands () =
@@ RawContractAlias.fresh_alias_param @@ RawContractAlias.fresh_alias_param
~name: "new" ~desc: "name of the new contract" ~name: "new" ~desc: "name of the new contract"
@@ prefix "for" @@ prefix "for"
@@ Public_key_hash.alias_param @@ Public_key_hash.source_param
~name: "mgr" ~desc: "manager of the new contract" ~name: "mgr" ~desc: "manager of the new contract"
@@ prefix "transferring" @@ prefix "transferring"
@@ tez_param @@ tez_param
~name: "qty" ~desc: "amount taken from source" ~name: "qty" ~desc: "amount taken from source"
@@ prefix "from" @@ prefix "from"
@@ ContractAlias.alias_param @@ ContractAlias.destination_param
~name:"src" ~desc: "name of the source contract" ~name:"src" ~desc: "name of the source contract"
@@ prefix "running" @@ prefix "running"
@@ Program.source_param @@ Program.source_param
@ -238,7 +238,7 @@ let commands () =
Combine with -init if the storage type is not unit." Combine with -init if the storage type is not unit."
@@ stop) @@ stop)
begin fun (fee, delegate, force, delegatable, spendable, initial_storage, no_print_source) begin fun (fee, delegate, force, delegatable, spendable, initial_storage, no_print_source)
alias_name (_, manager) balance (_, source) program (cctxt : Proto_alpha.full) -> alias_name manager balance (_, source) program (cctxt : Proto_alpha.full) ->
RawContractAlias.of_fresh cctxt force alias_name >>=? fun alias_name -> RawContractAlias.of_fresh cctxt force alias_name >>=? fun alias_name ->
Lwt.return (Micheline_parser.no_parsing_error program) >>=? fun { expanded = code } -> Lwt.return (Micheline_parser.no_parsing_error program) >>=? fun { expanded = code } ->
source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) -> source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) ->
@ -290,11 +290,11 @@ let commands () =
command ~group ~desc: "Register the public key hash as a delegate." command ~group ~desc: "Register the public key hash as a delegate."
(args1 fee_arg) (args1 fee_arg)
(prefixes [ "register" ; "key" ] (prefixes [ "register" ; "key" ]
@@ Public_key_hash.alias_param @@ Public_key_hash.source_param
~name: "mgr" ~desc: "the delegate key" ~name: "mgr" ~desc: "the delegate key"
@@ prefixes [ "as" ; "delegate" ] @@ prefixes [ "as" ; "delegate" ]
@@ stop) @@ stop)
begin fun fee (_, src_pkh) cctxt -> begin fun fee src_pkh cctxt ->
Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) ->
register_as_delegate cctxt register_as_delegate cctxt
~fee cctxt#block ~manager_sk:src_sk src_pk >>=? fun oph -> ~fee cctxt#block ~manager_sk:src_sk src_pk >>=? fun oph ->

View File

@ -192,9 +192,9 @@ let commands () =
@@ Clic.param ~name:"type" ~desc:"type of the data" @@ Clic.param ~name:"type" ~desc:"type of the data"
data_parameter data_parameter
@@ prefixes [ "for" ] @@ prefixes [ "for" ]
@@ Client_keys.Secret_key.alias_param @@ Client_keys.Secret_key.source_param
@@ stop) @@ stop)
(fun () data typ (_, sk) cctxt -> (fun () data typ sk cctxt ->
Client_proto_programs.hash_and_sign data typ sk cctxt#block cctxt >>= begin function Client_proto_programs.hash_and_sign data typ sk cctxt#block cctxt >>= begin function
| Ok (hash, signature) -> | Ok (hash, signature) ->
cctxt#message "@[<v 0>Hash: %S@,Signature: %S@]" hash signature cctxt#message "@[<v 0>Hash: %S@,Signature: %S@]" hash signature