Skip to content

Commit

Permalink
Chore/drop old files (#81)
Browse files Browse the repository at this point in the history
* chore: removed common project and unused files

* chore: delete copy of openapi files

* chore: updated docker files since common is deleted

* fixed /network/list endpoint to work as before

* fixed /coins
  • Loading branch information
Kammerlo authored Mar 8, 2024
1 parent a08ebd2 commit 899803f
Show file tree
Hide file tree
Showing 572 changed files with 1,790 additions and 46,271 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
- name: "Run tests"
run: newman run ./postmanTests/rosetta-java.postman_collection.json -e postmanTests/Rosetta-java-env.postman_environment.json -r cli
- name: "Tear down environment"
run: docker compose --env-file .env.IntegrationTest -f docker-integration-test-environment.yaml down
run: docker compose --env-file .env.IntegrationTest -f docker-integration-test-environment.yaml down
3 changes: 0 additions & 3 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ FROM maven:3.9.6-sapmachine-21 AS build-common
WORKDIR /app
COPY ./pom.xml /app/pom.xml

COPY ./common/pom.xml /app/common/pom.xml
COPY ./common /app/common

COPY ./api/pom.xml /app/api/pom.xml
COPY ./api /app/api

Expand Down
3 changes: 3 additions & 0 deletions api/api.iml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
<exclude-output />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="SonarLintModuleSettings">
<option name="uniqueId" value="b7785111-d3a1-4813-843e-493c59be712b" />
</component>
</module>
23 changes: 13 additions & 10 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.2</version>
</dependency>
<dependency>
<groupId>org.cardanofoundation.rosetta-java</groupId>
<artifactId>cardano-common-rosetta</artifactId>
<version>1.0.7-SNAPSHOT</version>
</dependency>

<dependency>

Expand All @@ -170,6 +165,13 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<artifactId>hibernate-jpamodelgen</artifactId>
<groupId>org.hibernate</groupId>
<version>6.2.0.Final</version>
<scope>provided</scope>
</dependency>


<dependency>
<groupId>org.postgresql</groupId>
Expand Down Expand Up @@ -206,11 +208,6 @@
<artifactId>tweetnacl-java</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.cardanofoundation.rosetta-java</groupId>
<artifactId>cardano-common-rosetta</artifactId>
<version>1.0.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
Expand Down Expand Up @@ -244,6 +241,12 @@
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-utils-hibernate-63</artifactId>
<version>3.7.0</version>
<scope>compile</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


@SpringBootApplication
@EntityScan({"org.cardanofoundation.rosetta.common"})
@EntityScan({"org.cardanofoundation.rosetta.api.model.entity"})
@OpenAPIDefinition(info = @Info(title = "APIs", version = "1.0", description = "Rosetta APIs v1.0"))
public class RosettaApiApplication {
public static void main(String[] args) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import java.util.Optional;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.cardanofoundation.rosetta.api.model.rest.NetworkRequest;
import org.cardanofoundation.rosetta.api.util.RosettaConstants;
import org.openapitools.client.model.NetworkRequest;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.cardanofoundation.rosetta.api.model.rest.AccountBalanceRequest;
import org.cardanofoundation.rosetta.api.model.rest.AccountBalanceResponse;
import org.cardanofoundation.rosetta.api.model.rest.AccountCoinsRequest;
import org.cardanofoundation.rosetta.api.model.rest.AccountCoinsResponse;
import org.openapitools.client.model.AccountBalanceRequest;
import org.openapitools.client.model.AccountBalanceResponse;
import org.openapitools.client.model.AccountCoinsRequest;
import org.openapitools.client.model.AccountCoinsResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.cardanofoundation.rosetta.api.model.rest.AccountBalanceRequest;
import org.cardanofoundation.rosetta.api.model.rest.AccountBalanceResponse;
import org.cardanofoundation.rosetta.api.model.rest.AccountCoinsRequest;
import org.cardanofoundation.rosetta.api.model.rest.AccountCoinsResponse;
import org.cardanofoundation.rosetta.api.service.AccountService;
import org.openapitools.client.model.AccountBalanceRequest;
import org.openapitools.client.model.AccountBalanceResponse;
import org.openapitools.client.model.AccountCoinsRequest;
import org.openapitools.client.model.AccountCoinsResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.cardanofoundation.rosetta.api.model.rest.BlockRequest;
import org.cardanofoundation.rosetta.api.model.rest.BlockResponse;
import org.cardanofoundation.rosetta.api.model.rest.BlockTransactionRequest;
import org.cardanofoundation.rosetta.api.model.rest.BlockTransactionResponse;
import org.openapitools.client.model.BlockRequest;
import org.openapitools.client.model.BlockResponse;
import org.openapitools.client.model.BlockTransactionRequest;
import org.openapitools.client.model.BlockTransactionResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.cardanofoundation.rosetta.api.controller;

import lombok.RequiredArgsConstructor;
import org.cardanofoundation.rosetta.api.model.rest.BlockRequest;
import org.cardanofoundation.rosetta.api.model.rest.BlockResponse;
import org.cardanofoundation.rosetta.api.model.rest.BlockTransactionRequest;
import org.cardanofoundation.rosetta.api.model.rest.BlockTransactionResponse;
import org.cardanofoundation.rosetta.api.service.BlockService;
import org.openapitools.client.model.BlockRequest;
import org.openapitools.client.model.BlockResponse;
import org.openapitools.client.model.BlockTransactionRequest;
import org.openapitools.client.model.BlockTransactionResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.io.IOException;
import java.net.UnknownHostException;

import org.cardanofoundation.rosetta.api.model.rest.*;
import org.openapitools.client.model.*;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
Expand Down Expand Up @@ -162,12 +162,12 @@ ResponseEntity<TransactionIdentifierResponse> constructionSubmit(
ConstructionSubmitRequest constructionSubmitRequest)
throws CborDeserializationException, CborSerializationException, InterruptedException;

@RequestMapping(
method = RequestMethod.POST,
value = "/construction/signingPayloads",
produces = { "application/json;charset=utf-8" },
consumes = { "application/json;charset=utf-8" }
)
ResponseEntity<SigningPayloadsResponse> constructionSigningPayloads(
SigningPayloadsRequest constructionSubmitRequest);
// @RequestMapping(
// method = RequestMethod.POST,
// value = "/construction/signingPayloads",
// produces = { "application/json;charset=utf-8" },
// consumes = { "application/json;charset=utf-8" }
// )
// ResponseEntity<SigningPayloadsResponse> constructionSigningPayloads(
// SigningPayloadsRequest constructionSubmitRequest);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
import com.bloxbean.cardano.client.util.HexUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.iwebpp.crypto.TweetNacl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.cardanofoundation.rosetta.api.model.PublicKey;
import org.cardanofoundation.rosetta.api.model.Signature;
import org.cardanofoundation.rosetta.api.model.SignatureType;
import org.cardanofoundation.rosetta.api.model.rest.*;

import org.cardanofoundation.rosetta.api.service.ConstructionApiService;
import org.openapitools.client.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
Expand All @@ -27,9 +26,9 @@

@Slf4j
@RestController
@RequiredArgsConstructor
public class ConstructionApiDelegateImplementation implements ConstructionApiDelegate {
@Autowired
ConstructionApiService constructionApiService;
private final ConstructionApiService constructionApiService;
@Override
public ResponseEntity<ConstructionCombineResponse> constructionCombine(@RequestBody ConstructionCombineRequest constructionCombineRequest) throws CborException, CborSerializationException, JsonProcessingException {
return ResponseEntity.ok(constructionApiService.constructionCombineService(constructionCombineRequest));
Expand Down Expand Up @@ -74,28 +73,29 @@ public ResponseEntity<TransactionIdentifierResponse> constructionSubmit(@Request
return ResponseEntity.ok(constructionApiService.constructionSubmitService(constructionSubmitRequest));
}

@Override
public ResponseEntity<SigningPayloadsResponse> constructionSigningPayloads(@RequestBody SigningPayloadsRequest signingPayloadsRequest) {
List<Signature> signatures= signingPayloadsRequest.getPayloads().stream().map(signing_payload->{
String privateKey= signingPayloadsRequest.getAddress_privateKey().get(signing_payload.getAccountIdentifier().getAddress());
if(privateKey!=null){
TweetNacl.Signature.KeyPair keyPair = TweetNacl.Signature.keyPair_fromSecretKey(
HexUtil.decodeHexString(privateKey));
TweetNacl.Signature signature = new TweetNacl.Signature(null,
keyPair.getSecretKey());
byte[] result = signature.detached(
HexUtil.decodeHexString(signing_payload.getHexBytes()));
String string = HexUtil.encodeHexString(result);
return new Signature(
signing_payload,
new PublicKey(HexUtil.encodeHexString(keyPair.getPublicKey()), "edwards25519"),
SignatureType.ED25519,
string
);
}
return null;
}).collect(Collectors.toList());
signatures.removeAll(Collections.singleton(null));
return ResponseEntity.ok(new SigningPayloadsResponse(signatures));
}
// @Override
// public ResponseEntity<SigningPayloadsResponse> constructionSigningPayloads(@RequestBody SigningPayloadsRequest signingPayloadsRequest) {
// List<Signature> signatures= signingPayloadsRequest.getPayloads().stream().map(signing_payload->{
// String privateKey= signingPayloadsRequest.getAddress_privateKey().get(signing_payload.getAccountIdentifier().getAddress());
// if(privateKey!=null){
// TweetNacl.Signature.KeyPair keyPair = TweetNacl.Signature.keyPair_fromSecretKey(
// HexUtil.decodeHexString(privateKey));
// TweetNacl.Signature signature = new TweetNacl.Signature(null,
// keyPair.getSecretKey());
// byte[] result = signature.detached(
// HexUtil.decodeHexString(signing_payload.getHexBytes()));
// String string = HexUtil.encodeHexString(result);
// return new Signature(
// signing_payload,
// new PublicKey(HexUtil.encodeHexString(keyPair.getPublicKey()), "edwards25519"),
// SignatureType.ED25519,
// string
// );
// }
//
// return null;
// }).collect(Collectors.toList());
// signatures.removeAll(Collections.singleton(null));
// return ResponseEntity.ok(new SigningPayloadsResponse(signatures));
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import java.io.IOException;
import org.cardanofoundation.rosetta.api.exception.ServerException;
import org.cardanofoundation.rosetta.api.model.rest.MetadataRequest;
import org.cardanofoundation.rosetta.api.model.rest.NetworkListResponse;
import org.cardanofoundation.rosetta.api.model.rest.NetworkOptionsResponse;
import org.cardanofoundation.rosetta.api.model.rest.NetworkRequest;
import org.cardanofoundation.rosetta.api.model.rest.NetworkStatusResponse;
import org.openapitools.client.model.*;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

import java.io.IOException;
import lombok.RequiredArgsConstructor;
import org.cardanofoundation.rosetta.api.model.rest.MetadataRequest;
import org.cardanofoundation.rosetta.api.model.rest.NetworkListResponse;
import org.cardanofoundation.rosetta.api.model.rest.NetworkOptionsResponse;
import org.cardanofoundation.rosetta.api.model.rest.NetworkRequest;
import org.cardanofoundation.rosetta.api.model.rest.NetworkStatusResponse;
import org.cardanofoundation.rosetta.api.service.NetworkService;
import org.openapitools.client.model.*;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -19,7 +15,7 @@ public class NetworkApiDelegateImplementation implements NetworkApiDelegate {
private final NetworkService networkService;

@Override
public ResponseEntity<NetworkListResponse> networkList( @RequestBody MetadataRequest metadataRequest)
public ResponseEntity<NetworkListResponse> networkList(@RequestBody MetadataRequest metadataRequest)
throws IOException {
final NetworkListResponse networkListResponse = networkService.getNetworkList(metadataRequest);
return ResponseEntity.ok(networkListResponse);
Expand Down
Loading

0 comments on commit 899803f

Please sign in to comment.