Developers
  • SWT PROTOCOL
    • Introduction
    • Accounts
    • Transactions
    • Fees
    • Smart Contracts
  • GETTING STARTED
    • Network Node
      • Introduction
      • STEP 1:RENTING A LINUX VPS
      • STEP 2:INSTALLATION OF PUTTY
      • STEP 3:INSTALLATION OF FILEZILLA
      • STEP 4:VPS CONNECTION AND LINUX CONFIGURATION WITH PUTTY (SSH)
      • STEP 5:HOW TO SECURE YOUR VPS
      • STEP 6:USING TMUX THROUGH PUTTY
      • STEP 7:UPLOAD OF THE SWT SOFTWARE WITH FILEZILLA
      • STEP 8:EXTRACT THE SWT SOFTWARE FOLDER
      • STEP 9:RUNNING THE SWT NODE THROUGH TMUX
      • STEP 10:RUNNING THE MONITORING TOOLS
  • API REFERENCE
    • Apache Thrift API
      • Transactions
      • Blocks
      • Smart contract
      • Tokens
      • Wallets
      • Sync info
      • Data structures
    • REST API
      • GetBlocks()
      • GetNodeInfo()
      • GetBalance()
      • GetWalletInfo()
      • GetTokenBalance()
      • GetTransactionsByWallet()
      • GetTransactionInfo()
      • GetEstimatedFee()
      • GetContractByAddress()
      • GetContractFromTransaction()
      • GetContractMethods()
      • ContractValidation()
      • ContractCall()
      • TransactionPack()
      • TransactionExec()
  • SMART CONTRACTS
    • Creating "Hello-world" Smart Contract
    • Smart Contract Methods
    • Smart Contract Standarts
      • Token Smart Contract
      • Escrow Smart Contract
      • Stable coin Token
  • HOW TO REST API
    • Introduction
    • Retrieve a balance from the blockchain
    • Request a specific transaction from the blockchain
    • Sending Transactions to the SWT Blockchain
    • Validating and deploying a Smart Contract with REST API
Powered by GitBook
On this page
  • Summary
  • Description
  • Request
  • Response
  • Example Code
  1. API REFERENCE
  2. REST API

GetEstimatedFee()

Summary

Route
Type
Example

Monitor/GetEstimatedFee

POST

http://176.113.80.7:62000/api/monitor/getestimatedfee

Description

Get transaction fee.

Request

Request Structure

{

// Parameters common for all requests

// Wallet address
  "networkAlias": string, // Mainnet or Testnet
  "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

Python

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

PreviousGetTransactionInfo()NextGetContractByAddress()

Last updated 1 year ago