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
  1. API REFERENCE
  2. REST API

ContractCall()

Summary

Route
Type
Example

/contract/contractcall

POST

http://176.113.80.7:62000/api/contract/contractcall

Description

Executes smart contract and actually forms a transaction to be executed, that’s why the output is the same with calling the method TransactionExec(). From the user point of view it looks like a selection of a smart contract, its methods, specifying parameters for selected methods. This is the work for front-end developer. The RESTful API has only the function to pack all of this information in a transaction and output an array of data for signature.

Request

Request Structure

{

// parameters common for all requests для любых запросов

…..

// API method name to form and process a transaction

"MethodApi" : "string_value",

// sender public key

"PublicKey":"string_value",

// smart contract public key

"ReceiverPublicKey":"string_value",

// maximum fee allowed by the user

"Fee":"decimal",

// invoked smart contract method

"Method":"string_value",

// arguments for the execution of a smart contract method

"Args":"string_value",

// data the user sent with the transaction

"UserData":"string_value"

}

Request Parameters

MethodApi: string value - it’s vital to specify the API method to pack the transaction: "SmartDeploy", "SmartMethodExecute";

PublicKey: string_value - sender public key in base58

ReceiverPublicKey: string_value - recipient public key (in this case, smart contract public key in base58 will be generated automatically)

Amount: decimal - transaction amount as a decimal or integer number. This field is not required to deploy or initiate the smart contract

Fee: decimal - maximum fee approved by the user as a decimal or integer number

Method: string_value - Name of the invoked smart contract method

Args: string_value - arguments for smart contract execution in base58 separate by base58

UserData: string_value - data the user sent with the transaction including the data about deployment and initiation of a smart contract

TransactionSignature: string_value - transaction signature in base58

Response

Response Structure

string: transaction_id - transaction number containing new state -> in TransactionExec()

string: commission: - fee for the execution

{

// upon successful transaction execution

"result": "transaction_id"

// upon successful smart contract execution

"result": "string_value"

// fee for the execution of a transaction/smart contract (and all its attachments) 

"fee": "decimal"

}

PreviousContractValidation()NextTransactionPack()

Last updated 1 year ago