[−][src]Module exonum_testkit::server
Types used by the testkit server.
The server may be created via serve
method in TestKitBuilder
. Testkit-specific
server endpoints are documented below. Other endpoints exposed by the server are the same
as for an Exonum node or TestKitApi
; that is, the server exposes HTTP API of Exonum
services and node plugins.
HTTP endpoints
All endpoints are served on the private HTTP server, which listens on the second
address passed to TestKitBuilder::serve()
.
Testkit status
Property | Value |
---|---|
Path | /api/testkit/v1/status |
Method | GET |
Query type | - |
Return type | TestKitStatus |
Outputs the status of the testkit, which includes:
- Current blockchain height
- Current test network configuration
Create block
Property | Value |
---|---|
Path | /api/testkit/v1/blocks/create |
Method | POST |
Body type | CreateBlock |
Return type | BlockWithTransactions |
Creates a new block in the testkit blockchain. If the
JSON body of the request is an empty object, the call is functionally equivalent
to create_block
. Otherwise, if the body has the tx_hashes
field specifying an array
of transaction hashes, the call is equivalent to create_block_with_tx_hashes
supplied
with these hashes.
Returns the latest block from the blockchain on success.
Roll back
Property | Value |
---|---|
Path | /api/testkit/v1/blocks/rollback |
Method | POST |
Body type | Height |
Return type | BlockWithTransactions |
Acts as a rough rollback
equivalent. The blocks are rolled back up and including the block
at the specified in JSON body height
value (a positive integer), so that after the request
the blockchain height is equal to height - 1
. If the specified height is greater than the
blockchain height, the request performs no action.
Returns the latest block from the blockchain on success.
Structs
CreateBlock | Block creation parameters for the testkit server. |
TestKitStatus | Testkit status, returned by the corresponding API endpoint. |