ContractValidation()
Summary
Route | Type | Example |
---|---|---|
/contract/validate | POST | http://apinode.credits.com/api/contract/validate |
Description
Validation of a smart contract compatibility
Request
Request Structure
x
{
// 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()