qan_estimateGas
API details
Returns an estimation of gas for a given transaction.
HTTP response status codes for "qan_estimateGas"
Status Code | Description |
---|---|
200 | OK |
400 | Bad Request |
404 | Not Found |
422 | Unprocessable Entity |
500 | Internal Server Error |
Code samples for "qan_estimateGas"
Request examples
post/estimateGas/
cURLJavaScriptGoPython
curl --request POST \
--url https://rpc-testnet.qanplatform.com/estimateGas/ \
--header 'Accept: application/json, , application/problem+json' \
--header 'Content-Type: application/json' \
--data '
{
"Object": {
"Balance": "string",
"Code": "integer",
"Nonce": "string",
"State": "string",
"StateDiff": "string"
},
"Transaction": {
"Data": "string",
"From": "string",
"Gas": "string",
"GasPrice": "string",
"To": "string",
"Value": "string"
}
}
'
const options = {
method: 'POST',
headers: {
Accept: 'application/json, , application/problem+json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
Object: {
Balance: 'string',
Code: 'integer',
Nonce: 'string',
State: 'string',
StateDiff: 'string'
},
Transaction: {
Data: 'string',
From: 'string',
Gas: 'string',
GasPrice: 'string',
To: 'string',
Value: 'string'
}
})
};
fetch('https://rpc-testnet.qanplatform.com/estimateGas/', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://rpc-testnet.qanplatform.com/estimateGas/"
payload := strings.NewReader("{\"Object\":{\"Balance\":\"string\",\"Code\":\"integer\",\"Nonce\":\"string\",\"State\":\"string\",\"StateDiff\":\"string\"},\"Transaction\":{\"Data\":\"string\",\"From\":\"string\",\"Gas\":\"string\",\"GasPrice\":\"string\",\"To\":\"string\",\"Value\":\"string\"}}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "application/json, , application/problem+json")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
import requests
url = "https://rpc-testnet.qanplatform.com/estimateGas/"
payload = {
"Object": {
"Balance": "string",
"Code": "integer",
"Nonce": "string",
"State": "string",
"StateDiff": "string"
},
"Transaction": {
"Data": "string",
"From": "string",
"Gas": "string",
"GasPrice": "string",
"To": "string",
"Value": "string"
}
}
headers = {
"Accept": "application/json, , application/problem+json",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
Response examples
200400404422500
Content type: application/json
{"EstimatedGas":"string"}
Content type: application/problem+json
{}
Content type: application/problem+json
{}
Content type: application/problem+json
{}
Content type: application/problem+json
{}