Skip to content

Commit

Permalink
Merge pull request #149 from walt-id/fix-unique-metadatas
Browse files Browse the repository at this point in the history
Fix unique metadatas
  • Loading branch information
ahmedsmiai authored Sep 12, 2023
2 parents dd1ddb1 + b6e7d32 commit 7ac1320
Show file tree
Hide file tree
Showing 28 changed files with 708 additions and 720 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/[email protected]
with:
distribution: 'adopt-hotspot'
java-version: '16'
java-version: '17'
- name: Setup cache
uses: actions/cache@v2
with:
Expand All @@ -46,4 +46,4 @@ jobs:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
with:
arguments: build publish --no-daemon
arguments: build publish --no-daemon
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/[email protected]
with:
distribution: 'adopt-hotspot'
java-version: '16'
java-version: '17'
- name: Setup cache
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -109,4 +109,4 @@ jobs:
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
with:
args: apply -n dev -f k8s/deployment-dev_mod.yaml
args: apply -n dev -f k8s/deployment-dev_mod.yaml
74 changes: 38 additions & 36 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.6.10"
kotlin("jvm") version "1.9.10"
// id("org.web3j") version "4.9.0"
kotlin("plugin.serialization") version "1.6.10"
kotlin("plugin.serialization") version "1.9.10"
application
`maven-publish`
id("com.expediagroup.graphql") version "6.4.0"

id("com.expediagroup.graphql") version "6.5.3"
}

group = "id.walt"
Expand All @@ -25,68 +24,65 @@ dependencies {
implementation(kotlin("stdlib"))

// Ethereum: Web3j
implementation ("org.web3j:core:5.0.0")
implementation("org.web3j:core:4.10.3") // 5.0.0 is an invalid old version

// JSON
implementation("com.beust:klaxon:5.6")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.3.2")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.6.0")

// Logging
implementation("org.slf4j:slf4j-api:2.0.0-alpha7")
implementation("org.slf4j:slf4j-simple:2.0.0-alpha7")
implementation("io.github.microutils:kotlin-logging:2.1.21")
implementation("org.slf4j:slf4j-api:2.0.9")
implementation("org.slf4j:slf4j-simple:2.0.9")
implementation("io.github.microutils:kotlin-logging:4.0.0-beta-2")

// Config: Hoplite
implementation("com.sksamuel.hoplite:hoplite-core:2.6.5")
implementation("com.sksamuel.hoplite:hoplite-yaml:2.6.5")
implementation("com.sksamuel.hoplite:hoplite-hikaricp:2.6.5")
implementation("com.sksamuel.hoplite:hoplite-core:2.8.0.RC2")
implementation("com.sksamuel.hoplite:hoplite-yaml:2.8.0.RC2")
implementation("com.sksamuel.hoplite:hoplite-hikaricp:2.8.0.RC2")

// HTTP / Server: Javalin
implementation("io.javalin:javalin-bundle:4.4.0")
implementation("io.javalin:javalin-bundle:4.6.8")

// HTTP / Client: ktor
implementation("io.ktor:ktor-client-core:2.1.3")
implementation("io.ktor:ktor-client-content-negotiation:2.1.3")
implementation("io.ktor:ktor-serialization-kotlinx-json:2.1.3")
implementation("io.ktor:ktor-client-cio:2.1.3")
implementation("io.ktor:ktor-client-logging:2.1.3")
implementation("io.ktor:ktor-client-auth:2.1.3")
implementation("io.ktor:ktor-client-core:2.3.4")
implementation("io.ktor:ktor-client-content-negotiation:2.3.4")
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.4")
implementation("io.ktor:ktor-client-cio:2.3.4")
implementation("io.ktor:ktor-client-logging:2.3.4")
implementation("io.ktor:ktor-client-auth:2.3.4")



// Persistence
implementation("org.jetbrains.exposed:exposed-core:0.38.2")
implementation("org.jetbrains.exposed:exposed-dao:0.38.2")
implementation("org.jetbrains.exposed:exposed-jdbc:0.38.2")
implementation("org.xerial:sqlite-jdbc:3.36.0.3")
/*implementation("org.jetbrains.exposed:exposed-core:0.43.0")
implementation("org.jetbrains.exposed:exposed-dao:0.43.0")
implementation("org.jetbrains.exposed:exposed-jdbc:0.43.0")
implementation("org.xerial:sqlite-jdbc:3.42.0.1")*/

// Testing
//testImplementation(kotlin("test-junit"))
//testImplementation("io.mockk:mockk:1.12.4")

testImplementation("io.kotest:kotest-runner-junit5:5.3.1")
testImplementation("io.kotest:kotest-assertions-core:5.3.1")
testImplementation("io.kotest:kotest-assertions-json:5.3.1")
testImplementation("io.kotest:kotest-runner-junit5:5.7.2")
testImplementation("io.kotest:kotest-assertions-core:5.7.2")
testImplementation("io.kotest:kotest-assertions-json:5.7.2")

//near
implementation ("com.syntifi.near:near-java-api:0.1.0")

// unique
implementation ("network.unique:unique-sdk-jvm:0.0.1")
implementation ("network.unique:unique-sdk-jvm:0.0.3")

// algorand
implementation ("com.algorand:algosdk:2.2.0")

// expediagroup graphql
implementation("com.expediagroup:graphql-kotlin-spring-client:6.4.0")
implementation("com.expediagroup", "graphql-kotlin-client-serialization", "6.4.0")

implementation("com.expediagroup", "graphql-kotlin-spring-client","6.4.0") {
exclude("com.expediagroup", "graphql-kotlin-client-jackson")
}
implementation("com.expediagroup", "graphql-kotlin-client-serialization","6.4.0")

