Skip to content

Commit

Permalink
Merge pull request #134 from OpenFuturePlatform/public-api-elaman
Browse files Browse the repository at this point in the history
Upgraded to secure web3j dependency
  • Loading branch information
borbuevbeksultan authored Aug 12, 2024
2 parents 07f5312 + 1e6f428 commit 015739f
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 24 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/open-api-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Prepare Java SDK 11
- name: Prepare Java SDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Cache Gradle packages
uses: actions/cache@v2
Expand Down Expand Up @@ -109,10 +109,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Prepare Java SDK 11
- name: Prepare Java SDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Build project
run: ./gradlew assemble
Expand Down
49 changes: 33 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
plugins {
id 'jacoco'
id 'idea'
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'org.jetbrains.kotlin.kapt' version '1.3.72'
id 'org.jetbrains.kotlin.plugin.spring' version '1.3.72'
id 'org.jetbrains.kotlin.plugin.jpa' version '1.3.72'
id 'org.springframework.boot' version '2.0.4.RELEASE'
id 'org.jetbrains.kotlin.jvm' version '1.8.22'
id 'org.jetbrains.kotlin.kapt' version '1.8.22'
id 'org.jetbrains.kotlin.plugin.spring' version '1.8.22'
id 'org.jetbrains.kotlin.plugin.jpa' version '1.8.22'
id 'org.springframework.boot' version '2.7.18'
id 'com.palantir.git-version' version '0.12.0-rc2'
id 'io.zensoft.versioning' version '1.1.0'
}

apply plugin: 'io.spring.dependency-management'

group = 'io.openfuture.api'
sourceCompatibility = 11
sourceCompatibility = 17
targetCompatibility = 17

repositories {
mavenCentral()
}

ext {
s3Version = "1.11.333"
s3Version = "1.12.261"
}

dependencies {
Expand All @@ -30,6 +31,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-freemarker")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-validation")

// OAuth
implementation("org.springframework.security:spring-security-oauth2-client")
Expand All @@ -41,8 +43,14 @@ dependencies {

// Ethereum
implementation("org.web3j:web3j-spring-boot-starter:1.6.0")
implementation('org.web3j:core:4.5.0')
compile group: 'org.web3j', name: 'web3j-sokt', version: '0.2.1'
implementation('org.web3j:core:4.12.0'){
exclude group : 'org.bouncycastle', module : 'bcprov-jdk18on'
exclude group : 'com.squareup.okhttp3', module : 'okhttp'
}
implementation('org.bouncycastle:bcprov-jdk18on:1.78.1')
implementation('com.squareup.okhttp3:okhttp:4.12.0')

implementation('org.web3j:web3j-sokt:0.4.0')
// AWS
implementation("com.amazonaws:aws-java-sdk-s3:${s3Version}")

Expand All @@ -60,11 +68,20 @@ dependencies {
implementation('commons-io:commons-io:2.8.0')
implementation 'org.apache.commons:commons-lang3:3.6'

implementation('org.apache.httpcomponents:httpclient:4.5.12')
implementation('org.apache.httpcomponents:httpclient:4.5.13')

// Test
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation("org.mockito:mockito-core:2.22.0")

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3'
testImplementation("junit:junit:4.13.1")

}

test {
useJUnitPlatform()
}

sourceSets {
Expand All @@ -79,13 +96,13 @@ sourceSets {
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "11"
jvmTarget = "17"
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "11"
jvmTarget = "17"
}
}

Expand All @@ -111,7 +128,7 @@ jacocoTestReport {
check.dependsOn jacocoTestReport

// Front
processResources.dependsOn(':frontend:assemble')
processResources.dependsOn(':widget:assemble')
processResources.dependsOn(':tracker:assemble')
processResources.dependsOn(':payment-chooser:assemble')
//processResources.dependsOn(':frontend:assemble')
//processResources.dependsOn(':widget:assemble')
//processResources.dependsOn(':tracker:assemble')
//processResources.dependsOn(':payment-chooser:assemble')
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PaymentCompletedDecoder(private val ethereumScaffoldPropertyRepository: Et
val signature = mutableListOf(
object : TypeReference<Uint256>() {},
object : TypeReference<Address>() {},
object : TypeReference<Uint256>() {},
object : TypeReference<Bytes32>() {},
object : TypeReference<Uint256>() {}
)

Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/io/openfuture/api/domain/PageRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ open class PageRequest(

override fun getOffset(): Long = offset

override fun getSort(): Sort = Sort(ASC, "id")
override fun getSort(): Sort = Sort.by(ASC, "id")

override fun first(): Pageable = PageRequest(0, limit)
override fun withPage(pageNumber: Int): Pageable = PageRequest(pageNumber.toLong(), limit)

override fun previous(): PageRequest {
return if (offset == 0L) this else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import org.junit.Test
import org.mockito.BDDMockito.given
import org.mockito.Mock
import java.nio.charset.Charset
import java.util.*
import kotlin.collections.HashMap

internal class V1ScaffoldCompilerTests : UnitTest() {

Expand Down Expand Up @@ -225,7 +227,7 @@ internal class V1ScaffoldCompilerTests : UnitTest() {

private fun createScaffoldContent(): String {
val resource = javaClass.classLoader
.getResource("templates/ethereum/scaffold_${ethereumScaffoldCompiler.getVersion().name.toLowerCase()}.ftl")
.getResource("templates/ethereum/scaffold_${ethereumScaffoldCompiler.getVersion().name.lowercase()}.ftl")
return IOUtils.toString(resource, Charset.defaultCharset())
}

Expand Down

0 comments on commit 015739f

Please sign in to comment.