ContractCall()
Summary
| Route | Type | Example |
|---|---|---|
| /contract/contractcall | POST | http://rest.creditsenterprise.com/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}