Client: allow tz1...
as the source of a transfer
This is only useful when a 'remote signer' is available.
This commit is contained in:
parent
fb85568d98
commit
da921a8f56
@ -141,6 +141,7 @@ let register_key cctxt ?(force=false) (public_key_hash, pk_uri, sk_uri) name =
|
||||
return ()
|
||||
|
||||
let raw_get_key (cctxt : #Client_context.wallet) pkh =
|
||||
begin
|
||||
Public_key_hash.rev_find cctxt pkh >>=? function
|
||||
| None -> failwith "no keys for the source contract manager"
|
||||
| Some n ->
|
||||
@ -158,6 +159,21 @@ let raw_get_key (cctxt : #Client_context.wallet) pkh =
|
||||
pk_uri
|
||||
end >>= fun pk ->
|
||||
return (n, pk, sk_uri)
|
||||
end >>= function
|
||||
| (Ok (_, None, None) | Error _) as initial_result -> begin
|
||||
begin
|
||||
(* try to lookup for a remote key *)
|
||||
find_signer_for_key ~scheme:"remote" >>=? fun signer ->
|
||||
let module Signer = (val signer : SIGNER) in
|
||||
let path = Signature.Public_key_hash.to_b58check pkh in
|
||||
let uri = Uri.make ~scheme:Signer.scheme ~path () in
|
||||
Signer.public_key uri >>=? fun pk ->
|
||||
return (path, Some pk, Some uri)
|
||||
end >>= function
|
||||
| Error _ -> Lwt.return initial_result
|
||||
| Ok _ as success -> Lwt.return success
|
||||
end
|
||||
| Ok _ as success -> Lwt.return success
|
||||
|
||||
let get_key cctxt pkh =
|
||||
raw_get_key cctxt pkh >>=? function
|
||||
|
@ -222,7 +222,7 @@ let commands () =
|
||||
@@ tez_param
|
||||
~name: "qty" ~desc: "amount taken from source"
|
||||
@@ prefix "from"
|
||||
@@ ContractAlias.alias_param
|
||||
@@ ContractAlias.destination_param
|
||||
~name: "src" ~desc: "name of the source contract"
|
||||
@@ prefix "to"
|
||||
@@ ContractAlias.destination_param
|
||||
|
Loading…
Reference in New Issue
Block a user