Tomochain JSON-RPC v1.0.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
A collection holding all the Tomochain JSON-RPC API calls Swagger Docs
Base URLs:
web3
API for web3 request
clientRequest
Code samples
curl --request POST \
--url https://rpc.tomochain.com//clientVersion \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//clientVersion",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'web3_clientVersion', params: [], id: 1}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//clientVersion"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"web3_clientVersion\",\"params\":[],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//clientVersion")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"web3_clientVersion\",\"params\":[],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"web3_clientVersion\",\"params\":[],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//clientVersion", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//clientVersion")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"web3_clientVersion\",\"params\":[],\"id\":1}")
.asString();
POST /clientVersion
Returns the current client version.
Parameters
none
Returns
String
- The current client version
Body parameter
{
"jsonrpc": "2.0",
"method": "web3_clientVersion",
"params": [],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | clientVersionRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
sha3Request
Code samples
curl --request POST \
--url https://rpc.tomochain.com//sha3 \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"web3_sha3","params":["0x68656c6c6f20776f726c64"],"id":64}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//sha3",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'web3_sha3',
params: ['0x68656c6c6f20776f726c64'],
id: 64
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//sha3"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"web3_sha3\",\"params\":[\"0x68656c6c6f20776f726c64\"],\"id\":64}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//sha3")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"web3_sha3\",\"params\":[\"0x68656c6c6f20776f726c64\"],\"id\":64}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"web3_sha3\",\"params\":[\"0x68656c6c6f20776f726c64\"],\"id\":64}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//sha3", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//sha3")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"web3_sha3\",\"params\":[\"0x68656c6c6f20776f726c64\"],\"id\":64}")
.asString();
POST /sha3
Returns Keccak-256 (not the standardized SHA3-256) of the given data.
Parameters
DATA
- the data to convert into a SHA3 hash
params: [ "0x68656c6c6f20776f726c64" ]
Returns
DATA
- The SHA3 result of the given string.
Body parameter
{
"jsonrpc": "2.0",
"method": "web3_sha3",
"params": [
"0x68656c6c6f20776f726c64"
],
"id": 64
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | sha3request | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
net
API for network request
versionRequest
Code samples
curl --request POST \
--url https://rpc.tomochain.com//version \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//version",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'net_version', params: [], id: 67}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//version"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"net_version\",\"params\":[],\"id\":67}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//version")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"net_version\",\"params\":[],\"id\":67}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"net_version\",\"params\":[],\"id\":67}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//version", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//version")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"net_version\",\"params\":[],\"id\":67}")
.asString();
POST /version
Returns the current network id.
Parameters
none
Returns
-
String
- The current network id.-
"88"
: Tomochain Mainnet -
"89"
: Tomochain Testnet
-
Body parameter
{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 67
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | versionrequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
listeningRequest
Code samples
curl --request POST \
--url https://rpc.tomochain.com//listening \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":67}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//listening",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'net_listening', params: [], id: 67}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//listening"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"net_listening\",\"params\":[],\"id\":67}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//listening")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"net_listening\",\"params\":[],\"id\":67}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"net_listening\",\"params\":[],\"id\":67}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//listening", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//listening")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"net_listening\",\"params\":[],\"id\":67}")
.asString();
POST /listening
Returns true
if client is actively listening for network connections.
Parameters
none
Returns
Boolean
-true
when listening, otherwisefalse
.
Body parameter
{
"jsonrpc": "2.0",
"method": "net_listening",
"params": [],
"id": 67
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | listeningrequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
peerCountRequest
Code samples
curl --request POST \
--url https://rpc.tomochain.com//peerCount \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":74}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//peerCount",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'net_peerCount', params: [], id: 74}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//peerCount"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"net_peerCount\",\"params\":[],\"id\":74}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//peerCount")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"net_peerCount\",\"params\":[],\"id\":74}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"net_peerCount\",\"params\":[],\"id\":74}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//peerCount", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//peerCount")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"net_peerCount\",\"params\":[],\"id\":74}")
.asString();
POST /peerCount
Returns number of peers currently connected to the client.
Parameters
none
Returns
QUANTITY
- integer of the number of connected peers.
Body parameter
{
"jsonrpc": "2.0",
"method": "net_peerCount",
"params": [],
"id": 74
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | peerCountRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
eth
API for eth information
protocolVersionRequest
Code samples
curl --request POST \
--url https://rpc.tomochain.com//protocolVersion \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_protocolVersion","params":[],"id":67}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//protocolVersion",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'eth_protocolVersion', params: [], id: 67}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//protocolVersion"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_protocolVersion\",\"params\":[],\"id\":67}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//protocolVersion")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_protocolVersion\",\"params\":[],\"id\":67}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_protocolVersion\",\"params\":[],\"id\":67}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//protocolVersion", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//protocolVersion")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_protocolVersion\",\"params\":[],\"id\":67}")
.asString();
POST /protocolVersion
Returns the current ethereum protocol version.
Parameters
none
Returns
String
- The current ethereum protocol version
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_protocolVersion",
"params": [],
"id": 67
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | protocolVersionRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
syncingrequest
Code samples
curl --request POST \
--url https://rpc.tomochain.com//syncing \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//syncing",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'eth_syncing', params: [], id: 1}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//syncing"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_syncing\",\"params\":[],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//syncing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_syncing\",\"params\":[],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_syncing\",\"params\":[],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//syncing", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//syncing")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_syncing\",\"params\":[],\"id\":1}")
.asString();
POST /syncing
Returns an object with data about the sync status or false.
Parameters
none
Returns
-
Object|Boolean
, An object with sync status data or FALSE, when not syncing:-
startingBlock
:QUANTITY
- The block at which the import started (will only be reset, after the sync reached his head) -
currentBlock
:QUANTITY
- The current block, same as eth_blockNumber -
highestBlock
:QUANTITY
- The estimated highest block
-
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_syncing",
"params": [],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | syncingrequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
coinbase
Code samples
curl --request POST \
--url https://rpc.tomochain.com//coinbase \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_coinbase","params":[],"id":64}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//coinbase",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'eth_coinbase', params: [], id: 64}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//coinbase"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_coinbase\",\"params\":[],\"id\":64}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//coinbase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_coinbase\",\"params\":[],\"id\":64}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_coinbase\",\"params\":[],\"id\":64}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//coinbase", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//coinbase")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_coinbase\",\"params\":[],\"id\":64}")
.asString();
POST /coinbase
Returns the client coinbase address. Parameters none Returns
DATA
, 20 bytes - the current coinbase address.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_coinbase",
"params": [],
"id": 64
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | coinbaserequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful operation | None |
500 | Internal Server Error | Internal Server Error | None |
gasPrice
Code samples
curl --request POST \
--url https://rpc.tomochain.com//gasPrice \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":73}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//gasPrice",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'eth_gasPrice', params: [], id: 73}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//gasPrice"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":73}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//gasPrice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":73}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":73}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//gasPrice", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//gasPrice")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":73}")
.asString();
POST /gasPrice
Returns the current price per gas in wei. Parameters none Returns
QUANTITY
- integer of the current gas price in wei.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 73
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | gasPriceRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful operation | None |
500 | Internal Server Error | Internal Server Error | None |
accounts
Code samples
curl --request POST \
--url https://rpc.tomochain.com//accounts \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//accounts",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'eth_accounts', params: [], id: 1}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//accounts"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_accounts\",\"params\":[],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_accounts\",\"params\":[],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_accounts\",\"params\":[],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//accounts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//accounts")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_accounts\",\"params\":[],\"id\":1}")
.asString();
POST /accounts
Returns a list of addresses owned by client.
Parameters
none
Returns
Array of DATA
, 20 Bytes - addresses owned by the client
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_accounts",
"params": [],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | accountsrequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful operation | None |
500 | Internal Server Error | Internal Server Error | None |
blockNumber
Code samples
curl --request POST \
--url https://rpc.tomochain.com//blockNumber \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//blockNumber",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'eth_blockNumber', params: [], id: 83}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//blockNumber"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":83}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//blockNumber")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":83}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":83}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//blockNumber", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//blockNumber")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":83}")
.asString();
POST /blockNumber
Returns the number of most recent block. Parameters none Returns
QUANTITY
- integer of the current block number the client is on.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 83
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | blockNumberRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBalance
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBalance \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x2b5634c42055806a59e9107ed44d43c426e58258","latest"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBalance",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getBalance',
params: ['0x2b5634c42055806a59e9107ed44d43c426e58258', 'latest'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBalance"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"0x2b5634c42055806a59e9107ed44d43c426e58258\",\"latest\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBalance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"0x2b5634c42055806a59e9107ed44d43c426e58258\",\"latest\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"0x2b5634c42055806a59e9107ed44d43c426e58258\",\"latest\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBalance", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBalance")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"0x2b5634c42055806a59e9107ed44d43c426e58258\",\"latest\"],\"id\":1}")
.asString();
POST /getBalance
Returns the balance of the account of given address.
Parameters
DATA
, 20 Bytes - address to check for balance.QUANTITY|TAG
- integer block number, or the string "latest", "earliest" or "pending", see the default block parameter
params: [ ' 0x2b5634c42055806a59e9107ed44d43c426e58258', 'latest' ]
Returns
QUANTITY
- integer of the current balance in wei.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": [
"0x2b5634c42055806a59e9107ed44d43c426e58258",
"latest"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBalanceRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful operation | None |
500 | Internal Server Error | Internal Server Error | None |
getStorageAt
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getStorageAt \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getStorageAt","params":["0x295a70b2de5e3953354a6a8344e616ed314d7251","0x0","latest"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getStorageAt",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getStorageAt',
params: ['0x295a70b2de5e3953354a6a8344e616ed314d7251', '0x0', 'latest'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getStorageAt"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getStorageAt\",\"params\":[\"0x295a70b2de5e3953354a6a8344e616ed314d7251\",\"0x0\",\"latest\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getStorageAt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getStorageAt\",\"params\":[\"0x295a70b2de5e3953354a6a8344e616ed314d7251\",\"0x0\",\"latest\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getStorageAt\",\"params\":[\"0x295a70b2de5e3953354a6a8344e616ed314d7251\",\"0x0\",\"latest\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getStorageAt", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getStorageAt")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getStorageAt\",\"params\":[\"0x295a70b2de5e3953354a6a8344e616ed314d7251\",\"0x0\",\"latest\"],\"id\":1}")
.asString();
POST /getStorageAt
Returns the balance of the account of given address.
Parameters
-
DATA
, 20 Bytes - address to check for balance. -
QUANTITY|TAG
- integer block number, or the string "latest", "earliest" or "pending", see the default block parameter
params: [ '0x2b5634c42055806a59e9107ed44d43c426e58258', 'latest' ]
Returns
QUANTITY
- integer of the current balance in wei.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getStorageAt",
"params": [
"0x295a70b2de5e3953354a6a8344e616ed314d7251",
"0x0",
"latest"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getStorageAtRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getTransactionCount
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getTransactionCount \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xbf1dcb735e512b731abd3404c15df6431bd03d42","latest"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getTransactionCount",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getTransactionCount',
params: ['0xbf1dcb735e512b731abd3404c15df6431bd03d42', 'latest'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getTransactionCount"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionCount\",\"params\":[\"0xbf1dcb735e512b731abd3404c15df6431bd03d42\",\"latest\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getTransactionCount")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionCount\",\"params\":[\"0xbf1dcb735e512b731abd3404c15df6431bd03d42\",\"latest\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionCount\",\"params\":[\"0xbf1dcb735e512b731abd3404c15df6431bd03d42\",\"latest\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getTransactionCount", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getTransactionCount")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionCount\",\"params\":[\"0xbf1dcb735e512b731abd3404c15df6431bd03d42\",\"latest\"],\"id\":1}")
.asString();
POST /getTransactionCount
Returns the number of transactions sent from an address.
Parameters
DATA
, 20 Bytes - address.QUANTITY|TAG
- integer block number, or the string"latest"
,"earliest"
or"pending"
, see the default block parameter
params: [ '0x407d73d8a49eeb85d32cf465507dd71d507100c1', 'latest' // state at the latest block ]
Returns
QUANTITY
- integer of the number of transactions send from this address.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": [
"0xbf1dcb735e512b731abd3404c15df6431bd03d42",
"latest"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getTransactionCountRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBlockTransactionCountByHash
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBlockTransactionCountByHash \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params":["0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBlockTransactionCountByHash",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getBlockTransactionCountByHash',
params: ['0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBlockTransactionCountByHash"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByHash\",\"params\":[\"0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBlockTransactionCountByHash")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByHash\",\"params\":[\"0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByHash\",\"params\":[\"0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBlockTransactionCountByHash", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBlockTransactionCountByHash")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByHash\",\"params\":[\"0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34\"],\"id\":1}")
.asString();
POST /getBlockTransactionCountByHash
Returns the number of transactions in a block from a block matching the given block hash.
Parameters
DATA
, 32 Bytes - hash of a block
params: [ '0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34' ]
Returns
QUANTITY
- integer of the number of transactions in this block.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBlockTransactionCountByHashRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBlockTransactionCountByNumber
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBlockTransactionCountByNumber \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params":["0x52A8CA"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBlockTransactionCountByNumber",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getBlockTransactionCountByNumber',
params: ['0x52A8CA'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBlockTransactionCountByNumber"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByNumber\",\"params\":[\"0x52A8CA\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBlockTransactionCountByNumber")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByNumber\",\"params\":[\"0x52A8CA\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByNumber\",\"params\":[\"0x52A8CA\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBlockTransactionCountByNumber", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBlockTransactionCountByNumber")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByNumber\",\"params\":[\"0x52A8CA\"],\"id\":1}")
.asString();
POST /getBlockTransactionCountByNumber
Returns the number of transactions in a block matching the given block number.
Parameters
QUANTITY|TAG
- integer of a block number, or the string"earliest"
,"latest"
or"pending"
, as in the default block parameter.
params: [ '0x85', // 232 ]
Returns
QUANTITY
- integer of the number of transactions in this block.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": [
"0x52A8CA"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBlockTransactionCountByNumberRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getCode
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getCode \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b","0x2"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getCode",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getCode',
params: ['0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b', '0x2'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getCode"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCode\",\"params\":[\"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\",\"0x2\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getCode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCode\",\"params\":[\"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\",\"0x2\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCode\",\"params\":[\"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\",\"0x2\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getCode", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getCode")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCode\",\"params\":[\"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\",\"0x2\"],\"id\":1}")
.asString();
POST /getCode
Returns code at a given address.
Parameters
-
DATA
, 20 Bytes - address -
QUANTITY|TAG
- integer block number, or the string"latest"
,"earliest"
or"pending"
, see the default block parameter
params: [ '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b', '0x2' // 2 ]
Returns
DATA
- the code from the given address.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": [
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"0x2"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getCodeRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful operation | None |
500 | Internal Server Error | Internal Server Error | None |
sign
Code samples
curl --request POST \
--url https://rpc.tomochain.com//sign \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_sign","params":["0x9b2055d370f73ec7d8a03e965129118dc8f5bf83","0xdeadbeaf"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//sign",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_sign',
params: ['0x9b2055d370f73ec7d8a03e965129118dc8f5bf83', '0xdeadbeaf'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//sign"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sign\",\"params\":[\"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83\",\"0xdeadbeaf\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//sign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sign\",\"params\":[\"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83\",\"0xdeadbeaf\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sign\",\"params\":[\"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83\",\"0xdeadbeaf\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//sign", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//sign")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sign\",\"params\":[\"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83\",\"0xdeadbeaf\"],\"id\":1}")
.asString();
POST /sign
The sign method calculates an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))
.
By adding a prefix to the message makes the calculated signature recognisable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.
Note: the address to sign with must be unlocked.
Parameters
-
DATA
, 20 Bytes - address -
DATA
, N Bytes - message to sign
Returns
DATA
: Signature
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_sign",
"params": [
"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83",
"0xdeadbeaf"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | signrequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
sendTransaction
Code samples
curl --request POST \
--url https://rpc.tomochain.com//sendTransaction \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas":"0x76c0","gasPrice":"0x9184e72a000","value":"0x9184e72a","data":"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//sendTransaction",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_sendTransaction',
params: [
{
from: '0xb60e8dd61c5d32be8058bb8eb970870f07233155',
to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
gas: '0x76c0',
gasPrice: '0x9184e72a000',
value: '0x9184e72a',
data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675'
}
],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//sendTransaction"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//sendTransaction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//sendTransaction", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//sendTransaction")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}")
.asString();
POST /sendTransaction
Creates new message call transaction or a contract creation, if the data field contains code.
Parameters
Object
- The transaction object
-
from
:DATA
, 20 Bytes - The address the transaction is send from. -
to
:DATA
, 20 Bytes - (optional when creating new contract) The address the transaction is directed to. -
gas
:QUANTITY
- (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas. -
gasPrice
:QUANTITY
- (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas -
value
:QUANTITY
- (optional) Integer of the value sent with this transaction -
data
:DATA
- The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABI -
nonce
:QUANTITY
- (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.
params: [{ "from": " 0xb60e8dd61c5d32be8058bb8eb970870f07233155", "to": " 0xd46e8dd67c5d32be8058bb8eb970870f07244567", "gas": "0x76c0", // 30400 "gasPrice": "0x9184e72a000", // 10000000000000 "value": "0x9184e72a", // 2441406250 "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675" }]
Returns
DATA
, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.
Use eth_getTransactionReceipt
to get the contract address, after the transaction was mined, when you created a contract.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
"params": [
{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | sendTransactionRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [Param] | true | none |
»» Param | body | Param | false | none |
»»» from | body | string | true | none |
»»» to | body | string | true | none |
»»» gas | body | string | true | none |
»»» gasPrice | body | string | true | none |
»»» value | body | string | true | none |
»»» data | body | string | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
sendRawTransaction
Code samples
curl --request POST \
--url https://rpc.tomochain.com//sendRawTransaction \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//sendRawTransaction",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_sendRawTransaction',
params: [
'0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675'
],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//sendRawTransaction"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendRawTransaction\",\"params\":[\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//sendRawTransaction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendRawTransaction\",\"params\":[\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendRawTransaction\",\"params\":[\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//sendRawTransaction", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//sendRawTransaction")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendRawTransaction\",\"params\":[\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"],\"id\":1}")
.asString();
POST /sendRawTransaction
Creates new message call transaction or a contract creation for signed transactions.
Parameters
DATA
, The signed transaction data.
params: ["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"]
Returns
DATA
, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.
Use eth_getTransactionReceipt
to get the contract address, after the transaction was mined, when you created a contract.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": [
"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | sendRawTransactionRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
call
Code samples
curl --request POST \
--url https://rpc.tomochain.com//call \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_call","params":[{"from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas":"0x76c0","gasPrice":"0x9184e72a000","value":"0x9184e72a","data":"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"},"latest"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//call",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_call',
params: [
{
from: '0xb60e8dd61c5d32be8058bb8eb970870f07233155',
to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
gas: '0x76c0',
gasPrice: '0x9184e72a000',
value: '0x9184e72a',
data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675'
},
'latest'
],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//call"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"},\"latest\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//call")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"},\"latest\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"},\"latest\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//call", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//call")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"},\"latest\"],\"id\":1}")
.asString();
POST /call
Executes a new message call immediately without creating a transaction on the block chain.
Parameters
Object
[required]- The transaction call object
-
from
:DATA
, 20 Bytes - (optional) The address the transaction is sent from. -
to
:DATA
, 20 Bytes - The address the transaction is directed to. -
gas
:QUANTITY
- (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions. -
gasPrice
:QUANTITY
- (optional) Integer of the gasPrice used for each paid gas -
value
:QUANTITY
- (optional) Integer of the value sent with this transaction -
data
:DATA
- (optional) Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI -
QUANTITY|TAG
- integer block number, or the string"latest"
,"earliest"
or"pending"
, see the default block parameter
Returns
DATA
- the return value of executed contract.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
},
"latest"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | callrequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [Param1] | true | none |
»» Param1 | body | Param1 | false | none |
»»» from | body | string | false | none |
»»» to | body | string | false | none |
»»» gas | body | string | false | none |
»»» gasPrice | body | string | false | none |
»»» value | body | string | false | none |
»»» data | body | string | false | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
estimateGas
Code samples
curl --request POST \
--url https://rpc.tomochain.com//estimateGas \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas":"0x76c0","gasPrice":"0x9184e72a000","value":"0x9184e72a","data":"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//estimateGas",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_estimateGas',
params: [
{
from: '0xb60e8dd61c5d32be8058bb8eb970870f07233155',
to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
gas: '0x76c0',
gasPrice: '0x9184e72a000',
value: '0x9184e72a',
data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675'
}
],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//estimateGas"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//estimateGas")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//estimateGas", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//estimateGas")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}")
.asString();
POST /estimateGas
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
Parameters
See eth_call
parameters, expect that all properties are optional. If no gas limit is specified geth uses the block gas limit from the pending block as an upper bound. As a result the returned estimate might not be enough to executed the call/transaction when the amount of gas is higher than the pending block gas limit.
Returns
QUANTITY
- the amount of gas used.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | estimateGasRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBlockByHash
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBlockByHash \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624",true],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBlockByHash",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getBlockByHash',
params: ['0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624', true],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBlockByHash"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByHash\",\"params\":[\"0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624\",true],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBlockByHash")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByHash\",\"params\":[\"0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624\",true],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByHash\",\"params\":[\"0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624\",true],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBlockByHash", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBlockByHash")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByHash\",\"params\":[\"0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624\",true],\"id\":1}")
.asString();
POST /getBlockByHash
Returns information about a block by hash.
Parameters
BLOCKHASH
[required] - a string representing a BLOCKHASHBoolean
[required] - If true it returns the full transaction objects, if false only the hashes of the transactions.params: [ '0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624', true ]
Returns
Object
- A block object, or null when no block was found:
-
number
:QUANTITY
- the block number. null when its pending block. -
hash
:DATA
, 32 Bytes - hash of the block.null
when its pending block. -
parentHash
:DATA
, 32 Bytes - hash of the parent block. -
nonce
:DATA
, 8 Bytes - hash of the generated proof-of-work.null
when its pending block. -
sha3Uncles
:DATA
, 32 Bytes - SHA3 of the uncles data in the block. -
logsBloom
:DATA
, 256 Bytes - the bloom filter for the logs of the block.null
when its pending block. -
transactionsRoot
:DATA
, 32 Bytes - the root of the transaction trie of the block. -
stateRoot
:DATA
, 32 Bytes - the root of the final state trie of the block. -
receiptsRoot
:DATA
, 32 Bytes - the root of the receipts trie of the block. -
miner
:DATA
, 20 Bytes - the address of the beneficiary to whom the mining rewards were given. -
difficulty
:QUANTITY
- integer of the difficulty for this block. -
totalDifficulty
:QUANTITY
- integer of the total difficulty of the chain until this block. -
extraData
:DATA
- the "extra data" field of this block. -
size
:QUANTITY
- integer the size of this block in bytes. -
gasLimit
:QUANTITY
- the maximum gas allowed in this block. -
gasUsed
:QUANTITY
- the total used gas by all transactions in this block. -
timestamp
:QUANTITY
- the unix timestamp for when the block was collated. -
transactions
:Array
- Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter. -
uncles
:Array
- Array of uncle hashes.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": [
"0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624",
true
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBlockByHashRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBlockByNumber
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBlockByNumber \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0",true],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBlockByNumber",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'eth_getBlockByNumber', params: ['0x0', true], id: 1}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBlockByNumber"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"0x0\",true],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBlockByNumber")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"0x0\",true],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"0x0\",true],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBlockByNumber", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBlockByNumber")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"0x0\",true],\"id\":1}")
.asString();
POST /getBlockByNumber
Returns information about a block by block number.
Parameters
BLOCKNUMBER
[required] - a hex code of an integer representing the BLOCKNUMBER or one of the following special params:
-
latest
: get block data of the latest block -
pending
: get block data of pending block -
earliest
: get the genesis block
FULLTX
[required] - a boolean value specified whether you want to get transactions list or not
params: [ '0x0', true ]
Returns
RETURN VALUE
- block data of the givenBLOCKNUMBER
See eth_getBlockByHash
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": [
"0x0",
true
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBlockByNumberRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBlockSignersByNumber
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBlockSignersByNumber \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getBlockSignersByNumber","params":["0xA61F98"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBlockSignersByNumber",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getBlockSignersByNumber',
params: ['0xA61F98'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBlockSignersByNumber"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBlockSignersByNumber")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBlockSignersByNumber", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBlockSignersByNumber")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}")
.asString();
POST /getBlockSignersByNumber
Returns the signers set of the block of given BLOCKNUMBER
.
Parameters
BLOCKNUMBER
[required] - a hex code of an integer representing the BLOCKNUMBER
or one of the following special params:
-
latest
: get block data of the latest block -
pending
: get block data of pending block -
earliest
: get the genesis block
params: [ '0xA61F98' ]
Returns
SIGNERS
- signers set of the block of givenBLOCKNUMBER
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getBlockSignersByNumber",
"params": [
"0xA61F98"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBlockSignersByNumberRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBlockSignersByHash
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBlockSignersByHash \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getBlockSignersByHash","params":["0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBlockSignersByHash",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getBlockSignersByHash',
params: ['0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBlockSignersByHash"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBlockSignersByHash")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBlockSignersByHash", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBlockSignersByHash")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}")
.asString();
POST /getBlockSignersByHash
Returns the signers set of the block of given BLOCKHASH
.
Parameters
BLOCKHASH
[required] - a string representing aBLOCKHASH
params: [ '0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f' ]
Returns
SIGNERS
- signers set of the block of givenBLOCKHASH
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getBlockSignersByHash",
"params": [
"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBlockSignersByHashRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBlockFinalityByNumber
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBlockFinalityByNumber \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getBlockFinalityByNumber","params":["0xA61F98"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBlockFinalityByNumber",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getBlockFinalityByNumber',
params: ['0xA61F98'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBlockFinalityByNumber"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBlockFinalityByNumber")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBlockFinalityByNumber", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBlockFinalityByNumber")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}")
.asString();
POST /getBlockFinalityByNumber
Returns the the finality of the block of given BLOCKNUMBER.
Parameters
-
BLOCKNUMBER
[required] - a hex code of an integer representing theBLOCKNUMBER
or one of the following special params:-
latest
: get block data of the latest block -
pending
: get block data of pending block -
earliest
: get the genesis block
-
params: [ '0xA61F98' ]
Returns
BLOCK_FINALITY
- integer of the the finality of the block of givenBLOCKNUMBER
.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getBlockFinalityByNumber",
"params": [
"0xA61F98"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBlockFinalityByNumberRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBlockFinalityByHash
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBlockFinalityByHash \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getBlockFinalityByHash","params":["0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBlockFinalityByHash",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getBlockFinalityByHash',
params: ['0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBlockFinalityByHash"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBlockFinalityByHash")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBlockFinalityByHash", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBlockFinalityByHash")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}")
.asString();
POST /getBlockFinalityByHash
Returns the the finality of the block of given BLOCKHASH
.
Parameters
BLOCKHASH
[required] - a string representing a BLOCKHASH
params: [ '0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f' ]
Returns
BLOCK_FINALITY
- integer of the the finality of the block of givenBLOCKHASH
.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getBlockFinalityByHash",
"params": [
"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBlockFinalityByHashRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getCandidates
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getCandidates \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getCandidates","params":["latest"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getCandidates",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'eth_getCandidates', params: ['latest'], id: 1}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getCandidates"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidates\",\"params\":[\"latest\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getCandidates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidates\",\"params\":[\"latest\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidates\",\"params\":[\"latest\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getCandidates", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getCandidates")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidates\",\"params\":[\"latest\"],\"id\":1}")
.asString();
POST /getCandidates
Returns the statuses of all candidates at a specific epoch
Parameters
-
EPOCH_NUMBER
[required] - a hex code of an integer representing theEPOCH_NUMBER
or the following special param:latest
: get the status of candidate at the current time
params: [ 'latest' ]
Returns
-
EPOCH
- the epoch number of the query of this request -
CANDIDATES
- list of candidates along with their statuses and capacities-
STATUS
- a string representing status of the corresponding candidate -
MASTERNODE
- if the candidate is a masternode -
SLASHED
- if the candidate is slashed -
PROPOSED
- if the candidate is proposed, have not been a masternode yet -
empty string
- if it's not a candidate
-
-
CAPACITY
- capacity of the corresponding candidate -
SUCCESS
- true if the request is successful, otherwise it's false
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getCandidates",
"params": [
"latest"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getCandidatesRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getCandidateStatus
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getCandidateStatus \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getCandidateStatus","params":["0x1d50df657b6dce50bac634bf18e2d986d807e940","latest"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getCandidateStatus",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getCandidateStatus',
params: ['0x1d50df657b6dce50bac634bf18e2d986d807e940', 'latest'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getCandidateStatus"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidateStatus\",\"params\":[\"0x1d50df657b6dce50bac634bf18e2d986d807e940\",\"latest\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getCandidateStatus")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidateStatus\",\"params\":[\"0x1d50df657b6dce50bac634bf18e2d986d807e940\",\"latest\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidateStatus\",\"params\":[\"0x1d50df657b6dce50bac634bf18e2d986d807e940\",\"latest\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getCandidateStatus", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getCandidateStatus")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidateStatus\",\"params\":[\"0x1d50df657b6dce50bac634bf18e2d986d807e940\",\"latest\"],\"id\":1}")
.asString();
POST /getCandidateStatus
Returns the status of the candidate of given COINBASE_ADDRESS
at a specific epoch
Parameters
-
COINBASE_ADDRESS
[required] - a string representing aCOINBASE_ADDRESS
(length: 40, start with 0x ) -
EPOCH_NUMBER
[required] - a hex code of an integer representing theEPOCH_NUMBER
or the following special param: -
latest
: get the status of candidate at the current time
Example
params: [ '0x1d50df657b6dce50bac634bf18e2d986d807e940', 'latest' ]
Returns
-
STATUS
- a string representing status of the candicate of givenCOINBASE_ADDRESS
-
MASTERNODE
- if the candidate is a masternode -
SLASHED
- if the candidate is slashed -
PROPOSED
- if the candidate is proposed, have not been a masternode yet -
empty string
- if it's not a candidate
-
-
CAPACITY
- capacity of the candidate -
EPOCH
- the epoch number of the query of this request -
SUCCESS
- true if the request is successful, otherwise it's false
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getCandidateStatus",
"params": [
"0x1d50df657b6dce50bac634bf18e2d986d807e940",
"latest"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getCandidateStatusRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getTransactionByHash
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getTransactionByHash \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getTransactionByHash",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getTransactionByHash',
params: ['0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getTransactionByHash"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByHash\",\"params\":[\"0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getTransactionByHash")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByHash\",\"params\":[\"0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByHash\",\"params\":[\"0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getTransactionByHash", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getTransactionByHash")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByHash\",\"params\":[\"0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1\"],\"id\":1}")
.asString();
POST /getTransactionByHash
Returns the information about a transaction requested by transaction hash.
Parameters
DATA
, 32 Bytes - hash of a transaction
Example
params: [ "0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1" ]
Returns
Object
- A transaction object, or null when no transaction was found:
-
hash
:DATA
, 32 Bytes - hash of the transaction. -
nonce
:QUANTITY
- the number of transactions made by the sender prior to this one. -
blockHash
:DATA
, 32 Bytes - hash of the block where this transaction was in.null
when its pending. -
blockNumber
:QUANTITY
- block number where this transaction was in.null
when its pending. -
transactionIndex
:QUANTITY
- integer of the transactions index position in the block.null
when its pending. -
from
:DATA
, 20 Bytes - address of the sender. -
to
:DATA
, 20 Bytes - address of the receiver.null
when its a contract creation transaction. -
value
:QUANTITY
- value transferred in Wei. -
gasPrice
:QUANTITY
- gas price provided by the sender in Wei. -
gas
:QUANTITY
- gas provided by the sender. -
input
:DATA
- the data send along with the transaction.
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": [
"0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getTransactionByHashRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getTransactionByBlockHashAndIndex
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getTransactionByBlockHashAndIndex \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params":["0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7","0x0"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getTransactionByBlockHashAndIndex",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getTransactionByBlockHashAndIndex',
params: ['0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7', '0x0'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getTransactionByBlockHashAndIndex"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockHashAndIndex\",\"params\":[\"0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7\",\"0x0\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getTransactionByBlockHashAndIndex")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockHashAndIndex\",\"params\":[\"0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7\",\"0x0\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockHashAndIndex\",\"params\":[\"0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7\",\"0x0\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getTransactionByBlockHashAndIndex", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getTransactionByBlockHashAndIndex")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockHashAndIndex\",\"params\":[\"0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7\",\"0x0\"],\"id\":1}")
.asString();
POST /getTransactionByBlockHashAndIndex
Returns information about a transaction by block hash and transaction index position. Parameters
DATA
, 32 Bytes - hash of a block.QUANTITY
- integer of the transaction index position. Exampleparams: [ '0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7', '0x0' // 0 ]
Returns Seeeth_getTransactionByHash
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": [
"0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7",
"0x0"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getTransactionByBlockHashAndIndexRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getTransactionByBlockNumberAndIndex
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getTransactionByBlockNumberAndIndex \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params":["0x52A96E","0x1"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getTransactionByBlockNumberAndIndex",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getTransactionByBlockNumberAndIndex',
params: ['0x52A96E', '0x1'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getTransactionByBlockNumberAndIndex"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\":[\"0x52A96E\",\"0x1\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getTransactionByBlockNumberAndIndex")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\":[\"0x52A96E\",\"0x1\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\":[\"0x52A96E\",\"0x1\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getTransactionByBlockNumberAndIndex", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getTransactionByBlockNumberAndIndex")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\":[\"0x52A96E\",\"0x1\"],\"id\":1}")
.asString();
POST /getTransactionByBlockNumberAndIndex
Returns information about a transaction by block number and transaction index position.
Parameters
QUANTITY|TAG
- a block number, or the string"earliest"
,"latest"
or"pending"
, as in the default block parameter.QUANTITY
- the transaction index position.
Example
params: [ '0x29c', // 668 '0x0' // 0 ]
Returns
See eth_getTransactionByHash
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": [
"0x52A96E",
"0x1"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getTransactionByBlockNumberAndIndexRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getTransactionReceipt
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getTransactionReceipt \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getTransactionReceipt",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getTransactionReceipt',
params: ['0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f'],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getTransactionReceipt"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionReceipt\",\"params\":[\"0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getTransactionReceipt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionReceipt\",\"params\":[\"0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionReceipt\",\"params\":[\"0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getTransactionReceipt", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getTransactionReceipt")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionReceipt\",\"params\":[\"0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f\"],\"id\":1}")
.asString();
POST /getTransactionReceipt
Returns the receipt of a transaction by transaction hash.
Note: That the receipt is not available for pending transactions.
Parameters
DATA
, 32 Bytes - hash of a transaction
Example
params: [ '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238' ]
Returns
Object
- A transaction receipt object, or null
when no receipt was found:
-
transactionHash
:DATA
, 32 Bytes - hash of the transaction. -
transactionIndex
:QUANTITY
- integer of the transactions index position in the block. -
blockHash
:DATA
, 32 Bytes - hash of the block where this transaction was in. -
blockNumber
:QUANTITY
- block number where this transaction was in. -
cumulativeGasUsed
:QUANTITY
- The total amount of gas used when this transaction was executed in the block. -
gasUsed
:QUANTITY
- The amount of gas used by this specific transaction alone. -
contractAddress
:DATA
, 20 Bytes - The contract address created, if the transaction was a contract creation, otherwisenull
. -
logs
:Array
- Array of log objects, which this transaction generated. -
logsBloom
:DATA
, 256 Bytes - Bloom filter for light clients to quickly retrieve related logs.
It also returns either :
-
root
:DATA
32 bytes of post-transaction stateroot (pre Byzantium) -
status
:QUANTITY
either1
(success) or0
(failure)
Body parameter
{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": [
"0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getTransactionReceiptRequest | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
tomox
API for tomox request
getAskTree
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getAskTree \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"tomox_getAskTree","params":["0xf992cf45394dAc5f50A26446de17803a79B940da","0x0000000000000000000000000000000000000001"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getAskTree",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'tomox_getAskTree',
params: [
'0xf992cf45394dAc5f50A26446de17803a79B940da',
'0x0000000000000000000000000000000000000001'
],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getAskTree"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getAskTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getAskTree")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getAskTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getAskTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getAskTree", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getAskTree")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getAskTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
.asString();
POST /getAskTree
Returns the ask tree (price, orders, amount)
Parameters
baseToken
, 32 Bytes - hash of a base tokenquoteToken
, 32 Bytes - hash of a quote token
Example
params: [ '0xf992cf45394dAc5f50A26446de17803a79B940da', '0x0000000000000000000000000000000000000001' ]
Returns
Object
- A ask tree (price, orders, amount)
Body parameter
{
"jsonrpc": "2.0",
"method": "tomox_getAskTree",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getAskTree | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getAsks
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getAsks \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"tomox_getAsks","params":["0xf992cf45394dAc5f50A26446de17803a79B940da","0x0000000000000000000000000000000000000001"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getAsks",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'tomox_getAsks',
params: [
'0xf992cf45394dAc5f50A26446de17803a79B940da',
'0x0000000000000000000000000000000000000001'
],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getAsks"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getAsks\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getAsks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getAsks\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getAsks\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getAsks", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getAsks")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getAsks\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
.asString();
POST /getAsks
Returns the asks (price, amount)
Parameters
-
baseToken
, 32 Bytes - hash of a base token -
quoteToken
, 32 Bytes - hash of a quote tokenparams: [ '0xf992cf45394dAc5f50A26446de17803a79B940da', '0x0000000000000000000000000000000000000001' ]
Returns
Object
- A asks (price, amount)
Body parameter
{
"jsonrpc": "2.0",
"method": "tomox_getAsks",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getAsks | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBestAsk
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBestAsk \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"tomox_getBestAsk","params":["0xf992cf45394dAc5f50A26446de17803a79B940da","0x0000000000000000000000000000000000000001"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBestAsk",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'tomox_getBestAsk',
params: [
'0xf992cf45394dAc5f50A26446de17803a79B940da',
'0x0000000000000000000000000000000000000001'
],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBestAsk"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBestAsk\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBestAsk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBestAsk\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBestAsk\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBestAsk", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBestAsk")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBestAsk\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
.asString();
POST /getBestAsk
Returns the best ask
Parameters
-
baseToken
, hash of a base token -
quoteToken
, hash of a quote tokenparams: [ '0xf992cf45394dAc5f50A26446de17803a79B940da', '0x0000000000000000000000000000000000000001' ]
Returns
Object
- the best ask (price, volume)
Body parameter
{
"jsonrpc": "2.0",
"method": "tomox_getBestAsk",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBestAsk | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBidTree
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBidTree \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"tomox_getBidTree","params":["0xf992cf45394dAc5f50A26446de17803a79B940da","0x0000000000000000000000000000000000000001"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBidTree",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'tomox_getBidTree',
params: [
'0xf992cf45394dAc5f50A26446de17803a79B940da',
'0x0000000000000000000000000000000000000001'
],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBidTree"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBidTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBidTree")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBidTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBidTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBidTree", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBidTree")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBidTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
.asString();
POST /getBidTree
Returns the bid tree (price, orders, amount)
Parameters
baseToken
, hash of a base tokenquoteToken
, hash of a quote token
Example
params: [ '0xf992cf45394dAc5f50A26446de17803a79B940da', '0x0000000000000000000000000000000000000001' ]
Returns
Object
- A bid tree (price, orders, amount)
Body parameter
{
"jsonrpc": "2.0",
"method": "tomox_getBidTree",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBidTree | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBids
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBids \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"tomox_getBids","params":["0xf992cf45394dAc5f50A26446de17803a79B940da","0x0000000000000000000000000000000000000001"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBids",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'tomox_getBids',
params: [
'0xf992cf45394dAc5f50A26446de17803a79B940da',
'0x0000000000000000000000000000000000000001'
],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBids"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBids\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBids")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBids\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBids\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBids", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBids")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBids\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
.asString();
POST /getBids
Returns the bids (price, amount)
Parameters
-
baseToken
, hash of a base token -
quoteToken
, hash of a quote tokenparams: [ '0xf992cf45394dAc5f50A26446de17803a79B940da', '0x0000000000000000000000000000000000000001' ]
Returns
Object
- A bids (price, amount)
Body parameter
{
"jsonrpc": "2.0",
"method": "tomox_getBids",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBids | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBestBid
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBestBid \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"tomox_getBestBid","params":["0xf992cf45394dAc5f50A26446de17803a79B940da","0x0000000000000000000000000000000000000001"],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBestBid",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'tomox_getBestBid',
params: [
'0xf992cf45394dAc5f50A26446de17803a79B940da',
'0x0000000000000000000000000000000000000001'
],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBestBid"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBestBid\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBestBid")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBestBid\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBestBid\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBestBid", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBestBid")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBestBid\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}")
.asString();
POST /getBestBid
Returns the best ask
Parameters
-
baseToken
, hash of a base token -
quoteToken
, hash of a quote tokenparams: [ '0xf992cf45394dAc5f50A26446de17803a79B940da', '0x0000000000000000000000000000000000000001' ]
Returns
Object
- the best ask (price, volume)
Body parameter
{
"jsonrpc": "2.0",
"method": "tomox_getBestBid",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBestBid | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getBorrows
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getBorrows \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"tomox_getBorrows","params":["0xf992cf45394dAc5f50A26446de17803a79B940da",86400],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getBorrows",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'tomox_getBorrows',
params: ['0xf992cf45394dAc5f50A26446de17803a79B940da', 86400],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getBorrows"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBorrows\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getBorrows")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBorrows\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBorrows\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getBorrows", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getBorrows")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBorrows\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"id\":1}")
.asString();
POST /getBorrows
Returns the borrows (interest, amount)
Parameters
-
lendingToken
, hash of a lending token -
term
, perior of the loan (seconds)params: [ '0xf992cf45394dAc5f50A26446de17803a79B940da', 86400 ]
Returns
Object
- list borrows (interest, amount)
Body parameter
{
"jsonrpc": "2.0",
"method": "tomox_getBorrows",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
86400
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getBorrows | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
getInvests
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getInvest \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"tomox_getInvests","params":["0xf992cf45394dAc5f50A26446de17803a79B940da",86400],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getInvest",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
jsonrpc: '2.0',
method: 'tomox_getInvests',
params: ['0xf992cf45394dAc5f50A26446de17803a79B940da', 86400],
id: 1
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getInvest"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getInvests\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getInvest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getInvests\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getInvests\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getInvest", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getInvest")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getInvests\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"id\":1}")
.asString();
POST /getInvest
Returns the invests (interest, amount)
Parameters
-
lendingToken
, hash of a lending token -
term
, perior of the loan (seconds)params: [ '0xf992cf45394dAc5f50A26446de17803a79B940da', 86400 ]
Returns
Object
- list invests (interest, amount)
Body parameter
{
"jsonrpc": "2.0",
"method": "tomox_getInvests",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
86400
],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getInvests | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
posv
API for posv request
getNetworkInformation
Code samples
curl --request POST \
--url https://rpc.tomochain.com//getNetworkInformation \
--header 'content-type: application/json' \
--data '{"jsonrpc":"2.0","method":"posv_getNetworkInformation","params":[],"id":1}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "rpc.tomochain.com",
"port": null,
"path": "//getNetworkInformation",
"headers": {
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({jsonrpc: '2.0', method: 'posv_getNetworkInformation', params: [], id: 1}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://rpc.tomochain.com//getNetworkInformation"
payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"posv_getNetworkInformation\",\"params\":[],\"id\":1}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://rpc.tomochain.com//getNetworkInformation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"posv_getNetworkInformation\",\"params\":[],\"id\":1}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("rpc.tomochain.com")
payload = "{\"jsonrpc\":\"2.0\",\"method\":\"posv_getNetworkInformation\",\"params\":[],\"id\":1}"
headers = { 'content-type': "application/json" }
conn.request("POST", "//getNetworkInformation", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com//getNetworkInformation")
.header("content-type", "application/json")
.body("{\"jsonrpc\":\"2.0\",\"method\":\"posv_getNetworkInformation\",\"params\":[],\"id\":1}")
.asString();
POST /getNetworkInformation
Returns the network information (chainId, special contracts)
Returns
Object
- network information
Body parameter
{
"jsonrpc": "2.0",
"method": "posv_getNetworkInformation",
"params": [],
"id": 1
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | getNetworkInformation | true | none |
» jsonrpc | body | string | true | none |
» method | body | string | true | none |
» params | body | [string] | true | none |
» id | body | integer(int32) | true | none |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Operation | None |
500 | Internal Server Error | Internal Server Error | None |
Schemas
clientVersionRequest
{
"jsonrpc": "2.0",
"method": "web3_clientVersion",
"params": [],
"id": 1
}
clientVersionRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
sha3request
{
"jsonrpc": "2.0",
"method": "web3_sha3",
"params": [
"0x68656c6c6f20776f726c64"
],
"id": 64
}
sha3request
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
versionrequest
{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 67
}
versionrequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
listeningrequest
{
"jsonrpc": "2.0",
"method": "net_listening",
"params": [],
"id": 67
}
listeningrequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
peerCountRequest
{
"jsonrpc": "2.0",
"method": "net_peerCount",
"params": [],
"id": 74
}
peerCountRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
protocolVersionRequest
{
"jsonrpc": "2.0",
"method": "eth_protocolVersion",
"params": [],
"id": 67
}
protocolVersionRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
syncingrequest
{
"jsonrpc": "2.0",
"method": "eth_syncing",
"params": [],
"id": 1
}
syncingrequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
coinbaserequest
{
"jsonrpc": "2.0",
"method": "eth_coinbase",
"params": [],
"id": 64
}
coinbaserequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
gasPriceRequest
{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 73
}
gasPriceRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
accountsrequest
{
"jsonrpc": "2.0",
"method": "eth_accounts",
"params": [],
"id": 1
}
accountsrequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
blockNumberRequest
{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 83
}
blockNumberRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBalanceRequest
{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": [
"0x2b5634c42055806a59e9107ed44d43c426e58258",
"latest"
],
"id": 1
}
getBalanceRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getStorageAtRequest
{
"jsonrpc": "2.0",
"method": "eth_getStorageAt",
"params": [
"0x295a70b2de5e3953354a6a8344e616ed314d7251",
"0x0",
"latest"
],
"id": 1
}
getStorageAtRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getTransactionCountRequest
{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": [
"0xbf1dcb735e512b731abd3404c15df6431bd03d42",
"latest"
],
"id": 1
}
getTransactionCountRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBlockTransactionCountByHashRequest
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34"
],
"id": 1
}
getBlockTransactionCountByHashRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBlockTransactionCountByNumberRequest
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": [
"0x52A8CA"
],
"id": 1
}
getBlockTransactionCountByNumberRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getCodeRequest
{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": [
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"0x2"
],
"id": 1
}
getCodeRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
signrequest
{
"jsonrpc": "2.0",
"method": "eth_sign",
"params": [
"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83",
"0xdeadbeaf"
],
"id": 1
}
signrequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
sendTransactionRequest
{
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
"params": [
{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}
],
"id": 1
}
sendTransactionRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [Param] | true | none | none |
id | integer(int32) | true | none | none |
Param
{
"from": 1.0393608864131634e+48,
"to": 1.2127714812045434e+48,
"gas": 30400,
"gasPrice": 10000000000000,
"value": 2441406250,
"data": 4.537516814050981e+98
}
Param
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
from | string | true | none | none |
to | string | true | none | none |
gas | string | true | none | none |
gasPrice | string | true | none | none |
value | string | true | none | none |
data | string | true | none | none |
sendRawTransactionRequest
{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": [
"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
],
"id": 1
}
sendRawTransactionRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
callrequest
{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
},
"latest"
],
"id": 1
}
callrequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [Param1] | true | none | none |
id | integer(int32) | true | none | none |
Param1
{
"from": "",
"to": "",
"gas": "",
"gasPrice": "",
"value": "",
"data": ""
}
Param1
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
from | string | false | none | none |
to | string | false | none | none |
gas | string | false | none | none |
gasPrice | string | false | none | none |
value | string | false | none | none |
data | string | false | none | none |
estimateGasRequest
{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}
],
"id": 1
}
estimateGasRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBlockByHashRequest
{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": [
"0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624",
true
],
"id": 1
}
getBlockByHashRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBlockByNumberRequest
{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": [
"0x0",
true
],
"id": 1
}
getBlockByNumberRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBlockSignersByNumberRequest
{
"jsonrpc": "2.0",
"method": "eth_getBlockSignersByNumber",
"params": [
"0xA61F98"
],
"id": 1
}
getBlockSignersByNumberRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBlockSignersByHashRequest
{
"jsonrpc": "2.0",
"method": "eth_getBlockSignersByHash",
"params": [
"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"
],
"id": 1
}
getBlockSignersByHashRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBlockFinalityByNumberRequest
{
"jsonrpc": "2.0",
"method": "eth_getBlockFinalityByNumber",
"params": [
"0xA61F98"
],
"id": 1
}
getBlockFinalityByNumberRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBlockFinalityByHashRequest
{
"jsonrpc": "2.0",
"method": "eth_getBlockFinalityByHash",
"params": [
"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"
],
"id": 1
}
getBlockFinalityByHashRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getTransactionByHashRequest
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": [
"0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1"
],
"id": 1
}
getTransactionByHashRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getTransactionByBlockHashAndIndexRequest
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": [
"0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7",
"0x0"
],
"id": 1
}
getTransactionByBlockHashAndIndexRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getTransactionByBlockNumberAndIndexRequest
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": [
"0x52A96E",
"0x1"
],
"id": 1
}
getTransactionByBlockNumberAndIndexRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getTransactionReceiptRequest
{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": [
"0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f"
],
"id": 1
}
getTransactionReceiptRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getCandidatesRequest
{
"jsonrpc": "2.0",
"method": "eth_getCandidates",
"params": [
"latest"
],
"id": 1
}
getCandidateStatusRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getCandidateStatusRequest
{
"jsonrpc": "2.0",
"method": "eth_getCandidateStatus",
"params": [
"0x1d50df657b6dce50bac634bf18e2d986d807e940",
"latest"
],
"id": 1
}
getCandidateStatusRequest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getAskTree
{
"jsonrpc": "2.0",
"method": "tomox_getAskTree",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
getAskTree
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getAsks
{
"jsonrpc": "2.0",
"method": "tomox_getAsks",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
getAsks
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBestAsk
{
"jsonrpc": "2.0",
"method": "tomox_getBestAsk",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
getBestAsk
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBidTree
{
"jsonrpc": "2.0",
"method": "tomox_getBidTree",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
getBidTree
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBids
{
"jsonrpc": "2.0",
"method": "tomox_getBids",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
getBids
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBestBid
{
"jsonrpc": "2.0",
"method": "tomox_getBestBid",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
"0x0000000000000000000000000000000000000001"
],
"id": 1
}
getBestBid
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getBorrows
{
"jsonrpc": "2.0",
"method": "tomox_getBorrows",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
86400
],
"id": 1
}
getBorrows
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getInvests
{
"jsonrpc": "2.0",
"method": "tomox_getInvests",
"params": [
"0xf992cf45394dAc5f50A26446de17803a79B940da",
86400
],
"id": 1
}
getInvest
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
getNetworkInformation
{
"jsonrpc": "2.0",
"method": "posv_getNetworkInformation",
"params": [],
"id": 1
}
getNetworkInformation
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
jsonrpc | string | true | none | none |
method | string | true | none | none |
params | [string] | true | none | none |
id | integer(int32) | true | none | none |
TomoDex APIs v1.0.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
TomoDex API Document
Base URLs:
accounts
Account endpoints
Find account by user address
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/account/string \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/account/string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/account/string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/account/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/account/string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/account/string")
.header("accept", "application/json")
.asString();
GET /account/{userAddress}
Returns a single account
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
userAddress | path | string | true | Address of user to return |
Example responses
200 Response
{
"address": "0xF7349C253FF7747Df661296E0859c44e974fb52E"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Account |
400 | Bad Request | Invalid Address | None |
404 | Not Found | Account not found | None |
[Deprecated] Find account's token balance by user address and token address
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/account/string/string \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/account/string/string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/account/string/string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/account/string/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/account/string/string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/account/string/string")
.header("accept", "application/json")
.asString();
GET /account/{userAddress}/{tokenAddress}
Returns an object contains token balance of user
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
userAddress | path | string | true | Address of user to find token balance |
tokenAddress | path | string | true | Address of token |
Example responses
200 Response
{
"address": "string",
"symbol": "string",
"balance": "string",
"availableBalance": "string",
"inOrderBalance": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | TokenBalance |
400 | Bad Request | Invalid Address | None |
404 | Not Found | Account not found | None |
tokens
Token endpoints
Finds all tokens
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/tokens \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/tokens",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/tokens"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/tokens", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/tokens")
.header("accept", "application/json")
.asString();
GET /tokens
Return all tokens in an array
Example responses
200 Response
[
{
"id": "string",
"name": "string",
"symbol": "string",
"address": "string",
"image": {
"url": "string",
"meta": {}
},
"contractAddress": "string",
"decimals": 0,
"active": true,
"listed": true,
"quote": true,
"makeFee": "string",
"takeFee": "string",
"usd": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
500 | Internal Server Error | Internal Server Error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Token] | false | none | none |
» id | string | false | read-only | none |
» name | string | false | none | none |
» symbol | string | false | none | none |
» address | string | false | none | none |
» image | Image | false | none | none |
»» url | string | false | none | none |
»» meta | object | false | none | none |
» contractAddress | string | false | none | none |
» decimals | integer(int32) | false | read-only | none |
» active | boolean | false | none | none |
» listed | boolean | false | read-only | none |
» quote | boolean | false | none | none |
» makeFee | string | false | none | none |
» takeFee | string | false | none | none |
» usd | string | false | read-only | none |
» createdAt | string(date-time) | false | read-only | none |
» updatedAt | string(date-time) | false | read-only | none |
Create new token
Code samples
curl --request POST \
--url https://dex.tomochain.com/api/tokens \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"name":"string","symbol":"string","address":"string","image":{"url":"string","meta":{}},"contractAddress":"string","active":true,"quote":true,"makeFee":"string","takeFee":"string"}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/tokens",
"headers": {
"content-type": "application/json",
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
name: 'string',
symbol: 'string',
address: 'string',
image: {url: 'string', meta: {}},
contractAddress: 'string',
active: true,
quote: true,
makeFee: 'string',
takeFee: 'string'
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/tokens"
payload := strings.NewReader("{\"name\":\"string\",\"symbol\":\"string\",\"address\":\"string\",\"image\":{\"url\":\"string\",\"meta\":{}},\"contractAddress\":\"string\",\"active\":true,\"quote\":true,\"makeFee\":\"string\",\"takeFee\":\"string\"}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{\"name\":\"string\",\"symbol\":\"string\",\"address\":\"string\",\"image\":{\"url\":\"string\",\"meta\":{}},\"contractAddress\":\"string\",\"active\":true,\"quote\":true,\"makeFee\":\"string\",\"takeFee\":\"string\"}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
payload = "{\"name\":\"string\",\"symbol\":\"string\",\"address\":\"string\",\"image\":{\"url\":\"string\",\"meta\":{}},\"contractAddress\":\"string\",\"active\":true,\"quote\":true,\"makeFee\":\"string\",\"takeFee\":\"string\"}"
headers = {
'content-type': "application/json",
'accept': "application/json"
}
conn.request("POST", "/api/tokens", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://dex.tomochain.com/api/tokens")
.header("content-type", "application/json")
.header("accept", "application/json")
.body("{\"name\":\"string\",\"symbol\":\"string\",\"address\":\"string\",\"image\":{\"url\":\"string\",\"meta\":{}},\"contractAddress\":\"string\",\"active\":true,\"quote\":true,\"makeFee\":\"string\",\"takeFee\":\"string\"}")
.asString();
POST /tokens
Returns newly created token
Body parameter
{
"name": "string",
"symbol": "string",
"address": "string",
"image": {
"url": "string",
"meta": {}
},
"contractAddress": "string",
"active": true,
"quote": true,
"makeFee": "string",
"takeFee": "string"
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | Token | true | Token object that needs to be added |
» id | body | string | false | none |
» name | body | string | false | none |
» symbol | body | string | false | none |
» address | body | string | false | none |
» image | body | Image | false | none |
»» url | body | string | false | none |
»» meta | body | object | false | none |
» contractAddress | body | string | false | none |
» decimals | body | integer(int32) | false | none |
» active | body | boolean | false | none |
» listed | body | boolean | false | none |
» quote | body | boolean | false | none |
» makeFee | body | string | false | none |
» takeFee | body | string | false | none |
» usd | body | string | false | none |
» createdAt | body | string(date-time) | false | none |
» updatedAt | body | string(date-time) | false | none |
Example responses
200 Response
{
"id": "string",
"name": "string",
"symbol": "string",
"address": "string",
"image": {
"url": "string",
"meta": {}
},
"contractAddress": "string",
"decimals": 0,
"active": true,
"listed": true,
"quote": true,
"makeFee": "string",
"takeFee": "string",
"usd": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Token |
400 | Bad Request | Invalid payload | None |
500 | Internal Server Error | Internal Server Error | None |
Finds all base tokens
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/tokens/base \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/tokens/base",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/tokens/base"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/tokens/base")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/tokens/base", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/tokens/base")
.header("accept", "application/json")
.asString();
GET /tokens/base
Return all base tokens in an array
Example responses
200 Response
[
{
"id": "string",
"name": "string",
"symbol": "string",
"address": "string",
"image": {
"url": "string",
"meta": {}
},
"contractAddress": "string",
"decimals": 0,
"active": true,
"listed": true,
"quote": true,
"makeFee": "string",
"takeFee": "string",
"usd": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
500 | Internal Server Error | Internal Server Error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Token] | false | none | none |
» id | string | false | read-only | none |
» name | string | false | none | none |
» symbol | string | false | none | none |
» address | string | false | none | none |
» image | Image | false | none | none |
»» url | string | false | none | none |
»» meta | object | false | none | none |
» contractAddress | string | false | none | none |
» decimals | integer(int32) | false | read-only | none |
» active | boolean | false | none | none |
» listed | boolean | false | read-only | none |
» quote | boolean | false | none | none |
» makeFee | string | false | none | none |
» takeFee | string | false | none | none |
» usd | string | false | read-only | none |
» createdAt | string(date-time) | false | read-only | none |
» updatedAt | string(date-time) | false | read-only | none |
Finds all quote tokens
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/tokens/quote \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/tokens/quote",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/tokens/quote"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/tokens/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/tokens/quote", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/tokens/quote")
.header("accept", "application/json")
.asString();
GET /tokens/quote
Return all quote tokens in an array
Example responses
200 Response
[
{
"id": "string",
"name": "string",
"symbol": "string",
"address": "string",
"image": {
"url": "string",
"meta": {}
},
"contractAddress": "string",
"decimals": 0,
"active": true,
"listed": true,
"quote": true,
"makeFee": "string",
"takeFee": "string",
"usd": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
500 | Internal Server Error | Internal Server Error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Token] | false | none | none |
» id | string | false | read-only | none |
» name | string | false | none | none |
» symbol | string | false | none | none |
» address | string | false | none | none |
» image | Image | false | none | none |
»» url | string | false | none | none |
»» meta | object | false | none | none |
» contractAddress | string | false | none | none |
» decimals | integer(int32) | false | read-only | none |
» active | boolean | false | none | none |
» listed | boolean | false | read-only | none |
» quote | boolean | false | none | none |
» makeFee | string | false | none | none |
» takeFee | string | false | none | none |
» usd | string | false | read-only | none |
» createdAt | string(date-time) | false | read-only | none |
» updatedAt | string(date-time) | false | read-only | none |
Retrieve the token information corresponding to an address
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/tokens/string \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/tokens/string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/tokens/string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/tokens/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/tokens/string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/tokens/string")
.header("accept", "application/json")
.asString();
GET /tokens/{address}
Return token object
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | path | string | true | Token address |
Example responses
200 Response
{
"id": "string",
"name": "string",
"symbol": "string",
"address": "string",
"image": {
"url": "string",
"meta": {}
},
"contractAddress": "string",
"decimals": 0,
"active": true,
"listed": true,
"quote": true,
"makeFee": "string",
"takeFee": "string",
"usd": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Token |
400 | Bad Request | Invalid Address | None |
500 | Internal Server Error | Internal Server Error | None |
pairs
Pair endpoints
Finds all pairs
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/pairs \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/pairs",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/pairs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/pairs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/pairs", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/pairs")
.header("accept", "application/json")
.asString();
GET /pairs
Return all pairs in an array
Example responses
200 Response
[
{
"id": "string",
"baseTokenSymbol": "string",
"baseTokenAddress": "string",
"baseTokenDecimals": 0,
"quoteTokenSymbol": "string",
"quoteTokenAddress": "string",
"quoteTokenDecimals": 0,
"listed": true,
"active": true,
"rank": 0,
"makeFee": "string",
"takeFee": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
500 | Internal Server Error | Internal Server Error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Pair] | false | none | none |
» id | string | false | read-only | none |
» baseTokenSymbol | string | false | none | none |
» baseTokenAddress | string | false | none | none |
» baseTokenDecimals | integer(int32) | false | read-only | none |
» quoteTokenSymbol | string | false | none | none |
» quoteTokenAddress | string | false | none | none |
» quoteTokenDecimals | integer(int32) | false | read-only | none |
» listed | boolean | false | read-only | none |
» active | boolean | false | none | none |
» rank | integer(int32) | false | read-only | none |
» makeFee | string | false | read-only | none |
» takeFee | string | false | read-only | none |
» createdAt | string(date-time) | false | read-only | none |
» updatedAt | string(date-time) | false | read-only | none |
Create new pair
Code samples
curl --request POST \
--url https://dex.tomochain.com/api/pairs \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"baseTokenSymbol":"string","baseTokenAddress":"string","quoteTokenSymbol":"string","quoteTokenAddress":"string","active":true}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/pairs",
"headers": {
"content-type": "application/json",
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
baseTokenSymbol: 'string',
baseTokenAddress: 'string',
quoteTokenSymbol: 'string',
quoteTokenAddress: 'string',
active: true
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/pairs"
payload := strings.NewReader("{\"baseTokenSymbol\":\"string\",\"baseTokenAddress\":\"string\",\"quoteTokenSymbol\":\"string\",\"quoteTokenAddress\":\"string\",\"active\":true}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/pairs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{\"baseTokenSymbol\":\"string\",\"baseTokenAddress\":\"string\",\"quoteTokenSymbol\":\"string\",\"quoteTokenAddress\":\"string\",\"active\":true}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
payload = "{\"baseTokenSymbol\":\"string\",\"baseTokenAddress\":\"string\",\"quoteTokenSymbol\":\"string\",\"quoteTokenAddress\":\"string\",\"active\":true}"
headers = {
'content-type': "application/json",
'accept': "application/json"
}
conn.request("POST", "/api/pairs", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://dex.tomochain.com/api/pairs")
.header("content-type", "application/json")
.header("accept", "application/json")
.body("{\"baseTokenSymbol\":\"string\",\"baseTokenAddress\":\"string\",\"quoteTokenSymbol\":\"string\",\"quoteTokenAddress\":\"string\",\"active\":true}")
.asString();
POST /pairs
Returns newly created pair
Body parameter
{
"baseTokenSymbol": "string",
"baseTokenAddress": "string",
"quoteTokenSymbol": "string",
"quoteTokenAddress": "string",
"active": true
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | Pair | true | Pair object that needs to be added |
» id | body | string | false | none |
» baseTokenSymbol | body | string | false | none |
» baseTokenAddress | body | string | false | none |
» baseTokenDecimals | body | integer(int32) | false | none |
» quoteTokenSymbol | body | string | false | none |
» quoteTokenAddress | body | string | false | none |
» quoteTokenDecimals | body | integer(int32) | false | none |
» listed | body | boolean | false | none |
» active | body | boolean | false | none |
» rank | body | integer(int32) | false | none |
» makeFee | body | string | false | none |
» takeFee | body | string | false | none |
» createdAt | body | string(date-time) | false | none |
» updatedAt | body | string(date-time) | false | none |
Example responses
200 Response
{
"id": "string",
"baseTokenSymbol": "string",
"baseTokenAddress": "string",
"baseTokenDecimals": 0,
"quoteTokenSymbol": "string",
"quoteTokenAddress": "string",
"quoteTokenDecimals": 0,
"listed": true,
"active": true,
"rank": 0,
"makeFee": "string",
"takeFee": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Pair |
400 | Bad Request | *** Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Retrieve the pair information corresponding to a baseToken and a quoteToken
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/pair?baseToken=string"eToken=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/pair?baseToken=string"eToken=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/pair?baseToken=string"eToken=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/pair?baseToken=string"eToken=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/pair?baseToken=string"eToken=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/pair?baseToken=string"eToken=string")
.header("accept", "application/json")
.asString();
GET /pair
Multiple status values can be provided with comma separated strings
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
baseToken | query | string | true | Base token address |
quoteToken | query | string | true | Quote token address |
Example responses
200 Response
{
"id": "string",
"baseTokenSymbol": "string",
"baseTokenAddress": "string",
"baseTokenDecimals": 0,
"quoteTokenSymbol": "string",
"quoteTokenAddress": "string",
"quoteTokenDecimals": 0,
"listed": true,
"active": true,
"rank": 0,
"makeFee": "string",
"takeFee": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Pair |
400 | Bad Request | baseToken Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Retrieve pair data corresponding to a baseToken and quoteToken
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/pair/data?baseToken=string"eToken=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/pair/data?baseToken=string"eToken=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/pair/data?baseToken=string"eToken=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/pair/data?baseToken=string"eToken=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/pair/data?baseToken=string"eToken=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/pair/data?baseToken=string"eToken=string")
.header("accept", "application/json")
.asString();
GET /pair/data
Multiple status values can be provided with comma separated strings
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
baseToken | query | string | true | Base token address |
quoteToken | query | string | true | Quote token address |
Example responses
200 Response
{
"pair": {
"pairName": "string",
"baseToken": "string",
"quoteToken": "string"
},
"open": "string",
"high": "string",
"low": 0,
"close": "string",
"volume": "string",
"count": "string",
"timestamp": "string",
"orderVolume": "string",
"orderCount": "string",
"askPrice": "string",
"bidPrice": "string",
"price": "string",
"rank": 0
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | PairData |
400 | Bad Request | baseToken Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Retrieve all pair data
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/pairs/data \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/pairs/data",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/pairs/data"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/pairs/data")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/pairs/data", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/pairs/data")
.header("accept", "application/json")
.asString();
GET /pairs/data
Multiple status values can be provided with comma separated strings
Example responses
200 Response
{
"pair": {
"pairName": "string",
"baseToken": "string",
"quoteToken": "string"
},
"open": "string",
"high": "string",
"low": 0,
"close": "string",
"volume": "string",
"count": "string",
"timestamp": "string",
"orderVolume": "string",
"orderCount": "string",
"askPrice": "string",
"bidPrice": "string",
"price": "string",
"rank": 0
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | PairData |
400 | Bad Request | baseToken Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
orders
Order endpoints
Retrieve the sorted list of orders for an Ethereum address
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/orders \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/orders",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/orders"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/orders", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders")
.header("accept", "application/json")
.asString();
GET /orders
Return all orders in an array
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | query | string | false | User address |
pageOffset | query | string | false | Page offset |
pageSize | query | string | false | Number of items per a page |
sortBy | query | string | false | Sort for query (time, orderStatus, orderType, orderSide) |
sortType | query | string | false | asc/dec |
orderStatus | query | string | false | OPEN/CANCELLED/FILLED/PARTIAL_FILLED |
orderSide | query | string | false | SELL/BUY |
orderType | query | string | false | LO/MO |
baseToken | query | string | false | Base token address |
quoteToken | query | string | false | Quote token address |
hash | query | string | false | hash of order |
from | query | string | false | the beginning timestamp (number of seconds from 1970/01/01) from which order data has to be queried |
to | query | string | false | the ending timestamp ((number of seconds from 1970/01/01)) until which order data has to be queried |
Example responses
200 Response
{
"total": 0,
"orders": [
{
"id": "string",
"userAddress": "string",
"exchangeAddress": "string",
"baseToken": "string",
"quoteToken": "string",
"status": "string",
"side": "string",
"type": "string",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
},
"pricepoint": "string",
"amount": "string",
"filledAmount": "string",
"nonce": "string",
"makeFee": "string",
"takeFee": "string",
"pairName": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z",
"orderID": "string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
400 | Bad Request | address Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» total | integer | false | none | none |
» orders | [Order] | false | none | none |
»» id | string | false | read-only | none |
»» userAddress | string | false | none | none |
»» exchangeAddress | string | false | none | none |
»» baseToken | string | false | none | none |
»» quoteToken | string | false | none | none |
»» status | string | false | none | none |
»» side | string | false | none | none |
»» type | string | false | none | none |
»» hash | string | false | none | none |
»» signature | Signature | false | none | none |
»»» V | string | false | none | none |
»»» R | string | false | none | none |
»»» S | string | false | none | none |
»» pricepoint | string | false | none | none |
»» amount | string | false | none | none |
»» filledAmount | string | false | none | none |
»» nonce | string | false | none | none |
»» makeFee | string | false | none | none |
»» takeFee | string | false | none | none |
»» pairName | string | false | none | none |
»» createdAt | string(date-time) | false | read-only | none |
»» updatedAt | string(date-time) | false | read-only | none |
»» orderID | string | false | none | none |
Create new order
Code samples
curl --request POST \
--url https://dex.tomochain.com/api/orders \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"userAddress":"0x15e08dE16f534c890828F2a0D935433aF5B3CE0C","exchangeAddress":"0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e","baseToken":"0x4d7eA2cE949216D6b120f3AA10164173615A2b6C","quoteToken":"0x0000000000000000000000000000000000000001","side":"SELL/BUY","type":"LO/MO","status":"NEW/CANCELLED","hash":"string","signature":{"V":"string","R":"string","S":"string"},"pricepoint":"21207020000000000000000","amount":"4693386710283129","nonce":"1","makeFee":"1","takeFee":"1"}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/orders",
"headers": {
"content-type": "application/json",
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
userAddress: '0x15e08dE16f534c890828F2a0D935433aF5B3CE0C',
exchangeAddress: '0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e',
baseToken: '0x4d7eA2cE949216D6b120f3AA10164173615A2b6C',
quoteToken: '0x0000000000000000000000000000000000000001',
side: 'SELL/BUY',
type: 'LO/MO',
status: 'NEW/CANCELLED',
hash: 'string',
signature: {V: 'string', R: 'string', S: 'string'},
pricepoint: '21207020000000000000000',
amount: '4693386710283129',
nonce: '1',
makeFee: '1',
takeFee: '1'
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/orders"
payload := strings.NewReader("{\"userAddress\":\"0x15e08dE16f534c890828F2a0D935433aF5B3CE0C\",\"exchangeAddress\":\"0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e\",\"baseToken\":\"0x4d7eA2cE949216D6b120f3AA10164173615A2b6C\",\"quoteToken\":\"0x0000000000000000000000000000000000000001\",\"side\":\"SELL/BUY\",\"type\":\"LO/MO\",\"status\":\"NEW/CANCELLED\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"},\"pricepoint\":\"21207020000000000000000\",\"amount\":\"4693386710283129\",\"nonce\":\"1\",\"makeFee\":\"1\",\"takeFee\":\"1\"}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{\"userAddress\":\"0x15e08dE16f534c890828F2a0D935433aF5B3CE0C\",\"exchangeAddress\":\"0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e\",\"baseToken\":\"0x4d7eA2cE949216D6b120f3AA10164173615A2b6C\",\"quoteToken\":\"0x0000000000000000000000000000000000000001\",\"side\":\"SELL/BUY\",\"type\":\"LO/MO\",\"status\":\"NEW/CANCELLED\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"},\"pricepoint\":\"21207020000000000000000\",\"amount\":\"4693386710283129\",\"nonce\":\"1\",\"makeFee\":\"1\",\"takeFee\":\"1\"}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
payload = "{\"userAddress\":\"0x15e08dE16f534c890828F2a0D935433aF5B3CE0C\",\"exchangeAddress\":\"0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e\",\"baseToken\":\"0x4d7eA2cE949216D6b120f3AA10164173615A2b6C\",\"quoteToken\":\"0x0000000000000000000000000000000000000001\",\"side\":\"SELL/BUY\",\"type\":\"LO/MO\",\"status\":\"NEW/CANCELLED\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"},\"pricepoint\":\"21207020000000000000000\",\"amount\":\"4693386710283129\",\"nonce\":\"1\",\"makeFee\":\"1\",\"takeFee\":\"1\"}"
headers = {
'content-type': "application/json",
'accept': "application/json"
}
conn.request("POST", "/api/orders", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://dex.tomochain.com/api/orders")
.header("content-type", "application/json")
.header("accept", "application/json")
.body("{\"userAddress\":\"0x15e08dE16f534c890828F2a0D935433aF5B3CE0C\",\"exchangeAddress\":\"0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e\",\"baseToken\":\"0x4d7eA2cE949216D6b120f3AA10164173615A2b6C\",\"quoteToken\":\"0x0000000000000000000000000000000000000001\",\"side\":\"SELL/BUY\",\"type\":\"LO/MO\",\"status\":\"NEW/CANCELLED\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"},\"pricepoint\":\"21207020000000000000000\",\"amount\":\"4693386710283129\",\"nonce\":\"1\",\"makeFee\":\"1\",\"takeFee\":\"1\"}")
.asString();
POST /orders
Returns newly created order
Body parameter
{
"userAddress": "0x15e08dE16f534c890828F2a0D935433aF5B3CE0C",
"exchangeAddress": "0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e",
"baseToken": "0x4d7eA2cE949216D6b120f3AA10164173615A2b6C",
"quoteToken": "0x0000000000000000000000000000000000000001",
"side": "SELL/BUY",
"type": "LO/MO",
"status": "NEW/CANCELLED",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
},
"pricepoint": "21207020000000000000000",
"amount": "4693386710283129",
"nonce": "1",
"makeFee": "1",
"takeFee": "1"
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | OrderCreate | true | Order object that needs to be added |
Example responses
201 Response
{
"id": "string",
"userAddress": "string",
"exchangeAddress": "string",
"baseToken": "string",
"quoteToken": "string",
"status": "string",
"side": "string",
"type": "string",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
},
"pricepoint": "string",
"amount": "string",
"filledAmount": "string",
"nonce": "string",
"makeFee": "string",
"takeFee": "string",
"pairName": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z",
"orderID": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | successful operation | Order |
400 | Bad Request | Invalid payload | None |
403 | Forbidden | Account is blocked | None |
500 | Internal Server Error | Internal Server Error | None |
[Deprecated] Retrieve the list of positions for an Ethereum address. Positions are order that have been sent to the matching engine and that are waiting to be matched
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/orders/positions?address=string&limit=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/orders/positions?address=string&limit=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/orders/positions?address=string&limit=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/orders/positions?address=string&limit=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/orders/positions?address=string&limit=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders/positions?address=string&limit=string")
.header("accept", "application/json")
.asString();
GET /orders/positions
Return all orders in an array
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | query | string | true | User address |
limit | query | string | true | Number of orders returned in query |
Example responses
200 Response
[
{
"id": "string",
"userAddress": "string",
"exchangeAddress": "string",
"baseToken": "string",
"quoteToken": "string",
"status": "string",
"side": "string",
"type": "string",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
},
"pricepoint": "string",
"amount": "string",
"filledAmount": "string",
"nonce": "string",
"makeFee": "string",
"takeFee": "string",
"pairName": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z",
"orderID": "string"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
400 | Bad Request | address Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Order] | false | none | none |
» id | string | false | read-only | none |
» userAddress | string | false | none | none |
» exchangeAddress | string | false | none | none |
» baseToken | string | false | none | none |
» quoteToken | string | false | none | none |
» status | string | false | none | none |
» side | string | false | none | none |
» type | string | false | none | none |
» hash | string | false | none | none |
» signature | Signature | false | none | none |
»» V | string | false | none | none |
»» R | string | false | none | none |
»» S | string | false | none | none |
» pricepoint | string | false | none | none |
» amount | string | false | none | none |
» filledAmount | string | false | none | none |
» nonce | string | false | none | none |
» makeFee | string | false | none | none |
» takeFee | string | false | none | none |
» pairName | string | false | none | none |
» createdAt | string(date-time) | false | read-only | none |
» updatedAt | string(date-time) | false | read-only | none |
» orderID | string | false | none | none |
Retrieve the list of filled order for an Ethereum address
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/orders/history?address=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/orders/history?address=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/orders/history?address=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/orders/history?address=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/orders/history?address=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders/history?address=string")
.header("accept", "application/json")
.asString();
GET /orders/history
Return all orders in an array
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | query | string | true | User address |
pageOffset | query | string | false | Page offset, default 0 |
pageSize | query | string | false | Number of items per a page, defaul 50 |
sortBy | query | string | false | Sort for query (time(default), orderStatus, orderType, orderSide) |
sortType | query | string | false | asc/dec, default asc |
orderStatus | query | string | false | OPEN/CANCELLED/FILLED/PARTIAL_FILLED |
orderSide | query | string | false | SELL/BUY |
orderType | query | string | false | LO/MO |
baseToken | query | string | false | Base token address |
quoteToken | query | string | false | Quote token address |
from | query | string | false | the beginning timestamp (number of seconds from 1970/01/01) from which order data has to be queried |
to | query | string | false | the ending timestamp ((number of seconds from 1970/01/01)) until which order data has to be queried |
Example responses
200 Response
{
"total": 0,
"orders": [
{
"id": "string",
"userAddress": "string",
"exchangeAddress": "string",
"baseToken": "string",
"quoteToken": "string",
"status": "string",
"side": "string",
"type": "string",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
},
"pricepoint": "string",
"amount": "string",
"filledAmount": "string",
"nonce": "string",
"makeFee": "string",
"takeFee": "string",
"pairName": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z",
"orderID": "string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
400 | Bad Request | address Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» total | integer | false | none | none |
» orders | [Order] | false | none | none |
»» id | string | false | read-only | none |
»» userAddress | string | false | none | none |
»» exchangeAddress | string | false | none | none |
»» baseToken | string | false | none | none |
»» quoteToken | string | false | none | none |
»» status | string | false | none | none |
»» side | string | false | none | none |
»» type | string | false | none | none |
»» hash | string | false | none | none |
»» signature | Signature | false | none | none |
»»» V | string | false | none | none |
»»» R | string | false | none | none |
»»» S | string | false | none | none |
»» pricepoint | string | false | none | none |
»» amount | string | false | none | none |
»» filledAmount | string | false | none | none |
»» nonce | string | false | none | none |
»» makeFee | string | false | none | none |
»» takeFee | string | false | none | none |
»» pairName | string | false | none | none |
»» createdAt | string(date-time) | false | read-only | none |
»» updatedAt | string(date-time) | false | read-only | none |
»» orderID | string | false | none | none |
Retrieve the total number of orders for an Ethereum address
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/orders/count?address=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/orders/count?address=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/orders/count?address=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/orders/count?address=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/orders/count?address=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders/count?address=string")
.header("accept", "application/json")
.asString();
GET /orders/count
Return a positive integer
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | query | string | true | User address |
Example responses
200 Response
0
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | integer |
400 | Bad Request | address Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Retrieve order nonce for an Ethereum address
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/orders/nonce?address=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/orders/nonce?address=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/orders/nonce?address=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/orders/nonce?address=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/orders/nonce?address=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders/nonce?address=string")
.header("accept", "application/json")
.asString();
GET /orders/nonce
Return a positive integer
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | query | string | true | User address |
Example responses
200 Response
0
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | integer |
400 | Bad Request | address Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Cancel order
Code samples
curl --request POST \
--url https://dex.tomochain.com/api/orders/cancel \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"orderHash":"string","nonce":"string","hash":"string","signature":{"V":"string","R":"string","S":"string"}}'
var http = require("https");
var options = {
"method": "POST",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/orders/cancel",
"headers": {
"content-type": "application/json",
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
orderHash: 'string',
nonce: 'string',
hash: 'string',
signature: {V: 'string', R: 'string', S: 'string'}
}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/orders/cancel"
payload := strings.NewReader("{\"orderHash\":\"string\",\"nonce\":\"string\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"}}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/orders/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{\"orderHash\":\"string\",\"nonce\":\"string\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"}}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
payload = "{\"orderHash\":\"string\",\"nonce\":\"string\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"}}"
headers = {
'content-type': "application/json",
'accept': "application/json"
}
conn.request("POST", "/api/orders/cancel", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://dex.tomochain.com/api/orders/cancel")
.header("content-type", "application/json")
.header("accept", "application/json")
.body("{\"orderHash\":\"string\",\"nonce\":\"string\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"}}")
.asString();
POST /orders/cancel
Returns the hash of cancelled order
Body parameter
{
"orderHash": "string",
"nonce": "string",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
}
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | OrderCancel | true | Cancel order object |
» orderHash | body | string | false | none |
» nonce | body | string | false | none |
» hash | body | string | false | none |
» signature | body | Signature | false | none |
»» V | body | string | false | none |
»» R | body | string | false | none |
»» S | body | string | false | none |
Example responses
200 Response
"string"
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | string |
400 | Bad Request | Invalid payload | None |
500 | Internal Server Error | Internal Server Error | None |
[Deprecated] Cancel all orders
Code samples
curl --request POST \
--url 'https://dex.tomochain.com/api/orders/cancelAll?address=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "POST",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/orders/cancelAll?address=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/orders/cancelAll?address=string"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/orders/cancelAll?address=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("POST", "/api/orders/cancelAll?address=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://dex.tomochain.com/api/orders/cancelAll?address=string")
.header("accept", "application/json")
.asString();
POST /orders/cancelAll
This endpoint should implements signature authentication
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | query | string | true | User address |
Example responses
200 Response
"string"
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | string |
400 | Bad Request | Invalid payload | None |
500 | Internal Server Error | Internal Server Error | None |
Retrieve the order information corresponding to an order hash
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/orders/string \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/orders/string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/orders/string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/orders/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/orders/string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders/string")
.header("accept", "application/json")
.asString();
GET /orders/{hash}
Return order object
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
hash | path | string | true | order hash |
Example responses
200 Response
{
"id": "string",
"userAddress": "string",
"exchangeAddress": "string",
"baseToken": "string",
"quoteToken": "string",
"status": "string",
"side": "string",
"type": "string",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
},
"pricepoint": "string",
"amount": "string",
"filledAmount": "string",
"nonce": "string",
"makeFee": "string",
"takeFee": "string",
"pairName": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z",
"orderID": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Order |
400 | Bad Request | Invalid order hash | None |
500 | Internal Server Error | Internal Server Error | None |
orderbook
Order book endpoints
Retrieve the orderbook (amount and pricepoint) corresponding to a a baseToken and a quoteToken
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/orderbook?baseToken=string"eToken=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/orderbook?baseToken=string"eToken=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/orderbook?baseToken=string"eToken=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/orderbook?baseToken=string"eToken=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/orderbook?baseToken=string"eToken=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orderbook?baseToken=string"eToken=string")
.header("accept", "application/json")
.asString();
GET /orderbook
Multiple status values can be provided with comma separated strings
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
baseToken | query | string | true | Base token address |
quoteToken | query | string | true | Quote token address |
Example responses
200 Response
{
"pairName": "string",
"asks": [
{
"amount": "string",
"pricepoint": "string"
}
],
"bids": [
{
"amount": "string",
"pricepoint": "string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | OrderBook |
400 | Bad Request | *** Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Retrieve the orderbook (full raw orders, including fields such as hashes, maker, taker addresses, signatures, etc.)
corresponding to a baseToken and a quoteToken
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/orderbook/raw?baseToken=string"eToken=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/orderbook/raw?baseToken=string"eToken=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/orderbook/raw?baseToken=string"eToken=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/orderbook/raw?baseToken=string"eToken=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/orderbook/raw?baseToken=string"eToken=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orderbook/raw?baseToken=string"eToken=string")
.header("accept", "application/json")
.asString();
GET /orderbook/raw
Multiple status values can be provided with comma separated strings
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
baseToken | query | string | true | Base token address |
quoteToken | query | string | true | Quote token address |
Example responses
200 Response
{
"pairName": "string",
"orders": [
{
"id": "string",
"userAddress": "string",
"exchangeAddress": "string",
"baseToken": "string",
"quoteToken": "string",
"status": "string",
"side": "string",
"type": "string",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
},
"pricepoint": "string",
"amount": "string",
"filledAmount": "string",
"nonce": "string",
"makeFee": "string",
"takeFee": "string",
"pairName": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z",
"orderID": "string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | RawOrderBook |
400 | Bad Request | *** Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Retrieve the orderbook (amount and pricepoint) corresponding to a lendingToken and a term
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/lending/orderbook?lendingToken=string&term=string'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/lending/orderbook?lendingToken=string&term=string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/lending/orderbook?lendingToken=string&term=string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/lending/orderbook?lendingToken=string&term=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
conn.request("GET", "/api/lending/orderbook?lendingToken=string&term=string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/lending/orderbook?lendingToken=string&term=string")
.asString();
GET /lending/orderbook
Retrieve the orderbook (amount and pricepoint) corresponding to a lendingToken and a term
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
lendingToken | query | string | true | lending token address |
term | query | string | true | term (e.g 86400 seconds) |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | None |
400 | Bad Request | *** Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
trades
Trade endpoints
Retrieve all trades corresponding to a baseToken or/and a quoteToken
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/trades \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/trades",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/trades"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/trades")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/trades", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/trades")
.header("accept", "application/json")
.asString();
GET /trades
Return all trades in an array with total match
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
baseToken | query | string | false | Base token address |
quoteToken | query | string | false | Quote token address |
pageOffset | query | string | false | none |
pageSize | query | string | false | number of trade item per page, default 50 |
sortBy | query | string | false | Sort for query (suported sort by time) |
sortType | query | string | false | asc/dec |
from | query | string | false | the beginning timestamp (number of seconds from 1970/01/01) from which order data has to be queried |
to | query | string | false | the ending timestamp ((number of seconds from 1970/01/01)) until which order data has to be queried |
Example responses
200 Response
{
"total": 0,
"trades": [
{
"id": "string",
"taker": "string",
"maker": "string",
"baseToken": "string",
"quoteToken": "string",
"makerOrderHash": "string",
"takerOrderHash": "string",
"hash": "string",
"txHash": "string",
"pairName": "string",
"pricepoint": "string",
"amount": "string",
"status": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
400 | Bad Request | *** Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» total | integer | false | none | none |
» trades | [Trade] | false | none | none |
»» id | string | false | read-only | none |
»» taker | string | false | none | none |
»» maker | string | false | none | none |
»» baseToken | string | false | none | none |
»» quoteToken | string | false | none | none |
»» makerOrderHash | string | false | none | none |
»» takerOrderHash | string | false | none | none |
»» hash | string | false | none | none |
»» txHash | string | false | none | none |
»» pairName | string | false | none | none |
»» pricepoint | string | false | none | none |
»» amount | string | false | none | none |
»» status | string | false | none | none |
»» createdAt | string(date-time) | false | read-only | none |
»» updatedAt | string(date-time) | false | read-only | none |
Retrieve the sorted list of trades for an Ethereum address in which the given address is either maker or taker
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/trades/history?address=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/trades/history?address=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/trades/history?address=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/trades/history?address=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/trades/history?address=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/trades/history?address=string")
.header("accept", "application/json")
.asString();
GET /trades/history
Return trades array
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | query | string | true | User address |
pageOffset | query | string | false | none |
pageSize | query | string | false | number of trade item per page, default 50 |
sortBy | query | string | false | Sort for query (suported sort by time) |
sortType | query | string | false | asc/dec |
baseToken | query | string | false | Base token address |
quoteToken | query | string | false | Quote token address |
from | query | string | false | the beginning timestamp (number of seconds from 1970/01/01) from which order data has to be queried |
to | query | string | false | the ending timestamp ((number of seconds from 1970/01/01)) until which order data has to be queried |
Example responses
200 Response
{
"total": 0,
"trades": [
{
"id": "string",
"taker": "string",
"maker": "string",
"baseToken": "string",
"quoteToken": "string",
"makerOrderHash": "string",
"takerOrderHash": "string",
"hash": "string",
"txHash": "string",
"pairName": "string",
"pricepoint": "string",
"amount": "string",
"status": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
400 | Bad Request | address Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» total | integer | false | none | none |
» trades | [Trade] | false | none | none |
»» id | string | false | read-only | none |
»» taker | string | false | none | none |
»» maker | string | false | none | none |
»» baseToken | string | false | none | none |
»» quoteToken | string | false | none | none |
»» makerOrderHash | string | false | none | none |
»» takerOrderHash | string | false | none | none |
»» hash | string | false | none | none |
»» txHash | string | false | none | none |
»» pairName | string | false | none | none |
»» pricepoint | string | false | none | none |
»» amount | string | false | none | none |
»» status | string | false | none | none |
»» createdAt | string(date-time) | false | read-only | none |
»» updatedAt | string(date-time) | false | read-only | none |
ohlcv
OHLCV endpoints
Retrieve OHLCV data corresponding to a baseToken and a quoteToken
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string")
.header("accept", "application/json")
.asString();
GET /ohlcv
Return all ticks in an array
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
baseToken | query | string | true | Base token address |
quoteToken | query | string | true | Quote token address |
timeInterval | query | string | true | Time interval, candle size. Valid values: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 1w, 1mo (1 month) |
from | query | string | true | the beginning timestamp (number of seconds from 1970/01/01) from which ohlcv data has to be queried |
to | query | string | true | the ending timestamp ((number of seconds from 1970/01/01)) until which ohlcv data has to be queried |
Example responses
200 Response
[
{
"pair": {
"pairName": "string",
"baseToken": "string",
"quoteToken": "string"
},
"open": "string",
"high": "string",
"low": 0,
"close": "string",
"volume": "string",
"count": "string",
"timestamp": "string"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
400 | Bad Request | *** Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Tick] | false | none | none |
» pair | PairID | false | none | none |
»» pairName | string | false | none | none |
»» baseToken | string | false | none | none |
»» quoteToken | string | false | none | none |
» open | string | false | none | none |
» high | string | false | none | none |
» low | integer(int32) | false | none | none |
» close | string | false | none | none |
» volume | string | false | none | none |
» count | string | false | none | none |
» timestamp | string | false | none | none |
notifications
Notification endpoints
Retrieve the list of notifications for an address with pagination
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/notifications?userAddress=string&page=string&perPage=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/notifications?userAddress=string&page=string&perPage=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/notifications?userAddress=string&page=string&perPage=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/notifications?userAddress=string&page=string&perPage=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/notifications?userAddress=string&page=string&perPage=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/notifications?userAddress=string&page=string&perPage=string")
.header("accept", "application/json")
.asString();
GET /notifications
Return notifications in an array
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
userAddress | query | string | true | User address |
page | query | string | true | Page number |
perPage | query | string | true | the number of records returned per page. Valid values are 10, 20, 30, 40, 50 |
Example responses
200 Response
[
{
"id": "string",
"recipient": "string",
"message": "string",
"type": "string",
"status": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
400 | Bad Request | Invalid user address | None |
500 | Internal Server Error | Internal Server Error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Notification] | false | none | none |
» id | string | false | read-only | none |
» recipient | string | false | none | none |
» message | string | false | none | none |
» type | string | false | none | none |
» status | string | false | none | none |
» createdAt | string(date-time) | false | read-only | none |
» updatedAt | string(date-time) | false | read-only | none |
Update status of a notification from UNREAD to READ
Code samples
curl --request PUT \
--url https://dex.tomochain.com/api/notifications/ \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"recipient":"string","message":"string","type":"string","status":"string"}'
var http = require("https");
var options = {
"method": "PUT",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/notifications/",
"headers": {
"content-type": "application/json",
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({recipient: 'string', message: 'string', type: 'string', status: 'string'}));
req.end();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/notifications/"
payload := strings.NewReader("{\"recipient\":\"string\",\"message\":\"string\",\"type\":\"string\",\"status\":\"string\"}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/notifications/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{\"recipient\":\"string\",\"message\":\"string\",\"type\":\"string\",\"status\":\"string\"}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
payload = "{\"recipient\":\"string\",\"message\":\"string\",\"type\":\"string\",\"status\":\"string\"}"
headers = {
'content-type': "application/json",
'accept': "application/json"
}
conn.request("PUT", "/api/notifications/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.put("https://dex.tomochain.com/api/notifications/")
.header("content-type", "application/json")
.header("accept", "application/json")
.body("{\"recipient\":\"string\",\"message\":\"string\",\"type\":\"string\",\"status\":\"string\"}")
.asString();
PUT /notifications/{id}
Returns newly updated notification
Body parameter
{
"recipient": "string",
"message": "string",
"type": "string",
"status": "string"
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | Notification | true | Notification object that needs to be updated |
» id | body | string | false | none |
» recipient | body | string | false | none |
» message | body | string | false | none |
» type | body | string | false | none |
» status | body | string | false | none |
» createdAt | body | string(date-time) | false | none |
» updatedAt | body | string(date-time) | false | none |
Example responses
200 Response
{
"id": "string",
"recipient": "string",
"message": "string",
"type": "string",
"status": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Notification |
400 | Bad Request | Invalid payload | None |
500 | Internal Server Error | Internal Server Error | None |
info
Info endpoints
get__info
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/info \
--header 'accept: */*'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/info",
"headers": {
"accept": "*/*"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/info"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "*/*")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/info")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = '*/*'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "*/*" }
conn.request("GET", "/api/info", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/info")
.header("accept", "*/*")
.asString();
GET /info
Example responses
200 Response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
500 | Internal Server Error | Internal server error | None |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» exchangeAddress | string | false | none | none |
» fee | string | false | none | none |
get__info_exchange
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/info/exchange \
--header 'accept: */*'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/info/exchange",
"headers": {
"accept": "*/*"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/info/exchange"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "*/*")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/info/exchange")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = '*/*'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "*/*" }
conn.request("GET", "/api/info/exchange", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/info/exchange")
.header("accept", "*/*")
.asString();
GET /info/exchange
Example responses
200 Response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» exchangeAddress | string | false | none | none |
get__info_fees
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/info/fees \
--header 'accept: */*'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/info/fees",
"headers": {
"accept": "*/*"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/info/fees"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "*/*")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/info/fees")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = '*/*'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "*/*" }
conn.request("GET", "/api/info/fees", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/info/fees")
.header("accept", "*/*")
.asString();
GET /info/fees
Example responses
200 Response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» fee | string | false | none | none |
market
Retrieve market stats 24h corresponding to a baseToken and a quoteToken
Code samples
curl --request GET \
--url 'https://dex.tomochain.com/api/market/stats?baseToken=string"eToken=string' \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/market/stats?baseToken=string"eToken=string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/market/stats?baseToken=string"eToken=string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/market/stats?baseToken=string"eToken=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/market/stats?baseToken=string"eToken=string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/market/stats?baseToken=string"eToken=string")
.header("accept", "application/json")
.asString();
GET /market/stats
Multiple status values can be provided with comma separated strings
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
baseToken | query | string | true | Base token address |
quoteToken | query | string | true | Quote token address |
Example responses
200 Response
{
"id": "string",
"baseTokenSymbol": "string",
"baseTokenAddress": "string",
"baseTokenDecimals": 0,
"quoteTokenSymbol": "string",
"quoteTokenAddress": "string",
"quoteTokenDecimals": 0,
"listed": true,
"active": true,
"rank": 0,
"makeFee": "string",
"takeFee": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Pair |
400 | Bad Request | baseToken Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Retrieve all market stats 2
Code samples
curl --request GET \
--url https://dex.tomochain.com/api/market/stats/all \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "dex.tomochain.com",
"port": null,
"path": "/api/market/stats/all",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dex.tomochain.com/api/market/stats/all"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://dex.tomochain.com/api/market/stats/all")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("dex.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/market/stats/all", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/market/stats/all")
.header("accept", "application/json")
.asString();
GET /market/stats/all
Multiple status values can be provided with comma separated strings
Example responses
200 Response
{
"pair": {
"pairName": "string",
"baseToken": "string",
"quoteToken": "string"
},
"open": "string",
"high": "string",
"low": 0,
"close": "string",
"volume": "string",
"count": "string",
"timestamp": "string",
"orderVolume": "string",
"orderCount": "string",
"askPrice": "string",
"bidPrice": "string",
"price": "string",
"rank": 0
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | PairData |
400 | Bad Request | baseToken Parameter missing | None |
500 | Internal Server Error | Internal Server Error | None |
Schemas
Account
{
"address": "0xF7349C253FF7747Df661296E0859c44e974fb52E"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | read-only | none |
address | string | false | none | none |
tokenBalances | object | false | none | none |
» address | string | false | none | none |
» symbol | string | false | none | none |
» balance | string | false | none | none |
» availableBalance | string | false | none | none |
» inOrderBalance | string | false | none | none |
isBlocked | boolean | false | none | none |
createdAt | string(date-time) | false | read-only | none |
updatedAt | string(date-time) | false | read-only | none |
TokenBalance
{
"address": "string",
"symbol": "string",
"balance": "string",
"availableBalance": "string",
"inOrderBalance": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
address | string | false | none | none |
symbol | string | false | none | none |
balance | string | false | none | none |
availableBalance | string | false | none | none |
inOrderBalance | string | false | none | none |
Token
{
"id": "string",
"name": "string",
"symbol": "string",
"address": "string",
"image": {
"url": "string",
"meta": {}
},
"contractAddress": "string",
"decimals": 0,
"active": true,
"listed": true,
"quote": true,
"makeFee": "string",
"takeFee": "string",
"usd": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | read-only | none |
name | string | false | none | none |
symbol | string | false | none | none |
address | string | false | none | none |
image | Image | false | none | none |
contractAddress | string | false | none | none |
decimals | integer(int32) | false | read-only | none |
active | boolean | false | none | none |
listed | boolean | false | read-only | none |
quote | boolean | false | none | none |
makeFee | string | false | none | none |
takeFee | string | false | none | none |
usd | string | false | read-only | none |
createdAt | string(date-time) | false | read-only | none |
updatedAt | string(date-time) | false | read-only | none |
Pair
{
"id": "string",
"baseTokenSymbol": "string",
"baseTokenAddress": "string",
"baseTokenDecimals": 0,
"quoteTokenSymbol": "string",
"quoteTokenAddress": "string",
"quoteTokenDecimals": 0,
"listed": true,
"active": true,
"rank": 0,
"makeFee": "string",
"takeFee": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | read-only | none |
baseTokenSymbol | string | false | none | none |
baseTokenAddress | string | false | none | none |
baseTokenDecimals | integer(int32) | false | read-only | none |
quoteTokenSymbol | string | false | none | none |
quoteTokenAddress | string | false | none | none |
quoteTokenDecimals | integer(int32) | false | read-only | none |
listed | boolean | false | read-only | none |
active | boolean | false | none | none |
rank | integer(int32) | false | read-only | none |
makeFee | string | false | read-only | none |
takeFee | string | false | read-only | none |
createdAt | string(date-time) | false | read-only | none |
updatedAt | string(date-time) | false | read-only | none |
PairID
{
"pairName": "string",
"baseToken": "string",
"quoteToken": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
pairName | string | false | none | none |
baseToken | string | false | none | none |
quoteToken | string | false | none | none |
PairData
{
"pair": {
"pairName": "string",
"baseToken": "string",
"quoteToken": "string"
},
"open": "string",
"high": "string",
"low": 0,
"close": "string",
"volume": "string",
"count": "string",
"timestamp": "string",
"orderVolume": "string",
"orderCount": "string",
"askPrice": "string",
"bidPrice": "string",
"price": "string",
"rank": 0
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
pair | PairID | false | none | none |
open | string | false | none | none |
high | string | false | none | none |
low | integer(int32) | false | none | none |
close | string | false | none | none |
volume | string | false | none | none |
count | string | false | none | none |
timestamp | string | false | none | none |
orderVolume | string | false | none | none |
orderCount | string | false | none | none |
askPrice | string | false | none | none |
bidPrice | string | false | none | none |
price | string | false | none | none |
rank | integer(int32) | false | none | none |
Image
{
"url": "string",
"meta": {}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
url | string | false | none | none |
meta | object | false | none | none |
Order
{
"id": "string",
"userAddress": "string",
"exchangeAddress": "string",
"baseToken": "string",
"quoteToken": "string",
"status": "string",
"side": "string",
"type": "string",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
},
"pricepoint": "string",
"amount": "string",
"filledAmount": "string",
"nonce": "string",
"makeFee": "string",
"takeFee": "string",
"pairName": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z",
"orderID": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | read-only | none |
userAddress | string | false | none | none |
exchangeAddress | string | false | none | none |
baseToken | string | false | none | none |
quoteToken | string | false | none | none |
status | string | false | none | none |
side | string | false | none | none |
type | string | false | none | none |
hash | string | false | none | none |
signature | Signature | false | none | none |
pricepoint | string | false | none | none |
amount | string | false | none | none |
filledAmount | string | false | none | none |
nonce | string | false | none | none |
makeFee | string | false | none | none |
takeFee | string | false | none | none |
pairName | string | false | none | none |
createdAt | string(date-time) | false | read-only | none |
updatedAt | string(date-time) | false | read-only | none |
orderID | string | false | none | none |
OrderCreate
{
"userAddress": "0x15e08dE16f534c890828F2a0D935433aF5B3CE0C",
"exchangeAddress": "0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e",
"baseToken": "0x4d7eA2cE949216D6b120f3AA10164173615A2b6C",
"quoteToken": "0x0000000000000000000000000000000000000001",
"side": "SELL/BUY",
"type": "LO/MO",
"status": "NEW/CANCELLED",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
},
"pricepoint": "21207020000000000000000",
"amount": "4693386710283129",
"nonce": "1",
"makeFee": "1",
"takeFee": "1"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
userAddress | string | false | none | none |
exchangeAddress | string | false | none | none |
baseToken | string | false | none | none |
quoteToken | string | false | none | none |
side | string | false | none | none |
type | string | false | none | none |
status | string | false | none | none |
hash | string | false | none | none |
signature | Signature | false | none | none |
pricepoint | string | false | none | none |
amount | string | false | none | none |
nonce | string | false | none | none |
makeFee | string | false | none | none |
takeFee | string | false | none | none |
OrderCancel
{
"orderHash": "string",
"nonce": "string",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
orderHash | string | false | none | none |
nonce | string | false | none | none |
hash | string | false | none | none |
signature | Signature | false | none | none |
Signature
{
"V": "string",
"R": "string",
"S": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
V | string | false | none | none |
R | string | false | none | none |
S | string | false | none | none |
OrderBook
{
"pairName": "string",
"asks": [
{
"amount": "string",
"pricepoint": "string"
}
],
"bids": [
{
"amount": "string",
"pricepoint": "string"
}
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
pairName | string | false | none | none |
asks | [object] | false | none | none |
» amount | string | false | none | none |
» pricepoint | string | false | none | none |
bids | [object] | false | none | none |
» amount | string | false | none | none |
» pricepoint | string | false | none | none |
RawOrderBook
{
"pairName": "string",
"orders": [
{
"id": "string",
"userAddress": "string",
"exchangeAddress": "string",
"baseToken": "string",
"quoteToken": "string",
"status": "string",
"side": "string",
"type": "string",
"hash": "string",
"signature": {
"V": "string",
"R": "string",
"S": "string"
},
"pricepoint": "string",
"amount": "string",
"filledAmount": "string",
"nonce": "string",
"makeFee": "string",
"takeFee": "string",
"pairName": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z",
"orderID": "string"
}
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
pairName | string | false | none | none |
orders | [Order] | false | none | none |
Trade
{
"id": "string",
"taker": "string",
"maker": "string",
"baseToken": "string",
"quoteToken": "string",
"makerOrderHash": "string",
"takerOrderHash": "string",
"hash": "string",
"txHash": "string",
"pairName": "string",
"pricepoint": "string",
"amount": "string",
"status": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | read-only | none |
taker | string | false | none | none |
maker | string | false | none | none |
baseToken | string | false | none | none |
quoteToken | string | false | none | none |
makerOrderHash | string | false | none | none |
takerOrderHash | string | false | none | none |
hash | string | false | none | none |
txHash | string | false | none | none |
pairName | string | false | none | none |
pricepoint | string | false | none | none |
amount | string | false | none | none |
status | string | false | none | none |
createdAt | string(date-time) | false | read-only | none |
updatedAt | string(date-time) | false | read-only | none |
Tick
{
"pair": {
"pairName": "string",
"baseToken": "string",
"quoteToken": "string"
},
"open": "string",
"high": "string",
"low": 0,
"close": "string",
"volume": "string",
"count": "string",
"timestamp": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
pair | PairID | false | none | none |
open | string | false | none | none |
high | string | false | none | none |
low | integer(int32) | false | none | none |
close | string | false | none | none |
volume | string | false | none | none |
count | string | false | none | none |
timestamp | string | false | none | none |
Notification
{
"id": "string",
"recipient": "string",
"message": "string",
"type": "string",
"status": "string",
"createdAt": "2020-06-22T09:54:03Z",
"updatedAt": "2020-06-22T09:54:03Z"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | read-only | none |
recipient | string | false | none | none |
message | string | false | none | none |
type | string | false | none | none |
status | string | false | none | none |
createdAt | string(date-time) | false | read-only | none |
updatedAt | string(date-time) | false | read-only | none |
ApiResponse
{
"code": 0,
"type": "string",
"message": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
code | integer(int32) | false | none | none |
type | string | false | none | none |
message | string | false | none | none |
TomoScan APIs v1.0.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
TomoScan APIs
License: Github
Accounts
Accounts API
Get list accounts
Code samples
curl --request GET \
--url https://example.com/api/accounts
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/accounts",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/accounts"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/accounts")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/accounts")
.asString();
GET /api/accounts
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
page | query | number | false | default = 1, maximum = 500 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Get account detail
Code samples
curl --request GET \
--url https://example.com/api/accounts/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/accounts/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/accounts/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/accounts/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/accounts/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/accounts/string")
.asString();
GET /api/accounts/{hash}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
hash | path | string | true | account address |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get list block create
Code samples
curl --request GET \
--url https://example.com/api/accounts/string/mined
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/accounts/string/mined",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/accounts/string/mined"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/accounts/string/mined")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/accounts/string/mined")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/accounts/string/mined")
.asString();
GET /api/accounts/{hash}/mined
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
hash | path | string | true | account address |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Blocks
Blocks API
Get list blocks
Code samples
curl --request GET \
--url https://example.com/api/blocks
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/blocks",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/blocks"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/blocks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/blocks")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/blocks")
.asString();
GET /api/blocks
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
page | query | number | false | default = 1, maximum = 500 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Get block detail
Code samples
curl --request GET \
--url https://example.com/api/blocks/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/blocks/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/blocks/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/blocks/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/blocks/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/blocks/string")
.asString();
GET /api/blocks/{hash}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
hash | path | string | true | block number or block hash |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Check exist transaction from/to address inside block
Code samples
curl --request GET \
--url https://example.com/api/blocks/0/address/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/blocks/0/address/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/blocks/0/address/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/blocks/0/address/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/blocks/0/address/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/blocks/0/address/string")
.asString();
GET /api/blocks/{blockNumber}/address/{address}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
blockNumber | path | number | true | block number |
address | path | string | true | address |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get list signers of a block
Code samples
curl --request GET \
--url https://example.com/api/blocks/signers/0
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/blocks/signers/0",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/blocks/signers/0"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/blocks/signers/0")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/blocks/signers/0")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/blocks/signers/0")
.asString();
GET /api/blocks/signers/{blockNumber}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
blockNumber | path | number | true | account address |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Get latest irreversible block
Code samples
curl --request GET \
--url https://example.com/api/blocks/finality/latestIrreversibleBlock
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/blocks/finality/latestIrreversibleBlock",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/blocks/finality/latestIrreversibleBlock"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/blocks/finality/latestIrreversibleBlock")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/blocks/finality/latestIrreversibleBlock")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/blocks/finality/latestIrreversibleBlock")
.asString();
GET /api/blocks/finality/latestIrreversibleBlock
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Contracts
Contract API
Get list verified contract
Code samples
curl --request GET \
--url https://example.com/api/contracts
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/contracts",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/contracts"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/contracts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/contracts")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/contracts")
.asString();
GET /api/contracts
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
page | query | number | false | default = 1, maximum = 500 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Get contract detail
Code samples
curl --request GET \
--url https://example.com/api/contracts/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/contracts/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/contracts/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/contracts/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/contracts/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/contracts/string")
.asString();
GET /api/contracts/{contractAddress}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
contractAddress | path | string | true | contract address |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Read all function on contract
Code samples
curl --request GET \
--url https://example.com/api/contracts/string/read
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/contracts/string/read",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/contracts/string/read"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/contracts/string/read")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/contracts/string/read")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/contracts/string/read")
.asString();
GET /api/contracts/{contractAddress}/read
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
contractAddress | path | string | true | contract address |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Transactions
Transactions API
Get list transaction by type
Code samples
curl --request GET \
--url https://example.com/api/txs/listByType/:txType
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/txs/listByType/:txType",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/txs/listByType/:txType"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/txs/listByType/:txType")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/txs/listByType/:txType")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/txs/listByType/:txType")
.asString();
GET /api/txs/listByType/:txType
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
txType | path | number | true | signTxs |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Get list txs by block number.
Code samples
curl --request GET \
--url https://example.com/api/txs/listByBlock/0
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/txs/listByBlock/0",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/txs/listByBlock/0"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/txs/listByBlock/0")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/txs/listByBlock/0")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/txs/listByBlock/0")
.asString();
GET /api/txs/listByBlock/{blockNumber}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
blockNumber | path | number | true | block number |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 100 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Get list txs by account address.
Code samples
curl --request GET \
--url https://example.com/api/txs/listByAccount/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/txs/listByAccount/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/txs/listByAccount/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/txs/listByAccount/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/txs/listByAccount/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/txs/listByAccount/string")
.asString();
GET /api/txs/listByAccount/{address}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | path | string | true | account address |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 100 |
tx_type | query | string | false | in |
filterAddress | query | string | false | transaction send to/from address |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Get transaction detail
Code samples
curl --request GET \
--url https://example.com/api/txs/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/txs/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/txs/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/txs/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/txs/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/txs/string")
.asString();
GET /api/txs/{hash}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
hash | path | string | true | transaction hash |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get internal transaction of an address
Code samples
curl --request GET \
--url https://example.com/api/txs/internal/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/txs/internal/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/txs/internal/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/txs/internal/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/txs/internal/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/txs/internal/string")
.asString();
GET /api/txs/internal/{address}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | path | string | true | account address |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Tokens
Tokens API
Get token detail
Code samples
curl --request GET \
--url https://example.com/api/tokens/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/tokens/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/tokens/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/tokens/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/tokens/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/tokens/string")
.asString();
GET /api/tokens/{hash}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
hash | path | string | true | token address |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get list token holding of a holder
Code samples
curl --request GET \
--url https://example.com/api/tokens/holding/string/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/tokens/holding/string/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/tokens/holding/string/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/tokens/holding/string/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/tokens/holding/string/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/tokens/holding/string/string")
.asString();
GET /api/tokens/holding/{tokenType}/{holder}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
tokenType | path | string | true | trc20 |
holder | path | string | true | holder address |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Epoch
Get list epoch
Code samples
curl --request GET \
--url https://example.com/api/epochs
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/epochs",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/epochs"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/epochs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/epochs")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/epochs")
.asString();
GET /api/epochs
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get epoch detail
Code samples
curl --request GET \
--url https://example.com/api/epochs/0
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/epochs/0",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/epochs/0"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/epochs/0")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/epochs/0")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/epochs/0")
.asString();
GET /api/epochs/{epochNumber}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
epochNumber | path | number | true | epoch number |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Rewards
Get list rewards of a voter
Code samples
curl --request GET \
--url https://example.com/api/rewards/0
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/rewards/0",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/rewards/0"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/rewards/0")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/rewards/0")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/rewards/0")
.asString();
GET /api/rewards/{voter}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
voter | path | number | true | account address |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Get list reward of an epoch
Code samples
curl --request GET \
--url https://example.com/api/rewards/epoch/0
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/rewards/epoch/0",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/rewards/epoch/0"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/rewards/epoch/0")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/rewards/epoch/0")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/rewards/epoch/0")
.asString();
GET /api/rewards/epoch/{epochNumber}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
epochNumber | path | number | true | epoch number |
hash | path | string | true | account address |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get total rewards of an address
Code samples
curl --request GET \
--url https://example.com/api/rewards/total/string/0/0
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/rewards/total/string/0/0",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/rewards/total/string/0/0"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/rewards/total/string/0/0")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/rewards/total/string/0/0")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/rewards/total/string/0/0")
.asString();
GET /api/rewards/total/{address}/{fromEpoch}/{toEpoch}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | path | string | true | account address |
fromEpoch | path | number | true | from epoch |
toEpoch | path | number | true | to epoch |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Token
Get list tokens
Code samples
curl --request GET \
--url https://example.com/api/tokens
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/tokens",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/tokens"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/tokens")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/tokens")
.asString();
GET /api/tokens
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
type | query | string | false | trc20 |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Get list trc20 token holder. Require 1 of 2 conditions - address | hash
Code samples
curl --request GET \
--url https://example.com/api/token-holders
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/token-holders",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/token-holders"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/token-holders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/token-holders")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/token-holders")
.asString();
GET /api/token-holders
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | query | string | false | token address |
hash | query | string | false | account address |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Get list token transactions.
Code samples
curl --request GET \
--url https://example.com/api/token-txs/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/token-txs/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/token-txs/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/token-txs/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/token-txs/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/token-txs/string")
.asString();
GET /api/token-txs/{tokenType}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
tokenType | path | string | true | trc20 |
holder | query | string | false | holder address |
token | query | string | false | token address |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Get list token transactions by transaction hash.
Code samples
curl --request GET \
--url https://example.com/api/token-txs/string/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/token-txs/string/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/token-txs/string/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/token-txs/string/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/token-txs/string/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/token-txs/string/string")
.asString();
GET /api/token-txs/{tokenType}/{txHash}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
tokenType | path | string | true | trc20 |
txHash | path | string | true | token address |
holder | query | string | false | holder address |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
500 | Internal Server Error | Server Internal Error | None |
Orders
Get list order
Code samples
curl --request GET \
--url https://example.com/api/orders
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/orders",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/orders"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/orders")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/orders")
.asString();
GET /api/orders
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
userAddress | query | string | false | userAddress |
pairName | query | string | false | pairName = btc/tomo |
side | query | string | false | buy/sell |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get list order of dex
Code samples
curl --request GET \
--url https://example.com/api/orders/listByDex/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/orders/listByDex/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/orders/listByDex/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/orders/listByDex/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/orders/listByDex/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/orders/listByDex/string")
.asString();
GET /api/orders/listByDex/{dexAddress}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
dexAddress | path | string | true | address of dex |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get list order of account
Code samples
curl --request GET \
--url https://example.com/api/orders/listByAccount/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/orders/listByAccount/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/orders/listByAccount/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/orders/listByAccount/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/orders/listByAccount/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/orders/listByAccount/string")
.asString();
GET /api/orders/listByAccount/{accountAddress}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
accountAddress | path | string | true | address of account |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get list order by pair
Code samples
curl --request GET \
--url https://example.com/api/orders/listByPair/string/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/orders/listByPair/string/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/orders/listByPair/string/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/orders/listByPair/string/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/orders/listByPair/string/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/orders/listByPair/string/string")
.asString();
GET /api/orders/listByPair/{baseToken}/{quoteToken}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
baseToken | path | string | true | base token |
quoteToken | path | string | true | quote token |
userAddress | query | string | false | filter account address |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Trades
Get list trade
Code samples
curl --request GET \
--url https://example.com/api/trades
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/trades",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/trades"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/trades")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/trades")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades")
.asString();
GET /api/trades
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
userAddress | query | string | false | userAddress |
pairName | query | string | false | pairName = btc/tomo |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get list trade of dex
Code samples
curl --request GET \
--url https://example.com/api/trades/listByDex/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/trades/listByDex/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/trades/listByDex/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/trades/listByDex/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/trades/listByDex/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/listByDex/string")
.asString();
GET /api/trades/listByDex/{dexAddress}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
dexAddress | path | string | true | address of dex |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get list trade of account
Code samples
curl --request GET \
--url https://example.com/api/trades/listByAccount/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/trades/listByAccount/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/trades/listByAccount/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/trades/listByAccount/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/trades/listByAccount/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/listByAccount/string")
.asString();
GET /api/trades/listByAccount/{accountAddress}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
accountAddress | path | string | true | address of account |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get list order by pair
Code samples
curl --request GET \
--url https://example.com/api/trades/listByPair/string/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/trades/listByPair/string/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/trades/listByPair/string/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/trades/listByPair/string/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/trades/listByPair/string/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/listByPair/string/string")
.asString();
GET /api/trades/listByPair/{baseToken}/{quoteToken}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
baseToken | path | string | true | base token |
quoteToken | path | string | true | quote token |
userAddress | query | string | false | filter account address |
page | query | number | false | default = 1 |
limit | query | number | false | default 20, maximum = 50 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get trade stats
Code samples
curl --request GET \
--url https://example.com/api/trades/stats/string/string
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/trades/stats/string/string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/trades/stats/string/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/trades/stats/string/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/trades/stats/string/string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/stats/string/string")
.asString();
GET /api/trades/stats/{exchangeAddress}/{pairName}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
exchangeAddress | path | string | true | exchange address |
pairName | path | string | true | pair |
date | query | string | false | stats of a special day yyyy-mm-dd |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get trade daily stats
Code samples
curl --request GET \
--url 'https://example.com/api/trades/dailyStats/string/string?fromDate=string&toDate=string'
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/trades/dailyStats/string/string?fromDate=string&toDate=string",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/trades/dailyStats/string/string?fromDate=string&toDate=string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/trades/dailyStats/string/string?fromDate=string&toDate=string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/trades/dailyStats/string/string?fromDate=string&toDate=string")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/dailyStats/string/string?fromDate=string&toDate=string")
.asString();
GET /api/trades/dailyStats/{exchangeAddress}/{pairName}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
exchangeAddress | path | string | true | exchange address |
pairName | path | string | true | pair |
fromDate | query | string | true | from day yyyy-mm-dd |
toDate | query | string | true | from day yyyy-mm-dd |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get trade weekly stats
Code samples
curl --request GET \
--url 'https://example.com/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0'
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0")
.asString();
GET /api/trades/weeklyStats/{exchangeAddress}/{pairName}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
exchangeAddress | path | string | true | exchange address |
pairName | path | string | true | pair |
fromYear | query | number | true | from year |
fromWeek | query | number | true | from week 1-53 |
toYear | query | number | true | to year |
toWeek | query | number | true | to week 1-53 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
Get trade monthly stats
Code samples
curl --request GET \
--url 'https://example.com/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0'
var http = require("https");
var options = {
"method": "GET",
"hostname": "example.com",
"port": null,
"path": "/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0",
"headers": {}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://example.com/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0")
.asString();
GET /api/trades/monthlyStats/{exchangeAddress}/{pairName}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
exchangeAddress | path | string | true | exchange address |
pairName | path | string | true | pair |
fromYear | query | number | true | from year |
fromMonth | query | number | true | from week 1-12 |
toYear | query | number | true | to year |
toMonth | query | number | true | to week 1-12 |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
400 | Bad Request | Bad Request | None |
404 | Not Found | Not Found | None |
500 | Internal Server Error | Server Internal Error | None |
TomoMaster APIs v1.3.3
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Happy to code TomoMaster APIs
Base URLs:
License: Github
Config
Get TomoMaster Application Configuration
Get TomoMaster Application Configuration
Code samples
curl --request GET \
--url https://master.tomochain.com/api/config \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "master.tomochain.com",
"port": null,
"path": "/api/config",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://master.tomochain.com/api/config"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://master.tomochain.com/api/config")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("master.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/config", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/config")
.header("accept", "application/json")
.asString();
GET /api/config
Example responses
200 Response
{
"blockchain": {
"rpc": "string",
"ws": "string",
"epoch": 900,
"blockTime": 0
},
"explorerUrl": "string",
"GA": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | config |
400 | Bad Request | Bad Request | None |
401 | Unauthorized | Unauthorized | None |
406 | Not Acceptable | Not Acceptable | None |
500 | Internal Server Error | Server Internal Error | None |
Candidates
Get Candidates information
Get candidates information
Code samples
curl --request GET \
--url https://master.tomochain.com/api/candidates \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "master.tomochain.com",
"port": null,
"path": "/api/candidates",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://master.tomochain.com/api/candidates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://master.tomochain.com/api/candidates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("master.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/candidates", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates")
.header("accept", "application/json")
.asString();
GET /api/candidates
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
limit | query | number | false | Number of record in a query |
page | query | number | false | Page number |
Example responses
200 Response
{
"items": [
{
"_id": "123",
"candidate": "0x11621900588eca4410c00097a9f59237f34064cd",
"smartContractAddress": "0x0000000000000000000000000000000000000088",
"__v": 0,
"capacity": "91540333800000001000000",
"createdAt": "2018-10-31T03:42:39.375Z",
"owner": "0x11621900588eca4410c00097a9f59237f34064cd",
"status": "RESIGNED",
"updatedAt": "2019-01-11T09:21:55.028Z",
"latestSignedBlock": 2917487,
"capacityNumber": 91540.33380000001,
"isMasternode": false,
"isPenalty": false
}
],
"total": 100,
"activeCandidates": 10
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | candidate |
406 | Not Acceptable | Not Acceptable | None |
Get masternodes(exclude Proposed candidates) information
Code samples
curl --request GET \
--url https://master.tomochain.com/api/candidates/masternodes \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "master.tomochain.com",
"port": null,
"path": "/api/candidates/masternodes",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://master.tomochain.com/api/candidates/masternodes"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://master.tomochain.com/api/candidates/masternodes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("master.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/candidates/masternodes", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/masternodes")
.header("accept", "application/json")
.asString();
GET /api/candidates/masternodes
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
limit | query | number | false | Number of record in a query |
page | query | number | false | Page number |
Example responses
200 Response
{
"items": [
{
"_id": "5c52a0df5f0abf3496d9a38f",
"candidate": "0x1d50df657b6dce50bac634bf18e2d986d807e940",
"smartContractAddress": "0x0000000000000000000000000000000000000088",
"__v": 0,
"capacity": "574962709628904011242293",
"capacityNumber": 574962.709628904,
"createdAt": "2019-01-31T07:16:47.833Z",
"nodeId": "1d50df657b6dce50bac634bf18e2d986d807e940",
"owner": "0x300d18c65563d0c9021d7722dd1aab74b9cc447f",
"status": "MASTERNODE",
"updatedAt": "2019-04-11T02:56:39.928Z",
"latestSignedBlock": 3899535,
"name": "GNBA.GE",
"rank": 1
}
],
"activeCandidates": 150,
"totalSlashed": 1,
"totalResigned": 53,
"totalProposed": 10
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | masternode |
406 | Not Acceptable | Not Acceptable | None |
Get slashed Masternodes
Code samples
curl --request GET \
--url https://master.tomochain.com/api/candidates/slashedMNs \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "master.tomochain.com",
"port": null,
"path": "/api/candidates/slashedMNs",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://master.tomochain.com/api/candidates/slashedMNs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://master.tomochain.com/api/candidates/slashedMNs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("master.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/candidates/slashedMNs", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/slashedMNs")
.header("accept", "application/json")
.asString();
GET /api/candidates/slashedMNs
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
limit | query | number | false | Number of record in a query |
page | query | number | false | Page number |
Example responses
200 Response
{
"items": [
{
"_id": "5c4006b47ff073e7961fabd5",
"candidate": "0x1c5a1cb41c920c2532cbb77be5845b258eca32f3",
"smartContractAddress": "0x0000000000000000000000000000000000000088",
"__v": 0,
"capacity": "114213709385390179602070",
"capacityNumber": 114213.70938539018,
"createdAt": "2019-01-17T04:38:12.051Z",
"nodeId": "1c5a1cb41c920c2532cbb77be5845b258eca32f3",
"owner": "0xe60f54049759a11d764756ece4d27815e990d92f",
"status": "SLASHED",
"updatedAt": "2019-01-29T10:38:18.268Z",
"latestSignedBlock": 1220265
}
],
"total": 1
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | slashedMN |
406 | Not Acceptable | Not Acceptable | None |
Get proposed Masternodes
Code samples
curl --request GET \
--url https://master.tomochain.com/api/candidates/proposedMNs \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "master.tomochain.com",
"port": null,
"path": "/api/candidates/proposedMNs",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://master.tomochain.com/api/candidates/proposedMNs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://master.tomochain.com/api/candidates/proposedMNs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("master.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/candidates/proposedMNs", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/proposedMNs")
.header("accept", "application/json")
.asString();
GET /api/candidates/proposedMNs
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
limit | query | number | false | Number of record in a query |
page | query | number | false | Page number |
Example responses
200 Response
{
"items": [
{
"_id": "5c4006b47ff073e7961fabd5",
"candidate": "0x1c5a1cb41c920c2532cbb77be5845b258eca32f3",
"smartContractAddress": "0x0000000000000000000000000000000000000088",
"__v": 0,
"capacity": "114213709385390179602070",
"capacityNumber": 114213.70938539018,
"createdAt": "2019-01-17T04:38:12.051Z",
"nodeId": "1c5a1cb41c920c2532cbb77be5845b258eca32f3",
"owner": "0xe60f54049759a11d764756ece4d27815e990d92f",
"status": "PROPOSED",
"updatedAt": "2019-01-29T10:38:18.268Z",
"latestSignedBlock": 1220265
}
],
"total": 1
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | proposedMN |
406 | Not Acceptable | Not Acceptable | None |
Get resigned Masternodes
Code samples
curl --request GET \
--url https://master.tomochain.com/api/candidates/resignedMNs \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "master.tomochain.com",
"port": null,
"path": "/api/candidates/resignedMNs",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://master.tomochain.com/api/candidates/resignedMNs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://master.tomochain.com/api/candidates/resignedMNs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("master.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/candidates/resignedMNs", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/resignedMNs")
.header("accept", "application/json")
.asString();
GET /api/candidates/resignedMNs
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
limit | query | number | false | Number of record in a query |
page | query | number | false | Page number |
Example responses
200 Response
{
"items": [
{
"_id": "5c4006b37ff073e7961fab14",
"candidate": "0x7a3b86261cd2042a3190c81dd37d0a12e0397daf",
"smartContractAddress": "0x0000000000000000000000000000000000000088",
"__v": 0,
"capacity": "40508760000000000000000",
"capacityNumber": 40508.76,
"createdAt": "2019-01-17T04:38:11.949Z",
"nodeId": "7a3b86261cd2042a3190c81dd37d0a12e0397daf",
"owner": "0xbff690303287ce327c319f575c7671c3ad626de4",
"status": "RESIGNED",
"updatedAt": "2019-01-29T10:11:19.464Z",
"latestSignedBlock": 957442
}
],
"total": 1
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | resignedMN |
406 | Not Acceptable | Not Acceptable | None |
Get candidate's information
Code samples
curl --request GET \
--url https://master.tomochain.com/api/candidates/string \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "master.tomochain.com",
"port": null,
"path": "/api/candidates/string",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://master.tomochain.com/api/candidates/string"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://master.tomochain.com/api/candidates/string")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("master.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/candidates/string", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/string")
.header("accept", "application/json")
.asString();
GET /api/candidates/{candidate}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
candidate | path | string | true | candidate's address |
Example responses
200 Response
{
"_id": "123",
"candidate": "0x11621900588eca4410c00097a9f59237f34064cd",
"smartContractAddress": "0x0000000000000000000000000000000000000088",
"__v": 0,
"capacity": "91540333800000001000000",
"createdAt": "2018-10-31T03:42:39.375Z",
"owner": "0x11621900588eca4410c00097a9f59237f34064cd",
"status": "RESIGNED",
"updatedAt": "2019-01-11T09:17:59.535Z",
"latestSignedBlock": "2917487",
"capacityNumber": 91540.33380000001,
"isMasternode": false,
"isPenalty": false
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | candidateDetail |
406 | Not Acceptable | Not Acceptable | None |
Get voters who voted for the candidate
Code samples
curl --request GET \
--url https://master.tomochain.com/api/candidates/string/voters \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "master.tomochain.com",
"port": null,
"path": "/api/candidates/string/voters",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://master.tomochain.com/api/candidates/string/voters"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://master.tomochain.com/api/candidates/string/voters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("master.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/candidates/string/voters", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/string/voters")
.header("accept", "application/json")
.asString();
GET /api/candidates/{candidate}/voters
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
candidate | path | string | true | candidate's address |
limit | query | number | false | Number of record in a query |
page | query | number | false | Page number |
Example responses
200 Response
{
"items": [
{
"_id": "5bd924a9aa41b819395d9207",
"candidate": "0x11621900588eca4410c00097a9f59237f34064cd",
"smartContractAddress": "0x0000000000000000000000000000000000000088",
"voter": "0xf2cce442c7ab5baf194838081b5f9396330ecfb8",
"__v": 0,
"capacity": "105000000000000000000",
"createdAt": "2018-10-31T03:42:33.922Z",
"updatedAt": "2019-01-05T02:11:31.489Z",
"capacityNumber": 105
}
],
"total": 100
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | candidateVoter |
406 | Not Acceptable | Not Acceptable | None |
Masternode checking
Code samples
curl --request GET \
--url https://master.tomochain.com/api/candidates/string/isMasternode \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "master.tomochain.com",
"port": null,
"path": "/api/candidates/string/isMasternode",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://master.tomochain.com/api/candidates/string/isMasternode"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://master.tomochain.com/api/candidates/string/isMasternode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("master.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/candidates/string/isMasternode", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/string/isMasternode")
.header("accept", "application/json")
.asString();
GET /api/candidates/{candidate}/isMasternode
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
candidate | path | string | true | candidate's address |
Example responses
200 Response
"1"
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | isMasternode |
406 | Not Acceptable | Not Acceptable | None |
Candidate checking
Code samples
curl --request GET \
--url https://master.tomochain.com/api/candidates/string/isCandidate \
--header 'accept: application/json'
var http = require("https");
var options = {
"method": "GET",
"hostname": "master.tomochain.com",
"port": null,
"path": "/api/candidates/string/isCandidate",
"headers": {
"accept": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://master.tomochain.com/api/candidates/string/isCandidate"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://master.tomochain.com/api/candidates/string/isCandidate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("master.tomochain.com")
headers = { 'accept': "application/json" }
conn.request("GET", "/api/candidates/string/isCandidate", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/string/isCandidate")
.header("accept", "application/json")
.asString();
GET /api/candidates/{candidate}/isCandidate
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
candidate | path | string | true | candidate's address |
Example responses
200 Response
"1"