-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from NTF-marketplace/develop
Develop
- Loading branch information
Showing
15 changed files
with
152 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/main/kotlin/com/api/nft/domain/attribute/AttributeRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
package com.api.nft.domain.attribute | ||
|
||
import org.springframework.data.repository.reactive.ReactiveCrudRepository | ||
import reactor.core.publisher.Flux | ||
|
||
interface AttributeRepository : ReactiveCrudRepository<Attribute,Long> { | ||
|
||
fun findAllByNftId(nftId: Long): Flux<Attribute> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/com/api/nft/properties/MarketApiProperties.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.api.nft.properties | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
|
||
@ConfigurationProperties(prefix = "market") | ||
data class MarketApiProperties( | ||
val uri: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/api/nft/service/dto/NftClientResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.api.nft.service.dto | ||
|
||
import com.api.nft.enums.ChainType | ||
import com.api.nft.enums.ContractType | ||
|
||
data class NftClientResponse( | ||
val id: Long, | ||
val tokenId: String, | ||
val tokenAddress: String, | ||
val chainType: ChainType, | ||
val contractType: ContractType, | ||
val nftName: String, | ||
val tokenHash: String, | ||
) |
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/com/api/nft/service/dto/NftDetailResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.api.nft.service.dto | ||
|
||
import com.api.nft.domain.attribute.Attribute | ||
import com.api.nft.domain.metadata.Metadata | ||
import com.api.nft.domain.nft.Nft | ||
import com.api.nft.domain.nft.NftAuction | ||
import com.api.nft.domain.nft.NftListing | ||
import com.api.nft.domain.trasfer.Transfer | ||
|
||
|
||
data class NftDetailResponse( | ||
val nft : Nft, | ||
val metadata : Metadata, | ||
val attributes : List<Attribute>, | ||
val transfers : List<Transfer>, | ||
val listing : NftListing?, | ||
val auction : NftAuction?, | ||
val offers: List<Any>?, | ||
val ledgers: List<Any>? | ||
) |
2 changes: 1 addition & 1 deletion
2
...n/com/api/nft/service/TransferResponse.kt → ...m/api/nft/service/dto/TransferResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.api.nft.service | ||
package com.api.nft.service.dto | ||
|
||
import java.math.BigInteger | ||
|
||
|
39 changes: 39 additions & 0 deletions
39
src/main/kotlin/com/api/nft/service/external/MarketApiService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.api.nft.service.external | ||
|
||
import com.api.nft.properties.MarketApiProperties | ||
import org.springframework.stereotype.Service | ||
import org.springframework.web.reactive.function.client.WebClient | ||
import reactor.core.publisher.Flux | ||
import reactor.core.publisher.Mono | ||
|
||
@Service | ||
class MarketApiService( | ||
marketApiProperties: MarketApiProperties | ||
) { | ||
private val webClient = WebClient.builder() | ||
.baseUrl(marketApiProperties.uri ) | ||
.build() | ||
|
||
//TODO("") | ||
fun getOfferHistory(nftId: Long): Flux<Any> { | ||
return webClient.get() | ||
.uri{ | ||
it.path("/v1/offer/history") | ||
.queryParam("nftId", nftId) | ||
it.build() | ||
} | ||
.retrieve() | ||
.bodyToFlux(Any::class.java) | ||
} | ||
//TODO("") | ||
fun getLedgerHistory(nftId: Long): Flux<Any> { | ||
return webClient.get() | ||
.uri{ | ||
it.path("/v1/orders/history") | ||
.queryParam("nftId", nftId) | ||
it.build() | ||
} | ||
.retrieve() | ||
.bodyToFlux(Any::class.java) | ||
} | ||
} |