implementation("com.expediagroup", "graphql-kotlin-client-serialization", "6.5.3")

implementation("com.expediagroup", "graphql-kotlin-spring-client","6.5.3") {
exclude("com.expediagroup", "graphql-kotlin-client-jackson")
}
implementation("com.expediagroup", "graphql-kotlin-client-serialization","6.5.3")
}

tasks.withType<Test> {
Expand All @@ -99,8 +95,14 @@ tasks.withType<Test> {
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "16"
kotlinOptions.jvmTarget = "17"
}

application {
Expand Down
6 changes: 0 additions & 6 deletions src/main/kotlin/id/walt/nftkit/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ package id.walt.nftkit
import id.walt.nftkit.rest.NftKitApi

fun main() {

println("\n\n\n")
/* /////////// */
/* /////////// */
/* /////////// */

NftKitApi.start()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package id.walt.nftkit
package id.walt.nftkit.graphql

import kotlin.String

Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/id/walt/nftkit/graphql/TokenOwnersQuery.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package id.walt.nftkit
package id.walt.nftkit.graphql

import com.expediagroup.graphql.client.Generated
import com.expediagroup.graphql.client.types.GraphQLClientRequest
import id.walt.nftkit.tokenownersquery.TokenOwnersDataResponse
import id.walt.nftkit.graphql.tokenownersquery.TokenOwnersDataResponse
import kotlin.String
import kotlin.reflect.KClass
import kotlinx.serialization.Required
Expand All @@ -17,12 +17,12 @@ public class TokenOwnersQuery : GraphQLClientRequest<TokenOwnersQuery.Result> {
@Required
public override var query: String = TOKEN_OWNERS_QUERY

public override fun responseType(): KClass<TokenOwnersQuery.Result> =
TokenOwnersQuery.Result::class
public override fun responseType(): KClass<Result> =
Result::class

@Generated
@Serializable
public data class Result(
public val token_owners: TokenOwnersDataResponse,
public val token_owners: TokenOwnersDataResponse,
)
}
6 changes: 3 additions & 3 deletions src/main/kotlin/id/walt/nftkit/graphql/TokensQuery.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package id.walt.nftkit
package id.walt.nftkit.graphql

import com.expediagroup.graphql.client.Generated
import com.expediagroup.graphql.client.types.GraphQLClientRequest
import id.walt.nftkit.tokensquery.TokenDataResponse
import id.walt.nftkit.graphql.tokensquery.TokenDataResponse
import kotlin.String
import kotlin.reflect.KClass
import kotlinx.serialization.Required
Expand All @@ -17,7 +17,7 @@ public class TokensQuery : GraphQLClientRequest<TokensQuery.Result> {
@Required
public override var query: String = TOKENS_QUERY

public override fun responseType(): KClass<TokensQuery.Result> = TokensQuery.Result::class
public override fun responseType(): KClass<Result> = Result::class

@Generated
@Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package id.walt.nftkit.tokenownersquery
package id.walt.nftkit.graphql.tokenownersquery

import com.expediagroup.graphql.client.Generated
import kotlin.Int
Expand All @@ -8,6 +8,6 @@ import kotlinx.serialization.Serializable
@Generated
@Serializable
public data class TokenOwnersDataResponse(
public val count: Int,
public val `data`: List<tokens_owners>? = null,
public val count: Int,
public val `data`: List<tokens_owners>? = null,
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package id.walt.nftkit.tokenownersquery
package id.walt.nftkit.graphql.tokenownersquery

import com.expediagroup.graphql.client.Generated
import kotlin.Int
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package id.walt.nftkit.tokensquery
package id.walt.nftkit.graphql.tokensquery

import com.expediagroup.graphql.client.Generated
import id.walt.nftkit.graphql.tokensquery.TokenEntity
import kotlin.collections.List
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package id.walt.nftkit.tokensquery
package id.walt.nftkit.graphql.tokensquery

import com.expediagroup.graphql.client.Generated
import id.walt.nftkit.JSONObject
import id.walt.nftkit.graphql.JSONObject
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonPrimitive

@Generated
@Serializable
public data class TokenEntity(
public val image: JSONObject? = null,
public val attributes: JSONObject? = null,
data class TokenEntity(
val image: JSONObject? = null,
val attributes: JSONObject? = null
)
2 changes: 1 addition & 1 deletion src/main/kotlin/id/walt/nftkit/opa/DynamicPolicy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ object DynamicPolicy {

}else if(nftMetadata.uniqueNftMetadata != null){
data.put("image", nftMetadata.uniqueNftMetadata.ipfsCid)
nftMetadata.uniqueNftMetadata.attributes?.forEach { data.put(it.name, it.value) }
nftMetadata.uniqueNftMetadata.attributes?.forEach { data.put(it.name, it.value.toString()) }


}else if (nftMetadata.algorandNftMetadata != null){
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/id/walt/nftkit/opa/OPAPolicyEngine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.beust.klaxon.JsonObject
import com.beust.klaxon.Klaxon
import com.beust.klaxon.Parser
import id.walt.nftkit.common.resolveContentToFile
import mu.KotlinLogging
import mu.two.KotlinLogging
import java.io.File

object OPAPolicyEngine : PolicyEngine {
Expand Down Expand Up @@ -39,7 +39,7 @@ object OPAPolicyEngine : PolicyEngine {
}
}
}


override val type: PolicyEngineType = PolicyEngineType.OPA
}
80 changes: 0 additions & 80 deletions src/main/kotlin/id/walt/nftkit/persistence/SQLDAOTesting.kt

This file was deleted.

Loading

0 comments on commit 7ac1320

Please sign in to comment.