Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
doc: fix gql_api.sh and update graphql_api.md (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
LycrusHamster authored Aug 3, 2020
1 parent 6e7292d commit d977e1f
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 37 deletions.
2 changes: 1 addition & 1 deletion devtools/chain/genesis.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ prevhash = "0x44915be5b6c20b0678cf05fcddbbaa832e25d7e6ac538784cd5c24de00d47472"
name = "asset"
payload = '''
{
"id": "0xf56924db538e77bb5951eb5ff0d02b88983c49c45eea30e8ae3e7234b311436c",
"id": "0xf56924db538e77bb5951eb5ff0d02b88983c49c45eea30e8ae3e7234b311436c",
"name": "MutaToken",
"symbol": "MT",
"supply": 320000011,
Expand Down
8 changes: 5 additions & 3 deletions docs/build/gql_api.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ if [ ! -z "$1" ]; then
endpoint=$1
fi

res_code=$(curl --write-out %{http_code} --silent --output /dev/null \
-X POST -d '{"query":"{\n getBlock(height: \"3\") {\n header {\n height\n preHash\n }\n orderedTxHashes\n }\n}\n"}' \
$endpoint)
#res_code=$(curl --write-out %{http_code} --silent --output /dev/null \
# -X POST -d 'query q{\n getBlock(height:"0x00"){\n hash \n }\n}' \
# $endpoint)

res_code=$(curl $endpoint --write-out %{http_code} --silent --output /dev/null -H 'content-type: application/json' --data-binary '{"operationName":"q","variables":{},"query":"query q {\n getBlock(height: \"0x00\") {\n hash\n }\n}\n"}')

if [ $res_code -ne 200 ]; then
echo "$endpoint GraphQL endpoint request failed"
Expand Down
99 changes: 66 additions & 33 deletions docs/graphql_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ node, and then try open http://127.0.0.1:8000/graphiql in the browser.
* [Block](#block)
* [BlockHeader](#blockheader)
* [Event](#event)
* [ExecResp](#execresp)
* [Proof](#proof)
* [Receipt](#receipt)
* [ReceiptResponse](#receiptresponse)
* [ServiceResponse](#serviceresponse)
* [SignedTransaction](#signedtransaction)
* [Validator](#validator)
* [Inputs](#inputs)
Expand Down Expand Up @@ -52,7 +52,7 @@ node, and then try open http://127.0.0.1:8000/graphiql in the browser.
<tbody>
<tr>
<td colspan="2" valign="top"><strong>getBlock</strong></td>
<td valign="top"><a href="#/graphql_api?id=block">Block</a>!</td>
<td valign="top"><a href="#/graphql_api?id=block">Block</a></td>
<td>

Get the block
Expand All @@ -66,7 +66,7 @@ Get the block
</tr>
<tr>
<td colspan="2" valign="top"><strong>getTransaction</strong></td>
<td valign="top"><a href="#/graphql_api?id=signedtransaction">SignedTransaction</a>!</td>
<td valign="top"><a href="#/graphql_api?id=signedtransaction">SignedTransaction</a></td>
<td>

Get the transaction by hash
Expand All @@ -80,7 +80,7 @@ Get the transaction by hash
</tr>
<tr>
<td colspan="2" valign="top"><strong>getReceipt</strong></td>
<td valign="top"><a href="#/graphql_api?id=receipt">Receipt</a>!</td>
<td valign="top"><a href="#/graphql_api?id=receipt">Receipt</a></td>
<td>

Get the receipt by transaction hash
Expand All @@ -94,7 +94,7 @@ Get the receipt by transaction hash
</tr>
<tr>
<td colspan="2" valign="top"><strong>queryService</strong></td>
<td valign="top"><a href="#/graphql_api?id=execresp">ExecResp</a>!</td>
<td valign="top"><a href="#/graphql_api?id=serviceresponse">ServiceResponse</a>!</td>
<td>

query service
Expand Down Expand Up @@ -226,6 +226,15 @@ The header section of a block

The body section of a block

</td>
</tr>
<tr>
<td colspan="2" valign="top"><strong>hash</strong></td>
<td valign="top"><a href="#/graphql_api?id=hash">Hash</a>!</td>
<td>

Hash of the block

</td>
</tr>
</tbody>
Expand Down Expand Up @@ -273,7 +282,7 @@ The height to which the block has been executed
</td>
</tr>
<tr>
<td colspan="2" valign="top"><strong>preHash</strong></td>
<td colspan="2" valign="top"><strong>prevHash</strong></td>
<td valign="top"><a href="#/graphql_api?id=hash">Hash</a>!</td>
<td>

Expand All @@ -297,6 +306,15 @@ A timestamp that records when the block was created

The merkle root of ordered transactions

</td>
</tr>
<tr>
<td colspan="2" valign="top"><strong>orderSignedTransactionsHash</strong></td>
<td valign="top"><a href="#/graphql_api?id=hash">Hash</a>!</td>
<td>

The hash of ordered signed transactions

</td>
</tr>
<tr>
Expand Down Expand Up @@ -384,35 +402,15 @@ The version of validator is designed for cross chain
<td></td>
</tr>
<tr>
<td colspan="2" valign="top"><strong>data</strong></td>
<td colspan="2" valign="top"><strong>name</strong></td>
<td valign="top"><a href="#/graphql_api?id=string">String</a>!</td>
<td></td>
</tr>
</tbody>
</table>

### ExecResp

<table>
<thead>
<tr>
<th align="left">Field</th>
<th align="right">Argument</th>
<th align="left">Type</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" valign="top"><strong>ret</strong></td>
<td colspan="2" valign="top"><strong>data</strong></td>
<td valign="top"><a href="#/graphql_api?id=string">String</a>!</td>
<td></td>
</tr>
<tr>
<td colspan="2" valign="top"><strong>isError</strong></td>
<td valign="top"><a href="#/graphql_api?id=boolean">Boolean</a>!</td>
<td></td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -526,13 +524,38 @@ The verifier of the block header proved
<td></td>
</tr>
<tr>
<td colspan="2" valign="top"><strong>ret</strong></td>
<td colspan="2" valign="top"><strong>response</strong></td>
<td valign="top"><a href="#/graphql_api?id=serviceresponse">ServiceResponse</a>!</td>
<td></td>
</tr>
</tbody>
</table>

### ServiceResponse

<table>
<thead>
<tr>
<th align="left">Field</th>
<th align="right">Argument</th>
<th align="left">Type</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" valign="top"><strong>code</strong></td>
<td valign="top"><a href="#/graphql_api?id=uint64">Uint64</a>!</td>
<td></td>
</tr>
<tr>
<td colspan="2" valign="top"><strong>succeedData</strong></td>
<td valign="top"><a href="#/graphql_api?id=string">String</a>!</td>
<td></td>
</tr>
<tr>
<td colspan="2" valign="top"><strong>isError</strong></td>
<td valign="top"><a href="#/graphql_api?id=boolean">Boolean</a>!</td>
<td colspan="2" valign="top"><strong>errorMessage</strong></td>
<td valign="top"><a href="#/graphql_api?id=string">String</a>!</td>
<td></td>
</tr>
</tbody>
Expand Down Expand Up @@ -576,6 +599,11 @@ The verifier of the block header proved
<td></td>
</tr>
<tr>
<td colspan="2" valign="top"><strong>sender</strong></td>
<td valign="top"><a href="#/graphql_api?id=address">Address</a>!</td>
<td></td>
</tr>
<tr>
<td colspan="2" valign="top"><strong>serviceName</strong></td>
<td valign="top"><a href="#/graphql_api?id=string">String</a>!</td>
<td></td>
Expand Down Expand Up @@ -623,8 +651,8 @@ Validator address set
</thead>
<tbody>
<tr>
<td colspan="2" valign="top"><strong>address</strong></td>
<td valign="top"><a href="#/graphql_api?id=address">Address</a>!</td>
<td colspan="2" valign="top"><strong>pubkey</strong></td>
<td valign="top"><a href="#/graphql_api?id=bytes">Bytes</a>!</td>
<td></td>
</tr>
<tr>
Expand Down Expand Up @@ -711,6 +739,11 @@ For security and performance reasons, Muta will only deal with trade request ove
<td valign="top"><a href="#/graphql_api?id=string">String</a>!</td>
<td></td>
</tr>
<tr>
<td colspan="2" valign="top"><strong>sender</strong></td>
<td valign="top"><a href="#/graphql_api?id=address">Address</a>!</td>
<td></td>
</tr>
</tbody>
</table>

Expand Down

0 comments on commit d977e1f

Please sign in to comment.