Alpha/client: add command "reveal key for <contract>"
This commit is contained in:
parent
86561363b2
commit
3a057ddad1
@ -73,6 +73,23 @@ let transfer cctxt
|
||||
assert (Operation_hash.equal oph injected_oph) ;
|
||||
return (oph, contracts)
|
||||
|
||||
let reveal cctxt
|
||||
block ?branch ~source ~src_pk ~src_sk ~fee () =
|
||||
get_branch cctxt block branch >>=? fun (chain_id, branch) ->
|
||||
Alpha_services.Contract.counter cctxt block source >>=? fun pcounter ->
|
||||
let counter = Int32.succ pcounter in
|
||||
Alpha_services.Forge.Manager.reveal
|
||||
cctxt block
|
||||
~branch ~source ~sourcePubKey:src_pk ~counter ~fee () >>=? fun bytes ->
|
||||
Client_keys.sign cctxt src_sk bytes >>=? fun signature ->
|
||||
let signed_bytes =
|
||||
MBytes.concat bytes (Ed25519.Signature.to_bytes signature) in
|
||||
let oph = Operation_hash.hash_bytes [ signed_bytes ] in
|
||||
Shell_services.inject_operation
|
||||
cctxt ~chain_id signed_bytes >>=? fun injected_oph ->
|
||||
assert (Operation_hash.equal oph injected_oph) ;
|
||||
return oph
|
||||
|
||||
let originate rpc_config ?chain_id ~block ?signature bytes =
|
||||
let signed_bytes =
|
||||
match signature with
|
||||
|
@ -118,6 +118,16 @@ val transfer :
|
||||
unit ->
|
||||
(Operation_hash.t * Contract.t list) tzresult Lwt.t
|
||||
|
||||
val reveal :
|
||||
#Proto_alpha.full ->
|
||||
Block_services.block ->
|
||||
?branch:int ->
|
||||
source:Contract.t ->
|
||||
src_pk:public_key ->
|
||||
src_sk:Client_keys.sk_locator ->
|
||||
fee:Tez.t ->
|
||||
unit -> Operation_hash.t tzresult Lwt.t
|
||||
|
||||
val dictate :
|
||||
#Proto_alpha.rpc_context ->
|
||||
Block_services.block ->
|
||||
|
@ -229,6 +229,19 @@ let commands () =
|
||||
operation_submitted_message cctxt ~contracts oph
|
||||
end;
|
||||
|
||||
command ~group ~desc: "Reveal the public key of the contract manager."
|
||||
(args1 fee_arg)
|
||||
(prefixes [ "reveal" ; "key" ; "for" ]
|
||||
@@ ContractAlias.alias_param
|
||||
~name: "src" ~desc: "name of the source contract"
|
||||
@@ stop)
|
||||
begin fun fee (_, source) cctxt ->
|
||||
source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) ->
|
||||
reveal cctxt ~fee cctxt#block
|
||||
~source ~src_pk ~src_sk () >>=? fun oph ->
|
||||
operation_submitted_message cctxt oph
|
||||
end;
|
||||
|
||||
command ~group:alphanet ~desc: "Open a new FREE account (Alphanet only)."
|
||||
(args1 force_switch)
|
||||
(prefixes [ "originate" ; "free" ; "account" ]
|
||||
|
@ -315,6 +315,10 @@ module Forge = struct
|
||||
(RPC_context.make_call0 S.operations ctxt block
|
||||
() ({ branch }, Sourced_operations ops))
|
||||
|
||||
let reveal ctxt
|
||||
block ~branch ~source ~sourcePubKey ~counter ~fee ()=
|
||||
operations ctxt block ~branch ~source ~sourcePubKey ~counter ~fee []
|
||||
|
||||
let transaction ctxt
|
||||
block ~branch ~source ?sourcePubKey ~counter
|
||||
~amount ~destination ?parameters ~fee ()=
|
||||
|
@ -69,6 +69,15 @@ module Forge : sig
|
||||
fee:Tez.t ->
|
||||
manager_operation list -> MBytes.t shell_tzresult Lwt.t
|
||||
|
||||
val reveal:
|
||||
'a #RPC_context.simple -> 'a ->
|
||||
branch:Block_hash.t ->
|
||||
source:Contract.t ->
|
||||
sourcePubKey:public_key ->
|
||||
counter:int32 ->
|
||||
fee:Tez.t ->
|
||||
unit -> MBytes.t shell_tzresult Lwt.t
|
||||
|
||||
val transaction:
|
||||
'a #RPC_context.simple -> 'a ->
|
||||
branch:Block_hash.t ->
|
||||
|
Loading…
Reference in New Issue
Block a user