NFT verification with OPA
1. Via REST API
Add new policy
After the development of a policy using Rego, we need to add it to the NFT Kit.
API Doc
Curl call example
curl -X POST "https://nftkit.walt-test.cloud/v2/nftkit/nft/verifier/policies/create"
-H "Content-Type: application/json"
-d "{\"name\":\"string\",\"description\":\"string\",\"input\":{\"additionalProp1\":{},\"additionalProp2\":{},\"additionalProp3\":{}},\"policy\":\"string\",\"policyQuery\":\"string\",\"policyEngine\":\"OPA\"}"Body parameters:
{
"name": "string",
"description": "string",
"input": {
"additionalProp1": {},
"additionalProp2": {},
"additionalProp3": {}
},
"policy": "string",
"policyQuery": "string",
"policyEngine": "OPA"
}name: [string] policy name.description: [string] policy description.input: [string] the input parameter of the open policy engine(OPA).policy: [string] the policy Rego code that will be executed by OPA.policyQuery: [string] the query parameter of the open policy engine(OPA).policyEngine: [string] the engine who will run the policy.
Example:
Rego policy example:
Get policy list
Get the list of added policies.
Apply a policy to a NFT
Execute a policy against a NFT metadata.
API Doc
Curl call example
Path parameters:
chain: [string] chain to work with. EitherTEZOS, GHOSTNET, ETHEREUM, POLYGON, GOERLI, MUMBAI , TESTNET or MAINNET.contract: [string] smart contract addresstokenId: [string] token id of the NFTpolicyName: [string] the name of an already-added policy.
Example:
2. Via code
Setup
You need have OPA in your local machine. Running OPA instructions.
You need to add a path of OPA in the environment variable. When using IntelliJ IDEA:

Code examples
You can run an OPA policy against an NFT metadata from an EVM compatible or Tezos chains.
EVM compatible:
Tezos
Rego Code Example:
Last updated
Was this helpful?
