Skip to content

Commit

Permalink
Merge pull request #148 from walt-id/feat/support-shimmerEvm
Browse files Browse the repository at this point in the history
support verification and fetching for shimmerEvm
  • Loading branch information
ahmedsmiai authored Sep 6, 2023
2 parents 6f73941 + 08d60e1 commit dd1ddb1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/main/kotlin/id/walt/nftkit/services/NftService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ enum class Chain {
OPAL,
ALGORAND_MAINNET,
ALGORAND_TESTNET,
ALGORAND_BETANET
ALGORAND_BETANET,
SHIMMEREVM
}

enum class EVMChain {
Expand Down Expand Up @@ -405,6 +406,7 @@ object NftService {
fun getAccountNFTs(chain: Chain, account: String): NFTsInfos {
return when{
Common.isEVMChain(chain) -> {

val result = getAccountNFTsByAlchemy(chain, account)
return (NFTsInfos(evmNfts = result))
}
Expand Down Expand Up @@ -462,6 +464,7 @@ object NftService {
Chain.SEPOLIA -> Values.ETHEREUM_TESTNET_SEPOLIA_ALCHEMY_URL
Chain.POLYGON -> Values.POLYGON_MAINNET_ALCHEMY_URL
Chain.MUMBAI -> Values.POLYGON_TESTNET_MUMBAI_ALCHEMY_URL
Chain.SHIMMEREVM -> Values.SHIMMEREVM_TESTNET_BLOCK_EXPLORER_URL
Chain.TEZOS -> throw Exception("Tezos is not supported")
Chain.GHOSTNET -> throw Exception("Ghostnet is not supported")
Chain.TESTNET -> throw Exception("Near testnet is not supported")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ object VerificationService {
return when{
Common.isEVMChain(chain) -> NFTsEvmOwnershipVerification(EVMChain.valueOf(chain.toString()), contractAddress, account, BigInteger(tokenId))
Common.isTezosChain(chain) -> NFTsTezosOwnershipVerification(chain, contractAddress, account, tokenId)

Common.isNearChain(chain) -> NFTsNearOwnershipVerification(NearChain.valueOf(chain.toString()), contractAddress, account, tokenId)

Common.isPolkadotParachain(chain) -> NFTsPolkadotOwnershipVerification(PolkadotParachain.valueOf(chain.toString()), contractAddress, account, tokenId)
Common.isUniqueParachain(chain) -> NFTsUniqueOwnershipVerification(UniqueNetwork.valueOf(chain.toString()), contractAddress, account, tokenId)
Common.isAlgorand(chain) -> NFTsAlgorandOwnershipVerification(AlgorandChain.valueOf(chain.toString()), account, tokenId )
Expand Down Expand Up @@ -112,7 +110,6 @@ object VerificationService {
println(it.value?.content)
println(traitValue)
if (it.trait_type == traitType && it.value?.content.equals(traitValue)) {

return true
}
}
Expand Down Expand Up @@ -148,6 +145,8 @@ object VerificationService {
}
return false
}


else -> {throw Exception("Chain is not supported")}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/id/walt/nftkit/services/WaltIdServices.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data class ChainConfig(val providers: Providers, val privateKey: String)

data class KeysConfig(val keys: Map<String, String>)

data class ApiKeys(val ethereumBlockExplorer: String, val polygonBlockExplorer: String, val alchemy: String, val nftstorage: String, val subscan: String)
data class ApiKeys(val ethereumBlockExplorer: String, val polygonBlockExplorer: String, val shimmerBlockExplorer:String, val alchemy: String, val nftstorage: String, val subscan: String)
data class BlockExplorerScanApiKeyConfig(val apiKeys: ApiKeys)
data class TezosConfig(val tezosBackendServer: String)
data class NearConfig(val nearBackendServer: String)
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/id/walt/nftkit/utilis/Common.kt
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ object Common {
EVMChain.SEPOLIA -> WaltIdServices.loadApiKeys().apiKeys.ethereumBlockExplorer
EVMChain.POLYGON -> WaltIdServices.loadApiKeys().apiKeys.polygonBlockExplorer
EVMChain.MUMBAI -> WaltIdServices.loadApiKeys().apiKeys.polygonBlockExplorer
EVMChain.SHIMMEREVM -> WaltIdServices.loadApiKeys().apiKeys.shimmerBlockExplorer
else -> {throw Exception("$chain is not supported")}
}
}

fun isEVMChain(chain: Chain): Boolean{
val EVMChains= listOf(Chain.ETHEREUM, Chain.POLYGON, Chain.GOERLI, Chain.SEPOLIA, Chain.MUMBAI)
val EVMChains= listOf(Chain.ETHEREUM, Chain.POLYGON, Chain.GOERLI, Chain.SEPOLIA, Chain.MUMBAI, Chain.SHIMMEREVM)
return chain in EVMChains
}

Expand All @@ -134,5 +135,6 @@ object Common {
chain in listOf(Chain.UNIQUE, Chain.OPAL)
fun isAlgorand(chain: Chain): Boolean =
chain in listOf(Chain.ALGORAND_MAINNET, Chain.ALGORAND_TESTNET, Chain.ALGORAND_BETANET)

}

4 changes: 3 additions & 1 deletion src/main/resources/walt-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ providers:
moonbeam: "https://rpc.api.moonbeam.network"
unique: "https://rpc.unique.network"
opal: "https://rpc-opal.unique.network"
shimmerevm: https://json-rpc.evm.testnet.shimmer.network
shimmerevm: "https://json-rpc.evm.testnet.shimmer.network"


#privateKey: "bd4cb3e507f342ee3a710370cef39dda48f17b0a158b0b8dd3f000fbd5b2c2d9"
privateKey: "fe96ea369abac7818a890da598d40e3e4709f1150e3ff35910f77f63484cffba"
#privateKey: "a1fcab9b58015f452c9a89d4cde4807a80111ab27142730bfb96be936e576be1"
#privateKey: "bd4cb3e507f342ee3a710370cef39dda48f17b0a158b0b8dd3f000fbd5b2c2d9"

keys:
0xaf87c5Ce7a1fb6BD5aaDB6dd9C0b8EF51EF1BC31: "bd4cb3e507f342ee3a710370cef39dda48f17b0a158b0b8dd3f000fbd5b2c2d9"
Expand Down Expand Up @@ -61,6 +62,7 @@ apiKeys:
alchemy: "QaHKxjJlUa4DGP8xISztrVcRjQ6DjqII"
nftstorage: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6ZXRocjoweEIwNGU5YzMyNzczNjI1MEQ0QTkzQjZmYThjODUwNzQwQkI0N0YyMmYiLCJpc3MiOiJuZnQtc3RvcmFnZSIsImlhdCI6MTY2ODU1MDg4NjY2MywibmFtZSI6Ik5GVF9URVNUIn0._DnFeEpPXVF4KqIoRRRV2O67HgjGSyYJgpXFhhf-FD4"
subscan: ""
shimmerBlockExplorer: ""



Expand Down

0 comments on commit dd1ddb1

Please sign in to comment.