Skip to content

Commit

Permalink
Merge branch 'main' into params
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy authored Aug 10, 2024
2 parents 83fe68b + dcdb8bf commit 21302f4
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 15 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ devtools:
go install mvdan.cc/gofumpt@latest
go install github.com/rakyll/statik@v0.1.7
go install github.com/pacviewer/jrpc-gateway/protoc-gen-jrpc-gateway@v0.3.2
go install github.com/pacviewer/jrpc-gateway/protoc-gen-jrpc-doc/cmd/protoc-gen-jrpc-doc@v0.1.7

########################################
### Building
Expand Down
4 changes: 2 additions & 2 deletions cmd/gtk/startup_assistant.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ func startupAssistant(workingDir string, chainType genesis.ChainType) bool {
fatalErrorCheck(err)
setMargin(listBox, 5, 5, 1, 1)
listBox.SetHAlign(gtk.ALIGN_CENTER)
listBox.SetSizeRequest(600, -1)
listBox.SetSizeRequest(700, -1)

ssDLBtn, err := gtk.ButtonNewWithLabel("⏬ Download")
fatalErrorCheck(err)
setMargin(ssDLBtn, 10, 5, 1, 1)
ssDLBtn.SetHAlign(gtk.ALIGN_CENTER)
ssDLBtn.SetSizeRequest(600, -1)
ssDLBtn.SetSizeRequest(700, -1)

ssPBLabel, err := gtk.LabelNew("")
fatalErrorCheck(err)
Expand Down
52 changes: 51 additions & 1 deletion www/grpc/buf/json-rpc-md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,57 @@ All the amounts and values in gRPC endpoints are in NanoPAC units,
which are atomic and the smallest unit in the Pactus blockchain.
Each PAC is equivalent to 1,000,000,000 or 10<sup>9</sup> NanoPACs.

<h2>JSON-RPC Services</h2>
## Example

To call JSON-RPC methods, you need to create the JSON-RPC request:

```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "pactus.network.get_node_info",
"params": {}
}
```

> Make sure you always add the `params` field, even if no parameters are needed, and ensure you use curly braces.

Then you use the `curl` command to send the request to the node:

```bash
curl --location 'http://localhost:8545/' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "pactus.network.get_node_info",
"params": {}
}'
```

> Before sending the request, you need to enable the JSON-RPC service inside the
> [configuration](/get-started/configuration/).

### Using Basic Auth

If you have enabled the [gRPC Basic Authentication](/tutorials/grpc-sign-transactions/),
then you need to set the `Authorization` header.

```bash
curl --location 'http://localhost:8545/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <BASIC-AUTH-TOKEN>' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "pactus.blockchain.get_account",
"params": {
"address": "pc1z2r0fmu8sg2ffa0tgrr08gnefcxl2kq7wvquf8z"
}
}'
```

<h2>JSON-RPC Methods</h2>

<div id="toc-container">
<ul class="">
Expand Down
2 changes: 1 addition & 1 deletion www/grpc/gen/docs/grpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ Message has no fields.
<td class="fw-bold">last_block_time</td>
<td> int64</td>
<td>
The last block time as timestamp
Timestamp of the last block in Unix format
</td>
</tr>
</tbody>
Expand Down
54 changes: 52 additions & 2 deletions www/grpc/gen/docs/json-rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,57 @@ All the amounts and values in gRPC endpoints are in NanoPAC units,
which are atomic and the smallest unit in the Pactus blockchain.
Each PAC is equivalent to 1,000,000,000 or 10<sup>9</sup> NanoPACs.

<h2>JSON-RPC Services</h2>
## Example

To call JSON-RPC methods, you need to create the JSON-RPC request:

```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "pactus.network.get_node_info",
"params": {}
}
```

> Make sure you always add the `params` field, even if no parameters are needed, and ensure you use curly braces.
Then you use the `curl` command to send the request to the node:

```bash
curl --location 'http://localhost:8545/' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "pactus.network.get_node_info",
"params": {}
}'
```

> Before sending the request, you need to enable the JSON-RPC service inside the
> [configuration](/get-started/configuration/).
### Using Basic Auth

If you have enabled the [gRPC Basic Authentication](/tutorials/grpc-sign-transactions/),
then you need to set the `Authorization` header.

```bash
curl --location 'http://localhost:8545/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <BASIC-AUTH-TOKEN>' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "pactus.blockchain.get_account",
"params": {
"address": "pc1z2r0fmu8sg2ffa0tgrr08gnefcxl2kq7wvquf8z"
}
}'
```

<h2>JSON-RPC Methods</h2>

<div id="toc-container">
<ul class="">
Expand Down Expand Up @@ -1403,7 +1453,7 @@ Parameters has no fields.
<td class="fw-bold">last_block_time</td>
<td> numeric</td>
<td>
The last block time as timestamp
Timestamp of the last block in Unix format
</td>
</tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion www/grpc/gen/go/blockchain.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions www/grpc/gen/java/pactus/blockchain/BlockchainOuterClass.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion www/grpc/gen/rust/pactus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ pub struct GetBlockchainInfoResponse {
/// Lowest-height block stored (only present if pruning is enabled)
#[prost(uint32, tag="9")]
pub pruning_height: u32,
/// The last block time as timestamp
/// Timestamp of the last block in Unix format
#[prost(int64, tag="10")]
pub last_block_time: i64,
}
Expand Down
2 changes: 1 addition & 1 deletion www/grpc/swagger-ui/pactus.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@
"lastBlockTime": {
"type": "string",
"format": "int64",
"title": "The last block time as timestamp"
"title": "Timestamp of the last block in Unix format"
}
},
"description": "Message containing the response with general blockchain information."
Expand Down

0 comments on commit 21302f4

Please sign in to comment.