Alpha: adds an RPC to get the storage of a contract
This commit is contained in:
parent
733be3fa17
commit
a8e984c1af
@ -236,6 +236,8 @@ let get_script c contract =
|
|||||||
| Some code, Some storage -> return (Some { Script_repr.code ; storage })
|
| Some code, Some storage -> return (Some { Script_repr.code ; storage })
|
||||||
| None, Some _ | Some _, None -> failwith "get_script"
|
| None, Some _ | Some _, None -> failwith "get_script"
|
||||||
|
|
||||||
|
let get_storage = Storage.Contract.Storage.get_option
|
||||||
|
|
||||||
let get_counter c contract =
|
let get_counter c contract =
|
||||||
Storage.Contract.Counter.get_option c contract >>=? function
|
Storage.Contract.Counter.get_option c contract >>=? function
|
||||||
| None -> begin
|
| None -> begin
|
||||||
|
@ -37,6 +37,7 @@ val get_balance: Storage.t -> Contract_repr.t -> Tez_repr.t tzresult Lwt.t
|
|||||||
val get_counter: Storage.t -> Contract_repr.t -> int32 tzresult Lwt.t
|
val get_counter: Storage.t -> Contract_repr.t -> int32 tzresult Lwt.t
|
||||||
|
|
||||||
val get_script: Storage.t -> Contract_repr.t -> Script_repr.t option tzresult Lwt.t
|
val get_script: Storage.t -> Contract_repr.t -> Script_repr.t option tzresult Lwt.t
|
||||||
|
val get_storage: Storage.t -> Contract_repr.t -> Script_repr.storage option tzresult Lwt.t
|
||||||
|
|
||||||
val update_script_storage_and_fees: Storage.t -> Contract_repr.t -> Tez_repr.t -> Script_repr.expr -> Storage.t tzresult Lwt.t
|
val update_script_storage_and_fees: Storage.t -> Contract_repr.t -> Tez_repr.t -> Script_repr.expr -> Storage.t tzresult Lwt.t
|
||||||
|
|
||||||
|
@ -301,6 +301,13 @@ module Context = struct
|
|||||||
~output: (wrap_tzerror (option Script.encoding))
|
~output: (wrap_tzerror (option Script.encoding))
|
||||||
RPC.Path.(custom_root / "context" / "contracts" /: Contract.arg / "script")
|
RPC.Path.(custom_root / "context" / "contracts" /: Contract.arg / "script")
|
||||||
|
|
||||||
|
let storage custom_root =
|
||||||
|
RPC.service
|
||||||
|
~description: "Access the data of the contract."
|
||||||
|
~input: empty
|
||||||
|
~output: (wrap_tzerror (option Script.storage_encoding))
|
||||||
|
RPC.Path.(custom_root / "context" / "contracts" /: Contract.arg / "storage")
|
||||||
|
|
||||||
type info = {
|
type info = {
|
||||||
manager: public_key_hash ;
|
manager: public_key_hash ;
|
||||||
balance: Tez.t ;
|
balance: Tez.t ;
|
||||||
|
@ -213,6 +213,7 @@ let () =
|
|||||||
register2' Services.Context.Contract.spendable Contract.is_spendable ;
|
register2' Services.Context.Contract.spendable Contract.is_spendable ;
|
||||||
register2' Services.Context.Contract.delegatable Contract.is_delegatable ;
|
register2' Services.Context.Contract.delegatable Contract.is_delegatable ;
|
||||||
register2' Services.Context.Contract.script Contract.get_script ;
|
register2' Services.Context.Contract.script Contract.get_script ;
|
||||||
|
register2' Services.Context.Contract.storage Contract.get_storage ;
|
||||||
register2' Services.Context.Contract.get (fun ctxt contract ->
|
register2' Services.Context.Contract.get (fun ctxt contract ->
|
||||||
Contract.get_balance ctxt contract >>=? fun balance ->
|
Contract.get_balance ctxt contract >>=? fun balance ->
|
||||||
Contract.get_manager ctxt contract >>=? fun manager ->
|
Contract.get_manager ctxt contract >>=? fun manager ->
|
||||||
|
@ -330,6 +330,8 @@ module Contract : sig
|
|||||||
context -> contract -> bool tzresult Lwt.t
|
context -> contract -> bool tzresult Lwt.t
|
||||||
val get_script:
|
val get_script:
|
||||||
context -> contract -> (Script.t option) tzresult Lwt.t
|
context -> contract -> (Script.t option) tzresult Lwt.t
|
||||||
|
val get_storage:
|
||||||
|
context -> contract -> (Script.storage option) tzresult Lwt.t
|
||||||
|
|
||||||
val get_counter: context -> contract -> int32 tzresult Lwt.t
|
val get_counter: context -> contract -> int32 tzresult Lwt.t
|
||||||
val get_balance:
|
val get_balance:
|
||||||
|
Loading…
Reference in New Issue
Block a user