Skip to content

Commit

Permalink
Merge pull request #2462 from tronprotocol/feature/v3.6.5_addSolidity…
Browse files Browse the repository at this point in the history
…CallConstant

add fullnode solidityapi triggerConstantContract function
  • Loading branch information
Sh11thead authored Sep 10, 2019
2 parents 2439433 + 0a0bbd1 commit 0cf192c
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.tron.core.services.interfaceOnSolidity.http;

import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.services.http.TriggerConstantContractServlet;
import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity;


@Component
@Slf4j(topic = "API")
public class TriggerConstantContractOnSolidityServlet extends TriggerConstantContractServlet {

@Autowired
private WalletOnSolidity walletOnSolidity;

protected void doGet(HttpServletRequest request, HttpServletResponse response) {
walletOnSolidity.futureGet(() -> super.doGet(request, response));
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) {
walletOnSolidity.futureGet(() -> {
try {
super.doPost(request, response);
} catch (IOException e) {
logger.error("TriggerConstantContractOnSolidityServlet Exception", e);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,26 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.tron.common.application.Service;
import org.tron.core.config.args.Args;
import org.tron.core.services.interfaceOnSolidity.http.*;
import org.tron.core.services.interfaceOnSolidity.http.GetAccountByIdOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetAccountOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByIdOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByNameOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListByNameOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetBlockByIdOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLatestNumOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLimitNextOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetBlockByNumOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceAccountIndexOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetExchangeByIdOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetNodeInfoOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetNowBlockOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetPaginatedAssetIssueListOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.GetTransactionCountByBlockNumOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.ListExchangesOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.ListWitnessesOnSolidityServlet;
import org.tron.core.services.interfaceOnSolidity.http.TriggerConstantContractOnSolidityServlet;

@Slf4j(topic = "API")
public class HttpApiOnSolidityService implements Service {
Expand Down Expand Up @@ -64,6 +83,8 @@ public class HttpApiOnSolidityService implements Service {
private GetBlockByLimitNextOnSolidityServlet getBlockByLimitNextOnSolidityServlet;
@Autowired
private GetBlockByLatestNumOnSolidityServlet getBlockByLatestNumOnSolidityServlet;
@Autowired
private TriggerConstantContractOnSolidityServlet triggerConstantContractOnSolidityServlet;

@Override
public void init() {
Expand Down Expand Up @@ -117,6 +138,8 @@ public void start() {
"/walletsolidity/getblockbylimitnext");
context.addServlet(new ServletHolder(getBlockByLatestNumOnSolidityServlet),
"/walletsolidity/getblockbylatestnum");
context.addServlet(new ServletHolder(triggerConstantContractOnSolidityServlet),
"/walletsolidity/triggerconstantcontract");

// only for SolidityNode
context.addServlet(new ServletHolder(getTransactionByIdOnSolidityServlet),
Expand Down

0 comments on commit 0cf192c

Please sign in to comment.