diff --git a/src/main/kotlin/id/walt/nftkit/rest/NftController.kt b/src/main/kotlin/id/walt/nftkit/rest/NftController.kt index dca0a0e8..b9014693 100644 --- a/src/main/kotlin/id/walt/nftkit/rest/NftController.kt +++ b/src/main/kotlin/id/walt/nftkit/rest/NftController.kt @@ -61,6 +61,7 @@ data class ApproveRequest( object NftController { val TAG1 ="EVM based Blockchain" val TAG2 ="General" + val TAG3 ="ShimmerEVM" fun deploy(ctx: Context) { val deployReq = ctx.bodyAsClass(DeployRequest::class.java) val chain = ctx.pathParam("chain") @@ -465,4 +466,16 @@ object NftController { }.json("200") { } + fun getShimmerNFTinstances(ctx: Context) { + val contractAddress = ctx.pathParam("contractAddress") + val result= NftService.getShimmerNFTinstances(contractAddress) + ctx.json(result) + } + + fun getShimmerNFTinstancesDocs() = document().operation { + it.summary("Get Shimmer NFT instances") + .operationId("Get Shimmer NFT instances").addTagsItem(TAG3) + }.pathParam("contractAddress") { + }.json>("200") { } + } diff --git a/src/main/kotlin/id/walt/nftkit/rest/NftKitApi.kt b/src/main/kotlin/id/walt/nftkit/rest/NftKitApi.kt index 9093b895..f33730f8 100644 --- a/src/main/kotlin/id/walt/nftkit/rest/NftKitApi.kt +++ b/src/main/kotlin/id/walt/nftkit/rest/NftKitApi.kt @@ -210,6 +210,12 @@ object NftKitApi { "chain/{chain}/contract/{contractAddress}/token/{tokenId}/getapproved", documented(NftController.getApprovedDocs(), NftController::getApproved) ) + path("ShimmerEVM"){ + post( + "contract/{contractAddress}/token/instances", + documented(NftController.getShimmerNFTinstancesDocs(), NftController::getShimmerNFTinstances) + ) + } path("tezos"){ post( "chain/{chain}/contract/deploy", diff --git a/src/main/kotlin/id/walt/nftkit/services/NftService.kt b/src/main/kotlin/id/walt/nftkit/services/NftService.kt index 955f1070..21cedaa2 100644 --- a/src/main/kotlin/id/walt/nftkit/services/NftService.kt +++ b/src/main/kotlin/id/walt/nftkit/services/NftService.kt @@ -200,6 +200,60 @@ data class Token( val timeStamp: Long ) +@Serializable +data class Trait_shimmer( + val trait_type: String, + val value: String +) +@Serializable + +data class Metadata( + val attributes: List?=null, + val description: String?=null, + val name: String?=null, +) +@Serializable +data class Owner( + val hash: String, + val implementation_name: String?, + val is_contract: Boolean, + val is_verified: Boolean?, + val name: String?, + val private_tags: List?, + val public_tags: List?, + val watchlist_names: List? +) +@Serializable + +data class Token_info( + val address: String, + val circulating_market_cap: String?, + val decimals: Int?, + val exchange_rate: String?, + val holders: String, + val icon_url: String?, + val name: String, + val symbol: String, + val total_supply: String?, + val type: String +) +@Serializable +data class Item( + val animation_url: String?, + val external_app_url: String?, + val id: String, + val image_url: String?, + val is_unique: Boolean, + val metadata: Metadata, + val owner: Owner, + val token: Token_info +) +@Serializable + +data class shimmerNFT( + val items: List, + val next_page_params: String?, +) /*@Serializable data class NFTsAlchemyResult( @@ -455,6 +509,24 @@ object NftService { } } + + fun getShimmerNFTinstances(smartContractAddress: String) : shimmerNFT{ + + return runBlocking { + val url = "https://explorer.evm.testnet.shimmer.network/api/v2/tokens/${smartContractAddress}/instances" + val nfts = client.get(url) + { + contentType(ContentType.Application.Json) + }.body() + + println("nfts: $nfts") + return@runBlocking nfts + } + + } + + + fun getAccountNFTsByAlchemy(chain: Chain, account: String): List { return runBlocking { val url = when (chain) {