Developer's Hub
v1.0
GetContractMethods()
Copy Markdown
Open in ChatGPT
Open in Claude
Summary
Route | Type | Example |
|---|---|---|
/contract/getmethods | POST |
Description
Get a list of smart contract methods by its PublicKey.
Request
Request Structure
{
// Parameters common for all requests
"PublicKey": "base58_string",// Smart contract PublicKey in Base58
}
Request Structure
string: PublicKey - smart contract address in Base58
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
{
"methods":[
{
"name":"String", // Name of Method in String Value
"returnType":"String", // Type of return for example void,Double in String Value
"arguments":[
{
"name":"amount", // Name of Argument in String Value
"type":"double", // Type of Argument in String Value
"annotations":[
]
}
],
"annotations":[ // Optional Annotations in String Value
]
},
],
"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
import requests
import json
def GetcontractMethods():
url = 'http://apinode.credits.com/api/contract/getmethods'
headers = {
'Content-type': 'application/json'
, 'Accept': 'application/json'
, 'Content-Encoding': 'utf-8'
}
data = {
"NetworkAlias":"Mainnet"
, "PublicKey":"4WsH74PEaiZkKCm853KTUpMfUzegybsJrf8ZvN2bevac"
}
answer = requests.post(url, data=json.dumps(data), headers=headers)
response = answer.json()
print(response)
GetcontractMethods()
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Program.Getinfo
{
public class GetcontractMethods
{
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 static async Task Main()
{
try
{
var body = new body
{
authKey = "",
networkAlias = "Mainnet",
PublicKey = "4WsH74PEaiZkKCm853KTUpMfUzegybsJrf8ZvN2bevac",
#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");
Last updated on
Credits Protocol
Getting Started
API Reference
Developers Journal
Powered by
