GetEstimatedFee()

Summary

Route

Type

Example

Monitor/GetEstimatedFee

POST

http://apinode.credits.com/api/monitor/getestimatedfee

Description

Get transaction fee.

Request

Request Structure

{ // Parameters common for all requests // Wallet address "transactionSize": <size>, "trType": a // (a = 0 - normal, 1 - token transfer, 2 - contract deploy, 3 - contract execute) }

Request Parameters

int: transactionSize - Transaction size in bytes

int: trType- Transaction type. 0 - normal, 1 - token transfer, 2 - contract deploy, 3 - contract execute

Response

JSON output depends on the request type and its success.

If there’s an error, request returns to the node basic Result:

  • Success: False

  • Message:

If successful, requested information is returned.

Response Structure

{ "fee": decimal, // amount of fee "success":bool, // Shows if request was Succes or False Boolean Value "message":"String" // Shows if a problem occurred with request in String Value }

Example Code

import requests import json def gettransactioninfo(): url = 'http://apinode.credits.com/api/monitor/getgetestimatedfee' headers = { 'Content-type': 'application/json' , 'Accept': 'application/json' , 'Content-Encoding': 'utf-8' } data = { #transaction size 500 bytes "transactionSize":500", #transaction type 1 - token transfer "trType": 1 # } answer = requests.post(url, data=json.dumps(data), headers=headers) response = answer.json() print(response) gettransactioninfo()