Developer's Hub
v1.0
API Reference
Powered By

Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
ContractValidation()
Copy Markdown
Open in ChatGPT
Open in Claude
Summary
Route | Type | Example |
|---|---|---|
/contract/validate | POST |
Description
Validation of a smart contract compatibility
Request
Request Structure
{
// parameters common for all requests для любых запросов
"sourceString": “string value”, // smart contract source code in String Value
}
Request Parameters
String : sourceString - Normalized (without double spaces and double line spacing) smart contract source code
Response
Response Structure
{
//data structure required for smart contract deployment
"deploy":{
"sourceCode":"string_value",
"byteCodeObjects":[
{
"name":"Contract",
"byteCode":[]
},
{},
...
],
“status”: “string value”,
//errors occured during compliation (status == “fail”)
“errors”:”string value”
},
"tokenStandard":int,
"success":bool,
"message":”string_value”
}
Example Code
def Contractvalidate():
url = 'http://apinode.credits.com/api/contract/validate'
headers = {
'Content-type': 'application/json'
, 'Accept': 'application/json'
, 'Content-Encoding': 'utf-8'
}
data = {
"NetworkAlias":"Mainnet"
, "PublicKey":"4WsH74PEaiZkKCm853KTUpMfUzegybsJrf8ZvN2bevac"
, "sourceString":"import com.credits.scapi.v0.BasicStandard;import com.credits.scapi.v0.SmartContract;import java.math.BigDecimal;import java.util.HashMap;import java.util.Map;import java.util.Optional;import static java.math.BigDecimal.ROUND_DOWN;import static java.math.BigDecimal.ZERO"
}
answer = requests.post(url, data=json.dumps(data), headers=headers)
response = answer.json()
print(response)
Contractvalidate()
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Program.Getinfo
{
public class Contractvalidate
{
static readonly HttpClient client = new HttpClient();
public class body
{
public string authKey { get; set; }
public string networkAlias { get; set; }
public string PublicKey { get; set; }
public string sourceString { get; set; }
}
public static async Task Main()
{
try
{
var body = new body
{
authKey = "",
networkAlias = "Mainnet",
PublicKey = "4WsH74PEaiZkKCm853KTUpMfUzegybsJrf8ZvN2bevac",
sourceString = "import com.credits.scapi.v0.BasicStandard;import com.credits.scapi.v0.SmartContract;import java.math.BigDecimal;import java.util.HashMap;import java.util.Map;import java.util.Optional;import static java.math.BigDecimal.ROUND_DOWN;import static java.math.BigDecimal.ZERO"
};
var httpContent = new StringContent(JsonConvert.SerializeObject(body),
Encoding.UTF8, "application/json");
var response = await client.PostAsync("http://apinode.credits.com/api/contract/validate",
httpContent);
Console.WriteLine("RESPONSE=" +
await response.Content.ReadAsStringAsync());
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
}
#include <iostream>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
using namespace utility; // Common utilities like string conversions
using namespace web; // Common features like URIs.
using namespace web::http; // Common HTTP functionality
using namespace web::http::client; // HTTP client features
using namespace concurrency::streams; // Asynchronous streams
using namespace web::json;
int main(int argc, char* argv[])
{
web::json::value json_v;
web::json::value json_return;
json_v[L"authKey"] = web::json::value::string(L"");
json_v[L"NetworkAlias"] = web::json::value::string(L"Mainnet");
json_v[L"PublicKey"] = web::json::value::string(L"4WsH74PEaiZkKCm853KTUpMfUzegybsJrf8ZvN2bevac");
json_v[L"sourceString"] = web::json::value::string(L"import com.credits.scapi.v0.BasicStandard;import com.credits.scapi.v0.SmartContract;import java.math.BigDecimal;import java.util.HashMap;import java.util.Map;import java.util.Optional;import static java.math.BigDecimal.ROUND_DOWN;import static java.math.BigDecimal.ZERO");
http_client client(U("http://apinode.credits.com"));
client.request(web::http::methods::POST, U("/api/contract/validate"), json_v)
.then([](const web::http::http_response& response) {
return response.extract_json();
})
.then([&json_return](const pplx::task<web::json::value>& task) {
try {
json_return = task.get();
}
catch (const web::http::http_exception& e) {
std::cout << "error " << e.what() << std::endl;
}
})
.wait();
std::wcout << json_return.serialize() << std::endl;
return 0;
}
Last updated on
Next to read:
ContractCall()null
Discard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message