Alpha/RPC: use GET requests for /contracts
and /constants
This commit is contained in:
parent
acc76d22a8
commit
991846e716
@ -17,162 +17,142 @@ module S = struct
|
|||||||
open Data_encoding
|
open Data_encoding
|
||||||
|
|
||||||
let preserved_cycles =
|
let preserved_cycles =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "How many cycle before the 'no-automatic-fork point'"
|
~description: "How many cycle before the 'no-automatic-fork point'"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: int31
|
||||||
~output: (obj1 (req "preserved_cycles" int31))
|
|
||||||
RPC_path.(custom_root / "preserved_cycles")
|
RPC_path.(custom_root / "preserved_cycles")
|
||||||
|
|
||||||
let blocks_per_cycle =
|
let blocks_per_cycle =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Cycle length"
|
~description: "Cycle length"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: int32
|
||||||
~output: (obj1 (req "blocks_per_cycle" int32))
|
|
||||||
RPC_path.(custom_root / "blocks_per_cycle")
|
RPC_path.(custom_root / "blocks_per_cycle")
|
||||||
|
|
||||||
let blocks_per_voting_period =
|
let blocks_per_voting_period =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Length of the voting period"
|
~description: "Length of the voting period"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: int32
|
||||||
~output: (obj1 (req "blocks_per_voting_period" int32))
|
|
||||||
RPC_path.(custom_root / "blocks_per_voting_period")
|
RPC_path.(custom_root / "blocks_per_voting_period")
|
||||||
|
|
||||||
let blocks_per_commitment =
|
let blocks_per_commitment =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "How many blocks between random seed's nonce commitment"
|
~description: "How many blocks between random seed's nonce commitment"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: int32
|
||||||
~output: (obj1 (req "blocks_per_commitment" int32))
|
|
||||||
RPC_path.(custom_root / "blocks_per_commitment")
|
RPC_path.(custom_root / "blocks_per_commitment")
|
||||||
|
|
||||||
let blocks_per_roll_snapshot =
|
let blocks_per_roll_snapshot =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "How many blocks between roll snapshots"
|
~description: "How many blocks between roll snapshots"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: int32
|
||||||
~output: (obj1 (req "blocks_per_roll_snapshot" int32))
|
|
||||||
RPC_path.(custom_root / "blocks_per_roll_snapshot")
|
RPC_path.(custom_root / "blocks_per_roll_snapshot")
|
||||||
|
|
||||||
let time_between_blocks =
|
let time_between_blocks =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Slot durations"
|
~description: "Slot durations"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: (list Period.encoding)
|
||||||
~output: (obj1 (req "time_between_slots" (list Period.encoding)))
|
|
||||||
RPC_path.(custom_root / "time_between_slots")
|
RPC_path.(custom_root / "time_between_slots")
|
||||||
|
|
||||||
let first_free_baking_slot =
|
let first_free_baking_slot =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "First free baking slot"
|
~description: "First free baking slot"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: uint16
|
||||||
~output: (obj1 (req "first_free_baking_slot" uint16))
|
|
||||||
RPC_path.(custom_root / "first_free_baking_slot")
|
RPC_path.(custom_root / "first_free_baking_slot")
|
||||||
|
|
||||||
let endorsers_per_block =
|
let endorsers_per_block =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Max signing slot"
|
~description: "Max signing slot"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: uint16
|
||||||
~output: (obj1 (req "endorsers_per_block" uint16))
|
|
||||||
RPC_path.(custom_root / "endorsers_per_block")
|
RPC_path.(custom_root / "endorsers_per_block")
|
||||||
|
|
||||||
let hard_gas_limits =
|
let hard_gas_limits =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Hard maximum amount of gas per operation and per block"
|
~description: "Hard maximum amount of gas per operation and per block"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
|
||||||
~output: (obj2 (req "per_block" z) (req "per_operation" z))
|
~output: (obj2 (req "per_block" z) (req "per_operation" z))
|
||||||
RPC_path.(custom_root / "hard_gas_limits")
|
RPC_path.(custom_root / "hard_gas_limits")
|
||||||
|
|
||||||
let hard_storage_limits =
|
let hard_storage_limits =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Hard maximum amount of bytes stored per operation and per block"
|
~description: "Hard maximum amount of bytes stored per operation and per block"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
|
||||||
~output: (obj2 (req "per_block" int64) (req "per_operation" int64))
|
~output: (obj2 (req "per_block" int64) (req "per_operation" int64))
|
||||||
RPC_path.(custom_root / "hard_storage_limits")
|
RPC_path.(custom_root / "hard_storage_limits")
|
||||||
|
|
||||||
let cost_per_byte =
|
let cost_per_byte =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "The cost per bytes added to the storage"
|
~description: "The cost per bytes added to the storage"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
|
||||||
~output: (obj1 (req "cost_per_byte" Tez.encoding))
|
~output: (obj1 (req "cost_per_byte" Tez.encoding))
|
||||||
RPC_path.(custom_root / "cost_per_byte")
|
RPC_path.(custom_root / "cost_per_byte")
|
||||||
|
|
||||||
let proof_of_work_threshold =
|
let proof_of_work_threshold =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Stamp threshold"
|
~description: "Stamp threshold"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: int64
|
||||||
~output: (obj1 (req "proof_of_work_threshold" int64))
|
|
||||||
RPC_path.(custom_root / "proof_of_work_threshold")
|
RPC_path.(custom_root / "proof_of_work_threshold")
|
||||||
|
|
||||||
let seed_nonce_revelation_tip =
|
let seed_nonce_revelation_tip =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "seed_nonce_revelation_tip"
|
~description: "seed_nonce_revelation_tip"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: Tez.encoding
|
||||||
~output: (obj1 (req "seed_nonce_revelation_tip" Tez.encoding))
|
|
||||||
RPC_path.(custom_root / "seed_nonce_revelation_tip")
|
RPC_path.(custom_root / "seed_nonce_revelation_tip")
|
||||||
|
|
||||||
let origination_burn =
|
let origination_burn =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "origination_burn"
|
~description: "origination_burn"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: Tez.encoding
|
||||||
~output: (obj1 (req "origination_burn" Tez.encoding))
|
|
||||||
RPC_path.(custom_root / "origination_burn")
|
RPC_path.(custom_root / "origination_burn")
|
||||||
|
|
||||||
let block_security_deposit =
|
let block_security_deposit =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "block_security_deposit"
|
~description: "block_security_deposit"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: Tez.encoding
|
||||||
~output: (obj1 (req "block_security_deposit" Tez.encoding))
|
|
||||||
RPC_path.(custom_root / "block_security_deposit")
|
RPC_path.(custom_root / "block_security_deposit")
|
||||||
|
|
||||||
let endorsement_security_deposit =
|
let endorsement_security_deposit =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "endorsement_security_deposit"
|
~description: "endorsement_security_deposit"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: Tez.encoding
|
||||||
~output: (obj1 (req "endorsement_security_deposit" Tez.encoding))
|
|
||||||
RPC_path.(custom_root / "endorsement_security_deposit")
|
RPC_path.(custom_root / "endorsement_security_deposit")
|
||||||
|
|
||||||
let block_reward =
|
let block_reward =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "block_reward"
|
~description: "block_reward"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: Tez.encoding
|
||||||
~output: (obj1 (req "block_reward" Tez.encoding))
|
|
||||||
RPC_path.(custom_root / "block_reward")
|
RPC_path.(custom_root / "block_reward")
|
||||||
|
|
||||||
let endorsement_reward =
|
let endorsement_reward =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "endorsement_reward"
|
~description: "endorsement_reward"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: Tez.encoding
|
||||||
~output: (obj1 (req "endorsement_reward" Tez.encoding))
|
|
||||||
RPC_path.(custom_root / "endorsement_reward")
|
RPC_path.(custom_root / "endorsement_reward")
|
||||||
|
|
||||||
let errors =
|
let errors =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Schema for all the RPC errors from this protocol version"
|
~description: "Schema for all the RPC errors from this protocol version"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
|
||||||
~output: json_schema
|
~output: json_schema
|
||||||
RPC_path.(custom_root / "errors")
|
RPC_path.(custom_root / "errors")
|
||||||
|
|
||||||
let all =
|
let all =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "All constants"
|
~description: "All constants"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
|
||||||
~output: Alpha_context.Constants.encoding
|
~output: Alpha_context.Constants.encoding
|
||||||
custom_root
|
custom_root
|
||||||
|
|
||||||
|
@ -47,93 +47,82 @@ module S = struct
|
|||||||
open Data_encoding
|
open Data_encoding
|
||||||
|
|
||||||
let balance =
|
let balance =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Access the balance of a contract."
|
~description: "Access the balance of a contract."
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: Tez.encoding
|
||||||
~output: (obj1 (req "balance" Tez.encoding))
|
|
||||||
RPC_path.(custom_root /: Contract.arg / "balance")
|
RPC_path.(custom_root /: Contract.arg / "balance")
|
||||||
|
|
||||||
let manager =
|
let manager =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Access the manager of a contract."
|
~description: "Access the manager of a contract."
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: Signature.Public_key_hash.encoding
|
||||||
~output: (obj1 (req "manager" Signature.Public_key_hash.encoding))
|
|
||||||
RPC_path.(custom_root /: Contract.arg / "manager")
|
RPC_path.(custom_root /: Contract.arg / "manager")
|
||||||
|
|
||||||
let manager_key =
|
let manager_key =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Access the manager of a contract."
|
~description: "Access the manager of a contract."
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
|
||||||
~output: (obj2
|
~output: (obj2
|
||||||
(req "manager" Signature.Public_key_hash.encoding)
|
(req "manager" Signature.Public_key_hash.encoding)
|
||||||
(opt "key" Signature.Public_key.encoding))
|
(opt "key" Signature.Public_key.encoding))
|
||||||
RPC_path.(custom_root /: Contract.arg / "manager_key")
|
RPC_path.(custom_root /: Contract.arg / "manager_key")
|
||||||
|
|
||||||
let delegate =
|
let delegate =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Access the delegate of a contract, if any."
|
~description: "Access the delegate of a contract, if any."
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: Signature.Public_key_hash.encoding
|
||||||
~output: (obj1 (req "delegate" Signature.Public_key_hash.encoding))
|
|
||||||
RPC_path.(custom_root /: Contract.arg / "delegate")
|
RPC_path.(custom_root /: Contract.arg / "delegate")
|
||||||
|
|
||||||
let counter =
|
let counter =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Access the counter of a contract, if any."
|
~description: "Access the counter of a contract, if any."
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: int32
|
||||||
~output: (obj1 (req "counter" int32))
|
|
||||||
RPC_path.(custom_root /: Contract.arg / "counter")
|
RPC_path.(custom_root /: Contract.arg / "counter")
|
||||||
|
|
||||||
let spendable =
|
let spendable =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Tells if the contract tokens can be spent by the manager."
|
~description: "Tells if the contract tokens can be spent by the manager."
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: bool
|
||||||
~output: (obj1 (req "spendable" bool))
|
|
||||||
RPC_path.(custom_root /: Contract.arg / "spendable")
|
RPC_path.(custom_root /: Contract.arg / "spendable")
|
||||||
|
|
||||||
let delegatable =
|
let delegatable =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Tells if the contract delegate can be changed."
|
~description: "Tells if the contract delegate can be changed."
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~output: bool
|
||||||
~output: (obj1 (req "delegatable" bool))
|
|
||||||
RPC_path.(custom_root /: Contract.arg / "delegatable")
|
RPC_path.(custom_root /: Contract.arg / "delegatable")
|
||||||
|
|
||||||
let script =
|
let script =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Access the code and data of the contract."
|
~description: "Access the code and data of the contract."
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
|
||||||
~output: Script.encoding
|
~output: Script.encoding
|
||||||
RPC_path.(custom_root /: Contract.arg / "script")
|
RPC_path.(custom_root /: Contract.arg / "script")
|
||||||
|
|
||||||
let storage =
|
let storage =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Access the data of the contract."
|
~description: "Access the data of the contract."
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
|
||||||
~output: Script.expr_encoding
|
~output: Script.expr_encoding
|
||||||
RPC_path.(custom_root /: Contract.arg / "storage")
|
RPC_path.(custom_root /: Contract.arg / "storage")
|
||||||
|
|
||||||
let info =
|
let info =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description: "Access the complete status of a contract."
|
~description: "Access the complete status of a contract."
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
|
||||||
~output: info_encoding
|
~output: info_encoding
|
||||||
RPC_path.(custom_root /: Contract.arg)
|
RPC_path.(custom_root /: Contract.arg)
|
||||||
|
|
||||||
let list =
|
let list =
|
||||||
RPC_service.post_service
|
RPC_service.get_service
|
||||||
~description:
|
~description:
|
||||||
"All existing contracts (including non-empty default contracts)."
|
"All existing contracts (including non-empty default contracts)."
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
|
||||||
~output: (list Contract.encoding)
|
~output: (list Contract.encoding)
|
||||||
custom_root
|
custom_root
|
||||||
|
|
||||||
@ -247,4 +236,3 @@ let storage ctxt block contract =
|
|||||||
|
|
||||||
let storage_opt ctxt block contract =
|
let storage_opt ctxt block contract =
|
||||||
RPC_context.make_opt_call1 S.storage ctxt block contract () ()
|
RPC_context.make_opt_call1 S.storage ctxt block contract () ()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user