dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
<properties>
<project.libs>${project.basedir}/libs</project.libs>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.6.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/logging-interceptor -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>4.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okio/okio-jvm -->
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio-jvm</artifactId>
<version>3.0.0</version>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.35</version>
</dependency>
<dependency>
<groupId>com.uracle.hecate.client</groupId>
<artifactId>com.uracle.hecate.client</artifactId>
<version>2.0.0</version>
<scope>system</scope>
<systemPath>${project.libs}/hecate-connector-client-v2.0.0.jar</systemPath>
</dependency>
</dependencies>
String bcname = ConnectorApi.getInOperationBcName("http://127.0.0.1:9780");
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
OauthClient response = api.signupClient("Uracle");
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
OauthClient response = api.getClient("Uracle");
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
String token = "bWdmaG13dmhvd2V0bndld25jMHpuemhrbHRnMW9kZXR6Z3EyemRlM256cXluamkzOmVjNzhjM2M3LWEzYWEtM2M3My1hMTNiLTdiY2U5ZjY5OTU1Yw==";
Authorization authorization = new Authorization(token, AuthorizationType.BASIC);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
OauthToken response = api.issueToken();
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
AergoProposal proposal = new AergoConnectorProposal();
proposal.setSmartContract("AmgiRx44b2meBtZoKjPR2WT1Bn5jzU41SqNpH5Xz4obTDYvu5yD"); // 스마트컨트랙트 주소
proposal.setWalletAddress("AmPiwE81hwBB1HzfDMJysGi5nhK4qE6iGiyJyYuyBDUimyMYRxXB"); // 지갑 주소
proposal.setFuncName("selectCandidate"); // 호출 할 스마트 컨트랙트 메소드명
proposal.setRawData(0); // 전달 할 파라미터 값
AergoProposal response = api.queryData(proposal);
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
AergoProposal proposal = new AergoConnectorProposal();
proposal.setSmartContract("AmgiRx44b2meBtZoKjPR2WT1Bn5jzU41SqNpH5Xz4obTDYvu5yD"); // 스마트컨트랙트 주소
proposal.setWalletAddress("AmPiwE81hwBB1HzfDMJysGi5nhK4qE6iGiyJyYuyBDUimyMYRxXB"); // 지갑 주소
proposal.setFuncName("selectCandidate"); // 호출 할 스마트 컨트랙트 메소드명
LinkedTreeMap<String, Object> params = new LinkedTreeMap<String, Object>();
params.put("name", "Uracle");
params.put("age", "31");
params.put("sex", "M");
proposal.setRawData(params); // 전달 할 파라미터 값
AergoProposal response = api.invokeData(proposal);
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
AergoProposal proposal = new AergoConnectorProposal();
proposal.setWalletAddress("AmPiwE81hwBB1HzfDMJysGi5nhK4qE6iGiyJyYuyBDUimyMYRxXB"); // 지갑 주소
LinkedTreeMap<String, Object> params = new LinkedTreeMap<String, Object>();
params.put("name", "Uracle");
params.put("age", "31");
params.put("sex", "M");
proposal.setRawData(params); // 전달 할 파라미터 값
AergoProposal response = api.commitTransaction(proposal);
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
- 데이터 및 트랜잭션 저장 시 Raw Data Hasing
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.onBodyHash(true)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
AergoProposal proposal = new AergoConnectorProposal();
proposal.setWalletAddress("AmPiwE81hwBB1HzfDMJysGi5nhK4qE6iGiyJyYuyBDUimyMYRxXB"); // 지갑 주소
LinkedTreeMap<String, Object> params = new LinkedTreeMap<String, Object>();
params.put("name", "Uracle");
params.put("age", "31");
params.put("sex", "M");
proposal.setRawData(params); // 전달 할 파라미터 값
AergoProposal response = api.commitTransaction(proposal, true);
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
String txHash = "BxMJ6grvU3ZKszrGf5LKvFxhV3LLfKQCArapgQY8yfge";
AergoProposal response = api.getTransactionInfo(txHash);
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
String txHash = "BxMJ6grvU3ZKszrGf5LKvFxhV3LLfKQCArapgQY8yfge";
AergoProposal response = api.getTransactionReceipt(txHash);
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
AergoProposal response = api.issueWallet();
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
AergoProposal response = api.updateWalletNonce("0x5492190824570b65ad4e96c4f7452d0160d74e7c");
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
String blockHash = "2bjYUe8R26CJXbgAsFrSJzSZ7UdeiY28S1LB4q1xXS4h";
AergoProposal response = api.getBlockByBlockHash(blockHash);
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
String blockHeight = "30218782";
AergoProposal response = api.getBlockByBlockHeight(blockHeight);
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
String blockHash = "2bjYUe8R26CJXbgAsFrSJzSZ7UdeiY28S1LB4q1xXS4h";
AergoProposal response = api.getMetaBlockByHash(blockHash);
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
- 블록 메타 정보 조회 By BlockHeight
String token = "eyJraWQiOiI0N2M4NzE1Mi04MGE2LTQzNGUtYmQzZi03MjU1NWQ2NjY1M2EiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJhdWQiOiJ5bW15bnRtNG16Y3RudGF4eWkwem5ncTVsd2UybWd1dG56dmluMml3bmp6a250YzMiLCJuYmYiOjE2NTY0NzY3NTQsInNjb3BlIjpbInByb2ZpbGUiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0Ojk3ODAiLCJleHAiOjE2NTY1NjMxNTQsImlhdCI6MTY1NjQ3Njc1NH0.kfNbILRMIbqkQZLMbbf0wwIja9NRAz-ACdouuSJcNtLmH1XRThFThrtN-RsYXPq7CXDyZKimL3MGbLBbGGTjGR6m66NHEUD-HeCzo9QlDj1okr5YFrsoT1q38DtwGSbW6I6jJNQmqs4deYHO5K-UsLTnSRLMEYfFept9va7v5GaUZpFmb7xfnOwoHI0aMccgbVaV-KvbSg2e_H1HWeZrAwBhcItSN4EKD-gIyHYoujEF6zBlK_X1Q1tUuyBuiIRxuC0W2tMZ0Yqamm88IsKzDkEYcjGHVeETXWQlmBuMDCaJGIWIb_KZlgJh47uQLV_6e_MtWBN36e5Vg7iCeXZfRw";
Authorization authorization = new Authorization(token, AuthorizationType.BEARER);
ConnectorClient client = new ConnectorClient.Builder("http://127.0.0.1:9780")
.authorization(authorization)
.build();
AergoConnectorApi api = new AergoConnectorApi(client);
String blockHeight = "30218782";
AergoProposal response = api.getMetaBlockByHeight(blockHeight);
// 에러체크
if(response.isError()){
return response.getError().getMessage();
}
return response.toJson();
- hecate-connector-client-v2.x.x.jar에서 제공하는 API들을 사용하지않고 담당자(개발자)가 사용하는 REST FUL 인터페이스가 있을 시 AergoConnectorProposal Class를 Json Serialize 또는 Json Deserialize 진행 할 경우 아래의 이미지와 같이 GsonInitializer Class로 진행하여야 한다
Gson gson = GsonInitializer.getInstance().getGson();
// Json Serialize
AergoProposal proposal = new AergoConnectorProposal();
proposal.setSmartContract("ethereum smartcontract");
proposal.setFuncName("hello world");
proposal.setRawData("This is Sample Data!");
String jsonProposal = gson.toJson(proposal);
// Json Deserialize
AergoProposal deProposal = gson.fromJson(jsonProposal, AergoConnectorProposal.class);