Skip to content

Commit

Permalink
feat(api): reactor http service
Browse files Browse the repository at this point in the history
  • Loading branch information
halibobo1205 committed Aug 3, 2024
1 parent 7710d37 commit f4b105a
Show file tree
Hide file tree
Showing 219 changed files with 665 additions and 1,233 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.tron.core.services.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.tron.core.services.http.FullNodeHttpApiService;

/**
* Annotation for {@link FullNodeHttpApiService} servlet.
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface FullServlet {

/**
* servlet pathSpec.
*/
String[] value();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.tron.core.services.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.tron.core.services.interfaceOnPBFT.http.PBFT.HttpApiOnPBFTService;

/**
* Annotation for {@link HttpApiOnPBFTService} servlet.
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface PbftServlet {

/**
* servlet pathSpec.
*/
String[] value();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.tron.core.services.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.tron.core.services.http.solidity.SolidityNodeHttpApiService;

/**
* Annotation for {@link SolidityNodeHttpApiService} servlet.
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SolidityNodeServlet {

/**
* servlet pathSpec.
*/
String[] value();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.tron.core.services.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.tron.core.services.interfaceOnSolidity.http.solidity.HttpApiOnSolidityService;

/**
* Annotation for {@link HttpApiOnSolidityService}
* servlet.
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SolidityServlet {

/**
* servlet pathSpec.
*/
String[] value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.AccountContract.AccountPermissionUpdateContract;


@FullServlet("/wallet/accountpermissionupdate")
@Component
@Slf4j(topic = "API")
public class AccountPermissionUpdateServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import org.tron.common.utils.ByteArray;
import org.tron.core.Wallet;
import org.tron.core.capsule.TransactionCapsule;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;

@FullServlet("/wallet/broadcasthex")
@Component
@Slf4j(topic = "API")
public class BroadcastHexServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
import org.tron.common.utils.ByteArray;
import org.tron.core.Wallet;
import org.tron.core.capsule.TransactionCapsule;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;


@FullServlet("/wallet/broadcasttransaction")
@Component
@Slf4j(topic = "API")
public class BroadcastServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.BalanceContract.CancelAllUnfreezeV2Contract;

@FullServlet("/wallet/cancelallunfreezev2")
@Component
@Slf4j(topic = "API")
public class CancelAllUnfreezeV2Servlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.SmartContractOuterClass.ClearABIContract;


@FullServlet("/wallet/clearabi")
@Component
@Slf4j(topic = "API")
public class ClearABIServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.AccountContract.AccountCreateContract;


@FullServlet("/wallet/createaccount")
@Component
@Slf4j(topic = "API")
public class CreateAccountServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.AssetIssueContractOuterClass.AssetIssueContract;


@FullServlet("/wallet/createassetissue")
@Component
@Slf4j(topic = "API")
public class CreateAssetIssueServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
import org.tron.core.Wallet;
import org.tron.core.actuator.TransactionFactory;
import org.tron.core.exception.ContractValidateException;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;


@FullServlet("/wallet/createCommonTransaction")
@Component
@Slf4j(topic = "API")
public class CreateCommonTransactionServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import org.tron.api.GrpcAPI.PrivateShieldedTRC20Parameters;
import org.tron.api.GrpcAPI.ShieldedTRC20Parameters;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;

@FullServlet("/wallet/createshieldedcontractparameters")
@Component
@Slf4j(topic = "API")
public class CreateShieldedContractParametersServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.tron.core.services.http;

import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -9,7 +8,9 @@
import org.tron.api.GrpcAPI.PrivateShieldedTRC20ParametersWithoutAsk;
import org.tron.api.GrpcAPI.ShieldedTRC20Parameters;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;

@FullServlet("/wallet/createshieldedcontractparameterswithoutask")
@Component
@Slf4j(topic = "API")
public class CreateShieldedContractParametersWithoutAskServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import org.tron.api.GrpcAPI.BytesMessage;
import org.tron.api.GrpcAPI.SpendAuthSigParameters;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;


@FullServlet("/wallet/createspendauthsig")
@Component
@Slf4j(topic = "API")
public class CreateSpendAuthSigServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.WitnessContract.WitnessCreateContract;


@FullServlet("/wallet/createwitness")
@Component
@Slf4j(topic = "API")
public class CreateWitnessServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.BalanceContract.DelegateResourceContract;

@FullServlet("/wallet/delegateresource")
@Component
@Slf4j(topic = "API")
public class DelegateResourceServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
import org.springframework.stereotype.Component;
import org.tron.common.utils.ByteArray;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.SmartContractOuterClass.CreateSmartContract;
import org.tron.protos.contract.SmartContractOuterClass.SmartContract;
import org.tron.protos.contract.SmartContractOuterClass.SmartContract.ABI;


@FullServlet("/wallet/deploycontract")
@Component
@Slf4j(topic = "API")
public class DeployContractServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
import org.tron.core.Wallet;
import org.tron.core.capsule.TransactionCapsule;
import org.tron.core.exception.ContractValidateException;
import org.tron.core.services.annotation.FullServlet;
import org.tron.core.services.annotation.SolidityNodeServlet;
import org.tron.protos.Protocol;
import org.tron.protos.contract.SmartContractOuterClass.TriggerSmartContract;

@FullServlet("/wallet/estimateenergy")
@SolidityNodeServlet("/walletsolidity/estimateenergy")
@Component
@Slf4j(topic = "API")
public class EstimateEnergyServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.ExchangeContract.ExchangeCreateContract;


@FullServlet("/wallet/exchangecreate")
@Component
@Slf4j(topic = "API")
public class ExchangeCreateServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.ExchangeContract.ExchangeInjectContract;


@FullServlet("/wallet/exchangeinject")
@Component
@Slf4j(topic = "API")
public class ExchangeInjectServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.ExchangeContract.ExchangeTransactionContract;


@FullServlet("/wallet/exchangetransaction")
@Component
@Slf4j(topic = "API")
public class ExchangeTransactionServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.ExchangeContract.ExchangeWithdrawContract;


@FullServlet("/wallet/exchangewithdraw")
@Component
@Slf4j(topic = "API")
public class ExchangeWithdrawServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.BalanceContract.FreezeBalanceContract;


@FullServlet("/wallet/freezebalance")
@Component
@Slf4j(topic = "API")
public class FreezeBalanceServlet extends RateLimiterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.core.Wallet;
import org.tron.core.services.annotation.FullServlet;
import org.tron.protos.Protocol.Transaction;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.contract.BalanceContract.FreezeBalanceV2Contract;

@FullServlet("/wallet/freezebalancev2")
@Component
@Slf4j(topic = "API")
public class FreezeBalanceV2Servlet extends RateLimiterServlet {
Expand Down
Loading

0 comments on commit f4b105a

Please sign in to comment.