Skip to content

Commit

Permalink
add opa support to algorand
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperBatata committed Sep 1, 2023
1 parent f3753f7 commit db735a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/kotlin/id/walt/nftkit/opa/DynamicPolicy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ object DynamicPolicy {
nftMetadata.uniqueNftMetadata.attributes?.forEach { data.put(it.name, it.value) }


}else if (nftMetadata.algorandNftMetadata != null){
data.put("name", nftMetadata.algorandNftMetadata.name)
data.put("description", nftMetadata.algorandNftMetadata.description)
data.put("image", nftMetadata.algorandNftMetadata.image)
data.put("unitname", nftMetadata.algorandNftMetadata.unitName)
}
return data
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ object VerificationService {
return DynamicPolicy.doVerify(policy!!.input, policy.policy, policy.policyQuery, nftMetadata)
}

Common.isAlgorand(chain) -> {
val algorandNftmetadata= AlgorandNftService.getNftMetadata(tokenId ,AlgorandChain.valueOf(chain.toString()) )
val nftMetadata = NftMetadataWrapper(null,null,null,null,null , algorandNftmetadata)
return DynamicPolicy.doVerify(policy!!.input, policy.policy, policy.policyQuery, nftMetadata)
}

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

0 comments on commit db735a0

Please sign in to comment.