api page example
Signed-off-by: PRavaga <trueravaga@gmail.com>
This commit is contained in:
parent
f073d10264
commit
97edec3841
14 changed files with 191 additions and 20 deletions
4
docs/build/clients/_category_.json
vendored
Normal file
4
docs/build/clients/_category_.json
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"label": "Clients",
|
||||
"position": 3
|
||||
}
|
||||
4
docs/build/clients/daemon-rpc-api/_category_.json
vendored
Normal file
4
docs/build/clients/daemon-rpc-api/_category_.json
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"label": "Dameon RPC API",
|
||||
"position": 1
|
||||
}
|
||||
52
docs/build/clients/daemon-rpc-api/how-to-call-api.md
vendored
Normal file
52
docs/build/clients/daemon-rpc-api/how-to-call-api.md
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# How to call API
|
||||
|
||||
Making API calls to the Zano Daemon and Wallet is easy, below we'll give you an example to help you get started building on Zano.
|
||||
|
||||
### Using Insomnia
|
||||
|
||||
[Insomnia](https://insomnia.rest/) is a program (similar to [postman](https://www.postman.com/)) that helps you design, debug, and test APIs, heres an example API call to the Zano Daemon using Insomnia.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
### Using NodeJS
|
||||
|
||||
Below is an example of the same API call using NodeJS:
|
||||
|
||||
```javascript
|
||||
const axios = require("axios");
|
||||
|
||||
async function callAPI() {
|
||||
try {
|
||||
const url = "http://127.0.0.1:11211/json_rpc";
|
||||
const requestData = {
|
||||
jsonrpc: "2.0",
|
||||
id: 0,
|
||||
method: "getbalance",
|
||||
};
|
||||
|
||||
const response = await axios.post(url, requestData);
|
||||
console.log(response.data);
|
||||
// Process the response data as needed
|
||||
} catch (error) {
|
||||
console.error("Error:", error.message);
|
||||
}
|
||||
}
|
||||
|
||||
callAPI();
|
||||
```
|
||||
|
||||
### Summary
|
||||
|
||||
When running the Daemon and Wallet in RPC mode locally, the following URL, whether using something like Insomnia or NodeJS or some other language, you access the daemon with the following URL:
|
||||
|
||||
```
|
||||
http://127.0.0.1:11211/json_rpc
|
||||
```
|
||||
|
||||
Have fun building on Zano!
|
||||
4
docs/build/clients/daemon-rpc-api/methods/_category_.json
vendored
Normal file
4
docs/build/clients/daemon-rpc-api/methods/_category_.json
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"label": "HTTP Methods",
|
||||
"position": 3
|
||||
}
|
||||
28
docs/build/clients/daemon-rpc-api/methods/getblockcount.md
vendored
Normal file
28
docs/build/clients/daemon-rpc-api/methods/getblockcount.md
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
### Request
|
||||
|
||||
```json
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 0,
|
||||
"method": "getblockcount"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 0,
|
||||
"jsonrpc": "2.0",
|
||||
"result": {
|
||||
"count": 2114936,
|
||||
"status": "OK"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Response information
|
||||
|
||||
- count - unsigned integer; total number of blocks in the blockchain, including genesis block at height zero.
|
||||
76
docs/build/clients/daemon-rpc-api/overview.md
vendored
Normal file
76
docs/build/clients/daemon-rpc-api/overview.md
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Overview
|
||||
|
||||
Welcome to the Zano API documentation! As a digital currency enthusiast, developer, or end user, we know how important it is for you to have a clear, comprehensive guide to our API. That's why we've designed our documentation to be as accessible and easy to understand as possible.
|
||||
|
||||
Our aim with this documentation is to help you harness the full potential of Zano's feature-rich platform, allowing you to integrate, innovate, and build on top of Zano's powerful privacy-oriented blockchain.
|
||||
|
||||
Read more on the JSON-RPC 2.0 Specification [HERE](https://www.jsonrpc.org/specification)
|
||||
|
||||
## Formatting example
|
||||
|
||||
Each API endpoint will have an example of the required JSON body to be sent with the POST request, an example response and additional information such as types and additional information regarding the parameters sent and received when necessary.
|
||||
|
||||
Additionally, endpoints will be grouped according to whether they call the Daemon or the wallet as well as the scope in which they function such as Marketplace, confidential assets, contracts etc.
|
||||
|
||||
### Request
|
||||
|
||||
```json
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 0,
|
||||
"method": "getbalance"
|
||||
}
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 0,
|
||||
"jsonrpc": "2.0",
|
||||
"result": {
|
||||
"balance": 50000000033,
|
||||
"unlocked_balance": 50000000033
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Running Daemon and Wallet in RPC mode
|
||||
|
||||
In order to send JSON requests, both the Zano Daemon and Wallet must be ran in RPC mode, for additional info on how to do this, for wallet visit [Here](https://docs.zano.org/docs/json-rpc-busy-response-2), and for the Daemon visit [Here](https://docs.zano.org/docs/how-to-connect-daemon-rpc-api). But we'll give a quick HOWTO below:
|
||||
|
||||
> 🚧 All examples below are based on the assumption that the daemon is listening for RPC at 127.0.0.1:11211
|
||||
|
||||
### How to run Daemon in RPC mode
|
||||
|
||||
> 📘 In order to interact with the Marketplace API, you must include the following flag: '--enable-offers-service'
|
||||
|
||||
```Text console
|
||||
./zanod --rpc-bind-ip 127.0.0.1 --rpc-bind-port 11211 --enable-offers-service
|
||||
```
|
||||
|
||||
### Daemon flags
|
||||
|
||||
- rpc-bind-ip — IP address to bind RPC server to (127.0.0.1 will be used if not specified);
|
||||
- rpc-bind-port — TCP port for RPC server (11211 is default);
|
||||
|
||||
---
|
||||
|
||||
### How to run Wallet in RPC mode
|
||||
|
||||
```Text console
|
||||
./simplewallet --wallet-file example.wallet --password password --rpc-bind-ip 127.0.0.1 --rpc-bind-port 11212 --daemon-address 127.0.0.1:11211
|
||||
```
|
||||
|
||||
### Daemon flags
|
||||
|
||||
- wallet-file - name of wallet file to use
|
||||
- password - wallets password
|
||||
- rpc-bind-port - TCP port for wallet RPC server
|
||||
- rpc-bind-ip - IP and PORT of the daemon
|
||||
4
docs/build/get-started/_category_.json
vendored
Normal file
4
docs/build/get-started/_category_.json
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"label": "Get Started",
|
||||
"position": 2
|
||||
}
|
||||
1
docs/build/get-started/overview.md
vendored
Normal file
1
docs/build/get-started/overview.md
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Overview
|
||||
5
docs/build/overview.md
vendored
Normal file
5
docs/build/overview.md
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Overview
|
||||
1
docs/mine/overview.md
Normal file
1
docs/mine/overview.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Mine overview
|
||||
1
docs/stake/overview.md
Normal file
1
docs/stake/overview.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Stake overview
|
||||
31
sidebars.js
31
sidebars.js
|
|
@ -1,42 +1,33 @@
|
|||
const sidebars = {
|
||||
learnSidebar: [
|
||||
"learn/intro",
|
||||
{
|
||||
type: "category",
|
||||
label: "Introduction",
|
||||
items: ["learn/introduction/what-is-zano"],
|
||||
type: "autogenerated",
|
||||
dirName: "learn",
|
||||
},
|
||||
],
|
||||
useSidebar: [
|
||||
"use/intro",
|
||||
{
|
||||
type: "category",
|
||||
label: "Getting Started",
|
||||
items: ["use/getting-started/wallet-setup"],
|
||||
type: "autogenerated",
|
||||
dirName: "use",
|
||||
},
|
||||
],
|
||||
buildSidebar: [
|
||||
"learn/intro",
|
||||
{
|
||||
type: "category",
|
||||
label: "Introduction",
|
||||
items: ["learn/introduction/what-is-zano"],
|
||||
type: "autogenerated",
|
||||
dirName: "build",
|
||||
},
|
||||
],
|
||||
|
||||
mineSidebar: [
|
||||
"learn/intro",
|
||||
{
|
||||
type: "category",
|
||||
label: "Introduction",
|
||||
items: ["learn/introduction/what-is-zano"],
|
||||
type: "autogenerated",
|
||||
dirName: "mine",
|
||||
},
|
||||
],
|
||||
stakeSidebar: [
|
||||
"learn/intro",
|
||||
{
|
||||
type: "category",
|
||||
label: "Introduction",
|
||||
items: ["learn/introduction/what-is-zano"],
|
||||
type: "autogenerated",
|
||||
dirName: "stake",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue