Client: add global option --wait
This commit is contained in:
parent
72e31287d1
commit
ee5373d960
@ -411,7 +411,8 @@ let run ?(rpc_port=18731) () =
|
|||||||
let open Client_config in
|
let open Client_config in
|
||||||
let {block; _} = default_cli_args in
|
let {block; _} = default_cli_args in
|
||||||
let (cctxt : #Tezos_client_base.Client_context.full) =
|
let (cctxt : #Tezos_client_base.Client_context.full) =
|
||||||
new Client_context_unix.unix_full ~block ~base_dir: "/" ~rpc_config
|
new Client_context_unix.unix_full
|
||||||
|
~block ~confirmations:None ~base_dir: "/" ~rpc_config
|
||||||
in
|
in
|
||||||
|
|
||||||
let print_header () =
|
let print_header () =
|
||||||
|
@ -8,6 +8,8 @@ source $test_dir/test_lib.inc.sh "$@"
|
|||||||
start_node 1
|
start_node 1
|
||||||
activate_alpha
|
activate_alpha
|
||||||
|
|
||||||
|
$client -w none config update
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
#tests for the rpc service raw_context
|
#tests for the rpc service raw_context
|
||||||
@ -83,8 +85,8 @@ bake_after $client transfer 400,000 from bootstrap5 to bootstrap1 -fee 0
|
|||||||
bake_after $client transfer 400,000 from bootstrap1 to bootstrap5 -fee 0
|
bake_after $client transfer 400,000 from bootstrap1 to bootstrap5 -fee 0
|
||||||
$client get balance for bootstrap5 | assert "4,000,000 ꜩ"
|
$client get balance for bootstrap5 | assert "4,000,000 ꜩ"
|
||||||
|
|
||||||
bake_after $client activate account $key4 with king_commitment.json --no-confirmation
|
bake_after $client activate account $key4 with king_commitment.json
|
||||||
bake_after $client activate account $key5 with queen_commitment.json --no-confirmation
|
bake_after $client activate account $key5 with queen_commitment.json
|
||||||
|
|
||||||
$client get balance for $key4 | assert "23,932,454.669,343 ꜩ"
|
$client get balance for $key4 | assert "23,932,454.669,343 ꜩ"
|
||||||
$client get balance for $key5 | assert "72,954,577.464,032 ꜩ"
|
$client get balance for $key5 | assert "72,954,577.464,032 ꜩ"
|
||||||
|
@ -9,6 +9,8 @@ source $test_dir/test_lib.inc.sh "$@"
|
|||||||
start_node 1
|
start_node 1
|
||||||
activate_alpha
|
activate_alpha
|
||||||
|
|
||||||
|
$client -w none config update
|
||||||
|
|
||||||
bake
|
bake
|
||||||
|
|
||||||
key1=foo
|
key1=foo
|
||||||
|
@ -17,7 +17,7 @@ show_logs="no"
|
|||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
dictator_secret="edsk31vznjHSSpGExDMHYASz45VZqXN4DPxvsa4hAyY8dHM28cZzp6"
|
dictator_secret="unencrypted:edsk31vznjHSSpGExDMHYASz45VZqXN4DPxvsa4hAyY8dHM28cZzp6"
|
||||||
|
|
||||||
# autogenerated from the demo source
|
# autogenerated from the demo source
|
||||||
protocol_version="Ps1ZDZdgRP4PFDkzmFpiYtE7gJHioavCMxC96i9zJsK6URwSXSJ"
|
protocol_version="Ps1ZDZdgRP4PFDkzmFpiYtE7gJHioavCMxC96i9zJsK6URwSXSJ"
|
||||||
|
@ -17,7 +17,7 @@ show_logs="no"
|
|||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
dictator_secret="edsk31vznjHSSpGExDMHYASz45VZqXN4DPxvsa4hAyY8dHM28cZzp6"
|
dictator_secret="unencrypted:edsk31vznjHSSpGExDMHYASz45VZqXN4DPxvsa4hAyY8dHM28cZzp6"
|
||||||
|
|
||||||
# autogenerated from the demo source
|
# autogenerated from the demo source
|
||||||
protocol_version="Ps1ZDZdgRP4PFDkzmFpiYtE7gJHioavCMxC96i9zJsK6URwSXSJ"
|
protocol_version="Ps1ZDZdgRP4PFDkzmFpiYtE7gJHioavCMxC96i9zJsK6URwSXSJ"
|
||||||
|
@ -21,6 +21,7 @@ for client in "${client_instances[@]}"; do
|
|||||||
echo
|
echo
|
||||||
echo "### $client bootstrapped"
|
echo "### $client bootstrapped"
|
||||||
echo
|
echo
|
||||||
|
$client -w none config update
|
||||||
$client bootstrapped
|
$client bootstrapped
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
|
@ -729,6 +729,11 @@ let args10 spec1 spec2 spec3 spec4 spec5 spec6 spec7 spec8 spec9 spec10 =
|
|||||||
{ spec = spec1 >> (spec2 >> (spec3 >> (spec4 >> (spec5 >> (spec6 >> (spec7 >> (spec8 >> (spec9 >> (spec10 >> NoArgs))))))))) ;
|
{ spec = spec1 >> (spec2 >> (spec3 >> (spec4 >> (spec5 >> (spec6 >> (spec7 >> (spec8 >> (spec9 >> (spec10 >> NoArgs))))))))) ;
|
||||||
converter = fun (arg1, (arg2, (arg3, (arg4, (arg5, (spec6, (spec7, (spec8, (spec9, (spec10, ())))))))))) ->
|
converter = fun (arg1, (arg2, (arg3, (arg4, (arg5, (spec6, (spec7, (spec8, (spec9, (spec10, ())))))))))) ->
|
||||||
arg1, arg2, arg3, arg4, arg5, spec6, spec7, spec8, spec9, spec10 }
|
arg1, arg2, arg3, arg4, arg5, spec6, spec7, spec8, spec9, spec10 }
|
||||||
|
let args11 spec1 spec2 spec3 spec4 spec5 spec6 spec7 spec8 spec9 spec10 spec11 =
|
||||||
|
Argument
|
||||||
|
{ spec = spec1 >> (spec2 >> (spec3 >> (spec4 >> (spec5 >> (spec6 >> (spec7 >> (spec8 >> (spec9 >> (spec10 >> (spec11 >> NoArgs)))))))))) ;
|
||||||
|
converter = fun (arg1, (arg2, (arg3, (arg4, (arg5, (spec6, (spec7, (spec8, (spec9, (spec10, (spec11, ()))))))))))) ->
|
||||||
|
arg1, arg2, arg3, arg4, arg5, spec6, spec7, spec8, spec9, spec10, spec11 }
|
||||||
|
|
||||||
(* Some combinators for writing commands concisely. *)
|
(* Some combinators for writing commands concisely. *)
|
||||||
let param ~name ~desc kind next = Param (name, desc, kind, next)
|
let param ~name ~desc kind next = Param (name, desc, kind, next)
|
||||||
|
@ -168,6 +168,12 @@ val args10 : ('a, 'ctx) arg -> ('b, 'ctx) arg -> ('c, 'ctx) arg -> ('d, 'ctx) ar
|
|||||||
('i, 'ctx) arg -> ('j, 'ctx) arg ->
|
('i, 'ctx) arg -> ('j, 'ctx) arg ->
|
||||||
('a * 'b * 'c * 'd * 'e * 'f * 'g * 'h * 'i * 'j, 'ctx) options
|
('a * 'b * 'c * 'd * 'e * 'f * 'g * 'h * 'i * 'j, 'ctx) options
|
||||||
|
|
||||||
|
(** Include 11 optional parameters *)
|
||||||
|
val args11 : ('a, 'ctx) arg -> ('b, 'ctx) arg -> ('c, 'ctx) arg -> ('d, 'ctx) arg ->
|
||||||
|
('e, 'ctx) arg -> ('f, 'ctx) arg -> ('g, 'ctx) arg -> ('h, 'ctx) arg ->
|
||||||
|
('i, 'ctx) arg -> ('j, 'ctx) arg -> ('k, 'ctx) arg ->
|
||||||
|
('a * 'b * 'c * 'd * 'e * 'f * 'g * 'h * 'i * 'j * 'k, 'ctx) options
|
||||||
|
|
||||||
(** {2 Parameter based command lines} *)
|
(** {2 Parameter based command lines} *)
|
||||||
|
|
||||||
(** Type of parameters for a command *)
|
(** Type of parameters for a command *)
|
||||||
|
@ -55,6 +55,7 @@ end
|
|||||||
|
|
||||||
class type block = object
|
class type block = object
|
||||||
method block : Block_services.block
|
method block : Block_services.block
|
||||||
|
method confirmations : int option
|
||||||
end
|
end
|
||||||
|
|
||||||
class type io_wallet = object
|
class type io_wallet = object
|
||||||
@ -80,6 +81,7 @@ end
|
|||||||
class proxy_context (obj : full) = object
|
class proxy_context (obj : full) = object
|
||||||
method base = obj#base
|
method base = obj#base
|
||||||
method block = obj#block
|
method block = obj#block
|
||||||
|
method confirmations = obj#confirmations
|
||||||
method answer : type a. (a, unit) lwt_format -> a = obj#answer
|
method answer : type a. (a, unit) lwt_format -> a = obj#answer
|
||||||
method call_service :
|
method call_service :
|
||||||
'm 'p 'q 'i 'o.
|
'm 'p 'q 'i 'o.
|
||||||
|
@ -35,6 +35,7 @@ end
|
|||||||
|
|
||||||
class type block = object
|
class type block = object
|
||||||
method block : Block_services.block
|
method block : Block_services.block
|
||||||
|
method confirmations : int option
|
||||||
end
|
end
|
||||||
|
|
||||||
class type io_wallet = object
|
class type io_wallet = object
|
||||||
|
@ -13,6 +13,7 @@ type error += Invalid_block_argument of string
|
|||||||
type error += Invalid_protocol_argument of string
|
type error += Invalid_protocol_argument of string
|
||||||
type error += Invalid_port_arg of string
|
type error += Invalid_port_arg of string
|
||||||
type error += Invalid_remote_signer_argument of string
|
type error += Invalid_remote_signer_argument of string
|
||||||
|
type error += Invalid_wait_arg of string
|
||||||
let () =
|
let () =
|
||||||
register_error_kind
|
register_error_kind
|
||||||
`Branch
|
`Branch
|
||||||
@ -57,7 +58,18 @@ let () =
|
|||||||
Format.fprintf ppf "Value '%s' is not a valid URI." s)
|
Format.fprintf ppf "Value '%s' is not a valid URI." s)
|
||||||
Data_encoding.(obj1 (req "value" string))
|
Data_encoding.(obj1 (req "value" string))
|
||||||
(function Invalid_remote_signer_argument s -> Some s | _ -> None)
|
(function Invalid_remote_signer_argument s -> Some s | _ -> None)
|
||||||
(fun s -> Invalid_remote_signer_argument s)
|
(fun s -> Invalid_remote_signer_argument s) ;
|
||||||
|
register_error_kind
|
||||||
|
`Branch
|
||||||
|
~id: "invalidWaitArgument"
|
||||||
|
~title: "Bad Wait Argument"
|
||||||
|
~description: "Wait argument could not be parsed"
|
||||||
|
~pp:
|
||||||
|
(fun ppf s ->
|
||||||
|
Format.fprintf ppf "Value %s is not a valid number of confirmation, nor 'none'." s)
|
||||||
|
Data_encoding.(obj1 (req "value" string))
|
||||||
|
(function Invalid_wait_arg s -> Some s | _ -> None)
|
||||||
|
(fun s -> Invalid_wait_arg s)
|
||||||
|
|
||||||
let home = try Sys.getenv "HOME" with Not_found -> "/root"
|
let home = try Sys.getenv "HOME" with Not_found -> "/root"
|
||||||
|
|
||||||
@ -77,6 +89,7 @@ module Cfg_file = struct
|
|||||||
tls: bool ;
|
tls: bool ;
|
||||||
web_port: int ;
|
web_port: int ;
|
||||||
remote_signer: Uri.t option ;
|
remote_signer: Uri.t option ;
|
||||||
|
confirmations: int option ;
|
||||||
}
|
}
|
||||||
|
|
||||||
let default = {
|
let default = {
|
||||||
@ -86,28 +99,33 @@ module Cfg_file = struct
|
|||||||
tls = false ;
|
tls = false ;
|
||||||
web_port = 8080 ;
|
web_port = 8080 ;
|
||||||
remote_signer = None ;
|
remote_signer = None ;
|
||||||
|
confirmations = Some 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
open Data_encoding
|
open Data_encoding
|
||||||
|
|
||||||
let encoding =
|
let encoding =
|
||||||
conv
|
conv
|
||||||
(fun { base_dir ; node_addr ; node_port ; tls ; web_port ; remote_signer } ->
|
(fun { base_dir ; node_addr ; node_port ; tls ; web_port ;
|
||||||
(base_dir, Some node_addr, Some node_port,
|
remote_signer ; confirmations } ->
|
||||||
Some tls, Some web_port, remote_signer))
|
(base_dir, Some node_addr, Some node_port,
|
||||||
(fun (base_dir, node_addr, node_port, tls, web_port, remote_signer) ->
|
Some tls, Some web_port, remote_signer, confirmations))
|
||||||
let node_addr = Option.unopt ~default:default.node_addr node_addr in
|
(fun (base_dir, node_addr, node_port, tls, web_port,
|
||||||
let node_port = Option.unopt ~default:default.node_port node_port in
|
remote_signer, confirmations) ->
|
||||||
let tls = Option.unopt ~default:default.tls tls in
|
let node_addr = Option.unopt ~default:default.node_addr node_addr in
|
||||||
let web_port = Option.unopt ~default:default.web_port web_port in
|
let node_port = Option.unopt ~default:default.node_port node_port in
|
||||||
{ base_dir ; node_addr ; node_port ; tls ; web_port ; remote_signer })
|
let tls = Option.unopt ~default:default.tls tls in
|
||||||
(obj6
|
let web_port = Option.unopt ~default:default.web_port web_port in
|
||||||
|
{ base_dir ; node_addr ; node_port ; tls ; web_port ;
|
||||||
|
remote_signer ; confirmations })
|
||||||
|
(obj7
|
||||||
(req "base_dir" string)
|
(req "base_dir" string)
|
||||||
(opt "node_addr" string)
|
(opt "node_addr" string)
|
||||||
(opt "node_port" int16)
|
(opt "node_port" int16)
|
||||||
(opt "tls" bool)
|
(opt "tls" bool)
|
||||||
(opt "web_port" int16)
|
(opt "web_port" int16)
|
||||||
(opt "remote_signer" RPC_client.uri_encoding))
|
(opt "remote_signer" RPC_client.uri_encoding)
|
||||||
|
(opt "confirmations" int8))
|
||||||
|
|
||||||
let from_json json =
|
let from_json json =
|
||||||
Data_encoding.Json.destruct encoding json
|
Data_encoding.Json.destruct encoding json
|
||||||
@ -124,6 +142,7 @@ end
|
|||||||
|
|
||||||
type cli_args = {
|
type cli_args = {
|
||||||
block: Block_services.block ;
|
block: Block_services.block ;
|
||||||
|
confirmations: int option ;
|
||||||
protocol: Protocol_hash.t option ;
|
protocol: Protocol_hash.t option ;
|
||||||
print_timings: bool ;
|
print_timings: bool ;
|
||||||
log_requests: bool ;
|
log_requests: bool ;
|
||||||
@ -131,6 +150,7 @@ type cli_args = {
|
|||||||
|
|
||||||
let default_cli_args = {
|
let default_cli_args = {
|
||||||
block = default_block ;
|
block = default_block ;
|
||||||
|
confirmations = Some 0 ;
|
||||||
protocol = None ;
|
protocol = None ;
|
||||||
print_timings = false ;
|
print_timings = false ;
|
||||||
log_requests = false ;
|
log_requests = false ;
|
||||||
@ -149,6 +169,20 @@ let block_parameter () =
|
|||||||
| Error _ -> fail (Invalid_block_argument block)
|
| Error _ -> fail (Invalid_block_argument block)
|
||||||
| Ok block -> return block)
|
| Ok block -> return block)
|
||||||
|
|
||||||
|
let wait_parameter () =
|
||||||
|
parameter
|
||||||
|
(fun _ wait ->
|
||||||
|
match wait with
|
||||||
|
| "no" | "none" -> return None
|
||||||
|
| _ ->
|
||||||
|
try
|
||||||
|
let w = int_of_string wait in
|
||||||
|
if 0 <= w then
|
||||||
|
return (Some w)
|
||||||
|
else
|
||||||
|
fail (Invalid_wait_arg wait)
|
||||||
|
with _ -> fail (Invalid_wait_arg wait))
|
||||||
|
|
||||||
let protocol_parameter () =
|
let protocol_parameter () =
|
||||||
parameter
|
parameter
|
||||||
(fun _ arg ->
|
(fun _ arg ->
|
||||||
@ -194,6 +228,13 @@ let block_arg () =
|
|||||||
~doc:"block on which to apply contextual commands"
|
~doc:"block on which to apply contextual commands"
|
||||||
~default:(Block_services.to_string default_cli_args.block)
|
~default:(Block_services.to_string default_cli_args.block)
|
||||||
(block_parameter ())
|
(block_parameter ())
|
||||||
|
let wait_arg () =
|
||||||
|
arg
|
||||||
|
~long:"wait"
|
||||||
|
~short:'w'
|
||||||
|
~placeholder:"none|<int>"
|
||||||
|
~doc:"how many confirmation blocks before to consider an operation as included"
|
||||||
|
(wait_parameter ())
|
||||||
let protocol_arg () =
|
let protocol_arg () =
|
||||||
arg
|
arg
|
||||||
~long:"protocol"
|
~long:"protocol"
|
||||||
@ -318,11 +359,12 @@ let commands config_file cfg =
|
|||||||
]
|
]
|
||||||
|
|
||||||
let global_options () =
|
let global_options () =
|
||||||
args10
|
args11
|
||||||
(base_dir_arg ())
|
(base_dir_arg ())
|
||||||
(config_file_arg ())
|
(config_file_arg ())
|
||||||
(timings_switch ())
|
(timings_switch ())
|
||||||
(block_arg ())
|
(block_arg ())
|
||||||
|
(wait_arg ())
|
||||||
(protocol_arg ())
|
(protocol_arg ())
|
||||||
(log_requests_switch ())
|
(log_requests_switch ())
|
||||||
(addr_arg ())
|
(addr_arg ())
|
||||||
@ -339,6 +381,7 @@ let parse_config_args (ctx : #Client_context.full) argv =
|
|||||||
config_file,
|
config_file,
|
||||||
timings,
|
timings,
|
||||||
block,
|
block,
|
||||||
|
confirmations,
|
||||||
protocol,
|
protocol,
|
||||||
log_requests,
|
log_requests,
|
||||||
node_addr,
|
node_addr,
|
||||||
@ -382,7 +425,9 @@ let parse_config_args (ctx : #Client_context.full) argv =
|
|||||||
let node_addr = Option.unopt ~default:cfg.node_addr node_addr in
|
let node_addr = Option.unopt ~default:cfg.node_addr node_addr in
|
||||||
let node_port = Option.unopt ~default:cfg.node_port node_port in
|
let node_port = Option.unopt ~default:cfg.node_port node_port in
|
||||||
let remote_signer = Option.first_some remote_signer cfg.remote_signer in
|
let remote_signer = Option.first_some remote_signer cfg.remote_signer in
|
||||||
let cfg = { cfg with tls ; node_port ; node_addr ; remote_signer } in
|
let confirmations = Option.unopt ~default:cfg.confirmations confirmations in
|
||||||
|
let cfg = { cfg with tls ; node_port ; node_addr ;
|
||||||
|
remote_signer ; confirmations } in
|
||||||
if Sys.file_exists base_dir && not (Sys.is_directory base_dir) then begin
|
if Sys.file_exists base_dir && not (Sys.is_directory base_dir) then begin
|
||||||
Format.eprintf "%s is not a directory.@." base_dir ;
|
Format.eprintf "%s is not a directory.@." base_dir ;
|
||||||
exit 1 ;
|
exit 1 ;
|
||||||
@ -394,5 +439,6 @@ let parse_config_args (ctx : #Client_context.full) argv =
|
|||||||
Lwt_utils_unix.create_dir config_dir >>= fun () ->
|
Lwt_utils_unix.create_dir config_dir >>= fun () ->
|
||||||
return
|
return
|
||||||
(cfg,
|
(cfg,
|
||||||
{ block ; print_timings = timings ; log_requests ; protocol },
|
{ block ; confirmations ;
|
||||||
|
print_timings = timings ; log_requests ; protocol },
|
||||||
commands config_file cfg, remaining)
|
commands config_file cfg, remaining)
|
||||||
|
@ -83,11 +83,12 @@ class unix_logger ~base_dir =
|
|||||||
inherit Client_context.simple_printer log
|
inherit Client_context.simple_printer log
|
||||||
end
|
end
|
||||||
|
|
||||||
class unix_full ~base_dir ~block ~rpc_config : Client_context.full =
|
class unix_full ~base_dir ~block ~confirmations ~rpc_config : Client_context.full =
|
||||||
object
|
object
|
||||||
inherit unix_logger ~base_dir
|
inherit unix_logger ~base_dir
|
||||||
inherit unix_prompter
|
inherit unix_prompter
|
||||||
inherit unix_wallet ~base_dir
|
inherit unix_wallet ~base_dir
|
||||||
inherit RPC_client.http_ctxt rpc_config Media_type.all_media_types
|
inherit RPC_client.http_ctxt rpc_config Media_type.all_media_types
|
||||||
method block = block
|
method block = block
|
||||||
|
method confirmations = confirmations
|
||||||
end
|
end
|
||||||
|
@ -18,5 +18,6 @@ class unix_logger :
|
|||||||
class unix_full :
|
class unix_full :
|
||||||
base_dir:string ->
|
base_dir:string ->
|
||||||
block:Block_services.block ->
|
block:Block_services.block ->
|
||||||
|
confirmations:int option ->
|
||||||
rpc_config:RPC_client.config ->
|
rpc_config:RPC_client.config ->
|
||||||
Client_context.full
|
Client_context.full
|
||||||
|
@ -90,6 +90,7 @@ let main select_commands =
|
|||||||
Client_config.parse_config_args
|
Client_config.parse_config_args
|
||||||
(new unix_full
|
(new unix_full
|
||||||
~block:Client_config.default_block
|
~block:Client_config.default_block
|
||||||
|
~confirmations:None
|
||||||
~base_dir:Client_config.default_base_dir
|
~base_dir:Client_config.default_base_dir
|
||||||
~rpc_config:RPC_client.default_config)
|
~rpc_config:RPC_client.default_config)
|
||||||
original_args
|
original_args
|
||||||
@ -120,6 +121,7 @@ let main select_commands =
|
|||||||
let client_config =
|
let client_config =
|
||||||
new unix_full
|
new unix_full
|
||||||
~block:parsed_args.block
|
~block:parsed_args.block
|
||||||
|
~confirmations:parsed_args.confirmations
|
||||||
~base_dir:parsed_config_file.base_dir
|
~base_dir:parsed_config_file.base_dir
|
||||||
~rpc_config:rpc_config in
|
~rpc_config:rpc_config in
|
||||||
Option.iter parsed_config_file.remote_signer ~f: begin fun signer ->
|
Option.iter parsed_config_file.remote_signer ~f: begin fun signer ->
|
||||||
|
@ -38,6 +38,7 @@ let no_write_context ?(block = `Head 0) config : #Client_context.full = object
|
|||||||
a Data_encoding.encoding -> unit Error_monad.tzresult Lwt.t =
|
a Data_encoding.encoding -> unit Error_monad.tzresult Lwt.t =
|
||||||
fun _ _ _ -> return ()
|
fun _ _ _ -> return ()
|
||||||
method block = block
|
method block = block
|
||||||
|
method confirmations = None
|
||||||
method prompt : type a. (a, string tzresult) Client_context.lwt_format -> a =
|
method prompt : type a. (a, string tzresult) Client_context.lwt_format -> a =
|
||||||
Format.kasprintf (fun _ -> return "")
|
Format.kasprintf (fun _ -> return "")
|
||||||
method prompt_password : type a. (a, MBytes.t tzresult) Client_context.lwt_format -> a =
|
method prompt_password : type a. (a, MBytes.t tzresult) Client_context.lwt_format -> a =
|
||||||
|
@ -141,7 +141,9 @@ let commands () =
|
|||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun fee (_, contract) (_, delegate) (cctxt : Proto_alpha.full) ->
|
begin fun fee (_, contract) (_, delegate) (cctxt : Proto_alpha.full) ->
|
||||||
source_to_keys cctxt cctxt#block contract >>=? fun (src_pk, manager_sk) ->
|
source_to_keys cctxt cctxt#block contract >>=? fun (src_pk, manager_sk) ->
|
||||||
set_delegate cctxt cctxt#block contract (Some delegate) ~fee ~src_pk ~manager_sk >>=? fun _ ->
|
set_delegate
|
||||||
|
cctxt cctxt#block ?confirmations:cctxt#confirmations
|
||||||
|
contract (Some delegate) ~fee ~src_pk ~manager_sk >>=? fun _ ->
|
||||||
return ()
|
return ()
|
||||||
end ;
|
end ;
|
||||||
|
|
||||||
@ -152,7 +154,9 @@ let commands () =
|
|||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun fee (_, contract) (cctxt : Proto_alpha.full) ->
|
begin fun fee (_, contract) (cctxt : Proto_alpha.full) ->
|
||||||
source_to_keys cctxt cctxt#block contract >>=? fun (src_pk, manager_sk) ->
|
source_to_keys cctxt cctxt#block contract >>=? fun (src_pk, manager_sk) ->
|
||||||
set_delegate ~fee cctxt cctxt#block contract None ~src_pk ~manager_sk >>=? fun _ ->
|
set_delegate
|
||||||
|
cctxt cctxt#block ?confirmations:cctxt#confirmations
|
||||||
|
contract None ~fee ~src_pk ~manager_sk >>=? fun _ ->
|
||||||
return ()
|
return ()
|
||||||
end ;
|
end ;
|
||||||
|
|
||||||
@ -178,6 +182,7 @@ let commands () =
|
|||||||
originate_account
|
originate_account
|
||||||
cctxt
|
cctxt
|
||||||
cctxt#block
|
cctxt#block
|
||||||
|
?confirmations:cctxt#confirmations
|
||||||
~fee
|
~fee
|
||||||
?delegate
|
?delegate
|
||||||
~delegatable
|
~delegatable
|
||||||
@ -217,7 +222,7 @@ let commands () =
|
|||||||
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) ->
|
||||||
originate_contract cctxt cctxt#block
|
originate_contract cctxt cctxt#block ?confirmations:cctxt#confirmations
|
||||||
~fee ?gas_limit ~delegate ~delegatable ~spendable ~initial_storage
|
~fee ?gas_limit ~delegate ~delegatable ~spendable ~initial_storage
|
||||||
~manager ~balance ~source ~src_pk ~src_sk ~code () >>= fun errors ->
|
~manager ~balance ~source ~src_pk ~src_sk ~code () >>= fun errors ->
|
||||||
report_michelson_errors ~no_print_source ~msg:"origination simulation failed" cctxt errors >>= function
|
report_michelson_errors ~no_print_source ~msg:"origination simulation failed" cctxt errors >>= function
|
||||||
@ -241,8 +246,8 @@ let commands () =
|
|||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun (fee, gas_limit, arg, no_print_source) amount (_, source) (_, destination) cctxt ->
|
begin fun (fee, gas_limit, arg, no_print_source) amount (_, source) (_, destination) cctxt ->
|
||||||
source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) ->
|
source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) ->
|
||||||
transfer cctxt ~fee cctxt#block
|
transfer cctxt cctxt#block ?confirmations:cctxt#confirmations
|
||||||
~source ~src_pk ~src_sk ~destination ~arg ~amount ?gas_limit () >>=
|
~source ~fee ~src_pk ~src_sk ~destination ~arg ~amount ?gas_limit () >>=
|
||||||
report_michelson_errors ~no_print_source ~msg:"transfer simulation failed" cctxt >>= function
|
report_michelson_errors ~no_print_source ~msg:"transfer simulation failed" cctxt >>= function
|
||||||
| None -> return ()
|
| None -> return ()
|
||||||
| Some (_res, _contracts) ->
|
| Some (_res, _contracts) ->
|
||||||
@ -257,8 +262,8 @@ let commands () =
|
|||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun fee (_, source) cctxt ->
|
begin fun fee (_, source) cctxt ->
|
||||||
source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) ->
|
source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) ->
|
||||||
reveal cctxt ~fee cctxt#block
|
reveal cctxt cctxt#block ?confirmations:cctxt#confirmations
|
||||||
~source ~src_pk ~src_sk () >>=? fun _res ->
|
~source ~fee ~src_pk ~src_sk () >>=? fun _res ->
|
||||||
return ()
|
return ()
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -271,15 +276,14 @@ let commands () =
|
|||||||
@@ 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 ?confirmations:cctxt#confirmations
|
||||||
~fee cctxt#block ~manager_sk:src_sk src_pk >>=? fun _res ->
|
~fee cctxt#block ~manager_sk:src_sk src_pk >>=? fun _res ->
|
||||||
return ()
|
return ()
|
||||||
end;
|
end;
|
||||||
|
|
||||||
command ~group ~desc:"Register and activate a predefined account using the provided activation key."
|
command ~group ~desc:"Register and activate a predefined account using the provided activation key."
|
||||||
(args3
|
(args2
|
||||||
(Secret_key.force_switch ())
|
(Secret_key.force_switch ())
|
||||||
(Client_proto_args.no_confirmation)
|
|
||||||
encrypted_switch)
|
encrypted_switch)
|
||||||
(prefixes [ "activate" ; "account" ]
|
(prefixes [ "activate" ; "account" ]
|
||||||
@@ Secret_key.fresh_alias_param
|
@@ Secret_key.fresh_alias_param
|
||||||
@ -288,7 +292,7 @@ let commands () =
|
|||||||
~desc:"Activation key (as JSON file) obtained from the Tezos foundation (or the Alphanet faucet)."
|
~desc:"Activation key (as JSON file) obtained from the Tezos foundation (or the Alphanet faucet)."
|
||||||
file_parameter
|
file_parameter
|
||||||
@@ stop)
|
@@ stop)
|
||||||
(fun (force, no_confirmation, encrypted) name activation_key_file cctxt ->
|
(fun (force, encrypted) name activation_key_file cctxt ->
|
||||||
Secret_key.of_fresh cctxt force name >>=? fun name ->
|
Secret_key.of_fresh cctxt force name >>=? fun name ->
|
||||||
Lwt_utils_unix.Json.read_file activation_key_file >>=? fun json ->
|
Lwt_utils_unix.Json.read_file activation_key_file >>=? fun json ->
|
||||||
match Data_encoding.Json.destruct
|
match Data_encoding.Json.destruct
|
||||||
@ -300,9 +304,8 @@ let commands () =
|
|||||||
(fun ppf -> Data_encoding.Json.print_error ppf) exn
|
(fun ppf -> Data_encoding.Json.print_error ppf) exn
|
||||||
Data_encoding.Json.pp json
|
Data_encoding.Json.pp json
|
||||||
| key ->
|
| key ->
|
||||||
let confirmations =
|
claim_commitment
|
||||||
if no_confirmation then None else Some 0 in
|
cctxt cctxt#block ?confirmations:cctxt#confirmations
|
||||||
claim_commitment cctxt cctxt#block ?confirmations
|
|
||||||
~encrypted ~force key name >>=? fun _res ->
|
~encrypted ~force key name >>=? fun _res ->
|
||||||
return ()
|
return ()
|
||||||
);
|
);
|
||||||
@ -358,7 +361,8 @@ let commands () =
|
|||||||
fail_when (predecessors < 0)
|
fail_when (predecessors < 0)
|
||||||
(failure "check-previous cannot be negative") >>=? fun () ->
|
(failure "check-previous cannot be negative") >>=? fun () ->
|
||||||
Client_confirmations.wait_for_operation_inclusion ctxt
|
Client_confirmations.wait_for_operation_inclusion ctxt
|
||||||
~confirmations ~predecessors operation_hash
|
~confirmations ~predecessors operation_hash >>=? fun _ ->
|
||||||
|
return ()
|
||||||
end ;
|
end ;
|
||||||
|
|
||||||
command ~group:alphanet ~desc: "Fork a test protocol (Alphanet dictator only)."
|
command ~group:alphanet ~desc: "Fork a test protocol (Alphanet dictator only)."
|
||||||
|
Loading…
Reference in New Issue
Block a user