Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tck/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

## Description

This module contains implementation of the JSON-RPC server for the Java SDK to interpret and process requests from the Test Driver based on the [TCK's](https://github.com/hiero-ledger/hiero-sdk-tck) requirements. Upon receiving a request, it executes the corresponding function or procedure associated with the method specified in the request. Subsequently, it prepares the response in JSON format and sends it back to the test driver.
This module contains implementation of the JSON-RPC server for the Java SDK to interpret and process requests from the
Test Driver based on the [TCK's](https://github.com/hiero-ledger/hiero-sdk-tck) requirements.
Upon receiving a request, it executes the corresponding function or procedure associated with the method specified in
the request.
Subsequently, it prepares the response in JSON format and sends it back to the test driver.

## Setup

Expand All @@ -24,7 +28,8 @@ cd tck
../gradlew bootRun
```

By default, the server will occupy port 80. If you need to specify a different port, modify the port in the `application.yml` file:
By default, the server will occupy port 80.
If you need to specify a different port, modify the port in the `application.yml` file:

```yaml
server:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck;
package org.hiero.tck;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.annotation;
package org.hiero.tck.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.annotation;
package org.hiero.tck.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.annotation;
package org.hiero.tck.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.config;
package org.hiero.tck.config;

import com.thetransactioncompany.jsonrpc2.server.Dispatcher;
import org.springframework.context.annotation.Bean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.config;
package org.hiero.tck.config;

import com.hedera.hashgraph.tck.controller.JRPCInterceptor;
import org.hiero.tck.controller.JRPCInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.controller;
package org.hiero.tck.controller;

import com.hedera.hashgraph.tck.annotation.JSONRPC2Controller;
import com.hedera.hashgraph.tck.util.JSONRPC2ServiceScanner;
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
import com.thetransactioncompany.jsonrpc2.server.Dispatcher;
import jakarta.servlet.http.HttpServletRequest;
import org.hiero.tck.annotation.JSONRPC2Controller;
import org.hiero.tck.util.JSONRPC2ServiceScanner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.controller;
package org.hiero.tck.controller;

import com.thetransactioncompany.jsonrpc2.JSONRPC2ParseException;
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.exception;
package org.hiero.tck.exception;

/**
* Thrown when the server cannot parse the given parameters.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.exception;
package org.hiero.tck.exception;

/**
* Thrown when the server cannot process the request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods;
package org.hiero.tck.methods;

import com.hedera.hashgraph.sdk.PrecheckStatusException;
import com.hedera.hashgraph.sdk.ReceiptStatusException;
import com.hedera.hashgraph.tck.annotation.JSONRPC2Method;
import com.hedera.hashgraph.tck.exception.InvalidJSONRPC2ParamsException;
import com.hedera.hashgraph.tck.exception.InvalidJSONRPC2RequestException;
import com.hedera.hashgraph.tck.methods.JSONRPC2Error.ErrorData;
import com.thetransactioncompany.jsonrpc2.JSONRPC2Error;
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
Expand All @@ -18,6 +14,10 @@
import java.util.HashMap;
import java.util.Map;
import net.minidev.json.JSONObject;
import org.hiero.tck.annotation.JSONRPC2Method;
import org.hiero.tck.exception.InvalidJSONRPC2ParamsException;
import org.hiero.tck.exception.InvalidJSONRPC2RequestException;
import org.hiero.tck.methods.JSONRPC2Error.ErrorData;

/**
* Implements RequestHandler and overrides some of the Dispatcher logic,
Expand Down Expand Up @@ -98,7 +98,7 @@ public JSONRPC2Response process(final JSONRPC2Request req, final MessageContext
errorJsonObject.put("status", errorData.status().toString());
errorJsonObject.put("message", errorData.message());

var hederaError = com.hedera.hashgraph.tck.methods.JSONRPC2Error.HEDERA_ERROR.setData(errorJsonObject);
var hederaError = org.hiero.tck.methods.JSONRPC2Error.HEDERA_ERROR.setData(errorJsonObject);
return new JSONRPC2Response(hederaError, req.getID());
} catch (Exception e) {
// other exceptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods;
package org.hiero.tck.methods;

import com.hedera.hashgraph.sdk.Status;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods;
package org.hiero.tck.methods;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods.sdk;
package org.hiero.tck.methods.sdk;

import com.google.protobuf.InvalidProtocolBufferException;
import com.hedera.hashgraph.sdk.AccountCreateTransaction;
Expand All @@ -10,16 +10,16 @@
import com.hedera.hashgraph.sdk.HbarUnit;
import com.hedera.hashgraph.sdk.Status;
import com.hedera.hashgraph.sdk.TransactionReceipt;
import com.hedera.hashgraph.tck.annotation.JSONRPC2Method;
import com.hedera.hashgraph.tck.annotation.JSONRPC2Service;
import com.hedera.hashgraph.tck.methods.AbstractJSONRPC2Service;
import com.hedera.hashgraph.tck.methods.sdk.param.account.AccountCreateParams;
import com.hedera.hashgraph.tck.methods.sdk.param.account.AccountDeleteParams;
import com.hedera.hashgraph.tck.methods.sdk.param.account.AccountUpdateParams;
import com.hedera.hashgraph.tck.methods.sdk.response.AccountResponse;
import com.hedera.hashgraph.tck.util.KeyUtils;
import java.time.Duration;
import java.time.Instant;
import org.hiero.tck.annotation.JSONRPC2Method;
import org.hiero.tck.annotation.JSONRPC2Service;
import org.hiero.tck.methods.AbstractJSONRPC2Service;
import org.hiero.tck.methods.sdk.param.account.AccountCreateParams;
import org.hiero.tck.methods.sdk.param.account.AccountDeleteParams;
import org.hiero.tck.methods.sdk.param.account.AccountUpdateParams;
import org.hiero.tck.methods.sdk.response.AccountResponse;
import org.hiero.tck.util.KeyUtils;

/**
* AccountService for account related methods
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods.sdk;
package org.hiero.tck.methods.sdk;

import com.google.protobuf.InvalidProtocolBufferException;
import com.hedera.hashgraph.sdk.Key;
import com.hedera.hashgraph.sdk.KeyList;
import com.hedera.hashgraph.sdk.PrivateKey;
import com.hedera.hashgraph.sdk.PublicKey;
import com.hedera.hashgraph.tck.annotation.JSONRPC2Method;
import com.hedera.hashgraph.tck.annotation.JSONRPC2Service;
import com.hedera.hashgraph.tck.exception.InvalidJSONRPC2RequestException;
import com.hedera.hashgraph.tck.methods.AbstractJSONRPC2Service;
import com.hedera.hashgraph.tck.methods.sdk.param.GenerateKeyParams;
import com.hedera.hashgraph.tck.methods.sdk.response.GenerateKeyResponse;
import com.hedera.hashgraph.tck.util.KeyUtils;
import com.hedera.hashgraph.tck.util.KeyUtils.KeyType;
import org.bouncycastle.util.encoders.Hex;
import org.hiero.tck.annotation.JSONRPC2Method;
import org.hiero.tck.annotation.JSONRPC2Service;
import org.hiero.tck.exception.InvalidJSONRPC2RequestException;
import org.hiero.tck.methods.AbstractJSONRPC2Service;
import org.hiero.tck.methods.sdk.param.GenerateKeyParams;
import org.hiero.tck.methods.sdk.response.GenerateKeyResponse;
import org.hiero.tck.util.KeyUtils;
import org.hiero.tck.util.KeyUtils.KeyType;

@JSONRPC2Service
public class KeyService extends AbstractJSONRPC2Service {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods.sdk;
package org.hiero.tck.methods.sdk;

import com.hedera.hashgraph.sdk.AccountId;
import com.hedera.hashgraph.sdk.Client;
import com.hedera.hashgraph.sdk.PrivateKey;
import com.hedera.hashgraph.tck.annotation.JSONRPC2Method;
import com.hedera.hashgraph.tck.annotation.JSONRPC2Service;
import com.hedera.hashgraph.tck.methods.AbstractJSONRPC2Service;
import com.hedera.hashgraph.tck.methods.sdk.param.SetupParams;
import com.hedera.hashgraph.tck.methods.sdk.response.SetupResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import org.hiero.tck.annotation.JSONRPC2Method;
import org.hiero.tck.annotation.JSONRPC2Service;
import org.hiero.tck.methods.AbstractJSONRPC2Service;
import org.hiero.tck.methods.sdk.param.SetupParams;
import org.hiero.tck.methods.sdk.response.SetupResponse;

/**
* SdkService for managing the {@link Client} setup and reset
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods.sdk;
package org.hiero.tck.methods.sdk;

import com.google.protobuf.InvalidProtocolBufferException;
import com.hedera.hashgraph.sdk.*;
import com.hedera.hashgraph.tck.annotation.JSONRPC2Method;
import com.hedera.hashgraph.tck.annotation.JSONRPC2Service;
import com.hedera.hashgraph.tck.methods.AbstractJSONRPC2Service;
import com.hedera.hashgraph.tck.methods.sdk.param.token.*;
import com.hedera.hashgraph.tck.methods.sdk.response.token.*;
import com.hedera.hashgraph.tck.util.KeyUtils;
import java.time.Duration;
import java.util.List;
import java.util.stream.Collectors;
import org.bouncycastle.util.encoders.Hex;
import org.hiero.tck.annotation.JSONRPC2Method;
import org.hiero.tck.annotation.JSONRPC2Service;
import org.hiero.tck.methods.AbstractJSONRPC2Service;
import org.hiero.tck.methods.sdk.param.token.*;
import org.hiero.tck.methods.sdk.response.token.*;
import org.hiero.tck.util.KeyUtils;

/**
* TokenService for token related methods
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods.sdk.param;
package org.hiero.tck.methods.sdk.param;

import com.hedera.hashgraph.sdk.Client;
import com.hedera.hashgraph.sdk.Hbar;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods.sdk.param;
package org.hiero.tck.methods.sdk.param;

import com.hedera.hashgraph.sdk.*;
import com.hedera.hashgraph.tck.methods.JSONRPC2Param;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -12,6 +11,7 @@
import lombok.NoArgsConstructor;
import lombok.NonNull;
import net.minidev.json.JSONObject;
import org.hiero.tck.methods.JSONRPC2Param;

@Getter
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods.sdk.param;
package org.hiero.tck.methods.sdk.param;

import com.hedera.hashgraph.tck.methods.JSONRPC2Param;
import com.hedera.hashgraph.tck.util.KeyUtils.KeyType;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -12,6 +10,8 @@
import lombok.NoArgsConstructor;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
import org.hiero.tck.methods.JSONRPC2Param;
import org.hiero.tck.util.KeyUtils.KeyType;

@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
@Getter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods.sdk.param;
package org.hiero.tck.methods.sdk.param;

import com.hedera.hashgraph.tck.methods.JSONRPC2Param;
import java.util.Map;
import java.util.Optional;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hiero.tck.methods.JSONRPC2Param;

/**
* SetupParams for SDK client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods.sdk.param.account;
package org.hiero.tck.methods.sdk.param.account;

import com.hedera.hashgraph.tck.methods.JSONRPC2Param;
import com.hedera.hashgraph.tck.methods.sdk.param.CommonTransactionParams;
import com.hedera.hashgraph.tck.util.JSONRPCParamParser;
import java.util.Map;
import java.util.Optional;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hiero.tck.methods.JSONRPC2Param;
import org.hiero.tck.methods.sdk.param.CommonTransactionParams;
import org.hiero.tck.util.JSONRPCParamParser;

/**
* AccountCreateParams for account create method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods.sdk.param.account;
package org.hiero.tck.methods.sdk.param.account;

import com.hedera.hashgraph.tck.methods.JSONRPC2Param;
import com.hedera.hashgraph.tck.methods.sdk.param.CommonTransactionParams;
import com.hedera.hashgraph.tck.util.JSONRPCParamParser;
import java.util.Map;
import java.util.Optional;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hiero.tck.methods.JSONRPC2Param;
import org.hiero.tck.methods.sdk.param.CommonTransactionParams;
import org.hiero.tck.util.JSONRPCParamParser;

/**
* AccountDeleteParams for account delete method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.hashgraph.tck.methods.sdk.param.account;
package org.hiero.tck.methods.sdk.param.account;

import com.hedera.hashgraph.tck.methods.JSONRPC2Param;
import com.hedera.hashgraph.tck.methods.sdk.param.CommonTransactionParams;
import com.hedera.hashgraph.tck.util.JSONRPCParamParser;
import java.util.Map;
import java.util.Optional;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hiero.tck.methods.JSONRPC2Param;
import org.hiero.tck.methods.sdk.param.CommonTransactionParams;
import org.hiero.tck.util.JSONRPCParamParser;

/**
* AccountUpdateParams for account update method
Expand Down
Loading